sdk

package
v0.0.0-...-6367170 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: MIT Imports: 18 Imported by: 0

README

Protocol Documentation

Table of Contents

Top

example.proto

CreateUserRequest

CreateUserRequest creates an account for given email and password

Field Type Label Description
user User User represents a user

CreateUserResponse

CreateUserResponse is the payload returned when a new user is created

Field Type Label Description
id string Represents the publication's unique identifier.

User

User details

Field Type Label Description
email string Represents the user's email address.
password string Represents the user's password.

UserAPI

UserAPI represents the User API server

Method Name Request Type Response Type Description
CreateUser CreateUserRequest CreateUserResponse CreateUser creates a new user for given email and password

Scalar Value Types

.proto Type Notes C++ Java Python Go C# PHP Ruby
double double double float float64 double float Float
float float float float float32 float float Float
int32 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. int32 int int int32 int integer Bignum or Fixnum (as required)
int64 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. int64 long int/long int64 long integer/string Bignum
uint32 Uses variable-length encoding. uint32 int int/long uint32 uint integer Bignum or Fixnum (as required)
uint64 Uses variable-length encoding. uint64 long int/long uint64 ulong integer/string Bignum or Fixnum (as required)
sint32 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. int32 int int int32 int integer Bignum or Fixnum (as required)
sint64 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. int64 long int/long int64 long integer/string Bignum
fixed32 Always four bytes. More efficient than uint32 if values are often greater than 2^28. uint32 int int uint32 uint integer Bignum or Fixnum (as required)
fixed64 Always eight bytes. More efficient than uint64 if values are often greater than 2^56. uint64 long int/long uint64 ulong integer/string Bignum
sfixed32 Always four bytes. int32 int int int32 int integer Bignum or Fixnum (as required)
sfixed64 Always eight bytes. int64 long int/long int64 long integer/string Bignum
bool bool boolean boolean bool bool boolean TrueClass/FalseClass
string A string must always contain UTF-8 encoded or 7-bit ASCII text. string String str/unicode string string string String (UTF-8)
bytes May contain any arbitrary sequence of bytes. string ByteString str []byte ByteString string String (ASCII-8BIT)

Documentation

Overview

Package sdk is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_example_proto protoreflect.FileDescriptor
View Source
var UserAPI_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "phogolabs.plex.example.sdk.UserAPI",
	HandlerType: (*UserAPIServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateUser",
			Handler:    _UserAPI_CreateUser_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "example.proto",
}

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

Functions

func RegisterUserAPIHandler

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

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

func RegisterUserAPIHandlerClient

func RegisterUserAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserAPIClient) error

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

func RegisterUserAPIHandlerFromEndpoint

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

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

func RegisterUserAPIHandlerServer

func RegisterUserAPIHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserAPIServer) error

RegisterUserAPIHandlerServer registers the http handlers for service UserAPI to "mux". UnaryRPC :call UserAPIServer 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 RegisterUserAPIHandlerFromEndpoint instead.

func RegisterUserAPIServer

func RegisterUserAPIServer(s grpc.ServiceRegistrar, srv UserAPIServer)

Types

type CreateUserRequest

type CreateUserRequest struct {

	// User represents a user
	User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty" validate:"required"`
	// contains filtered or unexported fields
}

CreateUserRequest creates an account for given email and password

func (*CreateUserRequest) Descriptor deprecated

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

Deprecated: Use CreateUserRequest.ProtoReflect.Descriptor instead.

func (*CreateUserRequest) GetUser

func (x *CreateUserRequest) GetUser() *User

func (*CreateUserRequest) ProtoMessage

func (*CreateUserRequest) ProtoMessage()

func (*CreateUserRequest) ProtoReflect

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

func (*CreateUserRequest) Reset

func (x *CreateUserRequest) Reset()

func (*CreateUserRequest) String

func (x *CreateUserRequest) String() string

type CreateUserResponse

type CreateUserResponse struct {

	// Represents the publication's unique identifier.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" validate:"required,gt=0,uuid"`
	// contains filtered or unexported fields
}

CreateUserResponse is the payload returned when a new user is created

func (*CreateUserResponse) Descriptor deprecated

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

Deprecated: Use CreateUserResponse.ProtoReflect.Descriptor instead.

func (*CreateUserResponse) GetId

func (x *CreateUserResponse) GetId() string

func (*CreateUserResponse) ProtoMessage

func (*CreateUserResponse) ProtoMessage()

func (*CreateUserResponse) ProtoReflect

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

func (*CreateUserResponse) Reset

func (x *CreateUserResponse) Reset()

func (*CreateUserResponse) String

func (x *CreateUserResponse) String() string

type UnimplementedUserAPIServer

type UnimplementedUserAPIServer struct {
}

UnimplementedUserAPIServer should be embedded to have forward compatible implementations.

func (UnimplementedUserAPIServer) CreateUser

type UnsafeUserAPIServer

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

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

type User

type User struct {

	// Represents the user's email address.
	Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty" validate:"required,gt=0,lte=256,email" form:"email"`
	// Represents the user's password.
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty" validate:"required,gte=8" form:"password"`
	// contains filtered or unexported fields
}

User details

func (*User) Descriptor deprecated

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

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) GetEmail

func (x *User) GetEmail() string

func (*User) GetPassword

func (x *User) GetPassword() string

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (*User) ProtoReflect

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

func (*User) Reset

func (x *User) Reset()

func (*User) String

func (x *User) String() string

type UserAPIClient

type UserAPIClient interface {
	// CreateUser creates a new user for given email and password
	CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error)
}

UserAPIClient is the client API for UserAPI 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 NewUserAPIClient

func NewUserAPIClient(cc grpc.ClientConnInterface) UserAPIClient

type UserAPIServer

type UserAPIServer interface {
	// CreateUser creates a new user for given email and password
	CreateUser(context.Context, *CreateUserRequest) (*CreateUserResponse, error)
}

UserAPIServer is the server API for UserAPI service. All implementations should embed UnimplementedUserAPIServer for forward compatibility

Jump to

Keyboard shortcuts

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