Autoenhance.ai
  • Overview
  • Getting Started
    • Obtaining an API key
    • Quickstart
      • Single Image
      • HDR Brackets
    • Code Examples
      • JavaScript
        • Uploading Single Bracket
        • Uploading HDR
        • Uploading 360
      • API Integrations Repository
  • SDKs
    • Web (Beta)
      • Changelog
    • JavaScript
      • Changelog
    • Python
      • Changelog
  • File & Camera Guidelines
    • File Formats
    • Metadata
    • 360
    • Lens Correction
  • Images
    • Managing Images
      • Creating & Uploading
      • Reprocessing
      • Retrieveing
      • Deleting
      • Reporting
    • Settings
      • Enhancement Style
      • Sky Replacement
      • Lens Correction
      • Vertical Correction
      • Window Pull
      • Auto Privacy
      • Usage Example
    • Downloading Images
      • Original
      • Preview
      • Enhanced
  • Orders
    • Managing Orders
      • Creating
      • Editing
      • Retrieving
      • Listing and Pagination
      • Deleting
    • Grouping Brackets and Processing Orders
  • Webhooks
  • API Versions
  • AI Versions
  • Links
    • API Specification
    • Support
Powered by GitBook
On this page
  • Requirements
  • Installation
  • Configuration
  • Usage examples
  1. SDKs

JavaScript

Our SDK will help you easily integrate Autoenhance.ai into your codebase in a matter of minutes. We've prepared methods for interacting with our API in all possible ways you might need.

PreviousChangelogNextChangelog

Last updated 11 months ago

Requirements

  • Basic JavaScript and Typescript knowledge

  • Autoenhance.ai API key ()

You can find the NPM package for our SDK on

Installation

Install Autoenhance.ai SDK with simple CLI command

With npm:

npm install @autoenhance.ai/javascript

With yarn:

yarn add @autoenhance.ai/javascript

Configuration

Follow these simple steps in order to implement and configure our SDK

Import Autoenhance SDK package

import Autoenhance from '@autoenhance.ai/javascript';

Create a constant, and add your API key

const autoenhance = new Autoenhance('YOUR API KEY');

Boom, that's it! Now you can interact with our API in a matter of seconds.

Usage examples

Uploading image

const uploadImage = async (imageProperties: ImageIn, image: Blob) => {
    const { s3PutObjectUrl } = await autoenhance.ImagesApi.createImage({
      imageIn: {
        contentType: image.type,
        ...imageProperties
      }
    })

    await fetch(s3PutObjectUrl, {
      method: "PUT",
        headers: {
            "Content-Type": blob.type,
        },
        body: image,
    });
}

Retrieving order

const getOrder = async (orderId:string) => {
  const order = await autoenhance.OrdersApi.retreiveOrder({ id: orderId});
};

Retrieving list of orders

const getOrders = async () => {
  const response = await autoenhance.OrdersApi.listOrders();
  const orders = response.orders;
};

Downloading enhanced image

const downloadImage = async (imageId) => {
    const imageUrl = await autoenhance.ImagesApi.downloadEnhancedImageRaw({
          id: imageId,
          size: "large",
      }).then((res) => res.raw.url);
      
    return { url: imageUrl };
};

How to obtain an API key
npmjs