@plastic-ant/lightcast-api
Version:
An unofficial helper package for accessing the Lightcast API endpoints
351 lines (350 loc) • 20.2 kB
TypeScript
/// <reference types="node" />
import axios, { AxiosRequestConfig, AxiosInstance, AxiosResponse } from "axios";
export interface RequestOptions<Q, R> extends Omit<AxiosRequestConfig<R>, "params"> {
params?: Q;
}
/**
* Client access values or token string
*/
export type CredentialsFunction = () => Promise<{
readonly client_id: string;
readonly client_secret: string;
readonly grant_type: string;
readonly scope: string;
} | string>;
export declare class LightcastAPIClient {
credentials?: CredentialsFunction | undefined;
readonly skills: {
baseUrl: string;
status: () => Promise<AxiosResponse<import("./lib/common-types").Response<import("./lib/common-types").Status>, any>>;
meta: () => Promise<AxiosResponse<import("./lib/common-types").Response, any>>;
versions: () => Promise<AxiosResponse<import("./lib/common-types").Response<string[]>, any>>;
version: (version?: string) => {
meta: <R = import("./lib/common-types").Response>() => Promise<AxiosResponse<R, any>>;
changes: <R_1 = import("./lib/common-types").Response>() => Promise<AxiosResponse<R_1, any>>;
listAll: <R_2 = import("./lib/common-types").Response, Q = {
q?: string | undefined;
limit?: number | undefined;
typeIds?: string | undefined;
fields?: string | undefined;
}>(params?: Q | undefined) => Promise<AxiosResponse<R_2, any>>;
listRequested: <R_3 = import("./lib/common-types").Response, B = {
ids: string[];
}>(body: B, params?: {
typeIds?: string | undefined;
fields?: string | undefined;
} | undefined) => Promise<AxiosResponse<R_3, any>>;
byId: <R_4 = import("./lib/common-types").Response>(id: string) => Promise<AxiosResponse<R_4, any>>;
findRelated: <R_5 = import("./lib/common-types").Response, B_1 = {
ids: string[];
limit?: number | undefined;
typeIds?: string | undefined;
fields?: string | undefined;
}>(body: B_1) => Promise<AxiosResponse<R_5, any>>;
extract: <R_6 = import("./lib/common-types").Response, B_2 = string | Buffer | {
text: string;
confidenceThreshold?: number | undefined;
}>(body: B_2, params?: {
language?: string | undefined;
confidenceThreshold?: number | undefined;
} | undefined) => Promise<AxiosResponse<R_6, any>>;
extractTrace: <R_7 = import("./lib/common-types").Response, B_3 = string | Buffer | {
text: string;
confidenceThreshold?: number | undefined;
}>(body: B_3, params?: {
language?: string | undefined;
includeNormalizedText: boolean;
} | undefined) => Promise<AxiosResponse<R_7, any>>;
};
};
readonly jpa: {
status: () => Promise<AxiosResponse<import("./lib/common-types").Response<import("./lib/common-types").Status>, any>>;
meta: <R = import("./lib/common-types").Response>() => Promise<AxiosResponse<R, any>>;
postings: {
byId: <R_1 = import("./lib/common-types").Response>(id: string, params?: import("./lib/jpa/common-types").QueryParameters | undefined) => Promise<AxiosResponse<R_1, any>>;
filtered: <R_2 = import("./lib/common-types").Response, B = unknown>(body: B, params?: import("./lib/jpa/common-types").QueryParameters | undefined) => Promise<AxiosResponse<R_2, any>>;
};
rankings: {
timeseries: {
byFacet: <R_3 = import("./lib/common-types").Response, B_1 = unknown>(facet: string, body: B_1, params?: import("./lib/jpa/common-types").QueryParameters | undefined) => Promise<AxiosResponse<R_3, any>>;
};
distributions: (distributionFacet: string) => {
byFacet: <R_4 = import("./lib/common-types").Response, B_2 = unknown>(facet: string, body: B_2, params?: import("./lib/jpa/common-types").QueryParameters | undefined) => Promise<AxiosResponse<R_4, any>>;
};
listAllFacets: <R_5 = import("./lib/common-types").Response<string[]>>() => Promise<AxiosResponse<R_5, any>>;
byNestedFacet: <R_6 = import("./lib/common-types").Response, B_3 = unknown>(facet: string, nestedFacet: string, body: B_3, params?: import("./lib/jpa/common-types").QueryParameters | undefined) => Promise<AxiosResponse<R_6, any>>;
byFacet: <R_7 = import("./lib/common-types").Response, B_4 = unknown>(facet: string, body: B_4, params?: import("./lib/jpa/common-types").QueryParameters | undefined) => Promise<AxiosResponse<R_7, any>>;
};
taxonomies: {
lookup: {
byFacet: <R_8 = import("./lib/common-types").Response, B_5 = {
ids: (string | number)[];
}>(facet: string, body: B_5, params?: import("./lib/jpa/common-types").QueryParameters | undefined) => Promise<AxiosResponse<R_8, any>>;
};
search: <R_9 = import("./lib/common-types").Response>(facet: string, params?: ({
q?: string | undefined;
autocomplete?: boolean | undefined;
limit?: number | undefined;
} & import("./lib/jpa/common-types").QueryParameters) | undefined) => Promise<AxiosResponse<R_9, any>>;
listAllFacets: <R_10 = import("./lib/common-types").Response<string[]>>() => Promise<AxiosResponse<R_10, any>>;
};
totals: <R_11 = import("./lib/common-types").Response, B_6 = unknown>(body: B_6, params?: import("./lib/jpa/common-types").QueryParameters | undefined) => Promise<AxiosResponse<R_11, any>>;
timeseries: <R_12 = import("./lib/common-types").Response, B_7 = unknown>(body: B_7, params?: import("./lib/jpa/common-types").QueryParameters | undefined) => Promise<AxiosResponse<R_12, any>>;
distributions: {
byFacet: <R_13 = import("./lib/common-types").Response, B_8 = unknown>(facet: string, body: B_8, params?: import("./lib/jpa/common-types").QueryParameters | undefined) => Promise<AxiosResponse<R_13, any>>;
listAllDimensions: <R_14 = import("./lib/common-types").Response>() => Promise<AxiosResponse<R_14, any>>;
};
};
readonly cajpa: {
status: () => Promise<AxiosResponse<import("./lib/common-types").Response<import("./lib/common-types").Status>, any>>;
meta: <R = import("./lib/common-types").Response>() => Promise<AxiosResponse<R, any>>;
postings: {
byId: <R_1 = import("./lib/common-types").Response>(id: string, params?: import("./lib/ca-jpa/common-types").QueryParameters | undefined) => Promise<AxiosResponse<R_1, any>>;
filtered: <R_2 = import("./lib/common-types").Response, B = unknown>(body: B, params?: import("./lib/ca-jpa/common-types").QueryParameters | undefined) => Promise<AxiosResponse<R_2, any>>;
};
rankings: {
timeseries: {
byFacet: <R_3 = import("./lib/common-types").Response, B_1 = unknown>(facet: string, body: B_1, params?: import("./lib/ca-jpa/common-types").QueryParameters | undefined) => Promise<AxiosResponse<R_3, any>>;
};
listAllFacets: <R_4 = import("./lib/common-types").Response<string[]>>() => Promise<AxiosResponse<R_4, any>>;
byNestedFacet: <R_5 = import("./lib/common-types").Response, B_2 = unknown>(facet: string, nestedFacet: string, body: B_2, params?: import("./lib/ca-jpa/common-types").QueryParameters | undefined) => Promise<AxiosResponse<R_5, any>>;
byFacet: <R_6 = import("./lib/common-types").Response, B_3 = unknown>(facet: string, body: B_3, params?: import("./lib/ca-jpa/common-types").QueryParameters | undefined) => Promise<AxiosResponse<R_6, any>>;
};
taxonomies: {
lookup: {
byFacet: <R_7 = import("./lib/common-types").Response, B_4 = {
ids: (string | number)[];
}>(facet: string, body: B_4, params?: import("./lib/ca-jpa/common-types").QueryParameters | undefined) => Promise<AxiosResponse<R_7, any>>;
};
search: <R_8 = import("./lib/common-types").Response>(facet: string, params?: ({
q?: string | undefined;
autocomplete?: boolean | undefined;
limit?: number | undefined;
} & import("./lib/ca-jpa/common-types").QueryParameters) | undefined) => Promise<AxiosResponse<R_8, any>>;
listAllFacets: <R_9 = import("./lib/common-types").Response<string[]>>() => Promise<AxiosResponse<R_9, any>>;
};
totals: <R_10 = import("./lib/common-types").Response, B_5 = unknown>(body: B_5, params?: import("./lib/ca-jpa/common-types").QueryParameters | undefined) => Promise<AxiosResponse<R_10, any>>;
timeseries: {
timeseries: <R_11 = import("./lib/common-types").Response, B_6 = unknown>(body: B_6, params?: import("./lib/ca-jpa/common-types").QueryParameters | undefined) => Promise<AxiosResponse<R_11, any>>;
};
distributions: {
byFacet: <R_12 = import("./lib/common-types").Response, B_7 = unknown>(facet: string, body: B_7, params?: import("./lib/ca-jpa/common-types").QueryParameters | undefined) => Promise<AxiosResponse<R_12, any>>;
listAllDimensions: <R_13 = import("./lib/common-types").Response<string[]>>() => Promise<AxiosResponse<R_13, any>>;
};
};
readonly classification: {
status: () => Promise<AxiosResponse<import("./lib/common-types").Response<import("./lib/common-types").Status>, any>>;
taxonomies: {
listAll: <R = import("./lib/common-types").Response>(params?: {
tags?: string | undefined;
} | undefined) => Promise<AxiosResponse<R, any>>;
meta: <R_1 = import("./lib/common-types").Response>(facet: string) => Promise<AxiosResponse<R_1, any>>;
versions: <R_2 = import("./lib/common-types").Response<string[]>>(facet: string) => Promise<AxiosResponse<R_2, any>>;
version: (version: string) => {
meta: <R_3 = import("./lib/common-types").Response>(facet: string) => Promise<AxiosResponse<R_3, any>>;
concepts: <R_4 = import("./lib/common-types").Response<import("type-fest").JsonValue[]>>(facet: string, params?: {
q?: string | undefined;
fields?: string | undefined;
filter?: string | undefined;
limit?: number | undefined;
after?: number | undefined;
locale?: string | undefined;
} | undefined) => Promise<AxiosResponse<R_4, any>>;
conceptsById: <R_5 = import("./lib/common-types").Response>(facet: string, id: string, params?: {
q?: string | undefined;
fields?: string | undefined;
filter?: string | undefined;
limit?: number | undefined;
after?: number | undefined;
locale?: string | undefined;
} | undefined) => Promise<AxiosResponse<R_5, any>>;
relations: <R_6 = import("./lib/common-types").Response, B = {
relationType: "child" | "sibling" | "any";
ids: string[];
filter?: import("type-fest").JsonObject | undefined;
}>(facet: string, body: B) => Promise<AxiosResponse<R_6, any>>;
};
};
mappings: {
meta: <R_7 = import("./lib/common-types").Response>(params?: {
filter?: string | undefined;
} | undefined) => Promise<AxiosResponse<R_7, any>>;
concepts: <R_8 = import("./lib/common-types").Response, B_1 = {
ids: string[];
}>(name: string, body: B_1) => Promise<AxiosResponse<R_8, any>>;
};
classifications: {
classifierReleases: <R_9 = import("./lib/common-types").Response>() => Promise<AxiosResponse<R_9, any>>;
/**
* Client access values or token string
*/
release: (release: string) => {
availableDataSourceTypes: <R_10 = import("./lib/common-types").Response>() => Promise<AxiosResponse<R_10, any>>;
operationsAvailableForSource: <R_11 = import("./lib/common-types").Response>(source: string) => Promise<AxiosResponse<R_11, any>>;
lotClassify: <R_12 = import("./lib/common-types").Response, B_2 = {
title: string;
limit?: number | undefined;
fields?: string[] | undefined;
description?: string | undefined;
}>(body: B_2) => Promise<AxiosResponse<R_12, any>>;
postingClassify: <R_13 = import("./lib/common-types").Response, B_3 = {
context: {
company: string;
title: string;
body: string;
};
outputs: string[];
}>(body: B_3) => Promise<AxiosResponse<R_13, any>>;
extractSkillsMeta: <R_14 = import("./lib/common-types").Response>() => Promise<AxiosResponse<R_14, any>>;
extractSkills: <R_15 = import("./lib/common-types").Response, B_4 = {
text: string;
confidenceThreshold: number;
trace: boolean;
inputLocale: string;
outputLocale: string;
}>(body: B_4) => Promise<AxiosResponse<R_15, any>>;
};
};
};
readonly careerPathways: {
status: () => Promise<AxiosResponse<import("./lib/common-types").Response<import("./lib/common-types").Status>, any>>;
meta: <R = import("./lib/common-types").Response>() => Promise<AxiosResponse<R, any>>;
dimensions: {
listAllFacets: <R_1 = import("./lib/common-types").Response<string[]>>() => Promise<AxiosResponse<R_1, any>>;
dimension: (facet: "soc" | "onet" | "lotocc" | "lotspecocc") => {
meta: <R_2 = import("./lib/common-types").Response>() => Promise<AxiosResponse<R_2, any>>;
feederJobs: <R_3 = import("./lib/common-types").Response, B = {
id: string;
responseIds?: string[] | undefined;
categories?: string[] | undefined;
limit?: number | undefined;
region?: {
nation: string;
level?: string | undefined;
id?: string | undefined;
} | undefined;
}>(body: B) => Promise<AxiosResponse<R_3, any>>;
nextStepJobs: <R_4 = import("./lib/common-types").Response, B_1 = {
id: string;
responseIds?: string[] | undefined;
categories?: string[] | undefined;
limit?: number | undefined;
region?: {
nation: string;
level?: string | undefined;
id?: string | undefined;
} | undefined;
}>(body: B_1) => Promise<AxiosResponse<R_4, any>>;
skillGap: <R_5 = import("./lib/common-types").Response, B_2 = {
sourceId: string;
destinationId: string;
limit?: number | undefined;
region?: {
nation: string;
level?: string | undefined;
id?: string | undefined;
} | undefined; /**
*
* @param resource
* @param body
* @param options
* @returns
*/
}>(body: B_2) => Promise<AxiosResponse<R_5, any>>;
bulk: <R_6 = import("./lib/common-types").Response, B_3 = {
id: string;
responseIds?: string[] | undefined;
categories?: string[] | undefined;
limit?: number | undefined;
region?: {
nation: string;
level?: string | undefined;
id?: string | undefined;
} | undefined;
}>(body: B_3) => Promise<AxiosResponse<R_6, any>>;
};
};
};
readonly salaryBoostingSkills: {
status: () => Promise<AxiosResponse<import("./lib/common-types").Response<import("./lib/common-types").Status>, any>>;
meta: <R = import("./lib/common-types").Response>() => Promise<AxiosResponse<R, any>>;
listAllDimensions: <R_1 = import("./lib/common-types").Response<string[]>>(params?: {
tags?: string | undefined;
} | undefined) => Promise<AxiosResponse<R_1, any>>;
dimensions: (dimension: string) => {
meta: <R_2 = import("./lib/common-types").Response>() => Promise<AxiosResponse<R_2, any>>;
salaryBoostingSkills: <R_3 = import("./lib/common-types").Response, B = {
id: string;
}>(body: B) => Promise<AxiosResponse<R_3, any>>;
};
};
readonly ddn: {
status: () => Promise<AxiosResponse<import("./lib/common-types").Response<import("./lib/common-types").Status>, any>>;
meta: <R = import("./lib/common-types").Response>() => Promise<AxiosResponse<R, any>>;
listAllDimensions: <R_1 = import("./lib/common-types").Response<string[]>>(params?: {
tags?: string | undefined;
} | undefined) => Promise<AxiosResponse<R_1, any>>;
dimensions: (dimension: string) => {
meta: <R_2 = import("./lib/common-types").Response>() => Promise<AxiosResponse<R_2, any>>;
ddn: <R_3 = import("./lib/common-types").Response, B = {
id: string;
region?: {
nation: string;
level?: string | undefined;
id?: string | undefined;
} | undefined;
}>(body: B) => Promise<AxiosResponse<R_3, any>>;
};
};
readonly similarity: {
status: () => Promise<AxiosResponse<{
data: import("./lib/common-types").Status;
}, any>>;
meta: <R = import("type-fest").JsonValue>() => Promise<AxiosResponse<R, any>>;
listAllModels: (params?: {
tags?: string | undefined;
} | undefined) => Promise<AxiosResponse<{
data: string[];
}, any>>;
models: (model: string) => {
similarity: <R_1 = Response, B = {
input: string | string[];
filter?: {
ids?: string[] | undefined;
minScore?: number | undefined;
} | undefined;
limit: number;
}>(body: B) => Promise<AxiosResponse<R_1, any>>;
};
};
readonly utils: {
occupations: {
fromSkills: (skills: string[], options?: {} | undefined) => void;
};
};
readonly client: AxiosInstance;
private expiresIn;
/**
*
* @param credentials
* @param args - Axios constructor arguments
*/
constructor(credentials?: CredentialsFunction | undefined, ...args: Parameters<typeof axios.create>);
setCredentials(creds: CredentialsFunction): void;
private refreshToken;
/**
*
* @param resource
* @param options
* @returns
*/
get<Q, R>(resource: string, options?: RequestOptions<Q, void>): Promise<AxiosResponse<R, any>>;
/**
*
* @param resource
* @param body
* @param options
* @returns
*/
post<Q, B, R>(resource: string, body: B, options?: RequestOptions<Q, B>): Promise<AxiosResponse<R, any>>;
}