Documentation ¶
Index ¶
- Constants
- Variables
- func SignOTP(otp string) string
- func ToJSONString(typedData *interface{}) (string, error)
- type CenterCalendar
- type CentersCalendar
- type CentersCalendarResponse
- type CoWinAPI
- func (c *CoWinAPI) ConfirmRawOTP(otp string, txnID string) (*OTPConfirmResponse, error)
- func (c *CoWinAPI) ConfirmSignedOTP(otpSHA256 string, txnID string) (*OTPConfirmResponse, error)
- func (c *CoWinAPI) GetCalendarByCenter(centerID int, date string) (*CenterCalendar, error)
- func (c *CoWinAPI) GetCalendarByDistrict(districtID int, date string) (*CentersCalendarResponse, error)
- func (c *CoWinAPI) GetCalendarByPIN(pincode string, date string) (*CentersCalendarResponse, error)
- func (c *CoWinAPI) GetCentersByLatLong(lat float64, long float64) (*VaccinationCentersResp, error)
- func (c *CoWinAPI) GetCertificate(beneficiaryID string, token string) ([]byte, error)
- func (c *CoWinAPI) GetDistricts(stateID int) (*DistrictResp, error)
- func (c *CoWinAPI) GetSessionsByDistrict(districtID int, date string) (*VaccinationSessionResp, error)
- func (c *CoWinAPI) GetSessionsByPIN(pincode string, date string) (*VaccinationSessionResp, error)
- func (c *CoWinAPI) GetStates() (*StateResp, error)
- func (c *CoWinAPI) RequestOTP(mobile string) (*OTPResponse, error)
- type District
- type DistrictResp
- type ErrorType
- type OTPConfirmRequest
- type OTPConfirmResponse
- type OTPRequest
- type OTPResponse
- type State
- type StateResp
- type VaccinationCenter
- type VaccinationCentersResp
- type VaccinationSession
- type VaccinationSessionResp
- type VaccinationSessions
- type VaccineFee
- type VaccineFeeList
Constants ¶
const DefaultServiceURL = "https://cdn-api.co-vin.in/api"
DefaultServiceURL the default URL of the CoWIN Production API server
const DefaultUserAgent = "" /* 158-byte string literal not displayed */
DefaultUserAgent the default user-agent
Variables ¶
var Routes map[string]string = map[string]string{
"request_otp": "/v2/auth/public/generateOTP",
"confirm_otp": "/v2/auth/public/confirmOTP",
"get_states": "/v2/admin/location/states",
"get_districts": "/v2/admin/location/districts",
"find_by_pin": "/v2/appointment/sessions/public/findByPin",
"find_by_district": "/v2/appointment/sessions/public/findByDistrict",
"find_by_lat_lan": "/v2/appointment/centers/public/findByLatLong",
"cal_by_pin": "/v2/appointment/sessions/public/calendarByPin",
"cal_by_district": "/v2/appointment/sessions/public/calendarByDistrict",
"cal_by_center": "/v2/appointment/sessions/public/calendarByCenter",
"download_cert": "/v2/registration/certificate/public/download",
}
Routes all the API routes that are available in this SDK
Functions ¶
func ToJSONString ¶
ToJSONString returns JSON string given the type
Types ¶
type CenterCalendar ¶
type CenterCalendar struct { CenterID int `json:"center_id"` Name string `json:"name"` NameL string `json:"name_l"` Address string `json:"address"` AddressL string `json:"address_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"` Lat float64 `json:"lat"` Long float64 `json:"long"` FromTime string `json:"from"` ToTime string `json:"to"` FeeType string `json:"fee_type"` Vaccines VaccineFeeList `json:"vaccine_fees"` Sessions VaccinationSessions `json:"sessions"` }
CenterCalendar the sessions of a center by calendar
type CentersCalendarResponse ¶
type CentersCalendarResponse struct {
Centers CentersCalendar `json:"centers"`
}
CentersCalendarResponse The response returned by API
type CoWinAPI ¶
type CoWinAPI struct {
// contains filtered or unexported fields
}
CoWinAPI The main type that implements all the CoWIN APIs
func NewCoWinAPI ¶
NewCoWinAPI Creates and returns a new CoWinAPI given language and userAgent string
func (*CoWinAPI) ConfirmRawOTP ¶
func (c *CoWinAPI) ConfirmRawOTP(otp string, txnID string) (*OTPConfirmResponse, error)
ConfirmRawOTP Confirm an OTP sent to given number by passing SHA-256 raw otp string
func (*CoWinAPI) ConfirmSignedOTP ¶
func (c *CoWinAPI) ConfirmSignedOTP(otpSHA256 string, txnID string) (*OTPConfirmResponse, error)
ConfirmSignedOTP Confirm an OTP sent to given number by passing SHA-256 hashed otp string:
func (*CoWinAPI) GetCalendarByCenter ¶
func (c *CoWinAPI) GetCalendarByCenter(centerID int, date string) (*CenterCalendar, error)
GetCalendarByCenter Get the calendar by center ID
func (*CoWinAPI) GetCalendarByDistrict ¶
func (c *CoWinAPI) GetCalendarByDistrict(districtID int, date string) (*CentersCalendarResponse, error)
GetCalendarByDistrict Get the calendar by district ID
func (*CoWinAPI) GetCalendarByPIN ¶
func (c *CoWinAPI) GetCalendarByPIN(pincode string, date string) (*CentersCalendarResponse, error)
GetCalendarByPIN Get the calendar by PIN
func (*CoWinAPI) GetCentersByLatLong ¶
func (c *CoWinAPI) GetCentersByLatLong(lat float64, long float64) (*VaccinationCentersResp, error)
GetCentersByLatLong Get the vaccination sessions available by lat long
func (*CoWinAPI) GetCertificate ¶
GetCertificate Get the certificate in binary blob format
func (*CoWinAPI) GetDistricts ¶
func (c *CoWinAPI) GetDistricts(stateID int) (*DistrictResp, error)
GetDistricts Get all the districts under a state, pass stateID as the parameter
func (*CoWinAPI) GetSessionsByDistrict ¶
func (c *CoWinAPI) GetSessionsByDistrict(districtID int, date string) (*VaccinationSessionResp, error)
GetSessionsByDistrict Get the vaccination sessions available by district ID
func (*CoWinAPI) GetSessionsByPIN ¶
func (c *CoWinAPI) GetSessionsByPIN(pincode string, date string) (*VaccinationSessionResp, error)
GetSessionsByPIN Get the vaccination sessions available by PIN
func (*CoWinAPI) RequestOTP ¶
func (c *CoWinAPI) RequestOTP(mobile string) (*OTPResponse, error)
RequestOTP Requests an OTP to be sent to given number:
type District ¶
type District struct { StateID int `json:"state_id"` ID int `json:"district_id"` Name string `json:"district_name"` NameL string `json:"district_name_l"` }
District the district type
type DistrictResp ¶
DistrictResp the API response returned by /location/districts
type OTPConfirmRequest ¶
OTPConfirmRequest OTP Confirm request payload
type OTPConfirmResponse ¶
type OTPConfirmResponse struct {
Token string `json:"token"`
}
OTPConfirmResponse OTP Confirm response payload
type OTPRequest ¶
type OTPRequest struct {
Mobile string `json:"mobile"`
}
OTPRequest OTP request payload
type OTPResponse ¶
type OTPResponse struct {
TxnID string `json:"txnId"`
}
OTPResponse OTP response payload
type State ¶
type State struct { ID int `json:"state_id"` Name string `json:"state_name"` NameL string `json:"state_name_l"` }
State the state type
type VaccinationCenter ¶
type VaccinationCenter struct { CenterID int `json:"center_id"` Name string `json:"name"` NameL string `json:"name_l"` Address string `json:"address"` AddressL string `json:"address_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 string `json:"pincode"` Lat string `json:"lat"` Long string `json:"long"` FromTime string `json:"from"` ToTime string `json:"to"` FeeType string `json:"fee_type"` }
VaccinationCenter the type that represents a vaccination center
type VaccinationCentersResp ¶
type VaccinationCentersResp struct { Centers []VaccinationCenter `json:"centers"` TTL int `json:"ttl"` }
VaccinationCentersResp the type that represents vaccination response
type VaccinationSession ¶
type VaccinationSession struct { CenterID int `json:"center_id"` Name string `json:"name"` NameL string `json:"name_l"` Address string `json:"address"` AddressL string `json:"address_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"` Lat float64 `json:"lat"` Long float64 `json:"long"` FromTime string `json:"from"` ToTime string `json:"to"` FeeType string `json:"fee_type"` Fee string `json:"fee"` SessionID string `json:"session_id"` Date string `json:"date"` Capacity int `json:"available_capacity"` CapacityFirstDose int `json:"available_capacity_dose1"` CapacitySecondDose int `json:"available_capacity_dose2"` MinimumAge int `json:"min_age_limit"` VaccineName string `json:"vaccine"` Slots []string `json:"slots"` }
VaccinationSession the Session type
type VaccinationSessionResp ¶
type VaccinationSessionResp struct {
Sessions []VaccinationSession `json:"sessions"`
}
VaccinationSessionResp the response returned by all find* APIs
type VaccinationSessions ¶
type VaccinationSessions []VaccinationSession
VaccinationSessions list of VaccinationSession
type VaccineFee ¶
VaccineFee the type that represents the fee of vaccine