diff options
author | Masaya Tojo <masaya@tojo.tokyo> | 2020-07-13 04:48:14 +0900 |
---|---|---|
committer | Masaya Tojo <masaya@tojo.tokyo> | 2020-07-13 04:48:32 +0900 |
commit | 2fcc69933845adf50220051005729702ae8b0f67 (patch) | |
tree | 6ced89c7a8b3d38b9c0123d88de5d3da3f2b3b52 | |
parent | 14e44e2eb79c086cdff90e56b21888b36adb03be (diff) |
qkbox: toot: Rename api procedure names.
-rw-r--r-- | qkbox/toot.scm | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/qkbox/toot.scm b/qkbox/toot.scm index 70c97b8..aa8bd8f 100644 --- a/qkbox/toot.scm +++ b/qkbox/toot.scm @@ -66,24 +66,24 @@ sensitive? reply-to) (receive (res body) - (/api/v1/statuses #:status text - #:spoiler-text spoiler-text - #:visibility visibility - #:sensitive? sensitive? - #:reply-to reply-to) + (post-/api/v1/statuses #:status text + #:spoiler-text spoiler-text + #:visibility visibility + #:sensitive? sensitive? + #:reply-to reply-to) (case (response-code res) ((200) (assoc-ref body "id")) (else (error "post: failed" res body))))) -(define* (/api/v1/statuses #:key - status - spoiler-text - visibility - sensitive? - reply-to - media-ids) +(define* (post-/api/v1/statuses #:key + status + spoiler-text + visibility + sensitive? + reply-to + media-ids) (request 'POST "/api/v1/statuses" @@ -482,13 +482,13 @@ (define*-public (fetch-status id #:key (authorization? #t)) (receive (res body) - (/api/v1/statuses/:id id #:authorization? authorization?) + (get-/api/v1/statuses/:id id #:authorization? authorization?) (case (response-code res) ((200) (make-status body)) (else (error "fetch-status: failed" res body))))) -(define* (/api/v1/statuses/:id id #:key (authorization? #t)) +(define* (get-/api/v1/statuses/:id id #:key (authorization? #t)) (request 'GET (format #f "/api/v1/statuses/~a" id) @@ -496,11 +496,11 @@ (define*-public (fetch-home-timeline #:key max-id since-id min-id limit local?) (receive (res body) - (/api/v1/timelines/home #:max-id max-id - #:since-id since-id - #:min-id min-id - #:limit limit - #:local? local?) + (get-/api/v1/timelines/home #:max-id max-id + #:since-id since-id + #:min-id min-id + #:limit limit + #:local? local?) (case (response-code res) ((200) (map make-status (vector->list body))) @@ -511,20 +511,20 @@ (define*-public (fetch-public-timeline #:key max-id since-id min-id limit local? remote? only-media?) (receive (res body) - (/api/v1/timelines/public #:max-id max-id - #:since-id since-id - #:min-id min-id - #:limit limit - #:local? local? - #:remote? remote? - #:only-media? only-media?) + (get-/api/v1/timelines/public #:max-id max-id + #:since-id since-id + #:min-id min-id + #:limit limit + #:local? local? + #:remote? remote? + #:only-media? only-media?) (case (response-code res) ((200) (map make-status (vector->list body))) (else (error "fetch-public-timeline: failed" res body))))) -(define* (/api/v1/timelines/home #:key max-id since-id min-id limit local?) +(define* (get-/api/v1/timelines/home #:key max-id since-id min-id limit local?) (request 'GET "/api/v1/timelines/home" @@ -536,7 +536,7 @@ ,@(and/nil local? `((local . ,local?)))) #:authorization? #t)) -(define* (/api/v1/timelines/public #:key max-id since-id min-id limit local? remote? only-media?) +(define* (get-/api/v1/timelines/public #:key max-id since-id min-id limit local? remote? only-media?) (request 'GET "/api/v1/timelines/public" @@ -552,13 +552,13 @@ (define-public (favourite id) (define-values (res body) - (/api/v1/statuses/:id/favourite id)) + (get-/api/v1/statuses/:id/favourite id)) (case (response-code res) ((200) #t) (else (error "favourite: failed" res body)))) -(define (/api/v1/statuses/:id/favourite id) +(define (get-/api/v1/statuses/:id/favourite id) (request 'POST (format #f "/api/v1/statuses/~a/favourite" id) @@ -566,13 +566,13 @@ (define-public (unfavourite id) (define-values (res body) - (/api/v1/statuses/:id/unfavourite id)) + (get-/api/v1/statuses/:id/unfavourite id)) (case (response-code res) ((200) #t) (else (error "unfavourite: failed" res body)))) -(define (/api/v1/statuses/:id/unfavourite id) +(define (get-/api/v1/statuses/:id/unfavourite id) (request 'POST (format #f "/api/v1/statuses/~a/unfavourite" id) @@ -580,13 +580,13 @@ (define-public (reblog id) (define-values (res body) - (/api/v1/statuses/:id/reblog id)) + (get-/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) +(define (get-/api/v1/statuses/:id/reblog id) (request 'POST (format #f "/api/v1/statuses/~a/reblog" id) @@ -594,13 +594,13 @@ (define-public (unreblog id) (define-values (res body) - (/api/v1/statuses/:id/unreblog id)) + (get-/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) +(define (get-/api/v1/statuses/:id/unreblog id) (request 'POST (format #f "/api/v1/statuses/~a/unreblog" id) @@ -642,7 +642,7 @@ (define*-public (fetch-account id) (receive (res body) - (/api/v1/accounts/:id id) + (get-/api/v1/accounts/:id id) (case (response-code res) ((200) (make-account body)) ((401) @@ -656,14 +656,14 @@ (response-code res) (utf8->string body)))))) -(define* (/api/v1/accounts/:id id) +(define* (get-/api/v1/accounts/:id id) (request 'GET (format #f "/api/v1/accounts/~a" id))) (define (streaming-health?) (receive (res body) - (/api/v1/streaming/health) + (get-/api/v1/streaming/health) (case (response-code res) ((200) (let ((result (utf8->string (get-bytevector-all body)))) @@ -672,7 +672,7 @@ (else #f)))) -(define (/api/v1/streaming/health) +(define (get-/api/v1/streaming/health) (raw-request 'GET "/api/v1/streaming/health" #:streaming? #t)) (define (utf8-read-line in) @@ -707,37 +707,37 @@ (substring line (+ i 1)))))))))) (define (streaming-user handler) - (streaming /api/v1/streaming/user handler)) + (streaming get-/api/v1/streaming/user handler)) (define* (streaming-public handler #:key only-media?) (streaming (if only-media? - /api/v1/streaming/public - /api/v1/streaming/public?only_media=true) + get-/api/v1/streaming/public + get-/api/v1/streaming/public?only_media=true) handler)) (define* (streaming-local handler #:key only-media?) (streaming (if only-media? - /api/v1/streaming/local - /api/v1/streaming/local?only_media=true) + get-/api/v1/streaming/local + get-/api/v1/streaming/local?only_media=true) handler)) (define (streaming-hashtag hashtag handler) (streaming (lambda () - (/api/v1/streaming/hashtag?tag=:hashtag hashtag)) + (get-/api/v1/streaming/hashtag?tag=:hashtag hashtag)) handler)) (define (streaming-local-hashtag hashtag handler) (streaming (lambda () - (/api/v1/streaming/hashtag/local?tag=:hashtag hashtag)) + (get-/api/v1/streaming/hashtag/local?tag=:hashtag hashtag)) handler)) (define (streaming-list list-id handler) (streaming (lambda () - (/api/v1/streaming/list?list=:list_id list-id)) + (get-/api/v1/streaming/list?list=:list_id list-id)) handler)) (define* (streaming-direct handler) - (streaming /api/v1/streaming/direct handler)) + (streaming get-/api/v1/streaming/direct handler)) (define (streaming streamer handler) (receive (res body) @@ -776,44 +776,44 @@ (close-input-port body)))) (else #f)))) -(define (/api/v1/streaming/user) +(define (get-/api/v1/streaming/user) (raw-request 'GET "/api/v1/streaming/user" #:streaming? #t #:authorization? #t)) -(define (/api/v1/streaming/public) +(define (get-/api/v1/streaming/public) (raw-request 'GET "/api/v1/streaming/public" #:streaming? #t)) -(define (/api/v1/streaming/public?only_media=true) +(define (get-/api/v1/streaming/public?only_media=true) (raw-request 'GET "/api/v1/streaming/public?only_media=true" #:streaming? #t)) -(define (/api/v1/streaming/local) +(define (get-/api/v1/streaming/local) (raw-request 'GET "/api/v1/streaming/local" #:streaming? #t)) -(define (/api/v1/streaming/local?only_media=true) +(define (get-/api/v1/streaming/local?only_media=true) (raw-request 'GET "/api/v1/streaming/local?only_media=true" #:streaming? #t)) -(define (/api/v1/streaming/hashtag?tag=:hashtag hashtag) +(define (get-/api/v1/streaming/hashtag?tag=:hashtag hashtag) (raw-request 'GET (format #f "/api/v1/streaming/hashtag?tag=~a" hashtag) #:streaming? #t)) -(define (/api/v1/streaming/hashtag/local?tag=:hashtag hashtag) +(define (get-/api/v1/streaming/hashtag/local?tag=:hashtag hashtag) (raw-request 'GET (format #f "/api/v1/streaming/hashtag/local?tag=~a" hashtag) #:streaming? #t)) -(define (/api/v1/streaming/list?list=:list_id hashtag) +(define (get-/api/v1/streaming/list?list=:list_id hashtag) (raw-request 'GET (format #f "/api/v1/streaming/list?list=~a" hashtag) #:streaming? #t #:authorization? #t)) -(define (/api/v1/streaming/direct) +(define (get-/api/v1/streaming/direct) (raw-request 'GET "/api/v1/streaming/direct" #:streaming? #t |