/
models_gen.go
179 lines (149 loc) · 4.74 KB
/
models_gen.go
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
// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
package model
import (
"fmt"
"io"
"strconv"
)
type Address struct {
Street string `json:"street"`
City string `json:"city"`
State string `json:"state"`
Zip string `json:"zip"`
Country string `json:"country"`
}
type Cards struct {
Count int `json:"count"`
Data []*Card `json:"data,omitempty"`
}
type NewCardInput struct {
Name string `json:"name"`
Number string `json:"number"`
ExpMonth int `json:"exp_month"`
ExpYear int `json:"exp_year"`
Cvv string `json:"cvv"`
Billing map[string]interface{} `json:"billing"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
type NewTransaction struct {
Type string `json:"type"`
Status string `json:"status"`
Amount float64 `json:"amount"`
Currency string `json:"currency"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
Date string `json:"date"`
Description string `json:"description"`
Card string `json:"card"`
UID string `json:"uid"`
Wallet string `json:"wallet"`
}
type NewWallet struct {
Balance float64 `json:"balance"`
Currency string `json:"currency"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
type Transactions struct {
Data []*Transaction `json:"data,omitempty"`
Count int `json:"count"`
}
type UpdateCardInput struct {
Name *string `json:"name,omitempty"`
ExpMonth *int `json:"exp_month,omitempty"`
ExpYear *int `json:"exp_year,omitempty"`
Cvv *string `json:"cvv,omitempty"`
Billing map[string]interface{} `json:"billing,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
type UpdateTransaction struct {
Description *string `json:"description,omitempty"`
Status *string `json:"status,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
type UpdateWallet struct {
Balance *float64 `json:"balance,omitempty"`
Currency *string `json:"currency,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
type User struct {
ID string `json:"id"`
Wallets []*Wallet `json:"wallets,omitempty"`
}
func (User) IsEntity() {}
type Wallets struct {
Data []*Wallet `json:"data,omitempty"`
Count int `json:"count"`
}
type TransactionMethod string
const (
TransactionMethodCreditCard TransactionMethod = "CREDIT_CARD"
TransactionMethodDebitCard TransactionMethod = "DEBIT_CARD"
TransactionMethodPaypal TransactionMethod = "PAYPAL"
TransactionMethodStripe TransactionMethod = "STRIPE"
)
var AllTransactionMethod = []TransactionMethod{
TransactionMethodCreditCard,
TransactionMethodDebitCard,
TransactionMethodPaypal,
TransactionMethodStripe,
}
func (e TransactionMethod) IsValid() bool {
switch e {
case TransactionMethodCreditCard, TransactionMethodDebitCard, TransactionMethodPaypal, TransactionMethodStripe:
return true
}
return false
}
func (e TransactionMethod) String() string {
return string(e)
}
func (e *TransactionMethod) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = TransactionMethod(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid TransactionMethod", str)
}
return nil
}
func (e TransactionMethod) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
type TransactionStatus string
const (
TransactionStatusPending TransactionStatus = "PENDING"
TransactionStatusCompleted TransactionStatus = "COMPLETED"
TransactionStatusFailed TransactionStatus = "FAILED"
TransactionStatusRefunded TransactionStatus = "REFUNDED"
)
var AllTransactionStatus = []TransactionStatus{
TransactionStatusPending,
TransactionStatusCompleted,
TransactionStatusFailed,
TransactionStatusRefunded,
}
func (e TransactionStatus) IsValid() bool {
switch e {
case TransactionStatusPending, TransactionStatusCompleted, TransactionStatusFailed, TransactionStatusRefunded:
return true
}
return false
}
func (e TransactionStatus) String() string {
return string(e)
}
func (e *TransactionStatus) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = TransactionStatus(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid TransactionStatus", str)
}
return nil
}
func (e TransactionStatus) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}