Skip to content

Commit 484a403

Browse files
committed
Purty
1 parent f61c2f3 commit 484a403

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

src/AWS/Core/Types.purs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,19 @@ derive newtype instance showEndpoint :: Show Endpoint
7878

7979
derive newtype instance encodeEndpoint :: EncodeJson Endpoint
8080

81-
newtype Tags = Tags (Map.Map String String)
81+
newtype Tags
82+
= Tags (Map.Map String String)
83+
8284
derive newtype instance showTags :: Show Tags
85+
8386
derive instance ntTags :: Newtype Tags _
8487

85-
instance tagsDecoder :: DecodeJson Tags where
86-
decodeJson = decodeAsMap >>> map Tags
88+
instance tagsDecoder :: DecodeJson Tags where
89+
decodeJson = decodeAsMap >>> map Tags
8790
where
88-
decodeAsMap str = do
89-
obj <- decodeJson str
90-
pure $ Map.fromFoldable $ (F.toUnfoldable obj :: Array _)
91+
decodeAsMap str = do
92+
obj <- decodeJson str
93+
pure $ Map.fromFoldable $ (F.toUnfoldable obj :: Array _)
9194

9295
type BasicClientPropsR r
9396
= ( accessKeyId :: Maybe AccessKeyId

src/AWS/S3/S3.purs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ type GetObjectResponse
9494
, contentLength :: Int
9595
, contentEncoding :: String
9696
, contentType :: String
97-
, tags :: Tags
97+
, tags :: Tags
9898
}
9999

100100
getObject :: S3 -> GetObjectParams -> Aff GetObjectResponse
@@ -110,16 +110,17 @@ getObject client { bucket: BucketName name, key: BucketKey key } =
110110

111111
convert :: InternalGetObjectResponse -> Either JsonDecodeError GetObjectResponse
112112
convert internalResponse = parse internalResponse."Metadata" <#> addTags
113-
where
114-
addTags tags = { body: internalResponse."Body"
115-
, contentLength: internalResponse."ContentLength"
116-
, contentEncoding: internalResponse."ContentEncoding"
117-
, contentType: internalResponse."ContentType"
118-
, tags : tags
119-
}
120-
parse :: Json -> Either JsonDecodeError Tags
121-
parse = decodeJson
122-
113+
where
114+
addTags tags =
115+
{ body: internalResponse."Body"
116+
, contentLength: internalResponse."ContentLength"
117+
, contentEncoding: internalResponse."ContentEncoding"
118+
, contentType: internalResponse."ContentType"
119+
, tags: tags
120+
}
121+
122+
parse :: Json -> Either JsonDecodeError Tags
123+
parse = decodeJson
123124

124125
type InternalGetSignedUrlParams
125126
= { "Bucket" :: String

0 commit comments

Comments
 (0)