Path: blob/main/components/public-api/go/v1/v1connect/token.connect.go
2501 views
// Copyright (c) 2025 Gitpod GmbH. All rights reserved.1// Licensed under the GNU Affero General Public License (AGPL).2// See License.AGPL.txt in the project root for license information.34// Code generated by protoc-gen-connect-go. DO NOT EDIT.5//6// Source: gitpod/v1/token.proto78package v1connect910import (11context "context"12errors "errors"13connect_go "github.com/bufbuild/connect-go"14v1 "github.com/gitpod-io/gitpod/components/public-api/go/v1"15http "net/http"16strings "strings"17)1819// This is a compile-time assertion to ensure that this generated file and the connect package are20// compatible. If you get a compiler error that this constant is not defined, this code was21// generated with a version of connect newer than the one compiled into your binary. You can fix the22// problem by either regenerating this code with an older version of connect or updating the connect23// version compiled into your binary.24const _ = connect_go.IsAtLeastVersion0_1_02526const (27// TokenServiceName is the fully-qualified name of the TokenService service.28TokenServiceName = "gitpod.v1.TokenService"29)3031// TokenServiceClient is a client for the gitpod.v1.TokenService service.32type TokenServiceClient interface {33// CreateUserToken creates a new temporary access token for the specified user.34// +admin – only to be used by installation admins35CreateTemporaryAccessToken(context.Context, *connect_go.Request[v1.CreateTemporaryAccessTokenRequest]) (*connect_go.Response[v1.CreateTemporaryAccessTokenResponse], error)36}3738// NewTokenServiceClient constructs a client for the gitpod.v1.TokenService service. By default, it39// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends40// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or41// connect.WithGRPCWeb() options.42//43// The URL supplied here should be the base URL for the Connect or gRPC server (for example,44// http://api.acme.com or https://acme.com/grpc).45func NewTokenServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) TokenServiceClient {46baseURL = strings.TrimRight(baseURL, "/")47return &tokenServiceClient{48createTemporaryAccessToken: connect_go.NewClient[v1.CreateTemporaryAccessTokenRequest, v1.CreateTemporaryAccessTokenResponse](49httpClient,50baseURL+"/gitpod.v1.TokenService/CreateTemporaryAccessToken",51opts...,52),53}54}5556// tokenServiceClient implements TokenServiceClient.57type tokenServiceClient struct {58createTemporaryAccessToken *connect_go.Client[v1.CreateTemporaryAccessTokenRequest, v1.CreateTemporaryAccessTokenResponse]59}6061// CreateTemporaryAccessToken calls gitpod.v1.TokenService.CreateTemporaryAccessToken.62func (c *tokenServiceClient) CreateTemporaryAccessToken(ctx context.Context, req *connect_go.Request[v1.CreateTemporaryAccessTokenRequest]) (*connect_go.Response[v1.CreateTemporaryAccessTokenResponse], error) {63return c.createTemporaryAccessToken.CallUnary(ctx, req)64}6566// TokenServiceHandler is an implementation of the gitpod.v1.TokenService service.67type TokenServiceHandler interface {68// CreateUserToken creates a new temporary access token for the specified user.69// +admin – only to be used by installation admins70CreateTemporaryAccessToken(context.Context, *connect_go.Request[v1.CreateTemporaryAccessTokenRequest]) (*connect_go.Response[v1.CreateTemporaryAccessTokenResponse], error)71}7273// NewTokenServiceHandler builds an HTTP handler from the service implementation. It returns the74// path on which to mount the handler and the handler itself.75//76// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf77// and JSON codecs. They also support gzip compression.78func NewTokenServiceHandler(svc TokenServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) {79mux := http.NewServeMux()80mux.Handle("/gitpod.v1.TokenService/CreateTemporaryAccessToken", connect_go.NewUnaryHandler(81"/gitpod.v1.TokenService/CreateTemporaryAccessToken",82svc.CreateTemporaryAccessToken,83opts...,84))85return "/gitpod.v1.TokenService/", mux86}8788// UnimplementedTokenServiceHandler returns CodeUnimplemented from all methods.89type UnimplementedTokenServiceHandler struct{}9091func (UnimplementedTokenServiceHandler) CreateTemporaryAccessToken(context.Context, *connect_go.Request[v1.CreateTemporaryAccessTokenRequest]) (*connect_go.Response[v1.CreateTemporaryAccessTokenResponse], error) {92return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.TokenService.CreateTemporaryAccessToken is not implemented"))93}949596