moceango

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2018 License: MIT Imports: 9 Imported by: 0

README

MoceanAPI Client Library for PHP

This is the Go library for use Mocean's API. To use this, you'll need a Mocean account. Sign up for free at moceanapi.com.

Installation

To install the client

go get "gopkg.in/MoceanAPI/mocean-sdk-go.v1"

Usage

Create a client with your API key and secret

import "gopkg.in/MoceanAPI/mocean-sdk-go.v1"

mocean := moceango.NewMoceanClient("apiKey", "apiSecret")

Available API

mocean.Sms().Send()             //Send SMS
mocean.Sms().getMsgStatus()     //Get Message Status
mocean.Account().getBalance()   //Get Account Balance
mocean.Account().getPricing()   //Get Account Pricing
mocean.Verify().sendCode()      //Send Verify Code
mocean.Verify().verifyCode()    //Check Verify Code

Example

import "gopkg.in/MoceanAPI/mocean-sdk-go.v1"

mocean := moceango.NewMoceanClient(testParams["apiKey"], testParams["apiSecret"])

message := &moceango.Message{
	From: "Mocean",
	To:   "60123456789",
	Text: "testing",
}

res, err := mocean.Sms().Send(message)
if err != nil {
	fmt.println(err)
} else {
	fmt.println("Msgid: " + res.Messages[0].Msgid)
}

License

This library is released under the MIT License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BalanceResponse

type BalanceResponse struct {
	Status  int     `json:"status"`
	Balance float64 `json:"value"`
}

type ErrorResponse

type ErrorResponse struct {
	Status   int    `json:"status"`
	ErrorMsg string `json:"err_msg"`
}

type Message

type Message struct {
	From     string
	To       string
	Text     string
	Udh      string
	Coding   string
	Dlrmask  string
	Dlrurl   string
	Schedule string
	Mclass   string
	Altdcs   string
	Charset  string
	Validity string
}

type Mocean

type Mocean struct {
	ApiKey    string
	ApiSecret string

	BaseUrl    string
	HTTPClient *http.Client
}

func NewMoceanClient

func NewMoceanClient(apiKey, apiSecret string) *Mocean

func (*Mocean) Account

func (mocean *Mocean) Account() *account

Account Constructor

func (*Mocean) Sms

func (mocean *Mocean) Sms() *sms

SMS constructor

func (*Mocean) Verify

func (mocean *Mocean) Verify() *verify

Verify Constructor

type MsgStatusResponse

type MsgStatusResponse struct {
	Status         int     `json:"status"`
	MessageStatus  int     `json:"message_status"`
	Msgid          string  `json:"msgid"`
	CreditDeducted float64 `json:"credit_deducted"`
}

type PricingResponse

type PricingResponse struct {
	Status       int `json:"status"`
	Destinations []struct {
		Country  string  `json:"country"`
		Operator string  `json:"operator"`
		Mcc      string  `json:"mcc"`
		Mnc      string  `json:"mnc"`
		Price    float64 `json:"price"`
		Currency string  `json:"currency"`
	} `json:"destinations"`
}

type SendSMSResponse

type SendSMSResponse struct {
	Messages []struct {
		Status   int    `json:"status"`
		Receiver string `json:"receiver"`
		Msgid    string `json:"msgid"`
	} `json:"messages"`
}

type VerifyCodeParams

type VerifyCodeParams struct {
	Reqid string
	Code  string
}

type VerifyCodeResponse

type VerifyCodeResponse struct {
	Reqid    string
	Status   string
	Price    string
	Currency string
}

type VerifyReqParams

type VerifyReqParams struct {
	To            string
	Brand         string
	From          string
	Codelength    string
	PinValidity   string
	NextEventWait string
}

type VerifyReqResponse

type VerifyReqResponse struct {
	Status string
	Reqid  string
}

Jump to

Keyboard shortcuts

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