extremum-sdk
v3.0.7
Published
frontend development kit
Downloads
452
Readme
Extremum SDK
Overview
Simple lib that allows developers to make serverless applications.
Usage:
const client = new ExtremumSDK("0", "http://api.app-0.ajev84ud35k4m2lo4n39.extremum.io"); // app-id & url for further requests client.login("client-lib", "rKg7b7HjbBITrCl42yERiTMFdCcy1rIj"); // use client_id & secret for login
Bucket
$ client.bucket.create("test-bucket"); # Create test-bucket Bucket
$ client.bucket.remove("test-bucket"); # Remove test-bucket Bucket
$ client.bucket.getMetadata("test-bucket"); # Get test-bucket metadata
$ client.bucket.setupTrigger("test-bucket", { function: "test-fn", options: { prefix: "", operations: ["create"] } }); set test-fn trigger on test-bucket
$ client.bucket.removeTrigger(test-bucket, "test-fn"); # Remove trigger from test-bucket
$ client.bucket.getBuckets(0, 20); # Get Bucket list with offset = 0 and limit = 20
Storage
$ client.storage.createOrReplaceObject("test-bucket", "test-file", data); # Add test-file to test-bucket
$ client.storage.getObject("test-bucket", "test-key", isStream); # Get test-key from test-bucket
$ client.storage.deleteObject("test-bucket", "test-key"); # Remove test-key from test-bucket
$ client.storage.createPostForm("test-bucket", "test-key"); # Create test-key form for test-bucket
$ client.storage.getObjectMetadata("test-bucket", "test-key"); # Get test-key metadata
$ client.storage.getKeys("test-bucket", 0, 20); # Get Storage list with offset = 0 and limit = 20
Functions
$ client.functions.create("test-function", body, "1.0.0"); # Create test-function function
$ client.functions.createNewVersion("test-function", body: Patch, "1.0.0") # Update test-function
$ client.functions.remove("test-function", "1.0.0"); # Remove test-function function
$ client.functions.getMetadata("test-function"); # get test-function metadata
$ client.functions.getFunctions(0, 20); # Get Functions list with offset = 0 and limit = 20
JOBS
$ client.job.create(action: "delete" | "invoke_function", "test-bucket", keys?: string[], func?: string) # Create job
$ client.job.getJobs(0, 20); # Get Job list with offset = 0 and limit = 20
$ client.job.cancel(id) # Cancel job by id
$ client.job.getMetadata(id) # Get job metadata by id
MESSAGING
$ client.messaging.createQueue('test-queue') # Create test-queue Queue
$ client.messaging.removeQueue('test-queue') # Remove test-queue Queue
$ client.messaging.getMetadata('test-queue') # Get test-queue metadata
$ client.messaging.getQueues(0, 20) # Get Queue list with offset = 0 and limit = 20
MESSAGE QUEUES
$ client.messageQueues.publish('test-queue', Buffer|string) # Publish a message to test-queue
$ client.messageQueues.pollUnreadMessages('test-queue', n) # Poll n messages from test-queue
$ client.messageQueues.remove('test-queue', 'id') # Remove message from test-queue by id
$ client.messageQueues.subscribe('test-queue', 'mycoolfunction') Subscribe mycoolfunction to test-queue
$ client.messageQueues.subscribe('test-queue', 'mycoolfunction') Unsubscribe mycoolfunction from test-queue
MULTIPART UPLOADS
TODO
ROLE
$ client.role.create('user') # Create user role
$ client.role.delete('user') # Remove user role
$ client.role.getRoleMeta('user') Get a user metadata
$ client.role.list(0, 20) # Get Role list with offset = 0 and limit = 20
$ client.role.createUser({name: 'John', email: '[email protected]', roles: ['user']}) # Create a new user
$ client.role.updateUser('John', [{path: 'email', op: 'replace', value: '[email protected]'}]) # Update user data
$ client.role.deleteUser('John') # Delete user
$ client.role.getUserMeta('John') # Get John metadata
$ client.role.listUser(0, 20) # Get User list with offset = 0 and limit = 20
$ client.role.changePassword('John', { old: 'old-password', new: 'new-password' }) # Change John password
$ client.role.getRules([{path: 'read', op: 'create', value: true}]) # Get access rules *
$ client.role.uploadRules(body) # Set access rules *
$ client.role.appendRules() # Append new access rules
SIGNAL
$ client.signals.send(Signal) # Send a signal * see Signal interface on the description
$ client.signals.poll(id, 20) # Poll 20 signals from id
$ client.signals.subscribe(id, Subscription) # Subscribe to topic by id
$client.signals.unsubscribe(id) # Unsubscribe from topic by id
DB
$ client.db.create('events', {name: 'event'}) # Create event
$ client.db.update(id, [{path: 'name', op: 'replace', value: 'new-event'}]) # Update data by id
$ client.db.delete(id) # Remove data by id
$ client.db.get(id, Params) # Get data by id with Params
$ client.db.link(srcId, targetId, predicate, options?) # Create RFC link
$ client.db.unlink(srcId, targetId, predicate, options) # Remove RFC link