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