status-go/protocol/requests/create_profile_chat.go

33 lines
877 B
Go
Raw Permalink Normal View History

2021-03-25 15:15:22 +00:00
package requests
import (
"errors"
"github.com/status-im/status-go/deprecation"
2021-03-25 15:15:22 +00:00
)
// Deprecated: errCreateProfileChatInvalidID shouldn't be used
// and is only left here in case profile chat feature is re-introduced.
var errCreateProfileChatInvalidID = errors.New("create-public-chat: invalid id")
2021-03-25 15:15:22 +00:00
// Deprecated: CreateProfileChat shouldn't be used
// and is only left here in case profile chat feature is re-introduced.
2021-03-25 15:15:22 +00:00
type CreateProfileChat struct {
2021-05-14 10:55:42 +00:00
ID string `json:"id"`
2021-03-25 15:15:22 +00:00
}
// Deprecated: Validate shouldn't be used
// and is only left here in case profile chat feature is re-introduced.
2021-05-14 10:55:42 +00:00
func (c *CreateProfileChat) Validate() error {
// Return error to prevent usafe of deprecated function
if deprecation.ChatProfileDeprecated {
return errors.New("profile chats are deprecated")
}
2021-05-14 10:55:42 +00:00
if len(c.ID) == 0 {
return errCreateProfileChatInvalidID
2021-03-25 15:15:22 +00:00
}
return nil
}