zippendo 1.2.3 → 1.2.5

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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/docs/CreateOrderChannelRequest.md +26 -0
  3. data/docs/CreateOrderChannelRequestSettings.md +42 -0
  4. data/docs/CreateOrderChannelRequestSettingsShippingMethodMappingsInner.md +22 -0
  5. data/docs/CreateOrderChannelWebhookSecret201Response.md +22 -0
  6. data/docs/CreateOrderRequest.md +4 -0
  7. data/docs/GetOrderChannelWebhookStatus200Response.md +22 -0
  8. data/docs/GetOrderChannelWebhookStatus200ResponseWebhooksInner.md +28 -0
  9. data/docs/ListAvailableCarriers200ResponseInner.md +5 -1
  10. data/docs/ListCarriers200ResponseDataInner.md +5 -1
  11. data/docs/ListOrderChannels200Response.md +26 -0
  12. data/docs/ListOrderChannels200ResponseDataInner.md +44 -0
  13. data/docs/ListOrderChannels200ResponseDataInnerSettings.md +50 -0
  14. data/docs/ListOrderChannels200ResponseDataInnerSettingsShippingMethodMappingsInner.md +22 -0
  15. data/docs/OrderChannelsApi.md +599 -0
  16. data/docs/RevokeOrderChannelWebhookSecret200Response.md +18 -0
  17. data/docs/UpdateOrderChannelRequest.md +28 -0
  18. data/docs/UpdateOrderChannelRequestSettings.md +42 -0
  19. data/lib/zippendo/api/order_channels_api.rb +629 -0
  20. data/lib/zippendo/models/batch_send_shipments200_response_results_inner.rb +2 -2
  21. data/lib/zippendo/models/create_order_channel_request.rb +266 -0
  22. data/lib/zippendo/models/create_order_channel_request_settings.rb +359 -0
  23. data/lib/zippendo/models/create_order_channel_request_settings_shipping_method_mappings_inner.rb +254 -0
  24. data/lib/zippendo/models/create_order_channel_webhook_secret201_response.rb +230 -0
  25. data/lib/zippendo/models/create_order_request.rb +23 -1
  26. data/lib/zippendo/models/get_order_channel_webhook_status200_response.rb +221 -0
  27. data/lib/zippendo/models/get_order_channel_webhook_status200_response_webhooks_inner.rb +266 -0
  28. data/lib/zippendo/models/list_api_tokens401_response.rb +2 -2
  29. data/lib/zippendo/models/list_available_carriers200_response_inner.rb +24 -4
  30. data/lib/zippendo/models/list_carriers200_response_data_inner.rb +24 -4
  31. data/lib/zippendo/models/list_order_channels200_response.rb +275 -0
  32. data/lib/zippendo/models/list_order_channels200_response_data_inner.rb +478 -0
  33. data/lib/zippendo/models/list_order_channels200_response_data_inner_settings.rb +509 -0
  34. data/lib/zippendo/models/list_order_channels200_response_data_inner_settings_shipping_method_mappings_inner.rb +254 -0
  35. data/lib/zippendo/models/list_orders200_response_data_inner_order_channel.rb +2 -2
  36. data/lib/zippendo/models/revoke_order_channel_webhook_secret200_response.rb +165 -0
  37. data/lib/zippendo/models/send_shipment422_response.rb +2 -2
  38. data/lib/zippendo/models/update_order_channel_request.rb +231 -0
  39. data/lib/zippendo/models/update_order_channel_request_settings.rb +360 -0
  40. data/lib/zippendo/version.rb +1 -1
  41. data/lib/zippendo.rb +14 -0
  42. metadata +29 -1
