This commit is contained in:
skidoodle 2024-03-13 00:33:46 +01:00
commit e124a47765
19374 changed files with 9806149 additions and 0 deletions

View file

@ -0,0 +1,31 @@
using System.Collections.Generic;
using Kreta.Client.FileService.Configuration;
using Kreta.Client.FileService.Constant;
namespace Kreta.Client.FileService.Extension
{
internal static class FileServiceClientConfigurationExtension
{
public static Dictionary<string, string> GetPublicTokenRequestParameters(this IFileServiceClientConfiguration fileServiceClientConfiguration)
{
return new Dictionary<string, string>
{
{ TokenRequest.GrantType, GrantType.ClientCredentials },
{ TokenRequest.ClientId, fileServiceClientConfiguration.PublicClientId },
{ TokenRequest.ClientSecret, fileServiceClientConfiguration.PublicClientSecret },
{ TokenRequest.Scope, Scope.Public },
};
}
public static Dictionary<string, string> GetPrivateTokenRequestParameters(this IFileServiceClientConfiguration fileServiceClientConfiguration)
{
return new Dictionary<string, string>
{
{ TokenRequest.GrantType, GrantType.ClientCredentials },
{ TokenRequest.ClientId, fileServiceClientConfiguration.PrivateClientId },
{ TokenRequest.ClientSecret, fileServiceClientConfiguration.PrivateClientSecret },
{ TokenRequest.Scope, Scope.Private },
};
}
}
}

View file

@ -0,0 +1,29 @@
using System.Collections.Generic;
using Kreta.Client.FileService.Constant;
using Kreta.Client.FileService.Request;
namespace Kreta.Client.FileService.Extension
{
internal static class GetUrlRequestExtension
{
public static Dictionary<string, string> GetUrlRequestParameters(this GetUrlRequest getUrlRequest)
{
return new Dictionary<string, string>
{
{ DownloadRequest.Konyvtar, getUrlRequest.Konyvtar },
{ DownloadRequest.FajlAzonosito, getUrlRequest.FajlAzonosito.ToString() },
{ DownloadRequest.Utvonal, getUrlRequest.Utvonal },
{ DownloadRequest.FajlNev, getUrlRequest.FajlNev }
};
}
public static Dictionary<string, string> GetUrlRequestParametersV3(this GetUrlRequest getUrlRequest)
{
return new Dictionary<string, string>
{
{ DownloadRequest.FajlId, getUrlRequest.FajlAzonosito.ToString() },
{ DownloadRequest.UtvonalV3, getUrlRequest.Utvonal }
};
}
}
}

View file

@ -0,0 +1,27 @@
using System.Collections.Generic;
namespace Kreta.Client.FileService.Extension
{
internal static class HeaderExtension
{
public static Dictionary<string, string> GetAuthorizationHeaderWithMulitpartFrom(this string token)
=> new Dictionary<string, string>
{
{ "Content-Type", "multipart/form-data" },
{ "Authorization", $"Bearer {token}" },
};
public static Dictionary<string, string> GetAuthorizationHeaderWithJson(this string token)
=> new Dictionary<string, string>
{
{ "Content-Type", "application/json" },
{ "Authorization", $"Bearer {token}" },
};
public static Dictionary<string, string> GetFormUrlEncodedHeader()
=> new Dictionary<string, string>
{
{ "Content-Type", "application/x-www-form-urlencoded" },
};
}
}