types.go
author Mikael Berthe <mikael@lilotux.net>
Sun, 16 Feb 2020 18:48:57 +0100
changeset 254 0362ce76324f
parent 239 ca5639b4768e
permissions -rw-r--r--
Update dependencies
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
130
c450bb73f59a Update credits
Mikael Berthe <mikael@lilotux.net>
parents: 123
diff changeset
     1
/*
207
301d5b94be3f Update copyrights
Mikael Berthe <mikael@lilotux.net>
parents: 200
diff changeset
     2
Copyright 2017-2018 Mikael Berthe
130
c450bb73f59a Update credits
Mikael Berthe <mikael@lilotux.net>
parents: 123
diff changeset
     3
Copyright 2017 Ollivier Robert
c450bb73f59a Update credits
Mikael Berthe <mikael@lilotux.net>
parents: 123
diff changeset
     4
c450bb73f59a Update credits
Mikael Berthe <mikael@lilotux.net>
parents: 123
diff changeset
     5
Licensed under the MIT license.  Please see the LICENSE file is this directory.
c450bb73f59a Update credits
Mikael Berthe <mikael@lilotux.net>
parents: 123
diff changeset
     6
*/
c450bb73f59a Update credits
Mikael Berthe <mikael@lilotux.net>
parents: 123
diff changeset
     7
138
23d3a518d0ad Update package name in source files
Mikael Berthe <mikael@lilotux.net>
parents: 136
diff changeset
     8
package madon
7
0fbbac6d8e8c We have an skeleton now.
Ollivier Robert <roberto@keltia.net>
parents:
diff changeset
     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
239
ca5639b4768e Introduce new type: MastodonDate
Mikael Berthe <mikael@lilotux.net>
parents: 236
diff changeset
    14
// MastodonDate is a custom type for the timestamps returned by some API calls
ca5639b4768e Introduce new type: MastodonDate
Mikael Berthe <mikael@lilotux.net>
parents: 236
diff changeset
    15
type MastodonDate struct {
221
f9228d1f4267 instance activity: Add a WeekActivity type
Mikael Berthe <mikael@lilotux.net>
parents: 220
diff changeset
    16
	time.Time
f9228d1f4267 instance activity: Add a WeekActivity type
Mikael Berthe <mikael@lilotux.net>
parents: 220
diff changeset
    17
}
f9228d1f4267 instance activity: Add a WeekActivity type
Mikael Berthe <mikael@lilotux.net>
parents: 220
diff changeset
    18
138
23d3a518d0ad Update package name in source files
Mikael Berthe <mikael@lilotux.net>
parents: 136
diff changeset
    19
// 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
    20
type Client struct {
131
68ef6504637e Introduce RestoreApp(), bump library version
Mikael Berthe <mikael@lilotux.net>
parents: 130
diff changeset
    21
	Name        string // Name of the client
68ef6504637e Introduce RestoreApp(), bump library version
Mikael Berthe <mikael@lilotux.net>
parents: 130
diff changeset
    22
	ID          string // Application ID
68ef6504637e Introduce RestoreApp(), bump library version
Mikael Berthe <mikael@lilotux.net>
parents: 130
diff changeset
    23
	Secret      string // Application secret
68ef6504637e Introduce RestoreApp(), bump library version
Mikael Berthe <mikael@lilotux.net>
parents: 130
diff changeset
    24
	APIBase     string // API prefix URL
68ef6504637e Introduce RestoreApp(), bump library version
Mikael Berthe <mikael@lilotux.net>
parents: 130
diff changeset
    25
	InstanceURL string // Instance base URL
85
abf0f5e40281 Initial login support
Mikael Berthe <mikael@lilotux.net>
parents: 83
diff changeset
    26
131
68ef6504637e Introduce RestoreApp(), bump library version
Mikael Berthe <mikael@lilotux.net>
parents: 130
diff changeset
    27
	UserToken *UserToken // User token
10
bb83de52ba5f Adding types.
Ollivier Robert <roberto@keltia.net>
parents: 7
diff changeset
    28
}
bb83de52ba5f Adding types.
Ollivier Robert <roberto@keltia.net>
parents: 7
diff changeset
    29
