This is the integral-rest Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 06:29:02 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
integral-rest
REST APIs for Integral DAO Table.
Rudolph-Miller
MIT
# Integral-Rest - REST APIs for Integral DAO Table.
[![Build Status](https://circleci.com/gh/Rudolph-Miller/integral-rest.svg?style=shield)](https://circleci.com/gh/Rudolph-Miller/integral-rest)
[![Quicklisp dist](http://quickdocs.org/badge/integral-rest.svg)](http://quickdocs.org/integral-rest/)
## Usage
“‘Lisp
(defclass user ()
((id :initarg :id
:primary-key t)
(name :initarg :name))
(:metaclass <dao-table-class>))
(set-rest-app)
(clack:clackup *rest-app*)
“‘
## Installation
“‘Lisp
(ql:quickload :integral-rest)
“‘
## API
### set-rest-app
“‘Lisp
(defclass user ()
((id :initarg :id
:primary-key t
:accessor user-id)
(name :initarg :name
:accessor user-name))
(:metaclass integral:<dao-table-class>))
(set-rest-app)
;; This sets REST API app to *rest-app*.
(defvar *my-rest-app* (set-rest-app))
;; (set-rest-app) also returns REST API app.
(set-rest-app (list (find-class ’user)))
;; (set-rest-app) can take list of class. (optional)
“‘
- sets REST API app to ‘*rest-app*‘.
- returns REST API app.
- REST API app has these routing rules below.
- ‘"/api/users" :GET‘
- ‘"/api/users" :POST‘
- ‘"/api/users/:id" :GET‘
- ‘"/api/users/:id" :PUT‘
- ‘"/api/users/:id" :DELETE‘
“‘Lisp
(defpackage sample
(:use :cl
:integral
:integral-rest))
(in-package :sample)
(connect-toplevel :sqlite3 :database-name ":memory:")
(defclass user ()
((id :initarg :id
:type integer
:primary-key t
:accessor user-id)
(name :initarg :name
:type string
:accessor user-name))
(:metaclass integral:<dao-table-class>))
(ensure-table-exists (find-class ’user))
(set-rest-app)
(clack:clackup *rest-app*)
;; => Listening on localhost:5000.
(create-dao ’user :name "Rudolph")
;; => #<USER id: 1>
(dex:get "http://localhost:5000/api/users")
;; => "[{\"id\":1,\"name\":\"Rudolph\"}]"
(dex:get "http://localhost:5000/api/users/1")
;; => "{\"id\":1,\"name\":\"Rudolph\"}"
(dex:post "http://localhost:5000/api/users" :content ’(("name" . "Miller")))
;; => "{\"id\":2,\"name\":\"Miller\"}"
(find-dao ’user 2)
;; => #<USER id: 2 name: "Miller">
(dex:put "http://localhost:5000/api/users/2" :content ’(("name" . "Tom")))
;; => "{\"id\":2,\"name\":\"Tom\"}"
(find-dao ’user 2)
;; => #<USER id: 2 name: "Tom">
(dex:delete "http://localhost:5000/api/users/2")
;; => "{\"id\":2,\"name\":\"Tom\"}"
(find-dao ’user 2)
;; => NIL
“‘
### routing-rules
“‘Lisp
(defclass user ()
((id :initarg :id
:primary-key t
:accessor user-id)
(name :initarg :name
:accessor user-name))
(:metaclass integral:<dao-table-class>))
(set-rest-app)
(routing-rules *rest-app*)
;; => ’(("/api/users" :GET) ("/api/users" :POST) ("/api/users/:id" :GET)
;; ("/api/users/:id" :PUT) ("/api/users/:id" :DELETE))
“‘
- returns list of routing rules the app has.
## Author
* Rudolph-Miller
## See Also
- [Integral](https://github.com/fukamachi/integral)
## Copyright
Copyright (c) 2015 Rudolph-Miller
## License
Licensed under the MIT License.
0.1
alexandria
(system).
integral
(system).
ningle
(system).
closer-mop
(system).
jonathan
(system).
cl-inflector
(system).
map-set
(system).
src
(module).
Modules are listed depth-first from the system components tree.
integral-rest/src
integral-rest
(system).
integral-rest.lisp
(file).
route.lisp
(file).
api.lisp
(file).
util.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
integral-rest/integral-rest.asd
integral-rest/src/integral-rest.lisp
integral-rest/src/route.lisp
integral-rest/src/api.lisp
integral-rest/src/util.lisp
integral-rest/integral-rest.asd
integral-rest
(system).
integral-rest/src/integral-rest.lisp
route.lisp
(file).
api.lisp
(file).
util.lisp
(file).
src
(module).
*rest-app*
(special variable).
routing-rules
(function).
set-rest-app
(function).
<app>
(class).
integral-rest/src/route.lisp
src
(module).
*api-conjunctive-string*
(special variable).
*api-prefix*
(special variable).
*params-case-insensitive-p*
(special variable).
api-path
(generic function).
resource-action
(generic function).
resource-path
(generic function).
resources-action
(generic function).
resources-path
(generic function).
integral-rest/src/api.lisp
integral-rest/src/util.lisp
src
(module).
*convert-intgral-slot-name-into-downcase*
(special variable).
plural-name-of
(generic function).
singular-name-of
(generic function).
slot-initarg
(function).
table-initargs
(generic function).
Packages are listed by definition order.
integral-rest.util
common-lisp
.
integral
.
jonathan
.
*convert-intgral-slot-name-into-downcase*
(special variable).
plural-name-of
(generic function).
singular-name-of
(generic function).
slot-initarg
(function).
table-initargs
(generic function).
integral-rest.route
common-lisp
.
integral
.
integral-rest.api
.
integral-rest.util
.
jonathan
.
ningle
.
*api-conjunctive-string*
(special variable).
*api-prefix*
(special variable).
*params-case-insensitive-p*
(special variable).
api-path
(generic function).
resource-action
(generic function).
resource-path
(generic function).
resources-action
(generic function).
resources-path
(generic function).
integral-rest
cl-annot.doc
.
common-lisp
.
integral
.
*rest-app*
(special variable).
routing-rules
(function).
set-rest-app
(function).
<app>
(class).
integral-rest.api
common-lisp
.
integral
.
integral-rest.util
.
ningle
.
Definitions are sorted by export status, category, package, and then by lexicographic order.
returns list of routing rules the app has.
sets REST API app to *rest-app* and returns REST API app.
<dao-table-class>
)) ¶<dao-table-class>
)) ¶<dao-table-class>
)) ¶<dao-table-class>
)) ¶<dao-table-class>
)) ¶Jump to: | A F G K M P R S T |
---|
Jump to: | A F G K M P R S T |
---|
Jump to: | *
S |
---|
Jump to: | *
S |
---|
Jump to: | <
A C F I M P R S U |
---|
Jump to: | <
A C F I M P R S U |
---|