// Code generated by protoc-gen-go-http. DO NOT EDIT.
// versions:
// - protoc-gen-go-http v2.6.3
// - protoc             v4.23.4
// source: interface/dex/assets.proto

package dex

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 OperationAssetsGetUserAccountsAssets = "/api.interface.dex.Assets/GetUserAccountsAssets"

type AssetsHTTPServer interface {
	GetUserAccountsAssets(context.Context, *GetUserAccountsAssetsRequest) (*GetUserAccountsAssetsReply, error)
}

func RegisterAssetsHTTPServer(s *http.Server, srv AssetsHTTPServer) {
	r := s.Route("/")
	r.GET("/api/gateway/interface/dex/assets/user_coin", _Assets_GetUserAccountsAssets0_HTTP_Handler(srv))
}

func _Assets_GetUserAccountsAssets0_HTTP_Handler(srv AssetsHTTPServer) func(ctx http.Context) error {
	return func(ctx http.Context) error {
		var in GetUserAccountsAssetsRequest
		if err := ctx.BindQuery(&in); err != nil {
			return err
		}
		http.SetOperation(ctx, OperationAssetsGetUserAccountsAssets)
		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
			return srv.GetUserAccountsAssets(ctx, req.(*GetUserAccountsAssetsRequest))
		})
		out, err := h(ctx, &in)
		if err != nil {
			return err
		}
		reply := out.(*GetUserAccountsAssetsReply)
		return ctx.Result(200, reply)
	}
}

type AssetsHTTPClient interface {
	GetUserAccountsAssets(ctx context.Context, req *GetUserAccountsAssetsRequest, opts ...http.CallOption) (rsp *GetUserAccountsAssetsReply, err error)
}

type AssetsHTTPClientImpl struct {
	cc *http.Client
}

func NewAssetsHTTPClient(client *http.Client) AssetsHTTPClient {
	return &AssetsHTTPClientImpl{client}
}

func (c *AssetsHTTPClientImpl) GetUserAccountsAssets(ctx context.Context, in *GetUserAccountsAssetsRequest, opts ...http.CallOption) (*GetUserAccountsAssetsReply, error) {
	var out GetUserAccountsAssetsReply
	pattern := "/api/gateway/interface/dex/assets/user_coin"
	path := binding.EncodeURL(pattern, in, true)
	opts = append(opts, http.Operation(OperationAssetsGetUserAccountsAssets))
	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
}
