mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-12 03:05:14 +00:00
141 lines
4.5 KiB
Go
141 lines
4.5 KiB
Go
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
|
// source: proto/seen.proto
|
|
|
|
package seen
|
|
|
|
import (
|
|
fmt "fmt"
|
|
proto "github.com/golang/protobuf/proto"
|
|
_ "github.com/golang/protobuf/ptypes/timestamp"
|
|
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 Seen service
|
|
|
|
func NewSeenEndpoints() []*api.Endpoint {
|
|
return []*api.Endpoint{}
|
|
}
|
|
|
|
// Client API for Seen service
|
|
|
|
type SeenService interface {
|
|
// Set a resource as seen by a user. If no timestamp is provided, the current time is used.
|
|
Set(ctx context.Context, in *SetRequest, opts ...client.CallOption) (*SetResponse, error)
|
|
// Unset a resource as seen, used in cases where a user viewed a resource but wants to override
|
|
// this so they remember to action it in the future, e.g. "Mark this as unread".
|
|
Unset(ctx context.Context, in *UnsetRequest, opts ...client.CallOption) (*UnsetResponse, error)
|
|
// Read returns the timestamps at which various resources were seen by a user. If no timestamp
|
|
// is returned for a given resource_id, it indicates that resource has not yet been seen by the
|
|
// user.
|
|
Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error)
|
|
}
|
|
|
|
type seenService struct {
|
|
c client.Client
|
|
name string
|
|
}
|
|
|
|
func NewSeenService(name string, c client.Client) SeenService {
|
|
return &seenService{
|
|
c: c,
|
|
name: name,
|
|
}
|
|
}
|
|
|
|
func (c *seenService) Set(ctx context.Context, in *SetRequest, opts ...client.CallOption) (*SetResponse, error) {
|
|
req := c.c.NewRequest(c.name, "Seen.Set", in)
|
|
out := new(SetResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *seenService) Unset(ctx context.Context, in *UnsetRequest, opts ...client.CallOption) (*UnsetResponse, error) {
|
|
req := c.c.NewRequest(c.name, "Seen.Unset", in)
|
|
out := new(UnsetResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *seenService) Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) {
|
|
req := c.c.NewRequest(c.name, "Seen.Read", in)
|
|
out := new(ReadResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// Server API for Seen service
|
|
|
|
type SeenHandler interface {
|
|
// Set a resource as seen by a user. If no timestamp is provided, the current time is used.
|
|
Set(context.Context, *SetRequest, *SetResponse) error
|
|
// Unset a resource as seen, used in cases where a user viewed a resource but wants to override
|
|
// this so they remember to action it in the future, e.g. "Mark this as unread".
|
|
Unset(context.Context, *UnsetRequest, *UnsetResponse) error
|
|
// Read returns the timestamps at which various resources were seen by a user. If no timestamp
|
|
// is returned for a given resource_id, it indicates that resource has not yet been seen by the
|
|
// user.
|
|
Read(context.Context, *ReadRequest, *ReadResponse) error
|
|
}
|
|
|
|
func RegisterSeenHandler(s server.Server, hdlr SeenHandler, opts ...server.HandlerOption) error {
|
|
type seen interface {
|
|
Set(ctx context.Context, in *SetRequest, out *SetResponse) error
|
|
Unset(ctx context.Context, in *UnsetRequest, out *UnsetResponse) error
|
|
Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error
|
|
}
|
|
type Seen struct {
|
|
seen
|
|
}
|
|
h := &seenHandler{hdlr}
|
|
return s.Handle(s.NewHandler(&Seen{h}, opts...))
|
|
}
|
|
|
|
type seenHandler struct {
|
|
SeenHandler
|
|
}
|
|
|
|
func (h *seenHandler) Set(ctx context.Context, in *SetRequest, out *SetResponse) error {
|
|
return h.SeenHandler.Set(ctx, in, out)
|
|
}
|
|
|
|
func (h *seenHandler) Unset(ctx context.Context, in *UnsetRequest, out *UnsetResponse) error {
|
|
return h.SeenHandler.Unset(ctx, in, out)
|
|
}
|
|
|
|
func (h *seenHandler) Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error {
|
|
return h.SeenHandler.Read(ctx, in, out)
|
|
}
|