use of com.arm.mbed.cloud.sdk.common.listing.ListOptions in project mbed-cloud-sdk-java by ARMmbed.
the class AccountManagement method listGroupApiKeys.
/**
* Lists API keys of a group.
* <p>
* Example:
*
* <pre>
* {@code
* try {
* String groupId = "015f4ac587f500000000000100109294";
* ListOptions options = new ListOptions();
* options.setLimit(10);
*
* ListResponse<ApiKey> apiKeys = accountManagementApi.listGroupApiKeys(groupId, options);
* for (ApiKey apiKey : apiKeys) {
* System.out.println("ApiKey: " + apiKey.getKey());
* }
* } catch (MbedCloudException e) {
* e.printStackTrace();
* }
* }
* </pre>
*
* @param groupId
* The group ID of the group.
* @param options
* filter options.
* @return The list of API keys corresponding to groupId and filter options (One page).
* @throws MbedCloudException
* if a problem occurred during request processing.
*/
@API
@Nullable
public ListResponse<ApiKey> listGroupApiKeys(@NonNull String groupId, @Nullable ListOptions options) throws MbedCloudException {
checkNotNull(groupId, TAG_GROUP_ID);
final ListOptions finalOptions = (options == null) ? new ListOptions() : options;
final String finalGroupId = groupId;
return CloudCaller.call(this, "listGroupApiKeys()", ApiKeyAdapter.getListMapper(), new CloudCall<ApiKeyInfoRespList>() {
@Override
public Call<ApiKeyInfoRespList> call() {
return endpoint.getDeveloper().getApiKeysOfGroup(finalGroupId, finalOptions.getLimit(), finalOptions.getAfter(), finalOptions.getOrder().toString(), finalOptions.encodeInclude());
}
});
}
use of com.arm.mbed.cloud.sdk.common.listing.ListOptions in project mbed-cloud-sdk-java by ARMmbed.
the class AccountManagement method listGroupUsers.
/**
* Lists users of a group.
* <p>
* Example:
*
* <pre>
* {@code
* try {
* String groupId = "015f4ac587f500000000000100109294";
* ListOptions options = new ListOptions();
* options.setLimit(10);
*
* ListResponse<User> users = accountManagementApi.listGroupUsers(groupId, options);
* for (User user : users) {
* System.out.println("User ID: " + user.getId());
* System.out.println("User name: " + user.getFullName());
* }
* } catch (MbedCloudException e) {
* e.printStackTrace();
* }
* }
* </pre>
*
* @param groupId
* The group ID.
* @param options
* filter options.
* @return The list of users corresponding to groupId and filter options (One page).
* @throws MbedCloudException
* if a problem occurred during request processing.
*/
@API
@Nullable
public ListResponse<User> listGroupUsers(@NonNull String groupId, @Nullable ListOptions options) throws MbedCloudException {
checkNotNull(groupId, TAG_GROUP_ID);
final ListOptions finalOptions = (options == null) ? new ListOptions() : options;
final String finalGroupId = groupId;
return CloudCaller.call(this, "listGroupUsers()", UserAdapter.getListMapper(), new CloudCall<UserInfoRespList>() {
@Override
public Call<UserInfoRespList> call() {
return endpoint.getAdmin().getUsersOfGroup(finalGroupId, finalOptions.getLimit(), finalOptions.getAfter(), finalOptions.getOrder().toString(), finalOptions.encodeInclude());
}
});
}
Aggregations