diff --git a/Makefile b/Makefile index 073034d..03de9c5 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: all install gen build test mocks +.PHONY: all install gen proto build test mocks # Load .env file if it exists (for local development) # In CI/CD, environment variables are provided by the environment @@ -25,6 +25,12 @@ install: gen: install gen-commands -input ./temporalcloudcli/commands.yml -pkg temporalcloudcli > ./temporalcloudcli/commands.gen.go +# Regenerates the vendored onboarding service client (proto/ -> internal/). +# Requires buf on PATH; the protoc plugins are pinned as go tools in go.mod. +proto: + buf lint + buf generate + build: go build -ldflags "$(LDFLAGS)" ./cmd/temporal-cloud diff --git a/buf.gen.yaml b/buf.gen.yaml new file mode 100644 index 0000000..f3faa39 --- /dev/null +++ b/buf.gen.yaml @@ -0,0 +1,10 @@ +version: v2 +inputs: + - directory: proto +plugins: + - local: ["go", "tool", "protoc-gen-go"] + out: internal + opt: [paths=source_relative] + - local: ["go", "tool", "protoc-gen-go-grpc"] + out: internal + opt: [paths=source_relative] diff --git a/buf.yaml b/buf.yaml new file mode 100644 index 0000000..1c5534a --- /dev/null +++ b/buf.yaml @@ -0,0 +1,13 @@ +version: v2 +modules: + - path: proto +lint: + use: + - STANDARD + except: + # Names and layout mirror saas-proto, which is the source of truth. + - PACKAGE_DIRECTORY_MATCH + - RPC_REQUEST_RESPONSE_UNIQUE + - RPC_REQUEST_STANDARD_NAME + - RPC_RESPONSE_STANDARD_NAME + - SERVICE_SUFFIX diff --git a/go.mod b/go.mod index 2fac367..1cb633a 100644 --- a/go.mod +++ b/go.mod @@ -80,7 +80,12 @@ require ( golang.org/x/tools v0.51.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa // indirect + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) -tool github.com/vektra/mockery/v3 +tool ( + github.com/vektra/mockery/v3 + google.golang.org/grpc/cmd/protoc-gen-go-grpc + google.golang.org/protobuf/cmd/protoc-gen-go +) diff --git a/go.sum b/go.sum index ec83f5e..4764b02 100644 --- a/go.sum +++ b/go.sum @@ -229,6 +229,8 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa h1: google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= google.golang.org/grpc v1.82.1 h1:NnAxzGRA0677vCa4BUkOAnO5+FfQqVl9iUXeD0IqcGE= google.golang.org/grpc v1.82.1/go.mod h1:yzTZ1TB1Z3SG+LIYaI+WiE8D5+PZ3ArnrSp8zF3+/ZA= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 h1:F29+wU6Ee6qgu9TddPgooOdaqsxTMunOoj8KA5yuS5A= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1/go.mod h1:5KF+wpkbTSbGcR9zteSqZV6fqFOWBl4Yde8En8MryZA= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/internal/onboardingservice/v1/onboarding.pb.go b/internal/onboardingservice/v1/onboarding.pb.go new file mode 100644 index 0000000..f25f1af --- /dev/null +++ b/internal/onboardingservice/v1/onboarding.pb.go @@ -0,0 +1,622 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc (unknown) +// source: onboardingservice/v1/onboarding.proto + +// Vendored subset of saas-proto proto/onboardingservice/v1/onboarding.proto. +// saas-proto is the source of truth. Field names, numbers and types must match +// it exactly. Fields the CLI does not need, and that would pull in private +// saas-proto imports, are left out and reserved here; the decoder skips them as +// unknown fields. Changes must be additive and land in saas-proto first. + +package onboardingservice + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type StepType int32 + +const ( + StepType_STEP_TYPE_UNSPECIFIED StepType = 0 + StepType_STEP_TYPE_CUSTOMER_DETAILS_COLLECTION StepType = 1 + StepType_STEP_TYPE_WAIT_FOR_THROTTLE StepType = 2 + StepType_STEP_TYPE_WAIT_FOR_PAYMENT_PROVIDER_SETUP StepType = 3 + StepType_STEP_TYPE_PAYMENT_COLLECTION StepType = 4 + StepType_STEP_TYPE_WAIT_FOR_ACCOUNT_CREATION StepType = 5 + StepType_STEP_TYPE_END_OF_FUNNEL StepType = 6 +) + +// Enum value maps for StepType. +var ( + StepType_name = map[int32]string{ + 0: "STEP_TYPE_UNSPECIFIED", + 1: "STEP_TYPE_CUSTOMER_DETAILS_COLLECTION", + 2: "STEP_TYPE_WAIT_FOR_THROTTLE", + 3: "STEP_TYPE_WAIT_FOR_PAYMENT_PROVIDER_SETUP", + 4: "STEP_TYPE_PAYMENT_COLLECTION", + 5: "STEP_TYPE_WAIT_FOR_ACCOUNT_CREATION", + 6: "STEP_TYPE_END_OF_FUNNEL", + } + StepType_value = map[string]int32{ + "STEP_TYPE_UNSPECIFIED": 0, + "STEP_TYPE_CUSTOMER_DETAILS_COLLECTION": 1, + "STEP_TYPE_WAIT_FOR_THROTTLE": 2, + "STEP_TYPE_WAIT_FOR_PAYMENT_PROVIDER_SETUP": 3, + "STEP_TYPE_PAYMENT_COLLECTION": 4, + "STEP_TYPE_WAIT_FOR_ACCOUNT_CREATION": 5, + "STEP_TYPE_END_OF_FUNNEL": 6, + } +) + +func (x StepType) Enum() *StepType { + p := new(StepType) + *p = x + return p +} + +func (x StepType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (StepType) Descriptor() protoreflect.EnumDescriptor { + return file_onboardingservice_v1_onboarding_proto_enumTypes[0].Descriptor() +} + +func (StepType) Type() protoreflect.EnumType { + return &file_onboardingservice_v1_onboarding_proto_enumTypes[0] +} + +func (x StepType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use StepType.Descriptor instead. +func (StepType) EnumDescriptor() ([]byte, []int) { + return file_onboardingservice_v1_onboarding_proto_rawDescGZIP(), []int{0} +} + +type OnboardingState struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Indicates the current step of the funnel the user is on + CurrentStep StepType `protobuf:"varint,1,opt,name=current_step,json=currentStep,proto3,enum=onboardingservice.v1.StepType" json:"current_step,omitempty"` + CustomerDetailsCollection *CustomerDetailsCollectionStepInformation `protobuf:"bytes,2,opt,name=customer_details_collection,json=customerDetailsCollection,proto3" json:"customer_details_collection,omitempty"` + WaitForThrottle *WaitForThrottleStepInformation `protobuf:"bytes,3,opt,name=wait_for_throttle,json=waitForThrottle,proto3" json:"wait_for_throttle,omitempty"` + StripeSetup *WaitForStripeSetupStepInformation `protobuf:"bytes,4,opt,name=stripe_setup,json=stripeSetup,proto3" json:"stripe_setup,omitempty"` + WaitForAccountCreation *WaitForAccountCreationStepInformation `protobuf:"bytes,6,opt,name=wait_for_account_creation,json=waitForAccountCreation,proto3" json:"wait_for_account_creation,omitempty"` + UserEmail string `protobuf:"bytes,7,opt,name=user_email,json=userEmail,proto3" json:"user_email,omitempty"` + // The Temporal Cloud user id of the user, if available. Empty if the user does not have one yet. + UserId string `protobuf:"bytes,12,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OnboardingState) Reset() { + *x = OnboardingState{} + mi := &file_onboardingservice_v1_onboarding_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OnboardingState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OnboardingState) ProtoMessage() {} + +func (x *OnboardingState) ProtoReflect() protoreflect.Message { + mi := &file_onboardingservice_v1_onboarding_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OnboardingState.ProtoReflect.Descriptor instead. +func (*OnboardingState) Descriptor() ([]byte, []int) { + return file_onboardingservice_v1_onboarding_proto_rawDescGZIP(), []int{0} +} + +func (x *OnboardingState) GetCurrentStep() StepType { + if x != nil { + return x.CurrentStep + } + return StepType_STEP_TYPE_UNSPECIFIED +} + +func (x *OnboardingState) GetCustomerDetailsCollection() *CustomerDetailsCollectionStepInformation { + if x != nil { + return x.CustomerDetailsCollection + } + return nil +} + +func (x *OnboardingState) GetWaitForThrottle() *WaitForThrottleStepInformation { + if x != nil { + return x.WaitForThrottle + } + return nil +} + +func (x *OnboardingState) GetStripeSetup() *WaitForStripeSetupStepInformation { + if x != nil { + return x.StripeSetup + } + return nil +} + +func (x *OnboardingState) GetWaitForAccountCreation() *WaitForAccountCreationStepInformation { + if x != nil { + return x.WaitForAccountCreation + } + return nil +} + +func (x *OnboardingState) GetUserEmail() string { + if x != nil { + return x.UserEmail + } + return "" +} + +func (x *OnboardingState) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type GetOrCreateCLIOnboardingStateRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Optional, as is every field in it; the CLI sends whatever its login provides. + CustomerDetails *CustomerDetails `protobuf:"bytes,1,opt,name=customer_details,json=customerDetails,proto3" json:"customer_details,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetOrCreateCLIOnboardingStateRequest) Reset() { + *x = GetOrCreateCLIOnboardingStateRequest{} + mi := &file_onboardingservice_v1_onboarding_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetOrCreateCLIOnboardingStateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetOrCreateCLIOnboardingStateRequest) ProtoMessage() {} + +func (x *GetOrCreateCLIOnboardingStateRequest) ProtoReflect() protoreflect.Message { + mi := &file_onboardingservice_v1_onboarding_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetOrCreateCLIOnboardingStateRequest.ProtoReflect.Descriptor instead. +func (*GetOrCreateCLIOnboardingStateRequest) Descriptor() ([]byte, []int) { + return file_onboardingservice_v1_onboarding_proto_rawDescGZIP(), []int{1} +} + +func (x *GetOrCreateCLIOnboardingStateRequest) GetCustomerDetails() *CustomerDetails { + if x != nil { + return x.CustomerDetails + } + return nil +} + +type GetOrCreateCLIOnboardingStateResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserAlreadyExists bool `protobuf:"varint,1,opt,name=user_already_exists,json=userAlreadyExists,proto3" json:"user_already_exists,omitempty"` + // Empty if user_already_exists is true. + State *OnboardingState `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetOrCreateCLIOnboardingStateResponse) Reset() { + *x = GetOrCreateCLIOnboardingStateResponse{} + mi := &file_onboardingservice_v1_onboarding_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetOrCreateCLIOnboardingStateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetOrCreateCLIOnboardingStateResponse) ProtoMessage() {} + +func (x *GetOrCreateCLIOnboardingStateResponse) ProtoReflect() protoreflect.Message { + mi := &file_onboardingservice_v1_onboarding_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetOrCreateCLIOnboardingStateResponse.ProtoReflect.Descriptor instead. +func (*GetOrCreateCLIOnboardingStateResponse) Descriptor() ([]byte, []int) { + return file_onboardingservice_v1_onboarding_proto_rawDescGZIP(), []int{2} +} + +func (x *GetOrCreateCLIOnboardingStateResponse) GetUserAlreadyExists() bool { + if x != nil { + return x.UserAlreadyExists + } + return false +} + +func (x *GetOrCreateCLIOnboardingStateResponse) GetState() *OnboardingState { + if x != nil { + return x.State + } + return nil +} + +type WaitForStripeSetupStepInformation struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WaitForStripeSetupStepInformation) Reset() { + *x = WaitForStripeSetupStepInformation{} + mi := &file_onboardingservice_v1_onboarding_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WaitForStripeSetupStepInformation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WaitForStripeSetupStepInformation) ProtoMessage() {} + +func (x *WaitForStripeSetupStepInformation) ProtoReflect() protoreflect.Message { + mi := &file_onboardingservice_v1_onboarding_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WaitForStripeSetupStepInformation.ProtoReflect.Descriptor instead. +func (*WaitForStripeSetupStepInformation) Descriptor() ([]byte, []int) { + return file_onboardingservice_v1_onboarding_proto_rawDescGZIP(), []int{3} +} + +type WaitForAccountCreationStepInformation struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WaitForAccountCreationStepInformation) Reset() { + *x = WaitForAccountCreationStepInformation{} + mi := &file_onboardingservice_v1_onboarding_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WaitForAccountCreationStepInformation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WaitForAccountCreationStepInformation) ProtoMessage() {} + +func (x *WaitForAccountCreationStepInformation) ProtoReflect() protoreflect.Message { + mi := &file_onboardingservice_v1_onboarding_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WaitForAccountCreationStepInformation.ProtoReflect.Descriptor instead. +func (*WaitForAccountCreationStepInformation) Descriptor() ([]byte, []int) { + return file_onboardingservice_v1_onboarding_proto_rawDescGZIP(), []int{4} +} + +type WaitForThrottleStepInformation struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WaitForThrottleStepInformation) Reset() { + *x = WaitForThrottleStepInformation{} + mi := &file_onboardingservice_v1_onboarding_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WaitForThrottleStepInformation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WaitForThrottleStepInformation) ProtoMessage() {} + +func (x *WaitForThrottleStepInformation) ProtoReflect() protoreflect.Message { + mi := &file_onboardingservice_v1_onboarding_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WaitForThrottleStepInformation.ProtoReflect.Descriptor instead. +func (*WaitForThrottleStepInformation) Descriptor() ([]byte, []int) { + return file_onboardingservice_v1_onboarding_proto_rawDescGZIP(), []int{5} +} + +type CustomerDetailsCollectionStepInformation struct { + state protoimpl.MessageState `protogen:"open.v1"` + Details *CustomerDetails `protobuf:"bytes,1,opt,name=details,proto3" json:"details,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CustomerDetailsCollectionStepInformation) Reset() { + *x = CustomerDetailsCollectionStepInformation{} + mi := &file_onboardingservice_v1_onboarding_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CustomerDetailsCollectionStepInformation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CustomerDetailsCollectionStepInformation) ProtoMessage() {} + +func (x *CustomerDetailsCollectionStepInformation) ProtoReflect() protoreflect.Message { + mi := &file_onboardingservice_v1_onboarding_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CustomerDetailsCollectionStepInformation.ProtoReflect.Descriptor instead. +func (*CustomerDetailsCollectionStepInformation) Descriptor() ([]byte, []int) { + return file_onboardingservice_v1_onboarding_proto_rawDescGZIP(), []int{6} +} + +func (x *CustomerDetailsCollectionStepInformation) GetDetails() *CustomerDetails { + if x != nil { + return x.Details + } + return nil +} + +type CustomerDetails struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The first name of the customer. + FirstName string `protobuf:"bytes,1,opt,name=first_name,json=firstName,proto3" json:"first_name,omitempty"` + // The last name of the customer. + LastName string `protobuf:"bytes,2,opt,name=last_name,json=lastName,proto3" json:"last_name,omitempty"` + // The name of the company the user is from. If empty, the server defaults to "Personal". + CompanyName string `protobuf:"bytes,3,opt,name=company_name,json=companyName,proto3" json:"company_name,omitempty"` + // The country of the user. + Country string `protobuf:"bytes,4,opt,name=country,proto3" json:"country,omitempty"` + // Indicates whether the user is interested in receiving marketing emails from Temporal + OptInMarketingEmail bool `protobuf:"varint,7,opt,name=opt_in_marketing_email,json=optInMarketingEmail,proto3" json:"opt_in_marketing_email,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CustomerDetails) Reset() { + *x = CustomerDetails{} + mi := &file_onboardingservice_v1_onboarding_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CustomerDetails) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CustomerDetails) ProtoMessage() {} + +func (x *CustomerDetails) ProtoReflect() protoreflect.Message { + mi := &file_onboardingservice_v1_onboarding_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CustomerDetails.ProtoReflect.Descriptor instead. +func (*CustomerDetails) Descriptor() ([]byte, []int) { + return file_onboardingservice_v1_onboarding_proto_rawDescGZIP(), []int{7} +} + +func (x *CustomerDetails) GetFirstName() string { + if x != nil { + return x.FirstName + } + return "" +} + +func (x *CustomerDetails) GetLastName() string { + if x != nil { + return x.LastName + } + return "" +} + +func (x *CustomerDetails) GetCompanyName() string { + if x != nil { + return x.CompanyName + } + return "" +} + +func (x *CustomerDetails) GetCountry() string { + if x != nil { + return x.Country + } + return "" +} + +func (x *CustomerDetails) GetOptInMarketingEmail() bool { + if x != nil { + return x.OptInMarketingEmail + } + return false +} + +var File_onboardingservice_v1_onboarding_proto protoreflect.FileDescriptor + +const file_onboardingservice_v1_onboarding_proto_rawDesc = "" + + "\n" + + "%onboardingservice/v1/onboarding.proto\x12\x14onboardingservice.v1\"\xda\x05\n" + + "\x0fOnboardingState\x12A\n" + + "\fcurrent_step\x18\x01 \x01(\x0e2\x1e.onboardingservice.v1.StepTypeR\vcurrentStep\x12~\n" + + "\x1bcustomer_details_collection\x18\x02 \x01(\v2>.onboardingservice.v1.CustomerDetailsCollectionStepInformationR\x19customerDetailsCollection\x12`\n" + + "\x11wait_for_throttle\x18\x03 \x01(\v24.onboardingservice.v1.WaitForThrottleStepInformationR\x0fwaitForThrottle\x12Z\n" + + "\fstripe_setup\x18\x04 \x01(\v27.onboardingservice.v1.WaitForStripeSetupStepInformationR\vstripeSetup\x12v\n" + + "\x19wait_for_account_creation\x18\x06 \x01(\v2;.onboardingservice.v1.WaitForAccountCreationStepInformationR\x16waitForAccountCreation\x12\x1d\n" + + "\n" + + "user_email\x18\a \x01(\tR\tuserEmail\x12\x17\n" + + "\auser_id\x18\f \x01(\tR\x06userIdJ\x04\b\x05\x10\x06J\x04\b\b\x10\tJ\x04\b\t\x10\n" + + "J\x04\b\n" + + "\x10\vJ\x04\b\v\x10\fR stripe_setup_intent_confirmationR\x13eligible_promotionsR\x16eligible_billing_plansR\x0ftarget_sku_typeR\x18billing_provider_details\"x\n" + + "$GetOrCreateCLIOnboardingStateRequest\x12P\n" + + "\x10customer_details\x18\x01 \x01(\v2%.onboardingservice.v1.CustomerDetailsR\x0fcustomerDetails\"\x94\x01\n" + + "%GetOrCreateCLIOnboardingStateResponse\x12.\n" + + "\x13user_already_exists\x18\x01 \x01(\bR\x11userAlreadyExists\x12;\n" + + "\x05state\x18\x02 \x01(\v2%.onboardingservice.v1.OnboardingStateR\x05state\"#\n" + + "!WaitForStripeSetupStepInformation\"'\n" + + "%WaitForAccountCreationStepInformation\" \n" + + "\x1eWaitForThrottleStepInformation\"k\n" + + "(CustomerDetailsCollectionStepInformation\x12?\n" + + "\adetails\x18\x01 \x01(\v2%.onboardingservice.v1.CustomerDetailsR\adetails\"\xf2\x01\n" + + "\x0fCustomerDetails\x12\x1d\n" + + "\n" + + "first_name\x18\x01 \x01(\tR\tfirstName\x12\x1b\n" + + "\tlast_name\x18\x02 \x01(\tR\blastName\x12!\n" + + "\fcompany_name\x18\x03 \x01(\tR\vcompanyName\x12\x18\n" + + "\acountry\x18\x04 \x01(\tR\acountry\x123\n" + + "\x16opt_in_marketing_email\x18\a \x01(\bR\x13optInMarketingEmailJ\x04\b\x05\x10\x06J\x04\b\x06\x10\aJ\x04\b\b\x10\tR\x16agree_terms_of_serviceR\apurpose*\x88\x02\n" + + "\bStepType\x12\x19\n" + + "\x15STEP_TYPE_UNSPECIFIED\x10\x00\x12)\n" + + "%STEP_TYPE_CUSTOMER_DETAILS_COLLECTION\x10\x01\x12\x1f\n" + + "\x1bSTEP_TYPE_WAIT_FOR_THROTTLE\x10\x02\x12-\n" + + ")STEP_TYPE_WAIT_FOR_PAYMENT_PROVIDER_SETUP\x10\x03\x12 \n" + + "\x1cSTEP_TYPE_PAYMENT_COLLECTION\x10\x04\x12'\n" + + "#STEP_TYPE_WAIT_FOR_ACCOUNT_CREATION\x10\x05\x12\x1b\n" + + "\x17STEP_TYPE_END_OF_FUNNEL\x10\x06BQZOgithub.com/temporalio/cloud-cli/internal/onboardingservice/v1;onboardingserviceb\x06proto3" + +var ( + file_onboardingservice_v1_onboarding_proto_rawDescOnce sync.Once + file_onboardingservice_v1_onboarding_proto_rawDescData []byte +) + +func file_onboardingservice_v1_onboarding_proto_rawDescGZIP() []byte { + file_onboardingservice_v1_onboarding_proto_rawDescOnce.Do(func() { + file_onboardingservice_v1_onboarding_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_onboardingservice_v1_onboarding_proto_rawDesc), len(file_onboardingservice_v1_onboarding_proto_rawDesc))) + }) + return file_onboardingservice_v1_onboarding_proto_rawDescData +} + +var file_onboardingservice_v1_onboarding_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_onboardingservice_v1_onboarding_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_onboardingservice_v1_onboarding_proto_goTypes = []any{ + (StepType)(0), // 0: onboardingservice.v1.StepType + (*OnboardingState)(nil), // 1: onboardingservice.v1.OnboardingState + (*GetOrCreateCLIOnboardingStateRequest)(nil), // 2: onboardingservice.v1.GetOrCreateCLIOnboardingStateRequest + (*GetOrCreateCLIOnboardingStateResponse)(nil), // 3: onboardingservice.v1.GetOrCreateCLIOnboardingStateResponse + (*WaitForStripeSetupStepInformation)(nil), // 4: onboardingservice.v1.WaitForStripeSetupStepInformation + (*WaitForAccountCreationStepInformation)(nil), // 5: onboardingservice.v1.WaitForAccountCreationStepInformation + (*WaitForThrottleStepInformation)(nil), // 6: onboardingservice.v1.WaitForThrottleStepInformation + (*CustomerDetailsCollectionStepInformation)(nil), // 7: onboardingservice.v1.CustomerDetailsCollectionStepInformation + (*CustomerDetails)(nil), // 8: onboardingservice.v1.CustomerDetails +} +var file_onboardingservice_v1_onboarding_proto_depIdxs = []int32{ + 0, // 0: onboardingservice.v1.OnboardingState.current_step:type_name -> onboardingservice.v1.StepType + 7, // 1: onboardingservice.v1.OnboardingState.customer_details_collection:type_name -> onboardingservice.v1.CustomerDetailsCollectionStepInformation + 6, // 2: onboardingservice.v1.OnboardingState.wait_for_throttle:type_name -> onboardingservice.v1.WaitForThrottleStepInformation + 4, // 3: onboardingservice.v1.OnboardingState.stripe_setup:type_name -> onboardingservice.v1.WaitForStripeSetupStepInformation + 5, // 4: onboardingservice.v1.OnboardingState.wait_for_account_creation:type_name -> onboardingservice.v1.WaitForAccountCreationStepInformation + 8, // 5: onboardingservice.v1.GetOrCreateCLIOnboardingStateRequest.customer_details:type_name -> onboardingservice.v1.CustomerDetails + 1, // 6: onboardingservice.v1.GetOrCreateCLIOnboardingStateResponse.state:type_name -> onboardingservice.v1.OnboardingState + 8, // 7: onboardingservice.v1.CustomerDetailsCollectionStepInformation.details:type_name -> onboardingservice.v1.CustomerDetails + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name +} + +func init() { file_onboardingservice_v1_onboarding_proto_init() } +func file_onboardingservice_v1_onboarding_proto_init() { + if File_onboardingservice_v1_onboarding_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_onboardingservice_v1_onboarding_proto_rawDesc), len(file_onboardingservice_v1_onboarding_proto_rawDesc)), + NumEnums: 1, + NumMessages: 8, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_onboardingservice_v1_onboarding_proto_goTypes, + DependencyIndexes: file_onboardingservice_v1_onboarding_proto_depIdxs, + EnumInfos: file_onboardingservice_v1_onboarding_proto_enumTypes, + MessageInfos: file_onboardingservice_v1_onboarding_proto_msgTypes, + }.Build() + File_onboardingservice_v1_onboarding_proto = out.File + file_onboardingservice_v1_onboarding_proto_goTypes = nil + file_onboardingservice_v1_onboarding_proto_depIdxs = nil +} diff --git a/internal/onboardingservice/v1/service.pb.go b/internal/onboardingservice/v1/service.pb.go new file mode 100644 index 0000000..5df1eaa --- /dev/null +++ b/internal/onboardingservice/v1/service.pb.go @@ -0,0 +1,73 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc (unknown) +// source: onboardingservice/v1/service.proto + +// Vendored subset of saas-proto proto/onboardingservice/v1/service.proto. +// saas-proto is the source of truth. Keep the package, service, RPC and message +// names identical to it: they form the gRPC method path on the wire. Only the +// RPCs the CLI calls are copied here. Changes must be additive and land in +// saas-proto first. + +package onboardingservice + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +var File_onboardingservice_v1_service_proto protoreflect.FileDescriptor + +const file_onboardingservice_v1_service_proto_rawDesc = "" + + "\n" + + "\"onboardingservice/v1/service.proto\x12\x14onboardingservice.v1\x1a%onboardingservice/v1/onboarding.proto2\xb0\x01\n" + + "\x11OnboardingService\x12\x9a\x01\n" + + "\x1dGetOrCreateCLIOnboardingState\x12:.onboardingservice.v1.GetOrCreateCLIOnboardingStateRequest\x1a;.onboardingservice.v1.GetOrCreateCLIOnboardingStateResponse\"\x00BQZOgithub.com/temporalio/cloud-cli/internal/onboardingservice/v1;onboardingserviceb\x06proto3" + +var file_onboardingservice_v1_service_proto_goTypes = []any{ + (*GetOrCreateCLIOnboardingStateRequest)(nil), // 0: onboardingservice.v1.GetOrCreateCLIOnboardingStateRequest + (*GetOrCreateCLIOnboardingStateResponse)(nil), // 1: onboardingservice.v1.GetOrCreateCLIOnboardingStateResponse +} +var file_onboardingservice_v1_service_proto_depIdxs = []int32{ + 0, // 0: onboardingservice.v1.OnboardingService.GetOrCreateCLIOnboardingState:input_type -> onboardingservice.v1.GetOrCreateCLIOnboardingStateRequest + 1, // 1: onboardingservice.v1.OnboardingService.GetOrCreateCLIOnboardingState:output_type -> onboardingservice.v1.GetOrCreateCLIOnboardingStateResponse + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_onboardingservice_v1_service_proto_init() } +func file_onboardingservice_v1_service_proto_init() { + if File_onboardingservice_v1_service_proto != nil { + return + } + file_onboardingservice_v1_onboarding_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_onboardingservice_v1_service_proto_rawDesc), len(file_onboardingservice_v1_service_proto_rawDesc)), + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_onboardingservice_v1_service_proto_goTypes, + DependencyIndexes: file_onboardingservice_v1_service_proto_depIdxs, + }.Build() + File_onboardingservice_v1_service_proto = out.File + file_onboardingservice_v1_service_proto_goTypes = nil + file_onboardingservice_v1_service_proto_depIdxs = nil +} diff --git a/internal/onboardingservice/v1/service_grpc.pb.go b/internal/onboardingservice/v1/service_grpc.pb.go new file mode 100644 index 0000000..8894c77 --- /dev/null +++ b/internal/onboardingservice/v1/service_grpc.pb.go @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc (unknown) +// source: onboardingservice/v1/service.proto + +// Vendored subset of saas-proto proto/onboardingservice/v1/service.proto. +// saas-proto is the source of truth. Keep the package, service, RPC and message +// names identical to it: they form the gRPC method path on the wire. Only the +// RPCs the CLI calls are copied here. Changes must be additive and land in +// saas-proto first. + +package onboardingservice + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + OnboardingService_GetOrCreateCLIOnboardingState_FullMethodName = "/onboardingservice.v1.OnboardingService/GetOrCreateCLIOnboardingState" +) + +// OnboardingServiceClient is the client API for OnboardingService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type OnboardingServiceClient interface { + // The endpoint the Temporal CLI signup command polls. + // Same contract as GetOrCreateOnboardingState for a CLI-started session. + GetOrCreateCLIOnboardingState(ctx context.Context, in *GetOrCreateCLIOnboardingStateRequest, opts ...grpc.CallOption) (*GetOrCreateCLIOnboardingStateResponse, error) +} + +type onboardingServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewOnboardingServiceClient(cc grpc.ClientConnInterface) OnboardingServiceClient { + return &onboardingServiceClient{cc} +} + +func (c *onboardingServiceClient) GetOrCreateCLIOnboardingState(ctx context.Context, in *GetOrCreateCLIOnboardingStateRequest, opts ...grpc.CallOption) (*GetOrCreateCLIOnboardingStateResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetOrCreateCLIOnboardingStateResponse) + err := c.cc.Invoke(ctx, OnboardingService_GetOrCreateCLIOnboardingState_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// OnboardingServiceServer is the server API for OnboardingService service. +// All implementations must embed UnimplementedOnboardingServiceServer +// for forward compatibility. +type OnboardingServiceServer interface { + // The endpoint the Temporal CLI signup command polls. + // Same contract as GetOrCreateOnboardingState for a CLI-started session. + GetOrCreateCLIOnboardingState(context.Context, *GetOrCreateCLIOnboardingStateRequest) (*GetOrCreateCLIOnboardingStateResponse, error) + mustEmbedUnimplementedOnboardingServiceServer() +} + +// UnimplementedOnboardingServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedOnboardingServiceServer struct{} + +func (UnimplementedOnboardingServiceServer) GetOrCreateCLIOnboardingState(context.Context, *GetOrCreateCLIOnboardingStateRequest) (*GetOrCreateCLIOnboardingStateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetOrCreateCLIOnboardingState not implemented") +} +func (UnimplementedOnboardingServiceServer) mustEmbedUnimplementedOnboardingServiceServer() {} +func (UnimplementedOnboardingServiceServer) testEmbeddedByValue() {} + +// UnsafeOnboardingServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to OnboardingServiceServer will +// result in compilation errors. +type UnsafeOnboardingServiceServer interface { + mustEmbedUnimplementedOnboardingServiceServer() +} + +func RegisterOnboardingServiceServer(s grpc.ServiceRegistrar, srv OnboardingServiceServer) { + // If the following call pancis, it indicates UnimplementedOnboardingServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&OnboardingService_ServiceDesc, srv) +} + +func _OnboardingService_GetOrCreateCLIOnboardingState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetOrCreateCLIOnboardingStateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OnboardingServiceServer).GetOrCreateCLIOnboardingState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OnboardingService_GetOrCreateCLIOnboardingState_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OnboardingServiceServer).GetOrCreateCLIOnboardingState(ctx, req.(*GetOrCreateCLIOnboardingStateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// OnboardingService_ServiceDesc is the grpc.ServiceDesc for OnboardingService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var OnboardingService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "onboardingservice.v1.OnboardingService", + HandlerType: (*OnboardingServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetOrCreateCLIOnboardingState", + Handler: _OnboardingService_GetOrCreateCLIOnboardingState_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "onboardingservice/v1/service.proto", +} diff --git a/proto/onboardingservice/v1/onboarding.proto b/proto/onboardingservice/v1/onboarding.proto new file mode 100644 index 0000000..eceaec7 --- /dev/null +++ b/proto/onboardingservice/v1/onboarding.proto @@ -0,0 +1,95 @@ +syntax = "proto3"; + +// Vendored subset of saas-proto proto/onboardingservice/v1/onboarding.proto. +// saas-proto is the source of truth. Field names, numbers and types must match +// it exactly. Fields the CLI does not need, and that would pull in private +// saas-proto imports, are left out and reserved here; the decoder skips them as +// unknown fields. Changes must be additive and land in saas-proto first. +package onboardingservice.v1; + +option go_package = "github.com/temporalio/cloud-cli/internal/onboardingservice/v1;onboardingservice"; + +enum StepType { + STEP_TYPE_UNSPECIFIED = 0; + STEP_TYPE_CUSTOMER_DETAILS_COLLECTION = 1; + STEP_TYPE_WAIT_FOR_THROTTLE = 2; + STEP_TYPE_WAIT_FOR_PAYMENT_PROVIDER_SETUP = 3; + STEP_TYPE_PAYMENT_COLLECTION = 4; + STEP_TYPE_WAIT_FOR_ACCOUNT_CREATION = 5; + STEP_TYPE_END_OF_FUNNEL = 6; +} + +message OnboardingState { + // Omitted from this copy: + // 5 stripe_setup_intent_confirmation (Stripe client secret; the CLI never collects payment) + // 8 eligible_promotions + // 9 eligible_billing_plans (private services.saasapi.ui.billingplan.v1 import) + // 10 target_sku_type (temporal.api.cloud.account.beta import) + // 11 billing_provider_details (private api.uiservice.v1 import) + reserved 5, 8, 9, 10, 11; + reserved "stripe_setup_intent_confirmation", "eligible_promotions", "eligible_billing_plans", + "target_sku_type", "billing_provider_details"; + + // Indicates the current step of the funnel the user is on + StepType current_step = 1; + + CustomerDetailsCollectionStepInformation customer_details_collection = 2; + + WaitForThrottleStepInformation wait_for_throttle = 3; + + WaitForStripeSetupStepInformation stripe_setup = 4; + + WaitForAccountCreationStepInformation wait_for_account_creation = 6; + + string user_email = 7; + + // The Temporal Cloud user id of the user, if available. Empty if the user does not have one yet. + string user_id = 12; +} + +message GetOrCreateCLIOnboardingStateRequest { + // Optional, as is every field in it; the CLI sends whatever its login provides. + CustomerDetails customer_details = 1; +} + +message GetOrCreateCLIOnboardingStateResponse { + bool user_already_exists = 1; + + // Empty if user_already_exists is true. + OnboardingState state = 2; +} + +message WaitForStripeSetupStepInformation { +} + +message WaitForAccountCreationStepInformation { +} + +message WaitForThrottleStepInformation { +} + +message CustomerDetailsCollectionStepInformation { + CustomerDetails details = 1; +} + +message CustomerDetails { + // Omitted from this copy: 6 agree_terms_of_service and 8 purpose (both deprecated upstream). + // 5 was "Industry", removed upstream. + reserved 5, 6, 8; + reserved "agree_terms_of_service", "purpose"; + + // The first name of the customer. + string first_name = 1; + + // The last name of the customer. + string last_name = 2; + + // The name of the company the user is from. If empty, the server defaults to "Personal". + string company_name = 3; + + // The country of the user. + string country = 4; + + // Indicates whether the user is interested in receiving marketing emails from Temporal + bool opt_in_marketing_email = 7; +} diff --git a/proto/onboardingservice/v1/service.proto b/proto/onboardingservice/v1/service.proto new file mode 100644 index 0000000..03e869b --- /dev/null +++ b/proto/onboardingservice/v1/service.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; + +// Vendored subset of saas-proto proto/onboardingservice/v1/service.proto. +// saas-proto is the source of truth. Keep the package, service, RPC and message +// names identical to it: they form the gRPC method path on the wire. Only the +// RPCs the CLI calls are copied here. Changes must be additive and land in +// saas-proto first. +package onboardingservice.v1; + +option go_package = "github.com/temporalio/cloud-cli/internal/onboardingservice/v1;onboardingservice"; + +import "onboardingservice/v1/onboarding.proto"; + +service OnboardingService { + // The endpoint the Temporal CLI signup command polls. + // Same contract as GetOrCreateOnboardingState for a CLI-started session. + rpc GetOrCreateCLIOnboardingState(GetOrCreateCLIOnboardingStateRequest) returns (GetOrCreateCLIOnboardingStateResponse) { + } +}