Skip to content
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

Update typescript definitions to match the latest SDK v3.0.2 #106

Merged
merged 3 commits into from
Nov 8, 2020
Merged
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
24 changes: 14 additions & 10 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@ import csrf from 'csrf';

declare class AuthResponse {
constructor(params: AuthResponse.AuthResponseParams);
processResponse(response: Object): void;
getToken(): Token;
text(): string;
status(): number;
headers(): Object;
valid(): boolean;
getJson(): Object;
get_intuit_tid(): string;
isContentType(): boolean;
getContentType(): string;
isJson(): boolean;

}

declare namespace AuthResponse {
Expand Down Expand Up @@ -43,13 +48,14 @@ declare class Token implements Token.TokenData {

declare namespace Token {
export interface TokenData {
realmId: string;
token_type: string;
access_token: string;
refresh_token: string;
realmId?: string;
token_type?: string;
access_token?: string;
refresh_token?: string;
expires_in: number;
x_refresh_token_expires_in: number;
id_token: string;
id_token?: string;
latency: number;
createdAt: string;
}
}
Expand All @@ -60,23 +66,19 @@ declare class OAuthClient {
authorizeUri(params: OAuthClient.AuthorizeParams): string;
createError(e: Error, authResponse?: AuthResponse): OAuthClient.OAuthClientError;
createToken(uri: string): Promise<AuthResponse>;
generateOauth1Sign(params: OAuthClient.GenerateOAuth1SignParams): string;
getKeyFromJWKsURI(id_token: string, kid: string, request: Request): Promise<object | string>;
getPublicKey(modulus: string, exponent: string): string;
getToken(): Token;
getTokenRequest(request: Request): Promise<AuthResponse>;
getUserInfo(params?: OAuthClient.GetUserInfoParams): Promise<AuthResponse>;
isAccessTokenValid(): boolean;
loadResponse(request: Request): Promise<Response>;
loadResponseFromJWKsURI(request: Request): Promise<Response>;
log(level: string, message: string, messageData: any): void;
makeApiCall(params?: OAuthClient.MakeApiCallParams): Promise<AuthResponse>;
migrate(params: OAuthClient.MigrateParams): Promise<AuthResponse>;
refresh(): Promise<AuthResponse>;
refreshUsingToken(refresh_token: string): Promise<AuthResponse>;
revoke(params?: OAuthClient.RevokeParams): Promise<AuthResponse>;
setToken(params: Token.TokenData): Token;
validateIdToken(params: OAuthClient.ValidateIdTokenParams): Promise<Response>;
validateIdToken(params?: OAuthClient.ValidateIdTokenParams): Promise<Response>;
validateToken(): void;
}

Expand All @@ -86,6 +88,8 @@ declare namespace OAuthClient {
clientSecret: string;
redirectUri?: string;
environment?: string;
token: Token;
logging: boolean;
}

export enum environment {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OAuthClient.migrate_production = 'https://developer.api.intuit.com/v2/oauth2/tokens/migrate';

I wasn't sure if constants such as these also had to be included in this file? Lines 79-109 from OAuthClient.js..I did see some constants like the scopes and environment already defined so wanted to clarify

Expand Down