17
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
    30
/*
138
23d3a518d0ad Update package name in source files
Mikael Berthe <mikael@lilotux.net>
parents: 136
diff changeset
    31
Entities - Everything manipulated/returned by the API
17
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
    32
*/
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
    33
187
e1b1f4a168b7 Add GetDomainBlocks, DomainBlock and DomainUnblock
Mikael Berthe <mikael@lilotux.net>
parents: 186
diff changeset
    34
// DomainName is a domain name string, as returned by the domain_blocks API
e1b1f4a168b7 Add GetDomainBlocks, DomainBlock and DomainUnblock
Mikael Berthe <mikael@lilotux.net>
parents: 186
diff changeset
    35
type DomainName string
e1b1f4a168b7 Add GetDomainBlocks, DomainBlock and DomainUnblock
Mikael Berthe <mikael@lilotux.net>
parents: 186
diff changeset
    36
211
12f0761e6442 Add new type InstancePeer
Mikael Berthe <mikael@lilotux.net>
parents: 207
diff changeset
    37
// InstancePeer is a peer name, as returned by the instance/peers API
12f0761e6442 Add new type InstancePeer
Mikael Berthe <mikael@lilotux.net>
parents: 207
diff changeset
    38
type InstancePeer string
12f0761e6442 Add new type InstancePeer
Mikael Berthe <mikael@lilotux.net>
parents: 207
diff changeset
    39
70
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
    40
// Account represents a Mastodon account entity
17
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
    41
type Account struct {
228
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
    42
	ID             int64         `json:"id,string"`
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
    43
	Username       string        `json:"username"`
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
    44
	Acct           string        `json:"acct"`
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
    45
	DisplayName    string        `json:"display_name"`
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
    46
	Note           string        `json:"note"`
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
    47
	URL            string        `json:"url"`
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
    48
	Avatar         string        `json:"avatar"`
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
    49
	AvatarStatic   string        `json:"avatar_static"`
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
    50
	Header         string        `json:"header"`
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
    51
	HeaderStatic   string        `json:"header_static"`
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
    52
	Locked         bool          `json:"locked"`
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
    53
	CreatedAt      time.Time     `json:"created_at"`
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
    54
	FollowersCount int64         `json:"followers_count"`
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
    55
	FollowingCount int64         `json:"following_count"`
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
    56
	StatusesCount  int64         `json:"statuses_count"`
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
    57
	Moved          *Account      `json:"moved"`
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
    58
	Bot            bool          `json:"bot"`
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
    59
	Emojis         []Emoji       `json:"emojis"`
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
    60
	Fields         *[]Field      `json:"fields"`
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
    61
	Source         *SourceParams `json:"source"`
17
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
    62
}
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
    63
70
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
    64
// Application represents a Mastodon application entity
17
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
    65
type Application struct {
70
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
    66
	Name    string `json:"name"`
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
    67
	Website string `json:"website"`
17
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
    68
}
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
    69
219
98697242c4a0 Update types
Mikael Berthe <mikael@lilotux.net>
parents: 211
diff changeset
    70
// Attachment represents a Mastodon media attachment entity
70
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
    71
