openapi

package
v1.0.0-rc.6 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: MIT Imports: 6 Imported by: 0

README

Go API client for openapi

This is the public Twilio REST API.

Overview

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

  • API version: 1.33.0
  • Package version: 1.0.0
  • Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit https://support.twilio.com

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go 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 to https://monitor.twilio.com

Class Method HTTP request Description
AlertsApi FetchAlert Get /v1/Alerts/{Sid}
AlertsApi ListAlert Get /v1/Alerts
EventsApi FetchEvent Get /v1/Events/{Sid}
EventsApi ListEvent Get /v1/Events

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

type ApiService added in v0.11.0

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

func NewApiService added in v0.11.0

func NewApiService(requestHandler *twilio.RequestHandler) *ApiService

func NewApiServiceWithClient added in v0.11.0

func NewApiServiceWithClient(client twilio.BaseClient) *ApiService

func (*ApiService) FetchAlert added in v0.11.0

func (c *ApiService) FetchAlert(Sid string) (*MonitorV1AlertInstance, error)

func (*ApiService) FetchEvent added in v0.11.0

func (c *ApiService) FetchEvent(Sid string) (*MonitorV1Event, error)

func (*ApiService) ListAlert added in v0.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) ListEvent added in v0.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) PageAlert added in v0.13.0

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

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

func (*ApiService) PageEvent added in v0.13.0

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

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

func (*ApiService) StreamAlert added in v0.13.0

func (c *ApiService) StreamAlert(params *ListAlertParams) (chan MonitorV1Alert, chan error)

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) StreamEvent added in v0.13.0

func (c *ApiService) StreamEvent(params *ListEventParams) (chan MonitorV1Event, chan error)

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

type ListAlertParams

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(EndDate time.Time) *ListAlertParams

func (*ListAlertParams) SetLimit added in v0.13.0

func (params *ListAlertParams) SetLimit(Limit int) *ListAlertParams

func (*ListAlertParams) SetLogLevel

func (params *ListAlertParams) SetLogLevel(LogLevel string) *ListAlertParams

func (*ListAlertParams) SetPageSize

func (params *ListAlertParams) SetPageSize(PageSize int) *ListAlertParams

func (*ListAlertParams) SetStartDate

func (params *ListAlertParams) SetStartDate(StartDate time.Time) *ListAlertParams

type ListAlertResponse

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

ListAlertResponse struct for ListAlertResponse

type ListAlertResponseMeta

type ListAlertResponseMeta struct {
	FirstPageUrl    string `json:"first_page_url,omitempty"`
	NextPageUrl     string `json:"next_page_url,omitempty"`
	Page            int    `json:"page,omitempty"`
	PageSize        int    `json:"page_size,omitempty"`
	PreviousPageUrl string `json:"previous_page_url,omitempty"`
	Url             string `json:"url,omitempty"`
	Key             string `json:"key,omitempty"`
}

ListAlertResponseMeta struct for ListAlertResponseMeta

type ListEventParams

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(ActorSid string) *ListEventParams

func (*ListEventParams) SetEndDate

func (params *ListEventParams) SetEndDate(EndDate time.Time) *ListEventParams

func (*ListEventParams) SetEventType

func (params *ListEventParams) SetEventType(EventType string) *ListEventParams

func (*ListEventParams) SetLimit added in v0.13.0

func (params *ListEventParams) SetLimit(Limit int) *ListEventParams

func (*ListEventParams) SetPageSize

func (params *ListEventParams) SetPageSize(PageSize int) *ListEventParams

func (*ListEventParams) SetResourceSid

func (params *ListEventParams) SetResourceSid(ResourceSid string) *ListEventParams

func (*ListEventParams) SetSourceIpAddress

func (params *ListEventParams) SetSourceIpAddress(SourceIpAddress string) *ListEventParams

func (*ListEventParams) SetStartDate

func (params *ListEventParams) SetStartDate(StartDate time.Time) *ListEventParams

type ListEventResponse

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

ListEventResponse struct for ListEventResponse

type MonitorV1Alert

