Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterProviderServiceServer(s grpc.ServiceRegistrar, srv ProviderServiceServer)
- type Channel
- type CheckRequest
- type CheckResponse
- type DescribeRequest
- type DescribeResponse
- func (*DescribeResponse) Descriptor() ([]byte, []int)deprecated
- func (x *DescribeResponse) GetDescription() string
- func (x *DescribeResponse) GetKind() string
- func (x *DescribeResponse) GetMessage() *schemapb.Schema
- func (x *DescribeResponse) GetResult() *schemapb.Schema
- func (x *DescribeResponse) GetSettings() *schemapb.Schema
- func (*DescribeResponse) ProtoMessage()
- func (x *DescribeResponse) ProtoReflect() protoreflect.Message
- func (x *DescribeResponse) Reset()
- func (x *DescribeResponse) String() string
- type Failure
- func (*Failure) Descriptor() ([]byte, []int)deprecated
- func (x *Failure) GetCode() string
- func (x *Failure) GetMessage() string
- func (x *Failure) GetPermanent() bool
- func (x *Failure) GetRetryAfter() *durationpb.Duration
- func (*Failure) ProtoMessage()
- func (x *Failure) ProtoReflect() protoreflect.Message
- func (x *Failure) Reset()
- func (x *Failure) String() string
- type ProviderServiceClient
- type ProviderServiceServer
- type SendRequest
- func (*SendRequest) Descriptor() ([]byte, []int)deprecated
- func (x *SendRequest) GetAttempt() int32
- func (x *SendRequest) GetChannel() *Channel
- func (x *SendRequest) GetIdempotencyKey() string
- func (x *SendRequest) GetMessage() []byte
- func (*SendRequest) ProtoMessage()
- func (x *SendRequest) ProtoReflect() protoreflect.Message
- func (x *SendRequest) Reset()
- func (x *SendRequest) String() string
- type SendResponse
- func (*SendResponse) Descriptor() ([]byte, []int)deprecated
- func (x *SendResponse) GetFailure() *Failure
- func (x *SendResponse) GetOutcome() isSendResponse_Outcome
- func (x *SendResponse) GetResult() []byte
- func (*SendResponse) ProtoMessage()
- func (x *SendResponse) ProtoReflect() protoreflect.Message
- func (x *SendResponse) Reset()
- func (x *SendResponse) String() string
- type SendResponse_Failure
- type SendResponse_Result
- type UnimplementedProviderServiceServer
- func (UnimplementedProviderServiceServer) Check(context.Context, *CheckRequest) (*CheckResponse, error)
- func (UnimplementedProviderServiceServer) Describe(context.Context, *DescribeRequest) (*DescribeResponse, error)
- func (UnimplementedProviderServiceServer) Send(context.Context, *SendRequest) (*SendResponse, error)
- type UnsafeProviderServiceServer
Constants ¶
const ( ProviderService_Describe_FullMethodName = "/courier.plugin.v1.ProviderService/Describe" ProviderService_Check_FullMethodName = "/courier.plugin.v1.ProviderService/Check" ProviderService_Send_FullMethodName = "/courier.plugin.v1.ProviderService/Send" )
Variables ¶
var File_proto_courier_plugin_v1_plugin_proto protoreflect.FileDescriptor
var ProviderService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "courier.plugin.v1.ProviderService", HandlerType: (*ProviderServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Describe", Handler: _ProviderService_Describe_Handler, }, { MethodName: "Check", Handler: _ProviderService_Check_Handler, }, { MethodName: "Send", Handler: _ProviderService_Send_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "proto/courier/plugin/v1/plugin.proto", }
ProviderService_ServiceDesc is the grpc.ServiceDesc for ProviderService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterProviderServiceServer ¶
func RegisterProviderServiceServer(s grpc.ServiceRegistrar, srv ProviderServiceServer)
Types ¶
type Channel ¶
type Channel struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// The settings as JSON, validated against DescribeResponse.settings.
Settings []byte `protobuf:"bytes,2,opt,name=settings,proto3" json:"settings,omitempty"`
// contains filtered or unexported fields
}
Channel is one configured channel of the plugin's kind.
func (*Channel) Descriptor
deprecated
func (*Channel) GetSettings ¶
func (*Channel) ProtoMessage ¶
func (*Channel) ProtoMessage()
func (*Channel) ProtoReflect ¶
func (x *Channel) ProtoReflect() protoreflect.Message
type CheckRequest ¶
type CheckRequest struct {
Channel *Channel `protobuf:"bytes,1,opt,name=channel,proto3" json:"channel,omitempty"`
// contains filtered or unexported fields
}
func (*CheckRequest) Descriptor
deprecated
func (*CheckRequest) Descriptor() ([]byte, []int)
Deprecated: Use CheckRequest.ProtoReflect.Descriptor instead.
func (*CheckRequest) GetChannel ¶
func (x *CheckRequest) GetChannel() *Channel
func (*CheckRequest) ProtoMessage ¶
func (*CheckRequest) ProtoMessage()
func (*CheckRequest) ProtoReflect ¶
func (x *CheckRequest) ProtoReflect() protoreflect.Message
func (*CheckRequest) Reset ¶
func (x *CheckRequest) Reset()
func (*CheckRequest) String ¶
func (x *CheckRequest) String() string
type CheckResponse ¶
type CheckResponse struct {
// Empty when the channel works; else what is wrong.
Failure *Failure `protobuf:"bytes,1,opt,name=failure,proto3" json:"failure,omitempty"`
// contains filtered or unexported fields
}
func (*CheckResponse) Descriptor
deprecated
func (*CheckResponse) Descriptor() ([]byte, []int)
Deprecated: Use CheckResponse.ProtoReflect.Descriptor instead.
func (*CheckResponse) GetFailure ¶
func (x *CheckResponse) GetFailure() *Failure
func (*CheckResponse) ProtoMessage ¶
func (*CheckResponse) ProtoMessage()
func (*CheckResponse) ProtoReflect ¶
func (x *CheckResponse) ProtoReflect() protoreflect.Message
func (*CheckResponse) Reset ¶
func (x *CheckResponse) Reset()
func (*CheckResponse) String ¶
func (x *CheckResponse) String() string
type DescribeRequest ¶
type DescribeRequest struct {
// contains filtered or unexported fields
}
func (*DescribeRequest) Descriptor
deprecated
func (*DescribeRequest) Descriptor() ([]byte, []int)
Deprecated: Use DescribeRequest.ProtoReflect.Descriptor instead.
func (*DescribeRequest) ProtoMessage ¶
func (*DescribeRequest) ProtoMessage()
func (*DescribeRequest) ProtoReflect ¶
func (x *DescribeRequest) ProtoReflect() protoreflect.Message
func (*DescribeRequest) Reset ¶
func (x *DescribeRequest) Reset()
func (*DescribeRequest) String ¶
func (x *DescribeRequest) String() string
type DescribeResponse ¶
type DescribeResponse struct {
// The provider's kind: [a-z][a-z0-9_]*, e.g. smsc; the activity is
// Send<Kind> in CamelCase (SendSmsc).
Kind string `protobuf:"bytes,1,opt,name=kind,proto3" json:"kind,omitempty"`
// What the activity does, for the console.
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
// A channel's settings: courier validates a channel against it at
// startup; fields marked secret are masked wherever courier shows them.
Settings *schemapb.Schema `protobuf:"bytes,3,opt,name=settings,proto3" json:"settings,omitempty"`
// A message: the activity's input (courier adds an optional channel
// field naming which channel of this kind delivers it).
Message *schemapb.Schema `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"`
// What Send answers, the activity's output; unset: {id}.
Result *schemapb.Schema `protobuf:"bytes,5,opt,name=result,proto3" json:"result,omitempty"`
// contains filtered or unexported fields
}
func (*DescribeResponse) Descriptor
deprecated
func (*DescribeResponse) Descriptor() ([]byte, []int)
Deprecated: Use DescribeResponse.ProtoReflect.Descriptor instead.
func (*DescribeResponse) GetDescription ¶
func (x *DescribeResponse) GetDescription() string
func (*DescribeResponse) GetKind ¶
func (x *DescribeResponse) GetKind() string
func (*DescribeResponse) GetMessage ¶
func (x *DescribeResponse) GetMessage() *schemapb.Schema
func (*DescribeResponse) GetResult ¶
func (x *DescribeResponse) GetResult() *schemapb.Schema
func (*DescribeResponse) GetSettings ¶
func (x *DescribeResponse) GetSettings() *schemapb.Schema
func (*DescribeResponse) ProtoMessage ¶
func (*DescribeResponse) ProtoMessage()
func (*DescribeResponse) ProtoReflect ¶
func (x *DescribeResponse) ProtoReflect() protoreflect.Message
func (*DescribeResponse) Reset ¶
func (x *DescribeResponse) Reset()
func (*DescribeResponse) String ¶
func (x *DescribeResponse) String() string
type Failure ¶
type Failure struct {
Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
// The provider's own code, for the audit record.
Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
// Retrying cannot help: the message or the recipient is wrong.
Permanent bool `protobuf:"varint,3,opt,name=permanent,proto3" json:"permanent,omitempty"`
// The provider asked to wait this long before the next attempt.
RetryAfter *durationpb.Duration `protobuf:"bytes,4,opt,name=retry_after,json=retryAfter,proto3" json:"retry_after,omitempty"`
// contains filtered or unexported fields
}
Failure is why a delivery or a check did not work.
func (*Failure) Descriptor
deprecated
func (*Failure) GetMessage ¶
func (*Failure) GetPermanent ¶
func (*Failure) GetRetryAfter ¶
func (x *Failure) GetRetryAfter() *durationpb.Duration
func (*Failure) ProtoMessage ¶
func (*Failure) ProtoMessage()
func (*Failure) ProtoReflect ¶
func (x *Failure) ProtoReflect() protoreflect.Message
type ProviderServiceClient ¶
type ProviderServiceClient interface {
// What the plugin delivers and the shapes of its settings and messages.
Describe(ctx context.Context, in *DescribeRequest, opts ...grpc.CallOption) (*DescribeResponse, error)
// Checks a channel's settings against the provider without delivering:
// credentials, account, reachability. Courier calls it at startup and
// when an operator checks the channel in the console.
Check(ctx context.Context, in *CheckRequest, opts ...grpc.CallOption) (*CheckResponse, error)
// Delivers one message through a channel.
Send(ctx context.Context, in *SendRequest, opts ...grpc.CallOption) (*SendResponse, error)
}
ProviderServiceClient is the client API for ProviderService 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.
ProviderService is what a courier plugin implements: one delivery provider courier does not know (an SMS gateway, a messenger, a webhook). Courier dials the plugin at its configured address (where and how it runs is the deployment's concern), asks Describe once at startup, declares the activity Send<Kind> with the message schema the plugin gives, and calls Send for every delivery. The contract evolves as protobuf does: new fields are added, numbers are never reused; an incompatible change is a new package.
func NewProviderServiceClient ¶
func NewProviderServiceClient(cc grpc.ClientConnInterface) ProviderServiceClient
type ProviderServiceServer ¶
type ProviderServiceServer interface {
// What the plugin delivers and the shapes of its settings and messages.
Describe(context.Context, *DescribeRequest) (*DescribeResponse, error)
// Checks a channel's settings against the provider without delivering:
// credentials, account, reachability. Courier calls it at startup and
// when an operator checks the channel in the console.
Check(context.Context, *CheckRequest) (*CheckResponse, error)
// Delivers one message through a channel.
Send(context.Context, *SendRequest) (*SendResponse, error)
// contains filtered or unexported methods
}
ProviderServiceServer is the server API for ProviderService service. All implementations must embed UnimplementedProviderServiceServer for forward compatibility.
ProviderService is what a courier plugin implements: one delivery provider courier does not know (an SMS gateway, a messenger, a webhook). Courier dials the plugin at its configured address (where and how it runs is the deployment's concern), asks Describe once at startup, declares the activity Send<Kind> with the message schema the plugin gives, and calls Send for every delivery. The contract evolves as protobuf does: new fields are added, numbers are never reused; an incompatible change is a new package.
type SendRequest ¶
type SendRequest struct {
Channel *Channel `protobuf:"bytes,1,opt,name=channel,proto3" json:"channel,omitempty"`
// The message as JSON, validated against DescribeResponse.message.
Message []byte `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
// The same for every attempt of one delivery: what the plugin passes to
// its provider as an idempotency key when the provider takes one.
IdempotencyKey string `protobuf:"bytes,3,opt,name=idempotency_key,json=idempotencyKey,proto3" json:"idempotency_key,omitempty"`
// 1 for the first attempt.
Attempt int32 `protobuf:"varint,4,opt,name=attempt,proto3" json:"attempt,omitempty"`
// contains filtered or unexported fields
}
func (*SendRequest) Descriptor
deprecated
func (*SendRequest) Descriptor() ([]byte, []int)
Deprecated: Use SendRequest.ProtoReflect.Descriptor instead.
func (*SendRequest) GetAttempt ¶
func (x *SendRequest) GetAttempt() int32
func (*SendRequest) GetChannel ¶
func (x *SendRequest) GetChannel() *Channel
func (*SendRequest) GetIdempotencyKey ¶
func (x *SendRequest) GetIdempotencyKey() string
func (*SendRequest) GetMessage ¶
func (x *SendRequest) GetMessage() []byte
func (*SendRequest) ProtoMessage ¶
func (*SendRequest) ProtoMessage()
func (*SendRequest) ProtoReflect ¶
func (x *SendRequest) ProtoReflect() protoreflect.Message
func (*SendRequest) Reset ¶
func (x *SendRequest) Reset()
func (*SendRequest) String ¶
func (x *SendRequest) String() string
type SendResponse ¶
type SendResponse struct {
// Types that are valid to be assigned to Outcome:
//
// *SendResponse_Result
// *SendResponse_Failure
Outcome isSendResponse_Outcome `protobuf_oneof:"outcome"`
// contains filtered or unexported fields
}
func (*SendResponse) Descriptor
deprecated
func (*SendResponse) Descriptor() ([]byte, []int)
Deprecated: Use SendResponse.ProtoReflect.Descriptor instead.
func (*SendResponse) GetFailure ¶
func (x *SendResponse) GetFailure() *Failure
func (*SendResponse) GetOutcome ¶
func (x *SendResponse) GetOutcome() isSendResponse_Outcome
func (*SendResponse) GetResult ¶
func (x *SendResponse) GetResult() []byte
func (*SendResponse) ProtoMessage ¶
func (*SendResponse) ProtoMessage()
func (*SendResponse) ProtoReflect ¶
func (x *SendResponse) ProtoReflect() protoreflect.Message
func (*SendResponse) Reset ¶
func (x *SendResponse) Reset()
func (*SendResponse) String ¶
func (x *SendResponse) String() string
type SendResponse_Failure ¶
type SendResponse_Failure struct {
Failure *Failure `protobuf:"bytes,2,opt,name=failure,proto3,oneof"`
}
type SendResponse_Result ¶
type SendResponse_Result struct {
// The result as JSON, matching DescribeResponse.result.
Result []byte `protobuf:"bytes,1,opt,name=result,proto3,oneof"`
}
type UnimplementedProviderServiceServer ¶
type UnimplementedProviderServiceServer struct{}
UnimplementedProviderServiceServer 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 (UnimplementedProviderServiceServer) Check ¶
func (UnimplementedProviderServiceServer) Check(context.Context, *CheckRequest) (*CheckResponse, error)
func (UnimplementedProviderServiceServer) Describe ¶
func (UnimplementedProviderServiceServer) Describe(context.Context, *DescribeRequest) (*DescribeResponse, error)
func (UnimplementedProviderServiceServer) Send ¶
func (UnimplementedProviderServiceServer) Send(context.Context, *SendRequest) (*SendResponse, error)
type UnsafeProviderServiceServer ¶
type UnsafeProviderServiceServer interface {
// contains filtered or unexported methods
}
UnsafeProviderServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ProviderServiceServer will result in compilation errors.