fix: wrap Notable record fields payload
This commit is contained in:
@@ -132,7 +132,11 @@ func (c *Client) BaseURL() string { return c.baseURL }
|
||||
|
||||
// insertRecordReq is the JSON body for the Notable v1 insertRecord endpoint.
|
||||
type insertRecordReq struct {
|
||||
Records []map[string]interface{} `json:"records"`
|
||||
Records []insertRecord `json:"records"`
|
||||
}
|
||||
|
||||
type insertRecord struct {
|
||||
Fields map[string]interface{} `json:"fields"`
|
||||
}
|
||||
|
||||
// insertRecordResp is the success response body.
|
||||
@@ -161,7 +165,7 @@ func (c *Client) InsertRecord(ctx context.Context, row Row) (string, error) {
|
||||
reqURL := c.baseURL + path + "?operatorId=" + url.QueryEscape(c.operatorID)
|
||||
|
||||
fields := row.ToFields()
|
||||
body := insertRecordReq{Records: []map[string]interface{}{fields}}
|
||||
body := insertRecordReq{Records: []insertRecord{{Fields: fields}}}
|
||||
jsonBody, err := json.Marshal(body)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("questiontable marshal: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user