Test mode: paid plans aren't on sale yet, so nothing is charged. Every plan's limits apply.

← Docs

Nod management API for Go

A client for each realm's management API (<issuer>/api/v1), standard library only. Go 1.23 or later.

import harpora "git.lunaor.com/lunaor/nod/sdks/go"

m := nod.New("https://auth.example.com/acme", "ops", secret)
alice, err := m.CreateUser(ctx, nod.UserCreate{Username: "alice", Email: "alice@example.com"})
err = m.AddMember(ctx, "initech", alice.ID)
err = m.EachUser(ctx, func(u nod.User) error { fmt.Println(u.Username); return nil })
err = m.EachEvent(ctx, nod.EventQuery{Type: "signin.failure"}, func(e nod.Event) error {
	fmt.Println(e.Time, e.Username, e.IP)
	return nil
})

var apiErr *nod.Error
if errors.As(err, &apiErr) {
	fmt.Println(apiErr.Status, apiErr.Code, apiErr.Description)
}

Billing

Plans (Plans, Plan, SetPlan, DeletePlan, AddPlanPrice), an organization's state (OrganizationBilling, SetOrganizationBilling; a PUT older than the stored AsOfMs answers with Stale set), the customer list (BillingOrganizations for a page, EachBillingOrganization for every page), BillingCheckout, BillingPortal and BillingSync (health).

_, err = m.AddPlanPrice(ctx, "pro", nod.PlanPrice{UnitAmount: 900, Currency: "eur", Interval: "month"})
c, err := m.BillingCheckout(ctx, "initech", nod.BillingCheckoutRequest{Plan: "pro", SuccessURL: ok, CancelURL: no})

In your app, nod.OrgPlan(claims), nod.OrgFeatures(claims) and nod.HasFeature(claims, "sso") read org_plan and org_features from a token's decoded claims (map[string]any); no org_plan is the free tier ("", no features). They verify nothing: verify the access or ID token first.