Current section
Files
Jump to
Current section
Files
lib/twilio/sync/v1/service/stream/message_service.ex
# File generated from Twilio's OpenAPI spec — do not edit manually
defmodule Twilio.Sync.V1.Service.Stream.MessageService do
@moduledoc """
Service for Message API operations.
Operations: `create`
"""
alias Twilio.Client
alias Twilio.Deserializer
@doc """
Create a new Stream Message.
Operation: `CreateStreamMessage` | Tags: SyncV1StreamMessage
## Required Parameters
| Parameter | Type | Description |
|-----------|------|-------------|
# credo:disable-for-next-line Credo.Check.Readability.MaxLineLength
| `Data` | string | 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. |
"""
@spec create(Client.t(), String.t(), String.t(), map(), keyword()) ::
{:ok, Twilio.Resources.Sync.V1.Service.Stream.Message.t()}
| {:ok, map(), map()}
| :ok
| {:error, Twilio.Error.t()}
def create(client, service_sid, stream_sid, params \\ %{}, opts \\ []) do
with {:ok, data} <-
Client.request(
client,
:post,
"/v1/Services/#{service_sid}/Streams/#{stream_sid}/Messages",
params: params,
opts: opts,
base_url: "https://sync.twilio.com",
content_type: :form
) do
{:ok, Deserializer.deserialize(data, Twilio.Resources.Sync.V1.Service.Stream.Message)}
end
end
end