v1

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Overview

Package v1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	NotificationService_SendNotification_FullMethodName = "/notification.v1.NotificationService/SendNotification"
	NotificationService_GetNotification_FullMethodName  = "/notification.v1.NotificationService/GetNotification"
)

Variables

View Source
var (
	NotificationType_name = map[int32]string{
		0: "NOTIFICATION_TYPE_UNSPECIFIED",
		1: "NOTIFICATION_TYPE_EMAIL",
		2: "NOTIFICATION_TYPE_SMS",
		3: "NOTIFICATION_TYPE_PUSH",
	}
	NotificationType_value = map[string]int32{
		"NOTIFICATION_TYPE_UNSPECIFIED": 0,
		"NOTIFICATION_TYPE_EMAIL":       1,
		"NOTIFICATION_TYPE_SMS":         2,
		"NOTIFICATION_TYPE_PUSH":        3,
	}
)

Enum value maps for NotificationType.

View Source
var (
	NotificationStatus_name = map[int32]string{
		0: "NOTIFICATION_STATUS_UNSPECIFIED",
		1: "NOTIFICATION_STATUS_PENDING",
		2: "NOTIFICATION_STATUS_SENT",
		3: "NOTIFICATION_STATUS_FAILED",
	}
	NotificationStatus_value = map[string]int32{
		"NOTIFICATION_STATUS_UNSPECIFIED": 0,
		"NOTIFICATION_STATUS_PENDING":     1,
		"NOTIFICATION_STATUS_SENT":        2,
		"NOTIFICATION_STATUS_FAILED":      3,
	}
)

Enum value maps for NotificationStatus.

View Source
var File_notification_v1_notification_proto protoreflect.FileDescriptor
View Source
var NotificationService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "notification.v1.NotificationService",
	HandlerType: (*NotificationServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "SendNotification",
			Handler:    _NotificationService_SendNotification_Handler,
		},
		{
			MethodName: "GetNotification",
			Handler:    _NotificationService_GetNotification_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "notification/v1/notification.proto",
}

NotificationService_ServiceDesc is the grpc.ServiceDesc for NotificationService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterNotificationServiceHandler added in v1.2.0

func RegisterNotificationServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterNotificationServiceHandler registers the http handlers for service NotificationService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterNotificationServiceHandlerClient added in v1.2.0

func RegisterNotificationServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client NotificationServiceClient) error

RegisterNotificationServiceHandlerClient registers the http handlers for service NotificationService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "NotificationServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "NotificationServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "NotificationServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.

func RegisterNotificationServiceHandlerFromEndpoint added in v1.2.0

func RegisterNotificationServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterNotificationServiceHandlerFromEndpoint is same as RegisterNotificationServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterNotificationServiceHandlerServer added in v1.2.0

func RegisterNotificationServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server NotificationServiceServer) error

RegisterNotificationServiceHandlerServer registers the http handlers for service NotificationService to "mux". UnaryRPC :call NotificationServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterNotificationServiceHandlerFromEndpoint instead. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.

func RegisterNotificationServiceServer

func RegisterNotificationServiceServer(s grpc.ServiceRegistrar, srv NotificationServiceServer)

Types

type GetNotificationRequest

type GetNotificationRequest struct {
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

Request to poll the delivery status of a specific message.

func (*GetNotificationRequest) Descriptor deprecated

func (*GetNotificationRequest) Descriptor() ([]byte, []int)

Deprecated: Use GetNotificationRequest.ProtoReflect.Descriptor instead.

func (*GetNotificationRequest) GetId

func (x *GetNotificationRequest) GetId() string

func (*GetNotificationRequest) ProtoMessage

func (*GetNotificationRequest) ProtoMessage()

func (*GetNotificationRequest) ProtoReflect

func (x *GetNotificationRequest) ProtoReflect() protoreflect.Message

func (*GetNotificationRequest) Reset

func (x *GetNotificationRequest) Reset()

func (*GetNotificationRequest) String

func (x *GetNotificationRequest) String() string

func (*GetNotificationRequest) Validate

func (m *GetNotificationRequest) Validate() error

Validate checks the field values on GetNotificationRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*GetNotificationRequest) ValidateAll

