The integral-rest Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The integral-rest Reference Manual

This is the integral-rest Reference Manual, version 0.1, generated automatically by Declt version 2.3 "Robert April" on Tue Feb 20 08:51:37 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

Integral-Rest - REST APIs for Integral DAO Table.

Build Status Quicklisp dist

Usage

(defclass user ()
  ((id :initarg :id
       :primary-key t)
   (name :initarg :name))
  (:metaclass <dao-table-class>))

(set-rest-app)

(clack:clackup *rest-app*)

Installation

(ql:quickload :integral-rest)

API

set-rest-app

(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)
(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

(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))

Author

See Also

Copyright

Copyright (c) 2015 Rudolph-Miller

License

Licensed under the MIT License.


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

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


Previous: , Up: Systems   [Contents][Index]

2.1 integral-rest

Author

Rudolph-Miller

License

MIT

Description

REST APIs for Integral DAO Table.

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
Source

integral-rest.asd (file)

Component

src (module)


Next: , Previous: , Up: Top   [Contents][Index]

3 Modules

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


Previous: , Up: Modules   [Contents][Index]

3.1 integral-rest/src

Parent

integral-rest (system)

Location

src/

Components

Next: , Previous: , Up: Top   [Contents][Index]

4 Files

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


Previous: , Up: Files   [Contents][Index]

4.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.1 integral-rest.asd

Location

integral-rest.asd

Systems

integral-rest (system)

Packages

integral-rest-asd


Next: , Previous: , Up: Lisp files   [Contents][Index]

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

Dependencies
Parent

src (module)

Location

src/integral-rest.lisp

Packages

integral-rest

Exported Definitions
Internal Definitions

<app> (class)


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.3 integral-rest/src/route.lisp

Dependencies
Parent

src (module)

Location

src/route.lisp

Packages

integral-rest.route

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.4 integral-rest/src/api.lisp

Dependency

util.lisp (file)

Parent

src (module)

Location

src/api.lisp

Packages

integral-rest.api

Exported Definitions

Previous: , Up: Lisp files   [Contents][Index]

4.1.5 integral-rest/src/util.lisp

Parent

src (module)

Location

src/util.lisp

Packages

integral-rest.util

Exported Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Packages

Packages are listed by definition order.


Next: , Previous: , Up: Packages   [Contents][Index]

5.1 integral-rest-asd

Source

integral-rest.asd

Use List

Next: , Previous: , Up: Packages   [Contents][Index]

5.2 integral-rest

Source

integral-rest.lisp (file)

Use List
Exported Definitions
Internal Definitions

<app> (class)


Next: , Previous: , Up: Packages   [Contents][Index]

5.3 integral-rest.route

Source

route.lisp (file)

Use List
Exported Definitions
Internal Definitions

Next: , Previous: , Up: Packages   [Contents][Index]

5.4 integral-rest.api

Source

api.lisp (file)

Use List
Used By List

integral-rest.route

Exported Definitions

Previous: , Up: Packages   [Contents][Index]

5.5 integral-rest.util

Source

util.lisp (file)

Use List
Used By List
Exported Definitions

Next: , Previous: , Up: Top   [Contents][Index]

6 Definitions

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


Next: , Previous: , Up: Definitions   [Contents][Index]

6.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.1 Special variables

Special Variable: *api-conjunctive-string*
Package

integral-rest.route

Source

route.lisp (file)

Special Variable: *api-prefix*
Package

integral-rest.route

Source

route.lisp (file)

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

integral-rest.util

Source

util.lisp (file)

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

integral-rest.route

Source

route.lisp (file)

Special Variable: *rest-app*
Package

integral-rest

Source

integral-rest.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.2 Functions

Function: routing-rules &optional APP

returns list of routing rules the app has.

Package

integral-rest

Source

integral-rest.lisp (file)

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 (file)

Function: slot-initarg SLOT
Package

integral-rest.util

Source

util.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

6.1.3 Generic functions

Generic Function: api-path TABLE
Package

integral-rest.route

Source

route.lisp (file)

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

integral-rest.util

Source

util.lisp (file)

Methods
Method: plural-name-of (TABLE <dao-table-class>)
Generic Function: resource MODEL METHOD &rest ARGS
Package

integral-rest.api

Source

api.lisp (file)

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 (file)

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 (file)

Methods
Method: resource-path (TABLE <dao-table-class>)
Generic Function: resources MODEL METHOD &rest ARGS
Package

integral-rest.api

Source

api.lisp (file)

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 (file)

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 (file)

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

integral-rest.util

Source

