baidubcev1

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package baidubcev1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	OauthService_Token_FullMethodName = "/baidubce.v1.OauthService/Token"
)

Variables

View Source
var File_baidubce_v1_oauth_proto protoreflect.FileDescriptor
View Source
var File_baidubce_v1_oauth_service_proto protoreflect.FileDescriptor
View Source
var OauthService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "baidubce.v1.OauthService",
	HandlerType: (*OauthServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Token",
			Handler:    _OauthService_Token_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "baidubce/v1/oauth_service.proto",
}

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

Functions

func RegisterOauthServiceHandler

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

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

func RegisterOauthServiceHandlerClient

func RegisterOauthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client OauthServiceClient) error

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

func RegisterOauthServiceHandlerFromEndpoint

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

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

func RegisterOauthServiceHandlerServer

func RegisterOauthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server OauthServiceServer) error

RegisterOauthServiceHandlerServer registers the http handlers for service OauthService to "mux". UnaryRPC :call OauthServiceServer 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 RegisterOauthServiceHandlerFromEndpoint instead.

func RegisterOauthServiceServer

func RegisterOauthServiceServer(s grpc.ServiceRegistrar, srv OauthServiceServer)

Types

type OauthServiceClient

type OauthServiceClient interface {
	Token(ctx context.Context, in *TokenRequest, opts ...grpc.CallOption) (*TokenResponse, error)
}

OauthServiceClient is the client API for OauthService 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 OauthServiceServer

type OauthServiceServer interface {
	Token(context.Context, *TokenRequest) (*TokenResponse, error)
}

OauthServiceServer is the server API for OauthService service. All implementations should embed UnimplementedOauthServiceServer for forward compatibility

type TokenRequest

type TokenRequest struct {

	// 是 	固定为client_credentials 	client_credentials
	GrantType string `protobuf:"bytes,1,opt,name=grant_type,json=grantType,proto3" json:"grant_type,omitempty"`
	// 是 	应用的API Key,获取方式:https://ai.baidu.com/ai-doc/REFERENCE/Ck3dwjgn3 	Va***********uXV4
	ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"`
	// 是 	应用的Secret Key,获取方式:https://ai.baidu.com/ai-doc/REFERENCE/Ck3dwjgn3 	0r******************pVw2
	ClientSecret string `protobuf:"bytes,3,opt,name=client_secret,json=clientSecret,proto3" json:"client_secret,omitempty"`
	// contains filtered or unexported fields
}

func (*TokenRequest) Descriptor deprecated

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

Deprecated: Use TokenRequest.ProtoReflect.Descriptor instead.

func (*TokenRequest) GetClientId

func (x *TokenRequest) GetClientId() string

func (*TokenRequest) GetClientSecret

func (x *TokenRequest) GetClientSecret() string

func (*TokenRequest) GetGrantType

func (x *TokenRequest) GetGrantType() string

func (*TokenRequest) ProtoMessage

func (*TokenRequest) ProtoMessage()

func (*TokenRequest) ProtoReflect

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

func (*TokenRequest) Reset

func (x *TokenRequest) Reset()

func (*TokenRequest) String

func (x *TokenRequest) String() string

type TokenResponse

type TokenResponse struct {

	// 要获取的Access Token
	AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
	// 该参数忽略
	RefreshToken string `protobuf:"bytes,2,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
	// Access Token的有效期(秒为单位,有效期30天)
	ExpiresIn int32 `protobuf:"varint,3,opt,name=expires_in,json=expiresIn,proto3" json:"expires_in,omitempty"`
	// 该参数忽略
	Scope string `protobuf:"bytes,4,opt,name=scope,proto3" json:"scope,omitempty"`
	// 该参数忽略
	SessionKey string `protobuf:"bytes,5,opt,name=session_key,json=sessionKey,proto3" json:"session_key,omitempty"`
	// 该参数忽略
	SessionSecret string `protobuf:"bytes,6,opt,name=session_secret,json=sessionSecret,proto3" json:"session_secret,omitempty"`
	// contains filtered or unexported fields
}

func (*TokenResponse) Descriptor deprecated

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

Deprecated: Use TokenResponse.ProtoReflect.Descriptor instead.

func (*TokenResponse) GetAccessToken

func (x *TokenResponse) GetAccessToken() string

func (*TokenResponse) GetExpiresIn

func (x *TokenResponse) GetExpiresIn() int32

func (*TokenResponse) GetRefreshToken

func (x *TokenResponse) GetRefreshToken() string

func (*TokenResponse) GetScope

func (x *TokenResponse) GetScope() string

func (*TokenResponse) GetSessionKey

func (x *TokenResponse) GetSessionKey() string

func (*TokenResponse) GetSessionSecret

func (x *TokenResponse) GetSessionSecret() string

func (*TokenResponse) ProtoMessage

func (*TokenResponse) ProtoMessage()

func (*TokenResponse) ProtoReflect

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

func (*TokenResponse) Reset

func (x *TokenResponse) Reset()

func (*TokenResponse) String

func (x *TokenResponse) String() string

type UnimplementedOauthServiceServer

type UnimplementedOauthServiceServer struct {
}

UnimplementedOauthServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedOauthServiceServer) Token

type UnsafeOauthServiceServer

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

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

Jump to

Keyboard shortcuts

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