// Code generated by protoc-gen-go-http. DO NOT EDIT.
// versions:
// - protoc-gen-go-http v2.7.1
// - protoc             (unknown)
// source: sys/api/locale/v1/locale.proto

package v1

import (
	context "context"
	http "github.com/go-kratos/kratos/v2/transport/http"
	binding "github.com/go-kratos/kratos/v2/transport/http/binding"
)

// 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

const _ = http.SupportPackageIsVersion1

const OperationLocaleServiceListMessages = "/sys.api.locale.v1.LocaleService/ListMessages"

type LocaleServiceHTTPServer interface {
	ListMessages(context.Context, *ListMessageRequest) (*ListMessageReply, error)
}

func RegisterLocaleServiceHTTPServer(s *http.Server, srv LocaleServiceHTTPServer) {
	r := s.Route("/")
	r.GET("/v1/sys/locale/msgs", _LocaleService_ListMessages0_HTTP_Handler(srv))
}

func _LocaleService_ListMessages0_HTTP_Handler(srv LocaleServiceHTTPServer) func(ctx http.Context) error {
	return func(ctx http.Context) error {
		var in ListMessageRequest
		if err := ctx.BindQuery(&in); err != nil {
			return err
		}
		http.SetOperation(ctx, OperationLocaleServiceListMessages)
		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
			return srv.ListMessages(ctx, req.(*ListMessageRequest))
		})
		out, err := h(ctx, &in)
		if err != nil {
			return err
		}
		reply := out.(*ListMessageReply)
		return ctx.Result(200, reply)
	}
}

type LocaleServiceHTTPClient interface {
	ListMessages(ctx context.Context, req *ListMessageRequest, opts ...http.CallOption) (rsp *ListMessageReply, err error)
}

type LocaleServiceHTTPClientImpl struct {
	cc *http.Client
}

func NewLocaleServiceHTTPClient(client *http.Client) LocaleServiceHTTPClient {
	return &LocaleServiceHTTPClientImpl{client}
}

func (c *LocaleServiceHTTPClientImpl) ListMessages(ctx context.Context, in *ListMessageRequest, opts ...http.CallOption) (*ListMessageReply, error) {
	var out ListMessageReply
	pattern := "/v1/sys/locale/msgs"
	path := binding.EncodeURL(pattern, in, true)
	opts = append(opts, http.Operation(OperationLocaleServiceListMessages))
	opts = append(opts, http.PathTemplate(pattern))
	err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...)
	if err != nil {
		return nil, err
	}
	return &out, err
}
