
Security News
GitHub Actions Pricing Whiplash: Self-Hosted Actions Billing Change Postponed
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.
axios-interface
Advanced tools
axios-interface helps you to define api, along with its type.
English | 中文
yarn add axios-interface
axios-interface separate api into 3 stage: factory => interface => call. In each stage, you can pass in some options.
import {createFactory} from 'axios-interface';
// factory
const {createInterface} = createFactory(options);
// interface
interface Params {
companyId: string;
keyword?: string;
}
interface User {
name: string;
}
const getUsers = createInterface<Params, User[]>('GET', '/rest/companies/{companyId}/users', options);
// call
const result = await getUsers({companyId: '1', keyword: 'jack'}); // GET /rest/companies/1/users?keyword=jack
interface Options extends AxiosRequestConfig {
onPending?: OnPending;
onResolve?: OnResolve;
onReject?: OnReject;
interpolate?: RegExp; // Default as /{(\w+)}/g
encodePathVariable?: boolean; // Parse variable like `a/b` into `a%2fb`. Default as false
transformDeleteParamsIntoBody?: boolean; // Change the way to treat with `params` when `DELETE`. Default as false.
/**
* Some axios options such as headers.
* Or whatever custom options you want. They will pass through 3 stages.
*/
[whatever: string]: any;
}
// Some types can be imported as `import {OnPending} from 'axios-interface'`
type OnPending = <TParams>(params: TParams, options: Options) => Options | Promise<Options>;
type OnResolve = <TParams>(response: AxiosResponse, params: TParams, options: Options) => any;
type OnReject = <TParams>(response: AxiosError, params: TParams, options: Options) => any;
NOTE: you can use all the configs of axios.
// options with same key will be covered.
const {createInterface} = createFactory(options);
const getUsers = createInterface(method, urlTemplate, options);
const result = getUsers(params);
when call => onPending => transformRequest(axios) => Browsers => transformResponse(axios) => onResolve | onReject => return
you can inject anything into options. In onPending, onResolve, onReject, options will be sent back, then you can do the logic with options and your custom onex.
These options take effect only in createFactory
These options take effect in createFactory and createInterface, not in request
These options take effect in createFactory, createInterface and request
FAQs
create interface from axios
The npm package axios-interface receives a total of 20 weekly downloads. As such, axios-interface popularity was classified as not popular.
We found that axios-interface demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.