summaryrefslogtreecommitdiff
path: root/qkbox/toot.scm
diff options
context:
space:
mode:
authorMasaya Tojo <masaya@tojo.tokyo>2020-07-08 10:03:09 +0900
committerMasaya Tojo <masaya@tojo.tokyo>2020-07-08 10:03:09 +0900
commit6ded583d3df053144f0b9e3087ec4bd3ad45c12f (patch)
tree89d8ccbb3141850f937cb328108d70face010063 /qkbox/toot.scm
parentdffe134e13b93f05ea515b6359d6edc0b2374f0b (diff)
qkbox: toot: Update post-json procedure.
* qkbox/toot.scm[post-json]: Add authorization? keyword.
Diffstat (limited to 'qkbox/toot.scm')
-rw-r--r--qkbox/toot.scm21
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))