-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): openAPI code generator - poc (wip)
Signed-off-by: Patrik Gfeller <[email protected]>
- Loading branch information
Showing
2,196 changed files
with
308,273 additions
and
321,195 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
...nhab.binding.jellyfin/src/main/java/org/openhab/binding/jellyfin/internal/api/generate.sh
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,47 @@ | ||
#!/usr/bin/bash | ||
|
||
set -e | ||
|
||
VERSIONS=("10.8.13" "10.10.3") | ||
REQUIRED=("wget" "yq" "openapi-generator-cli") | ||
|
||
function checkEnvironment() { | ||
for i in "${REQUIRED[@]}"; do | ||
if ! type $i &>/dev/null; then | ||
echo "⚠️ [${i}] could not be found" | ||
exit 127 | ||
fi | ||
done | ||
} | ||
|
||
checkEnvironment | ||
|
||
for i in "${VERSIONS[@]}"; do | ||
echo "ℹ️ - API Version to generate: $i" | ||
|
||
FILENAME_JSON="./specifications/json/jellyfin-openapi-${i}.json" | ||
FILENAME_YAML="./specifications/yaml/jellyfin-openapi-${i}.yaml" | ||
|
||
if [ ! -e "${FILENAME_JSON}" ]; then | ||
echo "⏬ - Downloading OPENAPI definition for Version ${i}" | ||
|
||
SERVER=https://repo.jellyfin.org/files/openapi/stable/jellyfin-openapi-${i}.json | ||
|
||
wget \ | ||
--no-verbose \ | ||
--output-document=${FILENAME_JSON} \ | ||
${SERVER} | ||
|
||
if [ ! -e "${FILENAME_YAML}" ]; then | ||
echo "⚙️ - json ➡️ yaml" | ||
yq -oy ${FILENAME_JSON} >${FILENAME_YAML} | ||
fi | ||
fi | ||
|
||
echo "⚙️ - generate code for API ${i}" | ||
|
||
# TODO: config.yaml - https://openapi-generator.tech/docs/customization | ||
openapi-generator-cli generate -g java \ | ||
--global-property models,modelTests=false,apis,apiTests=false,library=native,serializationLibrary=jackson,apiPackage=org.openhab.binding.jellyfin.internal.api.${i} \ | ||
--input-spec ${FILENAME_YAML} -o ./generated/${i} 1>/dev/null | ||
done |
File renamed without changes.
84 changes: 84 additions & 0 deletions
84
.../openhab/binding/jellyfin/internal/api/generated/10.10.3/docs/ActivityLogApi.md
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,84 @@ | ||
# ActivityLogApi | ||
|
||
All URIs are relative to *http://localhost* | ||
|
||
| Method | HTTP request | Description | | ||
|------------- | ------------- | -------------| | ||
| [**getLogEntries**](ActivityLogApi.md#getLogEntries) | **GET** /System/ActivityLog/Entries | Gets activity log entries. | | ||
|
||
|
||
<a id="getLogEntries"></a> | ||
# **getLogEntries** | ||
> ActivityLogEntryQueryResult getLogEntries(startIndex, limit, minDate, hasUserId) | ||
Gets activity log entries. | ||
|
||
### Example | ||
```java | ||
// Import classes: | ||
import org.openapitools.client.ApiClient; | ||
import org.openapitools.client.ApiException; | ||
import org.openapitools.client.Configuration; | ||
import org.openapitools.client.auth.*; | ||
import org.openapitools.client.models.*; | ||
import org.openapitools.client.api.ActivityLogApi; | ||
|
||
public class Example { | ||
public static void main(String[] args) { | ||
ApiClient defaultClient = Configuration.getDefaultApiClient(); | ||
defaultClient.setBasePath("http://localhost"); | ||
|
||
// Configure API key authorization: CustomAuthentication | ||
ApiKeyAuth CustomAuthentication = (ApiKeyAuth) defaultClient.getAuthentication("CustomAuthentication"); | ||
CustomAuthentication.setApiKey("YOUR API KEY"); | ||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) | ||
//CustomAuthentication.setApiKeyPrefix("Token"); | ||
|
||
ActivityLogApi apiInstance = new ActivityLogApi(defaultClient); | ||
Integer startIndex = 56; // Integer | Optional. The record index to start at. All items with a lower index will be dropped from the results. | ||
Integer limit = 56; // Integer | Optional. The maximum number of records to return. | ||
OffsetDateTime minDate = OffsetDateTime.now(); // OffsetDateTime | Optional. The minimum date. Format = ISO. | ||
Boolean hasUserId = true; // Boolean | Optional. Filter log entries if it has user id, or not. | ||
try { | ||
ActivityLogEntryQueryResult result = apiInstance.getLogEntries(startIndex, limit, minDate, hasUserId); | ||
System.out.println(result); | ||
} catch (ApiException e) { | ||
System.err.println("Exception when calling ActivityLogApi#getLogEntries"); | ||
System.err.println("Status code: " + e.getCode()); | ||
System.err.println("Reason: " + e.getResponseBody()); | ||
System.err.println("Response headers: " + e.getResponseHeaders()); | ||
e.printStackTrace(); | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### Parameters | ||
|
||
| Name | Type | Description | Notes | | ||
|------------- | ------------- | ------------- | -------------| | ||
| **startIndex** | **Integer**| Optional. The record index to start at. All items with a lower index will be dropped from the results. | [optional] | | ||
| **limit** | **Integer**| Optional. The maximum number of records to return. | [optional] | | ||
| **minDate** | **OffsetDateTime**| Optional. The minimum date. Format = ISO. | [optional] | | ||
| **hasUserId** | **Boolean**| Optional. Filter log entries if it has user id, or not. | [optional] | | ||
|
||
### Return type | ||
|
||
[**ActivityLogEntryQueryResult**](ActivityLogEntryQueryResult.md) | ||
|
||
### Authorization | ||
|
||
[CustomAuthentication](../README.md#CustomAuthentication) | ||
|
||
### HTTP request headers | ||
|
||
- **Content-Type**: Not defined | ||
- **Accept**: application/json, application/json; profile=CamelCase, application/json; profile=PascalCase | ||
|
||
### HTTP response details | ||
| Status code | Description | Response headers | | ||
|-------------|-------------|------------------| | ||
| **200** | Activity log returned. | - | | ||
| **401** | Unauthorized | - | | ||
| **403** | Forbidden | - | | ||
|
File renamed without changes.
16 changes: 16 additions & 0 deletions
16
...binding/jellyfin/internal/api/generated/10.10.3/docs/ActivityLogEntryMessage.md
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 @@ | ||
|
||
|
||
# ActivityLogEntryMessage | ||
|
||
Activity log created message. | ||
|
||
## Properties | ||
|
||
| Name | Type | Description | Notes | | ||
|------------ | ------------- | ------------- | -------------| | ||
|**data** | [**List<ActivityLogEntry>**](ActivityLogEntry.md) | Gets or sets the data. | [optional] | | ||
|**messageId** | **UUID** | Gets or sets the message id. | [optional] | | ||
|**messageType** | **SessionMessageType** | The different kinds of messages that are used in the WebSocket api. | [optional] [readonly] | | ||
|
||
|
||
|
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
# ActivityLogEntryQueryResult | ||
|
||
Query result container. | ||
|
||
## Properties | ||
|
||
|
15 changes: 15 additions & 0 deletions
15
...ng/jellyfin/internal/api/generated/10.10.3/docs/ActivityLogEntryStartMessage.md
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,15 @@ | ||
|
||
|
||
# ActivityLogEntryStartMessage | ||
|
||
Activity log entry start message. Data is the timing data encoded as \"$initialDelay,$interval\" in ms. | ||
|
||
## Properties | ||
|
||
| Name | Type | Description | Notes | | ||
|------------ | ------------- | ------------- | -------------| | ||
|**data** | **String** | Gets or sets the data. | [optional] | | ||
|**messageType** | **SessionMessageType** | The different kinds of messages that are used in the WebSocket api. | [optional] [readonly] | | ||
|
||
|
||
|
14 changes: 14 additions & 0 deletions
14
...ing/jellyfin/internal/api/generated/10.10.3/docs/ActivityLogEntryStopMessage.md
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,14 @@ | ||
|
||
|
||
# ActivityLogEntryStopMessage | ||
|
||
Activity log entry stop message. | ||
|
||
## Properties | ||
|
||
| Name | Type | Description | Notes | | ||
|------------ | ------------- | ------------- | -------------| | ||
|**messageType** | **SessionMessageType** | The different kinds of messages that are used in the WebSocket api. | [optional] [readonly] | | ||
|
||
|
||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.