type Attachment struct {
196
21519d54dd4c Update types to reflect Mastodon 2.0.0 API changes
Mikael Berthe <mikael@lilotux.net>
parents: 190
diff changeset
    72
	ID         int64   `json:"id,string"`
190
0684ddad598c Precise Attachment meta fields
Mikael Berthe <mikael@lilotux.net>
parents: 187
diff changeset
    73
	Type       string  `json:"type"`
0684ddad598c Precise Attachment meta fields
Mikael Berthe <mikael@lilotux.net>
parents: 187
diff changeset
    74
	URL        string  `json:"url"`
0684ddad598c Precise Attachment meta fields
Mikael Berthe <mikael@lilotux.net>
parents: 187
diff changeset
    75
	RemoteURL  *string `json:"remote_url"`
0684ddad598c Precise Attachment meta fields
Mikael Berthe <mikael@lilotux.net>
parents: 187
diff changeset
    76
	PreviewURL string  `json:"preview_url"`
0684ddad598c Precise Attachment meta fields
Mikael Berthe <mikael@lilotux.net>
parents: 187
diff changeset
    77
	TextURL    *string `json:"text_url"`
0684ddad598c Precise Attachment meta fields
Mikael Berthe <mikael@lilotux.net>
parents: 187
diff changeset
    78
	Meta       *struct {
0684ddad598c Precise Attachment meta fields
Mikael Berthe <mikael@lilotux.net>
parents: 187
diff changeset
    79
		Original struct {
0684ddad598c Precise Attachment meta fields
Mikael Berthe <mikael@lilotux.net>
parents: 187
diff changeset
    80
			Size   string  `json:"size"`
0684ddad598c Precise Attachment meta fields
Mikael Berthe <mikael@lilotux.net>
parents: 187
diff changeset
    81
			Aspect float64 `json:"aspect"`
0684ddad598c Precise Attachment meta fields
Mikael Berthe <mikael@lilotux.net>
parents: 187
diff changeset
    82
			Width  int     `json:"width"`
0684ddad598c Precise Attachment meta fields
Mikael Berthe <mikael@lilotux.net>
parents: 187
diff changeset
    83
			Height int     `json:"height"`
0684ddad598c Precise Attachment meta fields
Mikael Berthe <mikael@lilotux.net>
parents: 187
diff changeset
    84
		} `json:"original"`
0684ddad598c Precise Attachment meta fields
Mikael Berthe <mikael@lilotux.net>
parents: 187
diff changeset
    85
		Small struct {
0684ddad598c Precise Attachment meta fields
Mikael Berthe <mikael@lilotux.net>
parents: 187
diff changeset
    86
			Size   string  `json:"size"`
0684ddad598c Precise Attachment meta fields
Mikael Berthe <mikael@lilotux.net>
parents: 187
diff changeset
    87
			Aspect float64 `json:"aspect"`
0684ddad598c Precise Attachment meta fields
Mikael Berthe <mikael@lilotux.net>
parents: 187
diff changeset
    88
			Width  int     `json:"width"`
0684ddad598c Precise Attachment meta fields
Mikael Berthe <mikael@lilotux.net>
parents: 187
diff changeset
    89
			Height int     `json:"height"`
0684ddad598c Precise Attachment meta fields
Mikael Berthe <mikael@lilotux.net>
parents: 187
diff changeset
    90
		} `json:"small"`
0684ddad598c Precise Attachment meta fields
Mikael Berthe <mikael@lilotux.net>
parents: 187
diff changeset
    91
	} `json:"meta"`
200
67bae6c005d9 Update types wrt current Mastodon API
Mikael Berthe <mikael@lilotux.net>
parents: 196
diff changeset
    92
	Description *string `json:"description"`
10
bb83de52ba5f Adding types.
Ollivier Robert <roberto@keltia.net>
parents: 7
diff changeset
    93
}
17
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
    94
219
98697242c4a0 Update types
Mikael Berthe <mikael@lilotux.net>
parents: 211
diff changeset
    95
// Card represents a Mastodon preview card entity
17
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
    96
