237 lines
13 KiB
Go
237 lines
13 KiB
Go
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
|
|
//
|
|
// Source: officeconvertapi/v1/conversion.proto
|
|
|
|
package officeconvertapiv1connect
|
|
|
|
import (
|
|
connect "connectrpc.com/connect"
|
|
context "context"
|
|
errors "errors"
|
|
v1 "gitea.auvem.com/end/officeconvert/gen/go/officeconvertapi/v1"
|
|
http "net/http"
|
|
strings "strings"
|
|
)
|
|
|
|
// This is a compile-time assertion to ensure that this generated file and the connect package are
|
|
// compatible. If you get a compiler error that this constant is not defined, this code was
|
|
// generated with a version of connect newer than the one compiled into your binary. You can fix the
|
|
// problem by either regenerating this code with an older version of connect or updating the connect
|
|
// version compiled into your binary.
|
|
const _ = connect.IsAtLeastVersion1_13_0
|
|
|
|
const (
|
|
// ConversionServiceName is the fully-qualified name of the ConversionService service.
|
|
ConversionServiceName = "officeconvertapi.v1.ConversionService"
|
|
)
|
|
|
|
// These constants are the fully-qualified names of the RPCs defined in this package. They're
|
|
// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
|
|
//
|
|
// Note that these are different from the fully-qualified method names used by
|
|
// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
|
|
// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
|
|
// period.
|
|
const (
|
|
// ConversionServiceCreateConversionProcedure is the fully-qualified name of the ConversionService's
|
|
// CreateConversion RPC.
|
|
ConversionServiceCreateConversionProcedure = "/officeconvertapi.v1.ConversionService/CreateConversion"
|
|
// ConversionServiceStartConversionProcedure is the fully-qualified name of the ConversionService's
|
|
// StartConversion RPC.
|
|
ConversionServiceStartConversionProcedure = "/officeconvertapi.v1.ConversionService/StartConversion"
|
|
// ConversionServiceGetConversionStatusProcedure is the fully-qualified name of the
|
|
// ConversionService's GetConversionStatus RPC.
|
|
ConversionServiceGetConversionStatusProcedure = "/officeconvertapi.v1.ConversionService/GetConversionStatus"
|
|
// ConversionServiceGetSlideDeckProcedure is the fully-qualified name of the ConversionService's
|
|
// GetSlideDeck RPC.
|
|
ConversionServiceGetSlideDeckProcedure = "/officeconvertapi.v1.ConversionService/GetSlideDeck"
|
|
// ConversionServiceDeleteConversionProcedure is the fully-qualified name of the ConversionService's
|
|
// DeleteConversion RPC.
|
|
ConversionServiceDeleteConversionProcedure = "/officeconvertapi.v1.ConversionService/DeleteConversion"
|
|
)
|
|
|
|
// ConversionServiceClient is a client for the officeconvertapi.v1.ConversionService service.
|
|
type ConversionServiceClient interface {
|
|
// CreateConversion allocates a short-lived session and upload URL for a PPTX.
|
|
CreateConversion(context.Context, *connect.Request[v1.CreateConversionRequest]) (*connect.Response[v1.CreateConversionResponse], error)
|
|
// StartConversion marks upload completion and starts server-side conversion.
|
|
StartConversion(context.Context, *connect.Request[v1.StartConversionRequest]) (*connect.Response[v1.StartConversionResponse], error)
|
|
// GetConversionStatus returns state transitions for a conversion session.
|
|
GetConversionStatus(context.Context, *connect.Request[v1.GetConversionStatusRequest]) (*connect.Response[v1.GetConversionStatusResponse], error)
|
|
// GetSlideDeck fetches the final slide deck data after successful conversion.
|
|
GetSlideDeck(context.Context, *connect.Request[v1.GetSlideDeckRequest]) (*connect.Response[v1.GetSlideDeckResponse], error)
|
|
// DeleteConversion deletes session resources before automatic expiration.
|
|
DeleteConversion(context.Context, *connect.Request[v1.DeleteConversionRequest]) (*connect.Response[v1.DeleteConversionResponse], error)
|
|
}
|
|
|
|
// NewConversionServiceClient constructs a client for the officeconvertapi.v1.ConversionService
|
|
// 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).
|
|
func NewConversionServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) ConversionServiceClient {
|
|
baseURL = strings.TrimRight(baseURL, "/")
|
|
conversionServiceMethods := v1.File_officeconvertapi_v1_conversion_proto.Services().ByName("ConversionService").Methods()
|
|
return &conversionServiceClient{
|
|
createConversion: connect.NewClient[v1.CreateConversionRequest, v1.CreateConversionResponse](
|
|
httpClient,
|
|
baseURL+ConversionServiceCreateConversionProcedure,
|
|
connect.WithSchema(conversionServiceMethods.ByName("CreateConversion")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
startConversion: connect.NewClient[v1.StartConversionRequest, v1.StartConversionResponse](
|
|
httpClient,
|
|
baseURL+ConversionServiceStartConversionProcedure,
|
|
connect.WithSchema(conversionServiceMethods.ByName("StartConversion")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
getConversionStatus: connect.NewClient[v1.GetConversionStatusRequest, v1.GetConversionStatusResponse](
|
|
httpClient,
|
|
baseURL+ConversionServiceGetConversionStatusProcedure,
|
|
connect.WithSchema(conversionServiceMethods.ByName("GetConversionStatus")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
getSlideDeck: connect.NewClient[v1.GetSlideDeckRequest, v1.GetSlideDeckResponse](
|
|
httpClient,
|
|
baseURL+ConversionServiceGetSlideDeckProcedure,
|
|
connect.WithSchema(conversionServiceMethods.ByName("GetSlideDeck")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
deleteConversion: connect.NewClient[v1.DeleteConversionRequest, v1.DeleteConversionResponse](
|
|
httpClient,
|
|
baseURL+ConversionServiceDeleteConversionProcedure,
|
|
connect.WithSchema(conversionServiceMethods.ByName("DeleteConversion")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
}
|
|
}
|
|
|
|
// conversionServiceClient implements ConversionServiceClient.
|
|
type conversionServiceClient struct {
|
|
createConversion *connect.Client[v1.CreateConversionRequest, v1.CreateConversionResponse]
|
|
startConversion *connect.Client[v1.StartConversionRequest, v1.StartConversionResponse]
|
|
getConversionStatus *connect.Client[v1.GetConversionStatusRequest, v1.GetConversionStatusResponse]
|
|
getSlideDeck *connect.Client[v1.GetSlideDeckRequest, v1.GetSlideDeckResponse]
|
|
deleteConversion *connect.Client[v1.DeleteConversionRequest, v1.DeleteConversionResponse]
|
|
}
|
|
|
|
// CreateConversion calls officeconvertapi.v1.ConversionService.CreateConversion.
|
|
func (c *conversionServiceClient) CreateConversion(ctx context.Context, req *connect.Request[v1.CreateConversionRequest]) (*connect.Response[v1.CreateConversionResponse], error) {
|
|
return c.createConversion.CallUnary(ctx, req)
|
|
}
|
|
|
|
// StartConversion calls officeconvertapi.v1.ConversionService.StartConversion.
|
|
func (c *conversionServiceClient) StartConversion(ctx context.Context, req *connect.Request[v1.StartConversionRequest]) (*connect.Response[v1.StartConversionResponse], error) {
|
|
return c.startConversion.CallUnary(ctx, req)
|
|
}
|
|
|
|
// GetConversionStatus calls officeconvertapi.v1.ConversionService.GetConversionStatus.
|
|
func (c *conversionServiceClient) GetConversionStatus(ctx context.Context, req *connect.Request[v1.GetConversionStatusRequest]) (*connect.Response[v1.GetConversionStatusResponse], error) {
|
|
return c.getConversionStatus.CallUnary(ctx, req)
|
|
}
|
|
|
|
// GetSlideDeck calls officeconvertapi.v1.ConversionService.GetSlideDeck.
|
|
func (c *conversionServiceClient) GetSlideDeck(ctx context.Context, req *connect.Request[v1.GetSlideDeckRequest]) (*connect.Response[v1.GetSlideDeckResponse], error) {
|
|
return c.getSlideDeck.CallUnary(ctx, req)
|
|
}
|
|
|
|
// DeleteConversion calls officeconvertapi.v1.ConversionService.DeleteConversion.
|
|
func (c *conversionServiceClient) DeleteConversion(ctx context.Context, req *connect.Request[v1.DeleteConversionRequest]) (*connect.Response[v1.DeleteConversionResponse], error) {
|
|
return c.deleteConversion.CallUnary(ctx, req)
|
|
}
|
|
|
|
// ConversionServiceHandler is an implementation of the officeconvertapi.v1.ConversionService
|
|
// service.
|
|
type ConversionServiceHandler interface {
|
|
// CreateConversion allocates a short-lived session and upload URL for a PPTX.
|
|
CreateConversion(context.Context, *connect.Request[v1.CreateConversionRequest]) (*connect.Response[v1.CreateConversionResponse], error)
|
|
// StartConversion marks upload completion and starts server-side conversion.
|
|
StartConversion(context.Context, *connect.Request[v1.StartConversionRequest]) (*connect.Response[v1.StartConversionResponse], error)
|
|
// GetConversionStatus returns state transitions for a conversion session.
|
|
GetConversionStatus(context.Context, *connect.Request[v1.GetConversionStatusRequest]) (*connect.Response[v1.GetConversionStatusResponse], error)
|
|
// GetSlideDeck fetches the final slide deck data after successful conversion.
|
|
GetSlideDeck(context.Context, *connect.Request[v1.GetSlideDeckRequest]) (*connect.Response[v1.GetSlideDeckResponse], error)
|
|
// DeleteConversion deletes session resources before automatic expiration.
|
|
DeleteConversion(context.Context, *connect.Request[v1.DeleteConversionRequest]) (*connect.Response[v1.DeleteConversionResponse], error)
|
|
}
|
|
|
|
// NewConversionServiceHandler 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.
|
|
func NewConversionServiceHandler(svc ConversionServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
|
|
conversionServiceMethods := v1.File_officeconvertapi_v1_conversion_proto.Services().ByName("ConversionService").Methods()
|
|
conversionServiceCreateConversionHandler := connect.NewUnaryHandler(
|
|
ConversionServiceCreateConversionProcedure,
|
|
svc.CreateConversion,
|
|
connect.WithSchema(conversionServiceMethods.ByName("CreateConversion")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
conversionServiceStartConversionHandler := connect.NewUnaryHandler(
|
|
ConversionServiceStartConversionProcedure,
|
|
svc.StartConversion,
|
|
connect.WithSchema(conversionServiceMethods.ByName("StartConversion")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
conversionServiceGetConversionStatusHandler := connect.NewUnaryHandler(
|
|
ConversionServiceGetConversionStatusProcedure,
|
|
svc.GetConversionStatus,
|
|
connect.WithSchema(conversionServiceMethods.ByName("GetConversionStatus")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
conversionServiceGetSlideDeckHandler := connect.NewUnaryHandler(
|
|
ConversionServiceGetSlideDeckProcedure,
|
|
svc.GetSlideDeck,
|
|
connect.WithSchema(conversionServiceMethods.ByName("GetSlideDeck")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
conversionServiceDeleteConversionHandler := connect.NewUnaryHandler(
|
|
ConversionServiceDeleteConversionProcedure,
|
|
svc.DeleteConversion,
|
|
connect.WithSchema(conversionServiceMethods.ByName("DeleteConversion")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
return "/officeconvertapi.v1.ConversionService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
switch r.URL.Path {
|
|
case ConversionServiceCreateConversionProcedure:
|
|
conversionServiceCreateConversionHandler.ServeHTTP(w, r)
|
|
case ConversionServiceStartConversionProcedure:
|
|
conversionServiceStartConversionHandler.ServeHTTP(w, r)
|
|
case ConversionServiceGetConversionStatusProcedure:
|
|
conversionServiceGetConversionStatusHandler.ServeHTTP(w, r)
|
|
case ConversionServiceGetSlideDeckProcedure:
|
|
conversionServiceGetSlideDeckHandler.ServeHTTP(w, r)
|
|
case ConversionServiceDeleteConversionProcedure:
|
|
conversionServiceDeleteConversionHandler.ServeHTTP(w, r)
|
|
default:
|
|
http.NotFound(w, r)
|
|
}
|
|
})
|
|
}
|
|
|
|
// UnimplementedConversionServiceHandler returns CodeUnimplemented from all methods.
|
|
type UnimplementedConversionServiceHandler struct{}
|
|
|
|
func (UnimplementedConversionServiceHandler) CreateConversion(context.Context, *connect.Request[v1.CreateConversionRequest]) (*connect.Response[v1.CreateConversionResponse], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("officeconvertapi.v1.ConversionService.CreateConversion is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedConversionServiceHandler) StartConversion(context.Context, *connect.Request[v1.StartConversionRequest]) (*connect.Response[v1.StartConversionResponse], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("officeconvertapi.v1.ConversionService.StartConversion is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedConversionServiceHandler) GetConversionStatus(context.Context, *connect.Request[v1.GetConversionStatusRequest]) (*connect.Response[v1.GetConversionStatusResponse], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("officeconvertapi.v1.ConversionService.GetConversionStatus is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedConversionServiceHandler) GetSlideDeck(context.Context, *connect.Request[v1.GetSlideDeckRequest]) (*connect.Response[v1.GetSlideDeckResponse], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("officeconvertapi.v1.ConversionService.GetSlideDeck is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedConversionServiceHandler) DeleteConversion(context.Context, *connect.Request[v1.DeleteConversionRequest]) (*connect.Response[v1.DeleteConversionResponse], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("officeconvertapi.v1.ConversionService.DeleteConversion is not implemented"))
|
|
}
|