Documentation ¶
Index ¶
- Constants
- type AgreementChannelEventModel
- type ApiClient
- func (this *ApiClient) GetAllLocations() (target []LocationHierarchy, err error)
- func (this *ApiClient) GetApiRequest(path string, params url.Values, responseTarget interface{}) error
- func (this *ApiClient) GetBillDays() (target BillDayModel, err error)
- func (this *ApiClient) GetContactWithEmail(email, firstName, lastName string) (target []ContactWithEmailResultModel, err error)
- func (this *ApiClient) GetEmailInUse(email string) (target bool, err error)
- func (this *ApiClient) GetEmployers(locationGuid string) (target []EmployerModel, err error)
- func (this *ApiClient) GetHasOnlineProfile(email string) (target *HasOnlineProfile, err error)
- func (this *ApiClient) GetMembershipTypes(startDate LegendTime, endDate LegendTime, locationId int64, channelId int64) (target []MembershipTypeReturnModel, err error)
- func (this *ApiClient) GetPriceDetails(locationId int64, priceTypeId int64, startDate time.Time, promotionCode string) (target MembershipPriceDetailsModel, err error)
- func (this *ApiClient) GetRecurringFee(facilityGuid string, billingMethodId BillingMethod) (target []RecurringFeeModel, err error)
- func (this *ApiClient) GetSalesPersonDetails(locationId int64) (target []SalesPerson, err error)
- func (this *ApiClient) PostApiRequest(path string, params url.Values, body, responseTarget interface{}) error
- func (this *ApiClient) PostApiRequestRawResponse(path string, params url.Values, body interface{}) (string, error)
- func (this *ApiClient) PostJoiningMembers(request *JoiningMembersRequest) (target JoiningMembersResponse, err error)
- func (this *ApiClient) PostMemberCardRegistration(request *MemberCardRegistrationRequest) (target string, err error)
- func (this *ApiClient) PostRecurringFee(request *RecurringFeeRequest) (target string, err error)
- type BillDayModel
- type BillingMethod
- type ConnectionConfig
- type ContactWithEmailResultModel
- type DiscountPriceDetails
- type EmployerModel
- type Fee
- type FeeType
- type FutureDiscountPriceDetails
- type Gender
- type HasOnlineProfile
- type JoiningMembersRequest
- type JoiningMembersResponse
- type LegendTime
- type LocationHierarchy
- type MandateInfo
- type MemberCardRegistrationRequest
- type MembershipPriceDetailsModel
- type MembershipPriceTypeModel
- type MembershipProcessType
- type MembershipTypeModel
- type MembershipTypeReturnModel
- type PaymentInfo
- type PersonalInfo
- type PurchaseInfo
- type RecurringFeeModel
- type RecurringFeeRequest
- type SalesPerson
Constants ¶
const ( GenderMale Gender = 1 GenderFemale Gender = 2 GenderCorporate Gender = 3 GenderUnknown Gender = 4 MembershipProcessTypeNew MembershipProcessType = 0 MembershipProcessTypeRenewal MembershipProcessType = 1 )
const LEGEND_DATE_FORMAT = "2006-01-02"
LEGEND_DATE_FORMAT has the time format used by most Legend dates
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiClient ¶
type ApiClient struct {
// contains filtered or unexported fields
}
func NewApiClient ¶
func NewApiClient(config ConnectionConfig) *ApiClient
NewApiClient creates a basic Legend API client with a retry-mechanic It will automatically retry on 5xx errors up to the specified retryMax
func (*ApiClient) GetAllLocations ¶
func (this *ApiClient) GetAllLocations() (target []LocationHierarchy, err error)
GetAllLocations returns all available locations
func (*ApiClient) GetApiRequest ¶
func (this *ApiClient) GetApiRequest(path string, params url.Values, responseTarget interface{}) error
GetApiRequest issues a GET requests and unmarshals JSON response into the provided struct
func (*ApiClient) GetBillDays ¶
func (this *ApiClient) GetBillDays() (target BillDayModel, err error)
GetBillDays
func (*ApiClient) GetContactWithEmail ¶
func (this *ApiClient) GetContactWithEmail(email, firstName, lastName string) (target []ContactWithEmailResultModel, err error)
A prospect is assumed as active if it has not been contacted for last few months. 'Number of months' is a configurable setting in Legend.
func (*ApiClient) GetEmailInUse ¶
GetEmailInUse checks whether the given email is being used
func (*ApiClient) GetEmployers ¶
func (this *ApiClient) GetEmployers(locationGuid string) (target []EmployerModel, err error)
GetEmployers returns list of active employers at given location
func (*ApiClient) GetHasOnlineProfile ¶
func (this *ApiClient) GetHasOnlineProfile(email string) (target *HasOnlineProfile, err error)
GetHasOnlineProfile checks whether the given email already has an online profile
func (*ApiClient) GetMembershipTypes ¶
func (this *ApiClient) GetMembershipTypes(startDate LegendTime, endDate LegendTime, locationId int64, channelId int64) (target []MembershipTypeReturnModel, err error)
GetMembershipTypes reads available memberships at a given location
func (*ApiClient) GetPriceDetails ¶
func (this *ApiClient) GetPriceDetails(locationId int64, priceTypeId int64, startDate time.Time, promotionCode string) (target MembershipPriceDetailsModel, err error)
GetPriceDetails fetches base price for a given membership price at a location
func (*ApiClient) GetRecurringFee ¶
func (this *ApiClient) GetRecurringFee(facilityGuid string, billingMethodId BillingMethod) (target []RecurringFeeModel, err error)
GetRecurringFee returns List of recurring fees (active only)
func (*ApiClient) GetSalesPersonDetails ¶
func (this *ApiClient) GetSalesPersonDetails(locationId int64) (target []SalesPerson, err error)
GetSalesPersonDetails returns a list of sales-people at location
func (*ApiClient) PostApiRequest ¶
func (this *ApiClient) PostApiRequest(path string, params url.Values, body, responseTarget interface{}) error
PostApiRequest issues a POST requests and unmarshals JSON response into the provided struct
func (*ApiClient) PostApiRequestRawResponse ¶
func (this *ApiClient) PostApiRequestRawResponse(path string, params url.Values, body interface{}) (string, error)
PostApiRequestRawResponse issues a POST requests and returns the raw, unprocessed response as a string Usefull for requests which don't respond with a valid JSON (recurring fee for example)
func (*ApiClient) PostJoiningMembers ¶
func (this *ApiClient) PostJoiningMembers(request *JoiningMembersRequest) (target JoiningMembersResponse, err error)
PostJoiningMembers creates a new member
func (*ApiClient) PostMemberCardRegistration ¶
func (this *ApiClient) PostMemberCardRegistration(request *MemberCardRegistrationRequest) (target string, err error)
PostMemberCardRegistration add card token to the user profile
func (*ApiClient) PostRecurringFee ¶
func (this *ApiClient) PostRecurringFee(request *RecurringFeeRequest) (target string, err error)
PostRecurringFee adds a Bolt-on to an existing membership
type BillDayModel ¶
type BillDayModel struct {
Day int64
}
type BillingMethod ¶
type BillingMethod int64
const ( BillingMethodUnknown BillingMethod = 0 BillingMethodDirectDebit BillingMethod = 1 BillingMethodCreditCard BillingMethod = 2 BillingMethodPayInFull BillingMethod = 8 )
func BillingMethodFromFeeType ¶
func BillingMethodFromFeeType(feeType FeeType) BillingMethod
BillingMethodFromFeeType converts FeeType into BillingMethod. They are equivalent
func (BillingMethod) String ¶
func (bm BillingMethod) String() string
type ConnectionConfig ¶
type ConnectionConfig struct { UserAgent string Username string Password string Guid string Endpoint string // How many times should 5xx requests be retried. Defaults to 0 (don't retry) MaxRetries int // Request timeout (defaults to 120s) HttpTimeout time.Duration // ProxyUrl allows you to connect through proxies (usefull for local debugging) ProxyUrl string // Use locally-stored dumps for core-data instead of making GET requests // Price calculations & POST requests are still sent externally UseMocks bool // Persist core-data dumps after making GET requests SaveMocks bool }
ConnectionConfig stores configuration data for Legend ApiClient Credentials MUST be provided at least
type ContactWithEmailResultModel ¶
type ContactWithEmailResultModel struct { ContactId int64 // ExpiryDate DateTime FirstName string IsFreeMembership bool IsProspect bool LastName string LinkedStatus string MemberNumber string MemberStatus string Mobile string Phone string PostCode string // ProspectCreationDate DateTime ProspectId int64 ProspectStatus string }
type DiscountPriceDetails ¶
type EmployerModel ¶
type Fee ¶
type Fee struct { Amount decimal.Decimal CardType string `json:",omitempty"` MediaTypeId int64 `json:",omitempty"` PaymentHandlerId int64 `json:",omitempty"` ProcessType int64 PromotionCode string `json:",omitempty"` PromotionId int64 `json:",omitempty"` ServerTransactionID string `json:",omitempty"` SourceId int64 `json:",omitempty"` }
type HasOnlineProfile ¶
type JoiningMembersRequest ¶
type JoiningMembersRequest struct { ChannelId int64 `json:",omitempty"` ClientIPAddress string `json:",omitempty"` ContactId int64 `json:",omitempty"` DoNotCreateOnlineProfile bool `json:",omitempty"` LocationID int64 `json:",omitempty"` MemberNo string `json:",omitempty"` MembershipProcessType MembershipProcessType PAndAEligibilities string `json:",omitempty"` ProspectId int64 `json:",omitempty"` SalesPersonId int64 `json:",omitempty"` SignUpLocation string `json:",omitempty"` TermsAccepted bool `json:",omitempty"` Fees []Fee `json:",omitempty"` MandateInfo *MandateInfo `json:",omitempty"` PaymentInfo *PaymentInfo `json:",omitempty"` PersonalInfo *PersonalInfo `json:",omitempty"` PurchaseInfo *PurchaseInfo `json:",omitempty"` }
type JoiningMembersResponse ¶
type LegendTime ¶
LegendTime represents the most common datetime format used by Legend API You'll still find other date formats elsewhere in the API (especially when posting data), But this type should cover most GETs
func (LegendTime) FormatShortDate ¶
func (b LegendTime) FormatShortDate() string
FormatShortDate "2006-01-02"
func (LegendTime) MarshalJSON ¶
func (t LegendTime) MarshalJSON() ([]byte, error)
MarshalJSON "Mon Jan _2"
func (*LegendTime) Scan ¶
func (b *LegendTime) Scan(src interface{}) error
func (*LegendTime) UnmarshalJSON ¶
func (b *LegendTime) UnmarshalJSON(src []byte) (err error)
UnmarshalJSON expects either "2006-01-02T15:04:05" or "Mon Jan _2"
type LocationHierarchy ¶
type LocationHierarchy struct { Address1 string Address2 string Address3 string Address4 string City string Country string FacilityId int64 FriendlyName string Guid string Latitude float64 LocationId int64 Longitude float64 LongName string Name string ParentGuid string Postcode string Region string ShortName string Type int64 }
type MandateInfo ¶
type MembershipPriceDetailsModel ¶
type MembershipPriceDetailsModel struct { CycleFee decimal.Decimal CycleFeeProcessType int64 EnrollmentFee decimal.Decimal EnrollmentFeeProcessType int64 FirstBillDate LegendTime HasEligibilities bool InductionFee decimal.Decimal InductionFeeProcessType int64 MonthInHandFee decimal.Decimal MonthInHandFeeProcessType int64 MonthInHandProcessType int64 ProrateFee decimal.Decimal ProrateFeeProcessType int64 UpFrontCycleFee decimal.Decimal UpfrontCycleFeeProcessType int64 WaiveProrateFee bool Discounts []DiscountPriceDetails FutureDiscounts []FutureDiscountPriceDetails }
type MembershipPriceTypeModel ¶
type MembershipPriceTypeModel struct { Id int64 ActiveFrom LegendTime ActiveTo LegendTime AgreementChannelID int64 CycleFee float64 CycleFeeProcessType int64 Detail string DurationInMonths int64 EnrollmentFee float64 EnrollmentFeeProcessType int64 FeeType FeeType HasEligibilities bool InductionFee float64 InductionFeeProcessType int64 MembershipDurationInDays int64 MonthInHandFee float64 MonthInHandFeeProcessType int64 MonthInHandProcessType int64 MonthsInHand int64 Name string ProrateFee float64 ProrateFeeProcessType int64 UpFrontCycleFee float64 UpfrontCycleFeeProcessType int64 WaiveProrateFee bool WebDescription string Discounts []DiscountPriceDetails Events []AgreementChannelEventModel FutureDiscounts []FutureDiscountPriceDetails }
type MembershipProcessType ¶
type MembershipProcessType int64
type MembershipTypeModel ¶
type MembershipTypeReturnModel ¶
type MembershipTypeReturnModel struct { LocationId int64 LocationName string MembershipType []MembershipTypeModel }
type PaymentInfo ¶
type PersonalInfo ¶
type PersonalInfo struct { AddressCity string `json:",omitempty"` AddressLine1 string `json:",omitempty"` AddressLine2 string `json:",omitempty"` AddressLine3 string `json:",omitempty"` AddressRegios string `json:",omitempty"` Birthday string `json:",omitempty"` // 10-01-2010 CommunicationPreferenceIds []int64 `json:",omitempty"` EmailAddress string `json:",omitempty"` EmergencyContact string `json:",omitempty"` EmergencyPhone string `json:",omitempty"` Employer string `json:",omitempty"` EthnicOrigin int64 `json:",omitempty"` FirstName string `json:",omitempty"` GenderId Gender `json:",omitempty"` InductionOptout bool `json:",omitempty"` MarketingSourceId int64 `json:",omitempty"` MedicalConditionIds string `json:",omitempty"` MobilePhoneNumber string `json:",omitempty"` PhoneNumber string `json:",omitempty"` Postcode string `json:",omitempty"` Surname string `json:",omitempty"` Title string `json:",omitempty"` WorkPhone string `json:",omitempty"` }
type PurchaseInfo ¶
type PurchaseInfo struct { FirstBillDate time.Time `json:",omitempty"` LocationId int64 `json:",omitempty"` MembershipEndDate time.Time `json:",omitempty"` MembershipStartDate time.Time `json:",omitempty"` MembershipTypePriceId int64 `json:",omitempty"` PromotionCode string `json:",omitempty"` PromotionId int64 `json:",omitempty"` TotalFee decimal.Decimal `json:",omitempty"` }
type RecurringFeeModel ¶
type RecurringFeeModel struct { Id int64 ActiveDate LegendTime AdminFee decimal.Decimal Autobill bool BillingCycleId int64 BillingMethodId BillingMethod ClubRestrictionId int64 CycleFee decimal.Decimal Description string GroupRestrictionId int64 InactiveDate LegendTime IsEnterprise bool LocationId int64 Name string UsageMonths int64 WaiveProrateFee bool }
type RecurringFeeRequest ¶
type RecurringFeeRequest struct { AdminFee decimal.Decimal `json:",omitempty"` ContactId int64 CycleFee decimal.Decimal `json:",omitempty"` FirstBillDate *time.Time `json:",omitempty"` ProrateFee decimal.Decimal `json:",omitempty"` RecurringFeeId int64 RenewalDate *time.Time `json:",omitempty"` SalespersonId int64 StartDate time.Time TerminationDate *time.Time `json:",omitempty"` }