diff options
Diffstat (limited to 'qkbox')
| -rw-r--r-- | qkbox/toot.scm | 21 | 
1 files changed, 12 insertions, 9 deletions
| diff --git a/qkbox/toot.scm b/qkbox/toot.scm index 122e1bf..796d9c1 100644 --- a/qkbox/toot.scm +++ b/qkbox/toot.scm @@ -42,8 +42,8 @@     "/api/v1/statuses"     `(,@(if status             `((status . ,(if (string? status) -                             status -                             (format #f "~y" status)))) +                            status +                            (format #f "~y" status))))             '())       ,@(if spoiler-text             `((spoiler_text . ,spoiler-text)) @@ -62,19 +62,22 @@             '())       ,@(if media-ids             `((media_ids . ,(list->vector (map number->string media-ids)))) -           '())))) +           '())) +   #:authorization? #t)) -(define (post-json path json) +(define* (post-json path json #:key authorization?)    (define-values (res body)      (http-post (string-append "https://"                                (current-mastodon-host)                                path)                 #:headers `((content-type application/json) -                           (authorization -                            ,(string->symbol -                              (string-append -                               "Bearer " -                               (current-mastodon-access-token))))) +                           ,@(if authorization? +                                 `((authorization +                                     ,(string->symbol +                                       (string-append +                                        "Bearer " +                                        (current-mastodon-access-token))))) +                                 '()))                 #:decode-body? #t                 #:body (scm->json-string json)))    (if (= 200 (response-code res)) | 
