auth/service/proto: add Delete RPC (#1836)

Co-authored-by: Asim Aslam <asim@aslam.me>
This commit is contained in:
ben-toogood
2020-07-14 13:41:35 +01:00
committed by GitHub
parent 42c28f2b6d
commit 0287ab8751
3 changed files with 224 additions and 81 deletions

View File

@@ -136,6 +136,7 @@ func NewAccountsEndpoints() []*api.Endpoint {
type AccountsService interface {
List(ctx context.Context, in *ListAccountsRequest, opts ...client.CallOption) (*ListAccountsResponse, error)
Delete(ctx context.Context, in *DeleteAccountRequest, opts ...client.CallOption) (*DeleteAccountResponse, error)
}
type accountsService struct {
@@ -160,15 +161,27 @@ func (c *accountsService) List(ctx context.Context, in *ListAccountsRequest, opt
return out, nil
}
func (c *accountsService) Delete(ctx context.Context, in *DeleteAccountRequest, opts ...client.CallOption) (*DeleteAccountResponse, error) {
req := c.c.NewRequest(c.name, "Accounts.Delete", in)
out := new(DeleteAccountResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Accounts service
type AccountsHandler interface {
List(context.Context, *ListAccountsRequest, *ListAccountsResponse) error
Delete(context.Context, *DeleteAccountRequest, *DeleteAccountResponse) error
}
func RegisterAccountsHandler(s server.Server, hdlr AccountsHandler, opts ...server.HandlerOption) error {
type accounts interface {
List(ctx context.Context, in *ListAccountsRequest, out *ListAccountsResponse) error
Delete(ctx context.Context, in *DeleteAccountRequest, out *DeleteAccountResponse) error
}
type Accounts struct {
accounts
@@ -185,6 +198,10 @@ func (h *accountsHandler) List(ctx context.Context, in *ListAccountsRequest, out
return h.AccountsHandler.List(ctx, in, out)
}
func (h *accountsHandler) Delete(ctx context.Context, in *DeleteAccountRequest, out *DeleteAccountResponse) error {
return h.AccountsHandler.Delete(ctx, in, out)
}
// Api Endpoints for Rules service
func NewRulesEndpoints() []*api.Endpoint {