mirror of
https://github.com/jellyfin/jellyfin-sdk-csharp.git
synced 2024-11-23 13:49:49 +00:00
Update to latest Kiota
This commit is contained in:
parent
5a9524f33d
commit
beaee13138
@ -3,7 +3,7 @@
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"microsoft.openapi.kiota": {
|
||||
"version": "1.11.1",
|
||||
"version": "1.12.0-preview.202402290001",
|
||||
"commands": [
|
||||
"kiota"
|
||||
]
|
||||
|
@ -1,5 +1,4 @@
|
||||
using Jellyfin.Sdk;
|
||||
using Jellyfin.Sdk.Generated;
|
||||
using Jellyfin.Sdk.Generated.Models;
|
||||
|
||||
namespace Simple;
|
||||
@ -115,7 +114,11 @@ public class SimpleService : IDisposable
|
||||
Console.WriteLine("Printing Views:");
|
||||
foreach (var view in views.Items)
|
||||
{
|
||||
Console.WriteLine($"{view.Id} - {view.Name}");
|
||||
var requestInformation = _jellyfinApiClient.Items[view.Id.Value].Images[ImageType.Primary.ToString()]
|
||||
.ToGetRequestInformation();
|
||||
var uri = _jellyfinApiClient.BuildUri(requestInformation);
|
||||
|
||||
Console.WriteLine($"{view.Id} - {view.Name} - {uri.ToString()}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -1,38 +0,0 @@
|
||||
// <auto-generated/>
|
||||
using Jellyfin.Sdk.Generated.Albums.Item.InstantMix;
|
||||
using Jellyfin.Sdk.Generated.Albums.Item.Similar;
|
||||
using Microsoft.Kiota.Abstractions;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
namespace Jellyfin.Sdk.Generated.Albums.Item {
|
||||
/// <summary>
|
||||
/// Builds and executes requests for operations under \Albums\{Albums-id}
|
||||
/// </summary>
|
||||
public class AlbumsItemRequestBuilder : BaseRequestBuilder {
|
||||
/// <summary>The InstantMix property</summary>
|
||||
public InstantMixRequestBuilder InstantMix { get =>
|
||||
new InstantMixRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The Similar property</summary>
|
||||
public SimilarRequestBuilder Similar { get =>
|
||||
new SimilarRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>
|
||||
/// Instantiates a new AlbumsItemRequestBuilder and sets the default values.
|
||||
/// </summary>
|
||||
/// <param name="pathParameters">Path parameters for the request</param>
|
||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||
public AlbumsItemRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/Albums/{Albums%2Did}", pathParameters) {
|
||||
}
|
||||
/// <summary>
|
||||
/// Instantiates a new AlbumsItemRequestBuilder and sets the default values.
|
||||
/// </summary>
|
||||
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
|
||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||
public AlbumsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/Albums/{Albums%2Did}", rawUrl) {
|
||||
}
|
||||
}
|
||||
}
|
@ -1,92 +0,0 @@
|
||||
// <auto-generated/>
|
||||
using Jellyfin.Sdk.Generated.Artists.Item.Images;
|
||||
using Jellyfin.Sdk.Generated.Artists.Item.InstantMix;
|
||||
using Jellyfin.Sdk.Generated.Artists.Item.Similar;
|
||||
using Jellyfin.Sdk.Generated.Models;
|
||||
using Microsoft.Kiota.Abstractions.Serialization;
|
||||
using Microsoft.Kiota.Abstractions;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using System;
|
||||
namespace Jellyfin.Sdk.Generated.Artists.Item {
|
||||
/// <summary>
|
||||
/// Builds and executes requests for operations under \Artists\{Artists-id}
|
||||
/// </summary>
|
||||
public class ArtistsItemRequestBuilder : BaseRequestBuilder {
|
||||
/// <summary>The Images property</summary>
|
||||
public ImagesRequestBuilder Images { get =>
|
||||
new ImagesRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The InstantMix property</summary>
|
||||
public InstantMixRequestBuilder InstantMix { get =>
|
||||
new InstantMixRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The Similar property</summary>
|
||||
public SimilarRequestBuilder Similar { get =>
|
||||
new SimilarRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>
|
||||
/// Instantiates a new ArtistsItemRequestBuilder and sets the default values.
|
||||
/// </summary>
|
||||
/// <param name="pathParameters">Path parameters for the request</param>
|
||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||
public ArtistsItemRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/Artists/{Artists%2Did}{?userId*}", pathParameters) {
|
||||
}
|
||||
/// <summary>
|
||||
/// Instantiates a new ArtistsItemRequestBuilder and sets the default values.
|
||||
/// </summary>
|
||||
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
|
||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||
public ArtistsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/Artists/{Artists%2Did}{?userId*}", rawUrl) {
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets an artist by name.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation token to use when cancelling requests</param>
|
||||
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
public async Task<BaseItemDto?> GetAsync(Action<RequestConfiguration<ArtistsItemRequestBuilderGetQueryParameters>>? requestConfiguration = default, CancellationToken cancellationToken = default) {
|
||||
#nullable restore
|
||||
#else
|
||||
public async Task<BaseItemDto> GetAsync(Action<RequestConfiguration<ArtistsItemRequestBuilderGetQueryParameters>> requestConfiguration = default, CancellationToken cancellationToken = default) {
|
||||
#endif
|
||||
var requestInfo = ToGetRequestInformation(requestConfiguration);
|
||||
return await RequestAdapter.SendAsync<BaseItemDto>(requestInfo, BaseItemDto.CreateFromDiscriminatorValue, default, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets an artist by name.
|
||||
/// </summary>
|
||||
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<ArtistsItemRequestBuilderGetQueryParameters>>? requestConfiguration = default) {
|
||||
#nullable restore
|
||||
#else
|
||||
public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<ArtistsItemRequestBuilderGetQueryParameters>> requestConfiguration = default) {
|
||||
#endif
|
||||
var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters);
|
||||
requestInfo.Configure(requestConfiguration);
|
||||
requestInfo.Headers.TryAdd("Accept", "application/json, application/json;profile=\"CamelCase\", application/json;profile=\"PascalCase\"");
|
||||
return requestInfo;
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored.
|
||||
/// </summary>
|
||||
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
|
||||
public ArtistsItemRequestBuilder WithUrl(string rawUrl) {
|
||||
return new ArtistsItemRequestBuilder(rawUrl, RequestAdapter);
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets an artist by name.
|
||||
/// </summary>
|
||||
public class ArtistsItemRequestBuilderGetQueryParameters {
|
||||
/// <summary>Optional. Filter by user id, and attach user data.</summary>
|
||||
[QueryParameter("userId")]
|
||||
public Guid? UserId { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -1,82 +0,0 @@
|
||||
// <auto-generated/>
|
||||
using Jellyfin.Sdk.Generated.Genres.Item.Images;
|
||||
using Jellyfin.Sdk.Generated.Models;
|
||||
using Microsoft.Kiota.Abstractions.Serialization;
|
||||
using Microsoft.Kiota.Abstractions;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using System;
|
||||
namespace Jellyfin.Sdk.Generated.Genres.Item {
|
||||
/// <summary>
|
||||
/// Builds and executes requests for operations under \Genres\{Genres-id}
|
||||
/// </summary>
|
||||
public class GenresItemRequestBuilder : BaseRequestBuilder {
|
||||
/// <summary>The Images property</summary>
|
||||
public ImagesRequestBuilder Images { get =>
|
||||
new ImagesRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>
|
||||
/// Instantiates a new GenresItemRequestBuilder and sets the default values.
|
||||
/// </summary>
|
||||
/// <param name="pathParameters">Path parameters for the request</param>
|
||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||
public GenresItemRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/Genres/{Genres%2Did}{?userId*}", pathParameters) {
|
||||
}
|
||||
/// <summary>
|
||||
/// Instantiates a new GenresItemRequestBuilder and sets the default values.
|
||||
/// </summary>
|
||||
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
|
||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||
public GenresItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/Genres/{Genres%2Did}{?userId*}", rawUrl) {
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets a genre, by name.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation token to use when cancelling requests</param>
|
||||
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
public async Task<BaseItemDto?> GetAsync(Action<RequestConfiguration<GenresItemRequestBuilderGetQueryParameters>>? requestConfiguration = default, CancellationToken cancellationToken = default) {
|
||||
#nullable restore
|
||||
#else
|
||||
public async Task<BaseItemDto> GetAsync(Action<RequestConfiguration<GenresItemRequestBuilderGetQueryParameters>> requestConfiguration = default, CancellationToken cancellationToken = default) {
|
||||
#endif
|
||||
var requestInfo = ToGetRequestInformation(requestConfiguration);
|
||||
return await RequestAdapter.SendAsync<BaseItemDto>(requestInfo, BaseItemDto.CreateFromDiscriminatorValue, default, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets a genre, by name.
|
||||
/// </summary>
|
||||
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<GenresItemRequestBuilderGetQueryParameters>>? requestConfiguration = default) {
|
||||
#nullable restore
|
||||
#else
|
||||
public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<GenresItemRequestBuilderGetQueryParameters>> requestConfiguration = default) {
|
||||
#endif
|
||||
var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters);
|
||||
requestInfo.Configure(requestConfiguration);
|
||||
requestInfo.Headers.TryAdd("Accept", "application/json, application/json;profile=\"CamelCase\", application/json;profile=\"PascalCase\"");
|
||||
return requestInfo;
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored.
|
||||
/// </summary>
|
||||
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
|
||||
public GenresItemRequestBuilder WithUrl(string rawUrl) {
|
||||
return new GenresItemRequestBuilder(rawUrl, RequestAdapter);
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets a genre, by name.
|
||||
/// </summary>
|
||||
public class GenresItemRequestBuilderGetQueryParameters {
|
||||
/// <summary>The user id.</summary>
|
||||
[QueryParameter("userId")]
|
||||
public Guid? UserId { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -1,196 +0,0 @@
|
||||
// <auto-generated/>
|
||||
using Jellyfin.Sdk.Generated.Items.Item.Ancestors;
|
||||
using Jellyfin.Sdk.Generated.Items.Item.ContentType;
|
||||
using Jellyfin.Sdk.Generated.Items.Item.CriticReviews;
|
||||
using Jellyfin.Sdk.Generated.Items.Item.Download;
|
||||
using Jellyfin.Sdk.Generated.Items.Item.ExternalIdInfos;
|
||||
using Jellyfin.Sdk.Generated.Items.Item.FileNamespace;
|
||||
using Jellyfin.Sdk.Generated.Items.Item.Images;
|
||||
using Jellyfin.Sdk.Generated.Items.Item.InstantMix;
|
||||
using Jellyfin.Sdk.Generated.Items.Item.MetadataEditor;
|
||||
using Jellyfin.Sdk.Generated.Items.Item.PlaybackInfo;
|
||||
using Jellyfin.Sdk.Generated.Items.Item.Refresh;
|
||||
using Jellyfin.Sdk.Generated.Items.Item.RemoteImages;
|
||||
using Jellyfin.Sdk.Generated.Items.Item.RemoteSearch;
|
||||
using Jellyfin.Sdk.Generated.Items.Item.Similar;
|
||||
using Jellyfin.Sdk.Generated.Items.Item.ThemeMedia;
|
||||
using Jellyfin.Sdk.Generated.Items.Item.ThemeSongs;
|
||||
using Jellyfin.Sdk.Generated.Items.Item.ThemeVideos;
|
||||
using Jellyfin.Sdk.Generated.Models;
|
||||
using Microsoft.Kiota.Abstractions.Serialization;
|
||||
using Microsoft.Kiota.Abstractions;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using System;
|
||||
namespace Jellyfin.Sdk.Generated.Items.Item {
|
||||
/// <summary>
|
||||
/// Builds and executes requests for operations under \Items\{Items-id}
|
||||
/// </summary>
|
||||
public class ItemsItemRequestBuilder : BaseRequestBuilder {
|
||||
/// <summary>The Ancestors property</summary>
|
||||
public AncestorsRequestBuilder Ancestors { get =>
|
||||
new AncestorsRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The ContentType property</summary>
|
||||
public ContentTypeRequestBuilder ContentType { get =>
|
||||
new ContentTypeRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The CriticReviews property</summary>
|
||||
public CriticReviewsRequestBuilder CriticReviews { get =>
|
||||
new CriticReviewsRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The Download property</summary>
|
||||
public DownloadRequestBuilder Download { get =>
|
||||
new DownloadRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The ExternalIdInfos property</summary>
|
||||
public ExternalIdInfosRequestBuilder ExternalIdInfos { get =>
|
||||
new ExternalIdInfosRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The File property</summary>
|
||||
public FileRequestBuilder File { get =>
|
||||
new FileRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The Images property</summary>
|
||||
public ImagesRequestBuilder Images { get =>
|
||||
new ImagesRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The InstantMix property</summary>
|
||||
public InstantMixRequestBuilder InstantMix { get =>
|
||||
new InstantMixRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The MetadataEditor property</summary>
|
||||
public MetadataEditorRequestBuilder MetadataEditor { get =>
|
||||
new MetadataEditorRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The PlaybackInfo property</summary>
|
||||
public PlaybackInfoRequestBuilder PlaybackInfo { get =>
|
||||
new PlaybackInfoRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The Refresh property</summary>
|
||||
public RefreshRequestBuilder Refresh { get =>
|
||||
new RefreshRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The RemoteImages property</summary>
|
||||
public RemoteImagesRequestBuilder RemoteImages { get =>
|
||||
new RemoteImagesRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The RemoteSearch property</summary>
|
||||
public RemoteSearchRequestBuilder RemoteSearch { get =>
|
||||
new RemoteSearchRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The Similar property</summary>
|
||||
public SimilarRequestBuilder Similar { get =>
|
||||
new SimilarRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The ThemeMedia property</summary>
|
||||
public ThemeMediaRequestBuilder ThemeMedia { get =>
|
||||
new ThemeMediaRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The ThemeSongs property</summary>
|
||||
public ThemeSongsRequestBuilder ThemeSongs { get =>
|
||||
new ThemeSongsRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The ThemeVideos property</summary>
|
||||
public ThemeVideosRequestBuilder ThemeVideos { get =>
|
||||
new ThemeVideosRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>
|
||||
/// Instantiates a new ItemsItemRequestBuilder and sets the default values.
|
||||
/// </summary>
|
||||
/// <param name="pathParameters">Path parameters for the request</param>
|
||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||
public ItemsItemRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/Items/{Items%2Did}", pathParameters) {
|
||||
}
|
||||
/// <summary>
|
||||
/// Instantiates a new ItemsItemRequestBuilder and sets the default values.
|
||||
/// </summary>
|
||||
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
|
||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||
public ItemsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/Items/{Items%2Did}", rawUrl) {
|
||||
}
|
||||
/// <summary>
|
||||
/// Deletes an item from the library and filesystem.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation token to use when cancelling requests</param>
|
||||
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
public async Task DeleteAsync(Action<RequestConfiguration<DefaultQueryParameters>>? requestConfiguration = default, CancellationToken cancellationToken = default) {
|
||||
#nullable restore
|
||||
#else
|
||||
public async Task DeleteAsync(Action<RequestConfiguration<DefaultQueryParameters>> requestConfiguration = default, CancellationToken cancellationToken = default) {
|
||||
#endif
|
||||
var requestInfo = ToDeleteRequestInformation(requestConfiguration);
|
||||
var errorMapping = new Dictionary<string, ParsableFactory<IParsable>> {
|
||||
{"401", ProblemDetails.CreateFromDiscriminatorValue},
|
||||
};
|
||||
await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
/// <summary>
|
||||
/// Updates an item.
|
||||
/// </summary>
|
||||
/// <param name="body">This is strictly used as a data transfer object from the api layer.This holds information about a BaseItem in a format that is convenient for the client.</param>
|
||||
/// <param name="cancellationToken">Cancellation token to use when cancelling requests</param>
|
||||
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
public async Task PostAsync(BaseItemDto body, Action<RequestConfiguration<DefaultQueryParameters>>? requestConfiguration = default, CancellationToken cancellationToken = default) {
|
||||
#nullable restore
|
||||
#else
|
||||
public async Task PostAsync(BaseItemDto body, Action<RequestConfiguration<DefaultQueryParameters>> requestConfiguration = default, CancellationToken cancellationToken = default) {
|
||||
#endif
|
||||
_ = body ?? throw new ArgumentNullException(nameof(body));
|
||||
var requestInfo = ToPostRequestInformation(body, requestConfiguration);
|
||||
var errorMapping = new Dictionary<string, ParsableFactory<IParsable>> {
|
||||
{"404", ProblemDetails.CreateFromDiscriminatorValue},
|
||||
};
|
||||
await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
/// <summary>
|
||||
/// Deletes an item from the library and filesystem.
|
||||
/// </summary>
|
||||
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
public RequestInformation ToDeleteRequestInformation(Action<RequestConfiguration<DefaultQueryParameters>>? requestConfiguration = default) {
|
||||
#nullable restore
|
||||
#else
|
||||
public RequestInformation ToDeleteRequestInformation(Action<RequestConfiguration<DefaultQueryParameters>> requestConfiguration = default) {
|
||||
#endif
|
||||
var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters);
|
||||
requestInfo.Configure(requestConfiguration);
|
||||
requestInfo.Headers.TryAdd("Accept", "application/json, application/json;profile=\"CamelCase\", application/json;profile=\"PascalCase\"");
|
||||
return requestInfo;
|
||||
}
|
||||
/// <summary>
|
||||
/// Updates an item.
|
||||
/// </summary>
|
||||
/// <param name="body">This is strictly used as a data transfer object from the api layer.This holds information about a BaseItem in a format that is convenient for the client.</param>
|
||||
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
public RequestInformation ToPostRequestInformation(BaseItemDto body, Action<RequestConfiguration<DefaultQueryParameters>>? requestConfiguration = default) {
|
||||
#nullable restore
|
||||
#else
|
||||
public RequestInformation ToPostRequestInformation(BaseItemDto body, Action<RequestConfiguration<DefaultQueryParameters>> requestConfiguration = default) {
|
||||
#endif
|
||||
_ = body ?? throw new ArgumentNullException(nameof(body));
|
||||
var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters);
|
||||
requestInfo.Configure(requestConfiguration);
|
||||
requestInfo.Headers.TryAdd("Accept", "application/json, application/json;profile=\"CamelCase\", application/json;profile=\"PascalCase\"");
|
||||
requestInfo.SetContentFromParsable(RequestAdapter, "application/json", body);
|
||||
return requestInfo;
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored.
|
||||
/// </summary>
|
||||
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
|
||||
public ItemsItemRequestBuilder WithUrl(string rawUrl) {
|
||||
return new ItemsItemRequestBuilder(rawUrl, RequestAdapter);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,108 +0,0 @@
|
||||
// <auto-generated/>
|
||||
using Jellyfin.Sdk.Generated.Models;
|
||||
using Microsoft.Kiota.Abstractions.Serialization;
|
||||
using Microsoft.Kiota.Abstractions;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using System;
|
||||
namespace Jellyfin.Sdk.Generated.Items.Item.RemoteSearch.Subtitles.Item {
|
||||
/// <summary>
|
||||
/// Builds and executes requests for operations under \Items\{itemId}\RemoteSearch\Subtitles\{Subtitles-id}
|
||||
/// </summary>
|
||||
public class SubtitlesItemRequestBuilder : BaseRequestBuilder {
|
||||
/// <summary>
|
||||
/// Instantiates a new SubtitlesItemRequestBuilder and sets the default values.
|
||||
/// </summary>
|
||||
/// <param name="pathParameters">Path parameters for the request</param>
|
||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||
public SubtitlesItemRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/Items/{itemId}/RemoteSearch/Subtitles/{Subtitles%2Did}{?isPerfectMatch*}", pathParameters) {
|
||||
}
|
||||
/// <summary>
|
||||
/// Instantiates a new SubtitlesItemRequestBuilder and sets the default values.
|
||||
/// </summary>
|
||||
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
|
||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||
public SubtitlesItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/Items/{itemId}/RemoteSearch/Subtitles/{Subtitles%2Did}{?isPerfectMatch*}", rawUrl) {
|
||||
}
|
||||
/// <summary>
|
||||
/// Search remote subtitles.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation token to use when cancelling requests</param>
|
||||
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
public async Task<List<RemoteSubtitleInfo>?> GetAsync(Action<RequestConfiguration<SubtitlesItemRequestBuilderGetQueryParameters>>? requestConfiguration = default, CancellationToken cancellationToken = default) {
|
||||
#nullable restore
|
||||
#else
|
||||
public async Task<List<RemoteSubtitleInfo>> GetAsync(Action<RequestConfiguration<SubtitlesItemRequestBuilderGetQueryParameters>> requestConfiguration = default, CancellationToken cancellationToken = default) {
|
||||
#endif
|
||||
var requestInfo = ToGetRequestInformation(requestConfiguration);
|
||||
var collectionResult = await RequestAdapter.SendCollectionAsync<RemoteSubtitleInfo>(requestInfo, RemoteSubtitleInfo.CreateFromDiscriminatorValue, default, cancellationToken).ConfigureAwait(false);
|
||||
return collectionResult?.ToList();
|
||||
}
|
||||
/// <summary>
|
||||
/// Downloads a remote subtitle.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation token to use when cancelling requests</param>
|
||||
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
public async Task PostAsync(Action<RequestConfiguration<DefaultQueryParameters>>? requestConfiguration = default, CancellationToken cancellationToken = default) {
|
||||
#nullable restore
|
||||
#else
|
||||
public async Task PostAsync(Action<RequestConfiguration<DefaultQueryParameters>> requestConfiguration = default, CancellationToken cancellationToken = default) {
|
||||
#endif
|
||||
var requestInfo = ToPostRequestInformation(requestConfiguration);
|
||||
await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
/// <summary>
|
||||
/// Search remote subtitles.
|
||||
/// </summary>
|
||||
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<SubtitlesItemRequestBuilderGetQueryParameters>>? requestConfiguration = default) {
|
||||
#nullable restore
|
||||
#else
|
||||
public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<SubtitlesItemRequestBuilderGetQueryParameters>> requestConfiguration = default) {
|
||||
#endif
|
||||
var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters);
|
||||
requestInfo.Configure(requestConfiguration);
|
||||
requestInfo.Headers.TryAdd("Accept", "application/json");
|
||||
return requestInfo;
|
||||
}
|
||||
/// <summary>
|
||||
/// Downloads a remote subtitle.
|
||||
/// </summary>
|
||||
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
public RequestInformation ToPostRequestInformation(Action<RequestConfiguration<DefaultQueryParameters>>? requestConfiguration = default) {
|
||||
#nullable restore
|
||||
#else
|
||||
public RequestInformation ToPostRequestInformation(Action<RequestConfiguration<DefaultQueryParameters>> requestConfiguration = default) {
|
||||
#endif
|
||||
var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters);
|
||||
requestInfo.Configure(requestConfiguration);
|
||||
return requestInfo;
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored.
|
||||
/// </summary>
|
||||
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
|
||||
public SubtitlesItemRequestBuilder WithUrl(string rawUrl) {
|
||||
return new SubtitlesItemRequestBuilder(rawUrl, RequestAdapter);
|
||||
}
|
||||
/// <summary>
|
||||
/// Search remote subtitles.
|
||||
/// </summary>
|
||||
public class SubtitlesItemRequestBuilderGetQueryParameters {
|
||||
/// <summary>Optional. Only show subtitles which are a perfect match.</summary>
|
||||
[QueryParameter("isPerfectMatch")]
|
||||
public bool? IsPerfectMatch { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
// <auto-generated/>
|
||||
using Jellyfin.Sdk.Generated.Models;
|
||||
using Jellyfin.Sdk.Generated.MusicGenres.Item.Images;
|
||||
using Jellyfin.Sdk.Generated.MusicGenres.Item.InstantMix;
|
||||
using Microsoft.Kiota.Abstractions.Serialization;
|
||||
using Microsoft.Kiota.Abstractions;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using System;
|
||||
namespace Jellyfin.Sdk.Generated.MusicGenres.Item {
|
||||
/// <summary>
|
||||
/// Builds and executes requests for operations under \MusicGenres\{MusicGenres-id}
|
||||
/// </summary>
|
||||
public class MusicGenresItemRequestBuilder : BaseRequestBuilder {
|
||||
/// <summary>The Images property</summary>
|
||||
public ImagesRequestBuilder Images { get =>
|
||||
new ImagesRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The InstantMix property</summary>
|
||||
public InstantMixRequestBuilder InstantMix { get =>
|
||||
new InstantMixRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>
|
||||
/// Instantiates a new MusicGenresItemRequestBuilder and sets the default values.
|
||||
/// </summary>
|
||||
/// <param name="pathParameters">Path parameters for the request</param>
|
||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||
public MusicGenresItemRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/MusicGenres/{MusicGenres%2Did}{?userId*}", pathParameters) {
|
||||
}
|
||||
/// <summary>
|
||||
/// Instantiates a new MusicGenresItemRequestBuilder and sets the default values.
|
||||
/// </summary>
|
||||
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
|
||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||
public MusicGenresItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/MusicGenres/{MusicGenres%2Did}{?userId*}", rawUrl) {
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets a music genre, by name.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation token to use when cancelling requests</param>
|
||||
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
public async Task<BaseItemDto?> GetAsync(Action<RequestConfiguration<MusicGenresItemRequestBuilderGetQueryParameters>>? requestConfiguration = default, CancellationToken cancellationToken = default) {
|
||||
#nullable restore
|
||||
#else
|
||||
public async Task<BaseItemDto> GetAsync(Action<RequestConfiguration<MusicGenresItemRequestBuilderGetQueryParameters>> requestConfiguration = default, CancellationToken cancellationToken = default) {
|
||||
#endif
|
||||
var requestInfo = ToGetRequestInformation(requestConfiguration);
|
||||
return await RequestAdapter.SendAsync<BaseItemDto>(requestInfo, BaseItemDto.CreateFromDiscriminatorValue, default, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets a music genre, by name.
|
||||
/// </summary>
|
||||
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<MusicGenresItemRequestBuilderGetQueryParameters>>? requestConfiguration = default) {
|
||||
#nullable restore
|
||||
#else
|
||||
public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<MusicGenresItemRequestBuilderGetQueryParameters>> requestConfiguration = default) {
|
||||
#endif
|
||||
var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters);
|
||||
requestInfo.Configure(requestConfiguration);
|
||||
requestInfo.Headers.TryAdd("Accept", "application/json, application/json;profile=\"CamelCase\", application/json;profile=\"PascalCase\"");
|
||||
return requestInfo;
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored.
|
||||
/// </summary>
|
||||
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
|
||||
public MusicGenresItemRequestBuilder WithUrl(string rawUrl) {
|
||||
return new MusicGenresItemRequestBuilder(rawUrl, RequestAdapter);
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets a music genre, by name.
|
||||
/// </summary>
|
||||
public class MusicGenresItemRequestBuilderGetQueryParameters {
|
||||
/// <summary>Optional. Filter by user id, and attach user data.</summary>
|
||||
[QueryParameter("userId")]
|
||||
public Guid? UserId { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
// <auto-generated/>
|
||||
using Jellyfin.Sdk.Generated.Playlists.Item.InstantMix;
|
||||
using Jellyfin.Sdk.Generated.Playlists.Item.Items;
|
||||
using Microsoft.Kiota.Abstractions;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
namespace Jellyfin.Sdk.Generated.Playlists.Item {
|
||||
/// <summary>
|
||||
/// Builds and executes requests for operations under \Playlists\{Playlists-id}
|
||||
/// </summary>
|
||||
public class PlaylistsItemRequestBuilder : BaseRequestBuilder {
|
||||
/// <summary>The InstantMix property</summary>
|
||||
public InstantMixRequestBuilder InstantMix { get =>
|
||||
new InstantMixRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The Items property</summary>
|
||||
public ItemsRequestBuilder Items { get =>
|
||||
new ItemsRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>
|
||||
/// Instantiates a new PlaylistsItemRequestBuilder and sets the default values.
|
||||
/// </summary>
|
||||
/// <param name="pathParameters">Path parameters for the request</param>
|
||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||
public PlaylistsItemRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/Playlists/{Playlists%2Did}", pathParameters) {
|
||||
}
|
||||
/// <summary>
|
||||
/// Instantiates a new PlaylistsItemRequestBuilder and sets the default values.
|
||||
/// </summary>
|
||||
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
|
||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||
public PlaylistsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/Playlists/{Playlists%2Did}", rawUrl) {
|
||||
}
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
// <auto-generated/>
|
||||
using Jellyfin.Sdk.Generated.Shows.Item.Episodes;
|
||||
using Jellyfin.Sdk.Generated.Shows.Item.Seasons;
|
||||
using Jellyfin.Sdk.Generated.Shows.Item.Similar;
|
||||
using Microsoft.Kiota.Abstractions;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
namespace Jellyfin.Sdk.Generated.Shows.Item {
|
||||
/// <summary>
|
||||
/// Builds and executes requests for operations under \Shows\{Shows-id}
|
||||
/// </summary>
|
||||
public class ShowsItemRequestBuilder : BaseRequestBuilder {
|
||||
/// <summary>The Episodes property</summary>
|
||||
public EpisodesRequestBuilder Episodes { get =>
|
||||
new EpisodesRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The Seasons property</summary>
|
||||
public SeasonsRequestBuilder Seasons { get =>
|
||||
new SeasonsRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The Similar property</summary>
|
||||
public SimilarRequestBuilder Similar { get =>
|
||||
new SimilarRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>
|
||||
/// Instantiates a new ShowsItemRequestBuilder and sets the default values.
|
||||
/// </summary>
|
||||
/// <param name="pathParameters">Path parameters for the request</param>
|
||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||
public ShowsItemRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/Shows/{Shows%2Did}", pathParameters) {
|
||||
}
|
||||
/// <summary>
|
||||
/// Instantiates a new ShowsItemRequestBuilder and sets the default values.
|
||||
/// </summary>
|
||||
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
|
||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||
public ShowsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/Shows/{Shows%2Did}", rawUrl) {
|
||||
}
|
||||
}
|
||||
}
|
@ -1,343 +0,0 @@
|
||||
// <auto-generated/>
|
||||
using Jellyfin.Sdk.Generated.Models;
|
||||
using Microsoft.Kiota.Abstractions.Serialization;
|
||||
using Microsoft.Kiota.Abstractions;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using System;
|
||||
namespace Jellyfin.Sdk.Generated.Users.Item.Images.Item.Item {
|
||||
/// <summary>
|
||||
/// Builds and executes requests for operations under \Users\{userId}\Images\{imageType}\{ImageType-id}
|
||||
/// </summary>
|
||||
public class ImageTypeItemRequestBuilder : BaseRequestBuilder {
|
||||
/// <summary>
|
||||
/// Instantiates a new ImageTypeItemRequestBuilder and sets the default values.
|
||||
/// </summary>
|
||||
/// <param name="pathParameters">Path parameters for the request</param>
|
||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||
public ImageTypeItemRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/Users/{userId}/Images/{imageType}/{ImageType%2Did}{?addPlayedIndicator*,backgroundColor*,blur*,cropWhitespace*,fillHeight*,fillWidth*,foregroundLayer*,format*,height*,maxHeight*,maxWidth*,percentPlayed*,quality*,tag*,unplayedCount*,width*}", pathParameters) {
|
||||
}
|
||||
/// <summary>
|
||||
/// Instantiates a new ImageTypeItemRequestBuilder and sets the default values.
|
||||
/// </summary>
|
||||
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
|
||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||
public ImageTypeItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/Users/{userId}/Images/{imageType}/{ImageType%2Did}{?addPlayedIndicator*,backgroundColor*,blur*,cropWhitespace*,fillHeight*,fillWidth*,foregroundLayer*,format*,height*,maxHeight*,maxWidth*,percentPlayed*,quality*,tag*,unplayedCount*,width*}", rawUrl) {
|
||||
}
|
||||
/// <summary>
|
||||
/// Delete the user's image.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation token to use when cancelling requests</param>
|
||||
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
public async Task DeleteAsync(Action<RequestConfiguration<DefaultQueryParameters>>? requestConfiguration = default, CancellationToken cancellationToken = default) {
|
||||
#nullable restore
|
||||
#else
|
||||
public async Task DeleteAsync(Action<RequestConfiguration<DefaultQueryParameters>> requestConfiguration = default, CancellationToken cancellationToken = default) {
|
||||
#endif
|
||||
var requestInfo = ToDeleteRequestInformation(requestConfiguration);
|
||||
var errorMapping = new Dictionary<string, ParsableFactory<IParsable>> {
|
||||
{"403", ProblemDetails.CreateFromDiscriminatorValue},
|
||||
};
|
||||
await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
/// <summary>
|
||||
/// Get user profile image.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation token to use when cancelling requests</param>
|
||||
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
public async Task<Stream?> GetAsync(Action<RequestConfiguration<ImageTypeItemRequestBuilderGetQueryParameters>>? requestConfiguration = default, CancellationToken cancellationToken = default) {
|
||||
#nullable restore
|
||||
#else
|
||||
public async Task<Stream> GetAsync(Action<RequestConfiguration<ImageTypeItemRequestBuilderGetQueryParameters>> requestConfiguration = default, CancellationToken cancellationToken = default) {
|
||||
#endif
|
||||
var requestInfo = ToGetRequestInformation(requestConfiguration);
|
||||
var errorMapping = new Dictionary<string, ParsableFactory<IParsable>> {
|
||||
{"404", ProblemDetails.CreateFromDiscriminatorValue},
|
||||
};
|
||||
return await RequestAdapter.SendPrimitiveAsync<Stream>(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
/// <summary>
|
||||
/// Get user profile image.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation token to use when cancelling requests</param>
|
||||
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
public async Task<Stream?> HeadAsync(Action<RequestConfiguration<ImageTypeItemRequestBuilderHeadQueryParameters>>? requestConfiguration = default, CancellationToken cancellationToken = default) {
|
||||
#nullable restore
|
||||
#else
|
||||
public async Task<Stream> HeadAsync(Action<RequestConfiguration<ImageTypeItemRequestBuilderHeadQueryParameters>> requestConfiguration = default, CancellationToken cancellationToken = default) {
|
||||
#endif
|
||||
var requestInfo = ToHeadRequestInformation(requestConfiguration);
|
||||
var errorMapping = new Dictionary<string, ParsableFactory<IParsable>> {
|
||||
{"404", ProblemDetails.CreateFromDiscriminatorValue},
|
||||
};
|
||||
return await RequestAdapter.SendPrimitiveAsync<Stream>(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets the user image.
|
||||
/// </summary>
|
||||
/// <param name="body">Binary request body</param>
|
||||
/// <param name="cancellationToken">Cancellation token to use when cancelling requests</param>
|
||||
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
public async Task PostAsync(Stream body, Action<RequestConfiguration<DefaultQueryParameters>>? requestConfiguration = default, CancellationToken cancellationToken = default) {
|
||||
#nullable restore
|
||||
#else
|
||||
public async Task PostAsync(Stream body, Action<RequestConfiguration<DefaultQueryParameters>> requestConfiguration = default, CancellationToken cancellationToken = default) {
|
||||
#endif
|
||||
_ = body ?? throw new ArgumentNullException(nameof(body));
|
||||
var requestInfo = ToPostRequestInformation(body, requestConfiguration);
|
||||
var errorMapping = new Dictionary<string, ParsableFactory<IParsable>> {
|
||||
{"403", ProblemDetails.CreateFromDiscriminatorValue},
|
||||
};
|
||||
await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
/// <summary>
|
||||
/// Delete the user's image.
|
||||
/// </summary>
|
||||
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
public RequestInformation ToDeleteRequestInformation(Action<RequestConfiguration<DefaultQueryParameters>>? requestConfiguration = default) {
|
||||
#nullable restore
|
||||
#else
|
||||
public RequestInformation ToDeleteRequestInformation(Action<RequestConfiguration<DefaultQueryParameters>> requestConfiguration = default) {
|
||||
#endif
|
||||
var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters);
|
||||
requestInfo.Configure(requestConfiguration);
|
||||
requestInfo.Headers.TryAdd("Accept", "application/json, application/json;profile=\"CamelCase\", application/json;profile=\"PascalCase\"");
|
||||
return requestInfo;
|
||||
}
|
||||
/// <summary>
|
||||
/// Get user profile image.
|
||||
/// </summary>
|
||||
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<ImageTypeItemRequestBuilderGetQueryParameters>>? requestConfiguration = default) {
|
||||
#nullable restore
|
||||
#else
|
||||
public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<ImageTypeItemRequestBuilderGetQueryParameters>> requestConfiguration = default) {
|
||||
#endif
|
||||
var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters);
|
||||
requestInfo.Configure(requestConfiguration);
|
||||
requestInfo.Headers.TryAdd("Accept", "image/*, application/json, application/json;profile=\"CamelCase\", application/json;profile=\"PascalCase\"");
|
||||
return requestInfo;
|
||||
}
|
||||
/// <summary>
|
||||
/// Get user profile image.
|
||||
/// </summary>
|
||||
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
public RequestInformation ToHeadRequestInformation(Action<RequestConfiguration<ImageTypeItemRequestBuilderHeadQueryParameters>>? requestConfiguration = default) {
|
||||
#nullable restore
|
||||
#else
|
||||
public RequestInformation ToHeadRequestInformation(Action<RequestConfiguration<ImageTypeItemRequestBuilderHeadQueryParameters>> requestConfiguration = default) {
|
||||
#endif
|
||||
var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters);
|
||||
requestInfo.Configure(requestConfiguration);
|
||||
requestInfo.Headers.TryAdd("Accept", "image/*, application/json, application/json;profile=\"CamelCase\", application/json;profile=\"PascalCase\"");
|
||||
return requestInfo;
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets the user image.
|
||||
/// </summary>
|
||||
/// <param name="body">Binary request body</param>
|
||||
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
public RequestInformation ToPostRequestInformation(Stream body, Action<RequestConfiguration<DefaultQueryParameters>>? requestConfiguration = default) {
|
||||
#nullable restore
|
||||
#else
|
||||
public RequestInformation ToPostRequestInformation(Stream body, Action<RequestConfiguration<DefaultQueryParameters>> requestConfiguration = default) {
|
||||
#endif
|
||||
_ = body ?? throw new ArgumentNullException(nameof(body));
|
||||
var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters);
|
||||
requestInfo.Configure(requestConfiguration);
|
||||
requestInfo.Headers.TryAdd("Accept", "application/json, application/json;profile=\"CamelCase\", application/json;profile=\"PascalCase\"");
|
||||
requestInfo.SetStreamContent(body, "image/*");
|
||||
return requestInfo;
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored.
|
||||
/// </summary>
|
||||
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
|
||||
public ImageTypeItemRequestBuilder WithUrl(string rawUrl) {
|
||||
return new ImageTypeItemRequestBuilder(rawUrl, RequestAdapter);
|
||||
}
|
||||
/// <summary>
|
||||
/// Get user profile image.
|
||||
/// </summary>
|
||||
public class ImageTypeItemRequestBuilderGetQueryParameters {
|
||||
/// <summary>Optional. Add a played indicator.</summary>
|
||||
[QueryParameter("addPlayedIndicator")]
|
||||
public bool? AddPlayedIndicator { get; set; }
|
||||
/// <summary>Optional. Apply a background color for transparent images.</summary>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
[QueryParameter("backgroundColor")]
|
||||
public string? BackgroundColor { get; set; }
|
||||
#nullable restore
|
||||
#else
|
||||
[QueryParameter("backgroundColor")]
|
||||
public string BackgroundColor { get; set; }
|
||||
#endif
|
||||
/// <summary>Optional. Blur image.</summary>
|
||||
[QueryParameter("blur")]
|
||||
public int? Blur { get; set; }
|
||||
/// <summary>Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art.</summary>
|
||||
[Obsolete("")]
|
||||
[QueryParameter("cropWhitespace")]
|
||||
public bool? CropWhitespace { get; set; }
|
||||
/// <summary>Height of box to fill.</summary>
|
||||
[QueryParameter("fillHeight")]
|
||||
public int? FillHeight { get; set; }
|
||||
/// <summary>Width of box to fill.</summary>
|
||||
[QueryParameter("fillWidth")]
|
||||
public int? FillWidth { get; set; }
|
||||
/// <summary>Optional. Apply a foreground layer on top of the image.</summary>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
[QueryParameter("foregroundLayer")]
|
||||
public string? ForegroundLayer { get; set; }
|
||||
#nullable restore
|
||||
#else
|
||||
[QueryParameter("foregroundLayer")]
|
||||
public string ForegroundLayer { get; set; }
|
||||
#endif
|
||||
/// <summary>Determines the output format of the image - original,gif,jpg,png.</summary>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
[QueryParameter("format")]
|
||||
public string? Format { get; set; }
|
||||
#nullable restore
|
||||
#else
|
||||
[QueryParameter("format")]
|
||||
public string Format { get; set; }
|
||||
#endif
|
||||
/// <summary>The fixed image height to return.</summary>
|
||||
[QueryParameter("height")]
|
||||
public int? Height { get; set; }
|
||||
/// <summary>The maximum image height to return.</summary>
|
||||
[QueryParameter("maxHeight")]
|
||||
public int? MaxHeight { get; set; }
|
||||
/// <summary>The maximum image width to return.</summary>
|
||||
[QueryParameter("maxWidth")]
|
||||
public int? MaxWidth { get; set; }
|
||||
/// <summary>Optional. Percent to render for the percent played overlay.</summary>
|
||||
[QueryParameter("percentPlayed")]
|
||||
public double? PercentPlayed { get; set; }
|
||||
/// <summary>Optional. Quality setting, from 0-100. Defaults to 90 and should suffice in most cases.</summary>
|
||||
[QueryParameter("quality")]
|
||||
public int? Quality { get; set; }
|
||||
/// <summary>Optional. Supply the cache tag from the item object to receive strong caching headers.</summary>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
[QueryParameter("tag")]
|
||||
public string? Tag { get; set; }
|
||||
#nullable restore
|
||||
#else
|
||||
[QueryParameter("tag")]
|
||||
public string Tag { get; set; }
|
||||
#endif
|
||||
/// <summary>Optional. Unplayed count overlay to render.</summary>
|
||||
[QueryParameter("unplayedCount")]
|
||||
public int? UnplayedCount { get; set; }
|
||||
/// <summary>The fixed image width to return.</summary>
|
||||
[QueryParameter("width")]
|
||||
public int? Width { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get user profile image.
|
||||
/// </summary>
|
||||
public class ImageTypeItemRequestBuilderHeadQueryParameters {
|
||||
/// <summary>Optional. Add a played indicator.</summary>
|
||||
[QueryParameter("addPlayedIndicator")]
|
||||
public bool? AddPlayedIndicator { get; set; }
|
||||
/// <summary>Optional. Apply a background color for transparent images.</summary>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
[QueryParameter("backgroundColor")]
|
||||
public string? BackgroundColor { get; set; }
|
||||
#nullable restore
|
||||
#else
|
||||
[QueryParameter("backgroundColor")]
|
||||
public string BackgroundColor { get; set; }
|
||||
#endif
|
||||
/// <summary>Optional. Blur image.</summary>
|
||||
[QueryParameter("blur")]
|
||||
public int? Blur { get; set; }
|
||||
/// <summary>Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art.</summary>
|
||||
[Obsolete("")]
|
||||
[QueryParameter("cropWhitespace")]
|
||||
public bool? CropWhitespace { get; set; }
|
||||
/// <summary>Height of box to fill.</summary>
|
||||
[QueryParameter("fillHeight")]
|
||||
public int? FillHeight { get; set; }
|
||||
/// <summary>Width of box to fill.</summary>
|
||||
[QueryParameter("fillWidth")]
|
||||
public int? FillWidth { get; set; }
|
||||
/// <summary>Optional. Apply a foreground layer on top of the image.</summary>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
[QueryParameter("foregroundLayer")]
|
||||
public string? ForegroundLayer { get; set; }
|
||||
#nullable restore
|
||||
#else
|
||||
[QueryParameter("foregroundLayer")]
|
||||
public string ForegroundLayer { get; set; }
|
||||
#endif
|
||||
/// <summary>Determines the output format of the image - original,gif,jpg,png.</summary>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
[QueryParameter("format")]
|
||||
public string? Format { get; set; }
|
||||
#nullable restore
|
||||
#else
|
||||
[QueryParameter("format")]
|
||||
public string Format { get; set; }
|
||||
#endif
|
||||
/// <summary>The fixed image height to return.</summary>
|
||||
[QueryParameter("height")]
|
||||
public int? Height { get; set; }
|
||||
/// <summary>The maximum image height to return.</summary>
|
||||
[QueryParameter("maxHeight")]
|
||||
public int? MaxHeight { get; set; }
|
||||
/// <summary>The maximum image width to return.</summary>
|
||||
[QueryParameter("maxWidth")]
|
||||
public int? MaxWidth { get; set; }
|
||||
/// <summary>Optional. Percent to render for the percent played overlay.</summary>
|
||||
[QueryParameter("percentPlayed")]
|
||||
public double? PercentPlayed { get; set; }
|
||||
/// <summary>Optional. Quality setting, from 0-100. Defaults to 90 and should suffice in most cases.</summary>
|
||||
[QueryParameter("quality")]
|
||||
public int? Quality { get; set; }
|
||||
/// <summary>Optional. Supply the cache tag from the item object to receive strong caching headers.</summary>
|
||||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
|
||||
#nullable enable
|
||||
[QueryParameter("tag")]
|
||||
public string? Tag { get; set; }
|
||||
#nullable restore
|
||||
#else
|
||||
[QueryParameter("tag")]
|
||||
public string Tag { get; set; }
|
||||
#endif
|
||||
/// <summary>Optional. Unplayed count overlay to render.</summary>
|
||||
[QueryParameter("unplayedCount")]
|
||||
public int? UnplayedCount { get; set; }
|
||||
/// <summary>The fixed image width to return.</summary>
|
||||
[QueryParameter("width")]
|
||||
public int? Width { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
// <auto-generated/>
|
||||
using Jellyfin.Sdk.Generated.Videos.Item.Item.Attachments;
|
||||
using Jellyfin.Sdk.Generated.Videos.Item.Item.Subtitles;
|
||||
using Microsoft.Kiota.Abstractions;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
namespace Jellyfin.Sdk.Generated.Videos.Item.Item {
|
||||
/// <summary>
|
||||
/// Builds and executes requests for operations under \Videos\{Videos-id}\{ItemId-id}
|
||||
/// </summary>
|
||||
public class ItemIdItemRequestBuilder : BaseRequestBuilder {
|
||||
/// <summary>The Attachments property</summary>
|
||||
public AttachmentsRequestBuilder Attachments { get =>
|
||||
new AttachmentsRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The Subtitles property</summary>
|
||||
public SubtitlesRequestBuilder Subtitles { get =>
|
||||
new SubtitlesRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>
|
||||
/// Instantiates a new ItemIdItemRequestBuilder and sets the default values.
|
||||
/// </summary>
|
||||
/// <param name="pathParameters">Path parameters for the request</param>
|
||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||
public ItemIdItemRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/Videos/{Videos%2Did}/{ItemId%2Did}", pathParameters) {
|
||||
}
|
||||
/// <summary>
|
||||
/// Instantiates a new ItemIdItemRequestBuilder and sets the default values.
|
||||
/// </summary>
|
||||
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
|
||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||
public ItemIdItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/Videos/{Videos%2Did}/{ItemId%2Did}", rawUrl) {
|
||||
}
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
// <auto-generated/>
|
||||
using Jellyfin.Sdk.Generated.Videos.Item.Item.Subtitles.Item.Item;
|
||||
using Jellyfin.Sdk.Generated.Videos.Item.Item.Subtitles.Item.StreamWithRouteFormat;
|
||||
using Jellyfin.Sdk.Generated.Videos.Item.Item.Subtitles.Item.SubtitlesM3u8;
|
||||
using Microsoft.Kiota.Abstractions;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
namespace Jellyfin.Sdk.Generated.Videos.Item.Item.Subtitles.Item {
|
||||
/// <summary>
|
||||
/// Builds and executes requests for operations under \Videos\{Videos-id}\{ItemId-id}\Subtitles\{Subtitles-id}
|
||||
/// </summary>
|
||||
public class SubtitlesItemRequestBuilder : BaseRequestBuilder {
|
||||
/// <summary>The subtitlesM3u8 property</summary>
|
||||
public SubtitlesM3u8RequestBuilder SubtitlesM3u8 { get =>
|
||||
new SubtitlesM3u8RequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>Gets an item from the Jellyfin.Sdk.Generated.Videos.item.item.Subtitles.item.item collection</summary>
|
||||
/// <param name="position">The (route) start position of the subtitle in ticks.</param>
|
||||
public WithRouteStartPositionTicksItemRequestBuilder this[long position] { get {
|
||||
var urlTplParams = new Dictionary<string, object>(PathParameters);
|
||||
urlTplParams.Add("routeStartPositionTicks", position);
|
||||
return new WithRouteStartPositionTicksItemRequestBuilder(urlTplParams, RequestAdapter);
|
||||
} }
|
||||
/// <summary>
|
||||
/// Instantiates a new SubtitlesItemRequestBuilder and sets the default values.
|
||||
/// </summary>
|
||||
/// <param name="pathParameters">Path parameters for the request</param>
|
||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||
public SubtitlesItemRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/Videos/{Videos%2Did}/{ItemId%2Did}/Subtitles/{Subtitles%2Did}", pathParameters) {
|
||||
}
|
||||
/// <summary>
|
||||
/// Instantiates a new SubtitlesItemRequestBuilder and sets the default values.
|
||||
/// </summary>
|
||||
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
|
||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||
public SubtitlesItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/Videos/{Videos%2Did}/{ItemId%2Did}/Subtitles/{Subtitles%2Did}", rawUrl) {
|
||||
}
|
||||
/// <summary>
|
||||
/// Builds and executes requests for operations under \Videos\{routeItemId}\{routeMediaSourceId}\Subtitles\{Subtitles-id}\Stream.{routeFormat}
|
||||
/// </summary>
|
||||
/// <param name="routeFormat">The (route) format of the returned subtitle.</param>
|
||||
public StreamWithRouteFormatRequestBuilder StreamWithRouteFormat(string routeFormat) {
|
||||
if(string.IsNullOrEmpty(routeFormat)) throw new ArgumentNullException(nameof(routeFormat));
|
||||
return new StreamWithRouteFormatRequestBuilder(PathParameters, RequestAdapter, routeFormat);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
// <auto-generated/>
|
||||
using Jellyfin.Sdk.Generated.Videos.Item.AdditionalParts;
|
||||
using Jellyfin.Sdk.Generated.Videos.Item.AlternateSources;
|
||||
using Jellyfin.Sdk.Generated.Videos.Item.Hls1;
|
||||
using Jellyfin.Sdk.Generated.Videos.Item.Hls;
|
||||
using Jellyfin.Sdk.Generated.Videos.Item.Item;
|
||||
using Jellyfin.Sdk.Generated.Videos.Item.LiveM3u8;
|
||||
using Jellyfin.Sdk.Generated.Videos.Item.MainM3u8;
|
||||
using Jellyfin.Sdk.Generated.Videos.Item.MasterM3u8;
|
||||
using Jellyfin.Sdk.Generated.Videos.Item.StreamNamespace;
|
||||
using Jellyfin.Sdk.Generated.Videos.Item.StreamWithContainer;
|
||||
using Jellyfin.Sdk.Generated.Videos.Item.Subtitles;
|
||||
using Microsoft.Kiota.Abstractions;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
namespace Jellyfin.Sdk.Generated.Videos.Item {
|
||||
/// <summary>
|
||||
/// Builds and executes requests for operations under \Videos\{Videos-id}
|
||||
/// </summary>
|
||||
public class VideosItemRequestBuilder : BaseRequestBuilder {
|
||||
/// <summary>The AdditionalParts property</summary>
|
||||
public AdditionalPartsRequestBuilder AdditionalParts { get =>
|
||||
new AdditionalPartsRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The AlternateSources property</summary>
|
||||
public AlternateSourcesRequestBuilder AlternateSources { get =>
|
||||
new AlternateSourcesRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The hls property</summary>
|
||||
public HlsRequestBuilder Hls { get =>
|
||||
new HlsRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The hls1 property</summary>
|
||||
public Hls1RequestBuilder Hls1 { get =>
|
||||
new Hls1RequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The liveM3u8 property</summary>
|
||||
public LiveM3u8RequestBuilder LiveM3u8 { get =>
|
||||
new LiveM3u8RequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The mainM3u8 property</summary>
|
||||
public MainM3u8RequestBuilder MainM3u8 { get =>
|
||||
new MainM3u8RequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The masterM3u8 property</summary>
|
||||
public MasterM3u8RequestBuilder MasterM3u8 { get =>
|
||||
new MasterM3u8RequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The stream property</summary>
|
||||
public StreamRequestBuilder Stream { get =>
|
||||
new StreamRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>The Subtitles property</summary>
|
||||
public SubtitlesRequestBuilder Subtitles { get =>
|
||||
new SubtitlesRequestBuilder(PathParameters, RequestAdapter);
|
||||
}
|
||||
/// <summary>Gets an item from the Jellyfin.Sdk.Generated.Videos.item.item collection</summary>
|
||||
/// <param name="position">The media source id.</param>
|
||||
public ItemIdItemRequestBuilder this[string position] { get {
|
||||
var urlTplParams = new Dictionary<string, object>(PathParameters);
|
||||
urlTplParams.Add("ItemId%2Did", position);
|
||||
return new ItemIdItemRequestBuilder(urlTplParams, RequestAdapter);
|
||||
} }
|
||||
/// <summary>
|
||||
/// Instantiates a new VideosItemRequestBuilder and sets the default values.
|
||||
/// </summary>
|
||||
/// <param name="pathParameters">Path parameters for the request</param>
|
||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||
public VideosItemRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/Videos/{Videos%2Did}", pathParameters) {
|
||||
}
|
||||
/// <summary>
|
||||
/// Instantiates a new VideosItemRequestBuilder and sets the default values.
|
||||
/// </summary>
|
||||
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
|
||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||
public VideosItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/Videos/{Videos%2Did}", rawUrl) {
|
||||
}
|
||||
/// <summary>
|
||||
/// Builds and executes requests for operations under \Videos\{Videos-id}\stream.{container}
|
||||
/// </summary>
|
||||
/// <param name="container">The video container. Possible values are: ts, webm, asf, wmv, ogv, mp4, m4v, mkv, mpeg, mpg, avi, 3gp, wmv, wtv, m2ts, mov, iso, flv.</param>
|
||||
public StreamWithContainerRequestBuilder StreamWithContainer(string container) {
|
||||
if(string.IsNullOrEmpty(container)) throw new ArgumentNullException(nameof(container));
|
||||
return new StreamWithContainerRequestBuilder(PathParameters, RequestAdapter, container);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"descriptionHash": "0C08DF5EAA8946C3608DAC6B0D25814D8DF038BB8BAE6B45D4C1E9850DA6E2B195AD158111100630460B3B7767191BAB088D0B69C8B61DAAA3511EFA9F84B9B2",
|
||||
"descriptionHash": "3F58114763F2F98A3960C2DD27E5804D784D2535E426484FA04F945EA064E23929A7A6B7B2BCD04EEE249A290D52A665C8372BE3869F877D3041DAEEDE48C295",
|
||||
"descriptionLocation": "https://repo.jellyfin.org/master/releases/openapi/jellyfin-openapi-stable.json",
|
||||
"lockFileVersion": "1.0.0",
|
||||
"kiotaVersion": "1.11.1",
|
||||
"kiotaVersion": "1.12.0-preview.202402290001",
|
||||
"clientClassName": "BaseJellyfinApiClient",
|
||||
"clientNamespaceName": "Jellyfin.Sdk.Generated",
|
||||
"language": "CSharp",
|
||||
@ -16,7 +16,7 @@
|
||||
"Microsoft.Kiota.Serialization.Multipart.MultipartSerializationWriterFactory"
|
||||
],
|
||||
"deserializers": [
|
||||
"Jellyfin.Sdk.Internal.JellyfinParseNodeFactory",
|
||||
"Microsoft.Kiota.Serialization.Text.JsonParseNodeFactory",
|
||||
"Microsoft.Kiota.Serialization.Text.TextParseNodeFactory",
|
||||
"Microsoft.Kiota.Serialization.Form.FormParseNodeFactory"
|
||||
],
|
||||
|
@ -1,398 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Text.Json;
|
||||
using Microsoft.Kiota.Abstractions;
|
||||
using Microsoft.Kiota.Abstractions.Extensions;
|
||||
using Microsoft.Kiota.Abstractions.Serialization;
|
||||
using Microsoft.Kiota.Serialization.Json;
|
||||
|
||||
#if NET5_0_OR_GREATER
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endif
|
||||
|
||||
namespace Jellyfin.Sdk.Internal;
|
||||
|
||||
/// <summary>
|
||||
/// Json node parser with specific property overrides.
|
||||
/// </summary>
|
||||
internal sealed class JellyfinJsonParseNode : IParseNode
|
||||
{
|
||||
private static readonly Type _booleanType = typeof(bool?);
|
||||
private static readonly Type _byteType = typeof(byte?);
|
||||
private static readonly Type _sbyteType = typeof(sbyte?);
|
||||
private static readonly Type _stringType = typeof(string);
|
||||
private static readonly Type _intType = typeof(int?);
|
||||
private static readonly Type _floatType = typeof(float?);
|
||||
private static readonly Type _longType = typeof(long?);
|
||||
private static readonly Type _doubleType = typeof(double?);
|
||||
private static readonly Type _guidType = typeof(Guid?);
|
||||
private static readonly Type _dateTimeOffsetType = typeof(DateTimeOffset?);
|
||||
private static readonly Type _timeSpanType = typeof(TimeSpan?);
|
||||
private static readonly Type _dateType = typeof(Date?);
|
||||
private static readonly Type _timeType = typeof(Time?);
|
||||
|
||||
private readonly JsonParseNode _jsonParseNode;
|
||||
private readonly JsonElement _jsonNode;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="JellyfinJsonParseNode"/> class.
|
||||
/// </summary>
|
||||
/// <param name="node">The JsonElement to parse.</param>
|
||||
public JellyfinJsonParseNode(JsonElement node)
|
||||
{
|
||||
_jsonParseNode = new JsonParseNode(node);
|
||||
_jsonNode = node;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Action<IParsable>? OnBeforeAssignFieldValues
|
||||
{
|
||||
get => _jsonParseNode.OnBeforeAssignFieldValues;
|
||||
set => _jsonParseNode.OnBeforeAssignFieldValues = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Action<IParsable>? OnAfterAssignFieldValues
|
||||
{
|
||||
get => _jsonParseNode.OnAfterAssignFieldValues;
|
||||
set => _jsonParseNode.OnBeforeAssignFieldValues = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Guid? GetGuidValue()
|
||||
=> Guid.TryParse(GetStringValue(), out var guid) ? guid : null;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string? GetStringValue()
|
||||
=> _jsonParseNode.GetStringValue();
|
||||
|
||||
/// <inheritdoc />
|
||||
public IParseNode? GetChildNode(string identifier)
|
||||
{
|
||||
if (_jsonNode.ValueKind == JsonValueKind.Object && _jsonNode.TryGetProperty(identifier ?? throw new ArgumentNullException(nameof(identifier)), out var jsonElement))
|
||||
{
|
||||
return new JellyfinJsonParseNode(jsonElement)
|
||||
{
|
||||
OnBeforeAssignFieldValues = OnBeforeAssignFieldValues,
|
||||
OnAfterAssignFieldValues = OnAfterAssignFieldValues
|
||||
};
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool? GetBoolValue()
|
||||
=> _jsonParseNode.GetBoolValue();
|
||||
|
||||
/// <inheritdoc />
|
||||
public byte? GetByteValue()
|
||||
=> _jsonParseNode.GetByteValue();
|
||||
|
||||
/// <inheritdoc />
|
||||
public sbyte? GetSbyteValue()
|
||||
=> _jsonParseNode.GetSbyteValue();
|
||||
|
||||
/// <inheritdoc />
|
||||
public int? GetIntValue()
|
||||
=> _jsonParseNode.GetIntValue();
|
||||
|
||||
/// <inheritdoc />
|
||||
public float? GetFloatValue()
|
||||
=> _jsonParseNode.GetFloatValue();
|
||||
|
||||
/// <inheritdoc />
|
||||
public long? GetLongValue()
|
||||
=> _jsonParseNode.GetLongValue();
|
||||
|
||||
/// <inheritdoc />
|
||||
public double? GetDoubleValue()
|
||||
=> _jsonParseNode.GetDoubleValue();
|
||||
|
||||
/// <inheritdoc />
|
||||
public decimal? GetDecimalValue()
|
||||
=> _jsonParseNode.GetDecimalValue();
|
||||
|
||||
/// <inheritdoc />
|
||||
public DateTimeOffset? GetDateTimeOffsetValue()
|
||||
=> _jsonParseNode.GetDateTimeOffsetValue();
|
||||
|
||||
/// <inheritdoc />
|
||||
public TimeSpan? GetTimeSpanValue()
|
||||
=> _jsonParseNode.GetTimeSpanValue();
|
||||
|
||||
/// <inheritdoc />
|
||||
public Date? GetDateValue()
|
||||
=> _jsonParseNode.GetDateValue();
|
||||
|
||||
/// <inheritdoc />
|
||||
public Time? GetTimeValue()
|
||||
=> _jsonParseNode.GetTimeValue();
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<T> GetCollectionOfPrimitiveValues<T>()
|
||||
{
|
||||
if (_jsonNode.ValueKind == JsonValueKind.Array)
|
||||
{
|
||||
var genericType = typeof(T);
|
||||
foreach (var collectionValue in _jsonNode.EnumerateArray())
|
||||
{
|
||||
var currentParseNode = new JellyfinJsonParseNode(collectionValue) { OnBeforeAssignFieldValues = OnBeforeAssignFieldValues, OnAfterAssignFieldValues = OnAfterAssignFieldValues };
|
||||
if (genericType == _booleanType)
|
||||
{
|
||||
yield return (T)(object)currentParseNode.GetBoolValue()!;
|
||||
}
|
||||
else if (genericType == _byteType)
|
||||
{
|
||||
yield return (T)(object)currentParseNode.GetByteValue()!;
|
||||
}
|
||||
else if (genericType == _sbyteType)
|
||||
{
|
||||
yield return (T)(object)currentParseNode.GetSbyteValue()!;
|
||||
}
|
||||
else if (genericType == _stringType)
|
||||
{
|
||||
yield return (T)(object)currentParseNode.GetStringValue()!;
|
||||
}
|
||||
else if (genericType == _intType)
|
||||
{
|
||||
yield return (T)(object)currentParseNode.GetIntValue()!;
|
||||
}
|
||||
else if (genericType == _floatType)
|
||||
{
|
||||
yield return (T)(object)currentParseNode.GetFloatValue()!;
|
||||
}
|
||||
else if (genericType == _longType)
|
||||
{
|
||||
yield return (T)(object)currentParseNode.GetLongValue()!;
|
||||
}
|
||||
else if (genericType == _doubleType)
|
||||
{
|
||||
yield return (T)(object)currentParseNode.GetDoubleValue()!;
|
||||
}
|
||||
else if (genericType == _guidType)
|
||||
{
|
||||
yield return (T)(object)currentParseNode.GetGuidValue()!;
|
||||
}
|
||||
else if (genericType == _dateTimeOffsetType)
|
||||
{
|
||||
yield return (T)(object)currentParseNode.GetDateTimeOffsetValue()!;
|
||||
}
|
||||
else if (genericType == _timeSpanType)
|
||||
{
|
||||
yield return (T)(object)currentParseNode.GetTimeSpanValue()!;
|
||||
}
|
||||
else if (genericType == _dateType)
|
||||
{
|
||||
yield return (T)(object)currentParseNode.GetDateValue()!;
|
||||
}
|
||||
else if (genericType == _timeType)
|
||||
{
|
||||
yield return (T)(object)currentParseNode.GetTimeValue()!;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException($"unknown type for deserialization {genericType.FullName}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
#if NET5_0_OR_GREATER
|
||||
public IEnumerable<T?> GetCollectionOfEnumValues<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>()
|
||||
where T : struct, Enum
|
||||
#else
|
||||
public IEnumerable<T?> GetCollectionOfEnumValues<T>()
|
||||
where T : struct, Enum
|
||||
#endif
|
||||
{
|
||||
if (_jsonNode.ValueKind == JsonValueKind.Array)
|
||||
{
|
||||
var enumerator = _jsonNode.EnumerateArray();
|
||||
while (enumerator.MoveNext())
|
||||
{
|
||||
var currentParseNode = new JellyfinJsonParseNode(enumerator.Current)
|
||||
{
|
||||
OnAfterAssignFieldValues = OnAfterAssignFieldValues,
|
||||
OnBeforeAssignFieldValues = OnBeforeAssignFieldValues
|
||||
};
|
||||
yield return currentParseNode.GetEnumValue<T>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<T> GetCollectionOfObjectValues<T>(ParsableFactory<T> factory)
|
||||
where T : IParsable
|
||||
{
|
||||
if (_jsonNode.ValueKind == JsonValueKind.Array)
|
||||
{
|
||||
var enumerator = _jsonNode.EnumerateArray();
|
||||
while (enumerator.MoveNext())
|
||||
{
|
||||
var currentParseNode = new JellyfinJsonParseNode(enumerator.Current)
|
||||
{
|
||||
OnAfterAssignFieldValues = OnAfterAssignFieldValues,
|
||||
OnBeforeAssignFieldValues = OnBeforeAssignFieldValues
|
||||
};
|
||||
|
||||
yield return currentParseNode.GetObjectValue(factory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
#if NET5_0_OR_GREATER
|
||||
public T? GetEnumValue<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>()
|
||||
where T : struct, Enum
|
||||
#else
|
||||
public T? GetEnumValue<T>()
|
||||
where T : struct, Enum
|
||||
#endif
|
||||
=> _jsonParseNode.GetEnumValue<T>();
|
||||
|
||||
/// <inheritdoc />
|
||||
public T GetObjectValue<T>(ParsableFactory<T> factory)
|
||||
where T : IParsable
|
||||
{
|
||||
var item = factory(this);
|
||||
OnBeforeAssignFieldValues?.Invoke(item);
|
||||
AssignFieldValues(item);
|
||||
OnAfterAssignFieldValues?.Invoke(item);
|
||||
return item;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public byte[]? GetByteArrayValue()
|
||||
=> _jsonParseNode.GetByteArrayValue();
|
||||
|
||||
private static object? TryGetAnything(JsonElement element)
|
||||
{
|
||||
switch (element.ValueKind)
|
||||
{
|
||||
case JsonValueKind.Number:
|
||||
if (element.TryGetDecimal(out var dec))
|
||||
{
|
||||
return dec;
|
||||
}
|
||||
|
||||
if (element.TryGetDouble(out var db))
|
||||
{
|
||||
return db;
|
||||
}
|
||||
|
||||
if (element.TryGetInt16(out var s))
|
||||
{
|
||||
return s;
|
||||
}
|
||||
|
||||
if (element.TryGetInt32(out var i))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
if (element.TryGetInt64(out var l))
|
||||
{
|
||||
return l;
|
||||
}
|
||||
|
||||
if (element.TryGetSingle(out var f))
|
||||
{
|
||||
return f;
|
||||
}
|
||||
|
||||
if (element.TryGetUInt16(out var us))
|
||||
{
|
||||
return us;
|
||||
}
|
||||
|
||||
if (element.TryGetUInt32(out var ui))
|
||||
{
|
||||
return ui;
|
||||
}
|
||||
|
||||
if (element.TryGetUInt64(out var ul))
|
||||
{
|
||||
return ul;
|
||||
}
|
||||
|
||||
throw new InvalidOperationException("unexpected additional value type during number deserialization");
|
||||
|
||||
case JsonValueKind.String:
|
||||
if (element.TryGetDateTime(out var dt))
|
||||
{
|
||||
return dt;
|
||||
}
|
||||
|
||||
if (element.TryGetDateTimeOffset(out var dto))
|
||||
{
|
||||
return dto;
|
||||
}
|
||||
|
||||
if (element.TryGetGuid(out var g))
|
||||
{
|
||||
return g;
|
||||
}
|
||||
|
||||
return element.GetString();
|
||||
|
||||
case JsonValueKind.Array:
|
||||
case JsonValueKind.Object:
|
||||
return element;
|
||||
case JsonValueKind.True:
|
||||
return true;
|
||||
case JsonValueKind.False:
|
||||
return false;
|
||||
case JsonValueKind.Null:
|
||||
case JsonValueKind.Undefined:
|
||||
return null;
|
||||
default:
|
||||
throw new InvalidOperationException($"unexpected additional value type during deserialization json kind : {element.ValueKind}");
|
||||
}
|
||||
}
|
||||
|
||||
private void AssignFieldValues<T>(T item)
|
||||
where T : IParsable
|
||||
{
|
||||
if (_jsonNode.ValueKind != JsonValueKind.Object)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IDictionary<string, object>? itemAdditionalData = null;
|
||||
if (item is IAdditionalDataHolder holder)
|
||||
{
|
||||
itemAdditionalData = holder.AdditionalData;
|
||||
}
|
||||
|
||||
var fieldDeserializers = item.GetFieldDeserializers();
|
||||
|
||||
foreach (var fieldValue in _jsonNode.EnumerateObject())
|
||||
{
|
||||
if (fieldDeserializers.TryGetValue(fieldValue.Name, out var fieldDeserializer))
|
||||
{
|
||||
if (fieldValue.Value.ValueKind == JsonValueKind.Null)
|
||||
{
|
||||
// If the property is already null just continue. As calling functions like GetDouble,GetBoolValue do not process JsonValueKind.Null.
|
||||
continue;
|
||||
}
|
||||
|
||||
fieldDeserializer.Invoke(new JellyfinJsonParseNode(fieldValue.Value)
|
||||
{
|
||||
OnBeforeAssignFieldValues = OnBeforeAssignFieldValues,
|
||||
OnAfterAssignFieldValues = OnAfterAssignFieldValues
|
||||
});
|
||||
}
|
||||
else if (itemAdditionalData != null)
|
||||
{
|
||||
IDictionaryExtensions.TryAdd(itemAdditionalData, fieldValue.Name, TryGetAnything(fieldValue.Value)!);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.WriteLine($"found additional property {fieldValue.Name} to deserialize but the model doesn't support additional data");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
using Microsoft.Kiota.Abstractions.Serialization;
|
||||
|
||||
namespace Jellyfin.Sdk.Internal;
|
||||
|
||||
/// <summary>
|
||||
/// Jellyfin parse node factory.
|
||||
/// </summary>
|
||||
internal sealed class JellyfinParseNodeFactory : IParseNodeFactory
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public string ValidContentType => "application/json";
|
||||
|
||||
/// <inheritdoc />
|
||||
public IParseNode GetRootParseNode(string contentType, Stream? content)
|
||||
{
|
||||
#if NET8_0_OR_GREATER
|
||||
ArgumentException.ThrowIfNullOrEmpty(contentType);
|
||||
ArgumentNullException.ThrowIfNull(content);
|
||||
#else
|
||||
if (string.IsNullOrEmpty(contentType))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(contentType));
|
||||
}
|
||||
|
||||
if (content is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(content));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!string.Equals(ValidContentType, contentType, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
throw new ArgumentOutOfRangeException($"expected a {ValidContentType} content type");
|
||||
}
|
||||
|
||||
using var jsonDocument = JsonDocument.Parse(content);
|
||||
return new JellyfinJsonParseNode(jsonDocument.RootElement.Clone());
|
||||
}
|
||||
}
|
28
src/Jellyfin.Sdk/Internal/JsonGuidConverter.cs
Normal file
28
src/Jellyfin.Sdk/Internal/JsonGuidConverter.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Jellyfin.Sdk.Internal;
|
||||
|
||||
/// <summary>
|
||||
/// Converts a GUID object or value to/from JSON.
|
||||
/// </summary>
|
||||
internal sealed class JsonGuidConverter : JsonConverter<Guid>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override Guid Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
=> reader.TokenType == JsonTokenType.Null
|
||||
? Guid.Empty
|
||||
: ReadInternal(ref reader);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Write(Utf8JsonWriter writer, Guid value, JsonSerializerOptions options)
|
||||
=> WriteInternal(writer, value);
|
||||
|
||||
internal static Guid ReadInternal(ref Utf8JsonReader reader)
|
||||
=> Guid.Parse(reader.GetString()!); // null got handled higher up the call stack
|
||||
|
||||
internal static void WriteInternal(Utf8JsonWriter writer, Guid value)
|
||||
=> writer.WriteStringValue(value.ToString("N", CultureInfo.InvariantCulture));
|
||||
}
|
30
src/Jellyfin.Sdk/Internal/JsonNullableGuidConverter.cs
Normal file
30
src/Jellyfin.Sdk/Internal/JsonNullableGuidConverter.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Jellyfin.Sdk.Internal;
|
||||
|
||||
/// <summary>
|
||||
/// Converts a GUID object or value to/from JSON.
|
||||
/// </summary>
|
||||
internal sealed class JsonNullableGuidConverter : JsonConverter<Guid?>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override Guid? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
=> JsonGuidConverter.ReadInternal(ref reader);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Write(Utf8JsonWriter writer, Guid? value, JsonSerializerOptions options)
|
||||
{
|
||||
// null got handled higher up the call stack
|
||||
var val = value!.Value;
|
||||
if (val.Equals(default))
|
||||
{
|
||||
writer.WriteNullValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
JsonGuidConverter.WriteInternal(writer, val);
|
||||
}
|
||||
}
|
||||
}
|
@ -29,12 +29,12 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Kiota.Abstractions" Version="1.7.10" />
|
||||
<PackageReference Include="Microsoft.Kiota.Abstractions" Version="1.7.11" />
|
||||
<PackageReference Include="Microsoft.Kiota.Http.HttpClientLibrary" Version="1.3.7" />
|
||||
<PackageReference Include="Microsoft.Kiota.Serialization.Form" Version="1.1.4" />
|
||||
<PackageReference Include="Microsoft.Kiota.Serialization.Json" Version="1.1.6" />
|
||||
<PackageReference Include="Microsoft.Kiota.Serialization.Form" Version="1.1.5" />
|
||||
<PackageReference Include="Microsoft.Kiota.Serialization.Json" Version="1.1.8" />
|
||||
<PackageReference Include="Microsoft.Kiota.Serialization.Multipart" Version="1.1.3" />
|
||||
<PackageReference Include="Microsoft.Kiota.Serialization.Text" Version="1.1.3" />
|
||||
<PackageReference Include="Microsoft.Kiota.Serialization.Text" Version="1.1.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Code Analyzers-->
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Jellyfin.Sdk.Generated;
|
||||
using Microsoft.Kiota.Abstractions;
|
||||
using Microsoft.Kiota.Abstractions.Extensions;
|
||||
|
||||
namespace Jellyfin.Sdk;
|
||||
|
||||
@ -21,6 +22,21 @@ public class JellyfinApiClient : BaseJellyfinApiClient, IDisposable
|
||||
_requestAdapter = requestAdapter;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Build the uri from the request information.
|
||||
/// </summary>
|
||||
/// <param name="requestInformation">The request information.</param>
|
||||
/// <returns>The built uri.</returns>
|
||||
public Uri BuildUri(RequestInformation requestInformation)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_requestAdapter.BaseUrl))
|
||||
{
|
||||
requestInformation.PathParameters.AddOrReplace("baseurl", _requestAdapter.BaseUrl!);
|
||||
}
|
||||
|
||||
return requestInformation.URI;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
|
@ -1,7 +1,9 @@
|
||||
using System.Net.Http;
|
||||
using System.Text.Json;
|
||||
using Jellyfin.Sdk.Internal;
|
||||
using Microsoft.Kiota.Abstractions.Authentication;
|
||||
using Microsoft.Kiota.Http.HttpClientLibrary;
|
||||
using Microsoft.Kiota.Serialization.Json;
|
||||
|
||||
namespace Jellyfin.Sdk;
|
||||
|
||||
@ -10,7 +12,16 @@ namespace Jellyfin.Sdk;
|
||||
/// </summary>
|
||||
public class JellyfinRequestAdapter : HttpClientRequestAdapter
|
||||
{
|
||||
private static readonly JellyfinParseNodeFactory _jellyfinParseNodeFactory = new();
|
||||
private static readonly JsonParseNodeFactory _jsonParseNodeFactory = new(
|
||||
new KiotaJsonSerializationContext(
|
||||
new JsonSerializerOptions(KiotaJsonSerializationContext.Default.Options)
|
||||
{
|
||||
Converters =
|
||||
{
|
||||
new JsonNullableGuidConverter(),
|
||||
new JsonGuidConverter()
|
||||
}
|
||||
}));
|
||||
|
||||
private readonly JellyfinSdkSettings _jellyfinSdkSettings;
|
||||
|
||||
@ -26,7 +37,7 @@ public class JellyfinRequestAdapter : HttpClientRequestAdapter
|
||||
HttpClient? httpClient = null)
|
||||
: base(
|
||||
authenticationProvider,
|
||||
parseNodeFactory: _jellyfinParseNodeFactory,
|
||||
parseNodeFactory: _jsonParseNodeFactory,
|
||||
httpClient: httpClient)
|
||||
{
|
||||
_jellyfinSdkSettings = jellyfinSdkSettings;
|
||||
|
Loading…
Reference in New Issue
Block a user