Class: Hubspot::Cms::Blogs::BlogPosts::DefaultApi

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ DefaultApi

Returns a new instance of DefaultApi.



22
23
24
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 22

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



20
21
22
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 20

def api_client
  @api_client
end

Instance Method Details

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

Archive a batch of Blog Posts Archive the Blog Post objects identified in the request body.

Parameters:

  • batch_input_string (BatchInputString)

    The JSON array of Blog Post ids.

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

    the optional parameters

Returns:

  • (nil)


30
31
32
33
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 30

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

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

Delete a Blog Post Delete the Blog Post object identified by the id in the path.

Parameters:

  • object_id (String)

    The Blog Post id.

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

    the optional parameters

Options Hash (opts):

  • :archived (Boolean)

    Whether to return only results that have been archived.

Returns:

  • (nil)


95
96
97
98
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 95

def archive_0(object_id, opts = {})
  archive_0_with_http_info(object_id, opts)
  nil
end

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

Delete a Blog Post Delete the Blog Post object identified by the id in the path.

Parameters:

  • object_id (String)

    The Blog Post id.

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

    the optional parameters

Options Hash (opts):

  • :archived (Boolean)

    Whether to return only results that have been archived.

Returns:

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

    nil, response status code and response headers



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
143
144
145
146
147
148
149
150
151
152
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 106

