//------------------------------------------------------------------------------
//
// 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.
//
//------------------------------------------------------------------------------
#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
{
///
/// List of server URLs available to the SDK.
///
public static readonly string[] ServerList = {
"{protocol}://{ip}:{port}",
};
public ISpeakeasyHttpClient Client;
public string ServerUrl;
public int ServerIndex;
public List> ServerVariables;
public string UserAgent;
public Func? SecuritySource;
public SDKHooks Hooks;
public RetryConfig? RetryConfig;
///
/// Initializes a new instance of the SDKConfig struct with default values.
///
public SDKConfig(ISpeakeasyHttpClient? client = null)
{
Client = client ?? new SpeakeasyHttpClient();
ServerUrl = "";
ServerIndex = 0;
ServerVariables = new List>()
{
new Dictionary()
{
{"protocol", "https"},
{"ip", "10.10.10.47"},
{"port", "32400"},
},
};
UserAgent = "speakeasy-sdk/csharp 0.16.1 2.674.3 0.0.3 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());
}
return Utilities.TemplateUrl(SDKConfig.ServerList[this.ServerIndex], this.ServerVariables[this.ServerIndex]);
}
}
}