verihubsgo

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VerihubsSuccess        = 200
	VerihubsSuccessRequest = 201
	VerihubsBadRequest     = 400
	VerihubsForbidden      = 403
	VerihubsConflict       = 409
	VerihubsTooManyReq     = 429
	VerihubsInternalError  = 500
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	APIEnvType EnvironmentType
	AppId      string
	AppKey     string
	LogLevel   int
}

Client struct

func NewClient

func NewClient() Client

NewClient : this function will always be called when the library is in use

func (*Client) ExecuteRequest

func (c *Client) ExecuteRequest(req *http.Request, v interface{}) (httpStatus int, err error)

ExecuteRequest : execute request

func (*Client) NewRequest

func (c *Client) NewRequest(method string, fullPath string, body io.Reader) (*http.Request, error)

NewRequest : send new request

type EnvironmentType

type EnvironmentType int8

EnvironmentType value

const (

	// Sandbox : represent sandbox environment
	Sandbox EnvironmentType

	// Production : represent production environment
	Production
)

func (EnvironmentType) CreateMiscallVerifyUrl

func (e EnvironmentType) CreateMiscallVerifyUrl() string

CreateMisscallVerifyURL : Create Misscall verify URL

func (EnvironmentType) CreateMiscalllUrl

func (e EnvironmentType) CreateMiscalllUrl() string

CreateMisscallURL : Create Misscall URL

func (EnvironmentType) CreateSmsOtpURL

func (e EnvironmentType) CreateSmsOtpURL() string

CreateSmsOtpURL : Create SMSOTP URL

func (EnvironmentType) CreateSmsOtpVerifyURL

func (e EnvironmentType) CreateSmsOtpVerifyURL() string

CreateSmsOtpVerifyURL : Create VERIFY URL

func (EnvironmentType) CreateWhatsappOtpURL

func (e EnvironmentType) CreateWhatsappOtpURL() string

CreateWhatsappOtpURL : Create SMSOTP URL

func (EnvironmentType) CreateWhatsappOtpVerifyURL

func (e EnvironmentType) CreateWhatsappOtpVerifyURL() string

CreateWhatsappOtpVerifyURL : Create VERIFY URL

func (EnvironmentType) String

func (e EnvironmentType) String() string

implement stringer

type FlexInt

type FlexInt int

A FlexInt is an int that can be unmarshalled from a JSON field that has either a number or a string value. E.g. if the json field contains an string "42", the FlexInt value will be "42".

func (*FlexInt) UnmarshalJSON

func (fi *FlexInt) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface, which allows us to ingest values of any json type as an int and run our custom conversion

type SmsGateway

type SmsGateway struct {
	Client Client
}

SmsGateway struct

func (*SmsGateway) RequestMiscallOtp

func (gateway *SmsGateway) RequestMiscallOtp(req *VerihubsMisscallOtpRequest) (response *VerihubsMisscallOtpResponse, err error)

RequestMiscallOtp request miscall for OTP

func (*SmsGateway) RequestMiscallVerifyOtp

func (gateway *SmsGateway) RequestMiscallVerifyOtp(req *VerihubsOtpVerifyRequest) (response *VerihubsOtpVerifyResponse, err error)

RequestMiscallOtp request miscall for OTP

func (*SmsGateway) SendSmsOtp

func (gateway *SmsGateway) SendSmsOtp(req *VerihubsSmsOtpRequest) (response *VerihubsSmsOtpResponse, err error)

SendSmsOtp send sms for OTP

func (*SmsGateway) SendWhatsAppOtp

func (gateway *SmsGateway) SendWhatsAppOtp(req *VerihubsWhatsappOtpRequest) (response *VerihubsWhatsappOtpResponse, err error)

func (*SmsGateway) VerifyOtp

func (gateway *SmsGateway) VerifyOtp(req *VerihubsOtpVerifyRequest) (response *VerihubsOtpVerifyResponse, err error)

VerifySmsOtp Verify SMS OTP

func (*SmsGateway) VerifySmsOtp

func (gateway *SmsGateway) VerifySmsOtp(req *VerihubsOtpVerifyRequest) (response *VerihubsOtpVerifyResponse, err error)

VerifySmsOtp Verify SMS OTP

type VerihubsMisscallOtpRequest

type VerihubsMisscallOtpRequest struct {
	MSISDN    string `json:"msisdn"`
	OTP       string `json:"otp"`
	TimeLimit string `json:"time_limit"`
	Challenge string `json:"challenge"`
}

VerihubsMiscallOtpRequest Verihubs misscallOTP Request

type VerihubsMisscallOtpResponse

type VerihubsMisscallOtpResponse struct {
	Data struct {
		SessionId string `json:"id"`
		Status    int    `json:"status"`
		FlashCall string `json:"flashcall_prefix"`
	}
	Code        int    `json:"code"`
	Message     string `json:"message"`
	ErrorStatus bool   `json:"-"`
}

VerihubsSmsOtpResponse Verihubs SMSOTP Response

func (VerihubsMisscallOtpResponse) Error

type VerihubsOtpVerifyRequest

type VerihubsOtpVerifyRequest struct {
	OTP       string `json:"otp"`
	MSISDN    string `json:"msisdn"`
	Challenge string `json:"challenge"`
}

VerifySmsOtpVerihubs

type VerihubsOtpVerifyResponse

type VerihubsOtpVerifyResponse struct {
	Code        int    `json:"code"`
	Message     string `json:"message"`
	ErrorStatus bool   `json:"-"`
}

VerihubsSmsOtpVerifyResponse Verihubs SMSOTP Verify Response

func (VerihubsOtpVerifyResponse) Error

type VerihubsSmsOtpRequest

type VerihubsSmsOtpRequest struct {
	MSISDN    string `json:"msisdn"`
	Template  string `json:"template"`
	OTP       string `json:"otp"`
	TimeLimit string `json:"time_limit"`
	Challenge string `json:"challenge"`
}

VerihubsSmsOtpRequest Verihubs SMSOTP Request

type VerihubsSmsOtpResponse

type VerihubsSmsOtpResponse struct {
	Code         int    `json:"code"`
	Message      string `json:"message"`
	OTP          string `json:"otp"`
	MSISDN       string `json:"msisdn"`
	SessionId    string `json:"session_id"`
	TryCount     int    `json:"try_count"`
	SegmentCount int    `json:"segment_count"`
	ErrorStatus  bool   `json:"-"`
}

VerihubsSmsOtpResponse Verihubs SMSOTP Response

func (VerihubsSmsOtpResponse) Error

func (e VerihubsSmsOtpResponse) Error() string

type VerihubsWhatsappOtpRequest

type VerihubsWhatsappOtpRequest struct {
	MSISDN string `json:"msisdn"`
	//Content      []string `json:"content"`
	OTP          string `json:"otp"`
	TimeLimit    string `json:"time_limit"`
	Challenge    string `json:"challenge"`
	LangCode     string `json:"lang_code"`
	TemplateName string `json:"template_name"`
}

VerihubsWhatsappOtpRequest Verihubs SMSOTP Request

type VerihubsWhatsappOtpResponse

type VerihubsWhatsappOtpResponse struct {
	Code        int    `json:"code"`
	Message     string `json:"message"`
	OTP         string `json:"otp"`
	MSISDN      string `json:"msisdn"`
	SessionId   string `json:"session_id"`
	TryCount    int    `json:"try_count"`
	ErrorStatus bool   `json:"-"`
}

VerihubsWhatsappOtpResponse Verihubs WhatsappOTP Response

func (VerihubsWhatsappOtpResponse) Error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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