// Code generated by protoc-gen-go-ttrpc. DO NOT EDIT.
// source: services/images/v1/images.proto
package images

import (
	context "context"
	ttrpc "github.com/containerd/ttrpc"
	emptypb "google.golang.org/protobuf/types/known/emptypb"
)

type TTRPCImagesService interface {
	Get(context.Context, *GetImageRequest) (*GetImageResponse, error)
	List(context.Context, *ListImagesRequest) (*ListImagesResponse, error)
	Create(context.Context, *CreateImageRequest) (*CreateImageResponse, error)
	Update(context.Context, *UpdateImageRequest) (*UpdateImageResponse, error)
	Delete(context.Context, *DeleteImageRequest) (*emptypb.Empty, error)
}

func RegisterTTRPCImagesService(srv *ttrpc.Server, svc TTRPCImagesService) {
	srv.RegisterService("containerd.services.images.v1.Images", &ttrpc.ServiceDesc{
		Methods: map[string]ttrpc.Method{
			"Get": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
				var req GetImageRequest
				if err := unmarshal(&req); err != nil {
					return nil, err
				}
				return svc.Get(ctx, &req)
			},
			"List": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
				var req ListImagesRequest
				if err := unmarshal(&req); err != nil {
					return nil, err
				}
				return svc.List(ctx, &req)
			},
			"Create": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
				var req CreateImageRequest
				if err := unmarshal(&req); err != nil {
					return nil, err
				}
				return svc.Create(ctx, &req)
			},
			"Update": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
				var req UpdateImageRequest
				if err := unmarshal(&req); err != nil {
					return nil, err
				}
				return svc.Update(ctx, &req)
			},
			"Delete": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
				var req DeleteImageRequest
				if err := unmarshal(&req); err != nil {
					return nil, err
				}
				return svc.Delete(ctx, &req)
			},
		},
	})
}

type ttrpcimagesClient struct {
	client *ttrpc.Client
}

func NewTTRPCImagesClient(client *ttrpc.Client) TTRPCImagesService {
	return &ttrpcimagesClient{
		client: client,
	}
}

func (c *ttrpcimagesClient) Get(ctx context.Context, req *GetImageRequest) (*GetImageResponse, error) {
	var resp GetImageResponse
	if err := c.client.Call(ctx, "containerd.services.images.v1.Images", "Get", req, &resp); err != nil {
		return nil, err
	}
	return &resp, nil
}

func (c *ttrpcimagesClient) List(ctx context.Context, req *ListImagesRequest) (*ListImagesResponse, error) {
	var resp ListImagesResponse
	if err := c.client.Call(ctx, "containerd.services.images.v1.Images", "List", req, &resp); err != nil {
		return nil, err
	}
	return &resp, nil
}

func (c *ttrpcimagesClient) Create(ctx context.Context, req *CreateImageRequest) (*CreateImageResponse, error) {
	var resp CreateImageResponse
	if err := c.client.Call(ctx, "containerd.services.images.v1.Images", "Create", req, &resp); err != nil {
		return nil, err
	}
	return &resp, nil
}

func (c *ttrpcimagesClient) Update(ctx context.Context, req *UpdateImageRequest) (*UpdateImageResponse, error) {
	var resp UpdateImageResponse
	if err := c.client.Call(ctx, "containerd.services.images.v1.Images", "Update", req, &resp); err != nil {
		return nil, err
	}
	return &resp, nil
}

func (c *ttrpcimagesClient) Delete(ctx context.Context, req *DeleteImageRequest) (*emptypb.Empty, error) {
	var resp emptypb.Empty
	if err := c.client.Call(ctx, "containerd.services.images.v1.Images", "Delete", req, &resp); err != nil {
		return nil, err
	}
	return &resp, nil
}
