-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add type definitions and readme
- Loading branch information
Showing
4 changed files
with
192 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
## Types for Creator Database | ||
|
||
**Purpose:** | ||
|
||
This folder contains type definitions for the Creator Database JSON data in various programming languages. These type definitions can be used to provide strong typing and improve code maintainability when working with the database. | ||
|
||
**Usage:** | ||
|
||
1. **Choose the appropriate type definition file** based on the programming language you're using. | ||
2. **Import or include the type definitions** in your project. | ||
3. **Use the type definitions** to represent and manipulate the Creator Database data in your code. | ||
|
||
**Example (TypeScript):** | ||
|
||
```typescript | ||
interface SocialMedia { | ||
id: string | null; | ||
name?: string | null; | ||
username?: string | null; | ||
partner?: boolean | null; | ||
handle?: string | null; | ||
} | ||
|
||
interface Creator { | ||
name: string; | ||
aliases: string[] | null; | ||
steam: SocialMedia | null; | ||
discord: SocialMedia | null; | ||
twitch: Omit<SocialMedia, 'name' | 'username' | 'handle'> | null; | ||
youtube: Omit<SocialMedia, 'name' | 'username'> | null; | ||
} | ||
|
||
// Example | ||
|
||
const honeypuu: Creator = { | ||
name: "HoneyPuu", | ||
aliases: null, | ||
steam: { | ||
id: "76561198405910426", | ||
name: "HoneyPuu" | ||
}, | ||
discord: { | ||
id: "247064492427444224", | ||
username: "honeypuu", | ||
partner: false | ||
}, | ||
twitch: { | ||
id: "honeypuu", | ||
partner: true | ||
}, | ||
youtube: { | ||
handle: "honeypuu", | ||
id: "UC6lv714giE5fvmlUhS3d9gg", | ||
partner: true | ||
} | ||
}; | ||
``` | ||
|
||
**Disclaimer:** | ||
|
||
While we strive to provide accurate and up-to-date type definitions for the Creator Database, we cannot guarantee their correctness or completeness. It's always recommended to verify the data against the actual JSON structure. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
public partial class CreatorClass | ||
{ | ||
[JsonProperty("aliases")] | ||
public string[] Aliases { get; set; } | ||
|
||
[JsonProperty("discord")] | ||
public Discord Discord { get; set; } | ||
|
||
[JsonProperty("name")] | ||
public string Name { get; set; } | ||
|
||
[JsonProperty("steam")] | ||
public Steam Steam { get; set; } | ||
|
||
[JsonProperty("twitch")] | ||
public Twitch Twitch { get; set; } | ||
|
||
[JsonProperty("youtube")] | ||
public Youtube Youtube { get; set; } | ||
} | ||
|
||
public partial class Discord | ||
{ | ||
[JsonProperty("id")] | ||
public string Id { get; set; } | ||
|
||
[JsonProperty("partner")] | ||
public bool? Partner { get; set; } | ||
|
||
[JsonProperty("username")] | ||
public string Username { get; set; } | ||
} | ||
|
||
public partial class Steam | ||
{ | ||
[JsonProperty("id")] | ||
public string Id { get; set; } | ||
|
||
[JsonProperty("name")] | ||
public string Name { get; set; } | ||
} | ||
|
||
public partial class Twitch | ||
{ | ||
[JsonProperty("id")] | ||
public string Id { get; set; } | ||
|
||
[JsonProperty("partner")] | ||
public bool? Partner { get; set; } | ||
} | ||
|
||
public partial class Youtube | ||
{ | ||
[JsonProperty("handle")] | ||
public string Handle { get; set; } | ||
|
||
[JsonProperty("id")] | ||
public string Id { get; set; } | ||
|
||
[JsonProperty("partner")] | ||
public bool? Partner { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package main | ||
|
||
type Creator struct { | ||
Aliases []string `json:"aliases"` | ||
Discord *Discord `json:"discord"` | ||
Name string `json:"name"` | ||
Steam *Steam `json:"steam"` | ||
Twitch *Twitch `json:"twitch"` | ||
Youtube *Youtube `json:"youtube"` | ||
} | ||
|
||
type Discord struct { | ||
ID *string `json:"id"` | ||
Partner *bool `json:"partner"` | ||
Username *string `json:"username"` | ||
} | ||
|
||
type Steam struct { | ||
ID *string `json:"id"` | ||
Name *string `json:"name"` | ||
} | ||
|
||
type Twitch struct { | ||
ID *string `json:"id"` | ||
Partner *bool `json:"partner"` | ||
} | ||
|
||
type Youtube struct { | ||
Handle *string `json:"handle"` | ||
ID *string `json:"id"` | ||
Partner *bool `json:"partner"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use serde::{Serialize, Deserialize}; | ||
|
||
#[derive(Serialize, Deserialize)] | ||
pub struct CreatorStruct { | ||
aliases: Option<Vec<String>>, | ||
discord: Option<Discord>, | ||
name: String, | ||
steam: Option<Steam>, | ||
twitch: Option<Twitch>, | ||
youtube: Option<Youtube>, | ||
} | ||
|
||
#[derive(Serialize, Deserialize)] | ||
pub struct Discord { | ||
id: Option<String>, | ||
partner: Option<bool>, | ||
username: Option<String>, | ||
} | ||
|
||
#[derive(Serialize, Deserialize)] | ||
pub struct Steam { | ||
id: Option<String>, | ||
name: Option<String>, | ||
} | ||
|
||
#[derive(Serialize, Deserialize)] | ||
pub struct Twitch { | ||
id: Option<String>, | ||
partner: Option<bool>, | ||
} | ||
|
||
#[derive(Serialize, Deserialize)] | ||
pub struct Youtube { | ||
handle: Option<String>, | ||
id: Option<String>, | ||
partner: Option<bool>, | ||
} |