GetSyncState gets the sync state response from the server
(ctx context.DnoteCtx)
| 213 | |
| 214 | // GetSyncState gets the sync state response from the server |
| 215 | func GetSyncState(ctx context.DnoteCtx) (GetSyncStateResp, error) { |
| 216 | var ret GetSyncStateResp |
| 217 | |
| 218 | res, err := doAuthorizedReq(ctx, "GET", "/v3/sync/state", "", nil) |
| 219 | if err != nil { |
| 220 | return ret, errors.Wrap(err, "constructing http request") |
| 221 | } |
| 222 | |
| 223 | body, err := io.ReadAll(res.Body) |
| 224 | if err != nil { |
| 225 | return ret, errors.Wrap(err, "reading the response body") |
| 226 | } |
| 227 | |
| 228 | if err = json.Unmarshal(body, &ret); err != nil { |
| 229 | return ret, errors.Wrap(err, "unmarshalling the payload") |
| 230 | } |
| 231 | |
| 232 | return ret, nil |
| 233 | } |
| 234 | |
| 235 | // SyncFragNote represents a note in a sync fragment and contains only the necessary information |
| 236 | // for the client to sync the note locally |
no test coverage detected