Skip to content

Latest commit

 

History

History
393 lines (271 loc) · 14.3 KB

File metadata and controls

393 lines (271 loc) · 14.3 KB

Groups Users

Use these methods to manage group members.

GroupsUsersApi groupsUsersApi = client.getGroupsUsersApi();

Class Name

GroupsUsersApi

Methods

Get Group Members

This method returns every user who belongs to the specified group.

CompletableFuture<ApiResponse<List<User>>> getGroupMembersAsync(
    final double groupId,
    final Direction direction,
    final Filter2 filter,
    final Double page,
    final Double perPage,
    final String query,
    final Sort8 sort)

Authentication

This endpoint requires oauth2_authorization_code OR oauth2_client_credentials

Parameters

Parameter Type Tags Description
groupId double Template, Required The ID of the group.
direction Direction Query, Optional The sort direction of the results.

Option descriptions:

* asc - Sort the results in ascending order.
* desc - Sort the results in descending order.
filter Filter2 Query, Optional The attribute by which to filter the results.

Option descriptions:

* moderators - Return group moderators.
page Double Query, Optional The page number of the results to show.
perPage Double Query, Optional The number of items to show on each page of results, up to a maximum of 100.
query String Query, Optional The search query to use to filter the results.
sort Sort8 Query, Optional The way to sort the results.

Option descriptions:

* alphabetical - Sort the results alphabetically.
* date - Sort the results by creation date.

Requires scope

oauth2_authorization_code

ai, create, delete, edit, email, interact, private, promo_codes, public, purchase, purchased, scim, stats, upload, video_files

oauth2_client_credentials

ai, create, delete, edit, email, interact, private, promo_codes, public, purchase, purchased, scim, stats, upload, video_files

Response Type

200: The members were returned.

This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type List<User>.

Example Usage

double groupId = 1108D;
Direction direction = Direction.ASC;
Double page = 1D;
Double perPage = 10D;
String query = "Stop motion";

groupsUsersApi.getGroupMembersAsync(groupId, direction, null, page, perPage, query, null).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    Throwable cause = exception.getCause();

    if (cause instanceof LegacyErrorException) {
        LegacyErrorException legacyErrorException = (LegacyErrorException) cause;
        legacyErrorException.printStackTrace();
    } else {
        // fallback for unexpected errors
        exception.printStackTrace();
    }

    return null;
});

Errors

HTTP Status Code Error Description Exception Class
404 * No such group exists.
* Error code 5451: This resource is restricted in your region.
LegacyErrorException

Get User Groups Alt 1

This method returns every group to which the authenticated user belongs.

CompletableFuture<ApiResponse<List<Group>>> getUserGroupsAlt1Async(
    final Direction direction,
    final Filter12 filter,
    final Double page,
    final Double perPage,
    final String query,
    final Sort5 sort)

Authentication

This endpoint requires oauth2_authorization_code OR oauth2_client_credentials

Parameters

Parameter Type Tags Description
direction Direction Query, Optional The sort direction of the results.

Option descriptions:

* asc - Sort the results in ascending order.
* desc - Sort the results in descending order.
filter Filter12 Query, Optional The attribute by which to filter the results.

Option descriptions:

* moderated - Return moderated groups.
page Double Query, Optional The page number of the results to show.
perPage Double Query, Optional The number of items to show on each page of results, up to a maximum of 100.
query String Query, Optional The search query to use to filter the results.
sort Sort5 Query, Optional The way to sort the results.

Option descriptions:

* alphabetical - Sort the results alphabetically.
* date - Sort the results by creation date.
* members - Sort the results by number of members.
* videos - Sort the results by number of videos.

Requires scope

oauth2_authorization_code

ai, create, delete, edit, email, interact, private, promo_codes, public, purchase, purchased, scim, stats, upload, video_files

oauth2_client_credentials

ai, create, delete, edit, email, interact, private, promo_codes, public, purchase, purchased, scim, stats, upload, video_files

Response Type

200: The groups were returned.

This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type List<Group>.

Example Usage

Direction direction = Direction.ASC;
Double page = 1D;
Double perPage = 10D;
String query = "Stop motion";

groupsUsersApi.getUserGroupsAlt1Async(direction, null, page, perPage, query, null).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    Throwable cause = exception.getCause();

    if (cause instanceof ErrorException) {
        ErrorException errorException = (ErrorException) cause;
        errorException.printStackTrace();
    } else {
        // fallback for unexpected errors
        exception.printStackTrace();
    }

    return null;
});

Errors

HTTP Status Code Error Description Exception Class
404 Error code 5451: This resource is restricted in your region. ErrorException

Check if User Joined Group Alt 1

This method determines whether the authenticated user belongs to the specified group.

CompletableFuture<ApiResponse<Void>> checkIfUserJoinedGroupAlt1Async(
    final double groupId)

Authentication

This endpoint requires oauth2_authorization_code OR oauth2_client_credentials

Parameters

Parameter Type Tags Description
groupId double Template, Required The ID of the group.

Requires scope

oauth2_authorization_code

ai, create, delete, edit, email, interact, private, promo_codes, public, purchase, purchased, scim, stats, upload, video_files

oauth2_client_credentials

ai, create, delete, edit, email, interact, private, promo_codes, public, purchase, purchased, scim, stats, upload, video_files

Response Type

204: The user belongs to the group.

void

Example Usage

double groupId = 1108D;

groupsUsersApi.checkIfUserJoinedGroupAlt1Async(groupId).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    Throwable cause = exception.getCause();

    if (cause instanceof LegacyErrorException) {
        LegacyErrorException legacyErrorException = (LegacyErrorException) cause;
        legacyErrorException.printStackTrace();
    } else {
        // fallback for unexpected errors
        exception.printStackTrace();
    }

    return null;
});

Errors

HTTP Status Code Error Description Exception Class
404 * No such group exists.
* The authenticated user isn't a member of the group.
* Error code 5451: This resource is restricted in your region.
LegacyErrorException

Get User Groups

This method returns every group to which the authenticated user belongs.

CompletableFuture<ApiResponse<List<Group>>> getUserGroupsAsync(
    final double userId,
    final Direction direction,
    final Filter12 filter,
    final Double page,
    final Double perPage,
    final String query,
    final Sort5 sort)

Authentication

This endpoint requires oauth2_authorization_code OR oauth2_client_credentials

Parameters

Parameter Type Tags Description
userId double Template, Required The ID of the user.
direction Direction Query, Optional The sort direction of the results.

Option descriptions:

* asc - Sort the results in ascending order.
* desc - Sort the results in descending order.
filter Filter12 Query, Optional The attribute by which to filter the results.

Option descriptions:

* moderated - Return moderated groups.
page Double Query, Optional The page number of the results to show.
perPage Double Query, Optional The number of items to show on each page of results, up to a maximum of 100.
query String Query, Optional The search query to use to filter the results.
sort Sort5 Query, Optional The way to sort the results.

Option descriptions:

* alphabetical - Sort the results alphabetically.
* date - Sort the results by creation date.
* members - Sort the results by number of members.
* videos - Sort the results by number of videos.

Requires scope

oauth2_authorization_code

ai, create, delete, edit, email, interact, private, promo_codes, public, purchase, purchased, scim, stats, upload, video_files

oauth2_client_credentials

ai, create, delete, edit, email, interact, private, promo_codes, public, purchase, purchased, scim, stats, upload, video_files

Response Type

200: The groups were returned.

This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type List<Group>.

Example Usage

double userId = 152184D;
Direction direction = Direction.ASC;
Double page = 1D;
Double perPage = 10D;
String query = "Stop motion";

groupsUsersApi.getUserGroupsAsync(userId, direction, null, page, perPage, query, null).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    Throwable cause = exception.getCause();

    if (cause instanceof ErrorException) {
        ErrorException errorException = (ErrorException) cause;
        errorException.printStackTrace();
    } else {
        // fallback for unexpected errors
        exception.printStackTrace();
    }

    return null;
});

Errors

HTTP Status Code Error Description Exception Class
404 Error code 5451: This resource is restricted in your region. ErrorException

Check if User Joined Group

This method determines whether the authenticated user belongs to the specified group.

CompletableFuture<ApiResponse<Void>> checkIfUserJoinedGroupAsync(
    final double groupId,
    final double userId)

Authentication

This endpoint requires oauth2_authorization_code OR oauth2_client_credentials

Parameters

Parameter Type Tags Description
groupId double Template, Required The ID of the group.
userId double Template, Required The ID of the user.

Requires scope

oauth2_authorization_code

ai, create, delete, edit, email, interact, private, promo_codes, public, purchase, purchased, scim, stats, upload, video_files

oauth2_client_credentials

ai, create, delete, edit, email, interact, private, promo_codes, public, purchase, purchased, scim, stats, upload, video_files

Response Type

204: The user belongs to the group.

void

Example Usage

double groupId = 1108D;
double userId = 152184D;

groupsUsersApi.checkIfUserJoinedGroupAsync(groupId, userId).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    Throwable cause = exception.getCause();

    if (cause instanceof LegacyErrorException) {
        LegacyErrorException legacyErrorException = (LegacyErrorException) cause;
        legacyErrorException.printStackTrace();
    } else {
        // fallback for unexpected errors
        exception.printStackTrace();
    }

    return null;
});

Errors

HTTP Status Code Error Description Exception Class
404 * No such group exists.
* The authenticated user isn't a member of the group.
* Error code 5451: This resource is restricted in your region.
LegacyErrorException