Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 11 additions & 34 deletions apps/docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@
},
{
"group": "Identities",
"pages": [
"quickstart/identities/shared-ratelimits"
]
"pages": ["quickstart/identities/shared-ratelimits"]
}
]
},
Expand Down Expand Up @@ -115,10 +113,7 @@
{
"group": "Identities",
"icon": "fingerprint",
"pages": [
"concepts/identities/overview",
"concepts/identities/ratelimits"
]
"pages": ["concepts/identities/overview", "concepts/identities/ratelimits"]
}
]
},
Expand All @@ -135,9 +130,7 @@
"pages": [
{
"group": "Ratelimiting",
"pages": [
"apis/features/ratelimiting/overview"
]
"pages": ["apis/features/ratelimiting/overview"]
},
"apis/features/temp-keys",
"apis/features/remaining",
Expand Down Expand Up @@ -172,10 +165,7 @@
{
"group": "Audit logs",
"icon": "scroll",
"pages": [
"audit-log/introduction",
"audit-log/types"
]
"pages": ["audit-log/introduction", "audit-log/types"]
},
{
"group": "Analytics",
Expand All @@ -197,10 +187,7 @@
{
"group": "Migrating API Keys",
"icon": "plane",
"pages": [
"migrations/introduction",
"migrations/keys"
]
"pages": ["migrations/introduction", "migrations/keys"]
}
]
},
Expand Down Expand Up @@ -282,9 +269,7 @@
},
{
"group": "Too Many Requests",
"pages": [
"errors/user/too_many_requests/query_quota_exceeded"
]
"pages": ["errors/user/too_many_requests/query_quota_exceeded"]
},
{
"group": "Unprocessable Entity",
Expand Down Expand Up @@ -390,15 +375,11 @@
},
{
"group": "Go",
"pages": [
"libraries/go/api"
]
"pages": ["libraries/go/api"]
},
{
"group": "Python",
"pages": [
"libraries/py/api"
]
"pages": ["libraries/py/api"]
}
]
},
Expand All @@ -423,15 +404,11 @@
},
{
"group": "Nuxt",
"pages": [
"libraries/nuxt/overview"
]
"pages": ["libraries/nuxt/overview"]
},
{
"group": "Rust",
"pages": [
"libraries/rs/overview"
]
"pages": ["libraries/rs/overview"]
},
{
"group": "Springboot",
Expand Down Expand Up @@ -474,4 +451,4 @@
"codeblocks": "system"
},
"theme": "maple"
}
}
6 changes: 3 additions & 3 deletions go/apps/api/integration/multi_node_usagelimiting/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/unkeyed/unkey/go/apps/api/openapi"
handler "github.com/unkeyed/unkey/go/apps/api/routes/v2_keys_verify_key"
"github.com/unkeyed/unkey/go/pkg/clickhouse"
"github.com/unkeyed/unkey/go/pkg/ptr"
"github.com/unkeyed/unkey/go/pkg/testutil/seed"
)

Expand Down Expand Up @@ -46,8 +45,9 @@ func RunUsageLimitTest(
keyResponse := h.Seed.CreateKey(ctx, seed.CreateKeyRequest{
WorkspaceID: workspace.ID,
KeySpaceID: api.KeyAuthID.String,
//nolint: gosec
Remaining: ptr.P(int32(totalCredits)),
Credits: &seed.CreditRequest{
Remaining: int32(totalCredits),
},
})

keyStart := keyResponse.Key
Expand Down
2 changes: 1 addition & 1 deletion go/apps/api/openapi/gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions go/apps/api/openapi/openapi-generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2348,8 +2348,8 @@ components:
- "null"
format: int64
minimum: 0
maximum: 9223372036854776000
description: Number of credits remaining (null for unlimited).
maximum: 2147483647
description: Number of credits remaining (null for unlimited). Maximum value is 2147483647 (int32 limit).
example: 1000
refill:
"$ref": "#/components/schemas/CreditsRefill"
Expand Down
4 changes: 2 additions & 2 deletions go/apps/api/openapi/spec/common/Credits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ properties:
- "null"
format: int64
minimum: 0
maximum: 9223372036854775807
description: Number of credits remaining (null for unlimited).
maximum: 2147483647
description: Number of credits remaining (null for unlimited). Maximum value is 2147483647 (int32 limit).
example: 1000
refill:
"$ref": "./CreditsRefill.yaml"
Expand Down
23 changes: 19 additions & 4 deletions go/apps/api/routes/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
v2IdentitiesDeleteIdentity "github.com/unkeyed/unkey/go/apps/api/routes/v2_identities_delete_identity"
v2IdentitiesGetIdentity "github.com/unkeyed/unkey/go/apps/api/routes/v2_identities_get_identity"
v2IdentitiesListIdentities "github.com/unkeyed/unkey/go/apps/api/routes/v2_identities_list_identities"
v2IdentitiesUpdateCredits "github.com/unkeyed/unkey/go/apps/api/routes/v2_identities_update_credits"
v2IdentitiesUpdateIdentity "github.com/unkeyed/unkey/go/apps/api/routes/v2_identities_update_identity"

v2PermissionsCreatePermission "github.com/unkeyed/unkey/go/apps/api/routes/v2_permissions_create_permission"
Expand Down Expand Up @@ -226,10 +227,24 @@ func Register(srv *zen.Server, svc *Services) {
srv.RegisterRoute(
defaultMiddlewares,
&v2IdentitiesUpdateIdentity.Handler{
Logger: svc.Logger,
DB: svc.Database,
Keys: svc.Keys,
Auditlogs: svc.Auditlogs,
Logger: svc.Logger,
DB: svc.Database,
Keys: svc.Keys,
Auditlogs: svc.Auditlogs,
UsageLimiter: svc.UsageLimiter,
},
)

// v2/identities.updateCredits
srv.RegisterRoute(
defaultMiddlewares,
&v2IdentitiesUpdateCredits.Handler{
Logger: svc.Logger,
DB: svc.Database,
Keys: svc.Keys,
Auditlogs: svc.Auditlogs,
UsageLimiter: svc.UsageLimiter,
KeyCache: svc.Caches.VerificationKeyByHash,
},
)

Expand Down
Loading
Loading