Documentation ¶
Overview ¶
Package shortlinkv1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterShortlinkAPIHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterShortlinkAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ShortlinkAPIClient) error
- func RegisterShortlinkAPIHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterShortlinkAPIHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ShortlinkAPIServer) error
- func RegisterShortlinkAPIServer(s grpc.ServiceRegistrar, srv ShortlinkAPIServer)
- type CreateRequest
- func (*CreateRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CreateRequest) GetPath() string
- func (x *CreateRequest) GetState() []*ShareableState
- func (*CreateRequest) ProtoMessage()
- func (x *CreateRequest) ProtoReflect() protoreflect.Message
- func (x *CreateRequest) Reset()
- func (x *CreateRequest) String() string
- func (m *CreateRequest) Validate() error
- func (m *CreateRequest) ValidateAll() error
- type CreateRequestMultiError
- type CreateRequestValidationError
- func (e CreateRequestValidationError) Cause() error
- func (e CreateRequestValidationError) Error() string
- func (e CreateRequestValidationError) ErrorName() string
- func (e CreateRequestValidationError) Field() string
- func (e CreateRequestValidationError) Key() bool
- func (e CreateRequestValidationError) Reason() string
- type CreateResponse
- func (*CreateResponse) Descriptor() ([]byte, []int)deprecated
- func (x *CreateResponse) GetHash() string
- func (*CreateResponse) ProtoMessage()
- func (x *CreateResponse) ProtoReflect() protoreflect.Message
- func (x *CreateResponse) Reset()
- func (x *CreateResponse) String() string
- func (m *CreateResponse) Validate() error
- func (m *CreateResponse) ValidateAll() error
- type CreateResponseMultiError
- type CreateResponseValidationError
- func (e CreateResponseValidationError) Cause() error
- func (e CreateResponseValidationError) Error() string
- func (e CreateResponseValidationError) ErrorName() string
- func (e CreateResponseValidationError) Field() string
- func (e CreateResponseValidationError) Key() bool
- func (e CreateResponseValidationError) Reason() string
- type GetRequest
- func (*GetRequest) Descriptor() ([]byte, []int)deprecated
- func (x *GetRequest) GetHash() string
- func (*GetRequest) ProtoMessage()
- func (x *GetRequest) ProtoReflect() protoreflect.Message
- func (x *GetRequest) Reset()
- func (x *GetRequest) String() string
- func (m *GetRequest) Validate() error
- func (m *GetRequest) ValidateAll() error
- type GetRequestMultiError
- type GetRequestValidationError
- type GetResponse
- func (*GetResponse) Descriptor() ([]byte, []int)deprecated
- func (x *GetResponse) GetPath() string
- func (x *GetResponse) GetState() []*ShareableState
- func (*GetResponse) ProtoMessage()
- func (x *GetResponse) ProtoReflect() protoreflect.Message
- func (x *GetResponse) Reset()
- func (x *GetResponse) String() string
- func (m *GetResponse) Validate() error
- func (m *GetResponse) ValidateAll() error
- type GetResponseMultiError
- type GetResponseValidationError
- func (e GetResponseValidationError) Cause() error
- func (e GetResponseValidationError) Error() string
- func (e GetResponseValidationError) ErrorName() string
- func (e GetResponseValidationError) Field() string
- func (e GetResponseValidationError) Key() bool
- func (e GetResponseValidationError) Reason() string
- type ShareableState
- func (*ShareableState) Descriptor() ([]byte, []int)deprecated
- func (x *ShareableState) GetKey() string
- func (x *ShareableState) GetState() *structpb.Value
- func (*ShareableState) ProtoMessage()
- func (x *ShareableState) ProtoReflect() protoreflect.Message
- func (x *ShareableState) Reset()
- func (x *ShareableState) String() string
- func (m *ShareableState) Validate() error
- func (m *ShareableState) ValidateAll() error
- type ShareableStateMultiError
- type ShareableStateValidationError
- func (e ShareableStateValidationError) Cause() error
- func (e ShareableStateValidationError) Error() string
- func (e ShareableStateValidationError) ErrorName() string
- func (e ShareableStateValidationError) Field() string
- func (e ShareableStateValidationError) Key() bool
- func (e ShareableStateValidationError) Reason() string
- type ShortlinkAPIClient
- type ShortlinkAPIServer
- type UnimplementedShortlinkAPIServer
- type UnsafeShortlinkAPIServer
Constants ¶
const ( ShortlinkAPI_Create_FullMethodName = "/clutch.shortlink.v1.ShortlinkAPI/Create" ShortlinkAPI_Get_FullMethodName = "/clutch.shortlink.v1.ShortlinkAPI/Get" )
Variables ¶
var File_shortlink_v1_shortlink_proto protoreflect.FileDescriptor
var ShortlinkAPI_ServiceDesc = grpc.ServiceDesc{ ServiceName: "clutch.shortlink.v1.ShortlinkAPI", HandlerType: (*ShortlinkAPIServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Create", Handler: _ShortlinkAPI_Create_Handler, }, { MethodName: "Get", Handler: _ShortlinkAPI_Get_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "shortlink/v1/shortlink.proto", }
ShortlinkAPI_ServiceDesc is the grpc.ServiceDesc for ShortlinkAPI service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterShortlinkAPIHandler ¶
func RegisterShortlinkAPIHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterShortlinkAPIHandler registers the http handlers for service ShortlinkAPI to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterShortlinkAPIHandlerClient ¶
func RegisterShortlinkAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ShortlinkAPIClient) error
RegisterShortlinkAPIHandlerClient registers the http handlers for service ShortlinkAPI to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ShortlinkAPIClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ShortlinkAPIClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ShortlinkAPIClient" to call the correct interceptors.
func RegisterShortlinkAPIHandlerFromEndpoint ¶
func RegisterShortlinkAPIHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterShortlinkAPIHandlerFromEndpoint is same as RegisterShortlinkAPIHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterShortlinkAPIHandlerServer ¶
func RegisterShortlinkAPIHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ShortlinkAPIServer) error
RegisterShortlinkAPIHandlerServer registers the http handlers for service ShortlinkAPI to "mux". UnaryRPC :call ShortlinkAPIServer 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 RegisterShortlinkAPIHandlerFromEndpoint instead.
func RegisterShortlinkAPIServer ¶
func RegisterShortlinkAPIServer(s grpc.ServiceRegistrar, srv ShortlinkAPIServer)
Types ¶
type CreateRequest ¶
type CreateRequest struct { Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` State []*ShareableState `protobuf:"bytes,2,rep,name=state,proto3" json:"state,omitempty"` // contains filtered or unexported fields }
func (*CreateRequest) Descriptor
deprecated
func (*CreateRequest) Descriptor() ([]byte, []int)
Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead.
func (*CreateRequest) GetPath ¶
func (x *CreateRequest) GetPath() string
func (*CreateRequest) GetState ¶
func (x *CreateRequest) GetState() []*ShareableState
func (*CreateRequest) ProtoMessage ¶
func (*CreateRequest) ProtoMessage()
func (*CreateRequest) ProtoReflect ¶
func (x *CreateRequest) ProtoReflect() protoreflect.Message
func (*CreateRequest) Reset ¶
func (x *CreateRequest) Reset()
func (*CreateRequest) String ¶
func (x *CreateRequest) String() string
func (*CreateRequest) Validate ¶
func (m *CreateRequest) Validate() error
Validate checks the field values on CreateRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*CreateRequest) ValidateAll ¶
func (m *CreateRequest) ValidateAll() error
ValidateAll checks the field values on CreateRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in CreateRequestMultiError, or nil if none found.
type CreateRequestMultiError ¶
type CreateRequestMultiError []error
CreateRequestMultiError is an error wrapping multiple validation errors returned by CreateRequest.ValidateAll() if the designated constraints aren't met.
func (CreateRequestMultiError) AllErrors ¶
func (m CreateRequestMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (CreateRequestMultiError) Error ¶
func (m CreateRequestMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type CreateRequestValidationError ¶
type CreateRequestValidationError struct {
// contains filtered or unexported fields
}
CreateRequestValidationError is the validation error returned by CreateRequest.Validate if the designated constraints aren't met.
func (CreateRequestValidationError) Cause ¶
func (e CreateRequestValidationError) Cause() error
Cause function returns cause value.
func (CreateRequestValidationError) Error ¶
func (e CreateRequestValidationError) Error() string
Error satisfies the builtin error interface
func (CreateRequestValidationError) ErrorName ¶
func (e CreateRequestValidationError) ErrorName() string
ErrorName returns error name.
func (CreateRequestValidationError) Field ¶
func (e CreateRequestValidationError) Field() string
Field function returns field value.
func (CreateRequestValidationError) Key ¶
func (e CreateRequestValidationError) Key() bool
Key function returns key value.
func (CreateRequestValidationError) Reason ¶
func (e CreateRequestValidationError) Reason() string
Reason function returns reason value.
type CreateResponse ¶
type CreateResponse struct { Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` // contains filtered or unexported fields }
func (*CreateResponse) Descriptor
deprecated
func (*CreateResponse) Descriptor() ([]byte, []int)
Deprecated: Use CreateResponse.ProtoReflect.Descriptor instead.
func (*CreateResponse) GetHash ¶
func (x *CreateResponse) GetHash() string
func (*CreateResponse) ProtoMessage ¶
func (*CreateResponse) ProtoMessage()
func (*CreateResponse) ProtoReflect ¶
func (x *CreateResponse) ProtoReflect() protoreflect.Message
func (*CreateResponse) Reset ¶
func (x *CreateResponse) Reset()
func (*CreateResponse) String ¶
func (x *CreateResponse) String() string
func (*CreateResponse) Validate ¶
func (m *CreateResponse) Validate() error
Validate checks the field values on CreateResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*CreateResponse) ValidateAll ¶
func (m *CreateResponse) ValidateAll() error
ValidateAll checks the field values on CreateResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in CreateResponseMultiError, or nil if none found.
type CreateResponseMultiError ¶
type CreateResponseMultiError []error
CreateResponseMultiError is an error wrapping multiple validation errors returned by CreateResponse.ValidateAll() if the designated constraints aren't met.
func (CreateResponseMultiError) AllErrors ¶
func (m CreateResponseMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (CreateResponseMultiError) Error ¶
func (m CreateResponseMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type CreateResponseValidationError ¶
type CreateResponseValidationError struct {
// contains filtered or unexported fields
}
CreateResponseValidationError is the validation error returned by CreateResponse.Validate if the designated constraints aren't met.
func (CreateResponseValidationError) Cause ¶
func (e CreateResponseValidationError) Cause() error
Cause function returns cause value.
func (CreateResponseValidationError) Error ¶
func (e CreateResponseValidationError) Error() string
Error satisfies the builtin error interface
func (CreateResponseValidationError) ErrorName ¶
func (e CreateResponseValidationError) ErrorName() string
ErrorName returns error name.
func (CreateResponseValidationError) Field ¶
func (e CreateResponseValidationError) Field() string
Field function returns field value.
func (CreateResponseValidationError) Key ¶
func (e CreateResponseValidationError) Key() bool
Key function returns key value.
func (CreateResponseValidationError) Reason ¶
func (e CreateResponseValidationError) Reason() string
Reason function returns reason value.
type GetRequest ¶
type GetRequest struct { Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` // contains filtered or unexported fields }
func (*GetRequest) Descriptor
deprecated
func (*GetRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetRequest.ProtoReflect.Descriptor instead.
func (*GetRequest) GetHash ¶
func (x *GetRequest) GetHash() string
func (*GetRequest) ProtoMessage ¶
func (*GetRequest) ProtoMessage()
func (*GetRequest) ProtoReflect ¶
func (x *GetRequest) ProtoReflect() protoreflect.Message
func (*GetRequest) Reset ¶
func (x *GetRequest) Reset()
func (*GetRequest) String ¶
func (x *GetRequest) String() string
func (*GetRequest) Validate ¶
func (m *GetRequest) Validate() error
Validate checks the field values on GetRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*GetRequest) ValidateAll ¶
func (m *GetRequest) ValidateAll() error
ValidateAll checks the field values on GetRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in GetRequestMultiError, or nil if none found.
type GetRequestMultiError ¶
type GetRequestMultiError []error
GetRequestMultiError is an error wrapping multiple validation errors returned by GetRequest.ValidateAll() if the designated constraints aren't met.
func (GetRequestMultiError) AllErrors ¶
func (m GetRequestMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (GetRequestMultiError) Error ¶
func (m GetRequestMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type GetRequestValidationError ¶
type GetRequestValidationError struct {
// contains filtered or unexported fields
}
GetRequestValidationError is the validation error returned by GetRequest.Validate if the designated constraints aren't met.
func (GetRequestValidationError) Cause ¶
func (e GetRequestValidationError) Cause() error
Cause function returns cause value.
func (GetRequestValidationError) Error ¶
func (e GetRequestValidationError) Error() string
Error satisfies the builtin error interface
func (GetRequestValidationError) ErrorName ¶
func (e GetRequestValidationError) ErrorName() string
ErrorName returns error name.
func (GetRequestValidationError) Field ¶
func (e GetRequestValidationError) Field() string
Field function returns field value.
func (GetRequestValidationError) Key ¶
func (e GetRequestValidationError) Key() bool
Key function returns key value.
func (GetRequestValidationError) Reason ¶
func (e GetRequestValidationError) Reason() string
Reason function returns reason value.
type GetResponse ¶
type GetResponse struct { Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` State []*ShareableState `protobuf:"bytes,2,rep,name=state,proto3" json:"state,omitempty"` // contains filtered or unexported fields }
func (*GetResponse) Descriptor
deprecated
func (*GetResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetResponse.ProtoReflect.Descriptor instead.
func (*GetResponse) GetPath ¶
func (x *GetResponse) GetPath() string
func (*GetResponse) GetState ¶
func (x *GetResponse) GetState() []*ShareableState
func (*GetResponse) ProtoMessage ¶
func (*GetResponse) ProtoMessage()
func (*GetResponse) ProtoReflect ¶
func (x *GetResponse) ProtoReflect() protoreflect.Message
func (*GetResponse) Reset ¶
func (x *GetResponse) Reset()
func (*GetResponse) String ¶
func (x *GetResponse) String() string
func (*GetResponse) Validate ¶
func (m *GetResponse) Validate() error
Validate checks the field values on GetResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*GetResponse) ValidateAll ¶
func (m *GetResponse) ValidateAll() error
ValidateAll checks the field values on GetResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in GetResponseMultiError, or nil if none found.
type GetResponseMultiError ¶
type GetResponseMultiError []error
GetResponseMultiError is an error wrapping multiple validation errors returned by GetResponse.ValidateAll() if the designated constraints aren't met.
func (GetResponseMultiError) AllErrors ¶
func (m GetResponseMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (GetResponseMultiError) Error ¶
func (m GetResponseMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type GetResponseValidationError ¶
type GetResponseValidationError struct {
// contains filtered or unexported fields
}
GetResponseValidationError is the validation error returned by GetResponse.Validate if the designated constraints aren't met.
func (GetResponseValidationError) Cause ¶
func (e GetResponseValidationError) Cause() error
Cause function returns cause value.
func (GetResponseValidationError) Error ¶
func (e GetResponseValidationError) Error() string
Error satisfies the builtin error interface
func (GetResponseValidationError) ErrorName ¶
func (e GetResponseValidationError) ErrorName() string
ErrorName returns error name.
func (GetResponseValidationError) Field ¶
func (e GetResponseValidationError) Field() string
Field function returns field value.
func (GetResponseValidationError) Key ¶
func (e GetResponseValidationError) Key() bool
Key function returns key value.
func (GetResponseValidationError) Reason ¶
func (e GetResponseValidationError) Reason() string
Reason function returns reason value.
type ShareableState ¶
type ShareableState struct { // contains filtered or unexported fields }
ShareableState stores a key identifier that maps to state. This is analogous to a map, however we are not using a map here as that will restrict our ability to further expand on this message. For example adding a "revision" identifier in the future.
func (*ShareableState) Descriptor
deprecated
func (*ShareableState) Descriptor() ([]byte, []int)
Deprecated: Use ShareableState.ProtoReflect.Descriptor instead.
func (*ShareableState) GetKey ¶
func (x *ShareableState) GetKey() string
func (*ShareableState) GetState ¶
func (x *ShareableState) GetState() *structpb.Value
func (*ShareableState) ProtoMessage ¶
func (*ShareableState) ProtoMessage()
func (*ShareableState) ProtoReflect ¶
func (x *ShareableState) ProtoReflect() protoreflect.Message
func (*ShareableState) Reset ¶
func (x *ShareableState) Reset()
func (*ShareableState) String ¶
func (x *ShareableState) String() string
func (*ShareableState) Validate ¶
func (m *ShareableState) Validate() error
Validate checks the field values on ShareableState with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*ShareableState) ValidateAll ¶
func (m *ShareableState) ValidateAll() error
ValidateAll checks the field values on ShareableState with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ShareableStateMultiError, or nil if none found.
type ShareableStateMultiError ¶
type ShareableStateMultiError []error
ShareableStateMultiError is an error wrapping multiple validation errors returned by ShareableState.ValidateAll() if the designated constraints aren't met.
func (ShareableStateMultiError) AllErrors ¶
func (m ShareableStateMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (ShareableStateMultiError) Error ¶
func (m ShareableStateMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type ShareableStateValidationError ¶
type ShareableStateValidationError struct {
// contains filtered or unexported fields
}
ShareableStateValidationError is the validation error returned by ShareableState.Validate if the designated constraints aren't met.
func (ShareableStateValidationError) Cause ¶
func (e ShareableStateValidationError) Cause() error
Cause function returns cause value.
func (ShareableStateValidationError) Error ¶
func (e ShareableStateValidationError) Error() string
Error satisfies the builtin error interface
func (ShareableStateValidationError) ErrorName ¶
func (e ShareableStateValidationError) ErrorName() string
ErrorName returns error name.
func (ShareableStateValidationError) Field ¶
func (e ShareableStateValidationError) Field() string
Field function returns field value.
func (ShareableStateValidationError) Key ¶
func (e ShareableStateValidationError) Key() bool
Key function returns key value.
func (ShareableStateValidationError) Reason ¶
func (e ShareableStateValidationError) Reason() string
Reason function returns reason value.
type ShortlinkAPIClient ¶
type ShortlinkAPIClient interface { Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) }
ShortlinkAPIClient is the client API for ShortlinkAPI 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.
func NewShortlinkAPIClient ¶
func NewShortlinkAPIClient(cc grpc.ClientConnInterface) ShortlinkAPIClient
type ShortlinkAPIServer ¶
type ShortlinkAPIServer interface { Create(context.Context, *CreateRequest) (*CreateResponse, error) Get(context.Context, *GetRequest) (*GetResponse, error) }
ShortlinkAPIServer is the server API for ShortlinkAPI service. All implementations should embed UnimplementedShortlinkAPIServer for forward compatibility
type UnimplementedShortlinkAPIServer ¶
type UnimplementedShortlinkAPIServer struct { }
UnimplementedShortlinkAPIServer should be embedded to have forward compatible implementations.
func (UnimplementedShortlinkAPIServer) Create ¶
func (UnimplementedShortlinkAPIServer) Create(context.Context, *CreateRequest) (*CreateResponse, error)
func (UnimplementedShortlinkAPIServer) Get ¶
func (UnimplementedShortlinkAPIServer) Get(context.Context, *GetRequest) (*GetResponse, error)
type UnsafeShortlinkAPIServer ¶
type UnsafeShortlinkAPIServer interface {
// contains filtered or unexported methods
}
UnsafeShortlinkAPIServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ShortlinkAPIServer will result in compilation errors.