mirror of
https://github.com/LukeHagar/plexjs.git
synced 2025-12-06 04:20:46 +00:00
adjusted mustache files further
This commit is contained in:
@@ -41,7 +41,7 @@ export class BaseAPI {
|
||||
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.basePath = configuration.basePathV3 || this.basePath;
|
||||
this.basePath = configuration.basePath || this.basePath;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -40,41 +40,6 @@ export const setApiKeyToObject = async function (object: any, keyParamName: stri
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
|
||||
if (configuration && (configuration.username || configuration.password)) {
|
||||
object["auth"] = { username: configuration.username, password: configuration.password };
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
|
||||
if (configuration && configuration.accessToken) {
|
||||
const accessToken = typeof configuration.accessToken === 'function'
|
||||
? await configuration.accessToken()
|
||||
: await configuration.accessToken;
|
||||
object["Authorization"] = "Bearer " + accessToken;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
|
||||
if (configuration && configuration.accessToken) {
|
||||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
||||
? await configuration.accessToken(name, scopes)
|
||||
: await configuration.accessToken;
|
||||
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -126,8 +91,7 @@ export const toPathString = function (url: URL) {
|
||||
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
axiosRetry(globalAxios, configuration.retriesConfig)
|
||||
axiosArgs.axiosOptions.headers['X-SailPoint-SDK'] = 'typescript-{{npmVersion}}'
|
||||
const axiosRequestArgs = {...axiosArgs.axiosOptions, url: (configuration?.basePathV3 || basePath) + axiosArgs.url};
|
||||
const axiosRequestArgs = {...axiosArgs.axiosOptions, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||
return axios.request<T, R>(axiosRequestArgs);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -42,6 +42,14 @@ export class Configuration {
|
||||
*/
|
||||
formDataCtor?: new () => any;
|
||||
|
||||
/**
|
||||
* axios retry configuration
|
||||
*
|
||||
* @type {IAxiosRetryConfig}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
retriesConfig?: IAxiosRetryConfig
|
||||
|
||||
constructor(param: ConfigurationParameters = {}) {
|
||||
|
||||
this.apiKey = param.apiKey;
|
||||
|
||||
Reference in New Issue
Block a user