@gomomento/sdk-core 1.86.0 → 1.88.0
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.
- package/dist/src/auth/credential-provider.d.ts +26 -0
- package/dist/src/auth/credential-provider.js +45 -7
- package/dist/src/errors/errors.js +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +2 -1
- package/dist/src/internal/utils/auth.d.ts +7 -3
- package/dist/src/internal/utils/auth.js +19 -7
- package/dist/src/messages/responses/cache-batch-get.d.ts +18 -51
- package/dist/src/messages/responses/cache-batch-get.js +23 -56
- package/dist/src/messages/responses/cache-batch-set.d.ts +14 -51
- package/dist/src/messages/responses/cache-batch-set.js +12 -42
- package/dist/src/messages/responses/cache-delete.d.ts +11 -44
- package/dist/src/messages/responses/cache-delete.js +14 -35
- package/dist/src/messages/responses/cache-dictionary-fetch.d.ts +18 -54
- package/dist/src/messages/responses/cache-dictionary-fetch.js +23 -46
- package/dist/src/messages/responses/cache-dictionary-get-field.d.ts +19 -58
- package/dist/src/messages/responses/cache-dictionary-get-field.js +19 -52
- package/dist/src/messages/responses/cache-dictionary-get-fields.d.ts +19 -56
- package/dist/src/messages/responses/cache-dictionary-get-fields.js +27 -50
- package/dist/src/messages/responses/cache-dictionary-increment.d.ts +14 -46
- package/dist/src/messages/responses/cache-dictionary-increment.js +14 -41
- package/dist/src/messages/responses/cache-dictionary-length.d.ts +19 -53
- package/dist/src/messages/responses/cache-dictionary-length.js +26 -40
- package/dist/src/messages/responses/cache-dictionary-remove-field.d.ts +10 -43
- package/dist/src/messages/responses/cache-dictionary-remove-field.js +13 -34
- package/dist/src/messages/responses/cache-dictionary-remove-fields.d.ts +10 -43
- package/dist/src/messages/responses/cache-dictionary-remove-fields.js +13 -34
- package/dist/src/messages/responses/cache-dictionary-set-field.d.ts +10 -43
- package/dist/src/messages/responses/cache-dictionary-set-field.js +13 -34
- package/dist/src/messages/responses/cache-dictionary-set-fields.d.ts +10 -43
- package/dist/src/messages/responses/cache-dictionary-set-fields.js +13 -34
- package/dist/src/messages/responses/cache-flush.d.ts +12 -45
- package/dist/src/messages/responses/cache-flush.js +15 -36
- package/dist/src/messages/responses/cache-get.d.ts +19 -54
- package/dist/src/messages/responses/cache-get.js +22 -45
- package/dist/src/messages/responses/cache-increment.d.ts +24 -51
- package/dist/src/messages/responses/cache-increment.js +27 -49
- package/dist/src/messages/responses/cache-item-get-ttl.d.ts +22 -55
- package/dist/src/messages/responses/cache-item-get-ttl.js +27 -41
- package/dist/src/messages/responses/cache-item-get-type.d.ts +22 -55
- package/dist/src/messages/responses/cache-item-get-type.js +27 -41
- package/dist/src/messages/responses/cache-key-exists.d.ts +16 -47
- package/dist/src/messages/responses/cache-key-exists.js +17 -38
- package/dist/src/messages/responses/cache-keys-exist.d.ts +16 -47
- package/dist/src/messages/responses/cache-keys-exist.js +16 -37
- package/dist/src/messages/responses/cache-list-concatenate-back.d.ts +13 -46
- package/dist/src/messages/responses/cache-list-concatenate-back.js +13 -37
- package/dist/src/messages/responses/cache-list-concatenate-front.d.ts +13 -46
- package/dist/src/messages/responses/cache-list-concatenate-front.js +13 -37
- package/dist/src/messages/responses/cache-list-fetch.d.ts +23 -58
- package/dist/src/messages/responses/cache-list-fetch.js +26 -49
- package/dist/src/messages/responses/cache-list-length.d.ts +27 -59
- package/dist/src/messages/responses/cache-list-length.js +32 -42
- package/dist/src/messages/responses/cache-list-pop-back.d.ts +22 -57
- package/dist/src/messages/responses/cache-list-pop-back.js +25 -48
- package/dist/src/messages/responses/cache-list-pop-front.d.ts +22 -57
- package/dist/src/messages/responses/cache-list-pop-front.js +25 -48
- package/dist/src/messages/responses/cache-list-push-back.d.ts +13 -46
- package/dist/src/messages/responses/cache-list-push-back.js +13 -37
- package/dist/src/messages/responses/cache-list-push-front.d.ts +13 -46
- package/dist/src/messages/responses/cache-list-push-front.js +13 -37
- package/dist/src/messages/responses/cache-list-remove-value.d.ts +11 -44
- package/dist/src/messages/responses/cache-list-remove-value.js +14 -35
- package/dist/src/messages/responses/cache-list-retain.d.ts +11 -44
- package/dist/src/messages/responses/cache-list-retain.js +14 -35
- package/dist/src/messages/responses/cache-set-add-element.d.ts +10 -53
- package/dist/src/messages/responses/cache-set-add-element.js +13 -34
- package/dist/src/messages/responses/cache-set-add-elements.d.ts +12 -45
- package/dist/src/messages/responses/cache-set-add-elements.js +17 -38
- package/dist/src/messages/responses/cache-set-fetch.d.ts +18 -54
- package/dist/src/messages/responses/cache-set-fetch.js +23 -46
- package/dist/src/messages/responses/cache-set-if-absent-or-equal.d.ts +15 -55
- package/dist/src/messages/responses/cache-set-if-absent-or-equal.js +21 -41
- package/dist/src/messages/responses/cache-set-if-absent.d.ts +14 -63
- package/dist/src/messages/responses/cache-set-if-absent.js +20 -40
- package/dist/src/messages/responses/cache-set-if-equal.d.ts +15 -55
- package/dist/src/messages/responses/cache-set-if-equal.js +21 -41
- package/dist/src/messages/responses/cache-set-if-not-equal.d.ts +15 -55
- package/dist/src/messages/responses/cache-set-if-not-equal.js +21 -41
- package/dist/src/messages/responses/cache-set-if-not-exists.d.ts +14 -54
- package/dist/src/messages/responses/cache-set-if-not-exists.js +20 -40
- package/dist/src/messages/responses/cache-set-if-present-and-not-equal.d.ts +15 -55
- package/dist/src/messages/responses/cache-set-if-present-and-not-equal.js +21 -41
- package/dist/src/messages/responses/cache-set-if-present.d.ts +15 -55
- package/dist/src/messages/responses/cache-set-if-present.js +21 -41
- package/dist/src/messages/responses/cache-set-remove-element.d.ts +10 -43
- package/dist/src/messages/responses/cache-set-remove-element.js +13 -34
- package/dist/src/messages/responses/cache-set-remove-elements.d.ts +13 -46
- package/dist/src/messages/responses/cache-set-remove-elements.js +13 -34
- package/dist/src/messages/responses/cache-set-sample.d.ts +18 -54
- package/dist/src/messages/responses/cache-set-sample.js +23 -46
- package/dist/src/messages/responses/cache-set.d.ts +10 -43
- package/dist/src/messages/responses/cache-set.js +13 -34
- package/dist/src/messages/responses/cache-sorted-set-fetch.js +1 -1
- package/dist/src/messages/responses/cache-sorted-set-get-score.d.ts +6 -1
- package/dist/src/messages/responses/cache-sorted-set-get-score.js +1 -1
- package/dist/src/messages/responses/cache-sorted-set-get-scores.js +1 -1
- package/dist/src/messages/responses/cache-sorted-set-increment-score.js +1 -1
- package/dist/src/messages/responses/cache-ttl-decrease.d.ts +19 -53
- package/dist/src/messages/responses/cache-ttl-decrease.js +29 -39
- package/dist/src/messages/responses/cache-ttl-increase.d.ts +19 -53
- package/dist/src/messages/responses/cache-ttl-increase.js +29 -39
- package/dist/src/messages/responses/cache-ttl-update.d.ts +15 -55
- package/dist/src/messages/responses/cache-ttl-update.js +21 -41
- package/dist/src/messages/responses/create-cache.d.ts +15 -58
- package/dist/src/messages/responses/create-cache.js +21 -39
- package/dist/src/messages/responses/delete-cache.d.ts +11 -44
- package/dist/src/messages/responses/delete-cache.js +14 -35
- package/dist/src/messages/responses/enums/auth/generate-api-key.d.ts +4 -0
- package/dist/src/messages/responses/enums/auth/generate-api-key.js +9 -0
- package/dist/src/messages/responses/enums/auth/generate-disposable-token.d.ts +4 -0
- package/dist/src/messages/responses/enums/auth/generate-disposable-token.js +9 -0
- package/dist/src/messages/responses/enums/auth/index.d.ts +3 -0
- package/dist/src/messages/responses/enums/auth/index.js +10 -0
- package/dist/src/messages/responses/enums/auth/refresh-api-key.d.ts +4 -0
- package/dist/src/messages/responses/enums/auth/refresh-api-key.js +9 -0
- package/dist/src/messages/responses/enums/cache/control/index.d.ts +17 -0
- package/dist/src/messages/responses/enums/cache/control/index.js +25 -0
- package/dist/src/messages/responses/enums/cache/dictionary/index.d.ts +40 -0
- package/dist/src/messages/responses/enums/cache/dictionary/index.js +53 -0
- package/dist/src/messages/responses/enums/cache/index.d.ts +5 -0
- package/dist/src/messages/responses/enums/cache/index.js +22 -0
- package/dist/src/messages/responses/enums/cache/list/index.d.ts +44 -0
- package/dist/src/messages/responses/enums/cache/list/index.js +58 -0
- package/dist/src/messages/responses/enums/cache/scalar/index.d.ts +95 -0
- package/dist/src/messages/responses/enums/cache/scalar/index.js +122 -0
- package/dist/src/messages/responses/enums/cache/set/index.d.ts +26 -0
- package/dist/src/messages/responses/enums/cache/set/index.js +36 -0
- package/dist/src/messages/responses/enums/index.d.ts +4 -0
- package/dist/src/messages/responses/enums/index.js +21 -0
- package/dist/src/messages/responses/enums/leaderboard/index.d.ts +20 -0
- package/dist/src/messages/responses/enums/leaderboard/index.js +29 -0
- package/dist/src/messages/responses/enums/topics/index.d.ts +8 -0
- package/dist/src/messages/responses/enums/topics/index.js +14 -0
- package/dist/src/messages/responses/generate-api-key.d.ts +10 -27
- package/dist/src/messages/responses/generate-api-key.js +10 -18
- package/dist/src/messages/responses/generate-disposable-token.d.ts +10 -27
- package/dist/src/messages/responses/generate-disposable-token.js +10 -18
- package/dist/src/messages/responses/leaderboard/leaderboard-delete.d.ts +10 -43
- package/dist/src/messages/responses/leaderboard/leaderboard-delete.js +13 -34
- package/dist/src/messages/responses/leaderboard/leaderboard-fetch.d.ts +12 -45
- package/dist/src/messages/responses/leaderboard/leaderboard-fetch.js +11 -35
- package/dist/src/messages/responses/leaderboard/leaderboard-length.d.ts +12 -45
- package/dist/src/messages/responses/leaderboard/leaderboard-length.js +11 -35
- package/dist/src/messages/responses/leaderboard/leaderboard-remove-elements.d.ts +10 -43
- package/dist/src/messages/responses/leaderboard/leaderboard-remove-elements.js +13 -34
- package/dist/src/messages/responses/leaderboard/leaderboard-upsert.d.ts +11 -44
- package/dist/src/messages/responses/leaderboard/leaderboard-upsert.js +14 -35
- package/dist/src/messages/responses/list-caches.d.ts +13 -46
- package/dist/src/messages/responses/list-caches.js +11 -35
- package/dist/src/messages/responses/refresh-api-key.d.ts +10 -27
- package/dist/src/messages/responses/refresh-api-key.js +10 -18
- package/dist/src/messages/responses/response-base.d.ts +20 -0
- package/dist/src/messages/responses/response-base.js +42 -2
- package/dist/src/messages/responses/topic-publish.d.ts +10 -43
- package/dist/src/messages/responses/topic-publish.js +13 -34
- package/dist/src/messages/responses/topic-subscribe.d.ts +10 -37
- package/dist/src/messages/responses/topic-subscribe.js +10 -33
- package/dist/src/messages/responses/webhook/put-webhook.d.ts +1 -10
- package/package.json +1 -1
@@ -1,51 +1,15 @@
|
|
1
1
|
import { SdkError } from '../../../errors';
|
2
|
-
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
* the following subtypes:
|
7
|
-
*
|
8
|
-
* - {Success}
|
9
|
-
* - {Error}
|
10
|
-
*
|
11
|
-
* `instanceof` type guards can be used to operate on the appropriate subtype.
|
12
|
-
* @example
|
13
|
-
* For example:
|
14
|
-
* ```
|
15
|
-
* if (response instanceof LeaderboardUpsert.Error) {
|
16
|
-
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
17
|
-
* // `LeaderboardUpsert.Error` in this block, so you will have access to the properties
|
18
|
-
* // of the Error class; e.g. `response.errorCode()`.
|
19
|
-
* }
|
20
|
-
* ```
|
21
|
-
*/
|
22
|
-
export declare abstract class Response extends ResponseBase {
|
2
|
+
import { BaseResponseError, BaseResponseSuccess } from '../response-base';
|
3
|
+
import { LeaderboardUpsertResponse } from '../enums';
|
4
|
+
interface IResponse {
|
5
|
+
readonly type: LeaderboardUpsertResponse;
|
23
6
|
}
|
24
|
-
declare class _Success extends Response {
|
25
|
-
}
|
26
|
-
declare const Success_base: {
|
27
|
-
new (...args: any[]): {
|
28
|
-
readonly is_success: boolean;
|
29
|
-
};
|
30
|
-
} & typeof _Success;
|
31
7
|
/**
|
32
|
-
* Indicates a Successful leaderboard
|
8
|
+
* Indicates a Successful leaderboard upsert request.
|
33
9
|
*/
|
34
|
-
export declare class Success extends
|
35
|
-
|
36
|
-
declare class _Error extends Response {
|
37
|
-
protected _innerException: SdkError;
|
38
|
-
constructor(_innerException: SdkError);
|
10
|
+
export declare class Success extends BaseResponseSuccess implements IResponse {
|
11
|
+
readonly type: LeaderboardUpsertResponse.Success;
|
39
12
|
}
|
40
|
-
declare const Error_base: {
|
41
|
-
new (...args: any[]): {
|
42
|
-
_innerException: SdkError;
|
43
|
-
message(): string;
|
44
|
-
innerException(): SdkError;
|
45
|
-
errorCode(): import("../../../errors").MomentoErrorCode;
|
46
|
-
toString(): string;
|
47
|
-
};
|
48
|
-
} & typeof _Error;
|
49
13
|
/**
|
50
14
|
* Indicates that an error occurred during the leaderboard upsert request.
|
51
15
|
*
|
@@ -56,6 +20,9 @@ declare const Error_base: {
|
|
56
20
|
* - `message()` - a human-readable description of the error
|
57
21
|
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
58
22
|
*/
|
59
|
-
export declare class Error extends
|
23
|
+
export declare class Error extends BaseResponseError implements IResponse {
|
24
|
+
readonly type: LeaderboardUpsertResponse.Error;
|
25
|
+
constructor(_innerException: SdkError);
|
60
26
|
}
|
27
|
+
export type Response = Success | Error;
|
61
28
|
export {};
|
@@ -1,43 +1,18 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.Error = exports.Success =
|
3
|
+
exports.Error = exports.Success = void 0;
|
4
4
|
const response_base_1 = require("../response-base");
|
5
|
+
const enums_1 = require("../enums");
|
5
6
|
/**
|
6
|
-
*
|
7
|
-
* response object is resolved to a type-safe object of one of
|
8
|
-
* the following subtypes:
|
9
|
-
*
|
10
|
-
* - {Success}
|
11
|
-
* - {Error}
|
12
|
-
*
|
13
|
-
* `instanceof` type guards can be used to operate on the appropriate subtype.
|
14
|
-
* @example
|
15
|
-
* For example:
|
16
|
-
* ```
|
17
|
-
* if (response instanceof LeaderboardUpsert.Error) {
|
18
|
-
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
19
|
-
* // `LeaderboardUpsert.Error` in this block, so you will have access to the properties
|
20
|
-
* // of the Error class; e.g. `response.errorCode()`.
|
21
|
-
* }
|
22
|
-
* ```
|
23
|
-
*/
|
24
|
-
class Response extends response_base_1.ResponseBase {
|
25
|
-
}
|
26
|
-
exports.Response = Response;
|
27
|
-
class _Success extends Response {
|
28
|
-
}
|
29
|
-
/**
|
30
|
-
* Indicates a Successful leaderboard length request.
|
7
|
+
* Indicates a Successful leaderboard upsert request.
|
31
8
|
*/
|
32
|
-
class Success extends
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
constructor(_innerException) {
|
37
|
-
super();
|
38
|
-
this._innerException = _innerException;
|
9
|
+
class Success extends response_base_1.BaseResponseSuccess {
|
10
|
+
constructor() {
|
11
|
+
super(...arguments);
|
12
|
+
this.type = enums_1.LeaderboardUpsertResponse.Success;
|
39
13
|
}
|
40
14
|
}
|
15
|
+
exports.Success = Success;
|
41
16
|
/**
|
42
17
|
* Indicates that an error occurred during the leaderboard upsert request.
|
43
18
|
*
|
@@ -48,7 +23,11 @@ class _Error extends Response {
|
|
48
23
|
* - `message()` - a human-readable description of the error
|
49
24
|
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
50
25
|
*/
|
51
|
-
class Error extends
|
26
|
+
class Error extends response_base_1.BaseResponseError {
|
27
|
+
constructor(_innerException) {
|
28
|
+
super(_innerException);
|
29
|
+
this.type = enums_1.LeaderboardUpsertResponse.Error;
|
30
|
+
}
|
52
31
|
}
|
53
32
|
exports.Error = Error;
|
54
|
-
//# sourceMappingURL=data:application/json;base64,
|
33
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGVhZGVyYm9hcmQtdXBzZXJ0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vc3JjL21lc3NhZ2VzL3Jlc3BvbnNlcy9sZWFkZXJib2FyZC9sZWFkZXJib2FyZC11cHNlcnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0Esb0RBQXdFO0FBQ3hFLG9DQUFtRDtBQU1uRDs7R0FFRztBQUNILE1BQWEsT0FBUSxTQUFRLG1DQUFtQjtJQUFoRDs7UUFDVyxTQUFJLEdBQ1gsaUNBQXlCLENBQUMsT0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gKiBUaGlzIHJlc3BvbnNlIG9iamVjdCBpbmNsdWRlcyB0aGUgZm9sbG93aW5nIGZpZWxkcyB0aGF0IHlvdSBjYW4gdXNlIHRvIGRldGVybWluZVxuICogaG93IHlvdSB3b3VsZCBsaWtlIHRvIGhhbmRsZSB0aGUgZXJyb3I6XG4gKlxuICogLSBgZXJyb3JDb2RlKClgIC0gYSB1bmlxdWUgTW9tZW50byBlcnJvciBjb2RlIGluZGljYXRpbmcgdGhlIHR5cGUgb2YgZXJyb3IgdGhhdCBvY2N1cnJlZC5cbiAqIC0gYG1lc3NhZ2UoKWAgLSBhIGh1bWFuLXJlYWRhYmxlIGRlc2NyaXB0aW9uIG9mIHRoZSBlcnJvclxuICogLSBgaW5uZXJFeGNlcHRpb24oKWAgLSB0aGUgb3JpZ2luYWwgZXJyb3IgdGhhdCBjYXVzZWQgdGhlIGZhaWx1cmU7IGNhbiBiZSByZS10aHJvd24uXG4gKi9cbmV4cG9ydCBjbGFzcyBFcnJvciBleHRlbmRzIEJhc2VSZXNwb25zZUVycm9yIGltcGxlbWVudHMgSVJlc3BvbnNlIHtcbiAgcmVhZG9ubHkgdHlwZTogTGVhZGVyYm9hcmRVcHNlcnRSZXNwb25zZS5FcnJvciA9XG4gICAgTGVhZGVyYm9hcmRVcHNlcnRSZXNwb25zZS5FcnJvcjtcblxuICBjb25zdHJ1Y3RvcihfaW5uZXJFeGNlcHRpb246IFNka0Vycm9yKSB7XG4gICAgc3VwZXIoX2lubmVyRXhjZXB0aW9uKTtcbiAgfVxufVxuXG5leHBvcnQgdHlwZSBSZXNwb25zZSA9IFN1Y2Nlc3MgfCBFcnJvcjtcbiJdfQ==
|
@@ -1,28 +1,15 @@
|
|
1
|
-
import { CacheInfo } from '../cache-info';
|
2
1
|
import { SdkError } from '../../errors';
|
3
|
-
import {
|
2
|
+
import { BaseResponseError, BaseResponseSuccess } from './response-base';
|
3
|
+
import { ListCachesResponse } from './enums';
|
4
|
+
import { CacheInfo } from '../..';
|
5
|
+
interface IResponse {
|
6
|
+
readonly type: ListCachesResponse;
|
7
|
+
}
|
4
8
|
/**
|
5
|
-
*
|
6
|
-
* response object is resolved to a type-safe object of one of
|
7
|
-
* the following subtypes:
|
8
|
-
*
|
9
|
-
* - {Success}
|
10
|
-
* - {Error}
|
11
|
-
*
|
12
|
-
* `instanceof` type guards can be used to operate on the appropriate subtype.
|
13
|
-
* @example
|
14
|
-
* For example:
|
15
|
-
* ```
|
16
|
-
* if (response instanceof ListCaches.Error) {
|
17
|
-
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
18
|
-
* // `ListCaches.Error` in this block, so you will have access to the properties
|
19
|
-
* // of the Error class; e.g. `response.errorCode()`.
|
20
|
-
* }
|
21
|
-
* ```
|
9
|
+
* Indicates a successful list caches request.
|
22
10
|
*/
|
23
|
-
export declare
|
24
|
-
|
25
|
-
declare class _Success extends Response {
|
11
|
+
export declare class Success extends BaseResponseSuccess implements IResponse {
|
12
|
+
readonly type: ListCachesResponse.Success;
|
26
13
|
private readonly caches;
|
27
14
|
constructor(caches: CacheInfo[]);
|
28
15
|
/**
|
@@ -32,29 +19,6 @@ declare class _Success extends Response {
|
|
32
19
|
getCaches(): CacheInfo[];
|
33
20
|
toString(): string;
|
34
21
|
}
|
35
|
-
declare const Success_base: {
|
36
|
-
new (...args: any[]): {
|
37
|
-
readonly is_success: boolean;
|
38
|
-
};
|
39
|
-
} & typeof _Success;
|
40
|
-
/**
|
41
|
-
* Indicates a Successful list caches request.
|
42
|
-
*/
|
43
|
-
export declare class Success extends Success_base {
|
44
|
-
}
|
45
|
-
declare class _Error extends Response {
|
46
|
-
protected _innerException: SdkError;
|
47
|
-
constructor(_innerException: SdkError);
|
48
|
-
}
|
49
|
-
declare const Error_base: {
|
50
|
-
new (...args: any[]): {
|
51
|
-
_innerException: SdkError;
|
52
|
-
message(): string;
|
53
|
-
innerException(): SdkError;
|
54
|
-
errorCode(): import("../../errors").MomentoErrorCode;
|
55
|
-
toString(): string;
|
56
|
-
};
|
57
|
-
} & typeof _Error;
|
58
22
|
/**
|
59
23
|
* Indicates that an error occurred during the list caches request.
|
60
24
|
*
|
@@ -65,6 +29,9 @@ declare const Error_base: {
|
|
65
29
|
* - `message()` - a human-readable description of the error
|
66
30
|
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
67
31
|
*/
|
68
|
-
export declare class Error extends
|
32
|
+
export declare class Error extends BaseResponseError implements IResponse {
|
33
|
+
constructor(_innerException: SdkError);
|
34
|
+
readonly type: ListCachesResponse.Error;
|
69
35
|
}
|
36
|
+
export type Response = Success | Error;
|
70
37
|
export {};
|
@@ -1,32 +1,15 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.Error = exports.Success =
|
3
|
+
exports.Error = exports.Success = void 0;
|
4
4
|
const response_base_1 = require("./response-base");
|
5
|
+
const enums_1 = require("./enums");
|
5
6
|
/**
|
6
|
-
*
|
7
|
-
* response object is resolved to a type-safe object of one of
|
8
|
-
* the following subtypes:
|
9
|
-
*
|
10
|
-
* - {Success}
|
11
|
-
* - {Error}
|
12
|
-
*
|
13
|
-
* `instanceof` type guards can be used to operate on the appropriate subtype.
|
14
|
-
* @example
|
15
|
-
* For example:
|
16
|
-
* ```
|
17
|
-
* if (response instanceof ListCaches.Error) {
|
18
|
-
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
19
|
-
* // `ListCaches.Error` in this block, so you will have access to the properties
|
20
|
-
* // of the Error class; e.g. `response.errorCode()`.
|
21
|
-
* }
|
22
|
-
* ```
|
7
|
+
* Indicates a successful list caches request.
|
23
8
|
*/
|
24
|
-
class
|
25
|
-
}
|
26
|
-
exports.Response = Response;
|
27
|
-
class _Success extends Response {
|
9
|
+
class Success extends response_base_1.BaseResponseSuccess {
|
28
10
|
constructor(caches) {
|
29
11
|
super();
|
12
|
+
this.type = enums_1.ListCachesResponse.Success;
|
30
13
|
this.caches = caches;
|
31
14
|
}
|
32
15
|
/**
|
@@ -41,18 +24,7 @@ class _Success extends Response {
|
|
41
24
|
return super.toString() + ': ' + caches.join(', ');
|
42
25
|
}
|
43
26
|
}
|
44
|
-
/**
|
45
|
-
* Indicates a Successful list caches request.
|
46
|
-
*/
|
47
|
-
class Success extends (0, response_base_1.ResponseSuccess)(_Success) {
|
48
|
-
}
|
49
27
|
exports.Success = Success;
|
50
|
-
class _Error extends Response {
|
51
|
-
constructor(_innerException) {
|
52
|
-
super();
|
53
|
-
this._innerException = _innerException;
|
54
|
-
}
|
55
|
-
}
|
56
28
|
/**
|
57
29
|
* Indicates that an error occurred during the list caches request.
|
58
30
|
*
|
@@ -63,7 +35,11 @@ class _Error extends Response {
|
|
63
35
|
* - `message()` - a human-readable description of the error
|
64
36
|
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
65
37
|
*/
|
66
|
-
class Error extends
|
38
|
+
class Error extends response_base_1.BaseResponseError {
|
39
|
+
constructor(_innerException) {
|
40
|
+
super(_innerException);
|
41
|
+
this.type = enums_1.ListCachesResponse.Error;
|
42
|
+
}
|
67
43
|
}
|
68
44
|
exports.Error = Error;
|
69
|
-
//# sourceMappingURL=data:application/json;base64,
|
45
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlzdC1jYWNoZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvbWVzc2FnZXMvcmVzcG9uc2VzL2xpc3QtY2FjaGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUNBLG1EQUF1RTtBQUN2RSxtQ0FBMkM7QUFPM0M7O0dBRUc7QUFDSCxNQUFhLE9BQVEsU0FBUSxtQ0FBbUI7SUFJOUMsWUFBWSxNQUFtQjtRQUM3QixLQUFLLEVBQUUsQ0FBQztRQUpELFNBQUksR0FBK0IsMEJBQWtCLENBQUMsT0FBTyxDQUFDO1FBS3JFLElBQUksQ0FBQyxNQUFNL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ZCBsaWtlIHRvIGhhbmRsZSB0aGUgZXJyb3I6XG4gKlxuICogLSBgZXJyb3JDb2RlKClgIC0gYSB1bmlxdWUgTW9tZW50byBlcnJvciBjb2RlIGluZGljYXRpbmcgdGhlIHR5cGUgb2YgZXJyb3IgdGhhdCBvY2N1cnJlZC5cbiAqIC0gYG1lc3NhZ2UoKWAgLSBhIGh1bWFuLXJlYWRhYmxlIGRlc2NyaXB0aW9uIG9mIHRoZSBlcnJvclxuICogLSBgaW5uZXJFeGNlcHRpb24oKWAgLSB0aGUgb3JpZ2luYWwgZXJyb3IgdGhhdCBjYXVzZWQgdGhlIGZhaWx1cmU7IGNhbiBiZSByZS10aHJvd24uXG4gKi9cbmV4cG9ydCBjbGFzcyBFcnJvciBleHRlbmRzIEJhc2VSZXNwb25zZUVycm9yIGltcGxlbWVudHMgSVJlc3BvbnNlIHtcbiAgY29uc3RydWN0b3IoX2lubmVyRXhjZXB0aW9uOiBTZGtFcnJvcikge1xuICAgIHN1cGVyKF9pbm5lckV4Y2VwdGlvbik7XG4gIH1cblxuICByZWFkb25seSB0eXBlOiBMaXN0Q2FjaGVzUmVzcG9uc2UuRXJyb3IgPSBMaXN0Q2FjaGVzUmVzcG9uc2UuRXJyb3I7XG59XG5cbmV4cG9ydCB0eXBlIFJlc3BvbnNlID0gU3VjY2VzcyB8IEVycm9yO1xuIl19
|
@@ -1,9 +1,12 @@
|
|
1
|
-
import {
|
1
|
+
import { BaseResponseSuccess, BaseResponseError } from './response-base';
|
2
|
+
import { RefreshApiKeyResponse } from './enums';
|
2
3
|
import { SdkError } from '../../errors';
|
3
4
|
import { ExpiresAt } from '../../utils';
|
4
|
-
|
5
|
+
interface IResponse {
|
6
|
+
readonly type: RefreshApiKeyResponse;
|
5
7
|
}
|
6
|
-
declare class
|
8
|
+
export declare class Success extends BaseResponseSuccess implements IResponse {
|
9
|
+
readonly type: RefreshApiKeyResponse.Success;
|
7
10
|
readonly apiKey: string;
|
8
11
|
readonly refreshToken: string;
|
9
12
|
readonly endpoint: string;
|
@@ -15,29 +18,6 @@ declare class _Success extends Response {
|
|
15
18
|
get authToken(): string;
|
16
19
|
constructor(apiKey: string, refreshToken: string, endpoint: string, expiresAt: ExpiresAt);
|
17
20
|
}
|
18
|
-
declare const Success_base: {
|
19
|
-
new (...args: any[]): {
|
20
|
-
readonly is_success: boolean;
|
21
|
-
};
|
22
|
-
} & typeof _Success;
|
23
|
-
/**
|
24
|
-
* Indicates a Successful generate api token request.
|
25
|
-
*/
|
26
|
-
export declare class Success extends Success_base {
|
27
|
-
}
|
28
|
-
declare class _Error extends Response {
|
29
|
-
protected _innerException: SdkError;
|
30
|
-
constructor(_innerException: SdkError);
|
31
|
-
}
|
32
|
-
declare const Error_base: {
|
33
|
-
new (...args: any[]): {
|
34
|
-
_innerException: SdkError;
|
35
|
-
message(): string;
|
36
|
-
innerException(): SdkError;
|
37
|
-
errorCode(): import("../../errors").MomentoErrorCode;
|
38
|
-
toString(): string;
|
39
|
-
};
|
40
|
-
} & typeof _Error;
|
41
21
|
/**
|
42
22
|
* Indicates that an error occurred during the generate api token request.
|
43
23
|
*
|
@@ -48,6 +28,9 @@ declare const Error_base: {
|
|
48
28
|
* - `message()` - a human-readable description of the error
|
49
29
|
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
50
30
|
*/
|
51
|
-
export declare class Error extends
|
31
|
+
export declare class Error extends BaseResponseError implements IResponse {
|
32
|
+
constructor(innerException: SdkError);
|
33
|
+
readonly type: RefreshApiKeyResponse.Error;
|
52
34
|
}
|
35
|
+
export type Response = Success | Error;
|
53
36
|
export {};
|
@@ -1,12 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.Error = exports.Success =
|
3
|
+
exports.Error = exports.Success = void 0;
|
4
4
|
const response_base_1 = require("./response-base");
|
5
|
+
const enums_1 = require("./enums");
|
5
6
|
const utils_1 = require("../../internal/utils");
|
6
|
-
class
|
7
|
-
}
|
8
|
-
exports.Response = Response;
|
9
|
-
class _Success extends Response {
|
7
|
+
class Success extends response_base_1.BaseResponseSuccess {
|
10
8
|
/**
|
11
9
|
* @deprecated Use `apiKey` instead.
|
12
10
|
* @returns {string}
|
@@ -16,24 +14,14 @@ class _Success extends Response {
|
|
16
14
|
}
|
17
15
|
constructor(apiKey, refreshToken, endpoint, expiresAt) {
|
18
16
|
super();
|
17
|
+
this.type = enums_1.RefreshApiKeyResponse.Success;
|
19
18
|
this.apiKey = (0, utils_1.encodeToBase64)(JSON.stringify({ endpoint: endpoint, api_key: apiKey }));
|
20
19
|
this.refreshToken = refreshToken;
|
21
20
|
this.endpoint = endpoint;
|
22
21
|
this.expiresAt = expiresAt;
|
23
22
|
}
|
24
23
|
}
|
25
|
-
/**
|
26
|
-
* Indicates a Successful generate api token request.
|
27
|
-
*/
|
28
|
-
class Success extends (0, response_base_1.ResponseSuccess)(_Success) {
|
29
|
-
}
|
30
24
|
exports.Success = Success;
|
31
|
-
class _Error extends Response {
|
32
|
-
constructor(_innerException) {
|
33
|
-
super();
|
34
|
-
this._innerException = _innerException;
|
35
|
-
}
|
36
|
-
}
|
37
25
|
/**
|
38
26
|
* Indicates that an error occurred during the generate api token request.
|
39
27
|
*
|
@@ -44,7 +32,11 @@ class _Error extends Response {
|
|
44
32
|
* - `message()` - a human-readable description of the error
|
45
33
|
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
46
34
|
*/
|
47
|
-
class Error extends
|
35
|
+
class Error extends response_base_1.BaseResponseError {
|
36
|
+
constructor(innerException) {
|
37
|
+
super(innerException);
|
38
|
+
this.type = enums_1.RefreshApiKeyResponse.Error;
|
39
|
+
}
|
48
40
|
}
|
49
41
|
exports.Error = Error;
|
50
|
-
//# sourceMappingURL=data:application/json;base64,
|
42
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVmcmVzaC1hcGkta2V5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJ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nNlRXJyb3IgaW1wbGVtZW50cyBJUmVzcG9uc2Uge1xuICBjb25zdHJ1Y3Rvcihpbm5lckV4Y2VwdGlvbjogU2RrRXJyb3IpIHtcbiAgICBzdXBlcihpbm5lckV4Y2VwdGlvbik7XG4gIH1cblxuICByZWFkb25seSB0eXBlOiBSZWZyZXNoQXBpS2V5UmVzcG9uc2UuRXJyb3IgPSBSZWZyZXNoQXBpS2V5UmVzcG9uc2UuRXJyb3I7XG59XG5cbmV4cG9ydCB0eXBlIFJlc3BvbnNlID0gU3VjY2VzcyB8IEVycm9yO1xuIl19
|
@@ -18,6 +18,17 @@ export interface IResponseMiss {
|
|
18
18
|
export interface IListResponseSuccess {
|
19
19
|
listLength(): number;
|
20
20
|
}
|
21
|
+
export interface IResponseSubscription {
|
22
|
+
is_subscribed: boolean;
|
23
|
+
}
|
24
|
+
export declare abstract class BaseResponseError extends ResponseBase {
|
25
|
+
_innerException: SdkError;
|
26
|
+
protected constructor(innerException: SdkError);
|
27
|
+
message(): string;
|
28
|
+
innerException(): SdkError;
|
29
|
+
errorCode(): MomentoErrorCode;
|
30
|
+
toString(): string;
|
31
|
+
}
|
21
32
|
export declare function ResponseError<TBase extends Constructor>(Base: TBase): {
|
22
33
|
new (...args: any[]): {
|
23
34
|
_innerException: SdkError;
|
@@ -30,11 +41,20 @@ export declare function ResponseError<TBase extends Constructor>(Base: TBase): {
|
|
30
41
|
export declare function ResponseHit<TBase extends Constructor>(Base: TBase): {
|
31
42
|
new (...args: any[]): {};
|
32
43
|
} & TBase;
|
44
|
+
export declare abstract class BaseResponseMiss extends ResponseBase {
|
45
|
+
readonly is_miss: boolean;
|
46
|
+
}
|
33
47
|
export declare function ResponseMiss<TBase extends Constructor>(Base: TBase): {
|
34
48
|
new (...args: any[]): {
|
35
49
|
readonly is_miss: boolean;
|
36
50
|
};
|
37
51
|
} & TBase;
|
52
|
+
export declare abstract class BaseResponseSuccess extends ResponseBase {
|
53
|
+
readonly is_success: boolean;
|
54
|
+
}
|
55
|
+
export declare abstract class BaseResponseSubscription extends ResponseBase {
|
56
|
+
readonly is_subscribed: boolean;
|
57
|
+
}
|
38
58
|
export declare function ResponseSuccess<TBase extends Constructor>(Base: TBase): {
|
39
59
|
new (...args: any[]): {
|
40
60
|
readonly is_success: boolean;
|
@@ -1,12 +1,31 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.ResponseNotFound = exports.ResponseFound = exports.ResponseSuccess = exports.ResponseMiss = exports.ResponseHit = exports.ResponseError = exports.ResponseBase = void 0;
|
3
|
+
exports.ResponseNotFound = exports.ResponseFound = exports.ResponseSuccess = exports.BaseResponseSubscription = exports.BaseResponseSuccess = exports.ResponseMiss = exports.BaseResponseMiss = exports.ResponseHit = exports.ResponseError = exports.BaseResponseError = exports.ResponseBase = void 0;
|
4
4
|
class ResponseBase {
|
5
5
|
toString() {
|
6
6
|
return this.constructor.name;
|
7
7
|
}
|
8
8
|
}
|
9
9
|
exports.ResponseBase = ResponseBase;
|
10
|
+
class BaseResponseError extends ResponseBase {
|
11
|
+
constructor(innerException) {
|
12
|
+
super();
|
13
|
+
this._innerException = innerException;
|
14
|
+
}
|
15
|
+
message() {
|
16
|
+
return this._innerException.wrappedErrorMessage();
|
17
|
+
}
|
18
|
+
innerException() {
|
19
|
+
return this._innerException;
|
20
|
+
}
|
21
|
+
errorCode() {
|
22
|
+
return this._innerException.errorCode();
|
23
|
+
}
|
24
|
+
toString() {
|
25
|
+
return this.message();
|
26
|
+
}
|
27
|
+
}
|
28
|
+
exports.BaseResponseError = BaseResponseError;
|
10
29
|
function ResponseError(Base) {
|
11
30
|
return class ResponseError extends Base {
|
12
31
|
message() {
|
@@ -29,6 +48,13 @@ function ResponseHit(Base) {
|
|
29
48
|
};
|
30
49
|
}
|
31
50
|
exports.ResponseHit = ResponseHit;
|
51
|
+
class BaseResponseMiss extends ResponseBase {
|
52
|
+
constructor() {
|
53
|
+
super(...arguments);
|
54
|
+
this.is_miss = true;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
exports.BaseResponseMiss = BaseResponseMiss;
|
32
58
|
function ResponseMiss(Base) {
|
33
59
|
return class ResponseMiss extends Base {
|
34
60
|
constructor() {
|
@@ -38,6 +64,20 @@ function ResponseMiss(Base) {
|
|
38
64
|
};
|
39
65
|
}
|
40
66
|
exports.ResponseMiss = ResponseMiss;
|
67
|
+
class BaseResponseSuccess extends ResponseBase {
|
68
|
+
constructor() {
|
69
|
+
super(...arguments);
|
70
|
+
this.is_success = true;
|
71
|
+
}
|
72
|
+
}
|
73
|
+
exports.BaseResponseSuccess = BaseResponseSuccess;
|
74
|
+
class BaseResponseSubscription extends ResponseBase {
|
75
|
+
constructor() {
|
76
|
+
super(...arguments);
|
77
|
+
this.is_subscribed = true;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
exports.BaseResponseSubscription = BaseResponseSubscription;
|
41
81
|
function ResponseSuccess(Base) {
|
42
82
|
return class ResponseSuccess extends Base {
|
43
83
|
constructor() {
|
@@ -57,4 +97,4 @@ function ResponseNotFound(Base) {
|
|
57
97
|
};
|
58
98
|
}
|
59
99
|
exports.ResponseNotFound = ResponseNotFound;
|
60
|
-
//# sourceMappingURL=data:application/json;base64,
|
100
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVzcG9uc2UtYmFzZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9tZXNzYWdlcy9yZXNwb25zZXMvcmVzcG9uc2UtYmFzZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFFQSxNQUFzQixZQUFZO0lBQ3pCLFFBQVE7UUFDYixPQUFPLElBQUksQ0FBQyxXQUFXLENBQUMsSUFBSSxDQUFDO0lBQy9CLENBQUM7Q0FDRjtBQUpELG9DQUlDO0FBK0JELE1BQXNCLGlCQUFrQixTQUFRLFlBQVk7S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gaXNfc3VjY2VzczogYm9vbGVhbiA9IHRydWU7XG59XG5cbmV4cG9ydCBhYnN0cmFjdCBjbGFzcyBCYXNlUmVzcG9uc2VTdWJzY3JpcHRpb24gZXh0ZW5kcyBSZXNwb25zZUJhc2Uge1xuICBwdWJsaWMgcmVhZG9ubHkgaXNfc3Vic2NyaWJlZDogYm9vbGVhbiA9IHRydWU7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiBSZXNwb25zZVN1Y2Nlc3M8VEJhc2UgZXh0ZW5kcyBDb25zdHJ1Y3Rvcj4oQmFzZTogVEJhc2UpIHtcbiAgcmV0dXJuIGNsYXNzIFJlc3BvbnNlU3VjY2VzcyBleHRlbmRzIEJhc2Uge1xuICAgIHB1YmxpYyByZWFkb25seSBpc19zdWNjZXNzOiBib29sZWFuID0gdHJ1ZTtcbiAgfTtcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIFJlc3BvbnNlRm91bmQ8VEJhc2UgZXh0ZW5kcyBDb25zdHJ1Y3Rvcj4oQmFzZTogVEJhc2UpIHtcbiAgcmV0dXJuIGNsYXNzIFJlc3BvbnNlRm91bmQgZXh0ZW5kcyBCYXNlIHt9O1xufVxuXG5leHBvcnQgZnVuY3Rpb24gUmVzcG9uc2VOb3RGb3VuZDxUQmFzZSBleHRlbmRzIENvbnN0cnVjdG9yPihCYXNlOiBUQmFzZSkge1xuICByZXR1cm4gY2xhc3MgUmVzcG9uc2VOb3RGb3VuZCBleHRlbmRzIEJhc2Uge307XG59XG4iXX0=
|
@@ -1,51 +1,15 @@
|
|
1
1
|
import { SdkError } from '../../errors';
|
2
|
-
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
* the following subtypes:
|
7
|
-
*
|
8
|
-
* - {Success}
|
9
|
-
* - {Error}
|
10
|
-
*
|
11
|
-
* `instanceof` type guards can be used to operate on the appropriate subtype.
|
12
|
-
* @example
|
13
|
-
* For example:
|
14
|
-
* ```
|
15
|
-
* if (response instanceof TopicPublish.Error) {
|
16
|
-
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
17
|
-
* // `TopicPublish.Error` in this block, so you will have access to the properties
|
18
|
-
* // of the Error class; e.g. `response.errorCode()`.
|
19
|
-
* }
|
20
|
-
* ```
|
21
|
-
*/
|
22
|
-
export declare abstract class Response extends ResponseBase {
|
2
|
+
import { BaseResponseError, BaseResponseSuccess } from './response-base';
|
3
|
+
import { TopicPublishResponse } from './enums';
|
4
|
+
interface IResponse {
|
5
|
+
readonly type: TopicPublishResponse;
|
23
6
|
}
|
24
|
-
declare class _Success extends Response {
|
25
|
-
}
|
26
|
-
declare const Success_base: {
|
27
|
-
new (...args: any[]): {
|
28
|
-
readonly is_success: boolean;
|
29
|
-
};
|
30
|
-
} & typeof _Success;
|
31
7
|
/**
|
32
8
|
* Indicates a Successful cache set request.
|
33
9
|
*/
|
34
|
-
export declare class Success extends
|
35
|
-
|
36
|
-
declare class _Error extends Response {
|
37
|
-
protected _innerException: SdkError;
|
38
|
-
constructor(_innerException: SdkError);
|
10
|
+
export declare class Success extends BaseResponseSuccess implements IResponse {
|
11
|
+
readonly type: TopicPublishResponse.Success;
|
39
12
|
}
|
40
|
-
declare const Error_base: {
|
41
|
-
new (...args: any[]): {
|
42
|
-
_innerException: SdkError;
|
43
|
-
message(): string;
|
44
|
-
innerException(): SdkError;
|
45
|
-
errorCode(): import("../../errors").MomentoErrorCode;
|
46
|
-
toString(): string;
|
47
|
-
};
|
48
|
-
} & typeof _Error;
|
49
13
|
/**
|
50
14
|
* Indicates that an error occurred during the cache set request.
|
51
15
|
*
|
@@ -56,6 +20,9 @@ declare const Error_base: {
|
|
56
20
|
* - `message()` - a human-readable description of the error
|
57
21
|
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
58
22
|
*/
|
59
|
-
export declare class Error extends
|
23
|
+
export declare class Error extends BaseResponseError implements IResponse {
|
24
|
+
readonly type: TopicPublishResponse.Error;
|
25
|
+
constructor(_innerException: SdkError);
|
60
26
|
}
|
27
|
+
export type Response = Success | Error;
|
61
28
|
export {};
|