protos

package
v0.0.0-...-85d6a38 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2024 License: MIT Imports: 18 Imported by: 2

Documentation

Overview

Package protos is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	ResampleFilter_name = map[int32]string{
		0: "Lanczos",
		1: "CatmullRom",
		2: "MitchellNetravali",
		3: "Linear",
		4: "Box",
		5: "NearestNeighbor",
	}
	ResampleFilter_value = map[string]int32{
		"Lanczos":           0,
		"CatmullRom":        1,
		"MitchellNetravali": 2,
		"Linear":            3,
		"Box":               4,
		"NearestNeighbor":   5,
	}
)

Enum value maps for ResampleFilter.

View Source
var (
	BlurRequest_BlurMethod_name = map[int32]string{
		0: "Box",
		1: "Gaussian",
	}
	BlurRequest_BlurMethod_value = map[string]int32{
		"Box":      0,
		"Gaussian": 1,
	}
)

Enum value maps for BlurRequest_BlurMethod.

View Source
var File_image_processing_service_v1_messages_proto protoreflect.FileDescriptor
View Source
var File_image_processing_service_v1_proto protoreflect.FileDescriptor
View Source
var ImageProcessingServiceV1_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "image_processing_service.ImageProcessingServiceV1",
	HandlerType: (*ImageProcessingServiceV1Server)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Crop",
			Handler:    _ImageProcessingServiceV1_Crop_Handler,
		},
		{
			MethodName: "Resize",
			Handler:    _ImageProcessingServiceV1_Resize_Handler,
		},
		{
			MethodName: "Validate",
			Handler:    _ImageProcessingServiceV1_Validate_Handler,
		},
		{
			MethodName: "Desaturate",
			Handler:    _ImageProcessingServiceV1_Desaturate_Handler,
		},
		{
			MethodName: "Hue",
			Handler:    _ImageProcessingServiceV1_Hue_Handler,
		},
		{
			MethodName: "Blur",
			Handler:    _ImageProcessingServiceV1_Blur_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "image_processing_service_v1.proto",
}

ImageProcessingServiceV1_ServiceDesc is the grpc.ServiceDesc for ImageProcessingServiceV1 service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterImageProcessingServiceV1Handler

func RegisterImageProcessingServiceV1Handler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterImageProcessingServiceV1Handler registers the http handlers for service ImageProcessingServiceV1 to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterImageProcessingServiceV1HandlerClient

func RegisterImageProcessingServiceV1HandlerClient(ctx context.Context, mux *runtime.ServeMux, client ImageProcessingServiceV1Client) error

RegisterImageProcessingServiceV1HandlerClient registers the http handlers for service ImageProcessingServiceV1 to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ImageProcessingServiceV1Client". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ImageProcessingServiceV1Client" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ImageProcessingServiceV1Client" to call the correct interceptors.

func RegisterImageProcessingServiceV1HandlerFromEndpoint

func RegisterImageProcessingServiceV1HandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterImageProcessingServiceV1HandlerFromEndpoint is same as RegisterImageProcessingServiceV1Handler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterImageProcessingServiceV1HandlerServer

func RegisterImageProcessingServiceV1HandlerServer(ctx context.Context, mux *runtime.ServeMux, server ImageProcessingServiceV1Server) error

RegisterImageProcessingServiceV1HandlerServer registers the http handlers for service ImageProcessingServiceV1 to "mux". UnaryRPC :call ImageProcessingServiceV1Server directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterImageProcessingServiceV1HandlerFromEndpoint instead.

func RegisterImageProcessingServiceV1Server

func RegisterImageProcessingServiceV1Server(s grpc.ServiceRegistrar, srv ImageProcessingServiceV1Server)

Types

type BlurRequest

