Skip to content

Commit 29b2e71

Browse files
committed
Update readme and examples
1 parent d98808a commit 29b2e71

54 files changed

Lines changed: 21 additions & 4973 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/generate_sdk_code.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ jobs:
7777
- name: Generate SDK
7878
run: |
7979
java --version
80-
java -jar ${{ runner.temp }}/openapi-generator-cli.jar generate -i ${{ runner.temp }}/openapispec/openapi.yml -g java -o ./src -c ${{ runner.temp }}/${{ env.CONFIG_FILE }} --skip-validate-spec -t ./codegen-template
81-
cp ./src/README.md ./README.md
82-
cp -r ./src/docs ./docs
80+
java -jar ${{ runner.temp }}/openapi-generator-cli.jar generate -i ${{ runner.temp }}/openapispec/openapi.yml -g java -o ./src -c ${{ runner.temp }}/${{ env.CONFIG_FILE }} --skip-validate-spec
8381
8482
- name: Create Pull Request
8583
id: cpr

README.md

Lines changed: 20 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,9 @@
1-
# databox
1+
# Databox
2+
This package is designed to consume the Databox Push API functionality via a Java client.
23

3-
Static OpenAPI document of Push API resource
4-
- API version: 0.4.1
5-
- Build date: 2024-07-11T08:40:29.068083Z[Etc/UTC]
6-
- Generator version: 7.6.0
7-
8-
Push API resources Open API documentation
9-
10-
11-
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
12-
13-
14-
## Requirements
15-
16-
Building the API client library requires:
17-
1. Java 1.8+
18-
2. Maven (3.8.3+)/Gradle (7.2+)
194

205
## Installation
216

22-
To install the API client library to your local Maven repository, simply execute:
23-
24-
```shell
25-
mvn clean install
26-
```
27-
28-
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
29-
30-
```shell
31-
mvn clean deploy
32-
```
33-
34-
Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
35-
367
### Maven users
378

389
Add this dependency to your project's POM:
@@ -61,96 +32,42 @@ Add this dependency to your project's build file:
6132
}
6233
```
6334

64-
### Others
65-
66-
At first generate the JAR by executing:
67-
68-
```shell
69-
mvn clean package
70-
```
71-
72-
Then manually install the following JARs:
73-
74-
* `target/databox-2.5.1.jar`
75-
* `target/lib/*.jar`
76-
77-
## Getting Started
35+
## Prerequisites
36+
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.
7837

79-
Please follow the [installation](#installation) instruction and execute the following Java code:
38+
## Example
8039

8140
```java
82-
83-
// Import classes:
8441
import org.databox.ApiClient;
8542
import org.databox.ApiException;
8643
import org.databox.Configuration;
87-
import org.databox.auth.*;
88-
import org.databox.models.*;
8944
import org.databox.api.DefaultApi;
45+
import org.databox.auth.HttpBasicAuth;
46+
import org.openapitools.client.model.PushData;
47+
import org.openapitools.client.model.PushDataAttribute;
9048

9149
public class Example {
9250
public static void main(String[] args) {
9351
ApiClient defaultClient = Configuration.getDefaultApiClient();
9452
defaultClient.setBasePath("https://push.databox.com");
95-
96-
// Configure HTTP basic authorization: basicAuth
53+
defaultClient.addDefaultHeader("Accept", "application/vnd.databox.v2+json");
54+
9755
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
98-
basicAuth.setUsername("YOUR USERNAME");
99-
basicAuth.setPassword("YOUR PASSWORD");
56+
basicAuth.setUsername("Your_Databox_API_Token");
57+
58+
PushData data = new PushData()
59+
.key("Metric_name") // e.g. sales
60+
.value(123f)
61+
.date("Date_in_ISO8601") // e.g. "2024-08-01T00:00:00Z"
62+
.unit("Unit") // optional - e.g. USD
63+
.attributes(List.of(new PushDataAttribute().key("Dimension_name").value("Dimension_value"))); // optional - e.g. currency & USD
10064

10165
DefaultApi apiInstance = new DefaultApi(defaultClient);
10266
try {
103-
apiInstance.dataDelete();
67+
apiInstance.dataPost(List.of(data));
10468
} catch (ApiException e) {
105-
System.err.println("Exception when calling DefaultApi#dataDelete");
106-
System.err.println("Status code: " + e.getCode());
107-
System.err.println("Reason: " + e.getResponseBody());
108-
System.err.println("Response headers: " + e.getResponseHeaders());
10969
e.printStackTrace();
11070
}
11171
}
11272
}
113-
114-
```
115-
116-
## Documentation for API Endpoints
117-
118-
All URIs are relative to *https://push.databox.com*
119-
120-
Class | Method | HTTP request | Description
121-
------------ | ------------- | ------------- | -------------
122-
*DefaultApi* | [**dataDelete**](docs/DefaultApi.md#dataDelete) | **DELETE** /data |
123-
*DefaultApi* | [**dataMetricKeyDelete**](docs/DefaultApi.md#dataMetricKeyDelete) | **DELETE** /data/{metricKey} |
124-
*DefaultApi* | [**dataPost**](docs/DefaultApi.md#dataPost) | **POST** /data |
125-
*DefaultApi* | [**metrickeysGet**](docs/DefaultApi.md#metrickeysGet) | **GET** /metrickeys |
126-
*DefaultApi* | [**metrickeysPost**](docs/DefaultApi.md#metrickeysPost) | **POST** /metrickeys |
127-
*DefaultApi* | [**pingGet**](docs/DefaultApi.md#pingGet) | **GET** /ping |
128-
129-
130-
## Documentation for Models
131-
132-
- [ModelApiResponse](docs/ModelApiResponse.md)
133-
- [PushData](docs/PushData.md)
134-
- [PushDataAttribute](docs/PushDataAttribute.md)
135-
- [State](docs/State.md)
136-
137-
138-
<a id="documentation-for-authorization"></a>
139-
## Documentation for Authorization
140-
141-
142-
Authentication schemes defined for the API:
143-
<a id="basicAuth"></a>
144-
### basicAuth
145-
146-
- **Type**: HTTP basic authentication
147-
148-
149-
## Recommendation
150-
151-
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
152-
153-
## Author
154-
155-
156-
73+
```

0 commit comments

Comments
 (0)