v0.0.0-...-90d592e Latest Latest

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

Go to latest
Published: Oct 26, 2021 License: MIT Imports: 11 Imported by: 0




View Source
const (
	HttpMethodGet  HttpMethod = "GET"
	HttpMethodPost HttpMethod = "POST"

	StatusCodeErrorCarrierNotAvailable    StatusCode = "11"
	StatusCodeSuccess                     StatusCode = "100"
	StatusCodeSuccessPartial              StatusCode = "101"
	StatusCodeInvalidSender               StatusCode = "201"
	StatusCodeInvalidRecipient            StatusCode = "202"
	StatusCodeMissingParamTo              StatusCode = "301"
	StatusCodeMissingParamText            StatusCode = "305"
	StatusCodeParamTextExceedsLengthLimit StatusCode = "401"
	StatusCodePreventedByReloadLock       StatusCode = "402"
	StatusCodeReachedDailyLimitForNumber  StatusCode = "403"
	StatusCodeInsufficientCredits         StatusCode = "500"
	StatusCodeErrorCarrierDelivery        StatusCode = "600"
	StatusCodeErrorUnknown                StatusCode = "700"
	StatusCodeErrorAuthentication         StatusCode = "900"
	StatusCodeErrorApiDisabledForKey      StatusCode = "902"
	StatusCodeErrorServerIp               StatusCode = "903"
View Source
const EndpointPricing = "pricing"
View Source
const StatusApiCodeInvalidMessageId = "901"


View Source
var PricingCsvHeaders = map[PricingCsvHeader]string{
	PricingHeaderCountryCode:   "countryCode",
	PricingHeaderCountryName:   "countryName",
	PricingHeaderCountryPrefix: "countryPrefix",
	PricingHeaderMcc:           "mcc",
	PricingHeaderMncs:          "mnc",
	PricingHeaderNetworkName:   "networkName",
	PricingHeaderPrice:         "price",
	PricingHeaderFeatures:      "features",
	PricingHeaderComment:       "comment",
View Source
var StatusCodes = map[StatusCode]string{
	StatusCodeErrorCarrierNotAvailable:    "ErrorCarrierNotAvailable",
	StatusCodeSuccess:                     "Success",
	StatusCodeSuccessPartial:              "SuccessPartial",
	StatusCodeInvalidSender:               "InvalidSender",
	StatusCodeInvalidRecipient:            "InvalidRecipient",
	StatusCodeMissingParamTo:              "MissingParamTo",
	StatusCodeMissingParamText:            "MissingParamText",
	StatusCodeParamTextExceedsLengthLimit: "ParamTextExceedsLengthLimit",
	StatusCodePreventedByReloadLock:       "PreventedByReloadLock",
	StatusCodeReachedDailyLimitForNumber:  "ReachedDailyLimitForNumber",
	StatusCodeInsufficientCredits:         "InsufficientCredits",
	StatusCodeErrorCarrierDelivery:        "ErrorCarrierDelivery",
	StatusCodeErrorUnknown:                "ErrorUnknown",
	StatusCodeErrorAuthentication:         "ErrorAuthentication",
	StatusCodeErrorApiDisabledForKey:      "ErrorApiDisabledForKey",
	StatusCodeErrorServerIp:               "ErrorServerIp",


This section is empty.


type Analytics

type Analytics struct {
	Account *string `json:"account"`
	Country *string `json:"country"`
	Date    *string `json:"date"`
	Label   *string `json:"label"`

	Direct   int     `json:"direct"`
	Economy  int     `json:"economy"`
	Hlr      int     `json:"hlr"`
	Inbound  int     `json:"inbound"`
	Mnp      int     `json:"mnp"`
	Voice    int     `json:"voice"`
	UsageEur float64 `json:"usage_eur"`

type AnalyticsGroupBy

type AnalyticsGroupBy string
const (
	AnalyticsGroupByCountry    AnalyticsGroupBy = "country"
	AnalyticsGroupByDate       AnalyticsGroupBy = "date"
	AnalyticsGroupByLabel      AnalyticsGroupBy = "label"
	AnalyticsGroupBySubaccount AnalyticsGroupBy = "subaccount"

type AnalyticsParams

type AnalyticsParams struct {
	End         string           `json:"end,omitempty"`
	GroupBy     AnalyticsGroupBy `json:"group_by,omitempty"`
	Label       string           `json:"label,omitempty"`
	Start       string           `json:"start,omitempty"`
	Subaccounts string           `json:"subaccounts,omitempty"`

type AnalyticsResource

type AnalyticsResource resource

func (*AnalyticsResource) Get

func (api *AnalyticsResource) Get(p *AnalyticsParams) (o []Analytics, err error)

func (*AnalyticsResource) GetContext

func (api *AnalyticsResource) GetContext(ctx context.Context, p *AnalyticsParams) (o []Analytics, err error)

type BalanceResource

type BalanceResource resource

func (*BalanceResource) Get

func (api *BalanceResource) Get() (*float64, error)

func (*BalanceResource) GetContext

func (api *BalanceResource) GetContext(ctx context.Context) (*float64, error)

type Carrier

type Carrier struct {
	Country     string `json:"country"`
	Name        string `json:"name"`
	NetworkCode string `json:"network_code"`
	NetworkType string `json:"network_type"`

type Contact

type Contact struct {
	Id    string `json:"ID"`
	Nick  string `json:"Name"`
	Phone string `json:"Number"`

type ContactEditParams

type ContactEditParams struct {
	Id    string `json:"id"`
	Nick  string `json:"nick,omitempty"`
	Phone string `json:"empfaenger,omitempty"`

type ContactsAction

type ContactsAction string
const (
	ContactsActionDelete ContactsAction = "del"
	ContactsActionRead   ContactsAction = "read"
	ContactsActionWrite  ContactsAction = "write"

type ContactsCreateJsonResponse

type ContactsCreateJsonResponse struct {
	Id uint64 `json:"id"`
	// contains filtered or unexported fields

type ContactsDeleteJsonResponse

type ContactsDeleteJsonResponse = contactsPropReturn

type ContactsDeleteParams

type ContactsDeleteParams = contactsParamId

type ContactsEditJsonResponse

type ContactsEditJsonResponse = contactsPropReturn

type ContactsReadParams

type ContactsReadParams = contactsParamId

type ContactsResource

type ContactsResource resource

func (*ContactsResource) CreateCsv

func (api *ContactsResource) CreateCsv() (string, error)

func (*ContactsResource) CreateCsvContext

func (api *ContactsResource) CreateCsvContext(ctx context.Context) (string, error)

func (*ContactsResource) CreateJson

func (api *ContactsResource) CreateJson() (o ContactsCreateJsonResponse, e error)

func (*ContactsResource) CreateJsonContext

func (api *ContactsResource) CreateJsonContext(ctx context.Context) (o ContactsCreateJsonResponse, e error)

func (*ContactsResource) DeleteCsv

func (api *ContactsResource) DeleteCsv(p ContactsDeleteParams) (string, error)

func (*ContactsResource) DeleteCsvContext

func (api *ContactsResource) DeleteCsvContext(ctx context.Context, p ContactsDeleteParams) (string, error)

func (*ContactsResource) DeleteJson

func (*ContactsResource) DeleteJsonContext

func (*ContactsResource) EditCsv

func (api *ContactsResource) EditCsv(p ContactEditParams) (string, error)

func (*ContactsResource) EditCsvContext

func (api *ContactsResource) EditCsvContext(ctx context.Context, p ContactEditParams) (string, error)

func (*ContactsResource) EditJson

func (*ContactsResource) EditJsonContext

func (*ContactsResource) ReadCsv

func (api *ContactsResource) ReadCsv(p ContactsReadParams) (string, error)

func (*ContactsResource) ReadCsvContext

func (api *ContactsResource) ReadCsvContext(ctx context.Context, p ContactsReadParams) (string, error)

func (*ContactsResource) ReadJson

func (api *ContactsResource) ReadJson(p ContactsReadParams) (a []Contact, e error)

func (*ContactsResource) ReadJsonContext

func (api *ContactsResource) ReadJsonContext(ctx context.Context, p ContactsReadParams) (a []Contact, e error)

type ContactsWriteCode

type ContactsWriteCode string
const (
	ContactsWriteCodeUnchanged ContactsWriteCode = "151"
	ContactsWriteCodeChanged   ContactsWriteCode = "152"

type CountryNetwork

type CountryNetwork struct {
	Comment     string   `json:"comment,omitempty"`
	Features    []string `json:"features,omitempty"`
	Mcc         string   `json:"mcc,omitempty"`
	Mncs        []string `json:"mncs,omitempty"`
	NetworkName string   `json:"networkName,omitempty"`
	Price       float64  `json:"price,omitempty"`

type CountryPricing

type CountryPricing struct {
	CountryCode   string           `json:"countryCode,omitempty"`
	CountryName   string           `json:"countryName,omitempty"`
	CountryPrefix string           `json:"countryPrefix,omitempty"`
	Networks      []CountryNetwork `json:"networks,omitempty"`

type Hook

type Hook struct {
	Created       string            `json:"created"`
	EventType     HookEventType     `json:"event_type"`
	Id            string            `json:"id"`
	RequestMethod HookRequestMethod `json:"request_method"`
	TargetUrl     string            `json:"target_url"`

type HookEventType

type HookEventType string
const (
	HookEventTypeSmsStatus   HookEventType = "dlr"
	HookEventTypeVoiceStatus HookEventType = "voice_status"
	HookEventTypeInboundSms  HookEventType = "sms_mo"

type HookRequestMethod

type HookRequestMethod string
const (
	HookRequestMethodGet  HookRequestMethod = "GET"
	HookRequestMethodJson HookRequestMethod = "JSON"
	HookRequestMethodPost HookRequestMethod = "POST"

type HooksAction

type HooksAction string
const (
	HooksActionRead        HooksAction = "read"
	HooksActionSubscribe   HooksAction = "subscribe"
	HooksActionUnsubscribe HooksAction = "unsubscribe"

type HooksParams

type HooksParams struct {
	Action        HooksAction       `json:"action"`
	EventType     HookEventType     `json:"event_type,omitempty"`
	Id            int               `json:"id,omitempty"`
	RequestMethod HookRequestMethod `json:"request_method,omitempty"`
	TargetUrl     string            `json:"target_url,omitempty"`

type HooksReadResponse

type HooksReadResponse struct {
	Success bool   `json:"success"`
	Hooks   []Hook `json:"hooks"`

type HooksResource

type HooksResource resource

func (*HooksResource) Request

func (api *HooksResource) Request(p HooksParams) (interface{}, error)

func (*HooksResource) RequestContext

func (api *HooksResource) RequestContext(ctx context.Context, p HooksParams) (interface{}, error)

type HooksSubscribeResponse

type HooksSubscribeResponse struct {
	Id      int  `json:"id"`
	Success bool `json:"success"`

type HooksUnsubscribeResponse

type HooksUnsubscribeResponse struct {
	Success bool `json:"success"`

type HttpMethod

type HttpMethod string

type JournalBase

type JournalBase struct {
	From      string `json:"from"`
	Id        string `json:"id"`
	Price     string `json:"price"`
	Text      string `json:"text"`
	Timestamp string `json:"timestamp"`
	To        string `json:"to"`

type JournalInbound

type JournalInbound struct {

type JournalOutbound

type JournalOutbound struct {
	Connection   string `json:"connection"`
	Dlr          string `json:"dlr"`
	DlrTimestamp string `json:"dlr_timestamp"`
	ForeignId    string `json:"foreign_id"`
	Label        string `json:"label"`
	Latency      string `json:"latency"`
	MccMnc       string `json:"mccmnc"`
	Type         string `json:"type"`

type JournalParams

type JournalParams struct {
	DateFrom string      `json:"date_from,omitempty"`
	DateTo   string      `json:"date_to,omitempty"`
	Id       int         `json:"id,omitempty"`
	State    string      `json:"state,omitempty"`
	To       string      `json:"to,omitempty"`
	Type     JournalType `json:"type"`

func BuildJournalParams

func BuildJournalParams(journalType JournalType, p *JournalParams) *JournalParams

type JournalReplies

type JournalReplies struct {

type JournalResource

type JournalResource resource

func (*JournalResource) Inbound

func (api *JournalResource) Inbound(p *JournalParams) ([]JournalInbound, error)

func (*JournalResource) InboundContext

func (api *JournalResource) InboundContext(ctx context.Context, p *JournalParams) ([]JournalInbound, error)

func (*JournalResource) Outbound

func (api *JournalResource) Outbound(p *JournalParams) ([]JournalOutbound, error)

func (*JournalResource) OutboundContext

func (api *JournalResource) OutboundContext(ctx context.Context, p *JournalParams) ([]JournalOutbound, error)

func (*JournalResource) Replies

func (api *JournalResource) Replies(p *JournalParams) ([]JournalReplies, error)

func (*JournalResource) RepliesContext

func (api *JournalResource) RepliesContext(ctx context.Context, p *JournalParams) ([]JournalReplies, error)

func (*JournalResource) Voice

func (api *JournalResource) Voice(p *JournalParams) ([]JournalVoice, error)

func (*JournalResource) VoiceContext

func (api *JournalResource) VoiceContext(ctx context.Context, p *JournalParams) ([]JournalVoice, error)

type JournalType

type JournalType string
const (
	JournalTypeInbound  JournalType = "inbound"
	JournalTypeOutbound JournalType = "outbound"
	JournalTypeReplies  JournalType = "replies"
	JournalTypeVoice    JournalType = "voice"

type JournalVoice

type JournalVoice struct {
	Duration string `json:"duration"`
	Error    string `json:"error"`
	Status   string `json:"status"`
	Xml      bool   `json:"xml"`

type LookupCnamResponse

type LookupCnamResponse struct {
	Code    string `json:"code"`
	Name    string `json:"name"`
	Number  string `json:"number"`
	Success string `json:"success"`

type LookupFormatResponse

type LookupFormatResponse struct {
	National               string `json:"national"`
	Carrier                string `json:"carrier"`
	CountryCode            string `json:"country_code"`
	CountryIso             string `json:"country_iso"`
	CountryName            string `json:"country_name"`
	International          string `json:"international"`
	InternationalFormatted string `json:"international_formatted"`
	NetworkType            string `json:"network_type"`
	Success                bool   `json:"success"`

type LookupHlrResponse

type LookupHlrResponse struct {
	CountryCode               string  `json:"country_code"`
	CountryCodeIso3           *string `json:"country_code_iso3,omitempty"`
	CountryName               string  `json:"country_name"`
	CountryPrefix             string  `json:"country_prefix"`
	CurrentCarrier            Carrier `json:"current_carrier"`
	GsmCode                   string  `json:"gsm_code"`
	GsmMessage                string  `json:"gsm_message"`
	InternationalFormatNumber string  `json:"international_format_number"`
	InternationalFormatted    string  `json:"international_formatted"`
	LookupOutcome             bool    `json:"lookup_outcome"`
	LookupOutcomeMessage      string  `json:"lookup_outcome_message"`
	NationalFormatNumber      string  `json:"national_format_number"`
	OriginalCarrier           Carrier `json:"original_carrier"`
	Ported                    string  `json:"ported"`
	Reachable                 string  `json:"reachable"`
	Roaming                   string  `json:"roaming"`
	Status                    bool    `json:"status"`
	StatusMessage             string  `json:"status_message"`
	ValidNumber               string  `json:"valid_number"`

type LookupMnpResponse

type LookupMnpResponse struct {
	Code    int64   `json:"code"`
	Mnp     Mnp     `json:"mnp"`
	Price   float64 `json:"price"`
	Success bool    `json:"success"`

type LookupParams

type LookupParams struct {
	Type   string `json:"type"`
	Number string `json:"number,omitempty"`
	Json   bool   `json:"json,omitempty"`

type LookupResource

type LookupResource resource

func (*LookupResource) Post

func (api *LookupResource) Post(p LookupParams) (interface{}, error)

func (*LookupResource) PostContext

func (api *LookupResource) PostContext(ctx context.Context, p LookupParams) (interface{}, error)

type Mnp

type Mnp struct {
	Country                string `json:"country"`
	InternationalFormatted string `json:"international_formatted"`
	IsPorted               bool   `json:"isPorted"`
	Mccmnc                 string `json:"mccmnc"`
	NationalFormat         string `json:"national_format"`
	Network                string `json:"network"`
	Number                 string `json:"number"`

type Options

type Options struct {
	ApiKey   string
	Debug    bool
	SentWith string

type PricingApiParams

type PricingApiParams struct {
	Format PricingFormat `json:"format,omitempty"`

type PricingCsvColumn

type PricingCsvColumn int
const (
	PricingColumnCountryCode PricingCsvColumn = iota

type PricingCsvHeader

type PricingCsvHeader int
const (
	PricingHeaderCountryCode PricingCsvHeader = iota

type PricingFormat

type PricingFormat string
const (
	PricingFormatCsv  PricingFormat = "csv"
	PricingFormatJson PricingFormat = "json"

type PricingParams

type PricingParams struct {
	Country string `json:"country,omitempty"`

type PricingResource

type PricingResource resource

func (*PricingResource) Csv

func (api *PricingResource) Csv(p PricingParams) (string, error)

func (*PricingResource) CsvContext

func (api *PricingResource) CsvContext(ctx context.Context, p PricingParams) (string, error)

func (*PricingResource) Json

func (*PricingResource) JsonContext

func (api *PricingResource) JsonContext(ctx context.Context, p PricingParams) (*PricingResponse, error)

type PricingResponse

type PricingResponse struct {
	CountCountries int64            `json:"countCountries"`
	CountNetworks  int64            `json:"countNetworks"`
	Countries      []CountryPricing `json:"countries"`

type Sms77API

type Sms77API struct {

	Analytics        *AnalyticsResource
	Balance          *BalanceResource
	Contacts         *ContactsResource
	Hooks            *HooksResource
	Journal          *JournalResource
	Lookup           *LookupResource
	Pricing          *PricingResource
	Sms              *SmsResource
	Status           *StatusResource
	ValidateForVoice *ValidateForVoiceResource
	Voice            *VoiceResource
	// contains filtered or unexported fields

func New

func New(options Options) *Sms77API

type SmsBaseParams

type SmsBaseParams struct {
	Debug               bool      `json:"debug,omitempty"`
	Delay               string    `json:"delay,omitempty"`
	Files               []SmsFile `json:"files,omitempty"`
	Flash               bool      `json:"flash,omitempty"`
	ForeignId           string    `json:"foreign_id,omitempty"`
	From                string    `json:"from,omitempty"`
	Label               string    `json:"label,omitempty"`
	NoReload            bool      `json:"no_reload,omitempty"`
	PerformanceTracking bool      `json:"performance_tracking,omitempty"`
	Text                string    `json:"text"`
	To                  string    `json:"to"`
	Ttl                 int64     `json:"ttl,omitempty"`
	Udh                 string    `json:"udh,omitempty"`
	Unicode             bool      `json:"unicode,omitempty"`
	Utf8                bool      `json:"utf8,omitempty"`

type SmsFile

type SmsFile struct {
	Contents string  `json:"contents"`
	Name     string  `json:"name"`
	Validity *uint8  `json:"validity,omitempty"`
	Password *string `json:"password,omitempty"`

type SmsResource

type SmsResource resource

func (*SmsResource) Json

func (api *SmsResource) Json(p SmsBaseParams) (o *SmsResponse, err error)

func (*SmsResource) JsonContext

func (api *SmsResource) JsonContext(ctx context.Context, p SmsBaseParams) (o *SmsResponse, err error)

func (*SmsResource) Text

func (api *SmsResource) Text(p SmsTextParams) (res *string, err error)

func (*SmsResource) TextContext

func (api *SmsResource) TextContext(ctx context.Context, p SmsTextParams) (res *string, err error)

type SmsResponse

type SmsResponse struct {
	Debug      string               `json:"debug"`
	Balance    float64              `json:"balance"`
	Messages   []SmsResponseMessage `json:"messages"`
	SmsType    string               `json:"sms_type"`
	Success    StatusCode           `json:"success"`
	TotalPrice float64              `json:"total_price"`

type SmsResponseMessage

type SmsResponseMessage struct {
	Encoding  string    `json:"encoding"`
	Error     *string   `json:"error"`
	ErrorText *string   `json:"error_text"`
	Id        *string   `json:"id"`
	Label     *string   `json:"label"`
	Messages  *[]string `json:"messages,omitempty"`
	Parts     int64     `json:"parts"`
	Price     float64   `json:"price"`
	Recipient string    `json:"recipient"`
	Sender    string    `json:"sender"`
	Success   bool      `json:"success"`
	Text      string    `json:"text"`

type SmsTextParams

type SmsTextParams struct {
	Details         bool `json:"details,omitempty"`
	ReturnMessageId bool `json:"return_msg_id,omitempty"`

type Status

type Status struct {
	Code     string
	DateTime string

type StatusCode

type StatusCode string

type StatusParams

type StatusParams struct {
	MessageId uint64 `json:"msg_id"`

type StatusResource

type StatusResource resource

func (*StatusResource) Json

func (api *StatusResource) Json(p StatusParams) (o *Status, e error)

func (*StatusResource) Text

func (api *StatusResource) Text(p StatusParams) (*string, error)

func (*StatusResource) TextContext

func (api *StatusResource) TextContext(ctx context.Context, p StatusParams) (*string, error)

type ValidateForVoiceParams

type ValidateForVoiceParams struct {
	Callback string `json:"callback"`
	Number   string `json:"number"`

type ValidateForVoiceResource

type ValidateForVoiceResource resource

func (*ValidateForVoiceResource) Get

func (*ValidateForVoiceResource) GetContext

type ValidateForVoiceResponse

type ValidateForVoiceResponse struct {
	Code            string  `json:"code"`
	Error           *string `json:"error"`
	FormattedOutput *string `json:"formatted_output"`
	Id              *int64  `json:"id"`
	Sender          string  `json:"sender"`
	Success         bool    `json:"success"`
	Voice           bool    `json:"voice"`

type Voice

type Voice struct {
	Code int
	Cost float64
	Id   int

type VoiceParams

type VoiceParams struct {
	Debug bool   `json:"debug,omitempty"`
	To    string `json:"to"`
	Text  string `json:"text"`
	Xml   bool   `json:"xml,omitempty"`
	From  string `json:"from,omitempty"`

type VoiceResource

type VoiceResource resource

func (*VoiceResource) Json

func (api *VoiceResource) Json(p VoiceParams) (o Voice, e error)

func (*VoiceResource) Text

func (api *VoiceResource) Text(p VoiceParams) (*string, error)

func (*VoiceResource) TextContext

func (api *VoiceResource) TextContext(ctx context.Context, p VoiceParams) (*string, error)

Jump to

Keyboard shortcuts

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