105 lines
2.5 KiB
Go
105 lines
2.5 KiB
Go
package sigmasms
|
||
|
||
import (
|
||
"github.com/google/uuid"
|
||
)
|
||
|
||
/*
|
||
{
|
||
"id": "9987bf00-c082-4dec-b25f-875eb528cf34",
|
||
"chainId": "9987bf00-c082-4dec-b25f-875eb528cf34",
|
||
"groupId": null,
|
||
"type": "sms",
|
||
"createdAt": "2025-12-02T16:13:27.265Z",
|
||
"updatedAt": "2025-12-02T16:13:34.194Z",
|
||
"meta": {
|
||
"billing": {
|
||
"id": "4dbd2a09-0a77-4e70-8706-3a9851fcb587",
|
||
"amount": -7.49,
|
||
"refunded": false,
|
||
"TariffId": "9d9c19a9-5ac9-4963-9e4b-d69f78e811e0"
|
||
},
|
||
"billings": {
|
||
"ids": [
|
||
"4dbd2a09-0a77-4e70-8706-3a9851fcb587"
|
||
]
|
||
},
|
||
"stats": {
|
||
"segments": 1,
|
||
"characters": 6
|
||
},
|
||
"patternId": false,
|
||
"_recipientData": {
|
||
"mcc": "250",
|
||
"mnc": "01",
|
||
"code": "Мобильные ТелеСистемы ПАО_250_01",
|
||
"type": "def",
|
||
"group": "Russia | MTS",
|
||
"operator": "Мобильные ТелеСистемы ПАО"
|
||
}
|
||
},
|
||
"state": {
|
||
"status": "delivered",
|
||
"error": false,
|
||
"extendedStatus": null
|
||
},
|
||
"OwnerId": "99f5860a-a342-48fc-8e2e-3d4a26cdb79f"
|
||
}
|
||
*/
|
||
|
||
type ReceepientData struct {
|
||
MCC string `json:"mcc"`
|
||
MNC string `json:"mnc"`
|
||
Code string `json:"code"`
|
||
Type string `json:"type"`
|
||
Group string `json:"group"`
|
||
Operator string `json:"operator"`
|
||
}
|
||
|
||
type Billing struct {
|
||
ID string `json:"id"`
|
||
Amount float64 `json:"amount"`
|
||
Refunded bool `json:"refunded"`
|
||
TariffID string `json:"TariffId"`
|
||
}
|
||
|
||
type Billings struct {
|
||
IDs []uuid.UUID `json:"ids"`
|
||
}
|
||
|
||
type Stats struct {
|
||
Segments int `json:"segments"`
|
||
Characters int `json:"characters"`
|
||
}
|
||
|
||
type Meta struct {
|
||
Billing Billing `json:"billing"`
|
||
Billings Billings `json:"billings"`
|
||
Stats Stats `json:"stats"`
|
||
PatternID bool `json:"patternId"`
|
||
RecipientData ReceepientData `json:"_recipientData"`
|
||
}
|
||
|
||
type State struct {
|
||
Status string `json:"status"`
|
||
Error bool `json:"error"`
|
||
ExtendedStatus string `json:"extendedStatus"`
|
||
}
|
||
|
||
type StatusResponse struct {
|
||
ID uuid.UUID `json:"id"`
|
||
ChainID uuid.UUID `json:"chainId"`
|
||
Type string `json:"type"`
|
||
CreatedAt string `json:"createdAt"`
|
||
UpdatedAt string `json:"updatedAt"`
|
||
State State `json:"state"`
|
||
Meta *Meta `json:"meta"`
|
||
}
|
||
|
||
// 9987bf00-c082-4dec-b25f-875eb528cf34
|
||
func RequestStatus(id uuid.UUID, apiKey string) (resp *StatusResponse, err error) {
|
||
url := "https://user.sigmasms.ru/api/sendings/" + id.String()
|
||
err = requestGet(url, apiKey, nil, &resp)
|
||
return
|
||
}
|