doorflow 1.0.0 → 1.1.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 (197) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/README.md +222 -316
  4. data/bin/post-generate +3 -1
  5. data/doorflow.gemspec +1 -1
  6. data/lib/doorflow/client/credentials_proxy.rb +6 -9
  7. data/lib/doorflow/client/element_sessions_proxy.rb +91 -0
  8. data/lib/doorflow/client.rb +13 -0
  9. data/lib/doorflow/errors/doorflow_error.rb +1 -1
  10. data/lib/doorflow/resources/credential.rb +4 -3
  11. data/lib/doorflow/resources/element_session.rb +28 -0
  12. data/lib/doorflow/webhooks/handler.rb +6 -6
  13. data/lib/doorflow/webhooks/signature_verifier.rb +8 -5
  14. data/lib/doorflow-api/api/accounts_api.rb +1 -1
  15. data/lib/doorflow-api/api/admission_requests_api.rb +2 -2
  16. data/lib/doorflow-api/api/card_designs_api.rb +347 -0
  17. data/lib/doorflow-api/api/card_template_types_api.rb +350 -0
  18. data/lib/doorflow-api/api/card_templates_api.rb +811 -0
  19. data/lib/doorflow-api/api/channels_api.rb +11 -11
  20. data/lib/doorflow-api/api/credential_types_api.rb +1 -1
  21. data/lib/doorflow-api/api/credentials_api.rb +6 -6
  22. data/lib/doorflow-api/api/element_sessions_api.rb +90 -0
  23. data/lib/doorflow-api/api/events_api.rb +2 -2
  24. data/lib/doorflow-api/api/group_reservations_api.rb +68 -5
  25. data/lib/doorflow-api/api/groups_api.rb +1 -1
  26. data/lib/doorflow-api/api/notification_rules_api.rb +7 -7
  27. data/lib/doorflow-api/api/oauth_api.rb +1 -1
  28. data/lib/doorflow-api/api/people_api.rb +7 -7
  29. data/lib/doorflow-api/api/reservations_api.rb +5 -5
  30. data/lib/doorflow-api/api/roles_api.rb +1 -1
  31. data/lib/doorflow-api/api/sites_api.rb +1 -1
  32. data/lib/doorflow-api/api/sync_api.rb +4 -4
  33. data/lib/doorflow-api/api_client.rb +8 -4
  34. data/lib/doorflow-api/api_error.rb +9 -14
  35. data/lib/doorflow-api/api_model_base.rb +1 -1
  36. data/lib/doorflow-api/configuration.rb +1 -1
  37. data/lib/doorflow-api/models/account.rb +1 -1
  38. data/lib/doorflow-api/models/account_passport.rb +1 -1
  39. data/lib/doorflow-api/models/account_reseller.rb +1 -1
  40. data/lib/doorflow-api/models/account_sync.rb +1 -1
  41. data/lib/doorflow-api/models/account_user.rb +1 -1
  42. data/lib/doorflow-api/models/admission_request.rb +1 -1
  43. data/lib/doorflow-api/models/admission_request_door_controller.rb +1 -1
  44. data/lib/doorflow-api/models/admission_request_person.rb +1 -1
  45. data/lib/doorflow-api/models/admit_channel202_response.rb +1 -1
  46. data/lib/doorflow-api/models/admit_person202_response.rb +1 -1
  47. data/lib/doorflow-api/models/admit_person403_response.rb +1 -1
  48. data/lib/doorflow-api/models/admit_person_request.rb +1 -1
  49. data/lib/doorflow-api/models/auto_unlock_channel400_response.rb +1 -1
  50. data/lib/doorflow-api/models/auto_unlock_channel_request.rb +1 -1
  51. data/lib/doorflow-api/models/card_design.rb +243 -0
  52. data/lib/doorflow-api/models/card_design_image_back.rb +179 -0
  53. data/lib/doorflow-api/models/card_design_image_front.rb +179 -0
  54. data/lib/doorflow-api/models/card_design_input.rb +181 -0
  55. data/lib/doorflow-api/models/card_template.rb +475 -0
  56. data/lib/doorflow-api/models/card_template_input.rb +147 -0
  57. data/lib/doorflow-api/models/card_template_input_card_template.rb +347 -0
  58. data/lib/doorflow-api/models/card_template_type.rb +321 -0
  59. data/lib/doorflow-api/models/card_template_type_input.rb +147 -0
  60. data/lib/doorflow-api/models/card_template_type_input_card_template_type.rb +251 -0
  61. data/lib/doorflow-api/models/card_template_type_input_card_template_type_non_printable_zones_inner.rb +183 -0
  62. data/lib/doorflow-api/models/card_template_type_non_printable_zones_inner.rb +188 -0
  63. data/lib/doorflow-api/models/channel.rb +1 -1
  64. data/lib/doorflow-api/models/channel_auto_unlock.rb +1 -1
  65. data/lib/doorflow-api/models/channel_lockdown.rb +1 -1
  66. data/lib/doorflow-api/models/channel_lockdown_aux_lockdown.rb +1 -1
  67. data/lib/doorflow-api/models/channel_lockdown_card_lockdown.rb +1 -1
  68. data/lib/doorflow-api/models/channel_lockdown_rex_lockdown.rb +1 -1
  69. data/lib/doorflow-api/models/channel_mode.rb +1 -1
  70. data/lib/doorflow-api/models/channel_sync.rb +5 -2
  71. data/lib/doorflow-api/models/{create_credential422_response.rb → create_card_design422_response.rb} +5 -5
  72. data/lib/doorflow-api/models/{create_credential422_response_errors.rb → create_card_design422_response_errors.rb} +4 -4
  73. data/lib/doorflow-api/models/credential.rb +4 -4
  74. data/lib/doorflow-api/models/credential_input.rb +1 -1
  75. data/lib/doorflow-api/models/credential_input_person_credential.rb +1 -1
  76. data/lib/doorflow-api/models/credential_type.rb +1 -1
  77. data/lib/doorflow-api/models/credential_update_input.rb +1 -1
  78. data/lib/doorflow-api/models/credential_update_input_person_credential.rb +1 -1
  79. data/lib/doorflow-api/models/{delete_group_reservation200_response.rb → delete_card_design200_response.rb} +4 -4
  80. data/lib/doorflow-api/models/delete_card_template_type409_response.rb +147 -0
  81. data/lib/doorflow-api/models/element_session.rb +192 -0
  82. data/lib/doorflow-api/models/element_session_config.rb +265 -0
  83. data/lib/doorflow-api/models/element_session_error.rb +199 -0
  84. data/lib/doorflow-api/models/element_session_input.rb +271 -0
  85. data/lib/doorflow-api/models/element_session_member.rb +186 -0
  86. data/lib/doorflow-api/models/error.rb +1 -1
  87. data/lib/doorflow-api/models/event.rb +1 -1
  88. data/lib/doorflow-api/models/get_access_token200_response.rb +1 -1
  89. data/lib/doorflow-api/models/get_access_token400_response.rb +1 -1
  90. data/lib/doorflow-api/models/get_access_token401_response.rb +1 -1
  91. data/lib/doorflow-api/models/get_admission_request401_response.rb +1 -1
  92. data/lib/doorflow-api/models/get_admission_request403_response.rb +1 -1
  93. data/lib/doorflow-api/models/get_admission_request404_response.rb +1 -1
  94. data/lib/doorflow-api/models/get_admission_request500_response.rb +1 -1
  95. data/lib/doorflow-api/models/get_token_info200_response.rb +1 -1
  96. data/lib/doorflow-api/models/get_token_info200_response_application.rb +1 -1
  97. data/lib/doorflow-api/models/get_token_info401_response.rb +1 -1
  98. data/lib/doorflow-api/models/group.rb +1 -1
  99. data/lib/doorflow-api/models/group_reservation.rb +1 -1
  100. data/lib/doorflow-api/models/group_reservation_input.rb +1 -1
  101. data/lib/doorflow-api/models/group_reservation_input_group_reservation.rb +1 -1
  102. data/lib/doorflow-api/models/initiate_sync429_response.rb +1 -1
  103. data/lib/doorflow-api/models/linked_file.rb +217 -0
  104. data/lib/doorflow-api/models/list_events400_response.rb +1 -1
  105. data/lib/doorflow-api/models/lockdown_channel_request.rb +1 -1
  106. data/lib/doorflow-api/models/notification_rule.rb +1 -1
  107. data/lib/doorflow-api/models/notification_rule_actions_inner.rb +1 -1
  108. data/lib/doorflow-api/models/notification_rule_conditions_inner.rb +1 -1
  109. data/lib/doorflow-api/models/notification_rule_events_inner.rb +1 -1
  110. data/lib/doorflow-api/models/notification_rule_input.rb +1 -1
  111. data/lib/doorflow-api/models/person.rb +30 -8
  112. data/lib/doorflow-api/models/person_input.rb +1 -1
  113. data/lib/doorflow-api/models/reservation.rb +1 -1
  114. data/lib/doorflow-api/models/reservation_input.rb +1 -1
  115. data/lib/doorflow-api/models/revoke_token403_response.rb +1 -1
  116. data/lib/doorflow-api/models/role.rb +1 -1
  117. data/lib/doorflow-api/models/site.rb +1 -1
  118. data/lib/doorflow-api/models/site_site_ips_inner.rb +1 -1
  119. data/lib/doorflow-api/models/unlock_channel_request.rb +1 -1
  120. data/lib/doorflow-api/version.rb +2 -2
  121. data/lib/doorflow-api.rb +28 -9
  122. data/lib/doorflow.rb +8 -2
  123. metadata +45 -154
  124. data/spec/api/admission_requests_api_spec.rb +0 -47
  125. data/spec/api/channels_api_spec.rb +0 -174
  126. data/spec/api/credential_types_api_spec.rb +0 -49
  127. data/spec/api/group_reservations_api_spec.rb +0 -75
  128. data/spec/api/oauth_api_spec.rb +0 -97
  129. data/spec/doorflow/client_spec.rb +0 -109
  130. data/spec/doorflow_spec.rb +0 -22
  131. data/spec/fixtures/vcr_cassettes/channel/list.yml +0 -70
  132. data/spec/fixtures/vcr_cassettes/channel/retrieve.yml +0 -131
  133. data/spec/fixtures/vcr_cassettes/person/auto_pagination.yml +0 -87
  134. data/spec/fixtures/vcr_cassettes/person/create.yml +0 -64
  135. data/spec/fixtures/vcr_cassettes/person/delete.yml +0 -125
  136. data/spec/fixtures/vcr_cassettes/person/list.yml +0 -90
  137. data/spec/fixtures/vcr_cassettes/person/not_found.yml +0 -62
  138. data/spec/fixtures/vcr_cassettes/person/retrieve.yml +0 -136
  139. data/spec/fixtures/vcr_cassettes/person/update.yml +0 -260
  140. data/spec/fixtures/vcr_cassettes/person/validation_error.yml +0 -62
  141. data/spec/integration/channel_spec.rb +0 -88
  142. data/spec/integration/person_spec.rb +0 -99
  143. data/spec/models/account_passport_spec.rb +0 -42
  144. data/spec/models/account_reseller_spec.rb +0 -60
  145. data/spec/models/account_sync_spec.rb +0 -52
  146. data/spec/models/account_user_spec.rb +0 -54
  147. data/spec/models/admission_request_door_controller_spec.rb +0 -42
  148. data/spec/models/admission_request_person_spec.rb +0 -42
  149. data/spec/models/admission_request_spec.rb +0 -82
  150. data/spec/models/admit_channel202_response_spec.rb +0 -46
  151. data/spec/models/admit_person202_response_spec.rb +0 -46
  152. data/spec/models/admit_person403_response_spec.rb +0 -42
  153. data/spec/models/admit_person_request_spec.rb +0 -36
  154. data/spec/models/auto_unlock_channel400_response_spec.rb +0 -42
  155. data/spec/models/auto_unlock_channel_request_spec.rb +0 -36
  156. data/spec/models/channel_auto_unlock_spec.rb +0 -42
  157. data/spec/models/channel_lockdown_aux_lockdown_spec.rb +0 -36
  158. data/spec/models/channel_lockdown_card_lockdown_spec.rb +0 -36
  159. data/spec/models/channel_lockdown_rex_lockdown_spec.rb +0 -36
  160. data/spec/models/channel_lockdown_spec.rb +0 -54
  161. data/spec/models/channel_mode_spec.rb +0 -52
  162. data/spec/models/channel_sync_spec.rb +0 -46
  163. data/spec/models/create_credential422_response_errors_spec.rb +0 -48
  164. data/spec/models/create_credential422_response_spec.rb +0 -42
  165. data/spec/models/credential_input_person_credential_spec.rb +0 -48
  166. data/spec/models/credential_input_spec.rb +0 -36
  167. data/spec/models/credential_spec.rb +0 -86
  168. data/spec/models/credential_update_input_person_credential_spec.rb +0 -36
  169. data/spec/models/credential_update_input_spec.rb +0 -36
  170. data/spec/models/delete_group_reservation200_response_spec.rb +0 -36
  171. data/spec/models/error_spec.rb +0 -42
  172. data/spec/models/get_access_token200_response_spec.rb +0 -66
  173. data/spec/models/get_access_token400_response_spec.rb +0 -46
  174. data/spec/models/get_access_token401_response_spec.rb +0 -42
  175. data/spec/models/get_admission_request401_response_spec.rb +0 -42
  176. data/spec/models/get_admission_request403_response_spec.rb +0 -42
  177. data/spec/models/get_admission_request404_response_spec.rb +0 -42
  178. data/spec/models/get_admission_request500_response_spec.rb +0 -42
  179. data/spec/models/get_token_info200_response_application_spec.rb +0 -36
  180. data/spec/models/get_token_info200_response_spec.rb +0 -66
  181. data/spec/models/get_token_info401_response_spec.rb +0 -42
  182. data/spec/models/group_reservation_input_group_reservation_spec.rb +0 -54
  183. data/spec/models/group_reservation_input_spec.rb +0 -36
  184. data/spec/models/group_reservation_spec.rb +0 -82
  185. data/spec/models/initiate_sync429_response_spec.rb +0 -52
  186. data/spec/models/list_events400_response_spec.rb +0 -42
  187. data/spec/models/lockdown_channel_request_spec.rb +0 -48
  188. data/spec/models/notification_rule_actions_inner_spec.rb +0 -48
  189. data/spec/models/notification_rule_conditions_inner_spec.rb +0 -48
  190. data/spec/models/notification_rule_events_inner_spec.rb +0 -42
  191. data/spec/models/notification_rule_input_spec.rb +0 -60
  192. data/spec/models/person_input_spec.rb +0 -180
  193. data/spec/models/reservation_input_spec.rb +0 -60
  194. data/spec/models/revoke_token403_response_spec.rb +0 -42
  195. data/spec/models/site_site_ips_inner_spec.rb +0 -36
  196. data/spec/models/unlock_channel_request_spec.rb +0 -36
  197. data/spec/spec_helper.rb +0 -160
