Skip to content

Commit fcdcaa3

Browse files
aronzeke
authored andcommitted
Remove replicate.files API
1 parent 37c1f74 commit fcdcaa3

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
@@ -239,16 +239,6 @@ declare module "replicate" {
239239
list(): Promise<Page<Deployment>>;
240240
};
241241

242-
files: {
243-
create: (
244-
file: File | Blob,
245-
metadata?: Record<string, string | number | boolean | null>
246-
) => Promise<FileObject>;
247-
list: () => Promise<FileObject>;
248-
get: (file_id: string) => Promise<FileObject>;
249-
delete: (file_id: string) => Promise<FileObject>;
250-
};
251-
252242
hardware: {
253243
list(): Promise<Hardware[]>;
254244
};

index.js

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

1311
const accounts = require("./lib/accounts");
1412
const collections = require("./lib/collections");
1513
const deployments = require("./lib/deployments");
16-
const files = require("./lib/files");
1714
const hardware = require("./lib/hardware");
1815
const models = require("./lib/models");
1916
const predictions = require("./lib/predictions");
@@ -80,13 +77,6 @@ class Replicate {
8077
},
8178
};
8279

83-
this.files = {
84-
create: files.create.bind(this),
85-
list: files.list.bind(this),
86-
get: files.get.bind(this),
87-
delete: files.delete.bind(this),
88-
};
89-
9080
this.hardware = {
9181
list: hardware.list.bind(this),
9282
};

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}
@@ -253,7 +254,7 @@ async function transformFileInputs(client, inputs, strategy) {
253254
async function transformFileInputsToReplicateFileURLs(client, inputs) {
254255
return await transform(inputs, async (value) => {
255256
if (value instanceof Blob || value instanceof Buffer) {
256-
const file = await client.files.create(value);
257+
const file = await createFile.call(client, value);
257258
return file.urls.get;
258259
}
259260

@@ -438,6 +439,4 @@ module.exports = {
438439
withAutomaticRetries,
439440
parseProgressFromLogs,
440441
streamAsyncIterator,
441-
transformFileInputsToBase64EncodedDataURIs,
442-
transformFileInputsToReplicateFileURLs,
443442
};

0 commit comments

Comments
 (0)