postboost 1.0.0

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.
Files changed (206) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/LICENSE +21 -0
  4. data/README.md +0 -0
  5. data/Rakefile +10 -0
  6. data/docs/Account.md +34 -0
  7. data/docs/AccountsApi.md +149 -0
  8. data/docs/AddGenericSubscriptionRequest.md +22 -0
  9. data/docs/ChangeSubscriptionPlanRequest.md +24 -0
  10. data/docs/CheckoutSubscription200Response.md +18 -0
  11. data/docs/CheckoutSubscriptionRequest.md +22 -0
  12. data/docs/DeleteMediaBulkRequest.md +18 -0
  13. data/docs/DeleteMode.md +15 -0
  14. data/docs/DeletePostRequest.md +20 -0
  15. data/docs/DeletePostsBulkRequest.md +22 -0
  16. data/docs/DeleteReceiptsBulkRequest.md +18 -0
  17. data/docs/DeleteResult.md +22 -0
  18. data/docs/DeleteUser400Response.md +20 -0
  19. data/docs/DeleteUsersBulkRequest.md +18 -0
  20. data/docs/DeleteWorkspacesBulkRequest.md +18 -0
  21. data/docs/GetRemoteUploadStatus200Response.md +20 -0
  22. data/docs/InitiateChunkedUpload200Response.md +22 -0
  23. data/docs/InitiateChunkedUploadRequest.md +22 -0
  24. data/docs/InitiateRemoteUpload200Response.md +49 -0
  25. data/docs/InitiateRemoteUpload200ResponseOneOf.md +18 -0
  26. data/docs/InitiateRemoteUploadRequest.md +20 -0
  27. data/docs/ListAccounts200Response.md +18 -0
  28. data/docs/ListMedia200Response.md +22 -0
  29. data/docs/ListPosts200Response.md +22 -0
  30. data/docs/ListReceipts200Response.md +22 -0
  31. data/docs/ListTags200Response.md +18 -0
  32. data/docs/ListUsers200Response.md +22 -0
  33. data/docs/ListWorkspaces200Response.md +22 -0
  34. data/docs/Media.md +34 -0
  35. data/docs/MediaApi.md +810 -0
  36. data/docs/PaginationMeta.md +20 -0
  37. data/docs/PaginationMetaLinks.md +24 -0
  38. data/docs/PaginationMetaMeta.md +28 -0
  39. data/docs/Post.md +36 -0
  40. data/docs/PostContent.md +24 -0
  41. data/docs/PostInput.md +34 -0
  42. data/docs/PostStatus.md +15 -0
  43. data/docs/PostVersion.md +24 -0
  44. data/docs/PostsApi.md +659 -0
  45. data/docs/Receipt.md +36 -0
  46. data/docs/ReceiptInput.md +34 -0
  47. data/docs/ReceiptUpdateInput.md +32 -0
  48. data/docs/ReceiptsApi.md +421 -0
  49. data/docs/RemoveUserFromWorkspaceRequest.md +18 -0
  50. data/docs/SchedulePostRequest.md +18 -0
  51. data/docs/ScheduleResult.md +20 -0
  52. data/docs/Subscription.md +32 -0
  53. data/docs/SubscriptionInput.md +24 -0
  54. data/docs/SubscriptionStatus.md +15 -0
  55. data/docs/SubscriptionUpdateInput.md +24 -0
  56. data/docs/SubscriptionsApi.md +699 -0
  57. data/docs/Tag.md +24 -0
  58. data/docs/TagInput.md +20 -0
  59. data/docs/TagsApi.md +357 -0
  60. data/docs/UpdateMediaRequest.md +18 -0
  61. data/docs/UploadChunk200Response.md +18 -0
  62. data/docs/User.md +28 -0
  63. data/docs/UserInput.md +26 -0
  64. data/docs/UserUpdateInput.md +26 -0
  65. data/docs/UsersApi.md +419 -0
  66. data/docs/Workspace.md +28 -0
  67. data/docs/WorkspaceInput.md +24 -0
  68. data/docs/WorkspaceUserInput.md +24 -0
  69. data/docs/WorkspacesApi.md +637 -0
  70. data/git_push.sh +57 -0
  71. data/lib/postboost/api/accounts_api.rb +154 -0
  72. data/lib/postboost/api/media_api.rb +836 -0
  73. data/lib/postboost/api/posts_api.rb +673 -0
  74. data/lib/postboost/api/receipts_api.rb +409 -0
  75. data/lib/postboost/api/subscriptions_api.rb +689 -0
  76. data/lib/postboost/api/tags_api.rb +367 -0
  77. data/lib/postboost/api/users_api.rb +406 -0
  78. data/lib/postboost/api/workspaces_api.rb +640 -0
  79. data/lib/postboost/api_client.rb +394 -0
  80. data/lib/postboost/api_error.rb +58 -0
  81. data/lib/postboost/configuration.rb +308 -0
  82. data/lib/postboost/models/account.rb +321 -0
  83. data/lib/postboost/models/add_generic_subscription_request.rb +274 -0
  84. data/lib/postboost/models/change_subscription_plan_request.rb +303 -0
  85. data/lib/postboost/models/checkout_subscription200_response.rb +214 -0
  86. data/lib/postboost/models/checkout_subscription_request.rb +280 -0
  87. data/lib/postboost/models/delete_media_bulk_request.rb +224 -0
  88. data/lib/postboost/models/delete_mode.rb +41 -0
  89. data/lib/postboost/models/delete_post_request.rb +249 -0
  90. data/lib/postboost/models/delete_posts_bulk_request.rb +269 -0
  91. data/lib/postboost/models/delete_receipts_bulk_request.rb +223 -0
  92. data/lib/postboost/models/delete_result.rb +232 -0
  93. data/lib/postboost/models/delete_user400_response.rb +223 -0
  94. data/lib/postboost/models/delete_users_bulk_request.rb +223 -0
  95. data/lib/postboost/models/delete_workspaces_bulk_request.rb +223 -0
  96. data/lib/postboost/models/get_remote_upload_status200_response.rb +258 -0
  97. data/lib/postboost/models/initiate_chunked_upload200_response.rb +232 -0
  98. data/lib/postboost/models/initiate_chunked_upload_request.rb +273 -0
  99. data/lib/postboost/models/initiate_remote_upload200_response.rb +105 -0
  100. data/lib/postboost/models/initiate_remote_upload200_response_one_of.rb +214 -0
  101. data/lib/postboost/models/initiate_remote_upload_request.rb +250 -0
  102. data/lib/postboost/models/list_accounts200_response.rb +216 -0
  103. data/lib/postboost/models/list_media200_response.rb +241 -0
  104. data/lib/postboost/models/list_posts200_response.rb +241 -0
  105. data/lib/postboost/models/list_receipts200_response.rb +241 -0
  106. data/lib/postboost/models/list_tags200_response.rb +216 -0
  107. data/lib/postboost/models/list_users200_response.rb +241 -0
  108. data/lib/postboost/models/list_workspaces200_response.rb +241 -0
  109. data/lib/postboost/models/media.rb +320 -0
  110. data/lib/postboost/models/pagination_meta.rb +223 -0
  111. data/lib/postboost/models/pagination_meta_links.rb +241 -0
  112. data/lib/postboost/models/pagination_meta_meta.rb +259 -0
  113. data/lib/postboost/models/post.rb +323 -0
  114. data/lib/postboost/models/post_content.rb +247 -0
  115. data/lib/postboost/models/post_input.rb +324 -0
  116. data/lib/postboost/models/post_status.rb +41 -0
  117. data/lib/postboost/models/post_version.rb +267 -0
  118. data/lib/postboost/models/receipt.rb +295 -0
  119. data/lib/postboost/models/receipt_input.rb +335 -0
  120. data/lib/postboost/models/receipt_update_input.rb +312 -0
  121. data/lib/postboost/models/remove_user_from_workspace_request.rb +221 -0
  122. data/lib/postboost/models/schedule_post_request.rb +221 -0
  123. data/lib/postboost/models/schedule_result.rb +223 -0
  124. data/lib/postboost/models/subscription.rb +299 -0
  125. data/lib/postboost/models/subscription_input.rb +285 -0
  126. data/lib/postboost/models/subscription_status.rb +44 -0
  127. data/lib/postboost/models/subscription_update_input.rb +279 -0
  128. data/lib/postboost/models/tag.rb +241 -0
  129. data/lib/postboost/models/tag_input.rb +237 -0
  130. data/lib/postboost/models/update_media_request.rb +222 -0
  131. data/lib/postboost/models/upload_chunk200_response.rb +215 -0
  132. data/lib/postboost/models/user.rb +259 -0
  133. data/lib/postboost/models/user_input.rb +304 -0
  134. data/lib/postboost/models/user_update_input.rb +272 -0
  135. data/lib/postboost/models/workspace.rb +293 -0
  136. data/lib/postboost/models/workspace_input.rb +315 -0
  137. data/lib/postboost/models/workspace_user_input.rb +303 -0
  138. data/lib/postboost/version.rb +15 -0
  139. data/lib/postboost.rb +103 -0
  140. data/postboost.gemspec +39 -0
  141. data/spec/api/accounts_api_spec.rb +60 -0
  142. data/spec/api/media_api_spec.rb +182 -0
  143. data/spec/api/posts_api_spec.rb +152 -0
  144. data/spec/api/receipts_api_spec.rb +103 -0
  145. data/spec/api/subscriptions_api_spec.rb +151 -0
  146. data/spec/api/tags_api_spec.rb +95 -0
  147. data/spec/api/users_api_spec.rb +102 -0
  148. data/spec/api/workspaces_api_spec.rb +142 -0
  149. data/spec/models/account_spec.rb +88 -0
  150. data/spec/models/add_generic_subscription_request_spec.rb +48 -0
  151. data/spec/models/change_subscription_plan_request_spec.rb +58 -0
  152. data/spec/models/checkout_subscription200_response_spec.rb +36 -0
  153. data/spec/models/checkout_subscription_request_spec.rb +52 -0
  154. data/spec/models/delete_media_bulk_request_spec.rb +36 -0
  155. data/spec/models/delete_mode_spec.rb +30 -0
  156. data/spec/models/delete_post_request_spec.rb +42 -0
  157. data/spec/models/delete_posts_bulk_request_spec.rb +48 -0
  158. data/spec/models/delete_receipts_bulk_request_spec.rb +36 -0
  159. data/spec/models/delete_result_spec.rb +48 -0
  160. data/spec/models/delete_user400_response_spec.rb +42 -0
  161. data/spec/models/delete_users_bulk_request_spec.rb +36 -0
  162. data/spec/models/delete_workspaces_bulk_request_spec.rb +36 -0
  163. data/spec/models/get_remote_upload_status200_response_spec.rb +46 -0
  164. data/spec/models/initiate_chunked_upload200_response_spec.rb +48 -0
  165. data/spec/models/initiate_chunked_upload_request_spec.rb +48 -0
  166. data/spec/models/initiate_remote_upload200_response_one_of_spec.rb +36 -0
  167. data/spec/models/initiate_remote_upload200_response_spec.rb +32 -0
  168. data/spec/models/initiate_remote_upload_request_spec.rb +42 -0
  169. data/spec/models/list_accounts200_response_spec.rb +36 -0
  170. data/spec/models/list_media200_response_spec.rb +48 -0
  171. data/spec/models/list_posts200_response_spec.rb +48 -0
  172. data/spec/models/list_receipts200_response_spec.rb +48 -0
  173. data/spec/models/list_tags200_response_spec.rb +36 -0
  174. data/spec/models/list_users200_response_spec.rb +48 -0
  175. data/spec/models/list_workspaces200_response_spec.rb +48 -0
  176. data/spec/models/media_spec.rb +88 -0
  177. data/spec/models/pagination_meta_links_spec.rb +54 -0
  178. data/spec/models/pagination_meta_meta_spec.rb +66 -0
  179. data/spec/models/pagination_meta_spec.rb +42 -0
  180. data/spec/models/post_content_spec.rb +54 -0
  181. data/spec/models/post_input_spec.rb +84 -0
  182. data/spec/models/post_spec.rb +90 -0
  183. data/spec/models/post_status_spec.rb +30 -0
  184. data/spec/models/post_version_spec.rb +54 -0
  185. data/spec/models/receipt_input_spec.rb +84 -0
  186. data/spec/models/receipt_spec.rb +90 -0
  187. data/spec/models/receipt_update_input_spec.rb +78 -0
  188. data/spec/models/remove_user_from_workspace_request_spec.rb +36 -0
  189. data/spec/models/schedule_post_request_spec.rb +36 -0
  190. data/spec/models/schedule_result_spec.rb +42 -0
  191. data/spec/models/subscription_input_spec.rb +54 -0
  192. data/spec/models/subscription_spec.rb +78 -0
  193. data/spec/models/subscription_status_spec.rb +30 -0
  194. data/spec/models/subscription_update_input_spec.rb +54 -0
  195. data/spec/models/tag_input_spec.rb +42 -0
  196. data/spec/models/tag_spec.rb +54 -0
  197. data/spec/models/update_media_request_spec.rb +36 -0
  198. data/spec/models/upload_chunk200_response_spec.rb +36 -0
  199. data/spec/models/user_input_spec.rb +60 -0
  200. data/spec/models/user_spec.rb +66 -0
  201. data/spec/models/user_update_input_spec.rb +60 -0
  202. data/spec/models/workspace_input_spec.rb +58 -0
  203. data/spec/models/workspace_spec.rb +70 -0
  204. data/spec/models/workspace_user_input_spec.rb +58 -0
  205. data/spec/spec_helper.rb +111 -0
  206. metadata +358 -0
