2023-03-02 16:27:48 +00:00
|
|
|
package requests
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
|
|
|
"github.com/status-im/status-go/protocol/protobuf"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
ErrEditCommunityTokenPermissionInvalidID = errors.New("invalid community token permission id")
|
|
|
|
)
|
|
|
|
|
|
|
|
type EditCommunityTokenPermission struct {
|
|
|
|
PermissionID string `json:"permissionId"`
|
|
|
|
CreateCommunityTokenPermission
|
|
|
|
}
|
|
|
|
|
|
|
|
func (u *EditCommunityTokenPermission) Validate() error {
|
|
|
|
if len(u.PermissionID) == 0 {
|
|
|
|
return ErrEditCommunityTokenPermissionInvalidID
|
|
|
|
}
|
|
|
|
|
|
|
|
return u.CreateCommunityTokenPermission.Validate()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (u *EditCommunityTokenPermission) ToCommunityTokenPermission() protobuf.CommunityTokenPermission {
|
|
|
|
return protobuf.CommunityTokenPermission{
|
|
|
|
Id: u.PermissionID,
|
|
|
|
Type: u.Type,
|
|
|
|
TokenCriteria: u.TokenCriteria,
|
2023-06-09 09:50:25 +00:00
|
|
|
ChatIds: u.ChatIds,
|
2023-06-14 16:27:39 +00:00
|
|
|
IsPrivate: u.IsPrivate,
|
2023-03-02 16:27:48 +00:00
|
|
|
}
|
|
|
|
}
|