scraper

package
v0.0.0-...-7253cd6 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2023 License: BSL-1.0 Imports: 30 Imported by: 0

Documentation

Overview

Package scraper is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	ScraperService_Scrape_FullMethodName = "/scraper.service.v1.ScraperService/Scrape"
)

Variables

View Source
var File_scraper_service_v1_scraper_proto protoreflect.FileDescriptor
View Source
var ScraperService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "scraper.service.v1.ScraperService",
	HandlerType: (*ScraperServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Scrape",
			Handler:    _ScraperService_Scrape_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "scraper/service/v1/scraper.proto",
}

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

Functions

func RegisterScraperServiceHandler

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

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

func RegisterScraperServiceHandlerClient

func RegisterScraperServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ScraperServiceClient) error

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

func RegisterScraperServiceHandlerFromEndpoint

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

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

func RegisterScraperServiceHandlerServer

func RegisterScraperServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ScraperServiceServer) error

RegisterScraperServiceHandlerServer registers the http handlers for service ScraperService to "mux". UnaryRPC :call ScraperServiceServer 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 RegisterScraperServiceHandlerFromEndpoint instead.

func RegisterScraperServiceServer

func RegisterScraperServiceServer(s grpc.ServiceRegistrar, srv ScraperServiceServer)

Types

type ScrapeRequest

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

func (*ScrapeRequest) Descriptor deprecated

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

Deprecated: Use ScrapeRequest.ProtoReflect.Descriptor instead.

func (*ScrapeRequest) GetUrl

func (x *ScrapeRequest) GetUrl() string

func (*ScrapeRequest) ProtoMessage

func (*ScrapeRequest) ProtoMessage()

func (*ScrapeRequest) ProtoReflect

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

func (*ScrapeRequest) Reset

func (x *ScrapeRequest) Reset()

func (*ScrapeRequest) String

func (x *ScrapeRequest) String() string

func (*ScrapeRequest) Validate

func (m *ScrapeRequest) Validate() error

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

func (m *ScrapeRequest) ValidateAll() error

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

type ScrapeRequestMultiError

type ScrapeRequestMultiError []error

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

func (ScrapeRequestMultiError) AllErrors

func (m ScrapeRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (ScrapeRequestMultiError) Error

func (m ScrapeRequestMultiError) Error() string

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

type ScrapeRequestValidationError

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

ScrapeRequestValidationError is the validation error returned by ScrapeRequest.Validate if the designated constraints aren't met.

func (ScrapeRequestValidationError) Cause

Cause function returns cause value.

func (ScrapeRequestValidationError) Error

Error satisfies the builtin error interface

func (ScrapeRequestValidationError) ErrorName

func (e ScrapeRequestValidationError) ErrorName() string

ErrorName returns error name.

func (ScrapeRequestValidationError) Field

Field function returns field value.

func (ScrapeRequestValidationError) Key

Key function returns key value.

func (ScrapeRequestValidationError) Reason

Reason function returns reason value.

type ScrapeResponse

type ScrapeResponse struct {
	Anime *v1.Anime `protobuf:"bytes,1,opt,name=anime,proto3" json:"anime,omitempty"`
	// contains filtered or unexported fields
}

func (*ScrapeResponse) Descriptor deprecated

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

Deprecated: Use ScrapeResponse.ProtoReflect.Descriptor instead.

func (*ScrapeResponse) GetAnime

func (x *ScrapeResponse) GetAnime() *v1.Anime

func (*ScrapeResponse) ProtoMessage

func (*ScrapeResponse) ProtoMessage()

func (*ScrapeResponse) ProtoReflect

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

func (*ScrapeResponse) Reset

func (x *ScrapeResponse) Reset()

func (*ScrapeResponse) String

func (x *ScrapeResponse) String() string

func (*ScrapeResponse) Validate

func (m *ScrapeResponse) Validate() error

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

func (m *ScrapeResponse) ValidateAll() error

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

type ScrapeResponseMultiError

type ScrapeResponseMultiError []error

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

func (ScrapeResponseMultiError) AllErrors

func (m ScrapeResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (ScrapeResponseMultiError) Error

func (m ScrapeResponseMultiError) Error() string

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

type ScrapeResponseValidationError

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

ScrapeResponseValidationError is the validation error returned by ScrapeResponse.Validate if the designated constraints aren't met.

func (ScrapeResponseValidationError) Cause

Cause function returns cause value.

func (ScrapeResponseValidationError) Error

Error satisfies the builtin error interface

func (ScrapeResponseValidationError) ErrorName

func (e ScrapeResponseValidationError) ErrorName() string

ErrorName returns error name.

func (ScrapeResponseValidationError) Field

Field function returns field value.

func (ScrapeResponseValidationError) Key

Key function returns key value.

func (ScrapeResponseValidationError) Reason

Reason function returns reason value.

type ScraperServiceClient

type ScraperServiceClient interface {
	Scrape(ctx context.Context, in *ScrapeRequest, opts ...grpc.CallOption) (*ScrapeResponse, error)
}

ScraperServiceClient is the client API for ScraperService 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 ScraperServiceServer

type ScraperServiceServer interface {
	Scrape(context.Context, *ScrapeRequest) (*ScrapeResponse, error)
	// contains filtered or unexported methods
}

ScraperServiceServer is the server API for ScraperService service. All implementations must embed UnimplementedScraperServiceServer for forward compatibility

type UnimplementedScraperServiceServer

type UnimplementedScraperServiceServer struct {
}

UnimplementedScraperServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedScraperServiceServer) Scrape

type UnsafeScraperServiceServer

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

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

Jump to

Keyboard shortcuts

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