• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Bynder / bynder-java-sdk / 7011534548

27 Nov 2023 10:39PM UTC coverage: 45.356%. First build
7011534548

push

github

ahongbynder
API-1822 setup sample files for java sdk api calls

0 of 76 new or added lines in 4 files covered. (0.0%)

708 of 1561 relevant lines covered (45.36%)

0.45 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/com/bynder/sdk/sample/CollectionsSample.java
1
package com.bynder.sdk.sample;
2

3
import com.bynder.sdk.configuration.Configuration;
4
import com.bynder.sdk.model.Collection;
5
import com.bynder.sdk.service.BynderClient;
6
import com.bynder.sdk.service.collection.CollectionService;
7
import com.bynder.sdk.query.collection.CollectionQuery;
8
import com.bynder.sdk.query.collection.CollectionCreateQuery;
9
import com.bynder.sdk.util.Utils;
10

11
import java.io.IOException;
12
import java.net.URISyntaxException;
13
import java.net.URL;
14

15
import java.util.List;
16
import java.util.Map;
17
import java.util.Properties;
18

19
import org.slf4j.Logger;
20
import org.slf4j.LoggerFactory;
21

NEW
22
public class CollectionsSample {
×
NEW
23
    private static final Logger LOG = LoggerFactory.getLogger(CollectionsSample.class);
×
24

25
    public static void main(final String[] args) throws URISyntaxException, IOException {
26
        /**
27
         * Loads app.properties file under src/main/resources
28
         */
NEW
29
        Properties appProperties = Utils.loadConfig("app");
×
30

31

32
        // Initialize BynderClient with a permanent token
NEW
33
        BynderClient client = BynderClient.Builder.create(
×
NEW
34
                new Configuration.Builder(new URL(appProperties.getProperty("BASE_URL")))
×
NEW
35
                        .setPermanentToken(appProperties.getProperty("PERMANENT_TOKEN")).build());
×
36

37
        // Initialize collection service
NEW
38
        CollectionService collectionService = client.getCollectionService();
×
39

40
        // get collections
NEW
41
        CollectionQuery collectionQuery = new CollectionQuery();
×
NEW
42
        List<Collection> collections = collectionService.getCollections(collectionQuery).blockingSingle().body();
×
NEW
43
        for (Collection collectionResult : collections) {
×
NEW
44
            LOG.info(collectionResult.getId());
×
NEW
45
            LOG.info(collectionResult.getName());
×
NEW
46
            LOG.info(collectionResult.getDescription());
×
NEW
47
        }
×
48

49
        // add collection
NEW
50
        CollectionCreateQuery createCollectionQuery = new CollectionCreateQuery("New Collection 1234");
×
NEW
51
        collectionService.createCollection(createCollectionQuery).blockingSingle();
×
52
        //
NEW
53
        List<Collection> updatedCollections = collectionService.getCollections(collectionQuery).blockingSingle().body();
×
NEW
54
        for (Collection collectionResult : collections) {
×
NEW
55
            LOG.info(collectionResult.getId());
×
NEW
56
            LOG.info(collectionResult.getName());
×
NEW
57
            LOG.info(collectionResult.getDescription());
×
NEW
58
        }
×
NEW
59
    }
×
60
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc