reddit_feed_api

package
v0.0.0-...-d0a8e37 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: MIT Imports: 31 Imported by: 0

Documentation

Overview

Package reddit_feed_api is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_reddit_reddit_feed_api_v1_reddit_feed_api_proto protoreflect.FileDescriptor
View Source
var RedditFeedAPIService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "reddit.reddit_feed_api.v1.RedditFeedAPIService",
	HandlerType: (*RedditFeedAPIServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreatePostsV1",
			Handler:    _RedditFeedAPIService_CreatePostsV1_Handler,
		},
		{
			MethodName: "GenerateFeedV1",
			Handler:    _RedditFeedAPIService_GenerateFeedV1_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "reddit/reddit_feed_api/v1/reddit_feed_api.proto",
}

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

Functions

func RegisterRedditFeedAPIServiceHandler

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

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

func RegisterRedditFeedAPIServiceHandlerClient

func RegisterRedditFeedAPIServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client RedditFeedAPIServiceClient) error

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

func RegisterRedditFeedAPIServiceHandlerFromEndpoint

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

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

func RegisterRedditFeedAPIServiceHandlerServer

func RegisterRedditFeedAPIServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server RedditFeedAPIServiceServer) error

RegisterRedditFeedAPIServiceHandlerServer registers the http handlers for service RedditFeedAPIService to "mux". UnaryRPC :call RedditFeedAPIServiceServer 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 RegisterRedditFeedAPIServiceHandlerFromEndpoint instead.

func RegisterRedditFeedAPIServiceServer

func RegisterRedditFeedAPIServiceServer(s grpc.ServiceRegistrar, srv RedditFeedAPIServiceServer)

Types

type CreatePostsV1Request

type CreatePostsV1Request struct {
	Posts []*Post `protobuf:"bytes,1,rep,name=posts,proto3" json:"posts,omitempty"`
	// contains filtered or unexported fields
}

func (*CreatePostsV1Request) Descriptor deprecated

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

Deprecated: Use CreatePostsV1Request.ProtoReflect.Descriptor instead.

func (*CreatePostsV1Request) GetPosts

func (x *CreatePostsV1Request) GetPosts() []*Post

func (*CreatePostsV1Request) ProtoMessage

func (*CreatePostsV1Request) ProtoMessage()

func (*CreatePostsV1Request) ProtoReflect

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

func (*CreatePostsV1Request) Reset

func (x *CreatePostsV1Request) Reset()

func (*CreatePostsV1Request) String

func (x *CreatePostsV1Request) String() string

func (*CreatePostsV1Request) Validate

func (m *CreatePostsV1Request) Validate() error

Validate checks the field values on CreatePostsV1Request 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 (*CreatePostsV1Request) ValidateAll

func (m *CreatePostsV1Request) ValidateAll() error

ValidateAll checks the field values on CreatePostsV1Request 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 CreatePostsV1RequestMultiError, or nil if none found.

type CreatePostsV1RequestMultiError

type CreatePostsV1RequestMultiError []error

CreatePostsV1RequestMultiError is an error wrapping multiple validation errors returned by CreatePostsV1Request.ValidateAll() if the designated constraints aren't met.

func (CreatePostsV1RequestMultiError) AllErrors

