appwrite-utils
Version:
`appwrite-utils` is a comprehensive TypeScript library designed to streamline the development process for Appwrite projects. It provides a suite of utilities and helper functions that facilitate data manipulation, schema management, and seamless integrati
60 lines (59 loc) • 3.07 kB
TypeScript
import type { Models } from "appwrite";
/**
* Generates the view URL for a specific file based on the provided endpoint, project ID, bucket ID, file ID, and optional JWT token.
*
* @param {string} endpoint - the base URL endpoint
* @param {string} projectId - the ID of the project
* @param {string} bucketId - the ID of the bucket
* @param {string} fileId - the ID of the file
* @param {Models.Jwt} [jwt] - optional JWT token generated via the Appwrite SDK
* @return {string} the generated view URL for the file
*/
export declare const getFileViewUrl: (endpoint: string, projectId: string, bucketId: string, fileId: string, jwt?: Models.Jwt) => string;
/**
* Generates a download URL for a file based on the provided endpoint, project ID, bucket ID, file ID, and optionally a JWT.
*
* @param {string} endpoint - The base URL endpoint.
* @param {string} projectId - The ID of the project.
* @param {string} bucketId - The ID of the bucket.
* @param {string} fileId - The ID of the file.
* @param {Models.Jwt} [jwt] - Optional JWT object for authentication with Appwrite.
* @return {string} The complete download URL for the file.
*/
export declare const getFileDownloadUrl: (endpoint: string, projectId: string, bucketId: string, fileId: string, jwt?: Models.Jwt) => string;
/**
* Generates a preview URL for a file based on the provided endpoint, project ID, bucket ID, file ID, and optional JWT.
* Only works on Image Files with a max of 10 MB file size.
*
* @param {string} endpoint - The base URL endpoint.
* @param {string} projectId - The ID of the project.
* @param {string} bucketId - The ID of the bucket.
* @param {string} fileId - The ID of the file.
* @param {Models.Jwt} [jwt] - Optional JWT object for authentication with Appwrite.
* @param {Object} [options] - Optional options for the preview
* @param {number} [options.width] - The width of the preview
* @param {number} [options.height] - The height of the preview
* @param {string} [options.gravity] - The gravity of the preview
* @param {number} [options.quality] - The quality of the preview
* @param {number} [options.borderWidth] - The border width of the preview
* @param {string} [options.borderColor] - The border color of the preview
* @param {number} [options.borderRadius] - The border radius of the preview
* @param {number} [options.opacity] - The opacity of the preview
* @param {number} [options.rotation] - The rotation of the preview
* @param {string} [options.background] - The background of the preview
* @param {string} [options.output] - The output format of the preview
* @return {string} The complete preview URL for the file.
*/
export declare const getFilePreviewUrl: (endpoint: string, projectId: string, bucketId: string, fileId: string, jwt?: Models.Jwt, options?: {
width?: number;
height?: number;
gravity?: string;
quality?: number;
borderWidth?: number;
borderColor?: string;
borderRadius?: number;
opacity?: number;
rotation?: number;
background?: string;
output?: string;
}) => string;