-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add listRetain and allow slices for listFetch (#322)
* Add listRetain and allow slices for listFetch * Correct documentation * faster tracing and better validation --------- Co-authored-by: Ben Kugler <[email protected]>
- Loading branch information
1 parent
e1c2b91
commit b58d74d
Showing
7 changed files
with
323 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import {SdkError} from '../../errors/errors'; | ||
import {ResponseBase, ResponseError, ResponseSuccess} from './response-base'; | ||
|
||
/** | ||
* Parent response type for a list retain request. The | ||
* response object is resolved to a type-safe object of one of | ||
* the following subtypes: | ||
* | ||
* - {Success} | ||
* - {Error} | ||
* | ||
* `instanceof` type guards can be used to operate on the appropriate subtype. | ||
* @example | ||
* For example: | ||
* ``` | ||
* if (response instanceof CacheListRetain.Error) { | ||
* // Handle error as appropriate. The compiler will smart-cast `response` to type | ||
* // `CacheListRetain.Error` in this block, so you will have access to the properties | ||
* // of the Error class; e.g. `response.errorCode()`. | ||
* } | ||
* ``` | ||
*/ | ||
export abstract class Response extends ResponseBase {} | ||
|
||
class _Success extends Response {} | ||
|
||
/** | ||
* Indicates a Successful list retain request. | ||
*/ | ||
export class Success extends ResponseSuccess(_Success) {} | ||
|
||
class _Error extends Response { | ||
constructor(protected _innerException: SdkError) { | ||
super(); | ||
} | ||
} | ||
|
||
/** | ||
* Indicates that an error occurred during the list retain request. | ||
* | ||
* This response object includes the following fields that you can use to determine | ||
* how you would like to handle the error: | ||
* | ||
* - `errorCode()` - a unique Momento error code indicating the type of error that occurred. | ||
* - `message()` - a human-readable description of the error | ||
* - `innerException()` - the original error that caused the failure; can be re-thrown. | ||
*/ | ||
export class Error extends ResponseError(_Error) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.