Socket
Socket
Sign inDemoInstall

@ackee/antonio-core

Package Overview
Dependencies
Maintainers
7
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ackee/antonio-core

A HTTP client built on fetch API with axios-like API.


Version published
Maintainers
7
Created
Source

ackee|Antonio

GitHub license CI Status PRs Welcome Dependency Status bundlephobia bundlephobia node version

@ackee/antonio-core

HTTP client built on Fetch API.

Table of contents


Install

yarn add @ackee/antonio-core -S

Usage

import { Antonio } from '@ackee/antonio-core';

const api = new Antonio({
    baseURL: 'https://jsonplaceholder.typicode.com/',
});

function* fetchTodos() {
    // Since api.get returns generator function, `yield*` is required.
    const { data, request, response } = yield* api.get('/todos', {
        params: {
            page: 1,
            limit: 20,
        },
    });
}

API

new Antonio(requestConfig?: RequestConfig, generalConfig?: GeneralConfig)

Creates a new instance of Antonio with custom request config and general config:

import { Antonio } from '@ackee/antonio-core';

const api = new Antonio({
    baseURL: 'https://some-domain.com/api/',
});
Instance methods
api.get(url: string, requestConfig?: RequestConfig): Generator<any, RequestResult>

api.delete(url: string, requestConfig?: RequestConfig): Generator<any, RequestResult>

api.head(url: string, requestConfig?: RequestConfig): Generator<any, RequestResult>

api.options(url: string, requestConfig?: RequestConfig): Generator<any, RequestResult>

api.post(url: string, data: RequestBody, requestConfig?: RequestConfig): Generator<any, RequestResult>

api.put(url: string, data: RequestBody, requestConfig?: RequestConfig): Generator<any, RequestResult>

api.patch(url: string, data: RequestBody, requestConfig?: RequestConfig): Generator<any, RequestResult>

generalConfig: GeneralConfig

Optional @ackee/antonio-core configuration:

{
    // Default is [`loglevel`](https://www.npmjs.com/package/loglevel)
    logger: loglevel,
}

Keywords

FAQs

Package last updated on 08 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc