11# Module Documentation
22
3+ ## Module Type.Proxy
4+
5+ #### ` Proxy `
6+
7+ ``` purescript
8+ data Proxy a
9+ = Proxy
10+ ```
11+
12+
13+
314## Module Network.HTTP.Affjax
415
516#### ` Ajax `
@@ -18,13 +29,19 @@ type Affjax e a = Aff (ajax :: Ajax | e) (AffjaxResponse a)
1829
1930The type for Affjax requests.
2031
21- #### ` AffjaxOptions `
32+ #### ` AffjaxRequest `
2233
2334``` purescript
24- data AffjaxOptions :: *
35+ type AffjaxRequest a = { password :: Maybe String, username :: Maybe String, content :: Maybe a, headers :: [RequestHeader], url :: URL, method :: Method }
36+ ```
37+
38+
39+ #### ` defaultRequest `
40+
41+ ``` purescript
42+ defaultRequest :: AffjaxRequest Unit
2543```
2644
27- Options type for Affjax requests.
2845
2946#### ` AffjaxResponse `
3047
@@ -42,109 +59,53 @@ type URL = String
4259
4360Type alias for URL strings to aid readability of types.
4461
45- #### ` url `
46-
47- ``` purescript
48- url :: Option AffjaxOptions URL
49- ```
50-
51- Sets the URL for a request.
52-
53- #### ` method `
54-
55- ``` purescript
56- method :: Option AffjaxOptions Method
57- ```
58-
59- Sets the HTTP method for a request.
60-
61- #### ` content `
62-
63- ``` purescript
64- content :: Option AffjaxOptions RequestContent
65- ```
66-
67- Sets the content to send in a request.
68-
69- #### ` headers `
70-
71- ``` purescript
72- headers :: Option AffjaxOptions [RequestHeader]
73- ```
74-
75- Sets the headers to send with a request.
76-
77- #### ` username `
78-
79- ``` purescript
80- username :: Option AffjaxOptions String
81- ```
82-
83- Sets the HTTP auth username to send with a request.
84-
85- #### ` password `
86-
87- ``` purescript
88- password :: Option AffjaxOptions String
89- ```
90-
91- Sets the HTTP auth password to send with a request.
92-
9362#### ` affjax `
9463
9564``` purescript
96- affjax :: forall e a. Responsable a -> Options AffjaxOptions -> Affjax e a
97- ```
98-
99- Runs a request.
100-
101- #### ` affjax' `
102-
103- ``` purescript
104- affjax' :: forall e a. Responsable a -> Options AffjaxOptions -> (Error -> Eff (ajax :: Ajax | e) Unit) -> (AffjaxResponse a -> Eff (ajax :: Ajax | e) Unit) -> Eff (ajax :: Ajax | e) Unit
65+ affjax :: forall e a b. (Requestable a, Responsable b) => AffjaxRequest a -> Affjax e b
10566```
10667
107- Runs a request directly in Eff .
68+ Makes an ` Affjax ` request .
10869
10970#### ` get `
11071
11172``` purescript
112- get :: forall e a. URL -> Responsable a -> Affjax e a
73+ get :: forall e a. ( Responsable a) => URL -> Affjax e a
11374```
11475
11576
11677#### ` post `
11778
11879``` purescript
119- post :: forall e a. URL -> Responsable a -> RequestContent -> Affjax e a
80+ post :: forall e a b. (Requestable a, Responsable b) => URL -> a -> Affjax e b
12081```
12182
12283
12384#### ` post_ `
12485
12586``` purescript
126- post_ :: forall e. URL -> RequestContent -> Affjax e Unit
87+ post_ :: forall e a. (Requestable a) => URL -> a -> Affjax e Unit
12788```
12889
12990
13091#### ` put `
13192
13293``` purescript
133- put :: forall e a. URL -> Responsable a -> RequestContent -> Affjax e a
94+ put :: forall e a b. (Requestable a, Responsable b) => URL -> a -> Affjax e b
13495```
13596
13697
13798#### ` put_ `
13899
139100``` purescript
140- put_ :: forall e. URL -> RequestContent -> Affjax e Unit
101+ put_ :: forall e a. (Requestable a) => URL -> a -> Affjax e Unit
141102```
142103
143104
144105#### ` delete `
145106
146107``` purescript
147- delete :: forall e a. URL -> Responsable a -> Affjax e a
108+ delete :: forall e a. ( Responsable a) => URL -> Affjax e a
148109```
149110
150111
@@ -155,6 +116,14 @@ delete_ :: forall e. URL -> Affjax e Unit
155116```
156117
157118
119+ #### ` affjax' `
120+
121+ ``` purescript
122+ affjax' :: forall e a b. (Requestable a, Responsable b) => AffjaxRequest a -> (Error -> Eff (ajax :: Ajax | e) Unit) -> (AffjaxResponse b -> Eff (ajax :: Ajax | e) Unit) -> Eff (ajax :: Ajax | e) Unit
123+ ```
124+
125+ Run a request directly without using ` Aff ` .
126+
158127
159128## Module Network.HTTP.Method
160129
@@ -189,13 +158,6 @@ instance showMethod :: Show Method
189158```
190159
191160
192- #### ` isOptionMethod `
193-
194- ``` purescript
195- instance isOptionMethod :: IsOption Method
196- ```
197-
198-
199161#### ` methodToString `
200162
201163``` purescript
@@ -262,13 +224,6 @@ instance showRequestHeader :: Show RequestHeader
262224```
263225
264226
265- #### ` isOptionRequestHeader `
266-
267- ``` purescript
268- instance isOptionRequestHeader :: IsOption RequestHeader
269- ```
270-
271-
272227#### ` requestHeaderName `
273228
274229``` purescript
@@ -351,18 +306,11 @@ data RequestContent :: *
351306Type representing all content types that be sent via XHR (ArrayBufferView,
352307Blob, Document, String, FormData).
353308
354- #### ` isOptionRequestContent `
355-
356- ``` purescript
357- instance isOptionRequestContent :: IsOption RequestContent
358- ```
359-
360-
361309#### ` Requestable `
362310
363311``` purescript
364312class Requestable a where
365- toContent :: a -> RequestContent
313+ toRequest :: a -> RequestContent
366314```
367315
368316A class for types that can be converted to values that can be sent with
@@ -488,106 +436,43 @@ Type representing content types that be received from an XHR request
488436#### ` Responsable `
489437
490438``` purescript
491- data Responsable a
492- = Responsable (ResponseContent -> F a) ResponseType
493- ```
494-
495-
496- #### ` rInt8Array `
497-
498- ``` purescript
499- rInt8Array :: Responsable A.Int8Array
500- ```
501-
502-
503- #### ` rInt16Array `
504-
505- ``` purescript
506- rInt16Array :: Responsable A.Int16Array
507- ```
508-
509-
510- #### ` rInt32Array `
511-
512- ``` purescript
513- rInt32Array :: Responsable A.Int32Array
514- ```
515-
516-
517- #### ` rUint8Array `
518-
519- ``` purescript
520- rUint8Array :: Responsable A.Uint8Array
521- ```
522-
523-
524- #### ` rUint16Array `
525-
526- ``` purescript
527- rUint16Array :: Responsable A.Uint16Array
528- ```
529-
530-
531- #### ` rUint32Array `
532-
533- ``` purescript
534- rUint32Array :: Responsable A.Uint32Array
535- ```
536-
537-
538- #### ` rUint8ClampedArray `
539-
540- ``` purescript
541- rUint8ClampedArray :: Responsable A.Uint8ClampedArray
542- ```
543-
544-
545- #### ` rFloat32Array `
546-
547- ``` purescript
548- rFloat32Array :: Responsable A.Float32Array
439+ class Responsable a where
440+ responseType :: Proxy a -> ResponseType
441+ fromResponse :: ResponseContent -> F a
549442```
550443
551444
552- #### ` rFloat64Array `
445+ #### ` responsableBlob `
553446
554447``` purescript
555- rFloat64Array :: Responsable A.Float64Array
448+ instance responsableBlob :: Responsable Blob
556449```
557450
558-
559- #### ` rBlob `
451+ #### ` responsableDocument `
560452
561453``` purescript
562- rBlob :: Responsable Blob
454+ instance responsableDocument :: Responsable Document
563455```
564456
565457
566- #### ` rDocument `
458+ #### ` responsableJSON `
567459
568460``` purescript
569- rDocument :: Responsable Document
461+ instance responsableJSON :: Responsable Foreign
570462```
571463
572464
573- #### ` rJSON `
465+ #### ` responsableString `
574466
575467``` purescript
576- rJSON :: Responsable Foreign
468+ instance responsableString :: Responsable String
577469```
578470
579471
580- #### ` rString `
472+ #### ` responsableUnit `
581473
582474``` purescript
583- rString :: Responsable String
584- ```
585-
586-
587- #### ` rUnit `
588-
589- ``` purescript
590- rUnit :: Responsable Unit
475+ instance responsableUnit :: Responsable Unit
591476```
592477
593478
@@ -622,13 +507,6 @@ instance showResponseType :: Show ResponseType
622507```
623508
624509
625- #### ` isOptionResponseType `
626-
627- ``` purescript
628- instance isOptionResponseType :: IsOption ResponseType
629- ```
630-
631-
632510#### ` ajaxResponseTypeToString `
633511
634512``` purescript
0 commit comments