on master help sign in
17 files changed+68−82
since splitsnapshots
unifiedsplit
LICENSE Procfile Setup.hs app.json app/Main.hs docs.md docs/Docs.hs package.yaml readme.md+67−80 src/Data/CyclicBuffer.hs src/Data/Error.hs src/Foo/Data.hs+1−1 src/Lib.hs−1 src/Network/Bacon.hs stack.yaml swagger/Swagger.hs test/Spec.hs
LICENSEmode 100644 → 100755

Only the mode changed.

Procfilemode 100644 → 100755

Only the mode changed.

Setup.hsmode 100644 → 100755

Only the mode changed.

app.jsonmode 100644 → 100755

Only the mode changed.

app/Main.hsmode 100644 → 100755

Only the mode changed.

docs.mdmode 100644 → 100755

Only the mode changed.

docs/Docs.hsmode 100644 → 100755

Only the mode changed.

package.yamlmode 100644 → 100755

Only the mode changed.

readme.mdmode 100644 → 100755+67−80
@@ -6,10 +6,6 @@ _url: [`https://websuck1t.herokuapp.com`](https://websuck1t.herokuapp.com)_
66
77## GET /posts/all
88
9−_start with: [`https://websuck1t.herokuapp.com/posts/all`](https://websuck1t.herokuapp.com/posts/all)_
10−
11−Use this _url_ to get the token every time when application begins and previous session was closed
12−
139### Response:
1410
1511- Status code 200
@@ -59,19 +55,82 @@ Use this _url_ to get the token every time when application begins and previous
5955}
6056```
6157
62−### Response fields
58+## GET /users/:id
59+
60+Retrieves a user with the given `id`.
61+
62+#### If there is no user with the given `id`, the method returns error `404`.
63+
64+### Captures:
65+
66+- *id*: The id of the entity you want to query.
6367
64−- "token" to further use it in subscription to web socket
65−- "response" to start with the given number of posts in table
68+### Response:
69+
70+- Status code 200
71+- Headers: []
72+
73+- Supported content types are:
74+
75+ - `application/json`
76+
77+- Example (`application/json`):
78+
79+```javascript
80+{
81+ "userName": {
82+ "secondName": "Leonidovich",
83+ "firstName": "Seva"
84+ },
85+ "userId": 1
86+}
87+```
88+
89+- Example (`application/json`):
90+
91+```javascript
92+{
93+ "userName": {
94+ "secondName": "Barovich",
95+ "firstName": "Foo"
96+ },
97+ "userId": 42
98+}
99+```
100+
101+- Example (`application/json`):
102+
103+```javascript
104+{
105+ "userName": {
106+ "secondName": "Fooovich",
107+ "firstName": "Bar"
108+ },
109+ "userId": 69
110+}
111+```
112+
113+- Example (`application/json`):
114+
115+```javascript
116+{
117+ "userName": {
118+ "secondName": "Quixovich",
119+ "firstName": "Qux"
120+ },
121+ "userId": 8
122+}
123+```
66124
67125## WebSocket /posts/subscribe/:token
68126
69127You access the web socket with the web socket protocol. I. e. `https://` -> `ws://`.
70128
71−Open a web socket from the given `token` for receiving events about new and deleted posts with `ws://websuck1t.herokuapp.com/posts/subscribe/{token}`
129+Open a web socket from the given `token` for receiving events about new and deleted posts.
72130
73131#### Returns error `498` if the supplied token has expired or is invalid.
74132
133+
75134### Captures:
76135
77136- *token*: The token, received with the previous request.
@@ -98,8 +157,6 @@ Open a web socket from the given `token` for receiving events about new and dele
98157
99158## GET /posts/:id
100159
101−_url: [`https://websuck1t.herokuapp.com/posts/{id}`](https://websuck1t.herokuapp.com/posts/1)_
102−
103160#### If there is no post with the given `id`, the method returns error `404`.
104161
105162### Captures:
@@ -164,73 +221,3 @@ _url: [`https://websuck1t.herokuapp.com/posts/{id}`](https://websuck1t.herokuapp
164221 "postId": 1
165222}
166223```
167−
168−
169−## GET /users/:id
170−
171−_url: [`https://websuck1t.herokuapp.com/users/{id}`](https://websuck1t.herokuapp.com/users/1)_
172−
173−Retrieves a user with the given `id`.
174−
175−#### If there is no user with the given `id`, the method returns error `404`.
176−
177−### Captures:
178−
179−- *id*: The id of the entity you want to query.
180−
181−### Response:
182−
183−- Status code 200
184−- Headers: []
185−
186−- Supported content types are:
187−
188− - `application/json`
189−
190−- Example (`application/json`):
191−
192−```javascript
193−{
194− "userName": {
195− "secondName": "Leonidovich",
196− "firstName": "Seva"
197− },
198− "userId": 1
199−}
200−```
201−
202−- Example (`application/json`):
203−
204−```javascript
205−{
206− "userName": {
207− "secondName": "Barovich",
208− "firstName": "Foo"
209− },
210− "userId": 42
211−}
212−```
213−
214−- Example (`application/json`):
215−
216−```javascript
217−{
218− "userName": {
219− "secondName": "Fooovich",
220− "firstName": "Bar"
221− },
222− "userId": 69
223−}
224−```
225−
226−- Example (`application/json`):
227−
228−```javascript
229−{
230− "userName": {
231− "secondName": "Quixovich",
232− "firstName": "Qux"
233− },
234− "userId": 8
235−}
236−```
src/Data/CyclicBuffer.hsmode 100644 → 100755

Only the mode changed.

src/Data/Error.hsmode 100644 → 100755

Only the mode changed.

src/Foo/Data.hsmode 100644 → 100755+1−1
@@ -85,7 +85,7 @@ createConfig :: IO Config
8585createConfig = do
8686 mng <- newManager tlsManagerSettings
8787 cfg <- atomically $ Config <$> newTVar 0 <*> newTVar 0 <*> newTVar M.empty <*> newTVar M.empty <*> return mng <*> newTVar M.empty <*> newTVar 0 <*> newTVar (CB.empty 20)
88− forkIO . forever $ threadDelay 7000000 >> (runHandler . createApp cfg $ startAddingPosts 20 cfg >>= uncurry sendUpdate)
88+ forkIO . forever $ threadDelay 2000000 >> (runHandler . createApp cfg $ startAddingPosts 20 cfg >>= uncurry sendUpdate)
8989 return cfg
9090
9191type Token = Int
src/Lib.hsmode 100644 → 100755−1
@@ -42,7 +42,6 @@ createServer = do
4242 atomically $ newUser cfg "Anna" "Androidovna"
4343 atomically $ newUser cfg "Darya" "Aiphonovna"
4444 atomically $ newUser cfg "Ilya" "Serverovich"
45− atomically $ newUser cfg "Константин" "Дудосерович"
4645 return $ hoistServer server (createApp cfg) serverAPI
4746
4847server :: Proxy API
src/Network/Bacon.hsmode 100644 → 100755

Only the mode changed.

stack.yamlmode 100644 → 100755

Only the mode changed.

swagger/Swagger.hsmode 100644 → 100755

Only the mode changed.

test/Spec.hsmode 100644 → 100755

Only the mode changed.