// Code generated by protoc-gen-go-http. DO NOT EDIT.
// versions:
// - protoc-gen-go-http v2.8.0
// - protoc             v3.12.4
// source: v1/video.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 OperationVideoServiceFeedShortVideo = "/shortVideoCoreService.api.v1.VideoService/FeedShortVideo"
const OperationVideoServiceGetVideoById = "/shortVideoCoreService.api.v1.VideoService/GetVideoById"
const OperationVideoServiceListPublishedVideo = "/shortVideoCoreService.api.v1.VideoService/ListPublishedVideo"
const OperationVideoServicePublishVideo = "/shortVideoCoreService.api.v1.VideoService/PublishVideo"

type VideoServiceHTTPServer interface {
	FeedShortVideo(context.Context, *FeedShortVideoRequest) (*FeedShortVideoResponse, error)
	GetVideoById(context.Context, *GetVideoByIdRequest) (*GetVideoByIdResponse, error)
	ListPublishedVideo(context.Context, *ListPublishedVideoRequest) (*ListPublishedVideoResponse, error)
	PublishVideo(context.Context, *PublishVideoRequest) (*PublishVideoResponse, error)
}

func RegisterVideoServiceHTTPServer(s *http.Server, srv VideoServiceHTTPServer) {
	r := s.Route("/")
	r.POST("/v1/video/feed", _VideoService_FeedShortVideo0_HTTP_Handler(srv))
	r.GET("/v1/video/{video_id}", _VideoService_GetVideoById0_HTTP_Handler(srv))
	r.POST("/v1/video/publish", _VideoService_PublishVideo0_HTTP_Handler(srv))
	r.POST("/v1/video/list", _VideoService_ListPublishedVideo0_HTTP_Handler(srv))
}

func _VideoService_FeedShortVideo0_HTTP_Handler(srv VideoServiceHTTPServer) 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, OperationVideoServiceFeedShortVideo)
		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 _VideoService_GetVideoById0_HTTP_Handler(srv VideoServiceHTTPServer) 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, OperationVideoServiceGetVideoById)
		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 _VideoService_PublishVideo0_HTTP_Handler(srv VideoServiceHTTPServer) func(ctx http.Context) error {
	return func(ctx http.Context) error {
		var in PublishVideoRequest
		if err := ctx.Bind(&in); err != nil {
			return err
		}
		if err := ctx.BindQuery(&in); err != nil {
			return err
		}
		http.SetOperation(ctx, OperationVideoServicePublishVideo)
		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
			return srv.PublishVideo(ctx, req.(*PublishVideoRequest))
		})
		out, err := h(ctx, &in)
		if err != nil {
			return err
		}
		return ctx.Result(200, out)
	}
}

func _VideoService_ListPublishedVideo0_HTTP_Handler(srv VideoServiceHTTPServer) 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, OperationVideoServiceListPublishedVideo)
		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 VideoServiceHTTPClient 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)
	PublishVideo(ctx context.Context, req *PublishVideoRequest, opts ...http.CallOption) (rsp *PublishVideoResponse, err error)
}

type VideoServiceHTTPClientImpl struct {
	cc *http.Client
}

func NewVideoServiceHTTPClient(client *http.Client) VideoServiceHTTPClient {
	return &VideoServiceHTTPClientImpl{client}
}

func (c *VideoServiceHTTPClientImpl) FeedShortVideo(ctx context.Context, in *FeedShortVideoRequest, opts ...http.CallOption) (*FeedShortVideoResponse, error) {
	var out FeedShortVideoResponse
	pattern := "/v1/video/feed"
	path := binding.EncodeURL(pattern, in, false)
	opts = append(opts, http.Operation(OperationVideoServiceFeedShortVideo))
	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 *VideoServiceHTTPClientImpl) GetVideoById(ctx context.Context, in *GetVideoByIdRequest, opts ...http.CallOption) (*GetVideoByIdResponse, error) {
	var out GetVideoByIdResponse
	pattern := "/v1/video/{video_id}"
	path := binding.EncodeURL(pattern, in, true)
	opts = append(opts, http.Operation(OperationVideoServiceGetVideoById))
	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 *VideoServiceHTTPClientImpl) ListPublishedVideo(ctx context.Context, in *ListPublishedVideoRequest, opts ...http.CallOption) (*ListPublishedVideoResponse, error) {
	var out ListPublishedVideoResponse
	pattern := "/v1/video/list"
	path := binding.EncodeURL(pattern, in, false)
	opts = append(opts, http.Operation(OperationVideoServiceListPublishedVideo))
	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 *VideoServiceHTTPClientImpl) PublishVideo(ctx context.Context, in *PublishVideoRequest, opts ...http.CallOption) (*PublishVideoResponse, error) {
	var out PublishVideoResponse
	pattern := "/v1/video/publish"
	path := binding.EncodeURL(pattern, in, false)
	opts = append(opts, http.Operation(OperationVideoServicePublishVideo))
	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
}
