-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #138 from renderforest/template-svg
✨ release 0.3.5
- Loading branch information
Showing
15 changed files
with
202 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Renderforest SDK usage examples | ||
examples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* Copyright (c) 2018-present, Renderforest, LLC. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the license found in the | ||
* LICENSE file in the root directory. | ||
*/ | ||
|
||
const Renderforest = require('../../src/lib/renderforest') | ||
|
||
const payload = { | ||
templateId: 701 | ||
} | ||
Renderforest.getTemplateSVGContent(payload) | ||
.then(console.log) // handle the success | ||
.catch(console.error) // handle the error |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const PackageJson = require('../../package.json') | ||
|
||
const config = { | ||
API_HOST: 'https://api.renderforest.com', | ||
API_PREFIX: '/api/v1', | ||
HTTP_DEFAULT_OPTIONS: { | ||
method: 'GET', | ||
json: true, | ||
headers: { | ||
'Accept': 'application/json', | ||
'User-Agent': `renderforest/sdk-node/${PackageJson.version}` | ||
} | ||
}, | ||
PROJECT_DATA_API_PREFIX: '/api/v5', | ||
WEB_HOST: 'https://www.renderforest.com', | ||
WEB_PREFIX: '/api/v1' | ||
} | ||
|
||
module.exports = config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Copyright (c) 2018-present, Renderforest, LLC. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the license found in the | ||
* LICENSE file in the root directory. | ||
*/ | ||
|
||
const RequestPromise = require('request-promise') | ||
|
||
const { HTTP_DEFAULT_OPTIONS, WEB_HOST } = require('../../config/config') | ||
|
||
class WebRequest { | ||
/** | ||
* @param {Object} options | ||
* @description Append URI. | ||
*/ | ||
static appendURI (options) { | ||
options.uri = `${WEB_HOST}${options.endpoint}` | ||
} | ||
|
||
/** | ||
* @param {Object} options | ||
* @returns {Promise.<>} | ||
* @description Appends URI and makes request with default options. | ||
*/ | ||
request (options) { | ||
const _options = Object.assign({}, HTTP_DEFAULT_OPTIONS, options) | ||
|
||
WebRequest.appendURI(_options) | ||
|
||
return RequestPromise(_options) | ||
} | ||
} | ||
|
||
module.exports = new WebRequest() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.