Skip to content

Commit 75005ef

Browse files
author
Ryan Miville
committed
readme
1 parent daa0a88 commit 75005ef

File tree

2 files changed

+43
-8
lines changed

2 files changed

+43
-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

+42-8
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,52 @@
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+
}
33+
```
2034

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

0 commit comments

Comments
 (0)