@space-runners/ablo-ts-sdk
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -1,5 +0,17 @@ | ||
import { IAbloOptions } from './ablo-options.interface'; | ||
import { IAbloOptions } from './interfaces/ablo-options.interface'; | ||
import { StorageService } from './services/storage'; | ||
import { FontMakerService } from './services/fontmaker'; | ||
import { ImageMakerService } from './services/image-maker'; | ||
import { PhotoTransformerService } from './services/photo-transformer'; | ||
import { UpscaleService } from './services/upscale'; | ||
import { BackgroundRemoverService } from './services/background-removal'; | ||
export declare class Ablo { | ||
private axiosInstance; | ||
private axios; | ||
readonly storage: StorageService; | ||
readonly photoTransformer: PhotoTransformerService; | ||
readonly imageMaker: ImageMakerService; | ||
readonly fontMaker: FontMakerService; | ||
readonly upscale: UpscaleService; | ||
readonly removeBackground: BackgroundRemoverService; | ||
constructor(apiKey: string, options?: IAbloOptions); | ||
} |
@@ -5,5 +5,11 @@ "use strict"; | ||
const axios_1 = require("axios"); | ||
const storage_1 = require("./services/storage"); | ||
const fontmaker_1 = require("./services/fontmaker"); | ||
const image_maker_1 = require("./services/image-maker"); | ||
const photo_transformer_1 = require("./services/photo-transformer"); | ||
const upscale_1 = require("./services/upscale"); | ||
const background_removal_1 = require("./services/background-removal"); | ||
class Ablo { | ||
constructor(apiKey, options = {}) { | ||
this.axiosInstance = axios_1.default.create({ | ||
this.axios = axios_1.default.create({ | ||
baseURL: options.baseUrl || 'https://api.ablo.com', | ||
@@ -15,4 +21,10 @@ headers: { | ||
}); | ||
this.storage = new storage_1.StorageService(this.axios); | ||
this.photoTransformer = new photo_transformer_1.PhotoTransformerService(this.axios, this.storage); | ||
this.imageMaker = new image_maker_1.ImageMakerService(this.axios); | ||
this.fontMaker = new fontmaker_1.FontMakerService(this.axios); | ||
this.upscale = new upscale_1.UpscaleService(this.axios); | ||
this.removeBackground = new background_removal_1.BackgroundRemoverService(this.axios); | ||
} | ||
} | ||
exports.Ablo = Ablo; |
{ | ||
"name": "@space-runners/ablo-ts-sdk", | ||
"version": "0.0.1", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"version": "0.0.2", | ||
"description": "A TypeScript SDK for Ablo Services", | ||
@@ -5,0 +8,0 @@ "main": "lib/index.js", |
@@ -1,1 +0,51 @@ | ||
# ablo-ts-sdk | ||
# Ablo Typescript SDK | ||
This is the official Ablo Typescript SDK. | ||
## Installation | ||
```bash | ||
npm install ablo-ts-sdk | ||
``` | ||
## Usage | ||
To use the Ablo Typescript SDK, you need to initialize it with your API key. Here's a basic example of how to use the SDK: | ||
```typescript | ||
import { Ablo } from 'ablo-ts-sdk' | ||
const ablo = new Ablo('your-api-key') | ||
// Example usage of the SDK | ||
// GET /styles | ||
const styles = await ablo.styles.getAll() | ||
console.log('Styles:', styles) | ||
// Background Removal | ||
const backgroundRemovalResult = await ablo.backgroundRemoval.byUrl( | ||
imageUrl: 'https://example.com/image.jpg', | ||
) | ||
console.log('Background removed image:', backgroundRemovalResult.image) | ||
// FontMaker | ||
const fontMakerResult = await ablo.fontMaker.run({ | ||
text: 'Hello World', | ||
styleId: 'some-fontmaker-style-id', | ||
}) | ||
console.log('FontMaker generated images:', fontMakerResult.images) | ||
// Image Maker | ||
const imageMakerResult = await ablo.imageMaker.run({ | ||
freeText: 'A beautiful sunset over the ocean', | ||
styleId: 'some-imagemaker-style-id', | ||
}) | ||
console.log('Image Maker generated images:', imageMakerResult.images) | ||
// Photo Transformer | ||
const photoTransformerResult = await ablo.photoTransformer.fromUrl({ | ||
imageUrl: 'https://example.com/image.jpg', | ||
styleId: 'some-phototransformer-style-id', | ||
}) | ||
console.log('Photo Transformer result:', photoTransformerResult.images) | ||
``` |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
30749
46
630
52
2