=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 MultiLanguageApi
          attr_accessor :api_client

          def initialize(api_client = ApiClient.default)
            @api_client = api_client
          end
          # Attach post to a multi-language group
          # Attach a blog post to a [multi-language group](https://developers.hubspot.com/docs/guides/cms/content/multi-language-content).
          # @param attach_to_lang_primary_request_v_next [AttachToLangPrimaryRequestVNext] The JSON representation of the AttachToLangPrimaryRequest object.
          # @param [Hash] opts the optional parameters
          # @return [nil]
          def attach_to_lang_group(attach_to_lang_primary_request_v_next, opts = {})
            attach_to_lang_group_with_http_info(attach_to_lang_primary_request_v_next, opts)
            nil
          end

          # Attach post to a multi-language group
          # Attach a blog post to a [multi-language group](https://developers.hubspot.com/docs/guides/cms/content/multi-language-content).
          # @param attach_to_lang_primary_request_v_next [AttachToLangPrimaryRequestVNext] The JSON representation of the AttachToLangPrimaryRequest object.
          # @param [Hash] opts the optional parameters
          # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
          def attach_to_lang_group_with_http_info(attach_to_lang_primary_request_v_next, opts = {})
            if @api_client.config.debugging
              @api_client.config.logger.debug 'Calling API: MultiLanguageApi.attach_to_lang_group ...'
            end
            # verify the required parameter 'attach_to_lang_primary_request_v_next' is set
            if @api_client.config.client_side_validation && attach_to_lang_primary_request_v_next.nil?
              fail ArgumentError, "Missing the required parameter 'attach_to_lang_primary_request_v_next' when calling MultiLanguageApi.attach_to_lang_group"
            end
            # resource path
            local_var_path = '/cms/v3/blogs/posts/multi-language/attach-to-lang-group'

            # 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(attach_to_lang_primary_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 => :"MultiLanguageApi.attach_to_lang_group",
              :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: MultiLanguageApi#attach_to_lang_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
            end
            return data, status_code, headers
          end

          # Create a language variation
          # Create a new language variation from an existing blog post
          # @param blog_post_language_clone_request_v_next [BlogPostLanguageCloneRequestVNext] The JSON representation of the BlogPostLanguageCloneRequestVNext object.
          # @param [Hash] opts the optional parameters
          # @return [BlogPost]
          def create_lang_variation(blog_post_language_clone_request_v_next, opts = {})
            data, _status_code, _headers = create_lang_variation_with_http_info(blog_post_language_clone_request_v_next, opts)
            data
          end

          # Create a language variation
          # Create a new language variation from an existing blog post
          # @param blog_post_language_clone_request_v_next [BlogPostLanguageCloneRequestVNext] The JSON representation of the BlogPostLanguageCloneRequestVNext object.
          # @param [Hash] opts the optional parameters
          # @return [Array<(BlogPost, Integer, Hash)>] BlogPost data, response status code and response headers
          def create_lang_variation_with_http_info(blog_post_language_clone_request_v_next, opts = {})
            if @api_client.config.debugging
              @api_client.config.logger.debug 'Calling API: MultiLanguageApi.create_lang_variation ...'
            end
            # verify the required parameter 'blog_post_language_clone_request_v_next' is set
            if @api_client.config.client_side_validation && blog_post_language_clone_request_v_next.nil?
              fail ArgumentError, "Missing the required parameter 'blog_post_language_clone_request_v_next' when calling MultiLanguageApi.create_lang_variation"
            end
            # resource path
            local_var_path = '/cms/v3/blogs/posts/multi-language/create-language-variation'

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

          # Detach post from a multi-language group
          # Detach a blog post from a [multi-language group](https://developers.hubspot.com/docs/guides/cms/content/multi-language-content).
          # @param detach_from_lang_group_request_v_next [DetachFromLangGroupRequestVNext] The JSON representation of the DetachFromLangGroupRequest object.
          # @param [Hash] opts the optional parameters
          # @return [nil]
          def detach_from_lang_group(detach_from_lang_group_request_v_next, opts = {})
            detach_from_lang_group_with_http_info(detach_from_lang_group_request_v_next, opts)
            nil
          end

          # Detach post from a multi-language group
          # Detach a blog post from a [multi-language group](https://developers.hubspot.com/docs/guides/cms/content/multi-language-content).
          # @param detach_from_lang_group_request_v_next [DetachFromLangGroupRequestVNext] The JSON representation of the DetachFromLangGroupRequest object.
          # @param [Hash] opts the optional parameters
          # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
          def detach_from_lang_group_with_http_info(detach_from_lang_group_request_v_next, opts = {})
            if @api_client.config.debugging
              @api_client.config.logger.debug 'Calling API: MultiLanguageApi.detach_from_lang_group ...'
            end
            # verify the required parameter 'detach_from_lang_group_request_v_next' is set
            if @api_client.config.client_side_validation && detach_from_lang_group_request_v_next.nil?
              fail ArgumentError, "Missing the required parameter 'detach_from_lang_group_request_v_next' when calling MultiLanguageApi.detach_from_lang_group"
            end
            # resource path
            local_var_path = '/cms/v3/blogs/posts/multi-language/detach-from-lang-group'

            # 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(detach_from_lang_group_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 => :"MultiLanguageApi.detach_from_lang_group",
              :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: MultiLanguageApi#detach_from_lang_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
            end
            return data, status_code, headers
          end

          # Set a new primary language
          # Set the primary language of a [multi-language group](https://developers.hubspot.com/docs/guides/cms/content/multi-language-content) to the language of the provided post (specified as an ID in the request body)
          # @param set_new_language_primary_request_v_next [SetNewLanguagePrimaryRequestVNext] The JSON representation of the SetNewLanguagePrimaryRequest object.
          # @param [Hash] opts the optional parameters
          # @return [nil]
          def set_lang_primary(set_new_language_primary_request_v_next, opts = {})
            set_lang_primary_with_http_info(set_new_language_primary_request_v_next, opts)
            nil
          end

          # Set a new primary language
          # Set the primary language of a [multi-language group](https://developers.hubspot.com/docs/guides/cms/content/multi-language-content) to the language of the provided post (specified as an ID in the request body)
          # @param set_new_language_primary_request_v_next [SetNewLanguagePrimaryRequestVNext] The JSON representation of the SetNewLanguagePrimaryRequest object.
          # @param [Hash] opts the optional parameters
          # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
          def set_lang_primary_with_http_info(set_new_language_primary_request_v_next, opts = {})
            if @api_client.config.debugging
              @api_client.config.logger.debug 'Calling API: MultiLanguageApi.set_lang_primary ...'
            end
            # verify the required parameter 'set_new_language_primary_request_v_next' is set
            if @api_client.config.client_side_validation && set_new_language_primary_request_v_next.nil?
              fail ArgumentError, "Missing the required parameter 'set_new_language_primary_request_v_next' when calling MultiLanguageApi.set_lang_primary"
            end
            # resource path
            local_var_path = '/cms/v3/blogs/posts/multi-language/set-new-lang-primary'

            # 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(set_new_language_primary_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 => :"MultiLanguageApi.set_lang_primary",
              :header_params => header_params,
              :query_params => query_params,
              :form_params => form_params,
              :body => post_body,
              :auth_names => auth_names,
              :return_type => return_type
            )

            data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
            if @api_client.config.debugging
              @api_client.config.logger.debug "API called: MultiLanguageApi#set_lang_primary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
            end
            return data, status_code, headers
          end

          # Update languages of multi-language group
          # Explicitly set new languages for each post in a [multi-language group](https://developers.hubspot.com/docs/guides/cms/content/multi-language-content).
          # @param update_languages_request_v_next [UpdateLanguagesRequestVNext] The JSON representation of the SetNewLanguagePrimaryRequest object.
          # @param [Hash] opts the optional parameters
          # @return [nil]
          def update_langs(update_languages_request_v_next, opts = {})
            update_langs_with_http_info(update_languages_request_v_next, opts)
            nil
          end

          # Update languages of multi-language group
          # Explicitly set new languages for each post in a [multi-language group](https://developers.hubspot.com/docs/guides/cms/content/multi-language-content).
          # @param update_languages_request_v_next [UpdateLanguagesRequestVNext] The JSON representation of the SetNewLanguagePrimaryRequest object.
          # @param [Hash] opts the optional parameters
          # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
          def update_langs_with_http_info(update_languages_request_v_next, opts = {})
            if @api_client.config.debugging
              @api_client.config.logger.debug 'Calling API: MultiLanguageApi.update_langs ...'
            end
            # verify the required parameter 'update_languages_request_v_next' is set
            if @api_client.config.client_side_validation && update_languages_request_v_next.nil?
              fail ArgumentError, "Missing the required parameter 'update_languages_request_v_next' when calling MultiLanguageApi.update_langs"
            end
            # resource path
            local_var_path = '/cms/v3/blogs/posts/multi-language/update-languages'

            # 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(update_languages_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 => :"MultiLanguageApi.update_langs",
              :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: MultiLanguageApi#update_langs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
            end
            return data, status_code, headers
          end
        end
      end
    end
  end
end
