Class: WhopSDK::Resources::SocialAccounts
- Inherits:
-
Object
- Object
- WhopSDK::Resources::SocialAccounts
- Defined in:
- lib/whop_sdk/resources/social_accounts.rb,
sig/whop_sdk/resources/social_accounts.rbs
Overview
A Social Account represents an external profile connected to a Whop account or user, such as a Facebook page or Instagram account. Connecting a social account lets Whop run ads under that profile's identity and promote its existing posts.
Use the Social Accounts API to list connected accounts, create a Whop-managed Facebook page, start an OAuth connection, disconnect a social account, and list a connected profile's posts.
Instance Method Summary collapse
-
#connect(platform:, account_id: nil, redirect_url: nil, scopes: nil, request_options: {}) ⇒ WhopSDK::Models::SocialAccountConnectResponse
Some parameter documentations has been truncated, see Models::SocialAccountConnectParams for more details.
-
#create(platform:, account_id: nil, request_options: {}) ⇒ WhopSDK::Models::SocialAccount
Some parameter documentations has been truncated, see Models::SocialAccountCreateParams for more details.
-
#delete(id, account_id: nil, user_id: nil, request_options: {}) ⇒ Boolean
Some parameter documentations has been truncated, see Models::SocialAccountDeleteParams for more details.
-
#initialize(client:) ⇒ SocialAccounts
constructor
private
A new instance of SocialAccounts.
-
#list(account_id: nil, after: nil, before: nil, direction: nil, first: nil, last: nil, order: nil, platform: nil, scopes: nil, user_id: nil, verified: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::SocialAccount>
Some parameter documentations has been truncated, see Models::SocialAccountListParams for more details.
-
#posts(id, account_id:, after: nil, first: nil, post_id: nil, request_options: {}) ⇒ WhopSDK::Models::SocialAccountPostsResponse
Lists the existing posts of a connected Facebook page or Instagram account.
Constructor Details
#initialize(client:) ⇒ SocialAccounts
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of SocialAccounts.
187 188 189 |
# File 'lib/whop_sdk/resources/social_accounts.rb', line 187 def initialize(client:) @client = client end |
Instance Method Details
#connect(platform:, account_id: nil, redirect_url: nil, scopes: nil, request_options: {}) ⇒ WhopSDK::Models::SocialAccountConnectResponse
Some parameter documentations has been truncated, see Models::SocialAccountConnectParams for more details.
Starts an OAuth connection flow and returns an authorize_url where the user can connect a social account.
account-scop
142 143 144 145 146 147 148 149 150 151 |
# File 'lib/whop_sdk/resources/social_accounts.rb', line 142 def connect(params) parsed, = WhopSDK::SocialAccountConnectParams.dump_request(params) @client.request( method: :post, path: "social_accounts/connect", body: parsed, model: WhopSDK::Models::SocialAccountConnectResponse, options: ) end |
#create(platform:, account_id: nil, request_options: {}) ⇒ WhopSDK::Models::SocialAccount
Some parameter documentations has been truncated, see Models::SocialAccountCreateParams for more details.
Creates or returns a Whop-managed Facebook page for an account.
account-scope
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/whop_sdk/resources/social_accounts.rb', line 31 def create(params) parsed, = WhopSDK::SocialAccountCreateParams.dump_request(params) @client.request( method: :post, path: "social_accounts", body: parsed, model: WhopSDK::SocialAccount, options: ) end |
#delete(id, account_id: nil, user_id: nil, request_options: {}) ⇒ Boolean
Some parameter documentations has been truncated, see Models::SocialAccountDeleteParams for more details.
Disconnects a social account from an account or user without deleting the underlying platform account.
108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/whop_sdk/resources/social_accounts.rb', line 108 def delete(id, params = {}) parsed, = WhopSDK::SocialAccountDeleteParams.dump_request(params) query = WhopSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :delete, path: ["social_accounts/%1$s", id], query: query, model: WhopSDK::Internal::Type::Boolean, options: ) end |
#list(account_id: nil, after: nil, before: nil, direction: nil, first: nil, last: nil, order: nil, platform: nil, scopes: nil, user_id: nil, verified: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::SocialAccount>
Some parameter documentations has been truncated, see Models::SocialAccountListParams for more details.
Lists the social accounts linked to an account or user.
76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/whop_sdk/resources/social_accounts.rb', line 76 def list(params = {}) parsed, = WhopSDK::SocialAccountListParams.dump_request(params) query = WhopSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "social_accounts", query: query, page: WhopSDK::Internal::CursorPage, model: WhopSDK::SocialAccount, options: ) end |
#posts(id, account_id:, after: nil, first: nil, post_id: nil, request_options: {}) ⇒ WhopSDK::Models::SocialAccountPostsResponse
Lists the existing posts of a connected Facebook page or Instagram account.
172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/whop_sdk/resources/social_accounts.rb', line 172 def posts(id, params) parsed, = WhopSDK::SocialAccountPostsParams.dump_request(params) query = WhopSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["social_accounts/%1$s/posts", id], query: query, model: WhopSDK::Models::SocialAccountPostsResponse, options: ) end |