Class: Hubspot::Crm::Timeline::TokensApi

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot/codegen/crm/timeline/api/tokens_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ TokensApi

Returns a new instance of TokensApi.



21
22
23
# File 'lib/hubspot/codegen/crm/timeline/api/tokens_api.rb', line 21

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



19
20
21
# File 'lib/hubspot/codegen/crm/timeline/api/tokens_api.rb', line 19

def api_client
  @api_client
end

Instance Method Details

#archive(event_template_id, token_name, app_id, opts = {}) ⇒ nil

Removes a token from the event template This will remove the token from an existing template. Existing events and CRM objects will still retain the token and its mapped object properties, but new ones will not. The timeline will still display this property for older CRM objects if it’s still referenced in the template ‘Markdown`. New events will not. Any lists or reports referencing deleted tokens will no longer return new contacts, but old ones will still exist in the lists.

Parameters:

  • event_template_id (String)

    The event template ID.

  • token_name (String)

    The token name.

  • app_id (Integer)

    The ID of the target app.

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

    the optional parameters

Returns:

  • (nil)


31
32
33
34
# File 'lib/hubspot/codegen/crm/timeline/api/tokens_api.rb', line 31

def archive(event_template_id, token_name, app_id, opts = {})
  archive_with_http_info(event_template_id, token_name, app_id, opts)
  nil
end

#archive_with_http_info(event_template_id, token_name, app_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Removes a token from the event template This will remove the token from an existing template. Existing events and CRM objects will still retain the token and its mapped object properties, but new ones will not. The timeline will still display this property for older CRM objects if it&#39;s still referenced in the template &#x60;Markdown&#x60;. New events will not. Any lists or reports referencing deleted tokens will no longer return new contacts, but old ones will still exist in the lists.

Parameters:

  • event_template_id (String)

    The event template ID.

  • token_name (String)

    The token name.

  • app_id (Integer)

    The ID of the target app.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
94
95
96
# File 'lib/hubspot/codegen/crm/timeline/api/tokens_api.rb', line 43

def archive_with_http_info(event_template_id, token_name, app_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TokensApi.archive ...'
  end
  # verify the required parameter 'event_template_id' is set
  if @api_client.config.client_side_validation && event_template_id.nil?
    fail ArgumentError, "Missing the required parameter 'event_template_id' when calling TokensApi.archive"
  end
  # verify the required parameter 'token_name' is set
  if @api_client.config.client_side_validation && token_name.nil?
    fail ArgumentError, "Missing the required parameter 'token_name' when calling TokensApi.archive"
  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 TokensApi.archive"
  end
  # resource path
  local_var_path = '/crm/v3/timeline/{appId}/event-templates/{eventTemplateId}/tokens/{tokenName}'.sub('{' + 'eventTemplateId' + '}', CGI.escape(event_template_id.to_s)).sub('{' + 'tokenName' + '}', CGI.escape(token_name.to_s)).sub('{' + 'appId' + '}', CGI.escape(app_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(['*/*'])

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

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

  # return_type
  return_type = opts[:return_type] 

  # auth_names
  auth_names = opts[:auth_names] || ['developer_hapikey']

  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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TokensApi#archive\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create(event_template_id, app_id, timeline_event_template_token, opts = {}) ⇒ TimelineEventTemplateToken

Adds a token to an existing event template Once you’ve defined an event template, it’s likely that you’ll want to define tokens for it as well. You can do this on the event template itself or update individual tokens here. Event type tokens allow you to attach custom data to events displayed in a timeline or used for list segmentation. You can also use ‘objectPropertyName` to associate any CRM object properties. This will allow you to fully build out CRM objects. Token names should be unique across the template.

Parameters:

  • event_template_id (String)

    The event template ID.

  • app_id (Integer)

    The ID of the target app.

  • timeline_event_template_token (TimelineEventTemplateToken)

    The new token definition.

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

    the optional parameters

Returns:



105
106
107
108
# File 'lib/hubspot/codegen/crm/timeline/api/tokens_api.rb', line 105

def create(event_template_id, app_id, timeline_event_template_token, opts = {})
  data, _status_code, _headers = create_with_http_info(event_template_id, app_id, timeline_event_template_token, opts)
  data
end

#create_with_http_info(event_template_id, app_id, timeline_event_template_token, opts = {}) ⇒ Array<(TimelineEventTemplateToken, Integer, Hash)>

Adds a token to an existing event template Once you&#39;ve defined an event template, it&#39;s likely that you&#39;ll want to define tokens for it as well. You can do this on the event template itself or update individual tokens here. Event type tokens allow you to attach custom data to events displayed in a timeline or used for list segmentation. You can also use &#x60;objectPropertyName&#x60; to associate any CRM object properties. This will allow you to fully build out CRM objects. Token names should be unique across the template.

