## # This code was generated by # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ # # Organization Public API # No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # # NOTE: This class is auto generated by OpenAPI Generator. # https://openapi-generator.tech # Do not edit the class manually. # module Twilio module REST class PreviewIam < PreviewIamBase class Versionless < Version class OrganizationList < ListResource ## # Initialize the OrganizationList # @param [Version] version Version that contains the resource # @return [OrganizationList] OrganizationList def initialize(version) super(version) # Path Solution @solution = { } end # Provide a user friendly representation def to_s '#' end end class OrganizationContext < InstanceContext ## # Initialize the OrganizationContext # @param [Version] version Version that contains the resource # @param [String] organization_sid # @return [OrganizationContext] OrganizationContext def initialize(version, organization_sid) super(version) # Path Solution @solution = { organization_sid: organization_sid, } @uri = "/#{@solution[:organization_sid]}" # Dependents @resource_types = nil @role_assignments = nil @accounts = nil @users = nil end ## # Fetch the OrganizationInstance # @return [OrganizationInstance] Fetched OrganizationInstance def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) headers['Accept'] = 'application/scim+json' payload = @version.fetch('GET', @uri, headers: headers) OrganizationInstance.new( @version, payload, organization_sid: @solution[:organization_sid], ) end ## # Access the resource_types # @return [ResourceTypeList] # @return [ResourceTypeContext] def resource_types unless @resource_types @resource_types = ResourceTypeList.new( @version, ) end @resource_types end ## # Access the role_assignments # @return [RoleAssignmentList] # @return [RoleAssignmentContext] if sid was passed. def role_assignments(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return RoleAssignmentContext.new(@version, @solution[:organization_sid],sid ) end unless @role_assignments @role_assignments = RoleAssignmentList.new( @version, organization_sid: @solution[:organization_sid], ) end @role_assignments end ## # Access the accounts # @return [AccountList] # @return [AccountContext] if sid was passed. def accounts(account_sid=:unset) raise ArgumentError, 'account_sid cannot be nil' if account_sid.nil? if account_sid != :unset return AccountContext.new(@version, @solution[:organization_sid],account_sid ) end unless @accounts @accounts = AccountList.new( @version, organization_sid: @solution[:organization_sid], ) end @accounts end ## # Access the users # @return [UserList] # @return [UserContext] if sid was passed. def users(id=:unset) raise ArgumentError, 'id cannot be nil' if id.nil? if id != :unset return UserContext.new(@version, @solution[:organization_sid],id ) end unless @users @users = UserList.new( @version, organization_sid: @solution[:organization_sid], ) end @users end ## # Provide a user friendly representation def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#" end ## # Provide a detailed, user friendly representation def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#" end end class OrganizationPage < Page ## # Initialize the OrganizationPage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [OrganizationPage] OrganizationPage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of OrganizationInstance # @param [Hash] payload Payload response from the API # @return [OrganizationInstance] OrganizationInstance def get_instance(payload) OrganizationInstance.new(@version, payload) end ## # Provide a user friendly representation def to_s '' end end class OrganizationInstance < InstanceResource ## # Initialize the OrganizationInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @param [String] account_sid The SID of the # {Account}[https://www.twilio.com/docs/iam/api/account] that created this Organization # resource. # @param [String] sid The SID of the Call resource to fetch. # @return [OrganizationInstance] OrganizationInstance def initialize(version , organization_sid: nil) super(version) # Context @instance_context = nil @params = { 'organization_sid' => organization_sid || @properties['organization_sid'] , } end ## # Generate an instance context for the instance, the context is capable of # performing various actions. All instance actions are proxied to the context # @return [OrganizationContext] CallContext for this CallInstance def context unless @instance_context @instance_context = OrganizationContext.new(@version , @params['organization_sid']) end @instance_context end ## # Fetch the OrganizationInstance # @return [OrganizationInstance] Fetched OrganizationInstance def fetch context.fetch end ## # Access the resource_types # @return [resource_types] resource_types def resource_types context.resource_types end ## # Access the role_assignments # @return [role_assignments] role_assignments def role_assignments context.role_assignments end ## # Access the accounts # @return [accounts] accounts def accounts context.accounts end ## # Access the users # @return [users] users def users context.users end ## # Provide a user friendly representation def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "" end ## # Provide a detailed, user friendly representation def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "" end end end end end end