import { type CallOptions, type ChannelCredentials, Client, type ClientOptions, type ClientReadableStream, type ClientUnaryCall, type ClientWritableStream, type handleClientStreamingCall, type handleServerStreamingCall, type handleUnaryCall, type Metadata, type ServiceError, type UntypedServiceImplementation } from "@grpc/grpc-js"; import { CreateDirectoryRequest, CreateDirectoryResponse, DeleteEntryRequest, DeleteEntryResponse, GetEntriesRequest, GetEntriesResponse, GetRootResponse, ReadFileRequest, ReadFileResponse, WriteFileRequest, WriteFileResponse } from "./filesystem_params"; import { Empty } from "./google/protobuf/empty"; /** * The file system service. This service allows the GUI to browse the remote file system * on the machine running the CanKing Service, enabling file and folder selection over * remote connections. */ export type FileSystemServiceService = typeof FileSystemServiceService; export declare const FileSystemServiceService: { /** * Gets the root entry of the remote file system. * @returns A response message with the root file system entry. */ readonly getRoot: { readonly path: "/filesystemservice.FileSystemService/GetRoot"; readonly requestStream: false; readonly responseStream: false; readonly requestSerialize: (value: Empty) => Buffer; readonly requestDeserialize: (value: Buffer) => Empty; readonly responseSerialize: (value: GetRootResponse) => Buffer; readonly responseDeserialize: (value: Buffer) => GetRootResponse; }; /** * Gets the entries (files and subdirectories) of a directory on the remote file system. * @param request A request message with the directory path and an optional file-extension filter. * @returns A response message with the directory entries. */ readonly getEntries: { readonly path: "/filesystemservice.FileSystemService/GetEntries"; readonly requestStream: false; readonly responseStream: false; readonly requestSerialize: (value: GetEntriesRequest) => Buffer; readonly requestDeserialize: (value: Buffer) => GetEntriesRequest; readonly responseSerialize: (value: GetEntriesResponse) => Buffer; readonly responseDeserialize: (value: Buffer) => GetEntriesResponse; }; /** * Reads a file on the remote file system and streams its contents back to the caller. * @param request A request message containing the full file path. * @returns A stream of byte chunks containing the file contents. */ readonly readFile: { readonly path: "/filesystemservice.FileSystemService/ReadFile"; readonly requestStream: false; readonly responseStream: true; readonly requestSerialize: (value: ReadFileRequest) => Buffer; readonly requestDeserialize: (value: Buffer) => ReadFileRequest; readonly responseSerialize: (value: ReadFileResponse) => Buffer; readonly responseDeserialize: (value: Buffer) => ReadFileResponse; }; /** * Writes a file to the remote file system by accepting a stream of byte chunks from the caller. * @param request A stream of write chunks. The first chunk must include the destination file path. * @returns A response message indicating the success or failure of the write operation. */ readonly writeFile: { readonly path: "/filesystemservice.FileSystemService/WriteFile"; readonly requestStream: true; readonly responseStream: false; readonly requestSerialize: (value: WriteFileRequest) => Buffer; readonly requestDeserialize: (value: Buffer) => WriteFileRequest; readonly responseSerialize: (value: WriteFileResponse) => Buffer; readonly responseDeserialize: (value: Buffer) => WriteFileResponse; }; /** * Deletes a file or directory on the remote file system. * @param request A request message containing the full path of the file or directory to delete. * @returns A response message indicating the success or failure of the delete operation. */ readonly deleteEntry: { readonly path: "/filesystemservice.FileSystemService/DeleteEntry"; readonly requestStream: false; readonly responseStream: false; readonly requestSerialize: (value: DeleteEntryRequest) => Buffer; readonly requestDeserialize: (value: Buffer) => DeleteEntryRequest; readonly responseSerialize: (value: DeleteEntryResponse) => Buffer; readonly responseDeserialize: (value: Buffer) => DeleteEntryResponse; }; /** * Creates a new directory on the remote file system. * @param request A request message containing the full path of the directory to create. * @returns A response message indicating the success or failure of the directory creation operation. */ readonly createDirectory: { readonly path: "/filesystemservice.FileSystemService/CreateDirectory"; readonly requestStream: false; readonly responseStream: false; readonly requestSerialize: (value: CreateDirectoryRequest) => Buffer; readonly requestDeserialize: (value: Buffer) => CreateDirectoryRequest; readonly responseSerialize: (value: CreateDirectoryResponse) => Buffer; readonly responseDeserialize: (value: Buffer) => CreateDirectoryResponse; }; }; export interface FileSystemServiceServer extends UntypedServiceImplementation { /** * Gets the root entry of the remote file system. * @returns A response message with the root file system entry. */ getRoot: handleUnaryCall; /** * Gets the entries (files and subdirectories) of a directory on the remote file system. * @param request A request message with the directory path and an optional file-extension filter. * @returns A response message with the directory entries. */ getEntries: handleUnaryCall; /** * Reads a file on the remote file system and streams its contents back to the caller. * @param request A request message containing the full file path. * @returns A stream of byte chunks containing the file contents. */ readFile: handleServerStreamingCall; /** * Writes a file to the remote file system by accepting a stream of byte chunks from the caller. * @param request A stream of write chunks. The first chunk must include the destination file path. * @returns A response message indicating the success or failure of the write operation. */ writeFile: handleClientStreamingCall; /** * Deletes a file or directory on the remote file system. * @param request A request message containing the full path of the file or directory to delete. * @returns A response message indicating the success or failure of the delete operation. */ deleteEntry: handleUnaryCall; /** * Creates a new directory on the remote file system. * @param request A request message containing the full path of the directory to create. * @returns A response message indicating the success or failure of the directory creation operation. */ createDirectory: handleUnaryCall; } export interface FileSystemServiceClient extends Client { /** * Gets the root entry of the remote file system. * @returns A response message with the root file system entry. */ getRoot(request: Empty, callback: (error: ServiceError | null, response: GetRootResponse) => void): ClientUnaryCall; getRoot(request: Empty, metadata: Metadata, callback: (error: ServiceError | null, response: GetRootResponse) => void): ClientUnaryCall; getRoot(request: Empty, metadata: Metadata, options: Partial, callback: (error: ServiceError | null, response: GetRootResponse) => void): ClientUnaryCall; /** * Gets the entries (files and subdirectories) of a directory on the remote file system. * @param request A request message with the directory path and an optional file-extension filter. * @returns A response message with the directory entries. */ getEntries(request: GetEntriesRequest, callback: (error: ServiceError | null, response: GetEntriesResponse) => void): ClientUnaryCall; getEntries(request: GetEntriesRequest, metadata: Metadata, callback: (error: ServiceError | null, response: GetEntriesResponse) => void): ClientUnaryCall; getEntries(request: GetEntriesRequest, metadata: Metadata, options: Partial, callback: (error: ServiceError | null, response: GetEntriesResponse) => void): ClientUnaryCall; /** * Reads a file on the remote file system and streams its contents back to the caller. * @param request A request message containing the full file path. * @returns A stream of byte chunks containing the file contents. */ readFile(request: ReadFileRequest, options?: Partial): ClientReadableStream; readFile(request: ReadFileRequest, metadata?: Metadata, options?: Partial): ClientReadableStream; /** * Writes a file to the remote file system by accepting a stream of byte chunks from the caller. * @param request A stream of write chunks. The first chunk must include the destination file path. * @returns A response message indicating the success or failure of the write operation. */ writeFile(callback: (error: ServiceError | null, response: WriteFileResponse) => void): ClientWritableStream; writeFile(metadata: Metadata, callback: (error: ServiceError | null, response: WriteFileResponse) => void): ClientWritableStream; writeFile(options: Partial, callback: (error: ServiceError | null, response: WriteFileResponse) => void): ClientWritableStream; writeFile(metadata: Metadata, options: Partial, callback: (error: ServiceError | null, response: WriteFileResponse) => void): ClientWritableStream; /** * Deletes a file or directory on the remote file system. * @param request A request message containing the full path of the file or directory to delete. * @returns A response message indicating the success or failure of the delete operation. */ deleteEntry(request: DeleteEntryRequest, callback: (error: ServiceError | null, response: DeleteEntryResponse) => void): ClientUnaryCall; deleteEntry(request: DeleteEntryRequest, metadata: Metadata, callback: (error: ServiceError | null, response: DeleteEntryResponse) => void): ClientUnaryCall; deleteEntry(request: DeleteEntryRequest, metadata: Metadata, options: Partial, callback: (error: ServiceError | null, response: DeleteEntryResponse) => void): ClientUnaryCall; /** * Creates a new directory on the remote file system. * @param request A request message containing the full path of the directory to create. * @returns A response message indicating the success or failure of the directory creation operation. */ createDirectory(request: CreateDirectoryRequest, callback: (error: ServiceError | null, response: CreateDirectoryResponse) => void): ClientUnaryCall; createDirectory(request: CreateDirectoryRequest, metadata: Metadata, callback: (error: ServiceError | null, response: CreateDirectoryResponse) => void): ClientUnaryCall; createDirectory(request: CreateDirectoryRequest, metadata: Metadata, options: Partial, callback: (error: ServiceError | null, response: CreateDirectoryResponse) => void): ClientUnaryCall; } export declare const FileSystemServiceClient: { new (address: string, credentials: ChannelCredentials, options?: Partial): FileSystemServiceClient; service: typeof FileSystemServiceService; serviceName: string; };