chore: update subscription service

This commit is contained in:
Steven
2024-08-16 21:02:51 +08:00
parent 63ebd6f8ea
commit 0be4d8c906
9 changed files with 310 additions and 245 deletions

View File

@ -75,6 +75,24 @@ func local_request_SubscriptionService_UpdateSubscription_0(ctx context.Context,
}
func request_SubscriptionService_DeleteSubscription_0(ctx context.Context, marshaler runtime.Marshaler, client SubscriptionServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq DeleteSubscriptionRequest
var metadata runtime.ServerMetadata
msg, err := client.DeleteSubscription(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_SubscriptionService_DeleteSubscription_0(ctx context.Context, marshaler runtime.Marshaler, server SubscriptionServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq DeleteSubscriptionRequest
var metadata runtime.ServerMetadata
msg, err := server.DeleteSubscription(ctx, &protoReq)
return msg, metadata, err
}
// RegisterSubscriptionServiceHandlerServer registers the http handlers for service SubscriptionService to "mux".
// UnaryRPC :call SubscriptionServiceServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@ -132,6 +150,31 @@ func RegisterSubscriptionServiceHandlerServer(ctx context.Context, mux *runtime.
})
mux.Handle("DELETE", pattern_SubscriptionService_DeleteSubscription_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/slash.api.v1.SubscriptionService/DeleteSubscription", runtime.WithHTTPPathPattern("/v1/subscription"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_SubscriptionService_DeleteSubscription_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_SubscriptionService_DeleteSubscription_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@ -217,6 +260,28 @@ func RegisterSubscriptionServiceHandlerClient(ctx context.Context, mux *runtime.
})
mux.Handle("DELETE", pattern_SubscriptionService_DeleteSubscription_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/slash.api.v1.SubscriptionService/DeleteSubscription", runtime.WithHTTPPathPattern("/v1/subscription"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_SubscriptionService_DeleteSubscription_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_SubscriptionService_DeleteSubscription_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@ -224,10 +289,14 @@ var (
pattern_SubscriptionService_GetSubscription_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "subscription"}, ""))
pattern_SubscriptionService_UpdateSubscription_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "subscription"}, ""))
pattern_SubscriptionService_DeleteSubscription_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "subscription"}, ""))
)
var (
forward_SubscriptionService_GetSubscription_0 = runtime.ForwardResponseMessage
forward_SubscriptionService_UpdateSubscription_0 = runtime.ForwardResponseMessage
forward_SubscriptionService_DeleteSubscription_0 = runtime.ForwardResponseMessage
)