@@ -20,58 +20,35 @@ import Bfx.Import.External
20
20
import qualified Data.Aeson as A
21
21
import qualified Data.Aeson.Types as A
22
22
import qualified Data.ByteString as BS
23
- import qualified Data.ByteString.Lazy as BL
24
- import qualified Data.Text as T
25
23
import qualified Prelude
26
24
27
25
newtype PrvKey = PrvKey
28
- { unPrvKey :: BS. ByteString
26
+ { unPrvKey :: Text
29
27
}
30
28
deriving newtype
31
29
( Eq ,
32
30
Ord ,
33
- IsString
31
+ Read ,
32
+ IsString ,
33
+ HasCodec ,
34
+ HasItemCodec
34
35
)
36
+ deriving stock (Data , Generic )
37
+ deriving (Show ) via Redacted PrvKey
35
38
36
- instance From BS. ByteString PrvKey
37
-
38
- instance From PrvKey BS. ByteString
39
-
40
- instance From (UTF_8 BS. ByteString ) PrvKey where
41
- from =
42
- via @ BS. ByteString
43
-
44
- instance Prelude. Show PrvKey where
45
- show =
46
- const " SECRET"
47
-
48
- instance FromJSON PrvKey where
49
- parseJSON =
50
- parseJsonBs
51
-
52
- newtype ApiKey
53
- = ApiKey BS. ByteString
39
+ newtype ApiKey = ApiKey
40
+ { unApiKey :: Text
41
+ }
54
42
deriving newtype
55
43
( Eq ,
56
44
Ord ,
57
- IsString
45
+ Read ,
46
+ IsString ,
47
+ HasCodec ,
48
+ HasItemCodec
58
49
)
59
-
60
- instance From BS. ByteString ApiKey
61
-
62
- instance From ApiKey BS. ByteString
63
-
64
- instance From (UTF_8 BS. ByteString ) ApiKey where
65
- from =
66
- via @ BS. ByteString
67
-
68
- instance Prelude. Show ApiKey where
69
- show =
70
- const " SECRET"
71
-
72
- instance FromJSON ApiKey where
73
- parseJSON =
74
- parseJsonBs
50
+ deriving stock (Data , Generic )
51
+ deriving (Show ) via Redacted ApiKey
75
52
76
53
data RequestMethod
77
54
= GET
@@ -80,42 +57,35 @@ data RequestMethod
80
57
( Eq ,
81
58
Ord ,
82
59
Show ,
60
+ Read ,
83
61
Data ,
84
62
Generic
85
63
)
86
64
87
- newtype BaseUrl
88
- = BaseUrl Text
65
+ newtype BaseUrl = BaseUrl
66
+ { unBaseUrl :: Text
67
+ }
89
68
deriving newtype
90
69
( Eq ,
91
70
Ord ,
92
71
Show ,
72
+ Read ,
93
73
IsString
94
74
)
95
75
96
- newtype RawResponse
97
- = RawResponse ByteString
76
+ newtype RawResponse = RawResponse
77
+ { unRawResponse :: ByteString
78
+ }
98
79
deriving newtype
99
80
( Eq ,
100
- Ord
81
+ Ord ,
82
+ Show
101
83
)
102
84
deriving stock
103
85
( Data ,
104
86
Generic
105
87
)
106
88
107
- instance From ByteString RawResponse
108
-
109
- instance From RawResponse ByteString
110
-
111
- instance Show RawResponse where
112
- show x =
113
- case decodeUtf8Strict bs of
114
- Left {} -> " ByteString RawResponse" <> inspect (BS. unpack bs)
115
- Right res -> " Text RawResponse " <> T. unpack res
116
- where
117
- bs = BL. toStrict $ from x
118
-
119
89
newtype Nonce = Nonce
120
90
{ unNonce :: Natural
121
91
}
0 commit comments