Sha256: 09faf4a4f7fe6f97b48ee4f8ff034fca679f05c5aa8d06c11c9d1eed27654797

Contents?: true

Size: 1.82 KB

Versions: 6

Compression:

Stored size: 1.82 KB

Contents

# Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.

# typed: true
# frozen_string_literal: true

require 'faraday'
require 'faraday/multipart'
require 'sorbet-runtime'

module OpenApiSDK
  extend T::Sig
  class Metatags
    extend T::Sig


    sig { params(sdk_config: SDKConfiguration).void }
    def initialize(sdk_config)
      @sdk_configuration = sdk_config
    end


    sig { params(url: ::String).returns(::OpenApiSDK::Operations::GetMetatagsResponse) }
    def get(url)
      # get - Retrieve the metatags for a URL
      # Retrieve the metatags for a URL.
      request = ::OpenApiSDK::Operations::GetMetatagsRequest.new(
        
        url: url
      )
      url, params = @sdk_configuration.get_server_details
      base_url = Utils.template_url(url, params)
      url = "#{base_url}/metatags"
      headers = {}
      query_params = Utils.get_query_params(::OpenApiSDK::Operations::GetMetatagsRequest, request, @sdk_configuration.globals)
      headers['Accept'] = 'application/json'
      headers['user-agent'] = @sdk_configuration.user_agent

      r = @sdk_configuration.client.get(url) do |req|
        req.headers = headers
        req.params = query_params
        Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
      end

      content_type = r.headers.fetch('Content-Type', 'application/octet-stream')

      res = ::OpenApiSDK::Operations::GetMetatagsResponse.new(
        status_code: r.status, content_type: content_type, raw_response: r
      )
      if r.status == 200
        if Utils.match_content_type(content_type, 'application/json')
          out = Utils.unmarshal_complex(r.env.response_body, ::OpenApiSDK::Operations::GetMetatagsResponseBody)
          res.object = out
        end
      end
      res
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dub-0.0.7 lib/open_api_sdk/metatags.rb
dub-0.0.6 lib/open_api_sdk/metatags.rb
dub-0.0.5 lib/open_api_sdk/metatags.rb
dub-0.0.4 lib/open_api_sdk/metatags.rb
dub-0.0.3 lib/open_api_sdk/metatags.rb
dub-0.0.2 lib/open_api_sdk/metatags.rb