@@ -0,0 +1,629 @@
1
+ =begin
2
+ #Zippendo Public API
3
+
4
+ #Public API documentation for Zippendo. Authenticate using your API token (Bearer token prefixed with zipp_). **Brands (sub-accounts).** An organization can be split into brands, each keeping its own orders, shipments and configuration separate. There are two ways to scope requests to one brand, and NEITHER changes any request body: 1. **Bind the token.** Create an API token with a `brandId` and every request it makes is confined to that brand — reads filtered, writes stamped. This is the recommended way to give a single brand's team its own credential. 2. **Send the `X-Zippendo-Brand` header.** An organization-wide token can scope an individual request by sending the brand's id or slug in this header. Most SDKs let you set it once on the client so every call inherits it. A brand-bound token that receives an `X-Zippendo-Brand` header naming a different brand is rejected with `403 BRAND_ACCESS_DENIED` — the binding is never widened. Omit both and requests cover the whole organization, which is the behaviour of every existing token. Records that belong to no brand carry `brandId: null`. Configuration (carriers, shipping rules, addresses) with a null brand is organization-wide and remains visible inside every brand; orders and shipments with a null brand are only visible organization-wide. List endpoints additionally take a `?brandScope=own|shared|both` parameter to narrow further within whichever brand context already applies. `own` returns only rows assigned to that brand, and requires a brand context — a brand-bound token, a resolved brand session, or the `X-Zippendo-Brand` header above — otherwise `400`. `shared` returns only the organization-wide rows (equivalent to filtering `brandId=none`). The default, `both`, keeps the existing behaviour: a brand context sees its own rows plus the organization-wide ones. Set `X-Zippendo-Brand-Scope` as a client default to apply the same choice to every request instead of repeating the query parameter on each call — an explicit `brandScope` query parameter always wins over the header, and a blank header value is ignored. Brands themselves are managed under the **Brands** tag. Retiring a brand is done with `POST /orgs/{orgId}/brands/{brandId}/archive` — permanent deletion is a dashboard-only action, since it is refused while any order, shipment, member or token still references the brand. Brands require a plan that includes them; creating one beyond your plan's limit returns `403`.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: support@zippendo.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.24.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Zippendo
16
+ class OrderChannelsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create order channel
23
+ # Creates a new order channel for an organization.
24
+ # @param org_id [String] Organization ID
25
+ # @param create_order_channel_request [CreateOrderChannelRequest]
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [ListOrderChannels200ResponseDataInner]
28
+ def create_order_channel(org_id, create_order_channel_request, opts = {})
29
+ data, _status_code, _headers = create_order_channel_with_http_info(org_id, create_order_channel_request, opts)
30
+ data
31
+ end
32
+
33
+ # Create order channel
34
+ # Creates a new order channel for an organization.
35
+ # @param org_id [String] Organization ID
36
+ # @param create_order_channel_request [CreateOrderChannelRequest]
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<(ListOrderChannels200ResponseDataInner, Integer, Hash)>] ListOrderChannels200ResponseDataInner data, response status code and response headers
39
+ def create_order_channel_with_http_info(org_id, create_order_channel_request, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: OrderChannelsApi.create_order_channel ...'
42
+ end
43
+ # verify the required parameter 'org_id' is set
44
+ if @api_client.config.client_side_validation && org_id.nil?
45
+ fail ArgumentError, "Missing the required parameter 'org_id' when calling OrderChannelsApi.create_order_channel"
46
+ end
47
+ # verify the required parameter 'create_order_channel_request' is set
48
+ if @api_client.config.client_side_validation && create_order_channel_request.nil?
49
+ fail ArgumentError, "Missing the required parameter 'create_order_channel_request' when calling OrderChannelsApi.create_order_channel"
50
+ end
51
+ # resource path
52
+ local_var_path = '/orgs/{orgId}/order-channels'.sub('{orgId}', CGI.escape(org_id.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
+ # HTTP header 'Content-Type'
62
+ content_type = @api_client.select_header_content_type(['application/json'])
63
+ if !content_type.nil?
64
+ header_params['Content-Type'] = content_type
65
+ end
66
+
67
+ # form parameters
68
+ form_params = opts[:form_params] || {}
69
+
70
+ # http body (model)
71
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_order_channel_request)
72
+
73
+ # return_type
74
+ return_type = opts[:debug_return_type] || 'ListOrderChannels200ResponseDataInner'
75
+
76
+ # auth_names
77
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
78
+
79
+ new_options = opts.merge(
80
+ :operation => :"OrderChannelsApi.create_order_channel",
81
+ :header_params => header_params,
82
+ :query_params => query_params,
83
+ :form_params => form_params,
84
+ :body => post_body,
85
+ :auth_names => auth_names,
86
+ :return_type => return_type
87
+ )
88
+
89
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
90
+ if @api_client.config.debugging
91
+ @api_client.config.logger.debug "API called: OrderChannelsApi#create_order_channel\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
92
+ end
93
+ return data, status_code, headers
94
+ end
95
+
96
+ # Create or rotate webhook signing secret
97
+ # Generates (or rotates) the custom channel's webhook signing secret used to authenticate order pushes to the ingest URL. The secret is returned only once. Rotating invalidates the previous secret immediately.
98
+ # @param org_id [String] Organization ID.
99
+ # @param channel_id [String] Order channel ID.
100
+ # @param [Hash] opts the optional parameters
101
+ # @return [CreateOrderChannelWebhookSecret201Response]
102
+ def create_order_channel_webhook_secret(org_id, channel_id, opts = {})
103
+ data, _status_code, _headers = create_order_channel_webhook_secret_with_http_info(org_id, channel_id, opts)
104
+ data
105
+ end
106
+
107
+ # Create or rotate webhook signing secret
108
+ # Generates (or rotates) the custom channel&#39;s webhook signing secret used to authenticate order pushes to the ingest URL. The secret is returned only once. Rotating invalidates the previous secret immediately.
109
+ # @param org_id [String] Organization ID.
110
+ # @param channel_id [String] Order channel ID.
111
+ # @param [Hash] opts the optional parameters
112
+ # @return [Array<(CreateOrderChannelWebhookSecret201Response, Integer, Hash)>] CreateOrderChannelWebhookSecret201Response data, response status code and response headers
113
+ def create_order_channel_webhook_secret_with_http_info(org_id, channel_id, opts = {})
114
+ if @api_client.config.debugging
115
+ @api_client.config.logger.debug 'Calling API: OrderChannelsApi.create_order_channel_webhook_secret ...'
116
+ end
117
+ # verify the required parameter 'org_id' is set
118
+ if @api_client.config.client_side_validation && org_id.nil?
119
+ fail ArgumentError, "Missing the required parameter 'org_id' when calling OrderChannelsApi.create_order_channel_webhook_secret"
120
+ end
121
+ # verify the required parameter 'channel_id' is set
122
+ if @api_client.config.client_side_validation && channel_id.nil?
123
+ fail ArgumentError, "Missing the required parameter 'channel_id' when calling OrderChannelsApi.create_order_channel_webhook_secret"
124
+ end
125
+ # resource path
126
+ local_var_path = '/orgs/{orgId}/order-channels/{channelId}/webhook-secret'.sub('{orgId}', CGI.escape(org_id.to_s)).sub('{channelId}', CGI.escape(channel_id.to_s))
127
+
128
+ # query parameters
129
+ query_params = opts[:query_params] || {}
130
+
131
+ # header parameters
132
+ header_params = opts[:header_params] || {}
133
+ # HTTP header 'Accept' (if needed)
134
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
135
+
136
+ # form parameters
137
+ form_params = opts[:form_params] || {}
138
+
139
+ # http body (model)
140
+ post_body = opts[:debug_body]
141
+
142
+ # return_type
143
+ return_type = opts[:debug_return_type] || 'CreateOrderChannelWebhookSecret201Response'
144
+
145
+ # auth_names
146
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
147
+
148
+ new_options = opts.merge(
149
+ :operation => :"OrderChannelsApi.create_order_channel_webhook_secret",
150
+ :header_params => header_params,
151
+ :query_params => query_params,
152
+ :form_params => form_params,
153
+ :body => post_body,
154
+ :auth_names => auth_names,
155
+ :return_type => return_type
156
+ )
157
+
158
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
159
+ if @api_client.config.debugging
160
+ @api_client.config.logger.debug "API called: OrderChannelsApi#create_order_channel_webhook_secret\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
161
+ end
162
+ return data, status_code, headers
163
+ end
164
+
165
+ # Delete order channel
166
+ # Deletes an order channel and cascades deletion of its orders.
167
+ # @param org_id [String] Organization ID.
168
+ # @param channel_id [String] Order channel ID.
169
+ # @param [Hash] opts the optional parameters
170
+ # @return [RevokeApiToken200Response]
171
+ def delete_order_channel(org_id, channel_id, opts = {})
172
+ data, _status_code, _headers = delete_order_channel_with_http_info(org_id, channel_id, opts)
173
+ data
174
+ end
175
+
176
+ # Delete order channel
177
+ # Deletes an order channel and cascades deletion of its orders.
178
+ # @param org_id [String] Organization ID.
179
+ # @param channel_id [String] Order channel ID.
180
+ # @param [Hash] opts the optional parameters
181
+ # @return [Array<(RevokeApiToken200Response, Integer, Hash)>] RevokeApiToken200Response data, response status code and response headers
182
+ def delete_order_channel_with_http_info(org_id, channel_id, opts = {})
183
+ if @api_client.config.debugging
184
+ @api_client.config.logger.debug 'Calling API: OrderChannelsApi.delete_order_channel ...'
185
+ end
186
+ # verify the required parameter 'org_id' is set
187
+ if @api_client.config.client_side_validation && org_id.nil?
188
+ fail ArgumentError, "Missing the required parameter 'org_id' when calling OrderChannelsApi.delete_order_channel"
189
+ end
190
+ # verify the required parameter 'channel_id' is set
191
+ if @api_client.config.client_side_validation && channel_id.nil?
192
+ fail ArgumentError, "Missing the required parameter 'channel_id' when calling OrderChannelsApi.delete_order_channel"
193
+ end
194
+ # resource path
195
+ local_var_path = '/orgs/{orgId}/order-channels/{channelId}'.sub('{orgId}', CGI.escape(org_id.to_s)).sub('{channelId}', CGI.escape(channel_id.to_s))
196
+
197
+ # query parameters
198
+ query_params = opts[:query_params] || {}
199
+
200
+ # header parameters
201
+ header_params = opts[:header_params] || {}
202
+ # HTTP header 'Accept' (if needed)
203
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
204
+
205
+ # form parameters
206
+ form_params = opts[:form_params] || {}
207
+
208
+ # http body (model)
209
+ post_body = opts[:debug_body]
210
+
211
+ # return_type
212
+ return_type = opts[:debug_return_type] || 'RevokeApiToken200Response'
213
+
214
+ # auth_names
215
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
216
+
217
+ new_options = opts.merge(
218
+ :operation => :"OrderChannelsApi.delete_order_channel",
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: OrderChannelsApi#delete_order_channel\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
230
+ end
231
+ return data, status_code, headers
232
+ end
233
+
234
+ # Get order channel
235
+ # Returns a single order channel by ID, including its linked shipping rules.
236
+ # @param org_id [String] Organization ID.
237
+ # @param channel_id [String] Order channel ID.
238
+ # @param [Hash] opts the optional parameters
239
+ # @return [ListOrderChannels200ResponseDataInner]
240
+ def get_order_channel(org_id, channel_id, opts = {})
241
+ data, _status_code, _headers = get_order_channel_with_http_info(org_id, channel_id, opts)
242
+ data
243
+ end
244
+
245
+ # Get order channel
246
+ # Returns a single order channel by ID, including its linked shipping rules.
247
+ # @param org_id [String] Organization ID.
248
+ # @param channel_id [String] Order channel ID.
249
+ # @param [Hash] opts the optional parameters
250
+ # @return [Array<(ListOrderChannels200ResponseDataInner, Integer, Hash)>] ListOrderChannels200ResponseDataInner data, response status code and response headers
251
+ def get_order_channel_with_http_info(org_id, channel_id, opts = {})
252
+ if @api_client.config.debugging
253
+ @api_client.config.logger.debug 'Calling API: OrderChannelsApi.get_order_channel ...'
254
+ end
255
+ # verify the required parameter 'org_id' is set
256
+ if @api_client.config.client_side_validation && org_id.nil?
257
+ fail ArgumentError, "Missing the required parameter 'org_id' when calling OrderChannelsApi.get_order_channel"
258
+ end
259
+ # verify the required parameter 'channel_id' is set
260
+ if @api_client.config.client_side_validation && channel_id.nil?
261
+ fail ArgumentError, "Missing the required parameter 'channel_id' when calling OrderChannelsApi.get_order_channel"
262
+ end
263
+ # resource path
264
+ local_var_path = '/orgs/{orgId}/order-channels/{channelId}'.sub('{orgId}', CGI.escape(org_id.to_s)).sub('{channelId}', CGI.escape(channel_id.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] || 'ListOrderChannels200ResponseDataInner'
282
+
283
+ # auth_names
284
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
285
+
286
+ new_options = opts.merge(
287
+ :operation => :"OrderChannelsApi.get_order_channel",
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: OrderChannelsApi#get_order_channel\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
299
+ end
300
+ return data, status_code, headers
301
+ end
302
+
303
+ # Get channel webhook status
304
+ # Returns whether webhooks are enabled and lists the webhooks registered with the platform.
305
+ # @param org_id [String] Organization ID.
306
+ # @param channel_id [String] Order channel ID.
307
+ # @param [Hash] opts the optional parameters
308
+ # @return [GetOrderChannelWebhookStatus200Response]
309
+ def get_order_channel_webhook_status(org_id, channel_id, opts = {})
310
+ data, _status_code, _headers = get_order_channel_webhook_status_with_http_info(org_id, channel_id, opts)
311
+ data
312
+ end
313
+
314
+ # Get channel webhook status
315
+ # Returns whether webhooks are enabled and lists the webhooks registered with the platform.
316
+ # @param org_id [String] Organization ID.
317
+ # @param channel_id [String] Order channel ID.
318
+ # @param [Hash] opts the optional parameters
319
+ # @return [Array<(GetOrderChannelWebhookStatus200Response, Integer, Hash)>] GetOrderChannelWebhookStatus200Response data, response status code and response headers
320
+ def get_order_channel_webhook_status_with_http_info(org_id, channel_id, opts = {})
321
+ if @api_client.config.debugging
322
+ @api_client.config.logger.debug 'Calling API: OrderChannelsApi.get_order_channel_webhook_status ...'
323
+ end
324
+ # verify the required parameter 'org_id' is set
325
+ if @api_client.config.client_side_validation && org_id.nil?
326
+ fail ArgumentError, "Missing the required parameter 'org_id' when calling OrderChannelsApi.get_order_channel_webhook_status"
327
+ end
328
+ # verify the required parameter 'channel_id' is set
329
+ if @api_client.config.client_side_validation && channel_id.nil?
330
+ fail ArgumentError, "Missing the required parameter 'channel_id' when calling OrderChannelsApi.get_order_channel_webhook_status"
331
+ end
332
+ # resource path
333
+ local_var_path = '/orgs/{orgId}/order-channels/{channelId}/webhooks'.sub('{orgId}', CGI.escape(org_id.to_s)).sub('{channelId}', CGI.escape(channel_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] || 'GetOrderChannelWebhookStatus200Response'
351
+
352
+ # auth_names
353
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
354
+
355
+ new_options = opts.merge(
356
+ :operation => :"OrderChannelsApi.get_order_channel_webhook_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: OrderChannelsApi#get_order_channel_webhook_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
368
+ end
369
+ return data, status_code, headers
370
+ end
371
+
372
+ # List order channels
373
+ # Returns a paginated list of order channels for an organization.
374
+ # @param org_id [String] Organization ID
375
+ # @param [Hash] opts the optional parameters
376
+ # @option opts [Integer] :page Page number (1-based) (default to 1)
377
+ # @option opts [Integer] :limit Items per page (max 100) (default to 20)
378
+ # @option opts [String] :brand_id Filter by brand. Pass a brand ID, or \&quot;none\&quot; for records not assigned to any brand.
379
+ # @option opts [String] :brand_scope How the brand context narrows this list: \&quot;own\&quot; returns only rows assigned to the current brand (requires a brand session, a brand-bound token, or the X-Zippendo-Brand header), \&quot;shared\&quot; returns only unassigned organization-wide rows, \&quot;both\&quot; (default) returns both. The X-Zippendo-Brand-Scope header supplies a default when the parameter is omitted. For strictly brand-owned records (orders, shipments), a brand-scoped request combined with \&quot;shared\&quot; returns no rows, since those records are never visible organization-wide from within a brand context.
380
+ # @option opts [String] :type Filter by channel type.
381
+ # @option opts [String] :enabled Filter by enabled state.
382
+ # @option opts [String] :search Search by channel name.
383
+ # @return [ListOrderChannels200Response]
384
+ def list_order_channels(org_id, opts = {})
385
+ data, _status_code, _headers = list_order_channels_with_http_info(org_id, opts)
386
+ data
387
+ end
388
+
389
+ # List order channels
390
+ # Returns a paginated list of order channels for an organization.
391
+ # @param org_id [String] Organization ID
392
+ # @param [Hash] opts the optional parameters
393
+ # @option opts [Integer] :page Page number (1-based) (default to 1)
394
+ # @option opts [Integer] :limit Items per page (max 100) (default to 20)
395
+ # @option opts [String] :brand_id Filter by brand. Pass a brand ID, or \&quot;none\&quot; for records not assigned to any brand.
396
+ # @option opts [String] :brand_scope How the brand context narrows this list: \&quot;own\&quot; returns only rows assigned to the current brand (requires a brand session, a brand-bound token, or the X-Zippendo-Brand header), \&quot;shared\&quot; returns only unassigned organization-wide rows, \&quot;both\&quot; (default) returns both. The X-Zippendo-Brand-Scope header supplies a default when the parameter is omitted. For strictly brand-owned records (orders, shipments), a brand-scoped request combined with \&quot;shared\&quot; returns no rows, since those records are never visible organization-wide from within a brand context.
397
+ # @option opts [String] :type Filter by channel type.
398
+ # @option opts [String] :enabled Filter by enabled state.
399
+ # @option opts [String] :search Search by channel name.
400
+ # @return [Array<(ListOrderChannels200Response, Integer, Hash)>] ListOrderChannels200Response data, response status code and response headers
401
+ def list_order_channels_with_http_info(org_id, opts = {})
402
+ if @api_client.config.debugging
403
+ @api_client.config.logger.debug 'Calling API: OrderChannelsApi.list_order_channels ...'
404
+ end
405
+ # verify the required parameter 'org_id' is set
406
+ if @api_client.config.client_side_validation && org_id.nil?
407
+ fail ArgumentError, "Missing the required parameter 'org_id' when calling OrderChannelsApi.list_order_channels"
408
+ end
409
+ if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 9007199254740991
410
+ fail ArgumentError, 'invalid value for "opts[:"page"]" when calling OrderChannelsApi.list_order_channels, must be smaller than or equal to 9007199254740991.'
411
+ end
412
+
413
+ if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
414
+ fail ArgumentError, 'invalid value for "opts[:"page"]" when calling OrderChannelsApi.list_order_channels, must be greater than or equal to 1.'
415
+ end
416
+
417
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
418
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling OrderChannelsApi.list_order_channels, must be smaller than or equal to 100.'
419
+ end
420
+
421
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
422
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling OrderChannelsApi.list_order_channels, must be greater than or equal to 1.'
423
+ end
424
+
425
+ allowable_values = ["own", "shared", "both"]
426
+ if @api_client.config.client_side_validation && opts[:'brand_scope'] && !allowable_values.include?(opts[:'brand_scope'])
427
+ fail ArgumentError, "invalid value for \"brand_scope\", must be one of #{allowable_values}"
428
+ end
429
+ allowable_values = ["shopify", "woocommerce", "manual", "custom"]
430
+ if @api_client.config.client_side_validation && opts[:'type'] && !allowable_values.include?(opts[:'type'])
431
+ fail ArgumentError, "invalid value for \"type\", must be one of #{allowable_values}"
432
+ end
433
+ # resource path
434
+ local_var_path = '/orgs/{orgId}/order-channels'.sub('{orgId}', CGI.escape(org_id.to_s))
435
+
436
+ # query parameters
437
+ query_params = opts[:query_params] || {}
438
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
439
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
440
+ query_params[:'brandId'] = opts[:'brand_id'] if !opts[:'brand_id'].nil?
441
+ query_params[:'brandScope'] = opts[:'brand_scope'] if !opts[:'brand_scope'].nil?
442
+ query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
443
+ query_params[:'enabled'] = opts[:'enabled'] if !opts[:'enabled'].nil?
444
+ query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
445
+
446
+ # header parameters
447
+ header_params = opts[:header_params] || {}
448
+ # HTTP header 'Accept' (if needed)
449
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
450
+
451
+ # form parameters
452
+ form_params = opts[:form_params] || {}
453
+
454
+ # http body (model)
455
+ post_body = opts[:debug_body]
456
+
457
+ # return_type
458
+ return_type = opts[:debug_return_type] || 'ListOrderChannels200Response'
459
+
460
+ # auth_names
461
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
462
+
463
+ new_options = opts.merge(
464
+ :operation => :"OrderChannelsApi.list_order_channels",
465
+ :header_params => header_params,
466
+ :query_params => query_params,
467
+ :form_params => form_params,
468
+ :body => post_body,
469
+ :auth_names => auth_names,
470
+ :return_type => return_type
471
+ )
472
+
473
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
474
+ if @api_client.config.debugging
475
+ @api_client.config.logger.debug "API called: OrderChannelsApi#list_order_channels\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
476
+ end
477
+ return data, status_code, headers
478
+ end
479
+
480
+ # Revoke webhook signing secret
481
+ # Revokes the custom channel's webhook signing secret. All subsequent pushes to the ingest URL are rejected until a new secret is generated.
482
+ # @param org_id [String] Organization ID.
483
+ # @param channel_id [String] Order channel ID.
484
+ # @param [Hash] opts the optional parameters
485
+ # @return [RevokeOrderChannelWebhookSecret200Response]
486
+ def revoke_order_channel_webhook_secret(org_id, channel_id, opts = {})
487
+ data, _status_code, _headers = revoke_order_channel_webhook_secret_with_http_info(org_id, channel_id, opts)
488
+ data
489
+ end
490
+
491
+ # Revoke webhook signing secret
492
+ # Revokes the custom channel&#39;s webhook signing secret. All subsequent pushes to the ingest URL are rejected until a new secret is generated.
493
+ # @param org_id [String] Organization ID.
494
+ # @param channel_id [String] Order channel ID.
495
+ # @param [Hash] opts the optional parameters
496
+ # @return [Array<(RevokeOrderChannelWebhookSecret200Response, Integer, Hash)>] RevokeOrderChannelWebhookSecret200Response data, response status code and response headers
497
+ def revoke_order_channel_webhook_secret_with_http_info(org_id, channel_id, opts = {})
498
+ if @api_client.config.debugging
499
+ @api_client.config.logger.debug 'Calling API: OrderChannelsApi.revoke_order_channel_webhook_secret ...'
500
+ end
501
+ # verify the required parameter 'org_id' is set
502
+ if @api_client.config.client_side_validation && org_id.nil?
503
+ fail ArgumentError, "Missing the required parameter 'org_id' when calling OrderChannelsApi.revoke_order_channel_webhook_secret"
504
+ end
505
+ # verify the required parameter 'channel_id' is set
506
+ if @api_client.config.client_side_validation && channel_id.nil?
507
+ fail ArgumentError, "Missing the required parameter 'channel_id' when calling OrderChannelsApi.revoke_order_channel_webhook_secret"
508
+ end
509
+ # resource path
510
+ local_var_path = '/orgs/{orgId}/order-channels/{channelId}/webhook-secret'.sub('{orgId}', CGI.escape(org_id.to_s)).sub('{channelId}', CGI.escape(channel_id.to_s))
511
+
512
+ # query parameters
513
+ query_params = opts[:query_params] || {}
514
+
515
+ # header parameters
516
+ header_params = opts[:header_params] || {}
517
+ # HTTP header 'Accept' (if needed)
518
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
519
+
520
+ # form parameters
521
+ form_params = opts[:form_params] || {}
522
+
523
+ # http body (model)
524
+ post_body = opts[:debug_body]
525
+
526
+ # return_type
527
+ return_type = opts[:debug_return_type] || 'RevokeOrderChannelWebhookSecret200Response'
528
+
529
+ # auth_names
530
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
531
+
532
+ new_options = opts.merge(
533
+ :operation => :"OrderChannelsApi.revoke_order_channel_webhook_secret",
534
+ :header_params => header_params,
535
+ :query_params => query_params,
536
+ :form_params => form_params,
537
+ :body => post_body,
538
+ :auth_names => auth_names,
539
+ :return_type => return_type
540
+ )
541
+
542
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
543
+ if @api_client.config.debugging
544
+ @api_client.config.logger.debug "API called: OrderChannelsApi#revoke_order_channel_webhook_secret\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
545
+ end
546
+ return data, status_code, headers
547
+ end
548
+
549
+ # Update order channel
550
+ # Updates an order channel and its linked shipping rules.
551
+ # @param org_id [String] Organization ID.
552
+ # @param channel_id [String] Order channel ID.
553
+ # @param update_order_channel_request [UpdateOrderChannelRequest]
554
+ # @param [Hash] opts the optional parameters
555
+ # @return [ListOrderChannels200ResponseDataInner]
556
+ def update_order_channel(org_id, channel_id, update_order_channel_request, opts = {})
557
+ data, _status_code, _headers = update_order_channel_with_http_info(org_id, channel_id, update_order_channel_request, opts)
558
+ data
559
+ end
560
+
561
+ # Update order channel
562
+ # Updates an order channel and its linked shipping rules.
563
+ # @param org_id [String] Organization ID.
564
+ # @param channel_id [String] Order channel ID.
565
+ # @param update_order_channel_request [UpdateOrderChannelRequest]
566
+ # @param [Hash] opts the optional parameters
567
+ # @return [Array<(ListOrderChannels200ResponseDataInner, Integer, Hash)>] ListOrderChannels200ResponseDataInner data, response status code and response headers
568
+ def update_order_channel_with_http_info(org_id, channel_id, update_order_channel_request, opts = {})
569
+ if @api_client.config.debugging
570
+ @api_client.config.logger.debug 'Calling API: OrderChannelsApi.update_order_channel ...'
571
+ end
572
+ # verify the required parameter 'org_id' is set
573
+ if @api_client.config.client_side_validation && org_id.nil?
574
+ fail ArgumentError, "Missing the required parameter 'org_id' when calling OrderChannelsApi.update_order_channel"
575
+ end
576
+ # verify the required parameter 'channel_id' is set
577
+ if @api_client.config.client_side_validation && channel_id.nil?
578
+ fail ArgumentError, "Missing the required parameter 'channel_id' when calling OrderChannelsApi.update_order_channel"
579
+ end
580
+ # verify the required parameter 'update_order_channel_request' is set
581
+ if @api_client.config.client_side_validation && update_order_channel_request.nil?
582
+ fail ArgumentError, "Missing the required parameter 'update_order_channel_request' when calling OrderChannelsApi.update_order_channel"
583
+ end
584
+ # resource path
585
+ local_var_path = '/orgs/{orgId}/order-channels/{channelId}'.sub('{orgId}', CGI.escape(org_id.to_s)).sub('{channelId}', CGI.escape(channel_id.to_s))
586
+
587
+ # query parameters
588
+ query_params = opts[:query_params] || {}
589
+
590
+ # header parameters
591
+ header_params = opts[:header_params] || {}
592
+ # HTTP header 'Accept' (if needed)
593
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
594
+ # HTTP header 'Content-Type'
595
+ content_type = @api_client.select_header_content_type(['application/json'])
596
+ if !content_type.nil?
597
+ header_params['Content-Type'] = content_type
598
+ end
599
+
600
+ # form parameters
601
+ form_params = opts[:form_params] || {}
602
+
603
+ # http body (model)
604
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_order_channel_request)
605
+
606
+ # return_type
607
+ return_type = opts[:debug_return_type] || 'ListOrderChannels200ResponseDataInner'
608
+
609
+ # auth_names
610
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
611
+
612
+ new_options = opts.merge(
613
+ :operation => :"OrderChannelsApi.update_order_channel",
614
+ :header_params => header_params,
615
+ :query_params => query_params,
616
+ :form_params => form_params,
617
+ :body => post_body,
618
+ :auth_names => auth_names,
619
+ :return_type => return_type
620
+ )
621
+
622
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
623
+ if @api_client.config.debugging
624
+ @api_client.config.logger.debug "API called: OrderChannelsApi#update_order_channel\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
625
+ end
626
+ return data, status_code, headers
627
+ end
628
+ end
629
+ end