libra_ptapi_v1

package
v0.0.0-...-baae4bf Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package libra_ptapi_v1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_ptapi_v1_account_proto protoreflect.FileDescriptor

Functions

func RegisterAccountHandler

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

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

func RegisterAccountHandlerClient

func RegisterAccountHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AccountClient) error

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

func RegisterAccountHandlerFromEndpoint

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

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

func RegisterAccountHandlerServer

func RegisterAccountHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AccountServer) error

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

func RegisterAccountServer

func RegisterAccountServer(s *grpc.Server, srv AccountServer)

Types

type AccountClient

type AccountClient interface {
	Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error)
	ListRoles(ctx context.Context, in *ListRolesRequest, opts ...grpc.CallOption) (*ListRolesResponse, error)
	CreateRole(ctx context.Context, in *CreateRoleRequest, opts ...grpc.CallOption) (*CreateRoleResponse, error)
	SignIn(ctx context.Context, in *SignInRequest, opts ...grpc.CallOption) (*SignInResponse, error)
	SetUserMetadata(ctx context.Context, in *SetUserMetadataRequest, opts ...grpc.CallOption) (*SetUserMetadataResponse, error)
	SetRoleMetadata(ctx context.Context, in *SetRoleMetadataRequest, opts ...grpc.CallOption) (*SetRoleMetadataResponse, error)
}

AccountClient is the client API for Account 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 NewAccountClient

func NewAccountClient(cc grpc.ClientConnInterface) AccountClient

type AccountServer

AccountServer is the server API for Account service. All implementations must embed UnimplementedAccountServer for forward compatibility

type CreateRoleRequest

type CreateRoleRequest struct {
	AppId string `protobuf:"bytes,1,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"`
	Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"`
	Index int32  `protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"` // role index to prevent duplicate creation
	// contains filtered or unexported fields
}

func (*CreateRoleRequest) Descriptor deprecated

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

Deprecated: Use CreateRoleRequest.ProtoReflect.Descriptor instead.

func (*CreateRoleRequest) GetAppId

func (x *CreateRoleRequest) GetAppId() string

func (*CreateRoleRequest) GetIndex

func (x *CreateRoleRequest) GetIndex() int32

func (*CreateRoleRequest) GetToken

func (x *CreateRoleRequest) GetToken() string

func (*CreateRoleRequest) ProtoMessage

func (*CreateRoleRequest) ProtoMessage()

func (*CreateRoleRequest) ProtoReflect

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

func (*CreateRoleRequest) Reset

func (x *CreateRoleRequest) Reset()

func (*CreateRoleRequest) String

func (x *CreateRoleRequest) String() string

type CreateRoleResponse

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

func (*CreateRoleResponse) Descriptor deprecated

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

Deprecated: Use CreateRoleResponse.ProtoReflect.Descriptor instead.

func (*CreateRoleResponse) GetRole

func (x *CreateRoleResponse) GetRole() *Role

func (*CreateRoleResponse) ProtoMessage

func (*CreateRoleResponse) ProtoMessage()

func (*CreateRoleResponse) ProtoReflect

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

func (*CreateRoleResponse) Reset

func (x *CreateRoleResponse) Reset()

func (*CreateRoleResponse) String

func (x *CreateRoleResponse) String() string

type ListRolesRequest

type ListRolesRequest struct {
	AppId string `protobuf:"bytes,1,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"`
	Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"`
	// contains filtered or unexported fields
}

func (*ListRolesRequest) Descriptor deprecated

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

Deprecated: Use ListRolesRequest.ProtoReflect.Descriptor instead.

func (*ListRolesRequest) GetAppId

func (x *ListRolesRequest) GetAppId() string

func (*ListRolesRequest) GetToken

func (x *ListRolesRequest) GetToken() string

func (*ListRolesRequest) ProtoMessage

func (*ListRolesRequest) ProtoMessage()

func (*ListRolesRequest) ProtoReflect

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

func (*ListRolesRequest) Reset

func (x *ListRolesRequest) Reset()

func (*ListRolesRequest) String

func (x *ListRolesRequest) String() string

type ListRolesResponse

type ListRolesResponse struct {
	Roles []*Role `protobuf:"bytes,1,rep,name=roles,proto3" json:"roles,omitempty"`
	// contains filtered or unexported fields
}

func (*ListRolesResponse) Descriptor deprecated

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

Deprecated: Use ListRolesResponse.ProtoReflect.Descriptor instead.

func (*ListRolesResponse) GetRoles

func (x *ListRolesResponse) GetRoles() []*Role

func (*ListRolesResponse) ProtoMessage

func (*ListRolesResponse) ProtoMessage()

func (*ListRolesResponse) ProtoReflect

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

func (*ListRolesResponse) Reset

func (x *ListRolesResponse) Reset()

