451 lines
17 KiB
Go
451 lines
17 KiB
Go
// Code generated by protoc-gen-go-http. DO NOT EDIT.
|
|
// versions:
|
|
// - protoc-gen-go-http v2.9.0
|
|
// - protoc v3.21.12
|
|
// source: customer/v1/customer.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 OperationCustomerServiceChat = "/api.customer.v1.CustomerService/Chat"
|
|
const OperationCustomerServiceCreateSession = "/api.customer.v1.CustomerService/CreateSession"
|
|
const OperationCustomerServiceDeleteKnowledge = "/api.customer.v1.CustomerService/DeleteKnowledge"
|
|
const OperationCustomerServiceGetKnowledgeSummary = "/api.customer.v1.CustomerService/GetKnowledgeSummary"
|
|
const OperationCustomerServiceGetSessions = "/api.customer.v1.CustomerService/GetSessions"
|
|
const OperationCustomerServiceListKnowledge = "/api.customer.v1.CustomerService/ListKnowledge"
|
|
const OperationCustomerServiceQueryOrder = "/api.customer.v1.CustomerService/QueryOrder"
|
|
const OperationCustomerServiceSearchKnowledge = "/api.customer.v1.CustomerService/SearchKnowledge"
|
|
const OperationCustomerServiceSystemStatus = "/api.customer.v1.CustomerService/SystemStatus"
|
|
const OperationCustomerServiceUploadKnowledge = "/api.customer.v1.CustomerService/UploadKnowledge"
|
|
|
|
type CustomerServiceHTTPServer interface {
|
|
// Chat 聊天消息处理接口
|
|
Chat(context.Context, *ChatRequest) (*ChatResponse, error)
|
|
// CreateSession 创建新会话接口
|
|
CreateSession(context.Context, *CreateSessionRequest) (*CreateSessionResponse, error)
|
|
// DeleteKnowledge 删除知识库文档接口
|
|
DeleteKnowledge(context.Context, *DeleteKnowledgeRequest) (*DeleteKnowledgeResponse, error)
|
|
// GetKnowledgeSummary 获取知识库摘要接口
|
|
GetKnowledgeSummary(context.Context, *GetKnowledgeSummaryRequest) (*GetKnowledgeSummaryResponse, error)
|
|
// GetSessions 获取会话列表接口
|
|
GetSessions(context.Context, *GetSessionsRequest) (*GetSessionsResponse, error)
|
|
// ListKnowledge 获取知识库文档列表接口
|
|
ListKnowledge(context.Context, *ListKnowledgeRequest) (*ListKnowledgeResponse, error)
|
|
// QueryOrder 订单查询接口
|
|
QueryOrder(context.Context, *QueryOrderRequest) (*QueryOrderResponse, error)
|
|
// SearchKnowledge 搜索知识库接口
|
|
SearchKnowledge(context.Context, *SearchKnowledgeRequest) (*SearchKnowledgeResponse, error)
|
|
// SystemStatus 健康检查接口
|
|
SystemStatus(context.Context, *SystemStatusRequest) (*SystemStatusResponse, error)
|
|
// UploadKnowledge 知识库文档上传接口
|
|
UploadKnowledge(context.Context, *UploadKnowledgeRequest) (*UploadKnowledgeResponse, error)
|
|
}
|
|
|
|
func RegisterCustomerServiceHTTPServer(s *http.Server, srv CustomerServiceHTTPServer) {
|
|
r := s.Route("/")
|
|
r.GET("/api/system/status", _CustomerService_SystemStatus0_HTTP_Handler(srv))
|
|
r.POST("/api/chat", _CustomerService_Chat0_HTTP_Handler(srv))
|
|
r.GET("/api/sessions", _CustomerService_GetSessions0_HTTP_Handler(srv))
|
|
r.POST("/api/sessions", _CustomerService_CreateSession0_HTTP_Handler(srv))
|
|
r.POST("/api/knowledge/upload", _CustomerService_UploadKnowledge0_HTTP_Handler(srv))
|
|
r.GET("/api/knowledge/list", _CustomerService_ListKnowledge0_HTTP_Handler(srv))
|
|
r.DELETE("/api/knowledge/{id}", _CustomerService_DeleteKnowledge0_HTTP_Handler(srv))
|
|
r.POST("/api/knowledge/search", _CustomerService_SearchKnowledge0_HTTP_Handler(srv))
|
|
r.POST("/api/knowledge/summary", _CustomerService_GetKnowledgeSummary0_HTTP_Handler(srv))
|
|
r.POST("/api/order/query", _CustomerService_QueryOrder0_HTTP_Handler(srv))
|
|
}
|
|
|
|
func _CustomerService_SystemStatus0_HTTP_Handler(srv CustomerServiceHTTPServer) func(ctx http.Context) error {
|
|
return func(ctx http.Context) error {
|
|
var in SystemStatusRequest
|
|
if err := ctx.BindQuery(&in); err != nil {
|
|
return err
|
|
}
|
|
http.SetOperation(ctx, OperationCustomerServiceSystemStatus)
|
|
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.SystemStatus(ctx, req.(*SystemStatusRequest))
|
|
})
|
|
out, err := h(ctx, &in)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
reply := out.(*SystemStatusResponse)
|
|
return ctx.Result(200, reply)
|
|
}
|
|
}
|
|
|
|
func _CustomerService_Chat0_HTTP_Handler(srv CustomerServiceHTTPServer) func(ctx http.Context) error {
|
|
return func(ctx http.Context) error {
|
|
var in ChatRequest
|
|
if err := ctx.Bind(&in); err != nil {
|
|
return err
|
|
}
|
|
if err := ctx.BindQuery(&in); err != nil {
|
|
return err
|
|
}
|
|
http.SetOperation(ctx, OperationCustomerServiceChat)
|
|
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.Chat(ctx, req.(*ChatRequest))
|
|
})
|
|
out, err := h(ctx, &in)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
reply := out.(*ChatResponse)
|
|
return ctx.Result(200, reply)
|
|
}
|
|
}
|
|
|
|
func _CustomerService_GetSessions0_HTTP_Handler(srv CustomerServiceHTTPServer) func(ctx http.Context) error {
|
|
return func(ctx http.Context) error {
|
|
var in GetSessionsRequest
|
|
if err := ctx.BindQuery(&in); err != nil {
|
|
return err
|
|
}
|
|
http.SetOperation(ctx, OperationCustomerServiceGetSessions)
|
|
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.GetSessions(ctx, req.(*GetSessionsRequest))
|
|
})
|
|
out, err := h(ctx, &in)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
reply := out.(*GetSessionsResponse)
|
|
return ctx.Result(200, reply)
|
|
}
|
|
}
|
|
|
|
func _CustomerService_CreateSession0_HTTP_Handler(srv CustomerServiceHTTPServer) func(ctx http.Context) error {
|
|
return func(ctx http.Context) error {
|
|
var in CreateSessionRequest
|
|
if err := ctx.Bind(&in); err != nil {
|
|
return err
|
|
}
|
|
if err := ctx.BindQuery(&in); err != nil {
|
|
return err
|
|
}
|
|
http.SetOperation(ctx, OperationCustomerServiceCreateSession)
|
|
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.CreateSession(ctx, req.(*CreateSessionRequest))
|
|
})
|
|
out, err := h(ctx, &in)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
reply := out.(*CreateSessionResponse)
|
|
return ctx.Result(200, reply)
|
|
}
|
|
}
|
|
|
|
func _CustomerService_UploadKnowledge0_HTTP_Handler(srv CustomerServiceHTTPServer) func(ctx http.Context) error {
|
|
return func(ctx http.Context) error {
|
|
var in UploadKnowledgeRequest
|
|
if err := ctx.Bind(&in); err != nil {
|
|
return err
|
|
}
|
|
if err := ctx.BindQuery(&in); err != nil {
|
|
return err
|
|
}
|
|
http.SetOperation(ctx, OperationCustomerServiceUploadKnowledge)
|
|
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.UploadKnowledge(ctx, req.(*UploadKnowledgeRequest))
|
|
})
|
|
out, err := h(ctx, &in)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
reply := out.(*UploadKnowledgeResponse)
|
|
return ctx.Result(200, reply)
|
|
}
|
|
}
|
|
|
|
func _CustomerService_ListKnowledge0_HTTP_Handler(srv CustomerServiceHTTPServer) func(ctx http.Context) error {
|
|
return func(ctx http.Context) error {
|
|
var in ListKnowledgeRequest
|
|
if err := ctx.BindQuery(&in); err != nil {
|
|
return err
|
|
}
|
|
http.SetOperation(ctx, OperationCustomerServiceListKnowledge)
|
|
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.ListKnowledge(ctx, req.(*ListKnowledgeRequest))
|
|
})
|
|
out, err := h(ctx, &in)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
reply := out.(*ListKnowledgeResponse)
|
|
return ctx.Result(200, reply)
|
|
}
|
|
}
|
|
|
|
func _CustomerService_DeleteKnowledge0_HTTP_Handler(srv CustomerServiceHTTPServer) func(ctx http.Context) error {
|
|
return func(ctx http.Context) error {
|
|
var in DeleteKnowledgeRequest
|
|
if err := ctx.BindQuery(&in); err != nil {
|
|
return err
|
|
}
|
|
if err := ctx.BindVars(&in); err != nil {
|
|
return err
|
|
}
|
|
http.SetOperation(ctx, OperationCustomerServiceDeleteKnowledge)
|
|
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.DeleteKnowledge(ctx, req.(*DeleteKnowledgeRequest))
|
|
})
|
|
out, err := h(ctx, &in)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
reply := out.(*DeleteKnowledgeResponse)
|
|
return ctx.Result(200, reply)
|
|
}
|
|
}
|
|
|
|
func _CustomerService_SearchKnowledge0_HTTP_Handler(srv CustomerServiceHTTPServer) func(ctx http.Context) error {
|
|
return func(ctx http.Context) error {
|
|
var in SearchKnowledgeRequest
|
|
if err := ctx.Bind(&in); err != nil {
|
|
return err
|
|
}
|
|
if err := ctx.BindQuery(&in); err != nil {
|
|
return err
|
|
}
|
|
http.SetOperation(ctx, OperationCustomerServiceSearchKnowledge)
|
|
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.SearchKnowledge(ctx, req.(*SearchKnowledgeRequest))
|
|
})
|
|
out, err := h(ctx, &in)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
reply := out.(*SearchKnowledgeResponse)
|
|
return ctx.Result(200, reply)
|
|
}
|
|
}
|
|
|
|
func _CustomerService_GetKnowledgeSummary0_HTTP_Handler(srv CustomerServiceHTTPServer) func(ctx http.Context) error {
|
|
return func(ctx http.Context) error {
|
|
var in GetKnowledgeSummaryRequest
|
|
if err := ctx.Bind(&in); err != nil {
|
|
return err
|
|
}
|
|
if err := ctx.BindQuery(&in); err != nil {
|
|
return err
|
|
}
|
|
http.SetOperation(ctx, OperationCustomerServiceGetKnowledgeSummary)
|
|
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.GetKnowledgeSummary(ctx, req.(*GetKnowledgeSummaryRequest))
|
|
})
|
|
out, err := h(ctx, &in)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
reply := out.(*GetKnowledgeSummaryResponse)
|
|
return ctx.Result(200, reply)
|
|
}
|
|
}
|
|
|
|
func _CustomerService_QueryOrder0_HTTP_Handler(srv CustomerServiceHTTPServer) func(ctx http.Context) error {
|
|
return func(ctx http.Context) error {
|
|
var in QueryOrderRequest
|
|
if err := ctx.Bind(&in); err != nil {
|
|
return err
|
|
}
|
|
if err := ctx.BindQuery(&in); err != nil {
|
|
return err
|
|
}
|
|
http.SetOperation(ctx, OperationCustomerServiceQueryOrder)
|
|
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.QueryOrder(ctx, req.(*QueryOrderRequest))
|
|
})
|
|
out, err := h(ctx, &in)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
reply := out.(*QueryOrderResponse)
|
|
return ctx.Result(200, reply)
|
|
}
|
|
}
|
|
|
|
type CustomerServiceHTTPClient interface {
|
|
// Chat 聊天消息处理接口
|
|
Chat(ctx context.Context, req *ChatRequest, opts ...http.CallOption) (rsp *ChatResponse, err error)
|
|
// CreateSession 创建新会话接口
|
|
CreateSession(ctx context.Context, req *CreateSessionRequest, opts ...http.CallOption) (rsp *CreateSessionResponse, err error)
|
|
// DeleteKnowledge 删除知识库文档接口
|
|
DeleteKnowledge(ctx context.Context, req *DeleteKnowledgeRequest, opts ...http.CallOption) (rsp *DeleteKnowledgeResponse, err error)
|
|
// GetKnowledgeSummary 获取知识库摘要接口
|
|
GetKnowledgeSummary(ctx context.Context, req *GetKnowledgeSummaryRequest, opts ...http.CallOption) (rsp *GetKnowledgeSummaryResponse, err error)
|
|
// GetSessions 获取会话列表接口
|
|
GetSessions(ctx context.Context, req *GetSessionsRequest, opts ...http.CallOption) (rsp *GetSessionsResponse, err error)
|
|
// ListKnowledge 获取知识库文档列表接口
|
|
ListKnowledge(ctx context.Context, req *ListKnowledgeRequest, opts ...http.CallOption) (rsp *ListKnowledgeResponse, err error)
|
|
// QueryOrder 订单查询接口
|
|
QueryOrder(ctx context.Context, req *QueryOrderRequest, opts ...http.CallOption) (rsp *QueryOrderResponse, err error)
|
|
// SearchKnowledge 搜索知识库接口
|
|
SearchKnowledge(ctx context.Context, req *SearchKnowledgeRequest, opts ...http.CallOption) (rsp *SearchKnowledgeResponse, err error)
|
|
// SystemStatus 健康检查接口
|
|
SystemStatus(ctx context.Context, req *SystemStatusRequest, opts ...http.CallOption) (rsp *SystemStatusResponse, err error)
|
|
// UploadKnowledge 知识库文档上传接口
|
|
UploadKnowledge(ctx context.Context, req *UploadKnowledgeRequest, opts ...http.CallOption) (rsp *UploadKnowledgeResponse, err error)
|
|
}
|
|
|
|
type CustomerServiceHTTPClientImpl struct {
|
|
cc *http.Client
|
|
}
|
|
|
|
func NewCustomerServiceHTTPClient(client *http.Client) CustomerServiceHTTPClient {
|
|
return &CustomerServiceHTTPClientImpl{client}
|
|
}
|
|
|
|
// Chat 聊天消息处理接口
|
|
func (c *CustomerServiceHTTPClientImpl) Chat(ctx context.Context, in *ChatRequest, opts ...http.CallOption) (*ChatResponse, error) {
|
|
var out ChatResponse
|
|
pattern := "/api/chat"
|
|
path := binding.EncodeURL(pattern, in, false)
|
|
opts = append(opts, http.Operation(OperationCustomerServiceChat))
|
|
opts = append(opts, http.PathTemplate(pattern))
|
|
err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &out, nil
|
|
}
|
|
|
|
// CreateSession 创建新会话接口
|
|
func (c *CustomerServiceHTTPClientImpl) CreateSession(ctx context.Context, in *CreateSessionRequest, opts ...http.CallOption) (*CreateSessionResponse, error) {
|
|
var out CreateSessionResponse
|
|
pattern := "/api/sessions"
|
|
path := binding.EncodeURL(pattern, in, false)
|
|
opts = append(opts, http.Operation(OperationCustomerServiceCreateSession))
|
|
opts = append(opts, http.PathTemplate(pattern))
|
|
err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &out, nil
|
|
}
|
|
|
|
// DeleteKnowledge 删除知识库文档接口
|
|
func (c *CustomerServiceHTTPClientImpl) DeleteKnowledge(ctx context.Context, in *DeleteKnowledgeRequest, opts ...http.CallOption) (*DeleteKnowledgeResponse, error) {
|
|
var out DeleteKnowledgeResponse
|
|
pattern := "/api/knowledge/{id}"
|
|
path := binding.EncodeURL(pattern, in, true)
|
|
opts = append(opts, http.Operation(OperationCustomerServiceDeleteKnowledge))
|
|
opts = append(opts, http.PathTemplate(pattern))
|
|
err := c.cc.Invoke(ctx, "DELETE", path, nil, &out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &out, nil
|
|
}
|
|
|
|
// GetKnowledgeSummary 获取知识库摘要接口
|
|
func (c *CustomerServiceHTTPClientImpl) GetKnowledgeSummary(ctx context.Context, in *GetKnowledgeSummaryRequest, opts ...http.CallOption) (*GetKnowledgeSummaryResponse, error) {
|
|
var out GetKnowledgeSummaryResponse
|
|
pattern := "/api/knowledge/summary"
|
|
path := binding.EncodeURL(pattern, in, false)
|
|
opts = append(opts, http.Operation(OperationCustomerServiceGetKnowledgeSummary))
|
|
opts = append(opts, http.PathTemplate(pattern))
|
|
err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &out, nil
|
|
}
|
|
|
|
// GetSessions 获取会话列表接口
|
|
func (c *CustomerServiceHTTPClientImpl) GetSessions(ctx context.Context, in *GetSessionsRequest, opts ...http.CallOption) (*GetSessionsResponse, error) {
|
|
var out GetSessionsResponse
|
|
pattern := "/api/sessions"
|
|
path := binding.EncodeURL(pattern, in, true)
|
|
opts = append(opts, http.Operation(OperationCustomerServiceGetSessions))
|
|
opts = append(opts, http.PathTemplate(pattern))
|
|
err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &out, nil
|
|
}
|
|
|
|
// ListKnowledge 获取知识库文档列表接口
|
|
func (c *CustomerServiceHTTPClientImpl) ListKnowledge(ctx context.Context, in *ListKnowledgeRequest, opts ...http.CallOption) (*ListKnowledgeResponse, error) {
|
|
var out ListKnowledgeResponse
|
|
pattern := "/api/knowledge/list"
|
|
path := binding.EncodeURL(pattern, in, true)
|
|
opts = append(opts, http.Operation(OperationCustomerServiceListKnowledge))
|
|
opts = append(opts, http.PathTemplate(pattern))
|
|
err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &out, nil
|
|
}
|
|
|
|
// QueryOrder 订单查询接口
|
|
func (c *CustomerServiceHTTPClientImpl) QueryOrder(ctx context.Context, in *QueryOrderRequest, opts ...http.CallOption) (*QueryOrderResponse, error) {
|
|
var out QueryOrderResponse
|
|
pattern := "/api/order/query"
|
|
path := binding.EncodeURL(pattern, in, false)
|
|
opts = append(opts, http.Operation(OperationCustomerServiceQueryOrder))
|
|
opts = append(opts, http.PathTemplate(pattern))
|
|
err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &out, nil
|
|
}
|
|
|
|
// SearchKnowledge 搜索知识库接口
|
|
func (c *CustomerServiceHTTPClientImpl) SearchKnowledge(ctx context.Context, in *SearchKnowledgeRequest, opts ...http.CallOption) (*SearchKnowledgeResponse, error) {
|
|
var out SearchKnowledgeResponse
|
|
pattern := "/api/knowledge/search"
|
|
path := binding.EncodeURL(pattern, in, false)
|
|
opts = append(opts, http.Operation(OperationCustomerServiceSearchKnowledge))
|
|
opts = append(opts, http.PathTemplate(pattern))
|
|
err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &out, nil
|
|
}
|
|
|
|
// SystemStatus 健康检查接口
|
|
func (c *CustomerServiceHTTPClientImpl) SystemStatus(ctx context.Context, in *SystemStatusRequest, opts ...http.CallOption) (*SystemStatusResponse, error) {
|
|
var out SystemStatusResponse
|
|
pattern := "/api/system/status"
|
|
path := binding.EncodeURL(pattern, in, true)
|
|
opts = append(opts, http.Operation(OperationCustomerServiceSystemStatus))
|
|
opts = append(opts, http.PathTemplate(pattern))
|
|
err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &out, nil
|
|
}
|
|
|
|
// UploadKnowledge 知识库文档上传接口
|
|
func (c *CustomerServiceHTTPClientImpl) UploadKnowledge(ctx context.Context, in *UploadKnowledgeRequest, opts ...http.CallOption) (*UploadKnowledgeResponse, error) {
|
|
var out UploadKnowledgeResponse
|
|
pattern := "/api/knowledge/upload"
|
|
path := binding.EncodeURL(pattern, in, false)
|
|
opts = append(opts, http.Operation(OperationCustomerServiceUploadKnowledge))
|
|
opts = append(opts, http.PathTemplate(pattern))
|
|
err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &out, nil
|
|
}
|