Patreon Access and Refresh Tokens should now be automatically updated

This commit is contained in:
Kwoth
2021-11-17 18:45:49 +00:00
parent d55ce7accc
commit 06c20c6fa4
14 changed files with 375 additions and 267 deletions

View File

@@ -1,23 +1,134 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace NadekoBot.Modules.Utility.Common.Patreon
{
public class PatreonData
public sealed class Attributes
{
public JObject[] Included { get; set; }
public JObject[] Data { get; set; }
public PatreonDataLinks Links { get; set; }
[JsonPropertyName("full_name")]
public string FullName { get; set; }
[JsonPropertyName("is_follower")]
public bool IsFollower { get; set; }
[JsonPropertyName("last_charge_date")]
public DateTime LastChargeDate { get; set; }
[JsonPropertyName("last_charge_status")]
public string LastChargeStatus { get; set; }
[JsonPropertyName("lifetime_support_cents")]
public int LifetimeSupportCents { get; set; }
[JsonPropertyName("currently_entitled_amount_cents")]
public int CurrentlyEntitledAmountCents { get; set; }
[JsonPropertyName("patron_status")]
public string PatronStatus { get; set; }
}
public class PatreonDataLinks
public sealed class Data
{
public string first { get; set; }
public string next { get; set; }
[JsonPropertyName("id")]
public string Id { get; set; }
[JsonPropertyName("type")]
public string Type { get; set; }
}
public class PatreonUserAndReward
public sealed class Address
{
public PatreonUser User { get; set; }
public PatreonPledge Reward { get; set; }
[JsonPropertyName("data")]
public Data Data { get; set; }
}
// public sealed class CurrentlyEntitledTiers
// {
// [JsonPropertyName("data")]
// public List<Datum> Data { get; set; }
// }
// public sealed class Relationships
// {
// [JsonPropertyName("address")]
// public Address Address { get; set; }
//
// // [JsonPropertyName("currently_entitled_tiers")]
// // public CurrentlyEntitledTiers CurrentlyEntitledTiers { get; set; }
// }
public sealed class PatreonResponse
{
[JsonPropertyName("data")]
public List<PatreonMember> Data { get; set; }
[JsonPropertyName("included")]
public List<PatreonUser> Included { get; set; }
[JsonPropertyName("links")]
public PatreonLinks Links { get; set; }
}
public sealed class PatreonLinks
{
[JsonPropertyName("next")]
public string Next { get; set; }
}
public sealed class PatreonUser
{
[JsonPropertyName("attributes")]
public PatreonUserAttributes Attributes { get; set; }
[JsonPropertyName("id")]
public string Id { get; set; }
// public string Type { get; set; }
}
public sealed class PatreonUserAttributes
{
[JsonPropertyName("social_connections")]
public PatreonSocials SocialConnections { get; set; }
}
public sealed class PatreonSocials
{
[JsonPropertyName("discord")]
public DiscordSocial Discord { get; set; }
}
public sealed class DiscordSocial
{
[JsonPropertyName("user_id")]
public string UserId { get; set; }
}
public sealed class PatreonMember
{
[JsonPropertyName("attributes")]
public Attributes Attributes { get; set; }
[JsonPropertyName("relationships")]
public Relationships Relationships { get; set; }
[JsonPropertyName("type")]
public string Type { get; set; }
}
public sealed class Relationships
{
[JsonPropertyName("user")]
public PatreonRelationshipUser User { get; set; }
}
public sealed class PatreonRelationshipUser
{
[JsonPropertyName("data")]
public PatreonUserData Data { get; set; }
}
public sealed class PatreonUserData
{
[JsonPropertyName("id")]
public string Id { get; set; }
}
}

View File

@@ -1,62 +0,0 @@
namespace NadekoBot.Modules.Utility.Common.Patreon
{
public class Attributes
{
public int amount_cents { get; set; }
public string created_at { get; set; }
public object declined_since { get; set; }
public bool is_twitch_pledge { get; set; }
public bool patron_pays_fees { get; set; }
public int? pledge_cap_cents { get; set; }
}
public class Address
{
public object data { get; set; }
}
public class Data
{
public string id { get; set; }
public string type { get; set; }
}
public class Links
{
public string related { get; set; }
}
public class Creator
{
public Data data { get; set; }
public Links links { get; set; }
}
public class Patron
{
public Data data { get; set; }
public Links links { get; set; }
}
public class Reward
{
public Data data { get; set; }
public Links links { get; set; }
}
public class Relationships
{
public Address address { get; set; }
public Creator creator { get; set; }
public Patron patron { get; set; }
public Reward reward { get; set; }
}
public class PatreonPledge
{
public Attributes attributes { get; set; }
public string id { get; set; }
public Relationships relationships { get; set; }
public string type { get; set; }
}
}

View File

@@ -1,64 +0,0 @@
namespace NadekoBot.Modules.Utility.Common.Patreon
{
public class DiscordConnection
{
public string user_id { get; set; }
}
public class SocialConnections
{
public object deviantart { get; set; }
public DiscordConnection discord { get; set; }
public object facebook { get; set; }
public object spotify { get; set; }
public object twitch { get; set; }
public object twitter { get; set; }
public object youtube { get; set; }
}
public class UserAttributes
{
public string about { get; set; }
public string created { get; set; }
public object discord_id { get; set; }
public string email { get; set; }
public object facebook { get; set; }
public object facebook_id { get; set; }
public string first_name { get; set; }
public string full_name { get; set; }
public int gender { get; set; }
public bool has_password { get; set; }
public string image_url { get; set; }
public bool is_deleted { get; set; }
public bool is_nuked { get; set; }
public bool is_suspended { get; set; }
public string last_name { get; set; }
public SocialConnections social_connections { get; set; }
public int status { get; set; }
public string thumb_url { get; set; }
public object twitch { get; set; }
public string twitter { get; set; }
public string url { get; set; }
public string vanity { get; set; }
public object youtube { get; set; }
}
public class Campaign
{
public Data data { get; set; }
public Links links { get; set; }
}
public class UserRelationships
{
public Campaign campaign { get; set; }
}
public class PatreonUser
{
public UserAttributes attributes { get; set; }
public string id { get; set; }
public UserRelationships relationships { get; set; }
public string type { get; set; }
}
}