Skip to content

Commit 82d634c

Browse files
author
Ryan Miville
committed
readme update
1 parent 48c89b0 commit 82d634c

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

README.md

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# aws_request
22

3+
An AWS request builder for Gleam, generated using [aws_codegen](https://github.com/ryanmiville/aws_codegen) and built on top of [aws4_request](https://github.com/lpil/aws4_request).
4+
35
[![Package Version](https://img.shields.io/hexpm/v/aws_request)](https://hex.pm/packages/aws_request)
46
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/aws_request/)
57

68
```sh
7-
gleam add aws_request@1
9+
gleam add aws_request
810
```
911
```gleam
1012
import aws_request/config
@@ -14,22 +16,26 @@ import gleam/httpc
1416
import gleam/result
1517
1618
pub fn main() {
19+
// create a client for the AWS service, such as DynamoDB
1720
let assert Ok(dynamo_client) =
1821
config.new()
1922
|> config.with_region("us-east-1")
2023
|> config.build
2124
|> result.map(dynamodb.new)
2225
26+
// Create the request body if necessary
2327
let body =
2428
"{
2529
\"TableName\": \"people\",
2630
\"Key\": { \"name\": { \"S\": \"Ryan\" } }
2731
}"
2832
|> bit_array.from_string
2933
30-
let response =
31-
dynamodb.get_item(dynamo_client, body)
32-
|> httpc.send_bits
34+
// each API endpoint is a function in the service's module
35+
let req = dynamodb.get_item(dynamo_client, body)
36+
37+
// use a gleam_http client adapter to send the request
38+
let resp = httpc.send_bits(req)
3339
}
3440
```
3541

@@ -57,3 +63,6 @@ Ok(Response(
5763
"{"Item":{"name":{"S":"Ryan"}}}",
5864
))
5965
```
66+
67+
## Project Goals
68+
`aws_request` is NOT an AWS SDK for Gleam. It intends to be a base for idiomatic Gleam AWS SDKs.

gleam.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name = "aws_request"
2-
version = "1.0.0"
2+
version = "0.1.0"
33

44
# Fill out these fields if you intend to generate HTML documentation or publish
55
# your project to the Hex package manager.

0 commit comments

Comments
 (0)