Skip to content

Commit

Permalink
feat: public link metadata handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Dwynr committed May 22, 2024
1 parent d91524e commit 6f90481
Show file tree
Hide file tree
Showing 12 changed files with 373 additions and 44 deletions.
11 changes: 10 additions & 1 deletion dev/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,16 @@ const filen = new FilenSDK({
})

const main = async () => {
console.log(await filen.notes().history({ uuid: "2d103b43-5f55-4c35-84cf-c5b2c1a0ecc0" }))
console.log(
await filen
.cloud()
.filePublicLinkInfo({
uuid: "fce3c11f-1b0c-499b-91b2-e7d25f0241d6",
password: "xd",
salt: "rmP769wLwcQ0v8fTIVgQ56r3yiNegWF5",
key: "LVGUkFfIwYoSgakTr5yYI9ZRH8nvweQr"
})
)
}

main()
2 changes: 1 addition & 1 deletion dist/browser/api/v3/dir/link/content.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

94 changes: 85 additions & 9 deletions dist/browser/cloud/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/browser/cloud/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/node/api/v3/dir/link/content.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

83 changes: 74 additions & 9 deletions dist/node/cloud/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/node/cloud/index.js.map

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions dist/types/api/v3/dir/link/content.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type APIClient from "../../../client";
import type { DirColors } from "../color";
import { type FileMetadata, type FolderMetadata } from "../../../../types";
export type DirLinkContentResponse = {
folders: {
color: DirColors | null;
Expand All @@ -20,6 +21,26 @@ export type DirLinkContentResponse = {
version: number;
}[];
};
export type DirLinkContentDecryptedResponse = {
folders: {
color: DirColors | null;
metadata: FolderMetadata;
parent: string;
timestamp: number;
uuid: string;
}[];
files: {
bucket: string;
chunks: number;
metadata: FileMetadata;
parent: string;
region: string;
size: number;
timestamp: number;
uuid: string;
version: number;
}[];
};
/**
* DirLinkContent
* @date 2/1/2024 - 8:16:35 PM
Expand Down
44 changes: 33 additions & 11 deletions dist/types/cloud/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { type FileLinkStatusResponse } from "../api/v3/file/link/status";
import { type FileLinkPasswordResponse } from "../api/v3/file/link/password";
import { type DirLinkInfoResponse } from "../api/v3/dir/link/info";
import { type FileLinkInfoResponse } from "../api/v3/file/link/info";
import { type DirLinkContentDecryptedResponse } from "../api/v3/dir/link/content";
export type CloudConfig = {
sdkConfig: FilenSDKConfig;
api: API;
Expand Down Expand Up @@ -560,15 +561,26 @@ export declare class Cloud {
*
* @public
* @async
* @param {{ uuid: string; password: string; }} param0
* @param {{
* uuid: string
* password?: string
* salt?: string
* key: string
* }} param0
* @param {string} param0.uuid
* @param {string} param0.password
* @returns {Promise<FileLinkInfoResponse>}
* @param {string} param0.salt
* @param {string} param0.key
* @returns {(Promise<Omit<FileLinkInfoResponse, "size"> & { size: number }>)}
*/
filePublicLinkInfo({ uuid, password }: {
filePublicLinkInfo({ uuid, password, salt, key }: {
uuid: string;
password: string;
}): Promise<FileLinkInfoResponse>;
password?: string;
salt?: string;
key: string;
}): Promise<Omit<FileLinkInfoResponse, "size"> & {
size: number;
}>;
/**
* Fetch info about a directory public link.
*
Expand All @@ -582,21 +594,31 @@ export declare class Cloud {
uuid: string;
}): Promise<DirLinkInfoResponse>;
/**
* Fetch content of a directory public link.
* Fetch contents of a directory public link or it's children.
*
* @public
* @async
* @param {{uuid: string, parent: string, password: string}} param0
* @param {{
* uuid: string
* parent: string
* password?: string
* salt?: string
* key: string
* }} param0
* @param {string} param0.uuid
* @param {string} param0.parent
* @param {string} param0.password
* @returns {unknown}
* @param {string} param0.salt
* @param {string} param0.key
* @returns {Promise<DirLinkContentDecryptedResponse>}
*/
directoryPublicLinkContent({ uuid, parent, password }: {
directoryPublicLinkContent({ uuid, parent, password, salt, key }: {
uuid: string;
parent: string;
password: string;
}): Promise<import("../api/v3/dir/link/content").DirLinkContentResponse>;
password?: string;
salt?: string;
key: string;
}): Promise<DirLinkContentDecryptedResponse>;
/**
* Stop sharing an item with another user.
* @date 2/19/2024 - 4:38:21 AM
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@filen/sdk",
"version": "0.1.82",
"version": "0.1.84",
"description": "Filen SDK",
"main": "dist/node/index.js",
"browser": "dist/browser/index.js",
Expand Down
Loading

0 comments on commit 6f90481

Please sign in to comment.