Skip to content

Commit 65c8089

Browse files
committed
Remove replicate.files API
1 parent 1aaf01e commit 65c8089

File tree

3 files changed

+2
-23
lines changed

3 files changed

+2
-23
lines changed

index.d.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -215,16 +215,6 @@ declare module "replicate" {
215215
): Promise<Deployment>;
216216
};
217217

218-
files: {
219-
create: (
220-
file: File | Blob,
221-
metadata?: Record<string, string | number | boolean | null>
222-
) => Promise<FileObject>;
223-
list: () => Promise<FileObject>;
224-
get: (file_id: string) => Promise<FileObject>;
225-
delete: (file_id: string) => Promise<FileObject>;
226-
};
227-
228218
hardware: {
229219
list(): Promise<Hardware[]>;
230220
};

index.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@ const {
55
withAutomaticRetries,
66
validateWebhook,
77
parseProgressFromLogs,
8-
transformFileInputsToReplicateFileURLs,
9-
transformFileInputsToBase64EncodedDataURIs,
108
} = require("./lib/util");
119

1210
const accounts = require("./lib/accounts");
1311
const collections = require("./lib/collections");
1412
const deployments = require("./lib/deployments");
15-
const files = require("./lib/files");
1613
const hardware = require("./lib/hardware");
1714
const models = require("./lib/models");
1815
const predictions = require("./lib/predictions");
@@ -74,13 +71,6 @@ class Replicate {
7471
},
7572
};
7673

77-
this.files = {
78-
create: files.create.bind(this),
79-
list: files.list.bind(this),
80-
get: files.get.bind(this),
81-
delete: files.delete.bind(this),
82-
};
83-
8474
this.hardware = {
8575
list: hardware.list.bind(this),
8676
};

lib/util.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const ApiError = require("./error");
2+
const { create: createFile } = require("./files");
23

34
/**
45
* @see {@link validateWebhook}
@@ -246,7 +247,7 @@ async function transformFileInputs(client, inputs, strategy) {
246247
async function transformFileInputsToReplicateFileURLs(client, inputs) {
247248
return await transform(inputs, async (value) => {
248249
if (value instanceof Blob || value instanceof Buffer) {
249-
const file = await client.files.create(value);
250+
const file = await createFile.call(client, value);
250251
return file.urls.get;
251252
}
252253

@@ -393,6 +394,4 @@ module.exports = {
393394
validateWebhook,
394395
withAutomaticRetries,
395396
parseProgressFromLogs,
396-
transformFileInputsToBase64EncodedDataURIs,
397-
transformFileInputsToReplicateFileURLs,
398397
};

0 commit comments

Comments
 (0)