mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2025-05-10 13:58:46 +00:00
Feature: Bare bones Editing implimented
This commit is contained in:
parent
4df1f096be
commit
53353c0e64
5 changed files with 16 additions and 6 deletions
|
@ -260,6 +260,7 @@ func (c *Client) GetAccessToken(ctx context.Context) string {
|
|||
|
||||
// Toot is struct to post status.
|
||||
type Toot struct {
|
||||
Edit string `json:"id"`
|
||||
Status string `json:"status"`
|
||||
InReplyToID string `json:"in_reply_to_id"`
|
||||
MediaIDs []string `json:"media_ids"`
|
||||
|
|
|
@ -333,10 +333,16 @@ func (c *Client) PostStatus(ctx context.Context, toot *Toot) (*Status, error) {
|
|||
params.Set("content_type", toot.ContentType)
|
||||
}
|
||||
var status Status
|
||||
err := c.doAPI(ctx, http.MethodPost, "/api/v1/statuses", params, &status, nil)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
if toot.Edit != "" {
|
||||
err := c.doAPI(ctx, http.MethodPut, fmt.Sprintf("/api/v1/statuses/%s", toot.Edit), params, &status, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
err := c.doAPI(ctx, http.MethodPost, "/api/v1/statuses", params, &status, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return &status, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue