Skip to content
Merged
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
168 changes: 155 additions & 13 deletions go/apps/api/openapi/gen.go

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

118 changes: 116 additions & 2 deletions go/apps/api/openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -519,19 +519,20 @@
"ratelimits": {
"type": "array",
"items": {
"$ref": "#/components/schemas/V2Ratelimit"
"$ref": "#/components/schemas/Ratelimit"
},
"description": "Attach ratelimits to this identity.\n\nWhen verifying keys, you can specify which limits you want to use and all keys attached to this identity, will share the limits."
}
}
},
"V2Ratelimit": {
"Ratelimit": {
"type": "object",
"required": ["name", "limit", "duration"],
"properties": {
"name": {
"description": "The name of this limit. You will need to use this again when verifying a key.",
"type": "string",
"example": "api",
"minLength": 3,
"maxLength": 128
},
Expand Down Expand Up @@ -569,6 +570,35 @@
}
}
},
"V2IdentitiesDeleteIdentityRequestBody": {
"additionalProperties": false,
"type": "object",
"properties": {
"externalId": {
"type": "string",
"minLength": 3,
"description": "The id of this identity in your system.\n\nThis usually comes from your authentication provider and could be a userId, organisationId or even an email.\nIt does not matter what you use, as long as it uniquely identifies something in your application.\n",
"example": "user_123"
},
"identityId": {
"type": "string",
"minLength": 3,
"description": "The Unkey Identity ID.",
"example": "id_123"
}
},
"oneOf": [
{
"required": ["externalId"]
},
{
"required": ["identityId"]
}
]
},
"V2IdentitiesDeleteIdentityResponseBody": {
"type": "object"
},
"V2ApisCreateApiRequestBody": {
"type": "object",
"required": ["name"],
Expand Down Expand Up @@ -1152,6 +1182,90 @@
}
}
},
"/v2/identities.deleteIdentity": {
"post": {
"tags": ["identities"],
"operationId": "v2.identities.deleteIdentity",
"x-speakeasy-name-override": "deleteIdentity",
"security": [
{
"rootKey": []
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/V2IdentitiesDeleteIdentityRequestBody"
}
}
},
"required": true
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/V2IdentitiesDeleteIdentityResponseBody"
}
}
},
"description": "OK"
},
"400": {
"description": "Bad request",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/BadRequestErrorResponse"
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/UnauthorizedErrorResponse"
}
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ForbiddenErrorResponse"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/NotFoundErrorResponse"
}
}
}
},
"500": {
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/InternalServerErrorResponse"
}
}
},
"description": "Error"
}
}
}
},
"/v2/apis.createApi": {
"post": {
"tags": ["apis"],
Expand Down
13 changes: 13 additions & 0 deletions go/apps/api/routes/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
v2RatelimitSetOverride "github.com/unkeyed/unkey/go/apps/api/routes/v2_ratelimit_set_override"

v2IdentitiesCreateIdentity "github.com/unkeyed/unkey/go/apps/api/routes/v2_identities_create_identity"
v2IdentitiesDeleteIdentity "github.com/unkeyed/unkey/go/apps/api/routes/v2_identities_delete_identity"

zen "github.com/unkeyed/unkey/go/pkg/zen"
)
Expand Down Expand Up @@ -103,6 +104,18 @@ func Register(srv *zen.Server, svc *Services) {
}),
)

// v2/identities.deleteIdentity
srv.RegisterRoute(
defaultMiddlewares,
v2IdentitiesDeleteIdentity.New(v2IdentitiesDeleteIdentity.Services{
Logger: svc.Logger,
DB: svc.Database,
Keys: svc.Keys,
Permissions: svc.Permissions,
Auditlogs: svc.Auditlogs,
}),
)

// ---------------------------------------------------------------------------
// misc

Expand Down
1 change: 0 additions & 1 deletion go/apps/api/routes/v2_apis_create_api/401_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,4 @@ func TestCreateApi_Unauthorized(t *testing.T) {
res := testutil.CallRoute[handler.Request, handler.Response](h, route, headers, req)
require.Equal(t, http.StatusUnauthorized, res.Status, "expected 401, sent: %+v, received: %s", req, res.RawBody)
})

}
Loading