Skip to content

Latest commit

 

History

History
375 lines (246 loc) · 12.5 KB

File metadata and controls

375 lines (246 loc) · 12.5 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(group_id,
                      direction: nil,
                      filter: nil,
                      page: nil,
                      per_page: nil,
                      query: nil,
                      sort: nil)

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 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 data property of this instance returns the response data which is of type Array[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.success?
  puts result.data
elsif result.error?
  warn result.errors
end

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_alt1(direction: nil,
                         filter: nil,
                         page: nil,
                         per_page: nil,
                         query: nil,
                         sort: nil)

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 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 data property of this instance returns the response data which is of type Array[Group].

Example Usage

direction = Direction::ASC

page = 1

per_page = 10

query = 'Stop motion'

result = groups_users_api.get_user_groups_alt1(
  direction: direction,
  page: page,
  per_page: per_page,
  query: query
)

if result.success?
  puts result.data
elsif result.error?
  warn result.errors
end

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_alt1(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_alt1(group_id)

if result.success?
  puts result.data
elsif result.error?
  warn result.errors
end

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(user_id,
                    direction: nil,
                    filter: nil,
                    page: nil,
                    per_page: nil,
                    query: nil,
                    sort: nil)

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 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 data property of this instance returns the response data which is of type Array[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.success?
  puts result.data
elsif result.error?
  warn result.errors
end

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(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.success?
  puts result.data
elsif result.error?
  warn result.errors
end

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