util.lisp (file)

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

integral-rest.util

Source

util.lisp (file)

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

Previous: , Up: Definitions   [Contents][Index]

6.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.1 Functions

Function: get-value KEY ALIST
Package

integral-rest.route

Source

route.lisp (file)

Function: kv-action FN TABLE METHOD
Package

integral-rest.route

Source

route.lisp (file)

Function: pk-action FN TABLE METHOD
Package

integral-rest.route

Source

route.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

6.2.2 Classes

Class: <app> ()
Package

integral-rest

Source

integral-rest.lisp (file)

Direct superclasses

<app> (class)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   I   L   M  
Index Entry  Section

F
File, Lisp, integral-rest.asd: The integral-rest<dot>asd file
File, Lisp, integral-rest/src/api.lisp: The integral-rest/src/api<dot>lisp file
File, Lisp, integral-rest/src/integral-rest.lisp: The integral-rest/src/integral-rest<dot>lisp file
File, Lisp, integral-rest/src/route.lisp: The integral-rest/src/route<dot>lisp file
File, Lisp, integral-rest/src/util.lisp: The integral-rest/src/util<dot>lisp file

I
integral-rest.asd: The integral-rest<dot>asd file
integral-rest/src: The integral-rest/src module
integral-rest/src/api.lisp: The integral-rest/src/api<dot>lisp file
integral-rest/src/integral-rest.lisp: The integral-rest/src/integral-rest<dot>lisp file
integral-rest/src/route.lisp: The integral-rest/src/route<dot>lisp file
integral-rest/src/util.lisp: The integral-rest/src/util<dot>lisp file

L
Lisp File, integral-rest.asd: The integral-rest<dot>asd file
Lisp File, integral-rest/src/api.lisp: The integral-rest/src/api<dot>lisp file
Lisp File, integral-rest/src/integral-rest.lisp: The integral-rest/src/integral-rest<dot>lisp file
Lisp File, integral-rest/src/route.lisp: The integral-rest/src/route<dot>lisp file
Lisp File, integral-rest/src/util.lisp: The integral-rest/src/util<dot>lisp file

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

Jump to:   F   I   L   M  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

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

A
api-path: Exported generic functions
api-path: Exported generic functions

F
Function, get-value: Internal functions
Function, kv-action: Internal functions
Function, pk-action: Internal functions
Function, routing-rules: Exported functions
Function, set-rest-app: Exported functions
Function, slot-initarg: Exported functions

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

K
kv-action: Internal functions

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

P
pk-action: Internal functions
plural-name-of: Exported generic functions
plural-name-of: Exported generic functions

R
resource: Exported generic functions
resource: Exported generic functions
resource: Exported generic functions
resource: Exported generic functions
resource-action: Exported generic functions
resource-action: Exported generic functions
resource-action: Exported generic functions
resource-action: Exported generic functions
resource-path: Exported generic functions
resource-path: Exported generic functions
resources: Exported generic functions
resources: Exported generic functions
resources: Exported generic functions
resources-action: Exported generic functions
resources-action: Exported generic functions
resources-action: Exported generic functions
resources-path: Exported generic functions
resources-path: Exported generic functions
routing-rules: Exported functions

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

T
table-initargs: Exported generic functions
table-initargs: Exported generic functions
table-initargs: Exported generic functions

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

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
S  
Index Entry  Section

*
*api-conjunctive-string*: Exported special variables
*api-prefix*: Exported special variables
*convert-intgral-slot-name-into-downcase*: Exported special variables
*params-case-insensitive-p*: Exported special variables
*rest-app*: Exported special variables

S
Special Variable, *api-conjunctive-string*: Exported special variables
Special Variable, *api-prefix*: Exported special variables
Special Variable, *convert-intgral-slot-name-into-downcase*: Exported special variables
Special Variable, *params-case-insensitive-p*: Exported special variables
Special Variable, *rest-app*: Exported special variables

Jump to:   *  
S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   <  
C   I   P   S  
Index Entry  Section

<
<app>: Internal classes

C
Class, <app>: Internal classes

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<dot>api package
integral-rest.route: The integral-rest<dot>route package
integral-rest.util: The integral-rest<dot>util package

P
Package, integral-rest: The integral-rest package
Package, integral-rest-asd: The integral-rest-asd package
Package, integral-rest.api: The integral-rest<dot>api package
Package, integral-rest.route: The integral-rest<dot>route package
Package, integral-rest.util: The integral-rest<dot>util package

S
System, integral-rest: The integral-rest system

Jump to:   <  
C   I   P   S