Files
Igor Sirotin f9cc782a6f refactor: move services to pkg/services
Part of the Go project layout migration, item 31.

Pure move plus import-path rewrite across 687 files. No API or behaviour
change.

The services keep their grouping under pkg/services/<name> rather than
being promoted to pkg/<name>: 27 top-level directories in pkg/ would read
worse than what we have, and the grouping is what makes "an RPC service"
identifiable at a glance.

Paths that follow the move: the logosstorage test target and generate
step, the two wallet token-list tools, the migration-order check (and the
pre-rebase hook symlinked to it), and the storage env helper.

refs #7067
2026-08-21 10:11:05 +02:00

49 lines
1.1 KiB
Go

package chat
import (
"context"
"errors"
"github.com/status-im/status-go/internal/crypto/types"
"github.com/status-im/status-go/internal/images"
"github.com/status-im/status-go/internal/protocol"
)
var (
ErrChatNotFound = errors.New("can't find chat")
ErrCommunitiesNotSupported = errors.New("communities are not supported")
ErrChatTypeNotSupported = errors.New("chat type not supported")
)
func NewAPI(service *Service) *API {
return &API{
s: service,
}
}
type API struct {
s *Service
}
func (api *API) EditChat(ctx context.Context, communityID types.HexBytes, chatID string, name string, color string, image images.CroppedImage) (*protocol.MessengerResponse, error) {
if len(communityID) != 0 {
return nil, ErrCommunitiesNotSupported
}
chatToEdit := api.s.messenger.Chat(chatID)
if chatToEdit == nil {
return nil, ErrChatNotFound
}
if chatToEdit.ChatType != protocol.ChatTypePrivateGroupChat {
return nil, ErrChatTypeNotSupported
}
response, err := api.s.messenger.EditGroupChat(ctx, chatID, name, color, image)
if err != nil {
return nil, err
}
return response, nil
}