tenantv1connect

package
v0.0.0-...-5eacf0a Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TenantServiceName is the fully-qualified name of the TenantService service.
	TenantServiceName = "tenant.v1.TenantService"
)

Variables

This section is empty.

Functions

func NewTenantServiceHandler

func NewTenantServiceHandler(svc TenantServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler)

NewTenantServiceHandler builds an HTTP handler from the service implementation. It returns the path on which to mount the handler and the handler itself.

By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf and JSON codecs. They also support gzip compression.

Types

type TenantServiceClient

type TenantServiceClient interface {
	// AuthorizedUser returns the user that's currently authorized.
	// This can be used to check if the user is logged in.
	AuthorizedUser(context.Context, *connect_go.Request[v1.AuthorizedUserRequest]) (*connect_go.Response[v1.AuthorizedUserResponse], error)
	// CreateAPIKey creates a new API key for the authorized user.
	CreateAPIKey(context.Context, *connect_go.Request[v1.CreateAPIKeyRequest]) (*connect_go.Response[v1.CreateAPIKeyResponse], error)
	// ListAPIKeys lists the API keys for the authorized user.
	ListAPIKeys(context.Context, *connect_go.Request[v1.ListAPIKeysRequest]) (*connect_go.Response[v1.ListAPIKeysResponse], error)
	// DeleteAPIKey deletes an API key for the authorized user.
	DeleteAPIKey(context.Context, *connect_go.Request[v1.DeleteAPIKeyRequest]) (*connect_go.Response[v1.DeleteAPIKeyResponse], error)
	// OAuthLink allows users to make a number of links to external services.
	// For any given provider, this endpoint may return a setup URL that the
	// user can visit to authorize the service, or an object describing the
	// current state of the link.
	OAuthLink(context.Context, *connect_go.Request[v1.OAuthLinkRequest]) (*connect_go.Response[v1.OAuthLinkResponse], error)
	// UpdateUser updates the user's profile.
	UpdateUser(context.Context, *connect_go.Request[v1.UpdateUserRequest]) (*connect_go.Response[v1.UpdateUserResponse], error)
	// Usage queries the users usage statistics for the current period.
	Usage(context.Context, *connect_go.Request[v1.UsageRequest]) (*connect_go.Response[v1.UsageResponse], error)
	// UpdateSubscription updates the user's subscription.
	UpdateSubscription(context.Context, *connect_go.Request[v1.UpdateSubscriptionRequest]) (*connect_go.Response[v1.UpdateSubscriptionResponse], error)
}

TenantServiceClient is a client for the tenant.v1.TenantService service.

func NewTenantServiceClient

func NewTenantServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) TenantServiceClient

NewTenantServiceClient constructs a client for the tenant.v1.TenantService service. By default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or connect.WithGRPCWeb() options.

The URL supplied here should be the base URL for the Connect or gRPC server (for example, http://api.acme.com or https://acme.com/grpc).

type TenantServiceHandler

type TenantServiceHandler interface {
	// AuthorizedUser returns the user that's currently authorized.
	// This can be used to check if the user is logged in.
	AuthorizedUser(context.Context, *connect_go.Request[v1.AuthorizedUserRequest]) (*connect_go.Response[v1.AuthorizedUserResponse], error)
	// CreateAPIKey creates a new API key for the authorized user.
	CreateAPIKey(context.Context, *connect_go.Request[v1.CreateAPIKeyRequest]) (*connect_go.Response[v1.CreateAPIKeyResponse], error)
	// ListAPIKeys lists the API keys for the authorized user.
	ListAPIKeys(context.Context, *connect_go.Request[v1.ListAPIKeysRequest]) (*connect_go.Response[v1.ListAPIKeysResponse], error)
	// DeleteAPIKey deletes an API key for the authorized user.
	DeleteAPIKey(context.Context, *connect_go.Request[v1.DeleteAPIKeyRequest]) (*connect_go.Response[v1.DeleteAPIKeyResponse], error)
	// OAuthLink allows users to make a number of links to external services.
	// For any given provider, this endpoint may return a setup URL that the
	// user can visit to authorize the service, or an object describing the
	// current state of the link.
	OAuthLink(context.Context, *connect_go.Request[v1.OAuthLinkRequest]) (*connect_go.Response[v1.OAuthLinkResponse], error)
	// UpdateUser updates the user's profile.
	UpdateUser(context.Context, *connect_go.Request[v1.UpdateUserRequest]) (*connect_go.Response[v1.UpdateUserResponse], error)
	// Usage queries the users usage statistics for the current period.
	Usage(context.Context, *connect_go.Request[v1.UsageRequest]) (*connect_go.Response[v1.UsageResponse], error)
	// UpdateSubscription updates the user's subscription.
	UpdateSubscription(context.Context, *connect_go.Request[v1.UpdateSubscriptionRequest]) (*connect_go.Response[v1.UpdateSubscriptionResponse], error)
}

TenantServiceHandler is an implementation of the tenant.v1.TenantService service.

type UnimplementedTenantServiceHandler

type UnimplementedTenantServiceHandler struct{}

UnimplementedTenantServiceHandler returns CodeUnimplemented from all methods.

Jump to

Keyboard shortcuts

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