Movatterモバイル変換


[0]ホーム

URL:


openapi

package
v1.26.5Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2025 License:MITImports:6Imported by:0

Details

Repository

github.com/twilio/twilio-go

Links

README

Go API client for openapi

This is the public Twilio REST API.

Overview

This API client was generated by theOpenAPI Generator project from the OpenAPI specs located attwilio/twilio-oai. By using theOpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 1.0.0
  • Package version: 1.0.0
  • Build package: com.twilio.oai.TwilioGoGeneratorFor more information, please visithttps://support.twilio.com

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assertgo get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import "./openapi"

Documentation for API Endpoints

All URIs are relative tohttps://monitor.twilio.com

ClassMethodHTTP requestDescription
AlertsApiFetchAlertGet /v1/Alerts/{Sid}
AlertsApiListAlertGet /v1/Alerts
EventsApiFetchEventGet /v1/Events/{Sid}
EventsApiListEventGet /v1/EventsReturns a list of events in the account, sorted by event-date.

Documentation For Models

Documentation For Authorization

accountSid_authToken

  • Type: HTTP basic authentication

Example

auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{    UserName: "username",    Password: "password",})r, err := client.Service.Operation(auth, args)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

typeApiServiceadded inv0.11.0

type ApiService struct {// contains filtered or unexported fields}

funcNewApiServiceadded inv0.11.0

func NewApiService(requestHandler *twilio.RequestHandler) *ApiService

funcNewApiServiceWithClientadded inv0.11.0

func NewApiServiceWithClient(clienttwilio.BaseClient) *ApiService

func (*ApiService)FetchAlertadded inv0.11.0

func (c *ApiService) FetchAlert(Sidstring) (*MonitorV1AlertInstance,error)

func (*ApiService)FetchEventadded inv0.11.0

func (c *ApiService) FetchEvent(Sidstring) (*MonitorV1Event,error)

func (*ApiService)ListAlertadded inv0.11.0

func (c *ApiService) ListAlert(params *ListAlertParams) ([]MonitorV1Alert,error)

Lists Alert records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning.

func (*ApiService)ListEventadded inv0.11.0

func (c *ApiService) ListEvent(params *ListEventParams) ([]MonitorV1Event,error)

Lists Event records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning.

func (*ApiService)PageAlertadded inv0.13.0

func (c *ApiService) PageAlert(params *ListAlertParams, pageToken, pageNumberstring) (*ListAlertResponse,error)

Retrieve a single page of Alert records from the API. Request is executed immediately.

func (*ApiService)PageEventadded inv0.13.0

func (c *ApiService) PageEvent(params *ListEventParams, pageToken, pageNumberstring) (*ListEventResponse,error)

Retrieve a single page of Event records from the API. Request is executed immediately.

func (*ApiService)RequestHandleradded inv1.25.0

func (c *ApiService) RequestHandler() *twilio.RequestHandler

func (*ApiService)StreamAlertadded inv0.13.0

func (c *ApiService) StreamAlert(params *ListAlertParams) (chanMonitorV1Alert, chanerror)

Streams Alert records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached.

func (*ApiService)StreamEventadded inv0.13.0

func (c *ApiService) StreamEvent(params *ListEventParams) (chanMonitorV1Event, chanerror)

Streams Event records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached.

typeListAlertParams

type ListAlertParams struct {// Only show alerts for this log-level.  Can be: `error`, `warning`, `notice`, or `debug`.LogLevel *string `json:"LogLevel,omitempty"`// Only include alerts that occurred on or after this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported.StartDate *time.Time `json:"StartDate,omitempty"`// Only include alerts that occurred on or before this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported.EndDate *time.Time `json:"EndDate,omitempty"`// How many resources to return in each list page. The default is 50, and the maximum is 1000.PageSize *int `json:"PageSize,omitempty"`// Max number of records to return.Limit *int `json:"limit,omitempty"`}

Optional parameters for the method 'ListAlert'

func (*ListAlertParams)SetEndDate

func (params *ListAlertParams) SetEndDate(EndDatetime.Time) *ListAlertParams

func (*ListAlertParams)SetLimitadded inv0.13.0

func (params *ListAlertParams) SetLimit(Limitint) *ListAlertParams

func (*ListAlertParams)SetLogLevel

func (params *ListAlertParams) SetLogLevel(LogLevelstring) *ListAlertParams

func (*ListAlertParams)SetPageSize

func (params *ListAlertParams) SetPageSize(PageSizeint) *ListAlertParams

func (*ListAlertParams)SetStartDate

func (params *ListAlertParams) SetStartDate(StartDatetime.Time) *ListAlertParams

typeListAlertResponse

type ListAlertResponse struct {Alerts []MonitorV1Alert      `json:"alerts,omitempty"`MetaListAlertResponseMeta `json:"meta,omitempty"`}

ListAlertResponse struct for ListAlertResponse

typeListAlertResponseMeta

type ListAlertResponseMeta struct {FirstPageUrlstring  `json:"first_page_url,omitempty"`Keystring  `json:"key,omitempty"`NextPageUrl     *string `json:"next_page_url,omitempty"`Pageint     `json:"page,omitempty"`PageSizeint     `json:"page_size,omitempty"`PreviousPageUrl *string `json:"previous_page_url,omitempty"`Urlstring  `json:"url,omitempty"`}

ListAlertResponseMeta struct for ListAlertResponseMeta

typeListEventParams

type ListEventParams struct {// Only include events initiated by this Actor. Useful for auditing actions taken by specific users or API credentials.ActorSid *string `json:"ActorSid,omitempty"`// Only include events of this [Event Type](https://www.twilio.com/docs/usage/monitor-events#event-types).EventType *string `json:"EventType,omitempty"`// Only include events that refer to this resource. Useful for discovering the history of a specific resource.ResourceSid *string `json:"ResourceSid,omitempty"`// Only include events that originated from this IP address. Useful for tracking suspicious activity originating from the API or the Twilio Console.SourceIpAddress *string `json:"SourceIpAddress,omitempty"`// Only include events that occurred on or after this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.StartDate *time.Time `json:"StartDate,omitempty"`// Only include events that occurred on or before this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.EndDate *time.Time `json:"EndDate,omitempty"`// How many resources to return in each list page. The default is 50, and the maximum is 1000.PageSize *int `json:"PageSize,omitempty"`// Max number of records to return.Limit *int `json:"limit,omitempty"`}

Optional parameters for the method 'ListEvent'

func (*ListEventParams)SetActorSid

func (params *ListEventParams) SetActorSid(ActorSidstring) *ListEventParams

func (*ListEventParams)SetEndDate

func (params *ListEventParams) SetEndDate(EndDatetime.Time) *ListEventParams

func (*ListEventParams)SetEventType

func (params *ListEventParams) SetEventType(EventTypestring) *ListEventParams

func (*ListEventParams)SetLimitadded inv0.13.0

func (params *ListEventParams) SetLimit(Limitint) *ListEventParams

func (*ListEventParams)SetPageSize

func (params *ListEventParams) SetPageSize(PageSizeint) *ListEventParams

func (*ListEventParams)SetResourceSid

func (params *ListEventParams) SetResourceSid(ResourceSidstring) *ListEventParams

func (*ListEventParams)SetSourceIpAddress

func (params *ListEventParams) SetSourceIpAddress(SourceIpAddressstring) *ListEventParams

func (*ListEventParams)SetStartDate

func (params *ListEventParams) SetStartDate(StartDatetime.Time) *ListEventParams

typeListEventResponse

type ListEventResponse struct {Events []MonitorV1Event      `json:"events,omitempty"`MetaListAlertResponseMeta `json:"meta,omitempty"`}

ListEventResponse struct for ListEventResponse

typeMonitorV1Alert

type MonitorV1Alert struct {// The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Alert resource.AccountSid *string `json:"account_sid,omitempty"`// The text of the alert.AlertText *string `json:"alert_text,omitempty"`// The API version used when the alert was generated.  Can be empty for events that don't have a specific API version.ApiVersion *string `json:"api_version,omitempty"`// The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.DateCreated *time.Time `json:"date_created,omitempty"`// The date and time in GMT when the alert was generated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format.  Due to buffering, this can be different than `date_created`.DateGenerated *time.Time `json:"date_generated,omitempty"`// The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.DateUpdated *time.Time `json:"date_updated,omitempty"`// The error code for the condition that generated the alert. See the [Error Dictionary](https://www.twilio.com/docs/api/errors) for possible causes and solutions to the error.ErrorCode *string `json:"error_code,omitempty"`// The log level.  Can be: `error`, `warning`, `notice`, or `debug`.LogLevel *string `json:"log_level,omitempty"`// The URL of the page in our [Error Dictionary](https://www.twilio.com/docs/api/errors) with more information about the error condition.MoreInfo *string `json:"more_info,omitempty"`// The method used by the request that generated the alert. If the alert was generated by a request we made to your server, this is the method we used. If the alert was generated by a request from your application to our API, this is the method your application used.RequestMethod *string `json:"request_method,omitempty"`// The URL of the request that generated the alert. If the alert was generated by a request we made to your server, this is the URL on your server that generated the alert. If the alert was generated by a request from your application to our API, this is the URL of the resource requested.RequestUrl *string `json:"request_url,omitempty"`// The SID of the resource for which the alert was generated.  For instance, if your server failed to respond to an HTTP request during the flow of a particular call, this value would be the SID of the server.  This value is empty if the alert was not generated for a particular resource.ResourceSid *string `json:"resource_sid,omitempty"`// The unique string that we created to identify the Alert resource.Sid *string `json:"sid,omitempty"`// The absolute URL of the Alert resource.Url *string `json:"url,omitempty"`// The SID of the service or resource that generated the alert. Can be `null`.ServiceSid *string `json:"service_sid,omitempty"`}

MonitorV1Alert struct for MonitorV1Alert

typeMonitorV1AlertInstance

type MonitorV1AlertInstance struct {// The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Alert resource.AccountSid *string `json:"account_sid,omitempty"`// The text of the alert.AlertText *string `json:"alert_text,omitempty"`// The API version used when the alert was generated.  Can be empty for events that don't have a specific API version.ApiVersion *string `json:"api_version,omitempty"`// The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.DateCreated *time.Time `json:"date_created,omitempty"`// The date and time in GMT when the alert was generated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format.  Due to buffering, this can be different than `date_created`.DateGenerated *time.Time `json:"date_generated,omitempty"`// The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.DateUpdated *time.Time `json:"date_updated,omitempty"`// The error code for the condition that generated the alert. See the [Error Dictionary](https://www.twilio.com/docs/api/errors) for possible causes and solutions to the error.ErrorCode *string `json:"error_code,omitempty"`// The log level.  Can be: `error`, `warning`, `notice`, or `debug`.LogLevel *string `json:"log_level,omitempty"`// The URL of the page in our [Error Dictionary](https://www.twilio.com/docs/api/errors) with more information about the error condition.MoreInfo *string `json:"more_info,omitempty"`// The method used by the request that generated the alert. If the alert was generated by a request we made to your server, this is the method we used. If the alert was generated by a request from your application to our API, this is the method your application used.RequestMethod *string `json:"request_method,omitempty"`// The URL of the request that generated the alert. If the alert was generated by a request we made to your server, this is the URL on your server that generated the alert. If the alert was generated by a request from your application to our API, this is the URL of the resource requested.RequestUrl *string `json:"request_url,omitempty"`// The variables passed in the request that generated the alert. This value is only returned when a single Alert resource is fetched.RequestVariables *string `json:"request_variables,omitempty"`// The SID of the resource for which the alert was generated.  For instance, if your server failed to respond to an HTTP request during the flow of a particular call, this value would be the SID of the server.  This value is empty if the alert was not generated for a particular resource.ResourceSid *string `json:"resource_sid,omitempty"`// The response body of the request that generated the alert. This value is only returned when a single Alert resource is fetched.ResponseBody *string `json:"response_body,omitempty"`// The response headers of the request that generated the alert. This value is only returned when a single Alert resource is fetched.ResponseHeaders *string `json:"response_headers,omitempty"`// The unique string that we created to identify the Alert resource.Sid *string `json:"sid,omitempty"`// The absolute URL of the Alert resource.Url *string `json:"url,omitempty"`// The request headers of the request that generated the alert. This value is only returned when a single Alert resource is fetched.RequestHeaders *string `json:"request_headers,omitempty"`// The SID of the service or resource that generated the alert. Can be `null`.ServiceSid *string `json:"service_sid,omitempty"`}

MonitorV1AlertInstance struct for MonitorV1AlertInstance

typeMonitorV1Event

type MonitorV1Event struct {// The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Event resource.AccountSid *string `json:"account_sid,omitempty"`// The SID of the actor that caused the event, if available. This can be either a User ID (matching the pattern `^US[0-9a-fA-F]{32}$`) or an Account SID (matching the pattern `^AC[0-9a-fA-F]{32}$`). If the actor's SID isn't available, this field will be `null`.ActorSid *string `json:"actor_sid,omitempty"`// The type of actor that caused the event. Can be: `user` for a change made by a logged-in user in the Twilio Console, `account` for an event caused by an API request by an authenticating Account, `twilio-admin` for an event caused by a Twilio employee, and so on.ActorType *string `json:"actor_type,omitempty"`// A description of the event. Can be `null`.Description *string `json:"description,omitempty"`// An object with additional data about the event. The  contents depend on `event_type`. For example, event-types of the form `RESOURCE.updated`, this value contains a `resource_properties` dictionary that describes the previous and updated properties of the resource.EventData *interface{} `json:"event_data,omitempty"`// The date and time in GMT when the event was recorded specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.EventDate *time.Time `json:"event_date,omitempty"`// The event's type. Event-types are typically in the form: `RESOURCE_TYPE.ACTION`, where `RESOURCE_TYPE` is the type of resource that was affected and `ACTION` is what happened to it. For example, `phone-number.created`. For a full list of all event-types, see the [Monitor Event Types](https://www.twilio.com/docs/usage/monitor-events#event-types).EventType *string `json:"event_type,omitempty"`// The SID of the resource that was affected.ResourceSid *string `json:"resource_sid,omitempty"`// The type of resource that was affected. For a full list of all resource-types, see the [Monitor Event Types](https://www.twilio.com/docs/usage/monitor-events#event-types).ResourceType *string `json:"resource_type,omitempty"`// The unique string that we created to identify the Event resource.Sid *string `json:"sid,omitempty"`// The originating system or interface that caused the event.  Can be: `web` for events caused by user action in the Twilio Console, `api` for events caused by a request to our API, or   `twilio` for events caused by an automated or internal Twilio system.Source *string `json:"source,omitempty"`// The IP address of the source, if the source is outside the Twilio cloud. This value is `null` for events with `source` of `twilio`SourceIpAddress *string `json:"source_ip_address,omitempty"`// The absolute URL of the resource that was affected. Can be `null`.Url *string `json:"url,omitempty"`// The absolute URLs of related resources.Links *map[string]interface{} `json:"links,omitempty"`}

MonitorV1Event struct for MonitorV1Event

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp