hapic
Version:
A http api client based on axios.
19 lines (18 loc) • 667 B
TypeScript
import type { AuthorizationHeaderType } from './constants';
export interface AbstractAuthorizationHeader {
type: `${AuthorizationHeaderType}`;
}
export interface BearerAuthorizationHeader extends AbstractAuthorizationHeader {
type: 'Bearer';
token: string;
}
export interface BasicAuthorizationHeader extends AbstractAuthorizationHeader {
type: 'Basic';
username: string;
password: string;
}
export interface APIKeyAuthorizationHeader extends AbstractAuthorizationHeader {
type: 'API-Key' | 'X-API-Key';
key: string;
}
export type AuthorizationHeader = BasicAuthorizationHeader | BearerAuthorizationHeader | APIKeyAuthorizationHeader;