Documentation
¶
Index ¶
- Variables
- func NewImageEndpoints() []*api.Endpoint
- func RegisterImageHandler(s server.Server, hdlr ImageHandler, opts ...server.HandlerOption) error
- type ConvertRequest
- func (*ConvertRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ConvertRequest) GetBase64() string
- func (x *ConvertRequest) GetName() string
- func (x *ConvertRequest) GetOutputURL() bool
- func (x *ConvertRequest) GetUrl() string
- func (*ConvertRequest) ProtoMessage()
- func (x *ConvertRequest) ProtoReflect() protoreflect.Message
- func (x *ConvertRequest) Reset()
- func (x *ConvertRequest) String() string
- type ConvertResponse
- func (*ConvertResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ConvertResponse) GetBase64() string
- func (x *ConvertResponse) GetUrl() string
- func (*ConvertResponse) ProtoMessage()
- func (x *ConvertResponse) ProtoReflect() protoreflect.Message
- func (x *ConvertResponse) Reset()
- func (x *ConvertResponse) String() string
- type CropOptions
- func (*CropOptions) Descriptor() ([]byte, []int)deprecated
- func (x *CropOptions) GetAnchor() string
- func (x *CropOptions) GetHeight() int32
- func (x *CropOptions) GetWidth() int32
- func (*CropOptions) ProtoMessage()
- func (x *CropOptions) ProtoReflect() protoreflect.Message
- func (x *CropOptions) Reset()
- func (x *CropOptions) String() string
- type ImageHandler
- type ImageService
- type Point
- type Rectangle
- type ResizeRequest
- func (*ResizeRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ResizeRequest) GetBase64() string
- func (x *ResizeRequest) GetCropOptions() *CropOptions
- func (x *ResizeRequest) GetHeight() int64
- func (x *ResizeRequest) GetName() string
- func (x *ResizeRequest) GetOutputURL() bool
- func (x *ResizeRequest) GetUrl() string
- func (x *ResizeRequest) GetWidth() int64
- func (*ResizeRequest) ProtoMessage()
- func (x *ResizeRequest) ProtoReflect() protoreflect.Message
- func (x *ResizeRequest) Reset()
- func (x *ResizeRequest) String() string
- type ResizeResponse
- func (*ResizeResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ResizeResponse) GetBase64() string
- func (x *ResizeResponse) GetUrl() string
- func (*ResizeResponse) ProtoMessage()
- func (x *ResizeResponse) ProtoReflect() protoreflect.Message
- func (x *ResizeResponse) Reset()
- func (x *ResizeResponse) String() string
- type UploadRequest
- func (*UploadRequest) Descriptor() ([]byte, []int)deprecated
- func (x *UploadRequest) GetBase64() string
- func (x *UploadRequest) GetName() string
- func (x *UploadRequest) GetUrl() string
- func (*UploadRequest) ProtoMessage()
- func (x *UploadRequest) ProtoReflect() protoreflect.Message
- func (x *UploadRequest) Reset()
- func (x *UploadRequest) String() string
- type UploadResponse
Constants ¶
This section is empty.
Variables ¶
var File_proto_image_proto protoreflect.FileDescriptor
Functions ¶
func NewImageEndpoints ¶
func RegisterImageHandler ¶
func RegisterImageHandler(s server.Server, hdlr ImageHandler, opts ...server.HandlerOption) error
Types ¶
type ConvertRequest ¶
type ConvertRequest struct {
// base64 encoded image to resize,
// ie. "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
Base64 string `protobuf:"bytes,1,opt,name=base64,proto3" json:"base64,omitempty"`
// url of the image to resize
Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
// output name of the image including extension, ie. "cat.png"
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
// make output a URL and not a base64 response
OutputURL bool `protobuf:"varint,4,opt,name=outputURL,proto3" json:"outputURL,omitempty"`
// contains filtered or unexported fields
}
Convert an image from one format (jpeg, png etc.) to an other either on the fly (from base64 to base64), or by uploading the conversion result.
func (*ConvertRequest) Descriptor
deprecated
func (*ConvertRequest) Descriptor() ([]byte, []int)
Deprecated: Use ConvertRequest.ProtoReflect.Descriptor instead.
func (*ConvertRequest) GetBase64 ¶
func (x *ConvertRequest) GetBase64() string
func (*ConvertRequest) GetName ¶
func (x *ConvertRequest) GetName() string
func (*ConvertRequest) GetOutputURL ¶
func (x *ConvertRequest) GetOutputURL() bool
func (*ConvertRequest) GetUrl ¶
func (x *ConvertRequest) GetUrl() string
func (*ConvertRequest) ProtoMessage ¶
func (*ConvertRequest) ProtoMessage()
func (*ConvertRequest) ProtoReflect ¶
func (x *ConvertRequest) ProtoReflect() protoreflect.Message
func (*ConvertRequest) Reset ¶
func (x *ConvertRequest) Reset()
func (*ConvertRequest) String ¶
func (x *ConvertRequest) String() string
type ConvertResponse ¶
type ConvertResponse struct {
Base64 string `protobuf:"bytes,1,opt,name=base64,proto3" json:"base64,omitempty"`
Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
// contains filtered or unexported fields
}
func (*ConvertResponse) Descriptor
deprecated
func (*ConvertResponse) Descriptor() ([]byte, []int)
Deprecated: Use ConvertResponse.ProtoReflect.Descriptor instead.
func (*ConvertResponse) GetBase64 ¶
func (x *ConvertResponse) GetBase64() string
func (*ConvertResponse) GetUrl ¶
func (x *ConvertResponse) GetUrl() string
func (*ConvertResponse) ProtoMessage ¶
func (*ConvertResponse) ProtoMessage()
func (*ConvertResponse) ProtoReflect ¶
func (x *ConvertResponse) ProtoReflect() protoreflect.Message
func (*ConvertResponse) Reset ¶
func (x *ConvertResponse) Reset()
func (*ConvertResponse) String ¶
func (x *ConvertResponse) String() string
type CropOptions ¶
type CropOptions struct {
// width to crop to
Width int32 `protobuf:"varint,1,opt,name=width,proto3" json:"width,omitempty"`
// height to crop to
Height int32 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
// Crop anchor point: "top", "top left", "top right",
// "left", "center", "right"
// "bottom left", "bottom", "bottom right".
// Optional. Defaults to center.
Anchor string `protobuf:"bytes,3,opt,name=anchor,proto3" json:"anchor,omitempty"`
// contains filtered or unexported fields
}
func (*CropOptions) Descriptor
deprecated
func (*CropOptions) Descriptor() ([]byte, []int)
Deprecated: Use CropOptions.ProtoReflect.Descriptor instead.
func (*CropOptions) GetAnchor ¶
func (x *CropOptions) GetAnchor() string
func (*CropOptions) GetHeight ¶
func (x *CropOptions) GetHeight() int32
func (*CropOptions) GetWidth ¶
func (x *CropOptions) GetWidth() int32
func (*CropOptions) ProtoMessage ¶
func (*CropOptions) ProtoMessage()
func (*CropOptions) ProtoReflect ¶
func (x *CropOptions) ProtoReflect() protoreflect.Message
func (*CropOptions) Reset ¶
func (x *CropOptions) Reset()
func (*CropOptions) String ¶
func (x *CropOptions) String() string
type ImageHandler ¶
type ImageHandler interface {
Upload(context.Context, *UploadRequest, *UploadResponse) error
Resize(context.Context, *ResizeRequest, *ResizeResponse) error
Convert(context.Context, *ConvertRequest, *ConvertResponse) error
}
type ImageService ¶
type ImageService interface {
Upload(ctx context.Context, in *UploadRequest, opts ...client.CallOption) (*UploadResponse, error)
Resize(ctx context.Context, in *ResizeRequest, opts ...client.CallOption) (*ResizeResponse, error)
Convert(ctx context.Context, in *ConvertRequest, opts ...client.CallOption) (*ConvertResponse, error)
}
func NewImageService ¶
func NewImageService(name string, c client.Client) ImageService
type Point ¶
type Point struct {
X int32 `protobuf:"varint,1,opt,name=x,proto3" json:"x,omitempty"`
Y int32 `protobuf:"varint,2,opt,name=y,proto3" json:"y,omitempty"`
// contains filtered or unexported fields
}
func (*Point) Descriptor
deprecated
func (*Point) ProtoMessage ¶
func (*Point) ProtoMessage()
func (*Point) ProtoReflect ¶
func (x *Point) ProtoReflect() protoreflect.Message
type Rectangle ¶
type Rectangle struct {
Min *Point `protobuf:"bytes,1,opt,name=min,proto3" json:"min,omitempty"`
Max *Point `protobuf:"bytes,2,opt,name=max,proto3" json:"max,omitempty"`
// contains filtered or unexported fields
}
func (*Rectangle) Descriptor
deprecated
func (*Rectangle) ProtoMessage ¶
func (*Rectangle) ProtoMessage()
func (*Rectangle) ProtoReflect ¶
func (x *Rectangle) ProtoReflect() protoreflect.Message
type ResizeRequest ¶
type ResizeRequest struct {
// base64 encoded image to resize,
// ie. "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
Base64 string `protobuf:"bytes,1,opt,name=base64,proto3" json:"base64,omitempty"`
// url of the image to resize
Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
// output name of the image including extension, ie. "cat.png"
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
// make output a URL and not a base64 response
OutputURL bool `protobuf:"varint,4,opt,name=outputURL,proto3" json:"outputURL,omitempty"`
Width int64 `protobuf:"varint,5,opt,name=width,proto3" json:"width,omitempty"`
Height int64 `protobuf:"varint,6,opt,name=height,proto3" json:"height,omitempty"`
// optional crop options
// if provided, after resize, the image
// will be cropped
CropOptions *CropOptions `protobuf:"bytes,7,opt,name=cropOptions,proto3" json:"cropOptions,omitempty"`
// contains filtered or unexported fields
}
Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters. If one of width or height is 0, the image aspect ratio is preserved. Optional cropping.
func (*ResizeRequest) Descriptor
deprecated
func (*ResizeRequest) Descriptor() ([]byte, []int)
Deprecated: Use ResizeRequest.ProtoReflect.Descriptor instead.
func (*ResizeRequest) GetBase64 ¶
func (x *ResizeRequest) GetBase64() string
func (*ResizeRequest) GetCropOptions ¶
func (x *ResizeRequest) GetCropOptions() *CropOptions
func (*ResizeRequest) GetHeight ¶
func (x *ResizeRequest) GetHeight() int64
func (*ResizeRequest) GetName ¶
func (x *ResizeRequest) GetName() string
func (*ResizeRequest) GetOutputURL ¶
func (x *ResizeRequest) GetOutputURL() bool
func (*ResizeRequest) GetUrl ¶
func (x *ResizeRequest) GetUrl() string
func (*ResizeRequest) GetWidth ¶
func (x *ResizeRequest) GetWidth() int64
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 ResizeResponse ¶
type ResizeResponse struct {
Base64 string `protobuf:"bytes,1,opt,name=base64,proto3" json:"base64,omitempty"`
Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
// contains filtered or unexported fields
}
func (*ResizeResponse) Descriptor
deprecated
func (*ResizeResponse) Descriptor() ([]byte, []int)
Deprecated: Use ResizeResponse.ProtoReflect.Descriptor instead.
func (*ResizeResponse) GetBase64 ¶
func (x *ResizeResponse) GetBase64() string
func (*ResizeResponse) GetUrl ¶
func (x *ResizeResponse) GetUrl() string
func (*ResizeResponse) ProtoMessage ¶
func (*ResizeResponse) ProtoMessage()
func (*ResizeResponse) ProtoReflect ¶
func (x *ResizeResponse) ProtoReflect() protoreflect.Message
func (*ResizeResponse) Reset ¶
func (x *ResizeResponse) Reset()
func (*ResizeResponse) String ¶
func (x *ResizeResponse) String() string
type UploadRequest ¶
type UploadRequest struct {
// Base64 encoded image to upload,
// ie. "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
Base64 string `protobuf:"bytes,1,opt,name=base64,proto3" json:"base64,omitempty"`
// URL of the image to upload
Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
// Output name of the image including extension, ie. "cat.png"
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
// contains filtered or unexported fields
}
Upload an image by either sending a base64 encoded image to this endpoint or a URL. To resize an image before uploading, see the Resize endpoint.
func (*UploadRequest) Descriptor
deprecated
func (*UploadRequest) Descriptor() ([]byte, []int)
Deprecated: Use UploadRequest.ProtoReflect.Descriptor instead.
func (*UploadRequest) GetBase64 ¶
func (x *UploadRequest) GetBase64() string
func (*UploadRequest) GetName ¶
func (x *UploadRequest) GetName() string
func (*UploadRequest) GetUrl ¶
func (x *UploadRequest) GetUrl() string
func (*UploadRequest) ProtoMessage ¶
func (*UploadRequest) ProtoMessage()
func (*UploadRequest) ProtoReflect ¶
func (x *UploadRequest) ProtoReflect() protoreflect.Message
func (*UploadRequest) Reset ¶
func (x *UploadRequest) Reset()
func (*UploadRequest) String ¶
func (x *UploadRequest) String() string
type UploadResponse ¶
type UploadResponse struct {
Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
// contains filtered or unexported fields
}
func (*UploadResponse) Descriptor
deprecated
func (*UploadResponse) Descriptor() ([]byte, []int)
Deprecated: Use UploadResponse.ProtoReflect.Descriptor instead.
func (*UploadResponse) GetUrl ¶
func (x *UploadResponse) GetUrl() string
func (*UploadResponse) ProtoMessage ¶
func (*UploadResponse) ProtoMessage()
func (*UploadResponse) ProtoReflect ¶
func (x *UploadResponse) ProtoReflect() protoreflect.Message
func (*UploadResponse) Reset ¶
func (x *UploadResponse) Reset()
func (*UploadResponse) String ¶
func (x *UploadResponse) String() string