Added: isHashed field in external API

This commit is contained in:
Aleksandr Soloshenko 2023-12-19 00:03:17 +07:00
parent 8ab1a6a7c2
commit 09f5b187e5
3 changed files with 4 additions and 2 deletions

View File

@ -28,7 +28,7 @@ Authorization: Basic {{credentials}}
}
###
GET {{baseUrl}}/api/3rdparty/v1/message/IyJP8Iexf55XFhYFHMjcs HTTP/1.1
GET {{baseUrl}}/api/3rdparty/v1/message/-rnEaUz7KObDdokPrzKpM HTTP/1.1
Authorization: Basic {{credentials}}
###

View File

@ -239,6 +239,7 @@ func modelToMessageState(input models.Message) smsgateway.MessageState {
return smsgateway.MessageState{
ID: input.ExtID,
State: smsgateway.ProcessState(input.State),
IsHashed: input.IsHashed,
Recipients: slices.Map(input.Recipients, modelToRecipientState),
}
}

View File

@ -24,12 +24,13 @@ type Message struct {
type MessageState struct {
ID string `json:"id,omitempty" validate:"omitempty,max=36" example:"PyDmBQZZXYmyxMwED8Fzy"` // Идентификатор
State ProcessState `json:"state" validate:"required" example:"Pending"` // Состояние
IsHashed bool `json:"isHashed" validate:"required" example:"false"` // Хэшировано
Recipients []RecipientState `json:"recipients" validate:"required,min=1,dive"` // Детализация состояния по получателям
}
// Детализация состояния
type RecipientState struct {
PhoneNumber string `json:"phoneNumber" validate:"required,min=10" example:"79990001234"` // Номер телефона
PhoneNumber string `json:"phoneNumber" validate:"required,min=10" example:"79990001234"` // Номер телефона или первые 16 символов SHA256
State ProcessState `json:"state" validate:"required" example:"Pending"` // Состояние
Error *string `json:"error,omitempty" example:"timeout"` // Ошибка
}