1.0.4 • Published 4 years ago

cobblevision-api v1.0.4

Weekly downloads
2
License
GPL-3.0-or-later
Repository
github
Last release
4 years ago

CobbleVision-API

This is the official SDK for the CobbleVision Computer Vision Marketplace & SaaS. With this SDK using computer vision is easier and less complex then ever. Use this SDK after signing up to process images, gifs and videos on cobblevision.

You can find the official documentation for our API at: https://app.swaggerhub.com/domains-docs/CobbleVision/CobbleVision/

Cover Image

Documentation for CobbleVision SDK - NPM Package

  • exports.setApiAuth(apiusername, apitoken)
  • exports.setDebugging(debugBool)
  • exports.uploadMediaFile(price_category, publicBool, name, tags, file)
  • exports.deleteMediaFile(IDArray)
  • exports.launchCalculation(algorithms, media, type, notificationURL)
  • exports.waitForCalculationCompletion(calculationIDArray)
  • exports.deleteCalculation(IDArray)
  • exports.getCalculationResult(idArray, returnOnlyStatusBool)
  • exports.getCalculationVisualization(id, returnBase64Bool, width, height)

exports.setApiAuth(apiusername, apitoken)

This function sets your API Username and API Token for the SDK to use! It does not verify your auth!

Parameters
NameTypeDescription
apiusernamestring- Username of API 
apitokenstring- Token of API 
Returns
  • boolean Indicating Success of setting Auth Information

exports.setDebugging(debugBool)

This function sets your API Username and API Token for the SDK to use! It does not verify your auth!

Parameters
NameTypeDescription
debugBoolboolean- Boolean to trigger debuggging 
Returns
  • boolean Indicating Success of setting Debug Information

exports.uploadMediaFile(price_category, publicBool, name, tags, file)

This function uploads a media file to CobbleVision. You can find it after login in your media storage. Returns a response object with body, response and headers properties, deducted from npm request module

Parameters
NameTypeDescription
price_categorystring- Either high, medium, low 
publicBoolboolean- Make Media available publicly or not? 
namestring- Name of Media (Non Unique) 
tagsarray- Tag Names for Media - Array of Strings 
filebuffer- File Buffer from fs.readFile() - instance of UInt8Array; 
Returns
  • Promise<Object> This return the Upload Media Response. The body is in JSON format.
NameTypeDescription
responseobjectOn Resolve: This is the response from the request npm module 
bodyobjectOn Resolve: This is the body of the request npm module. 
headersobjectOn Resolve: This are the headers from the request npm module. 
errorstringOn Reject: Message of ErrorOptional
codenumberOn Reject: Code of ErrorOptional

exports.deleteMediaFile(IDArray)

This function deletes Media from CobbleVision

Parameters
NameTypeDescription
IDArrayarrayArray of ID's as Strings 
Returns
  • Promise<Object> This return the Delete Media Response. The body is in JSON format.
NameTypeDescription
responseobjectOn Resolve: This is the response from the request npm module 
bodyobjectOn Resolve: This is the body of the request npm module. 
headersobjectOn Resolve: This are the headers from the request npm module. 
errorstringOn Reject: Message of ErrorOptional
codenumberOn Reject: Code of ErrorOptional

exports.launchCalculation(algorithms, media, type, notificationURL)

Launch a calculation with CobbleVision's Web API. Returns a response object with body, response and headers properties, deducted from npm request module;

Parameters
NameTypeDescription
algorithmsarrayArray of Algorithm Names 
mediaarrayArray of Media ID's 
typestringType of Job - Currently Always "QueuedJob" 
notificationURLstringOptional - Notify user upon finishing calculation!Optional
Returns
  • Promise<Object> This returns the Launch Calculation Response. The body is in JSON format.
NameTypeDescription
responseobjectOn Resolve: This is the response from the request npm module 
bodyobjectOn Resolve: This is the body of the request npm module. 
headersobjectOn Resolve: This are the headers from the request npm module. 
errorstringOn Reject: Message of ErrorOptional
codenumberOn Reject: Code of ErrorOptional

exports.waitForCalculationCompletion(calculationIDArray)

This function waits until the given calculation ID's are ready to be downloaded!

Parameters
NameTypeDescription
calculationIDArrayarrayArray of Calculation ID's 
Returns
  • Promise<Object> This returns the Wait For Calculation Response. The body is in JSON format.
NameTypeDescription
responseobjectOn Resolve: This is the response from the request npm module 
bodyobjectOn Resolve: This is the body of the request npm module. 
headersobjectOn Resolve: This are the headers from the request npm module. 
errorstringOn Reject: Message of ErrorOptional
codenumberOn Reject: Code of ErrorOptional

exports.deleteCalculation(IDArray)

This function deletes Result Files or calculations in status "waiting" from CobbleVision. You cannot delete finished jobs beyond their result files, as we keep them for billing purposes.

Parameters
NameTypeDescription
IDArrayarrayArray of ID's as Strings 
Returns
  • Promise<Object> This returns the Delete Calculation Response. The body is in JSON format.
NameTypeDescription
responseobjectOn Resolve: This is the response from the request npm module 
bodyobjectOn Resolve: This is the body of the request npm module. 
headersobjectOn Resolve: This are the headers from the request npm module. 
errorstringOn Reject: Message of ErrorOptional
codenumberOn Reject: Code of ErrorOptional

exports.getCalculationResult(idArray, returnOnlyStatusBool)

Launch a calculation with CobbleVision's Web API. Returns a response object with body, response and headers properties, deducted from npm request module;

Parameters
NameTypeDescription
idArrayarrayID of calculation to return result Array 
returnOnlyStatusBoolbooleanReturn full result or only status? See Doc for more detailed description! 
Returns
  • Promise<Object> This returns the Get Calculation Result. The body is in json format.
NameTypeDescription
responseobjectOn Resolve: This is the response from the request npm module 
bodyobjectOn Resolve: This is the body of the request npm module. 
headersobjectOn Resolve: This are the headers from the request npm module. 
errorstringOn Reject: Message of ErrorOptional
codenumberOn Reject: Code of ErrorOptional

exports.getCalculationVisualization(id, returnBase64Bool, width, height)

Request your calculation result by ID with the CobbleVision API. Returns a response object with body, response and headers properties, deducted from npm request module;

Parameters
NameTypeDescription
idarrayID of calculation to return result/check String 
returnBase64BoolbooleanReturn Base64 String or image buffer as string? 
widthnumbertarget width of visualization file 
heightnumbertarget height of visualization file 
Returns
  • Promise<Object> This returns the Get Calculation Visualization Result. The body is in binary format.
NameTypeDescription
responseobjectOn Resolve: This is the response from the request npm module 
bodyobjectOn Resolve: This is the body of the request npm module. 
headersobjectOn Resolve: This are the headers from the request npm module. 
errorstringOn Reject: Message of ErrorOptional
codenumberOn Reject: Code of ErrorOptional