Compare commits
No commits in common. "2bb801b6d04c3b760840b0baa7a9592df6d05f85" and "28bf902599205c9e3105fa4cebba9d528533ada2" have entirely different histories.
2bb801b6d0
...
28bf902599
5 changed files with 15 additions and 29 deletions
|
@ -401,10 +401,6 @@ enbas show --type status --status-id 01J1Z9PT0243JT9QNQ5W96Z8CA
|
||||||
```
|
```
|
||||||
enbas create --type status --content-type markdown --visibility private --from-file status.md
|
enbas create --type status --content-type markdown --visibility private --from-file status.md
|
||||||
```
|
```
|
||||||
- Reply to another status.
|
|
||||||
```
|
|
||||||
enbas create --type status --in-reply-to 01J2A86E3M7WWH37H1QENT7CSH --content "@bernie thanks for this! Looking forward to trying this out."
|
|
||||||
```
|
|
||||||
- Create a status with a poll
|
- Create a status with a poll
|
||||||
```
|
```
|
||||||
enbas create \
|
enbas create \
|
||||||
|
@ -432,7 +428,6 @@ enbas show --type status --status-id 01J1Z9PT0243JT9QNQ5W96Z8CA
|
||||||
| `enable-likes` | boolean | false | The status can be liked (favourtied). | true |
|
| `enable-likes` | boolean | false | The status can be liked (favourtied). | true |
|
||||||
| `enable-replies` | boolean | false | The status can be replied to. | true |
|
| `enable-replies` | boolean | false | The status can be replied to. | true |
|
||||||
| `from-file` | string | false | The path to the file where to read the contents of the status from. | |
|
| `from-file` | string | false | The path to the file where to read the contents of the status from. | |
|
||||||
| `in-reply-to` | string | false | The ID of the status that you want to reply to. | |
|
|
||||||
| `language` | string | false | The ISO 639 language code that the status is written in.<br>If this is not specified then the default language from your posting preferences will be used. | |
|
| `language` | string | false | The ISO 639 language code that the status is written in.<br>If this is not specified then the default language from your posting preferences will be used. | |
|
||||||
| `sensitive` | string | false | The status should be marked as sensitive.<br>If this is not specified then the default sensitivity from your posting preferences will be used. | |
|
| `sensitive` | string | false | The status should be marked as sensitive.<br>If this is not specified then the default sensitivity from your posting preferences will be used. | |
|
||||||
| `spoiler-text` | string | false | The text to display as the status' warning or subject. | |
|
| `spoiler-text` | string | false | The text to display as the status' warning or subject. | |
|
||||||
|
|
|
@ -14,11 +14,11 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
baseListPath string = "/api/v1/lists"
|
listPath string = "/api/v1/lists"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetAllLists() ([]model.List, error) {
|
func (g *Client) GetAllLists() ([]model.List, error) {
|
||||||
url := g.Authentication.Instance + baseListPath
|
url := g.Authentication.Instance + listPath
|
||||||
|
|
||||||
var lists []model.List
|
var lists []model.List
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ func (g *Client) GetAllLists() ([]model.List, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Client) GetList(listID string) (model.List, error) {
|
func (g *Client) GetList(listID string) (model.List, error) {
|
||||||
url := g.Authentication.Instance + baseListPath + "/" + listID
|
url := g.Authentication.Instance + listPath + "/" + listID
|
||||||
|
|
||||||
var list model.List
|
var list model.List
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ func (g *Client) CreateList(form CreateListForm) (model.List, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
requestBody := bytes.NewBuffer(data)
|
requestBody := bytes.NewBuffer(data)
|
||||||
url := g.Authentication.Instance + baseListPath
|
url := g.Authentication.Instance + "/api/v1/lists"
|
||||||
|
|
||||||
var list model.List
|
var list model.List
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ func (g *Client) UpdateList(listToUpdate model.List) (model.List, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
requestBody := bytes.NewBuffer(data)
|
requestBody := bytes.NewBuffer(data)
|
||||||
url := g.Authentication.Instance + baseListPath + "/" + listToUpdate.ID
|
url := g.Authentication.Instance + listPath + "/" + listToUpdate.ID
|
||||||
|
|
||||||
var updatedList model.List
|
var updatedList model.List
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ func (g *Client) UpdateList(listToUpdate model.List) (model.List, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Client) DeleteList(listID string) error {
|
func (g *Client) DeleteList(listID string) error {
|
||||||
url := g.Authentication.Instance + baseListPath + "/" + listID
|
url := g.Authentication.Instance + "/api/v1/lists/" + listID
|
||||||
|
|
||||||
return g.sendRequest(http.MethodDelete, url, nil, nil)
|
return g.sendRequest(http.MethodDelete, url, nil, nil)
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ func (g *Client) AddAccountsToList(listID string, accountIDs []string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
requestBody := bytes.NewBuffer(data)
|
requestBody := bytes.NewBuffer(data)
|
||||||
url := g.Authentication.Instance + baseListPath + "/" + listID + "/accounts"
|
url := g.Authentication.Instance + listPath + "/" + listID + "/accounts"
|
||||||
|
|
||||||
if err := g.sendRequest(http.MethodPost, url, requestBody, nil); err != nil {
|
if err := g.sendRequest(http.MethodPost, url, requestBody, nil); err != nil {
|
||||||
return fmt.Errorf(
|
return fmt.Errorf(
|
||||||
|
@ -146,7 +146,7 @@ func (g *Client) RemoveAccountsFromList(listID string, accountIDs []string) erro
|
||||||
}
|
}
|
||||||
|
|
||||||
requestBody := bytes.NewBuffer(data)
|
requestBody := bytes.NewBuffer(data)
|
||||||
url := g.Authentication.Instance + baseListPath + "/" + listID + "/accounts"
|
url := g.Authentication.Instance + listPath + "/" + listID + "/accounts"
|
||||||
|
|
||||||
if err := g.sendRequest(http.MethodDelete, url, requestBody, nil); err != nil {
|
if err := g.sendRequest(http.MethodDelete, url, requestBody, nil); err != nil {
|
||||||
return fmt.Errorf(
|
return fmt.Errorf(
|
||||||
|
@ -159,7 +159,7 @@ func (g *Client) RemoveAccountsFromList(listID string, accountIDs []string) erro
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Client) GetAccountsFromList(listID string, limit int) ([]model.Account, error) {
|
func (g *Client) GetAccountsFromList(listID string, limit int) ([]model.Account, error) {
|
||||||
path := fmt.Sprintf("%s/%s/accounts?limit=%d", baseListPath, listID, limit)
|
path := fmt.Sprintf("%s/%s/accounts?limit=%d", listPath, listID, limit)
|
||||||
url := g.Authentication.Instance + path
|
url := g.Authentication.Instance + path
|
||||||
|
|
||||||
var accounts []model.Account
|
var accounts []model.Account
|
||||||
|
|
|
@ -13,12 +13,8 @@ import (
|
||||||
"codeflow.dananglin.me.uk/apollo/enbas/internal/model"
|
"codeflow.dananglin.me.uk/apollo/enbas/internal/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
baseStatusesPath string = "/api/v1/statuses"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (g *Client) GetStatus(statusID string) (model.Status, error) {
|
func (g *Client) GetStatus(statusID string) (model.Status, error) {
|
||||||
path := baseStatusesPath + "/" + statusID
|
path := "/api/v1/statuses/" + statusID
|
||||||
url := g.Authentication.Instance + path
|
url := g.Authentication.Instance + path
|
||||||
|
|
||||||
var status model.Status
|
var status model.Status
|
||||||
|
@ -35,7 +31,6 @@ func (g *Client) GetStatus(statusID string) (model.Status, error) {
|
||||||
|
|
||||||
type CreateStatusForm struct {
|
type CreateStatusForm struct {
|
||||||
Content string `json:"status"`
|
Content string `json:"status"`
|
||||||
InReplyTo string `json:"in_reply_to_id"`
|
|
||||||
Language string `json:"language"`
|
Language string `json:"language"`
|
||||||
SpoilerText string `json:"spoiler_text"`
|
SpoilerText string `json:"spoiler_text"`
|
||||||
Boostable bool `json:"boostable"`
|
Boostable bool `json:"boostable"`
|
||||||
|
@ -62,7 +57,7 @@ func (g *Client) CreateStatus(form CreateStatusForm) (model.Status, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
requestBody := bytes.NewBuffer(data)
|
requestBody := bytes.NewBuffer(data)
|
||||||
url := g.Authentication.Instance + baseStatusesPath
|
url := g.Authentication.Instance + "/api/v1/statuses"
|
||||||
|
|
||||||
var status model.Status
|
var status model.Status
|
||||||
|
|
||||||
|
@ -124,7 +119,7 @@ func (g *Client) RemoveStatusFromBookmarks(statusID string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Client) LikeStatus(statusID string) error {
|
func (g *Client) LikeStatus(statusID string) error {
|
||||||
url := g.Authentication.Instance + baseStatusesPath + "/" + statusID + "/favourite"
|
url := g.Authentication.Instance + "/api/v1/statuses/" + statusID + "/favourite"
|
||||||
|
|
||||||
if err := g.sendRequest(http.MethodPost, url, nil, nil); err != nil {
|
if err := g.sendRequest(http.MethodPost, url, nil, nil); err != nil {
|
||||||
return fmt.Errorf(
|
return fmt.Errorf(
|
||||||
|
@ -137,7 +132,7 @@ func (g *Client) LikeStatus(statusID string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Client) UnlikeStatus(statusID string) error {
|
func (g *Client) UnlikeStatus(statusID string) error {
|
||||||
url := g.Authentication.Instance + baseStatusesPath + "/" + statusID + "/unfavourite"
|
url := g.Authentication.Instance + "/api/v1/statuses/" + statusID + "/unfavourite"
|
||||||
|
|
||||||
if err := g.sendRequest(http.MethodPost, url, nil, nil); err != nil {
|
if err := g.sendRequest(http.MethodPost, url, nil, nil); err != nil {
|
||||||
return fmt.Errorf(
|
return fmt.Errorf(
|
||||||
|
@ -168,7 +163,7 @@ func (g *Client) GetLikedStatuses(limit int, resourceName string) (model.StatusL
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Client) ReblogStatus(statusID string) error {
|
func (g *Client) ReblogStatus(statusID string) error {
|
||||||
url := g.Authentication.Instance + baseStatusesPath + "/" + statusID + "/reblog"
|
url := g.Authentication.Instance + "/api/v1/statuses/" + statusID + "/reblog"
|
||||||
|
|
||||||
if err := g.sendRequest(http.MethodPost, url, nil, nil); err != nil {
|
if err := g.sendRequest(http.MethodPost, url, nil, nil); err != nil {
|
||||||
return fmt.Errorf(
|
return fmt.Errorf(
|
||||||
|
@ -181,7 +176,7 @@ func (g *Client) ReblogStatus(statusID string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Client) UnreblogStatus(statusID string) error {
|
func (g *Client) UnreblogStatus(statusID string) error {
|
||||||
url := g.Authentication.Instance + baseStatusesPath + "/" + statusID + "/unreblog"
|
url := g.Authentication.Instance + "/api/v1/statuses/" + statusID + "/unreblog"
|
||||||
|
|
||||||
if err := g.sendRequest(http.MethodPost, url, nil, nil); err != nil {
|
if err := g.sendRequest(http.MethodPost, url, nil, nil); err != nil {
|
||||||
return fmt.Errorf(
|
return fmt.Errorf(
|
||||||
|
|
|
@ -32,7 +32,6 @@ type CreateExecutor struct {
|
||||||
content string
|
content string
|
||||||
contentType string
|
contentType string
|
||||||
fromFile string
|
fromFile string
|
||||||
inReplyTo string
|
|
||||||
language string
|
language string
|
||||||
resourceType string
|
resourceType string
|
||||||
listTitle string
|
listTitle string
|
||||||
|
@ -59,7 +58,6 @@ func NewCreateExecutor(printer *printer.Printer, config *config.Config, name, su
|
||||||
createExe.StringVar(&createExe.contentType, flagContentType, "plain", "The type that the contents should be parsed from (valid values are plain and markdown)")
|
createExe.StringVar(&createExe.contentType, flagContentType, "plain", "The type that the contents should be parsed from (valid values are plain and markdown)")
|
||||||
createExe.BoolVar(&createExe.federated, flagEnableFederation, true, "Specify if the status can be federated beyond the local timelines")
|
createExe.BoolVar(&createExe.federated, flagEnableFederation, true, "Specify if the status can be federated beyond the local timelines")
|
||||||
createExe.StringVar(&createExe.fromFile, flagFromFile, "", "The file path where to read the contents from")
|
createExe.StringVar(&createExe.fromFile, flagFromFile, "", "The file path where to read the contents from")
|
||||||
createExe.StringVar(&createExe.inReplyTo, flagInReplyTo, "", "The ID of the status that you want to reply to")
|
|
||||||
createExe.StringVar(&createExe.language, flagLanguage, "", "The ISO 639 language code for this status")
|
createExe.StringVar(&createExe.language, flagLanguage, "", "The ISO 639 language code for this status")
|
||||||
createExe.BoolVar(&createExe.likeable, flagEnableLikes, true, "Specify if the status can be liked/favourited")
|
createExe.BoolVar(&createExe.likeable, flagEnableLikes, true, "Specify if the status can be liked/favourited")
|
||||||
createExe.BoolVar(&createExe.replyable, flagEnableReplies, true, "Specify if the status can be replied to")
|
createExe.BoolVar(&createExe.replyable, flagEnableReplies, true, "Specify if the status can be replied to")
|
||||||
|
@ -206,7 +204,6 @@ func (c *CreateExecutor) createStatus(gtsClient *client.Client) error {
|
||||||
SpoilerText: c.spoilerText,
|
SpoilerText: c.spoilerText,
|
||||||
Boostable: c.boostable,
|
Boostable: c.boostable,
|
||||||
Federated: c.federated,
|
Federated: c.federated,
|
||||||
InReplyTo: c.inReplyTo,
|
|
||||||
Likeable: c.likeable,
|
Likeable: c.likeable,
|
||||||
Replyable: c.replyable,
|
Replyable: c.replyable,
|
||||||
Sensitive: sensitive,
|
Sensitive: sensitive,
|
||||||
|
|
|
@ -25,7 +25,6 @@ const (
|
||||||
flagFrom = "from"
|
flagFrom = "from"
|
||||||
flagFromFile = "from-file"
|
flagFromFile = "from-file"
|
||||||
flagFull = "full"
|
flagFull = "full"
|
||||||
flagInReplyTo = "in-reply-to"
|
|
||||||
flagInstance = "instance"
|
flagInstance = "instance"
|
||||||
flagLanguage = "language"
|
flagLanguage = "language"
|
||||||
flagLimit = "limit"
|
flagLimit = "limit"
|
||||||
|
|
Loading…
Reference in a new issue