Skip to content

refactor: enhance Axios type definitions in BaseAPI and OAuth2Configu… #600

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/versions/v1/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import type { Configuration } from './configuration';
// Some imports not used depending on template conditions
// @ts-ignore
import type { AxiosError, AxiosResponse, AxiosRequestConfig , InternalAxiosRequestConfig } from 'axios';
import type { AxiosError, AxiosResponse, AxiosRequestConfig , InternalAxiosRequestConfig, AxiosInstance } from 'axios';
import axios from 'axios';
import { join, dirname } from 'path';
import { existsSync } from 'fs';
Expand Down Expand Up @@ -95,7 +95,7 @@ export const errorInterceptor = (error: AxiosError) => {
export class BaseAPI {
protected configuration: Configuration | undefined;
protected basePath: string = BASE_PATH;
protected axios = axios.create();
protected axios: AxiosInstance = axios.create();
constructor(configuration: Configuration) {
if (configuration) {
this.configuration = configuration;
Expand Down
4 changes: 2 additions & 2 deletions src/versions/v1/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/


import axios from "axios";
import axios, { AxiosResponse } from "axios";
import { stringify } from "qs";
import { errorInterceptor, responseInterceptor, versionInterceptor } from './base';

Expand Down Expand Up @@ -186,7 +186,7 @@ export class OAuth2Configuration {
* Revoke Refresh Token aka marking an app uninstalled or revoke the Access Token.
* @param {String} tokenTypeHint values can be: 'access_token' or 'refresh_token'.
*/
public async revokeToken(tokenTypeHint?: 'access_token' | 'refresh_token') {
public async revokeToken(tokenTypeHint?: 'access_token' | 'refresh_token'): Promise<AxiosResponse<any, any>> {

const token = tokenTypeHint === 'refresh_token'
? this.refreshToken : encodeURIComponent(this.accessToken);
Expand Down
Loading