https://github.com/versbinarii/spike
(Dead)
https://github.com/versbinarii/spike
actix actix-web diesel-rs rest-api rust
Last synced: about 1 year ago
JSON representation
(Dead)
- Host: GitHub
- URL: https://github.com/versbinarii/spike
- Owner: VersBinarii
- Created: 2019-04-25T16:15:10.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-21T09:53:29.000Z (about 7 years ago)
- Last Synced: 2025-03-01T10:21:57.864Z (over 1 year ago)
- Topics: actix, actix-web, diesel-rs, rest-api, rust
- Language: Rust
- Homepage:
- Size: 46.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
README
* WORK IN PROGRESS
* Spike API
* Number blocks
Number blocks and DDIs are going to be treated interchangeably.
Bloc are allowed only in powers of 10 (1, 10, 100) etc.
If 3 number are requested then 3 blocks of 1 are created, for 32 numbers 3 blocks of 10 and 2 blocks of 1 are created etc...
* Design
** MNA (Designation)
The assignement of numbers will be constrained by the designation
assigned to the number. The designation is a set of information describing the
validation rules that should be applied to number.
* API
** Assumptions
Each API endpoint will support pagination (where applicable).
** Authentication
In order to authenticate a `POST` request needs to be made to the `/login` endpoint.
#+BEGIN_SRC bash
curl -XPOST -H 'Content-Type: application/json' -d'{"username": "admin", "password":"admin"}' 'http://localhost:9080/login'
#+END_SRC
The response will contain an authentication token that needs to be included
into every ubsequent call. I.e.:
#+BEGIN_SRC bash
curl -XGET -H 'token: 4984f8116c364679aebb952a60f092e5' 'http://localhost:8080/mna'
#+END_SRC
** Number
GET numbers - list all
#+BEGIN_SRC bash
curl -XGET -H 'token: 4984f8116c364679aebb952a60f092e5' 'http://localhost:9080/numbers'
#+END_SRC
GET numbers/:id - info on number id
#+BEGIN_SRC bash
curl -XGET -H 'token: 4984f8116c364679aebb952a60f092e5' 'http://localhost:9080/numbers/1'
#+END_SRC
POST numbers - Create new number
#+BEGIN_SRC bash
curl -XPOST -H 'Content-Type: application/json' -H 'token: 4984f8116c364679aebb952a60f092e5' 'http://localhost:9080/numbers' \
-d'{"number": "4567890", "number_type": "NonGeo", "number_status": "Available", "mna_id": 1, "wlr": false, "is_main_number": false, "ecas":false}'
#+END_SRC
PUT numbers/:id - Update number with the specfied ID
#+BEGIN_SRC bash
curl -XPUT -H 'Content-Type: application/json' -H 'token: 4984f8116c364679aebb952a60f092e5' 'http://localhost:9080/numbers' \
-d'{"number": "4567890", "number_type": "Geo", "number_status":"Assigned", "mna_id": 1, "wlr": false, "is_main_number": true, "ecas":true}'
#+END_SRC
*** Unimplemented:
DELETE numbers/:id
GET numbers/new - find new available number
GET numbers/:id/status - show the status of the number
GET numbers/search - lookup numbers
** MNA
GET mna - list all MNAs
GET mna/:id - retrive single MNA
POST mna - create new MNA
PUT mna/:id - update MNA
*** Unimplemented:
GET mna/:id/numbers - list all numbers for this MNA
DELETE mna/:id - delete MNA
** RSP
GET rsp - list all RSPs
** Subscriber
** Address
** Porting