func (*ListRolesResponse) String

func (x *ListRolesResponse) String() string

type LoginRequest

type LoginRequest struct {
	AppId string   `protobuf:"bytes,1,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"`
	State *any.Any `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"`
	// contains filtered or unexported fields
}

func (*LoginRequest) Descriptor deprecated

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

Deprecated: Use LoginRequest.ProtoReflect.Descriptor instead.

func (*LoginRequest) GetAppId

func (x *LoginRequest) GetAppId() string

func (*LoginRequest) GetState

func (x *LoginRequest) GetState() *any.Any

func (*LoginRequest) ProtoMessage

func (*LoginRequest) ProtoMessage()

func (*LoginRequest) ProtoReflect

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

func (*LoginRequest) Reset

func (x *LoginRequest) Reset()

func (*LoginRequest) String

func (x *LoginRequest) String() string

type LoginResponse

type LoginResponse struct {

	// Token will be set to cookie "x-libra-token" as well.
	// A token field should be set to request if cookie is not supported.
	// Both cookie and field are set, cookie is preferred.
	Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
	User  *User  `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"`
	// contains filtered or unexported fields
}

func (*LoginResponse) Descriptor deprecated

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

Deprecated: Use LoginResponse.ProtoReflect.Descriptor instead.

func (*LoginResponse) GetToken

func (x *LoginResponse) GetToken() string

func (*LoginResponse) GetUser

func (x *LoginResponse) GetUser() *User

func (*LoginResponse) ProtoMessage

func (*LoginResponse) ProtoMessage()

func (*LoginResponse) ProtoReflect

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

func (*LoginResponse) Reset

func (x *LoginResponse) Reset()

func (*LoginResponse) String

func (x *LoginResponse) String() string

type Role

