=begin
#Posts

#Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags

The version of the OpenAPI document: v3

Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.2.1

=end

require 'cgi'

module Hubspot
  module Cms
    module Blogs
      module BlogPosts
        class BasicApi
          require 'hubspot/helpers/get_all_helper'
          include Hubspot::Helpers::GetAllHelper

          attr_accessor :api_client

          def initialize(api_client = ApiClient.default)
            @api_client = api_client
          end
          # Delete a blog post
          # Delete a blog post by ID.
          # @param object_id [String] The ID of the blog post to delete.
          # @param [Hash] opts the optional parameters
          # @option opts [Boolean] :archived Whether to return only results that have been deleted.
          # @return [nil]
          def archive(object_id, opts = {})
            archive_with_http_info(object_id, opts)
            nil
          end

          # Delete a blog post
          # Delete a blog post by ID.
          # @param object_id [String] The ID of the blog post to delete.
          # @param [Hash] opts the optional parameters
          # @option opts [Boolean] :archived Whether to return only results that have been deleted.
          # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
          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 a blog post
          # Clone a blog post, making a copy of it in a new blog post.
          # @param content_clone_request_v_next [ContentCloneRequestVNext] The JSON representation of the ContentCloneRequest object.
          # @param [Hash] opts the optional parameters
          # @return [BlogPost]
          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 a blog post
          # Clone a blog post, making a copy of it in a new blog post.
          # @param content_clone_request_v_next [ContentCloneRequestVNext] The JSON representation of the ContentCloneRequest object.
          # @param [Hash] opts the optional parameters
          # @return [Array<(BlogPost, Integer, Hash)>] BlogPost data, response status code and response headers
          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 a new post
          # Create a new blog post, specifying its content in the request body.
          # @param blog_post [BlogPost] The JSON representation of a new Blog Post.
          # @param [Hash] opts the optional parameters
          # @return [BlogPost]
          def create(blog_post, opts = {})
            data, _status_code, _headers = create_with_http_info(blog_post, opts)
            data
          end

          # Create a new post
          # Create a new blog post, specifying its content in the request body.
          # @param blog_post [BlogPost] The JSON representation of a new Blog Post.
          # @param [Hash] opts the optional parameters
          # @return [Array<(BlogPost, Integer, Hash)>] BlogPost data, response status code and response headers
          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

          # Retrieve a blog post
          # Retrieve a blog post by the post ID.
          # @param object_id [String] The ID of the blog post to retrieve.
          # @param [Hash] opts the optional parameters
          # @option opts [Boolean] :archived Specifies whether to return deleted blog posts. Defaults to &#x60;false&#x60;.
          # @option opts [String] :property Specific properties to return.
          # @return [BlogPost]
          def get_by_id(object_id, opts = {})
            data, _status_code, _headers = get_by_id_with_http_info(object_id, opts)
            data
          end

          # Retrieve a blog post
          # Retrieve a blog post by the post ID.
          # @param object_id [String] The ID of the blog post to retrieve.
          # @param [Hash] opts the optional parameters
          # @option opts [Boolean] :archived Specifies whether to return deleted blog posts. Defaults to &#x60;false&#x60;.
          # @option opts [String] :property Specific properties to return.
          # @return [Array<(BlogPost, Integer, Hash)>] BlogPost data, response status code and response headers
          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

          # Retrieve the full draft version of the Blog Post
          # Retrieve the full draft version of a blog post.
          # @param object_id [String] The ID of the blog post to retrieve the draft of.
          # @param [Hash] opts the optional parameters
          # @return [BlogPost]
          def get_draft_by_id(object_id, opts = {})
            data, _status_code, _headers = get_draft_by_id_with_http_info(object_id, opts)
            data
          end

          # Retrieve the full draft version of the Blog Post
          # Retrieve the full draft version of a blog post.
          # @param object_id [String] The ID of the blog post to retrieve the draft of.
          # @param [Hash] opts the optional parameters
          # @return [Array<(BlogPost, Integer, Hash)>] BlogPost data, response status code and response headers
          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 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.
          # @param [Hash] opts the optional parameters
          # @option opts [Time] :created_at Only return blog posts created at exactly the specified time.
          # @option opts [Time] :created_after Only return blog posts created after the specified time.
          # @option opts [Time] :created_before Only return blog posts created before the specified time.
          # @option opts [Time] :updated_at Only return blog posts last updated at exactly the specified time.
          # @option opts [Time] :updated_after Only return blog posts last updated after the specified time.
          # @option opts [Time] :updated_before Only return blog posts last updated before the specified time.
          # @option opts [Array<String>] :sort 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;.
          # @option opts [String] :after 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.
          # @option opts [Integer] :limit The maximum number of results to return. Default is 20.
          # @option opts [Boolean] :archived Specifies whether to return deleted blog posts. Defaults to &#x60;false&#x60;.
          # @option opts [String] :property 
          # @return [CollectionResponseWithTotalBlogPostForwardPaging]
          def get_page(opts = {})
            data, _status_code, _headers = get_page_with_http_info(opts)
            data
          end

          # 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.
          # @param [Hash] opts the optional parameters
          # @option opts [Time] :created_at Only return blog posts created at exactly the specified time.
          # @option opts [Time] :created_after Only return blog posts created after the specified time.
          # @option opts [Time] :created_before Only return blog posts created before the specified time.
          # @option opts [Time] :updated_at Only return blog posts last updated at exactly the specified time.
          # @option opts [Time] :updated_after Only return blog posts last updated after the specified time.
          # @option opts [Time] :updated_before Only return blog posts last updated before the specified time.
          # @option opts [Array<String>] :sort 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;.
          # @option opts [String] :after 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.
          # @option opts [Integer] :limit The maximum number of results to return. Default is 20.
          # @option opts [Boolean] :archived Specifies whether to return deleted blog posts. Defaults to &#x60;false&#x60;.
          # @option opts [String] :property 
          # @return [Array<(CollectionResponseWithTotalBlogPostForwardPaging, Integer, Hash)>] CollectionResponseWithTotalBlogPostForwardPaging data, response status code and response headers
          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

          # Retrieve a previous version of a blog post
          # Retrieve a previous version of a blog post.
          # @param object_id [String] The ID of the blog post.
          # @param revision_id [String] The ID of the version to retrieve.
          # @param [Hash] opts the optional parameters
          # @return [VersionBlogPost]
          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

          # Retrieve a previous version of a blog post
          # Retrieve a previous version of a blog post.
          # @param object_id [String] The ID of the blog post.
          # @param revision_id [String] The ID of the version to retrieve.
          # @param [Hash] opts the optional parameters
          # @return [Array<(VersionBlogPost, Integer, Hash)>] VersionBlogPost data, response status code and response headers
          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

          # Retrieves all previous versions of a post
          # Retrieve all the previous versions of a blog post.
          # @param object_id [String] The ID of the blog post to retrieve previous versions of.
          # @param [Hash] opts the optional parameters
          # @option opts [String] :after 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.
          # @option opts [String] :before 
          # @option opts [Integer] :limit The maximum number of results to return. Default is 100.
          # @return [CollectionResponseWithTotalVersionBlogPost]
          def get_previous_versions(object_id, opts = {})
            data, _status_code, _headers = get_previous_versions_with_http_info(object_id, opts)
            data
          end

          # Retrieves all previous versions of a post
          # Retrieve all the previous versions of a blog post.
          # @param object_id [String] The ID of the blog post to retrieve previous versions of.
          # @param [Hash] opts the optional parameters
          # @option opts [String] :after 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.
          # @option opts [String] :before 
          # @option opts [Integer] :limit The maximum number of results to return. Default is 100.
          # @return [Array<(CollectionResponseWithTotalVersionBlogPost, Integer, Hash)>] CollectionResponseWithTotalVersionBlogPost data, response status code and response headers
          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

          # Publish blog post draft
          # Publish the draft version of the blog post, sending its content to the live page.
          # @param object_id [String] The ID of the post to publish.
          # @param [Hash] opts the optional parameters
          # @return [nil]
          def push_live(object_id, opts = {})
            push_live_with_http_info(object_id, opts)
            nil
          end

          # Publish blog post draft
          # Publish the draft version of the blog post, sending its content to the live page.
          # @param object_id [String] The ID of the post to publish.
          # @param [Hash] opts the optional parameters
          # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
          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 post draft to the live version
          # Discard all drafted content, resetting the draft to contain the content in the currently published version.
          # @param object_id [String] The ID of the blog post to reset.
          # @param [Hash] opts the optional parameters
          # @return [nil]
          def reset_draft(object_id, opts = {})
            reset_draft_with_http_info(object_id, opts)
            nil
          end

          # Reset post draft to the live version
          # Discard all drafted content, resetting the draft to contain the content in the currently published version.
          # @param object_id [String] The ID of the blog post to reset.
          # @param [Hash] opts the optional parameters
          # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
          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 a previous version
          # Restores a blog post to one of its previous versions.
          # @param object_id [String] The ID of the blog post.
          # @param revision_id [String] The ID of the version to restore the blog post to.
          # @param [Hash] opts the optional parameters
          # @return [BlogPost]
          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 a previous version
          # Restores a blog post to one of its previous versions.
          # @param object_id [String] The ID of the blog post.
          # @param revision_id [String] The ID of the version to restore the blog post to.
          # @param [Hash] opts the optional parameters
          # @return [Array<(BlogPost, Integer, Hash)>] BlogPost data, response status code and response headers
          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

          # 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.
          # @param object_id [String] The ID of the blog post.
          # @param revision_id [Integer] The ID of the version to restore the blog post to.
          # @param [Hash] opts the optional parameters
          # @return [BlogPost]
          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 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.
          # @param object_id [String] The ID of the blog post.
          # @param revision_id [Integer] The ID of the version to restore the blog post to.
          # @param [Hash] opts the optional parameters
          # @return [Array<(BlogPost, Integer, Hash)>] BlogPost data, response status code and response headers
          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

          # Schedule a post to be published
          # Schedule a blog post to be published at a specified time.
          # @param content_schedule_request_v_next [ContentScheduleRequestVNext] The JSON representation of the ContentScheduleRequestVNext object.
          # @param [Hash] opts the optional parameters
          # @return [nil]
          def schedule(content_schedule_request_v_next, opts = {})
            schedule_with_http_info(content_schedule_request_v_next, opts)
            nil
          end

          # Schedule a post to be published
          # Schedule a blog post to be published at a specified time.
          # @param content_schedule_request_v_next [ContentScheduleRequestVNext] The JSON representation of the ContentScheduleRequestVNext object.
          # @param [Hash] opts the optional parameters
          # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
          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 a post
          # Partially updates a single blog post by ID. You only need to specify the values that you want to update.
          # @param object_id [String] The ID of the blog post to update.
          # @param blog_post [BlogPost] The JSON representation of the updated Blog Post.
          # @param [Hash] opts the optional parameters
          # @option opts [Boolean] :archived Specifies whether to update deleted blog posts. Defaults to &#x60;false&#x60;.
          # @return [BlogPost]
          def update(object_id, blog_post, opts = {})
            data, _status_code, _headers = update_with_http_info(object_id, blog_post, opts)
            data
          end

          # Update a post
          # Partially updates a single blog post by ID. You only need to specify the values that you want to update.
          # @param object_id [String] The ID of the blog post to update.
          # @param blog_post [BlogPost] The JSON representation of the updated Blog Post.
          # @param [Hash] opts the optional parameters
          # @option opts [Boolean] :archived Specifies whether to update deleted blog posts. Defaults to &#x60;false&#x60;.
          # @return [Array<(BlogPost, Integer, Hash)>] BlogPost data, response status code and response headers
          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

          # 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.
          # @param object_id [String] The ID of the blog post to update the draft of.
          # @param blog_post [BlogPost] The JSON representation of the updated Blog Post to be applied to the draft.
          # @param [Hash] opts the optional parameters
          # @return [BlogPost]
          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 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.
          # @param object_id [String] The ID of the blog post to update the draft of.
          # @param blog_post [BlogPost] The JSON representation of the updated Blog Post to be applied to the draft.
          # @param [Hash] opts the optional parameters
          # @return [Array<(BlogPost, Integer, Hash)>] BlogPost data, response status code and response headers
          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
        end
      end
    end
  end
end
