You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

46 lines
966 B

package toot
func (a *TootAttachment) GetDescription () string {
return a.Description
}
func (a *TootAttachment) SetDescription ( d string ) {
a.Description = d
}
func (a *TootAttachment) GetFilename () string {
return a.LocalUrl
}
func (a *TootAttachment) SetFilename ( f string ) {
a.LocalUrl = f
}
func (a *TootAttachment) Post () ( *TootAttachment, error ) {
if len(a.Id) > 0 {
return a.Update()
}
var formData map[string]string = make(map[string]string)
if len(a.Description) > 0 {
formData["description"] = a.Description
}
// TODO: focal points
resp, err := lc.PostFile ("media", formData, "file", a.LocalUrl )
if err != nil {
return nil, err
}
var att TootAttachment
err = lc.DecodeResponse ( resp, &att )
if err != nil {
return nil, err
}
return &att, nil
}
func (a *TootAttachment) Update () ( *TootAttachment, error ) {
return nil, nil
}