Class: SunshineConversationsClient::SwitchboardActionsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/sunshine-conversations-client/api/switchboard_actions_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ SwitchboardActionsApi

Returns a new instance of SwitchboardActionsApi.



16
17
18
# File 'lib/sunshine-conversations-client/api/switchboard_actions_api.rb', line 16

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



14
15
16
# File 'lib/sunshine-conversations-client/api/switchboard_actions_api.rb', line 14

def api_client
  @api_client
end

Instance Method Details

#accept_control(app_id, conversation_id, accept_control_body, opts = {}) ⇒ Object

Accept Control The acceptControl action transfers the control of the conversation to the pending switchboard integration. When using integration auth scope, a 403 is returned if the pending switchboard integration is not the authenticated integration.

Parameters:

  • app_id (String)

    Identifies the app.

  • conversation_id (String)

    Identifies the conversation.

  • accept_control_body (AcceptControlBody)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Object)


26
27
28
29
# File 'lib/sunshine-conversations-client/api/switchboard_actions_api.rb', line 26

def accept_control(app_id, conversation_id, accept_control_body, opts = {})
  data, _status_code, _headers = accept_control_with_http_info(app_id, conversation_id, accept_control_body, opts)
  data
end

#accept_control_with_http_info(app_id, conversation_id, accept_control_body, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Accept Control The acceptControl action transfers the control of the conversation to the pending switchboard integration. When using integration auth scope, a 403 is returned if the pending switchboard integration is not the authenticated integration.

Parameters:

  • app_id (String)

    Identifies the app.

  • conversation_id (String)

    Identifies the conversation.

  • accept_control_body (AcceptControlBody)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/sunshine-conversations-client/api/switchboard_actions_api.rb', line 38

