@notionhq/client
Version:
A simple and easy to use client for the Notion API
139 lines • 4.51 kB
TypeScript
import type { EmptyObject, IdRequest, IdResponse, RequestStatusResponse } from "./common";
export type FileUploadObjectResponse = {
object: "file_upload";
id: IdResponse;
created_time: string;
created_by: {
id: IdResponse;
type: "person" | "bot" | "agent";
};
last_edited_time: string;
in_trash: boolean;
/** @deprecated Use `in_trash` instead. Present for backwards compatibility with API versions prior to 2026-03-11. */
archived: boolean;
expiry_time: string | null;
status: "pending" | "uploaded" | "expired" | "failed";
filename: string | null;
content_type: string | null;
content_length: number | null;
upload_url?: string;
complete_url?: string;
file_import_result?: {
imported_time: string;
} & ({
type: "success";
success: EmptyObject;
} | {
type: "error";
error: {
type: "validation_error" | "internal_system_error" | "download_error" | "upload_error";
code: string;
message: string;
parameter: string | null;
status_code: number | null;
};
});
number_of_parts?: {
total: number;
sent: number;
};
};
type CreateFileUploadBodyParameters = {
mode?: "single_part" | "multi_part" | "external_url";
filename?: string;
content_type?: string;
number_of_parts?: number;
external_url?: string;
};
export type CreateFileUploadParameters = CreateFileUploadBodyParameters;
export type CreateFileUploadResponse = FileUploadObjectResponse;
/**
* Create a file upload
*/
export declare const createFileUpload: {
readonly method: "post";
readonly pathParams: readonly [];
readonly queryParams: readonly [];
readonly bodyParams: readonly ["mode", "filename", "content_type", "number_of_parts", "external_url"];
readonly path: () => string;
};
type ListFileUploadsQueryParameters = {
status?: "pending" | "uploaded" | "expired" | "failed";
start_cursor?: string;
page_size?: number;
};
export type ListFileUploadsParameters = ListFileUploadsQueryParameters;
export type ListFileUploadsResponse = {
object: "list";
next_cursor: IdResponse | null;
has_more: boolean;
results: Array<FileUploadObjectResponse>;
type: "file_upload";
file_upload: EmptyObject;
request_status?: RequestStatusResponse;
};
/**
* List file uploads
*/
export declare const listFileUploads: {
readonly method: "get";
readonly pathParams: readonly [];
readonly queryParams: readonly ["status", "start_cursor", "page_size"];
readonly bodyParams: readonly [];
readonly path: () => string;
};
type SendFileUploadPathParameters = {
file_upload_id: IdRequest;
};
type SendFileUploadFormDataParameters = {
file: {
filename?: string;
data: string | Blob;
};
part_number?: string;
};
export type SendFileUploadParameters = SendFileUploadPathParameters & SendFileUploadFormDataParameters;
export type SendFileUploadResponse = FileUploadObjectResponse;
/**
* Upload a file
*/
export declare const sendFileUpload: {
readonly method: "post";
readonly pathParams: readonly ["file_upload_id"];
readonly queryParams: readonly [];
readonly bodyParams: readonly [];
readonly formDataParams: readonly ["file", "part_number"];
readonly path: (p: SendFileUploadPathParameters) => string;
};
type CompleteFileUploadPathParameters = {
file_upload_id: IdRequest;
};
export type CompleteFileUploadParameters = CompleteFileUploadPathParameters;
export type CompleteFileUploadResponse = FileUploadObjectResponse;
/**
* Complete a multi-part file upload
*/
export declare const completeFileUpload: {
readonly method: "post";
readonly pathParams: readonly ["file_upload_id"];
readonly queryParams: readonly [];
readonly bodyParams: readonly [];
readonly path: (p: CompleteFileUploadPathParameters) => string;
};
type GetFileUploadPathParameters = {
file_upload_id: IdRequest;
};
export type GetFileUploadParameters = GetFileUploadPathParameters;
export type GetFileUploadResponse = FileUploadObjectResponse;
/**
* Retrieve a file upload
*/
export declare const getFileUpload: {
readonly method: "get";
readonly pathParams: readonly ["file_upload_id"];
readonly queryParams: readonly [];
readonly bodyParams: readonly [];
readonly path: (p: GetFileUploadPathParameters) => string;
};
export {};
//# sourceMappingURL=file-uploads.d.ts.map