github.com/schmorrison/Zoho@v1.1.4/recruit/organization.go (about) 1 package recruit 2 3 import ( 4 "fmt" 5 "time" 6 7 zoho "github.com/schmorrison/Zoho" 8 ) 9 10 // GetOrganizationDetails returns organization's data 11 // https://www.zoho.com/recruit/developer-guide/apiv2/get-org-data.html 12 // https://recruit.zoho.eu/recruit/v2/org 13 func (c *API) GetOrganizationDetails() (data OrganizationResponse, err error) { 14 endpoint := zoho.Endpoint{ 15 Name: "GetOrganizationDetails", 16 URL: fmt.Sprintf("https://recruit.zoho.%s/recruit/v2/org", c.ZohoTLD), 17 Method: zoho.HTTPGet, 18 ResponseData: &OrganizationResponse{}, 19 } 20 21 err = c.Zoho.HTTPRequest(&endpoint) 22 if err != nil { 23 return OrganizationResponse{}, fmt.Errorf("failed to retrieve organization's data: %s", err) 24 } 25 26 if v, ok := endpoint.ResponseData.(*OrganizationResponse); ok { 27 return *v, nil 28 } 29 30 return OrganizationResponse{}, fmt.Errorf("data returned was not 'OrganizationResponse'") 31 } 32 33 // OrganizationResponse is the data returned by GetOrganizationDetails 34 type OrganizationResponse struct { 35 Org []struct { 36 EmployeeCount string `json:"employee_count"` 37 Zip interface{} `json:"zip"` 38 Country interface{} `json:"country"` 39 Website string `json:"website"` 40 City interface{} `json:"city"` 41 Mobile interface{} `json:"mobile"` 42 Description interface{} `json:"description"` 43 Type string `json:"type"` 44 TimeZone string `json:"time_zone"` 45 McStatus bool `json:"mc_status"` 46 CountryCode string `json:"country_code"` 47 LicenseDetails struct { 48 TrialType string `json:"trial_type"` 49 TrialExpiry time.Time `json:"trial_expiry"` 50 Paid bool `json:"paid"` 51 PaidType string `json:"paid_type"` 52 NoOfUsers int `json:"no_of_users"` 53 } `json:"license_details"` 54 Zgid string `json:"zgid"` 55 Phone string `json:"phone"` 56 Street interface{} `json:"street"` 57 CompanyName string `json:"company_name"` 58 PrimaryUserid string `json:"primary_userid"` 59 Alias interface{} `json:"alias"` 60 PrimaryEmail string `json:"primary_email"` 61 EditorMode string `json:"editor_mode"` 62 State interface{} `json:"state"` 63 Fax interface{} `json:"fax"` 64 } `json:"org"` 65 }