utils

package
Version: v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2022 License: Apache-2.0 Imports: 7 Imported by: 64

Documentation

Index

Constants

View Source
const RFC2822 = "Mon, 2 Jan 2006 15:04:05 -0700"

RFC2822 is the time format used by Twilio's unified API

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

Bool returns a pointer to the bool value passed in.

func Int

func Int(v int) *int

Int returns a pointer to the int value passed in.

func Interface

func Interface(v interface{}) *interface{}

Interface returns a pointer to the interface value passed in.

func String

func String(v string) *string

String returns a pointer to the string value passed in.

func StructToURLValues added in v0.3.0

func StructToURLValues(v interface{}) *url.Values

func Time

func Time(v time.Time) *time.Time

Time returns a pointer to the time value passed in.

func ValidateInput

func ValidateInput(input interface{}) error

ValidateInput validates an input struct matches the schema defined on the struct

Types

type RFC2822Time

type RFC2822Time struct {
	*time.Time
}

RFC2822Time allows RFC2822 returned by the Twilio APIs to marshalled/ unmarshalled

func (*RFC2822Time) MarshalJSON

func (value *RFC2822Time) MarshalJSON() ([]byte, error)

func (*RFC2822Time) UnmarshalJSON

func (value *RFC2822Time) UnmarshalJSON(b []byte) error

type TwilioError

type TwilioError struct {
	Code     *int                    `json:"code,omitempty"`
	Details  *map[string]interface{} `json:"details,omitempty"`
	Message  string                  `json:"message"`
	MoreInfo *string                 `json:"more_info,omitempty"`
	Status   int                     `json:"status"`
}

TwilioError represents the error object returned by the Twilio API when an error occurs

func (TwilioError) Error

func (twilioError TwilioError) Error() string

Error returns the error message

func (TwilioError) IsNotFoundError

func (twilioError TwilioError) IsNotFoundError() bool

IsNotFoundError check if the error is a not found error

Jump to

Keyboard shortcuts

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