Parameters:

  • event_template_id (String)

    The event template ID.

  • app_id (Integer)

    The ID of the target app.

  • timeline_event_template_token (TimelineEventTemplateToken)

    The new token definition.

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

    the optional parameters

Returns:

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

    TimelineEventTemplateToken data, response status code and response headers



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
170
171
172
# File 'lib/hubspot/codegen/crm/timeline/api/tokens_api.rb', line 117

def create_with_http_info(event_template_id, app_id, timeline_event_template_token, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TokensApi.create ...'
  end
  # verify the required parameter 'event_template_id' is set
  if @api_client.config.client_side_validation && event_template_id.nil?
    fail ArgumentError, "Missing the required parameter 'event_template_id' when calling TokensApi.create"
  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 TokensApi.create"
  end
  # verify the required parameter 'timeline_event_template_token' is set
  if @api_client.config.client_side_validation && timeline_event_template_token.nil?
    fail ArgumentError, "Missing the required parameter 'timeline_event_template_token' when calling TokensApi.create"
  end
  # resource path
  local_var_path = '/crm/v3/timeline/{appId}/event-templates/{eventTemplateId}/tokens'.sub('{' + 'eventTemplateId' + '}', CGI.escape(event_template_id.to_s)).sub('{' + 'appId' + '}', CGI.escape(app_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(timeline_event_template_token) 

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

  # auth_names
  auth_names = opts[:auth_names] || ['developer_hapikey']

  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: TokensApi#create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update(event_template_id, token_name, app_id, timeline_event_template_token_update_request, opts = {}) ⇒ TimelineEventTemplateToken

Updates an existing token on an event template This will update the existing token on an event template. Name and type can’t be changed on existing tokens.

Parameters:

  • event_template_id (String)

    The event template ID.

  • token_name (String)

    The token name.

  • app_id (Integer)

    The ID of the target app.

  • timeline_event_template_token_update_request (TimelineEventTemplateTokenUpdateRequest)

    The updated token definition.

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

    the optional parameters

Returns:



182
183
184
185
# File 'lib/hubspot/codegen/crm/timeline/api/tokens_api.rb', line 182

def update(event_template_id, token_name, app_id, timeline_event_template_token_update_request, opts = {})
  data, _status_code, _headers = update_with_http_info(event_template_id, token_name, app_id, timeline_event_template_token_update_request, opts)
  data
end

#update_with_http_info(event_template_id, token_name, app_id, timeline_event_template_token_update_request, opts = {}) ⇒ Array<(TimelineEventTemplateToken, Integer, Hash)>

Updates an existing token on an event template This will update the existing token on an event template. Name and type can&#39;t be changed on existing tokens.

Parameters:

  • event_template_id (String)

    The event template ID.

  • token_name (String)

    The token name.

  • app_id (Integer)

    The ID of the target app.

  • timeline_event_template_token_update_request (TimelineEventTemplateTokenUpdateRequest)

    The updated token definition.

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

    the optional parameters

Returns:

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

    TimelineEventTemplateToken data, response status code and response headers



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
246
247
248
249
250
251
252
253
254
# File 'lib/hubspot/codegen/crm/timeline/api/tokens_api.rb', line 195

def update_with_http_info(event_template_id, token_name, app_id, timeline_event_template_token_update_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TokensApi.update ...'
  end
  # verify the required parameter 'event_template_id' is set
  if @api_client.config.client_side_validation && event_template_id.nil?
    fail ArgumentError, "Missing the required parameter 'event_template_id' when calling TokensApi.update"
  end
  # verify the required parameter 'token_name' is set
  if @api_client.config.client_side_validation && token_name.nil?
    fail ArgumentError, "Missing the required parameter 'token_name' when calling TokensApi.update"
  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 TokensApi.update"
  end
  # verify the required parameter 'timeline_event_template_token_update_request' is set
  if @api_client.config.client_side_validation && timeline_event_template_token_update_request.nil?
    fail ArgumentError, "Missing the required parameter 'timeline_event_template_token_update_request' when calling TokensApi.update"
  end
  # resource path
  local_var_path = '/crm/v3/timeline/{appId}/event-templates/{eventTemplateId}/tokens/{tokenName}'.sub('{' + 'eventTemplateId' + '}', CGI.escape(event_template_id.to_s)).sub('{' + 'tokenName' + '}', CGI.escape(token_name.to_s)).sub('{' + 'appId' + '}', CGI.escape(app_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(timeline_event_template_token_update_request) 

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

  # auth_names
  auth_names = opts[:auth_names] || ['developer_hapikey']

  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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TokensApi#update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end