@@ -0,0 +1,811 @@
1
+ =begin
2
+ #DoorFlow API
3
+
4
+ #Access control and door management API for DoorFlow
5
+
6
+ The version of the OpenAPI document: 3.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.24.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module DoorFlow
16
+ class CardTemplatesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create card template
23
+ # Creates a new card template. The client should submit a locally generated uuid. The server preserves this and returns the server-assigned id.
24
+ # @param card_template_input [CardTemplateInput]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [CardTemplate]
27
+ def create_card_template(card_template_input, opts = {})
28
+ data, _status_code, _headers = create_card_template_with_http_info(card_template_input, opts)
29
+ data
30
+ end
31
+
32
+ # Create card template
33
+ # Creates a new card template. The client should submit a locally generated uuid. The server preserves this and returns the server-assigned id.
34
+ # @param card_template_input [CardTemplateInput]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(CardTemplate, Integer, Hash)>] CardTemplate data, response status code and response headers
37
+ def create_card_template_with_http_info(card_template_input, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: CardTemplatesApi.create_card_template ...'
40
+ end
41
+ # verify the required parameter 'card_template_input' is set
42
+ if @api_client.config.client_side_validation && card_template_input.nil?
43
+ fail ArgumentError, "Missing the required parameter 'card_template_input' when calling CardTemplatesApi.create_card_template"
44
+ end
45
+ # resource path
46
+ local_var_path = '/api/3/card_templates'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
55
+ # HTTP header 'Content-Type'
56
+ content_type = @api_client.select_header_content_type(['application/json'])
57
+ if !content_type.nil?
58
+ header_params['Content-Type'] = content_type
59
+ end
60
+
61
+ # form parameters
62
+ form_params = opts[:form_params] || {}
63
+
64
+ # http body (model)
65
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(card_template_input)
66
+
67
+ # return_type
68
+ return_type = opts[:debug_return_type] || 'CardTemplate'
69
+
70
+ # auth_names
71
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
72
+
73
+ new_options = opts.merge(
74
+ :operation => :"CardTemplatesApi.create_card_template",
75
+ :header_params => header_params,
76
+ :query_params => query_params,
77
+ :form_params => form_params,
78
+ :body => post_body,
79
+ :auth_names => auth_names,
80
+ :return_type => return_type
81
+ )
82
+
83
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
84
+ if @api_client.config.debugging
85
+ @api_client.config.logger.debug "API called: CardTemplatesApi#create_card_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
86
+ end
87
+ return data, status_code, headers
88
+ end
89
+
90
+ # Delete card template (hard-delete)
91
+ # Permanently deletes a card template and all associated template elements and background images. The record is removed from the database and cannot be restored. Permitted for any admin in the account. For a recoverable delete, PATCH `deleted_at` instead.
92
+ # @param id [Integer] Card template ID
93
+ # @param [Hash] opts the optional parameters
94
+ # @return [nil]
95
+ def delete_card_template(id, opts = {})
96
+ delete_card_template_with_http_info(id, opts)
97
+ nil
98
+ end
99
+
100
+ # Delete card template (hard-delete)
101
+ # Permanently deletes a card template and all associated template elements and background images. The record is removed from the database and cannot be restored. Permitted for any admin in the account. For a recoverable delete, PATCH &#x60;deleted_at&#x60; instead.
102
+ # @param id [Integer] Card template ID
103
+ # @param [Hash] opts the optional parameters
104
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
105
+ def delete_card_template_with_http_info(id, opts = {})
106
+ if @api_client.config.debugging
107
+ @api_client.config.logger.debug 'Calling API: CardTemplatesApi.delete_card_template ...'
108
+ end
109
+ # verify the required parameter 'id' is set
110
+ if @api_client.config.client_side_validation && id.nil?
111
+ fail ArgumentError, "Missing the required parameter 'id' when calling CardTemplatesApi.delete_card_template"
112
+ end
113
+ # resource path
114
+ local_var_path = '/api/3/card_templates/{id}'.sub('{id}', CGI.escape(id.to_s))
115
+
116
+ # query parameters
117
+ query_params = opts[:query_params] || {}
118
+
119
+ # header parameters
120
+ header_params = opts[:header_params] || {}
121
+ # HTTP header 'Accept' (if needed)
122
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
123
+
124
+ # form parameters
125
+ form_params = opts[:form_params] || {}
126
+
127
+ # http body (model)
128
+ post_body = opts[:debug_body]
129
+
130
+ # return_type
131
+ return_type = opts[:debug_return_type]
132
+
133
+ # auth_names
134
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
135
+
136
+ new_options = opts.merge(
137
+ :operation => :"CardTemplatesApi.delete_card_template",
138
+ :header_params => header_params,
139
+ :query_params => query_params,
140
+ :form_params => form_params,
141
+ :body => post_body,
142
+ :auth_names => auth_names,
143
+ :return_type => return_type
144
+ )
145
+
146
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
147
+ if @api_client.config.debugging
148
+ @api_client.config.logger.debug "API called: CardTemplatesApi#delete_card_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
149
+ end
150
+ return data, status_code, headers
151
+ end
152
+
153
+ # Delete background image
154
+ # Removes the background image for the specified side.
155
+ # @param id [Integer] Card template ID
156
+ # @param side [String] Which side of the card
157
+ # @param [Hash] opts the optional parameters
158
+ # @return [nil]
159
+ def delete_card_template_background_image(id, side, opts = {})
160
+ delete_card_template_background_image_with_http_info(id, side, opts)
161
+ nil
162
+ end
163
+
164
+ # Delete background image
165
+ # Removes the background image for the specified side.
166
+ # @param id [Integer] Card template ID
167
+ # @param side [String] Which side of the card
168
+ # @param [Hash] opts the optional parameters
169
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
170
+ def delete_card_template_background_image_with_http_info(id, side, opts = {})
171
+ if @api_client.config.debugging
172
+ @api_client.config.logger.debug 'Calling API: CardTemplatesApi.delete_card_template_background_image ...'
173
+ end
174
+ # verify the required parameter 'id' is set
175
+ if @api_client.config.client_side_validation && id.nil?
176
+ fail ArgumentError, "Missing the required parameter 'id' when calling CardTemplatesApi.delete_card_template_background_image"
177
+ end
178
+ # verify the required parameter 'side' is set
179
+ if @api_client.config.client_side_validation && side.nil?
180
+ fail ArgumentError, "Missing the required parameter 'side' when calling CardTemplatesApi.delete_card_template_background_image"
181
+ end
182
+ # verify enum value
183
+ allowable_values = ["front", "back"]
184
+ if @api_client.config.client_side_validation && !allowable_values.include?(side)
185
+ fail ArgumentError, "invalid value for \"side\", must be one of #{allowable_values}"
186
+ end
187
+ # resource path
188
+ local_var_path = '/api/3/card_templates/{id}/background_image/{side}'.sub('{id}', CGI.escape(id.to_s)).sub('{side}', CGI.escape(side.to_s))
189
+
190
+ # query parameters
191
+ query_params = opts[:query_params] || {}
192
+
193
+ # header parameters
194
+ header_params = opts[:header_params] || {}
195
+ # HTTP header 'Accept' (if needed)
196
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
197
+
198
+ # form parameters
199
+ form_params = opts[:form_params] || {}
200
+
201
+ # http body (model)
202
+ post_body = opts[:debug_body]
203
+
204
+ # return_type
205
+ return_type = opts[:debug_return_type]
206
+
207
+ # auth_names
208
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
209
+
210
+ new_options = opts.merge(
211
+ :operation => :"CardTemplatesApi.delete_card_template_background_image",
212
+ :header_params => header_params,
213
+ :query_params => query_params,
214
+ :form_params => form_params,
215
+ :body => post_body,
216
+ :auth_names => auth_names,
217
+ :return_type => return_type
218
+ )
219
+
220
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
221
+ if @api_client.config.debugging
222
+ @api_client.config.logger.debug "API called: CardTemplatesApi#delete_card_template_background_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
223
+ end
224
+ return data, status_code, headers
225
+ end
226
+
227
+ # Delete linked file
228
+ # Removes a linked file from a card template.
229
+ # @param id [Integer] Card template ID
230
+ # @param file_uuid [String] UUID of the linked file
231
+ # @param [Hash] opts the optional parameters
232
+ # @return [nil]
233
+ def delete_card_template_file(id, file_uuid, opts = {})
234
+ delete_card_template_file_with_http_info(id, file_uuid, opts)
235
+ nil
236
+ end
237
+
238
+ # Delete linked file
239
+ # Removes a linked file from a card template.
240
+ # @param id [Integer] Card template ID
241
+ # @param file_uuid [String] UUID of the linked file
242
+ # @param [Hash] opts the optional parameters
243
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
244
+ def delete_card_template_file_with_http_info(id, file_uuid, opts = {})
245
+ if @api_client.config.debugging
246
+ @api_client.config.logger.debug 'Calling API: CardTemplatesApi.delete_card_template_file ...'
247
+ end
248
+ # verify the required parameter 'id' is set
249
+ if @api_client.config.client_side_validation && id.nil?
250
+ fail ArgumentError, "Missing the required parameter 'id' when calling CardTemplatesApi.delete_card_template_file"
251
+ end
252
+ # verify the required parameter 'file_uuid' is set
253
+ if @api_client.config.client_side_validation && file_uuid.nil?
254
+ fail ArgumentError, "Missing the required parameter 'file_uuid' when calling CardTemplatesApi.delete_card_template_file"
255
+ end
256
+ # resource path
257
+ local_var_path = '/api/3/card_templates/{id}/files/{file_uuid}'.sub('{id}', CGI.escape(id.to_s)).sub('{file_uuid}', CGI.escape(file_uuid.to_s))
258
+
259
+ # query parameters
260
+ query_params = opts[:query_params] || {}
261
+
262
+ # header parameters
263
+ header_params = opts[:header_params] || {}
264
+ # HTTP header 'Accept' (if needed)
265
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
266
+
267
+ # form parameters
268
+ form_params = opts[:form_params] || {}
269
+
270
+ # http body (model)
271
+ post_body = opts[:debug_body]
272
+
273
+ # return_type
274
+ return_type = opts[:debug_return_type]
275
+
276
+ # auth_names
277
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
278
+
279
+ new_options = opts.merge(
280
+ :operation => :"CardTemplatesApi.delete_card_template_file",
281
+ :header_params => header_params,
282
+ :query_params => query_params,
283
+ :form_params => form_params,
284
+ :body => post_body,
285
+ :auth_names => auth_names,
286
+ :return_type => return_type
287
+ )
288
+
289
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
290
+ if @api_client.config.debugging
291
+ @api_client.config.logger.debug "API called: CardTemplatesApi#delete_card_template_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
292
+ end
293
+ return data, status_code, headers
294
+ end
295
+
296
+ # Get card template
297
+ # Returns a single card template by ID including all template elements.
298
+ # @param id [Integer] Card template ID
299
+ # @param [Hash] opts the optional parameters
300
+ # @return [CardTemplate]
301
+ def get_card_template(id, opts = {})
302
+ data, _status_code, _headers = get_card_template_with_http_info(id, opts)
303
+ data
304
+ end
305
+
306
+ # Get card template
307
+ # Returns a single card template by ID including all template elements.
308
+ # @param id [Integer] Card template ID
309
+ # @param [Hash] opts the optional parameters
310
+ # @return [Array<(CardTemplate, Integer, Hash)>] CardTemplate data, response status code and response headers
311
+ def get_card_template_with_http_info(id, opts = {})
312
+ if @api_client.config.debugging
313
+ @api_client.config.logger.debug 'Calling API: CardTemplatesApi.get_card_template ...'
314
+ end
315
+ # verify the required parameter 'id' is set
316
+ if @api_client.config.client_side_validation && id.nil?
317
+ fail ArgumentError, "Missing the required parameter 'id' when calling CardTemplatesApi.get_card_template"
318
+ end
319
+ # resource path
320
+ local_var_path = '/api/3/card_templates/{id}'.sub('{id}', CGI.escape(id.to_s))
321
+
322
+ # query parameters
323
+ query_params = opts[:query_params] || {}
324
+
325
+ # header parameters
326
+ header_params = opts[:header_params] || {}
327
+ # HTTP header 'Accept' (if needed)
328
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
329
+
330
+ # form parameters
331
+ form_params = opts[:form_params] || {}
332
+
333
+ # http body (model)
334
+ post_body = opts[:debug_body]
335
+
336
+ # return_type
337
+ return_type = opts[:debug_return_type] || 'CardTemplate'
338
+
339
+ # auth_names
340
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
341
+
342
+ new_options = opts.merge(
343
+ :operation => :"CardTemplatesApi.get_card_template",
344
+ :header_params => header_params,
345
+ :query_params => query_params,
346
+ :form_params => form_params,
347
+ :body => post_body,
348
+ :auth_names => auth_names,
349
+ :return_type => return_type
350
+ )
351
+
352
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
353
+ if @api_client.config.debugging
354
+ @api_client.config.logger.debug "API called: CardTemplatesApi#get_card_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
355
+ end
356
+ return data, status_code, headers
357
+ end
358
+
359
+ # Get background image
360
+ # Returns the background image for the specified side. Redirects to the image URL.
361
+ # @param id [Integer] Card template ID
362
+ # @param side [String] Which side of the card
363
+ # @param [Hash] opts the optional parameters
364
+ # @return [nil]
365
+ def get_card_template_background_image(id, side, opts = {})
366
+ get_card_template_background_image_with_http_info(id, side, opts)
367
+ nil
368
+ end
369
+
370
+ # Get background image
371
+ # Returns the background image for the specified side. Redirects to the image URL.
372
+ # @param id [Integer] Card template ID
373
+ # @param side [String] Which side of the card
374
+ # @param [Hash] opts the optional parameters
375
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
376
+ def get_card_template_background_image_with_http_info(id, side, opts = {})
377
+ if @api_client.config.debugging
378
+ @api_client.config.logger.debug 'Calling API: CardTemplatesApi.get_card_template_background_image ...'
379
+ end
380
+ # verify the required parameter 'id' is set
381
+ if @api_client.config.client_side_validation && id.nil?
382
+ fail ArgumentError, "Missing the required parameter 'id' when calling CardTemplatesApi.get_card_template_background_image"
383
+ end
384
+ # verify the required parameter 'side' is set
385
+ if @api_client.config.client_side_validation && side.nil?
386
+ fail ArgumentError, "Missing the required parameter 'side' when calling CardTemplatesApi.get_card_template_background_image"
387
+ end
388
+ # verify enum value
389
+ allowable_values = ["front", "back"]
390
+ if @api_client.config.client_side_validation && !allowable_values.include?(side)
391
+ fail ArgumentError, "invalid value for \"side\", must be one of #{allowable_values}"
392
+ end
393
+ # resource path
394
+ local_var_path = '/api/3/card_templates/{id}/background_image/{side}'.sub('{id}', CGI.escape(id.to_s)).sub('{side}', CGI.escape(side.to_s))
395
+
396
+ # query parameters
397
+ query_params = opts[:query_params] || {}
398
+
399
+ # header parameters
400
+ header_params = opts[:header_params] || {}
401
+ # HTTP header 'Accept' (if needed)
402
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
403
+
404
+ # form parameters
405
+ form_params = opts[:form_params] || {}
406
+
407
+ # http body (model)
408
+ post_body = opts[:debug_body]
409
+
410
+ # return_type
411
+ return_type = opts[:debug_return_type]
412
+
413
+ # auth_names
414
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
415
+
416
+ new_options = opts.merge(
417
+ :operation => :"CardTemplatesApi.get_card_template_background_image",
418
+ :header_params => header_params,
419
+ :query_params => query_params,
420
+ :form_params => form_params,
421
+ :body => post_body,
422
+ :auth_names => auth_names,
423
+ :return_type => return_type
424
+ )
425
+
426
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
427
+ if @api_client.config.debugging
428
+ @api_client.config.logger.debug "API called: CardTemplatesApi#get_card_template_background_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
429
+ end
430
+ return data, status_code, headers
431
+ end
432
+
433
+ # List linked files
434
+ # Returns all files linked to a card template.
435
+ # @param id [Integer] Card template ID
436
+ # @param [Hash] opts the optional parameters
437
+ # @return [Array<LinkedFile>]
438
+ def list_card_template_files(id, opts = {})
439
+ data, _status_code, _headers = list_card_template_files_with_http_info(id, opts)
440
+ data
441
+ end
442
+
443
+ # List linked files
444
+ # Returns all files linked to a card template.
445
+ # @param id [Integer] Card template ID
446
+ # @param [Hash] opts the optional parameters
447
+ # @return [Array<(Array<LinkedFile>, Integer, Hash)>] Array<LinkedFile> data, response status code and response headers
448
+ def list_card_template_files_with_http_info(id, opts = {})
449
+ if @api_client.config.debugging
450
+ @api_client.config.logger.debug 'Calling API: CardTemplatesApi.list_card_template_files ...'
451
+ end
452
+ # verify the required parameter 'id' is set
453
+ if @api_client.config.client_side_validation && id.nil?
454
+ fail ArgumentError, "Missing the required parameter 'id' when calling CardTemplatesApi.list_card_template_files"
455
+ end
456
+ # resource path
457
+ local_var_path = '/api/3/card_templates/{id}/files'.sub('{id}', CGI.escape(id.to_s))
458
+
459
+ # query parameters
460
+ query_params = opts[:query_params] || {}
461
+
462
+ # header parameters
463
+ header_params = opts[:header_params] || {}
464
+ # HTTP header 'Accept' (if needed)
465
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
466
+
467
+ # form parameters
468
+ form_params = opts[:form_params] || {}
469
+
470
+ # http body (model)
471
+ post_body = opts[:debug_body]
472
+
473
+ # return_type
474
+ return_type = opts[:debug_return_type] || 'Array<LinkedFile>'
475
+
476
+ # auth_names
477
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
478
+
479
+ new_options = opts.merge(
480
+ :operation => :"CardTemplatesApi.list_card_template_files",
481
+ :header_params => header_params,
482
+ :query_params => query_params,
483
+ :form_params => form_params,
484
+ :body => post_body,
485
+ :auth_names => auth_names,
486
+ :return_type => return_type
487
+ )
488
+
489
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
490
+ if @api_client.config.debugging
491
+ @api_client.config.logger.debug "API called: CardTemplatesApi#list_card_template_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
492
+ end
493
+ return data, status_code, headers
494
+ end
495
+
496
+ # List card templates
497
+ # Returns a paginated list of card templates for the authenticated account. Soft-deleted templates (deleted_at is not null) are excluded by default; pass include_deleted=true to include them.
498
+ # @param [Hash] opts the optional parameters
499
+ # @option opts [Integer] :page Page number (default to 1)
500
+ # @option opts [Integer] :per_page Results per page (default to 50)
501
+ # @option opts [Time] :updated_since ISO 8601 timestamp. Returns only records updated after this time
502
+ # @option opts [Boolean] :include_deleted When true, soft-deleted templates are included in the response. Defaults to false. (default to false)
503
+ # @return [Array<CardTemplate>]
504
+ def list_card_templates(opts = {})
505
+ data, _status_code, _headers = list_card_templates_with_http_info(opts)
506
+ data
507
+ end
508
+
509
+ # List card templates
510
+ # Returns a paginated list of card templates for the authenticated account. Soft-deleted templates (deleted_at is not null) are excluded by default; pass include_deleted&#x3D;true to include them.
511
+ # @param [Hash] opts the optional parameters
512
+ # @option opts [Integer] :page Page number (default to 1)
513
+ # @option opts [Integer] :per_page Results per page (default to 50)
514
+ # @option opts [Time] :updated_since ISO 8601 timestamp. Returns only records updated after this time
515
+ # @option opts [Boolean] :include_deleted When true, soft-deleted templates are included in the response. Defaults to false. (default to false)
516
+ # @return [Array<(Array<CardTemplate>, Integer, Hash)>] Array<CardTemplate> data, response status code and response headers
517
+ def list_card_templates_with_http_info(opts = {})
518
+ if @api_client.config.debugging
519
+ @api_client.config.logger.debug 'Calling API: CardTemplatesApi.list_card_templates ...'
520
+ end
521
+ # resource path
522
+ local_var_path = '/api/3/card_templates'
523
+
524
+ # query parameters
525
+ query_params = opts[:query_params] || {}
526
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
527
+ query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
528
+ query_params[:'updated_since'] = opts[:'updated_since'] if !opts[:'updated_since'].nil?
529
+ query_params[:'include_deleted'] = opts[:'include_deleted'] if !opts[:'include_deleted'].nil?
530
+
531
+ # header parameters
532
+ header_params = opts[:header_params] || {}
533
+ # HTTP header 'Accept' (if needed)
534
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
535
+
536
+ # form parameters
537
+ form_params = opts[:form_params] || {}
538
+
539
+ # http body (model)
540
+ post_body = opts[:debug_body]
541
+
542
+ # return_type
543
+ return_type = opts[:debug_return_type] || 'Array<CardTemplate>'
544
+
545
+ # auth_names
546
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
547
+
548
+ new_options = opts.merge(
549
+ :operation => :"CardTemplatesApi.list_card_templates",
550
+ :header_params => header_params,
551
+ :query_params => query_params,
552
+ :form_params => form_params,
553
+ :body => post_body,
554
+ :auth_names => auth_names,
555
+ :return_type => return_type
556
+ )
557
+
558
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
559
+ if @api_client.config.debugging
560
+ @api_client.config.logger.debug "API called: CardTemplatesApi#list_card_templates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
561
+ end
562
+ return data, status_code, headers
563
+ end
564
+
565
+ # Update card template
566
+ # Updates an existing card template. Submitting template_objects replaces the entire objects array. Three special update modes are recognised: - **Soft-delete**: PATCH `deleted_at` to a non-null timestamp to soft-delete (or null to restore). The server records `deleted_by_id` from the authenticated user. Soft-delete is permitted for any admin in the account, regardless of `editable_by` or `owner_id`. - **Owner transfer**: PATCH `owner_id` to reassign ownership. Permitted for the current owner or any admin in the account. The new value must be the ID of an admin in the same account. - **Content edits** (any other writable field): respect the existing `editable_by` rule; if `editable_by` is `owner_only`, only the current owner may edit.
567
+ # @param id [Integer] Card template ID
568
+ # @param card_template_input [CardTemplateInput]
569
+ # @param [Hash] opts the optional parameters
570
+ # @return [CardTemplate]
571
+ def update_card_template(id, card_template_input, opts = {})
572
+ data, _status_code, _headers = update_card_template_with_http_info(id, card_template_input, opts)
573
+ data
574
+ end
575
+
576
+ # Update card template
577
+ # Updates an existing card template. Submitting template_objects replaces the entire objects array. Three special update modes are recognised: - **Soft-delete**: PATCH &#x60;deleted_at&#x60; to a non-null timestamp to soft-delete (or null to restore). The server records &#x60;deleted_by_id&#x60; from the authenticated user. Soft-delete is permitted for any admin in the account, regardless of &#x60;editable_by&#x60; or &#x60;owner_id&#x60;. - **Owner transfer**: PATCH &#x60;owner_id&#x60; to reassign ownership. Permitted for the current owner or any admin in the account. The new value must be the ID of an admin in the same account. - **Content edits** (any other writable field): respect the existing &#x60;editable_by&#x60; rule; if &#x60;editable_by&#x60; is &#x60;owner_only&#x60;, only the current owner may edit.
578
+ # @param id [Integer] Card template ID
579
+ # @param card_template_input [CardTemplateInput]
580
+ # @param [Hash] opts the optional parameters
581
+ # @return [Array<(CardTemplate, Integer, Hash)>] CardTemplate data, response status code and response headers
582
+ def update_card_template_with_http_info(id, card_template_input, opts = {})
583
+ if @api_client.config.debugging
584
+ @api_client.config.logger.debug 'Calling API: CardTemplatesApi.update_card_template ...'
585
+ end
586
+ # verify the required parameter 'id' is set
587
+ if @api_client.config.client_side_validation && id.nil?
588
+ fail ArgumentError, "Missing the required parameter 'id' when calling CardTemplatesApi.update_card_template"
589
+ end
590
+ # verify the required parameter 'card_template_input' is set
591
+ if @api_client.config.client_side_validation && card_template_input.nil?
592
+ fail ArgumentError, "Missing the required parameter 'card_template_input' when calling CardTemplatesApi.update_card_template"
593
+ end
594
+ # resource path
595
+ local_var_path = '/api/3/card_templates/{id}'.sub('{id}', CGI.escape(id.to_s))
596
+
597
+ # query parameters
598
+ query_params = opts[:query_params] || {}
599
+
600
+ # header parameters
601
+ header_params = opts[:header_params] || {}
602
+ # HTTP header 'Accept' (if needed)
603
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
604
+ # HTTP header 'Content-Type'
605
+ content_type = @api_client.select_header_content_type(['application/json'])
606
+ if !content_type.nil?
607
+ header_params['Content-Type'] = content_type
608
+ end
609
+
610
+ # form parameters
611
+ form_params = opts[:form_params] || {}
612
+
613
+ # http body (model)
614
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(card_template_input)
615
+
616
+ # return_type
617
+ return_type = opts[:debug_return_type] || 'CardTemplate'
618
+
619
+ # auth_names
620
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
621
+
622
+ new_options = opts.merge(
623
+ :operation => :"CardTemplatesApi.update_card_template",
624
+ :header_params => header_params,
625
+ :query_params => query_params,
626
+ :form_params => form_params,
627
+ :body => post_body,
628
+ :auth_names => auth_names,
629
+ :return_type => return_type
630
+ )
631
+
632
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
633
+ if @api_client.config.debugging
634
+ @api_client.config.logger.debug "API called: CardTemplatesApi#update_card_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
635
+ end
636
+ return data, status_code, headers
637
+ end
638
+
639
+ # Upload background image
640
+ # Uploads or replaces the background image for the specified side.
641
+ # @param id [Integer] Card template ID
642
+ # @param side [String] Which side of the card
643
+ # @param body [File]
644
+ # @param [Hash] opts the optional parameters
645
+ # @return [CardTemplate]
646
+ def update_card_template_background_image(id, side, body, opts = {})
647
+ data, _status_code, _headers = update_card_template_background_image_with_http_info(id, side, body, opts)
648
+ data
649
+ end
650
+
651
+ # Upload background image
652
+ # Uploads or replaces the background image for the specified side.
653
+ # @param id [Integer] Card template ID
654
+ # @param side [String] Which side of the card
655
+ # @param body [File]
656
+ # @param [Hash] opts the optional parameters
657
+ # @return [Array<(CardTemplate, Integer, Hash)>] CardTemplate data, response status code and response headers
658
+ def update_card_template_background_image_with_http_info(id, side, body, opts = {})
659
+ if @api_client.config.debugging
660
+ @api_client.config.logger.debug 'Calling API: CardTemplatesApi.update_card_template_background_image ...'
661
+ end
662
+ # verify the required parameter 'id' is set
663
+ if @api_client.config.client_side_validation && id.nil?
664
+ fail ArgumentError, "Missing the required parameter 'id' when calling CardTemplatesApi.update_card_template_background_image"
665
+ end
666
+ # verify the required parameter 'side' is set
667
+ if @api_client.config.client_side_validation && side.nil?
668
+ fail ArgumentError, "Missing the required parameter 'side' when calling CardTemplatesApi.update_card_template_background_image"
669
+ end
670
+ # verify enum value
671
+ allowable_values = ["front", "back"]
672
+ if @api_client.config.client_side_validation && !allowable_values.include?(side)
673
+ fail ArgumentError, "invalid value for \"side\", must be one of #{allowable_values}"
674
+ end
675
+ # verify the required parameter 'body' is set
676
+ if @api_client.config.client_side_validation && body.nil?
677
+ fail ArgumentError, "Missing the required parameter 'body' when calling CardTemplatesApi.update_card_template_background_image"
678
+ end
679
+ # resource path
680
+ local_var_path = '/api/3/card_templates/{id}/background_image/{side}'.sub('{id}', CGI.escape(id.to_s)).sub('{side}', CGI.escape(side.to_s))
681
+
682
+ # query parameters
683
+ query_params = opts[:query_params] || {}
684
+
685
+ # header parameters
686
+ header_params = opts[:header_params] || {}
687
+ # HTTP header 'Accept' (if needed)
688
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
689
+ # HTTP header 'Content-Type'
690
+ content_type = @api_client.select_header_content_type(['image/png', 'image/jpeg'])
691
+ if !content_type.nil?
692
+ header_params['Content-Type'] = content_type
693
+ end
694
+
695
+ # form parameters
696
+ form_params = opts[:form_params] || {}
697
+
698
+ # http body (model)
699
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
700
+
701
+ # return_type
702
+ return_type = opts[:debug_return_type] || 'CardTemplate'
703
+
704
+ # auth_names
705
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
706
+
707
+ new_options = opts.merge(
708
+ :operation => :"CardTemplatesApi.update_card_template_background_image",
709
+ :header_params => header_params,
710
+ :query_params => query_params,
711
+ :form_params => form_params,
712
+ :body => post_body,
713
+ :auth_names => auth_names,
714
+ :return_type => return_type
715
+ )
716
+
717
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
718
+ if @api_client.config.debugging
719
+ @api_client.config.logger.debug "API called: CardTemplatesApi#update_card_template_background_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
720
+ end
721
+ return data, status_code, headers
722
+ end
723
+
724
+ # Upload or replace linked file
725
+ # Uploads or replaces a linked file for a card template. The file_role query parameter is required.
726
+ # @param id [Integer] Card template ID
727
+ # @param file_uuid [String] UUID of the linked file
728
+ # @param file_role [String] Role of the file (e.g. background_front, background_back, logo)
729
+ # @param body [File]
730
+ # @param [Hash] opts the optional parameters
731
+ # @return [LinkedFile]
732
+ def upload_card_template_file(id, file_uuid, file_role, body, opts = {})
733
+ data, _status_code, _headers = upload_card_template_file_with_http_info(id, file_uuid, file_role, body, opts)
734
+ data
735
+ end
736
+
737
+ # Upload or replace linked file
738
+ # Uploads or replaces a linked file for a card template. The file_role query parameter is required.
739
+ # @param id [Integer] Card template ID
740
+ # @param file_uuid [String] UUID of the linked file
741
+ # @param file_role [String] Role of the file (e.g. background_front, background_back, logo)
742
+ # @param body [File]
743
+ # @param [Hash] opts the optional parameters
744
+ # @return [Array<(LinkedFile, Integer, Hash)>] LinkedFile data, response status code and response headers
745
+ def upload_card_template_file_with_http_info(id, file_uuid, file_role, body, opts = {})
746
+ if @api_client.config.debugging
747
+ @api_client.config.logger.debug 'Calling API: CardTemplatesApi.upload_card_template_file ...'
748
+ end
749
+ # verify the required parameter 'id' is set
750
+ if @api_client.config.client_side_validation && id.nil?
751
+ fail ArgumentError, "Missing the required parameter 'id' when calling CardTemplatesApi.upload_card_template_file"
752
+ end
753
+ # verify the required parameter 'file_uuid' is set
754
+ if @api_client.config.client_side_validation && file_uuid.nil?
755
+ fail ArgumentError, "Missing the required parameter 'file_uuid' when calling CardTemplatesApi.upload_card_template_file"
756
+ end
757
+ # verify the required parameter 'file_role' is set
758
+ if @api_client.config.client_side_validation && file_role.nil?
759
+ fail ArgumentError, "Missing the required parameter 'file_role' when calling CardTemplatesApi.upload_card_template_file"
760
+ end
761
+ # verify the required parameter 'body' is set
762
+ if @api_client.config.client_side_validation && body.nil?
763
+ fail ArgumentError, "Missing the required parameter 'body' when calling CardTemplatesApi.upload_card_template_file"
764
+ end
765
+ # resource path
766
+ local_var_path = '/api/3/card_templates/{id}/files/{file_uuid}'.sub('{id}', CGI.escape(id.to_s)).sub('{file_uuid}', CGI.escape(file_uuid.to_s))
767
+
768
+ # query parameters
769
+ query_params = opts[:query_params] || {}
770
+ query_params[:'file_role'] = file_role
771
+
772
+ # header parameters
773
+ header_params = opts[:header_params] || {}
774
+ # HTTP header 'Accept' (if needed)
775
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
776
+ # HTTP header 'Content-Type'
777
+ content_type = @api_client.select_header_content_type(['application/octet-stream'])
778
+ if !content_type.nil?
779
+ header_params['Content-Type'] = content_type
780
+ end
781
+
782
+ # form parameters
783
+ form_params = opts[:form_params] || {}
784
+
785
+ # http body (model)
786
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
787
+
788
+ # return_type
789
+ return_type = opts[:debug_return_type] || 'LinkedFile'
790
+
791
+ # auth_names
792
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
793
+
794
+ new_options = opts.merge(
795
+ :operation => :"CardTemplatesApi.upload_card_template_file",
796
+ :header_params => header_params,
797
+ :query_params => query_params,
798
+ :form_params => form_params,
799
+ :body => post_body,
800
+ :auth_names => auth_names,
801
+ :return_type => return_type
802
+ )
803
+
804
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
805
+ if @api_client.config.debugging
806
+ @api_client.config.logger.debug "API called: CardTemplatesApi#upload_card_template_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
807
+ end
808
+ return data, status_code, headers
809
+ end
810
+ end
811
+ end