Function createSdk
Creates an SDK instance
Based on the provided configuration, various services are made available:
- When Open Design API credentials (a token) is provided, the API is configured and available for uploading and downloading designs.
- A local rendering engine is available by default.
- Local system fonts can be used for rendering design by default.
- A local cache is available by default.
Example:
Full SDK
const sdk = createSdk({
token: '<TOKEN>',
})
Full SDK with all logs for debugging purposes
const sdk = createSdk({
token: '<TOKEN>',
console: { level: 'debug' }
})
SDK without the local rendering engine
const sdk = createSdk({
token: '<TOKEN>',
rendering: false,
systemFonts: false,
})
Parameters:
SDK Parameters
The URL base for Open Design API calls. By default, production Avocode Open Design API servers are used.
Whether to use a local (file system) cache in the form for .octopus
files. This is enabled by default.
Configuration of the console/logger. This can either be a log level configuration for the bundled logger or a custom console object. The bundled logger can be replaced with the default node.js console via { console: console }
.
Whether to use a local rendering engine for rendering designs. This is enabled by default. cached
must not be set to false
for the rendering engine to be available.
Whether to use a local SVG exporter. This is enabled by default.
Whether to use local system fonts for rendering designs via the rendering engine. This is enabled by default.
An Open Design API access token. Test tokens can be generated within the Open Design API documentation. When no token is provided, online services (the API) is not configured.
An absolute path to the directory against which should the SDK resolve relative file paths and where should it look for its cache directory.
An SDK instance.
Was this article helpful?