Set delivery to FAILURE if [client|user|message|channel] no longer exists
This commit is contained in:
parent
e329e13a02
commit
4c7632a144
@ -4,6 +4,12 @@ run:
|
|||||||
flutter pub run build_runner build
|
flutter pub run build_runner build
|
||||||
flutter run
|
flutter run
|
||||||
|
|
||||||
|
run-android:
|
||||||
|
ping -c1 10.10.10.177
|
||||||
|
adb connect 10.10.10.177:5555
|
||||||
|
flutter pub run build_runner build
|
||||||
|
flutter run -d 10.10.10.177:5555
|
||||||
|
|
||||||
test:
|
test:
|
||||||
dart analyze
|
dart analyze
|
||||||
|
|
||||||
|
@ -52,6 +52,18 @@ func (db *Database) GetClient(ctx db.TxContext, userid models.UserID, clientid m
|
|||||||
}, sq.SModeExtended, sq.Safe)
|
}, sq.SModeExtended, sq.Safe)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (db *Database) GetClientOpt(ctx db.TxContext, userid models.UserID, clientid models.ClientID) (*models.Client, error) {
|
||||||
|
tx, err := ctx.GetOrCreateTransaction(db)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return sq.QuerySingleOpt[models.Client](ctx, tx, "SELECT * FROM clients WHERE deleted=0 AND user_id = :uid AND client_id = :cid LIMIT 1", sq.PP{
|
||||||
|
"uid": userid,
|
||||||
|
"cid": clientid,
|
||||||
|
}, sq.SModeExtended, sq.Safe)
|
||||||
|
}
|
||||||
|
|
||||||
func (db *Database) DeleteClient(ctx db.TxContext, clientid models.ClientID) error {
|
func (db *Database) DeleteClient(ctx db.TxContext, clientid models.ClientID) error {
|
||||||
tx, err := ctx.GetOrCreateTransaction(db)
|
tx, err := ctx.GetOrCreateTransaction(db)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -62,6 +62,15 @@ func (db *Database) GetUser(ctx db.TxContext, userid models.UserID) (models.User
|
|||||||
return sq.QuerySingle[models.User](ctx, tx, "SELECT * FROM users WHERE user_id = :uid LIMIT 1", sq.PP{"uid": userid}, sq.SModeExtended, sq.Safe)
|
return sq.QuerySingle[models.User](ctx, tx, "SELECT * FROM users WHERE user_id = :uid LIMIT 1", sq.PP{"uid": userid}, sq.SModeExtended, sq.Safe)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (db *Database) GetUserOpt(ctx db.TxContext, userid models.UserID) (*models.User, error) {
|
||||||
|
tx, err := ctx.GetOrCreateTransaction(db)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return sq.QuerySingleOpt[models.User](ctx, tx, "SELECT * FROM users WHERE user_id = :uid LIMIT 1", sq.PP{"uid": userid}, sq.SModeExtended, sq.Safe)
|
||||||
|
}
|
||||||
|
|
||||||
func (db *Database) UpdateUserUsername(ctx db.TxContext, userid models.UserID, username *string) error {
|
func (db *Database) UpdateUserUsername(ctx db.TxContext, userid models.UserID, username *string) error {
|
||||||
tx, err := ctx.GetOrCreateTransaction(db)
|
tx, err := ctx.GetOrCreateTransaction(db)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -134,12 +134,30 @@ func (j *DeliveryRetryJob) execute() (fastrr bool, err error) {
|
|||||||
|
|
||||||
func (j *DeliveryRetryJob) redeliver(ctx *simplectx.SimpleContext, delivery models.Delivery) {
|
func (j *DeliveryRetryJob) redeliver(ctx *simplectx.SimpleContext, delivery models.Delivery) {
|
||||||
|
|
||||||
client, err := j.app.Database.Primary.GetClient(ctx, delivery.ReceiverUserID, delivery.ReceiverClientID)
|
client, err := j.app.Database.Primary.GetClientOpt(ctx, delivery.ReceiverUserID, delivery.ReceiverClientID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Err(err).Str("ReceiverUserID", delivery.ReceiverUserID.String()).Str("ReceiverClientID", delivery.ReceiverClientID.String()).Msg("Failed to get client")
|
log.Err(err).Str("ReceiverUserID", delivery.ReceiverUserID.String()).Str("ReceiverClientID", delivery.ReceiverClientID.String()).Msg("Failed to get client")
|
||||||
ctx.RollbackTransaction()
|
ctx.RollbackTransaction()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if client == nil {
|
||||||
|
log.Error().Str("ReceiverUserID", delivery.ReceiverUserID.String()).Str("ReceiverClientID", delivery.ReceiverClientID.String()).Msg("Failed to get client (client no longer exists)")
|
||||||
|
|
||||||
|
err = j.app.Database.Primary.SetDeliveryFailed(ctx, delivery)
|
||||||
|
if err != nil {
|
||||||
|
log.Err(err).Str("MessageID", delivery.MessageID.String()).Str("DeliveryID", delivery.DeliveryID.String()).Msg("Failed to update delivery")
|
||||||
|
ctx.RollbackTransaction()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.Warn().Str("MessageID", delivery.MessageID.String()).Str("DeliveryID", delivery.DeliveryID.String()).Msg("Delivery failed because of [client==null] (set to FAILURE)")
|
||||||
|
|
||||||
|
err = ctx.CommitTransaction()
|
||||||
|
if err != nil {
|
||||||
|
log.Err(err).Msg("Failed to commit transaction")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
msg, err := j.app.Database.Primary.GetMessage(ctx, delivery.MessageID, true)
|
msg, err := j.app.Database.Primary.GetMessage(ctx, delivery.MessageID, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -148,25 +166,6 @@ func (j *DeliveryRetryJob) redeliver(ctx *simplectx.SimpleContext, delivery mode
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
user, err := j.app.Database.Primary.GetUser(ctx, delivery.ReceiverUserID)
|
|
||||||
if err != nil {
|
|
||||||
log.Err(err).Str("ReceiverUserID", delivery.ReceiverUserID.String()).Msg("Failed to get user")
|
|
||||||
ctx.RollbackTransaction()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
channel, err := j.app.Database.Primary.GetChannelByID(ctx, msg.ChannelID)
|
|
||||||
if err != nil {
|
|
||||||
log.Err(err).Str("ChannelID", msg.ChannelID.String()).Msg("Failed to get channel")
|
|
||||||
ctx.RollbackTransaction()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if channel == nil {
|
|
||||||
log.Error().Str("ChannelID", msg.ChannelID.String()).Msg("Failed to get channel")
|
|
||||||
ctx.RollbackTransaction()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if msg.Deleted {
|
if msg.Deleted {
|
||||||
err = j.app.Database.Primary.SetDeliveryFailed(ctx, delivery)
|
err = j.app.Database.Primary.SetDeliveryFailed(ctx, delivery)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -174,9 +173,68 @@ func (j *DeliveryRetryJob) redeliver(ctx *simplectx.SimpleContext, delivery mode
|
|||||||
ctx.RollbackTransaction()
|
ctx.RollbackTransaction()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
log.Warn().Str("MessageID", delivery.MessageID.String()).Str("DeliveryID", delivery.DeliveryID.String()).Msg("Delivery failed because of [message.deleted] (set to FAILURE)")
|
||||||
|
|
||||||
fcmDelivID, err := j.app.DeliverMessage(ctx, user, client, *channel, msg)
|
err = ctx.CommitTransaction()
|
||||||
|
if err != nil {
|
||||||
|
log.Err(err).Msg("Failed to commit transaction")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
user, err := j.app.Database.Primary.GetUserOpt(ctx, delivery.ReceiverUserID)
|
||||||
|
if err != nil {
|
||||||
|
log.Err(err).Str("ReceiverUserID", delivery.ReceiverUserID.String()).Msg("Failed to get user")
|
||||||
|
ctx.RollbackTransaction()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if user == nil {
|
||||||
|
log.Error().Str("ReceiverUserID", delivery.ReceiverUserID.String()).Str("ChannelID", msg.ChannelID.String()).Msg("Failed to get user (user no longer exists)")
|
||||||
|
|
||||||
|
err = j.app.Database.Primary.SetDeliveryFailed(ctx, delivery)
|
||||||
|
if err != nil {
|
||||||
|
log.Err(err).Str("MessageID", delivery.MessageID.String()).Str("DeliveryID", delivery.DeliveryID.String()).Msg("Failed to update delivery")
|
||||||
|
ctx.RollbackTransaction()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.Warn().Str("MessageID", delivery.MessageID.String()).Str("DeliveryID", delivery.DeliveryID.String()).Msg("Delivery failed because of [user==null] (set to FAILURE)")
|
||||||
|
|
||||||
|
err = ctx.CommitTransaction()
|
||||||
|
if err != nil {
|
||||||
|
log.Err(err).Msg("Failed to commit transaction")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
channel, err := j.app.Database.Primary.GetChannelByID(ctx, msg.ChannelID)
|
||||||
|
if err != nil {
|
||||||
|
log.Err(err).Str("ChannelID", msg.ChannelID.String()).Msg("Failed to get channel")
|
||||||
|
ctx.RollbackTransaction()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if channel == nil {
|
||||||
|
log.Error().Str("ReceiverUserID", delivery.ReceiverUserID.String()).Str("ChannelID", msg.ChannelID.String()).Msg("Failed to get channel (client no longer exists)")
|
||||||
|
|
||||||
|
err = j.app.Database.Primary.SetDeliveryFailed(ctx, delivery)
|
||||||
|
if err != nil {
|
||||||
|
log.Err(err).Str("MessageID", delivery.MessageID.String()).Str("DeliveryID", delivery.DeliveryID.String()).Msg("Failed to update delivery")
|
||||||
|
ctx.RollbackTransaction()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.Warn().Str("MessageID", delivery.MessageID.String()).Str("DeliveryID", delivery.DeliveryID.String()).Msg("Delivery failed because of [channel==null] (set to FAILURE)")
|
||||||
|
|
||||||
|
err = ctx.CommitTransaction()
|
||||||
|
if err != nil {
|
||||||
|
log.Err(err).Msg("Failed to commit transaction")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
fcmDelivID, err := j.app.DeliverMessage(ctx, *user, *client, *channel, msg)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = j.app.Database.Primary.SetDeliverySuccess(ctx, delivery, fcmDelivID)
|
err = j.app.Database.Primary.SetDeliverySuccess(ctx, delivery, fcmDelivID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -201,8 +259,11 @@ func (j *DeliveryRetryJob) redeliver(ctx *simplectx.SimpleContext, delivery mode
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = ctx.CommitTransaction()
|
||||||
|
if err != nil {
|
||||||
|
log.Err(err).Msg("Failed to commit transaction")
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ctx.CommitTransaction()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ func (app *Application) SendMessage(g *gin.Context, ctx *AppContext, UserID *mod
|
|||||||
return nil, langext.Ptr(ginresp.SendAPIError(g, 500, apierr.DATABASE_ERROR, hl.NONE, "Failed to inc token msg-counter", err))
|
return nil, langext.Ptr(ginresp.SendAPIError(g, 500, apierr.DATABASE_ERROR, hl.NONE, "Failed to inc token msg-counter", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info().Msg(fmt.Sprintf("Sending new notification %s for user %s", msg.MessageID, UserID))
|
log.Info().Msg(fmt.Sprintf("Sending new notification %s for user %s (to %d active subscriptions)", msg.MessageID, UserID, len(activeSubscriptions)))
|
||||||
|
|
||||||
for _, sub := range activeSubscriptions {
|
for _, sub := range activeSubscriptions {
|
||||||
clients, err := app.Database.Primary.ListClients(ctx, sub.SubscriberUserID)
|
clients, err := app.Database.Primary.ListClients(ctx, sub.SubscriberUserID)
|
||||||
@ -186,6 +186,8 @@ func (app *Application) SendMessage(g *gin.Context, ctx *AppContext, UserID *mod
|
|||||||
|
|
||||||
for _, client := range clients {
|
for _, client := range clients {
|
||||||
|
|
||||||
|
log.Info().Msg(fmt.Sprintf("Create delivery for message %s to client %s (of user %s)", msg.MessageID, client.ClientID, client.UserID))
|
||||||
|
|
||||||
fcmDelivID, err := app.DeliverMessage(ctx, user, client, channel, msg)
|
fcmDelivID, err := app.DeliverMessage(ctx, user, client, channel, msg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
_, err = app.Database.Primary.CreateRetryDelivery(ctx, client, msg)
|
_, err = app.Database.Primary.CreateRetryDelivery(ctx, client, msg)
|
||||||
|
@ -19,37 +19,61 @@
|
|||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"example": "test",
|
||||||
|
"name": "channel",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"example": "This is a message",
|
||||||
"name": "content",
|
"name": "content",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"example": "P3TNH8mvv14fm",
|
||||||
|
"name": "key",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"example": "db8b0e6a-a08c-4646",
|
||||||
"name": "msg_id",
|
"name": "msg_id",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"enum": [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
2
|
||||||
|
],
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
|
"example": 1,
|
||||||
"name": "priority",
|
"name": "priority",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"example": "example-server",
|
||||||
|
"name": "sender_name",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "number",
|
"type": "number",
|
||||||
|
"example": 1669824037,
|
||||||
"name": "timestamp",
|
"name": "timestamp",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"example": "Hello World",
|
||||||
"name": "title",
|
"name": "title",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "integer",
|
|
||||||
"name": "user_id",
|
|
||||||
"in": "query"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"name": "user_key",
|
"example": "7725",
|
||||||
|
"name": "user_id",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -62,37 +86,61 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"example": "test",
|
||||||
|
"name": "channel",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"example": "This is a message",
|
||||||
"name": "content",
|
"name": "content",
|
||||||
"in": "formData"
|
"in": "formData"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"example": "P3TNH8mvv14fm",
|
||||||
|
"name": "key",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"example": "db8b0e6a-a08c-4646",
|
||||||
"name": "msg_id",
|
"name": "msg_id",
|
||||||
"in": "formData"
|
"in": "formData"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"enum": [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
2
|
||||||
|
],
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
|
"example": 1,
|
||||||
"name": "priority",
|
"name": "priority",
|
||||||
"in": "formData"
|
"in": "formData"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"example": "example-server",
|
||||||
|
"name": "sender_name",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "number",
|
"type": "number",
|
||||||
|
"example": 1669824037,
|
||||||
"name": "timestamp",
|
"name": "timestamp",
|
||||||
"in": "formData"
|
"in": "formData"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"example": "Hello World",
|
||||||
"name": "title",
|
"name": "title",
|
||||||
"in": "formData"
|
"in": "formData"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "integer",
|
|
||||||
"name": "user_id",
|
|
||||||
"in": "formData"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"name": "user_key",
|
"example": "7725",
|
||||||
|
"name": "user_id",
|
||||||
"in": "formData"
|
"in": "formData"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -2717,37 +2765,61 @@
|
|||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"example": "test",
|
||||||
|
"name": "channel",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"example": "This is a message",
|
||||||
"name": "content",
|
"name": "content",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"example": "P3TNH8mvv14fm",
|
||||||
|
"name": "key",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"example": "db8b0e6a-a08c-4646",
|
||||||
"name": "msg_id",
|
"name": "msg_id",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"enum": [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
2
|
||||||
|
],
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
|
"example": 1,
|
||||||
"name": "priority",
|
"name": "priority",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"example": "example-server",
|
||||||
|
"name": "sender_name",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "number",
|
"type": "number",
|
||||||
|
"example": 1669824037,
|
||||||
"name": "timestamp",
|
"name": "timestamp",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"example": "Hello World",
|
||||||
"name": "title",
|
"name": "title",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "integer",
|
|
||||||
"name": "user_id",
|
|
||||||
"in": "query"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"name": "user_key",
|
"example": "7725",
|
||||||
|
"name": "user_id",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -2760,37 +2832,61 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"example": "test",
|
||||||
|
"name": "channel",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"example": "This is a message",
|
||||||
"name": "content",
|
"name": "content",
|
||||||
"in": "formData"
|
"in": "formData"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"example": "P3TNH8mvv14fm",
|
||||||
|
"name": "key",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"example": "db8b0e6a-a08c-4646",
|
||||||
"name": "msg_id",
|
"name": "msg_id",
|
||||||
"in": "formData"
|
"in": "formData"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"enum": [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
2
|
||||||
|
],
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
|
"example": 1,
|
||||||
"name": "priority",
|
"name": "priority",
|
||||||
"in": "formData"
|
"in": "formData"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"example": "example-server",
|
||||||
|
"name": "sender_name",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "number",
|
"type": "number",
|
||||||
|
"example": 1669824037,
|
||||||
"name": "timestamp",
|
"name": "timestamp",
|
||||||
"in": "formData"
|
"in": "formData"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"example": "Hello World",
|
||||||
"name": "title",
|
"name": "title",
|
||||||
"in": "formData"
|
"in": "formData"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "integer",
|
|
||||||
"name": "user_id",
|
|
||||||
"in": "formData"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"name": "user_key",
|
"example": "7725",
|
||||||
|
"name": "user_id",
|
||||||
"in": "formData"
|
"in": "formData"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -2839,72 +2935,120 @@
|
|||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"example": "test",
|
||||||
|
"name": "channel",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"example": "This is a message",
|
||||||
"name": "content",
|
"name": "content",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"example": "P3TNH8mvv14fm",
|
||||||
|
"name": "key",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"example": "db8b0e6a-a08c-4646",
|
||||||
"name": "msg_id",
|
"name": "msg_id",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"enum": [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
2
|
||||||
|
],
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
|
"example": 1,
|
||||||
"name": "priority",
|
"name": "priority",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"example": "example-server",
|
||||||
|
"name": "sender_name",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "number",
|
"type": "number",
|
||||||
|
"example": 1669824037,
|
||||||
"name": "timestamp",
|
"name": "timestamp",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"example": "Hello World",
|
||||||
"name": "title",
|
"name": "title",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "integer",
|
"type": "string",
|
||||||
|
"example": "7725",
|
||||||
"name": "user_id",
|
"name": "user_id",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"name": "user_key",
|
"example": "test",
|
||||||
"in": "query"
|
"name": "channel",
|
||||||
|
"in": "formData"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"example": "This is a message",
|
||||||
"name": "content",
|
"name": "content",
|
||||||
"in": "formData"
|
"in": "formData"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"example": "P3TNH8mvv14fm",
|
||||||
|
"name": "key",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"example": "db8b0e6a-a08c-4646",
|
||||||
"name": "msg_id",
|
"name": "msg_id",
|
||||||
"in": "formData"
|
"in": "formData"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"enum": [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
2
|
||||||
|
],
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
|
"example": 1,
|
||||||
"name": "priority",
|
"name": "priority",
|
||||||
"in": "formData"
|
"in": "formData"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"example": "example-server",
|
||||||
|
"name": "sender_name",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "number",
|
"type": "number",
|
||||||
|
"example": 1669824037,
|
||||||
"name": "timestamp",
|
"name": "timestamp",
|
||||||
"in": "formData"
|
"in": "formData"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"example": "Hello World",
|
||||||
"name": "title",
|
"name": "title",
|
||||||
"in": "formData"
|
"in": "formData"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "integer",
|
|
||||||
"name": "user_id",
|
|
||||||
"in": "formData"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"name": "user_key",
|
"example": "7725",
|
||||||
|
"name": "user_id",
|
||||||
"in": "formData"
|
"in": "formData"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -3403,26 +3547,46 @@
|
|||||||
"handler.SendMessage.combined": {
|
"handler.SendMessage.combined": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"channel": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "test"
|
||||||
|
},
|
||||||
"content": {
|
"content": {
|
||||||
"type": "string"
|
"type": "string",
|
||||||
|
"example": "This is a message"
|
||||||
|
},
|
||||||
|
"key": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "P3TNH8mvv14fm"
|
||||||
},
|
},
|
||||||
"msg_id": {
|
"msg_id": {
|
||||||
"type": "string"
|
"type": "string",
|
||||||
|
"example": "db8b0e6a-a08c-4646"
|
||||||
},
|
},
|
||||||
"priority": {
|
"priority": {
|
||||||
"type": "integer"
|
"type": "integer",
|
||||||
|
"enum": [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
2
|
||||||
|
],
|
||||||
|
"example": 1
|
||||||
|
},
|
||||||
|
"sender_name": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "example-server"
|
||||||
},
|
},
|
||||||
"timestamp": {
|
"timestamp": {
|
||||||
"type": "number"
|
"type": "number",
|
||||||
|
"example": 1669824037
|
||||||
},
|
},
|
||||||
"title": {
|
"title": {
|
||||||
"type": "string"
|
"type": "string",
|
||||||
|
"example": "Hello World"
|
||||||
},
|
},
|
||||||
"user_id": {
|
"user_id": {
|
||||||
"type": "integer"
|
"type": "string",
|
||||||
},
|
"example": "7725"
|
||||||
"user_key": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -3451,7 +3615,7 @@
|
|||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"scn_msg_id": {
|
"scn_msg_id": {
|
||||||
"type": "integer"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"success": {
|
"success": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
|
@ -329,19 +329,36 @@ definitions:
|
|||||||
type: object
|
type: object
|
||||||
handler.SendMessage.combined:
|
handler.SendMessage.combined:
|
||||||
properties:
|
properties:
|
||||||
|
channel:
|
||||||
|
example: test
|
||||||
|
type: string
|
||||||
content:
|
content:
|
||||||
|
example: This is a message
|
||||||
|
type: string
|
||||||
|
key:
|
||||||
|
example: P3TNH8mvv14fm
|
||||||
type: string
|
type: string
|
||||||
msg_id:
|
msg_id:
|
||||||
|
example: db8b0e6a-a08c-4646
|
||||||
type: string
|
type: string
|
||||||
priority:
|
priority:
|
||||||
|
enum:
|
||||||
|
- 0
|
||||||
|
- 1
|
||||||
|
- 2
|
||||||
|
example: 1
|
||||||
type: integer
|
type: integer
|
||||||
|
sender_name:
|
||||||
|
example: example-server
|
||||||
|
type: string
|
||||||
timestamp:
|
timestamp:
|
||||||
|
example: 1669824037
|
||||||
type: number
|
type: number
|
||||||
title:
|
title:
|
||||||
|
example: Hello World
|
||||||
type: string
|
type: string
|
||||||
user_id:
|
user_id:
|
||||||
type: integer
|
example: "7725"
|
||||||
user_key:
|
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
handler.SendMessage.response:
|
handler.SendMessage.response:
|
||||||
@ -361,7 +378,7 @@ definitions:
|
|||||||
quota_max:
|
quota_max:
|
||||||
type: integer
|
type: integer
|
||||||
scn_msg_id:
|
scn_msg_id:
|
||||||
type: integer
|
type: string
|
||||||
success:
|
success:
|
||||||
type: boolean
|
type: boolean
|
||||||
suppress_send:
|
suppress_send:
|
||||||
@ -785,52 +802,90 @@ paths:
|
|||||||
description: All parameter can be set via query-parameter or the json body.
|
description: All parameter can be set via query-parameter or the json body.
|
||||||
Only UserID, UserKey and Title are required
|
Only UserID, UserKey and Title are required
|
||||||
parameters:
|
parameters:
|
||||||
- in: query
|
- example: test
|
||||||
|
in: query
|
||||||
|
name: channel
|
||||||
|
type: string
|
||||||
|
- example: This is a message
|
||||||
|
in: query
|
||||||
name: content
|
name: content
|
||||||
type: string
|
type: string
|
||||||
- in: query
|
- example: P3TNH8mvv14fm
|
||||||
|
in: query
|
||||||
|
name: key
|
||||||
|
type: string
|
||||||
|
- example: db8b0e6a-a08c-4646
|
||||||
|
in: query
|
||||||
name: msg_id
|
name: msg_id
|
||||||
type: string
|
type: string
|
||||||
- in: query
|
- enum:
|
||||||
|
- 0
|
||||||
|
- 1
|
||||||
|
- 2
|
||||||
|
example: 1
|
||||||
|
in: query
|
||||||
name: priority
|
name: priority
|
||||||
type: integer
|
type: integer
|
||||||
- in: query
|
- example: example-server
|
||||||
|
in: query
|
||||||
|
name: sender_name
|
||||||
|
type: string
|
||||||
|
- example: 1669824037
|
||||||
|
in: query
|
||||||
name: timestamp
|
name: timestamp
|
||||||
type: number
|
type: number
|
||||||
- in: query
|
- example: Hello World
|
||||||
|
in: query
|
||||||
name: title
|
name: title
|
||||||
type: string
|
type: string
|
||||||
- in: query
|
- example: "7725"
|
||||||
|
in: query
|
||||||
name: user_id
|
name: user_id
|
||||||
type: integer
|
|
||||||
- in: query
|
|
||||||
name: user_key
|
|
||||||
type: string
|
type: string
|
||||||
- description: ' '
|
- description: ' '
|
||||||
in: body
|
in: body
|
||||||
name: post_body
|
name: post_body
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/handler.SendMessage.combined'
|
$ref: '#/definitions/handler.SendMessage.combined'
|
||||||
- in: formData
|
- example: test
|
||||||
|
in: formData
|
||||||
|
name: channel
|
||||||
|
type: string
|
||||||
|
- example: This is a message
|
||||||
|
in: formData
|
||||||
name: content
|
name: content
|
||||||
type: string
|
type: string
|
||||||
- in: formData
|
- example: P3TNH8mvv14fm
|
||||||
|
in: formData
|
||||||
|
name: key
|
||||||
|
type: string
|
||||||
|
- example: db8b0e6a-a08c-4646
|
||||||
|
in: formData
|
||||||
name: msg_id
|
name: msg_id
|
||||||
type: string
|
type: string
|
||||||
- in: formData
|
- enum:
|
||||||
|
- 0
|
||||||
|
- 1
|
||||||
|
- 2
|
||||||
|
example: 1
|
||||||
|
in: formData
|
||||||
name: priority
|
name: priority
|
||||||
type: integer
|
type: integer
|
||||||
- in: formData
|
- example: example-server
|
||||||
|
in: formData
|
||||||
|
name: sender_name
|
||||||
|
type: string
|
||||||
|
- example: 1669824037
|
||||||
|
in: formData
|
||||||
name: timestamp
|
name: timestamp
|
||||||
type: number
|
type: number
|
||||||
- in: formData
|
- example: Hello World
|
||||||
|
in: formData
|
||||||
name: title
|
name: title
|
||||||
type: string
|
type: string
|
||||||
- in: formData
|
- example: "7725"
|
||||||
|
in: formData
|
||||||
name: user_id
|
name: user_id
|
||||||
type: integer
|
|
||||||
- in: formData
|
|
||||||
name: user_key
|
|
||||||
type: string
|
type: string
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
@ -2630,52 +2685,90 @@ paths:
|
|||||||
description: All parameter can be set via query-parameter or the json body.
|
description: All parameter can be set via query-parameter or the json body.
|
||||||
Only UserID, UserKey and Title are required
|
Only UserID, UserKey and Title are required
|
||||||
parameters:
|
parameters:
|
||||||
- in: query
|
- example: test
|
||||||
|
in: query
|
||||||
|
name: channel
|
||||||
|
type: string
|
||||||
|
- example: This is a message
|
||||||
|
in: query
|
||||||
name: content
|
name: content
|
||||||
type: string
|
type: string
|
||||||
- in: query
|
- example: P3TNH8mvv14fm
|
||||||
|
in: query
|
||||||
|
name: key
|
||||||
|
type: string
|
||||||
|
- example: db8b0e6a-a08c-4646
|
||||||
|
in: query
|
||||||
name: msg_id
|
name: msg_id
|
||||||
type: string
|
type: string
|
||||||
- in: query
|
- enum:
|
||||||
|
- 0
|
||||||
|
- 1
|
||||||
|
- 2
|
||||||
|
example: 1
|
||||||
|
in: query
|
||||||
name: priority
|
name: priority
|
||||||
type: integer
|
type: integer
|
||||||
- in: query
|
- example: example-server
|
||||||
|
in: query
|
||||||
|
name: sender_name
|
||||||
|
type: string
|
||||||
|
- example: 1669824037
|
||||||
|
in: query
|
||||||
name: timestamp
|
name: timestamp
|
||||||
type: number
|
type: number
|
||||||
- in: query
|
- example: Hello World
|
||||||
|
in: query
|
||||||
name: title
|
name: title
|
||||||
type: string
|
type: string
|
||||||
- in: query
|
- example: "7725"
|
||||||
|
in: query
|
||||||
name: user_id
|
name: user_id
|
||||||
type: integer
|
|
||||||
- in: query
|
|
||||||
name: user_key
|
|
||||||
type: string
|
type: string
|
||||||
- description: ' '
|
- description: ' '
|
||||||
in: body
|
in: body
|
||||||
name: post_body
|
name: post_body
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/handler.SendMessage.combined'
|
$ref: '#/definitions/handler.SendMessage.combined'
|
||||||
- in: formData
|
- example: test
|
||||||
|
in: formData
|
||||||
|
name: channel
|
||||||
|
type: string
|
||||||
|
- example: This is a message
|
||||||
|
in: formData
|
||||||
name: content
|
name: content
|
||||||
type: string
|
type: string
|
||||||
- in: formData
|
- example: P3TNH8mvv14fm
|
||||||
|
in: formData
|
||||||
|
name: key
|
||||||
|
type: string
|
||||||
|
- example: db8b0e6a-a08c-4646
|
||||||
|
in: formData
|
||||||
name: msg_id
|
name: msg_id
|
||||||
type: string
|
type: string
|
||||||
- in: formData
|
- enum:
|
||||||
|
- 0
|
||||||
|
- 1
|
||||||
|
- 2
|
||||||
|
example: 1
|
||||||
|
in: formData
|
||||||
name: priority
|
name: priority
|
||||||
type: integer
|
type: integer
|
||||||
- in: formData
|
- example: example-server
|
||||||
|
in: formData
|
||||||
|
name: sender_name
|
||||||
|
type: string
|
||||||
|
- example: 1669824037
|
||||||
|
in: formData
|
||||||
name: timestamp
|
name: timestamp
|
||||||
type: number
|
type: number
|
||||||
- in: formData
|
- example: Hello World
|
||||||
|
in: formData
|
||||||
name: title
|
name: title
|
||||||
type: string
|
type: string
|
||||||
- in: formData
|
- example: "7725"
|
||||||
|
in: formData
|
||||||
name: user_id
|
name: user_id
|
||||||
type: integer
|
|
||||||
- in: formData
|
|
||||||
name: user_key
|
|
||||||
type: string
|
type: string
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
@ -2708,47 +2801,85 @@ paths:
|
|||||||
description: All parameter can be set via query-parameter or form-data body.
|
description: All parameter can be set via query-parameter or form-data body.
|
||||||
Only UserID, UserKey and Title are required
|
Only UserID, UserKey and Title are required
|
||||||
parameters:
|
parameters:
|
||||||
- in: query
|
- example: test
|
||||||
|
in: query
|
||||||
|
name: channel
|
||||||
|
type: string
|
||||||
|
- example: This is a message
|
||||||
|
in: query
|
||||||
name: content
|
name: content
|
||||||
type: string
|
type: string
|
||||||
- in: query
|
- example: P3TNH8mvv14fm
|
||||||
|
in: query
|
||||||
|
name: key
|
||||||
|
type: string
|
||||||
|
- example: db8b0e6a-a08c-4646
|
||||||
|
in: query
|
||||||
name: msg_id
|
name: msg_id
|
||||||
type: string
|
type: string
|
||||||
- in: query
|
- enum:
|
||||||
|
- 0
|
||||||
|
- 1
|
||||||
|
- 2
|
||||||
|
example: 1
|
||||||
|
in: query
|
||||||
name: priority
|
name: priority
|
||||||
type: integer
|
type: integer
|
||||||
- in: query
|
- example: example-server
|
||||||
|
in: query
|
||||||
|
name: sender_name
|
||||||
|
type: string
|
||||||
|
- example: 1669824037
|
||||||
|
in: query
|
||||||
name: timestamp
|
name: timestamp
|
||||||
type: number
|
type: number
|
||||||
- in: query
|
- example: Hello World
|
||||||
|
in: query
|
||||||
name: title
|
name: title
|
||||||
type: string
|
type: string
|
||||||
- in: query
|
- example: "7725"
|
||||||
|
in: query
|
||||||
name: user_id
|
name: user_id
|
||||||
type: integer
|
|
||||||
- in: query
|
|
||||||
name: user_key
|
|
||||||
type: string
|
type: string
|
||||||
- in: formData
|
- example: test
|
||||||
|
in: formData
|
||||||
|
name: channel
|
||||||
|
type: string
|
||||||
|
- example: This is a message
|
||||||
|
in: formData
|
||||||
name: content
|
name: content
|
||||||
type: string
|
type: string
|
||||||
- in: formData
|
- example: P3TNH8mvv14fm
|
||||||
|
in: formData
|
||||||
|
name: key
|
||||||
|
type: string
|
||||||
|
- example: db8b0e6a-a08c-4646
|
||||||
|
in: formData
|
||||||
name: msg_id
|
name: msg_id
|
||||||
type: string
|
type: string
|
||||||
- in: formData
|
- enum:
|
||||||
|
- 0
|
||||||
|
- 1
|
||||||
|
- 2
|
||||||
|
example: 1
|
||||||
|
in: formData
|
||||||
name: priority
|
name: priority
|
||||||
type: integer
|
type: integer
|
||||||
- in: formData
|
- example: example-server
|
||||||
|
in: formData
|
||||||
|
name: sender_name
|
||||||
|
type: string
|
||||||
|
- example: 1669824037
|
||||||
|
in: formData
|
||||||
name: timestamp
|
name: timestamp
|
||||||
type: number
|
type: number
|
||||||
- in: formData
|
- example: Hello World
|
||||||
|
in: formData
|
||||||
name: title
|
name: title
|
||||||
type: string
|
type: string
|
||||||
- in: formData
|
- example: "7725"
|
||||||
|
in: formData
|
||||||
name: user_id
|
name: user_id
|
||||||
type: integer
|
|
||||||
- in: formData
|
|
||||||
name: user_key
|
|
||||||
type: string
|
type: string
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
|
Loading…
Reference in New Issue
Block a user