// Code generated by Kitex v0.4.4. DO NOT EDIT.

package feedservice

import (
	rpc "common/kitex_gen/douyin/rpc"
	"context"
	client "github.com/cloudwego/kitex/client"
	kitex "github.com/cloudwego/kitex/pkg/serviceinfo"
)

func serviceInfo() *kitex.ServiceInfo {
	return feedServiceServiceInfo
}

var feedServiceServiceInfo = NewServiceInfo()

func NewServiceInfo() *kitex.ServiceInfo {
	serviceName := "FeedService"
	handlerType := (*rpc.FeedService)(nil)
	methods := map[string]kitex.MethodInfo{
		"Feed":      kitex.NewMethodInfo(feedHandler, newFeedServiceFeedArgs, newFeedServiceFeedResult, false),
		"Publish":   kitex.NewMethodInfo(publishHandler, newFeedServicePublishArgs, newFeedServicePublishResult, false),
		"List":      kitex.NewMethodInfo(listHandler, newFeedServiceListArgs, newFeedServiceListResult, false),
		"Relation":  kitex.NewMethodInfo(relationHandler, newFeedServiceRelationArgs, newFeedServiceRelationResult, false),
		"Following": kitex.NewMethodInfo(followingHandler, newFeedServiceFollowingArgs, newFeedServiceFollowingResult, false),
		"Follower":  kitex.NewMethodInfo(followerHandler, newFeedServiceFollowerArgs, newFeedServiceFollowerResult, false),
		"Friend":    kitex.NewMethodInfo(friendHandler, newFeedServiceFriendArgs, newFeedServiceFriendResult, false),
		"VideoInfo": kitex.NewMethodInfo(videoInfoHandler, newFeedServiceVideoInfoArgs, newFeedServiceVideoInfoResult, false),
		"IsFriend":  kitex.NewMethodInfo(isFriendHandler, newFeedServiceIsFriendArgs, newFeedServiceIsFriendResult, false),
	}
	extra := map[string]interface{}{
		"PackageName": "rpc",
	}
	svcInfo := &kitex.ServiceInfo{
		ServiceName:     serviceName,
		HandlerType:     handlerType,
		Methods:         methods,
		PayloadCodec:    kitex.Thrift,
		KiteXGenVersion: "v0.4.4",
		Extra:           extra,
	}
	return svcInfo
}

func feedHandler(ctx context.Context, handler interface{}, arg, result interface{}) error {
	realArg := arg.(*rpc.FeedServiceFeedArgs)
	realResult := result.(*rpc.FeedServiceFeedResult)
	success, err := handler.(rpc.FeedService).Feed(ctx, realArg.Req)
	if err != nil {
		return err
	}
	realResult.Success = success
	return nil
}
func newFeedServiceFeedArgs() interface{} {
	return rpc.NewFeedServiceFeedArgs()
}

func newFeedServiceFeedResult() interface{} {
	return rpc.NewFeedServiceFeedResult()
}

func publishHandler(ctx context.Context, handler interface{}, arg, result interface{}) error {
	realArg := arg.(*rpc.FeedServicePublishArgs)
	realResult := result.(*rpc.FeedServicePublishResult)
	success, err := handler.(rpc.FeedService).Publish(ctx, realArg.Req)
	if err != nil {
		return err
	}
	realResult.Success = success
	return nil
}
func newFeedServicePublishArgs() interface{} {
	return rpc.NewFeedServicePublishArgs()
}

func newFeedServicePublishResult() interface{} {
	return rpc.NewFeedServicePublishResult()
}

func listHandler(ctx context.Context, handler interface{}, arg, result interface{}) error {
	realArg := arg.(*rpc.FeedServiceListArgs)
	realResult := result.(*rpc.FeedServiceListResult)
	success, err := handler.(rpc.FeedService).List(ctx, realArg.Req)
	if err != nil {
		return err
	}
	realResult.Success = success
	return nil
}
func newFeedServiceListArgs() interface{} {
	return rpc.NewFeedServiceListArgs()
}

func newFeedServiceListResult() interface{} {
	return rpc.NewFeedServiceListResult()
}

func relationHandler(ctx context.Context, handler interface{}, arg, result interface{}) error {
	realArg := arg.(*rpc.FeedServiceRelationArgs)
	realResult := result.(*rpc.FeedServiceRelationResult)
	success, err := handler.(rpc.FeedService).Relation(ctx, realArg.Req)
	if err != nil {
		return err
	}
	realResult.Success = success
	return nil
}
func newFeedServiceRelationArgs() interface{} {
	return rpc.NewFeedServiceRelationArgs()
}

func newFeedServiceRelationResult() interface{} {
	return rpc.NewFeedServiceRelationResult()
}

func followingHandler(ctx context.Context, handler interface{}, arg, result interface{}) error {
	realArg := arg.(*rpc.FeedServiceFollowingArgs)
	realResult := result.(*rpc.FeedServiceFollowingResult)
	success, err := handler.(rpc.FeedService).Following(ctx, realArg.Req)
	if err != nil {
		return err
	}
	realResult.Success = success
	return nil
}
func newFeedServiceFollowingArgs() interface{} {
	return rpc.NewFeedServiceFollowingArgs()
}

func newFeedServiceFollowingResult() interface{} {
	return rpc.NewFeedServiceFollowingResult()
}

func followerHandler(ctx context.Context, handler interface{}, arg, result interface{}) error {
	realArg := arg.(*rpc.FeedServiceFollowerArgs)
	realResult := result.(*rpc.FeedServiceFollowerResult)
	success, err := handler.(rpc.FeedService).Follower(ctx, realArg.Req)
	if err != nil {
		return err
	}
	realResult.Success = success
	return nil
}
func newFeedServiceFollowerArgs() interface{} {
	return rpc.NewFeedServiceFollowerArgs()
}

func newFeedServiceFollowerResult() interface{} {
	return rpc.NewFeedServiceFollowerResult()
}

func friendHandler(ctx context.Context, handler interface{}, arg, result interface{}) error {
	realArg := arg.(*rpc.FeedServiceFriendArgs)
	realResult := result.(*rpc.FeedServiceFriendResult)
	success, err := handler.(rpc.FeedService).Friend(ctx, realArg.Req)
	if err != nil {
		return err
	}
	realResult.Success = success
	return nil
}
func newFeedServiceFriendArgs() interface{} {
	return rpc.NewFeedServiceFriendArgs()
}

func newFeedServiceFriendResult() interface{} {
	return rpc.NewFeedServiceFriendResult()
}

func videoInfoHandler(ctx context.Context, handler interface{}, arg, result interface{}) error {
	realArg := arg.(*rpc.FeedServiceVideoInfoArgs)
	realResult := result.(*rpc.FeedServiceVideoInfoResult)
	success, err := handler.(rpc.FeedService).VideoInfo(ctx, realArg.Req)
	if err != nil {
		return err
	}
	realResult.Success = success
	return nil
}
func newFeedServiceVideoInfoArgs() interface{} {
	return rpc.NewFeedServiceVideoInfoArgs()
}

func newFeedServiceVideoInfoResult() interface{} {
	return rpc.NewFeedServiceVideoInfoResult()
}

func isFriendHandler(ctx context.Context, handler interface{}, arg, result interface{}) error {
	realArg := arg.(*rpc.FeedServiceIsFriendArgs)
	realResult := result.(*rpc.FeedServiceIsFriendResult)
	success, err := handler.(rpc.FeedService).IsFriend(ctx, realArg.Req)
	if err != nil {
		return err
	}
	realResult.Success = success
	return nil
}
func newFeedServiceIsFriendArgs() interface{} {
	return rpc.NewFeedServiceIsFriendArgs()
}

func newFeedServiceIsFriendResult() interface{} {
	return rpc.NewFeedServiceIsFriendResult()
}

type kClient struct {
	c client.Client
}

