MCPcopy Index your code
hub / github.com/dnote/dnote / GetSyncState

Function GetSyncState

pkg/cli/client/client.go:215–233  ·  view source on GitHub ↗

GetSyncState gets the sync state response from the server

(ctx context.DnoteCtx)

Source from the content-addressed store, hash-verified

213
214// GetSyncState gets the sync state response from the server
215func 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

Callers 1

newRunFunction · 0.92

Calls 1

doAuthorizedReqFunction · 0.85

Tested by

no test coverage detected