diff options
author | Masaya Tojo <masaya@tojo.tokyo> | 2020-07-08 10:51:04 +0900 |
---|---|---|
committer | Masaya Tojo <masaya@tojo.tokyo> | 2020-07-08 10:51:04 +0900 |
commit | 29c5cc5909ddd9845a701e2d9eec383bc627f152 (patch) | |
tree | 584f3be92467a4597df1b65d098f0b1947a476ef /qkbox | |
parent | 9a63f2aebc1a1d15c04915cd27ee72027768d116 (diff) |
qkbox: toot: Add reblog and unreblog procedures.
Diffstat (limited to 'qkbox')
-rw-r--r-- | qkbox/toot.scm | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/qkbox/toot.scm b/qkbox/toot.scm index 0ccad60..7b12487 100644 --- a/qkbox/toot.scm +++ b/qkbox/toot.scm @@ -100,7 +100,6 @@ ,@(if local? `((local . ,local?)) '())) #:authorization? #t)) - (define (favourite id) (define-values (res body) (/api/v1/statuses/:id/favourite id)) @@ -129,6 +128,34 @@ (format #f "/api/v1/statuses/~a/unfavourite" id) #:authorization? #t)) +(define (reblog id) + (define-values (res body) + (/api/v1/statuses/:id/reblog id)) + (case (response-code res) + ((200) #t) + (else + (error "reblog: failed" res body)))) + +(define (/api/v1/statuses/:id/reblog id) + (request + 'POST + (format #f "/api/v1/statuses/~a/reblog" id) + #:authorization? #t)) + +(define (unreblog id) + (define-values (res body) + (/api/v1/statuses/:id/unreblog id)) + (case (response-code res) + ((200) #t) + (else + (error "unreblog: failed" res body)))) + +(define (/api/v1/statuses/:id/unreblog id) + (request + 'POST + (format #f "/api/v1/statuses/~a/unreblog" id) + #:authorization? #t)) + (define* (request method path #:key json authorization?) (define-values (res body) (http-request (string-append "https://" |