Skip to content

Commit 48c89b0

Browse files
author
Ryan Miville
committed
readme
1 parent daa0a88 commit 48c89b0

File tree

2 files changed

+44
-8
lines changed

2 files changed

+44
-8
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
/build
44
erl_crash.dump
55
.DS_Store
6+
main.gleam

README.md

+43-8
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,53 @@
77
gleam add aws_request@1
88
```
99
```gleam
10-
import aws_request
10+
import aws_request/config
11+
import aws_request/service/dynamodb
12+
import gleam/bit_array
13+
import gleam/httpc
14+
import gleam/result
1115
1216
pub fn main() {
13-
// TODO: An example of the project in use
14-
}
15-
```
17+
let assert Ok(dynamo_client) =
18+
config.new()
19+
|> config.with_region("us-east-1")
20+
|> config.build
21+
|> result.map(dynamodb.new)
1622
17-
Further documentation can be found at <https://hexdocs.pm/aws_request>.
23+
let body =
24+
"{
25+
\"TableName\": \"people\",
26+
\"Key\": { \"name\": { \"S\": \"Ryan\" } }
27+
}"
28+
|> bit_array.from_string
1829
19-
## Development
30+
let response =
31+
dynamodb.get_item(dynamo_client, body)
32+
|> httpc.send_bits
33+
}
34+
```
2035

2136
```sh
22-
gleam run # Run the project
23-
gleam test # Run the tests
37+
Ok(Response(
38+
200,
39+
[
40+
#("connection", "keep-alive"),
41+
#(
42+
"date",
43+
"Mon, 26 Aug 2024 01:14:37 GMT",
44+
),
45+
#("server", "Server"),
46+
#("content-length", "48"),
47+
#(
48+
"content-type",
49+
"application/x-amz-json-1.0",
50+
),
51+
#(
52+
"x-amzn-requestid",
53+
"9UDMAF5C9T46D39RJSCHUB7IMFVV4KQNSO5AEMVJF66Q9ASUAAJG",
54+
),
55+
#("x-amz-crc32", "3152510195"),
56+
],
57+
"{"Item":{"name":{"S":"Ryan"}}}",
58+
))
2459
```

0 commit comments

Comments
 (0)