From 07f75cbe734c70526fde1e1401f90a720fe2ffe7 Mon Sep 17 00:00:00 2001 From: slavkor <30171206+slavkor@users.noreply.github.com> Date: Mon, 2 Sep 2024 08:41:05 +0000 Subject: [PATCH] chore: release data-link SDK --- src/README.md | 69 +++++++++-------------------- src/package.json | 5 ++- src/src/apis/DefaultApi.ts | 2 +- src/src/models/ModelApiResponse.ts | 2 +- src/src/models/PushData.ts | 2 +- src/src/models/PushDataAttribute.ts | 2 +- src/src/models/State.ts | 2 +- src/src/runtime.ts | 2 +- 8 files changed, 32 insertions(+), 54 deletions(-) diff --git a/src/README.md b/src/README.md index 82e9db3..03cc1f8 100644 --- a/src/README.md +++ b/src/README.md @@ -1,6 +1,6 @@ -## Databox +## databox@2.1.2 -This package is designed to consume the Databox Push API functionality via TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The package is compatible with the following environments: +This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The generated Node module can be used in the following environments: Environment * Node.js @@ -8,64 +8,39 @@ Environment * Browserify Language level -* ES5 - You must have a Promises/A+ library installed +* ES5 - you must have a Promises/A+ library installed * ES6 Module system * CommonJS * ES6 module system -The package can be used with both TypeScript and JavaScript. In TypeScript, the definitions will be automatically resolved via `package.json`. ([Reference](https://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html)). +It can be used in both TypeScript and JavaScript. In TypeScript, the definition will be automatically resolved via `package.json`. ([Reference](https://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html)) -### Installing +### Building +To build and compile the typescript sources to javascript use: ``` -npm install databox --save +npm install +npm run build ``` -### Prerequisites -In use the Databox Push API functionality, please refer to [Databox Developers Page](https://developers.databox.com/), specifically the **Quick Guide** section, where you will learn how to create a **Databox Push API token** which is required for pushing your data. +### Publishing -### Example -The basic example of pushing data to Databox is provided below: -```TypeScript -import { - ApiResponse, - Configuration, - DataPostRequest, - DefaultApi, -} from "databox"; +First build the package then run `npm publish` -const config: Configuration = new Configuration({ - basePath: "https://push.databox.com", - username: "", - headers: { - Accept: "application/vnd.databox.v2+json", - }, -}); +### Consuming -const dataPostRequest: DataPostRequest = { - pushData: [ - { - key: "", - value: 123, - date: "", - unit: "", // Optional - attributes: [{ key: "", value: "" }], // Optional - }, - ], -}; +navigate to the folder of your consuming project and run one of the following commands. -const api = new DefaultApi(config); +_published:_ -try { - api - .dataPostRaw(dataPostRequest) - .then((response: ApiResponse) => response.raw.json()) - .then((responseBody) => { - console.log("Response data", responseBody); - }); -} catch (error) { - console.log("Error: ", error); -} -``` \ No newline at end of file +``` +npm install databox@2.1.2 --save +``` + +_unPublished (not recommended):_ + +``` +npm install PATH_TO_GENERATED_PACKAGE --save +``` diff --git a/src/package.json b/src/package.json index 1b1012d..72fcc08 100644 --- a/src/package.json +++ b/src/package.json @@ -5,7 +5,7 @@ "author": "OpenAPI-Generator", "repository": { "type": "git", - "url": "https://github.com/databox/databox-js.git" + "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git" }, "main": "./dist/index.js", "typings": "./dist/index.d.ts", @@ -15,5 +15,8 @@ }, "devDependencies": { "typescript": "^4.0 || ^5.0" + }, + "publishConfig": { + "registry": "https://github.com/databox/databox-js.git" } } diff --git a/src/src/apis/DefaultApi.ts b/src/src/apis/DefaultApi.ts index f7c7af3..6fd43e8 100644 --- a/src/src/apis/DefaultApi.ts +++ b/src/src/apis/DefaultApi.ts @@ -4,7 +4,7 @@ * Static OpenAPI document of Push API resource * Push API resources Open API documentation * - * The version of the OpenAPI document: 0.4.3 + * The version of the OpenAPI document: 0.4.4-alpha.4 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/src/models/ModelApiResponse.ts b/src/src/models/ModelApiResponse.ts index 76f74d0..2d856df 100644 --- a/src/src/models/ModelApiResponse.ts +++ b/src/src/models/ModelApiResponse.ts @@ -4,7 +4,7 @@ * Static OpenAPI document of Push API resource * Push API resources Open API documentation * - * The version of the OpenAPI document: 0.4.3 + * The version of the OpenAPI document: 0.4.4-alpha.4 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/src/models/PushData.ts b/src/src/models/PushData.ts index 654290b..f758cd5 100644 --- a/src/src/models/PushData.ts +++ b/src/src/models/PushData.ts @@ -4,7 +4,7 @@ * Static OpenAPI document of Push API resource * Push API resources Open API documentation * - * The version of the OpenAPI document: 0.4.3 + * The version of the OpenAPI document: 0.4.4-alpha.4 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/src/models/PushDataAttribute.ts b/src/src/models/PushDataAttribute.ts index 723670d..e27d9fd 100644 --- a/src/src/models/PushDataAttribute.ts +++ b/src/src/models/PushDataAttribute.ts @@ -4,7 +4,7 @@ * Static OpenAPI document of Push API resource * Push API resources Open API documentation * - * The version of the OpenAPI document: 0.4.3 + * The version of the OpenAPI document: 0.4.4-alpha.4 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/src/models/State.ts b/src/src/models/State.ts index 6f88713..4ee11f8 100644 --- a/src/src/models/State.ts +++ b/src/src/models/State.ts @@ -4,7 +4,7 @@ * Static OpenAPI document of Push API resource * Push API resources Open API documentation * - * The version of the OpenAPI document: 0.4.3 + * The version of the OpenAPI document: 0.4.4-alpha.4 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/src/runtime.ts b/src/src/runtime.ts index 6c1c675..f49b8fe 100644 --- a/src/src/runtime.ts +++ b/src/src/runtime.ts @@ -4,7 +4,7 @@ * Static OpenAPI document of Push API resource * Push API resources Open API documentation * - * The version of the OpenAPI document: 0.4.3 + * The version of the OpenAPI document: 0.4.4-alpha.4 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).