|
| 1 | +package lanyard |
| 2 | + |
| 3 | +// I'm not entirely sure if these are correct. You can review and open a PR before using it. |
| 4 | +// Go port of https://github.com/barbarbar338/react-use-lanyard/blob/main/src/types.ts |
| 5 | +type LanyardResponse struct { |
| 6 | + Success bool `json:"success"` |
| 7 | + Data *LanyardData `json:"data"` |
| 8 | + Error *LanyardError `json:"error"` |
| 9 | +} |
| 10 | + |
| 11 | +type LanyardWSResponse struct { |
| 12 | + Op int `json:"op"` |
| 13 | + Seq int `json:"seq"` |
| 14 | + T string `json:"t"` |
| 15 | + D *LanyardData `json:"d"` |
| 16 | +} |
| 17 | + |
| 18 | + |
| 19 | +type LanyardData struct { |
| 20 | + Spotify Spotify `json:"spotify"` |
| 21 | + ListeningToSpotify bool `json:"listening_to_spotify"` |
| 22 | + DiscordUser DiscordUser `json:"discord_user"` |
| 23 | + DiscordStatus string `json:"discord_status"` |
| 24 | + Activities []Activity `json:"activities"` |
| 25 | + ActiveOnDiscordMobile bool `json:"active_on_discord_mobile"` |
| 26 | + ActiveOnDiscordDesktop bool `json:"active_on_discord_desktop"` |
| 27 | +} |
| 28 | + |
| 29 | +type LanyardError struct { |
| 30 | + Message string `json:"message"` |
| 31 | + Code string `json:"code"` |
| 32 | +} |
| 33 | + |
| 34 | +type Spotify struct { |
| 35 | + TrackId string `json:"track_id"` |
| 36 | + Timestamps Timestamps `json:"timestamps"` |
| 37 | + Song string `json:"song"` |
| 38 | + Artist string `json:"artist"` |
| 39 | + Album string `json:"album"` |
| 40 | + AlbumArtUrl string `json:"album_art_url"` |
| 41 | +} |
| 42 | + |
| 43 | +type Timestamps struct { |
| 44 | + Start int `json:"start"` |
| 45 | + End int `json:"end"` |
| 46 | +} |
| 47 | + |
| 48 | +type Activity struct { |
| 49 | + Type int `json:"type"` |
| 50 | + State string `json:"state"` |
| 51 | + Name string `json:"name"` |
| 52 | + Id string `json:"id"` |
| 53 | + Emoji *Emoji `json:"emoji"` |
| 54 | + CreatedAt int `json:"created_at"` |
| 55 | + ApplicationId string `json:"application_id"` |
| 56 | + Timestamps *Timestamps `json:"timestamps"` |
| 57 | + SessionId string `json:"session_id"` |
| 58 | + Details *string `json:"details"` |
| 59 | + Buttons *[]string `json:"buttons"` |
| 60 | + Assets *Assets `json:"assets"` |
| 61 | +} |
| 62 | + |
| 63 | +type Assets struct { |
| 64 | + SmallText string `json:"small_text"` |
| 65 | + SmallImage string `json:"small_image"` |
| 66 | + LargeText string `json:"large_text"` |
| 67 | + LargeImage string `json:"large_image"` |
| 68 | +} |
| 69 | + |
| 70 | +type Emoji struct { |
| 71 | + Name string `json:"name"` |
| 72 | +} |
| 73 | + |
| 74 | +type DiscordUser struct { |
| 75 | + Id string `json:"id"` |
| 76 | + Username string `json:"username"` |
| 77 | + Avatar string `json:"avatar"` |
| 78 | + Discriminator string `json:"discriminator"` |
| 79 | + PublicFlags int `json:"public_flags"` |
| 80 | +} |
0 commit comments