##
#    This code was generated by
#    ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
#     |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
#     |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \
#
#    Twilio - Sync
#    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 Sync < SyncBase
            class V1 < Version
                class ServiceContext < InstanceContext
                class SyncStreamContext < InstanceContext

                     class StreamMessageList < ListResource
                
                    ##
                    # Initialize the StreamMessageList
                    # @param [Version] version Version that contains the resource
                    # @return [StreamMessageList] StreamMessageList
                    def initialize(version, service_sid: nil, stream_sid: nil)
                        super(version)
                        # Path Solution
                        @solution = { service_sid: service_sid, stream_sid: stream_sid }
                        @uri = "/Services/#{@solution[:service_sid]}/Streams/#{@solution[:stream_sid]}/Messages"
                        
                    end
                    ##
                    # Create the StreamMessageInstance
                    # @param [Object] data A JSON string that represents an arbitrary, schema-less object that makes up the Stream Message body. Can be up to 4 KiB in length.
                    # @return [StreamMessageInstance] Created StreamMessageInstance
                    def create(
                        data: nil
                    )

                        data = Twilio::Values.of({
                            'Data' => Twilio.serialize_object(data),
                        })

                        headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
                        
                        
                        
                        
                        
                        payload = @version.create('POST', @uri, data: data, headers: headers)
                        StreamMessageInstance.new(
                            @version,
                            payload,
                            service_sid: @solution[:service_sid],
                            stream_sid: @solution[:stream_sid],
                        )
                    end

                


                    # Provide a user friendly representation
                    def to_s
                        '#<Twilio.Sync.V1.StreamMessageList>'
                    end
                end

                class StreamMessagePage < Page
                    ##
                    # Initialize the StreamMessagePage
                    # @param [Version] version Version that contains the resource
                    # @param [Response] response Response from the API
                    # @param [Hash] solution Path solution for the resource
                    # @return [StreamMessagePage] StreamMessagePage
                    def initialize(version, response, solution)
                        super(version, response)

                        # Path Solution
                        @solution = solution
                    end

                    ##
                    # Build an instance of StreamMessageInstance
                    # @param [Hash] payload Payload response from the API
                    # @return [StreamMessageInstance] StreamMessageInstance
                    def get_instance(payload)
                        StreamMessageInstance.new(@version, payload, service_sid: @solution[:service_sid], stream_sid: @solution[:stream_sid])
                    end

                    ##
                    # Provide a user friendly representation
                    def to_s
                        '<Twilio.Sync.V1.StreamMessagePage>'
                    end
                end
                class StreamMessageInstance < InstanceResource
                    ##
                    # Initialize the StreamMessageInstance
                    # @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 StreamMessage
                    #   resource.
                    # @param [String] sid The SID of the Call resource to fetch.
                    # @return [StreamMessageInstance] StreamMessageInstance
                    def initialize(version, payload , service_sid: nil, stream_sid: nil)
                        super(version)
                        
                        # Marshaled Properties
                        @properties = { 
                            'sid' => payload['sid'],
                            'data' => payload['data'],
                        }
                    end

                    
                    ##
                    # @return [String] The unique string that we created to identify the Stream Message resource.
                    def sid
                        @properties['sid']
                    end
                    
                    ##
                    # @return [Hash] An arbitrary, schema-less object that contains the Stream Message body. Can be up to 4 KiB in length.
                    def data
                        @properties['data']
                    end
                    
                    ##
                    # Provide a user friendly representation
                    def to_s
                        "<Twilio.Sync.V1.StreamMessageInstance>"
                    end

                    ##
                    # Provide a detailed, user friendly representation
                    def inspect
                        "<Twilio.Sync.V1.StreamMessageInstance>"
                    end
                end

             end
             end
            end
        end
    end
end


