all repos — litestore @ ef312937774367a3383a876ee9cc88349e0974fa

A minimalist nosql document store.

src/admin/md/nim-api_high.md

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
### High-Level Nim API

The following [proc](class:kwd)s map 1:1 to the corresponding HTTP methods. This API is recommended for most uses, as every method triggers exactly the same logic as the corresponding HTTP request.

#### get

     proc get*(resource, id: string, params = newStringTable(), headers = newHttpHeaders()): LSResponse

Retrieves a resource.

##### Parameters

<dl>
<dt>resource</dt>
<dd>The resource to perform the operation on <span class="kwd">info</span> or <span class="kwd">docs</span>.</dd>
<dt>id</dt> 
<dd>The identifier of the resource (set to an empty string if not needed).</dd>
<dt>params</dt>
<dd>The parameters to pass to the operation (see the corresponding HTTP querystring parameters).</dd>
<dt>headers</dt>
<dd>An <span class="kwd">HttpHeaders</span> object containing the headers of the request. Use the <span class="kwd">Content-Type</span> header to specify the content type of the <span class="kwd">body</span> parameter.</dd>
</dl>

#### post

     proc post*(resource, id, body: string, headers = newHttpHeaders()): LSResponse

Creates a new resource.

##### Parameters

<dl>
<dt>resource</dt>
<dd>The resource to perform the operation on <span class="kwd">info</span> or <span class="kwd">docs</span>.</dd>
<dt>folder</dt>
<dd>The folder that will contain the resource (set to an empty string if not needed).</dd>
<dt>body</dt>
<dd>The request body.</dd>
<dt>headers</dt>
<dd>An <span class="kwd">HttpHeaders</span> object containing the headers of the request. Use the <span class="kwd">Content-Type</span> header to specify the content type of the <span class="kwd">body</span> parameter.</dd>
</dl>

#### put

     proc put*(resource, id, body: string, headers = newHttpHeaders()): LSResponse

Modifies an existing resource.

##### Parameters

<dl>
<dt>resource</dt>
<dd>The resource to perform the operation on <span class="kwd">info</span> or <span class="kwd">docs</span>.</dd>
<dt>id</dt> 
<dd>The identifier of the resource (set to an empty string if not needed).</dd>
<dt>body</dt>
<dd>The request body.</dd>
<dt>headers</dt>
<dd>An <span class="kwd">HttpHeaders</span> object containing the headers of the request. Use the <span class="kwd">Content-Type</span> header to specify the content type of the <span class="kwd">body</span> parameter.</dd>
</dl>

#### patch

     proc patch*(resource, id, body: string, headers = newHttpHeaders()): LSResponse

Modifies the tags of an existing resource (or the data of a JSON document).

##### Parameters

<dl>
<dt>resource</dt>
<dd>The resource to perform the operation on <span class="kwd">info</span> or <span class="kwd">docs</span>.</dd>
<dt>id</dt> 
<dd>The identifier of the resource (set to an empty string if not needed).</dd>
<dt>body</dt>
<dd>The request body.</dd>
<dt>headers</dt>
<dd>An <span class="kwd">HttpHeaders</span> object containing the headers of the request. Use the <span class="kwd">Content-Type</span> header to specify the content type of the <span class="kwd">body</span> parameter.</dd>
</dl>

#### delete

     proc delete*(resource, id: string, headers = newHttpHeaders()): LSResponse

Deletes an existing resource.

##### Parameters

<dl>
<dt>resource</dt>
<dd>The resource to perform the operation on <span class="kwd">info</span> or <span class="kwd">docs</span>.</dd>
<dt>id</dt> 
<dd>The identifier of the resource (set to an empty string if not needed).</dd>
<dt>headers</dt>
<dd>An <span class="kwd">HttpHeaders</span> object containing the headers of the request. Use the <span class="kwd">Content-Type</span> header to specify the content type of the <span class="kwd">body</span> parameter.</dd>
</dl>

#### head

     proc head*(resource, id: string, headers = newHttpHeaders()): LSResponse

Checks whether a resource exists or not.

##### Parameters

<dl>
<dt>resource</dt>
<dd>The resource to perform the operation on <span class="kwd">info</span> or <span class="kwd">docs</span>.</dd>
<dt>id</dt> 
<dd>The identifier of the resource (set to an empty string if not needed).</dd>
<dt>headers</dt>
<dd>An <span class="kwd">HttpHeaders</span> object containing the headers of the request. Use the <span class="kwd">Content-Type</span> header to specify the content type of the <span class="kwd">body</span> parameter.</dd>
</dl>

#### options

     proc options*(resource, id: string, headers = newHttpHeaders()): LSResponse

Checks what HTTP methods are supported by the specified resource.

##### Parameters

<dl>
<dt>resource</dt>
<dd>The resource to perform the operation on <span class="kwd">info</span> or <span class="kwd">docs</span>.</dd>
<dt>id</dt> 
<dd>The identifier of the resource (set to an empty string if not needed).</dd>
<dt>headers</dt>
<dd>An <span class="kwd">HttpHeaders</span> object containing the headers of the request. Use the <span class="kwd">Content-Type</span> header to specify the content type of the <span class="kwd">body</span> parameter.</dd>
</dl>