-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathshared.go
More file actions
239 lines (200 loc) · 7.31 KB
/
Copy pathshared.go
File metadata and controls
239 lines (200 loc) · 7.31 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package privyclient
import (
"encoding/json"
"github.com/privy-io/go-sdk/internal/apijson"
"github.com/privy-io/go-sdk/option"
"github.com/privy-io/go-sdk/packages/param"
"github.com/privy-io/go-sdk/packages/respjson"
)
// SharedService contains methods and other services that help with interacting
// with the Privy API API.
//
// Note, unlike clients, this service does not read variables from the environment
// automatically. You should not instantiate this service directly, and instead use
// the [NewSharedService] method instead.
type SharedService struct {
Options []option.RequestOption
}
// NewSharedService generates a new service that applies the given options to each
// request. These options are applied after the parent client's options (if there
// is one), and before any request-specific options.
func NewSharedService(opts ...option.RequestOption) (r SharedService) {
r = SharedService{}
r.Options = opts
return
}
type Bps = int64
// The Privy API environment.
type Environment string
const (
EnvironmentSandbox Environment = "sandbox"
EnvironmentProduction Environment = "production"
)
type EvmCaip2 = string
type KeyQuorumID = string
// Supported fiat orchestration providers.
type OrchestrationProvider string
const (
OrchestrationProviderBridge OrchestrationProvider = "bridge"
)
type OwnerIDInput = string
// OwnerInputUnionResp contains all possible properties and values from
// [OwnerInputUserResp], [OwnerInputPublicKeyResp].
//
// Use the methods beginning with 'As' to cast the union to one of its variants.
type OwnerInputUnionResp struct {
// This field is from variant [OwnerInputUserResp].
UserID string `json:"user_id"`
// This field is from variant [OwnerInputPublicKeyResp].
PublicKey P256PublicKey `json:"public_key"`
JSON struct {
UserID respjson.Field
PublicKey respjson.Field
raw string
} `json:"-"`
}
func (u OwnerInputUnionResp) AsOwnerInputUser() (v OwnerInputUserResp) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
func (u OwnerInputUnionResp) AsOwnerInputPublicKey() (v OwnerInputPublicKeyResp) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
func (u OwnerInputUnionResp) RawJSON() string { return u.JSON.raw }
func (r *OwnerInputUnionResp) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// ToParam converts this OwnerInputUnionResp to a OwnerInputUnion.
//
// Warning: the fields of the param type will not be present. ToParam should only
// be used at the last possible moment before sending a request. Test for this with
// OwnerInputUnion.Overrides()
func (r OwnerInputUnionResp) ToParam() OwnerInputUnion {
return param.Override[OwnerInputUnion](json.RawMessage(r.RawJSON()))
}
func OwnerInputOfOwnerInputUser(userID string) OwnerInputUnion {
var variant OwnerInputUser
variant.UserID = userID
return OwnerInputUnion{OfOwnerInputUser: &variant}
}
func OwnerInputOfOwnerInputPublicKey(publicKey P256PublicKey) OwnerInputUnion {
var variant OwnerInputPublicKey
variant.PublicKey = publicKey
return OwnerInputUnion{OfOwnerInputPublicKey: &variant}
}
// Only one field can be non-zero.
//
// Use [param.IsOmitted] to confirm if a field is set.
type OwnerInputUnion struct {
OfOwnerInputUser *OwnerInputUser `json:",omitzero,inline"`
OfOwnerInputPublicKey *OwnerInputPublicKey `json:",omitzero,inline"`
paramUnion
}
func (u OwnerInputUnion) MarshalJSON() ([]byte, error) {
return param.MarshalUnion(u, u.OfOwnerInputUser, u.OfOwnerInputPublicKey)
}
func (u *OwnerInputUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
}
// Owner input specifying a P-256 public key.
type OwnerInputPublicKeyResp struct {
// A P-256 (secp256r1) public key.
PublicKey P256PublicKey `json:"public_key" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
PublicKey respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
func (r OwnerInputPublicKeyResp) RawJSON() string { return r.JSON.raw }
func (r *OwnerInputPublicKeyResp) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// ToParam converts this OwnerInputPublicKeyResp to a OwnerInputPublicKey.
//
// Warning: the fields of the param type will not be present. ToParam should only
// be used at the last possible moment before sending a request. Test for this with
// OwnerInputPublicKey.Overrides()
func (r OwnerInputPublicKeyResp) ToParam() OwnerInputPublicKey {
return param.Override[OwnerInputPublicKey](json.RawMessage(r.RawJSON()))
}
// Owner input specifying a P-256 public key.
//
// The property PublicKey is required.
type OwnerInputPublicKey struct {
// A P-256 (secp256r1) public key.
PublicKey P256PublicKey `json:"public_key" api:"required"`
paramObj
}
func (r OwnerInputPublicKey) MarshalJSON() (data []byte, err error) {
type shadow OwnerInputPublicKey
return param.MarshalObject(r, (*shadow)(&r))
}
func (r *OwnerInputPublicKey) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Owner input specifying a Privy user ID.
type OwnerInputUserResp struct {
UserID string `json:"user_id" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
UserID respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
func (r OwnerInputUserResp) RawJSON() string { return r.JSON.raw }
func (r *OwnerInputUserResp) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// ToParam converts this OwnerInputUserResp to a OwnerInputUser.
//
// Warning: the fields of the param type will not be present. ToParam should only
// be used at the last possible moment before sending a request. Test for this with
// OwnerInputUser.Overrides()
func (r OwnerInputUserResp) ToParam() OwnerInputUser {
return param.Override[OwnerInputUser](json.RawMessage(r.RawJSON()))
}
// Owner input specifying a Privy user ID.
//
// The property UserID is required.
type OwnerInputUser struct {
UserID string `json:"user_id" api:"required"`
paramObj
}
func (r OwnerInputUser) MarshalJSON() (data []byte, err error) {
type shadow OwnerInputUser
return param.MarshalObject(r, (*shadow)(&r))
}
func (r *OwnerInputUser) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
type P256PublicKey = string
// A simple success response.
type SuccessResponse struct {
Success bool `json:"success" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Success respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
func (r SuccessResponse) RawJSON() string { return r.JSON.raw }
func (r *SuccessResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Tron CAIP-2 chain identifier. Supported values: "tron:mainnet", "tron:nile".
type TronCaip2 string
const (
TronCaip2TronMainnet TronCaip2 = "tron:mainnet"
TronCaip2TronNile TronCaip2 = "tron:nile"
)
type TronHexAddress = string