This is the erjoalgo-webutil Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 06:03:26 2024 GMT+0.
erjoalgo-webutil/erjoalgo-webutil.asd
erjoalgo-webutil/packages.lisp
erjoalgo-webutil/util.lisp
erjoalgo-webutil/json.lisp
erjoalgo-webutil/http.lisp
erjoalgo-webutil/api-client.lisp
erjoalgo-webutil/defendpoint.lisp
erjoalgo-webutil/oauth.lisp
erjoalgo-webutil/site-integrations.lisp
The main system appears first, followed by any subsystem dependency.
erjoalgo-webutil
Framework for defining [oauth] http api client & sever.
Ernesto Alfonso <erjoalgo@gmail.com>
GPLv3
cl-json
(system).
drakma
(system).
cl-ppcre
(system).
hunchentoot
(system).
gzip-stream
(system).
vom
(system).
fiasco
(system).
packages.lisp
(file).
util.lisp
(file).
json.lisp
(file).
http.lisp
(file).
api-client.lisp
(file).
defendpoint.lisp
(file).
oauth.lisp
(file).
site-integrations.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
erjoalgo-webutil/erjoalgo-webutil.asd
erjoalgo-webutil/packages.lisp
erjoalgo-webutil/util.lisp
erjoalgo-webutil/json.lisp
erjoalgo-webutil/http.lisp
erjoalgo-webutil/api-client.lisp
erjoalgo-webutil/defendpoint.lisp
erjoalgo-webutil/oauth.lisp
erjoalgo-webutil/site-integrations.lisp
erjoalgo-webutil/erjoalgo-webutil.asd
erjoalgo-webutil
(system).
erjoalgo-webutil/util.lisp
packages.lisp
(file).
erjoalgo-webutil
(system).
->
(macro).
->>
(macro).
alist-get
(macro).
make-directories-recursively
(function).
read-file
(function).
slot-value->
(macro).
when-let
(macro).
with-gensyms
(macro).
erjoalgo-webutil/json.lisp
util.lisp
(file).
erjoalgo-webutil
(system).
-json-get-nested
(macro).
json-get-nested
(function).
json-key-to-lisp
(function).
json-path-split
(function).
lisp-to-json-key
(function).
make-from-json-alist
(macro).
struct-to-alist
(function).
with-json-paths
(macro).
erjoalgo-webutil/http.lisp
json.lisp
(file).
erjoalgo-webutil
(system).
-params
(macro).
check-nonnil
(macro).
defroutes
(macro).
drakma-json-content-type-hack
(function).
first-file-matching
(function).
hunchentoot-make-add-fake-session
(function).
json-req
(function).
json-resp
(function).
log-request
(function).
params
(function).
retry-times
(macro).
test-routes
(special variable).
with-mock
(macro).
erjoalgo-webutil/api-client.lisp
http.lisp
(file).
erjoalgo-webutil
(system).
*api-base-url*
(special variable).
*api-req-retry-count*
(special variable).
api-req
(function).
http-request
(structure).
http-request-qparams
(reader).
(setf http-request-qparams)
(writer).
make-http-request
(function).
alist-to-http-params
(function).
copy-http-request
(function).
copy-resp-page
(function).
http-request-additional-headers
(reader).
(setf http-request-additional-headers)
(writer).
http-request-content
(reader).
(setf http-request-content)
(writer).
http-request-method
(reader).
(setf http-request-method)
(writer).
http-request-p
(function).
http-request-resource
(reader).
(setf http-request-resource)
(writer).
http-request-rest
(reader).
(setf http-request-rest)
(writer).
make-resp-page
(function).
resp-page
(structure).
resp-page-error
(reader).
(setf resp-page-error)
(writer).
resp-page-etag
(reader).
(setf resp-page-etag)
(writer).
resp-page-items
(reader).
(setf resp-page-items)
(writer).
resp-page-kind
(reader).
(setf resp-page-kind)
(writer).
resp-page-next-page-token
(reader).
(setf resp-page-next-page-token)
(writer).
resp-page-p
(function).
resp-page-page-info
(reader).
(setf resp-page-page-info)
(writer).
resp-page-prev-page-token
(reader).
(setf resp-page-prev-page-token)
(writer).
erjoalgo-webutil/defendpoint.lisp
api-client.lisp
(file).
erjoalgo-webutil
(system).
defendpoint
(macro).
erjoalgo-webutil/oauth.lisp
defendpoint.lisp
(file).
erjoalgo-webutil
(system).
api-login-client
(reader).
(setf api-login-client)
(writer).
hunchentoot-create-oauth-redirect-handler
(function).
make-api-login
(function).
oauth-client-meta
(reader).
(setf oauth-client-meta)
(writer).
oauth-exchange-code-for-token
(function).
oauth-make-client-from-file
(function).
oauth-server-redirect-url
(function).
oauth-token-access-token
(reader).
(setf oauth-token-access-token)
(writer).
oauth-token-auth-header
(function).
oauth-token-refresh-token
(reader).
(setf oauth-token-refresh-token)
(writer).
api-login
(structure).
api-login-key
(reader).
(setf api-login-key)
(writer).
api-login-p
(function).
api-login-token
(reader).
(setf api-login-token)
(writer).
copy-api-login
(function).
copy-oauth-client
(function).
copy-oauth-token
(function).
fetch-token
(function).
make-oauth-client
(function).
make-oauth-token
(function).
oauth-client
(structure).
oauth-client-auth-provider-x-509-cert-url
(reader).
(setf oauth-client-auth-provider-x-509-cert-url)
(writer).
oauth-client-auth-uri
(reader).
(setf oauth-client-auth-uri)
(writer).
oauth-client-client-id
(reader).
(setf oauth-client-client-id)
(writer).
oauth-client-client-secret
(reader).
(setf oauth-client-client-secret)
(writer).
oauth-client-key
(reader).
(setf oauth-client-key)
(writer).
oauth-client-p
(function).
oauth-client-project-id
(reader).
(setf oauth-client-project-id)
(writer).
oauth-client-redirect-uris
(reader).
(setf oauth-client-redirect-uris)
(writer).
oauth-client-scopes
(reader).
(setf oauth-client-scopes)
(writer).
oauth-client-token-uri
(reader).
(setf oauth-client-token-uri)
(writer).
oauth-token
(structure).
oauth-token-error
(reader).
(setf oauth-token-error)
(writer).
oauth-token-error-description
(reader).
(setf oauth-token-error-description)
(writer).
oauth-token-expires
(reader).
(setf oauth-token-expires)
(writer).
oauth-token-expires-in
(reader).
(setf oauth-token-expires-in)
(writer).
oauth-token-obtained-at
(reader).
(setf oauth-token-obtained-at)
(writer).
oauth-token-p
(function).
oauth-token-scope
(reader).
(setf oauth-token-scope)
(writer).
oauth-token-token-type
(reader).
(setf oauth-token-token-type)
(writer).
erjoalgo-webutil/site-integrations.lisp
oauth.lisp
(file).
erjoalgo-webutil
(system).
*google-login*
(special variable).
*sexchange-login*
(special variable).
google-authenticator
(function).
google-depaginator
(function).
google-login-key
(special variable).
google-userinfo-email
(function).
sexchange-authenticator
(function).
sexchange-depaginator
(function).
sexchange-login-key
(special variable).
google-current-session-user-email
(function).
Packages are listed by definition order.
erjoalgo-webutil
common-lisp
.
*api-base-url*
(special variable).
*api-req-retry-count*
(special variable).
*google-login*
(special variable).
*sexchange-login*
(special variable).
->
(macro).
->>
(macro).
-json-get-nested
(macro).
-params
(macro).
alist-get
(macro).
api-login-client
(reader).
(setf api-login-client)
(writer).
api-req
(function).
check-nonnil
(macro).
defendpoint
(macro).
defroutes
(macro).
drakma-json-content-type-hack
(function).
first-file-matching
(function).
google-authenticator
(function).
google-depaginator
(function).
google-login-key
(special variable).
google-userinfo-email
(function).
http-request
(structure).
http-request-qparams
(reader).
(setf http-request-qparams)
(writer).
hunchentoot-create-oauth-redirect-handler
(function).
hunchentoot-make-add-fake-session
(function).
json-get-nested
(function).
json-key-to-lisp
(function).
json-path-split
(function).
json-req
(function).
json-resp
(function).
lisp-to-json-key
(function).
log-request
(function).
make-api-login
(function).
make-directories-recursively
(function).
make-from-json-alist
(macro).
make-http-request
(function).
oauth-client-meta
(reader).
(setf oauth-client-meta)
(writer).
oauth-exchange-code-for-token
(function).
oauth-make-client-from-file
(function).
oauth-server-redirect-url
(function).
oauth-token-access-token
(reader).
(setf oauth-token-access-token)
(writer).
oauth-token-auth-header
(function).
oauth-token-refresh-token
(reader).
(setf oauth-token-refresh-token)
(writer).
params
(function).
read-file
(function).
retry-times
(macro).
sexchange-authenticator
(function).
sexchange-depaginator
(function).
sexchange-login-key
(special variable).
slot-value->
(macro).
struct-to-alist
(function).
when-let
(macro).
with-gensyms
(macro).
with-json-paths
(macro).
alist-to-http-params
(function).
api-login
(structure).
api-login-key
(reader).
(setf api-login-key)
(writer).
api-login-p
(function).
api-login-token
(reader).
(setf api-login-token)
(writer).
copy-api-login
(function).
copy-http-request
(function).
copy-oauth-client
(function).
copy-oauth-token
(function).
copy-resp-page
(function).
fetch-token
(function).
google-current-session-user-email
(function).
http-request-additional-headers
(reader).
(setf http-request-additional-headers)
(writer).
http-request-content
(reader).
(setf http-request-content)
(writer).
http-request-method
(reader).
(setf http-request-method)
(writer).
http-request-p
(function).
http-request-resource
(reader).
(setf http-request-resource)
(writer).
http-request-rest
(reader).
(setf http-request-rest)
(writer).
make-oauth-client
(function).
make-oauth-token
(function).
make-resp-page
(function).
oauth-client
(structure).
oauth-client-auth-provider-x-509-cert-url
(reader).
(setf oauth-client-auth-provider-x-509-cert-url)
(writer).
oauth-client-auth-uri
(reader).
(setf oauth-client-auth-uri)
(writer).
oauth-client-client-id
(reader).
(setf oauth-client-client-id)
(writer).
oauth-client-client-secret
(reader).
(setf oauth-client-client-secret)
(writer).
oauth-client-key
(reader).
(setf oauth-client-key)
(writer).
oauth-client-p
(function).
oauth-client-project-id
(reader).
(setf oauth-client-project-id)
(writer).
oauth-client-redirect-uris
(reader).
(setf oauth-client-redirect-uris)
(writer).
oauth-client-scopes
(reader).
(setf oauth-client-scopes)
(writer).
oauth-client-token-uri
(reader).
(setf oauth-client-token-uri)
(writer).
oauth-token
(structure).
oauth-token-error
(reader).
(setf oauth-token-error)
(writer).
oauth-token-error-description
(reader).
(setf oauth-token-error-description)
(writer).
oauth-token-expires
(reader).
(setf oauth-token-expires)
(writer).
oauth-token-expires-in
(reader).
(setf oauth-token-expires-in)
(writer).
oauth-token-obtained-at
(reader).
(setf oauth-token-obtained-at)
(writer).
oauth-token-p
(function).
oauth-token-scope
(reader).
(setf oauth-token-scope)
(writer).
oauth-token-token-type
(reader).
(setf oauth-token-token-type)
(writer).
resp-page
(structure).
resp-page-error
(reader).
(setf resp-page-error)
(writer).
resp-page-etag
(reader).
(setf resp-page-etag)
(writer).
resp-page-items
(reader).
(setf resp-page-items)
(writer).
resp-page-kind
(reader).
(setf resp-page-kind)
(writer).
resp-page-next-page-token
(reader).
(setf resp-page-next-page-token)
(writer).
resp-page-p
(function).
resp-page-page-info
(reader).
(setf resp-page-page-info)
(writer).
resp-page-prev-page-token
(reader).
(setf resp-page-prev-page-token)
(writer).
test-routes
(special variable).
with-mock
(macro).
Definitions are sorted by export status, category, package, and then by lexicographic order.
default base url used by api-req
default retry count used by api-req
Threading macro.
Macro-version of JSON-GET-NESTED. Only macroexpands if PATH is a string known at compile time.
Convert a flat list of key-value pairs into an alist.
get ITEM in ALIST
Asserts a form is non-nil.
Defines a function FUN-SYM that calls an api-endpoint.
DEFAULT-PARAMS specifies defaults parameters used in the request unless overridden later by the caller.
Define a hunchentoot dispatch table VAR of http routes.
Each route has the form (ALLOWED-METHODS URI-REGEXP . CAPTURE-NAMES):
ALLOWED-METHODS may be a list of http verbs as in (:GET :POST), or the
special value t which matches any verb.
URI-REGEXP and CAPTURE-NAMES are used to match against the request path
and capture path variables. They correspond to the REGEX and VAR-LIST
parameters in PPCRE:REGISTER-GROUPS-BIND.
For example,
- URI-REGEXP "/user/([0-9]+)/product/([0-9]+)"
- CAPTURE-NAMES (user-id product-id)
would capture the user-id and product-id path variables of
requests matching the given path regexp.
- CAPTURE-NAMES could also have the form
((#’PARSE-INTEGER UNIQUE-ID) (#’PARSE-INTEGER PRODUCT-ID))
as supported by PPCRE:REGISTER-GROUPS-BIND.
Make an instance of type TYPE from a cl-json-decoded JSON-ALIST.
Retry form N times, with each retry timed out at TIMEOUT-SECS. An error is raised only after all retries have been exhausted.
Let-bind certain json paths within json OBJ.
VAR-PATHS has the form (VAR JSON-PATH). See test for examples.
Make a REST api request to the URL: (CONCAT API-BASE-URL RESOURCE)
with query parameters PARAMS-ALIST. (Note that no slash is added in between.)
Retry RETRY-COUNT times with a delay of RETRY-DELAY seconds
after each retry in case of network errors.
Returns values (DECODED-JSON RESP-CODE RESP-STRING)
- DECODED-JSON is a json object decoded via cl-json
- HTTP-RESP-CODE is the http response code as a number
- RESP-STRING is the raw response string before cl-json decoding
If DEPAGINATE is non-nil, attempt to depaginate the requested resource
by making several requests. If DEPAGINATE is a positive number, it specifies the max
number of pages to request, otherwise no such limit is imposed.
When depagination is on:
- DECODED-JSON object is a list of resources across all requesed pages.
- RETRY-COUNT applies to each page request.
- RESP-STRING, HTTP-RESP-CODE values are based on the last retrieved page.
- A fourth value ERROR is returned. Any non-2xx response code or persistent
network error short-circuits depagination: partial results are returned
and details of the error are stored in ERROR
When AUTO-REFRESH-P is non-nil, an one-time attempt (per retry) is made, if possible, to refresh the token on 403 errors.
Remove application/json from drakma:*text-content-types*.
Locate the first file in DIRECTORY matching the extension EXT.
Create a ’fake’ hunchentoot session with mock data DATA as HUNCHENTOOT::SESSION-DATA.
Returns (VALUES SESSION COOKIE).
The resulting SESSION will be actived for a given request if:
- request user-agent is USER-AGENT
- request real-remote-addr (IP address?) is REAL-REMOTE-ADDR
- the request contains a header with the name ’cookie’ and value COOKIE
Get the value in ALIST at the given PATH.
Convert a json object KEY string into a lisp identifier name.
Split a json PATH string into components.
Obtain the current request payload as a decoded json object.
Convert a lisp object into a json response with the appropriate content type to be called within a hunchentoot handler.
Convert a LISP-IDENTIFIER string name into a json object key string.
meta
.
code The authorization code returned from the initial request.
client_id The client ID obtained from the API Console.
client_secret The client secret obtained from the API Console.
redirect_uri One of the redirect URIs listed for your project in the API Console.
grant_type As defined in the OAuth 2.0 specification,
this field must contain a value of authorization_code.
Example
https://accounts.google.com/o/oauth2/v2/auth?
scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.metadata.readonly&
access-type=offline&
include-granted-scopes=true&
state=state-parameter-passthrough-value&
redirect-uri=http%3A%2F%2Foauth2.example.com%2Fcallback&
response-type=code&
client-id=client-id
Convert a flat list of key-value pairs into an alist.
Read file contents into a string.
structure-object
.
common-lisp
.
common-lisp
.
Shadow the function named fname with fun
Any call to fname within body will use fun, instead of the default function for fname.
This macro is intentionally unhygienic:
fun-orig is the anaphor, and can be used in body to access the shadowed function
Convert an lisp alist of key-value pairs PARAMS into drakma-compatible http-params. Later parameters override earlier ones to support multiple levels of customization.
key
.
Return the current authenticated user’s email.
If it does not exist, it is fetched and cached in the session.
rest
.
key
.
etag
.
kind
.
structure-object
.
structure-object
.
common-lisp
.
structure-object
.
common-lisp
.
Jump to: | (
-
A C D F G H J L M O P R S W |
---|
Jump to: | (
-
A C D F G H J L M O P R S W |
---|
Jump to: | *
A C E G I K M N O P Q R S T |
---|
Jump to: | *
A C E G I K M N O P Q R S T |
---|
Jump to: | A D E F H J O P R S U |
---|
Jump to: | A D E F H J O P R S U |
---|