Repository navigation
Expand file tree
/
Copy pathusers_gen.go
More file actions
141 lines (120 loc) · 4.74 KB
/
Copy pathusers_gen.go
File metadata and controls
141 lines (120 loc) · 4.74 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*
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"
)
// UsersService reads and updates the signed-in user.
type UsersService struct {
t *transport
}
// DeleteMe calls DELETE /v2/users/me: delete the current user.
func (s *UsersService) DeleteMe(ctx context.Context) (*SuccessResponse, error) {
c := call{method: http.MethodDelete, path: "/v2/users/me", idempotent: true}
var out SuccessResponse
if err := s.t.do(ctx, c, &out); err != nil {
return nil, err
}
return &out, nil
}
// Me calls GET /v2/users/me: get the current user.
func (s *UsersService) Me(ctx context.Context) (*CurrentUser, error) {
c := call{method: http.MethodGet, path: "/v2/users/me", idempotent: true}
var out CurrentUser
if err := s.t.do(ctx, c, &out); err != nil {
return nil, err
}
return &out, nil
}
// UpdateMe calls PUT /v2/users/me: update the current user.
func (s *UsersService) UpdateMe(ctx context.Context, params UpdateCurrentUserParams) (*UserMutationResponse, error) {
c := call{method: http.MethodPut, path: "/v2/users/me", idempotent: true, body: params}
var out UserMutationResponse
if err := s.t.do(ctx, c, &out); err != nil {
return nil, err
}
return &out, nil
}
// VerifyPhoneNumber calls PUT /v2/users/me/verify-phone-number: verify a phone
// number.
//
// It is not retried after a failure that may have reached the server. Such a
// failure matches [ErrOutcomeUnknown]: check whether the call took effect
// before making it again.
func (s *UsersService) VerifyPhoneNumber(ctx context.Context, params VerifyPhoneNumberParams) (*SuccessResponse, error) {
c := call{method: http.MethodPut, path: "/v2/users/me/verify-phone-number", idempotent: false, body: params}
var out SuccessResponse
if err := s.t.do(ctx, c, &out); err != nil {
return nil, err
}
return &out, nil
}
// CurrentUser The authenticated user, with account state resolved.
type CurrentUser struct {
CompletedPromos []string `json:"completedPromos"`
// CreatedAt Example: 2025-01-31T12:00:00.000Z
CreatedAt time.Time `json:"createdAt"`
Email string `json:"email"`
EmailVerified nullable.Nullable[bool] `json:"emailVerified"`
HasPurchasedCredits bool `json:"hasPurchasedCredits"`
ID string `json:"id"`
IsActive nullable.Nullable[bool] `json:"isActive"`
Name nullable.Nullable[string] `json:"name"`
OnboardedAt nullable.Nullable[time.Time] `json:"onboardedAt"`
OnboardedFor nullable.Nullable[string] `json:"onboardedFor"`
Picture nullable.Nullable[string] `json:"picture"`
Provider nullable.Nullable[string] `json:"provider"`
ReferralCode nullable.Nullable[string] `json:"referralCode"`
ReservedRentalLimit *int `json:"reservedRentalLimit,omitempty"`
Role CurrentUserRole `json:"role"`
}
// CurrentUserRole defines model for CurrentUser.Role.
type CurrentUserRole string
// Defines values for CurrentUserRole.
const (
CurrentUserRoleElite CurrentUserRole = "elite"
CurrentUserRolePro CurrentUserRole = "pro"
CurrentUserRoleUser CurrentUserRole = "user"
)
// Valid indicates whether the value is a known member of the CurrentUserRole enum.
func (e CurrentUserRole) Valid() bool {
switch e {
case CurrentUserRoleElite:
return true
case CurrentUserRolePro:
return true
case CurrentUserRoleUser:
return true
default:
return false
}
}
// UpdateCurrentUserParams defines model for UpdateCurrentUserParams.
type UpdateCurrentUserParams struct {
Name nullable.Nullable[string] `json:"name,omitempty"`
OnboardedFor nullable.Nullable[string] `json:"onboardedFor,omitempty"`
}
// UserMutationResponse The user account as it stands after an update.
type UserMutationResponse struct {
Success bool `json:"success"`
// User A Hyperbolic user account.
User User `json:"user"`
}
// VerifyPhoneNumberParams defines model for VerifyPhoneNumberParams.
type VerifyPhoneNumberParams struct {
PhoneNumber string `json:"phoneNumber"`
}