ballerinax/vonage.numbers Ballerina library

1.5.1

Overview

This is a generated connector for Vonage Numbers API v1.0.20 OpenAPI specification. The Numbers API enables you to manage your existing numbers and buy new virtual numbers for use with the Vonage APIs. Further information is here: https://developer.nexmo.com/numbers/overview

Prerequisites

Before using this connector in your Ballerina application, complete the following:

Quickstart

To use the Vonage Numbers connector in your Ballerina application, update the .bal file as follows:

Step 1: Import connector

First, import the ballerinax/vonage.numbers module into the Ballerina project.

Copy
import ballerinax/vonage.numbers as vn;

Step 2: Create a new connector instance

Create a numbers:ApiKeysConfig with the API key and API secret obtained, and initialize the connector with it.

Copy
vn:ApiKeysConfig config = {
    apiKey: "<API_KEY>",
    apiSecret: "<API_SECRET"
}
vn:Client baseClient = check new Client();

Step 3: Invoke connector operation

  1. Now you can use the operations available within the connector. Note that they are in the form of remote operations.

    Following is an example on how to list the numbers that you own programmatically using the connector.

    List Your Numbers

    Copy
    public function main() {
        InboundNumbers|error response = baseClient->getOwnedNumbers();
        if (response is InboundNumbers) {
            log:printInfo(response.toString());
        } else {
            log:printError(response.message());
        }
    }

    Following is an example on how to programmatically search for numbers that are available for purchase in a specific country using the connector. Provide the two digit country code for the number as a parameter. For example: GB for the United Kingdom.

    Search Available Numbers

    Copy
    public function main() {
        AvailableNumbers|error response = baseClient->getAvailableNumbers("GB");
        if (response is AvailableNumbers) {
            log:printInfo(response.toString());
        } else {
            log:printError(response.message());
        }
    }
  2. Use bal run command to compile and run the Ballerina program.

Import

import ballerinax/vonage.numbers;Copy

Metadata

Released date: 12 months ago

Version: 1.5.1

License: Apache-2.0


Compatibility

Platform: any

Ballerina version: 2201.4.1

GraalVM compatible: Yes


Pull count

Total: 0

Current verison: 0


Weekly downloads


Source repository


Keywords

Communication/Call Tracking

Cost/Paid


Contributors

Other versions

See more...