1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-09 09:35:03 +09:00

NS: Add GetNameByAnyId method

This commit is contained in:
Anton Akentev 2024-03-11 17:03:23 +00:00
parent 2d65758ba3
commit ef9e107496
5 changed files with 289 additions and 29 deletions

View file

@ -55,6 +55,21 @@ func (mr *MockAnyNsClientServiceBaseMockRecorder) GetNameByAddress(ctx, in any)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNameByAddress", reflect.TypeOf((*MockAnyNsClientServiceBase)(nil).GetNameByAddress), ctx, in)
}
// GetNameByAnyId mocks base method.
func (m *MockAnyNsClientServiceBase) GetNameByAnyId(ctx context.Context, in *nameserviceproto.NameByAnyIdRequest) (*nameserviceproto.NameByAddressResponse, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetNameByAnyId", ctx, in)
ret0, _ := ret[0].(*nameserviceproto.NameByAddressResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// GetNameByAnyId indicates an expected call of GetNameByAnyId.
func (mr *MockAnyNsClientServiceBaseMockRecorder) GetNameByAnyId(ctx, in any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNameByAnyId", reflect.TypeOf((*MockAnyNsClientServiceBase)(nil).GetNameByAnyId), ctx, in)
}
// Init mocks base method.
func (m *MockAnyNsClientServiceBase) Init(a *app.App) error {
m.ctrl.T.Helper()
@ -181,6 +196,21 @@ func (mr *MockAnyNsClientServiceMockRecorder) GetNameByAddress(ctx, in any) *gom
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNameByAddress", reflect.TypeOf((*MockAnyNsClientService)(nil).GetNameByAddress), ctx, in)
}
// GetNameByAnyId mocks base method.
func (m *MockAnyNsClientService) GetNameByAnyId(ctx context.Context, in *nameserviceproto.NameByAnyIdRequest) (*nameserviceproto.NameByAddressResponse, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetNameByAnyId", ctx, in)
ret0, _ := ret[0].(*nameserviceproto.NameByAddressResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// GetNameByAnyId indicates an expected call of GetNameByAnyId.
func (mr *MockAnyNsClientServiceMockRecorder) GetNameByAnyId(ctx, in any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNameByAnyId", reflect.TypeOf((*MockAnyNsClientService)(nil).GetNameByAnyId), ctx, in)
}
// GetOperation mocks base method.
func (m *MockAnyNsClientService) GetOperation(ctx context.Context, in *nameserviceproto.GetOperationStatusRequest) (*nameserviceproto.OperationResponse, error) {
m.ctrl.T.Helper()

View file

@ -26,6 +26,7 @@ type AnyNsClientServiceBase interface {
IsNameAvailable(ctx context.Context, in *nsp.NameAvailableRequest) (out *nsp.NameAvailableResponse, err error)
// reverse resolve
GetNameByAddress(ctx context.Context, in *nsp.NameByAddressRequest) (out *nsp.NameByAddressResponse, err error)
GetNameByAnyId(ctx context.Context, in *nsp.NameByAnyIdRequest) (out *nsp.NameByAddressResponse, err error)
app.Component
}
@ -125,6 +126,16 @@ func (s *service) GetNameByAddress(ctx context.Context, in *nsp.NameByAddressReq
return
}
func (s *service) GetNameByAnyId(ctx context.Context, in *nsp.NameByAnyIdRequest) (out *nsp.NameByAddressResponse, err error) {
err = s.doClient(ctx, func(cl nsp.DRPCAnynsClient) error {
if out, err = cl.GetNameByAnyId(ctx, in); err != nil {
return rpcerr.Unwrap(err)
}
return nil
})
return
}
// AA
func (s *service) GetUserAccount(ctx context.Context, in *nsp.GetUserAccountRequest) (out *nsp.UserAccount, err error) {
err = s.doClientAA(ctx, func(cl nsp.DRPCAnynsAccountAbstractionClient) error {