type MonitorV1Alert struct {
	// The SID of the Account that created the 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
	ApiVersion *string `json:"api_version,omitempty"`
	// The ISO 8601 date and time in GMT when the resource was created
	DateCreated *time.Time `json:"date_created,omitempty"`
	// The date and time when the alert was generated specified in ISO 8601 format
	DateGenerated *time.Time `json:"date_generated,omitempty"`
	// The ISO 8601 date and time in GMT when the resource was last updated
	DateUpdated *time.Time `json:"date_updated,omitempty"`
	// The error code for the condition that generated the alert
	ErrorCode *string `json:"error_code,omitempty"`
	// The log level
	LogLevel *string `json:"log_level,omitempty"`
	// The URL of the page in our Error Dictionary with more information about the error condition
	MoreInfo *string `json:"more_info,omitempty"`
	// The method used by the request that generated the alert
	RequestMethod *string `json:"request_method,omitempty"`
	// The URL of the request that generated the alert
	RequestUrl *string `json:"request_url,omitempty"`
	// The SID of the resource for which the alert was generated
	ResourceSid *string `json:"resource_sid,omitempty"`
	// The unique string that identifies the 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
	ServiceSid *string `json:"service_sid,omitempty"`
}

MonitorV1Alert struct for MonitorV1Alert

type MonitorV1AlertInstance

type MonitorV1AlertInstance struct {
	// The SID of the Account that created the 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
	ApiVersion *string `json:"api_version,omitempty"`
	// The ISO 8601 date and time in GMT when the resource was created
	DateCreated *time.Time `json:"date_created,omitempty"`
	// The date and time when the alert was generated specified in ISO 8601 format
	DateGenerated *time.Time `json:"date_generated,omitempty"`
	// The ISO 8601 date and time in GMT when the resource was last updated
	DateUpdated *time.Time `json:"date_updated,omitempty"`
	// The error code for the condition that generated the alert
	ErrorCode *string `json:"error_code,omitempty"`
	// The log level
	LogLevel *string `json:"log_level,omitempty"`
	// The URL of the page in our Error Dictionary with more information about the error condition
	MoreInfo *string `json:"more_info,omitempty"`
	// The method used by the request that generated the alert
	RequestMethod *string `json:"request_method,omitempty"`
	// The URL of the request that generated the alert
	RequestUrl *string `json:"request_url,omitempty"`
	// The variables passed in the request that generated the alert
	RequestVariables *string `json:"request_variables,omitempty"`
	// The SID of the resource for which the alert was generated
	ResourceSid *string `json:"resource_sid,omitempty"`
	// The response body of the request that generated the alert
	ResponseBody *string `json:"response_body,omitempty"`
	// The response headers of the request that generated the alert
	ResponseHeaders *string `json:"response_headers,omitempty"`
	// The unique string that identifies the 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
	RequestHeaders *string `json:"request_headers,omitempty"`
	// The SID of the service or resource that generated the alert
	ServiceSid *string `json:"service_sid,omitempty"`
}

MonitorV1AlertInstance struct for MonitorV1AlertInstance

type MonitorV1Event

type MonitorV1Event struct {
	// The SID of the Account that created the resource
	AccountSid *string `json:"account_sid,omitempty"`
	// The SID of the actor that caused the event, if available
	ActorSid *string `json:"actor_sid,omitempty"`
	// The type of actor that caused the event
	ActorType *string `json:"actor_type,omitempty"`
	// A description of the event
	Description *string `json:"description,omitempty"`
	// A JSON string that represents an object with additional data about the event
	EventData *interface{} `json:"event_data,omitempty"`
	// The ISO 8601 date and time in GMT when the event was recorded
	EventDate *time.Time `json:"event_date,omitempty"`
	// The event's type
	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
	ResourceType *string `json:"resource_type,omitempty"`
	// The unique string that identifies the resource
	Sid *string `json:"sid,omitempty"`
	// The originating system or interface that caused the event
	Source *string `json:"source,omitempty"`
	// The IP address of the source
	SourceIpAddress *string `json:"source_ip_address,omitempty"`
	// The absolute URL of the resource that was affected
	Url *string `json:"url,omitempty"`
	// The absolute URLs of related resources
	Links *map[string]interface{} `json:"links,omitempty"`
}

MonitorV1Event struct for MonitorV1Event

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL