Documentation ¶
Index ¶
- Constants
- func BeginPollingForClients(interval int) error
- func CheckSlots(remoteClient *RemoteClient) error
- func Clients() map[string]*RemoteClient
- func Initialize() *map[string]interface{}
- func PollServer(remoteClient *RemoteClient) error
- func Respond(remoteClient *RemoteClient)
- func SendResponse(remoteClient *RemoteClient, userInput string)
- func SetWACClient(wac *pkWhatsApp.WhatsappClient)
- type AppointmentConfirmation
- type AppointmentList
- type Appointments
- type ApptRequestError
- type BeneficiaryList
- type BookingSlot
- type CaptchaSVG
- type Command
- type DistrictList
- type OTPConfirmTxn
- type OTPTxn
- type PotentialSession
- type RemoteClient
- type StateList
- type Subscriber
- type Subscriptions
- type UserParams
Constants ¶
View Source
const ( // This client secret is a ciphertext generated by using the AES key and then calling // aes.encrypt(CLIENT_USERNAME, AES_KEY) for CBC mode // and getting the string form of the result. See setWithDynamicKey method in // https://selfregistration.cowin.gov.in/main-es2015.a738dfab7b730e7c14ac.js:formatted CLIENT_SECRET = "U2FsdGVkX1+OsCQvQsCompcYGsHbguKSzKrIAh4xUB/us+Z7ZTqUiCsbkR+fKtfft6wsmYmTYyGlzVqi3L/x/g==" // See constructor of one of the classes in // https://selfregistration.cowin.gov.in/main-es2015.a738dfab7b730e7c14ac.js:formatted AES_KEY = "CoWIN@$#&*(!@%^&" // See anonymouslogin method in // https://selfregistration.cowin.gov.in/main-es2015.a738dfab7b730e7c14ac.js:formatted // If it's different for your browser client code, you may just put the breakpoints // for the methods listed above and get the client secret yourself or use any AES lib // to calculate your secret using the key given above and the username plaintext CLIENT_USERNAME = "b5cab167-7977-4df1-8027-a63aa144f04e" )
Variables ¶
This section is empty.
Functions ¶
func BeginPollingForClients ¶
func CheckSlots ¶
func CheckSlots(remoteClient *RemoteClient) error
func Clients ¶
func Clients() map[string]*RemoteClient
func Initialize ¶
func Initialize() *map[string]interface{}
func PollServer ¶
func PollServer(remoteClient *RemoteClient) error
func Respond ¶
func Respond(remoteClient *RemoteClient)
func SendResponse ¶
func SendResponse(remoteClient *RemoteClient, userInput string)
func SetWACClient ¶
func SetWACClient(wac *pkWhatsApp.WhatsappClient)
Types ¶
type AppointmentConfirmation ¶
type AppointmentConfirmation struct {
ConfirmationId string `json:"appointment_confirmation_no"`
}
type AppointmentList ¶
type AppointmentList struct {
DoseAppointments []struct {
} `json:"appointments"`
}
type Appointments ¶
type Appointments struct { Centers []struct { CenterID int `json:"center_id"` Name string `json:"name"` NameL string `json:"name_l"` StateName string `json:"state_name"` StateNameL string `json:"state_name_l"` DistrictName string `json:"district_name"` DistrictNameL string `json:"district_name_l"` BlockName string `json:"block_name"` BlockNameL string `json:"block_name_l"` Pincode int `json:"pincode"` Address string `json:"address"` Lat float64 `json:"lat"` Long float64 `json:"long"` From string `json:"from"` To string `json:"to"` FeeType string `json:"fee_type"` VaccineFees []struct { Vaccine string `json:"vaccine"` Fee string `json:"fee"` } `json:"vaccine_fees"` Sessions []struct { CenterID int SessionID string `json:"session_id"` Date string `json:"date"` AvailableCapacity float64 `json:"available_capacity"` MinAgeLimit int `json:"min_age_limit"` Vaccine string `json:"vaccine"` Dose1Capacity float64 `json:"available_capacity_dose1"` Dose2Capacity float64 `json:"available_capacity_dose2"` Slots []string `json:"slots"` } `json:"sessions"` } `json:"centers"` }
type ApptRequestError ¶
type BeneficiaryList ¶
type BeneficiaryList struct { Beneficiaries []struct { ReferenceID string `json:"beneficiary_reference_id"` Name string `json:"name"` Birth string `json:"birth_year"` Gender string `json:"gender"` Mobile string `json:"mobile_number"` PhotoIdType string `json:"photo_id_type"` PhotoIdNumber string `json:"photo_id_number"` ComorbidityInd string `json:"comorbidity_ind"` VaccinationStat string `json:"vaccination_status"` Vaccine string `json:"vaccine"` Dose1Date string `json:"dose1_date"` Dose2Date string `json:"dose2_date"` Appointments []struct { AppointmentID string `json:"appointment_id"` CenterID int `json:"center_id"` Name string `json:"name"` StateName string `json:"state_name"` DistrictName string `json:"district_name"` BlockName string `json:"block_name"` From string `json:"from"` To string `json:"to"` Dose int `json:"dose"` SessionID string `json:"session_id"` Date string `json:"date"` Slot string `json:"slot"` } `json:"appointments"` } `json:"beneficiaries"` Description string EligibleCount int }
type BookingSlot ¶
type BookingSlot struct { Available bool Preferred bool CenterID int BookAnySlot bool CenterName string SessionID string Slot string Description string PotentialSessions []PotentialSession EligibleCount int TotalDose1Available int }
func Search ¶
func Search(remoteClient *RemoteClient) (*BookingSlot, error)
type CaptchaSVG ¶
type CaptchaSVG struct {
Captcha string `json:"captcha"`
}
type Command ¶
type Command struct { Name string `json:"name"` CommandType string `json:"commandType"` ToBeSent string `json:"toBeSent"` ResponseType string `json:"responseType"` ExpectedResponse string `json:"expectedResponse"` NextCommand string `json:"nextCommand"` ErrorResponse1 string `json:"errorResponse1"` ErrorResponse2 string `json:"errorResponse2"` NextYCommand string `json:"nextYCommand"` NextNCommand string `json:"nextNCommand"` }
type DistrictList ¶
type OTPConfirmTxn ¶
type OTPConfirmTxn struct {
TOKEN string `json:"token"`
}
type PotentialSession ¶
type RemoteClient ¶
type RemoteClient struct { RemoteJID string RemoteMobileNumber string LastReceived pkWhatsApp.Message LastSent *Command Received pkWhatsApp.Message Host *pkWhatsApp.WhatsappClient Params *UserParams PollingInterval int PollWaitCounter int }
Remote WhatsappClient who's trying to communicate
func GetClient ¶
func GetClient(msg pkWhatsApp.Message, wac *pkWhatsApp.WhatsappClient) *RemoteClient
func NewClient ¶
func NewClient(msg pkWhatsApp.Message, wac *pkWhatsApp.WhatsappClient) *RemoteClient
NewClient create whatsapp client
func NewRemoteClient ¶
func NewRemoteClient(msg pkWhatsApp.Message, from, mobile string, wac *pkWhatsApp.WhatsappClient) *RemoteClient
type Subscriber ¶
type Subscriptions ¶
type Subscriptions struct { Subscribers []Subscriber NonSubscribers []Subscriber }
type UserParams ¶
Click to show internal directories.
Click to hide internal directories.