Skip to content

Latest commit

 

History

History
375 lines (246 loc) · 12.7 KB

File metadata and controls

375 lines (246 loc) · 12.7 KB

Groups Users

Use these methods to manage group members.

groups_users_api = client.groups_users

Class Name

GroupsUsersApi

Methods

Get Group Members

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

def get_group_members(self,
                     group_id,
                     direction=None,
                     filter=None,
                     page=None,
                     per_page=None,
                     query=None,
                     sort=None)

Authentication

This endpoint requires oauth2_authorization_code OR oauth2_client_credentials

Parameters

Parameter Type Tags Description
group_id float 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 float Query, Optional The page number of the results to show.
per_page float Query, Optional The number of items to show on each page of results, up to a maximum of 100.
query str 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 body property of this instance returns the response data which is of type List[User].

Example Usage

group_id = 1108

direction = Direction.ASC

page = 1

per_page = 10

query = 'Stop motion'

result = groups_users_api.get_group_members(
    group_id,
    direction=direction,
    page=page,
    per_page=per_page,
    query=query
)

if result.is_success():
    print(result.body)
elif result.is_error():
    print(result.errors)

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.

def get_user_groups_alt_1(self,
                         direction=None,
                         filter=None,
                         page=None,
                         per_page=None,
                         query=None,
                         sort=None)

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 float Query, Optional The page number of the results to show.
per_page float Query, Optional The number of items to show on each page of results, up to a maximum of 100.
query str 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 body property of this instance returns the response data which is of type List[Group].

Example Usage

direction = Direction.ASC

page = 1

per_page = 10

query = 'Stop motion'

result = groups_users_api.get_user_groups_alt_1(
    direction=direction,
    page=page,
    per_page=per_page,
    query=query
)

if result.is_success():
    print(result.body)
elif result.is_error():
    print(result.errors)

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.

def check_if_user_joined_group_alt_1(self,
                                    group_id)

Authentication

This endpoint requires oauth2_authorization_code OR oauth2_client_credentials

Parameters

Parameter Type Tags Description
group_id float 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.

This method returns an ApiResponse instance.

Example Usage

group_id = 1108

result = groups_users_api.check_if_user_joined_group_alt_1(group_id)

if result.is_success():
    print(result.body)
elif result.is_error():
    print(result.errors)

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.

def get_user_groups(self,
                   user_id,
                   direction=None,
                   filter=None,
                   page=None,
                   per_page=None,
                   query=None,
                   sort=None)

Authentication

This endpoint requires oauth2_authorization_code OR oauth2_client_credentials

Parameters

Parameter Type Tags Description
user_id float 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 float Query, Optional The page number of the results to show.
per_page float Query, Optional The number of items to show on each page of results, up to a maximum of 100.
query str 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 body property of this instance returns the response data which is of type List[Group].

Example Usage

user_id = 152184

direction = Direction.ASC

page = 1

per_page = 10

query = 'Stop motion'

result = groups_users_api.get_user_groups(
    user_id,
    direction=direction,
    page=page,
    per_page=per_page,
    query=query
)

if result.is_success():
    print(result.body)
elif result.is_error():
    print(result.errors)

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.

def check_if_user_joined_group(self,
                              group_id,
                              user_id)

Authentication

This endpoint requires oauth2_authorization_code OR oauth2_client_credentials

Parameters

Parameter Type Tags Description
group_id float Template, Required The ID of the group.
user_id float 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.

This method returns an ApiResponse instance.

Example Usage

group_id = 1108

user_id = 152184

result = groups_users_api.check_if_user_joined_group(
    group_id,
    user_id
)

if result.is_success():
    print(result.body)
elif result.is_error():
    print(result.errors)

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