Official Go client for the Nitrozen.io changelog API.
Requires Go 1.22 or later.
go get github.com/nitrozenio/nitrozen-gopackage main
import (
"context"
"fmt"
nitrozen "github.com/nitrozenio/nitrozen-go"
)
func main() {
cfg := nitrozen.NewConfiguration()
client := nitrozen.NewAPIClient(cfg)
ctx := context.WithValue(context.Background(), nitrozen.ContextAccessToken, "YOUR_API_TOKEN")
// List your projects
resp, _, err := client.ProjectsAPI.ProjectsGet(ctx).Execute()
if err != nil {
panic(err)
}
for _, p := range resp.Data {
fmt.Printf("%d %s (%s)\n", p.GetId(), p.GetName(), p.GetSlug())
}
// Create a changelog entry
input := nitrozen.NewEntryInput()
input.SetTitle("New feature")
input.SetContent("We shipped something great.")
input.SetCategory("new")
entry, _, err := client.EntriesAPI.
ProjectsProjectEntriesPost(ctx, resp.Data[0].GetId()).
EntryInput(*input).
Execute()
if err != nil {
panic(err)
}
fmt.Println(entry.Data.GetTitle())
}Create an API token on the API Tokens page. Pass it via context.WithValue using the ContextAccessToken key:
cfg := nitrozen.NewConfiguration()
client := nitrozen.NewAPIClient(cfg)
// Attach the token via context — pass this ctx to every API call
ctx := context.WithValue(
context.Background(),
nitrozen.ContextAccessToken,
"YOUR_API_TOKEN",
)The context can be enriched with deadlines and cancellation as usual:
ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
defer cancel()
resp, _, err := client.UsersAPI.UserGet(ctx).Execute()Every Execute() call returns (response, *http.Response, error). Cast the error to *nitrozen.GenericOpenAPIError to inspect the raw response body:
resp, httpResp, err := client.ProjectsAPI.ProjectsProjectGet(ctx, 999).Execute()
if err != nil {
if apiErr, ok := err.(*nitrozen.GenericOpenAPIError); ok {
fmt.Println(httpResp.StatusCode) // e.g. 404
fmt.Println(string(apiErr.Body())) // raw JSON error body
}
return
}List endpoints accept .Page() and .PerPage() builder methods. The response includes a Meta field with pagination details:
resp, _, err := client.EntriesAPI.
ProjectsProjectEntriesGet(ctx, projectId).
Page(2).
PerPage(20).
Execute()
if err != nil {
panic(err)
}
meta := resp.GetMeta()
fmt.Printf("page %d of %d (%d total)\n",
meta.GetCurrentPage(), meta.GetLastPage(), meta.GetTotal())
for _, e := range resp.Data {
fmt.Printf("[%d] %s\n", e.GetId(), e.GetTitle())
}All methods follow the builder pattern ending with .Execute(). All URIs are relative to https://nitrozen.io/api/v1.
| Method | HTTP | Description |
|---|---|---|
| AuthenticationAPI.TokensGet(ctx).Execute() | GET /tokens | List API tokens |
| AuthenticationAPI.TokensPost(ctx).TokensPostRequest(r).Execute() | POST /tokens | Create an API token |
| AuthenticationAPI.TokensTokenDelete(ctx, id).Execute() | DELETE /tokens/{token} | Revoke an API token |
| Method | HTTP | Description |
|---|---|---|
| ProjectsAPI.ProjectsGet(ctx).Execute() | GET /projects | List projects |
| ProjectsAPI.ProjectsPost(ctx).ProjectInput(p).Execute() | POST /projects | Create a project |
| ProjectsAPI.ProjectsProjectGet(ctx, id).Execute() | GET /projects/{project} | Get a project |
| ProjectsAPI.ProjectsProjectPut(ctx, id).ProjectInput(p).Execute() | PUT /projects/{project} | Update a project |
| ProjectsAPI.ProjectsProjectDelete(ctx, id).Execute() | DELETE /projects/{project} | Delete a project |
| Method | HTTP | Description |
|---|---|---|
| EntriesAPI.ProjectsProjectEntriesGet(ctx, id).Page(n).PerPage(n).Execute() | GET /projects/{project}/entries | List entries |
| EntriesAPI.ProjectsProjectEntriesPost(ctx, id).EntryInput(e).Execute() | POST /projects/{project}/entries | Create an entry |
| EntriesAPI.ProjectsProjectEntriesEntryGet(ctx, pid, eid).Execute() | GET …/entries/{entry} | Get an entry |
| EntriesAPI.ProjectsProjectEntriesEntryPut(ctx, pid, eid).EntryInput(e).Execute() | PUT …/entries/{entry} | Update an entry |
| EntriesAPI.ProjectsProjectEntriesEntryDelete(ctx, pid, eid).Execute() | DELETE …/entries/{entry} | Delete an entry |
| Method | HTTP | Description |
|---|---|---|
| UsersAPI.UserGet(ctx).Execute() | GET /user | Get current user |
| UsersAPI.UserUsageGet(ctx).Execute() | GET /user/usage | Get usage statistics |
| Method | HTTP | Description |
|---|---|---|
| PublicAPI.PublicProjectsSlugEntriesGet(ctx, slug).Execute() | GET /public/projects/{slug}/entries | List published entries (no auth) |
category values:
new
improvement
fix
announcement
Projects on a plan with custom categories enabled can define additional category slugs from the dashboard — any of those slugs are valid here too.