ballerinax/newsapi Ballerina library

1.5.1

Overview

This is a generated connector for News API v2.0.0 OpenAPI specification.

News API used to fetch news(articles, headlines and sources) from news sources and blogs across the web.

Prerequisites

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

Quickstart

Step 1: Import connector

Import the ballerinax/newsapi module into the Ballerina project.

Copy
import ballerinax/newsapi;

Step 2: Create a new connector instance

Copy
newsapi:ApiKeysConfig config = {
    apiKey : "<your apiKey>"
};

newsapi:Client myclient = check new newsapi:Client(config, {}, "https://newsapi.org/v2");

Step 3: Invoke connector operation

  1. You can get top headlines as follows with listTopHeadlines method by passing country as a parameter.
    Copy
    newsapi:WSNewsTopHeadlineResponse result = check myclient->listTopHeadlines(country="us");
  2. Use bal run command to compile and run the Ballerina program.

Import

import ballerinax/newsapi;Copy

Metadata

Released date: 10 months ago

Version: 1.5.1

License: Apache-2.0


Compatibility

Platform: any

Ballerina version: 2201.4.1

GraalVM compatible: Yes


Pull count

Total: 

Current verison: 295


Weekly downloads


Source repository


Keywords

Lifestyle & Entertainment/News & Lifestyle
Cost/Freemium

Contributors

Other versions

See more...