mirror of
https://github.com/LukeHagar/plexcsharp.git
synced 2025-12-06 04:20:46 +00:00
ci: regenerated with OpenAPI Doc 0.0.3, Speakeasy CLI 1.129.1
This commit is contained in:
170
PlexAPI/Hubs.cs
Normal file
170
PlexAPI/Hubs.cs
Normal file
@@ -0,0 +1,170 @@
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace PlexAPI
|
||||
{
|
||||
using Newtonsoft.Json;
|
||||
using PlexAPI.Models.Requests;
|
||||
using PlexAPI.Utils;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// Hubs are a structured two-dimensional container for media, generally represented by multiple horizontal rows.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public interface IHubs
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Get Global Hubs
|
||||
///
|
||||
/// <remarks>
|
||||
/// Get Global Hubs filtered by the parameters provided.
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<GetGlobalHubsResponse> GetGlobalHubsAsync(double? count = null, OnlyTransient? onlyTransient = null);
|
||||
|
||||
/// <summary>
|
||||
/// Get library specific hubs
|
||||
///
|
||||
/// <remarks>
|
||||
/// This endpoint will return a list of library specific hubs<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<GetLibraryHubsResponse> GetLibraryHubsAsync(double sectionId, double? count = null, QueryParamOnlyTransient? onlyTransient = null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hubs are a structured two-dimensional container for media, generally represented by multiple horizontal rows.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class Hubs: IHubs
|
||||
{
|
||||
public SDKConfig SDKConfiguration { get; private set; }
|
||||
private const string _language = "csharp";
|
||||
private const string _sdkVersion = "0.1.0";
|
||||
private const string _sdkGenVersion = "2.223.3";
|
||||
private const string _openapiDocVersion = "0.0.3";
|
||||
private const string _userAgent = "speakeasy-sdk/csharp 0.1.0 2.223.3 0.0.3 Plex-API";
|
||||
private string _serverUrl = "";
|
||||
private ISpeakeasyHttpClient _defaultClient;
|
||||
private ISpeakeasyHttpClient _securityClient;
|
||||
|
||||
public Hubs(ISpeakeasyHttpClient defaultClient, ISpeakeasyHttpClient securityClient, string serverUrl, SDKConfig config)
|
||||
{
|
||||
_defaultClient = defaultClient;
|
||||
_securityClient = securityClient;
|
||||
_serverUrl = serverUrl;
|
||||
SDKConfiguration = config;
|
||||
}
|
||||
|
||||
|
||||
public async Task<GetGlobalHubsResponse> GetGlobalHubsAsync(double? count = null, OnlyTransient? onlyTransient = null)
|
||||
{
|
||||
var request = new GetGlobalHubsRequest()
|
||||
{
|
||||
Count = count,
|
||||
OnlyTransient = onlyTransient,
|
||||
};
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerDetails();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/hubs", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
|
||||
httpRequest.Headers.Add("user-agent", _userAgent);
|
||||
|
||||
|
||||
var client = _securityClient;
|
||||
|
||||
var httpResponse = await client.SendAsync(httpRequest);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
|
||||
var response = new GetGlobalHubsResponse
|
||||
{
|
||||
StatusCode = (int)httpResponse.StatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
|
||||
if((response.StatusCode == 200) || (response.StatusCode == 400))
|
||||
{
|
||||
|
||||
return response;
|
||||
}
|
||||
if((response.StatusCode == 401))
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
|
||||
{
|
||||
response.Object = JsonConvert.DeserializeObject<GetGlobalHubsResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }});
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
public async Task<GetLibraryHubsResponse> GetLibraryHubsAsync(double sectionId, double? count = null, QueryParamOnlyTransient? onlyTransient = null)
|
||||
{
|
||||
var request = new GetLibraryHubsRequest()
|
||||
{
|
||||
SectionId = sectionId,
|
||||
Count = count,
|
||||
OnlyTransient = onlyTransient,
|
||||
};
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerDetails();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/hubs/sections/{sectionId}", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
|
||||
httpRequest.Headers.Add("user-agent", _userAgent);
|
||||
|
||||
|
||||
var client = _securityClient;
|
||||
|
||||
var httpResponse = await client.SendAsync(httpRequest);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
|
||||
var response = new GetLibraryHubsResponse
|
||||
{
|
||||
StatusCode = (int)httpResponse.StatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
|
||||
if((response.StatusCode == 200) || (response.StatusCode == 400))
|
||||
{
|
||||
|
||||
return response;
|
||||
}
|
||||
if((response.StatusCode == 401))
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
|
||||
{
|
||||
response.Object = JsonConvert.DeserializeObject<GetLibraryHubsResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }});
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user