func (m *GetNotificationRequest) ValidateAll() error

ValidateAll checks the field values on GetNotificationRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in GetNotificationRequestMultiError, or nil if none found.

type GetNotificationRequestMultiError

type GetNotificationRequestMultiError []error

GetNotificationRequestMultiError is an error wrapping multiple validation errors returned by GetNotificationRequest.ValidateAll() if the designated constraints aren't met.

func (GetNotificationRequestMultiError) AllErrors

func (m GetNotificationRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (GetNotificationRequestMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type GetNotificationRequestValidationError

type GetNotificationRequestValidationError struct {
	// contains filtered or unexported fields
}

GetNotificationRequestValidationError is the validation error returned by GetNotificationRequest.Validate if the designated constraints aren't met.

func (GetNotificationRequestValidationError) Cause

Cause function returns cause value.

func (GetNotificationRequestValidationError) Error

Error satisfies the builtin error interface

func (GetNotificationRequestValidationError) ErrorName

ErrorName returns error name.

func (GetNotificationRequestValidationError) Field

Field function returns field value.

func (GetNotificationRequestValidationError) Key

Key function returns key value.

func (GetNotificationRequestValidationError) Reason

Reason function returns reason value.

type GetNotificationResponse

type GetNotificationResponse struct {
	Notification *Notification `protobuf:"bytes,1,opt,name=notification,proto3" json:"notification,omitempty"`
	// contains filtered or unexported fields
}

Response returning the delivery status of the message.

func (*GetNotificationResponse) Descriptor deprecated

func (*GetNotificationResponse) Descriptor() ([]byte, []int)

Deprecated: Use GetNotificationResponse.ProtoReflect.Descriptor instead.

func (*GetNotificationResponse) GetNotification

func (x *GetNotificationResponse) GetNotification() *Notification

func (*GetNotificationResponse) ProtoMessage

func (*GetNotificationResponse) ProtoMessage()

func (*GetNotificationResponse) ProtoReflect

func (x *GetNotificationResponse) ProtoReflect() protoreflect.Message

func (*GetNotificationResponse) Reset

func (x *GetNotificationResponse) Reset()

func (*GetNotificationResponse) String

func (x *GetNotificationResponse) String() string

func (*GetNotificationResponse) Validate

func (m *GetNotificationResponse) Validate() error

Validate checks the field values on GetNotificationResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*GetNotificationResponse) ValidateAll

func (m *GetNotificationResponse) ValidateAll() error

ValidateAll checks the field values on GetNotificationResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in GetNotificationResponseMultiError, or nil if none found.

type GetNotificationResponseMultiError

type GetNotificationResponseMultiError []error

GetNotificationResponseMultiError is an error wrapping multiple validation errors returned by GetNotificationResponse.ValidateAll() if the designated constraints aren't met.

func (GetNotificationResponseMultiError) AllErrors

func (m GetNotificationResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (GetNotificationResponseMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type GetNotificationResponseValidationError

type GetNotificationResponseValidationError struct {
	// contains filtered or unexported fields
}

GetNotificationResponseValidationError is the validation error returned by GetNotificationResponse.Validate if the designated constraints aren't met.

func (GetNotificationResponseValidationError) Cause

Cause function returns cause value.

func (GetNotificationResponseValidationError) Error

Error satisfies the builtin error interface

func (GetNotificationResponseValidationError) ErrorName

ErrorName returns error name.

func (GetNotificationResponseValidationError) Field

Field function returns field value.

func (GetNotificationResponseValidationError) Key

Key function returns key value.

func (GetNotificationResponseValidationError) Reason

Reason function returns reason value.

type Notification

type Notification struct {
	Id     string           `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	UserId string           `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	Type   NotificationType `protobuf:"varint,3,opt,name=type,proto3,enum=notification.v1.NotificationType" json:"type,omitempty"`
	// The contact destination (email address or phone number)
	Destination string             `protobuf:"bytes,4,opt,name=destination,proto3" json:"destination,omitempty"`
	Subject     string             `protobuf:"bytes,5,opt,name=subject,proto3" json:"subject,omitempty"`
	Body        string             `protobuf:"bytes,6,opt,name=body,proto3" json:"body,omitempty"`
	Status      NotificationStatus `protobuf:"varint,7,opt,name=status,proto3,enum=notification.v1.NotificationStatus" json:"status,omitempty"`
	CreatedAt   string             `protobuf:"bytes,8,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	SentAt      string             `protobuf:"bytes,9,opt,name=sent_at,json=sentAt,proto3" json:"sent_at,omitempty"`
	// contains filtered or unexported fields
}

Notification represents an outbound transactional message.

func (*Notification) Descriptor deprecated

func (*Notification) Descriptor() ([]byte, []int)

Deprecated: Use Notification.ProtoReflect.Descriptor instead.

func (*Notification) GetBody

func (x *Notification) GetBody() string

func (*Notification) GetCreatedAt

func (x *Notification) GetCreatedAt() string

func (*Notification) GetDestination

func (x *Notification) GetDestination() string

func (*Notification) GetId

func (x *Notification) GetId() string

func (*Notification) GetSentAt

func (x *Notification) GetSentAt() string

func (*Notification) GetStatus

func (x *Notification) GetStatus() NotificationStatus

func (*Notification) GetSubject

func (x *Notification) GetSubject() string

func (*Notification) GetType

func (x *Notification) GetType() NotificationType

func (*Notification) GetUserId

func (x *Notification) GetUserId() string

func (*Notification) ProtoMessage

func (*Notification) ProtoMessage()

func (*Notification) ProtoReflect

func (x *Notification) ProtoReflect() protoreflect.Message

func (*Notification) Reset

func (x *Notification) Reset()

func (*Notification) String

func (x *Notification) String() string

func (*Notification) Validate

func (m *Notification) Validate() error

Validate checks the field values on Notification with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Notification) ValidateAll

func (m *Notification) ValidateAll() error

ValidateAll checks the field values on Notification with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in NotificationMultiError, or nil if none found.

type NotificationMultiError

type NotificationMultiError []error

NotificationMultiError is an error wrapping multiple validation errors returned by Notification.ValidateAll() if the designated constraints aren't met.

func (NotificationMultiError) AllErrors

func (m NotificationMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (NotificationMultiError) Error

func (m NotificationMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type NotificationServiceClient

type NotificationServiceClient interface {
	SendNotification(ctx context.Context, in *SendNotificationRequest, opts ...grpc.CallOption) (*SendNotificationResponse, error)
	GetNotification(ctx context.Context, in *GetNotificationRequest, opts ...grpc.CallOption) (*GetNotificationResponse, error)
}

NotificationServiceClient is the client API for NotificationService 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.

NotificationService abstracts interactions with third-party providers (SendGrid, SNS, etc.)

type NotificationServiceServer

type NotificationServiceServer interface {
	SendNotification(context.Context, *SendNotificationRequest) (*SendNotificationResponse, error)
	GetNotification(context.Context, *GetNotificationRequest) (*GetNotificationResponse, error)
	// contains filtered or unexported methods
}

NotificationServiceServer is the server API for NotificationService service. All implementations must embed UnimplementedNotificationServiceServer for forward compatibility.

NotificationService abstracts interactions with third-party providers (SendGrid, SNS, etc.)

type NotificationStatus

type NotificationStatus int32

The delivery state of a scheduled notification.

const (
	NotificationStatus_NOTIFICATION_STATUS_UNSPECIFIED NotificationStatus = 0
	NotificationStatus_NOTIFICATION_STATUS_PENDING     NotificationStatus = 1
	NotificationStatus_NOTIFICATION_STATUS_SENT        NotificationStatus = 2
	NotificationStatus_NOTIFICATION_STATUS_FAILED      NotificationStatus = 3
)

func (NotificationStatus) Descriptor

func (NotificationStatus) Enum

func (NotificationStatus) EnumDescriptor deprecated

func (NotificationStatus) EnumDescriptor() ([]byte, []int)

Deprecated: Use NotificationStatus.Descriptor instead.

func (NotificationStatus) Number

func (NotificationStatus) String

func (x NotificationStatus) String() string

func (NotificationStatus) Type

type NotificationType

type NotificationType int32

How the notification should be delivered to the user.

const (
	NotificationType_NOTIFICATION_TYPE_UNSPECIFIED NotificationType = 0
	NotificationType_NOTIFICATION_TYPE_EMAIL       NotificationType = 1
	NotificationType_NOTIFICATION_TYPE_SMS         NotificationType = 2
	NotificationType_NOTIFICATION_TYPE_PUSH        NotificationType = 3
)

func (NotificationType) Descriptor

func (NotificationType) Enum

func (NotificationType) EnumDescriptor deprecated

func (NotificationType) EnumDescriptor() ([]byte, []int)

Deprecated: Use NotificationType.Descriptor instead.

func (NotificationType) Number

func (NotificationType) String

func (x NotificationType) String() string

func (NotificationType) Type

type NotificationValidationError

type NotificationValidationError struct {
	// contains filtered or unexported fields
}

NotificationValidationError is the validation error returned by Notification.Validate if the designated constraints aren't met.

func (NotificationValidationError) Cause

Cause function returns cause value.

func (NotificationValidationError) Error

Error satisfies the builtin error interface

func (NotificationValidationError) ErrorName

func (e NotificationValidationError) ErrorName() string

ErrorName returns error name.

func (NotificationValidationError) Field

Field function returns field value.

func (NotificationValidationError) Key

Key function returns key value.

func (NotificationValidationError) Reason

Reason function returns reason value.

type SendNotificationRequest

type SendNotificationRequest struct {
	UserId      string           `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	Type        NotificationType `protobuf:"varint,2,opt,name=type,proto3,enum=notification.v1.NotificationType" json:"type,omitempty"`
	Destination string           `protobuf:"bytes,3,opt,name=destination,proto3" json:"destination,omitempty"`
	Subject     string           `protobuf:"bytes,4,opt,name=subject,proto3" json:"subject,omitempty"` // Optional for SMS/Push
	Body        string           `protobuf:"bytes,5,opt,name=body,proto3" json:"body,omitempty"`
	// contains filtered or unexported fields
}

Request to queue an outbound email, text, or push alert.

func (*SendNotificationRequest) Descriptor deprecated

func (*SendNotificationRequest) Descriptor() ([]byte, []int)

Deprecated: Use SendNotificationRequest.ProtoReflect.Descriptor instead.

func (*SendNotificationRequest) GetBody

func (x *SendNotificationRequest) GetBody() string

func (*SendNotificationRequest) GetDestination

func (x *SendNotificationRequest) GetDestination() string

func (*SendNotificationRequest) GetSubject

func (x *SendNotificationRequest) GetSubject() string

func (*SendNotificationRequest) GetType

func (*SendNotificationRequest) GetUserId

func (x *SendNotificationRequest) GetUserId() string

func (*SendNotificationRequest) ProtoMessage

func (*SendNotificationRequest) ProtoMessage()

func (*SendNotificationRequest) ProtoReflect

func (x *SendNotificationRequest) ProtoReflect() protoreflect.Message

func (*SendNotificationRequest) Reset

func (x *SendNotificationRequest) Reset()

func (*SendNotificationRequest) String

func (x *SendNotificationRequest) String() string

func (*SendNotificationRequest) Validate

func (m *SendNotificationRequest) Validate() error

Validate checks the field values on SendNotificationRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*SendNotificationRequest) ValidateAll

func (m *SendNotificationRequest) ValidateAll() error

ValidateAll checks the field values on SendNotificationRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in SendNotificationRequestMultiError, or nil if none found.

type SendNotificationRequestMultiError

type SendNotificationRequestMultiError []error

SendNotificationRequestMultiError is an error wrapping multiple validation errors returned by SendNotificationRequest.ValidateAll() if the designated constraints aren't met.

func (SendNotificationRequestMultiError) AllErrors

func (m SendNotificationRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (SendNotificationRequestMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type SendNotificationRequestValidationError

type SendNotificationRequestValidationError struct {
	// contains filtered or unexported fields
}

SendNotificationRequestValidationError is the validation error returned by SendNotificationRequest.Validate if the designated constraints aren't met.

func (SendNotificationRequestValidationError) Cause

Cause function returns cause value.

func (SendNotificationRequestValidationError) Error

Error satisfies the builtin error interface

func (SendNotificationRequestValidationError) ErrorName

ErrorName returns error name.

func (SendNotificationRequestValidationError) Field

Field function returns field value.

func (SendNotificationRequestValidationError) Key

Key function returns key value.

func (SendNotificationRequestValidationError) Reason

Reason function returns reason value.

type SendNotificationResponse

type SendNotificationResponse struct {
	Notification *Notification `protobuf:"bytes,1,opt,name=notification,proto3" json:"notification,omitempty"`
	// contains filtered or unexported fields
}

Response after queuing a notification.

func (*SendNotificationResponse) Descriptor deprecated

func (*SendNotificationResponse) Descriptor() ([]byte, []int)

Deprecated: Use SendNotificationResponse.ProtoReflect.Descriptor instead.

func (*SendNotificationResponse) GetNotification

func (x *SendNotificationResponse) GetNotification() *Notification

func (*SendNotificationResponse) ProtoMessage

func (*SendNotificationResponse) ProtoMessage()

func (*SendNotificationResponse) ProtoReflect

func (x *SendNotificationResponse) ProtoReflect() protoreflect.Message

func (*SendNotificationResponse) Reset

func (x *SendNotificationResponse) Reset()

func (*SendNotificationResponse) String

func (x *SendNotificationResponse) String() string

func (*SendNotificationResponse) Validate

func (m *SendNotificationResponse) Validate() error

Validate checks the field values on SendNotificationResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*SendNotificationResponse) ValidateAll

func (m *SendNotificationResponse) ValidateAll() error

ValidateAll checks the field values on SendNotificationResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in SendNotificationResponseMultiError, or nil if none found.

type SendNotificationResponseMultiError

type SendNotificationResponseMultiError []error

SendNotificationResponseMultiError is an error wrapping multiple validation errors returned by SendNotificationResponse.ValidateAll() if the designated constraints aren't met.

func (SendNotificationResponseMultiError) AllErrors

func (m SendNotificationResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (SendNotificationResponseMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type SendNotificationResponseValidationError

type SendNotificationResponseValidationError struct {
	// contains filtered or unexported fields
}

SendNotificationResponseValidationError is the validation error returned by SendNotificationResponse.Validate if the designated constraints aren't met.

func (SendNotificationResponseValidationError) Cause

Cause function returns cause value.

func (SendNotificationResponseValidationError) Error

Error satisfies the builtin error interface

func (SendNotificationResponseValidationError) ErrorName

ErrorName returns error name.

func (SendNotificationResponseValidationError) Field

Field function returns field value.

func (SendNotificationResponseValidationError) Key

Key function returns key value.

func (SendNotificationResponseValidationError) Reason

Reason function returns reason value.

type UnimplementedNotificationServiceServer

type UnimplementedNotificationServiceServer struct{}

UnimplementedNotificationServiceServer 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.

func (UnimplementedNotificationServiceServer) GetNotification

func (UnimplementedNotificationServiceServer) SendNotification

type UnsafeNotificationServiceServer

type UnsafeNotificationServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeNotificationServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to NotificationServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL