api/check.go
func (a *API) FetchCheck(cid CIDType) (*Check, error) {
	if cid == nil || *cid == "" {
		return nil, fmt.Errorf("Invalid check CID [none]")
	}

	checkCID := string(*cid)

	matched, err := regexp.MatchString(config.CheckCIDRegex, checkCID)
	if err != nil {
		return nil, err
	}
	if !matched {
		return nil, fmt.Errorf("Invalid check CID [%s]", checkCID)
	}

	result, err := a.Get(checkCID)
	if err != nil {
		return nil, err
	}

	if a.Debug {
		a.Log.Printf("[DEBUG] fetch check, received JSON: %s", string(result))
	}

	check := new(Check)
	if err := json.Unmarshal(result, check); err != nil {
		return nil, err
	}

	return check, nil
}
func (a *API) FetchCheck(cid CIDType) (*Check, error) {
	if cid == nil || *cid == "" {
		return nil, fmt.Errorf("Invalid check CID [none]")
	}

	checkCID := string(*cid)

	matched, err := regexp.MatchString(config.CheckCIDRegex, checkCID)
	if err != nil {
		return nil, err
	}
	if !matched {
		return nil, fmt.Errorf("Invalid check CID [%s]", checkCID)
	}

	result, err := a.Get(checkCID)
	if err != nil {
		return nil, err
	}

	if a.Debug {
		a.Log.Printf("[DEBUG] fetch check, received JSON: %s", string(result))
	}

	check := new(Check)
	if err := json.Unmarshal(result, check); err != nil {
		return nil, err
	}

	return check, nil
}
// FetchCheck retrieves check with passed cid.