Callbacks service docs updated
This commit is contained in:
8
api/edge/callbacks/internal/model/callback.go
Normal file
8
api/edge/callbacks/internal/model/callback.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package model
|
||||
|
||||
import pmodel "github.com/tech/sendico/pkg/model"
|
||||
|
||||
type CallbackInternal struct {
|
||||
pmodel.Callback `bson:",inline" json:",inline"`
|
||||
SecretRef string `bson:"secretRef"`
|
||||
}
|
||||
22
api/edge/callbacks/internal/model/endpoint.go
Normal file
22
api/edge/callbacks/internal/model/endpoint.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/tech/sendico/pkg/db/storable"
|
||||
pmodel "github.com/tech/sendico/pkg/model"
|
||||
)
|
||||
|
||||
// Endpoint describes one target callback endpoint.
|
||||
type Endpoint struct {
|
||||
storable.Base
|
||||
pmodel.OrganizationBoundBase
|
||||
URL string
|
||||
SigningMode string
|
||||
SecretRef string
|
||||
Headers map[string]string
|
||||
MaxAttempts int
|
||||
MinDelay time.Duration
|
||||
MaxDelay time.Duration
|
||||
RequestTimeout time.Duration
|
||||
}
|
||||
37
api/edge/callbacks/internal/model/task.go
Normal file
37
api/edge/callbacks/internal/model/task.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/tech/sendico/pkg/db/storable"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
)
|
||||
|
||||
// TaskStatus tracks delivery task lifecycle.
|
||||
type TaskStatus string
|
||||
|
||||
const (
|
||||
TaskStatusPending TaskStatus = "PENDING"
|
||||
TaskStatusRetry TaskStatus = "RETRY"
|
||||
TaskStatusDelivered TaskStatus = "DELIVERED"
|
||||
TaskStatusFailed TaskStatus = "FAILED"
|
||||
)
|
||||
|
||||
// Task is one callback delivery job.
|
||||
type Task struct {
|
||||
storable.Base
|
||||
EventID string
|
||||
EndpointRef bson.ObjectID
|
||||
EndpointURL string
|
||||
SigningMode string
|
||||
SecretRef string
|
||||
Headers map[string]string
|
||||
Payload []byte
|
||||
Attempt int
|
||||
MaxAttempts int
|
||||
MinDelay time.Duration
|
||||
MaxDelay time.Duration
|
||||
RequestTimeout time.Duration
|
||||
Status TaskStatus
|
||||
NextAttemptAt time.Time
|
||||
}
|
||||
Reference in New Issue
Block a user