refining some serialization
This commit is contained in:
parent
1025ac31aa
commit
9eb8878e94
@ -109,5 +109,5 @@ func (m *appModule) appsPOSTHandler(c *gin.Context) {
|
||||
}
|
||||
|
||||
// done, return the new app information per the spec here: https://docs.joinmastodon.org/methods/apps/
|
||||
c.JSON(http.StatusOK, app.ToMasto())
|
||||
c.JSON(http.StatusOK, app.ToMastoSensitive())
|
||||
}
|
||||
|
@ -41,8 +41,8 @@ type Application struct {
|
||||
VapidKey string
|
||||
}
|
||||
|
||||
// ToMasto returns this application as a mastodon api type, ready for serialization
|
||||
func (a *Application) ToMasto() *mastotypes.Application {
|
||||
// ToMastoSensitive returns this application as a mastodon api type, ready for serialization
|
||||
func (a *Application) ToMastoSensitive() *mastotypes.Application {
|
||||
return &mastotypes.Application{
|
||||
ID: a.ID,
|
||||
Name: a.Name,
|
||||
@ -53,3 +53,10 @@ func (a *Application) ToMasto() *mastotypes.Application {
|
||||
VapidKey: a.VapidKey,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *Application) ToMastoPublic() *mastotypes.Application {
|
||||
return &mastotypes.Application{
|
||||
Name: a.Name,
|
||||
Website: a.Website,
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ type Account struct {
|
||||
// When a timed mute will expire, if applicable. (ISO 8601 Datetime)
|
||||
MuteExpiresAt string `json:"mute_expires_at,omitempty"`
|
||||
// An extra entity to be used with API methods to verify credentials and update credentials.
|
||||
Source *Source `json:"source"`
|
||||
Source *Source `json:"source,omitempty"`
|
||||
}
|
||||
|
||||
// AccountCreateRequest represents the form submitted during a POST request to /api/v1/accounts.
|
||||
|
@ -35,7 +35,7 @@ type Application struct {
|
||||
// Client secret to use when obtaining an auth token for this application (ie., in client_secret parameter of https://docs.joinmastodon.org/methods/apps/)
|
||||
ClientSecret string `json:"client_secret,omitempty"`
|
||||
// Used for Push Streaming API. Returned with POST /api/v1/apps. Equivalent to https://docs.joinmastodon.org/entities/pushsubscription/#server_key
|
||||
VapidKey string `json:"vapid_key"`
|
||||
VapidKey string `json:"vapid_key,omitempty"`
|
||||
}
|
||||
|
||||
// ApplicationPOSTRequest represents a POST request to https://example.org/api/v1/apps.
|
||||
|
Loading…
Reference in New Issue
Block a user