Load loads data from r. contentType is a media type for r or the empty string, in which case the server will attempt to detect r's format.
(ctx context.Context, poolID ksuid.KSUID, branchName, contentType string, r io.Reader, message api.CommitMessage)
| 328 | // Load loads data from r. contentType is a media type for r or the empty |
| 329 | // string, in which case the server will attempt to detect r's format. |
| 330 | func (c *Connection) Load(ctx context.Context, poolID ksuid.KSUID, branchName, contentType string, r io.Reader, message api.CommitMessage) (api.CommitResponse, error) { |
| 331 | path := urlPath("pool", poolID.String(), "branch", branchName) |
| 332 | req := c.NewRequest(ctx, http.MethodPost, path, r) |
| 333 | req.Header.Set("Content-Type", contentType) |
| 334 | if err := encodeCommitMessage(req, message); err != nil { |
| 335 | return api.CommitResponse{}, err |
| 336 | } |
| 337 | var commit api.CommitResponse |
| 338 | err := c.doAndUnmarshal(req, &commit) |
| 339 | return commit, err |
| 340 | } |
| 341 | |
| 342 | func encodeCommitMessage(req *Request, message api.CommitMessage) error { |
| 343 | encoded, err := json.Marshal(message) |
nothing calls this directly
no test coverage detected