type Card struct {
186
eb9e257ba50c Sync types with current Mastodon documentation
Mikael Berthe <mikael@lilotux.net>
parents: 185
diff changeset
    97
	URL          string  `json:"url"`
eb9e257ba50c Sync types with current Mastodon documentation
Mikael Berthe <mikael@lilotux.net>
parents: 185
diff changeset
    98
	Title        string  `json:"title"`
eb9e257ba50c Sync types with current Mastodon documentation
Mikael Berthe <mikael@lilotux.net>
parents: 185
diff changeset
    99
	Description  string  `json:"description"`
eb9e257ba50c Sync types with current Mastodon documentation
Mikael Berthe <mikael@lilotux.net>
parents: 185
diff changeset
   100
	Image        string  `json:"image"`
eb9e257ba50c Sync types with current Mastodon documentation
Mikael Berthe <mikael@lilotux.net>
parents: 185
diff changeset
   101
	Type         *string `json:"type"`
eb9e257ba50c Sync types with current Mastodon documentation
Mikael Berthe <mikael@lilotux.net>
parents: 185
diff changeset
   102
	AuthorName   *string `json:"author_name"`
eb9e257ba50c Sync types with current Mastodon documentation
Mikael Berthe <mikael@lilotux.net>
parents: 185
diff changeset
   103
	AuthorURL    *string `json:"author_url"`
eb9e257ba50c Sync types with current Mastodon documentation
Mikael Berthe <mikael@lilotux.net>
parents: 185
diff changeset
   104
	ProviderName *string `json:"provider_name"`
eb9e257ba50c Sync types with current Mastodon documentation
Mikael Berthe <mikael@lilotux.net>
parents: 185
diff changeset
   105
	ProviderURL  *string `json:"provider_url"`
219
98697242c4a0 Update types
Mikael Berthe <mikael@lilotux.net>
parents: 211
diff changeset
   106
	EmbedURL     *string `json:"embed_url"`
186
eb9e257ba50c Sync types with current Mastodon documentation
Mikael Berthe <mikael@lilotux.net>
parents: 185
diff changeset
   107
	HTML         *string `json:"html"`
eb9e257ba50c Sync types with current Mastodon documentation
Mikael Berthe <mikael@lilotux.net>
parents: 185
diff changeset
   108
	Width        *int    `json:"width"`
eb9e257ba50c Sync types with current Mastodon documentation
Mikael Berthe <mikael@lilotux.net>
parents: 185
diff changeset
   109
	Height       *int    `json:"height"`
70
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   110
}
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   111
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   112
// Context represents a Mastodon context entity
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   113
type Context struct {
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   114
	Ancestors   []Status `json:"ancestors"`
175
2541f5050df3 Fix Descendants spelling
Mikael Berthe <mikael@lilotux.net>
parents: 172
diff changeset
   115
	Descendants []Status `json:"descendants"`
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
200
67bae6c005d9 Update types wrt current Mastodon API
Mikael Berthe <mikael@lilotux.net>
parents: 196
diff changeset
   118
// Emoji represents a Mastodon emoji entity
67bae6c005d9 Update types wrt current Mastodon API
Mikael Berthe <mikael@lilotux.net>
parents: 196
diff changeset
   119
type Emoji struct {
67bae6c005d9 Update types wrt current Mastodon API
Mikael Berthe <mikael@lilotux.net>
parents: 196
diff changeset
   120
	ShortCode       string `json:"shortcode"`
67bae6c005d9 Update types wrt current Mastodon API
Mikael Berthe <mikael@lilotux.net>
parents: 196
diff changeset
   121
	URL             string `json:"url"`
67bae6c005d9 Update types wrt current Mastodon API
Mikael Berthe <mikael@lilotux.net>
parents: 196
diff changeset
   122
	StaticURL       string `json:"static_url"`
67bae6c005d9 Update types wrt current Mastodon API
Mikael Berthe <mikael@lilotux.net>
parents: 196
diff changeset
   123
	VisibleInPicker bool   `json:"visible_in_picker"`
67bae6c005d9 Update types wrt current Mastodon API
Mikael Berthe <mikael@lilotux.net>
parents: 196
diff changeset
   124
}
67bae6c005d9 Update types wrt current Mastodon API
Mikael Berthe <mikael@lilotux.net>
parents: 196
diff changeset
   125
70
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   126
// Error represents a Mastodon error entity
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   127
type Error struct {
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   128
	Text string `json:"error"`
17
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
   129
}
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
   130
70
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   131
// Instance represents a Mastodon instance entity
17
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
   132
type Instance struct {
70
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   133
	URI         string `json:"uri"`
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   134
	Title       string `json:"title"`
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   135
	Description string `json:"description"`
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   136
	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
   137
	Version     string `json:"version"`
196
21519d54dd4c Update types to reflect Mastodon 2.0.0 API changes
Mikael Berthe <mikael@lilotux.net>
parents: 190
diff changeset
   138
21519d54dd4c Update types to reflect Mastodon 2.0.0 API changes
Mikael Berthe <mikael@lilotux.net>
parents: 190
diff changeset
   139
	URLs struct {
21519d54dd4c Update types to reflect Mastodon 2.0.0 API changes
Mikael Berthe <mikael@lilotux.net>
parents: 190
diff changeset
   140
		SteamingAPI string `json:"streaming_api"`
21519d54dd4c Update types to reflect Mastodon 2.0.0 API changes
Mikael Berthe <mikael@lilotux.net>
parents: 190
diff changeset
   141
	} `json:"urls"`
21519d54dd4c Update types to reflect Mastodon 2.0.0 API changes
Mikael Berthe <mikael@lilotux.net>
parents: 190
diff changeset
   142
	Stats struct {
21519d54dd4c Update types to reflect Mastodon 2.0.0 API changes
Mikael Berthe <mikael@lilotux.net>
parents: 190
diff changeset
   143
		UserCount   int64 `json:"user_count"`
21519d54dd4c Update types to reflect Mastodon 2.0.0 API changes
Mikael Berthe <mikael@lilotux.net>
parents: 190
diff changeset
   144
		StatusCount int64 `json:"status_count"`
21519d54dd4c Update types to reflect Mastodon 2.0.0 API changes
Mikael Berthe <mikael@lilotux.net>
parents: 190
diff changeset
   145
		DomainCount int64 `json:"domain_count"`
21519d54dd4c Update types to reflect Mastodon 2.0.0 API changes
Mikael Berthe <mikael@lilotux.net>
parents: 190
diff changeset
   146
	} `json:"stats"`
200
67bae6c005d9 Update types wrt current Mastodon API
Mikael Berthe <mikael@lilotux.net>
parents: 196
diff changeset
   147
	Thumbnail      *string  `json:"thumbnail"`
67bae6c005d9 Update types wrt current Mastodon API
Mikael Berthe <mikael@lilotux.net>
parents: 196
diff changeset
   148
	Languages      []string `json:"languages"`
67bae6c005d9 Update types wrt current Mastodon API
Mikael Berthe <mikael@lilotux.net>
parents: 196
diff changeset
   149
	ContactAccount *Account `json:"contact_account"`
67bae6c005d9 Update types wrt current Mastodon API
Mikael Berthe <mikael@lilotux.net>
parents: 196
diff changeset
   150
}
67bae6c005d9 Update types wrt current Mastodon API
Mikael Berthe <mikael@lilotux.net>
parents: 196
diff changeset
   151
67bae6c005d9 Update types wrt current Mastodon API
Mikael Berthe <mikael@lilotux.net>
parents: 196
diff changeset
   152
// List represents a Mastodon list entity
67bae6c005d9 Update types wrt current Mastodon API
Mikael Berthe <mikael@lilotux.net>
parents: 196
diff changeset
   153
type List struct {
67bae6c005d9 Update types wrt current Mastodon API
Mikael Berthe <mikael@lilotux.net>
parents: 196
diff changeset
   154
	ID    int64  `json:"id,string"`
67bae6c005d9 Update types wrt current Mastodon API
Mikael Berthe <mikael@lilotux.net>
parents: 196
diff changeset
   155
	Title string `json:"title"`
17
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
   156
}
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
   157
70
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   158
// Mention represents a Mastodon mention entity
17
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
   159
type Mention struct {
196
21519d54dd4c Update types to reflect Mastodon 2.0.0 API changes
Mikael Berthe <mikael@lilotux.net>
parents: 190
diff changeset
   160
	ID       int64  `json:"id,string"`
70
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   161
	URL      string `json:"url"`
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   162
	Username string `json:"username"`
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   163
	Acct     string `json:"acct"`
17
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
   164
}
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
   165
70
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   166
// Notification represents a Mastodon notification entity
17
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
   167
type Notification struct {
196
21519d54dd4c Update types to reflect Mastodon 2.0.0 API changes
Mikael Berthe <mikael@lilotux.net>
parents: 190
diff changeset
   168
	ID        int64     `json:"id,string"`
136
1af0a6199a93 Change CreatedAt fields to time.Time
Mikael Berthe <mikael@lilotux.net>
parents: 133
diff changeset
   169
	Type      string    `json:"type"`
1af0a6199a93 Change CreatedAt fields to time.Time
Mikael Berthe <mikael@lilotux.net>
parents: 133
diff changeset
   170
	CreatedAt time.Time `json:"created_at"`
1af0a6199a93 Change CreatedAt fields to time.Time
Mikael Berthe <mikael@lilotux.net>
parents: 133
diff changeset
   171
	Account   *Account  `json:"account"`
1af0a6199a93 Change CreatedAt fields to time.Time
Mikael Berthe <mikael@lilotux.net>
parents: 133
diff changeset
   172
	Status    *Status   `json:"status"`
17
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
   173
}
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
   174
70
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   175
// Relationship represents a Mastodon relationship entity
17
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
   176
type Relationship struct {
219
98697242c4a0 Update types
Mikael Berthe <mikael@lilotux.net>
parents: 211
diff changeset
   177
	ID        int64 `json:"id,string"`
98697242c4a0 Update types
Mikael Berthe <mikael@lilotux.net>
parents: 211
diff changeset
   178
	Following bool  `json:"following"`
98697242c4a0 Update types
Mikael Berthe <mikael@lilotux.net>
parents: 211
diff changeset
   179
	//ShowingReblogs      bool  `json:"showing_reblogs"` // Incoherent type
98697242c4a0 Update types
Mikael Berthe <mikael@lilotux.net>
parents: 211
diff changeset
   180
	FollowedBy          bool `json:"followed_by"`
98697242c4a0 Update types
Mikael Berthe <mikael@lilotux.net>
parents: 211
diff changeset
   181
	Blocking            bool `json:"blocking"`
98697242c4a0 Update types
Mikael Berthe <mikael@lilotux.net>
parents: 211
diff changeset
   182
	Muting              bool `json:"muting"`
98697242c4a0 Update types
Mikael Berthe <mikael@lilotux.net>
parents: 211
diff changeset
   183
	Requested           bool `json:"requested"`
98697242c4a0 Update types
Mikael Berthe <mikael@lilotux.net>
parents: 211
diff changeset
   184
	DomainBlocking      bool `jsin:"domain_blocking"`
98697242c4a0 Update types
Mikael Berthe <mikael@lilotux.net>
parents: 211
diff changeset
   185
	MutingNotifications bool `json:"muting_notifications"`
228
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
   186
	ShowingReblogs      bool `json:"showing_reblogs"`
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
   187
	Endorsed            bool `json:"endorsed"`
17
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
   188
}
70
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   189
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   190
// Report represents a Mastodon report entity
17
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
   191
type Report struct {
196
21519d54dd4c Update types to reflect Mastodon 2.0.0 API changes
Mikael Berthe <mikael@lilotux.net>
parents: 190
diff changeset
   192
	ID          int64  `json:"id,string"`
70
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   193
	ActionTaken string `json:"action_taken"`
17
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
   194
}
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
   195
219
98697242c4a0 Update types
Mikael Berthe <mikael@lilotux.net>
parents: 211
diff changeset
   196
// Results represents a Mastodon search results entity
70
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   197
type Results struct {
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   198
	Accounts []Account `json:"accounts"`
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   199
	Statuses []Status  `json:"statuses"`
236
5b87cc73ed97 Update search result type (us rich tag structure)
Mikael Berthe <mikael@lilotux.net>
parents: 232
diff changeset
   200
	Hashtags []Tag     `json:"hashtags"`
17
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
   201
}
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
   202
70
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   203
// Status represents a Mastodon status entity
17
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
   204
type Status struct {
196
21519d54dd4c Update types to reflect Mastodon 2.0.0 API changes
Mikael Berthe <mikael@lilotux.net>
parents: 190
diff changeset
   205
	ID                 int64        `json:"id,string"`
70
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   206
	URI                string       `json:"uri"`
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   207
	URL                string       `json:"url"`
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   208
	Account            *Account     `json:"account"`
196
21519d54dd4c Update types to reflect Mastodon 2.0.0 API changes
Mikael Berthe <mikael@lilotux.net>
parents: 190
diff changeset
   209
	InReplyToID        *int64       `json:"in_reply_to_id,string"`
21519d54dd4c Update types to reflect Mastodon 2.0.0 API changes
Mikael Berthe <mikael@lilotux.net>
parents: 190
diff changeset
   210
	InReplyToAccountID *int64       `json:"in_reply_to_account_id,string"`
70
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   211
	Reblog             *Status      `json:"reblog"`
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   212
	Content            string       `json:"content"`
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   213
	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
   214
	ReblogsCount       int64        `json:"reblogs_count"`
408aa794d9bb s/int/int64/ for IDs and time integers
Mikael Berthe <mikael@lilotux.net>
parents: 147
diff changeset
   215
	FavouritesCount    int64        `json:"favourites_count"`
228
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
   216
	RepliesCount       int64        `json:"replies_count"`
70
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   217
	Reblogged          bool         `json:"reblogged"`
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   218
	Favourited         bool         `json:"favourited"`
185
faa72b9877c5 Update types (add Muted to Status entity)
Mikael Berthe <mikael@lilotux.net>
parents: 182
diff changeset
   219
	Muted              bool         `json:"muted"`
219
98697242c4a0 Update types
Mikael Berthe <mikael@lilotux.net>
parents: 211
diff changeset
   220
	Pinned             bool         `json:"pinned"`
70
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   221
	Sensitive          bool         `json:"sensitive"`
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   222
	SpoilerText        string       `json:"spoiler_text"`
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   223
	Visibility         string       `json:"visibility"`
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   224
	MediaAttachments   []Attachment `json:"media_attachments"`
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   225
	Mentions           []Mention    `json:"mentions"`
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   226
	Tags               []Tag        `json:"tags"`
200
67bae6c005d9 Update types wrt current Mastodon API
Mikael Berthe <mikael@lilotux.net>
parents: 196
diff changeset
   227
	Emojis             []Emoji      `json:"emojis"`
196
21519d54dd4c Update types to reflect Mastodon 2.0.0 API changes
Mikael Berthe <mikael@lilotux.net>
parents: 190
diff changeset
   228
	Application        *Application `json:"application"`
21519d54dd4c Update types to reflect Mastodon 2.0.0 API changes
Mikael Berthe <mikael@lilotux.net>
parents: 190
diff changeset
   229
	Language           *string      `json:"language"`
17
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
   230
}
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
   231
70
fbc089e7249d Add json tags.
Ollivier Robert <roberto@keltia.net>
parents: 66
diff changeset
   232
// Tag represents a Mastodon tag entity
17
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
   233
type Tag struct {
228
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
   234
	Name    string `json:"name"`
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
   235
	URL     string `json:"url"`
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
   236
	History []struct {
239
ca5639b4768e Introduce new type: MastodonDate
Mikael Berthe <mikael@lilotux.net>
parents: 236
diff changeset
   237
		Day      MastodonDate `json:"day"`
ca5639b4768e Introduce new type: MastodonDate
Mikael Berthe <mikael@lilotux.net>
parents: 236
diff changeset
   238
		Uses     int64        `json:"uses,string"`
ca5639b4768e Introduce new type: MastodonDate
Mikael Berthe <mikael@lilotux.net>
parents: 236
diff changeset
   239
		Accounts int64        `json:"accounts,string"`
228
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
   240
	} `json:"history"`
17
9f17ef336aad Add all types documented.
Ollivier Robert <roberto@keltia.net>
parents: 16
diff changeset
   241
}
221
f9228d1f4267 instance activity: Add a WeekActivity type
Mikael Berthe <mikael@lilotux.net>
parents: 220
diff changeset
   242
f9228d1f4267 instance activity: Add a WeekActivity type
Mikael Berthe <mikael@lilotux.net>
parents: 220
diff changeset
   243
// WeekActivity represents a Mastodon instance activity "week" entity
f9228d1f4267 instance activity: Add a WeekActivity type
Mikael Berthe <mikael@lilotux.net>
parents: 220
diff changeset
   244
type WeekActivity struct {
239
ca5639b4768e Introduce new type: MastodonDate
Mikael Berthe <mikael@lilotux.net>
parents: 236
diff changeset
   245
	Week          MastodonDate `json:"week"`
221
f9228d1f4267 instance activity: Add a WeekActivity type
Mikael Berthe <mikael@lilotux.net>
parents: 220
diff changeset
   246
	Statuses      int64        `json:"statuses,string"`
f9228d1f4267 instance activity: Add a WeekActivity type
Mikael Berthe <mikael@lilotux.net>
parents: 220
diff changeset
   247
	Logins        int64        `json:"logins,string"`
f9228d1f4267 instance activity: Add a WeekActivity type
Mikael Berthe <mikael@lilotux.net>
parents: 220
diff changeset
   248
	Registrations int64        `json:"registrations,string"`
f9228d1f4267 instance activity: Add a WeekActivity type
Mikael Berthe <mikael@lilotux.net>
parents: 220
diff changeset
   249
}
228
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
   250
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
   251
// Field is a single field structure
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
   252
// (Used for the verify_credentials endpoint)
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
   253
type Field struct {
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
   254
	Name  string `json:"name"`
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
   255
	Value string `json:"value"`
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
   256
}
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
   257
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
   258
// SourceParams is a source params structure
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
   259
type SourceParams struct { // Used for verify_credentials
232
de13b1d39099 UpdateAccount: Add support for FieldsAttributes and Source parameters
Mikael Berthe <mikael@lilotux.net>
parents: 228
diff changeset
   260
	Privacy   *string  `json:"privacy,omitempty"`
de13b1d39099 UpdateAccount: Add support for FieldsAttributes and Source parameters
Mikael Berthe <mikael@lilotux.net>
parents: 228
diff changeset
   261
	Language  *string  `json:"language,omitempty"`
de13b1d39099 UpdateAccount: Add support for FieldsAttributes and Source parameters
Mikael Berthe <mikael@lilotux.net>
parents: 228
diff changeset
   262
	Sensitive *bool    `json:"sensitive,omitempty"`
de13b1d39099 UpdateAccount: Add support for FieldsAttributes and Source parameters
Mikael Berthe <mikael@lilotux.net>
parents: 228
diff changeset
   263
	Note      *string  `json:"note,omitempty"`
de13b1d39099 UpdateAccount: Add support for FieldsAttributes and Source parameters
Mikael Berthe <mikael@lilotux.net>
parents: 228
diff changeset
   264
	Fields    *[]Field `json:"fields,omitempty"`
228
21056fc9563e Update Mastodon types
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
   265
}