The integral-rest Reference Manual

This is the integral-rest Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sat Dec 03 21:44:54 2022 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 integral-rest

REST APIs for Integral DAO Table.

Author

Rudolph-Miller

License

MIT

Long Description

# 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.

Version

0.1

Dependencies
  • alexandria (system).
  • integral (system).
  • ningle (system).
  • closer-mop (system).
  • jonathan (system).
  • cl-inflector (system).
  • map-set (system).
Source

integral-rest.asd.

Child Component

src (module).


3 Modules

Modules are listed depth-first from the system components tree.


3.1 integral-rest/src

Source

integral-rest.asd.

Parent Component

integral-rest (system).

Child Components

4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


4.1 Lisp


4.1.1 integral-rest/integral-rest.asd

Source

integral-rest.asd.

Parent Component

integral-rest (system).

ASDF Systems

integral-rest.

Packages

integral-rest-asd.


4.1.2 integral-rest/src/integral-rest.lisp

Dependencies
Source

integral-rest.asd.

Parent Component

src (module).

Packages

integral-rest.

Public Interface
Internals

<app> (class).


4.1.3 integral-rest/src/route.lisp

Dependencies
Source

integral-rest.asd.

Parent Component

src (module).

Packages

integral-rest.route.

Public Interface
Internals

4.1.4 integral-rest/src/api.lisp

Dependency

util.lisp (file).

Source

integral-rest.asd.

Parent Component

src (module).

Packages

integral-rest.api.

Public Interface

4.1.5 integral-rest/src/util.lisp

Source

integral-rest.asd.

Parent Component

src (module).

Packages

integral-rest.util.

Public Interface

5 Packages

Packages are listed by definition order.


5.1 integral-rest.route

Source

route.lisp.

Use List
Public Interface
Internals

5.2 integral-rest.api

Source

api.lisp.

Use List
Used By List

integral-rest.route.

Public Interface

5.3 integral-rest.util

Source

util.lisp.

Use List
  • common-lisp.
  • integral.
  • jonathan.
Used By List
Public Interface

5.4 integral-rest-asd

Source

integral-rest.asd.

Use List
  • asdf/interface.
  • common-lisp.

5.5 integral-rest

Source

integral-rest.lisp.

Use List
  • cl-annot.doc.
  • common-lisp.
  • integral.
Public Interface
Internals

<app> (class).


6 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


6.1 Public Interface


6.1.1 Special variables

Special Variable: *api-conjunctive-string*
Package

integral-rest.route.

Source

route.lisp.

Special Variable: *api-prefix*
Package

integral-rest.route.

Source

route.lisp.

Special Variable: *convert-intgral-slot-name-into-downcase*
Package

integral-rest.util.

Source

util.lisp.

Special Variable: *params-case-insensitive-p*
Package

integral-rest.route.

Source

route.lisp.

Special Variable: *rest-app*
Package

integral-rest.

Source

integral-rest.lisp.


6.1.2 Ordinary functions

Function: routing-rules (&optional app)

returns list of routing rules the app has.

Package

integral-rest.

Source

integral-rest.lisp.

Function: set-rest-app (&optional tables)

sets REST API app to *rest-app* and returns REST API app.

Package

integral-rest.

Source

integral-rest.lisp.

Function: slot-initarg (slot)
Package

integral-rest.util.

Source

util.lisp.


6.1.3 Generic functions

Generic Function: api-path (table)
Package

integral-rest.route.

Source

route.lisp.

Methods
Method: api-path ((table <dao-table-class>))
Generic Function: plural-name-of (table)
Package

integral-rest.util.

Source

util.lisp.

Methods
Method: plural-name-of ((table <dao-table-class>))
Generic Function: resource (model method &rest args)
Package

integral-rest.api.

Source

api.lisp.

Methods
Method: resource ((table <dao-table-class>) (method (eql :get)) &rest args)
Method: resource ((table <dao-table-class>) (method (eql :put)) &rest args)
Method: resource ((table <dao-table-class>) (method (eql :delete)) &rest args)
Generic Function: resource-action (table method)
Package

integral-rest.route.

Source

route.lisp.

Methods
Method: resource-action ((table <dao-table-class>) (method (eql :get)))
Method: resource-action ((table <dao-table-class>) (method (eql :put)))
Method: resource-action ((table <dao-table-class>) (method (eql :delete)))
Generic Function: resource-path (table)
Package

integral-rest.route.

Source

route.lisp.

Methods
Method: resource-path ((table <dao-table-class>))
Generic Function: resources (model method &rest args)
Package

integral-rest.api.

Source

api.lisp.

Methods
Method: resources ((table <dao-table-class>) (method (eql :get)) &rest args)
Method: resources ((table <dao-table-class>) (method (eql :post)) &rest args)
Generic Function: resources-action (table method)
Package

integral-rest.route.

Source

route.lisp.

Methods
Method: resources-action ((table <dao-table-class>) (method (eql :get)))
Method: resources-action ((table <dao-table-class>) (method (eql :post)))
Generic Function: resources-path (table)
Package

