author | Mikael Berthe <mikael@lilotux.net> |
Sat, 15 Apr 2017 21:08:34 +0200 | |
changeset 123 | 9b566c020a17 |
parent 100 | e327896577dd |
child 130 | c450bb73f59a |
permissions | -rw-r--r-- |
7 | 1 |
package gondole |
2 |
||
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
3 |
import ( |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
4 |
"time" |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
5 |
) |
16
9d64e00d3ea6
Begin to fill in types.
Ollivier Robert <roberto@keltia.net>
parents:
10
diff
changeset
|
6 |
|
83
adc39ae774c0
Make it work with non-defaut instances
Mikael Berthe <mikael@lilotux.net>
parents:
74
diff
changeset
|
7 |
// Client contains data for a gondole client application |
74
ba06092b91a6
Rename "Gondole" as "Client" to avoid "gondole.Gondole".
Ollivier Robert <roberto@keltia.net>
parents:
70
diff
changeset
|
8 |
type Client struct { |
83
adc39ae774c0
Make it work with non-defaut instances
Mikael Berthe <mikael@lilotux.net>
parents:
74
diff
changeset
|
9 |
Name string |
adc39ae774c0
Make it work with non-defaut instances
Mikael Berthe <mikael@lilotux.net>
parents:
74
diff
changeset
|
10 |
ID string |
adc39ae774c0
Make it work with non-defaut instances
Mikael Berthe <mikael@lilotux.net>
parents:
74
diff
changeset
|
11 |
Secret string |
adc39ae774c0
Make it work with non-defaut instances
Mikael Berthe <mikael@lilotux.net>
parents:
74
diff
changeset
|
12 |
APIBase string |
adc39ae774c0
Make it work with non-defaut instances
Mikael Berthe <mikael@lilotux.net>
parents:
74
diff
changeset
|
13 |
InstanceURL string |
85 | 14 |
|
123 | 15 |
UserToken *UserToken |
10 | 16 |
} |
17 |
||
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
18 |
/* |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
19 |
Entities: |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
20 |
|
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
21 |
Everything manipulated/returned by the API |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
22 |
*/ |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
23 |
|
70 | 24 |
// Account represents a Mastodon account entity |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
25 |
type Account struct { |
70 | 26 |
ID int `json:"id"` |
27 |
Username string `json:"username"` |
|
28 |
Acct string `json:"acct"` |
|
29 |
DisplayName string `json:"display_name"` |
|
30 |
Note string `json:"note"` |
|
31 |
URL string `json:"url"` |
|
32 |
Avatar string `json:"avatar"` |
|
33 |
Header string `json:"header"` |
|
34 |
Locked bool `json:"locked"` |
|
35 |
CreatedAt string `json:"created_at"` |
|
36 |
FollowersCount int `json:"followers_count"` |
|
37 |
FollowingCount int `json:"following_count"` |
|
38 |
StatusesCount int `json:"statuses_count"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
39 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
40 |
|
70 | 41 |
// Application represents a Mastodon application entity |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
42 |
type Application struct { |
70 | 43 |
Name string `json:"name"` |
44 |
Website string `json:"website"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
45 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
46 |
|
70 | 47 |
// Attachment represents a Mastodon attachement entity |
48 |
type Attachment struct { |
|
49 |
ID int `json:"iD"` |
|
50 |
Type string `json:"type"` |
|
51 |
URL string `json:"url"` |
|
52 |
RemoteURL string `json:"remote_url"` |
|
53 |
PreviewURL string `json:"preview_url"` |
|
54 |
TextURL string `json:"text_url"` |
|
10 | 55 |
} |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
56 |
|
70 | 57 |
// Card represents a Mastodon card entity |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
58 |
type Card struct { |
100 | 59 |
URL string `json:"url"` |
60 |
Title string `json:"title"` |
|
61 |
Description string `json:"description"` |
|
62 |
Image string `json:"image"` |
|
70 | 63 |
} |
64 |
||
65 |
// Context represents a Mastodon context entity |
|
66 |
type Context struct { |
|
67 |
Ancestors []Status `json:"ancestors"` |
|
68 |
Descendents []Status `json:"descendents"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
69 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
70 |
|
70 | 71 |
// Error represents a Mastodon error entity |
72 |
type Error struct { |
|
73 |
Text string `json:"error"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
74 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
75 |
|
70 | 76 |
// Instance represents a Mastodon instance entity |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
77 |
type Instance struct { |
70 | 78 |
URI string `json:"uri"` |
79 |
Title string `json:"title"` |
|
80 |
Description string `json:"description"` |
|
81 |
Email string `json:"email"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
82 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
83 |
|
70 | 84 |
// Mention represents a Mastodon mention entity |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
85 |
type Mention struct { |
70 | 86 |
ID int `json:"id"` |
87 |
URL string `json:"url"` |
|
88 |
Username string `json:"username"` |
|
89 |
Acct string `json:"acct"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
90 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
91 |
|
70 | 92 |
// Notification represents a Mastodon notification entity |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
93 |
type Notification struct { |
70 | 94 |
ID int `json:"id"` |
95 |
Type string `json:"type"` |
|
96 |
CreatedAt string `json:"created_at"` |
|
97 |
Account *Account `json:"account"` |
|
98 |
Status *Status `json:"status"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
99 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
100 |
|
70 | 101 |
// Relationship represents a Mastodon relationship entity |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
102 |
type Relationship struct { |
70 | 103 |
Following bool `json:"following"` |
104 |
FollowedBy bool `json:"followed_by"` |
|
105 |
Blocking bool `json:"blocking"` |
|
106 |
Muting bool `json:"muting"` |
|
107 |
Requested bool `json:"requested"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
108 |
} |
70 | 109 |
|
110 |
// Report represents a Mastodon report entity |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
111 |
type Report struct { |
70 | 112 |
ID int `json:"iD"` |
113 |
ActionTaken string `json:"action_taken"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
114 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
115 |
|
70 | 116 |
// Results represents a Mastodon results entity |
117 |
type Results struct { |
|
118 |
Accounts []Account `json:"accounts"` |
|
119 |
Statuses []Status `json:"statuses"` |
|
120 |
Hashtags []string `json:"hashtags"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
121 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
122 |
|
70 | 123 |
// Status represents a Mastodon status entity |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
124 |
type Status struct { |
70 | 125 |
ID int `json:"id"` |
126 |
URI string `json:"uri"` |
|
127 |
URL string `json:"url"` |
|
128 |
Account *Account `json:"account"` |
|
129 |
InReplyToID int `json:"in_reply_to_id"` |
|
130 |
InReplyToAccountID int `json:"in_reply_to_account_id"` |
|
131 |
Reblog *Status `json:"reblog"` |
|
132 |
Content string `json:"content"` |
|
133 |
CreatedAt time.Time `json:"created_at"` |
|
134 |
ReblogsCount int `json:"reblogs_count"` |
|
135 |
FavouritesCount int `json:"favourites_count"` |
|
136 |
Reblogged bool `json:"reblogged"` |
|
137 |
Favourited bool `json:"favourited"` |
|
138 |
Sensitive bool `json:"sensitive"` |
|
139 |
SpoilerText string `json:"spoiler_text"` |
|
140 |
Visibility string `json:"visibility"` |
|
141 |
MediaAttachments []Attachment `json:"media_attachments"` |
|
142 |
Mentions []Mention `json:"mentions"` |
|
143 |
Tags []Tag `json:"tags"` |
|
144 |
Application Application `json:"application"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
145 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
146 |
|
70 | 147 |
// Tag represents a Mastodon tag entity |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
148 |
type Tag struct { |
70 | 149 |
Name string `json:"name"` |
150 |
URL string `json:"url"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
151 |
} |