Skip to content

Commit

Permalink
[Librarian] Regenerated @ 2e932f6c59e0f9fb6cb96952802e5ebedd83b6f0 18…
Browse files Browse the repository at this point in the history
…52557f82faade033dbd5bd0615c9e1aa4d9fae
  • Loading branch information
twilio-dx committed Oct 24, 2024
1 parent db34888 commit b2c3b50
Show file tree
Hide file tree
Showing 12 changed files with 675 additions and 178 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
twilio-ruby changelog
=====================

[2024-10-24] Version 7.3.5
--------------------------
**Conversations**
- Expose ConversationWithParticipants resource that allows creating a conversation with participants


[2024-10-17] Version 7.3.4
--------------------------
**Api**
Expand Down
6 changes: 6 additions & 0 deletions lib/twilio-ruby/rest/conversations/v1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def initialize(domain)
@address_configurations = nil
@configuration = nil
@conversations = nil
@conversation_with_participants = nil
@credentials = nil
@participant_conversations = nil
@roles = nil
Expand Down Expand Up @@ -65,6 +66,11 @@ def conversations(sid=:unset)
end
end
##
# @return [Twilio::REST::Conversations::V1::ConversationWithParticipantsList]
def conversation_with_participants
@conversation_with_participants ||= ConversationWithParticipantsList.new self
end
##
# @param [String] sid A 34 character string that uniquely identifies this resource.
# @return [Twilio::REST::Conversations::V1::CredentialContext] if sid was passed.
# @return [Twilio::REST::Conversations::V1::CredentialList]
Expand Down
54 changes: 27 additions & 27 deletions lib/twilio-ruby/rest/conversations/v1/conversation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ def initialize(version, sid)
@uri = "/Conversations/#{@solution[:sid]}"

# Dependents
@webhooks = nil
@messages = nil
@participants = nil
@webhooks = nil
end
##
# Delete the ConversationInstance
Expand Down Expand Up @@ -295,25 +295,6 @@ def update(
)
end

##
# Access the webhooks
# @return [WebhookList]
# @return [WebhookContext] if sid was passed.
def webhooks(sid=:unset)

raise ArgumentError, 'sid cannot be nil' if sid.nil?

if sid != :unset
return WebhookContext.new(@version, @solution[:sid],sid )
end

unless @webhooks
@webhooks = WebhookList.new(
@version, conversation_sid: @solution[:sid], )
end

@webhooks
end
##
# Access the messages
# @return [MessageList]
Expand Down Expand Up @@ -352,6 +333,25 @@ def participants(sid=:unset)

@participants
end
##
# Access the webhooks
# @return [WebhookList]
# @return [WebhookContext] if sid was passed.
def webhooks(sid=:unset)

raise ArgumentError, 'sid cannot be nil' if sid.nil?

if sid != :unset
return WebhookContext.new(@version, @solution[:sid],sid )
end

unless @webhooks
@webhooks = WebhookList.new(
@version, conversation_sid: @solution[:sid], )
end

@webhooks
end

##
# Provide a user friendly representation
Expand Down Expand Up @@ -594,13 +594,6 @@ def update(
)
end

##
# Access the webhooks
# @return [webhooks] webhooks
def webhooks
context.webhooks
end

##
# Access the messages
# @return [messages] messages
Expand All @@ -615,6 +608,13 @@ def participants
context.participants
end

##
# Access the webhooks
# @return [webhooks] webhooks
def webhooks
context.webhooks
end

##
# Provide a user friendly representation
def to_s
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
##
# This code was generated by
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
#
# Twilio - Conversations
# 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 Conversations < ConversationsBase
class V1 < Version
class ConversationWithParticipantsList < ListResource

##
# Initialize the ConversationWithParticipantsList
# @param [Version] version Version that contains the resource
# @return [ConversationWithParticipantsList] ConversationWithParticipantsList
def initialize(version)
super(version)
# Path Solution
@solution = { }
@uri = "/ConversationWithParticipants"

end
##
# Create the ConversationWithParticipantsInstance
# @param [String] friendly_name The human-readable name of this conversation, limited to 256 characters. Optional.
# @param [String] unique_name An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL.
# @param [Time] date_created The date that this resource was created.
# @param [Time] date_updated The date that this resource was last updated.
# @param [String] messaging_service_sid The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to.
# @param [String] attributes An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned.
# @param [State] state
# @param [String] timers_inactive ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute.
# @param [String] timers_closed ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes.
# @param [String] bindings_email_address The default email address that will be used when sending outbound emails in this conversation.
# @param [String] bindings_email_name The default name that will be used when sending outbound emails in this conversation.
# @param [Array[String]] participant The participant to be added to the conversation in JSON format. The parameters are as in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10.
# @param [ConversationWithParticipantsEnumWebhookEnabledType] x_twilio_webhook_enabled The X-Twilio-Webhook-Enabled HTTP request header
# @return [ConversationWithParticipantsInstance] Created ConversationWithParticipantsInstance
def create(
friendly_name: :unset,
unique_name: :unset,
date_created: :unset,
date_updated: :unset,
messaging_service_sid: :unset,
attributes: :unset,
state: :unset,
timers_inactive: :unset,
timers_closed: :unset,
bindings_email_address: :unset,
bindings_email_name: :unset,
participant: :unset,
x_twilio_webhook_enabled: :unset
)

data = Twilio::Values.of({
'FriendlyName' => friendly_name,
'UniqueName' => unique_name,
'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated),
'MessagingServiceSid' => messaging_service_sid,
'Attributes' => attributes,
'State' => state,
'Timers.Inactive' => timers_inactive,
'Timers.Closed' => timers_closed,
'Bindings.Email.Address' => bindings_email_address,
'Bindings.Email.Name' => bindings_email_name,
'Participant' => Twilio.serialize_list(participant) { |e| e },
})

headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })

payload = @version.create('POST', @uri, data: data, headers: headers)
ConversationWithParticipantsInstance.new(
@version,
payload,
)
end




# Provide a user friendly representation
def to_s
'#<Twilio.Conversations.V1.ConversationWithParticipantsList>'
end
end

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

# Path Solution
@solution = solution
end

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

##
# Provide a user friendly representation
def to_s
'<Twilio.Conversations.V1.ConversationWithParticipantsPage>'
end
end
class ConversationWithParticipantsInstance < InstanceResource
##
# Initialize the ConversationWithParticipantsInstance
# @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 ConversationWithParticipants
# resource.
# @param [String] sid The SID of the Call resource to fetch.
# @return [ConversationWithParticipantsInstance] ConversationWithParticipantsInstance
def initialize(version, payload )
super(version)

# Marshaled Properties
@properties = {
'account_sid' => payload['account_sid'],
'chat_service_sid' => payload['chat_service_sid'],
'messaging_service_sid' => payload['messaging_service_sid'],
'sid' => payload['sid'],
'friendly_name' => payload['friendly_name'],
'unique_name' => payload['unique_name'],
'attributes' => payload['attributes'],
'state' => payload['state'],
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
'timers' => payload['timers'],
'links' => payload['links'],
'bindings' => payload['bindings'],
'url' => payload['url'],
}
end


##
# @return [String] The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation.
def account_sid
@properties['account_sid']
end

##
# @return [String] The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to.
def chat_service_sid
@properties['chat_service_sid']
end

##
# @return [String] The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to.
def messaging_service_sid
@properties['messaging_service_sid']
end

##
# @return [String] A 34 character string that uniquely identifies this resource.
def sid
@properties['sid']
end

##
# @return [String] The human-readable name of this conversation, limited to 256 characters. Optional.
def friendly_name
@properties['friendly_name']
end

##
# @return [String] An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL.
def unique_name
@properties['unique_name']
end

##
# @return [String] An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned.
def attributes
@properties['attributes']
end

##
# @return [State]
def state
@properties['state']
end

##
# @return [Time] The date that this resource was created.
def date_created
@properties['date_created']
end

##
# @return [Time] The date that this resource was last updated.
def date_updated
@properties['date_updated']
end

##
# @return [Hash] Timer date values representing state update for this conversation.
def timers
@properties['timers']
end

##
# @return [Hash] Contains absolute URLs to access the [participants](https://www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](https://www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](https://www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation.
def links
@properties['links']
end

##
# @return [Hash]
def bindings
@properties['bindings']
end

##
# @return [String] An absolute API resource URL for this conversation.
def url
@properties['url']
end

##
# Provide a user friendly representation
def to_s
"<Twilio.Conversations.V1.ConversationWithParticipantsInstance>"
end

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

end
end
end
end
Loading

0 comments on commit b2c3b50

Please sign in to comment.