Sha256: c3068ad60c9dcf494d9572c302a24c8f80a1436f913c3f6d7b4473b5e121b350

Contents?: true

Size: 1.86 KB

Versions: 15

Compression:

Stored size: 1.86 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 SpeakeasyClientSDK
  extend T::Sig
  class Organizations
    extend T::Sig


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


    sig { returns(::SpeakeasyClientSDK::Operations::GetOrganizationsResponse) }
    def get_organizations
      # get_organizations - Get organizations for a user
      # Returns a list of organizations a user has access too
      url, params = @sdk_configuration.get_server_details
      base_url = Utils.template_url(url, params)
      url = "#{base_url}/v1/organization"
      headers = {}
      headers['Accept'] = 'application/json'
      headers['user-agent'] = @sdk_configuration.user_agent

      r = @sdk_configuration.client.get(url) do |req|
        req.headers = headers
        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 = ::SpeakeasyClientSDK::Operations::GetOrganizationsResponse.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, T::Array[::SpeakeasyClientSDK::Shared::Organization])
          res.organizations = out
        end
      else
                
        if Utils.match_content_type(content_type, 'application/json')
          out = Utils.unmarshal_complex(r.env.response_body, ::SpeakeasyClientSDK::Shared::Error)
          res.error = out
        end
      end
      res
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
speakeasy_client_sdk_ruby-4.1.11 lib/speakeasy_client_sdk/organizations.rb
speakeasy_client_sdk_ruby-4.1.10 lib/speakeasy_client_sdk/organizations.rb
speakeasy_client_sdk_ruby-4.1.9 lib/speakeasy_client_sdk/organizations.rb
speakeasy_client_sdk_ruby-4.1.8 lib/speakeasy_client_sdk/organizations.rb
speakeasy_client_sdk_ruby-4.1.7 lib/speakeasy_client_sdk/organizations.rb
speakeasy_client_sdk_ruby-4.1.6 lib/speakeasy_client_sdk/organizations.rb
speakeasy_client_sdk_ruby-4.1.5 lib/speakeasy_client_sdk/organizations.rb
speakeasy_client_sdk_ruby-4.1.4 lib/speakeasy_client_sdk/organizations.rb
speakeasy_client_sdk_ruby-4.1.3 lib/speakeasy_client_sdk/organizations.rb
speakeasy_client_sdk_ruby-4.1.2 lib/speakeasy_client_sdk/organizations.rb
speakeasy_client_sdk_ruby-4.1.1 lib/speakeasy_client_sdk/organizations.rb
speakeasy_client_sdk_ruby-4.1.0 lib/speakeasy_client_sdk/organizations.rb
speakeasy_client_sdk_ruby-4.0.16 lib/speakeasy_client_sdk/organizations.rb
speakeasy_client_sdk_ruby-4.0.15 lib/speakeasy_client_sdk/organizations.rb
speakeasy_client_sdk_ruby-4.0.14 lib/speakeasy_client_sdk/organizations.rb