@devvai/devv-code-backend
Version:
Backend SDK for Devv Code - Provides authentication, data management, email and AI capabilities
142 lines (141 loc) • 3.42 kB
TypeScript
export interface User {
projectId: string;
uid: string;
name: string;
email: string;
createdTime: number;
lastLoginTime: number;
}
export interface AuthResponse {
sid: string;
user: User;
}
export type QueryOperator = 'EQ' | 'NE' | 'LT' | 'LE' | 'GT' | 'GE' | 'BEGINS_WITH' | 'BETWEEN';
export type QueryValue = string | number | boolean | [string | number, string | number];
export interface QueryCondition {
operator: QueryOperator;
value: QueryValue;
}
export interface GetItemsOptions {
limit?: number;
cursor?: string;
sort?: string;
order?: 'asc' | 'desc';
query?: Record<string, string | number | boolean | QueryCondition>;
}
export interface GetItemsResponse {
items: Record<string, any>[];
nextCursor?: string;
indexName?: string;
}
export type ItemData = Record<string, any>;
export interface ApiResponse {
message: string;
}
export interface UploadFileRequest {
file: File;
}
export interface UploadFileSuccessResponse {
[key: string]: string | undefined;
filename?: string;
link?: string;
}
export interface ErrorResponse {
errCode: number;
errMsg: string;
}
export type UploadFileResponse = UploadFileSuccessResponse | ErrorResponse;
export interface EmailTag {
name: string;
value: string;
}
export interface EmailAttachment {
filename: string;
content?: number[];
path?: string;
content_type?: string;
}
export interface SendEmailOptions {
from: string;
to: string[];
subject: string;
bcc?: string[];
cc?: string[];
reply_to?: string;
html?: string;
text?: string;
tags?: EmailTag[];
attachments?: EmailAttachment[];
headers?: Record<string, string>;
scheduled_at?: string;
}
export interface EmailResponse {
id: string;
}
export type ImageAspectRatio = '1:1' | '16:9' | '21:9' | '3:2' | '2:3' | '4:5' | '5:4' | '3:4' | '4:3' | '9:16' | '9:21';
export type ImageOutputFormat = 'webp' | 'jpg' | 'png';
export interface TextToImageOptions {
prompt: string;
num_outputs?: number;
aspect_ratio?: ImageAspectRatio;
output_format?: ImageOutputFormat;
}
export interface TextToImageResponse {
images: string[];
}
interface JinaApiResponse<T> {
code: number;
status: number;
data: T;
meta?: {
usage?: {
tokens: number;
};
};
}
export interface WebSearchOptions {
query: string | string[];
}
export interface WebSearchResult {
title: string;
url: string;
description: string;
content: string;
date?: string;
usage?: {
tokens: number;
};
}
export type WebSearchResponse = JinaApiResponse<WebSearchResult[]>;
export interface WebReaderOptions {
url: string;
}
export interface WebReaderData {
title: string;
description: string;
url: string;
content: string;
publishedTime?: string;
metadata?: Record<string, any>;
external?: Record<string, any>;
warning?: string;
usage?: {
tokens: number;
};
}
export type WebReaderResponse = JinaApiResponse<WebReaderData>;
export interface TextToSpeechOptions {
text: string;
voice_id?: string;
model_id?: string;
output_format?: string;
stability?: number;
similarity_boost?: number;
style?: number;
}
export interface TextToSpeechResponse {
audio_url: string;
format: string;
size: number;
}
export {};