From 29c5cc5909ddd9845a701e2d9eec383bc627f152 Mon Sep 17 00:00:00 2001 From: Masaya Tojo Date: Wed, 8 Jul 2020 10:51:04 +0900 Subject: qkbox: toot: Add reblog and unreblog procedures. --- qkbox/toot.scm | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) 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://" -- cgit v1.2.3