//go:build wasip1

// Code generated by protoc-gen-go-plugin. DO NOT EDIT.
// versions:
// 	protoc-gen-go-plugin v0.1.0
// 	protoc               v5.29.3
// source: host/http/http.proto

package http

import (
	context "context"
	wasm "github.com/knqyf263/go-plugin/wasm"
	_ "unsafe"
)

type httpService struct{}

func NewHttpService() HttpService {
	return httpService{}
}

//go:wasmimport env get
func _get(ptr uint32, size uint32) uint64

func (h httpService) Get(ctx context.Context, request *HttpRequest) (*HttpResponse, error) {
	buf, err := request.MarshalVT()
	if err != nil {
		return nil, err
	}
	ptr, size := wasm.ByteToPtr(buf)
	ptrSize := _get(ptr, size)
	wasm.Free(ptr)

	ptr = uint32(ptrSize >> 32)
	size = uint32(ptrSize)
	buf = wasm.PtrToByte(ptr, size)

	response := new(HttpResponse)
	if err = response.UnmarshalVT(buf); err != nil {
		return nil, err
	}
	return response, nil
}

//go:wasmimport env post
func _post(ptr uint32, size uint32) uint64

func (h httpService) Post(ctx context.Context, request *HttpRequest) (*HttpResponse, error) {
	buf, err := request.MarshalVT()
	if err != nil {
		return nil, err
	}
	ptr, size := wasm.ByteToPtr(buf)
	ptrSize := _post(ptr, size)
	wasm.Free(ptr)

	ptr = uint32(ptrSize >> 32)
	size = uint32(ptrSize)
	buf = wasm.PtrToByte(ptr, size)

	response := new(HttpResponse)
	if err = response.UnmarshalVT(buf); err != nil {
		return nil, err
	}
	return response, nil
}

//go:wasmimport env put
func _put(ptr uint32, size uint32) uint64

func (h httpService) Put(ctx context.Context, request *HttpRequest) (*HttpResponse, error) {
	buf, err := request.MarshalVT()
	if err != nil {
		return nil, err
	}
	ptr, size := wasm.ByteToPtr(buf)
	ptrSize := _put(ptr, size)
	wasm.Free(ptr)

	ptr = uint32(ptrSize >> 32)
	size = uint32(ptrSize)
	buf = wasm.PtrToByte(ptr, size)

	response := new(HttpResponse)
	if err = response.UnmarshalVT(buf); err != nil {
		return nil, err
	}
	return response, nil
}

//go:wasmimport env delete
func _delete(ptr uint32, size uint32) uint64

func (h httpService) Delete(ctx context.Context, request *HttpRequest) (*HttpResponse, error) {
	buf, err := request.MarshalVT()
	if err != nil {
		return nil, err
	}
	ptr, size := wasm.ByteToPtr(buf)
	ptrSize := _delete(ptr, size)
	wasm.Free(ptr)

	ptr = uint32(ptrSize >> 32)
	size = uint32(ptrSize)
	buf = wasm.PtrToByte(ptr, size)

	response := new(HttpResponse)
	if err = response.UnmarshalVT(buf); err != nil {
		return nil, err
	}
	return response, nil
}

//go:wasmimport env patch
func _patch(ptr uint32, size uint32) uint64

func (h httpService) Patch(ctx context.Context, request *HttpRequest) (*HttpResponse, error) {
	buf, err := request.MarshalVT()
	if err != nil {
		return nil, err
	}
	ptr, size := wasm.ByteToPtr(buf)
	ptrSize := _patch(ptr, size)
	wasm.Free(ptr)

	ptr = uint32(ptrSize >> 32)
	size = uint32(ptrSize)
	buf = wasm.PtrToByte(ptr, size)

	response := new(HttpResponse)
	if err = response.UnmarshalVT(buf); err != nil {
		return nil, err
	}
	return response, nil
}

//go:wasmimport env head
func _head(ptr uint32, size uint32) uint64

func (h httpService) Head(ctx context.Context, request *HttpRequest) (*HttpResponse, error) {
	buf, err := request.MarshalVT()
	if err != nil {
		return nil, err
	}
	ptr, size := wasm.ByteToPtr(buf)
	ptrSize := _head(ptr, size)
	wasm.Free(ptr)

	ptr = uint32(ptrSize >> 32)
	size = uint32(ptrSize)
	buf = wasm.PtrToByte(ptr, size)

	response := new(HttpResponse)
	if err = response.UnmarshalVT(buf); err != nil {
		return nil, err
	}
	return response, nil
}

//go:wasmimport env options
func _options(ptr uint32, size uint32) uint64

func (h httpService) Options(ctx context.Context, request *HttpRequest) (*HttpResponse, error) {
	buf, err := request.MarshalVT()
	if err != nil {
		return nil, err
	}
	ptr, size := wasm.ByteToPtr(buf)
	ptrSize := _options(ptr, size)
	wasm.Free(ptr)

	ptr = uint32(ptrSize >> 32)
	size = uint32(ptrSize)
	buf = wasm.PtrToByte(ptr, size)

	response := new(HttpResponse)
	if err = response.UnmarshalVT(buf); err != nil {
		return nil, err
	}
	return response, nil
}