type Role struct {

	// primary key
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// union key
	AppId  string `protobuf:"bytes,2,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"`
	UserId string `protobuf:"bytes,3,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	// custom key-value metadata
	Metadata map[string]string `` /* 158-byte string literal not displayed */
	// contains filtered or unexported fields
}

Instances of role are mapped from tuple(app, user) Multiple roles could be created in one app by the same user

func (*Role) Descriptor deprecated

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

Deprecated: Use Role.ProtoReflect.Descriptor instead.

func (*Role) GetAppId

func (x *Role) GetAppId() string

func (*Role) GetId

func (x *Role) GetId() string

func (*Role) GetMetadata

func (x *Role) GetMetadata() map[string]string

func (*Role) GetUserId

func (x *Role) GetUserId() string

func (*Role) ProtoMessage

func (*Role) ProtoMessage()

func (*Role) ProtoReflect

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

func (*Role) Reset

func (x *Role) Reset()

func (*Role) String

func (x *Role) String() string

type SetRoleMetadataRequest

type SetRoleMetadataRequest struct {
	AppId    string            `protobuf:"bytes,1,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"`
	Token    string            `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"`
	RoleId   string            `protobuf:"bytes,3,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"`
	Metadata map[string]string `` /* 157-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*SetRoleMetadataRequest) Descriptor deprecated

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

Deprecated: Use SetRoleMetadataRequest.ProtoReflect.Descriptor instead.

func (*SetRoleMetadataRequest) GetAppId

func (x *SetRoleMetadataRequest) GetAppId() string

func (*SetRoleMetadataRequest) GetMetadata

func (x *SetRoleMetadataRequest) GetMetadata() map[string]string

func (*SetRoleMetadataRequest) GetRoleId

func (x *SetRoleMetadataRequest) GetRoleId() string

func (*SetRoleMetadataRequest) GetToken

func (x *SetRoleMetadataRequest) GetToken() string

func (*SetRoleMetadataRequest) ProtoMessage

func (*SetRoleMetadataRequest) ProtoMessage()

func (*SetRoleMetadataRequest) ProtoReflect

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

func (*SetRoleMetadataRequest) Reset

func (x *SetRoleMetadataRequest) Reset()

func (*SetRoleMetadataRequest) String

func (x *SetRoleMetadataRequest) String() string

type SetRoleMetadataResponse

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

func (*SetRoleMetadataResponse) Descriptor deprecated

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

Deprecated: Use SetRoleMetadataResponse.ProtoReflect.Descriptor instead.

func (*SetRoleMetadataResponse) ProtoMessage

func (*SetRoleMetadataResponse) ProtoMessage()

func (*SetRoleMetadataResponse) ProtoReflect

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

func (*SetRoleMetadataResponse) Reset

func (x *SetRoleMetadataResponse) Reset()

func (*SetRoleMetadataResponse) String

func (x *SetRoleMetadataResponse) String() string

type SetUserMetadataRequest

type SetUserMetadataRequest struct {
	AppId    string            `protobuf:"bytes,1,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"`
	Token    string            `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"`
	Metadata map[string]string `` /* 157-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*SetUserMetadataRequest) Descriptor deprecated

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

Deprecated: Use SetUserMetadataRequest.ProtoReflect.Descriptor instead.

func (*SetUserMetadataRequest) GetAppId

func (x *SetUserMetadataRequest) GetAppId() string

func (*SetUserMetadataRequest) GetMetadata

func (x *SetUserMetadataRequest) GetMetadata() map[string]string

func (*SetUserMetadataRequest) GetToken

func (x *SetUserMetadataRequest) GetToken() string

func (*SetUserMetadataRequest) ProtoMessage

func (*SetUserMetadataRequest) ProtoMessage()

func (*SetUserMetadataRequest) ProtoReflect

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

func (*SetUserMetadataRequest) Reset

func (x *SetUserMetadataRequest) Reset()

func (*SetUserMetadataRequest) String

func (x *SetUserMetadataRequest) String() string

type SetUserMetadataResponse

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

func (*SetUserMetadataResponse) Descriptor deprecated

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

Deprecated: Use SetUserMetadataResponse.ProtoReflect.Descriptor instead.

func (*SetUserMetadataResponse) ProtoMessage

func (*SetUserMetadataResponse) ProtoMessage()

func (*SetUserMetadataResponse) ProtoReflect

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

func (*SetUserMetadataResponse) Reset

func (x *SetUserMetadataResponse) Reset()

func (*SetUserMetadataResponse) String

func (x *SetUserMetadataResponse) String() string

type SignInRequest

type SignInRequest struct {
	AppId  string `protobuf:"bytes,1,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"`
	Token  string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"`
	RoleId string `protobuf:"bytes,3,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"`
	// contains filtered or unexported fields
}

func (*SignInRequest) Descriptor deprecated

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

Deprecated: Use SignInRequest.ProtoReflect.Descriptor instead.

func (*SignInRequest) GetAppId

func (x *SignInRequest) GetAppId() string

func (*SignInRequest) GetRoleId

func (x *SignInRequest) GetRoleId() string

func (*SignInRequest) GetToken

func (x *SignInRequest) GetToken() string

func (*SignInRequest) ProtoMessage

func (*SignInRequest) ProtoMessage()

func (*SignInRequest) ProtoReflect

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

func (*SignInRequest) Reset

func (x *SignInRequest) Reset()

func (*SignInRequest) String

func (x *SignInRequest) String() string

type SignInResponse

type SignInResponse struct {
	Ticket string `protobuf:"bytes,1,opt,name=ticket,proto3" json:"ticket,omitempty"`
	Role   *Role  `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"`
	// contains filtered or unexported fields
}

func (*SignInResponse) Descriptor deprecated

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

Deprecated: Use SignInResponse.ProtoReflect.Descriptor instead.

func (*SignInResponse) GetRole

func (x *SignInResponse) GetRole() *Role

func (*SignInResponse) GetTicket

func (x *SignInResponse) GetTicket() string

func (*SignInResponse) ProtoMessage

func (*SignInResponse) ProtoMessage()

func (*SignInResponse) ProtoReflect

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

func (*SignInResponse) Reset

func (x *SignInResponse) Reset()

func (*SignInResponse) String

func (x *SignInResponse) String() string

type UnimplementedAccountServer

type UnimplementedAccountServer struct {
}

UnimplementedAccountServer must be embedded to have forward compatible implementations.

func (*UnimplementedAccountServer) CreateRole

func (*UnimplementedAccountServer) ListRoles

func (*UnimplementedAccountServer) Login

func (*UnimplementedAccountServer) SetRoleMetadata

func (*UnimplementedAccountServer) SetUserMetadata

func (*UnimplementedAccountServer) SignIn

type User

type User struct {

	// primary key
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// union key
	AppId   string `protobuf:"bytes,2,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"`
	AcctSrc string `protobuf:"bytes,3,opt,name=acct_src,json=acctSrc,proto3" json:"acct_src,omitempty"`
	AcctId  string `protobuf:"bytes,4,opt,name=acct_id,json=acctId,proto3" json:"acct_id,omitempty"`
	// custom key-value metadata
	Metadata map[string]string `` /* 158-byte string literal not displayed */
	// contains filtered or unexported fields
}

An instance of user is mapped from tuple(app, acct_src, acct_id).

func (*User) Descriptor deprecated

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

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) GetAcctId

func (x *User) GetAcctId() string

func (*User) GetAcctSrc

func (x *User) GetAcctSrc() string

func (*User) GetAppId

func (x *User) GetAppId() string

func (*User) GetId

func (x *User) GetId() string

func (*User) GetMetadata

func (x *User) GetMetadata() map[string]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

Jump to

Keyboard shortcuts

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