Giter VIP home page Giter VIP logo

bring-api-java's Introduction

Unoffical Bring!-Api ๐Ÿ‡จ๐Ÿ‡ญ

Preface/Introduction

Bring! is a pretty popular grocery shopping app developed in Switzerland and mainly used in Germany, Austria and Switzerland.

Sadly Bring! does not offer a public API to interact with and build own applications which make requests to their servers.

Since I needed an API to connect to Bring! servers and perform requests for another project of mine, I build this little unofficial app which lets you interact with the Bring! servers.

Usage

First you need to add the .jar to your classpath.

If your project is managed by maven you can add the .jar the following way (if you have added the .jar to your /resource folder. I'm working on getting it to work with automatic maven download):

<dependency>
	<groupId>com.janetschel</groupId>
   	<artifactId>bring-api</artifactId>
	<version>1.0</version>
	<scope>system</scope>
	<systemPath>${project.basedir}/src/main/resources/bring-api-1.0.jar</systemPath>
</dependency>

After that you can use it like that:

public class Example(){

    @SneakyThrows
    public static void main(String[] args){
        
        // Basic login
        BringApi bringApi = new BringApi("email", "password");
        bringApi.loadLists(); // needs to be called before getLists() or getList("...") can be called
        BringList myList = bringApi.getList("listName");
        
        // Get all products from a list
        List<Product> myProducts = myList.getProducts();
        
        // Add a product to a list
        Product myNewProduct = new Product("productName", "productSpecification");
        myList.addProduct(myNewProduct);
        
        // Delete a product from a list
        myList.removeProduct(myNewProduct);
	
    }
}

Note that you can also log in by using the method

public class Example(){

    @SneakyThrows
    public static void main(String[] args){
       
        // Log in using the login method
        BringApi bringApi = new BringApi();    
        bringApi.login("email", "password");
        
        // ...        
	
    }
}

There is also the option to get all users sharing a list:

public class Example(){

    @SneakyThrows
    public static void main(String[] args){
       
        // ...
        
        // Get users
        List<User> users = myList.getAllUsers();
        
        // ...        
	
    }
}

Please be aware of the exceptions thrown by these methods. In this example I used the @SneakyThrows annotation from lombok so I don't have a massive overhead using try-catch etc.

You have to catch and handle those exceptions by yourself (or annotate your method with at @SneakyThrows if your application allows that without it being too ugly)

Heads-Up

Please note that this is an unofficial API, and I am in no way associated with this company.

It also is not complete so there may be some features I did not implement yet. You can always contribute to this project by simply opening an issue or PR.

Any new ideas? Let me know

Status

โœ… It works with the latest version of Bring!. I will test it with every new version

bring-api-java's People

Contributors

janetschel avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.