mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-12 19:25:16 +00:00
* Autogenerate services.m3o.com * Openapi for all * Gen * Fix * Whaat * Fix dep * Fix * Hmm * Install make * Debug * Debug 1 * Location -> locations * Fix * Intall protoc gen micro * F * F * F * Push * Rename secret * Fix npm install * Fix script * Fix v2 * Ignore errors * Ignore v2 * F * F * F * Docs index * Add hugo theme * Hugo tania fixes * Change gen * Change gen 2 * Install hugo * Change gen * Gen fix * Change hugo install * Change hugo install * CNAME * Change articles wording * Tiny fix * Fix gen * Redoc it all * Fix gen * Fixing up protos * Fix proto * Fix gen * Fix * Trigger build * Fix copy * Openapi docs * Flatten * Changes * No date vol2 * Changes * Add make to chat * Fixes * Change * api spec * replace RSS * fix link * Dont continue on error * increase the width * use micro at master * change box colours * move some things * Pushing new readmes to see how they look like * Add skip file * Readmes * Nicer api link * Remove stutter * FIx mistake * set service font weight * Messages readme fix * add other font bold * Notes * Remove post from url * Revert "Remove post from url" This reverts commit 5fea2c23d0bafa910f5dc4d4cc63f71f578530e3. * move exampleSite to site * replace exampleSite with site * update readme * use filename for post * update index * Add source urls * set source as params * set source as params * Fix entries * Generator in go * Fixes to generator * F * Change doc gen * FIx cname * Fixing protos * Change to makefiles * Fix gen script Co-authored-by: Asim Aslam <asim@aslam.me>
130 lines
3.7 KiB
Go
130 lines
3.7 KiB
Go
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
|
// source: proto/posts.proto
|
|
|
|
package posts
|
|
|
|
import (
|
|
fmt "fmt"
|
|
proto "github.com/golang/protobuf/proto"
|
|
math "math"
|
|
)
|
|
|
|
import (
|
|
context "context"
|
|
api "github.com/micro/micro/v3/service/api"
|
|
client "github.com/micro/micro/v3/service/client"
|
|
server "github.com/micro/micro/v3/service/server"
|
|
)
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ = proto.Marshal
|
|
var _ = fmt.Errorf
|
|
var _ = math.Inf
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the proto package it is being compiled against.
|
|
// A compilation error at this line likely means your copy of the
|
|
// proto package needs to be updated.
|
|
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 Posts service
|
|
|
|
func NewPostsEndpoints() []*api.Endpoint {
|
|
return []*api.Endpoint{}
|
|
}
|
|
|
|
// Client API for Posts service
|
|
|
|
type PostsService interface {
|
|
// Query currently only supports read by slug or timestamp, no listing.
|
|
Query(ctx context.Context, in *QueryRequest, opts ...client.CallOption) (*QueryResponse, error)
|
|
Save(ctx context.Context, in *SaveRequest, opts ...client.CallOption) (*SaveResponse, error)
|
|
Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error)
|
|
}
|
|
|
|
type postsService struct {
|
|
c client.Client
|
|
name string
|
|
}
|
|
|
|
func NewPostsService(name string, c client.Client) PostsService {
|
|
return &postsService{
|
|
c: c,
|
|
name: name,
|
|
}
|
|
}
|
|
|
|
func (c *postsService) Query(ctx context.Context, in *QueryRequest, opts ...client.CallOption) (*QueryResponse, error) {
|
|
req := c.c.NewRequest(c.name, "Posts.Query", in)
|
|
out := new(QueryResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *postsService) Save(ctx context.Context, in *SaveRequest, opts ...client.CallOption) (*SaveResponse, error) {
|
|
req := c.c.NewRequest(c.name, "Posts.Save", in)
|
|
out := new(SaveResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *postsService) Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) {
|
|
req := c.c.NewRequest(c.name, "Posts.Delete", in)
|
|
out := new(DeleteResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// Server API for Posts service
|
|
|
|
type PostsHandler interface {
|
|
// Query currently only supports read by slug or timestamp, no listing.
|
|
Query(context.Context, *QueryRequest, *QueryResponse) error
|
|
Save(context.Context, *SaveRequest, *SaveResponse) error
|
|
Delete(context.Context, *DeleteRequest, *DeleteResponse) error
|
|
}
|
|
|
|
func RegisterPostsHandler(s server.Server, hdlr PostsHandler, opts ...server.HandlerOption) error {
|
|
type posts interface {
|
|
Query(ctx context.Context, in *QueryRequest, out *QueryResponse) error
|
|
Save(ctx context.Context, in *SaveRequest, out *SaveResponse) error
|
|
Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error
|
|
}
|
|
type Posts struct {
|
|
posts
|
|
}
|
|
h := &postsHandler{hdlr}
|
|
return s.Handle(s.NewHandler(&Posts{h}, opts...))
|
|
}
|
|
|
|
type postsHandler struct {
|
|
PostsHandler
|
|
}
|
|
|
|
func (h *postsHandler) Query(ctx context.Context, in *QueryRequest, out *QueryResponse) error {
|
|
return h.PostsHandler.Query(ctx, in, out)
|
|
}
|
|
|
|
func (h *postsHandler) Save(ctx context.Context, in *SaveRequest, out *SaveResponse) error {
|
|
return h.PostsHandler.Save(ctx, in, out)
|
|
}
|
|
|
|
func (h *postsHandler) Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error {
|
|
return h.PostsHandler.Delete(ctx, in, out)
|
|
}
|