apiCreateNote creates a note via the API and returns its UUID
(t *testing.T, env testEnv, user database.User, bookUUID, body, message string)
| 192 | |
| 193 | // apiCreateNote creates a note via the API and returns its UUID |
| 194 | func apiCreateNote(t *testing.T, env testEnv, user database.User, bookUUID, body, message string) string { |
| 195 | res := doHTTPReq(t, env, "POST", "/v3/notes", fmt.Sprintf(`{"book_uuid": "%s", "content": "%s"}`, bookUUID, body), message, user) |
| 196 | |
| 197 | var resp controllers.CreateNoteResp |
| 198 | if err := json.NewDecoder(res.Body).Decode(&resp); err != nil { |
| 199 | t.Fatal(errors.Wrap(err, "decoding payload for adding note")) |
| 200 | return "" |
| 201 | } |
| 202 | |
| 203 | return resp.Result.UUID |
| 204 | } |
| 205 | |
| 206 | // apiPatchNote updates a note via the API |
| 207 | func apiPatchNote(t *testing.T, env testEnv, user database.User, noteUUID, payload, message string) { |