Class: MailchimpMarketing::ConversationsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/MailchimpMarketing/api/conversations_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client) ⇒ ConversationsApi

Returns a new instance of ConversationsApi.


19
20
21
# File 'lib/MailchimpMarketing/api/conversations_api.rb', line 19

def initialize(api_client)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client


17
18
19
# File 'lib/MailchimpMarketing/api/conversations_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_conversation_message(conversation_id = {}, body = {}, opts = {}) ⇒ ConversationMessage

Post a new conversation message Post a new message to a conversation.

Parameters:

  • conversation_id (defaults to: {})

    The unique id for the conversation.

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

    the optional parameters

Returns:

  • (ConversationMessage)

252
253
254
255
# File 'lib/MailchimpMarketing/api/conversations_api.rb', line 252

def create_conversation_message(conversation_id = {}, body = {}, opts = {})
  data, _status_code, _headers = create_conversation_message_with_http_info(conversation_id, body, opts)
  data
end

#create_conversation_message_with_http_info(conversation_id, body, opts = {}) ⇒ Array<(ConversationMessage, Fixnum, Hash)>

Post a new conversation message Post a new message to a conversation.

Parameters:

  • conversation_id

    The unique id for the conversation.

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

    the optional parameters

Returns:

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

    ConversationMessage data, response status code and response headers


263
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
# File 'lib/MailchimpMarketing/api/conversations_api.rb', line 263

def create_conversation_message_with_http_info(conversation_id, body, opts = {})
  # resource path
  local_var_path = '/conversations/{conversation_id}/messages'.sub('{' + 'conversation_id' + '}', conversation_id.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', 'application/problem+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(body)
  auth_names = ['basicAuth']
  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 => 'ConversationMessage')
  return data, status_code, headers
end

#get(conversation_id = {}, opts = {}) ⇒ Conversation

Get information about a conversation Get details about an individual conversation.

Parameters:

  • conversation_id (defaults to: {})

    The unique id for the conversation.

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

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.

  • :exclude_fields (Array<String>)

    A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.

Returns:

  • (Conversation)

92
93
94
95
# File 'lib/MailchimpMarketing/api/conversations_api.rb', line 92

def get(conversation_id = {}, opts = {})
  data, _status_code, _headers = get_with_http_info(conversation_id, opts)
  data
end

#get_conversation_message(conversation_id = {}, message_id = {}, opts = {}) ⇒ ConversationMessage

Get a specific conversation message Get an individual message in a conversation.

Parameters:

  • conversation_id (defaults to: {})

    The unique id for the conversation.

  • message_id (defaults to: {})

    The unique id for the conversation message.

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

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.

  • :exclude_fields (Array<String>)

    A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.

Returns:

  • (ConversationMessage)

202
203
204
205
# File 'lib/MailchimpMarketing/api/conversations_api.rb', line 202

def get_conversation_message(conversation_id = {}, message_id = {}, opts = {})
  data, _status_code, _headers = get_conversation_message_with_http_info(conversation_id, message_id, opts)
  data
end

#get_conversation_message_with_http_info(conversation_id, message_id, opts = {}) ⇒ Array<(ConversationMessage, Fixnum, Hash)>

Get a specific conversation message Get an individual message in a conversation.

Parameters:

  • conversation_id

    The unique id for the conversation.

  • message_id

    The unique id for the conversation message.

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

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.

  • :exclude_fields (Array<String>)

    A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.

Returns:

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

    ConversationMessage data, response status code and response headers


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/MailchimpMarketing/api/conversations_api.rb', line 215

def get_conversation_message_with_http_info(conversation_id, message_id, opts = {})
  # resource path
  local_var_path = '/conversations/{conversation_id}/messages/{message_id}'.sub('{' + 'conversation_id' + '}', conversation_id.to_s).sub('{' + 'message_id' + '}', message_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?
  query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :csv) if !opts[:'exclude_fields'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+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']
  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 => 'ConversationMessage')
  return data, status_code, headers
end

#get_conversation_messages(conversation_id = {}, opts = {}) ⇒ CollectionOfConversationMessages

Get conversation messages Get messages from a specific conversation.

Parameters:

  • conversation_id (defaults to: {})

    The unique id for the conversation.

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

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.

  • :exclude_fields (Array<String>)

    A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.

  • :is_read (String)

    Whether a conversation message has been marked as read.

  • :before_timestamp (DateTime)

    Restrict the response to messages created before the set time. We recommend [ISO 8601](en.wikipedia.org/wiki/ISO_8601) time format: 2015-10-21T15:41:36+00:00.

  • :since_timestamp (DateTime)

    Restrict the response to messages created after the set time. We recommend [ISO 8601](en.wikipedia.org/wiki/ISO_8601) time format: 2015-10-21T15:41:36+00:00.

Returns:

  • (CollectionOfConversationMessages)

145
146
147
148
# File 'lib/MailchimpMarketing/api/conversations_api.rb', line 145

def get_conversation_messages(conversation_id = {}, opts = {})
  data, _status_code, _headers = get_conversation_messages_with_http_info(conversation_id, opts)
  data
end

#get_conversation_messages_with_http_info(conversation_id, opts = {}) ⇒ Array<(CollectionOfConversationMessages, Fixnum, Hash)>

Get conversation messages Get messages from a specific conversation.

Parameters:

  • conversation_id

    The unique id for the conversation.

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

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.

  • :exclude_fields (Array<String>)

    A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.

  • :is_read (String)

    Whether a conversation message has been marked as read.

  • :before_timestamp (DateTime)

    Restrict the response to messages created before the set time. We recommend [ISO 8601](en.wikipedia.org/wiki/ISO_8601) time format: 2015-10-21T15:41:36+00:00.

  • :since_timestamp (DateTime)

    Restrict the response to messages created after the set time. We recommend [ISO 8601](en.wikipedia.org/wiki/ISO_8601) time format: 2015-10-21T15:41:36+00:00.

Returns:

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

    CollectionOfConversationMessages data, response status code and response headers


160
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
# File 'lib/MailchimpMarketing/api/conversations_api.rb', line 160

def get_conversation_messages_with_http_info(conversation_id, opts = {})
  # resource path
  local_var_path = '/conversations/{conversation_id}/messages'.sub('{' + 'conversation_id' + '}', conversation_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?
  query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :csv) if !opts[:'exclude_fields'].nil?
  query_params[:'is_read'] = opts[:'is_read'] if !opts[:'is_read'].nil?
  query_params[:'before_timestamp'] = opts[:'before_timestamp'] if !opts[:'before_timestamp'].nil?
  query_params[:'since_timestamp'] = opts[:'since_timestamp'] if !opts[:'since_timestamp'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+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']
  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 => 'CollectionOfConversationMessages')
  return data, status_code, headers
end

#get_with_http_info(conversation_id, opts = {}) ⇒ Array<(Conversation, Fixnum, Hash)>

Get information about a conversation Get details about an individual conversation.

Parameters:

  • conversation_id

    The unique id for the conversation.

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

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.

  • :exclude_fields (Array<String>)

    A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.

Returns:

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

    Conversation data, response status code and response headers


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
# File 'lib/MailchimpMarketing/api/conversations_api.rb', line 104

def get_with_http_info(conversation_id, opts = {})
  # resource path
  local_var_path = '/conversations/{conversation_id}'.sub('{' + 'conversation_id' + '}', conversation_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?
  query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :csv) if !opts[:'exclude_fields'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+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']
  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 => 'Conversation')
  return data, status_code, headers
end

#list(opts = {}) ⇒ TrackedConversations

Get a list of conversations Get a list of conversations for the account.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.

  • :exclude_fields (Array<String>)

    A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.

  • :count (Integer)

    The number of records to return. [Default value](/developer/guides/get-started-with-mailchimp-api-3/#Parameters) is *10*. [Maximum value](/developer/guides/get-started-with-mailchimp-api-3/#Parameters) is *1000* (default to 10)

  • :offset (Integer)

    The number of records from a collection to skip. Iterating over large collections with this parameter can be slow. [Default value](/developer/guides/get-started-with-mailchimp-api-3/#Parameters) is *0*. (default to 0)

  • :has_unread_messages (String)

    Whether the conversation has any unread messages.

  • :list_id (String)

    The unique id for the list.

  • :campaign_id (String)

    The unique id for the campaign.

Returns:

  • (TrackedConversations)

33
34
35
36
# File 'lib/MailchimpMarketing/api/conversations_api.rb', line 33

def list(opts = {})
  data, _status_code, _headers = list_with_http_info(opts)
  data
end

#list_with_http_info(opts = {}) ⇒ Array<(TrackedConversations, Fixnum, Hash)>

Get a list of conversations Get a list of conversations for the account.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.

  • :exclude_fields (Array<String>)

    A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.

  • :count (Integer)

    The number of records to return. [Default value](/developer/guides/get-started-with-mailchimp-api-3/#Parameters) is *10*. [Maximum value](/developer/guides/get-started-with-mailchimp-api-3/#Parameters) is *1000*

  • :offset (Integer)

    The number of records from a collection to skip. Iterating over large collections with this parameter can be slow. [Default value](/developer/guides/get-started-with-mailchimp-api-3/#Parameters) is *0*.

  • :has_unread_messages (String)

    Whether the conversation has any unread messages.

  • :list_id (String)

    The unique id for the list.

  • :campaign_id (String)

    The unique id for the campaign.

Returns:

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

    TrackedConversations data, response status code and response headers


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
# File 'lib/MailchimpMarketing/api/conversations_api.rb', line 49

def list_with_http_info(opts = {})
  # resource path
  local_var_path = '/conversations'

  # query parameters
  query_params = {}
  query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?
  query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :csv) if !opts[:'exclude_fields'].nil?
  query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'has_unread_messages'] = opts[:'has_unread_messages'] if !opts[:'has_unread_messages'].nil?
  query_params[:'list_id'] = opts[:'list_id'] if !opts[:'list_id'].nil?
  query_params[:'campaign_id'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+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']
  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 => 'TrackedConversations')
  return data, status_code, headers
end