type BlurRequest struct {
	Image      *Image                 `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"`
	BlurRadius float64                `protobuf:"fixed64,2,opt,name=blur_radius,json=blurRadius,proto3" json:"blur_radius,omitempty"`
	Method     BlurRequest_BlurMethod `protobuf:"varint,3,opt,name=method,proto3,enum=image_processing_service.BlurRequest_BlurMethod" json:"method,omitempty"`
	// contains filtered or unexported fields
}

func (*BlurRequest) Descriptor deprecated

func (*BlurRequest) Descriptor() ([]byte, []int)

Deprecated: Use BlurRequest.ProtoReflect.Descriptor instead.

func (*BlurRequest) GetBlurRadius

func (x *BlurRequest) GetBlurRadius() float64

func (*BlurRequest) GetImage

func (x *BlurRequest) GetImage() *Image

func (*BlurRequest) GetMethod

func (x *BlurRequest) GetMethod() BlurRequest_BlurMethod

func (*BlurRequest) ProtoMessage

func (*BlurRequest) ProtoMessage()

func (*BlurRequest) ProtoReflect

func (x *BlurRequest) ProtoReflect() protoreflect.Message

func (*BlurRequest) Reset

func (x *BlurRequest) Reset()

func (*BlurRequest) String

func (x *BlurRequest) String() string

type BlurRequest_BlurMethod

type BlurRequest_BlurMethod int32
const (
	BlurRequest_Box      BlurRequest_BlurMethod = 0
	BlurRequest_Gaussian BlurRequest_BlurMethod = 1
)

func (BlurRequest_BlurMethod) Descriptor

func (BlurRequest_BlurMethod) Enum

func (BlurRequest_BlurMethod) EnumDescriptor deprecated

func (BlurRequest_BlurMethod) EnumDescriptor() ([]byte, []int)

Deprecated: Use BlurRequest_BlurMethod.Descriptor instead.

func (BlurRequest_BlurMethod) Number

func (BlurRequest_BlurMethod) String

func (x BlurRequest_BlurMethod) String() string

func (BlurRequest_BlurMethod) Type

type CropRequest

type CropRequest struct {
	Image *Image `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"`
	// rectangle coordinate x0
	StartX uint32 `protobuf:"varint,2,opt,name=StartX,json=start_x,proto3" json:"StartX,omitempty"`
	// rectangle coordinate y0
	StartY uint32 `protobuf:"varint,3,opt,name=StartY,json=start_y,proto3" json:"StartY,omitempty"`
	// rectangle coordinate x1
	EndX uint32 `protobuf:"varint,4,opt,name=EndX,json=end_x,proto3" json:"EndX,omitempty"`
	// rectangle coordinate y1
	EndY uint32 `protobuf:"varint,5,opt,name=EndY,json=end_y,proto3" json:"EndY,omitempty"`
	// contains filtered or unexported fields
}

func (*CropRequest) Descriptor deprecated

func (*CropRequest) Descriptor() ([]byte, []int)

Deprecated: Use CropRequest.ProtoReflect.Descriptor instead.

func (*CropRequest) GetEndX

func (x *CropRequest) GetEndX() uint32

func (*CropRequest) GetEndY

func (x *CropRequest) GetEndY() uint32

func (*CropRequest) GetImage

func (x *CropRequest) GetImage() *Image

func (*CropRequest) GetStartX

func (x *CropRequest) GetStartX() uint32

func (*CropRequest) GetStartY

func (x *CropRequest) GetStartY() uint32

func (*CropRequest) ProtoMessage

func (*CropRequest) ProtoMessage()

func (*CropRequest) ProtoReflect

func (x *CropRequest) ProtoReflect() protoreflect.Message

func (*CropRequest) Reset

func (x *CropRequest) Reset()

func (*CropRequest) String

func (x *CropRequest) String() string

type HueRequest

type HueRequest struct {
	Image *Image `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"`
	// between -360 and 360
	Hue int32 `protobuf:"varint,2,opt,name=hue,proto3" json:"hue,omitempty"`
	// contains filtered or unexported fields
}

func (*HueRequest) Descriptor deprecated

