Skip to content

Joralmo/deno-wrapper-novelcovid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wrapper of novelCOVID API for Deno

All Contributors

Wrapper of covid-19 API for easy use in deno

deno documentation chat

Usage

All methods return a promise

For more documentation see the Doc

import { Wrapper } from 'https://deno.land/x/novelcovid_wrapper/mod.ts';

const wrapper = new Wrapper();

wrapper
    .country('co')
    .then((data) => console.log(data)); // Print data of colombia

Countries

/**
 * Get all affected countries data
 * Return and object of type Countries like { data: [Country] }
 */
wrapper
    .countries()
    .then((data) => console.log(data));

/**
 * Get all affected countries ordered data (order by country, cases, todayCases, deaths, todayDeaths, ...)
 * Return and object of type Countries like { data: [Country] }
 */
wrapper
    .countries({ sort: 'country' })
    .then((data) => console.log(data));

/**
 * Get yesterday data of affected countries
 * Return and object of type Countries like { data: [Country] }
 */
wrapper
    .countries({ yesterday: true })
    .then((data) => console.log(data));

/**
 * Get data of continents
 * Return and object of type Countries like { data: [Country] }
 * the data can be ordered sending { sort: 'continent' }
 */
wrapper
    .continents()
    .then((data) => console.log(data));

Continents

/**
 * Get data of continents
 * Return and object of type Countries like { data: [Continent] }
 */
wrapper
    .continents()
    .then((data) => console.log(data));


/**
 * Get data of specific continent
 */
wrapper
    .continent('North America')
    .then((data) => console.log(data));

States

/**
 * Get data of states
 */
wrapper
    .states()
    .then((data) => console.log(data));

/**
 * Get data of specific state
 */
wrapper
    .state('Northern Mariana Islands')
    .then((data) => console.log(data));

Historical

/**
 * Get all historical list
 */
wrapper
    .historical()
    .then((d: any) => console.log(d));

/**
 * Get all historical for a country
 */
wrapper
    .historical({ country: 'USA' })
    .then((d: any) => console.log(d));

/**
 * Get all historical for a province
 */
wrapper
    .historical({ country: 'China', province: 'guangdong' })
    .then((d: any) => console.log(d));

/**
 * Get 5 last days of historical for a province (also works for the country history)
 */
wrapper
    .historical({ country: 'China', province: 'guangdong', days: 5 })
    .then((d: any) => console.log(d));

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Masumi Kawasaki

📖

EndersonPro

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

About

Wrapper de NovelCOVID/API para Deno.land

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •