using System.Net.Http;
using System.Text.Json.Serialization;
namespace Content.Server.Github.Requests;
///
/// Interface for all github api requests.
///
///
/// WARNING: You must add this JsonDerivedType for all requests that have json otherwise they will not parse properly!
///
[JsonPolymorphic(UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FailSerialization)]
[JsonDerivedType(typeof(CreateIssueRequest))]
[JsonDerivedType(typeof(InstallationsRequest))]
[JsonDerivedType(typeof(TokenRequest))]
public interface IGithubRequest
{
///
/// The kind of request method for the request.
///
[JsonIgnore]
public HttpMethod RequestMethod { get; }
///
/// There are different types of authentication methods depending on which endpoint you are working with.
/// E.g. the app api endpoint mostly uses JWTs, while stuff like issue creation uses Tokens
///
[JsonIgnore]
public GithubAuthMethod AuthenticationMethod { get; }
///
/// Location of the api endpoint for this request.
///
/// Owner of the repository.
/// The repository to make the request.
/// The api location for this request.
public string GetLocation(string owner, string repository);
}
public enum GithubAuthMethod
{
JWT,
Token,
}