func (*HueRequest) Descriptor() ([]byte, []int)

Deprecated: Use HueRequest.ProtoReflect.Descriptor instead.

func (*HueRequest) GetHue

func (x *HueRequest) GetHue() int32

func (*HueRequest) GetImage

func (x *HueRequest) GetImage() *Image

func (*HueRequest) ProtoMessage

func (*HueRequest) ProtoMessage()

func (*HueRequest) ProtoReflect

func (x *HueRequest) ProtoReflect() protoreflect.Message

func (*HueRequest) Reset

func (x *HueRequest) Reset()

func (*HueRequest) String

func (x *HueRequest) String() string

type Image

type Image struct {

	// Image file as bytes (supports base64 encoding)
	Image []byte `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"`
	// contains filtered or unexported fields
}

func (*Image) Descriptor deprecated

func (*Image) Descriptor() ([]byte, []int)

Deprecated: Use Image.ProtoReflect.Descriptor instead.

func (*Image) GetImage

func (x *Image) GetImage() []byte

func (*Image) ProtoMessage

func (*Image) ProtoMessage()

func (*Image) ProtoReflect

func (x *Image) ProtoReflect() protoreflect.Message

func (*Image) Reset

func (x *Image) Reset()

func (*Image) String

func (x *Image) String() string

type ImageProcessingServiceV1Client

type ImageProcessingServiceV1Client interface {
	Crop(ctx context.Context, in *CropRequest, opts ...grpc.CallOption) (*httpbody.HttpBody, error)
	Resize(ctx context.Context, in *ResizeRequest, opts ...grpc.CallOption) (*httpbody.HttpBody, error)
	Validate(ctx context.Context, in *ValidateRequest, opts ...grpc.CallOption) (*ValidateResponse, error)
	Desaturate(ctx context.Context, in *Image, opts ...grpc.CallOption) (*httpbody.HttpBody, error)
	Hue(ctx context.Context, in *HueRequest, opts ...grpc.CallOption) (*httpbody.HttpBody, error)
	Blur(ctx context.Context, in *BlurRequest, opts ...grpc.CallOption) (*httpbody.HttpBody, error)
}

ImageProcessingServiceV1Client is the client API for ImageProcessingServiceV1 service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type ImageProcessingServiceV1Server

type ImageProcessingServiceV1Server interface {
	Crop(context.Context, *CropRequest) (*httpbody.HttpBody, error)
	Resize(context.Context, *ResizeRequest) (*httpbody.HttpBody, error)
	Validate(context.Context, *ValidateRequest) (*ValidateResponse, error)
	Desaturate(context.Context, *Image) (*httpbody.HttpBody, error)
	Hue(context.Context, *HueRequest) (*httpbody.HttpBody, error)
	Blur(context.Context, *BlurRequest) (*httpbody.HttpBody, error)
	// contains filtered or unexported methods
}

ImageProcessingServiceV1Server is the server API for ImageProcessingServiceV1 service. All implementations must embed UnimplementedImageProcessingServiceV1Server for forward compatibility

type ImageResponse

type ImageResponse struct {

	// Image file as bytes
	Image []byte `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"`
	// contains filtered or unexported fields
}

func (*ImageResponse) Descriptor deprecated

func (*ImageResponse) Descriptor() ([]byte, []int)

Deprecated: Use ImageResponse.ProtoReflect.Descriptor instead.

func (*ImageResponse) GetImage

func (x *ImageResponse) GetImage() []byte

func (*ImageResponse) ProtoMessage

func (*ImageResponse) ProtoMessage()

func (*ImageResponse) ProtoReflect

func (x *ImageResponse) ProtoReflect() protoreflect.Message

func (*ImageResponse) Reset

func (x *ImageResponse) Reset()

func (*ImageResponse) String

func (x *ImageResponse) String() string

type ResampleFilter

