Vonage / vonage-node-sdk

Vonage API client for Node.js. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
Apache License 2.0
374 stars 178 forks source link

RequestResponseStatusCode enum is wrong in types #649

Closed eljass closed 1 year ago

eljass commented 2 years ago

Expected Behavior

We are expecting the enums here to match status codes on https://api.support.vonage.com/hc/en-us/articles/360025561931-What-do-the-Verify-API-response-codes-mean-

Current Behavior

Currently the status codes are wrong in:

export enum RequestResponseStatusCode {
    Success = "0",
    Throttled = "1",
    MissingParameters = "2",
    InvalidCredentials = "3",
    InternalError = "4",
    NotProcessed = "5",
    BlackListedNumber = "6",
    BlockedAccount = "7",
    QuotaExceeded = "8",
    ConcurrentVerificationNumber = "9",
    TargetNetworkNotSupported = "10",
    WrongVerificationCode = "11",
    TooManyRequests = "12",
    NoMoreEvents = "13",
    NoRequestFound = "14",
}

Possible Solution

Update the typings:

export enum RequestResponseStatusCode {
    Success = "0",
    Throttled = "1",
    MissingParameters = "2",
    InvalidParameters = "3",
    InvalidCredentials = "4",
    InternalError = "5",
    NotProcessed = "6",
    BlackListedNumber = "7",
    BlockedAccount = "8",
    QuotaExceeded = "9",
    ConcurrentVerificationNumber = "10",
    TargetNetworkNotSupported = "15",
    WrongVerificationCode = "16",
    TooManyRequests = "17",
    TooManyRequestIds = "18",
    NoMoreEvents = "19",
    NoRequestFound = "101"
}

To make this even better, these enums could be exported in a .ts file so we don't have to create our own representation of these when we are trying to access them in runtime.

Context

We map error notifications for customers based on these status codes. Therefore it is better that they are up to date.

Your Environment

manchuck commented 1 year ago

@eljass V3 of the SDK should now have the correct types. Can you please check if you're still having an issue?