// Searches appStore by a appID and returns result in channel
Searches appStore by a appID and returns result in channel
// Searches appStore by a appID and returns result in channel
func lookupApple(id string) []AppleSearchAppInfo {
	url := APPLE_LOOKUP_API + "id=" + url.QueryEscape(id) + "&media=software" + "&limit=1"
	response, err := http.Get(url)
	if err != nil {
		log.Println("Error: The HTTP request failed with error: " + err.Error())
		return nil
	}
	responseData, err := ioutil.ReadAll(response.Body)
	if err != nil {
		log.Println("Error: Reading http response failed with error: " + err.Error())
		return nil
	}
	appleSearchAPiRes := AppleSearchResponse{}
	err = json.Unmarshal(responseData, &appleSearchAPiRes)
	if err != nil {
		log.Println("Error: Parsing http response as json failed with error: " + err.Error())
		return nil
	}
	if len(appleSearchAPiRes.Results) < 1 {
		log.Println("Error: No results found for id: " + id)
		return nil
	}
	return appleSearchAPiRes.Results
}
func lookupApple ( id string ) [ ] AppleSearchAppInfo { url := APPLE_LOOKUP_API + " " + url . QueryEscape ( id ) + " " + " " response , err := http . Get ( url ) if err != nil { log . Println ( " " + err . Error ( ) ) return nil } responseData , err := ioutil . ReadAll ( response . Body ) if err != nil { log . Println ( " " + err . Error ( ) ) return nil } appleSearchAPiRes := AppleSearchResponse { } err = json . Unmarshal ( responseData , & appleSearchAPiRes ) if err != nil { log . Println ( " " + err . Error ( ) ) return nil } if len ( appleSearchAPiRes . Results ) < 1 { log . Println ( " " + id ) return nil } return appleSearchAPiRes . Results }
Searches appStore by a appID and returns result in channel
Searches appStore by a appID and returns result in channel