Specifications - gropax/qiq GitHub Wiki

Actions

I. Actions on Notes

A. Create note

Create a new note on the server.

Command line
$ qiq note new --buffer proj/philo --tag plato,socrates
(vim)
Request
POST /notes.json HTTP/1.1
Host: www.gropax.ninja

{"note":
    {
        "content": "This is a cool note",
        "buffers": ["proj/philo"],
        "tags": ["plato", "socrates"]
    }
}
Response
HTTP/1.1 201 Created
Location: www.gropax.ninja/notes/123

{
  "id": 123,
  "content": "This is a cool note",
  "created_at": "28-12-2014 14:35:41",
  "updated_at": "28-12-2014 14:35:41",
  "url": "www.gropax.ninja/notes/123"
}
Terminal ouput
$ qiq note new --content "This is a cool note"
123
Options
$ qiq note new --content "This is a cool note"  # create inline
$ qiq note new --file dir/note_file             # create from file
$ echo "This is a cool note" | qiq note new     # create from pipe
$ qiq note new [--editor vim]                   # create in text editor

$ qiq note new --tag plato,socrates  # create note with tags
$ qiq note new --buffer proj/philo     # create note in buffers
B. Update note

Update a new note on the server.

Command line
$ qiq note edit 123 [--editor vim]   # edit in text editor
Request
PUT /notes/123.json HTTP/1.1
Host: www.gropax.ninja

{"content": "This is an updated cool note"}
Response
HTTP/1.1 204 No Content

Terminal ouput
$ qiq note edit 123
(vim)
123
C. Delete note

Delete a note on the server.

Command line
$ qiq note delete 123
Request
DELETE /notes/123.json HTTP/1.1
Host: www.gropax.ninja

Response
HTTP/1.1 204 No Content

Terminal ouput
$ qiq note delete 123
123
D. Show note

Get a note from the server.

Command line
$ qiq note show 123
Request
GET /notes/123.json HTTP/1.1
Host: www.gropax.ninja

Response
HTTP/1.1 200 OK

{
  "id": 123,
  "content": "This is an updated cool note",
  "created_at": "28-12-2014 14:35:41",
  "updated_at": "28-12-2014 14:56:19",
  "url": "www.gropax.ninja/notes/123"
}
Terminal ouput
$ qiq note show 123
This is an updated cool note
Options
$ qiq note show 123
$ qiq note show --last
$ qiq note show --buffer proj/philo --first
E. List notes
Command line
$ qiq note list --buffer proj/philo --tag plato,socrates
Request
GET /notes.json HTTP/1.1
Host: www.gropax.ninja

{"buffers": ["proj/philo"], "tags": ["plato", "socrates"]}
Response
HTTP/1.1 200 OK

[
    {
      "id": 123,
      "content": "This is a cool note",
      "created_at": "28-12-2014 14:35:41",
      "updated_at": "28-12-2014 14:35:41",
      "url": "www.gropax.ninja/notes/123"
    },
    ...
]
Terminal ouput
$ qiq note list --buffer proj/philo --tag plato,socrates
#123
  This is a cool note

...
Options
$ qiq note list --all
$ qiq note list --buffer proj/chinese
$ qiq note list --tag plato,socrates

$ qiq note list --created-after 25/12/2014
$ qiq note list --updated-before 25/12/2014

$ qiq note list --buffer proj/chinese/*  # Use wildcard selectors for buffers