Regenerate assets

This commit is contained in:
Lukas Hirt
2020-09-09 14:10:27 +02:00
parent b549b9ae16
commit f3af912c6f
5 changed files with 1046 additions and 2059 deletions
+1
View File
@@ -11,6 +11,7 @@ require (
github.com/golang/protobuf v1.4.2
github.com/mennanov/fieldmask-utils v0.3.2
github.com/micro/cli/v2 v2.1.2
github.com/micro/go-micro v1.18.0
github.com/micro/go-micro/v2 v2.9.1
github.com/oklog/run v1.1.0
github.com/olekukonko/tablewriter v0.0.4
+32 -3
View File
File diff suppressed because one or more lines are too long
+985 -1815
View File
File diff suppressed because it is too large Load Diff
+14 -198
View File
@@ -15,9 +15,8 @@ import (
import (
context "context"
api "github.com/micro/go-micro/v2/api"
client "github.com/micro/go-micro/v2/client"
server "github.com/micro/go-micro/v2/server"
client "github.com/micro/go-micro/client"
server "github.com/micro/go-micro/server"
)
// Reference imports to suppress errors if they are not otherwise used.
@@ -32,53 +31,10 @@ var _ = math.Inf
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ api.Endpoint
var _ context.Context
var _ client.Option
var _ server.Option
// Api Endpoints for AccountsService service
func NewAccountsServiceEndpoints() []*api.Endpoint {
return []*api.Endpoint{
&api.Endpoint{
Name: "AccountsService.ListAccounts",
Path: []string{"/api/v0/accounts/accounts-list"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
},
&api.Endpoint{
Name: "AccountsService.GetAccount",
Path: []string{"/api/v0/accounts/accounts-get"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
},
&api.Endpoint{
Name: "AccountsService.CreateAccount",
Path: []string{"/api/v0/accounts/accounts-create"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
},
&api.Endpoint{
Name: "AccountsService.UpdateAccount",
Path: []string{"/api/v0/accounts/accounts-update"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
},
&api.Endpoint{
Name: "AccountsService.DeleteAccount",
Path: []string{"/api/v0/accounts/accounts-delete"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
},
}
}
// Client API for AccountsService service
type AccountsService interface {
@@ -100,6 +56,12 @@ type accountsService struct {
}
func NewAccountsService(name string, c client.Client) AccountsService {
if c == nil {
c = client.NewClient()
}
if len(name) == 0 {
name = "settings"
}
return &accountsService{
c: c,
name: name,
@@ -183,41 +145,6 @@ func RegisterAccountsServiceHandler(s server.Server, hdlr AccountsServiceHandler
accountsService
}
h := &accountsServiceHandler{hdlr}
opts = append(opts, api.WithEndpoint(&api.Endpoint{
Name: "AccountsService.ListAccounts",
Path: []string{"/api/v0/accounts/accounts-list"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
}))
opts = append(opts, api.WithEndpoint(&api.Endpoint{
Name: "AccountsService.GetAccount",
Path: []string{"/api/v0/accounts/accounts-get"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
}))
opts = append(opts, api.WithEndpoint(&api.Endpoint{
Name: "AccountsService.CreateAccount",
Path: []string{"/api/v0/accounts/accounts-create"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
}))
opts = append(opts, api.WithEndpoint(&api.Endpoint{
Name: "AccountsService.UpdateAccount",
Path: []string{"/api/v0/accounts/accounts-update"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
}))
opts = append(opts, api.WithEndpoint(&api.Endpoint{
Name: "AccountsService.DeleteAccount",
Path: []string{"/api/v0/accounts/accounts-delete"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
}))
return s.Handle(s.NewHandler(&AccountsService{h}, opts...))
}
@@ -245,68 +172,6 @@ func (h *accountsServiceHandler) DeleteAccount(ctx context.Context, in *DeleteAc
return h.AccountsServiceHandler.DeleteAccount(ctx, in, out)
}
// Api Endpoints for GroupsService service
func NewGroupsServiceEndpoints() []*api.Endpoint {
return []*api.Endpoint{
&api.Endpoint{
Name: "GroupsService.ListGroups",
Path: []string{"/api/v0/accounts/groups-list"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
},
&api.Endpoint{
Name: "GroupsService.GetGroup",
Path: []string{"/api/v0/accounts/groups-get"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
},
&api.Endpoint{
Name: "GroupsService.CreateGroup",
Path: []string{"/api/v0/accounts/groups-create"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
},
&api.Endpoint{
Name: "GroupsService.UpdateGroup",
Path: []string{"/api/v0/accounts/groups-update"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
},
&api.Endpoint{
Name: "GroupsService.DeleteGroup",
Path: []string{"/api/v0/accounts/groups-delete"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
},
&api.Endpoint{
Name: "GroupsService.AddMember",
Path: []string{"/api/v0/groups/{group_id=*}/members/$ref"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
},
&api.Endpoint{
Name: "GroupsService.RemoveMember",
Path: []string{"/api/v0/groups/{group_id=*}/members/{account_id}/$ref"},
Method: []string{"DELETE"},
Body: "*",
Handler: "rpc",
},
&api.Endpoint{
Name: "GroupsService.ListMembers",
Path: []string{"/api/v0/groups/{id=*}/members/$ref"},
Method: []string{"GET"},
Handler: "rpc",
},
}
}
// Client API for GroupsService service
type GroupsService interface {
@@ -334,6 +199,12 @@ type groupsService struct {
}
func NewGroupsService(name string, c client.Client) GroupsService {
if c == nil {
c = client.NewClient()
}
if len(name) == 0 {
name = "settings"
}
return &groupsService{
c: c,
name: name,
@@ -456,61 +327,6 @@ func RegisterGroupsServiceHandler(s server.Server, hdlr GroupsServiceHandler, op
groupsService
}
h := &groupsServiceHandler{hdlr}
opts = append(opts, api.WithEndpoint(&api.Endpoint{
Name: "GroupsService.ListGroups",
Path: []string{"/api/v0/accounts/groups-list"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
}))
opts = append(opts, api.WithEndpoint(&api.Endpoint{
Name: "GroupsService.GetGroup",
Path: []string{"/api/v0/accounts/groups-get"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
}))
opts = append(opts, api.WithEndpoint(&api.Endpoint{
Name: "GroupsService.CreateGroup",
Path: []string{"/api/v0/accounts/groups-create"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
}))
opts = append(opts, api.WithEndpoint(&api.Endpoint{
Name: "GroupsService.UpdateGroup",
Path: []string{"/api/v0/accounts/groups-update"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
}))
opts = append(opts, api.WithEndpoint(&api.Endpoint{
Name: "GroupsService.DeleteGroup",
Path: []string{"/api/v0/accounts/groups-delete"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
}))
opts = append(opts, api.WithEndpoint(&api.Endpoint{
Name: "GroupsService.AddMember",
Path: []string{"/api/v0/groups/{group_id=*}/members/$ref"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
}))
opts = append(opts, api.WithEndpoint(&api.Endpoint{
Name: "GroupsService.RemoveMember",
Path: []string{"/api/v0/groups/{group_id=*}/members/{account_id}/$ref"},
Method: []string{"DELETE"},
Body: "*",
Handler: "rpc",
}))
opts = append(opts, api.WithEndpoint(&api.Endpoint{
Name: "GroupsService.ListMembers",
Path: []string{"/api/v0/groups/{id=*}/members/$ref"},
Method: []string{"GET"},
Handler: "rpc",
}))
return s.Handle(s.NewHandler(&GroupsService{h}, opts...))
}
+14 -43
View File
@@ -5,14 +5,13 @@ package proto
import (
"bytes"
"context"
"encoding/json"
"net/http"
"github.com/go-chi/chi"
"github.com/go-chi/render"
"github.com/golang/protobuf/jsonpb"
"github.com/golang/protobuf/ptypes/empty"
)
type webAccountsServiceHandler struct {
@@ -25,9 +24,7 @@ func (h *webAccountsServiceHandler) ServeHTTP(w http.ResponseWriter, r *http.Req
}
func (h *webAccountsServiceHandler) ListAccounts(w http.ResponseWriter, r *http.Request) {
req := &ListAccountsRequest{}
resp := &ListAccountsResponse{}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
@@ -36,7 +33,7 @@ func (h *webAccountsServiceHandler) ListAccounts(w http.ResponseWriter, r *http.
}
if err := h.h.ListAccounts(
r.Context(),
context.Background(),
req,
resp,
); err != nil {
@@ -49,9 +46,7 @@ func (h *webAccountsServiceHandler) ListAccounts(w http.ResponseWriter, r *http.
}
func (h *webAccountsServiceHandler) GetAccount(w http.ResponseWriter, r *http.Request) {
req := &GetAccountRequest{}
resp := &Account{}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
@@ -60,7 +55,7 @@ func (h *webAccountsServiceHandler) GetAccount(w http.ResponseWriter, r *http.Re
}
if err := h.h.GetAccount(
r.Context(),
context.Background(),
req,
resp,
); err != nil {
@@ -73,9 +68,7 @@ func (h *webAccountsServiceHandler) GetAccount(w http.ResponseWriter, r *http.Re
}
func (h *webAccountsServiceHandler) CreateAccount(w http.ResponseWriter, r *http.Request) {
req := &CreateAccountRequest{}
resp := &Account{}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
@@ -84,7 +77,7 @@ func (h *webAccountsServiceHandler) CreateAccount(w http.ResponseWriter, r *http
}
if err := h.h.CreateAccount(
r.Context(),
context.Background(),
req,
resp,
); err != nil {
@@ -97,9 +90,7 @@ func (h *webAccountsServiceHandler) CreateAccount(w http.ResponseWriter, r *http
}
func (h *webAccountsServiceHandler) UpdateAccount(w http.ResponseWriter, r *http.Request) {
req := &UpdateAccountRequest{}
resp := &Account{}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
@@ -108,7 +99,7 @@ func (h *webAccountsServiceHandler) UpdateAccount(w http.ResponseWriter, r *http
}
if err := h.h.UpdateAccount(
r.Context(),
context.Background(),
req,
resp,
); err != nil {
@@ -121,9 +112,7 @@ func (h *webAccountsServiceHandler) UpdateAccount(w http.ResponseWriter, r *http
}
func (h *webAccountsServiceHandler) DeleteAccount(w http.ResponseWriter, r *http.Request) {
req := &DeleteAccountRequest{}
resp := &empty.Empty{}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
http.Error(w, err.Error(), http.StatusPreconditionFailed)
@@ -131,9 +120,8 @@ func (h *webAccountsServiceHandler) DeleteAccount(w http.ResponseWriter, r *http
}
if err := h.h.DeleteAccount(
r.Context(),
context.Background(),
req,
resp,
); err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
@@ -166,9 +154,7 @@ func (h *webGroupsServiceHandler) ServeHTTP(w http.ResponseWriter, r *http.Reque
}
func (h *webGroupsServiceHandler) ListGroups(w http.ResponseWriter, r *http.Request) {
req := &ListGroupsRequest{}
resp := &ListGroupsResponse{}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
@@ -177,7 +163,7 @@ func (h *webGroupsServiceHandler) ListGroups(w http.ResponseWriter, r *http.Requ
}
if err := h.h.ListGroups(
r.Context(),
context.Background(),
req,
resp,
); err != nil {
@@ -190,9 +176,7 @@ func (h *webGroupsServiceHandler) ListGroups(w http.ResponseWriter, r *http.Requ
}
func (h *webGroupsServiceHandler) GetGroup(w http.ResponseWriter, r *http.Request) {
req := &GetGroupRequest{}
resp := &Group{}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
@@ -201,7 +185,7 @@ func (h *webGroupsServiceHandler) GetGroup(w http.ResponseWriter, r *http.Reques
}
if err := h.h.GetGroup(
r.Context(),
context.Background(),
req,
resp,
); err != nil {
@@ -214,9 +198,7 @@ func (h *webGroupsServiceHandler) GetGroup(w http.ResponseWriter, r *http.Reques
}
func (h *webGroupsServiceHandler) CreateGroup(w http.ResponseWriter, r *http.Request) {
req := &CreateGroupRequest{}
resp := &Group{}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
@@ -225,7 +207,7 @@ func (h *webGroupsServiceHandler) CreateGroup(w http.ResponseWriter, r *http.Req
}
if err := h.h.CreateGroup(
r.Context(),
context.Background(),
req,
resp,
); err != nil {
@@ -238,9 +220,7 @@ func (h *webGroupsServiceHandler) CreateGroup(w http.ResponseWriter, r *http.Req
}
func (h *webGroupsServiceHandler) UpdateGroup(w http.ResponseWriter, r *http.Request) {
req := &UpdateGroupRequest{}
resp := &Group{}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
@@ -249,7 +229,7 @@ func (h *webGroupsServiceHandler) UpdateGroup(w http.ResponseWriter, r *http.Req
}
if err := h.h.UpdateGroup(
r.Context(),
context.Background(),
req,
resp,
); err != nil {
@@ -262,9 +242,7 @@ func (h *webGroupsServiceHandler) UpdateGroup(w http.ResponseWriter, r *http.Req
}
func (h *webGroupsServiceHandler) DeleteGroup(w http.ResponseWriter, r *http.Request) {
req := &DeleteGroupRequest{}
resp := &empty.Empty{}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
http.Error(w, err.Error(), http.StatusPreconditionFailed)
@@ -272,9 +250,8 @@ func (h *webGroupsServiceHandler) DeleteGroup(w http.ResponseWriter, r *http.Req
}
if err := h.h.DeleteGroup(
r.Context(),
context.Background(),
req,
resp,
); err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
@@ -285,9 +262,7 @@ func (h *webGroupsServiceHandler) DeleteGroup(w http.ResponseWriter, r *http.Req
}
func (h *webGroupsServiceHandler) AddMember(w http.ResponseWriter, r *http.Request) {
req := &AddMemberRequest{}
resp := &Group{}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
@@ -296,7 +271,7 @@ func (h *webGroupsServiceHandler) AddMember(w http.ResponseWriter, r *http.Reque
}
if err := h.h.AddMember(
r.Context(),
context.Background(),
req,
resp,
); err != nil {
@@ -309,9 +284,7 @@ func (h *webGroupsServiceHandler) AddMember(w http.ResponseWriter, r *http.Reque
}
func (h *webGroupsServiceHandler) RemoveMember(w http.ResponseWriter, r *http.Request) {
req := &RemoveMemberRequest{}
resp := &Group{}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
@@ -320,7 +293,7 @@ func (h *webGroupsServiceHandler) RemoveMember(w http.ResponseWriter, r *http.Re
}
if err := h.h.RemoveMember(
r.Context(),
context.Background(),
req,
resp,
); err != nil {
@@ -333,9 +306,7 @@ func (h *webGroupsServiceHandler) RemoveMember(w http.ResponseWriter, r *http.Re
}
func (h *webGroupsServiceHandler) ListMembers(w http.ResponseWriter, r *http.Request) {
req := &ListMembersRequest{}
resp := &ListMembersResponse{}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
@@ -344,7 +315,7 @@ func (h *webGroupsServiceHandler) ListMembers(w http.ResponseWriter, r *http.Req
}
if err := h.h.ListMembers(
r.Context(),
context.Background(),
req,
resp,
); err != nil {