Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jellyfin] Add support for server versions > 10.8 #17757

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
133 changes: 34 additions & 99 deletions bundles/org.openhab.binding.jellyfin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,108 +9,43 @@
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
<version>4.3.0-SNAPSHOT</version>
</parent>

<properties>
<bnd.importpackage>
!android.*,!com.android.*,!kotlin.internal.jdk7,!kotlin.internal.jdk8,!kotlin.reflect.*,!okhttp3.*,!okio.*
</bnd.importpackage>
<jellyfin.sdk>1.4.7</jellyfin.sdk>
<openapi-generator.version>7.10.0</openapi-generator.version>
</properties>

<artifactId>org.openhab.binding.jellyfin</artifactId>

<name>openHAB Add-ons :: Bundles :: Jellyfin Binding</name>
<dependencies>
<dependency>
<groupId>org.jellyfin.sdk</groupId>
<artifactId>jellyfin-core-jvm</artifactId>
<version>${jellyfin.sdk}</version>
</dependency>
<dependency>
<groupId>org.jellyfin.sdk</groupId>
<artifactId>jellyfin-api-jvm</artifactId>
<version>${jellyfin.sdk}</version>
</dependency>
<dependency>
<groupId>org.jellyfin.sdk</groupId>
<artifactId>jellyfin-model-jvm</artifactId>
<version>${jellyfin.sdk}</version>
</dependency>
<dependency>
<groupId>io.ktor</groupId>
<artifactId>ktor-client-core-jvm</artifactId>
<version>1.6.8</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.ktor</groupId>
<artifactId>ktor-client-cio-jvm</artifactId>
<version>1.6.8</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.ktor</groupId>
<artifactId>ktor-http-jvm</artifactId>
<version>1.6.8</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.ktor</groupId>
<artifactId>ktor-http-cio-jvm</artifactId>
<version>1.6.8</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.ktor</groupId>
<artifactId>ktor-network-jvm</artifactId>
<version>1.6.8</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.ktor</groupId>
<artifactId>ktor-utils-jvm</artifactId>
<version>1.6.8</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.ktor</groupId>
<artifactId>ktor-io-jvm</artifactId>
<version>1.6.8</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.ktor</groupId>
<artifactId>ktor-network-tls-jvm</artifactId>
<version>1.6.8</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>${kotlin.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-core-jvm</artifactId>
<version>1.8.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-serialization-core-jvm</artifactId>
<version>1.6.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-serialization-json-jvm</artifactId>
<version>1.6.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.github.microutils</groupId>
<artifactId>kotlin-logging-jvm</artifactId>
<version>3.0.5</version>
<scope>compile</scope>
</dependency>
</dependencies>

<!--
***
* 🐛 [\#18596 - [BUG] [JAVA] ClassCastException...](https://github.com/OpenAPITools/openapi-generator/issues/18596)
*
* ➡️ Integration into maven would depend on solving this issue first.
***
<build>
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>${openapi-generator.version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/jellyfin-openapi-10.10.3.yaml</inputSpec>
<generatorName>java</generatorName>
<configOptions>
<sourceFolder>src/gen/java/main</sourceFolder>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
-->
</project>
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@


# AccessSchedule

An entity representing a user's access schedule.

## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**id** | **Integer** | Gets the id of this instance. | [optional] [readonly] |
|**userId** | **UUID** | Gets the id of the associated user. | [optional] |
|**dayOfWeek** | **DynamicDayOfWeek** | Gets or sets the day of week. | [optional] |
|**startHour** | **Double** | Gets or sets the start hour. | [optional] |
|**endHour** | **Double** | Gets or sets the end hour. | [optional] |



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 &#x3D; 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 | - |

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@


# ActivityLogEntry

An activity log entry.

## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**id** | **Long** | Gets or sets the identifier. | [optional] |
|**name** | **String** | Gets or sets the name. | [optional] |
|**overview** | **String** | Gets or sets the overview. | [optional] |
|**shortOverview** | **String** | Gets or sets the short overview. | [optional] |
|**type** | **String** | Gets or sets the type. | [optional] |
|**itemId** | **String** | Gets or sets the item identifier. | [optional] |
|**date** | **OffsetDateTime** | Gets or sets the date. | [optional] |
|**userId** | **UUID** | Gets or sets the user identifier. | [optional] |
|**userPrimaryImageTag** | **String** | Gets or sets the user primary image tag. | [optional] |
|**severity** | **LogLevel** | Gets or sets the log severity. | [optional] |



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&lt;ActivityLogEntry&gt;**](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] |



Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@


# ActivityLogEntryQueryResult

Query result container.

## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**items** | [**List&lt;ActivityLogEntry&gt;**](ActivityLogEntry.md) | Gets or sets the items. | [optional] |
|**totalRecordCount** | **Integer** | Gets or sets the total number of records available. | [optional] |
|**startIndex** | **Integer** | Gets or sets the index of the first record in Items. | [optional] |



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] |



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] |



Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@


# AddVirtualFolderDto

Add virtual folder dto.

## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**libraryOptions** | [**LibraryOptions**](LibraryOptions.md) | Gets or sets library options. | [optional] |



Loading
Loading