Skip to content

Files Create With Metadata

This example assumes using Replicate; is in scope and apiKey contains your Replicate API key.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
using var api = GetAuthorizedClient();

var content = System.Text.Encoding.UTF8.GetBytes("metadata test");
var fileName = "test-metadata.txt";
var metadata = "{\"test_key\": \"test_value\"}";

var created = await api.FilesCreateAsync(
    content: content,
    contentname: fileName,
    filename: fileName,
    metadata: metadata);

try
{
}
finally
{
    await api.FilesDeleteAsync(created.Id);
}