author | Mikael Berthe <mikael@lilotux.net> |
Wed, 12 Apr 2017 17:36:27 +0200 | |
changeset 85 | abf0f5e40281 |
parent 83 | adc39ae774c0 |
child 100 | e327896577dd |
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 |
|
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 |
/* |
58 |
// Card represents a Mastodon card entity |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
59 |
type Card struct { |
70 | 60 |
URL string `json:"url"` |
61 |
Title string `json:"title"` |
|
62 |
Description string `json:"description"` |
|
63 |
Image *interface{} `json:"image"` |
|
64 |
} |
|
65 |
*/ |
|
66 |
||
67 |
// Context represents a Mastodon context entity |
|
68 |
type Context struct { |
|
69 |
Ancestors []Status `json:"ancestors"` |
|
70 |
Descendents []Status `json:"descendents"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
71 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
72 |
|
70 | 73 |
// Error represents a Mastodon error entity |
74 |
type Error struct { |
|
75 |
Text string `json:"error"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
76 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
77 |
|
70 | 78 |
// Instance represents a Mastodon instance entity |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
79 |
type Instance struct { |
70 | 80 |
URI string `json:"uri"` |
81 |
Title string `json:"title"` |
|
82 |
Description string `json:"description"` |
|
83 |
Email string `json:"email"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
84 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
85 |
|
70 | 86 |
// Mention represents a Mastodon mention entity |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
87 |
type Mention struct { |
70 | 88 |
ID int `json:"id"` |
89 |
URL string `json:"url"` |
|
90 |
Username string `json:"username"` |
|
91 |
Acct string `json:"acct"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
92 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
93 |
|
70 | 94 |
// Notification represents a Mastodon notification entity |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
95 |
type Notification struct { |
70 | 96 |
ID int `json:"id"` |
97 |
Type string `json:"type"` |
|
98 |
CreatedAt string `json:"created_at"` |
|
99 |
Account *Account `json:"account"` |
|
100 |
Status *Status `json:"status"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
101 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
102 |
|
70 | 103 |
// Relationship represents a Mastodon relationship entity |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
104 |
type Relationship struct { |
70 | 105 |
Following bool `json:"following"` |
106 |
FollowedBy bool `json:"followed_by"` |
|
107 |
Blocking bool `json:"blocking"` |
|
108 |
Muting bool `json:"muting"` |
|
109 |
Requested bool `json:"requested"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
110 |
} |
70 | 111 |
|
112 |
// Report represents a Mastodon report entity |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
113 |
type Report struct { |
70 | 114 |
ID int `json:"iD"` |
115 |
ActionTaken string `json:"action_taken"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
116 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
117 |
|
70 | 118 |
// Results represents a Mastodon results entity |
119 |
type Results struct { |
|
120 |
Accounts []Account `json:"accounts"` |
|
121 |
Statuses []Status `json:"statuses"` |
|
122 |
Hashtags []string `json:"hashtags"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
123 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
124 |
|
70 | 125 |
// Status represents a Mastodon status entity |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
126 |
type Status struct { |
70 | 127 |
ID int `json:"id"` |
128 |
URI string `json:"uri"` |
|
129 |
URL string `json:"url"` |
|
130 |
Account *Account `json:"account"` |
|
131 |
InReplyToID int `json:"in_reply_to_id"` |
|
132 |
InReplyToAccountID int `json:"in_reply_to_account_id"` |
|
133 |
Reblog *Status `json:"reblog"` |
|
134 |
Content string `json:"content"` |
|
135 |
CreatedAt time.Time `json:"created_at"` |
|
136 |
ReblogsCount int `json:"reblogs_count"` |
|
137 |
FavouritesCount int `json:"favourites_count"` |
|
138 |
Reblogged bool `json:"reblogged"` |
|
139 |
Favourited bool `json:"favourited"` |
|
140 |
Sensitive bool `json:"sensitive"` |
|
141 |
SpoilerText string `json:"spoiler_text"` |
|
142 |
Visibility string `json:"visibility"` |
|
143 |
MediaAttachments []Attachment `json:"media_attachments"` |
|
144 |
Mentions []Mention `json:"mentions"` |
|
145 |
Tags []Tag `json:"tags"` |
|
146 |
Application Application `json:"application"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
147 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
148 |
|
70 | 149 |
// Tag represents a Mastodon tag entity |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
150 |
type Tag struct { |
70 | 151 |
Name string `json:"name"` |
152 |
URL string `json:"url"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
153 |
} |