def archive_0_with_http_info(object_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.archive_0 ...'
  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 DefaultApi.archive_0"
  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[:body] 

  # return_type
  return_type = opts[:return_type] 

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

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

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

Archive a batch of Blog Posts Archive the Blog Post objects identified in the request body.

Parameters:

  • batch_input_string (BatchInputString)

    The JSON array of Blog Post ids.

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

    the optional parameters

Returns:

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

    nil, 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
83
84
85
86
87
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 40

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

  # 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'
  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(batch_input_string) 

  # return_type
  return_type = opts[:return_type] 

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  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: DefaultApi#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.

Parameters:

  • content_clone_request_v_next (ContentCloneRequestVNext)

    The JSON representation of the ContentCloneRequest object.

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

    the optional parameters

Returns:



159
160
161
162
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 159

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.

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



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
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 169

def clone_with_http_info(content_clone_request_v_next, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.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 DefaultApi.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'
  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(content_clone_request_v_next) 

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  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: DefaultApi#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 Blog Post Create a new Blog Post.

Parameters:

  • blog_post (BlogPost)

    The JSON representation of a new Blog Post.

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

    the optional parameters

Returns:



223
224
225
226
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 223

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

#create_0(batch_input_blog_post, opts = {}) ⇒ Object

Create a batch of Blog Posts Create the Blog Post objects detailed in the request body.

Parameters:

  • batch_input_blog_post (BatchInputBlogPost)

    The JSON array of new Blog Posts to create.

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

    the optional parameters

Returns:

  • (Object)


287
288
289
290
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 287

def create_0(batch_input_blog_post, opts = {})
  data, _status_code, _headers = create_0_with_http_info(batch_input_blog_post, opts)
  data
end

#create_0_with_http_info(batch_input_blog_post, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Create a batch of Blog Posts Create the Blog Post objects detailed in the request body.

Parameters:

  • batch_input_blog_post (BatchInputBlogPost)

    The JSON array of new Blog Posts to create.

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

    the optional parameters

Returns:

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

    Object data, response status code and response headers



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
332
333
334
335
336
337
338
339
340
341
342
343
344
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 297

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

  # 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(batch_input_blog_post) 

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

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

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

Create a new Blog Post Create a new Blog Post.

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



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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 233

def create_with_http_info(blog_post, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.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 DefaultApi.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'
  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(blog_post) 

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  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: DefaultApi#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 the Blog Post object identified by the id in the path.

Parameters:

  • object_id (String)

    The Blog Post id.

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

    the optional parameters

Options Hash (opts):

  • :archived (Boolean)

    Specifies whether to return archived Blog Posts. Defaults to &#x60;false&#x60;.

Returns:



352
353
354
355
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 352

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 the Blog Post object identified by the id in the path.

Parameters:

  • object_id (String)

    The Blog Post id.

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

    the optional parameters

Options Hash (opts):

  • :archived (Boolean)

    Specifies whether to return archived Blog Posts. Defaults to &#x60;false&#x60;.

Returns:

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

    BlogPost data, response status code and response headers



363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 363

def get_by_id_with_http_info(object_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.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 DefaultApi.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?

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

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

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

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#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 the Blog Post.

Parameters:

  • object_id (String)

    The Blog Post id.

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

    the optional parameters

Returns:



416
417
418
419
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 416

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 the Blog Post.

Parameters:

  • object_id (String)

    The Blog Post id.

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

    the optional parameters

Returns:

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

    BlogPost data, response status code and response headers



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
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 426

def get_draft_by_id_with_http_info(object_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.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 DefaultApi.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[:body] 

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#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 Blog Posts Get the list of blog posts. Supports paging and filtering. This method would be useful for an integration that examined these models and used an external service to suggest edits.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :created_at (DateTime)

    Only return Blog Posts created at exactly the specified time.

  • :created_after (DateTime)

    Only return Blog Posts created after the specified time.

  • :created_before (DateTime)

    Only return Blog Posts created before the specified time.

  • :updated_at (DateTime)

    Only return Blog Posts last updated at exactly the specified time.

  • :updated_after (DateTime)

    Only return Blog Posts last updated after the specified time.

  • :updated_before (DateTime)

    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;name&#x60;, &#x60;createdAt&#x60;, &#x60;updatedAt&#x60;, &#x60;createdBy&#x60;, &#x60;updatedBy&#x60;. &#x60;createdAt&#x60; will be used by default.

  • :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 100.

  • :archived (Boolean)

    Specifies whether to return archived Blog Posts. Defaults to &#x60;false&#x60;.

Returns:



487
488
489
490
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 487

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 Blog Posts Get the list of blog posts. Supports paging and filtering. This method would be useful for an integration that examined these models and used an external service to suggest edits.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :created_at (DateTime)

    Only return Blog Posts created at exactly the specified time.

  • :created_after (DateTime)

    Only return Blog Posts created after the specified time.

  • :created_before (DateTime)

    Only return Blog Posts created before the specified time.

  • :updated_at (DateTime)

    Only return Blog Posts last updated at exactly the specified time.

  • :updated_after (DateTime)

    Only return Blog Posts last updated after the specified time.

  • :updated_before (DateTime)

    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;name&#x60;, &#x60;createdAt&#x60;, &#x60;updatedAt&#x60;, &#x60;createdBy&#x60;, &#x60;updatedBy&#x60;. &#x60;createdAt&#x60; will be used by default.

  • :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 100.

  • :archived (Boolean)

    Specifies whether to return archived Blog Posts. Defaults to &#x60;false&#x60;.

Returns:



506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 506

def get_page_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.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?

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

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

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

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#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

Retrieves a previous version of a blog post Retrieves a previous version of a blog post.

Parameters:

  • object_id (String)

    The Blog Post id.

  • revision_id (String)

    The Blog Post version id.

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

    the optional parameters

Returns:



565
566
567
568
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 565

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)>

Retrieves a previous version of a blog post Retrieves a previous version of a blog post.

Parameters:

  • object_id (String)

    The Blog Post id.

  • revision_id (String)

    The Blog Post version id.

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

    the optional parameters

Returns:

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

    VersionBlogPost data, response status code and response headers



576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 576

def get_previous_version_with_http_info(object_id, revision_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.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 DefaultApi.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 DefaultApi.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[:body] 

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#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 the previous versions of a blog post Retrieves all the previous versions of a blog post.

Parameters:

  • object_id (String)

    The Blog Post id.

  • 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:



635
636
637
638
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 635

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 the previous versions of a blog post Retrieves all the previous versions of a blog post.

Parameters:

  • object_id (String)

    The Blog Post id.

  • 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:



648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
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
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 648

def get_previous_versions_with_http_info(object_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.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 DefaultApi.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[:body] 

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#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

Push Blog Post draft edits live Take any changes from the draft version of the Blog Post and apply them to the live version.

Parameters:

  • object_id (String)

    The id of the Blog Post for which it&#39;s draft will be pushed live.

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

    the optional parameters

Returns:

  • (nil)


703
704
705
706
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 703

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)>

Push Blog Post draft edits live Take any changes from the draft version of the Blog Post and apply them to the live version.

Parameters:

  • object_id (String)

    The id of the Blog Post for which it&#39;s draft will be pushed live.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 713

def push_live_with_http_info(object_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.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 DefaultApi.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[:body] 

  # return_type
  return_type = opts[:return_type] 

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

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

#read(batch_input_string, opts = {}) ⇒ Object

Retrieve a batch of Blog Posts Retrieve the Blog Post objects identified in the request body.

Parameters:

  • batch_input_string (BatchInputString)

    The JSON array of Blog Post ids.

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

    the optional parameters

Options Hash (opts):

  • :archived (Boolean)

    Specifies whether to return archived Blog Posts. Defaults to &#x60;false&#x60;.

Returns:

  • (Object)


766
767
768
769
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 766

def read(batch_input_string, opts = {})
  data, _status_code, _headers = read_with_http_info(batch_input_string, opts)
  data
end

#read_with_http_info(batch_input_string, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Retrieve a batch of Blog Posts Retrieve the Blog Post objects identified in the request body.

Parameters:

  • batch_input_string (BatchInputString)

    The JSON array of Blog Post ids.

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

    the optional parameters

Options Hash (opts):

  • :archived (Boolean)

    Specifies whether to return archived Blog Posts. Defaults to &#x60;false&#x60;.

Returns:

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

    Object data, response status code and response headers



777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 777

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

  # 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'
  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(batch_input_string) 

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

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

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

Reset the Blog Post draft to the live version Discards any edits and resets the draft to the live version.

Parameters:

  • object_id (String)

    The id of the Blog Post for which it&#39;s draft will be reset.

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

    the optional parameters

Returns:

  • (nil)


832
833
834
835
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 832

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 the Blog Post draft to the live version Discards any edits and resets the draft to the live version.

Parameters:

  • object_id (String)

    The id of the Blog Post for which it&#39;s draft will be reset.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 842

def reset_draft_with_http_info(object_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.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 DefaultApi.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[:body] 

  # return_type
  return_type = opts[:return_type] 

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  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: DefaultApi#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 of a blog post Takes a specified version of a blog post and restores it.

Parameters:

  • object_id (String)

    The Blog Post id.

  • revision_id (String)

    The Blog Post version id to restore.

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

    the optional parameters

Returns:



895
896
897
898
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 895

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 previous version of a blog post, to the draft version of the blog post Takes a specified version of a blog post, sets it as the new draft version of the blog post.

Parameters:

  • object_id (String)

    The Blog Post id.

  • revision_id (Integer)

    The Blog Post version id to restore.

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

    the optional parameters

Returns:



963
964
965
966
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 963

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 previous version of a blog post, to the draft version of the blog post Takes a specified version of a blog post, sets it as the new draft version of the blog post.

Parameters:

  • object_id (String)

    The Blog Post id.

  • revision_id (Integer)

    The Blog Post version id to restore.

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

    the optional parameters

Returns:

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

    BlogPost data, response status code and response headers



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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 974

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: DefaultApi.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 DefaultApi.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 DefaultApi.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[:body] 

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  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: DefaultApi#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 of a blog post Takes a specified version of a blog post and restores it.

Parameters:

  • object_id (String)

    The Blog Post id.

  • revision_id (String)

    The Blog Post version id to restore.

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

    the optional parameters

Returns:

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

    BlogPost data, response status code and response headers



906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 906

def restore_previous_version_with_http_info(object_id, revision_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.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 DefaultApi.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 DefaultApi.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[:body] 

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  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: DefaultApi#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 Blog Post to be Published Schedule a Blog Post to be Published.

Parameters:

  • content_schedule_request_v_next (ContentScheduleRequestVNext)

    The JSON representation of the ContentCloneRequestVNext object.

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

    the optional parameters

Returns:

  • (nil)


1030
1031
1032
1033
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 1030

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 Blog Post to be Published Schedule a Blog Post to be Published.

Parameters:

  • content_schedule_request_v_next (ContentScheduleRequestVNext)

    The JSON representation of the ContentCloneRequestVNext object.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 1040

def schedule_with_http_info(content_schedule_request_v_next, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.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 DefaultApi.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'
  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(content_schedule_request_v_next) 

  # return_type
  return_type = opts[:return_type] 

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

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

#update(batch_input_json_node, opts = {}) ⇒ Object

Update a batch of Blog Posts Update the Blog Post objects identified in the request body.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :archived (Boolean)

    Whether to return only results that have been archived.

Returns:

  • (Object)


1095
1096
1097
1098
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 1095

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

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

Update a Blog Post Sparse updates a single Blog Post object identified by the id in the path. All the column values need not be specified. Only the that need to be modified can be specified.

Parameters:

  • object_id (String)

    The Blog Post id.

  • 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 archived Blog Posts. Defaults to &#x60;false&#x60;.

Returns:



1163
1164
1165
1166
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 1163

def update_0(object_id, blog_post, opts = {})
  data, _status_code, _headers = update_0_with_http_info(object_id, blog_post, opts)
  data
end

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

Update a Blog Post Sparse updates a single Blog Post object identified by the id in the path. All the column values need not be specified. Only the that need to be modified can be specified.

Parameters:

  • object_id (String)

    The Blog Post id.

  • 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 archived Blog Posts. Defaults to &#x60;false&#x60;.

Returns:

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

    BlogPost data, response status code and response headers



1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 1175

def update_0_with_http_info(object_id, blog_post, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.update_0 ...'
  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 DefaultApi.update_0"
  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 DefaultApi.update_0"
  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'
  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(blog_post) 

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

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

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

Update a Blog Post draft Sparse updates the draft version of a single Blog Post object identified by the id in the path. All the column values need not be specified. Only the that need to be modified can be specified.

Parameters:

  • object_id (String)

    The Blog Post id.

  • 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:



1235
1236
1237
1238
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 1235

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 a Blog Post draft Sparse updates the draft version of a single Blog Post object identified by the id in the path. All the column values need not be specified. Only the that need to be modified can be specified.

Parameters:

  • object_id (String)

    The Blog Post id.

  • 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



1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 1246

def update_draft_with_http_info(object_id, blog_post, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.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 DefaultApi.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 DefaultApi.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'
  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(blog_post) 

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

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

#update_with_http_info(batch_input_json_node, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Update a batch of Blog Posts Update the Blog Post objects identified in the request body.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :archived (Boolean)

    Whether to return only results that have been archived.

Returns:

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

    Object data, response status code and response headers



1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
# File 'lib/hubspot/codegen/cms/blogs/blog-posts/api/default_api.rb', line 1106

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

  # 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'
  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(batch_input_json_node) 

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

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