Merge pull request #22 from capcom6/feature/privacy-hash

Added: `isHashed` field in external API
This commit is contained in:
capcom6 2023-12-20 09:35:55 +07:00 committed by GitHub
commit bb64fa1df8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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

@ -242,6 +242,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"` // Ошибка
}