integral-rest.route.

Source

route.lisp.

Methods
Method: resources-path ((table <dao-table-class>))
Generic Function: singular-name-of (table)
Package

integral-rest.util.

Source

util.lisp.

Methods
Method: singular-name-of ((table <dao-table-class>))
Generic Function: table-initargs (table)
Package

integral-rest.util.

Source

util.lisp.

Methods
Method: table-initargs ((table symbol))
Method: table-initargs ((table class))

6.2 Internals


6.2.1 Ordinary functions

Function: get-value (key alist)
Package

integral-rest.route.

Source

route.lisp.

Function: kv-action (fn table method)
Package

integral-rest.route.

Source

route.lisp.

Function: pk-action (fn table method)
Package

integral-rest.route.

Source

route.lisp.


6.2.2 Classes

Class: <app>
Package

integral-rest.

Source

integral-rest.lisp.

Direct superclasses

app.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   A   F   G   K   M   P   R   S   T  
Index Entry  Section

A
api-path: Public generic functions
api-path: Public generic functions

F
Function, get-value: Private ordinary functions
Function, kv-action: Private ordinary functions
Function, pk-action: Private ordinary functions
Function, routing-rules: Public ordinary functions
Function, set-rest-app: Public ordinary functions
Function, slot-initarg: Public ordinary functions

G
Generic Function, api-path: Public generic functions
Generic Function, plural-name-of: Public generic functions
Generic Function, resource: Public generic functions
Generic Function, resource-action: Public generic functions
Generic Function, resource-path: Public generic functions
Generic Function, resources: Public generic functions
Generic Function, resources-action: Public generic functions
Generic Function, resources-path: Public generic functions
Generic Function, singular-name-of: Public generic functions
Generic Function, table-initargs: Public generic functions
get-value: Private ordinary functions

K
kv-action: Private ordinary functions

M
Method, api-path: Public generic functions
Method, plural-name-of: Public generic functions
Method, resource: Public generic functions
Method, resource: Public generic functions
Method, resource: Public generic functions
Method, resource-action: Public generic functions
Method, resource-action: Public generic functions
Method, resource-action: Public generic functions
Method, resource-path: Public generic functions
Method, resources: Public generic functions
Method, resources: Public generic functions
Method, resources-action: Public generic functions
Method, resources-action: Public generic functions
Method, resources-path: Public generic functions
Method, singular-name-of: Public generic functions
Method, table-initargs: Public generic functions
Method, table-initargs: Public generic functions

P
pk-action: Private ordinary functions
plural-name-of: Public generic functions
plural-name-of: Public generic functions

R
resource: Public generic functions
resource: Public generic functions
resource: Public generic functions
resource: Public generic functions
resource-action: Public generic functions
resource-action: Public generic functions
resource-action: Public generic functions
resource-action: Public generic functions
resource-path: Public generic functions
resource-path: Public generic functions
resources: Public generic functions
resources: Public generic functions
resources: Public generic functions
resources-action: Public generic functions
resources-action: Public generic functions
resources-action: Public generic functions
resources-path: Public generic functions
resources-path: Public generic functions
routing-rules: Public ordinary functions

S
set-rest-app: Public ordinary functions
singular-name-of: Public generic functions
singular-name-of: Public generic functions
slot-initarg: Public ordinary functions

T
table-initargs: Public generic functions
table-initargs: Public generic functions
table-initargs: Public generic functions


A.4 Data types

Jump to:   <  
A   C   F   I   M   P   R   S   U  
Index Entry  Section

<
<app>: Private classes

A
api.lisp: The integral-rest/src/api․lisp file

C
Class, <app>: Private classes

F
File, api.lisp: The integral-rest/src/api․lisp file
File, integral-rest.asd: The integral-rest/integral-rest․asd file
File, integral-rest.lisp: The integral-rest/src/integral-rest․lisp file
File, route.lisp: The integral-rest/src/route․lisp file
File, util.lisp: The integral-rest/src/util․lisp file

I
integral-rest: The integral-rest system
integral-rest: The integral-rest package
integral-rest-asd: The integral-rest-asd package
integral-rest.api: The integral-rest․api package
integral-rest.asd: The integral-rest/integral-rest․asd file
integral-rest.lisp: The integral-rest/src/integral-rest․lisp file
integral-rest.route: The integral-rest․route package
integral-rest.util: The integral-rest․util package

M
Module, src: The integral-rest/src module

P
Package, integral-rest: The integral-rest package
Package, integral-rest-asd: The integral-rest-asd package
Package, integral-rest.api: The integral-rest․api package
Package, integral-rest.route: The integral-rest․route package
Package, integral-rest.util: The integral-rest․util package

R
route.lisp: The integral-rest/src/route․lisp file

S
src: The integral-rest/src module
System, integral-rest: The integral-rest system

U
util.lisp: The integral-rest/src/util․lisp file