@@ -0,0 +1,836 @@
1
+ =begin
2
+ #PostBoost API
3
+
4
+ #The PostBoost REST API lets you publish, schedule, and analyze social media posts across 8+ platforms from a single integration. No OAuth apps to maintain — PostBoost handles platform authorization for you. ## Base URL All workspace-scoped endpoints are prefixed with `/{workspaceUuid}`. Panel/admin endpoints are prefixed with `/panel`. ## Authentication All requests require a Bearer token in the `Authorization` header. Generate tokens in your PostBoost dashboard under **Settings → Access Tokens**. ``` Authorization: Bearer YOUR_API_TOKEN ```
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: hi@postboost.co
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.9.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module PostBoost
16
+ class MediaApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Abort chunked upload
23
+ # Cancel an in-progress chunked upload session and clean up uploaded chunks.
24
+ # @param workspace_uuid [String] UUID of the workspace.
25
+ # @param upload_uuid [String]
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [nil]
28
+ def abort_chunked_upload(workspace_uuid, upload_uuid, opts = {})
29
+ abort_chunked_upload_with_http_info(workspace_uuid, upload_uuid, opts)
30
+ nil
31
+ end
32
+
33
+ # Abort chunked upload
34
+ # Cancel an in-progress chunked upload session and clean up uploaded chunks.
35
+ # @param workspace_uuid [String] UUID of the workspace.
36
+ # @param upload_uuid [String]
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
39
+ def abort_chunked_upload_with_http_info(workspace_uuid, upload_uuid, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: MediaApi.abort_chunked_upload ...'
42
+ end
43
+ # verify the required parameter 'workspace_uuid' is set
44
+ if @api_client.config.client_side_validation && workspace_uuid.nil?
45
+ fail ArgumentError, "Missing the required parameter 'workspace_uuid' when calling MediaApi.abort_chunked_upload"
46
+ end
47
+ # verify the required parameter 'upload_uuid' is set
48
+ if @api_client.config.client_side_validation && upload_uuid.nil?
49
+ fail ArgumentError, "Missing the required parameter 'upload_uuid' when calling MediaApi.abort_chunked_upload"
50
+ end
51
+ # resource path
52
+ local_var_path = '/{workspaceUuid}/media/chunked/{uploadUuid}'.sub('{' + 'workspaceUuid' + '}', CGI.escape(workspace_uuid.to_s)).sub('{' + 'uploadUuid' + '}', CGI.escape(upload_uuid.to_s))
53
+
54
+ # query parameters
55
+ query_params = opts[:query_params] || {}
56
+
57
+ # header parameters
58
+ header_params = opts[:header_params] || {}
59
+ # HTTP header 'Accept' (if needed)
60
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
61
+
62
+ # form parameters
63
+ form_params = opts[:form_params] || {}
64
+
65
+ # http body (model)
66
+ post_body = opts[:debug_body]
67
+
68
+ # return_type
69
+ return_type = opts[:debug_return_type]
70
+
71
+ # auth_names
72
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
73
+
74
+ new_options = opts.merge(
75
+ :operation => :"MediaApi.abort_chunked_upload",
76
+ :header_params => header_params,
77
+ :query_params => query_params,
78
+ :form_params => form_params,
79
+ :body => post_body,
80
+ :auth_names => auth_names,
81
+ :return_type => return_type
82
+ )
83
+
84
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
85
+ if @api_client.config.debugging
86
+ @api_client.config.logger.debug "API called: MediaApi#abort_chunked_upload\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
87
+ end
88
+ return data, status_code, headers
89
+ end
90
+
91
+ # Complete chunked upload
92
+ # Signal that all chunks have been uploaded. Returns the final media object.
93
+ # @param workspace_uuid [String] UUID of the workspace.
94
+ # @param upload_uuid [String]
95
+ # @param [Hash] opts the optional parameters
96
+ # @return [Media]
97
+ def complete_chunked_upload(workspace_uuid, upload_uuid, opts = {})
98
+ data, _status_code, _headers = complete_chunked_upload_with_http_info(workspace_uuid, upload_uuid, opts)
99
+ data
100
+ end
101
+
102
+ # Complete chunked upload
103
+ # Signal that all chunks have been uploaded. Returns the final media object.
104
+ # @param workspace_uuid [String] UUID of the workspace.
105
+ # @param upload_uuid [String]
106
+ # @param [Hash] opts the optional parameters
107
+ # @return [Array<(Media, Integer, Hash)>] Media data, response status code and response headers
108
+ def complete_chunked_upload_with_http_info(workspace_uuid, upload_uuid, opts = {})
109
+ if @api_client.config.debugging
110
+ @api_client.config.logger.debug 'Calling API: MediaApi.complete_chunked_upload ...'
111
+ end
112
+ # verify the required parameter 'workspace_uuid' is set
113
+ if @api_client.config.client_side_validation && workspace_uuid.nil?
114
+ fail ArgumentError, "Missing the required parameter 'workspace_uuid' when calling MediaApi.complete_chunked_upload"
115
+ end
116
+ # verify the required parameter 'upload_uuid' is set
117
+ if @api_client.config.client_side_validation && upload_uuid.nil?
118
+ fail ArgumentError, "Missing the required parameter 'upload_uuid' when calling MediaApi.complete_chunked_upload"
119
+ end
120
+ # resource path
121
+ local_var_path = '/{workspaceUuid}/media/chunked/{uploadUuid}/complete'.sub('{' + 'workspaceUuid' + '}', CGI.escape(workspace_uuid.to_s)).sub('{' + 'uploadUuid' + '}', CGI.escape(upload_uuid.to_s))
122
+
123
+ # query parameters
124
+ query_params = opts[:query_params] || {}
125
+
126
+ # header parameters
127
+ header_params = opts[:header_params] || {}
128
+ # HTTP header 'Accept' (if needed)
129
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
130
+
131
+ # form parameters
132
+ form_params = opts[:form_params] || {}
133
+
134
+ # http body (model)
135
+ post_body = opts[:debug_body]
136
+
137
+ # return_type
138
+ return_type = opts[:debug_return_type] || 'Media'
139
+
140
+ # auth_names
141
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
142
+
143
+ new_options = opts.merge(
144
+ :operation => :"MediaApi.complete_chunked_upload",
145
+ :header_params => header_params,
146
+ :query_params => query_params,
147
+ :form_params => form_params,
148
+ :body => post_body,
149
+ :auth_names => auth_names,
150
+ :return_type => return_type
151
+ )
152
+
153
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
154
+ if @api_client.config.debugging
155
+ @api_client.config.logger.debug "API called: MediaApi#complete_chunked_upload\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
156
+ end
157
+ return data, status_code, headers
158
+ end
159
+
160
+ # Delete media (bulk)
161
+ # Delete one or more media items by their IDs.
162
+ # @param workspace_uuid [String] UUID of the workspace.
163
+ # @param delete_media_bulk_request [DeleteMediaBulkRequest]
164
+ # @param [Hash] opts the optional parameters
165
+ # @return [Object]
166
+ def delete_media_bulk(workspace_uuid, delete_media_bulk_request, opts = {})
167
+ data, _status_code, _headers = delete_media_bulk_with_http_info(workspace_uuid, delete_media_bulk_request, opts)
168
+ data
169
+ end
170
+
171
+ # Delete media (bulk)
172
+ # Delete one or more media items by their IDs.
173
+ # @param workspace_uuid [String] UUID of the workspace.
174
+ # @param delete_media_bulk_request [DeleteMediaBulkRequest]
175
+ # @param [Hash] opts the optional parameters
176
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
177
+ def delete_media_bulk_with_http_info(workspace_uuid, delete_media_bulk_request, opts = {})
178
+ if @api_client.config.debugging
179
+ @api_client.config.logger.debug 'Calling API: MediaApi.delete_media_bulk ...'
180
+ end
181
+ # verify the required parameter 'workspace_uuid' is set
182
+ if @api_client.config.client_side_validation && workspace_uuid.nil?
183
+ fail ArgumentError, "Missing the required parameter 'workspace_uuid' when calling MediaApi.delete_media_bulk"
184
+ end
185
+ # verify the required parameter 'delete_media_bulk_request' is set
186
+ if @api_client.config.client_side_validation && delete_media_bulk_request.nil?
187
+ fail ArgumentError, "Missing the required parameter 'delete_media_bulk_request' when calling MediaApi.delete_media_bulk"
188
+ end
189
+ # resource path
190
+ local_var_path = '/{workspaceUuid}/media'.sub('{' + 'workspaceUuid' + '}', CGI.escape(workspace_uuid.to_s))
191
+
192
+ # query parameters
193
+ query_params = opts[:query_params] || {}
194
+
195
+ # header parameters
196
+ header_params = opts[:header_params] || {}
197
+ # HTTP header 'Accept' (if needed)
198
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
199
+ # HTTP header 'Content-Type'
200
+ content_type = @api_client.select_header_content_type(['application/json'])
201
+ if !content_type.nil?
202
+ header_params['Content-Type'] = content_type
203
+ end
204
+
205
+ # form parameters
206
+ form_params = opts[:form_params] || {}
207
+
208
+ # http body (model)
209
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(delete_media_bulk_request)
210
+
211
+ # return_type
212
+ return_type = opts[:debug_return_type] || 'Object'
213
+
214
+ # auth_names
215
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
216
+
217
+ new_options = opts.merge(
218
+ :operation => :"MediaApi.delete_media_bulk",
219
+ :header_params => header_params,
220
+ :query_params => query_params,
221
+ :form_params => form_params,
222
+ :body => post_body,
223
+ :auth_names => auth_names,
224
+ :return_type => return_type
225
+ )
226
+
227
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
228
+ if @api_client.config.debugging
229
+ @api_client.config.logger.debug "API called: MediaApi#delete_media_bulk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
230
+ end
231
+ return data, status_code, headers
232
+ end
233
+
234
+ # Get media
235
+ # Returns a single media asset.
236
+ # @param workspace_uuid [String] UUID of the workspace.
237
+ # @param media_uuid [String] UUID of the media asset.
238
+ # @param [Hash] opts the optional parameters
239
+ # @return [Media]
240
+ def get_media(workspace_uuid, media_uuid, opts = {})
241
+ data, _status_code, _headers = get_media_with_http_info(workspace_uuid, media_uuid, opts)
242
+ data
243
+ end
244
+
245
+ # Get media
246
+ # Returns a single media asset.
247
+ # @param workspace_uuid [String] UUID of the workspace.
248
+ # @param media_uuid [String] UUID of the media asset.
249
+ # @param [Hash] opts the optional parameters
250
+ # @return [Array<(Media, Integer, Hash)>] Media data, response status code and response headers
251
+ def get_media_with_http_info(workspace_uuid, media_uuid, opts = {})
252
+ if @api_client.config.debugging
253
+ @api_client.config.logger.debug 'Calling API: MediaApi.get_media ...'
254
+ end
255
+ # verify the required parameter 'workspace_uuid' is set
256
+ if @api_client.config.client_side_validation && workspace_uuid.nil?
257
+ fail ArgumentError, "Missing the required parameter 'workspace_uuid' when calling MediaApi.get_media"
258
+ end
259
+ # verify the required parameter 'media_uuid' is set
260
+ if @api_client.config.client_side_validation && media_uuid.nil?
261
+ fail ArgumentError, "Missing the required parameter 'media_uuid' when calling MediaApi.get_media"
262
+ end
263
+ # resource path
264
+ local_var_path = '/{workspaceUuid}/media/{mediaUuid}'.sub('{' + 'workspaceUuid' + '}', CGI.escape(workspace_uuid.to_s)).sub('{' + 'mediaUuid' + '}', CGI.escape(media_uuid.to_s))
265
+
266
+ # query parameters
267
+ query_params = opts[:query_params] || {}
268
+
269
+ # header parameters
270
+ header_params = opts[:header_params] || {}
271
+ # HTTP header 'Accept' (if needed)
272
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
273
+
274
+ # form parameters
275
+ form_params = opts[:form_params] || {}
276
+
277
+ # http body (model)
278
+ post_body = opts[:debug_body]
279
+
280
+ # return_type
281
+ return_type = opts[:debug_return_type] || 'Media'
282
+
283
+ # auth_names
284
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
285
+
286
+ new_options = opts.merge(
287
+ :operation => :"MediaApi.get_media",
288
+ :header_params => header_params,
289
+ :query_params => query_params,
290
+ :form_params => form_params,
291
+ :body => post_body,
292
+ :auth_names => auth_names,
293
+ :return_type => return_type
294
+ )
295
+
296
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
297
+ if @api_client.config.debugging
298
+ @api_client.config.logger.debug "API called: MediaApi#get_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
299
+ end
300
+ return data, status_code, headers
301
+ end
302
+
303
+ # Get remote upload status
304
+ # Poll the status of an in-progress remote media download.
305
+ # @param workspace_uuid [String] UUID of the workspace.
306
+ # @param download_id [String]
307
+ # @param [Hash] opts the optional parameters
308
+ # @return [GetRemoteUploadStatus200Response]
309
+ def get_remote_upload_status(workspace_uuid, download_id, opts = {})
310
+ data, _status_code, _headers = get_remote_upload_status_with_http_info(workspace_uuid, download_id, opts)
311
+ data
312
+ end
313
+
314
+ # Get remote upload status
315
+ # Poll the status of an in-progress remote media download.
316
+ # @param workspace_uuid [String] UUID of the workspace.
317
+ # @param download_id [String]
318
+ # @param [Hash] opts the optional parameters
319
+ # @return [Array<(GetRemoteUploadStatus200Response, Integer, Hash)>] GetRemoteUploadStatus200Response data, response status code and response headers
320
+ def get_remote_upload_status_with_http_info(workspace_uuid, download_id, opts = {})
321
+ if @api_client.config.debugging
322
+ @api_client.config.logger.debug 'Calling API: MediaApi.get_remote_upload_status ...'
323
+ end
324
+ # verify the required parameter 'workspace_uuid' is set
325
+ if @api_client.config.client_side_validation && workspace_uuid.nil?
326
+ fail ArgumentError, "Missing the required parameter 'workspace_uuid' when calling MediaApi.get_remote_upload_status"
327
+ end
328
+ # verify the required parameter 'download_id' is set
329
+ if @api_client.config.client_side_validation && download_id.nil?
330
+ fail ArgumentError, "Missing the required parameter 'download_id' when calling MediaApi.get_remote_upload_status"
331
+ end
332
+ # resource path
333
+ local_var_path = '/{workspaceUuid}/media/remote/{downloadId}/status'.sub('{' + 'workspaceUuid' + '}', CGI.escape(workspace_uuid.to_s)).sub('{' + 'downloadId' + '}', CGI.escape(download_id.to_s))
334
+
335
+ # query parameters
336
+ query_params = opts[:query_params] || {}
337
+
338
+ # header parameters
339
+ header_params = opts[:header_params] || {}
340
+ # HTTP header 'Accept' (if needed)
341
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
342
+
343
+ # form parameters
344
+ form_params = opts[:form_params] || {}
345
+
346
+ # http body (model)
347
+ post_body = opts[:debug_body]
348
+
349
+ # return_type
350
+ return_type = opts[:debug_return_type] || 'GetRemoteUploadStatus200Response'
351
+
352
+ # auth_names
353
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
354
+
355
+ new_options = opts.merge(
356
+ :operation => :"MediaApi.get_remote_upload_status",
357
+ :header_params => header_params,
358
+ :query_params => query_params,
359
+ :form_params => form_params,
360
+ :body => post_body,
361
+ :auth_names => auth_names,
362
+ :return_type => return_type
363
+ )
364
+
365
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
366
+ if @api_client.config.debugging
367
+ @api_client.config.logger.debug "API called: MediaApi#get_remote_upload_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
368
+ end
369
+ return data, status_code, headers
370
+ end
371
+
372
+ # Initiate chunked upload
373
+ # Start a chunked upload session for large files. Returns an `upload_uuid`, `chunk_size`, and `total_chunks` to use for subsequent chunk requests.
374
+ # @param workspace_uuid [String] UUID of the workspace.
375
+ # @param initiate_chunked_upload_request [InitiateChunkedUploadRequest]
376
+ # @param [Hash] opts the optional parameters
377
+ # @return [InitiateChunkedUpload200Response]
378
+ def initiate_chunked_upload(workspace_uuid, initiate_chunked_upload_request, opts = {})
379
+ data, _status_code, _headers = initiate_chunked_upload_with_http_info(workspace_uuid, initiate_chunked_upload_request, opts)
380
+ data
381
+ end
382
+
383
+ # Initiate chunked upload
384
+ # Start a chunked upload session for large files. Returns an &#x60;upload_uuid&#x60;, &#x60;chunk_size&#x60;, and &#x60;total_chunks&#x60; to use for subsequent chunk requests.
385
+ # @param workspace_uuid [String] UUID of the workspace.
386
+ # @param initiate_chunked_upload_request [InitiateChunkedUploadRequest]
387
+ # @param [Hash] opts the optional parameters
388
+ # @return [Array<(InitiateChunkedUpload200Response, Integer, Hash)>] InitiateChunkedUpload200Response data, response status code and response headers
389
+ def initiate_chunked_upload_with_http_info(workspace_uuid, initiate_chunked_upload_request, opts = {})
390
+ if @api_client.config.debugging
391
+ @api_client.config.logger.debug 'Calling API: MediaApi.initiate_chunked_upload ...'
392
+ end
393
+ # verify the required parameter 'workspace_uuid' is set
394
+ if @api_client.config.client_side_validation && workspace_uuid.nil?
395
+ fail ArgumentError, "Missing the required parameter 'workspace_uuid' when calling MediaApi.initiate_chunked_upload"
396
+ end
397
+ # verify the required parameter 'initiate_chunked_upload_request' is set
398
+ if @api_client.config.client_side_validation && initiate_chunked_upload_request.nil?
399
+ fail ArgumentError, "Missing the required parameter 'initiate_chunked_upload_request' when calling MediaApi.initiate_chunked_upload"
400
+ end
401
+ # resource path
402
+ local_var_path = '/{workspaceUuid}/media/chunked/initiate'.sub('{' + 'workspaceUuid' + '}', CGI.escape(workspace_uuid.to_s))
403
+
404
+ # query parameters
405
+ query_params = opts[:query_params] || {}
406
+
407
+ # header parameters
408
+ header_params = opts[:header_params] || {}
409
+ # HTTP header 'Accept' (if needed)
410
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
411
+ # HTTP header 'Content-Type'
412
+ content_type = @api_client.select_header_content_type(['application/json'])
413
+ if !content_type.nil?
414
+ header_params['Content-Type'] = content_type
415
+ end
416
+
417
+ # form parameters
418
+ form_params = opts[:form_params] || {}
419
+
420
+ # http body (model)
421
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(initiate_chunked_upload_request)
422
+
423
+ # return_type
424
+ return_type = opts[:debug_return_type] || 'InitiateChunkedUpload200Response'
425
+
426
+ # auth_names
427
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
428
+
429
+ new_options = opts.merge(
430
+ :operation => :"MediaApi.initiate_chunked_upload",
431
+ :header_params => header_params,
432
+ :query_params => query_params,
433
+ :form_params => form_params,
434
+ :body => post_body,
435
+ :auth_names => auth_names,
436
+ :return_type => return_type
437
+ )
438
+
439
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
440
+ if @api_client.config.debugging
441
+ @api_client.config.logger.debug "API called: MediaApi#initiate_chunked_upload\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
442
+ end
443
+ return data, status_code, headers
444
+ end
445
+
446
+ # Initiate remote upload
447
+ # Download a file from a remote URL into the media library. For small files the media object is returned immediately. For large files a `download_id` is returned — poll the status endpoint.
448
+ # @param workspace_uuid [String] UUID of the workspace.
449
+ # @param initiate_remote_upload_request [InitiateRemoteUploadRequest]
450
+ # @param [Hash] opts the optional parameters
451
+ # @return [InitiateRemoteUpload200Response]
452
+ def initiate_remote_upload(workspace_uuid, initiate_remote_upload_request, opts = {})
453
+ data, _status_code, _headers = initiate_remote_upload_with_http_info(workspace_uuid, initiate_remote_upload_request, opts)
454
+ data
455
+ end
456
+
457
+ # Initiate remote upload
458
+ # Download a file from a remote URL into the media library. For small files the media object is returned immediately. For large files a &#x60;download_id&#x60; is returned — poll the status endpoint.
459
+ # @param workspace_uuid [String] UUID of the workspace.
460
+ # @param initiate_remote_upload_request [InitiateRemoteUploadRequest]
461
+ # @param [Hash] opts the optional parameters
462
+ # @return [Array<(InitiateRemoteUpload200Response, Integer, Hash)>] InitiateRemoteUpload200Response data, response status code and response headers
463
+ def initiate_remote_upload_with_http_info(workspace_uuid, initiate_remote_upload_request, opts = {})
464
+ if @api_client.config.debugging
465
+ @api_client.config.logger.debug 'Calling API: MediaApi.initiate_remote_upload ...'
466
+ end
467
+ # verify the required parameter 'workspace_uuid' is set
468
+ if @api_client.config.client_side_validation && workspace_uuid.nil?
469
+ fail ArgumentError, "Missing the required parameter 'workspace_uuid' when calling MediaApi.initiate_remote_upload"
470
+ end
471
+ # verify the required parameter 'initiate_remote_upload_request' is set
472
+ if @api_client.config.client_side_validation && initiate_remote_upload_request.nil?
473
+ fail ArgumentError, "Missing the required parameter 'initiate_remote_upload_request' when calling MediaApi.initiate_remote_upload"
474
+ end
475
+ # resource path
476
+ local_var_path = '/{workspaceUuid}/media/remote/initiate'.sub('{' + 'workspaceUuid' + '}', CGI.escape(workspace_uuid.to_s))
477
+
478
+ # query parameters
479
+ query_params = opts[:query_params] || {}
480
+
481
+ # header parameters
482
+ header_params = opts[:header_params] || {}
483
+ # HTTP header 'Accept' (if needed)
484
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
485
+ # HTTP header 'Content-Type'
486
+ content_type = @api_client.select_header_content_type(['application/json'])
487
+ if !content_type.nil?
488
+ header_params['Content-Type'] = content_type
489
+ end
490
+
491
+ # form parameters
492
+ form_params = opts[:form_params] || {}
493
+
494
+ # http body (model)
495
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(initiate_remote_upload_request)
496
+
497
+ # return_type
498
+ return_type = opts[:debug_return_type] || 'InitiateRemoteUpload200Response'
499
+
500
+ # auth_names
501
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
502
+
503
+ new_options = opts.merge(
504
+ :operation => :"MediaApi.initiate_remote_upload",
505
+ :header_params => header_params,
506
+ :query_params => query_params,
507
+ :form_params => form_params,
508
+ :body => post_body,
509
+ :auth_names => auth_names,
510
+ :return_type => return_type
511
+ )
512
+
513
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
514
+ if @api_client.config.debugging
515
+ @api_client.config.logger.debug "API called: MediaApi#initiate_remote_upload\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
516
+ end
517
+ return data, status_code, headers
518
+ end
519
+
520
+ # List media
521
+ # Returns a paginated list of media assets in the workspace library.
522
+ # @param workspace_uuid [String] UUID of the workspace.
523
+ # @param [Hash] opts the optional parameters
524
+ # @option opts [Integer] :page Page number (20 items per page). (default to 1)
525
+ # @return [ListMedia200Response]
526
+ def list_media(workspace_uuid, opts = {})
527
+ data, _status_code, _headers = list_media_with_http_info(workspace_uuid, opts)
528
+ data
529
+ end
530
+
531
+ # List media
532
+ # Returns a paginated list of media assets in the workspace library.
533
+ # @param workspace_uuid [String] UUID of the workspace.
534
+ # @param [Hash] opts the optional parameters
535
+ # @option opts [Integer] :page Page number (20 items per page). (default to 1)
536
+ # @return [Array<(ListMedia200Response, Integer, Hash)>] ListMedia200Response data, response status code and response headers
537
+ def list_media_with_http_info(workspace_uuid, opts = {})
538
+ if @api_client.config.debugging
539
+ @api_client.config.logger.debug 'Calling API: MediaApi.list_media ...'
540
+ end
541
+ # verify the required parameter 'workspace_uuid' is set
542
+ if @api_client.config.client_side_validation && workspace_uuid.nil?
543
+ fail ArgumentError, "Missing the required parameter 'workspace_uuid' when calling MediaApi.list_media"
544
+ end
545
+ # resource path
546
+ local_var_path = '/{workspaceUuid}/media'.sub('{' + 'workspaceUuid' + '}', CGI.escape(workspace_uuid.to_s))
547
+
548
+ # query parameters
549
+ query_params = opts[:query_params] || {}
550
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
551
+
552
+ # header parameters
553
+ header_params = opts[:header_params] || {}
554
+ # HTTP header 'Accept' (if needed)
555
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
556
+
557
+ # form parameters
558
+ form_params = opts[:form_params] || {}
559
+
560
+ # http body (model)
561
+ post_body = opts[:debug_body]
562
+
563
+ # return_type
564
+ return_type = opts[:debug_return_type] || 'ListMedia200Response'
565
+
566
+ # auth_names
567
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
568
+
569
+ new_options = opts.merge(
570
+ :operation => :"MediaApi.list_media",
571
+ :header_params => header_params,
572
+ :query_params => query_params,
573
+ :form_params => form_params,
574
+ :body => post_body,
575
+ :auth_names => auth_names,
576
+ :return_type => return_type
577
+ )
578
+
579
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
580
+ if @api_client.config.debugging
581
+ @api_client.config.logger.debug "API called: MediaApi#list_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
582
+ end
583
+ return data, status_code, headers
584
+ end
585
+
586
+ # Update media
587
+ # Update the alt text of a media asset.
588
+ # @param workspace_uuid [String] UUID of the workspace.
589
+ # @param media_uuid [String] UUID of the media asset.
590
+ # @param update_media_request [UpdateMediaRequest]
591
+ # @param [Hash] opts the optional parameters
592
+ # @return [Object]
593
+ def update_media(workspace_uuid, media_uuid, update_media_request, opts = {})
594
+ data, _status_code, _headers = update_media_with_http_info(workspace_uuid, media_uuid, update_media_request, opts)
595
+ data
596
+ end
597
+
598
+ # Update media
599
+ # Update the alt text of a media asset.
600
+ # @param workspace_uuid [String] UUID of the workspace.
601
+ # @param media_uuid [String] UUID of the media asset.
602
+ # @param update_media_request [UpdateMediaRequest]
603
+ # @param [Hash] opts the optional parameters
604
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
605
+ def update_media_with_http_info(workspace_uuid, media_uuid, update_media_request, opts = {})
606
+ if @api_client.config.debugging
607
+ @api_client.config.logger.debug 'Calling API: MediaApi.update_media ...'
608
+ end
609
+ # verify the required parameter 'workspace_uuid' is set
610
+ if @api_client.config.client_side_validation && workspace_uuid.nil?
611
+ fail ArgumentError, "Missing the required parameter 'workspace_uuid' when calling MediaApi.update_media"
612
+ end
613
+ # verify the required parameter 'media_uuid' is set
614
+ if @api_client.config.client_side_validation && media_uuid.nil?
615
+ fail ArgumentError, "Missing the required parameter 'media_uuid' when calling MediaApi.update_media"
616
+ end
617
+ # verify the required parameter 'update_media_request' is set
618
+ if @api_client.config.client_side_validation && update_media_request.nil?
619
+ fail ArgumentError, "Missing the required parameter 'update_media_request' when calling MediaApi.update_media"
620
+ end
621
+ # resource path
622
+ local_var_path = '/{workspaceUuid}/media/{mediaUuid}'.sub('{' + 'workspaceUuid' + '}', CGI.escape(workspace_uuid.to_s)).sub('{' + 'mediaUuid' + '}', CGI.escape(media_uuid.to_s))
623
+
624
+ # query parameters
625
+ query_params = opts[:query_params] || {}
626
+
627
+ # header parameters
628
+ header_params = opts[:header_params] || {}
629
+ # HTTP header 'Accept' (if needed)
630
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
631
+ # HTTP header 'Content-Type'
632
+ content_type = @api_client.select_header_content_type(['application/json'])
633
+ if !content_type.nil?
634
+ header_params['Content-Type'] = content_type
635
+ end
636
+
637
+ # form parameters
638
+ form_params = opts[:form_params] || {}
639
+
640
+ # http body (model)
641
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_media_request)
642
+
643
+ # return_type
644
+ return_type = opts[:debug_return_type] || 'Object'
645
+
646
+ # auth_names
647
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
648
+
649
+ new_options = opts.merge(
650
+ :operation => :"MediaApi.update_media",
651
+ :header_params => header_params,
652
+ :query_params => query_params,
653
+ :form_params => form_params,
654
+ :body => post_body,
655
+ :auth_names => auth_names,
656
+ :return_type => return_type
657
+ )
658
+
659
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
660
+ if @api_client.config.debugging
661
+ @api_client.config.logger.debug "API called: MediaApi#update_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
662
+ end
663
+ return data, status_code, headers
664
+ end
665
+
666
+ # Upload a chunk
667
+ # Upload a single chunk of a chunked upload session.
668
+ # @param workspace_uuid [String] UUID of the workspace.
669
+ # @param upload_uuid [String]
670
+ # @param chunk [File]
671
+ # @param chunk_index [Integer] Zero-based index of this chunk.
672
+ # @param [Hash] opts the optional parameters
673
+ # @return [UploadChunk200Response]
674
+ def upload_chunk(workspace_uuid, upload_uuid, chunk, chunk_index, opts = {})
675
+ data, _status_code, _headers = upload_chunk_with_http_info(workspace_uuid, upload_uuid, chunk, chunk_index, opts)
676
+ data
677
+ end
678
+
679
+ # Upload a chunk
680
+ # Upload a single chunk of a chunked upload session.
681
+ # @param workspace_uuid [String] UUID of the workspace.
682
+ # @param upload_uuid [String]
683
+ # @param chunk [File]
684
+ # @param chunk_index [Integer] Zero-based index of this chunk.
685
+ # @param [Hash] opts the optional parameters
686
+ # @return [Array<(UploadChunk200Response, Integer, Hash)>] UploadChunk200Response data, response status code and response headers
687
+ def upload_chunk_with_http_info(workspace_uuid, upload_uuid, chunk, chunk_index, opts = {})
688
+ if @api_client.config.debugging
689
+ @api_client.config.logger.debug 'Calling API: MediaApi.upload_chunk ...'
690
+ end
691
+ # verify the required parameter 'workspace_uuid' is set
692
+ if @api_client.config.client_side_validation && workspace_uuid.nil?
693
+ fail ArgumentError, "Missing the required parameter 'workspace_uuid' when calling MediaApi.upload_chunk"
694
+ end
695
+ # verify the required parameter 'upload_uuid' is set
696
+ if @api_client.config.client_side_validation && upload_uuid.nil?
697
+ fail ArgumentError, "Missing the required parameter 'upload_uuid' when calling MediaApi.upload_chunk"
698
+ end
699
+ # verify the required parameter 'chunk' is set
700
+ if @api_client.config.client_side_validation && chunk.nil?
701
+ fail ArgumentError, "Missing the required parameter 'chunk' when calling MediaApi.upload_chunk"
702
+ end
703
+ # verify the required parameter 'chunk_index' is set
704
+ if @api_client.config.client_side_validation && chunk_index.nil?
705
+ fail ArgumentError, "Missing the required parameter 'chunk_index' when calling MediaApi.upload_chunk"
706
+ end
707
+ # resource path
708
+ local_var_path = '/{workspaceUuid}/media/chunked/{uploadUuid}/upload'.sub('{' + 'workspaceUuid' + '}', CGI.escape(workspace_uuid.to_s)).sub('{' + 'uploadUuid' + '}', CGI.escape(upload_uuid.to_s))
709
+
710
+ # query parameters
711
+ query_params = opts[:query_params] || {}
712
+
713
+ # header parameters
714
+ header_params = opts[:header_params] || {}
715
+ # HTTP header 'Accept' (if needed)
716
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
717
+ # HTTP header 'Content-Type'
718
+ content_type = @api_client.select_header_content_type(['multipart/form-data'])
719
+ if !content_type.nil?
720
+ header_params['Content-Type'] = content_type
721
+ end
722
+
723
+ # form parameters
724
+ form_params = opts[:form_params] || {}
725
+ form_params['chunk'] = chunk
726
+ form_params['chunk_index'] = chunk_index
727
+
728
+ # http body (model)
729
+ post_body = opts[:debug_body]
730
+
731
+ # return_type
732
+ return_type = opts[:debug_return_type] || 'UploadChunk200Response'
733
+
734
+ # auth_names
735
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
736
+
737
+ new_options = opts.merge(
738
+ :operation => :"MediaApi.upload_chunk",
739
+ :header_params => header_params,
740
+ :query_params => query_params,
741
+ :form_params => form_params,
742
+ :body => post_body,
743
+ :auth_names => auth_names,
744
+ :return_type => return_type
745
+ )
746
+
747
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
748
+ if @api_client.config.debugging
749
+ @api_client.config.logger.debug "API called: MediaApi#upload_chunk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
750
+ end
751
+ return data, status_code, headers
752
+ end
753
+
754
+ # Upload media (binary)
755
+ # Upload a file directly as multipart form data.
756
+ # @param workspace_uuid [String] UUID of the workspace.
757
+ # @param file [File] The file to upload.
758
+ # @param [Hash] opts the optional parameters
759
+ # @option opts [String] :alt_text Alternative text for accessibility.
760
+ # @return [Media]
761
+ def upload_media(workspace_uuid, file, opts = {})
762
+ data, _status_code, _headers = upload_media_with_http_info(workspace_uuid, file, opts)
763
+ data
764
+ end
765
+
766
+ # Upload media (binary)
767
+ # Upload a file directly as multipart form data.
768
+ # @param workspace_uuid [String] UUID of the workspace.
769
+ # @param file [File] The file to upload.
770
+ # @param [Hash] opts the optional parameters
771
+ # @option opts [String] :alt_text Alternative text for accessibility.
772
+ # @return [Array<(Media, Integer, Hash)>] Media data, response status code and response headers
773
+ def upload_media_with_http_info(workspace_uuid, file, opts = {})
774
+ if @api_client.config.debugging
775
+ @api_client.config.logger.debug 'Calling API: MediaApi.upload_media ...'
776
+ end
777
+ # verify the required parameter 'workspace_uuid' is set
778
+ if @api_client.config.client_side_validation && workspace_uuid.nil?
779
+ fail ArgumentError, "Missing the required parameter 'workspace_uuid' when calling MediaApi.upload_media"
780
+ end
781
+ # verify the required parameter 'file' is set
782
+ if @api_client.config.client_side_validation && file.nil?
783
+ fail ArgumentError, "Missing the required parameter 'file' when calling MediaApi.upload_media"
784
+ end
785
+ if @api_client.config.client_side_validation && !opts[:'alt_text'].nil? && opts[:'alt_text'].to_s.length > 255
786
+ fail ArgumentError, 'invalid value for "opts[:"alt_text"]" when calling MediaApi.upload_media, the character length must be smaller than or equal to 255.'
787
+ end
788
+
789
+ # resource path
790
+ local_var_path = '/{workspaceUuid}/media'.sub('{' + 'workspaceUuid' + '}', CGI.escape(workspace_uuid.to_s))
791
+
792
+ # query parameters
793
+ query_params = opts[:query_params] || {}
794
+
795
+ # header parameters
796
+ header_params = opts[:header_params] || {}
797
+ # HTTP header 'Accept' (if needed)
798
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
799
+ # HTTP header 'Content-Type'
800
+ content_type = @api_client.select_header_content_type(['multipart/form-data'])
801
+ if !content_type.nil?
802
+ header_params['Content-Type'] = content_type
803
+ end
804
+
805
+ # form parameters
806
+ form_params = opts[:form_params] || {}
807
+ form_params['file'] = file
808
+ form_params['alt_text'] = opts[:'alt_text'] if !opts[:'alt_text'].nil?
809
+
810
+ # http body (model)
811
+ post_body = opts[:debug_body]
812
+
813
+ # return_type
814
+ return_type = opts[:debug_return_type] || 'Media'
815
+
816
+ # auth_names
817
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
818
+
819
+ new_options = opts.merge(
820
+ :operation => :"MediaApi.upload_media",
821
+ :header_params => header_params,
822
+ :query_params => query_params,
823
+ :form_params => form_params,
824
+ :body => post_body,
825
+ :auth_names => auth_names,
826
+ :return_type => return_type
827
+ )
828
+
829
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
830
+ if @api_client.config.debugging
831
+ @api_client.config.logger.debug "API called: MediaApi#upload_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
832
+ end
833
+ return data, status_code, headers
834
+ end
835
+ end
836
+ end