post-for-me 0.1.0.pre.alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.ignore +2 -0
- data/CHANGELOG.md +32 -0
- data/README.md +265 -0
- data/SECURITY.md +27 -0
- data/lib/post_for_me/client.rb +86 -0
- data/lib/post_for_me/errors.rb +214 -0
- data/lib/post_for_me/file_part.rb +55 -0
- data/lib/post_for_me/internal/transport/base_client.rb +563 -0
- data/lib/post_for_me/internal/transport/pooled_net_requester.rb +209 -0
- data/lib/post_for_me/internal/type/array_of.rb +168 -0
- data/lib/post_for_me/internal/type/base_model.rb +537 -0
- data/lib/post_for_me/internal/type/base_page.rb +55 -0
- data/lib/post_for_me/internal/type/boolean.rb +77 -0
- data/lib/post_for_me/internal/type/converter.rb +327 -0
- data/lib/post_for_me/internal/type/enum.rb +131 -0
- data/lib/post_for_me/internal/type/file_input.rb +108 -0
- data/lib/post_for_me/internal/type/hash_of.rb +188 -0
- data/lib/post_for_me/internal/type/request_parameters.rb +42 -0
- data/lib/post_for_me/internal/type/union.rb +237 -0
- data/lib/post_for_me/internal/type/unknown.rb +81 -0
- data/lib/post_for_me/internal/util.rb +914 -0
- data/lib/post_for_me/internal.rb +20 -0
- data/lib/post_for_me/models/create_social_post.rb +558 -0
- data/lib/post_for_me/models/media_create_upload_url_params.rb +14 -0
- data/lib/post_for_me/models/media_create_upload_url_response.rb +25 -0
- data/lib/post_for_me/models/social_account.rb +110 -0
- data/lib/post_for_me/models/social_account_create_auth_url_params.rb +109 -0
- data/lib/post_for_me/models/social_account_create_auth_url_response.rb +25 -0
- data/lib/post_for_me/models/social_account_disconnect_params.rb +14 -0
- data/lib/post_for_me/models/social_account_disconnect_response.rb +109 -0
- data/lib/post_for_me/models/social_account_list_params.rb +69 -0
- data/lib/post_for_me/models/social_account_list_response.rb +58 -0
- data/lib/post_for_me/models/social_account_retrieve_params.rb +14 -0
- data/lib/post_for_me/models/social_account_update_params.rb +30 -0
- data/lib/post_for_me/models/social_post.rb +114 -0
- data/lib/post_for_me/models/social_post_create_params.rb +14 -0
- data/lib/post_for_me/models/social_post_delete_params.rb +14 -0
- data/lib/post_for_me/models/social_post_delete_response.rb +17 -0
- data/lib/post_for_me/models/social_post_list_params.rb +87 -0
- data/lib/post_for_me/models/social_post_list_response.rb +58 -0
- data/lib/post_for_me/models/social_post_result.rb +87 -0
- data/lib/post_for_me/models/social_post_result_list_params.rb +51 -0
- data/lib/post_for_me/models/social_post_result_list_response.rb +58 -0
- data/lib/post_for_me/models/social_post_result_retrieve_params.rb +14 -0
- data/lib/post_for_me/models/social_post_retrieve_params.rb +14 -0
- data/lib/post_for_me/models/social_post_update_params.rb +14 -0
- data/lib/post_for_me/models/tiktok_configuration.rb +88 -0
- data/lib/post_for_me/models.rb +77 -0
- data/lib/post_for_me/request_options.rb +77 -0
- data/lib/post_for_me/resources/media.rb +94 -0
- data/lib/post_for_me/resources/social_accounts.rb +143 -0
- data/lib/post_for_me/resources/social_post_results.rb +65 -0
- data/lib/post_for_me/resources/social_posts.rb +164 -0
- data/lib/post_for_me/version.rb +5 -0
- data/lib/post_for_me.rb +82 -0
- data/manifest.yaml +15 -0
- data/rbi/post_for_me/client.rbi +58 -0
- data/rbi/post_for_me/errors.rbi +178 -0
- data/rbi/post_for_me/file_part.rbi +37 -0
- data/rbi/post_for_me/internal/transport/base_client.rbi +294 -0
- data/rbi/post_for_me/internal/transport/pooled_net_requester.rbi +79 -0
- data/rbi/post_for_me/internal/type/array_of.rbi +104 -0
- data/rbi/post_for_me/internal/type/base_model.rbi +304 -0
- data/rbi/post_for_me/internal/type/base_page.rbi +42 -0
- data/rbi/post_for_me/internal/type/boolean.rbi +58 -0
- data/rbi/post_for_me/internal/type/converter.rbi +216 -0
- data/rbi/post_for_me/internal/type/enum.rbi +82 -0
- data/rbi/post_for_me/internal/type/file_input.rbi +59 -0
- data/rbi/post_for_me/internal/type/hash_of.rbi +104 -0
- data/rbi/post_for_me/internal/type/request_parameters.rbi +29 -0
- data/rbi/post_for_me/internal/type/union.rbi +128 -0
- data/rbi/post_for_me/internal/type/unknown.rbi +58 -0
- data/rbi/post_for_me/internal/util.rbi +487 -0
- data/rbi/post_for_me/internal.rbi +18 -0
- data/rbi/post_for_me/models/create_social_post.rbi +1128 -0
- data/rbi/post_for_me/models/media_create_upload_url_params.rbi +30 -0
- data/rbi/post_for_me/models/media_create_upload_url_response.rbi +38 -0
- data/rbi/post_for_me/models/social_account.rbi +139 -0
- data/rbi/post_for_me/models/social_account_create_auth_url_params.rbi +260 -0
- data/rbi/post_for_me/models/social_account_create_auth_url_response.rbi +36 -0
- data/rbi/post_for_me/models/social_account_disconnect_params.rbi +30 -0
- data/rbi/post_for_me/models/social_account_disconnect_response.rbi +156 -0
- data/rbi/post_for_me/models/social_account_list_params.rbi +112 -0
- data/rbi/post_for_me/models/social_account_list_response.rbi +107 -0
- data/rbi/post_for_me/models/social_account_retrieve_params.rbi +30 -0
- data/rbi/post_for_me/models/social_account_update_params.rbi +60 -0
- data/rbi/post_for_me/models/social_post.rbi +142 -0
- data/rbi/post_for_me/models/social_post_create_params.rbi +27 -0
- data/rbi/post_for_me/models/social_post_delete_params.rbi +27 -0
- data/rbi/post_for_me/models/social_post_delete_response.rbi +30 -0
- data/rbi/post_for_me/models/social_post_list_params.rbi +207 -0
- data/rbi/post_for_me/models/social_post_list_response.rbi +107 -0
- data/rbi/post_for_me/models/social_post_result.rbi +130 -0
- data/rbi/post_for_me/models/social_post_result_list_params.rbi +86 -0
- data/rbi/post_for_me/models/social_post_result_list_response.rbi +107 -0
- data/rbi/post_for_me/models/social_post_result_retrieve_params.rbi +30 -0
- data/rbi/post_for_me/models/social_post_retrieve_params.rbi +30 -0
- data/rbi/post_for_me/models/social_post_update_params.rbi +27 -0
- data/rbi/post_for_me/models/tiktok_configuration.rbi +109 -0
- data/rbi/post_for_me/models.rbi +42 -0
- data/rbi/post_for_me/request_options.rbi +59 -0
- data/rbi/post_for_me/resources/media.rbi +83 -0
- data/rbi/post_for_me/resources/social_accounts.rbi +112 -0
- data/rbi/post_for_me/resources/social_post_results.rbi +51 -0
- data/rbi/post_for_me/resources/social_posts.rbi +160 -0
- data/rbi/post_for_me/version.rbi +5 -0
- data/sig/post_for_me/client.rbs +32 -0
- data/sig/post_for_me/errors.rbs +110 -0
- data/sig/post_for_me/file_part.rbs +21 -0
- data/sig/post_for_me/internal/transport/base_client.rbs +131 -0
- data/sig/post_for_me/internal/transport/pooled_net_requester.rbs +45 -0
- data/sig/post_for_me/internal/type/array_of.rbs +48 -0
- data/sig/post_for_me/internal/type/base_model.rbs +102 -0
- data/sig/post_for_me/internal/type/base_page.rbs +24 -0
- data/sig/post_for_me/internal/type/boolean.rbs +26 -0
- data/sig/post_for_me/internal/type/converter.rbs +79 -0
- data/sig/post_for_me/internal/type/enum.rbs +32 -0
- data/sig/post_for_me/internal/type/file_input.rbs +25 -0
- data/sig/post_for_me/internal/type/hash_of.rbs +48 -0
- data/sig/post_for_me/internal/type/request_parameters.rbs +19 -0
- data/sig/post_for_me/internal/type/union.rbs +52 -0
- data/sig/post_for_me/internal/type/unknown.rbs +26 -0
- data/sig/post_for_me/internal/util.rbs +185 -0
- data/sig/post_for_me/internal.rbs +9 -0
- data/sig/post_for_me/models/create_social_post.rbs +398 -0
- data/sig/post_for_me/models/media_create_upload_url_params.rbs +15 -0
- data/sig/post_for_me/models/media_create_upload_url_response.rbs +16 -0
- data/sig/post_for_me/models/social_account.rbs +81 -0
- data/sig/post_for_me/models/social_account_create_auth_url_params.rbs +105 -0
- data/sig/post_for_me/models/social_account_create_auth_url_response.rbs +16 -0
- data/sig/post_for_me/models/social_account_disconnect_params.rbs +15 -0
- data/sig/post_for_me/models/social_account_disconnect_response.rbs +80 -0
- data/sig/post_for_me/models/social_account_list_params.rbs +63 -0
- data/sig/post_for_me/models/social_account_list_response.rbs +51 -0
- data/sig/post_for_me/models/social_account_retrieve_params.rbs +15 -0
- data/sig/post_for_me/models/social_account_update_params.rbs +32 -0
- data/sig/post_for_me/models/social_post.rbs +83 -0
- data/sig/post_for_me/models/social_post_create_params.rbs +15 -0
- data/sig/post_for_me/models/social_post_delete_params.rbs +15 -0
- data/sig/post_for_me/models/social_post_delete_response.rbs +13 -0
- data/sig/post_for_me/models/social_post_list_params.rbs +100 -0
- data/sig/post_for_me/models/social_post_list_response.rbs +51 -0
- data/sig/post_for_me/models/social_post_result.rbs +66 -0
- data/sig/post_for_me/models/social_post_result_list_params.rbs +49 -0
- data/sig/post_for_me/models/social_post_result_list_response.rbs +51 -0
- data/sig/post_for_me/models/social_post_result_retrieve_params.rbs +15 -0
- data/sig/post_for_me/models/social_post_retrieve_params.rbs +15 -0
- data/sig/post_for_me/models/social_post_update_params.rbs +15 -0
- data/sig/post_for_me/models/tiktok_configuration.rbs +65 -0
- data/sig/post_for_me/models.rbs +37 -0
- data/sig/post_for_me/request_options.rbs +34 -0
- data/sig/post_for_me/resources/media.rbs +11 -0
- data/sig/post_for_me/resources/social_accounts.rbs +40 -0
- data/sig/post_for_me/resources/social_post_results.rbs +20 -0
- data/sig/post_for_me/resources/social_posts.rbs +51 -0
- data/sig/post_for_me/version.rbs +3 -0
- metadata +215 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PostForMe
|
|
4
|
+
module Resources
|
|
5
|
+
class Media
|
|
6
|
+
# To upload media to attach to your post, make a `POST` request to the
|
|
7
|
+
# `/media/create-upload-url` endpoint.
|
|
8
|
+
#
|
|
9
|
+
# You'll receive the public url of your media item (which can be used when making
|
|
10
|
+
# a post) and will include an `upload_url` which is a signed URL of the storage
|
|
11
|
+
# location for uploading your file to.
|
|
12
|
+
#
|
|
13
|
+
# This URL is unique and publicly signed for a short time, so make sure to upload
|
|
14
|
+
# your files in a timely manner.
|
|
15
|
+
#
|
|
16
|
+
# **Example flow using JavaScript and the Fetch API:**
|
|
17
|
+
#
|
|
18
|
+
# **Request an upload URL**
|
|
19
|
+
#
|
|
20
|
+
# ```js
|
|
21
|
+
# // Step 1: Request an upload URL from your API
|
|
22
|
+
# const response = await fetch(
|
|
23
|
+
# "https://api.postforme.dev/v1/media/create-upload-url",
|
|
24
|
+
# {
|
|
25
|
+
# method: "POST",
|
|
26
|
+
# headers: {
|
|
27
|
+
# "Content-Type": "application/json",
|
|
28
|
+
# },
|
|
29
|
+
# }
|
|
30
|
+
# );
|
|
31
|
+
#
|
|
32
|
+
# const { media_url, upload_url } = await response.json();
|
|
33
|
+
# ```
|
|
34
|
+
#
|
|
35
|
+
# **Upload your file to the signed URL**
|
|
36
|
+
#
|
|
37
|
+
# ```js
|
|
38
|
+
# // Step 2: Upload your file to the signed URL
|
|
39
|
+
# const file = /* your File or Blob object, e.g., from an <input type="file"> */;
|
|
40
|
+
# await fetch(upload_url, {
|
|
41
|
+
# method: 'PUT',
|
|
42
|
+
# headers: {
|
|
43
|
+
# 'Content-Type': 'image/jpeg'
|
|
44
|
+
# },
|
|
45
|
+
# body: file
|
|
46
|
+
# });
|
|
47
|
+
# ```
|
|
48
|
+
#
|
|
49
|
+
# **Use the `media_url` when creating your post**
|
|
50
|
+
#
|
|
51
|
+
# ```js
|
|
52
|
+
# // Step 3: Use the `media_url` when creating your post
|
|
53
|
+
# const response = await fetch('https://api.postforme.dev/v1/social-posts', {
|
|
54
|
+
# method: 'POST',
|
|
55
|
+
# headers: {
|
|
56
|
+
# 'Content-Type': 'application/json'
|
|
57
|
+
# },
|
|
58
|
+
# body: JSON.stringify({
|
|
59
|
+
# social_accounts: ['spc_...', ...],
|
|
60
|
+
# caption: 'My caption',
|
|
61
|
+
# media: [
|
|
62
|
+
# {
|
|
63
|
+
# url: media_url
|
|
64
|
+
# }
|
|
65
|
+
# ]
|
|
66
|
+
# })
|
|
67
|
+
# });
|
|
68
|
+
# ```
|
|
69
|
+
#
|
|
70
|
+
# @overload create_upload_url(request_options: {})
|
|
71
|
+
#
|
|
72
|
+
# @param request_options [PostForMe::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
73
|
+
#
|
|
74
|
+
# @return [PostForMe::Models::MediaCreateUploadURLResponse]
|
|
75
|
+
#
|
|
76
|
+
# @see PostForMe::Models::MediaCreateUploadURLParams
|
|
77
|
+
def create_upload_url(params = {})
|
|
78
|
+
@client.request(
|
|
79
|
+
method: :post,
|
|
80
|
+
path: "v1/media/create-upload-url",
|
|
81
|
+
model: PostForMe::Models::MediaCreateUploadURLResponse,
|
|
82
|
+
options: params[:request_options]
|
|
83
|
+
)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# @api private
|
|
87
|
+
#
|
|
88
|
+
# @param client [PostForMe::Client]
|
|
89
|
+
def initialize(client:)
|
|
90
|
+
@client = client
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PostForMe
|
|
4
|
+
module Resources
|
|
5
|
+
class SocialAccounts
|
|
6
|
+
# Get social account by ID
|
|
7
|
+
#
|
|
8
|
+
# @overload retrieve(id, request_options: {})
|
|
9
|
+
#
|
|
10
|
+
# @param id [String] Social Account ID
|
|
11
|
+
#
|
|
12
|
+
# @param request_options [PostForMe::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
13
|
+
#
|
|
14
|
+
# @return [PostForMe::Models::SocialAccount]
|
|
15
|
+
#
|
|
16
|
+
# @see PostForMe::Models::SocialAccountRetrieveParams
|
|
17
|
+
def retrieve(id, params = {})
|
|
18
|
+
@client.request(
|
|
19
|
+
method: :get,
|
|
20
|
+
path: ["v1/social-accounts/%1$s", id],
|
|
21
|
+
model: PostForMe::SocialAccount,
|
|
22
|
+
options: params[:request_options]
|
|
23
|
+
)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Update social account
|
|
27
|
+
#
|
|
28
|
+
# @overload update(id, external_id: nil, username: nil, request_options: {})
|
|
29
|
+
#
|
|
30
|
+
# @param id [String] Social Account ID
|
|
31
|
+
#
|
|
32
|
+
# @param external_id [String] The platform's external id of the social account
|
|
33
|
+
#
|
|
34
|
+
# @param username [String] The platform's username of the social account
|
|
35
|
+
#
|
|
36
|
+
# @param request_options [PostForMe::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
37
|
+
#
|
|
38
|
+
# @return [PostForMe::Models::SocialAccount]
|
|
39
|
+
#
|
|
40
|
+
# @see PostForMe::Models::SocialAccountUpdateParams
|
|
41
|
+
def update(id, params = {})
|
|
42
|
+
parsed, options = PostForMe::SocialAccountUpdateParams.dump_request(params)
|
|
43
|
+
@client.request(
|
|
44
|
+
method: :patch,
|
|
45
|
+
path: ["v1/social-accounts/%1$s", id],
|
|
46
|
+
body: parsed,
|
|
47
|
+
model: PostForMe::SocialAccount,
|
|
48
|
+
options: options
|
|
49
|
+
)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Some parameter documentations has been truncated, see
|
|
53
|
+
# {PostForMe::Models::SocialAccountListParams} for more details.
|
|
54
|
+
#
|
|
55
|
+
# Get a paginated result for social accounts based on the applied filters
|
|
56
|
+
#
|
|
57
|
+
# @overload list(id: nil, external_id: nil, limit: nil, offset: nil, platform: nil, username: nil, request_options: {})
|
|
58
|
+
#
|
|
59
|
+
# @param id [Array<String>] Filter by id(s). Multiple values imply OR logic (e.g., ?id=spc_xxxxxx&id=spc_yyy
|
|
60
|
+
#
|
|
61
|
+
# @param external_id [Array<String>] Filter by externalId(s). Multiple values imply OR logic (e.g., ?externalId=test&
|
|
62
|
+
#
|
|
63
|
+
# @param limit [Float] Number of items to return
|
|
64
|
+
#
|
|
65
|
+
# @param offset [Float] Number of items to skip
|
|
66
|
+
#
|
|
67
|
+
# @param platform [Array<String>] Filter by platform(s). Multiple values imply OR logic (e.g., ?platform=x&platfor
|
|
68
|
+
#
|
|
69
|
+
# @param username [Array<String>] Filter by username(s). Multiple values imply OR logic (e.g., ?username=test&user
|
|
70
|
+
#
|
|
71
|
+
# @param request_options [PostForMe::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
72
|
+
#
|
|
73
|
+
# @return [PostForMe::Models::SocialAccountListResponse]
|
|
74
|
+
#
|
|
75
|
+
# @see PostForMe::Models::SocialAccountListParams
|
|
76
|
+
def list(params = {})
|
|
77
|
+
parsed, options = PostForMe::SocialAccountListParams.dump_request(params)
|
|
78
|
+
@client.request(
|
|
79
|
+
method: :get,
|
|
80
|
+
path: "v1/social-accounts",
|
|
81
|
+
query: parsed,
|
|
82
|
+
model: PostForMe::Models::SocialAccountListResponse,
|
|
83
|
+
options: options
|
|
84
|
+
)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Generates a URL that initiates the authentication flow for a user's social media
|
|
88
|
+
# account. When visited, the user is redirected to the selected social platform's
|
|
89
|
+
# login/authorization page. Upon successful authentication, they are redirected
|
|
90
|
+
# back to your application
|
|
91
|
+
#
|
|
92
|
+
# @overload create_auth_url(platform:, platform_data: nil, request_options: {})
|
|
93
|
+
#
|
|
94
|
+
# @param platform [String] The social account provider
|
|
95
|
+
#
|
|
96
|
+
# @param platform_data [PostForMe::Models::SocialAccountCreateAuthURLParams::PlatformData] Additional data needed for the provider
|
|
97
|
+
#
|
|
98
|
+
# @param request_options [PostForMe::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
99
|
+
#
|
|
100
|
+
# @return [PostForMe::Models::SocialAccountCreateAuthURLResponse]
|
|
101
|
+
#
|
|
102
|
+
# @see PostForMe::Models::SocialAccountCreateAuthURLParams
|
|
103
|
+
def create_auth_url(params)
|
|
104
|
+
parsed, options = PostForMe::SocialAccountCreateAuthURLParams.dump_request(params)
|
|
105
|
+
@client.request(
|
|
106
|
+
method: :post,
|
|
107
|
+
path: "v1/social-accounts/auth-url",
|
|
108
|
+
body: parsed,
|
|
109
|
+
model: PostForMe::Models::SocialAccountCreateAuthURLResponse,
|
|
110
|
+
options: options
|
|
111
|
+
)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Disconnecting an account with remove all auth tokens and mark the account as
|
|
115
|
+
# disconnected. The record of the account will be kept and can be retrieved and
|
|
116
|
+
# reconnected by the owner of the account.
|
|
117
|
+
#
|
|
118
|
+
# @overload disconnect(id, request_options: {})
|
|
119
|
+
#
|
|
120
|
+
# @param id [String]
|
|
121
|
+
# @param request_options [PostForMe::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
122
|
+
#
|
|
123
|
+
# @return [PostForMe::Models::SocialAccountDisconnectResponse]
|
|
124
|
+
#
|
|
125
|
+
# @see PostForMe::Models::SocialAccountDisconnectParams
|
|
126
|
+
def disconnect(id, params = {})
|
|
127
|
+
@client.request(
|
|
128
|
+
method: :post,
|
|
129
|
+
path: ["v1/social-accounts/%1$s/disconnect", id],
|
|
130
|
+
model: PostForMe::Models::SocialAccountDisconnectResponse,
|
|
131
|
+
options: params[:request_options]
|
|
132
|
+
)
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# @api private
|
|
136
|
+
#
|
|
137
|
+
# @param client [PostForMe::Client]
|
|
138
|
+
def initialize(client:)
|
|
139
|
+
@client = client
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PostForMe
|
|
4
|
+
module Resources
|
|
5
|
+
class SocialPostResults
|
|
6
|
+
# Get post result by ID
|
|
7
|
+
#
|
|
8
|
+
# @overload retrieve(id, request_options: {})
|
|
9
|
+
#
|
|
10
|
+
# @param id [String] Post Result ID
|
|
11
|
+
#
|
|
12
|
+
# @param request_options [PostForMe::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
13
|
+
#
|
|
14
|
+
# @return [PostForMe::Models::SocialPostResult]
|
|
15
|
+
#
|
|
16
|
+
# @see PostForMe::Models::SocialPostResultRetrieveParams
|
|
17
|
+
def retrieve(id, params = {})
|
|
18
|
+
@client.request(
|
|
19
|
+
method: :get,
|
|
20
|
+
path: ["v1/social-post-results/%1$s", id],
|
|
21
|
+
model: PostForMe::SocialPostResult,
|
|
22
|
+
options: params[:request_options]
|
|
23
|
+
)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Some parameter documentations has been truncated, see
|
|
27
|
+
# {PostForMe::Models::SocialPostResultListParams} for more details.
|
|
28
|
+
#
|
|
29
|
+
# Get a paginated result for post results based on the applied filters
|
|
30
|
+
#
|
|
31
|
+
# @overload list(limit: nil, offset: nil, platform: nil, post_id: nil, request_options: {})
|
|
32
|
+
#
|
|
33
|
+
# @param limit [Float] Number of items to return
|
|
34
|
+
#
|
|
35
|
+
# @param offset [Float] Number of items to skip
|
|
36
|
+
#
|
|
37
|
+
# @param platform [Array<String>] Filter by platform(s). Multiple values imply OR logic (e.g., ?platform=x&platfor
|
|
38
|
+
#
|
|
39
|
+
# @param post_id [Array<String>] Filter by post IDs. Multiple values imply OR logic (e.g., ?post_id=123&post_id=4
|
|
40
|
+
#
|
|
41
|
+
# @param request_options [PostForMe::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
42
|
+
#
|
|
43
|
+
# @return [PostForMe::Models::SocialPostResultListResponse]
|
|
44
|
+
#
|
|
45
|
+
# @see PostForMe::Models::SocialPostResultListParams
|
|
46
|
+
def list(params = {})
|
|
47
|
+
parsed, options = PostForMe::SocialPostResultListParams.dump_request(params)
|
|
48
|
+
@client.request(
|
|
49
|
+
method: :get,
|
|
50
|
+
path: "v1/social-post-results",
|
|
51
|
+
query: parsed,
|
|
52
|
+
model: PostForMe::Models::SocialPostResultListResponse,
|
|
53
|
+
options: options
|
|
54
|
+
)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# @api private
|
|
58
|
+
#
|
|
59
|
+
# @param client [PostForMe::Client]
|
|
60
|
+
def initialize(client:)
|
|
61
|
+
@client = client
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PostForMe
|
|
4
|
+
module Resources
|
|
5
|
+
class SocialPosts
|
|
6
|
+
# Some parameter documentations has been truncated, see
|
|
7
|
+
# {PostForMe::Models::SocialPostCreateParams} for more details.
|
|
8
|
+
#
|
|
9
|
+
# Create Post
|
|
10
|
+
#
|
|
11
|
+
# @overload create(caption:, social_accounts:, account_configurations: nil, external_id: nil, is_draft: nil, media: nil, platform_configurations: nil, scheduled_at: nil, request_options: {})
|
|
12
|
+
#
|
|
13
|
+
# @param caption [String] Caption text for the post
|
|
14
|
+
#
|
|
15
|
+
# @param social_accounts [Array<String>] Array of social account IDs for posting
|
|
16
|
+
#
|
|
17
|
+
# @param account_configurations [Array<PostForMe::Models::CreateSocialPost::AccountConfiguration>, nil] Account-specific configurations for the post
|
|
18
|
+
#
|
|
19
|
+
# @param external_id [String, nil] Array of social account IDs for posting
|
|
20
|
+
#
|
|
21
|
+
# @param is_draft [Boolean, nil] If isDraft is set then the post will not be processed
|
|
22
|
+
#
|
|
23
|
+
# @param media [Array<PostForMe::Models::CreateSocialPost::Media>, nil] Array of media URLs associated with the post
|
|
24
|
+
#
|
|
25
|
+
# @param platform_configurations [PostForMe::Models::CreateSocialPost::PlatformConfigurations, nil] Platform-specific configurations for the post
|
|
26
|
+
#
|
|
27
|
+
# @param scheduled_at [Time, nil] Scheduled date and time for the post, setting to null or undefined will post ins
|
|
28
|
+
#
|
|
29
|
+
# @param request_options [PostForMe::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
30
|
+
#
|
|
31
|
+
# @return [PostForMe::Models::SocialPost]
|
|
32
|
+
#
|
|
33
|
+
# @see PostForMe::Models::SocialPostCreateParams
|
|
34
|
+
def create(params)
|
|
35
|
+
parsed, options = PostForMe::SocialPostCreateParams.dump_request(params)
|
|
36
|
+
@client.request(
|
|
37
|
+
method: :post,
|
|
38
|
+
path: "v1/social-posts",
|
|
39
|
+
body: parsed,
|
|
40
|
+
model: PostForMe::SocialPost,
|
|
41
|
+
options: options
|
|
42
|
+
)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Get Post by ID
|
|
46
|
+
#
|
|
47
|
+
# @overload retrieve(id, request_options: {})
|
|
48
|
+
#
|
|
49
|
+
# @param id [String] Post ID
|
|
50
|
+
#
|
|
51
|
+
# @param request_options [PostForMe::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
52
|
+
#
|
|
53
|
+
# @return [PostForMe::Models::SocialPost]
|
|
54
|
+
#
|
|
55
|
+
# @see PostForMe::Models::SocialPostRetrieveParams
|
|
56
|
+
def retrieve(id, params = {})
|
|
57
|
+
@client.request(
|
|
58
|
+
method: :get,
|
|
59
|
+
path: ["v1/social-posts/%1$s", id],
|
|
60
|
+
model: PostForMe::SocialPost,
|
|
61
|
+
options: params[:request_options]
|
|
62
|
+
)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Some parameter documentations has been truncated, see
|
|
66
|
+
# {PostForMe::Models::SocialPostUpdateParams} for more details.
|
|
67
|
+
#
|
|
68
|
+
# Update Post
|
|
69
|
+
#
|
|
70
|
+
# @overload update(id, caption:, social_accounts:, account_configurations: nil, external_id: nil, is_draft: nil, media: nil, platform_configurations: nil, scheduled_at: nil, request_options: {})
|
|
71
|
+
#
|
|
72
|
+
# @param id [String] Post ID
|
|
73
|
+
#
|
|
74
|
+
# @param caption [String] Caption text for the post
|
|
75
|
+
#
|
|
76
|
+
# @param social_accounts [Array<String>] Array of social account IDs for posting
|
|
77
|
+
#
|
|
78
|
+
# @param account_configurations [Array<PostForMe::Models::CreateSocialPost::AccountConfiguration>, nil] Account-specific configurations for the post
|
|
79
|
+
#
|
|
80
|
+
# @param external_id [String, nil] Array of social account IDs for posting
|
|
81
|
+
#
|
|
82
|
+
# @param is_draft [Boolean, nil] If isDraft is set then the post will not be processed
|
|
83
|
+
#
|
|
84
|
+
# @param media [Array<PostForMe::Models::CreateSocialPost::Media>, nil] Array of media URLs associated with the post
|
|
85
|
+
#
|
|
86
|
+
# @param platform_configurations [PostForMe::Models::CreateSocialPost::PlatformConfigurations, nil] Platform-specific configurations for the post
|
|
87
|
+
#
|
|
88
|
+
# @param scheduled_at [Time, nil] Scheduled date and time for the post, setting to null or undefined will post ins
|
|
89
|
+
#
|
|
90
|
+
# @param request_options [PostForMe::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
91
|
+
#
|
|
92
|
+
# @return [PostForMe::Models::SocialPost]
|
|
93
|
+
#
|
|
94
|
+
# @see PostForMe::Models::SocialPostUpdateParams
|
|
95
|
+
def update(id, params)
|
|
96
|
+
parsed, options = PostForMe::SocialPostUpdateParams.dump_request(params)
|
|
97
|
+
@client.request(
|
|
98
|
+
method: :put,
|
|
99
|
+
path: ["v1/social-posts/%1$s", id],
|
|
100
|
+
body: parsed,
|
|
101
|
+
model: PostForMe::SocialPost,
|
|
102
|
+
options: options
|
|
103
|
+
)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Get a paginated result for posts based on the applied filters
|
|
107
|
+
#
|
|
108
|
+
# @overload list(external_id: nil, limit: nil, offset: nil, platform: nil, status: nil, request_options: {})
|
|
109
|
+
#
|
|
110
|
+
# @param external_id [Array<String>] Filter by external ID. Multiple values imply OR logic.
|
|
111
|
+
#
|
|
112
|
+
# @param limit [Float] Number of items to return
|
|
113
|
+
#
|
|
114
|
+
# @param offset [Float] Number of items to skip
|
|
115
|
+
#
|
|
116
|
+
# @param platform [Array<Symbol, PostForMe::Models::SocialPostListParams::Platform>] Filter by platforms. Multiple values imply OR logic.
|
|
117
|
+
#
|
|
118
|
+
# @param status [Array<Symbol, PostForMe::Models::SocialPostListParams::Status>] Filter by post status. Multiple values imply OR logic.
|
|
119
|
+
#
|
|
120
|
+
# @param request_options [PostForMe::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
121
|
+
#
|
|
122
|
+
# @return [PostForMe::Models::SocialPostListResponse]
|
|
123
|
+
#
|
|
124
|
+
# @see PostForMe::Models::SocialPostListParams
|
|
125
|
+
def list(params = {})
|
|
126
|
+
parsed, options = PostForMe::SocialPostListParams.dump_request(params)
|
|
127
|
+
@client.request(
|
|
128
|
+
method: :get,
|
|
129
|
+
path: "v1/social-posts",
|
|
130
|
+
query: parsed,
|
|
131
|
+
model: PostForMe::Models::SocialPostListResponse,
|
|
132
|
+
options: options
|
|
133
|
+
)
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Delete Post
|
|
137
|
+
#
|
|
138
|
+
# @overload delete(id, request_options: {})
|
|
139
|
+
#
|
|
140
|
+
# @param id [String] Post ID
|
|
141
|
+
#
|
|
142
|
+
# @param request_options [PostForMe::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
143
|
+
#
|
|
144
|
+
# @return [PostForMe::Models::SocialPostDeleteResponse]
|
|
145
|
+
#
|
|
146
|
+
# @see PostForMe::Models::SocialPostDeleteParams
|
|
147
|
+
def delete(id, params = {})
|
|
148
|
+
@client.request(
|
|
149
|
+
method: :delete,
|
|
150
|
+
path: ["v1/social-posts/%1$s", id],
|
|
151
|
+
model: PostForMe::Models::SocialPostDeleteResponse,
|
|
152
|
+
options: params[:request_options]
|
|
153
|
+
)
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# @api private
|
|
157
|
+
#
|
|
158
|
+
# @param client [PostForMe::Client]
|
|
159
|
+
def initialize(client:)
|
|
160
|
+
@client = client
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
end
|
data/lib/post_for_me.rb
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Standard libraries.
|
|
4
|
+
# rubocop:disable Lint/RedundantRequireStatement
|
|
5
|
+
require "English"
|
|
6
|
+
require "cgi"
|
|
7
|
+
require "date"
|
|
8
|
+
require "erb"
|
|
9
|
+
require "etc"
|
|
10
|
+
require "json"
|
|
11
|
+
require "net/http"
|
|
12
|
+
require "pathname"
|
|
13
|
+
require "rbconfig"
|
|
14
|
+
require "securerandom"
|
|
15
|
+
require "set"
|
|
16
|
+
require "stringio"
|
|
17
|
+
require "time"
|
|
18
|
+
require "uri"
|
|
19
|
+
# rubocop:enable Lint/RedundantRequireStatement
|
|
20
|
+
|
|
21
|
+
# We already ship the preferred sorbet manifests in the package itself.
|
|
22
|
+
# `tapioca` currently does not offer us a way to opt out of unnecessary compilation.
|
|
23
|
+
if Object.const_defined?(:Tapioca) &&
|
|
24
|
+
caller.chain([$PROGRAM_NAME]).chain(ARGV).any?(/tapioca/) &&
|
|
25
|
+
ARGV.none?(/dsl/)
|
|
26
|
+
return
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Gems.
|
|
30
|
+
require "connection_pool"
|
|
31
|
+
|
|
32
|
+
# Package files.
|
|
33
|
+
require_relative "post_for_me/version"
|
|
34
|
+
require_relative "post_for_me/internal/util"
|
|
35
|
+
require_relative "post_for_me/internal/type/converter"
|
|
36
|
+
require_relative "post_for_me/internal/type/unknown"
|
|
37
|
+
require_relative "post_for_me/internal/type/boolean"
|
|
38
|
+
require_relative "post_for_me/internal/type/file_input"
|
|
39
|
+
require_relative "post_for_me/internal/type/enum"
|
|
40
|
+
require_relative "post_for_me/internal/type/union"
|
|
41
|
+
require_relative "post_for_me/internal/type/array_of"
|
|
42
|
+
require_relative "post_for_me/internal/type/hash_of"
|
|
43
|
+
require_relative "post_for_me/internal/type/base_model"
|
|
44
|
+
require_relative "post_for_me/internal/type/base_page"
|
|
45
|
+
require_relative "post_for_me/internal/type/request_parameters"
|
|
46
|
+
require_relative "post_for_me/internal"
|
|
47
|
+
require_relative "post_for_me/request_options"
|
|
48
|
+
require_relative "post_for_me/file_part"
|
|
49
|
+
require_relative "post_for_me/errors"
|
|
50
|
+
require_relative "post_for_me/internal/transport/base_client"
|
|
51
|
+
require_relative "post_for_me/internal/transport/pooled_net_requester"
|
|
52
|
+
require_relative "post_for_me/client"
|
|
53
|
+
require_relative "post_for_me/models/create_social_post"
|
|
54
|
+
require_relative "post_for_me/models/media_create_upload_url_params"
|
|
55
|
+
require_relative "post_for_me/models/media_create_upload_url_response"
|
|
56
|
+
require_relative "post_for_me/models/social_account"
|
|
57
|
+
require_relative "post_for_me/models/social_account_create_auth_url_params"
|
|
58
|
+
require_relative "post_for_me/models/social_account_create_auth_url_response"
|
|
59
|
+
require_relative "post_for_me/models/social_account_disconnect_params"
|
|
60
|
+
require_relative "post_for_me/models/social_account_disconnect_response"
|
|
61
|
+
require_relative "post_for_me/models/social_account_list_params"
|
|
62
|
+
require_relative "post_for_me/models/social_account_list_response"
|
|
63
|
+
require_relative "post_for_me/models/social_account_retrieve_params"
|
|
64
|
+
require_relative "post_for_me/models/social_account_update_params"
|
|
65
|
+
require_relative "post_for_me/models/social_post"
|
|
66
|
+
require_relative "post_for_me/models/social_post_create_params"
|
|
67
|
+
require_relative "post_for_me/models/social_post_delete_params"
|
|
68
|
+
require_relative "post_for_me/models/social_post_delete_response"
|
|
69
|
+
require_relative "post_for_me/models/social_post_list_params"
|
|
70
|
+
require_relative "post_for_me/models/social_post_list_response"
|
|
71
|
+
require_relative "post_for_me/models/social_post_result"
|
|
72
|
+
require_relative "post_for_me/models/social_post_result_list_params"
|
|
73
|
+
require_relative "post_for_me/models/social_post_result_list_response"
|
|
74
|
+
require_relative "post_for_me/models/social_post_result_retrieve_params"
|
|
75
|
+
require_relative "post_for_me/models/social_post_retrieve_params"
|
|
76
|
+
require_relative "post_for_me/models/social_post_update_params"
|
|
77
|
+
require_relative "post_for_me/models/tiktok_configuration"
|
|
78
|
+
require_relative "post_for_me/models"
|
|
79
|
+
require_relative "post_for_me/resources/media"
|
|
80
|
+
require_relative "post_for_me/resources/social_accounts"
|
|
81
|
+
require_relative "post_for_me/resources/social_post_results"
|
|
82
|
+
require_relative "post_for_me/resources/social_posts"
|
data/manifest.yaml
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module PostForMe
|
|
4
|
+
class Client < PostForMe::Internal::Transport::BaseClient
|
|
5
|
+
DEFAULT_MAX_RETRIES = 2
|
|
6
|
+
|
|
7
|
+
DEFAULT_TIMEOUT_IN_SECONDS = T.let(60.0, Float)
|
|
8
|
+
|
|
9
|
+
DEFAULT_INITIAL_RETRY_DELAY = T.let(0.5, Float)
|
|
10
|
+
|
|
11
|
+
DEFAULT_MAX_RETRY_DELAY = T.let(8.0, Float)
|
|
12
|
+
|
|
13
|
+
sig { returns(String) }
|
|
14
|
+
attr_reader :api_key
|
|
15
|
+
|
|
16
|
+
sig { returns(PostForMe::Resources::Media) }
|
|
17
|
+
attr_reader :media
|
|
18
|
+
|
|
19
|
+
sig { returns(PostForMe::Resources::SocialPosts) }
|
|
20
|
+
attr_reader :social_posts
|
|
21
|
+
|
|
22
|
+
sig { returns(PostForMe::Resources::SocialPostResults) }
|
|
23
|
+
attr_reader :social_post_results
|
|
24
|
+
|
|
25
|
+
sig { returns(PostForMe::Resources::SocialAccounts) }
|
|
26
|
+
attr_reader :social_accounts
|
|
27
|
+
|
|
28
|
+
# @api private
|
|
29
|
+
sig { override.returns(T::Hash[String, String]) }
|
|
30
|
+
private def auth_headers
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Creates and returns a new client for interacting with the API.
|
|
34
|
+
sig do
|
|
35
|
+
params(
|
|
36
|
+
api_key: T.nilable(String),
|
|
37
|
+
base_url: T.nilable(String),
|
|
38
|
+
max_retries: Integer,
|
|
39
|
+
timeout: Float,
|
|
40
|
+
initial_retry_delay: Float,
|
|
41
|
+
max_retry_delay: Float
|
|
42
|
+
).returns(T.attached_class)
|
|
43
|
+
end
|
|
44
|
+
def self.new(
|
|
45
|
+
# Defaults to `ENV["POST_FOR_ME_API_KEY"]`
|
|
46
|
+
api_key: ENV["POST_FOR_ME_API_KEY"],
|
|
47
|
+
# Override the default base URL for the API, e.g.,
|
|
48
|
+
# `"https://api.example.com/v2/"`. Defaults to `ENV["POST_FOR_ME_BASE_URL"]`
|
|
49
|
+
base_url: ENV["POST_FOR_ME_BASE_URL"],
|
|
50
|
+
# Max number of retries to attempt after a failed retryable request.
|
|
51
|
+
max_retries: PostForMe::Client::DEFAULT_MAX_RETRIES,
|
|
52
|
+
timeout: PostForMe::Client::DEFAULT_TIMEOUT_IN_SECONDS,
|
|
53
|
+
initial_retry_delay: PostForMe::Client::DEFAULT_INITIAL_RETRY_DELAY,
|
|
54
|
+
max_retry_delay: PostForMe::Client::DEFAULT_MAX_RETRY_DELAY
|
|
55
|
+
)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|