// Code generated by protoc-gen-go-http. DO NOT EDIT.
// versions:
// - protoc-gen-go-http v2.8.0
// - protoc             v3.12.4
// source: svapi/video.proto

package svapi

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 OperationShortVideoCoreVideoServiceFeedShortVideo = "/svapi.ShortVideoCoreVideoService/FeedShortVideo"
const OperationShortVideoCoreVideoServiceGetVideoById = "/svapi.ShortVideoCoreVideoService/GetVideoById"
const OperationShortVideoCoreVideoServiceListPublishedVideo = "/svapi.ShortVideoCoreVideoService/ListPublishedVideo"
const OperationShortVideoCoreVideoServicePreSign4UploadCover = "/svapi.ShortVideoCoreVideoService/PreSign4UploadCover"
const OperationShortVideoCoreVideoServicePreSign4UploadVideo = "/svapi.ShortVideoCoreVideoService/PreSign4UploadVideo"
const OperationShortVideoCoreVideoServiceReportFinishUpload = "/svapi.ShortVideoCoreVideoService/ReportFinishUpload"
const OperationShortVideoCoreVideoServiceReportVideoFinishUpload = "/svapi.ShortVideoCoreVideoService/ReportVideoFinishUpload"

type ShortVideoCoreVideoServiceHTTPServer interface {
	// FeedShortVideo 刷视频
	FeedShortVideo(context.Context, *FeedShortVideoRequest) (*FeedShortVideoResponse, error)
	// GetVideoById 获取视频信息
	GetVideoById(context.Context, *GetVideoByIdRequest) (*GetVideoByIdResponse, error)
	// ListPublishedVideo 获取当前用户的发布视频列表
	ListPublishedVideo(context.Context, *ListPublishedVideoRequest) (*ListPublishedVideoResponse, error)
	// PreSign4UploadCover 预注册上传封面
	PreSign4UploadCover(context.Context, *PreSign4UploadRequest) (*PreSign4UploadResponse, error)
	// PreSign4UploadVideo 预注册上传视频
	PreSign4UploadVideo(context.Context, *PreSign4UploadVideoRequest) (*PreSign4UploadVideoResponse, error)
	// ReportFinishUpload 通用确认上传完成
	ReportFinishUpload(context.Context, *ReportFinishUploadRequest) (*ReportFinishUploadResponse, error)
	// ReportVideoFinishUpload 确认视频上传完成
	ReportVideoFinishUpload(context.Context, *ReportVideoFinishUploadRequest) (*ReportVideoFinishUploadResponse, error)
}

func RegisterShortVideoCoreVideoServiceHTTPServer(s *http.Server, srv ShortVideoCoreVideoServiceHTTPServer) {
	r := s.Route("/")
	r.POST("/video/upload", _ShortVideoCoreVideoService_PreSign4UploadVideo0_HTTP_Handler(srv))
	r.POST("/cover/upload", _ShortVideoCoreVideoService_PreSign4UploadCover0_HTTP_Handler(srv))
	r.POST("/file/{file_id}/finish", _ShortVideoCoreVideoService_ReportFinishUpload0_HTTP_Handler(srv))
	r.POST("/video/finish", _ShortVideoCoreVideoService_ReportVideoFinishUpload0_HTTP_Handler(srv))
	r.POST("/video/feed", _ShortVideoCoreVideoService_FeedShortVideo0_HTTP_Handler(srv))
	r.GET("/video/{video_id}", _ShortVideoCoreVideoService_GetVideoById0_HTTP_Handler(srv))
	r.POST("/video/list", _ShortVideoCoreVideoService_ListPublishedVideo0_HTTP_Handler(srv))
}

func _ShortVideoCoreVideoService_PreSign4UploadVideo0_HTTP_Handler(srv ShortVideoCoreVideoServiceHTTPServer) func(ctx http.Context) error {
	return func(ctx http.Context) error {
		var in PreSign4UploadVideoRequest
		if err := ctx.Bind(&in); err != nil {
			return err
		}
		if err := ctx.BindQuery(&in); err != nil {
			return err
		}
		http.SetOperation(ctx, OperationShortVideoCoreVideoServicePreSign4UploadVideo)
		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
			return srv.PreSign4UploadVideo(ctx, req.(*PreSign4UploadVideoRequest))
		})
		out, err := h(ctx, &in)
		if err != nil {
			return err
		}
		return ctx.Result(200, out)
	}
}

