Usage
Cllouda SDK

U2I SDK

Using the SDK is the recommended way to interact with the Cllouda. It allows us to manage utilities and what-not for you in the background, without you needing to worry about anything.

We are working to bring the SDK to other languages in the near future.

Installation

npm install @cllouda/sdk

Importing

import { UploadFile } from '@cllouda/sdk'

Usage

libs/cllouda.ts
    const { success, data, message } = await UploadFile({
        token: 'YOUR_API_KEY',
        data: {
            fileBase64: 'BASE64_STRING',
            fileName: 'FILENAME',
            fileType: 'FILE_TYPE'
        }
    })
 
    if (success && data) {
       const { publicFileUrl } = data
 
        // Do something with the data
    }
 
    else {
        console.error(message)
 
        // Handle the error case, you can use our message to show the user
    }

SDK is designed to work only in server environments because of the token we provide. This token must not be exposed, as it would allow other people to access your account.

Request

token is the token we provide you.
data is the object contains the data about your file.

Response

success is a boolean that tells you if the request was successful.
message is a string that tells you what happened.
data is an object that contains the data you requested if the request was successful.
data?.publicFileUrl is the URL of the uploaded file, this never expires.

Currently we only accept: .webp, .jpeg, .jpg, .png file types while working on 10+ more formats.