Class: SmoochApi::TemplateApi

Inherits:
Object
  • Object
show all
Defined in:
lib/smooch-api/api/template_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ TemplateApi

Returns a new instance of TemplateApi.



19
20
21
# File 'lib/smooch-api/api/template_api.rb', line 19

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/smooch-api/api/template_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_template(appId, templateCreateBody, opts = {}) ⇒ TemplateResponse

Create a template for the specified app.

Parameters:

  • appId

    Identifies the app.

  • templateCreateBody

    Body for a createTemplate request.

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

    the optional parameters

Returns:



29
30
31
32
# File 'lib/smooch-api/api/template_api.rb', line 29

def create_template(appId, templateCreateBody, opts = {})
  data, _status_code, _headers = create_template_with_http_info(appId, templateCreateBody, opts)
  return data
end

#create_template_with_http_info(appId, templateCreateBody, opts = {}) ⇒ Array<(TemplateResponse, Fixnum, Hash)>

Create a template for the specified app.

Parameters:

  • appId

    Identifies the app.

  • templateCreateBody

    Body for a createTemplate request.

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

    the optional parameters

Returns:

  • (Array<(TemplateResponse, Fixnum, Hash)>)

    TemplateResponse data, response status code and response headers



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
# File 'lib/smooch-api/api/template_api.rb', line 40

