openapi

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 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.17.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
DefaultApi FetchAlert Get /v1/Alerts/{Sid}
DefaultApi FetchEvent Get /v1/Events/{Sid}
DefaultApi ListAlert Get /v1/Alerts
DefaultApi 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)

Author

support@twilio.com

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultApiService

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

func NewDefaultApiService

func NewDefaultApiService(requestHandler *twilio.RequestHandler) *DefaultApiService

func NewDefaultApiServiceWithClient added in v0.9.0

func NewDefaultApiServiceWithClient(client twilio.BaseClient) *DefaultApiService

func (*DefaultApiService) FetchAlert

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

func (*DefaultApiService) FetchEvent

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

func (*DefaultApiService) ListAlert

func (c *DefaultApiService) ListAlert(params *ListAlertParams) (*ListAlertResponse, error)

func (*DefaultApiService) ListEvent

func (c *DefaultApiService) ListEvent(params *ListEventParams) (*ListEventResponse, error)

Returns a list of events in the account, sorted by event-date.

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 *int32 `json:"PageSize,omitempty"`
}

Optional parameters for the method 'ListAlert'

func (*ListAlertParams) SetEndDate

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

func (*ListAlertParams) SetLogLevel

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

func (*ListAlertParams) SetPageSize

func (params *ListAlertParams) SetPageSize(PageSize int32) *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"`
	Key             string `json:"key,omitempty"`
	NextPageUrl     string `json:"next_page_url,omitempty"`
	Page            int32  `json:"page,omitempty"`
	PageSize        int32  `json:"page_size,omitempty"`
	PreviousPageUrl string `json:"previous_page_url,omitempty"`
	Url             string `json:"url,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 *int32 `json:"PageSize,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) SetPageSize

func (params *ListEventParams) SetPageSize(PageSize int32) *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 SID of the service or resource that generated the alert
	ServiceSid *string `json:"service_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"`
}

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 request headers of the request that generated the alert
	RequestHeaders *string `json:"request_headers,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 SID of the service or resource that generated the alert
	ServiceSid *string `json:"service_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"`
}

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 *map[string]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 absolute URLs of related resources
	Links *map[string]interface{} `json:"links,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"`
}

MonitorV1Event struct for MonitorV1Event

Jump to

Keyboard shortcuts

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