torrentV1

package
v0.0.0-...-cbca754 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package torrentV1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	TorrentService_GetTorrentV1_FullMethodName      = "/torrent.v1.TorrentService/GetTorrentV1"
	TorrentService_GetTorrentV1List_FullMethodName  = "/torrent.v1.TorrentService/GetTorrentV1List"
	TorrentService_CreateTorrentV1_FullMethodName   = "/torrent.v1.TorrentService/CreateTorrentV1"
	TorrentService_DownloadTorrentV1_FullMethodName = "/torrent.v1.TorrentService/DownloadTorrentV1"
)

Variables

View Source
var File_torrent_v1_torrent_proto protoreflect.FileDescriptor
View Source
var TorrentService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "torrent.v1.TorrentService",
	HandlerType: (*TorrentServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetTorrentV1",
			Handler:    _TorrentService_GetTorrentV1_Handler,
		},
		{
			MethodName: "GetTorrentV1List",
			Handler:    _TorrentService_GetTorrentV1List_Handler,
		},
		{
			MethodName: "CreateTorrentV1",
			Handler:    _TorrentService_CreateTorrentV1_Handler,
		},
		{
			MethodName: "DownloadTorrentV1",
			Handler:    _TorrentService_DownloadTorrentV1_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "torrent/v1/torrent.proto",
}

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

Functions

func RegisterTorrentServiceHandler

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

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

func RegisterTorrentServiceHandlerClient

func RegisterTorrentServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TorrentServiceClient) error

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

func RegisterTorrentServiceHandlerFromEndpoint

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

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

func RegisterTorrentServiceHandlerServer

func RegisterTorrentServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TorrentServiceServer) error

RegisterTorrentServiceHandlerServer registers the http handlers for service TorrentService to "mux". UnaryRPC :call TorrentServiceServer 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 RegisterTorrentServiceHandlerFromEndpoint instead. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.

func RegisterTorrentServiceServer

func RegisterTorrentServiceServer(s grpc.ServiceRegistrar, srv TorrentServiceServer)

Types

type CreateTorrentV1Request

type CreateTorrentV1Request struct {
	CategoryId string             `protobuf:"bytes,1,opt,name=categoryId,proto3" json:"categoryId,omitempty"`
	Name       string             `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Comment    string             `protobuf:"bytes,3,opt,name=comment,proto3" json:"comment,omitempty"`
	Metadata   []*TorrentMetaData `protobuf:"bytes,4,rep,name=metadata,proto3" json:"metadata,omitempty"`
	Torrent    *Torrent           `protobuf:"bytes,5,opt,name=torrent,proto3" json:"torrent,omitempty"`
	// contains filtered or unexported fields
}

CreateTorrentV1

func (*CreateTorrentV1Request) Descriptor deprecated

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

Deprecated: Use CreateTorrentV1Request.ProtoReflect.Descriptor instead.

func (*CreateTorrentV1Request) GetCategoryId

func (x *CreateTorrentV1Request) GetCategoryId() string

func (*CreateTorrentV1Request) GetComment

func (x *CreateTorrentV1Request) GetComment() string

func (*CreateTorrentV1Request) GetMetadata

func (x *CreateTorrentV1Request) GetMetadata() []*TorrentMetaData

func (*CreateTorrentV1Request) GetName

func (x *CreateTorrentV1Request) GetName() string

func (*CreateTorrentV1Request) GetTorrent

func (x *CreateTorrentV1Request) GetTorrent() *Torrent

func (*CreateTorrentV1Request) ProtoMessage

func (*CreateTorrentV1Request) ProtoMessage()

func (*CreateTorrentV1Request) ProtoReflect

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

func (*CreateTorrentV1Request) Reset

func (x *CreateTorrentV1Request) Reset()

func (*CreateTorrentV1Request) String

func (x *CreateTorrentV1Request) String() string

type CreateTorrentV1Response

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

func (*CreateTorrentV1Response) Descriptor deprecated

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

Deprecated: Use CreateTorrentV1Response.ProtoReflect.Descriptor instead.

func (*CreateTorrentV1Response) GetId

func (x *CreateTorrentV1Response) GetId() string

func (*CreateTorrentV1Response) ProtoMessage

func (*CreateTorrentV1Response) ProtoMessage()

func (*CreateTorrentV1Response) ProtoReflect

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

func (*CreateTorrentV1Response) Reset

func (x *CreateTorrentV1Response) Reset()

func (*CreateTorrentV1Response) String

func (x *CreateTorrentV1Response) String() string

type DownloadTorrentV1Request

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

DownloadTorrentV1

func (*DownloadTorrentV1Request) Descriptor deprecated

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

Deprecated: Use DownloadTorrentV1Request.ProtoReflect.Descriptor instead.

func (*DownloadTorrentV1Request) GetId

func (x *DownloadTorrentV1Request) GetId() string

func (*DownloadTorrentV1Request) ProtoMessage

func (*DownloadTorrentV1Request) ProtoMessage()

func (*DownloadTorrentV1Request) ProtoReflect

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

func (*DownloadTorrentV1Request) Reset

func (x *DownloadTorrentV1Request) Reset()

func (*DownloadTorrentV1Request) String

func (x *DownloadTorrentV1Request) String() string

type DownloadTorrentV1Response

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

func (*DownloadTorrentV1Response) Descriptor deprecated

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

Deprecated: Use DownloadTorrentV1Response.ProtoReflect.Descriptor instead.

func (*DownloadTorrentV1Response) GetData

func (x *DownloadTorrentV1Response) GetData() string

func (*DownloadTorrentV1Response) ProtoMessage

func (*DownloadTorrentV1Response) ProtoMessage()

func (*DownloadTorrentV1Response) ProtoReflect

func (*DownloadTorrentV1Response) Reset

func (x *DownloadTorrentV1Response) Reset()

func (*DownloadTorrentV1Response) String

func (x *DownloadTorrentV1Response) String() string

type GetTorrentV1ListRequest

type GetTorrentV1ListRequest struct {
	CategoryId string `protobuf:"bytes,1,opt,name=categoryId,proto3" json:"categoryId,omitempty"`
	Id         string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
	Limit      int64  `protobuf:"varint,11,opt,name=limit,proto3" json:"limit,omitempty"`
	// contains filtered or unexported fields
}

GetTorrentV1List

func (*GetTorrentV1ListRequest) Descriptor deprecated

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

Deprecated: Use GetTorrentV1ListRequest.ProtoReflect.Descriptor instead.

func (*GetTorrentV1ListRequest) GetCategoryId

func (x *GetTorrentV1ListRequest) GetCategoryId() string

func (*GetTorrentV1ListRequest) GetId

func (x *GetTorrentV1ListRequest) GetId() string

func (*GetTorrentV1ListRequest) GetLimit

func (x *GetTorrentV1ListRequest) GetLimit() int64

func (*GetTorrentV1ListRequest) ProtoMessage

func (*GetTorrentV1ListRequest) ProtoMessage()

func (*GetTorrentV1ListRequest) ProtoReflect

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

func (*GetTorrentV1ListRequest) Reset

func (x *GetTorrentV1ListRequest) Reset()

func (*GetTorrentV1ListRequest) String

func (x *GetTorrentV1ListRequest) String() string

type GetTorrentV1ListResponse

type GetTorrentV1ListResponse struct {
	Torrents []*TorrentBasic `protobuf:"bytes,1,rep,name=torrents,proto3" json:"torrents,omitempty"`
	// contains filtered or unexported fields
}

func (*GetTorrentV1ListResponse) Descriptor deprecated

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

Deprecated: Use GetTorrentV1ListResponse.ProtoReflect.Descriptor instead.

func (*GetTorrentV1ListResponse) GetTorrents

func (x *GetTorrentV1ListResponse) GetTorrents() []*TorrentBasic

func (*GetTorrentV1ListResponse) ProtoMessage

func (*GetTorrentV1ListResponse) ProtoMessage()

func (*GetTorrentV1ListResponse) ProtoReflect

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

func (*GetTorrentV1ListResponse) Reset

func (x *GetTorrentV1ListResponse) Reset()

func (*GetTorrentV1ListResponse) String

func (x *GetTorrentV1ListResponse) String() string

type GetTorrentV1Request

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

GetTorrentV1

func (*GetTorrentV1Request) Descriptor deprecated

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

Deprecated: Use GetTorrentV1Request.ProtoReflect.Descriptor instead.

func (*GetTorrentV1Request) GetId

func (x *GetTorrentV1Request) GetId() string

func (*GetTorrentV1Request) ProtoMessage

func (*GetTorrentV1Request) ProtoMessage()

func (*GetTorrentV1Request) ProtoReflect

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

func (*GetTorrentV1Request) Reset

func (x *GetTorrentV1Request) Reset()

func (*GetTorrentV1Request) String

func (x *GetTorrentV1Request) String() string

type GetTorrentV1Response

type GetTorrentV1Response struct {
	Metadata []*TorrentMetaData `protobuf:"bytes,1,rep,name=metadata,proto3" json:"metadata,omitempty"`
	// contains filtered or unexported fields
}

func (*GetTorrentV1Response) Descriptor deprecated

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

Deprecated: Use GetTorrentV1Response.ProtoReflect.Descriptor instead.

func (*GetTorrentV1Response) GetMetadata

func (x *GetTorrentV1Response) GetMetadata() []*TorrentMetaData

func (*GetTorrentV1Response) ProtoMessage

func (*GetTorrentV1Response) ProtoMessage()

func (*GetTorrentV1Response) ProtoReflect

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

func (*GetTorrentV1Response) Reset

func (x *GetTorrentV1Response) Reset()

func (*GetTorrentV1Response) String

func (x *GetTorrentV1Response) String() string

type Torrent

type Torrent struct {
	Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*Torrent) Descriptor deprecated

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

Deprecated: Use Torrent.ProtoReflect.Descriptor instead.

func (*Torrent) GetData

func (x *Torrent) GetData() []byte

func (*Torrent) ProtoMessage

func (*Torrent) ProtoMessage()

func (*Torrent) ProtoReflect

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

func (*Torrent) Reset

func (x *Torrent) Reset()

func (*Torrent) String

func (x *Torrent) String() string

type TorrentBasic

type TorrentBasic struct {
	Id           string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Name         string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Description  string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
	CategoryId   string `protobuf:"bytes,4,opt,name=categoryId,proto3" json:"categoryId,omitempty"`
	CategoryName string `protobuf:"bytes,5,opt,name=categoryName,proto3" json:"categoryName,omitempty"`
	// contains filtered or unexported fields
}

func (*TorrentBasic) Descriptor deprecated

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

Deprecated: Use TorrentBasic.ProtoReflect.Descriptor instead.

func (*TorrentBasic) GetCategoryId

func (x *TorrentBasic) GetCategoryId() string

func (*TorrentBasic) GetCategoryName

func (x *TorrentBasic) GetCategoryName() string

func (*TorrentBasic) GetDescription

func (x *TorrentBasic) GetDescription() string

func (*TorrentBasic) GetId

func (x *TorrentBasic) GetId() string

func (*TorrentBasic) GetName

func (x *TorrentBasic) GetName() string

func (*TorrentBasic) ProtoMessage

func (*TorrentBasic) ProtoMessage()

func (*TorrentBasic) ProtoReflect

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

func (*TorrentBasic) Reset

func (x *TorrentBasic) Reset()

func (*TorrentBasic) String

func (x *TorrentBasic) String() string

type TorrentMetaData

type TorrentMetaData struct {
	Id          string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	CategoryId  string `protobuf:"bytes,2,opt,name=categoryId,proto3" json:"categoryId,omitempty"`
	TorrentId   string `protobuf:"bytes,3,opt,name=torrentId,proto3" json:"torrentId,omitempty"`
	Key         string `protobuf:"bytes,4,opt,name=key,proto3" json:"key,omitempty"`
	Order       int32  `protobuf:"varint,5,opt,name=order,proto3" json:"order,omitempty"`
	Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"`
	Type        string `protobuf:"bytes,7,opt,name=type,proto3" json:"type,omitempty"`
	Value       string `protobuf:"bytes,8,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*TorrentMetaData) Descriptor deprecated

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

Deprecated: Use TorrentMetaData.ProtoReflect.Descriptor instead.

func (*TorrentMetaData) GetCategoryId

func (x *TorrentMetaData) GetCategoryId() string

func (*TorrentMetaData) GetDescription

func (x *TorrentMetaData) GetDescription() string

func (*TorrentMetaData) GetId

func (x *TorrentMetaData) GetId() string

func (*TorrentMetaData) GetKey

func (x *TorrentMetaData) GetKey() string

func (*TorrentMetaData) GetOrder

func (x *TorrentMetaData) GetOrder() int32

func (*TorrentMetaData) GetTorrentId

func (x *TorrentMetaData) GetTorrentId() string

func (*TorrentMetaData) GetType

func (x *TorrentMetaData) GetType() string

func (*TorrentMetaData) GetValue

func (x *TorrentMetaData) GetValue() string

func (*TorrentMetaData) ProtoMessage

func (*TorrentMetaData) ProtoMessage()

func (*TorrentMetaData) ProtoReflect

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

func (*TorrentMetaData) Reset

func (x *TorrentMetaData) Reset()

func (*TorrentMetaData) String

func (x *TorrentMetaData) String() string

type TorrentServiceClient

type TorrentServiceClient interface {
	// GetTorrentV1
	// @Description
	// Get torrent by id, return torrent data
	// The file follows the torrent file format V1.
	// @Param GetTorrentV1Request
	// @Return GetTorrentV1Response
	// @Http GET /gapi/torrent/v1/info
	GetTorrentV1(ctx context.Context, in *GetTorrentV1Request, opts ...grpc.CallOption) (*GetTorrentV1Response, error)
	GetTorrentV1List(ctx context.Context, in *GetTorrentV1ListRequest, opts ...grpc.CallOption) (*GetTorrentV1ListResponse, error)
	// CreateTorrentV1
	// @Description
	// Create torrent, return torrent id
	// The file follows the torrent file format V1.
	// @Param CreateTorrentV1Request
	// @Return CreateTorrentV1Response
	// @Http POST /gapi/torrent/v1/info
	CreateTorrentV1(ctx context.Context, in *CreateTorrentV1Request, opts ...grpc.CallOption) (*CreateTorrentV1Response, error)
	DownloadTorrentV1(ctx context.Context, in *DownloadTorrentV1Request, opts ...grpc.CallOption) (*DownloadTorrentV1Response, error)
}

TorrentServiceClient is the client API for TorrentService 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 TorrentServiceServer

type TorrentServiceServer interface {
	// GetTorrentV1
	// @Description
	// Get torrent by id, return torrent data
	// The file follows the torrent file format V1.
	// @Param GetTorrentV1Request
	// @Return GetTorrentV1Response
	// @Http GET /gapi/torrent/v1/info
	GetTorrentV1(context.Context, *GetTorrentV1Request) (*GetTorrentV1Response, error)
	GetTorrentV1List(context.Context, *GetTorrentV1ListRequest) (*GetTorrentV1ListResponse, error)
	// CreateTorrentV1
	// @Description
	// Create torrent, return torrent id
	// The file follows the torrent file format V1.
	// @Param CreateTorrentV1Request
	// @Return CreateTorrentV1Response
	// @Http POST /gapi/torrent/v1/info
	CreateTorrentV1(context.Context, *CreateTorrentV1Request) (*CreateTorrentV1Response, error)
	DownloadTorrentV1(context.Context, *DownloadTorrentV1Request) (*DownloadTorrentV1Response, error)
	// contains filtered or unexported methods
}

TorrentServiceServer is the server API for TorrentService service. All implementations must embed UnimplementedTorrentServiceServer for forward compatibility.

type UnimplementedTorrentServiceServer

type UnimplementedTorrentServiceServer struct{}

UnimplementedTorrentServiceServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedTorrentServiceServer) CreateTorrentV1

func (UnimplementedTorrentServiceServer) DownloadTorrentV1

func (UnimplementedTorrentServiceServer) GetTorrentV1

func (UnimplementedTorrentServiceServer) GetTorrentV1List

type UnsafeTorrentServiceServer

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

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

Jump to

Keyboard shortcuts

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