@teamhanko/hanko-frontend-sdk 0.1.0-alpha → 0.2.0-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,25 @@
1
+ import { ConfigClient } from "./lib/client/ConfigClient";
2
+ import { PasscodeClient } from "./lib/client/PasscodeClient";
3
+ import { PasswordClient } from "./lib/client/PasswordClient";
4
+ import { UserClient } from "./lib/client/UserClient";
5
+ import { WebauthnClient } from "./lib/client/WebauthnClient";
6
+ import { EmailClient } from "./lib/client/EmailClient";
7
+ import { ThirdPartyClient } from "./lib/client/ThirdPartyClient";
8
+ /**
9
+ * A class that bundles all available SDK functions.
10
+ *
11
+ * @param {string} api - The URL of your Hanko API instance
12
+ * @param {number=} timeout - The request timeout in milliseconds
13
+ */
14
+ declare class Hanko {
15
+ api: string;
16
+ config: ConfigClient;
17
+ user: UserClient;
18
+ webauthn: WebauthnClient;
19
+ password: PasswordClient;
20
+ passcode: PasscodeClient;
21
+ email: EmailClient;
22
+ thirdParty: ThirdPartyClient;
23
+ constructor(api: string, timeout?: number);
24
+ }
25
+ export { Hanko };
@@ -0,0 +1,16 @@
1
+ import { Hanko } from "./Hanko";
2
+ export { Hanko };
3
+ import { ConfigClient } from "./lib/client/ConfigClient";
4
+ import { PasscodeClient } from "./lib/client/PasscodeClient";
5
+ import { PasswordClient } from "./lib/client/PasswordClient";
6
+ import { UserClient } from "./lib/client/UserClient";
7
+ import { WebauthnClient } from "./lib/client/WebauthnClient";
8
+ import { EmailClient } from "./lib/client/EmailClient";
9
+ import { ThirdPartyClient } from "./lib/client/ThirdPartyClient";
10
+ export { ConfigClient, UserClient, WebauthnClient, PasswordClient, PasscodeClient, EmailClient, ThirdPartyClient, };
11
+ import { WebauthnSupport } from "./lib/WebauthnSupport";
12
+ export { WebauthnSupport };
13
+ import { PasswordConfig, Config, WebauthnFinalized, Credential, UserInfo, User, Email, Emails, WebauthnCredential, WebauthnCredentials, Passcode, Identity } from "./lib/Dto";
14
+ export type { PasswordConfig, Config, WebauthnFinalized, Credential, UserInfo, User, Email, Emails, WebauthnCredential, WebauthnCredentials, Passcode, Identity, };
15
+ import { HankoError, ConflictError, EmailAddressAlreadyExistsError, InvalidPasswordError, InvalidPasscodeError, InvalidWebauthnCredentialError, MaxNumOfEmailAddressesReachedError, MaxNumOfPasscodeAttemptsReachedError, NotFoundError, PasscodeExpiredError, RequestTimeoutError, TechnicalError, ThirdPartyError, TooManyRequestsError, UnauthorizedError, UserVerificationError, WebauthnRequestCancelledError } from "./lib/Errors";
16
+ export { HankoError, ConflictError, EmailAddressAlreadyExistsError, InvalidPasswordError, InvalidPasscodeError, InvalidWebauthnCredentialError, MaxNumOfEmailAddressesReachedError, MaxNumOfPasscodeAttemptsReachedError, NotFoundError, PasscodeExpiredError, RequestTimeoutError, TechnicalError, ThirdPartyError, TooManyRequestsError, UnauthorizedError, UserVerificationError, WebauthnRequestCancelledError, };
@@ -0,0 +1,191 @@
1
+ import { PublicKeyCredentialWithAttestationJSON } from "@github/webauthn-json";
2
+ /**
3
+ * @interface
4
+ * @category SDK
5
+ * @subcategory DTO
6
+ * @property {boolean} enabled - Indicates passwords are enabled, so the API accepts login attempts using passwords.
7
+ * @property {number} min_password_length - The minimum length of a password. To be used for password validation.
8
+ */
9
+ interface PasswordConfig {
10
+ enabled: boolean;
11
+ min_password_length: number;
12
+ }
13
+ /**
14
+ * @interface
15
+ * @category SDK
16
+ * @subcategory DTO
17
+ * @property {boolean} require_verification - Indicates that email addresses must be verified.
18
+ * @property {number} max_num_of_addresses - The maximum number of email addresses a user can have.
19
+ */
20
+ interface EmailConfig {
21
+ require_verification: boolean;
22
+ max_num_of_addresses: number;
23
+ }
24
+ /**
25
+ * @interface
26
+ * @category SDK
27
+ * @subcategory DTO
28
+ * @property {PasswordConfig} password - The password configuration.
29
+ * @property {EmailConfig} emails - The email configuration.
30
+ * @property {string[]} providers - The enabled third party providers.
31
+ */
32
+ interface Config {
33
+ password: PasswordConfig;
34
+ emails: EmailConfig;
35
+ providers: string[];
36
+ }
37
+ /**
38
+ * @interface
39
+ * @category SDK
40
+ * @subcategory DTO
41
+ * @property {string} credential_id - The ID of the credential that was used.
42
+ * @property {string} user_id - The ID of the user that was used.
43
+ */
44
+ interface WebauthnFinalized {
45
+ credential_id: string;
46
+ user_id: string;
47
+ }
48
+ /**
49
+ * @interface
50
+ * @category SDK
51
+ * @subcategory DTO
52
+ * @property {string} id - The UUID of the user.
53
+ * @property {boolean} verified - Indicates whether the user's email address is verified.
54
+ * @property {string} email_id - The UUID of the email address.
55
+ * @property {boolean} has_webauthn_credential - Indicates that the user has registered a WebAuthn credential in the past.
56
+ */
57
+ interface UserInfo {
58
+ id: string;
59
+ verified: boolean;
60
+ email_id: string;
61
+ has_webauthn_credential: boolean;
62
+ }
63
+ /**
64
+ * @interface
65
+ * @category SDK
66
+ * @subcategory DTO
67
+ * @property {string} id - The UUID of the current user.
68
+ * @ignore
69
+ */
70
+ interface Me {
71
+ id: string;
72
+ }
73
+ /**
74
+ * @interface
75
+ * @category SDK
76
+ * @subcategory DTO
77
+ * @property {string} id - The WebAuthn credential ID.
78
+ */
79
+ interface Credential {
80
+ id: string;
81
+ }
82
+ /**
83
+ * @interface
84
+ * @category SDK
85
+ * @subcategory DTO
86
+ * @property {string} id - The user's UUID.
87
+ * @property {string} email - The user's email.
88
+ * @property {Credential[]} webauthn_credentials - A list of credentials that have been registered.
89
+ */
90
+ interface User {
91
+ id: string;
92
+ email_id: string;
93
+ webauthn_credentials: Credential[];
94
+ }
95
+ /**
96
+ * @interface
97
+ * @category SDK
98
+ * @subcategory DTO
99
+ * @property {string} id - The UUID of the passcode.
100
+ * @property {number} ttl - How long the code is active in seconds.
101
+ */
102
+ interface Passcode {
103
+ id: string;
104
+ ttl: number;
105
+ }
106
+ /**
107
+ * @interface
108
+ * @category SDK
109
+ * @subcategory DTO
110
+ * @property {string[]} - Transports which may be used by the authenticator. E.g. "internal", "ble",...
111
+ */
112
+ interface WebauthnTransports extends Array<string> {
113
+ }
114
+ /**
115
+ * @interface
116
+ * @category SDK
117
+ * @subcategory DTO
118
+ * @property {WebauthnTransports} transports
119
+ * @ignore
120
+ */
121
+ interface Attestation extends PublicKeyCredentialWithAttestationJSON {
122
+ transports: WebauthnTransports;
123
+ }
124
+ /**
125
+ * @interface
126
+ * @category SDK
127
+ * @subcategory DTO
128
+ * @property {string} id - The UUID of the email address.
129
+ * @property {string} address - The email address.
130
+ * @property {boolean} is_verified - Indicates whether the email address is verified.
131
+ * @property {boolean} is_primary - Indicates it's the primary email address.
132
+ * @property {Identity} identity - Indicates that this email is linked to a third party account.
133
+ */
134
+ interface Email {
135
+ id: string;
136
+ address: string;
137
+ is_verified: boolean;
138
+ is_primary: boolean;
139
+ identity: Identity;
140
+ }
141
+ /**
142
+ * @interface
143
+ * @category SDK
144
+ * @subcategory DTO
145
+ * @property {Email[]} - A list of emails assigned to the current user.
146
+ */
147
+ interface Emails extends Array<Email> {
148
+ }
149
+ /**
150
+ * @interface
151
+ * @category SDK
152
+ * @subcategory DTO
153
+ * @property {string} id - The credential id.
154
+ * @property {string=} name - The credential name.
155
+ * @property {string} public_key - The public key.
156
+ * @property {string} attestation_type - The attestation type.
157
+ * @property {string} aaguid - The AAGUID of the authenticator.
158
+ * @property {string} last_used_at - The time when the credential was used last.
159
+ * @property {string} created_at - Time of credential creation.
160
+ * @property {WebauthnTransports} transports
161
+ */
162
+ interface WebauthnCredential {
163
+ id: string;
164
+ name?: string;
165
+ public_key: string;
166
+ attestation_type: string;
167
+ aaguid: string;
168
+ last_used_at: string;
169
+ created_at: string;
170
+ transports: WebauthnTransports;
171
+ }
172
+ /**
173
+ * @interface
174
+ * @category SDK
175
+ * @subcategory DTO
176
+ * @property {WebauthnCredential[]} - A list of WebAuthn credential assigned to the current user.
177
+ */
178
+ interface WebauthnCredentials extends Array<WebauthnCredential> {
179
+ }
180
+ /**
181
+ * @interface
182
+ * @category SDK
183
+ * @subcategory DTO
184
+ * @property {id} - The subject ID with the third party provider.
185
+ * @property {provider} - The third party provider name.
186
+ */
187
+ interface Identity {
188
+ id: string;
189
+ provider: string;
190
+ }
191
+ export type { PasswordConfig, Config, WebauthnFinalized, Credential, UserInfo, Me, User, Email, Emails, Passcode, Attestation, WebauthnCredential, WebauthnCredentials, Identity, };
@@ -0,0 +1,182 @@
1
+ /**
2
+ * Every error thrown in the SDK is an instance of 'HankoError'. The value of the 'code' property is eligible to
3
+ * translate the error into an error message.
4
+ *
5
+ * @extends {Error}
6
+ * @category SDK
7
+ * @subcategory Errors
8
+ * @param code {string} - An error code that refers to the error instance.
9
+ * @param cause {Error=} - The original error
10
+ */
11
+ declare abstract class HankoError extends Error {
12
+ code: string;
13
+ cause?: Error;
14
+ protected constructor(message: string, code: string, cause?: Error);
15
+ }
16
+ /**
17
+ * Every error that doesn't need to be handled in a special way is a 'TechnicalError'. Whenever you catch one, there is
18
+ * usually nothing you can do but present an error to the user, e.g. "Something went wrong".
19
+ *
20
+ * @category SDK
21
+ * @subcategory Errors
22
+ * @extends {HankoError}
23
+ */
24
+ declare class TechnicalError extends HankoError {
25
+ constructor(cause?: Error);
26
+ }
27
+ /**
28
+ * Attempting to create a resource that already exists results in a 'ConflictError'.
29
+ *
30
+ * @category SDK
31
+ * @subcategory Errors
32
+ * @extends {HankoError}
33
+ */
34
+ declare class ConflictError extends HankoError {
35
+ constructor(userID?: string, cause?: Error);
36
+ }
37
+ /**
38
+ * A 'RequestTimeoutError' occurs when the specified timeout has been reached.
39
+ *
40
+ * @category SDK
41
+ * @subcategory Errors
42
+ * @extends {HankoError}
43
+ */
44
+ declare class RequestTimeoutError extends HankoError {
45
+ constructor(cause?: Error);
46
+ }
47
+ /**
48
+ * A 'WebauthnRequestCancelledError' occurs during WebAuthn authentication or registration, when the WebAuthn API throws
49
+ * an error. In most cases, this happens when the user cancels the browser's WebAuthn dialog.
50
+ *
51
+ * @category SDK
52
+ * @subcategory Errors
53
+ * @extends {HankoError}
54
+ */
55
+ declare class WebauthnRequestCancelledError extends HankoError {
56
+ constructor(cause?: Error);
57
+ }
58
+ /**
59
+ * An 'InvalidPasswordError' occurs when invalid credentials are provided when logging in with a password.
60
+ *
61
+ * @category SDK
62
+ * @subcategory Errors
63
+ * @extends {HankoError}
64
+ */
65
+ declare class InvalidPasswordError extends HankoError {
66
+ constructor(cause?: Error);
67
+ }
68
+ /**
69
+ * An 'InvalidPasswordError' occurs when an incorrect code is entered when logging in with a passcode.
70
+ *
71
+ * @category SDK
72
+ * @subcategory Errors
73
+ * @extends {HankoError}
74
+ */
75
+ declare class InvalidPasscodeError extends HankoError {
76
+ constructor(cause?: Error);
77
+ }
78
+ /**
79
+ * An 'InvalidWebauthnCredentialError' occurs if invalid credentials were used when logging in with WebAuthn.
80
+ *
81
+ * @category SDK
82
+ * @subcategory Errors
83
+ * @extends {HankoError}
84
+ */
85
+ declare class InvalidWebauthnCredentialError extends HankoError {
86
+ constructor(cause?: Error);
87
+ }
88
+ /**
89
+ * A 'PasscodeExpiredError' occurs when the passcode has expired.
90
+ *
91
+ * @category SDK
92
+ * @subcategory Errors
93
+ * @extends {HankoError}
94
+ */
95
+ declare class PasscodeExpiredError extends HankoError {
96
+ constructor(cause?: Error);
97
+ }
98
+ /**
99
+ * A 'MaxNumOfPasscodeAttemptsReachedError' occurs when an incorrect passcode is provided too many times.
100
+ *
101
+ * @category SDK
102
+ * @subcategory Errors
103
+ * @extends {HankoError}
104
+ */
105
+ declare class MaxNumOfPasscodeAttemptsReachedError extends HankoError {
106
+ constructor(cause?: Error);
107
+ }
108
+ /**
109
+ * A 'NotFoundError' occurs when the requested resource was not found.
110
+ *
111
+ * @category SDK
112
+ * @subcategory Errors
113
+ * @extends {HankoError}
114
+ */
115
+ declare class NotFoundError extends HankoError {
116
+ constructor(cause?: Error);
117
+ }
118
+ /**
119
+ * A 'TooManyRequestsError' occurs due to rate limiting when too many requests are made.
120
+ *
121
+ * @category SDK
122
+ * @subcategory Errors
123
+ * @extends {HankoError}
124
+ */
125
+ declare class TooManyRequestsError extends HankoError {
126
+ retryAfter?: number;
127
+ constructor(retryAfter?: number, cause?: Error);
128
+ }
129
+ /**
130
+ * An 'UnauthorizedError' occurs when the user is not authorized to access the resource.
131
+ *
132
+ * @category SDK
133
+ * @subcategory Errors
134
+ * @extends {HankoError}
135
+ */
136
+ declare class UnauthorizedError extends HankoError {
137
+ constructor(cause?: Error);
138
+ }
139
+ /**
140
+ * A 'UserVerificationError' occurs when the user verification requirements
141
+ * for a WebAuthn ceremony are not met.
142
+ *
143
+ * @category SDK
144
+ * @subcategory Errors
145
+ * @extends {HankoError}
146
+ */
147
+ declare class UserVerificationError extends HankoError {
148
+ constructor(cause?: Error);
149
+ }
150
+ /**
151
+ * A 'MaxNumOfEmailAddressesReachedError' occurs when the user tries to add a new email address while the maximum number
152
+ * of email addresses (see backend configuration) equals the number of email addresses already registered.
153
+ *
154
+ * @category SDK
155
+ * @subcategory Errors
156
+ * @extends {HankoError}
157
+ */
158
+ declare class MaxNumOfEmailAddressesReachedError extends HankoError {
159
+ constructor(cause?: Error);
160
+ }
161
+ /**
162
+ * An 'EmailAddressAlreadyExistsError' occurs when the user tries to add a new email address which already exists.
163
+ *
164
+ * @category SDK
165
+ * @subcategory Errors
166
+ * @extends {HankoError}
167
+ */
168
+ declare class EmailAddressAlreadyExistsError extends HankoError {
169
+ constructor(cause?: Error);
170
+ }
171
+ /**
172
+ * A `ThirdPartyError` may occur during a sign in/sign up with a third party
173
+ * provider.
174
+ *
175
+ * @category SDK
176
+ * @subcategory Errors
177
+ * @extends {HankoError}
178
+ */
179
+ declare class ThirdPartyError extends HankoError {
180
+ constructor(code: string, cause?: Error);
181
+ }
182
+ export { HankoError, TechnicalError, ConflictError, RequestTimeoutError, WebauthnRequestCancelledError, InvalidPasswordError, InvalidPasscodeError, InvalidWebauthnCredentialError, PasscodeExpiredError, MaxNumOfPasscodeAttemptsReachedError, NotFoundError, TooManyRequestsError, UnauthorizedError, UserVerificationError, MaxNumOfEmailAddressesReachedError, EmailAddressAlreadyExistsError, ThirdPartyError, };
@@ -0,0 +1,36 @@
1
+ /**
2
+ * A class to check the browser's WebAuthn support.
3
+ *
4
+ * @hideconstructor
5
+ * @category SDK
6
+ * @subcategory Utilities
7
+ */
8
+ declare class WebauthnSupport {
9
+ /**
10
+ * Does a simple check to test for the credential management API functions we need, and an indication of
11
+ * public key credential authentication support.
12
+ *
13
+ * @see https://developers.google.com/web/updates/2018/03/webauthn-credential-management
14
+ * @return boolean
15
+ */
16
+ static supported(): boolean;
17
+ /**
18
+ * Checks whether a user-verifying platform authenticator is available.
19
+ *
20
+ * @return Promise<boolean>
21
+ */
22
+ static isPlatformAuthenticatorAvailable(): Promise<boolean>;
23
+ /**
24
+ * Checks whether external CTAP2 security keys are supported.
25
+ *
26
+ * @return Promise<boolean>
27
+ */
28
+ static isSecurityKeySupported(): Promise<boolean>;
29
+ /**
30
+ * Checks whether autofill assisted requests are supported.
31
+ *
32
+ * @return Promise<boolean>
33
+ */
34
+ static isConditionalMediationAvailable(): Promise<boolean>;
35
+ }
36
+ export { WebauthnSupport };
@@ -0,0 +1,15 @@
1
+ import { HttpClient } from "./HttpClient";
2
+ /**
3
+ * A class to be extended by the other client classes.
4
+ *
5
+ * @abstract
6
+ * @category SDK
7
+ * @subcategory Internal
8
+ * @param {string} api - The URL of your Hanko API instance
9
+ * @param {number=} timeout - The request timeout in milliseconds
10
+ */
11
+ declare abstract class Client {
12
+ client: HttpClient;
13
+ constructor(api: string, timeout?: number);
14
+ }
15
+ export { Client };
@@ -0,0 +1,20 @@
1
+ import { Config } from "../Dto";
2
+ import { Client } from "./Client";
3
+ /**
4
+ * A class for retrieving configurations from the API.
5
+ *
6
+ * @category SDK
7
+ * @subcategory Clients
8
+ * @extends {Client}
9
+ */
10
+ declare class ConfigClient extends Client {
11
+ /**
12
+ * Retrieves the frontend configuration.
13
+ * @return {Promise<Config>}
14
+ * @throws {RequestTimeoutError}
15
+ * @throws {TechnicalError}
16
+ * @see https://docs.hanko.io/api/public#tag/.well-known/operation/getConfig
17
+ */
18
+ get(): Promise<Config>;
19
+ }
20
+ export { ConfigClient };
@@ -0,0 +1,58 @@
1
+ import { Client } from "./Client";
2
+ import { Email, Emails } from "../Dto";
3
+ /**
4
+ * Manages email addresses of the current user.
5
+ *
6
+ * @constructor
7
+ * @category SDK
8
+ * @subcategory Clients
9
+ * @extends {Client}
10
+ */
11
+ declare class EmailClient extends Client {
12
+ /**
13
+ * Returns a list of all email addresses assigned to the current user.
14
+ *
15
+ * @return {Promise<Emails>}
16
+ * @throws {UnauthorizedError}
17
+ * @throws {RequestTimeoutError}
18
+ * @throws {TechnicalError}
19
+ * @see https://docs.hanko.io/api/public#tag/Email-Management/operation/listEmails
20
+ */
21
+ list(): Promise<Emails>;
22
+ /**
23
+ * Adds a new email address to the current user.
24
+ *
25
+ * @param {string} address - The email address to be added.
26
+ * @return {Promise<Email>}
27
+ * @throws {EmailAddressAlreadyExistsError}
28
+ * @throws {MaxNumOfEmailAddressesReachedError}
29
+ * @throws {UnauthorizedError}
30
+ * @throws {RequestTimeoutError}
31
+ * @throws {TechnicalError}
32
+ * @see https://docs.hanko.io/api/public#tag/Email-Management/operation/createEmail
33
+ */
34
+ create(address: string): Promise<Email>;
35
+ /**
36
+ * Marks the specified email address as primary.
37
+ *
38
+ * @param {string} emailID - The ID of the email address to be updated
39
+ * @return {Promise<void>}
40
+ * @throws {UnauthorizedError}
41
+ * @throws {RequestTimeoutError}
42
+ * @throws {TechnicalError}
43
+ * @see https://docs.hanko.io/api/public#tag/Email-Management/operation/setPrimaryEmail
44
+ */
45
+ setPrimaryEmail(emailID: string): Promise<void>;
46
+ /**
47
+ * Deletes the specified email address.
48
+ *
49
+ * @param {string} emailID - The ID of the email address to be deleted
50
+ * @return {Promise<void>}
51
+ * @throws {UnauthorizedError}
52
+ * @throws {RequestTimeoutError}
53
+ * @throws {TechnicalError}
54
+ * @see https://docs.hanko.io/api/public#tag/Email-Management/operation/deleteEmail
55
+ */
56
+ delete(emailID: string): Promise<void>;
57
+ }
58
+ export { EmailClient };
@@ -0,0 +1,118 @@
1
+ /**
2
+ * This class wraps an XMLHttpRequest to maintain compatibility with the fetch API.
3
+ *
4
+ * @category SDK
5
+ * @subcategory Internal
6
+ * @param {XMLHttpRequest} xhr - The request to be wrapped.
7
+ * @see HttpClient
8
+ */
9
+ declare class Headers {
10
+ _xhr: XMLHttpRequest;
11
+ constructor(xhr: XMLHttpRequest);
12
+ /**
13
+ * Returns the response header with the given name.
14
+ *
15
+ * @param {string} name
16
+ * @return {string}
17
+ */
18
+ get(name: string): string;
19
+ }
20
+ /**
21
+ * This class wraps an XMLHttpRequest to maintain compatibility with the fetch API.
22
+ *
23
+ * @category SDK
24
+ * @subcategory Internal
25
+ * @param {XMLHttpRequest} xhr - The request to be wrapped.
26
+ * @see HttpClient
27
+ */
28
+ declare class Response {
29
+ headers: Headers;
30
+ ok: boolean;
31
+ status: number;
32
+ statusText: string;
33
+ url: string;
34
+ _decodedJSON: any;
35
+ private xhr;
36
+ constructor(xhr: XMLHttpRequest);
37
+ /**
38
+ * Returns the JSON decoded response.
39
+ *
40
+ * @return {any}
41
+ */
42
+ json(): any;
43
+ /**
44
+ * Returns the value for Retry-After contained in the response header.
45
+ *
46
+ * @return {number}
47
+ */
48
+ parseRetryAfterHeader(): number;
49
+ }
50
+ /**
51
+ * Internally used for communication with the Hanko API. It also handles authorization tokens to enable authorized
52
+ * requests.
53
+ *
54
+ * Currently, there is an issue with Safari and on iOS 15 devices where decoding a JSON response via the fetch API
55
+ * breaks the user gesture and the user is not able to use the authenticator. Therefore, this class uses XMLHttpRequests
56
+ * instead of the fetch API, but maintains compatibility by wrapping the XMLHttpRequests. So, if the issues are fixed,
57
+ * we can easily return to the fetch API.
58
+ *
59
+ * @category SDK
60
+ * @subcategory Internal
61
+ * @param {string} api - The URL of your Hanko API instance
62
+ * @param {number=} timeout - The request timeout in milliseconds
63
+ */
64
+ declare class HttpClient {
65
+ timeout: number;
66
+ api: string;
67
+ constructor(api: string, timeout?: number);
68
+ _fetch(path: string, options: RequestInit, xhr?: XMLHttpRequest): Promise<Response>;
69
+ /**
70
+ * Performs a GET request.
71
+ *
72
+ * @param {string} path - The path to the requested resource.
73
+ * @return {Promise<Response>}
74
+ * @throws {RequestTimeoutError}
75
+ * @throws {TechnicalError}
76
+ */
77
+ get(path: string): Promise<Response>;
78
+ /**
79
+ * Performs a POST request.
80
+ *
81
+ * @param {string} path - The path to the requested resource.
82
+ * @param {any=} body - The request body.
83
+ * @return {Promise<Response>}
84
+ * @throws {RequestTimeoutError}
85
+ * @throws {TechnicalError}
86
+ */
87
+ post(path: string, body?: any): Promise<Response>;
88
+ /**
89
+ * Performs a PUT request.
90
+ *
91
+ * @param {string} path - The path to the requested resource.
92
+ * @param {any=} body - The request body.
93
+ * @return {Promise<Response>}
94
+ * @throws {RequestTimeoutError}
95
+ * @throws {TechnicalError}
96
+ */
97
+ put(path: string, body?: any): Promise<Response>;
98
+ /**
99
+ * Performs a PATCH request.
100
+ *
101
+ * @param {string} path - The path to the requested resource.
102
+ * @param {any=} body - The request body.
103
+ * @return {Promise<Response>}
104
+ * @throws {RequestTimeoutError}
105
+ * @throws {TechnicalError}
106
+ */
107
+ patch(path: string, body?: any): Promise<Response>;
108
+ /**
109
+ * Performs a DELETE request.
110
+ *
111
+ * @param {string} path - The path to the requested resource.
112
+ * @return {Promise<Response>}
113
+ * @throws {RequestTimeoutError}
114
+ * @throws {TechnicalError}
115
+ */
116
+ delete(path: string): Promise<Response>;
117
+ }
118
+ export { Headers, Response, HttpClient };