func _ShortVideoCoreVideoService_PreSign4UploadCover0_HTTP_Handler(srv ShortVideoCoreVideoServiceHTTPServer) func(ctx http.Context) error {
	return func(ctx http.Context) error {
		var in PreSign4UploadRequest
		if err := ctx.Bind(&in); err != nil {
			return err
		}
		if err := ctx.BindQuery(&in); err != nil {
			return err
		}
		http.SetOperation(ctx, OperationShortVideoCoreVideoServicePreSign4UploadCover)
		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
			return srv.PreSign4UploadCover(ctx, req.(*PreSign4UploadRequest))
		})
		out, err := h(ctx, &in)
		if err != nil {
			return err
		}
		return ctx.Result(200, out)
	}
}

func _ShortVideoCoreVideoService_ReportFinishUpload0_HTTP_Handler(srv ShortVideoCoreVideoServiceHTTPServer) func(ctx http.Context) error {
	return func(ctx http.Context) error {
		var in ReportFinishUploadRequest
		if err := ctx.Bind(&in); err != nil {
			return err
		}
		if err := ctx.BindQuery(&in); err != nil {
			return err
		}
		if err := ctx.BindVars(&in); err != nil {
			return err
		}
		http.SetOperation(ctx, OperationShortVideoCoreVideoServiceReportFinishUpload)
		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
			return srv.ReportFinishUpload(ctx, req.(*ReportFinishUploadRequest))
		})
		out, err := h(ctx, &in)
		if err != nil {
			return err
		}
		return ctx.Result(200, out)
	}
}

func _ShortVideoCoreVideoService_ReportVideoFinishUpload0_HTTP_Handler(srv ShortVideoCoreVideoServiceHTTPServer) func(ctx http.Context) error {
	return func(ctx http.Context) error {
		var in ReportVideoFinishUploadRequest
		if err := ctx.Bind(&in); err != nil {
			return err
		}
		if err := ctx.BindQuery(&in); err != nil {
			return err
		}
		http.SetOperation(ctx, OperationShortVideoCoreVideoServiceReportVideoFinishUpload)
		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
			return srv.ReportVideoFinishUpload(ctx, req.(*ReportVideoFinishUploadRequest))
		})
		out, err := h(ctx, &in)
		if err != nil {
			return err
		}
		return ctx.Result(200, out)
	}
}

func _ShortVideoCoreVideoService_FeedShortVideo0_HTTP_Handler(srv ShortVideoCoreVideoServiceHTTPServer) func(ctx http.Context) error {
	return func(ctx http.Context) error {
		var in FeedShortVideoRequest
		if err := ctx.Bind(&in); err != nil {
			return err
		}
		if err := ctx.BindQuery(&in); err != nil {
			return err
		}
		http.SetOperation(ctx, OperationShortVideoCoreVideoServiceFeedShortVideo)
		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
			return srv.FeedShortVideo(ctx, req.(*FeedShortVideoRequest))
		})
		out, err := h(ctx, &in)
		if err != nil {
			return err
		}
		return ctx.Result(200, out)
	}
}

func _ShortVideoCoreVideoService_GetVideoById0_HTTP_Handler(srv ShortVideoCoreVideoServiceHTTPServer) func(ctx http.Context) error {
	return func(ctx http.Context) error {
		var in GetVideoByIdRequest
		if err := ctx.BindQuery(&in); err != nil {
			return err
		}
		if err := ctx.BindVars(&in); err != nil {
			return err
		}
		http.SetOperation(ctx, OperationShortVideoCoreVideoServiceGetVideoById)
		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
			return srv.GetVideoById(ctx, req.(*GetVideoByIdRequest))
		})
		out, err := h(ctx, &in)
		if err != nil {
			return err
		}
		return ctx.Result(200, out)
	}
}

func _ShortVideoCoreVideoService_ListPublishedVideo0_HTTP_Handler(srv ShortVideoCoreVideoServiceHTTPServer) func(ctx http.Context) error {
	return func(ctx http.Context) error {
		var in ListPublishedVideoRequest
		if err := ctx.Bind(&in); err != nil {
			return err
		}
		if err := ctx.BindQuery(&in); err != nil {
			return err
		}
		http.SetOperation(ctx, OperationShortVideoCoreVideoServiceListPublishedVideo)
		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
			return srv.ListPublishedVideo(ctx, req.(*ListPublishedVideoRequest))
		})
		out, err := h(ctx, &in)
		if err != nil {
			return err
		}
		return ctx.Result(200, out)
	}
}

