From 95ebf56f53ab1f5bf49bdeb2485897faa7360bda Mon Sep 17 00:00:00 2001 From: slavkor <30171206+slavkor@users.noreply.github.com> Date: Mon, 26 Aug 2024 12:34:32 +0000 Subject: [PATCH] chore: release data-link SDK --- src/README.md | 69 +++++++++-------------------- src/package.json | 5 ++- src/src/apis/DefaultApi.ts | 4 +- src/src/models/ModelApiResponse.ts | 4 +- src/src/models/PushData.ts | 4 +- src/src/models/PushDataAttribute.ts | 4 +- src/src/models/State.ts | 4 +- src/src/runtime.ts | 4 +- 8 files changed, 38 insertions(+), 60 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: "<Your_Databox_API_Token>", - headers: { - Accept: "application/vnd.databox.v2+json", - }, -}); +### Consuming -const dataPostRequest: DataPostRequest = { - pushData: [ - { - key: "<Metric_name>", - value: 123, - date: "<Date_in_ISO8601>", - unit: "<Unit>", // Optional - attributes: [{ key: "<Dimension_name>", value: "<Dimension_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<void>) => 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..6c1b3a6 100644 --- a/src/src/apis/DefaultApi.ts +++ b/src/src/apis/DefaultApi.ts @@ -2,9 +2,9 @@ /* eslint-disable */ /** * Static OpenAPI document of Push API resource - * Push API resources Open API documentation + * Push API resources Open API documentation asdas * - * The version of the OpenAPI document: 0.4.3 + * The version of the OpenAPI document: 0.4.4-alpha.2 * * * 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..491c427 100644 --- a/src/src/models/ModelApiResponse.ts +++ b/src/src/models/ModelApiResponse.ts @@ -2,9 +2,9 @@ /* eslint-disable */ /** * Static OpenAPI document of Push API resource - * Push API resources Open API documentation + * Push API resources Open API documentation asdas * - * The version of the OpenAPI document: 0.4.3 + * The version of the OpenAPI document: 0.4.4-alpha.2 * * * 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..ddb2035 100644 --- a/src/src/models/PushData.ts +++ b/src/src/models/PushData.ts @@ -2,9 +2,9 @@ /* eslint-disable */ /** * Static OpenAPI document of Push API resource - * Push API resources Open API documentation + * Push API resources Open API documentation asdas * - * The version of the OpenAPI document: 0.4.3 + * The version of the OpenAPI document: 0.4.4-alpha.2 * * * 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..2249b0a 100644 --- a/src/src/models/PushDataAttribute.ts +++ b/src/src/models/PushDataAttribute.ts @@ -2,9 +2,9 @@ /* eslint-disable */ /** * Static OpenAPI document of Push API resource - * Push API resources Open API documentation + * Push API resources Open API documentation asdas * - * The version of the OpenAPI document: 0.4.3 + * The version of the OpenAPI document: 0.4.4-alpha.2 * * * 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..7c1cc5b 100644 --- a/src/src/models/State.ts +++ b/src/src/models/State.ts @@ -2,9 +2,9 @@ /* eslint-disable */ /** * Static OpenAPI document of Push API resource - * Push API resources Open API documentation + * Push API resources Open API documentation asdas * - * The version of the OpenAPI document: 0.4.3 + * The version of the OpenAPI document: 0.4.4-alpha.2 * * * 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..9e390f3 100644 --- a/src/src/runtime.ts +++ b/src/src/runtime.ts @@ -2,9 +2,9 @@ /* eslint-disable */ /** * Static OpenAPI document of Push API resource - * Push API resources Open API documentation + * Push API resources Open API documentation asdas * - * The version of the OpenAPI document: 0.4.3 + * The version of the OpenAPI document: 0.4.4-alpha.2 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).