func newServiceClient(c client.Client) *kClient {
	return &kClient{
		c: c,
	}
}

func (p *kClient) Feed(ctx context.Context, req *rpc.DouyinFeedRequest) (r *rpc.DouyinFeedResponse, err error) {
	var _args rpc.FeedServiceFeedArgs
	_args.Req = req
	var _result rpc.FeedServiceFeedResult
	if err = p.c.Call(ctx, "Feed", &_args, &_result); err != nil {
		return
	}
	return _result.GetSuccess(), nil
}

func (p *kClient) Publish(ctx context.Context, req *rpc.DouyinPublishActionRequest) (r *rpc.DouyinPublishActionResponse, err error) {
	var _args rpc.FeedServicePublishArgs
	_args.Req = req
	var _result rpc.FeedServicePublishResult
	if err = p.c.Call(ctx, "Publish", &_args, &_result); err != nil {
		return
	}
	return _result.GetSuccess(), nil
}

func (p *kClient) List(ctx context.Context, req *rpc.DouyinPublishListRequest) (r *rpc.DouyinPublishListResponse, err error) {
	var _args rpc.FeedServiceListArgs
	_args.Req = req
	var _result rpc.FeedServiceListResult
	if err = p.c.Call(ctx, "List", &_args, &_result); err != nil {
		return
	}
	return _result.GetSuccess(), nil
}

func (p *kClient) Relation(ctx context.Context, req *rpc.DouyinRelationActionRequest) (r *rpc.DouyinRelationActionResponse, err error) {
	var _args rpc.FeedServiceRelationArgs
	_args.Req = req
	var _result rpc.FeedServiceRelationResult
	if err = p.c.Call(ctx, "Relation", &_args, &_result); err != nil {
		return
	}
	return _result.GetSuccess(), nil
}

func (p *kClient) Following(ctx context.Context, req *rpc.DouyinRelationFollowListRequest) (r *rpc.DouyinRelationFollowListResponse, err error) {
	var _args rpc.FeedServiceFollowingArgs
	_args.Req = req
	var _result rpc.FeedServiceFollowingResult
	if err = p.c.Call(ctx, "Following", &_args, &_result); err != nil {
		return
	}
	return _result.GetSuccess(), nil
}

func (p *kClient) Follower(ctx context.Context, req *rpc.DouyinRelationFollowerListRequest) (r *rpc.DouyinRelationFollowerListResponse, err error) {
	var _args rpc.FeedServiceFollowerArgs
	_args.Req = req
	var _result rpc.FeedServiceFollowerResult
	if err = p.c.Call(ctx, "Follower", &_args, &_result); err != nil {
		return
	}
	return _result.GetSuccess(), nil
}

func (p *kClient) Friend(ctx context.Context, req *rpc.DouyinRelationFriendListRequest) (r *rpc.DouyinRelationFriendListResponse, err error) {
	var _args rpc.FeedServiceFriendArgs
	_args.Req = req
	var _result rpc.FeedServiceFriendResult
	if err = p.c.Call(ctx, "Friend", &_args, &_result); err != nil {
		return
	}
	return _result.GetSuccess(), nil
}

func (p *kClient) VideoInfo(ctx context.Context, req *rpc.VideoBatchInfoRequest) (r *rpc.VideoBatchInfoResponse, err error) {
	var _args rpc.FeedServiceVideoInfoArgs
	_args.Req = req
	var _result rpc.FeedServiceVideoInfoResult
	if err = p.c.Call(ctx, "VideoInfo", &_args, &_result); err != nil {
		return
	}
	return _result.GetSuccess(), nil
}

func (p *kClient) IsFriend(ctx context.Context, req *rpc.FriendCheckRequest) (r *rpc.FriendCheckResponse, err error) {
	var _args rpc.FeedServiceIsFriendArgs
	_args.Req = req
	var _result rpc.FeedServiceIsFriendResult
	if err = p.c.Call(ctx, "IsFriend", &_args, &_result); err != nil {
		return
	}
	return _result.GetSuccess(), nil
}
