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

Bynder / bynder-java-sdk / 7116807269

06 Dec 2023 03:41PM UTC coverage: 38.562%. First build
7116807269

Pull #114

github

ahongbynder
API-1822 add System.exit(0) to terminate processes
Pull Request #114: API-1822 [BE] [SDK] Implement Sample Files for JAVA-SDK Functionality Testing

0 of 351 new or added lines in 8 files covered. (0.0%)

708 of 1836 relevant lines covered (38.56%)

0.39 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/TagsSample.java
1
package com.bynder.sdk.sample;
2

3
import com.bynder.sdk.configuration.Configuration;
4
import com.bynder.sdk.configuration.HttpConnectionSettings;
5
import com.bynder.sdk.configuration.OAuthSettings;
6
import com.bynder.sdk.model.Tag;
7
import com.bynder.sdk.service.BynderClient;
8
import com.bynder.sdk.service.asset.AssetService;
9
import com.bynder.sdk.service.oauth.OAuthService;
10
import com.bynder.sdk.util.Utils;
11

12
import java.awt.*;
13
import java.io.IOException;
14
import java.net.URI;
15
import java.net.URISyntaxException;
16
import java.net.URL;
17

18
import java.util.*;
19
import java.util.List;
20

21
import org.slf4j.Logger;
22
import org.slf4j.LoggerFactory;
23

NEW
24
public class TagsSample {
×
NEW
25
    private static final Logger LOG = LoggerFactory.getLogger(TagsSample.class);
×
26

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

33
        // Initialize BynderClient with OAuth
NEW
34
        OAuthSettings oAuthSettings = new OAuthSettings(appProperties.getProperty("CLIENT_ID"), appProperties.getProperty("CLIENT_SECRET"), new URI(appProperties.getProperty("REDIRECT_URI")));
×
NEW
35
        BynderClient client = BynderClient.Builder.create(
×
NEW
36
                new Configuration.Builder(new URL(appProperties.getProperty("BASE_URL")))
×
NEW
37
                        .setOAuthSettings(oAuthSettings)
×
NEW
38
                        .setHttpConnectionSettings(new HttpConnectionSettings()).build());
×
NEW
39
        List<String> scopes = Arrays.asList("offline", "asset:read", "asset:write", "asset.usage:read",
×
40
                "asset.usage:write", "collection:read", "collection:write", "meta.assetbank:read",
41
                "meta.assetbank:write", "meta.workflow:read", "current.user:read", "current.profile:read",
42
                "admin.profile:read", "admin.user:read", "admin.user:write", "analytics.api:read");
43

44
        // Initialize OAuthService
NEW
45
        OAuthService oauthService = client.getOAuthService();
×
NEW
46
        URL authorizationUrl = oauthService.getAuthorizationUrl("state example", scopes);
×
47

48
        // Open browser with authorization URL
NEW
49
        Desktop desktop = Desktop.getDesktop();
×
NEW
50
        desktop.browse(authorizationUrl.toURI());
×
51

52
        // Ask for the code returned in the redirect URI
NEW
53
        System.out.println("Insert the code: ");
×
NEW
54
        Scanner scanner = new Scanner(System.in);
×
NEW
55
        String code = scanner.nextLine();
×
NEW
56
        scanner.close();
×
57

58
        // Get the access token
NEW
59
        oauthService.getAccessToken(code, scopes).blockingSingle();
×
60

NEW
61
        AssetService assetService = client.getAssetService();
×
62

63
        // get tags and media count for each tag
NEW
64
        List<Tag> assetTags = assetService.getTags().blockingSingle().body();
×
NEW
65
        if (assetTags != null && !assetTags.isEmpty()) {
×
NEW
66
            for (Tag assetTag : assetTags) {
×
NEW
67
                LOG.info("Asset Tag ID: " + assetTag.getId());
×
NEW
68
                LOG.info("Asset Tag: " + assetTag.getTag());
×
NEW
69
                LOG.info("Asset Tag Media Count: " + assetTag.getMediaCount());
×
NEW
70
            }
×
71
        }
NEW
72
        System.exit(0);
×
NEW
73
    }
×
74
}
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