def accept_control_with_http_info(app_id, conversation_id, accept_control_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SwitchboardActionsApi.accept_control ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling SwitchboardActionsApi.accept_control"
  end
  # verify the required parameter 'conversation_id' is set
  if @api_client.config.client_side_validation && conversation_id.nil?
    fail ArgumentError, "Missing the required parameter 'conversation_id' when calling SwitchboardActionsApi.accept_control"
  end
  # verify the required parameter 'accept_control_body' is set
  if @api_client.config.client_side_validation && accept_control_body.nil?
    fail ArgumentError, "Missing the required parameter 'accept_control_body' when calling SwitchboardActionsApi.accept_control"
  end
  # resource path
  local_var_path = '/v2/apps/{appId}/conversations/{conversationId}/acceptControl'.sub('{' + 'appId' + '}', CGI.escape(app_id.to_s)).sub('{' + 'conversationId' + '}', CGI.escape(conversation_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(accept_control_body) 

  # return_type
  return_type = opts[:return_type] || 'Object' 

  # auth_names
  auth_names = opts[:auth_names] || ['basicAuth', 'bearerAuth']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SwitchboardActionsApi#accept_control\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#offer_control(app_id, conversation_id, offer_control_body, opts = {}) ⇒ Object

Offer Control The offerControl action will invite a switchboard integration to accept control of the conversation (changing its status to pending), and trigger a webhook signal to that integration indicating that they have been offered control of the conversation. Invalidates previous offerControl actions.

Parameters:

  • app_id (String)

    Identifies the app.

  • conversation_id (String)

    Identifies the conversation.

  • offer_control_body (OfferControlBody)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Object)


102
103
104
105
# File 'lib/sunshine-conversations-client/api/switchboard_actions_api.rb', line 102

def offer_control(app_id, conversation_id, offer_control_body, opts = {})
  data, _status_code, _headers = offer_control_with_http_info(app_id, conversation_id, offer_control_body, opts)
  data
end

#offer_control_with_http_info(app_id, conversation_id, offer_control_body, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Offer Control The offerControl action will invite a switchboard integration to accept control of the conversation (changing its status to pending), and trigger a webhook signal to that integration indicating that they have been offered control of the conversation. Invalidates previous offerControl actions.

Parameters:

  • app_id (String)

    Identifies the app.

  • conversation_id (String)

    Identifies the conversation.

  • offer_control_body (OfferControlBody)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/sunshine-conversations-client/api/switchboard_actions_api.rb', line 114

def offer_control_with_http_info(app_id, conversation_id, offer_control_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SwitchboardActionsApi.offer_control ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling SwitchboardActionsApi.offer_control"
  end
  # verify the required parameter 'conversation_id' is set
  if @api_client.config.client_side_validation && conversation_id.nil?
    fail ArgumentError, "Missing the required parameter 'conversation_id' when calling SwitchboardActionsApi.offer_control"
  end
  # verify the required parameter 'offer_control_body' is set
  if @api_client.config.client_side_validation && offer_control_body.nil?
    fail ArgumentError, "Missing the required parameter 'offer_control_body' when calling SwitchboardActionsApi.offer_control"
  end
  # resource path
  local_var_path = '/v2/apps/{appId}/conversations/{conversationId}/offerControl'.sub('{' + 'appId' + '}', CGI.escape(app_id.to_s)).sub('{' + 'conversationId' + '}', CGI.escape(conversation_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(offer_control_body) 

  # return_type
  return_type = opts[:return_type] || 'Object' 

  # auth_names
  auth_names = opts[:auth_names] || ['basicAuth', 'bearerAuth']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SwitchboardActionsApi#offer_control\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#pass_control(app_id, conversation_id, pass_control_body, opts = {}) ⇒ Object

Pass Control The passControl action marks the named switchboard integration as active and transitions all the other switchboard integrations to standby status. The ‘passControl` action is idempotent if either the target `switchboardIntegration` is specified explicitly by its `id` or `name`, or the `next` keyword is used for the `switchboardIntegration` field, and the invoking integration can be identified by its [OAuth token](docs.smooch.io/guide/oauth/#redirect-and-acquiring-an-oauth-token) or [Custom Integration API Key](docs.smooch.io/rest/#tag/CustomIntegrationApiKeys) credentials. Duplicate passControl actions using the `next` keyword and their metadata are disregarded. For more information, see [Switchboard passControl](docs.smooch.io/guide/switchboard/#pass-control).

Parameters:

  • app_id (String)

    Identifies the app.

  • conversation_id (String)

    Identifies the conversation.

  • pass_control_body (PassControlBody)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Object)


178
179
180
181
# File 'lib/sunshine-conversations-client/api/switchboard_actions_api.rb', line 178

def pass_control(app_id, conversation_id, pass_control_body, opts = {})
  data, _status_code, _headers = pass_control_with_http_info(app_id, conversation_id, pass_control_body, opts)
  data
end

#pass_control_with_http_info(app_id, conversation_id, pass_control_body, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Pass Control The passControl action marks the named switchboard integration as active and transitions all the other switchboard integrations to standby status. The &#x60;passControl&#x60; action is idempotent if either the target &#x60;switchboardIntegration&#x60; is specified explicitly by its &#x60;id&#x60; or &#x60;name&#x60;, or the &#x60;next&#x60; keyword is used for the &#x60;switchboardIntegration&#x60; field, and the invoking integration can be identified by its [OAuth token](docs.smooch.io/guide/oauth/#redirect-and-acquiring-an-oauth-token) or [Custom Integration API Key](docs.smooch.io/rest/#tag/CustomIntegrationApiKeys) credentials. Duplicate passControl actions using the &#x60;next&#x60; keyword and their metadata are disregarded. For more information, see [Switchboard passControl](docs.smooch.io/guide/switchboard/#pass-control).

Parameters:

  • app_id (String)

    Identifies the app.

  • conversation_id (String)

    Identifies the conversation.

  • pass_control_body (PassControlBody)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/sunshine-conversations-client/api/switchboard_actions_api.rb', line 190

def pass_control_with_http_info(app_id, conversation_id, pass_control_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SwitchboardActionsApi.pass_control ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling SwitchboardActionsApi.pass_control"
  end
  # verify the required parameter 'conversation_id' is set
  if @api_client.config.client_side_validation && conversation_id.nil?
    fail ArgumentError, "Missing the required parameter 'conversation_id' when calling SwitchboardActionsApi.pass_control"
  end
  # verify the required parameter 'pass_control_body' is set
  if @api_client.config.client_side_validation && pass_control_body.nil?
    fail ArgumentError, "Missing the required parameter 'pass_control_body' when calling SwitchboardActionsApi.pass_control"
  end
  # resource path
  local_var_path = '/v2/apps/{appId}/conversations/{conversationId}/passControl'.sub('{' + 'appId' + '}', CGI.escape(app_id.to_s)).sub('{' + 'conversationId' + '}', CGI.escape(conversation_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(pass_control_body) 

  # return_type
  return_type = opts[:return_type] || 'Object' 

  # auth_names
  auth_names = opts[:auth_names] || ['basicAuth', 'bearerAuth']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SwitchboardActionsApi#pass_control\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#release_control(app_id, conversation_id, opts = {}) ⇒ Object

Release Control The releaseControl action releases the control of the conversation by nullifying its switchboard state. When using integration auth scope, a 403 is returned if the active switchboard integration is not the authenticated integration.

Parameters:

  • app_id (String)

    Identifies the app.

  • conversation_id (String)

    Identifies the conversation.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Object)


253
254
255
256
# File 'lib/sunshine-conversations-client/api/switchboard_actions_api.rb', line 253

def release_control(app_id, conversation_id, opts = {})
  data, _status_code, _headers = release_control_with_http_info(app_id, conversation_id, opts)
  data
end

#release_control_with_http_info(app_id, conversation_id, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Release Control The releaseControl action releases the control of the conversation by nullifying its switchboard state. When using integration auth scope, a 403 is returned if the active switchboard integration is not the authenticated integration.

Parameters:

  • app_id (String)

    Identifies the app.

  • conversation_id (String)

    Identifies the conversation.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/sunshine-conversations-client/api/switchboard_actions_api.rb', line 264

def release_control_with_http_info(app_id, conversation_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SwitchboardActionsApi.release_control ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling SwitchboardActionsApi.release_control"
  end
  # verify the required parameter 'conversation_id' is set
  if @api_client.config.client_side_validation && conversation_id.nil?
    fail ArgumentError, "Missing the required parameter 'conversation_id' when calling SwitchboardActionsApi.release_control"
  end
  # resource path
  local_var_path = '/v2/apps/{appId}/conversations/{conversationId}/releaseControl'.sub('{' + 'appId' + '}', CGI.escape(app_id.to_s)).sub('{' + 'conversationId' + '}', CGI.escape(conversation_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'Object' 

  # auth_names
  auth_names = opts[:auth_names] || ['basicAuth', 'bearerAuth']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SwitchboardActionsApi#release_control\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end