diff --git a/src/index.ts b/src/index.ts index accbbef..ec25f13 100644 --- a/src/index.ts +++ b/src/index.ts @@ -161,7 +161,7 @@ export default class SecureFileWrapper { async list(folder?: string): Promise { let query: any = {} if (folder) query.folder = folder; - let res = await this.makeRequest("/file", "GET", query); + let res = await this.makeRequest("/files", "GET", query); let d = await res.json(); return d.files; } @@ -175,16 +175,16 @@ export default class SecureFileWrapper { params.folder = folder; } - let res = await this.makeRequest("/file", "POST", params, data); + let res = await this.makeRequest("/files", "POST", params, data); return (await res.json()).file; } async get(id: string, version?: string): Promise { let res: Response; if (typeof version === "string") { - res = await this.makeRequest(`/file/${id}/history/${version}`, "GET", {}); + res = await this.makeRequest(`/files/${id}/history/${version}`, "GET", {}); } else { - res = await this.makeRequest("/file/" + id, "GET", {}); + res = await this.makeRequest("/files/" + id, "GET", {}); } if (res.arrayBuffer) { @@ -199,25 +199,25 @@ export default class SecureFileWrapper { async update(id: string, data: ArrayBuffer | ArrayBufferView, preview?: string): Promise { let put: any = {}; if (preview) put.preview = preview; - let res = await this.makeRequest("/file/" + id, "PUT", put, data); + let res = await this.makeRequest("/files/" + id, "PUT", put, data); let json = await res.json() return json.file; } async delete(id: string): Promise { - let res = await this.makeRequest("/file/" + id, "DELETE", {}); + let res = await this.makeRequest("/files/" + id, "DELETE", {}); return res.json(); } async history(id: string): Promise { - let res = await this.makeRequest(`/file/${id}/history`, "GET", {}); + let res = await this.makeRequest(`/files/${id}/history`, "GET", {}); statusParser(res); return res.json(); } async restore(id: string, version: string) { - await this.makeRequest(`/file/${id}/history/${version}/restore`, "PUT", {}); + await this.makeRequest(`/files/${id}/history/${version}/restore`, "PUT", {}); } } \ No newline at end of file