Documentation ¶
Index ¶
Constants ¶
View Source
const BASE_URL = "https://sms.capcom.me/api/3rdparty/v1"
Variables ¶
View Source
var ErrConflictFields = errors.New("conflict fields")
Functions ¶
This section is empty.
Types ¶
type Device ¶ added in v1.6.0
type Device struct { ID string `json:"id" example:"PyDmBQZZXYmyxMwED8Fzy"` // ID Name string `json:"name" example:"My Device"` // Name CreatedAt time.Time `json:"createdAt" example:"2020-01-01T00:00:00Z"` // Created at (read only) UpdatedAt time.Time `json:"updatedAt" example:"2020-01-01T00:00:00Z"` // Updated at (read only) DeletedAt *time.Time `json:"deletedAt,omitempty" example:"2020-01-01T00:00:00Z"` // Deleted at (read only) LastSeen time.Time `json:"lastSeen" example:"2020-01-01T00:00:00Z"` // Last seen at (read only) }
Device
type ErrorResponse ¶
type ErrorResponse struct { Message string `json:"message" example:"An error occurred"` // Error message Code int32 `json:"code,omitempty"` // Error code Data any `json:"data,omitempty"` // Error context }
Error response
type Message ¶
type Message struct { ID string `json:"id,omitempty" validate:"omitempty,max=36" example:"PyDmBQZZXYmyxMwED8Fzy"` // ID (if not set - will be generated) Message string `json:"message" validate:"required,max=65535" example:"Hello World!"` // Content SimNumber *uint8 `json:"simNumber,omitempty" validate:"omitempty,max=3" example:"1"` // SIM card number (1-3) WithDeliveryReport *bool `json:"withDeliveryReport,omitempty" example:"true"` // With delivery report IsEncrypted bool `json:"isEncrypted,omitempty" example:"true"` // Is encrypted PhoneNumbers []string `json:"phoneNumbers" validate:"required,min=1,max=100,dive,required,min=10,max=128" example:"79990001234"` // Recipients (phone numbers) TTL *uint64 `json:"ttl,omitempty" validate:"omitempty,min=5" example:"86400"` // Time to live in seconds (conflicts with `validUntil`) ValidUntil *time.Time `json:"validUntil,omitempty" example:"2020-01-01T00:00:00Z"` // Valid until (conflicts with `ttl`) }
Message
type MessageState ¶
type MessageState struct { ID string `json:"id,omitempty" validate:"omitempty,max=36" example:"PyDmBQZZXYmyxMwED8Fzy"` // Message ID State ProcessState `json:"state" validate:"required" example:"Pending"` // State IsHashed bool `json:"isHashed" example:"false"` // Hashed IsEncrypted bool `json:"isEncrypted" example:"false"` // Encrypted Recipients []RecipientState `json:"recipients" validate:"required,min=1,dive"` // Recipients states }
Message state
type MobileRegisterRequest ¶
type MobileRegisterRequest struct { Name *string `json:"name,omitempty" validate:"omitempty,max=128" example:"Android Phone"` // Device name PushToken *string `json:"pushToken" validate:"omitempty,max=256" example:"gHz-T6NezDlOfllr7F-Be"` // FCM token }
Device registration request
type MobileRegisterResponse ¶
type MobileRegisterResponse struct { Id string `json:"id" example:"QslD_GefqiYV6RQXdkM6V"` // New device ID Token string `json:"token" example:"bP0ZdK6rC6hCYZSjzmqhQ"` // Device access token Login string `json:"login" example:"VQ4GII"` // User login Password string `json:"password" example:"cp2pydvxd2zwpx"` // User password }
Device registration response
type MobileUpdateRequest ¶
type MobileUpdateRequest struct { Id string `json:"id" example:"QslD_GefqiYV6RQXdkM6V"` // ID PushToken string `json:"pushToken" validate:"omitempty,max=256" example:"gHz-T6NezDlOfllr7F-Be"` // FCM token }
Device update request
type ProcessState ¶
type ProcessState string
const ( MessageStatePending ProcessState = "Pending" // Pending MessageStateProcessed ProcessState = "Processed" // Processed (received by device) MessageStateSent ProcessState = "Sent" // Sent MessageStateDelivered ProcessState = "Delivered" // Delivered MessageStateFailed ProcessState = "Failed" // Failed )
type PushNotification ¶ added in v1.7.0
type PushNotification struct {
Token string `json:"token" validate:"required" example:"PyDmBQZZXYmyxMwED8Fzy"` // Device FCM token
}
Push notification
type RecipientState ¶
type RecipientState struct { PhoneNumber string `json:"phoneNumber" validate:"required,min=10,max=128" example:"79990001234"` // Phone number or first 16 symbols of SHA256 hash State ProcessState `json:"state" validate:"required" example:"Pending"` // State Error *string `json:"error,omitempty" example:"timeout"` // Error (for `Failed` state) }
Recipient state
type UpstreamPushRequest ¶ added in v1.7.0
type UpstreamPushRequest = []PushNotification
Push request
Click to show internal directories.
Click to hide internal directories.