All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.synedge.oss.client.distributiongroup.JerseyDistributionGroupClient.groovy Maven / Gradle / Ivy

Go to download

This client allows you to easily connect to the Synedge API with any language running on the JDK

The newest version!
package com.synedge.oss.client.distributiongroup

import com.synedge.oss.client.DistributionGroupClient
import com.synedge.oss.client.SynedgeClient
import com.synedge.oss.client.authentication.AuthenticatedClient
import groovy.transform.PackageScope

class JerseyDistributionGroupClient extends AuthenticatedClient implements DistributionGroupClient {
    @PackageScope
    JerseyDistributionGroupClient(String username, String password, String endpoint = SynedgeClient.DEFAULT_ENDPOINT) {
        super(username, password, endpoint)
    }

    @Override
    Collection getDistributionGroups(String customerId) {
        def responseJson = signAndGet(client.target(endpoint).path(customerId).path('distributiongroups').request())
        responseJson.collect { it -> convert(it) }
    }

    @Override
    DistributionGroup getDistributionGroup(String customerId, String distributionGroupId) {
        def responseJson = signAndGet(client.target(endpoint).path(customerId).path('distributiongroups/' + distributionGroupId).request())
        convert(responseJson)
    }

    private DistributionGroup convert(def response) {
        new DistributionGroup(id: response.id, name: response.name, domain: response.domain)
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy