2021-04-17 11:36:37 -04:00
|
|
|
package model
|
|
|
|
|
2024-10-19 12:09:16 -04:00
|
|
|
const (
|
|
|
|
ApiErrorUnauthorized = 10001
|
|
|
|
)
|
|
|
|
|
2024-12-28 10:50:59 -05:00
|
|
|
type Oauth2LoginResponse struct {
|
|
|
|
Redirect string `json:"redirect,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Oauth2Callback struct {
|
|
|
|
State string `json:"state,omitempty"`
|
|
|
|
Code string `json:"code,omitempty"`
|
|
|
|
}
|
|
|
|
|
2024-10-19 12:09:16 -04:00
|
|
|
type LoginRequest struct {
|
2024-10-20 02:05:43 -04:00
|
|
|
Username string `json:"username,omitempty"`
|
|
|
|
Password string `json:"password,omitempty"`
|
2024-10-19 12:09:16 -04:00
|
|
|
}
|
|
|
|
|
2024-10-20 02:05:43 -04:00
|
|
|
type CommonResponse[T any] struct {
|
|
|
|
Success bool `json:"success,omitempty"`
|
|
|
|
Data T `json:"data,omitempty"`
|
|
|
|
Error string `json:"error,omitempty"`
|
2024-10-19 12:09:16 -04:00
|
|
|
}
|
|
|
|
|
2024-12-21 11:05:41 -05:00
|
|
|
type PaginatedResponse[S ~[]E, E any] struct {
|
|
|
|
Success bool `json:"success,omitempty"`
|
|
|
|
Data *Value[S] `json:"data,omitempty"`
|
|
|
|
Error string `json:"error,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Value[T any] struct {
|
|
|
|
Value T `json:"value,omitempty"`
|
|
|
|
Pagination Pagination `json:"pagination,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Pagination struct {
|
|
|
|
Offset int `json:"offset,omitempty"`
|
|
|
|
Limit int `json:"limit,omitempty"`
|
|
|
|
Total int64 `json:"total,omitempty"`
|
|
|
|
}
|
|
|
|
|
2024-10-20 02:05:43 -04:00
|
|
|
type LoginResponse struct {
|
|
|
|
Token string `json:"token,omitempty"`
|
|
|
|
Expire string `json:"expire,omitempty"`
|
2024-10-19 12:09:16 -04:00
|
|
|
}
|