Skip to content

Commit f32a91d

Browse files
committed
scoped actions are back
1 parent 7afc998 commit f32a91d

30 files changed

+866
-1020
lines changed
Lines changed: 84 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,169 +1,158 @@
1-
---
2-
title: ApiInstance
3-
---
1+
---
2+
title: ApiInstance
3+
---
44

55
[![view on npm](http://img.shields.io/npm/v/@plexusjs/core.svg)](https://www.npmjs.org/package/@plexusjs/core)
66

77
An API instance is used to make requests to a server. Interact with this by using api()
88

9-
- [ApiInstance](#ApiInstance)
10-
- [.headers](#ApiInstance+headers) ⇒ <code>Record.&lt;string, string&gt;</code>
11-
- [.config](#ApiInstance+config) ⇒ <code>Record.&lt;string, any&gt;</code>
12-
- [.makeRequest(path, options)](#ApiInstance+makeRequest)
13-
- [.send(path, options)](#ApiInstance+send)
14-
- [.options(options, overwrite)](#ApiInstance+options) ⇒ <code>this</code>
15-
- [.get(path, query)](#ApiInstance+get)
16-
- [.post(path, body)](#ApiInstance+post) ⇒ <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code>
17-
- [.put(path, body)](#ApiInstance+put) ⇒ <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code>
18-
- [.delete(path)](#ApiInstance+delete) ⇒ <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code>
19-
- [.patch(path, body)](#ApiInstance+patch) ⇒ <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code>
20-
- [.gql(query, variables)](#ApiInstance+gql) ⇒ <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code>
21-
- [.auth(type, token)](#ApiInstance+auth) ⇒ <code>this</code>
22-
- [.reset()](#ApiInstance+reset) ⇒ <code>this</code>
23-
24-
<a name='ApiInstance+headers'></a>
259

26-
### .headers ⇒ <code>Record.&lt;string, string&gt;</code>
10+
* [ApiInstance](#ApiInstance)
11+
* [.headers](#ApiInstance+headers) ⇒ <code>Record.&lt;string, string&gt;</code>
12+
* [.config](#ApiInstance+config) ⇒ <code>Record.&lt;string, any&gt;</code>
13+
* [.makeRequest(path, options)](#ApiInstance+makeRequest)
14+
* [.send(path, options)](#ApiInstance+send)
15+
* [.options(options, overwrite)](#ApiInstance+options) ⇒ <code>this</code>
16+
* [.get(path, query)](#ApiInstance+get)
17+
* [.post(path, body)](#ApiInstance+post) ⇒ <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code>
18+
* [.put(path, body)](#ApiInstance+put) ⇒ <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code>
19+
* [.delete(path)](#ApiInstance+delete) ⇒ <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code>
20+
* [.patch(path, body)](#ApiInstance+patch) ⇒ <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code>
21+
* [.gql(query, variables)](#ApiInstance+gql) ⇒ <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code>
22+
* [.auth(type, token)](#ApiInstance+auth) ⇒ <code>this</code>
23+
* [.reset()](#ApiInstance+reset) ⇒ <code>this</code>
2724

28-
<p>Get the headers for the request</p>
25+
<a name="ApiInstance+headers"></a>
2926

30-
**Returns**: <code>Record.&lt;string, string&gt;</code> <p>The headers for the request</p>
27+
### .headers ⇒ <code>Record.&lt;string, string&gt;</code>
28+
<p>Get the headers for the request</p>
3129

32-
<a name='ApiInstance+config'></a>
30+
**Returns**: <code>Record.&lt;string, string&gt;</code> <p>The headers for the request</p>
31+
<a name="ApiInstance+config"></a>
3332

3433
### .config ⇒ <code>Record.&lt;string, any&gt;</code>
35-
3634
<p>The configuration of this api</p>
3735

38-
**Returns**: <code>Record.&lt;string, any&gt;</code> <p>The configuration of this api</p>
39-
40-
<a name='ApiInstance+makeRequest'></a>
36+
**Returns**: <code>Record.&lt;string, any&gt;</code> <p>The configuration of this api</p>
37+
<a name="ApiInstance+makeRequest"></a>
4138

4239
### .makeRequest(path, options)
43-
4440
<p>Send a request to the server</p>
4541

46-
| Param |
47-
| ------- |
48-
| path |
49-
| options |
5042

51-
<a name='ApiInstance+send'></a>
43+
| Param |
44+
| --- |
45+
| path |
46+
| options |
5247

53-
### .send(path, options)
48+
<a name="ApiInstance+send"></a>
5449

50+
### .send(path, options)
5551
<p>Do some pre-send stuff</p>
5652

57-
| Param |
58-
| ------- |
59-
| path |
60-
| options |
6153

62-
<a name='ApiInstance+options'></a>
54+
| Param |
55+
| --- |
56+
| path |
57+
| options |
6358

64-
### .options(options, overwrite) ⇒ <code>this</code>
59+
<a name="ApiInstance+options"></a>
6560

61+
### .options(options, overwrite) ⇒ <code>this</code>
6662
<p>Set the configuration options for fetch</p>
6763

68-
**Returns**: <code>this</code> <p>The current instance</p>
64+
**Returns**: <code>this</code> <p>The current instance</p>
6965

70-
| Param | Type | Default | Description |
71-
| --------- | ------------------------ | ------------------ | -------------------------------------------------------------------- |
72-
| options | <code>RequestInit</code> | | <p>Same as fetch options</p> |
73-
| overwrite | <code>boolean</code> | <code>false</code> | <p>(optional) If true, will overwrite the current options object</p> |
66+
| Param | Type | Default | Description |
67+
| --- | --- | --- | --- |
68+
| options | <code>RequestInit</code> | | <p>Same as fetch options</p> |
69+
| overwrite | <code>boolean</code> | <code>false</code> | <p>(optional) If true, will overwrite the current options object</p> |
7470

75-
<a name='ApiInstance+get'></a>
71+
<a name="ApiInstance+get"></a>
7672

7773
### .get(path, query)
78-
7974
<p>Send a get request</p>
8075

81-
| Param | Type | Description |
82-
| ----- | --------------------------------------- | ------------------------------------- |
83-
| path | <code>string</code> | <p>The url to send the request to</p> |
84-
| query | <code>Record.&lt;string, any&gt;</code> | <p>The url query to send</p> |
8576

86-
<a name='ApiInstance+post'></a>
77+
| Param | Type | Description |
78+
| --- | --- | --- |
79+
| path | <code>string</code> | <p>The url to send the request to</p> |
80+
| query | <code>Record.&lt;string, any&gt;</code> | <p>The url query to send</p> |
8781

88-
### .post(path, body) ⇒ <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code>
82+
<a name="ApiInstance+post"></a>
8983

84+
### .post(path, body) ⇒ <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code>
9085
<p>Send a post request</p>
9186

92-
**Returns**: <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code> <p>The response from the server</p>
87+
**Returns**: <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code> <p>The response from the server</p>
9388

94-
| Param | Type | Description |
95-
| ----- | -------------------------------------------------------------- | ---------------------------------------------------------- |
96-
| path | <code>string</code> | <p>The url to send the request to</p> |
97-
| body | <code>Record.&lt;string, any&gt;</code> \| <code>string</code> | <p>The body of the request (can be a string or object)</p> |
89+
| Param | Type | Description |
90+
| --- | --- | --- |
91+
| path | <code>string</code> | <p>The url to send the request to</p> |
92+
| body | <code>Record.&lt;string, any&gt;</code> \| <code>string</code> | <p>The body of the request (can be a string or object)</p> |
9893

99-
<a name='ApiInstance+put'></a>
94+
<a name="ApiInstance+put"></a>
10095

10196
### .put(path, body) ⇒ <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code>
102-
10397
<p>Send a put request</p>
10498

105-
**Returns**: <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code> <p>The response from the server</p>
99+
**Returns**: <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code> <p>The response from the server</p>
106100

107-
| Param | Type | Description |
108-
| ----- | -------------------------------------------------------------- | ---------------------------------------------------------- |
109-
| path | <code>string</code> | <p>The url to send the request to</p> |
110-
| body | <code>Record.&lt;string, any&gt;</code> \| <code>string</code> | <p>The body of the request (can be a string or object)</p> |
101+
| Param | Type | Description |
102+
| --- | --- | --- |
103+
| path | <code>string</code> | <p>The url to send the request to</p> |
104+
| body | <code>Record.&lt;string, any&gt;</code> \| <code>string</code> | <p>The body of the request (can be a string or object)</p> |
111105

112-
<a name='ApiInstance+delete'></a>
106+
<a name="ApiInstance+delete"></a>
113107

114108
### .delete(path) ⇒ <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code>
115-
116109
<p>Send a delete request</p>
117110

118-
**Returns**: <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code> <p>The response from the server</p>
111+
**Returns**: <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code> <p>The response from the server</p>
119112

120-
| Param | Type | Description |
121-
| ----- | ------------------- | ------------------------------------- |
122-
| path | <code>string</code> | <p>The url to send the request to</p> |
113+
| Param | Type | Description |
114+
| --- | --- | --- |
115+
| path | <code>string</code> | <p>The url to send the request to</p> |
123116

124-
<a name='ApiInstance+patch'></a>
117+
<a name="ApiInstance+patch"></a>
125118

126119
### .patch(path, body) ⇒ <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code>
127-
128120
<p>Send a patch request</p>
129121

130-
**Returns**: <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code> <p>The response from the server</p>
122+
**Returns**: <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code> <p>The response from the server</p>
131123

132-
| Param | Type | Description |
133-
| ----- | -------------------------------------------------------------- | ---------------------------------------------------------- |
134-
| path | <code>string</code> | <p>The url to send the request to</p> |
135-
| body | <code>Record.&lt;string, any&gt;</code> \| <code>string</code> | <p>The body of the request (can be a string or object)</p> |
124+
| Param | Type | Description |
125+
| --- | --- | --- |
126+
| path | <code>string</code> | <p>The url to send the request to</p> |
127+
| body | <code>Record.&lt;string, any&gt;</code> \| <code>string</code> | <p>The body of the request (can be a string or object)</p> |
136128

137-
<a name='ApiInstance+gql'></a>
129+
<a name="ApiInstance+gql"></a>
138130

139131
### .gql(query, variables) ⇒ <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code>
140-
141132
<p>Send a graphql request</p>
142133

143-
**Returns**: <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code> <p>The response from the server</p>
134+
**Returns**: <code>Promise.&lt;PlexusApiRes.&lt;unknown&gt;&gt;</code> <p>The response from the server</p>
144135

145-
| Param | Type | Description |
146-
| --------- | --------------------------------------- | ---------------------------- |
147-
| query | <code>string</code> | <p>The gql query to send</p> |
148-
| variables | <code>Record.&lt;string, any&gt;</code> | <p>Variables</p> |
136+
| Param | Type | Description |
137+
| --- | --- | --- |
138+
| query | <code>string</code> | <p>The gql query to send</p> |
139+
| variables | <code>Record.&lt;string, any&gt;</code> | <p>Variables</p> |
149140

150-
<a name='ApiInstance+auth'></a>
141+
<a name="ApiInstance+auth"></a>
151142

152143
### .auth(type, token) ⇒ <code>this</code>
153-
154144
<p>Set the authentication details for the request</p>
155145

156-
**Returns**: <code>this</code> <p>The current instance</p>
146+
**Returns**: <code>this</code> <p>The current instance</p>
157147

158-
| Param | Type | Description |
159-
| ----- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
160-
| type | <code>&#x27;bearer&#x27;</code> \| <code>&#x27;basic&#x27;</code> \| <code>&#x27;jwt&#x27;</code> | <p>optional - The type of authentication to use. This determines what prefix to use for the header</p> |
161-
| token | <code>string</code> | <p>The token to use for authentication</p> |
148+
| Param | Type | Description |
149+
| --- | --- | --- |
150+
| type | <code>&#x27;bearer&#x27;</code> \| <code>&#x27;basic&#x27;</code> \| <code>&#x27;jwt&#x27;</code> | <p>optional - The type of authentication to use. This determines what prefix to use for the header</p> |
151+
| token | <code>string</code> | <p>The token to use for authentication</p> |
162152

163-
<a name='ApiInstance+reset'></a>
153+
<a name="ApiInstance+reset"></a>
164154

165155
### .reset() ⇒ <code>this</code>
166-
167156
<p>Reset this routes configuration</p>
168157

169-
**Returns**: <code>this</code> <p>The current instance</p>
158+
**Returns**: <code>this</code> <p>The current instance</p>
Lines changed: 38 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,85 @@
1-
---
2-
title: CollectionData
3-
---
1+
---
2+
title: CollectionData
3+
---
44

55
[![view on npm](http://img.shields.io/npm/v/@plexusjs/core.svg)](https://www.npmjs.org/package/@plexusjs/core)
66

77
A piece of data belonging to a collection
88

9-
- [CollectionData](#CollectionData)
10-
- [.id](#CollectionData+id) : <code>string</code>
11-
- [.instanceId](#CollectionData+instanceId) : <code>string</code>
12-
- [.value](#CollectionData+value) : <code>DataType</code>
13-
- [.shallowValue](#CollectionData+shallowValue) : <code>DataType</code>
14-
- [.set(value)](#CollectionData+set) ⇒ <code>this</code>
15-
- [.patch(value)](#CollectionData+patch) ⇒ <code>this</code>
16-
- [.delete()](#CollectionData+delete) ⇒ <code>this</code>
17-
- [.clean()](#CollectionData+clean) ⇒ <code>this</code>
18-
- [.decay(time)](#CollectionData+decay) ⇒ <code>this</code>
199

20-
<a name='CollectionData+id'></a>
10+
* [CollectionData](#CollectionData)
11+
* [.id](#CollectionData+id) : <code>string</code>
12+
* [.instanceId](#CollectionData+instanceId) : <code>string</code>
13+
* [.value](#CollectionData+value) : <code>DataType</code>
14+
* [.shallowValue](#CollectionData+shallowValue) : <code>DataType</code>
15+
* [.set(value)](#CollectionData+set) ⇒ <code>this</code>
16+
* [.patch(value)](#CollectionData+patch) ⇒ <code>this</code>
17+
* [.delete()](#CollectionData+delete) ⇒ <code>this</code>
18+
* [.clean()](#CollectionData+clean) ⇒ <code>this</code>
19+
* [.decay(time)](#CollectionData+decay) ⇒ <code>this</code>
2120

22-
### .id : <code>string</code>
21+
<a name="CollectionData+id"></a>
2322

23+
### .id : <code>string</code>
2424
<p>The internal id of the state with an instance prefix</p>
2525

26-
<a name='CollectionData+instanceId'></a>
26+
<a name="CollectionData+instanceId"></a>
2727

2828
### .instanceId : <code>string</code>
29-
3029
<p>The internal id of the state with an instance prefix</p>
3130

32-
<a name='CollectionData+value'></a>
31+
<a name="CollectionData+value"></a>
3332

3433
### .value : <code>DataType</code>
35-
3634
<p>Get the value of the data instance</p>
3735

38-
<a name='CollectionData+shallowValue'></a>
36+
<a name="CollectionData+shallowValue"></a>
3937

4038
### .shallowValue : <code>DataType</code>
39+
<p>Get the shallow value of the data instance (no foreign key values injected)</p>
4140

42-
<p>
43-
Get the shallow value of the data instance (no foreign key values injected)
44-
</p>
45-
46-
<a name='CollectionData+set'></a>
41+
<a name="CollectionData+set"></a>
4742

4843
### .set(value) ⇒ <code>this</code>
49-
5044
<p>Set the value of the data instance</p>
5145

52-
**Returns**: <code>this</code> <p>The data instance</p>
46+
**Returns**: <code>this</code> <p>The data instance</p>
5347

54-
| Param | Type | Description |
55-
| ----- | --------------------- | ----------------------- |
48+
| Param | Type | Description |
49+
| --- | --- | --- |
5650
| value | <code>DataType</code> | <p>The value to set</p> |
5751

58-
<a name='CollectionData+patch'></a>
52+
<a name="CollectionData+patch"></a>
5953

6054
### .patch(value) ⇒ <code>this</code>
61-
6255
<p>Patch the current value of the state</p>
6356

64-
**Returns**: <code>this</code> <p>The data instance</p>
57+
**Returns**: <code>this</code> <p>The data instance</p>
6558

66-
| Param | Type | Description |
67-
| ----- | --------------------- | ----------------------------------------------------------- |
59+
| Param | Type | Description |
60+
| --- | --- | --- |
6861
| value | <code>DataType</code> | <p>A value of the state to merge with the current value</p> |
6962

70-
<a name='CollectionData+delete'></a>
63+
<a name="CollectionData+delete"></a>
7164

7265
### .delete() ⇒ <code>this</code>
73-
7466
<p>Delete the data instance</p>
7567

76-
**Returns**: <code>this</code> <p>The data instance</p>
77-
78-
<a name='CollectionData+clean'></a>
68+
**Returns**: <code>this</code> <p>The data instance</p>
69+
<a name="CollectionData+clean"></a>
7970

8071
### .clean() ⇒ <code>this</code>
72+
<p>Clean this data instance (remove all watchers &amp; remove the state from the instance)</p>
8173

82-
<p>
83-
Clean this data instance (remove all watchers &amp; remove the state from the
84-
instance)
85-
</p>
86-
87-
**Returns**: <code>this</code> <p>The data instance</p>
88-
89-
<a name='CollectionData+decay'></a>
74+
**Returns**: <code>this</code> <p>The data instance</p>
75+
<a name="CollectionData+decay"></a>
9076

9177
### .decay(time) ⇒ <code>this</code>
92-
9378
<p>Decay this data instance after a certain amount of time</p>
9479

95-
**Returns**: <code>this</code> <p>The data instance</p>
80+
**Returns**: <code>this</code> <p>The data instance</p>
81+
82+
| Param | Type | Description |
83+
| --- | --- | --- |
84+
| time | <code>boolean</code> \| <code>string</code> | <p>The time to decay in ms</p> |
9685

97-
| Param | Type | Description |
98-
| ----- | ------------------------------------------- | ------------------------------ |
99-
| time | <code>boolean</code> \| <code>string</code> | <p>The time to decay in ms</p> |

0 commit comments

Comments
 (0)