ballerinax/openair Ballerina library

1.5.1

Overview

This is a generated connector for OpenAir API v1.0 OpenAPI specification. The OpenAir REST API provides an interface for integration applications to exchange information with OpenAir. OpenAir REST API currently supports the following resources: Expense reports, Receipts, Attachments, Job codes, Contacts

Prerequisites

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

Quickstart

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

Step 1: Import connector

First, import the ballerinax/openair module into the Ballerina project.

Copy
import ballerinax/openair;

Step 2: Create a new connector instance

Create a openair:ClientConfig with bearer token obtained, then initialize the connector with it and the service URL according to the OpenAir REST API guide.

Copy
configurable http:BearerTokenConfig & readonly authConfig = ?;
openair:ClientConfig clientConfig = {auth : authConfig};
openair:Client baseClient = check new Client(clientConfig, serviceUrl = "<Service URL>");

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 to get a list of contacts using the connector.

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

Import

import ballerinax/openair;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: 2

Current verison: 0


Weekly downloads


Source repository


Keywords

Productivity/Project Management

Cost/Paid


Contributors

Other versions

See more...