func (c *Client) Do(ctx context.Context, r *http.Request, v interface{}, reqID *string, progress *ProgressFunc) (*http.Response, error) {
	done := make(chan bool)
	if progress != nil {
		version := "v1"
		req, err := http.NewRequest("GET", "http://localhost/"+version+"/observe", nil)
		if err != nil {
			return nil, err
		}
		stream, err := eventsource.SubscribeWith("", c.client, req)
		if err != nil {
			return nil, err
		}

		output := *progress
		go func() {
			for {
				select {
				case <-done:
					return
				case ev := <-stream.Events:
					data := ev.Data()
					raw := []byte(data)

					event := Event{}
					event.MessageType = "message"
					err = json.Unmarshal(raw, &event)
					if err != nil {
						output(nil, err)
						return
					}
					if event.ID == *reqID {
						output(&event, nil)
					}
				case err := <-stream.Errors:
					output(nil, err)
				}
			}
		}()
	}

	resp, err := c.client.Do(r)
	close(done)
	if err != nil {
		return nil, err
	}

	defer resp.Body.Close()

	err = checkResponseCode(resp)
	if err != nil {
		return resp, err
	}

	if v != nil {
		dec := json.NewDecoder(resp.Body)
		err = dec.Decode(v)
		if err != nil {
			return nil, err
		}
	}

	return resp, nil
}
// Do executes an http.Request, populating v with the JSON response
// on success.
//
// If the request errors with a JSON formatted response body, it will be
// unmarshaled into the returned error.
Do executes an http.Request, populating v with the JSON response
on success.

If the request errors with a JSON formatted response body, it will be
unmarshaled into the returned error.
// Do executes an http . Request populating v with the JSON response // on success . // // If the request errors with a JSON formatted response body it will be // unmarshaled into the returned error .
func (c *Client) Do(ctx context.Context, r *http.Request, v interface{}, reqID *string, progress *ProgressFunc) (*http.Response, error) {
	done := make(chan bool)
	if progress != nil {
		version := "v1"
		req, err := http.NewRequest("GET", "http://localhost/"+version+"/observe", nil)
		if err != nil {
			return nil, err
		}
		stream, err := eventsource.SubscribeWith("", c.client, req)
		if err != nil {
			return nil, err
		}
		output := *progress
		go func() {
			for {
				select {
				case <-done:
					return
				case ev := <-stream.Events:
					data := ev.Data()
					raw := []byte(data)
					event := Event{}
					event.MessageType = "message"
					err = json.Unmarshal(raw, &event)
					if err != nil {
						output(nil, err)
						return
					}
					if event.ID == *reqID {
						output(&event, nil)
					}
				case err := <-stream.Errors:
					output(nil, err)
				}
			}
		}()
	}
	resp, err := c.client.Do(r)
	close(done)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	err = checkResponseCode(resp)
	if err != nil {
		return resp, err
	}
	if v != nil {
		dec := json.NewDecoder(resp.Body)
		err = dec.Decode(v)
		if err != nil {
			return nil, err
		}
	}
	return resp, nil
}
func ( c * Client ) Do ( ctx context . Context , r * http . Request , v interface { } , reqID * string , progress * ProgressFunc ) ( * http . Response , error ) { done := make ( chan bool ) if progress != nil { version := " " req , err := http . NewRequest ( " " , " " + version + " " , nil ) if err != nil { return nil , err } stream , err := eventsource . SubscribeWith ( " " , c . client , req ) if err != nil { return nil , err } output := * progress go func ( ) { for { select { case <- done : return case ev := <- stream . Events : data := ev . Data ( ) raw := [ ] byte ( data ) event := Event { } event . MessageType = " " err = json . Unmarshal ( raw , & event ) if err != nil { output ( nil , err ) return } if event . ID == * reqID { output ( & event , nil ) } case err := <- stream . Errors : output ( nil , err ) } } } ( ) } resp , err := c . client . Do ( r ) close ( done ) if err != nil { return nil , err } defer resp . Body . Close ( ) err = checkResponseCode ( resp ) if err != nil { return resp , err } if v != nil { dec := json . NewDecoder ( resp . Body ) err = dec . Decode ( v ) if err != nil { return nil , err } } return resp , nil }
Do executes an http.Request, populating v with the JSON response
on success.
Do executes an http . Request populating v with the JSON response on success .