blob: f8baa8ef4fb39a7511a4523859c78d876665e33d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
;;;; DO NOT EDIT! THIS FILE HAS BEEN GENERATED BY LAZYBONES-CLIENT
(defpackage #:ONELINERS.API-CLIENT
(:use :cl)
(:export
#:get-oneliners
#:get-oneliners/all-flagged
#:get-oneliners/newest
#:put-oneliner/entry/flag
#:get-oneliner/entry
#:patch-oneliner/entry/edit
#:put-oneliner/oneliner/locked
#:post-oneliner
#:delete-oneliner/oneliner
#:post-invite
#:delete-access/access
#:post-access
#:post-invite/redeem/code
#:put-contributor/who/signature
#:put-contributor/who/password
#:put-contributor/who/locked
#:get-contributor/who
#:post-snapshot))
(in-package :ONELINERS.API-CLIENT)
(defun get-oneliners
(TAGS LIMIT NOTFLAGGED %host &key %headers %cookies)
"A search endpoint returning a JSON encoded array of Oneliner
Entries. TAGS cannot be empty. Returns a [Search
Result](#search-result) object."
(dexador:get
(format nil "~a/api/oneliners?~@[TAGS=~a~]~@[&LIMIT=~a~]~@[&NOTFLAGGED=~a~]" %host TAGS LIMIT NOTFLAGGED)
:cookie-jar %cookies
:headers %headers))
(defun get-oneliners/all-flagged
(LIMIT %host &key %headers %cookies)
"A search endpoint returning all of the flagged oneliners. If LIMIT
is present, only that many are returned."
(dexador:get
(format nil "~a/api/oneliners/all-flagged?~@[LIMIT=~a~]" %host LIMIT)
:cookie-jar %cookies
:headers %headers))
(defun get-oneliners/newest
(LIMIT %host &key %headers %cookies)
"A search endpoint returning the LIMIT newest oneliners."
(dexador:get
(format nil "~a/api/oneliners/newest?~@[LIMIT=~a~]" %host LIMIT)
:cookie-jar %cookies
:headers %headers))
(defun put-oneliner/entry/flag
(ENTRY TOKEN VALUE %host &key %content-type %body %headers %cookies)
"Flag / Unflag the oneliner for review."
(dexador:put
(format nil "~a/api/oneliner/~a/flag?~@[TOKEN=~a~]~@[&VALUE=~a~]" %host ENTRY TOKEN VALUE)
:content %body
:cookie-jar %cookies
:headers (if %content-type (cons (cons "Content-Type" %content-type) %headers) %headers)))
(defun get-oneliner/entry
(ENTRY %host &key %headers %cookies)
"Gets a oneliner by id."
(dexador:get
(format nil "~a/api/oneliner/~a?" %host ENTRY )
:cookie-jar %cookies
:headers %headers))
(defun patch-oneliner/entry/edit
(ENTRY TOKEN %host &key %content-type %body %headers %cookies)
"Edit the fields of a oneliner."
(dexador:patch
(format nil "~a/api/oneliner/~a/edit?~@[TOKEN=~a~]" %host ENTRY TOKEN)
:content %body
:cookie-jar %cookies
:headers (if %content-type (cons (cons "Content-Type" %content-type) %headers) %headers)))
(defun put-oneliner/oneliner/locked
(ONELINER TOKEN VALUE %host &key %content-type %body %headers %cookies)
"Sets the locked value of the specified oneliner"
(dexador:put
(format nil "~a/api/oneliner/~a/locked?~@[TOKEN=~a~]~@[&VALUE=~a~]" %host ONELINER TOKEN VALUE)
:content %body
:cookie-jar %cookies
:headers (if %content-type (cons (cons "Content-Type" %content-type) %headers) %headers)))
(defun post-oneliner
(TOKEN %host &key %content-type %body %headers %cookies)
"Make a new [oneliner](#oneliner)."
(dexador:post
(format nil "~a/api/oneliner?~@[TOKEN=~a~]" %host TOKEN)
:content %body
:cookie-jar %cookies
:headers (if %content-type (cons (cons "Content-Type" %content-type) %headers) %headers)))
(defun delete-oneliner/oneliner
(ONELINER TOKEN %host &key %headers %cookies)
"Delete a oneliner."
(dexador:delete
(format nil "~a/api/oneliner/~a?~@[TOKEN=~a~]" %host ONELINER TOKEN)
:cookie-jar %cookies
:headers %headers))
(defun post-invite
(TOKEN %host &key %content-type %body %headers %cookies)
"On success, return an object containing a new [invite token](#invite-token)."
(dexador:post
(format nil "~a/api/invite?~@[TOKEN=~a~]" %host TOKEN)
:content %body
:cookie-jar %cookies
:headers (if %content-type (cons (cons "Content-Type" %content-type) %headers) %headers)))
(defun delete-access/access
(ACCESS TOKEN %host &key %headers %cookies)
"Revoke access of CONTRIBUTOR"
(dexador:delete
(format nil "~a/api/access/~a?~@[TOKEN=~a~]" %host ACCESS TOKEN)
:cookie-jar %cookies
:headers %headers))
(defun post-access
( %host &key %content-type %body %headers %cookies)
"Authenticate a contributor and reply with an [API token](#access-token)"
(dexador:post
(format nil "~a/api/access?" %host )
:content %body
:cookie-jar %cookies
:headers (if %content-type (cons (cons "Content-Type" %content-type) %headers) %headers)))
(defun post-invite/redeem/code
(CODE %host &key %content-type %body %headers %cookies)
"Redeem an [invite code](#invite-code) and create a new [contributor](#new-contributor-post-body)"
(dexador:post
(format nil "~a/api/invite/redeem/~a?" %host CODE )
:content %body
:cookie-jar %cookies
:headers (if %content-type (cons (cons "Content-Type" %content-type) %headers) %headers)))
(defun put-contributor/who/signature
(WHO TOKEN %host &key %content-type %body %headers %cookies)
"Update a [contributor's](#contributor) signature."
(dexador:put
(format nil "~a/api/contributor/~a/signature?~@[TOKEN=~a~]" %host WHO TOKEN)
:content %body
:cookie-jar %cookies
:headers (if %content-type (cons (cons "Content-Type" %content-type) %headers) %headers)))
(defun put-contributor/who/password
(WHO VALUE REPEATED CURRENT TOKEN %host &key %content-type %body %headers %cookies)
"Change a contributor's password. CURRENT is the current
password. VALUE is the new password. REPEATED must match VALUE. TOKEN
is an API Access token."
(dexador:put
(format nil "~a/api/contributor/~a/password?~@[VALUE=~a~]~@[&REPEATED=~a~]~@[&CURRENT=~a~]~@[&TOKEN=~a~]" %host WHO VALUE REPEATED CURRENT TOKEN)
:content %body
:cookie-jar %cookies
:headers (if %content-type (cons (cons "Content-Type" %content-type) %headers) %headers)))
(defun put-contributor/who/locked
(WHO VALUE TOKEN %host &key %content-type %body %headers %cookies)
"Admin users may lock a particular contributor, preventing that
contributor for making edits or adding new oneliners."
(dexador:put
(format nil "~a/api/contributor/~a/locked?~@[VALUE=~a~]~@[&TOKEN=~a~]" %host WHO VALUE TOKEN)
:content %body
:cookie-jar %cookies
:headers (if %content-type (cons (cons "Content-Type" %content-type) %headers) %headers)))
(defun get-contributor/who
(WHO %host &key %headers %cookies)
"Return a [contributor](#contributor) data object."
(dexador:get
(format nil "~a/api/contributor/~a?" %host WHO )
:cookie-jar %cookies
:headers %headers))
(defun post-snapshot
(TOKEN %host &key %content-type %body %headers %cookies)
"Snapshot the datastore. Do this after upgrade"
(dexador:post
(format nil "~a/api/snapshot?~@[TOKEN=~a~]" %host TOKEN)
:content %body
:cookie-jar %cookies
:headers (if %content-type (cons (cons "Content-Type" %content-type) %headers) %headers)))
|