mirror of
https://github.com/LukeHagar/plexcsharp.git
synced 2025-12-06 12:37:46 +00:00
112 lines
3.9 KiB
C#
112 lines
3.9 KiB
C#
//------------------------------------------------------------------------------
|
|
// <auto-generated>
|
|
// This code was generated by Speakeasy (https://speakeasy.com). 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 LukeHagar.PlexAPI.SDK
|
|
{
|
|
using LukeHagar.PlexAPI.SDK.Hooks;
|
|
using LukeHagar.PlexAPI.SDK.Models.Components;
|
|
using LukeHagar.PlexAPI.SDK.Utils;
|
|
using LukeHagar.PlexAPI.SDK.Utils.Retries;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
public struct SDKConfig
|
|
{
|
|
/// <summary>
|
|
/// List of server URLs available to the SDK.
|
|
/// </summary>
|
|
public static readonly string[] ServerList = {
|
|
"https://{IP-description}.{identifier}.plex.direct:{port}",
|
|
"{protocol}://{host}:{port}",
|
|
"https://{full_server_url}",
|
|
};
|
|
|
|
public ISpeakeasyHttpClient Client;
|
|
public string ServerUrl;
|
|
public int ServerIndex;
|
|
public List<Dictionary<string, string>> ServerVariables;
|
|
public Accepts? Accepts;
|
|
public string? ClientIdentifier;
|
|
public string? Product;
|
|
public string? Version;
|
|
public string? Platform;
|
|
public string? PlatformVersion;
|
|
public string? Device;
|
|
public string? Model;
|
|
public string? DeviceVendor;
|
|
public string? DeviceName;
|
|
public string? Marketplace;
|
|
public string UserAgent;
|
|
public Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? SecuritySource;
|
|
public SDKHooks Hooks;
|
|
public RetryConfig? RetryConfig;
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the SDKConfig struct with default values.
|
|
/// </summary>
|
|
public SDKConfig(ISpeakeasyHttpClient? client = null)
|
|
{
|
|
Client = client ?? new SpeakeasyHttpClient();
|
|
ServerUrl = "";
|
|
ServerIndex = 0;
|
|
ServerVariables = new List<Dictionary<string, string>>()
|
|
{
|
|
new Dictionary<string, string>()
|
|
{
|
|
{"identifier", "0123456789abcdef0123456789abcdef"},
|
|
{"IP-description", "1-2-3-4"},
|
|
{"port", "32400"},
|
|
},
|
|
new Dictionary<string, string>()
|
|
{
|
|
{"protocol", "http"},
|
|
{"host", "localhost"},
|
|
{"port", "32400"},
|
|
},
|
|
new Dictionary<string, string>()
|
|
{
|
|
{"full_server_url", "http://localhost:32400"},
|
|
},
|
|
};
|
|
Accepts = null;
|
|
ClientIdentifier = null;
|
|
Product = null;
|
|
Version = null;
|
|
Platform = null;
|
|
PlatformVersion = null;
|
|
Device = null;
|
|
Model = null;
|
|
DeviceVendor = null;
|
|
DeviceName = null;
|
|
Marketplace = null;
|
|
UserAgent = "speakeasy-sdk/csharp 0.19.0 2.743.2 1.1.1 LukeHagar.PlexAPI.SDK";
|
|
SecuritySource = null;
|
|
Hooks = new SDKHooks();
|
|
RetryConfig = null;
|
|
}
|
|
|
|
public void SetServerVariable(string key, string value)
|
|
{
|
|
foreach (var serverVariables in this.ServerVariables.Where(dict => dict.ContainsKey(key)))
|
|
{
|
|
serverVariables[key] = value;
|
|
}
|
|
}
|
|
|
|
public string GetTemplatedServerUrl()
|
|
{
|
|
if (!String.IsNullOrEmpty(this.ServerUrl))
|
|
{
|
|
return Utilities.TemplateUrl(Utilities.RemoveSuffix(this.ServerUrl, "/"), new Dictionary<string, string>());
|
|
}
|
|
return Utilities.TemplateUrl(SDKConfig.ServerList[this.ServerIndex], this.ServerVariables[this.ServerIndex]);
|
|
}
|
|
}
|
|
} |