🖥️ Onlyoffice connector moved into the TwakeDrive repository (#366)

This commit is contained in:
Montassar Ghanmy
2024-02-27 10:35:01 +01:00
committed by GitHub
parent ff74104a1b
commit dcb6fa1c36
40 changed files with 1557 additions and 3 deletions
@@ -0,0 +1,31 @@
import { ResponseType } from 'axios';
export interface IApiServiceRequestParams<T> {
url: string;
payload?: T;
token?: string;
responseType?: ResponseType;
headers?: any;
}
export interface IApiService {
get<T>(params: IApiServiceRequestParams<T>): Promise<T>;
post<T>(params: IApiServiceRequestParams<T>): Promise<T>;
runCommand<T>(c: string, key: string): Promise<void>;
}
export interface IApiServiceApplicationTokenRequestParams {
id: string;
secret: string;
}
export interface IApiServiceApplicationTokenResponse {
resource: {
access_token: {
time: number;
expiration: number;
value: string;
type: string;
};
};
}
@@ -0,0 +1,22 @@
export type DriveFileType = {
access: 'manage' | 'write' | 'read' | 'none';
item: {
last_version_cache: {
id: string;
date_added: number;
file_metadata: {
external_id: string;
};
};
};
};
export type DriveRequestParams = {
drive_file_id: string;
company_id: string;
};
export interface IDriveService {
get: (params: DriveRequestParams) => Promise<DriveFileType>;
createVersion: (params: { company_id: string; drive_file_id: string; file_id: string }) => Promise<DriveFileType['item']['last_version_cache']>;
}
@@ -0,0 +1,42 @@
import { UserType } from './user.interface';
export type EditorInitRequestParams = {
file_id: string;
company_id: string;
token: string;
user: UserType;
preview: string;
};
export type EditConfigInitResult = {
user_id: string;
username: string;
language: string;
user_image: string;
mode: string;
onlyoffice_server: string;
color: string;
company_id: string;
file_id: string;
file_version_id: string;
filename: string;
file_type: string;
editable: boolean;
preview: boolean;
};
export interface IEditorService {
init: (
company_id: string,
file_name: string,
file_version_id: string,
user: UserType,
preview: boolean,
file_id: string,
) => Promise<EditConfigInitResult>;
}
export type ModeParametersType = {
mode: string;
color: string;
};
@@ -0,0 +1,23 @@
export type FileType = {
id: string;
filename: string;
company_id: string;
user_id: string;
metadata: {
name: string;
mime: string;
};
};
export type FileRequestParams = {
file_id: string;
company_id: string;
url?: string;
user_id?: string;
create_new?: boolean;
};
export interface IFileService {
get: (params: FileRequestParams) => Promise<FileType>;
download: (params: FileRequestParams) => Promise<any>;
}
@@ -0,0 +1,16 @@
import { Router } from 'express';
export interface Routes {
path?: string;
router: Router;
}
export interface OfficeToken {
user_id: string;
company_id: string;
file_id: string;
file_name: string;
preview: boolean;
drive_file_id?: string;
in_page_token?: boolean;
}
@@ -0,0 +1,14 @@
export type UserType = {
id: string;
username: string;
thumbnail: string;
picture: string;
email: string;
preferences: {
locale: string;
};
};
export interface IuserService {
getCurrentUser: (token: string) => Promise<UserType>;
}