-
Notifications
You must be signed in to change notification settings - Fork 5
feat: initial docs for tigris sdk #262
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
62200a3
feat: initial docs for tigris sdk
designcode 0c87b5a
feat: initial docs for tigris sdk
designcode beb8ab3
feat: initial docs for tigris sdk
designcode 20f9ee8
fix(sdks/tigris): amend wording, tabify examples
Xe d7facd9
fix(sdks/tigris/api-ref): amend wording to flow better
Xe a3f1f5e
feat: sdk docs
designcode ad87196
fix: blog link
designcode 80cdbfa
fix: code formatting
designcode 8b055f1
chore: structured docs
designcode 62454a7
chore: structured docs
designcode 256fb99
chore: add presigned url examples
designcode 39c2015
chore: PR comments
designcode ad69d74
chore: PR comments
designcode 6a80b05
chore: typos
designcode 0b5e1c4
chore: remove homepage banner
designcode File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,349 @@ | ||
| # Tigris Storage API Reference | ||
|
|
||
| ## Configuration | ||
|
|
||
| ### TigrisStorageConfig | ||
|
|
||
| The configuration object for Tigris Storage operations. | ||
|
|
||
| ```typescript | ||
| type TigrisStorageConfig = { | ||
| bucket?: string; | ||
| accessKeyId?: string; | ||
| secretAccessKey?: string; | ||
| endpoint?: string; | ||
| }; | ||
| ``` | ||
|
|
||
| **Properties:** | ||
|
|
||
| - `bucket` (optional): The storage bucket name | ||
| - `accessKeyId` (optional): Access key ID for authentication | ||
| - `secretAccessKey` (optional): Secret access key for authentication | ||
| - `endpoint` (optional): Custom endpoint URL | ||
|
|
||
| ### TigrisStorageResponse | ||
|
|
||
| A generic response wrapper for all Tigris Storage operations. All the functions | ||
| return a `TigrisStorageResponse` object. If there is an error, the `error` | ||
| property will be set. If there is a successful response, the `data` property | ||
| will be set. | ||
|
|
||
| ```typescript | ||
| type TigrisStorageResponse<T, E = unknown> = { | ||
| data?: T; | ||
| error?: E; | ||
| }; | ||
| ``` | ||
|
|
||
| **Type Parameters:** | ||
|
|
||
| - `T`: The type of successful response data | ||
| - `E`: The type of error (defaults to `unknown`) | ||
|
|
||
| **Properties:** | ||
|
|
||
| - `data` (optional): The response data on success | ||
| - `error` (optional): Error information on failure | ||
|
|
||
| ## Functions | ||
|
|
||
| ### get() | ||
|
|
||
| Retrieves an object from storage with support for different return formats. | ||
|
|
||
| ```typescript | ||
| // String format | ||
| function get( | ||
| path: string, | ||
| format: "string", | ||
| options?: GetOptions, | ||
| ): Promise<TigrisStorageResponse<string, Error>>; | ||
|
|
||
| // File format | ||
| function get( | ||
| path: string, | ||
| format: "file", | ||
| options?: GetOptions, | ||
| ): Promise<TigrisStorageResponse<File, Error>>; | ||
|
|
||
| // Stream format | ||
| function get( | ||
| path: string, | ||
| format: "stream", | ||
| options?: GetOptions, | ||
| ): Promise<TigrisStorageResponse<ReadableStream, Error>>; | ||
| ``` | ||
|
|
||
| **Parameters:** | ||
|
|
||
| - `path`: The path to the object in storage | ||
| - `format`: The desired return format (`'string'`, `'file'`, or `'stream'`) | ||
| - `options` (optional): Additional options for the get operation | ||
|
|
||
| **Returns:** Promise resolving to a `TigrisStorageResponse` with the requested | ||
| data type. | ||
|
|
||
| #### GetOptions | ||
|
|
||
| ```typescript | ||
| type GetOptions = { | ||
| config?: TigrisStorageConfig; | ||
| contentDisposition?: "attachment" | "inline"; | ||
| contentType?: string; | ||
| encoding?: string; | ||
| }; | ||
| ``` | ||
|
|
||
| **Properties:** | ||
|
|
||
| - `config` (optional): Tigris storage configuration | ||
| - `contentDisposition` (optional): How the content should be presented | ||
| (`'attachment'` or `'inline'`) | ||
| - `contentType` (optional): MIME type of the content | ||
| - `encoding` (optional): Character encoding for the content | ||
|
|
||
| ### list() | ||
|
|
||
| Lists objects in the storage bucket with pagination support. | ||
|
|
||
| ```typescript | ||
| function list( | ||
| options?: ListOptions, | ||
| ): Promise<TigrisStorageResponse<ListResponse, Error>>; | ||
| ``` | ||
|
|
||
| **Parameters:** | ||
|
|
||
| - `options` (optional): Options for listing objects | ||
|
|
||
| **Returns:** Promise resolving to a `TigrisStorageResponse` containing the list | ||
| of items. | ||
|
|
||
| #### ListOptions | ||
|
|
||
| ```typescript | ||
| type ListOptions = { | ||
| limit?: number; | ||
| paginationToken?: string; | ||
| config?: TigrisStorageConfig; | ||
| }; | ||
| ``` | ||
|
|
||
| **Properties:** | ||
|
|
||
| - `limit` (optional): Maximum number of items to return | ||
| - `paginationToken` (optional): Token for continuing pagination | ||
| - `config` (optional): Tigris storage configuration | ||
|
|
||
| #### ListResponse | ||
|
|
||
| ```typescript | ||
| type ListResponse = { | ||
| items: Item[]; | ||
| paginationToken: string | undefined; | ||
| hasMore: boolean; | ||
| }; | ||
| ``` | ||
|
|
||
| **Properties:** | ||
|
|
||
| - `items`: Array of storage items | ||
| - `paginationToken`: Token for the next page (undefined if no more pages) | ||
| - `hasMore`: Boolean indicating if more items are available | ||
|
|
||
| #### Item | ||
|
|
||
| ```typescript | ||
| type Item = { | ||
| id: string; | ||
| name: string; | ||
| size: number; | ||
| lastModified: Date; | ||
| }; | ||
| ``` | ||
|
|
||
| **Properties:** | ||
|
|
||
| - `id`: Unique identifier for the item | ||
| - `name`: Name of the item | ||
| - `size`: Size of the item in bytes | ||
| - `lastModified`: Date when the item was last modified | ||
|
|
||
| ### head() | ||
|
|
||
| Retrieves metadata about an object without downloading its content. | ||
|
|
||
| ```typescript | ||
| function head( | ||
| path: string, | ||
| options?: HeadOptions, | ||
| ): Promise<TigrisStorageResponse<HeadResponse, Error> | undefined>; | ||
| ``` | ||
designcode marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| **Parameters:** | ||
|
|
||
| - `path`: The path to the object in storage | ||
| - `options` (optional): Options for the head operation | ||
|
|
||
| **Returns:** Promise resolving to a `TigrisStorageResponse` with object | ||
| metadata, or `undefined`. | ||
|
|
||
| #### HeadOptions | ||
|
|
||
| ```typescript | ||
| type HeadOptions = { | ||
| config?: TigrisStorageConfig; | ||
| }; | ||
| ``` | ||
|
|
||
| **Properties:** | ||
|
|
||
| - `config` (optional): Tigris storage configuration | ||
|
|
||
| #### HeadResponse | ||
|
|
||
| ```typescript | ||
| type HeadResponse = { | ||
| contentDisposition: string; | ||
| contentType: string; | ||
| modified: Date; | ||
| path: string; | ||
| size: number; | ||
| url: string; | ||
| }; | ||
| ``` | ||
|
|
||
| **Properties:** | ||
|
|
||
| - `contentDisposition`: Content disposition header value | ||
| - `contentType`: MIME type of the object | ||
| - `modified`: Date when the object was last modified | ||
| - `path`: Path of the object in storage | ||
| - `size`: Size of the object in bytes | ||
| - `url`: URL to access the object | ||
|
|
||
| ### put() | ||
|
|
||
| Uploads data to storage. | ||
|
|
||
| ```typescript | ||
| function put( | ||
| path: string, | ||
| data: string | ReadableStream | Blob | Buffer, | ||
| options?: PutOptions, | ||
| ): Promise<TigrisStorageResponse<PutResponse, Error>>; | ||
| ``` | ||
|
|
||
| **Parameters:** | ||
|
|
||
| - `path`: The destination path in storage | ||
| - `data`: The data to upload (string, ReadableStream, Blob, or Buffer) | ||
| - `options` (optional): Options for the put operation | ||
|
|
||
| **Returns:** Promise resolving to a `TigrisStorageResponse` with upload details. | ||
|
|
||
| #### PutOptions | ||
|
|
||
| ```typescript | ||
| type PutOptions = { | ||
| access?: "public" | "private"; | ||
| addRandomSuffix?: boolean; | ||
| allowOverwrite?: boolean; | ||
| contentType?: string; | ||
| contentDisposition?: "attachment" | "inline"; | ||
| multipart?: boolean; | ||
| abortController?: AbortController; | ||
| onUploadProgress?: PutOnUploadProgress; | ||
| config?: TigrisStorageConfig; | ||
| }; | ||
| ``` | ||
|
|
||
| **Properties:** | ||
|
|
||
| - `access` (optional): Access level for the uploaded object (`'public'` or | ||
| `'private'`) | ||
| - `addRandomSuffix` (optional): Whether to add a random suffix to the path | ||
| - `allowOverwrite` (optional): Whether to allow overwriting existing objects, | ||
| defaults to `true` | ||
| - `contentType` (optional): MIME type of the content | ||
| - `contentDisposition` (optional): How the content should be presented | ||
| - `multipart` (optional): Whether to use multipart upload | ||
| - `abortController` (optional): Controller to abort the upload | ||
| - `onUploadProgress` (optional): Callback function for upload progress | ||
| - `config` (optional): Tigris storage configuration | ||
|
|
||
| #### PutOnUploadProgress | ||
|
|
||
| ```typescript | ||
| type PutOnUploadProgress = ({ | ||
| loaded, | ||
| total, | ||
| percentage, | ||
| }: { | ||
| loaded: number; | ||
| total: number; | ||
| percentage: number; | ||
| }) => void; | ||
| ``` | ||
|
|
||
| Callback function that receives upload progress information. | ||
|
|
||
| **Parameters:** | ||
|
|
||
| - `loaded`: Number of bytes uploaded | ||
| - `total`: Total number of bytes to upload | ||
| - `percentage`: Upload progress as a percentage | ||
|
|
||
| #### PutResponse | ||
|
|
||
| ```typescript | ||
| type PutResponse = { | ||
| contentDisposition: string | undefined; | ||
| contentType: string | undefined; | ||
| modified: Date; | ||
| path: string; | ||
| size: number; | ||
| url: string; | ||
| }; | ||
| ``` | ||
|
|
||
| **Properties:** | ||
|
|
||
| - `contentDisposition`: Content disposition header value (may be undefined) | ||
| - `contentType`: MIME type of the uploaded object (may be undefined) | ||
| - `modified`: Date when the object was uploaded/modified | ||
| - `path`: Path where the object was stored | ||
| - `size`: Size of the uploaded object in bytes | ||
| - `url`: URL to access the uploaded object | ||
|
|
||
| ### remove() | ||
|
|
||
| Deletes an object from storage. | ||
|
|
||
| ```typescript | ||
| function remove( | ||
| path: string, | ||
| options?: RemoveOptions, | ||
| ): Promise<TigrisStorageResponse<void, Error> | void>; | ||
| ``` | ||
designcode marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| **Parameters:** | ||
|
|
||
| - `path`: The path to the object to delete | ||
| - `options` (optional): Options for the remove operation | ||
|
|
||
| **Returns:** Promise resolving to a `TigrisStorageResponse` with void data, or | ||
| `void`. | ||
|
|
||
| #### RemoveOptions | ||
|
|
||
| ```typescript | ||
| type RemoveOptions = { | ||
| config?: TigrisStorageConfig; | ||
| }; | ||
| ``` | ||
|
|
||
| **Properties:** | ||
|
|
||
| - `config` (optional): Tigris storage configuration | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.