Solidarity transport
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user