Object
List all objects in a Smart Bucket or regular bucket. The bucket parameter (ID) is used to identify the bucket to list objects from.
import Raindrop from '@liquidmetal-ai/lm-raindrop';
const client = new Raindrop({ apiKey: process.env['RAINDROP_API_KEY'], // This is the default and can be omitted});
async function main() { const object = await client.object.list('bucket');
console.log(object.objects);}
main();
import osfrom lm_raindrop import Raindrop
client = Raindrop( api_key=os.environ.get("RAINDROP_API_KEY"), # This is the default and can be omitted)object = client.object.list( "bucket",)print(object.objects)
package main
import ( "context" "fmt"
"github.com/LiquidMetal-AI/raindrop-go-sdk" "github.com/LiquidMetal-AI/raindrop-go-sdk/option")
func main() { client := raindrop.NewClient( option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("RAINDROP_API_KEY") ) object, err := client.Object.List(context.TODO(), "bucket") if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", object.Objects)}
package com.raindrop.api.example;
import com.raindrop.api.client.RaindropClient;import com.raindrop.api.client.okhttp.RaindropOkHttpClient;import com.raindrop.api.models.object_.ObjectListParams;import com.raindrop.api.models.object_.ObjectListResponse;
public final class Main { private Main() {}
public static void main(String[] args) { // Configures using the `RAINDROP_API_KEY` environment variable RaindropClient client = RaindropOkHttpClient.fromEnv();
ObjectListParams params = ObjectListParams.builder() .bucket("bucket") .build(); ObjectListResponse object_ = client.object_().list(params); }}
# List all objects in a bucketnpx raindrop object list --bucket my-bucket
# List objects in JSON formatnpx raindrop object list --bucket my-bucket --output json
# List objects in table formatnpx raindrop object list --bucket my-bucket --output table
Upload Object
Upload a file to a Smart Bucket or regular bucket. The bucket parameter (ID) is used to identify the bucket to upload to. The key is the path to the object in the bucket.
import Raindrop from '@liquidmetal-ai/lm-raindrop';
const client = new Raindrop({ apiKey: process.env['RAINDROP_API_KEY'], // This is the default and can be omitted});
async function main() { const response = await client.object.upload('key', { bucket: 'bucket', body: fs.createReadStream('path/to/file'), });
console.log(response.bucket);}
main();
import osfrom lm_raindrop import Raindrop
client = Raindrop( api_key=os.environ.get("RAINDROP_API_KEY"), # This is the default and can be omitted)response = client.object.upload( key="key", bucket="bucket", body=b'raw file contents',)print(response.bucket)
package main
import ( "bytes" "context" "fmt" "io"
"github.com/LiquidMetal-AI/raindrop-go-sdk" "github.com/LiquidMetal-AI/raindrop-go-sdk/option")
func main() { client := raindrop.NewClient( option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("RAINDROP_API_KEY") ) response, err := client.Object.Upload( context.TODO(), "bucket", "key", raindrop.ObjectUploadParams{ Body: io.Reader(bytes.NewBuffer([]byte("some file contents"))), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Bucket)}
package com.raindrop.api.example;
import com.raindrop.api.client.RaindropClient;import com.raindrop.api.client.okhttp.RaindropOkHttpClient;import com.raindrop.api.models.object_.ObjectUploadParams;import com.raindrop.api.models.object_.ObjectUploadResponse;
public final class Main { private Main() {}
public static void main(String[] args) { // Configures using the `RAINDROP_API_KEY` environment variable RaindropClient client = RaindropOkHttpClient.fromEnv();
ObjectUploadParams params = ObjectUploadParams.builder() .bucket("bucket") .key("key") .body("some content") .build(); ObjectUploadResponse response = client.object_().upload(params); }}
# Upload a file to a bucketnpx raindrop object put ./myfile.txt my-key --bucket my-bucket
# Upload with specific content typenpx raindrop object put ./myfile.json my-key --bucket my-bucket --content-type application/json
Download Object
Download a file from a Smart Bucket or regular bucket. The bucket parameter (ID) is used to identify the bucket to download from. The key is the path to the object in the bucket.
import Raindrop from '@liquidmetal-ai/lm-raindrop';
const client = new Raindrop({ apiKey: process.env['RAINDROP_API_KEY'], // This is the default and can be omitted});
async function main() { const response = await client.object.download('key', { bucket: 'bucket' });
console.log(response);
const content = await response.blob(); console.log(content);}
main();
import osfrom lm_raindrop import Raindrop
client = Raindrop( api_key=os.environ.get("RAINDROP_API_KEY"), # This is the default and can be omitted)response = client.object.download( key="key", bucket="bucket",)print(response)content = response.read()print(content)
package main
import ( "context" "fmt"
"github.com/LiquidMetal-AI/raindrop-go-sdk" "github.com/LiquidMetal-AI/raindrop-go-sdk/option")
func main() { client := raindrop.NewClient( option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("RAINDROP_API_KEY") ) response, err := client.Object.Download( context.TODO(), "bucket", "key", ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response)}
package com.raindrop.api.example;
import com.raindrop.api.client.RaindropClient;import com.raindrop.api.client.okhttp.RaindropOkHttpClient;import com.raindrop.api.core.http.HttpResponse;import com.raindrop.api.models.object_.ObjectDownloadParams;
public final class Main { private Main() {}
public static void main(String[] args) { // Configures using the `RAINDROP_API_KEY` environment variable RaindropClient client = RaindropOkHttpClient.fromEnv();
ObjectDownloadParams params = ObjectDownloadParams.builder() .bucket("bucket") .key("key") .build(); HttpResponse response = client.object_().download(params); }}
# Download a file from a bucketnpx raindrop object get my-key --bucket my-bucket
# Download to specific output filenpx raindrop object get my-key output.txt --bucket my-bucket
# Output to stdoutnpx raindrop object get my-key --bucket my-bucket --format stdout
Delete Object
Delete a file from a Smart Bucket or regular bucket. The bucket parameter (ID) is used to identify the bucket to delete from. The key is the path to the object in the bucket.
import Raindrop from '@liquidmetal-ai/lm-raindrop';
const client = new Raindrop({ apiKey: process.env['RAINDROP_API_KEY'], // This is the default and can be omitted});
async function main() { const object = await client.object.delete('key', { bucket: 'bucket' });
console.log(object.success);}
main();
import osfrom lm_raindrop import Raindrop
client = Raindrop( api_key=os.environ.get("RAINDROP_API_KEY"), # This is the default and can be omitted)object = client.object.delete( key="key", bucket="bucket",)print(object.success)
package main
import ( "context" "fmt"
"github.com/LiquidMetal-AI/raindrop-go-sdk" "github.com/LiquidMetal-AI/raindrop-go-sdk/option")
func main() { client := raindrop.NewClient( option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("RAINDROP_API_KEY") ) object, err := client.Object.Delete( context.TODO(), "bucket", "key", ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", object.Success)}
package com.raindrop.api.example;
import com.raindrop.api.client.RaindropClient;import com.raindrop.api.client.okhttp.RaindropOkHttpClient;import com.raindrop.api.models.object_.ObjectDeleteParams;import com.raindrop.api.models.object_.ObjectDeleteResponse;
public final class Main { private Main() {}
public static void main(String[] args) { // Configures using the `RAINDROP_API_KEY` environment variable RaindropClient client = RaindropOkHttpClient.fromEnv();
ObjectDeleteParams params = ObjectDeleteParams.builder() .bucket("bucket") .key("key") .build(); ObjectDeleteResponse object_ = client.object_().delete(params); }}
# Delete a file from a bucketnpx raindrop object delete my-key --bucket my-bucket