type ShortVideoCoreVideoServiceHTTPClient interface {
	FeedShortVideo(ctx context.Context, req *FeedShortVideoRequest, opts ...http.CallOption) (rsp *FeedShortVideoResponse, err error)
	GetVideoById(ctx context.Context, req *GetVideoByIdRequest, opts ...http.CallOption) (rsp *GetVideoByIdResponse, err error)
	ListPublishedVideo(ctx context.Context, req *ListPublishedVideoRequest, opts ...http.CallOption) (rsp *ListPublishedVideoResponse, err error)
	PreSign4UploadCover(ctx context.Context, req *PreSign4UploadRequest, opts ...http.CallOption) (rsp *PreSign4UploadResponse, err error)
	PreSign4UploadVideo(ctx context.Context, req *PreSign4UploadVideoRequest, opts ...http.CallOption) (rsp *PreSign4UploadVideoResponse, err error)
	ReportFinishUpload(ctx context.Context, req *ReportFinishUploadRequest, opts ...http.CallOption) (rsp *ReportFinishUploadResponse, err error)
	ReportVideoFinishUpload(ctx context.Context, req *ReportVideoFinishUploadRequest, opts ...http.CallOption) (rsp *ReportVideoFinishUploadResponse, err error)
}

type ShortVideoCoreVideoServiceHTTPClientImpl struct {
	cc *http.Client
}

func NewShortVideoCoreVideoServiceHTTPClient(client *http.Client) ShortVideoCoreVideoServiceHTTPClient {
	return &ShortVideoCoreVideoServiceHTTPClientImpl{client}
}

func (c *ShortVideoCoreVideoServiceHTTPClientImpl) FeedShortVideo(ctx context.Context, in *FeedShortVideoRequest, opts ...http.CallOption) (*FeedShortVideoResponse, error) {
	var out FeedShortVideoResponse
	pattern := "/video/feed"
	path := binding.EncodeURL(pattern, in, false)
	opts = append(opts, http.Operation(OperationShortVideoCoreVideoServiceFeedShortVideo))
	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
}

func (c *ShortVideoCoreVideoServiceHTTPClientImpl) GetVideoById(ctx context.Context, in *GetVideoByIdRequest, opts ...http.CallOption) (*GetVideoByIdResponse, error) {
	var out GetVideoByIdResponse
	pattern := "/video/{video_id}"
	path := binding.EncodeURL(pattern, in, true)
	opts = append(opts, http.Operation(OperationShortVideoCoreVideoServiceGetVideoById))
	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
}

func (c *ShortVideoCoreVideoServiceHTTPClientImpl) ListPublishedVideo(ctx context.Context, in *ListPublishedVideoRequest, opts ...http.CallOption) (*ListPublishedVideoResponse, error) {
	var out ListPublishedVideoResponse
	pattern := "/video/list"
	path := binding.EncodeURL(pattern, in, false)
	opts = append(opts, http.Operation(OperationShortVideoCoreVideoServiceListPublishedVideo))
	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
}

func (c *ShortVideoCoreVideoServiceHTTPClientImpl) PreSign4UploadCover(ctx context.Context, in *PreSign4UploadRequest, opts ...http.CallOption) (*PreSign4UploadResponse, error) {
	var out PreSign4UploadResponse
	pattern := "/cover/upload"
	path := binding.EncodeURL(pattern, in, false)
	opts = append(opts, http.Operation(OperationShortVideoCoreVideoServicePreSign4UploadCover))
	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
}

func (c *ShortVideoCoreVideoServiceHTTPClientImpl) PreSign4UploadVideo(ctx context.Context, in *PreSign4UploadVideoRequest, opts ...http.CallOption) (*PreSign4UploadVideoResponse, error) {
	var out PreSign4UploadVideoResponse
	pattern := "/video/upload"
	path := binding.EncodeURL(pattern, in, false)
	opts = append(opts, http.Operation(OperationShortVideoCoreVideoServicePreSign4UploadVideo))
	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
}

func (c *ShortVideoCoreVideoServiceHTTPClientImpl) ReportFinishUpload(ctx context.Context, in *ReportFinishUploadRequest, opts ...http.CallOption) (*ReportFinishUploadResponse, error) {
	var out ReportFinishUploadResponse
	pattern := "/file/{file_id}/finish"
	path := binding.EncodeURL(pattern, in, false)
	opts = append(opts, http.Operation(OperationShortVideoCoreVideoServiceReportFinishUpload))
	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
}

func (c *ShortVideoCoreVideoServiceHTTPClientImpl) ReportVideoFinishUpload(ctx context.Context, in *ReportVideoFinishUploadRequest, opts ...http.CallOption) (*ReportVideoFinishUploadResponse, error) {
	var out ReportVideoFinishUploadResponse
	pattern := "/video/finish"
	path := binding.EncodeURL(pattern, in, false)
	opts = append(opts, http.Operation(OperationShortVideoCoreVideoServiceReportVideoFinishUpload))
	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
}
