Repository navigation
Expand file tree
/
Copy pathapi_keys_gen.go
More file actions
86 lines (71 loc) · 2.73 KB
/
Copy pathapi_keys_gen.go
File metadata and controls
86 lines (71 loc) · 2.73 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
Copyright 2026 Hyperbolic Labs, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by internal/gen from openapi/openapi.json and openapi/sdk.yaml. DO NOT EDIT.
package hyperbolic
import (
"context"
"net/http"
"time"
"github.com/oapi-codegen/nullable"
)
// APIKeysService lists the account's API keys.
type APIKeysService struct {
t *transport
}
// List calls GET /v2/api-keys/list: list all API keys for the current user or
// organization.
func (s *APIKeysService) List(ctx context.Context) ([]APIKey, error) {
c := call{method: http.MethodGet, path: "/v2/api-keys/list", idempotent: true}
var out []APIKey
if err := s.t.do(ctx, c, &out); err != nil {
return nil, err
}
return out, nil
}
// APIKey An issued API key. The secret itself is only ever returned at creation.
type APIKey struct {
// CreatedAt Example: 2025-01-31T12:00:00.000Z
CreatedAt time.Time `json:"createdAt"`
Last4 string `json:"last4"`
OrgID nullable.Nullable[string] `json:"orgId"`
// OrganizationMember The organization member an API key belongs to.
OrganizationMember *OrganizationMember `json:"organizationMember,omitempty"`
PublicID string `json:"publicId"`
RevokedAt nullable.Nullable[time.Time] `json:"revokedAt"`
UserID string `json:"userId"`
}
// OrganizationMember The organization member an API key belongs to.
type OrganizationMember struct {
Email string `json:"email"`
FullName *string `json:"fullName,omitempty"`
ImageURL *string `json:"imageUrl,omitempty"`
Role OrganizationMemberRole `json:"role"`
}
// OrganizationMemberRole defines model for OrganizationMember.Role.
type OrganizationMemberRole string
// Defines values for OrganizationMemberRole.
const (
OrganizationMemberRoleOrgAdmin OrganizationMemberRole = "org:admin"
OrganizationMemberRoleOrgMember OrganizationMemberRole = "org:member"
)
// Valid indicates whether the value is a known member of the OrganizationMemberRole enum.
func (e OrganizationMemberRole) Valid() bool {
switch e {
case OrganizationMemberRoleOrgAdmin:
return true
case OrganizationMemberRoleOrgMember:
return true
default:
return false
}
}