github.com/equinox-io/equinox@v1.2.1-0.20200723040547-60ffe7f858fe/sdk_ctx.go (about)

     1  // +build go1.7
     2  
     3  package equinox
     4  
     5  import (
     6  	"context"
     7  )
     8  
     9  // CheckContext is like Check but includes a context.
    10  func CheckContext(ctx context.Context, appID string, opts Options) (Response, error) {
    11  	var req, err = checkRequest(appID, &opts)
    12  
    13  	if err != nil {
    14  		return Response{}, err
    15  	}
    16  
    17  	return doCheckRequest(opts, req.WithContext(ctx))
    18  }
    19  
    20  // ApplyContext is like Apply but includes a context.
    21  func (r Response) ApplyContext(ctx context.Context) error {
    22  	var req, opts, err = r.applyRequest()
    23  
    24  	if err != nil {
    25  		return err
    26  	}
    27  
    28  	return r.applyUpdate(req.WithContext(ctx), opts)
    29  }