channel

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package channel is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_channel_proto protoreflect.FileDescriptor

Functions

func RegisterChannelAPIHandler

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

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

func RegisterChannelAPIHandlerClient

func RegisterChannelAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ChannelAPIClient) error

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

func RegisterChannelAPIHandlerFromEndpoint

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

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

func RegisterChannelAPIHandlerServer

func RegisterChannelAPIHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ChannelAPIServer) error

RegisterChannelAPIHandlerServer registers the http handlers for service ChannelAPI to "mux". UnaryRPC :call ChannelAPIServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.

func RegisterChannelAPIServer

func RegisterChannelAPIServer(s *grpc.Server, srv ChannelAPIServer)

Types

type Channel

type Channel struct {
	Id                string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Title             string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
	Description       string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
	OwnerId           string `protobuf:"bytes,4,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"`
	CreateTimeSeconds int32  `protobuf:"varint,5,opt,name=create_time_seconds,json=createTimeSeconds,proto3" json:"create_time_seconds,omitempty"`
	Subscribers       int32  `protobuf:"varint,6,opt,name=subscribers,proto3" json:"subscribers,omitempty"`
	// contains filtered or unexported fields
}

func (*Channel) Descriptor deprecated

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

Deprecated: Use Channel.ProtoReflect.Descriptor instead.

func (*Channel) GetCreateTimeSeconds

func (x *Channel) GetCreateTimeSeconds() int32

func (*Channel) GetDescription

func (x *Channel) GetDescription() string

func (*Channel) GetId

func (x *Channel) GetId() string

func (*Channel) GetOwnerId

func (x *Channel) GetOwnerId() string

func (*Channel) GetSubscribers

func (x *Channel) GetSubscribers() int32

func (*Channel) GetTitle

func (x *Channel) GetTitle() string

func (*Channel) ProtoMessage

func (*Channel) ProtoMessage()

func (*Channel) ProtoReflect

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

func (*Channel) Reset

func (x *Channel) Reset()

func (*Channel) String

func (x *Channel) String() string

type ChannelAPIClient

