author | convert-repo |
Mon, 01 May 2017 19:47:38 +0000 | |
changeset 174 | 349081794232 |
parent 172 | 1f8ea3aa20e7 |
child 175 | 2541f5050df3 |
permissions | -rw-r--r-- |
130 | 1 |
/* |
2 |
Copyright 2017 Ollivier Robert |
|
3 |
Copyright 2017 Mikael Berthe |
|
4 |
||
5 |
Licensed under the MIT license. Please see the LICENSE file is this directory. |
|
6 |
*/ |
|
7 |
||
138
23d3a518d0ad
Update package name in source files
Mikael Berthe <mikael@lilotux.net>
parents:
136
diff
changeset
|
8 |
package madon |
7 | 9 |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
10 |
import ( |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
11 |
"time" |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
12 |
) |
16
9d64e00d3ea6
Begin to fill in types.
Ollivier Robert <roberto@keltia.net>
parents:
10
diff
changeset
|
13 |
|
138
23d3a518d0ad
Update package name in source files
Mikael Berthe <mikael@lilotux.net>
parents:
136
diff
changeset
|
14 |
// Client contains data for a madon client application |
74
ba06092b91a6
Rename "Gondole" as "Client" to avoid "gondole.Gondole".
Ollivier Robert <roberto@keltia.net>
parents:
70
diff
changeset
|
15 |
type Client struct { |
131
68ef6504637e
Introduce RestoreApp(), bump library version
Mikael Berthe <mikael@lilotux.net>
parents:
130
diff
changeset
|
16 |
Name string // Name of the client |
68ef6504637e
Introduce RestoreApp(), bump library version
Mikael Berthe <mikael@lilotux.net>
parents:
130
diff
changeset
|
17 |
ID string // Application ID |
68ef6504637e
Introduce RestoreApp(), bump library version
Mikael Berthe <mikael@lilotux.net>
parents:
130
diff
changeset
|
18 |
Secret string // Application secret |
68ef6504637e
Introduce RestoreApp(), bump library version
Mikael Berthe <mikael@lilotux.net>
parents:
130
diff
changeset
|
19 |
APIBase string // API prefix URL |
68ef6504637e
Introduce RestoreApp(), bump library version
Mikael Berthe <mikael@lilotux.net>
parents:
130
diff
changeset
|
20 |
InstanceURL string // Instance base URL |
85 | 21 |
|
131
68ef6504637e
Introduce RestoreApp(), bump library version
Mikael Berthe <mikael@lilotux.net>
parents:
130
diff
changeset
|
22 |
UserToken *UserToken // User token |
10 | 23 |
} |
24 |
||
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
25 |
/* |
138
23d3a518d0ad
Update package name in source files
Mikael Berthe <mikael@lilotux.net>
parents:
136
diff
changeset
|
26 |
Entities - Everything manipulated/returned by the API |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
27 |
*/ |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
28 |
|
70 | 29 |
// Account represents a Mastodon account entity |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
30 |
type Account struct { |
159
408aa794d9bb
s/int/int64/ for IDs and time integers
Mikael Berthe <mikael@lilotux.net>
parents:
147
diff
changeset
|
31 |
ID int64 `json:"id"` |
136
1af0a6199a93
Change CreatedAt fields to time.Time
Mikael Berthe <mikael@lilotux.net>
parents:
133
diff
changeset
|
32 |
Username string `json:"username"` |
1af0a6199a93
Change CreatedAt fields to time.Time
Mikael Berthe <mikael@lilotux.net>
parents:
133
diff
changeset
|
33 |
Acct string `json:"acct"` |
1af0a6199a93
Change CreatedAt fields to time.Time
Mikael Berthe <mikael@lilotux.net>
parents:
133
diff
changeset
|
34 |
DisplayName string `json:"display_name"` |
1af0a6199a93
Change CreatedAt fields to time.Time
Mikael Berthe <mikael@lilotux.net>
parents:
133
diff
changeset
|
35 |
Note string `json:"note"` |
1af0a6199a93
Change CreatedAt fields to time.Time
Mikael Berthe <mikael@lilotux.net>
parents:
133
diff
changeset
|
36 |
URL string `json:"url"` |
1af0a6199a93
Change CreatedAt fields to time.Time
Mikael Berthe <mikael@lilotux.net>
parents:
133
diff
changeset
|
37 |
Avatar string `json:"avatar"` |
1af0a6199a93
Change CreatedAt fields to time.Time
Mikael Berthe <mikael@lilotux.net>
parents:
133
diff
changeset
|
38 |
Header string `json:"header"` |
1af0a6199a93
Change CreatedAt fields to time.Time
Mikael Berthe <mikael@lilotux.net>
parents:
133
diff
changeset
|
39 |
Locked bool `json:"locked"` |
1af0a6199a93
Change CreatedAt fields to time.Time
Mikael Berthe <mikael@lilotux.net>
parents:
133
diff
changeset
|
40 |
CreatedAt time.Time `json:"created_at"` |
159
408aa794d9bb
s/int/int64/ for IDs and time integers
Mikael Berthe <mikael@lilotux.net>
parents:
147
diff
changeset
|
41 |
FollowersCount int64 `json:"followers_count"` |
408aa794d9bb
s/int/int64/ for IDs and time integers
Mikael Berthe <mikael@lilotux.net>
parents:
147
diff
changeset
|
42 |
FollowingCount int64 `json:"following_count"` |
408aa794d9bb
s/int/int64/ for IDs and time integers
Mikael Berthe <mikael@lilotux.net>
parents:
147
diff
changeset
|
43 |
StatusesCount int64 `json:"statuses_count"` |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
44 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
45 |
|
70 | 46 |
// Application represents a Mastodon application entity |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
47 |
type Application struct { |
70 | 48 |
Name string `json:"name"` |
49 |
Website string `json:"website"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
50 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
51 |
|
70 | 52 |
// Attachment represents a Mastodon attachement entity |
53 |
type Attachment struct { |
|
172
1f8ea3aa20e7
Fix case mistakes in JSON tags
Mikael Berthe <mikael@lilotux.net>
parents:
159
diff
changeset
|
54 |
ID int64 `json:"id"` |
70 | 55 |
Type string `json:"type"` |
56 |
URL string `json:"url"` |
|
57 |
RemoteURL string `json:"remote_url"` |
|
58 |
PreviewURL string `json:"preview_url"` |
|
59 |
TextURL string `json:"text_url"` |
|
10 | 60 |
} |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
61 |
|
70 | 62 |
// Card represents a Mastodon card entity |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
63 |
type Card struct { |
100 | 64 |
URL string `json:"url"` |
65 |
Title string `json:"title"` |
|
66 |
Description string `json:"description"` |
|
67 |
Image string `json:"image"` |
|
70 | 68 |
} |
69 |
||
70 |
// Context represents a Mastodon context entity |
|
71 |
type Context struct { |
|
72 |
Ancestors []Status `json:"ancestors"` |
|
73 |
Descendents []Status `json:"descendents"` |
|
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 |
// Error represents a Mastodon error entity |
77 |
type Error struct { |
|
78 |
Text string `json:"error"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
79 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
80 |
|
70 | 81 |
// Instance represents a Mastodon instance entity |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
82 |
type Instance struct { |
70 | 83 |
URI string `json:"uri"` |
84 |
Title string `json:"title"` |
|
85 |
Description string `json:"description"` |
|
86 |
Email string `json:"email"` |
|
147
b682706e2f31
Add version filed (Mastodon 1.3+) to the Instance type
Mikael Berthe <mikael@lilotux.net>
parents:
138
diff
changeset
|
87 |
Version string `json:"version"` |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
88 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
89 |
|
70 | 90 |
// Mention represents a Mastodon mention entity |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
91 |
type Mention struct { |
159
408aa794d9bb
s/int/int64/ for IDs and time integers
Mikael Berthe <mikael@lilotux.net>
parents:
147
diff
changeset
|
92 |
ID int64 `json:"id"` |
70 | 93 |
URL string `json:"url"` |
94 |
Username string `json:"username"` |
|
95 |
Acct string `json:"acct"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
96 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
97 |
|
70 | 98 |
// Notification represents a Mastodon notification entity |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
99 |
type Notification struct { |
159
408aa794d9bb
s/int/int64/ for IDs and time integers
Mikael Berthe <mikael@lilotux.net>
parents:
147
diff
changeset
|
100 |
ID int64 `json:"id"` |
136
1af0a6199a93
Change CreatedAt fields to time.Time
Mikael Berthe <mikael@lilotux.net>
parents:
133
diff
changeset
|
101 |
Type string `json:"type"` |
1af0a6199a93
Change CreatedAt fields to time.Time
Mikael Berthe <mikael@lilotux.net>
parents:
133
diff
changeset
|
102 |
CreatedAt time.Time `json:"created_at"` |
1af0a6199a93
Change CreatedAt fields to time.Time
Mikael Berthe <mikael@lilotux.net>
parents:
133
diff
changeset
|
103 |
Account *Account `json:"account"` |
1af0a6199a93
Change CreatedAt fields to time.Time
Mikael Berthe <mikael@lilotux.net>
parents:
133
diff
changeset
|
104 |
Status *Status `json:"status"` |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
105 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
106 |
|
70 | 107 |
// Relationship represents a Mastodon relationship entity |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
108 |
type Relationship struct { |
159
408aa794d9bb
s/int/int64/ for IDs and time integers
Mikael Berthe <mikael@lilotux.net>
parents:
147
diff
changeset
|
109 |
ID int64 `json:"id"` |
408aa794d9bb
s/int/int64/ for IDs and time integers
Mikael Berthe <mikael@lilotux.net>
parents:
147
diff
changeset
|
110 |
Following bool `json:"following"` |
408aa794d9bb
s/int/int64/ for IDs and time integers
Mikael Berthe <mikael@lilotux.net>
parents:
147
diff
changeset
|
111 |
FollowedBy bool `json:"followed_by"` |
408aa794d9bb
s/int/int64/ for IDs and time integers
Mikael Berthe <mikael@lilotux.net>
parents:
147
diff
changeset
|
112 |
Blocking bool `json:"blocking"` |
408aa794d9bb
s/int/int64/ for IDs and time integers
Mikael Berthe <mikael@lilotux.net>
parents:
147
diff
changeset
|
113 |
Muting bool `json:"muting"` |
408aa794d9bb
s/int/int64/ for IDs and time integers
Mikael Berthe <mikael@lilotux.net>
parents:
147
diff
changeset
|
114 |
Requested bool `json:"requested"` |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
115 |
} |
70 | 116 |
|
117 |
// Report represents a Mastodon report entity |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
118 |
type Report struct { |
172
1f8ea3aa20e7
Fix case mistakes in JSON tags
Mikael Berthe <mikael@lilotux.net>
parents:
159
diff
changeset
|
119 |
ID int64 `json:"id"` |
70 | 120 |
ActionTaken string `json:"action_taken"` |
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 |
// Results represents a Mastodon results entity |
124 |
type Results struct { |
|
125 |
Accounts []Account `json:"accounts"` |
|
126 |
Statuses []Status `json:"statuses"` |
|
127 |
Hashtags []string `json:"hashtags"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
128 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
129 |
|
70 | 130 |
// Status represents a Mastodon status entity |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
131 |
type Status struct { |
159
408aa794d9bb
s/int/int64/ for IDs and time integers
Mikael Berthe <mikael@lilotux.net>
parents:
147
diff
changeset
|
132 |
ID int64 `json:"id"` |
70 | 133 |
URI string `json:"uri"` |
134 |
URL string `json:"url"` |
|
135 |
Account *Account `json:"account"` |
|
159
408aa794d9bb
s/int/int64/ for IDs and time integers
Mikael Berthe <mikael@lilotux.net>
parents:
147
diff
changeset
|
136 |
InReplyToID int64 `json:"in_reply_to_id"` |
408aa794d9bb
s/int/int64/ for IDs and time integers
Mikael Berthe <mikael@lilotux.net>
parents:
147
diff
changeset
|
137 |
InReplyToAccountID int64 `json:"in_reply_to_account_id"` |
70 | 138 |
Reblog *Status `json:"reblog"` |
139 |
Content string `json:"content"` |
|
140 |
CreatedAt time.Time `json:"created_at"` |
|
159
408aa794d9bb
s/int/int64/ for IDs and time integers
Mikael Berthe <mikael@lilotux.net>
parents:
147
diff
changeset
|
141 |
ReblogsCount int64 `json:"reblogs_count"` |
408aa794d9bb
s/int/int64/ for IDs and time integers
Mikael Berthe <mikael@lilotux.net>
parents:
147
diff
changeset
|
142 |
FavouritesCount int64 `json:"favourites_count"` |
70 | 143 |
Reblogged bool `json:"reblogged"` |
144 |
Favourited bool `json:"favourited"` |
|
145 |
Sensitive bool `json:"sensitive"` |
|
146 |
SpoilerText string `json:"spoiler_text"` |
|
147 |
Visibility string `json:"visibility"` |
|
148 |
MediaAttachments []Attachment `json:"media_attachments"` |
|
149 |
Mentions []Mention `json:"mentions"` |
|
150 |
Tags []Tag `json:"tags"` |
|
151 |
Application Application `json:"application"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
152 |
} |
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
153 |
|
70 | 154 |
// Tag represents a Mastodon tag entity |
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
155 |
type Tag struct { |
70 | 156 |
Name string `json:"name"` |
157 |
URL string `json:"url"` |
|
17
9f17ef336aad
Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents:
16
diff
changeset
|
158 |
} |