Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/public-api/go/experimental/v1/v1connect/stats.connect.go
2501 views
1
// Copyright (c) 2025 Gitpod GmbH. All rights reserved.
2
// Licensed under the GNU Affero General Public License (AGPL).
3
// See License.AGPL.txt in the project root for license information.
4
5
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
6
//
7
// Source: gitpod/experimental/v1/stats.proto
8
9
package v1connect
10
11
import (
12
context "context"
13
errors "errors"
14
connect_go "github.com/bufbuild/connect-go"
15
v1 "github.com/gitpod-io/gitpod/components/public-api/go/experimental/v1"
16
http "net/http"
17
strings "strings"
18
)
19
20
// This is a compile-time assertion to ensure that this generated file and the connect package are
21
// compatible. If you get a compiler error that this constant is not defined, this code was
22
// generated with a version of connect newer than the one compiled into your binary. You can fix the
23
// problem by either regenerating this code with an older version of connect or updating the connect
24
// version compiled into your binary.
25
const _ = connect_go.IsAtLeastVersion0_1_0
26
27
const (
28
// StatsServiceName is the fully-qualified name of the StatsService service.
29
StatsServiceName = "gitpod.experimental.v1.StatsService"
30
)
31
32
// StatsServiceClient is a client for the gitpod.experimental.v1.StatsService service.
33
type StatsServiceClient interface {
34
// Retrieves the current user stats
35
GetUserStats(context.Context, *connect_go.Request[v1.GetUserStatsRequest]) (*connect_go.Response[v1.GetUserStatsResponse], error)
36
}
37
38
// NewStatsServiceClient constructs a client for the gitpod.experimental.v1.StatsService service. By
39
// default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses,
40
// and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the
41
// connect.WithGRPC() or 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).
45
func NewStatsServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) StatsServiceClient {
46
baseURL = strings.TrimRight(baseURL, "/")
47
return &statsServiceClient{
48
getUserStats: connect_go.NewClient[v1.GetUserStatsRequest, v1.GetUserStatsResponse](
49
httpClient,
50
baseURL+"/gitpod.experimental.v1.StatsService/GetUserStats",
51
opts...,
52
),
53
}
54
}
55
56
// statsServiceClient implements StatsServiceClient.
57
type statsServiceClient struct {
58
getUserStats *connect_go.Client[v1.GetUserStatsRequest, v1.GetUserStatsResponse]
59
}
60
61
// GetUserStats calls gitpod.experimental.v1.StatsService.GetUserStats.
62
func (c *statsServiceClient) GetUserStats(ctx context.Context, req *connect_go.Request[v1.GetUserStatsRequest]) (*connect_go.Response[v1.GetUserStatsResponse], error) {
63
return c.getUserStats.CallUnary(ctx, req)
64
}
65
66
// StatsServiceHandler is an implementation of the gitpod.experimental.v1.StatsService service.
67
type StatsServiceHandler interface {
68
// Retrieves the current user stats
69
GetUserStats(context.Context, *connect_go.Request[v1.GetUserStatsRequest]) (*connect_go.Response[v1.GetUserStatsResponse], error)
70
}
71
72
// NewStatsServiceHandler builds an HTTP handler from the service implementation. It returns the
73
// path on which to mount the handler and the handler itself.
74
//
75
// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
76
// and JSON codecs. They also support gzip compression.
77
func NewStatsServiceHandler(svc StatsServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) {
78
mux := http.NewServeMux()
79
mux.Handle("/gitpod.experimental.v1.StatsService/GetUserStats", connect_go.NewUnaryHandler(
80
"/gitpod.experimental.v1.StatsService/GetUserStats",
81
svc.GetUserStats,
82
opts...,
83
))
84
return "/gitpod.experimental.v1.StatsService/", mux
85
}
86
87
// UnimplementedStatsServiceHandler returns CodeUnimplemented from all methods.
88
type UnimplementedStatsServiceHandler struct{}
89
90
func (UnimplementedStatsServiceHandler) GetUserStats(context.Context, *connect_go.Request[v1.GetUserStatsRequest]) (*connect_go.Response[v1.GetUserStatsResponse], error) {
91
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.experimental.v1.StatsService.GetUserStats is not implemented"))
92
}
93
94