forked from getarcaneapp/arcane
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapikey.go
More file actions
37 lines (32 loc) · 1.92 KB
/
apikey.go
File metadata and controls
37 lines (32 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package apikey
import "time"
// Create represents the request body for creating an API key.
type CreateApiKey struct {
Name string `json:"name" minLength:"1" maxLength:"255" doc:"Name of the API key" example:"My API Key"`
Description *string `json:"description,omitempty" maxLength:"1000" doc:"Optional description of the API key"`
ExpiresAt *time.Time `json:"expiresAt,omitempty" doc:"Optional expiration date for the API key"`
}
// ApiKey represents an API key without the secret.
type ApiKey struct {
ID string `json:"id" doc:"Unique identifier of the API key"`
Name string `json:"name" doc:"Name of the API key"`
Description *string `json:"description,omitempty" doc:"Description of the API key"`
KeyPrefix string `json:"keyPrefix" doc:"Prefix of the API key for identification"`
UserID *string `json:"userId,omitempty" doc:"ID of the user who owns the API key"`
IsStatic bool `json:"isStatic" doc:"Whether the API key is environment-managed and protected from deletion"`
ExpiresAt *time.Time `json:"expiresAt,omitempty" doc:"Expiration date of the API key"`
LastUsedAt *time.Time `json:"lastUsedAt,omitempty" doc:"Last time the API key was used"`
CreatedAt time.Time `json:"createdAt" doc:"Creation timestamp"`
UpdatedAt *time.Time `json:"updatedAt,omitempty" doc:"Last update timestamp"`
}
// ApiKeyCreatedDto represents a newly created API key with the full secret.
type ApiKeyCreatedDto struct {
ApiKey
Key string `json:"key" doc:"The full API key secret (only shown once)"`
}
// Update represents the request body for updating an API key.
type UpdateApiKey struct {
Name *string `json:"name,omitempty" maxLength:"255" doc:"New name for the API key"`
Description *string `json:"description,omitempty" maxLength:"1000" doc:"New description for the API key"`
ExpiresAt *time.Time `json:"expiresAt,omitempty" doc:"New expiration date for the API key"`
}