Initial commit
Some checks are pending
test / test (push) Waiting to run

This commit is contained in:
Lily Rose 2025-07-09 02:07:44 +10:00
commit b44c46047a
9 changed files with 9432 additions and 0 deletions

23
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,23 @@
name: test
on:
push:
branches:
- master
- main
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
with:
otp-version: "27.1.2"
gleam-version: "1.11.1"
rebar3-version: "3"
# elixir-version: "1"
- run: gleam deps download
- run: gleam test
- run: gleam format --check src test

5
.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
*.beam
*.ez
/build
erl_crash.dump
.env

9
LICENSE.md Normal file
View file

@ -0,0 +1,9 @@
The MIT License (MIT)
Copyright © 2025 Lily Rose
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

36
README.md Normal file
View file

@ -0,0 +1,36 @@
# spacetraders_sdk
[![Package Version](https://img.shields.io/hexpm/v/spacetraders_sdk)](https://hex.pm/packages/spacetraders_sdk)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/spacetraders_sdk/)
```sh
gleam add spacetraders_sdk@1
```
```gleam
import spacetraders_api
import spacetraders_models/agent_token
import gleam/httpc
pub fn main() -> Nil {
let assert Ok(agent_token) = agent_token.parse("...")
case spacetraders_api.get_account_request(agent_token) |> httpc.send_bits {
Ok(res) -> {
echo spacetraders_api.get_account_response(res)
Nil
}
Error(err) -> {
echo err
Nil
}
}
}
```
Further documentation can be found at <https://hexdocs.pm/spacetraders_sdk>.
## Development
```sh
gleam run # Run the project
gleam test # Run the tests
```

15
gleam.toml Normal file
View file

@ -0,0 +1,15 @@
name = "spacetraders_api"
version = "1.0.0"
gleam = ">= 1.11.0"
description = "Gleam functions for interacting with the spacetraders.io game API"
licences = ["MIT"]
repository = { type = "forgejo", host = "git.7cs.dev", user = "lily", repo = "gleam-spacetraders-api" }
[dependencies]
gleam_stdlib = ">= 0.61.0 and < 1.0.0"
gleam_http = ">= 4.1.0 and < 5.0.0"
gleam_json = ">= 3.0.2 and < 4.0.0"
spacetraders_models = ">= 1.1.0 and < 2.0.0"
[dev-dependencies]
gleeunit = ">= 1.5.1 and < 2.0.0"

18
manifest.toml Normal file
View file

@ -0,0 +1,18 @@
# This file was generated by Gleam
# You typically do not need to edit this file
packages = [
{ name = "gleam_http", version = "4.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_http", source = "hex", outer_checksum = "DB25DFC8530B64B77105405B80686541A0D96F7E2D83D807D6B2155FB9A8B1B8" },
{ name = "gleam_json", version = "3.0.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_json", source = "hex", outer_checksum = "874FA3C3BB6E22DD2BB111966BD40B3759E9094E05257899A7C08F5DE77EC049" },
{ name = "gleam_stdlib", version = "0.61.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "3DC407D6EDA98FCE089150C11F3AD892B6F4C3CA77C87A97BAE8D5AB5E41F331" },
{ name = "gleam_time", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_time", source = "hex", outer_checksum = "D71F1AFF7FEB534FF55E5DC58E534E9201BA75A444619788A2E4DEA4EBD87D16" },
{ name = "gleeunit", version = "1.5.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "D33B7736CF0766ED3065F64A1EBB351E72B2E8DE39BAFC8ADA0E35E92A6A934F" },
{ name = "spacetraders_models", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_http", "gleam_json", "gleam_stdlib", "gleam_time"], otp_app = "spacetraders_models", source = "hex", outer_checksum = "6A0CBC5CFC54313170AEEF813567C910D212F4FDB9AAA3B45F078A48935038A1" },
]
[requirements]
gleam_http = { version = ">= 4.1.0 and < 5.0.0" }
gleam_json = { version = ">= 3.0.2 and < 4.0.0" }
gleam_stdlib = { version = ">= 0.61.0 and < 1.0.0" }
gleeunit = { version = ">= 1.5.1 and < 2.0.0" }
spacetraders_models = { version = ">= 1.1.0 and < 2.0.0" }

7223
spacetraders.openapi.json Normal file

File diff suppressed because it is too large Load diff

2098
src/spacetraders_api.gleam Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,5 @@
import gleeunit
pub fn main() -> Nil {
gleeunit.main()
}