def create_template_with_http_info(appId, templateCreateBody, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: TemplateApi.create_template ..."
  end
  # verify the required parameter 'appId' is set
  if @api_client.config.client_side_validation && appId.nil?
    fail ArgumentError, "Missing the required parameter 'appId' when calling TemplateApi.create_template"
  end
  # verify the required parameter 'templateCreateBody' is set
  if @api_client.config.client_side_validation && templateCreateBody.nil?
    fail ArgumentError, "Missing the required parameter 'templateCreateBody' when calling TemplateApi.create_template"
  end
  # resource path
  local_var_path = "/v1.1/apps/{appId}/templates".sub('{' + 'appId' + '}', appId.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(templateCreateBody)
  auth_names = ['basicAuth', 'jwt']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'TemplateResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TemplateApi#create_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_template(appId, templateId, opts = {}) ⇒ nil

Delete the specified template.

Parameters:

  • appId

    Identifies the app.

  • templateId

    Identifies the template.

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

    the optional parameters

Returns:

  • (nil)


90
91
92
93
# File 'lib/smooch-api/api/template_api.rb', line 90

def delete_template(appId, templateId, opts = {})
  delete_template_with_http_info(appId, templateId, opts)
  return nil
end

#delete_template_with_http_info(appId, templateId, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete the specified template.

Parameters:

  • appId

    Identifies the app.

  • templateId

    Identifies the template.

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

    the optional parameters

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



101
102
103
104
105
106
107
108
109
110
111
112
113
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
# File 'lib/smooch-api/api/template_api.rb', line 101

def delete_template_with_http_info(appId, templateId, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: TemplateApi.delete_template ..."
  end
  # verify the required parameter 'appId' is set
  if @api_client.config.client_side_validation && appId.nil?
    fail ArgumentError, "Missing the required parameter 'appId' when calling TemplateApi.delete_template"
  end
  # verify the required parameter 'templateId' is set
  if @api_client.config.client_side_validation && templateId.nil?
    fail ArgumentError, "Missing the required parameter 'templateId' when calling TemplateApi.delete_template"
  end
  # resource path
  local_var_path = "/v1.1/apps/{appId}/templates/{templateId}".sub('{' + 'appId' + '}', appId.to_s).sub('{' + 'templateId' + '}', templateId.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['basicAuth', 'jwt']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TemplateApi#delete_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_template(appId, templateId, opts = {}) ⇒ TemplateResponse

Get the specified template.

Parameters:

  • appId

    Identifies the app.

  • templateId

    Identifies the template.

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

    the optional parameters

Returns:



150
151
152
153
# File 'lib/smooch-api/api/template_api.rb', line 150

def get_template(appId, templateId, opts = {})
  data, _status_code, _headers = get_template_with_http_info(appId, templateId, opts)
  return data
end

#get_template_with_http_info(appId, templateId, opts = {}) ⇒ Array<(TemplateResponse, Fixnum, Hash)>

Get the specified template.

Parameters:

  • appId

    Identifies the app.

  • templateId

    Identifies the template.

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

    the optional parameters

Returns:

  • (Array<(TemplateResponse, Fixnum, Hash)>)

    TemplateResponse data, response status code and response headers



161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/smooch-api/api/template_api.rb', line 161

def get_template_with_http_info(appId, templateId, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: TemplateApi.get_template ..."
  end
  # verify the required parameter 'appId' is set
  if @api_client.config.client_side_validation && appId.nil?
    fail ArgumentError, "Missing the required parameter 'appId' when calling TemplateApi.get_template"
  end
  # verify the required parameter 'templateId' is set
  if @api_client.config.client_side_validation && templateId.nil?
    fail ArgumentError, "Missing the required parameter 'templateId' when calling TemplateApi.get_template"
  end
  # resource path
  local_var_path = "/v1.1/apps/{appId}/templates/{templateId}".sub('{' + 'appId' + '}', appId.to_s).sub('{' + 'templateId' + '}', templateId.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['basicAuth', 'jwt']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'TemplateResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TemplateApi#get_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_templates(appId, opts = {}) ⇒ ListTemplatesResponse

List templates for the specified app.

Parameters:

  • appId

    Identifies the app.

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    The number of records to return. (default to 25)

  • :offset (Integer)

    The number of initial records to skip before picking records to return. (default to 0)

Returns:



212
213
214
215
# File 'lib/smooch-api/api/template_api.rb', line 212

def list_templates(appId, opts = {})
  data, _status_code, _headers = list_templates_with_http_info(appId, opts)
  return data
end

#list_templates_with_http_info(appId, opts = {}) ⇒ Array<(ListTemplatesResponse, Fixnum, Hash)>

List templates for the specified app.

Parameters:

  • appId

    Identifies the app.

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    The number of records to return.

  • :offset (Integer)

    The number of initial records to skip before picking records to return.

Returns:

  • (Array<(ListTemplatesResponse, Fixnum, Hash)>)

    ListTemplatesResponse data, response status code and response headers



224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/smooch-api/api/template_api.rb', line 224

def list_templates_with_http_info(appId, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: TemplateApi.list_templates ..."
  end
  # verify the required parameter 'appId' is set
  if @api_client.config.client_side_validation && appId.nil?
    fail ArgumentError, "Missing the required parameter 'appId' when calling TemplateApi.list_templates"
  end
  # resource path
  local_var_path = "/v1.1/apps/{appId}/templates".sub('{' + 'appId' + '}', appId.to_s)

  # query parameters
  query_params = {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['basicAuth', 'jwt']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ListTemplatesResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TemplateApi#list_templates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_template(appId, templateId, templateUpdateBody, opts = {}) ⇒ TemplateResponse

Update the specified template.

Parameters:

  • appId

    Identifies the app.

  • templateId

    Identifies the template.

  • templateUpdateBody

    Body for an updateTemplate request.

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

    the optional parameters

Returns:



273
274
275
276
# File 'lib/smooch-api/api/template_api.rb', line 273

def update_template(appId, templateId, templateUpdateBody, opts = {})
  data, _status_code, _headers = update_template_with_http_info(appId, templateId, templateUpdateBody, opts)
  return data
end

#update_template_with_http_info(appId, templateId, templateUpdateBody, opts = {}) ⇒ Array<(TemplateResponse, Fixnum, Hash)>

Update the specified template.

Parameters:

  • appId

    Identifies the app.

  • templateId

    Identifies the template.

  • templateUpdateBody

    Body for an updateTemplate request.

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

    the optional parameters

Returns:

  • (Array<(TemplateResponse, Fixnum, Hash)>)

    TemplateResponse data, response status code and response headers



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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
# File 'lib/smooch-api/api/template_api.rb', line 285

def update_template_with_http_info(appId, templateId, templateUpdateBody, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: TemplateApi.update_template ..."
  end
  # verify the required parameter 'appId' is set
  if @api_client.config.client_side_validation && appId.nil?
    fail ArgumentError, "Missing the required parameter 'appId' when calling TemplateApi.update_template"
  end
  # verify the required parameter 'templateId' is set
  if @api_client.config.client_side_validation && templateId.nil?
    fail ArgumentError, "Missing the required parameter 'templateId' when calling TemplateApi.update_template"
  end
  # verify the required parameter 'templateUpdateBody' is set
  if @api_client.config.client_side_validation && templateUpdateBody.nil?
    fail ArgumentError, "Missing the required parameter 'templateUpdateBody' when calling TemplateApi.update_template"
  end
  # resource path
  local_var_path = "/v1.1/apps/{appId}/templates/{templateId}".sub('{' + 'appId' + '}', appId.to_s).sub('{' + 'templateId' + '}', templateId.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(templateUpdateBody)
  auth_names = ['basicAuth', 'jwt']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'TemplateResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TemplateApi#update_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end