https://github.com/sgerrand/ex_incident_io
An Elixir client for the incident.io API
https://github.com/sgerrand/ex_incident_io
Last synced: 4 months ago
JSON representation
An Elixir client for the incident.io API
- Host: GitHub
- URL: https://github.com/sgerrand/ex_incident_io
- Owner: sgerrand
- License: mit
- Created: 2024-05-22T15:35:46.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-12-30T11:44:57.000Z (5 months ago)
- Last Synced: 2025-01-18T03:53:34.824Z (4 months ago)
- Language: Elixir
- Size: 501 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# incident_io
[](https://github.com/sgerrand/ex_incident_io/actions/workflows/ci.yml)
[](https://coveralls.io/github/sgerrand/ex_incident_io?branch=main)
[](https://hex.pm/packages/incident_io)
[](https://hexdocs.pm/incident_io/)An Elixir client for the [incident.io API](https://api-docs.incident.io/).
With just a few lines of code you can begin interacting:
```elixir
Mix.install([
{:incident_io, "~> 0.1"}
])client = IncidentIo.Client.new(%{api_key: System.fetch_env!("INCIDENT_API_KEY")})
IncidentIo.IncidentsV2.create(client,
idempotency_key: "your-idempotency-key",
visibility: :public)
```## Requirements
You'll need an [incident.io](https://incident.io/) account to use this package.
[Sign up on their website](https://incident.io/) if you don't already have one.## Installation
Add `:incident_io` to the dependencies in your project's `mix.exs`:
```elixir
def deps do
[
{:incident_io, "~> 0.1"}
]
end
```## Getting started
You will need to create an API key via your [incident.io
dashboard](https://app.incident.io/settings/api-keys) to make requests. Please
note their warning message about the scope for this API key:> When you create the key, you'll be able to choose what actions it can take for
> your account: choose carefully, as those roles can only be set when you first
> create the key.Once you've created an API key then you're ready to start making requests.
## Example
Assuming that you've created and configured your incident.io API key as an
environment variable named `INCIDENT_API_KEY`, you can
create and read incidents as simply as the following example module:```elixir
defmodule MyIncidentIo do
use IncidentIoalias IncidentIo.Client
alias IncidentIo.IncidentsV2def create(idempotency_key)
IncidentsV2.create(client, idempotency_key: idempotency_key, visibility: :public)
enddef read(incident_id)
IncidentsV2.show(client, incident_id)
enddefp client
Client.new(%{api_key: System.fetch_env!("INCIDENT_API_KEY")})
end
end
```## Development
To start working on this application, clone the repository and fetch its
dependencies:
```shell
git clone https://github.com/sgerrand/ex_incident_io.git
cd ex_incident_io
mix deps.get
```Then you can start running the tests.
```shell
mix test
```## Contributing
[Bug reports](https://github.com/sgerrand/ex_incident_io/issues) and [pull requests](https://github.com/sgerrand/ex_incident_io/pulls) are welcomed.
## License
This package is available as open source under the terms of the [MIT
License](https://opensource.org/licenses/MIT).