github.com/bshelton229/agent@v3.5.4+incompatible/api/header_times.go (about)

     1  package api
     2  
     3  import (
     4  	"fmt"
     5  )
     6  
     7  // HeaderTimesService handles communication with the meta data related methods
     8  // of the Buildkite Agent API.
     9  type HeaderTimesService struct {
    10  	client *Client
    11  }
    12  
    13  // HeaderTimes represents a set of header times that are associated with a job
    14  // log.
    15  type HeaderTimes struct {
    16  	Times map[string]string `json:"header_times"`
    17  }
    18  
    19  // Saves the header times to the job
    20  func (hs *HeaderTimesService) Save(jobId string, headerTimes *HeaderTimes) (*Response, error) {
    21  	u := fmt.Sprintf("jobs/%s/header_times", jobId)
    22  
    23  	req, err := hs.client.NewRequest("POST", u, headerTimes)
    24  	if err != nil {
    25  		return nil, err
    26  	}
    27  
    28  	resp, err := hs.client.Do(req, nil)
    29  	if err != nil {
    30  		return resp, err
    31  	}
    32  
    33  	return resp, err
    34  }