Skip to content

Latest commit

 

History

History
257 lines (160 loc) · 6.26 KB

File metadata and controls

257 lines (160 loc) · 6.26 KB

Groups Subscriptions

Use these methods to manage group membership.

groups_subscriptions_api = client.groups_subscriptions

Class Name

GroupsSubscriptionsApi

Methods

Leave Group Alt 1

This method removes the authenticated user from the specified group. The authenticated user can't be the owner of the group; assign a new owner through a PATCH request first.

def leave_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

interact

oauth2_client_credentials

interact

Response Type

204: The user was removed from the group.

This method returns an ApiResponse instance.

Example Usage

group_id = 1108

result = groups_subscriptions_api.leave_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
403 The authenticated user can't leave the group. LegacyErrorException
404 Error code 5451: This resource is restricted in your region. ErrorException

Join Group Alt 1

This method adds the authenticated user to the specified group.

def join_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

interact

oauth2_client_credentials

interact

Response Type

204: The user joined the group.

This method returns an ApiResponse instance.

Example Usage

group_id = 1108

result = groups_subscriptions_api.join_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
403 The authenticated user can't join the group. Possible reasons are that the group isn't public or that its privacy setting is members. LegacyErrorException
404 Error code 5451: This resource is restricted in your region. ErrorException

Leave Group

This method removes the authenticated user from the specified group. The authenticated user can't be the owner of the group; assign a new owner through a PATCH request first.

def leave_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

interact

oauth2_client_credentials

interact

Response Type

204: The user was removed from the group.

This method returns an ApiResponse instance.

Example Usage

group_id = 1108

user_id = 152184

result = groups_subscriptions_api.leave_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
403 The authenticated user can't leave the group. LegacyErrorException
404 Error code 5451: This resource is restricted in your region. ErrorException

Join Group

This method adds the authenticated user to the specified group.

def join_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

interact

oauth2_client_credentials

interact

Response Type

204: The user joined the group.

This method returns an ApiResponse instance.

Example Usage

group_id = 1108

user_id = 152184

result = groups_subscriptions_api.join_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
403 The authenticated user can't join the group. Possible reasons are that the group isn't public or that its privacy setting is members. LegacyErrorException
404 Error code 5451: This resource is restricted in your region. ErrorException