Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

edit response sms-api code #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 41 additions & 37 deletions sms.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,47 +114,51 @@ func (c ResponseCode) String() string {
}

// Possible response codes
// https://developer.nexmo.com/api-errors/sms updated at 2019-08-01
const (
ResponseSuccess ResponseCode = iota
ResponseThrottled
ResponseMissingParams
ResponseInvalidParams
ResponseInvalidCredentials
ResponseInternalError
ResponseInvalidMessage
ResponseNumberBarred
ResponsePartnerAcctBarred
ResponsePartnerQuotaExceeded
ResponseUnused //This is not used yet.Left blank by Nexmo for the time being.
ResponseRESTNotEnabled
ResponseMessageTooLong
ResponseCommunicationFailed
ResponseInvalidSignature
ResponseInvalidSenderAddress
ResponseInvalidTTL
ResponseFacilityNotAllowed
ResponseInvalidMessageClass
ResponseSuccess ResponseCode = 0
ResponseThrottled ResponseCode = 1
ResponseMissingParams ResponseCode = 2
ResponseInvalidParams ResponseCode = 3
ResponseInvalidCredentials ResponseCode = 4
ResponseInternalError ResponseCode = 5
ResponseInvalidMessage ResponseCode = 6
ResponseNumberBarred ResponseCode = 7
ResponsePartnerAcctBarred ResponseCode = 8
ResponsePartnerQuotaViolation ResponseCode = 9
ResponseTooManyExistBinds ResponseCode = 10
ResponseRESTNotEnabled ResponseCode = 11
ResponseMessageTooLong ResponseCode = 12
ResponseInvalidSignature ResponseCode = 14
ResponseInvalidSenderAddress ResponseCode = 15
ResponseInvalidNetworkCode ResponseCode = 22
ResponseInvalidCallbackUrl ResponseCode = 23
ResponseNonWhitelisted ResponseCode = 29
ResponseSignatureAPIDisallowed ResponseCode = 32
ResponseNumberDeactivated ResponseCode = 33
)

var responseCodeMap = map[ResponseCode]string{
ResponseSuccess: "Success",
ResponseThrottled: "Throttled",
ResponseMissingParams: "Missing params",
ResponseInvalidParams: "Invalid params",
ResponseInvalidCredentials: "Invalid credentials",
ResponseInternalError: "Internal error",
ResponseInvalidMessage: "Invalid message",
ResponseNumberBarred: "Number barred",
ResponsePartnerAcctBarred: "Partner account barred",
ResponsePartnerQuotaExceeded: "Partner quota exceeded",
ResponseRESTNotEnabled: "Account not enabled for REST",
ResponseMessageTooLong: "Message too long",
ResponseCommunicationFailed: "Communication failed",
ResponseInvalidSignature: "Invalid signature",
ResponseInvalidSenderAddress: "Invalid sender address",
ResponseInvalidTTL: "Invalid TTL",
ResponseFacilityNotAllowed: "Facility not allowed",
ResponseInvalidMessageClass: "Invalid message class",
ResponseSuccess: "Success",
ResponseThrottled: "Throttled",
ResponseMissingParams: "Missing params",
ResponseInvalidParams: "Invalid params",
ResponseInvalidCredentials: "Invalid credentials",
ResponseInternalError: "Internal error",
ResponseInvalidMessage: "Invalid message",
ResponseNumberBarred: "Number barred",
ResponsePartnerAcctBarred: "Partner account barred",
ResponsePartnerQuotaViolation: "Partner quota violation",
ResponseTooManyExistBinds: "Too many exist binds",
ResponseRESTNotEnabled: "Account not enabled for REST",
ResponseMessageTooLong: "Message too long",
ResponseInvalidSignature: "Invalid signature",
ResponseInvalidSenderAddress: "Invalid sender address",
ResponseInvalidNetworkCode: "Invalid network code",
ResponseInvalidCallbackUrl: "Invalid callback url",
ResponseNonWhitelisted: "Non-whitelisted destination",
ResponseSignatureAPIDisallowed: "Signature and api secret disallowed",
ResponseNumberDeactivated: "Number De-activated",
}

// MessageReport is the "status report" for a single SMS sent via the Nexmo API
Expand Down