Class: Hubspot::Cms::Blogs::BlogPosts::BasicApi

Inherits:
Object
  • Object
show all
Includes:
Helpers::GetAllHelper
Defined in:
lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb

Constant Summary

Constants included from Helpers::GetAllHelper

Helpers::GetAllHelper::MAX_PAGE_SIZE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::GetAllHelper

#get_all

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ BasicApi

Returns a new instance of BasicApi.



25
26
27
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 25

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



23
24
25
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 23

def api_client
  @api_client
end

Instance Method Details

#archive(object_id, opts = {}) ⇒ nil

Delete a blog post Delete a blog post by ID.

Parameters:

  • object_id (String)

    The ID of the blog post to delete.

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

    the optional parameters

Options Hash (opts):

  • :archived (Boolean)

    Whether to return only results that have been deleted.

Returns:

  • (nil)


34
35
36
37
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 34

def archive(object_id, opts = {})
  archive_with_http_info(object_id, opts)
  nil
end

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

Delete a blog post Delete a blog post by ID.

Parameters:

  • object_id (String)

    The ID of the blog post to delete.

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

    the optional parameters

Options Hash (opts):

  • :archived (Boolean)

    Whether to return only results that have been deleted.

Returns:

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

    nil, response status code and response headers



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
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 45

def archive_with_http_info(object_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BasicApi.archive ...'
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    fail ArgumentError, "Missing the required parameter 'object_id' when calling BasicApi.archive"
  end
  # resource path
  local_var_path = '/cms/v3/blogs/posts/{objectId}'.sub('{' + 'objectId' + '}', CGI.escape(object_id.to_s))

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

  # 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[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"BasicApi.archive",
    :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: BasicApi#archive\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#clone(content_clone_request_v_next, opts = {}) ⇒ BlogPost

Clone a blog post Clone a blog post, making a copy of it in a new blog post.

Parameters:

  • content_clone_request_v_next (ContentCloneRequestVNext)

    The JSON representation of the ContentCloneRequest object.

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

    the optional parameters

Returns:



99
100
101
102
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 99

def clone(content_clone_request_v_next, opts = {})
  data, _status_code, _headers = clone_with_http_info(content_clone_request_v_next, opts)
  data
end

#clone_with_http_info(content_clone_request_v_next, opts = {}) ⇒ Array<(BlogPost, Integer, Hash)>

Clone a blog post Clone a blog post, making a copy of it in a new blog post.

Parameters:

  • content_clone_request_v_next (ContentCloneRequestVNext)

    The JSON representation of the ContentCloneRequest object.

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

    the optional parameters

Returns:

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

    BlogPost data, response status code and response headers



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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 109

def clone_with_http_info(content_clone_request_v_next, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BasicApi.clone ...'
  end
  # verify the required parameter 'content_clone_request_v_next' is set
  if @api_client.config.client_side_validation && content_clone_request_v_next.nil?
    fail ArgumentError, "Missing the required parameter 'content_clone_request_v_next' when calling BasicApi.clone"
  end
  # resource path
  local_var_path = '/cms/v3/blogs/posts/clone'

  # 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'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'BlogPost'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"BasicApi.clone",
    :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: BasicApi#clone\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create(blog_post, opts = {}) ⇒ BlogPost

Create a new post Create a new blog post, specifying its content in the request body.

Parameters:

  • blog_post (BlogPost)

    The JSON representation of a new Blog Post.

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

    the optional parameters

Returns:



167
168
169
170
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 167

def create(blog_post, opts = {})
  data, _status_code, _headers = create_with_http_info(blog_post, opts)
  data
end

#create_with_http_info(blog_post, opts = {}) ⇒ Array<(BlogPost, Integer, Hash)>

Create a new post Create a new blog post, specifying its content in the request body.

Parameters:

  • blog_post (BlogPost)

    The JSON representation of a new Blog Post.

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

    the optional parameters

Returns:

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

    BlogPost data, response status code and response headers



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
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
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 177

def create_with_http_info(blog_post, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BasicApi.create ...'
  end
  # verify the required parameter 'blog_post' is set
  if @api_client.config.client_side_validation && blog_post.nil?
    fail ArgumentError, "Missing the required parameter 'blog_post' when calling BasicApi.create"
  end
  # resource path
  local_var_path = '/cms/v3/blogs/posts'

  # 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'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'BlogPost'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"BasicApi.create",
    :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: BasicApi#create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_by_id(object_id, opts = {}) ⇒ BlogPost

Retrieve a blog post Retrieve a blog post by the post ID.

Parameters:

  • object_id (String)

    The ID of the blog post to retrieve.

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

    the optional parameters

Options Hash (opts):

  • :archived (Boolean)

    Specifies whether to return deleted blog posts. Defaults to &#x60;false&#x60;.

  • :property (String)

    Specific properties to return.

Returns:



237
238
239
240
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 237

def get_by_id(object_id, opts = {})
  data, _status_code, _headers = get_by_id_with_http_info(object_id, opts)
  data
end

#get_by_id_with_http_info(object_id, opts = {}) ⇒ Array<(BlogPost, Integer, Hash)>

Retrieve a blog post Retrieve a blog post by the post ID.

Parameters:

  • object_id (String)

    The ID of the blog post to retrieve.

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

    the optional parameters

Options Hash (opts):

  • :archived (Boolean)

    Specifies whether to return deleted blog posts. Defaults to &#x60;false&#x60;.

  • :property (String)

    Specific properties to return.

Returns:

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

    BlogPost data, response status code and response headers



249
250
251
252
253
254
255
256
257
258
259
260
261
262
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
292
293
294
295
296
297
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 249

def get_by_id_with_http_info(object_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BasicApi.get_by_id ...'
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    fail ArgumentError, "Missing the required parameter 'object_id' when calling BasicApi.get_by_id"
  end
  # resource path
  local_var_path = '/cms/v3/blogs/posts/{objectId}'.sub('{' + 'objectId' + '}', CGI.escape(object_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil?
  query_params[:'property'] = opts[:'property'] if !opts[:'property'].nil?

  # 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[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'BlogPost'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"BasicApi.get_by_id",
    :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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BasicApi#get_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_draft_by_id(object_id, opts = {}) ⇒ BlogPost

Retrieve the full draft version of the Blog Post Retrieve the full draft version of a blog post.

Parameters:

  • object_id (String)

    The ID of the blog post to retrieve the draft of.

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

    the optional parameters

Returns:



304
305
306
307
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 304

def get_draft_by_id(object_id, opts = {})
  data, _status_code, _headers = get_draft_by_id_with_http_info(object_id, opts)
  data
end

#get_draft_by_id_with_http_info(object_id, opts = {}) ⇒ Array<(BlogPost, Integer, Hash)>

Retrieve the full draft version of the Blog Post Retrieve the full draft version of a blog post.

Parameters:

  • object_id (String)

    The ID of the blog post to retrieve the draft of.

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

    the optional parameters

Returns:

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

    BlogPost data, response status code and response headers



314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 314

def get_draft_by_id_with_http_info(object_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BasicApi.get_draft_by_id ...'
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    fail ArgumentError, "Missing the required parameter 'object_id' when calling BasicApi.get_draft_by_id"
  end
  # resource path
  local_var_path = '/cms/v3/blogs/posts/{objectId}/draft'.sub('{' + 'objectId' + '}', CGI.escape(object_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[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'BlogPost'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"BasicApi.get_draft_by_id",
    :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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BasicApi#get_draft_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_page(opts = {}) ⇒ CollectionResponseWithTotalBlogPostForwardPaging

Get all posts Retrieve all blog posts, with paging and filtering options. This method would be useful for an integration that ingests posts and suggests edits.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :created_at (Time)

    Only return blog posts created at exactly the specified time.

  • :created_after (Time)

    Only return blog posts created after the specified time.

  • :created_before (Time)

    Only return blog posts created before the specified time.

  • :updated_at (Time)

    Only return blog posts last updated at exactly the specified time.

  • :updated_after (Time)

    Only return blog posts last updated after the specified time.

  • :updated_before (Time)

    Only return blog posts last updated before the specified time.

  • :sort (Array<String>)

    Specifies which fields to use for sorting results. Valid fields are &#x60;createdAt&#x60; (default), &#x60;name&#x60;, &#x60;updatedAt&#x60;, &#x60;createdBy&#x60;, &#x60;updatedBy&#x60;.

  • :after (String)

    The cursor token value to get the next set of results. You can get this from the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results.

  • :limit (Integer)

    The maximum number of results to return. Default is 20.

  • :archived (Boolean)

    Specifies whether to return deleted blog posts. Defaults to &#x60;false&#x60;.

  • :property (String)

Returns:



377
378
379
380
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 377

def get_page(opts = {})
  data, _status_code, _headers = get_page_with_http_info(opts)
  data
end

#get_page_with_http_info(opts = {}) ⇒ Array<(CollectionResponseWithTotalBlogPostForwardPaging, Integer, Hash)>

Get all posts Retrieve all blog posts, with paging and filtering options. This method would be useful for an integration that ingests posts and suggests edits.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :created_at (Time)

    Only return blog posts created at exactly the specified time.

  • :created_after (Time)

    Only return blog posts created after the specified time.

  • :created_before (Time)

    Only return blog posts created before the specified time.

  • :updated_at (Time)

    Only return blog posts last updated at exactly the specified time.

  • :updated_after (Time)

    Only return blog posts last updated after the specified time.

  • :updated_before (Time)

    Only return blog posts last updated before the specified time.

  • :sort (Array<String>)

    Specifies which fields to use for sorting results. Valid fields are &#x60;createdAt&#x60; (default), &#x60;name&#x60;, &#x60;updatedAt&#x60;, &#x60;createdBy&#x60;, &#x60;updatedBy&#x60;.

  • :after (String)

    The cursor token value to get the next set of results. You can get this from the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results.

  • :limit (Integer)

    The maximum number of results to return. Default is 20.

  • :archived (Boolean)

    Specifies whether to return deleted blog posts. Defaults to &#x60;false&#x60;.

  • :property (String)

Returns:



397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 397

def get_page_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BasicApi.get_page ...'
  end
  # resource path
  local_var_path = '/cms/v3/blogs/posts'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'createdAt'] = opts[:'created_at'] if !opts[:'created_at'].nil?
  query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].nil?
  query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil?
  query_params[:'updatedAt'] = opts[:'updated_at'] if !opts[:'updated_at'].nil?
  query_params[:'updatedAfter'] = opts[:'updated_after'] if !opts[:'updated_after'].nil?
  query_params[:'updatedBefore'] = opts[:'updated_before'] if !opts[:'updated_before'].nil?
  query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].nil?
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil?
  query_params[:'property'] = opts[:'property'] if !opts[:'property'].nil?

  # 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[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CollectionResponseWithTotalBlogPostForwardPaging'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"BasicApi.get_page",
    :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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BasicApi#get_page\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_previous_version(object_id, revision_id, opts = {}) ⇒ VersionBlogPost

Retrieve a previous version of a blog post Retrieve a previous version of a blog post.

Parameters:

  • object_id (String)

    The ID of the blog post.

  • revision_id (String)

    The ID of the version to retrieve.

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

    the optional parameters

Returns:



458
459
460
461
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 458

def get_previous_version(object_id, revision_id, opts = {})
  data, _status_code, _headers = get_previous_version_with_http_info(object_id, revision_id, opts)
  data
end

#get_previous_version_with_http_info(object_id, revision_id, opts = {}) ⇒ Array<(VersionBlogPost, Integer, Hash)>

Retrieve a previous version of a blog post Retrieve a previous version of a blog post.

Parameters:

  • object_id (String)

    The ID of the blog post.

  • revision_id (String)

    The ID of the version to retrieve.

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

    the optional parameters

Returns:

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

    VersionBlogPost data, response status code and response headers



469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 469

def get_previous_version_with_http_info(object_id, revision_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BasicApi.get_previous_version ...'
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    fail ArgumentError, "Missing the required parameter 'object_id' when calling BasicApi.get_previous_version"
  end
  # verify the required parameter 'revision_id' is set
  if @api_client.config.client_side_validation && revision_id.nil?
    fail ArgumentError, "Missing the required parameter 'revision_id' when calling BasicApi.get_previous_version"
  end
  # resource path
  local_var_path = '/cms/v3/blogs/posts/{objectId}/revisions/{revisionId}'.sub('{' + 'objectId' + '}', CGI.escape(object_id.to_s)).sub('{' + 'revisionId' + '}', CGI.escape(revision_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[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'VersionBlogPost'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"BasicApi.get_previous_version",
    :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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BasicApi#get_previous_version\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_previous_versions(object_id, opts = {}) ⇒ CollectionResponseWithTotalVersionBlogPost

Retrieves all previous versions of a post Retrieve all the previous versions of a blog post.

Parameters:

  • object_id (String)

    The ID of the blog post to retrieve previous versions of.

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

    the optional parameters

Options Hash (opts):

  • :after (String)

    The cursor token value to get the next set of results. You can get this from the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results.

  • :before (String)
  • :limit (Integer)

    The maximum number of results to return. Default is 100.

Returns:



529
530
531
532
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 529

def get_previous_versions(object_id, opts = {})
  data, _status_code, _headers = get_previous_versions_with_http_info(object_id, opts)
  data
end

#get_previous_versions_with_http_info(object_id, opts = {}) ⇒ Array<(CollectionResponseWithTotalVersionBlogPost, Integer, Hash)>

Retrieves all previous versions of a post Retrieve all the previous versions of a blog post.

Parameters:

  • object_id (String)

    The ID of the blog post to retrieve previous versions of.

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

    the optional parameters

Options Hash (opts):

  • :after (String)

    The cursor token value to get the next set of results. You can get this from the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results.

  • :before (String)
  • :limit (Integer)

    The maximum number of results to return. Default is 100.

Returns:



542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 542

def get_previous_versions_with_http_info(object_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BasicApi.get_previous_versions ...'
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    fail ArgumentError, "Missing the required parameter 'object_id' when calling BasicApi.get_previous_versions"
  end
  # resource path
  local_var_path = '/cms/v3/blogs/posts/{objectId}/revisions'.sub('{' + 'objectId' + '}', CGI.escape(object_id.to_s))

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

  # 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[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CollectionResponseWithTotalVersionBlogPost'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"BasicApi.get_previous_versions",
    :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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BasicApi#get_previous_versions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#push_live(object_id, opts = {}) ⇒ nil

Publish blog post draft Publish the draft version of the blog post, sending its content to the live page.

Parameters:

  • object_id (String)

    The ID of the post to publish.

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

    the optional parameters

Returns:

  • (nil)


598
599
600
601
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 598

def push_live(object_id, opts = {})
  push_live_with_http_info(object_id, opts)
  nil
end

#push_live_with_http_info(object_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Publish blog post draft Publish the draft version of the blog post, sending its content to the live page.

Parameters:

  • object_id (String)

    The ID of the post to publish.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 608

def push_live_with_http_info(object_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BasicApi.push_live ...'
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    fail ArgumentError, "Missing the required parameter 'object_id' when calling BasicApi.push_live"
  end
  # resource path
  local_var_path = '/cms/v3/blogs/posts/{objectId}/draft/push-live'.sub('{' + 'objectId' + '}', CGI.escape(object_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[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"BasicApi.push_live",
    :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: BasicApi#push_live\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#reset_draft(object_id, opts = {}) ⇒ nil

Reset post draft to the live version Discard all drafted content, resetting the draft to contain the content in the currently published version.

Parameters:

  • object_id (String)

    The ID of the blog post to reset.

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

    the optional parameters

Returns:

  • (nil)


661
662
663
664
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 661

def reset_draft(object_id, opts = {})
  reset_draft_with_http_info(object_id, opts)
  nil
end

#reset_draft_with_http_info(object_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Reset post draft to the live version Discard all drafted content, resetting the draft to contain the content in the currently published version.

Parameters:

  • object_id (String)

    The ID of the blog post to reset.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 671

def reset_draft_with_http_info(object_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BasicApi.reset_draft ...'
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    fail ArgumentError, "Missing the required parameter 'object_id' when calling BasicApi.reset_draft"
  end
  # resource path
  local_var_path = '/cms/v3/blogs/posts/{objectId}/draft/reset'.sub('{' + 'objectId' + '}', CGI.escape(object_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[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"BasicApi.reset_draft",
    :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: BasicApi#reset_draft\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#restore_previous_version(object_id, revision_id, opts = {}) ⇒ BlogPost

Restore a previous version Restores a blog post to one of its previous versions.

Parameters:

  • object_id (String)

    The ID of the blog post.

  • revision_id (String)

    The ID of the version to restore the blog post to.

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

    the optional parameters

Returns:



725
726
727
728
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 725

def restore_previous_version(object_id, revision_id, opts = {})
  data, _status_code, _headers = restore_previous_version_with_http_info(object_id, revision_id, opts)
  data
end

#restore_previous_version_to_draft(object_id, revision_id, opts = {}) ⇒ BlogPost

Restore a draft to a previous version Takes a specified version of a blog post, sets it as the new draft version of the blog post.

Parameters:

  • object_id (String)

    The ID of the blog post.

  • revision_id (Integer)

    The ID of the version to restore the blog post to.

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

    the optional parameters

Returns:



794
795
796
797
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 794

def restore_previous_version_to_draft(object_id, revision_id, opts = {})
  data, _status_code, _headers = restore_previous_version_to_draft_with_http_info(object_id, revision_id, opts)
  data
end

#restore_previous_version_to_draft_with_http_info(object_id, revision_id, opts = {}) ⇒ Array<(BlogPost, Integer, Hash)>

Restore a draft to a previous version Takes a specified version of a blog post, sets it as the new draft version of the blog post.

Parameters:

  • object_id (String)

    The ID of the blog post.

  • revision_id (Integer)

    The ID of the version to restore the blog post to.

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

    the optional parameters

Returns:

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

    BlogPost data, response status code and response headers



805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 805

def restore_previous_version_to_draft_with_http_info(object_id, revision_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BasicApi.restore_previous_version_to_draft ...'
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    fail ArgumentError, "Missing the required parameter 'object_id' when calling BasicApi.restore_previous_version_to_draft"
  end
  # verify the required parameter 'revision_id' is set
  if @api_client.config.client_side_validation && revision_id.nil?
    fail ArgumentError, "Missing the required parameter 'revision_id' when calling BasicApi.restore_previous_version_to_draft"
  end
  # resource path
  local_var_path = '/cms/v3/blogs/posts/{objectId}/revisions/{revisionId}/restore-to-draft'.sub('{' + 'objectId' + '}', CGI.escape(object_id.to_s)).sub('{' + 'revisionId' + '}', CGI.escape(revision_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[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'BlogPost'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"BasicApi.restore_previous_version_to_draft",
    :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: BasicApi#restore_previous_version_to_draft\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#restore_previous_version_with_http_info(object_id, revision_id, opts = {}) ⇒ Array<(BlogPost, Integer, Hash)>

Restore a previous version Restores a blog post to one of its previous versions.

Parameters:

  • object_id (String)

    The ID of the blog post.

  • revision_id (String)

    The ID of the version to restore the blog post to.

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

    the optional parameters

Returns:

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

    BlogPost data, response status code and response headers



736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 736

def restore_previous_version_with_http_info(object_id, revision_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BasicApi.restore_previous_version ...'
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    fail ArgumentError, "Missing the required parameter 'object_id' when calling BasicApi.restore_previous_version"
  end
  # verify the required parameter 'revision_id' is set
  if @api_client.config.client_side_validation && revision_id.nil?
    fail ArgumentError, "Missing the required parameter 'revision_id' when calling BasicApi.restore_previous_version"
  end
  # resource path
  local_var_path = '/cms/v3/blogs/posts/{objectId}/revisions/{revisionId}/restore'.sub('{' + 'objectId' + '}', CGI.escape(object_id.to_s)).sub('{' + 'revisionId' + '}', CGI.escape(revision_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[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'BlogPost'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"BasicApi.restore_previous_version",
    :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: BasicApi#restore_previous_version\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#schedule(content_schedule_request_v_next, opts = {}) ⇒ nil

Schedule a post to be published Schedule a blog post to be published at a specified time.

Parameters:

  • content_schedule_request_v_next (ContentScheduleRequestVNext)

    The JSON representation of the ContentScheduleRequestVNext object.

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

    the optional parameters

Returns:

  • (nil)


862
863
864
865
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 862

def schedule(content_schedule_request_v_next, opts = {})
  schedule_with_http_info(content_schedule_request_v_next, opts)
  nil
end

#schedule_with_http_info(content_schedule_request_v_next, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Schedule a post to be published Schedule a blog post to be published at a specified time.

Parameters:

  • content_schedule_request_v_next (ContentScheduleRequestVNext)

    The JSON representation of the ContentScheduleRequestVNext object.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 872

def schedule_with_http_info(content_schedule_request_v_next, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BasicApi.schedule ...'
  end
  # verify the required parameter 'content_schedule_request_v_next' is set
  if @api_client.config.client_side_validation && content_schedule_request_v_next.nil?
    fail ArgumentError, "Missing the required parameter 'content_schedule_request_v_next' when calling BasicApi.schedule"
  end
  # resource path
  local_var_path = '/cms/v3/blogs/posts/schedule'

  # 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(['*/*'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

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

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"BasicApi.schedule",
    :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: BasicApi#schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update(object_id, blog_post, opts = {}) ⇒ BlogPost

Update a post Partially updates a single blog post by ID. You only need to specify the values that you want to update.

Parameters:

  • object_id (String)

    The ID of the blog post to update.

  • blog_post (BlogPost)

    The JSON representation of the updated Blog Post.

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

    the optional parameters

Options Hash (opts):

  • :archived (Boolean)

    Specifies whether to update deleted blog posts. Defaults to &#x60;false&#x60;.

Returns:



932
933
934
935
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 932

def update(object_id, blog_post, opts = {})
  data, _status_code, _headers = update_with_http_info(object_id, blog_post, opts)
  data
end

#update_draft(object_id, blog_post, opts = {}) ⇒ BlogPost

Update the draft of a post Partially updates the draft version of a single blog post by ID. You only need to specify the values that you want to update.

Parameters:

  • object_id (String)

    The ID of the blog post to update the draft of.

  • blog_post (BlogPost)

    The JSON representation of the updated Blog Post to be applied to the draft.

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

    the optional parameters

Returns:



1008
1009
1010
1011
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 1008

def update_draft(object_id, blog_post, opts = {})
  data, _status_code, _headers = update_draft_with_http_info(object_id, blog_post, opts)
  data
end

#update_draft_with_http_info(object_id, blog_post, opts = {}) ⇒ Array<(BlogPost, Integer, Hash)>

Update the draft of a post Partially updates the draft version of a single blog post by ID. You only need to specify the values that you want to update.

Parameters:

  • object_id (String)

    The ID of the blog post to update the draft of.

  • blog_post (BlogPost)

    The JSON representation of the updated Blog Post to be applied to the draft.

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

    the optional parameters

Returns:

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

    BlogPost data, response status code and response headers



1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 1019

def update_draft_with_http_info(object_id, blog_post, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BasicApi.update_draft ...'
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    fail ArgumentError, "Missing the required parameter 'object_id' when calling BasicApi.update_draft"
  end
  # verify the required parameter 'blog_post' is set
  if @api_client.config.client_side_validation && blog_post.nil?
    fail ArgumentError, "Missing the required parameter 'blog_post' when calling BasicApi.update_draft"
  end
  # resource path
  local_var_path = '/cms/v3/blogs/posts/{objectId}/draft'.sub('{' + 'objectId' + '}', CGI.escape(object_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'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'BlogPost'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"BasicApi.update_draft",
    :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(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BasicApi#update_draft\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_with_http_info(object_id, blog_post, opts = {}) ⇒ Array<(BlogPost, Integer, Hash)>

Update a post Partially updates a single blog post by ID. You only need to specify the values that you want to update.

Parameters:

  • object_id (String)

    The ID of the blog post to update.

  • blog_post (BlogPost)

    The JSON representation of the updated Blog Post.

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

    the optional parameters

Options Hash (opts):

  • :archived (Boolean)

    Specifies whether to update deleted blog posts. Defaults to &#x60;false&#x60;.

Returns:

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

    BlogPost data, response status code and response headers



944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# File 'lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb', line 944

def update_with_http_info(object_id, blog_post, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BasicApi.update ...'
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    fail ArgumentError, "Missing the required parameter 'object_id' when calling BasicApi.update"
  end
  # verify the required parameter 'blog_post' is set
  if @api_client.config.client_side_validation && blog_post.nil?
    fail ArgumentError, "Missing the required parameter 'blog_post' when calling BasicApi.update"
  end
  # resource path
  local_var_path = '/cms/v3/blogs/posts/{objectId}'.sub('{' + 'objectId' + '}', CGI.escape(object_id.to_s))

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

  # 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'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'BlogPost'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

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