Solidarity transport

This commit is contained in:
2025-02-28 17:49:14 +01:00
parent 0dc694324e
commit 7914cd919f
11 changed files with 529 additions and 59 deletions

View File

@@ -74,3 +74,32 @@ func (s *ServicesHandler) GetAccounts() (accounts []storage.Account, err error)
return
}
func (s *ServicesHandler) GetAccountsInNamespace(namespace string) (accounts []storage.Account, err error) {
accounts = []storage.Account{}
request := &mobilityaccounts.GetAccountsRequest{
Namespaces: []string{namespace},
}
resp, err := s.GRPC.MobilityAccounts.GetAccounts(context.TODO(), request)
if err == nil {
for _, v := range resp.Accounts {
a := v.ToStorageType()
accounts = append(accounts, a)
}
}
return
}
func (s *ServicesHandler) GetAccount(id string) (account storage.Account, err error) {
request := &mobilityaccounts.GetAccountRequest{
Id: id,
}
resp, err := s.GRPC.MobilityAccounts.GetAccount(context.TODO(), request)
if err != nil {
return storage.Account{}, err
}
return resp.Account.ToStorageType(), nil
}