function iris_hcr2events, t0 , t1, goes_above=goes_above, taglist=taglist, mission=mission, structure=structure, $
   _EXTRA=_EXTRA, her_events=her_events, debug=debug, count=count, query=query, no_flare=no_flare
;+
;   Name: iris_hcr2events
;
;   Purpose: return IRIS HCR records in user time range, optionally which map to HER events (default=flares)
;
;   Input Parameters:
;      t0,t1 - time range - reqired unless /MISSION switch set
;
;   Output:
;      function returns HCR record vector - default is IDL LIST data type due to variability
;
;   Keyword Parameters:
;      goes_above - events above this GOES class = 'C', 'M', or 'X' - default='C'
;      structure (switch) - if set, attempt to return structure vector (default=LIST vector)
;      mission (switch) - if SET and no time range supplied, do the mission ; CAVEAT EMPTOR
;      taglist - optional taglist to return (in conjuction with /STRUCTURE)
;      _EXTRA - unspecified keywords passed to ssw_hcr_make_query verbatim
;               expands XCEN,YCEN,FOVX,FOVY,RADIUS ranges -> new api if 2 elements - e.g. ,RADIUS=[850,1200]
;      her_events - optional comma delimited list of zero or more HER event types to match
;      query (output) - query issued (as generated by ssw_hcr_make_query for This set of inputs)
;      count (output) - number of HCR matches for This set of inputs (from ssw_hcr_query.pro )
;      no_flares (switch) - inhibit default <nn>_FL (flare) events
; 
;   Method: 
;      set up/call ssw_her_query using new search api 
;
;  History:
;      25-nov-2014 - S.L.Freeland - prototype / demo new ssw_hcr_make_query/ssw_hcr_query extensions 
;                                   for "new" API (events3) applied to IRIS/Flare case
;  Notes:
;      function output is IDL LIST data type (rather than canonical structure) since variable params/groups et
;      conversion
;      
;  Calls: ssw_hcr_query, ssw_hcr_make_query, ssw_list2structvect
;-

debug=keyword_set(debug)

if n_params() lt 2 then begin 
   if keyword_set(MISSION) then begin 
      t0='1-aug-2013'
      t1=reltime(/now,out='yohkoh')
   endif else begin 
      box_message,'Need to supply time range (t0,t1) -OR- set /MISSION switch. bailing...'
      return,'' ; EARLY EXIT!! on no time range and no /MISSION switch set
   endelse
endif

if n_elements(goes_above) eq 0 then goes_above='C'
fl=strupcase(goes_above)+'_FL'

if n_elements(her_events) gt 1 then her_events=arr2str(her_events)

case 1 of 
   n_elements(her_events) eq 0: her_events=fl
   keyword_set(no_flare): 
   strmatch(her_events,'*_FL*',/fold) eq 0: her_events=her_events + ',' + fl
   else: ; verbatim user list
endcase

query=ssw_hcr_make_query(t0,t1,instrument='IRIS',extra=_extra,herevents=her_events,/events3)
hcr=ssw_hcr_query(query,/remove,count=count)

if count gt 0 then keyword_set(structure) then begin 
   if n_elements(taglist) eq 0 then taglist= $
      parenturl,eventid,planners,obsid,sciobjectives,target,umodes'  ; some random default
   hcr=ssw_list2structvect(hcr,taglist=taglist) ; LIST -> STRUCTURE 
endif

if debug then stop,'hcr'
return,hcr
end




