## # This code was generated by # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ # # Twilio - Messaging # This is the public Twilio REST API. # # NOTE: This class is auto generated by OpenAPI Generator. # https://openapi-generator.tech # Do not edit the class manually. # module Twilio module REST class Messaging < MessagingBase class V1 < Version class LinkshorteningMessagingServiceList < ListResource ## # Initialize the LinkshorteningMessagingServiceList # @param [Version] version Version that contains the resource # @return [LinkshorteningMessagingServiceList] LinkshorteningMessagingServiceList def initialize(version) super(version) # Path Solution @solution = { } end # Provide a user friendly representation def to_s '#' end end class LinkshorteningMessagingServiceContext < InstanceContext ## # Initialize the LinkshorteningMessagingServiceContext # @param [Version] version Version that contains the resource # @param [String] domain_sid The domain SID to dissociate from a messaging service. With URL shortening enabled, links in messages sent with the associated messaging service will be shortened to the provided domain # @param [String] messaging_service_sid A messaging service SID to dissociate from a domain. With URL shortening enabled, links in messages sent with the provided messaging service will be shortened to the associated domain # @return [LinkshorteningMessagingServiceContext] LinkshorteningMessagingServiceContext def initialize(version, domain_sid, messaging_service_sid) super(version) # Path Solution @solution = { domain_sid: domain_sid, messaging_service_sid: messaging_service_sid, } @uri = "/LinkShortening/Domains/#{@solution[:domain_sid]}/MessagingServices/#{@solution[:messaging_service_sid]}" end ## # Create the LinkshorteningMessagingServiceInstance # @return [LinkshorteningMessagingServiceInstance] Created LinkshorteningMessagingServiceInstance def create headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.create('POST', @uri, headers: headers) LinkshorteningMessagingServiceInstance.new( @version, payload, domain_sid: @solution[:domain_sid], messaging_service_sid: @solution[:messaging_service_sid], ) end ## # Delete the LinkshorteningMessagingServiceInstance # @return [Boolean] True if delete succeeds, false otherwise def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) 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 LinkshorteningMessagingServicePage < Page ## # Initialize the LinkshorteningMessagingServicePage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [LinkshorteningMessagingServicePage] LinkshorteningMessagingServicePage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of LinkshorteningMessagingServiceInstance # @param [Hash] payload Payload response from the API # @return [LinkshorteningMessagingServiceInstance] LinkshorteningMessagingServiceInstance def get_instance(payload) LinkshorteningMessagingServiceInstance.new(@version, payload) end ## # Provide a user friendly representation def to_s '' end end class LinkshorteningMessagingServiceInstance < InstanceResource ## # Initialize the LinkshorteningMessagingServiceInstance # @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 LinkshorteningMessagingService # resource. # @param [String] sid The SID of the Call resource to fetch. # @return [LinkshorteningMessagingServiceInstance] LinkshorteningMessagingServiceInstance def initialize(version, payload , domain_sid: nil, messaging_service_sid: nil) super(version) # Marshaled Properties @properties = { 'domain_sid' => payload['domain_sid'], 'messaging_service_sid' => payload['messaging_service_sid'], 'url' => payload['url'], } # Context @instance_context = nil @params = { 'domain_sid' => domain_sid || @properties['domain_sid'] ,'messaging_service_sid' => messaging_service_sid || @properties['messaging_service_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 [LinkshorteningMessagingServiceContext] CallContext for this CallInstance def context unless @instance_context @instance_context = LinkshorteningMessagingServiceContext.new(@version , @params['domain_sid'], @params['messaging_service_sid']) end @instance_context end ## # @return [String] The unique string identifies the domain resource def domain_sid @properties['domain_sid'] end ## # @return [String] The unique string that identifies the messaging service def messaging_service_sid @properties['messaging_service_sid'] end ## # @return [String] def url @properties['url'] end ## # Create the LinkshorteningMessagingServiceInstance # @return [LinkshorteningMessagingServiceInstance] Created LinkshorteningMessagingServiceInstance def create context.create end ## # Delete the LinkshorteningMessagingServiceInstance # @return [Boolean] True if delete succeeds, false otherwise def delete context.delete 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