summaryrefslogtreecommitdiff
path: root/internal/platforms
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-10-24 10:36:17 +0300
committerPaul Buetow <paul@buetow.org>2024-10-24 10:36:17 +0300
commit8b4cd3d9d2af89efdb9b0225742d70edc3483bf4 (patch)
tree6d373a5fc902e766d10eab52f44d2419c14baa1f /internal/platforms
parent9a68ca0461bdf6d093213a218fbf255678018a16 (diff)
refactor
Diffstat (limited to 'internal/platforms')
-rw-r--r--internal/platforms/linkedin/linkedin.go10
-rw-r--r--internal/platforms/mastodon/mastodon.go2
2 files changed, 7 insertions, 5 deletions
diff --git a/internal/platforms/linkedin/linkedin.go b/internal/platforms/linkedin/linkedin.go
index 5f222fa..b6bc3c6 100644
--- a/internal/platforms/linkedin/linkedin.go
+++ b/internal/platforms/linkedin/linkedin.go
@@ -38,11 +38,13 @@ func post(ctx context.Context, args config.Args, sizeLimit int, ent entry.Entry)
if err != nil {
return err
}
- content, err := ent.ContentWithLimit(sizeLimit)
+ content, urls, err := ent.ContentWithLimit(sizeLimit)
if err != nil {
return err
}
- if err := prompt.DoYouWantThis("Do you want to post this message to Linkedin?", content); err != nil {
+
+ question := fmt.Sprintf("Do you want to post this message to Linkedin (URLs: %v)?", urls)
+ if err := prompt.DoYouWantThis(question, content); err != nil {
if errors.Is(err, prompt.ErrEditContent) {
if err := ent.Edit(); err != nil {
return err
@@ -51,10 +53,10 @@ func post(ctx context.Context, args config.Args, sizeLimit int, ent entry.Entry)
}
return err
}
- return callLinkedInAPI(ctx, personID, accessToken, content)
+ return callLinkedInAPI(ctx, personID, accessToken, content, urls)
}
-func callLinkedInAPI(ctx context.Context, personID, accessToken, content string) error {
+func callLinkedInAPI(ctx context.Context, personID, accessToken, content string, urls []string) error {
const url = "https://api.linkedin.com/v2/posts"
post := map[string]interface{}{
diff --git a/internal/platforms/mastodon/mastodon.go b/internal/platforms/mastodon/mastodon.go
index 3da32f4..42700e5 100644
--- a/internal/platforms/mastodon/mastodon.go
+++ b/internal/platforms/mastodon/mastodon.go
@@ -16,7 +16,7 @@ import (
)
func Post(ctx context.Context, args config.Args, sizeLimit int, ent entry.Entry) error {
- content, err := ent.ContentWithLimit(sizeLimit)
+ content, _, err := ent.ContentWithLimit(sizeLimit)
if err != nil {
return err
}