Twilio.Sms.ShortCodes (twilio v0.2.0)

Copy Markdown

API calls: list, retrieve, update.

Summary

Functions

Retrieve a list of short-codes belonging to the account used to make the request

Like list/2, but returns the result or raises Infusion.Runtime.Error.

Like list/2, but returns every item, from every page: a lazy stream of Twilio.Schemas.ShortCode.t() that fetches pages as it is read.

Fetch an instance of a short code

Like retrieve/2, but returns the result or raises Infusion.Runtime.Error.

Update a short code with the following parameters

Functions

list(params \\ %{}, opts \\ [])

Retrieve a list of short-codes belonging to the account used to make the request

GET /2010-04-01/Accounts/{AccountSid}/SMS/ShortCodes.json

{AccountSid} in the path is the :account_sid setting; pass account_sid: "..." as an option to use another.

Parameters

  • friendly_name - The string that identifies the ShortCode resources to read.
  • short_code - Only show the ShortCode resources that match this pattern. You can specify partial numbers and use '*' as a wildcard for any digit.
  • page_size - How many resources to return in each list page. The default is 50, and the maximum is 1000.
  • page - The page index. This value is simply for client state.
  • page_token - The page token. This is provided by the API.

To read every item across all pages, use list_all.

list!(params \\ %{}, opts \\ [])

Like list/2, but returns the result or raises Infusion.Runtime.Error.

list_all(params \\ %{}, opts \\ [])

@spec list_all(map() | keyword(), keyword()) ::
  {:ok, Enumerable.t()} | {:error, Infusion.Runtime.Error.t()}

Like list/2, but returns every item, from every page: a lazy stream of Twilio.Schemas.ShortCode.t() that fetches pages as it is read.

The first page is fetched right away, so its errors are returned; a later page that fails raises Infusion.Runtime.Error. Stopping early (Enum.take/2) fetches no more pages.

list_all!(params \\ %{}, opts \\ [])

@spec list_all!(map() | keyword(), keyword()) :: Enumerable.t()

Like list_all/2, but returns the stream or raises Infusion.Runtime.Error.

retrieve(sid, opts \\ [])

@spec retrieve(String.t(), keyword()) ::
  {:ok, Twilio.Schemas.ShortCode.t()} | {:error, Infusion.Runtime.Error.t()}

Fetch an instance of a short code

GET /2010-04-01/Accounts/{AccountSid}/SMS/ShortCodes/{Sid}.json

Path parameters

  • sid (required) - The Twilio-provided string that uniquely identifies the ShortCode resource to fetch

{AccountSid} in the path is the :account_sid setting; pass account_sid: "..." as an option to use another.

retrieve!(sid, opts \\ [])

@spec retrieve!(String.t(), keyword()) :: Twilio.Schemas.ShortCode.t()

Like retrieve/2, but returns the result or raises Infusion.Runtime.Error.

update(sid, params \\ %{}, opts \\ [])

@spec update(String.t(), map() | keyword(), keyword()) ::
  {:ok, Twilio.Schemas.ShortCode.t()} | {:error, Infusion.Runtime.Error.t()}

Update a short code with the following parameters

POST /2010-04-01/Accounts/{AccountSid}/SMS/ShortCodes/{Sid}.json

Path parameters

  • sid (required) - The Twilio-provided string that uniquely identifies the ShortCode resource to update

{AccountSid} in the path is the :account_sid setting; pass account_sid: "..." as an option to use another.

Parameters

  • api_version - The API version to use to start a new TwiML session. Can be: 2010-04-01 or 2008-08-01.
  • friendly_name - A descriptive string that you created to describe this resource. It can be up to 64 characters long. By default, the FriendlyName is the short code.
  • sms_fallback_method - The HTTP method that we should use to call the sms_fallback_url. Can be: GET or POST.
  • sms_fallback_url - The URL that we should call if an error occurs while retrieving or executing the TwiML from sms_url.
  • sms_method - The HTTP method we should use when calling the sms_url. Can be: GET or POST.
  • sms_url - The URL we should call when receiving an incoming SMS message to this short code.

update!(sid, params \\ %{}, opts \\ [])

@spec update!(String.t(), map() | keyword(), keyword()) ::
  Twilio.Schemas.ShortCode.t()

Like update/3, but returns the result or raises Infusion.Runtime.Error.