func (m CreatePostsV1RequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (CreatePostsV1RequestMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type CreatePostsV1RequestValidationError

type CreatePostsV1RequestValidationError struct {
	// contains filtered or unexported fields
}

CreatePostsV1RequestValidationError is the validation error returned by CreatePostsV1Request.Validate if the designated constraints aren't met.

func (CreatePostsV1RequestValidationError) Cause

Cause function returns cause value.

func (CreatePostsV1RequestValidationError) Error

Error satisfies the builtin error interface

func (CreatePostsV1RequestValidationError) ErrorName

ErrorName returns error name.

func (CreatePostsV1RequestValidationError) Field

Field function returns field value.

func (CreatePostsV1RequestValidationError) Key

Key function returns key value.

func (CreatePostsV1RequestValidationError) Reason

Reason function returns reason value.

type CreatePostsV1Response

type CreatePostsV1Response struct {
	NumberOfCreatedPosts int64 `` /* 126-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*CreatePostsV1Response) Descriptor deprecated

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

Deprecated: Use CreatePostsV1Response.ProtoReflect.Descriptor instead.

func (*CreatePostsV1Response) GetNumberOfCreatedPosts

func (x *CreatePostsV1Response) GetNumberOfCreatedPosts() int64

func (*CreatePostsV1Response) ProtoMessage

func (*CreatePostsV1Response) ProtoMessage()

func (*CreatePostsV1Response) ProtoReflect

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

func (*CreatePostsV1Response) Reset

func (x *CreatePostsV1Response) Reset()

func (*CreatePostsV1Response) String

func (x *CreatePostsV1Response) String() string

func (*CreatePostsV1Response) Validate

func (m *CreatePostsV1Response) Validate() error

Validate checks the field values on CreatePostsV1Response 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 (*CreatePostsV1Response) ValidateAll

func (m *CreatePostsV1Response) ValidateAll() error

ValidateAll checks the field values on CreatePostsV1Response 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 CreatePostsV1ResponseMultiError, or nil if none found.

type CreatePostsV1ResponseMultiError

type CreatePostsV1ResponseMultiError []error

CreatePostsV1ResponseMultiError is an error wrapping multiple validation errors returned by CreatePostsV1Response.ValidateAll() if the designated constraints aren't met.

func (CreatePostsV1ResponseMultiError) AllErrors

func (m CreatePostsV1ResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (CreatePostsV1ResponseMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type CreatePostsV1ResponseValidationError

type CreatePostsV1ResponseValidationError struct {
	// contains filtered or unexported fields
}

CreatePostsV1ResponseValidationError is the validation error returned by CreatePostsV1Response.Validate if the designated constraints aren't met.

func (CreatePostsV1ResponseValidationError) Cause

Cause function returns cause value.

func (CreatePostsV1ResponseValidationError) Error

Error satisfies the builtin error interface

func (CreatePostsV1ResponseValidationError) ErrorName

ErrorName returns error name.

func (CreatePostsV1ResponseValidationError) Field

Field function returns field value.

func (CreatePostsV1ResponseValidationError) Key

Key function returns key value.

func (CreatePostsV1ResponseValidationError) Reason

Reason function returns reason value.

type GenerateFeedV1Request

type GenerateFeedV1Request struct {
	PageId uint64 `protobuf:"varint,1,opt,name=page_id,json=pageId,proto3" json:"page_id,omitempty"`
	// contains filtered or unexported fields
}

func (*GenerateFeedV1Request) Descriptor deprecated

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

Deprecated: Use GenerateFeedV1Request.ProtoReflect.Descriptor instead.

func (*GenerateFeedV1Request) GetPageId

func (x *GenerateFeedV1Request) GetPageId() uint64

func (*GenerateFeedV1Request) ProtoMessage

func (*GenerateFeedV1Request) ProtoMessage()

func (*GenerateFeedV1Request) ProtoReflect

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

func (*GenerateFeedV1Request) Reset

func (x *GenerateFeedV1Request) Reset()

func (*GenerateFeedV1Request) String

func (x *GenerateFeedV1Request) String() string

func (*GenerateFeedV1Request) Validate

func (m *GenerateFeedV1Request) Validate() error

Validate checks the field values on GenerateFeedV1Request 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 (*GenerateFeedV1Request) ValidateAll

func (m *GenerateFeedV1Request) ValidateAll() error

ValidateAll checks the field values on GenerateFeedV1Request 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 GenerateFeedV1RequestMultiError, or nil if none found.

type GenerateFeedV1RequestMultiError

type GenerateFeedV1RequestMultiError []error

GenerateFeedV1RequestMultiError is an error wrapping multiple validation errors returned by GenerateFeedV1Request.ValidateAll() if the designated constraints aren't met.

func (GenerateFeedV1RequestMultiError) AllErrors

func (m GenerateFeedV1RequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (GenerateFeedV1RequestMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type GenerateFeedV1RequestValidationError

type GenerateFeedV1RequestValidationError struct {
	// contains filtered or unexported fields
}

GenerateFeedV1RequestValidationError is the validation error returned by GenerateFeedV1Request.Validate if the designated constraints aren't met.

func (GenerateFeedV1RequestValidationError) Cause

Cause function returns cause value.

func (GenerateFeedV1RequestValidationError) Error

Error satisfies the builtin error interface

func (GenerateFeedV1RequestValidationError) ErrorName

ErrorName returns error name.

func (GenerateFeedV1RequestValidationError) Field

Field function returns field value.

func (GenerateFeedV1RequestValidationError) Key

Key function returns key value.

func (GenerateFeedV1RequestValidationError) Reason

Reason function returns reason value.

type GenerateFeedV1Response

type GenerateFeedV1Response struct {
	Posts []*Post `protobuf:"bytes,1,rep,name=posts,proto3" json:"posts,omitempty"`
	// contains filtered or unexported fields
}

func (*GenerateFeedV1Response) Descriptor deprecated

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

Deprecated: Use GenerateFeedV1Response.ProtoReflect.Descriptor instead.

func (*GenerateFeedV1Response) GetPosts

func (x *GenerateFeedV1Response) GetPosts() []*Post

func (*GenerateFeedV1Response) ProtoMessage

func (*GenerateFeedV1Response) ProtoMessage()

func (*GenerateFeedV1Response) ProtoReflect

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

func (*GenerateFeedV1Response) Reset

func (x *GenerateFeedV1Response) Reset()

func (*GenerateFeedV1Response) String

func (x *GenerateFeedV1Response) String() string

func (*GenerateFeedV1Response) Validate

func (m *GenerateFeedV1Response) Validate() error

Validate checks the field values on GenerateFeedV1Response 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 (*GenerateFeedV1Response) ValidateAll

func (m *GenerateFeedV1Response) ValidateAll() error

ValidateAll checks the field values on GenerateFeedV1Response 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 GenerateFeedV1ResponseMultiError, or nil if none found.

type GenerateFeedV1ResponseMultiError

type GenerateFeedV1ResponseMultiError []error

GenerateFeedV1ResponseMultiError is an error wrapping multiple validation errors returned by GenerateFeedV1Response.ValidateAll() if the designated constraints aren't met.

func (GenerateFeedV1ResponseMultiError) AllErrors

func (m GenerateFeedV1ResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (GenerateFeedV1ResponseMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type GenerateFeedV1ResponseValidationError

type GenerateFeedV1ResponseValidationError struct {
	// contains filtered or unexported fields
}

GenerateFeedV1ResponseValidationError is the validation error returned by GenerateFeedV1Response.Validate if the designated constraints aren't met.

func (GenerateFeedV1ResponseValidationError) Cause

Cause function returns cause value.

func (GenerateFeedV1ResponseValidationError) Error

Error satisfies the builtin error interface

func (GenerateFeedV1ResponseValidationError) ErrorName

ErrorName returns error name.

func (GenerateFeedV1ResponseValidationError) Field

Field function returns field value.

func (GenerateFeedV1ResponseValidationError) Key

Key function returns key value.

func (GenerateFeedV1ResponseValidationError) Reason

Reason function returns reason value.

type Post

type Post struct {
	Title     string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
	Author    string `protobuf:"bytes,2,opt,name=author,proto3" json:"author,omitempty"`
	Subreddit string `protobuf:"bytes,3,opt,name=subreddit,proto3" json:"subreddit,omitempty"`
	// Types that are assignable to PostType:
	//
	//	*Post_Link
	//	*Post_Content
	PostType       isPost_PostType `protobuf_oneof:"post_type"`
	Score          uint64          `protobuf:"varint,6,opt,name=score,proto3" json:"score,omitempty"`
	Promoted       bool            `protobuf:"varint,7,opt,name=promoted,proto3" json:"promoted,omitempty"`
	NotSafeForWork bool            `protobuf:"varint,8,opt,name=not_safe_for_work,json=notSafeForWork,proto3" json:"not_safe_for_work,omitempty"`
	// contains filtered or unexported fields
}

func (*Post) Descriptor deprecated

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

Deprecated: Use Post.ProtoReflect.Descriptor instead.

func (*Post) GetAuthor

func (x *Post) GetAuthor() string

func (*Post) GetContent

func (x *Post) GetContent() string
func (x *Post) GetLink() string

func (*Post) GetNotSafeForWork

func (x *Post) GetNotSafeForWork() bool

func (*Post) GetPostType

func (m *Post) GetPostType() isPost_PostType

func (*Post) GetPromoted

func (x *Post) GetPromoted() bool

func (*Post) GetScore

func (x *Post) GetScore() uint64

func (*Post) GetSubreddit

func (x *Post) GetSubreddit() string

func (*Post) GetTitle

func (x *Post) GetTitle() string

func (*Post) ProtoMessage

func (*Post) ProtoMessage()

func (*Post) ProtoReflect

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

func (*Post) Reset

func (x *Post) Reset()

func (*Post) String

func (x *Post) String() string

func (*Post) Validate

func (m *Post) Validate() error

Validate checks the field values on Post 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 (*Post) ValidateAll

func (m *Post) ValidateAll() error

ValidateAll checks the field values on Post 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 PostMultiError, or nil if none found.

type PostMultiError

type PostMultiError []error

PostMultiError is an error wrapping multiple validation errors returned by Post.ValidateAll() if the designated constraints aren't met.

func (PostMultiError) AllErrors

func (m PostMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (PostMultiError) Error

func (m PostMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type PostValidationError

type PostValidationError struct {
	// contains filtered or unexported fields
}

PostValidationError is the validation error returned by Post.Validate if the designated constraints aren't met.

func (PostValidationError) Cause

func (e PostValidationError) Cause() error

Cause function returns cause value.

func (PostValidationError) Error

func (e PostValidationError) Error() string

Error satisfies the builtin error interface

func (PostValidationError) ErrorName

func (e PostValidationError) ErrorName() string

ErrorName returns error name.

func (PostValidationError) Field

func (e PostValidationError) Field() string

Field function returns field value.

func (PostValidationError) Key

func (e PostValidationError) Key() bool

Key function returns key value.

func (PostValidationError) Reason

func (e PostValidationError) Reason() string

Reason function returns reason value.

type Post_Content

type Post_Content struct {
	Content string `protobuf:"bytes,5,opt,name=content,proto3,oneof"`
}

type Post_Link

type Post_Link struct {
	Link string `protobuf:"bytes,4,opt,name=link,proto3,oneof"`
}

type RedditFeedAPIServiceClient

type RedditFeedAPIServiceClient interface {
	// Create new posts
	CreatePostsV1(ctx context.Context, in *CreatePostsV1Request, opts ...grpc.CallOption) (*CreatePostsV1Response, error)
	// Generate a feed of posts
	GenerateFeedV1(ctx context.Context, in *GenerateFeedV1Request, opts ...grpc.CallOption) (*GenerateFeedV1Response, error)
}

RedditFeedAPIServiceClient is the client API for RedditFeedAPIService 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 RedditFeedAPIServiceServer

type RedditFeedAPIServiceServer interface {
	// Create new posts
	CreatePostsV1(context.Context, *CreatePostsV1Request) (*CreatePostsV1Response, error)
	// Generate a feed of posts
	GenerateFeedV1(context.Context, *GenerateFeedV1Request) (*GenerateFeedV1Response, error)
	// contains filtered or unexported methods
}

RedditFeedAPIServiceServer is the server API for RedditFeedAPIService service. All implementations must embed UnimplementedRedditFeedAPIServiceServer for forward compatibility

type UnimplementedRedditFeedAPIServiceServer

type UnimplementedRedditFeedAPIServiceServer struct {
}

UnimplementedRedditFeedAPIServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedRedditFeedAPIServiceServer) CreatePostsV1

func (UnimplementedRedditFeedAPIServiceServer) GenerateFeedV1

type UnsafeRedditFeedAPIServiceServer

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

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

Jump to

Keyboard shortcuts

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