| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- // Code generated by protoc-gen-go-http. DO NOT EDIT.
- // versions:
- // protoc-gen-go-http v2.0.0
- package base
- import (
- context "context"
- base "git.ikuban.com/server/base-protobuf/kuban/api/base"
- reply "git.ikuban.com/server/kratos-utils/http/reply"
- common "git.ikuban.com/server/pw-protobuf/api/common"
- http "github.com/go-kratos/kratos/v2/transport/http"
- binding "github.com/go-kratos/kratos/v2/transport/http/binding"
- ioutil "io/ioutil"
- time "time"
- )
- // This is a compile-time assertion to ensure that this generated file
- // is compatible with the kratos package it is being compiled against.
- var _ = new(context.Context)
- var _ = binding.EncodeURL
- var _ = ioutil.Discard
- var _ = new(time.Time)
- var _ = new(reply.SuccessReply)
- var _ = new(base.Html)
- const _ = http.SupportPackageIsVersion1
- type BaseHTTPServer interface {
- RandomAvatar(context.Context, *common.SexReq) (*RandomAvatarReply, error)
- RandomIntroduce(context.Context, *common.SexReq) (*common.RandomIntroduceReply, error)
- RandomNickname(context.Context, *common.SexReq) (*RandomNicknameReply, error)
- }
- func RegisterBaseHTTPServer(s *http.Server, srv BaseHTTPServer) {
- r := s.Route("/")
- r.POST("/api/common/random/nickname", _Base_RandomNickname0_HTTP_Handler(srv))
- r.POST("/api/common/random/avatar", _Base_RandomAvatar0_HTTP_Handler(srv))
- r.POST("/api/common/random/introduce", _Base_RandomIntroduce0_HTTP_Handler(srv))
- }
- func _Base_RandomNickname0_HTTP_Handler(srv BaseHTTPServer) func(ctx http.Context) error {
- return func(ctx http.Context) error {
- var in common.SexReq
- if err := ctx.Bind(&in); err != nil {
- return err
- }
- if err := ctx.BindQuery(&in); err != nil {
- return err
- }
- http.SetOperation(ctx, "/api.base.Base/RandomNickname")
- h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.RandomNickname(ctx, req.(*common.SexReq))
- })
- out, err := h(ctx, &in)
- if err != nil {
- return err
- }
- success := &reply.SuccessReply{
- Code: 0,
- }
- if out != nil {
- success.Data = out
- }
- return ctx.Result(200, success)
- }
- }
- func _Base_RandomAvatar0_HTTP_Handler(srv BaseHTTPServer) func(ctx http.Context) error {
- return func(ctx http.Context) error {
- var in common.SexReq
- if err := ctx.Bind(&in); err != nil {
- return err
- }
- if err := ctx.BindQuery(&in); err != nil {
- return err
- }
- http.SetOperation(ctx, "/api.base.Base/RandomAvatar")
- h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.RandomAvatar(ctx, req.(*common.SexReq))
- })
- out, err := h(ctx, &in)
- if err != nil {
- return err
- }
- success := &reply.SuccessReply{
- Code: 0,
- }
- if out != nil {
- success.Data = out
- }
- return ctx.Result(200, success)
- }
- }
- func _Base_RandomIntroduce0_HTTP_Handler(srv BaseHTTPServer) func(ctx http.Context) error {
- return func(ctx http.Context) error {
- var in common.SexReq
- if err := ctx.Bind(&in); err != nil {
- return err
- }
- if err := ctx.BindQuery(&in); err != nil {
- return err
- }
- http.SetOperation(ctx, "/api.base.Base/RandomIntroduce")
- h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.RandomIntroduce(ctx, req.(*common.SexReq))
- })
- out, err := h(ctx, &in)
- if err != nil {
- return err
- }
- success := &reply.SuccessReply{
- Code: 0,
- }
- if out != nil {
- success.Data = out
- }
- return ctx.Result(200, success)
- }
- }
- type BaseHTTPClient interface {
- RandomAvatar(ctx context.Context, req *common.SexReq, opts ...http.CallOption) (rsp *RandomAvatarReply, err error)
- RandomIntroduce(ctx context.Context, req *common.SexReq, opts ...http.CallOption) (rsp *common.RandomIntroduceReply, err error)
- RandomNickname(ctx context.Context, req *common.SexReq, opts ...http.CallOption) (rsp *RandomNicknameReply, err error)
- }
- type BaseHTTPClientImpl struct {
- cc *http.Client
- }
- func NewBaseHTTPClient(client *http.Client) BaseHTTPClient {
- return &BaseHTTPClientImpl{client}
- }
- func (c *BaseHTTPClientImpl) RandomAvatar(ctx context.Context, in *common.SexReq, opts ...http.CallOption) (*RandomAvatarReply, error) {
- var out RandomAvatarReply
- pattern := "/api/common/random/avatar"
- path := binding.EncodeURL(pattern, in, false)
- opts = append(opts, http.Operation("/api.base.Base/RandomAvatar"))
- opts = append(opts, http.PathTemplate(pattern))
- err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
- if err != nil {
- return nil, err
- }
- return &out, err
- }
- func (c *BaseHTTPClientImpl) RandomIntroduce(ctx context.Context, in *common.SexReq, opts ...http.CallOption) (*common.RandomIntroduceReply, error) {
- var out common.RandomIntroduceReply
- pattern := "/api/common/random/introduce"
- path := binding.EncodeURL(pattern, in, false)
- opts = append(opts, http.Operation("/api.base.Base/RandomIntroduce"))
- opts = append(opts, http.PathTemplate(pattern))
- err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
- if err != nil {
- return nil, err
- }
- return &out, err
- }
- func (c *BaseHTTPClientImpl) RandomNickname(ctx context.Context, in *common.SexReq, opts ...http.CallOption) (*RandomNicknameReply, error) {
- var out RandomNicknameReply
- pattern := "/api/common/random/nickname"
- path := binding.EncodeURL(pattern, in, false)
- opts = append(opts, http.Operation("/api.base.Base/RandomNickname"))
- opts = append(opts, http.PathTemplate(pattern))
- err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
- if err != nil {
- return nil, err
- }
- return &out, err
- }
|