type ChannelAPIClient interface {
	// Creates a new subscriber channel
	CreateChannel(ctx context.Context, in *CreateChannelRequest, opts ...grpc.CallOption) (*CreateChannelResponse, error)
	// Updates an existing channel resource
	UpdateChannel(ctx context.Context, in *UpdateChannelRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Removes a subscribers channel
	DeleteChannel(ctx context.Context, in *DeleteChannelRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Retrieves a collection of channels resource
	ListChannels(ctx context.Context, in *ListChannelsRequest, opts ...grpc.CallOption) (*ListChannelsResponse, error)
	// Retrieves a single channel resource
	GetChannel(ctx context.Context, in *GetChannelRequest, opts ...grpc.CallOption) (*Channel, error)
	// Increment subscribers by one.
	IncrementSubscribers(ctx context.Context, in *SubscribersRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Decrement subscribers by one.
	DecrementSubscribers(ctx context.Context, in *SubscribersRequest, opts ...grpc.CallOption) (*empty.Empty, error)
}

ChannelAPIClient is the client API for ChannelAPI service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewChannelAPIClient

func NewChannelAPIClient(cc grpc.ClientConnInterface) ChannelAPIClient

type ChannelAPIServer

type ChannelAPIServer interface {
	// Creates a new subscriber channel
	CreateChannel(context.Context, *CreateChannelRequest) (*CreateChannelResponse, error)
	// Updates an existing channel resource
	UpdateChannel(context.Context, *UpdateChannelRequest) (*empty.Empty, error)
	// Removes a subscribers channel
	DeleteChannel(context.Context, *DeleteChannelRequest) (*empty.Empty, error)
	// Retrieves a collection of channels resource
	ListChannels(context.Context, *ListChannelsRequest) (*ListChannelsResponse, error)
	// Retrieves a single channel resource
	GetChannel(context.Context, *GetChannelRequest) (*Channel, error)
	// Increment subscribers by one.
	IncrementSubscribers(context.Context, *SubscribersRequest) (*empty.Empty, error)
	// Decrement subscribers by one.
	DecrementSubscribers(context.Context, *SubscribersRequest) (*empty.Empty, error)
}

ChannelAPIServer is the server API for ChannelAPI service.

type CreateChannelRequest

type CreateChannelRequest struct {
	Channel *Channel `protobuf:"bytes,1,opt,name=channel,proto3" json:"channel,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateChannelRequest) Descriptor deprecated

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

Deprecated: Use CreateChannelRequest.ProtoReflect.Descriptor instead.

func (*CreateChannelRequest) GetChannel

func (x *CreateChannelRequest) GetChannel() *Channel

func (*CreateChannelRequest) ProtoMessage

func (*CreateChannelRequest) ProtoMessage()

func (*CreateChannelRequest) ProtoReflect

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

func (*CreateChannelRequest) Reset

func (x *CreateChannelRequest) Reset()

func (*CreateChannelRequest) String

func (x *CreateChannelRequest) String() string

type CreateChannelResponse

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

func (*CreateChannelResponse) Descriptor deprecated

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

Deprecated: Use CreateChannelResponse.ProtoReflect.Descriptor instead.

func (*CreateChannelResponse) GetId

func (x *CreateChannelResponse) GetId() string

func (*CreateChannelResponse) ProtoMessage

func (*CreateChannelResponse) ProtoMessage()

func (*CreateChannelResponse) ProtoReflect

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

func (*CreateChannelResponse) Reset

func (x *CreateChannelResponse) Reset()

func (*CreateChannelResponse) String

func (x *CreateChannelResponse) String() string

type DeleteChannelRequest

type DeleteChannelRequest struct {
	Id      string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	OwnerId string `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteChannelRequest) Descriptor deprecated

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

Deprecated: Use DeleteChannelRequest.ProtoReflect.Descriptor instead.

func (*DeleteChannelRequest) GetId

func (x *DeleteChannelRequest) GetId() string

func (*DeleteChannelRequest) GetOwnerId

func (x *DeleteChannelRequest) GetOwnerId() string

func (*DeleteChannelRequest) ProtoMessage

func (*DeleteChannelRequest) ProtoMessage()

func (*DeleteChannelRequest) ProtoReflect

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

func (*DeleteChannelRequest) Reset

func (x *DeleteChannelRequest) Reset()

func (*DeleteChannelRequest) String

func (x *DeleteChannelRequest) String() string

type GetChannelRequest

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

func (*GetChannelRequest) Descriptor deprecated

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

Deprecated: Use GetChannelRequest.ProtoReflect.Descriptor instead.

func (*GetChannelRequest) GetId

func (x *GetChannelRequest) GetId() string

func (*GetChannelRequest) ProtoMessage

func (*GetChannelRequest) ProtoMessage()

func (*GetChannelRequest) ProtoReflect

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

func (*GetChannelRequest) Reset

func (x *GetChannelRequest) Reset()

func (*GetChannelRequest) String

func (x *GetChannelRequest) String() string

type ListChannelsRequest

type ListChannelsRequest struct {
	PageToken string `protobuf:"bytes,1,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
	PageSize  int32  `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
	// contains filtered or unexported fields
}

func (*ListChannelsRequest) Descriptor deprecated

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

Deprecated: Use ListChannelsRequest.ProtoReflect.Descriptor instead.

func (*ListChannelsRequest) GetPageSize

func (x *ListChannelsRequest) GetPageSize() int32

func (*ListChannelsRequest) GetPageToken

func (x *ListChannelsRequest) GetPageToken() string

func (*ListChannelsRequest) ProtoMessage

func (*ListChannelsRequest) ProtoMessage()

func (*ListChannelsRequest) ProtoReflect

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

func (*ListChannelsRequest) Reset

func (x *ListChannelsRequest) Reset()

func (*ListChannelsRequest) String

func (x *ListChannelsRequest) String() string

type ListChannelsResponse

type ListChannelsResponse struct {
	Channels      []*Channel `protobuf:"bytes,1,rep,name=channels,proto3" json:"channels,omitempty"`
	NextPageToken string     `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
	// contains filtered or unexported fields
}

func (*ListChannelsResponse) Descriptor deprecated

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

Deprecated: Use ListChannelsResponse.ProtoReflect.Descriptor instead.

func (*ListChannelsResponse) GetChannels

func (x *ListChannelsResponse) GetChannels() []*Channel

func (*ListChannelsResponse) GetNextPageToken

func (x *ListChannelsResponse) GetNextPageToken() string

func (*ListChannelsResponse) ProtoMessage

func (*ListChannelsResponse) ProtoMessage()

func (*ListChannelsResponse) ProtoReflect

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

func (*ListChannelsResponse) Reset

func (x *ListChannelsResponse) Reset()

func (*ListChannelsResponse) String

func (x *ListChannelsResponse) String() string

type SubscribersRequest

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

func (*SubscribersRequest) Descriptor deprecated

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

Deprecated: Use SubscribersRequest.ProtoReflect.Descriptor instead.

func (*SubscribersRequest) GetId added in v0.6.0

func (x *SubscribersRequest) GetId() string

func (*SubscribersRequest) ProtoMessage

func (*SubscribersRequest) ProtoMessage()

func (*SubscribersRequest) ProtoReflect

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

func (*SubscribersRequest) Reset

func (x *SubscribersRequest) Reset()

func (*SubscribersRequest) String

func (x *SubscribersRequest) String() string

type UnimplementedChannelAPIServer

type UnimplementedChannelAPIServer struct {
}

UnimplementedChannelAPIServer can be embedded to have forward compatible implementations.

func (*UnimplementedChannelAPIServer) CreateChannel

func (*UnimplementedChannelAPIServer) DecrementSubscribers

func (*UnimplementedChannelAPIServer) DeleteChannel

func (*UnimplementedChannelAPIServer) GetChannel

func (*UnimplementedChannelAPIServer) IncrementSubscribers

func (*UnimplementedChannelAPIServer) ListChannels

func (*UnimplementedChannelAPIServer) UpdateChannel

type UpdateChannelRequest

type UpdateChannelRequest struct {
	OwnerId string   `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"`
	Channel *Channel `protobuf:"bytes,2,opt,name=channel,proto3" json:"channel,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateChannelRequest) Descriptor deprecated

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

Deprecated: Use UpdateChannelRequest.ProtoReflect.Descriptor instead.

func (*UpdateChannelRequest) GetChannel

func (x *UpdateChannelRequest) GetChannel() *Channel

func (*UpdateChannelRequest) GetOwnerId

func (x *UpdateChannelRequest) GetOwnerId() string

func (*UpdateChannelRequest) ProtoMessage

func (*UpdateChannelRequest) ProtoMessage()

func (*UpdateChannelRequest) ProtoReflect

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

func (*UpdateChannelRequest) Reset

func (x *UpdateChannelRequest) Reset()

func (*UpdateChannelRequest) String

func (x *UpdateChannelRequest) String() string

Jump to

Keyboard shortcuts

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