ballerinax/nytimes.books Ballerina library

1.5.1

Overview

This is a generated connector for New York Times Books API v3.0.0 OpenAPI specification.

The Books API provides information about book reviews and The New York Times bestsellers lists. For additional help getting started with the API, visit New York Times Books API.

Prerequisites

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

Quickstart

To use the New York Times Books connector in your Ballerina application, update the .bal file as follows:

Step 1: Import connector

Import the ballerinax/nytimes.books module into the Ballerina project.

Copy
import ballerinax/nytimes.books as books;

Step 2: Create a new connector instance

You can initialize the client as follows. You can now provide the API key obtained from the NYTimes Developer Portal in the configuration.

Copy
books:ApiKeysConfig config = {
    apiKey: "<API_KEY>"
}
books:Client baseClient = check new Client(config);

Step 3: Invoke connector operation

  1. You can use this function to get list of all the New York Times Best Sellers Lists. Some lists are published weekly and others monthly. The response includes when each list was first published and last published.
    Copy
    books:InlineResponse2002 listsBestSellersHistoryJson = check baseClient->getListsFormat("json");
    if (listsBestSellersHistoryJson is books:InlineResponse2002) {
        books:InlineResponse2002Results[]? Results = listsBestSellersHistoryJson?.results;
        if !(Results is ()) {
            foreach var result in Results {
                log:printInfo(result.toString() + "\n");
            }
        }
    }
  2. Use bal run command to compile and run the Ballerina program

Import

import ballerinax/nytimes.books;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

Lifestyle & Entertainment/News & Lifestyle

Cost/Free


Contributors

Other versions

See more...