amazonka-cognito-sync-2.0: Amazon Cognito Sync SDK.
Copyright(c) 2013-2023 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Amazonka.CognitoSync.UpdateRecords

Description

Posts updates to records and adds and deletes records for a dataset and user.

The sync count in the record patch is your last known sync count for that record. The server will reject an UpdateRecords request with a ResourceConflictException if you try to patch a record with a new value but a stale sync count.

For example, if the sync count on the server is 5 for a key called highScore and you try and submit a new highScore with sync count of 4, the request will be rejected. To obtain the current sync count for a record, call ListRecords. On a successful update of the record, the response returns the new sync count for that record. You should present that sync count the next time you try to update that same record. When the record does not exist, specify the sync count as 0.

This API can be called with temporary user credentials provided by Cognito Identity or with developer credentials.

Synopsis

Creating a Request

data UpdateRecords Source #

A request to post updates to records or add and delete records for a dataset and user.

See: newUpdateRecords smart constructor.

Constructors

UpdateRecords' 

Fields

  • clientContext :: Maybe Text

    Intended to supply a device ID that will populate the lastModifiedBy field referenced in other methods. The ClientContext field is not yet implemented.

  • deviceId :: Maybe Text

    The unique ID generated for this device by Cognito.

  • recordPatches :: Maybe [RecordPatch]

    A list of patch operations.

  • identityPoolId :: Text

    A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.

  • identityId :: Text

    A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.

  • datasetName :: Text

    A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).

  • syncSessionToken :: Text

    The SyncSessionToken returned by a previous call to ListRecords for this dataset and identity.

Instances

Instances details
ToJSON UpdateRecords Source # 
Instance details

Defined in Amazonka.CognitoSync.UpdateRecords

ToHeaders UpdateRecords Source # 
Instance details

Defined in Amazonka.CognitoSync.UpdateRecords

ToPath UpdateRecords Source # 
Instance details

Defined in Amazonka.CognitoSync.UpdateRecords

ToQuery UpdateRecords Source # 
Instance details

Defined in Amazonka.CognitoSync.UpdateRecords

AWSRequest UpdateRecords Source # 
Instance details

Defined in Amazonka.CognitoSync.UpdateRecords

Associated Types

type AWSResponse UpdateRecords #

Generic UpdateRecords Source # 
Instance details

Defined in Amazonka.CognitoSync.UpdateRecords

Associated Types

type Rep UpdateRecords :: Type -> Type #

Read UpdateRecords Source # 
Instance details

Defined in Amazonka.CognitoSync.UpdateRecords

Show UpdateRecords Source # 
Instance details

Defined in Amazonka.CognitoSync.UpdateRecords

NFData UpdateRecords Source # 
Instance details

Defined in Amazonka.CognitoSync.UpdateRecords

Methods

rnf :: UpdateRecords -> () #

Eq UpdateRecords Source # 
Instance details

Defined in Amazonka.CognitoSync.UpdateRecords

Hashable UpdateRecords Source # 
Instance details

Defined in Amazonka.CognitoSync.UpdateRecords

type AWSResponse UpdateRecords Source # 
Instance details

Defined in Amazonka.CognitoSync.UpdateRecords

type Rep UpdateRecords Source # 
Instance details

Defined in Amazonka.CognitoSync.UpdateRecords

type Rep UpdateRecords = D1 ('MetaData "UpdateRecords" "Amazonka.CognitoSync.UpdateRecords" "amazonka-cognito-sync-2.0-4eAo0O3jWiUGlkSwv2vKaB" 'False) (C1 ('MetaCons "UpdateRecords'" 'PrefixI 'True) ((S1 ('MetaSel ('Just "clientContext") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: (S1 ('MetaSel ('Just "deviceId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "recordPatches") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [RecordPatch])))) :*: ((S1 ('MetaSel ('Just "identityPoolId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "identityId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "datasetName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "syncSessionToken") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)))))

newUpdateRecords Source #

Create a value of UpdateRecords with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:clientContext:UpdateRecords', updateRecords_clientContext - Intended to supply a device ID that will populate the lastModifiedBy field referenced in other methods. The ClientContext field is not yet implemented.

$sel:deviceId:UpdateRecords', updateRecords_deviceId - The unique ID generated for this device by Cognito.

$sel:recordPatches:UpdateRecords', updateRecords_recordPatches - A list of patch operations.

UpdateRecords, updateRecords_identityPoolId - A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.

UpdateRecords, updateRecords_identityId - A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.

UpdateRecords, updateRecords_datasetName - A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).

$sel:syncSessionToken:UpdateRecords', updateRecords_syncSessionToken - The SyncSessionToken returned by a previous call to ListRecords for this dataset and identity.

Request Lenses

updateRecords_clientContext :: Lens' UpdateRecords (Maybe Text) Source #

Intended to supply a device ID that will populate the lastModifiedBy field referenced in other methods. The ClientContext field is not yet implemented.

updateRecords_deviceId :: Lens' UpdateRecords (Maybe Text) Source #

The unique ID generated for this device by Cognito.

updateRecords_identityPoolId :: Lens' UpdateRecords Text Source #

A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.

updateRecords_identityId :: Lens' UpdateRecords Text Source #

A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.

updateRecords_datasetName :: Lens' UpdateRecords Text Source #

A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).

updateRecords_syncSessionToken :: Lens' UpdateRecords Text Source #

The SyncSessionToken returned by a previous call to ListRecords for this dataset and identity.

Destructuring the Response

data UpdateRecordsResponse Source #

Returned for a successful UpdateRecordsRequest.

See: newUpdateRecordsResponse smart constructor.

Constructors

UpdateRecordsResponse' 

Fields

Instances

Instances details
Generic UpdateRecordsResponse Source # 
Instance details

Defined in Amazonka.CognitoSync.UpdateRecords

Associated Types

type Rep UpdateRecordsResponse :: Type -> Type #

Read UpdateRecordsResponse Source # 
Instance details

Defined in Amazonka.CognitoSync.UpdateRecords

Show UpdateRecordsResponse Source # 
Instance details

Defined in Amazonka.CognitoSync.UpdateRecords

NFData UpdateRecordsResponse Source # 
Instance details

Defined in Amazonka.CognitoSync.UpdateRecords

Methods

rnf :: UpdateRecordsResponse -> () #

Eq UpdateRecordsResponse Source # 
Instance details

Defined in Amazonka.CognitoSync.UpdateRecords

type Rep UpdateRecordsResponse Source # 
Instance details

Defined in Amazonka.CognitoSync.UpdateRecords

type Rep UpdateRecordsResponse = D1 ('MetaData "UpdateRecordsResponse" "Amazonka.CognitoSync.UpdateRecords" "amazonka-cognito-sync-2.0-4eAo0O3jWiUGlkSwv2vKaB" 'False) (C1 ('MetaCons "UpdateRecordsResponse'" 'PrefixI 'True) (S1 ('MetaSel ('Just "records") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [Record])) :*: S1 ('MetaSel ('Just "httpStatus") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)))

newUpdateRecordsResponse Source #

Create a value of UpdateRecordsResponse with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:records:UpdateRecordsResponse', updateRecordsResponse_records - A list of records that have been updated.

$sel:httpStatus:UpdateRecordsResponse', updateRecordsResponse_httpStatus - The response's http status code.

Response Lenses

updateRecordsResponse_records :: Lens' UpdateRecordsResponse (Maybe [Record]) Source #

A list of records that have been updated.