type ResampleFilter int32
const (
	// A high-quality resampling filter for photographic images yielding sharp results.
	ResampleFilter_Lanczos ResampleFilter = 0
	// A sharp cubic filter that is faster than Lanczos filter while providing similar results.
	ResampleFilter_CatmullRom ResampleFilter = 1
	// A cubic filter that produces smoother results with less ringing artifacts than CatmullRom.
	ResampleFilter_MitchellNetravali ResampleFilter = 2
	// Bilinear resampling filter, produces a smooth output. Faster than cubic filters.
	ResampleFilter_Linear ResampleFilter = 3
	// Simple and fast averaging filter appropriate for downscaling.
	// When upscaling it's similar to NearestNeighbor.
	ResampleFilter_Box ResampleFilter = 4
	// Fastest resampling filter, no antialiasing.
	ResampleFilter_NearestNeighbor ResampleFilter = 5
)

func (ResampleFilter) Descriptor

func (ResampleFilter) Enum

func (x ResampleFilter) Enum() *ResampleFilter

func (ResampleFilter) EnumDescriptor deprecated

func (ResampleFilter) EnumDescriptor() ([]byte, []int)

Deprecated: Use ResampleFilter.Descriptor instead.

func (ResampleFilter) Number

func (ResampleFilter) String

func (x ResampleFilter) String() string

func (ResampleFilter) Type

type ResizeRequest

type ResizeRequest struct {
	Image          *Image         `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"`
	ResampleFilter ResampleFilter `` /* 148-byte string literal not displayed */
	Width          int32          `protobuf:"varint,3,opt,name=Width,json=width,proto3" json:"Width,omitempty"`
	Height         int32          `protobuf:"varint,4,opt,name=Height,json=height,proto3" json:"Height,omitempty"`
	// contains filtered or unexported fields
}

func (*ResizeRequest) Descriptor deprecated

func (*ResizeRequest) Descriptor() ([]byte, []int)

Deprecated: Use ResizeRequest.ProtoReflect.Descriptor instead.

func (*ResizeRequest) GetHeight

func (x *ResizeRequest) GetHeight() int32

func (*ResizeRequest) GetImage

func (x *ResizeRequest) GetImage() *Image

func (*ResizeRequest) GetResampleFilter

func (x *ResizeRequest) GetResampleFilter() ResampleFilter

func (*ResizeRequest) GetWidth

func (x *ResizeRequest) GetWidth() int32

func (*ResizeRequest) ProtoMessage

func (*ResizeRequest) ProtoMessage()

func (*ResizeRequest) ProtoReflect

func (x *ResizeRequest) ProtoReflect() protoreflect.Message

func (*ResizeRequest) Reset

func (x *ResizeRequest) Reset()

func (*ResizeRequest) String

func (x *ResizeRequest) String() string

type UnimplementedImageProcessingServiceV1Server

type UnimplementedImageProcessingServiceV1Server struct {
}

UnimplementedImageProcessingServiceV1Server must be embedded to have forward compatible implementations.

func (UnimplementedImageProcessingServiceV1Server) Blur

func (UnimplementedImageProcessingServiceV1Server) Crop

func (UnimplementedImageProcessingServiceV1Server) Desaturate

func (UnimplementedImageProcessingServiceV1Server) Hue

func (UnimplementedImageProcessingServiceV1Server) Resize

func (UnimplementedImageProcessingServiceV1Server) Validate

type UnsafeImageProcessingServiceV1Server

type UnsafeImageProcessingServiceV1Server interface {
	// contains filtered or unexported methods
}

UnsafeImageProcessingServiceV1Server may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ImageProcessingServiceV1Server will result in compilation errors.

type UserErrorMessage

type UserErrorMessage struct {
	Message string `protobuf:"bytes,1,opt,name=Message,json=message,proto3" json:"Message,omitempty"`
	// contains filtered or unexported fields
}

func (*UserErrorMessage) Descriptor deprecated

func (*UserErrorMessage) Descriptor() ([]byte, []int)

Deprecated: Use UserErrorMessage.ProtoReflect.Descriptor instead.

