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,27 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module PostForMe
|
|
4
|
+
module Models
|
|
5
|
+
class SocialPostUpdateParams < PostForMe::Models::CreateSocialPost
|
|
6
|
+
extend PostForMe::Internal::Type::RequestParameters::Converter
|
|
7
|
+
include PostForMe::Internal::Type::RequestParameters
|
|
8
|
+
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(PostForMe::SocialPostUpdateParams, PostForMe::Internal::AnyHash)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
sig do
|
|
15
|
+
params(request_options: PostForMe::RequestOptions::OrHash).returns(
|
|
16
|
+
T.attached_class
|
|
17
|
+
)
|
|
18
|
+
end
|
|
19
|
+
def self.new(request_options: {})
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
sig { override.returns({ request_options: PostForMe::RequestOptions }) }
|
|
23
|
+
def to_hash
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module PostForMe
|
|
4
|
+
module Models
|
|
5
|
+
class TiktokConfiguration < PostForMe::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(PostForMe::TiktokConfiguration, PostForMe::Internal::AnyHash)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# Allow comments on TikTok
|
|
12
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
13
|
+
attr_accessor :allow_comment
|
|
14
|
+
|
|
15
|
+
# Allow duets on TikTok
|
|
16
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
17
|
+
attr_accessor :allow_duet
|
|
18
|
+
|
|
19
|
+
# Allow stitch on TikTok
|
|
20
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
21
|
+
attr_accessor :allow_stitch
|
|
22
|
+
|
|
23
|
+
# Overrides the `caption` from the post
|
|
24
|
+
sig { returns(T.nilable(T.anything)) }
|
|
25
|
+
attr_accessor :caption
|
|
26
|
+
|
|
27
|
+
# Disclose branded content on TikTok
|
|
28
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
29
|
+
attr_accessor :disclose_branded_content
|
|
30
|
+
|
|
31
|
+
# Disclose your brand on TikTok
|
|
32
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
33
|
+
attr_accessor :disclose_your_brand
|
|
34
|
+
|
|
35
|
+
# Flag content as AI generated on TikTok
|
|
36
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
37
|
+
attr_accessor :is_ai_generated
|
|
38
|
+
|
|
39
|
+
# Overrides the `media` from the post
|
|
40
|
+
sig { returns(T.nilable(T::Array[String])) }
|
|
41
|
+
attr_accessor :media
|
|
42
|
+
|
|
43
|
+
# Sets the privacy status for TikTok (private, public)
|
|
44
|
+
sig { returns(T.nilable(String)) }
|
|
45
|
+
attr_accessor :privacy_status
|
|
46
|
+
|
|
47
|
+
# Overrides the `title` from the post
|
|
48
|
+
sig { returns(T.nilable(String)) }
|
|
49
|
+
attr_accessor :title
|
|
50
|
+
|
|
51
|
+
sig do
|
|
52
|
+
params(
|
|
53
|
+
allow_comment: T.nilable(T::Boolean),
|
|
54
|
+
allow_duet: T.nilable(T::Boolean),
|
|
55
|
+
allow_stitch: T.nilable(T::Boolean),
|
|
56
|
+
caption: T.nilable(T.anything),
|
|
57
|
+
disclose_branded_content: T.nilable(T::Boolean),
|
|
58
|
+
disclose_your_brand: T.nilable(T::Boolean),
|
|
59
|
+
is_ai_generated: T.nilable(T::Boolean),
|
|
60
|
+
media: T.nilable(T::Array[String]),
|
|
61
|
+
privacy_status: T.nilable(String),
|
|
62
|
+
title: T.nilable(String)
|
|
63
|
+
).returns(T.attached_class)
|
|
64
|
+
end
|
|
65
|
+
def self.new(
|
|
66
|
+
# Allow comments on TikTok
|
|
67
|
+
allow_comment: nil,
|
|
68
|
+
# Allow duets on TikTok
|
|
69
|
+
allow_duet: nil,
|
|
70
|
+
# Allow stitch on TikTok
|
|
71
|
+
allow_stitch: nil,
|
|
72
|
+
# Overrides the `caption` from the post
|
|
73
|
+
caption: nil,
|
|
74
|
+
# Disclose branded content on TikTok
|
|
75
|
+
disclose_branded_content: nil,
|
|
76
|
+
# Disclose your brand on TikTok
|
|
77
|
+
disclose_your_brand: nil,
|
|
78
|
+
# Flag content as AI generated on TikTok
|
|
79
|
+
is_ai_generated: nil,
|
|
80
|
+
# Overrides the `media` from the post
|
|
81
|
+
media: nil,
|
|
82
|
+
# Sets the privacy status for TikTok (private, public)
|
|
83
|
+
privacy_status: nil,
|
|
84
|
+
# Overrides the `title` from the post
|
|
85
|
+
title: nil
|
|
86
|
+
)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
sig do
|
|
90
|
+
override.returns(
|
|
91
|
+
{
|
|
92
|
+
allow_comment: T.nilable(T::Boolean),
|
|
93
|
+
allow_duet: T.nilable(T::Boolean),
|
|
94
|
+
allow_stitch: T.nilable(T::Boolean),
|
|
95
|
+
caption: T.nilable(T.anything),
|
|
96
|
+
disclose_branded_content: T.nilable(T::Boolean),
|
|
97
|
+
disclose_your_brand: T.nilable(T::Boolean),
|
|
98
|
+
is_ai_generated: T.nilable(T::Boolean),
|
|
99
|
+
media: T.nilable(T::Array[String]),
|
|
100
|
+
privacy_status: T.nilable(String),
|
|
101
|
+
title: T.nilable(String)
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
end
|
|
105
|
+
def to_hash
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module PostForMe
|
|
4
|
+
CreateSocialPost = PostForMe::Models::CreateSocialPost
|
|
5
|
+
|
|
6
|
+
MediaCreateUploadURLParams = PostForMe::Models::MediaCreateUploadURLParams
|
|
7
|
+
|
|
8
|
+
SocialAccount = PostForMe::Models::SocialAccount
|
|
9
|
+
|
|
10
|
+
SocialAccountCreateAuthURLParams =
|
|
11
|
+
PostForMe::Models::SocialAccountCreateAuthURLParams
|
|
12
|
+
|
|
13
|
+
SocialAccountDisconnectParams =
|
|
14
|
+
PostForMe::Models::SocialAccountDisconnectParams
|
|
15
|
+
|
|
16
|
+
SocialAccountListParams = PostForMe::Models::SocialAccountListParams
|
|
17
|
+
|
|
18
|
+
SocialAccountRetrieveParams = PostForMe::Models::SocialAccountRetrieveParams
|
|
19
|
+
|
|
20
|
+
SocialAccountUpdateParams = PostForMe::Models::SocialAccountUpdateParams
|
|
21
|
+
|
|
22
|
+
SocialPost = PostForMe::Models::SocialPost
|
|
23
|
+
|
|
24
|
+
SocialPostCreateParams = PostForMe::Models::SocialPostCreateParams
|
|
25
|
+
|
|
26
|
+
SocialPostDeleteParams = PostForMe::Models::SocialPostDeleteParams
|
|
27
|
+
|
|
28
|
+
SocialPostListParams = PostForMe::Models::SocialPostListParams
|
|
29
|
+
|
|
30
|
+
SocialPostResult = PostForMe::Models::SocialPostResult
|
|
31
|
+
|
|
32
|
+
SocialPostResultListParams = PostForMe::Models::SocialPostResultListParams
|
|
33
|
+
|
|
34
|
+
SocialPostResultRetrieveParams =
|
|
35
|
+
PostForMe::Models::SocialPostResultRetrieveParams
|
|
36
|
+
|
|
37
|
+
SocialPostRetrieveParams = PostForMe::Models::SocialPostRetrieveParams
|
|
38
|
+
|
|
39
|
+
SocialPostUpdateParams = PostForMe::Models::SocialPostUpdateParams
|
|
40
|
+
|
|
41
|
+
TiktokConfiguration = PostForMe::Models::TiktokConfiguration
|
|
42
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module PostForMe
|
|
4
|
+
# Specify HTTP behaviour to use for a specific request. These options supplement
|
|
5
|
+
# or override those provided at the client level.
|
|
6
|
+
#
|
|
7
|
+
# When making a request, you can pass an actual {RequestOptions} instance, or
|
|
8
|
+
# simply pass a Hash with symbol keys matching the attributes on this class.
|
|
9
|
+
class RequestOptions < PostForMe::Internal::Type::BaseModel
|
|
10
|
+
OrHash =
|
|
11
|
+
T.type_alias do
|
|
12
|
+
T.any(PostForMe::RequestOptions, PostForMe::Internal::AnyHash)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# @api private
|
|
16
|
+
sig { params(opts: PostForMe::RequestOptions::OrHash).void }
|
|
17
|
+
def self.validate!(opts)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Idempotency key to send with request and all associated retries. Will only be
|
|
21
|
+
# sent for write requests.
|
|
22
|
+
sig { returns(T.nilable(String)) }
|
|
23
|
+
attr_accessor :idempotency_key
|
|
24
|
+
|
|
25
|
+
# Extra query params to send with the request. These are `.merge`’d into any
|
|
26
|
+
# `query` given at the client level.
|
|
27
|
+
sig do
|
|
28
|
+
returns(
|
|
29
|
+
T.nilable(T::Hash[String, T.nilable(T.any(T::Array[String], String))])
|
|
30
|
+
)
|
|
31
|
+
end
|
|
32
|
+
attr_accessor :extra_query
|
|
33
|
+
|
|
34
|
+
# Extra headers to send with the request. These are `.merged`’d into any
|
|
35
|
+
# `extra_headers` given at the client level.
|
|
36
|
+
sig { returns(T.nilable(T::Hash[String, T.nilable(String)])) }
|
|
37
|
+
attr_accessor :extra_headers
|
|
38
|
+
|
|
39
|
+
# Extra data to send with the request. These are deep merged into any data
|
|
40
|
+
# generated as part of the normal request.
|
|
41
|
+
sig { returns(T.nilable(T.anything)) }
|
|
42
|
+
attr_accessor :extra_body
|
|
43
|
+
|
|
44
|
+
# Maximum number of retries to attempt after a failed initial request.
|
|
45
|
+
sig { returns(T.nilable(Integer)) }
|
|
46
|
+
attr_accessor :max_retries
|
|
47
|
+
|
|
48
|
+
# Request timeout in seconds.
|
|
49
|
+
sig { returns(T.nilable(Float)) }
|
|
50
|
+
attr_accessor :timeout
|
|
51
|
+
|
|
52
|
+
# Returns a new instance of RequestOptions.
|
|
53
|
+
sig do
|
|
54
|
+
params(values: PostForMe::Internal::AnyHash).returns(T.attached_class)
|
|
55
|
+
end
|
|
56
|
+
def self.new(values = {})
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# typed: strong
|
|
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
|
+
sig do
|
|
70
|
+
params(request_options: PostForMe::RequestOptions::OrHash).returns(
|
|
71
|
+
PostForMe::Models::MediaCreateUploadURLResponse
|
|
72
|
+
)
|
|
73
|
+
end
|
|
74
|
+
def create_upload_url(request_options: {})
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# @api private
|
|
78
|
+
sig { params(client: PostForMe::Client).returns(T.attached_class) }
|
|
79
|
+
def self.new(client:)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module PostForMe
|
|
4
|
+
module Resources
|
|
5
|
+
class SocialAccounts
|
|
6
|
+
# Get social account by ID
|
|
7
|
+
sig do
|
|
8
|
+
params(
|
|
9
|
+
id: String,
|
|
10
|
+
request_options: PostForMe::RequestOptions::OrHash
|
|
11
|
+
).returns(PostForMe::SocialAccount)
|
|
12
|
+
end
|
|
13
|
+
def retrieve(
|
|
14
|
+
# Social Account ID
|
|
15
|
+
id,
|
|
16
|
+
request_options: {}
|
|
17
|
+
)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Update social account
|
|
21
|
+
sig do
|
|
22
|
+
params(
|
|
23
|
+
id: String,
|
|
24
|
+
external_id: String,
|
|
25
|
+
username: String,
|
|
26
|
+
request_options: PostForMe::RequestOptions::OrHash
|
|
27
|
+
).returns(PostForMe::SocialAccount)
|
|
28
|
+
end
|
|
29
|
+
def update(
|
|
30
|
+
# Social Account ID
|
|
31
|
+
id,
|
|
32
|
+
# The platform's external id of the social account
|
|
33
|
+
external_id: nil,
|
|
34
|
+
# The platform's username of the social account
|
|
35
|
+
username: nil,
|
|
36
|
+
request_options: {}
|
|
37
|
+
)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Get a paginated result for social accounts based on the applied filters
|
|
41
|
+
sig do
|
|
42
|
+
params(
|
|
43
|
+
id: T::Array[String],
|
|
44
|
+
external_id: T::Array[String],
|
|
45
|
+
limit: Float,
|
|
46
|
+
offset: Float,
|
|
47
|
+
platform: T::Array[String],
|
|
48
|
+
username: T::Array[String],
|
|
49
|
+
request_options: PostForMe::RequestOptions::OrHash
|
|
50
|
+
).returns(PostForMe::Models::SocialAccountListResponse)
|
|
51
|
+
end
|
|
52
|
+
def list(
|
|
53
|
+
# Filter by id(s). Multiple values imply OR logic (e.g.,
|
|
54
|
+
# ?id=spc_xxxxxx&id=spc_yyyyyy).
|
|
55
|
+
id: nil,
|
|
56
|
+
# Filter by externalId(s). Multiple values imply OR logic (e.g.,
|
|
57
|
+
# ?externalId=test&externalId=test2).
|
|
58
|
+
external_id: nil,
|
|
59
|
+
# Number of items to return
|
|
60
|
+
limit: nil,
|
|
61
|
+
# Number of items to skip
|
|
62
|
+
offset: nil,
|
|
63
|
+
# Filter by platform(s). Multiple values imply OR logic (e.g.,
|
|
64
|
+
# ?platform=x&platform=facebook).
|
|
65
|
+
platform: nil,
|
|
66
|
+
# Filter by username(s). Multiple values imply OR logic (e.g.,
|
|
67
|
+
# ?username=test&username=test2).
|
|
68
|
+
username: nil,
|
|
69
|
+
request_options: {}
|
|
70
|
+
)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Generates a URL that initiates the authentication flow for a user's social media
|
|
74
|
+
# account. When visited, the user is redirected to the selected social platform's
|
|
75
|
+
# login/authorization page. Upon successful authentication, they are redirected
|
|
76
|
+
# back to your application
|
|
77
|
+
sig do
|
|
78
|
+
params(
|
|
79
|
+
platform: String,
|
|
80
|
+
platform_data:
|
|
81
|
+
PostForMe::SocialAccountCreateAuthURLParams::PlatformData::OrHash,
|
|
82
|
+
request_options: PostForMe::RequestOptions::OrHash
|
|
83
|
+
).returns(PostForMe::Models::SocialAccountCreateAuthURLResponse)
|
|
84
|
+
end
|
|
85
|
+
def create_auth_url(
|
|
86
|
+
# The social account provider
|
|
87
|
+
platform:,
|
|
88
|
+
# Additional data needed for the provider
|
|
89
|
+
platform_data: nil,
|
|
90
|
+
request_options: {}
|
|
91
|
+
)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Disconnecting an account with remove all auth tokens and mark the account as
|
|
95
|
+
# disconnected. The record of the account will be kept and can be retrieved and
|
|
96
|
+
# reconnected by the owner of the account.
|
|
97
|
+
sig do
|
|
98
|
+
params(
|
|
99
|
+
id: String,
|
|
100
|
+
request_options: PostForMe::RequestOptions::OrHash
|
|
101
|
+
).returns(PostForMe::Models::SocialAccountDisconnectResponse)
|
|
102
|
+
end
|
|
103
|
+
def disconnect(id, request_options: {})
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# @api private
|
|
107
|
+
sig { params(client: PostForMe::Client).returns(T.attached_class) }
|
|
108
|
+
def self.new(client:)
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module PostForMe
|
|
4
|
+
module Resources
|
|
5
|
+
class SocialPostResults
|
|
6
|
+
# Get post result by ID
|
|
7
|
+
sig do
|
|
8
|
+
params(
|
|
9
|
+
id: String,
|
|
10
|
+
request_options: PostForMe::RequestOptions::OrHash
|
|
11
|
+
).returns(PostForMe::SocialPostResult)
|
|
12
|
+
end
|
|
13
|
+
def retrieve(
|
|
14
|
+
# Post Result ID
|
|
15
|
+
id,
|
|
16
|
+
request_options: {}
|
|
17
|
+
)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Get a paginated result for post results based on the applied filters
|
|
21
|
+
sig do
|
|
22
|
+
params(
|
|
23
|
+
limit: Float,
|
|
24
|
+
offset: Float,
|
|
25
|
+
platform: T::Array[String],
|
|
26
|
+
post_id: T::Array[String],
|
|
27
|
+
request_options: PostForMe::RequestOptions::OrHash
|
|
28
|
+
).returns(PostForMe::Models::SocialPostResultListResponse)
|
|
29
|
+
end
|
|
30
|
+
def list(
|
|
31
|
+
# Number of items to return
|
|
32
|
+
limit: nil,
|
|
33
|
+
# Number of items to skip
|
|
34
|
+
offset: nil,
|
|
35
|
+
# Filter by platform(s). Multiple values imply OR logic (e.g.,
|
|
36
|
+
# ?platform=x&platform=facebook).
|
|
37
|
+
platform: nil,
|
|
38
|
+
# Filter by post IDs. Multiple values imply OR logic (e.g.,
|
|
39
|
+
# ?post_id=123&post_id=456).
|
|
40
|
+
post_id: nil,
|
|
41
|
+
request_options: {}
|
|
42
|
+
)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# @api private
|
|
46
|
+
sig { params(client: PostForMe::Client).returns(T.attached_class) }
|
|
47
|
+
def self.new(client:)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module PostForMe
|
|
4
|
+
module Resources
|
|
5
|
+
class SocialPosts
|
|
6
|
+
# Create Post
|
|
7
|
+
sig do
|
|
8
|
+
params(
|
|
9
|
+
caption: String,
|
|
10
|
+
social_accounts: T::Array[String],
|
|
11
|
+
account_configurations:
|
|
12
|
+
T.nilable(
|
|
13
|
+
T::Array[
|
|
14
|
+
PostForMe::CreateSocialPost::AccountConfiguration::OrHash
|
|
15
|
+
]
|
|
16
|
+
),
|
|
17
|
+
external_id: T.nilable(String),
|
|
18
|
+
is_draft: T.nilable(T::Boolean),
|
|
19
|
+
media:
|
|
20
|
+
T.nilable(T::Array[PostForMe::CreateSocialPost::Media::OrHash]),
|
|
21
|
+
platform_configurations:
|
|
22
|
+
T.nilable(
|
|
23
|
+
PostForMe::CreateSocialPost::PlatformConfigurations::OrHash
|
|
24
|
+
),
|
|
25
|
+
scheduled_at: T.nilable(Time),
|
|
26
|
+
request_options: PostForMe::RequestOptions::OrHash
|
|
27
|
+
).returns(PostForMe::SocialPost)
|
|
28
|
+
end
|
|
29
|
+
def create(
|
|
30
|
+
# Caption text for the post
|
|
31
|
+
caption:,
|
|
32
|
+
# Array of social account IDs for posting
|
|
33
|
+
social_accounts:,
|
|
34
|
+
# Account-specific configurations for the post
|
|
35
|
+
account_configurations: nil,
|
|
36
|
+
# Array of social account IDs for posting
|
|
37
|
+
external_id: nil,
|
|
38
|
+
# If isDraft is set then the post will not be processed
|
|
39
|
+
is_draft: nil,
|
|
40
|
+
# Array of media URLs associated with the post
|
|
41
|
+
media: nil,
|
|
42
|
+
# Platform-specific configurations for the post
|
|
43
|
+
platform_configurations: nil,
|
|
44
|
+
# Scheduled date and time for the post, setting to null or undefined will post
|
|
45
|
+
# instantly
|
|
46
|
+
scheduled_at: nil,
|
|
47
|
+
request_options: {}
|
|
48
|
+
)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Get Post by ID
|
|
52
|
+
sig do
|
|
53
|
+
params(
|
|
54
|
+
id: String,
|
|
55
|
+
request_options: PostForMe::RequestOptions::OrHash
|
|
56
|
+
).returns(PostForMe::SocialPost)
|
|
57
|
+
end
|
|
58
|
+
def retrieve(
|
|
59
|
+
# Post ID
|
|
60
|
+
id,
|
|
61
|
+
request_options: {}
|
|
62
|
+
)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Update Post
|
|
66
|
+
sig do
|
|
67
|
+
params(
|
|
68
|
+
id: String,
|
|
69
|
+
caption: String,
|
|
70
|
+
social_accounts: T::Array[String],
|
|
71
|
+
account_configurations:
|
|
72
|
+
T.nilable(
|
|
73
|
+
T::Array[
|
|
74
|
+
PostForMe::CreateSocialPost::AccountConfiguration::OrHash
|
|
75
|
+
]
|
|
76
|
+
),
|
|
77
|
+
external_id: T.nilable(String),
|
|
78
|
+
is_draft: T.nilable(T::Boolean),
|
|
79
|
+
media:
|
|
80
|
+
T.nilable(T::Array[PostForMe::CreateSocialPost::Media::OrHash]),
|
|
81
|
+
platform_configurations:
|
|
82
|
+
T.nilable(
|
|
83
|
+
PostForMe::CreateSocialPost::PlatformConfigurations::OrHash
|
|
84
|
+
),
|
|
85
|
+
scheduled_at: T.nilable(Time),
|
|
86
|
+
request_options: PostForMe::RequestOptions::OrHash
|
|
87
|
+
).returns(PostForMe::SocialPost)
|
|
88
|
+
end
|
|
89
|
+
def update(
|
|
90
|
+
# Post ID
|
|
91
|
+
id,
|
|
92
|
+
# Caption text for the post
|
|
93
|
+
caption:,
|
|
94
|
+
# Array of social account IDs for posting
|
|
95
|
+
social_accounts:,
|
|
96
|
+
# Account-specific configurations for the post
|
|
97
|
+
account_configurations: nil,
|
|
98
|
+
# Array of social account IDs for posting
|
|
99
|
+
external_id: nil,
|
|
100
|
+
# If isDraft is set then the post will not be processed
|
|
101
|
+
is_draft: nil,
|
|
102
|
+
# Array of media URLs associated with the post
|
|
103
|
+
media: nil,
|
|
104
|
+
# Platform-specific configurations for the post
|
|
105
|
+
platform_configurations: nil,
|
|
106
|
+
# Scheduled date and time for the post, setting to null or undefined will post
|
|
107
|
+
# instantly
|
|
108
|
+
scheduled_at: nil,
|
|
109
|
+
request_options: {}
|
|
110
|
+
)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Get a paginated result for posts based on the applied filters
|
|
114
|
+
sig do
|
|
115
|
+
params(
|
|
116
|
+
external_id: T::Array[String],
|
|
117
|
+
limit: Float,
|
|
118
|
+
offset: Float,
|
|
119
|
+
platform:
|
|
120
|
+
T::Array[PostForMe::SocialPostListParams::Platform::OrSymbol],
|
|
121
|
+
status: T::Array[PostForMe::SocialPostListParams::Status::OrSymbol],
|
|
122
|
+
request_options: PostForMe::RequestOptions::OrHash
|
|
123
|
+
).returns(PostForMe::Models::SocialPostListResponse)
|
|
124
|
+
end
|
|
125
|
+
def list(
|
|
126
|
+
# Filter by external ID. Multiple values imply OR logic.
|
|
127
|
+
external_id: nil,
|
|
128
|
+
# Number of items to return
|
|
129
|
+
limit: nil,
|
|
130
|
+
# Number of items to skip
|
|
131
|
+
offset: nil,
|
|
132
|
+
# Filter by platforms. Multiple values imply OR logic.
|
|
133
|
+
platform: nil,
|
|
134
|
+
# Filter by post status. Multiple values imply OR logic.
|
|
135
|
+
status: nil,
|
|
136
|
+
request_options: {}
|
|
137
|
+
)
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# Delete Post
|
|
141
|
+
sig do
|
|
142
|
+
params(
|
|
143
|
+
id: String,
|
|
144
|
+
request_options: PostForMe::RequestOptions::OrHash
|
|
145
|
+
).returns(PostForMe::Models::SocialPostDeleteResponse)
|
|
146
|
+
end
|
|
147
|
+
def delete(
|
|
148
|
+
# Post ID
|
|
149
|
+
id,
|
|
150
|
+
request_options: {}
|
|
151
|
+
)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# @api private
|
|
155
|
+
sig { params(client: PostForMe::Client).returns(T.attached_class) }
|
|
156
|
+
def self.new(client:)
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module PostForMe
|
|
2
|
+
class Client < PostForMe::Internal::Transport::BaseClient
|
|
3
|
+
DEFAULT_MAX_RETRIES: 2
|
|
4
|
+
|
|
5
|
+
DEFAULT_TIMEOUT_IN_SECONDS: Float
|
|
6
|
+
|
|
7
|
+
DEFAULT_INITIAL_RETRY_DELAY: Float
|
|
8
|
+
|
|
9
|
+
DEFAULT_MAX_RETRY_DELAY: Float
|
|
10
|
+
|
|
11
|
+
attr_reader api_key: String
|
|
12
|
+
|
|
13
|
+
attr_reader media: PostForMe::Resources::Media
|
|
14
|
+
|
|
15
|
+
attr_reader social_posts: PostForMe::Resources::SocialPosts
|
|
16
|
+
|
|
17
|
+
attr_reader social_post_results: PostForMe::Resources::SocialPostResults
|
|
18
|
+
|
|
19
|
+
attr_reader social_accounts: PostForMe::Resources::SocialAccounts
|
|
20
|
+
|
|
21
|
+
private def auth_headers: -> ::Hash[String, String]
|
|
22
|
+
|
|
23
|
+
def initialize: (
|
|
24
|
+
?api_key: String?,
|
|
25
|
+
?base_url: String?,
|
|
26
|
+
?max_retries: Integer,
|
|
27
|
+
?timeout: Float,
|
|
28
|
+
?initial_retry_delay: Float,
|
|
29
|
+
?max_retry_delay: Float
|
|
30
|
+
) -> void
|
|
31
|
+
end
|
|
32
|
+
end
|