65 lines
2.1 KiB
Go
65 lines
2.1 KiB
Go
package models
|
||
|
||
type CreateWebHookReq struct {
|
||
ClientID string `json:"client_id"` // id интеграции
|
||
ClientSecret string `json:"client_secret"` // Секрет интеграции
|
||
GrantType string `json:"grant_type"` // Тип авторизационных данных (для кода авторизации – authorization_code)
|
||
Code string `json:"code"` // Полученный код авторизации
|
||
}
|
||
|
||
type CreateWebHookResp struct {
|
||
AccessToken string `json:"access_token"` // access token в формате JWT
|
||
ClientEndpoint string `json:"client_endpoint"`
|
||
Domain string `json:"domain"`
|
||
ExpiresIn int64 `json:"expires_in"` // время жизни токена в секундах
|
||
MemberID string `json:"member_id"` // ид пользователя
|
||
RefreshToken string `json:"refresh_token"` // токен для обновления access Token
|
||
Scope string `json:"scope"`
|
||
}
|
||
|
||
type UpdateWebHookReq struct {
|
||
ClientID string `json:"client_id"` // id интеграции
|
||
ClientSecret string `json:"client_secret"` // Секрет интеграции
|
||
GrantType string `json:"grant_type"` // Тип авторизационных данных (для кода авторизации – authorization_code) refresh_token tut
|
||
RefreshToken string `json:"refresh_token"` // Refresh токен
|
||
}
|
||
|
||
type WebHookRequest interface {
|
||
SetClientID(str string)
|
||
SetClientSecret(str string)
|
||
GetGrantType() string
|
||
GetToken() string
|
||
}
|
||
|
||
func (req *CreateWebHookReq) SetClientID(str string) {
|
||
req.ClientID = str
|
||
}
|
||
|
||
func (req *CreateWebHookReq) SetClientSecret(str string) {
|
||
req.ClientSecret = str
|
||
}
|
||
|
||
func (req *CreateWebHookReq) GetGrantType() string {
|
||
return req.GrantType
|
||
}
|
||
|
||
func (req *CreateWebHookReq) GetToken() string {
|
||
return req.Code
|
||
}
|
||
|
||
func (req *UpdateWebHookReq) SetClientID(str string) {
|
||
req.ClientID = str
|
||
}
|
||
|
||
func (req *UpdateWebHookReq) SetClientSecret(str string) {
|
||
req.ClientSecret = str
|
||
}
|
||
|
||
func (req *UpdateWebHookReq) GetGrantType() string {
|
||
return req.GrantType
|
||
}
|
||
|
||
func (req *UpdateWebHookReq) GetToken() string {
|
||
return req.RefreshToken
|
||
}
|