func (*UserErrorMessage) GetMessage

func (x *UserErrorMessage) GetMessage() string

func (*UserErrorMessage) ProtoMessage

func (*UserErrorMessage) ProtoMessage()

func (*UserErrorMessage) ProtoReflect

func (x *UserErrorMessage) ProtoReflect() protoreflect.Message

func (*UserErrorMessage) Reset

func (x *UserErrorMessage) Reset()

func (*UserErrorMessage) String

func (x *UserErrorMessage) String() string

type ValidateRequest

type ValidateRequest struct {
	Image     *Image `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"`
	MaxWidth  *int32 `protobuf:"varint,2,opt,name=MaxWidth,json=max_width,proto3,oneof" json:"MaxWidth,omitempty"`
	MaxHeight *int32 `protobuf:"varint,3,opt,name=MaxHeight,json=max_height,proto3,oneof" json:"MaxHeight,omitempty"`
	MinWidth  *int32 `protobuf:"varint,4,opt,name=MinWidth,json=min_width,proto3,oneof" json:"MinWidth,omitempty"`
	MinHeight *int32 `protobuf:"varint,5,opt,name=MinHeight,json=min_height,proto3,oneof" json:"MinHeight,omitempty"`
	// List of image types, checking for the occurrence of an image type in the list
	SupportedTypes []string `protobuf:"bytes,6,rep,name=SupportedTypes,json=supported_types,proto3" json:"SupportedTypes,omitempty"`
	// contains filtered or unexported fields
}

func (*ValidateRequest) Descriptor deprecated

func (*ValidateRequest) Descriptor() ([]byte, []int)

Deprecated: Use ValidateRequest.ProtoReflect.Descriptor instead.

func (*ValidateRequest) GetImage

func (x *ValidateRequest) GetImage() *Image

func (*ValidateRequest) GetMaxHeight

func (x *ValidateRequest) GetMaxHeight() int32

func (*ValidateRequest) GetMaxWidth

func (x *ValidateRequest) GetMaxWidth() int32

func (*ValidateRequest) GetMinHeight

func (x *ValidateRequest) GetMinHeight() int32

func (*ValidateRequest) GetMinWidth

func (x *ValidateRequest) GetMinWidth() int32

func (*ValidateRequest) GetSupportedTypes

func (x *ValidateRequest) GetSupportedTypes() []string

func (*ValidateRequest) ProtoMessage

func (*ValidateRequest) ProtoMessage()

func (*ValidateRequest) ProtoReflect

func (x *ValidateRequest) ProtoReflect() protoreflect.Message

func (*ValidateRequest) Reset

func (x *ValidateRequest) Reset()

func (*ValidateRequest) String

func (x *ValidateRequest) String() string

type ValidateResponse

type ValidateResponse struct {
	ImageValid bool `protobuf:"varint,1,opt,name=ImageValid,json=image_valid,proto3" json:"ImageValid,omitempty"`
	// Returns when image not passed, a message describing why the image failed validation
	Details *string `protobuf:"bytes,2,opt,name=Details,json=details,proto3,oneof" json:"Details,omitempty"`
	// contains filtered or unexported fields
}

func (*ValidateResponse) Descriptor deprecated

func (*ValidateResponse) Descriptor() ([]byte, []int)

Deprecated: Use ValidateResponse.ProtoReflect.Descriptor instead.

func (*ValidateResponse) GetDetails

func (x *ValidateResponse) GetDetails() string

func (*ValidateResponse) GetImageValid

func (x *ValidateResponse) GetImageValid() bool

func (*ValidateResponse) ProtoMessage

func (*ValidateResponse) ProtoMessage()

func (*ValidateResponse) ProtoReflect

func (x *ValidateResponse) ProtoReflect() protoreflect.Message

func (*ValidateResponse) Reset

func (x *ValidateResponse) Reset()

func (*ValidateResponse) String

func (x *ValidateResponse) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL