il2_rest/client.py
def add_record_as_json(self, applicationId=None, payloadTagId=None, payload=None, rec_type=RecordType.Data, model=None) :
        """
        Add a new record with a payload encoded as JSON.
        The JSON value will be mapped to the payload tagged format as described by the metadata associated with the payloadTagId

        Args:
            applicationId (:obj:`int`): Application id of the record.
            payloadTagId (:obj:`int`): Payload tag id of the record.
            payload (:obj:`int`): Payload data encoded as json
            rec_type (:obj:`il2_rest.enumerations.RecordType`): Type of record.
            model (:obj:`il2_rest.models.NewRecordModelAsJson`): Model with the description of the new record as JSON. **NOTE:**  if model is not None, the other arguments will be ignored.

        Returns:
            :obj:`il2_rest.models.RecordModel`: Added record information.

        Example: 
            >>> node = RestNode(cert_file='recorder.pfx', cert_pass='password', port=32020)
            >>> chain = node.chain_by_id('tdiy2HnWv-4a_h5T4Xy8l93CQ0lVkIeu2r5qgSlALMY')
            >>> model = NewRecordModelAsJson(applicationId=1, payloadTagId=300, rec_json={'tagId': 300,'version': 0, 'apps': [4]})
            >>> record = chain.add_record_as_json(model=model)
            >>> print(record)
            {
                "applicationId": 1,
                "chainId": "tdiy2HnWv-4a_h5T4Xy8l93CQ0lVkIeu2r5qgSlALMY",
                "createdAt": "2020-02-13T18:56:44.3002447-03:00",
                "hash": "Y8Xb9FpTkgxj38xlwzcaZXm8fUq-NYxODVcyOQtzJ3c#SHA256",
                "payloadTagId": 300,
                "serial": 4,
                "type": "Data",
                "version": 2,
                "payload": {
                    "tagId": 300,
                    "version": 0,
                    "apps": [
                        4
                    ]
                }
            }
        """
        if model :
            if not isinstance(model, NewRecordModelAsJson) :
                raise TypeError('model must be NewRecordModelAsJson')
            return RecordModelAsJson.from_json(self.__rest._post(f"/records@{self.id}/asJson{model.to_query_string}", model.JSON))
        else :
            if applicationId is None:
                raise TypeError('applicationId is None')
            if payloadTagId is None:
                raise TypeError('payloadTagId is None')
            if payload is None:
                raise TypeError('payload is None')
            model = NewRecordModelAsJson(applicationId=applicationId, payloadTagId=payloadTagId, rec_type=rec_type, rec_json=payload)

        Add a new record with a payload encoded as JSON.
        The JSON value will be mapped to the payload tagged format as described by the metadata associated with the payloadTagId

        Args:
            applicationId (:obj:`int`): Application id of the record.
            payloadTagId (:obj:`int`): Payload tag id of the record.
            payload (:obj:`int`): Payload data encoded as json
            rec_type (:obj:`il2_rest.enumerations.RecordType`): Type of record.
            model (:obj:`il2_rest.models.NewRecordModelAsJson`): Model with the description of the new record as JSON. **NOTE:**  if model is not None, the other arguments will be ignored.

        Returns:
            :obj:`il2_rest.models.RecordModel`: Added record information.

        Example: 
            >>> node = RestNode(cert_file='recorder.pfx', cert_pass='password', port=32020)
            >>> chain = node.chain_by_id('tdiy2HnWv-4a_h5T4Xy8l93CQ0lVkIeu2r5qgSlALMY')
            >>> model = NewRecordModelAsJson(applicationId=1, payloadTagId=300, rec_json={'tagId': 300,'version': 0, 'apps': [4]})
            >>> record = chain.add_record_as_json(model=model)
            >>> print(record)
            {
                "applicationId": 1,
                "chainId": "tdiy2HnWv-4a_h5T4Xy8l93CQ0lVkIeu2r5qgSlALMY",
                "createdAt": "2020-02-13T18:56:44.3002447-03:00",
                "hash": "Y8Xb9FpTkgxj38xlwzcaZXm8fUq-NYxODVcyOQtzJ3c#SHA256",
                "payloadTagId": 300,
                "serial": 4,
                "type": "Data",
                "version": 2,
                "payload": {
                    "tagId": 300,
                    "version": 0,
                    "apps": [
                        4
                    ]
                }
            }
        
Add a new record with a payload encoded as JSON.
The JSON value will be mapped to the payload tagged format as described by the metadata associated with the payloadTagId
Add a new record with a payload encoded as JSON . The JSON value will be mapped to the payload tagged format as described by the metadata associated with the payloadTagId
def add_record_as_json(self, applicationId=None, payloadTagId=None, payload=None, rec_type=RecordType.Data, model=None) :
        if model :
            if not isinstance(model, NewRecordModelAsJson) :
                raise TypeError('model must be NewRecordModelAsJson')
            return RecordModelAsJson.from_json(self.__rest._post(f"/records@{self.id}/asJson{model.to_query_string}", model.JSON))
        else :
            if applicationId is None:
                raise TypeError('applicationId is None')
            if payloadTagId is None:
                raise TypeError('payloadTagId is None')
            if payload is None:
                raise TypeError('payload is None')
            model = NewRecordModelAsJson(applicationId=applicationId, payloadTagId=payloadTagId, rec_type=rec_type, rec_json=payload)
def add_record_as_json ( self , applicationId = None , payloadTagId = None , payload = None , rec_type = RecordType . Data , model = None ) : if model : if not isinstance ( model , NewRecordModelAsJson ) : raise TypeError ( 'model must be NewRecordModelAsJson' ) return RecordModelAsJson . from_json ( self . __rest . _post ( f"/records@{self.id}/asJson{model.to_query_string}" , model . JSON ) ) else : if applicationId is None : raise TypeError ( 'applicationId is None' ) if payloadTagId is None : raise TypeError ( 'payloadTagId is None' ) if payload is None : raise TypeError ( 'payload is None' ) model = NewRecordModelAsJson ( applicationId = applicationId , payloadTagId = payloadTagId , rec_type = rec_type , rec_json = payload )
Add a new record with a payload encoded as JSON.
Add a new record with a payload encoded as JSON .
"""
        Add a new record with a payload encoded as JSON.
        The JSON value will be mapped to the payload tagged format as described by the metadata associated with the payloadTagId

        Args:
            applicationId (:obj:`int`): Application id of the record.
            payloadTagId (:obj:`int`): Payload tag id of the record.
            payload (:obj:`int`): Payload data encoded as json
            rec_type (:obj:`il2_rest.enumerations.RecordType`): Type of record.
            model (:obj:`il2_rest.models.NewRecordModelAsJson`): Model with the description of the new record as JSON. **NOTE:**  if model is not None, the other arguments will be ignored.

        Returns:
            :obj:`il2_rest.models.RecordModel`: Added record information.

        Example: 
            >>> node = RestNode(cert_file='recorder.pfx', cert_pass='password', port=32020)
            >>> chain = node.chain_by_id('tdiy2HnWv-4a_h5T4Xy8l93CQ0lVkIeu2r5qgSlALMY')
            >>> model = NewRecordModelAsJson(applicationId=1, payloadTagId=300, rec_json={'tagId': 300,'version': 0, 'apps': [4]})
            >>> record = chain.add_record_as_json(model=model)
            >>> print(record)
            {
                "applicationId": 1,
                "chainId": "tdiy2HnWv-4a_h5T4Xy8l93CQ0lVkIeu2r5qgSlALMY",
                "createdAt": "2020-02-13T18:56:44.3002447-03:00",
                "hash": "Y8Xb9FpTkgxj38xlwzcaZXm8fUq-NYxODVcyOQtzJ3c#SHA256",
                "payloadTagId": 300,
                "serial": 4,
                "type": "Data",
                "version": 2,
                "payload": {
                    "tagId": 300,
                    "version": 0,
                    "apps": [
                        4
                    ]
                }
            }
        """
:obj:`il2_rest.models.RecordModel`: Added record information.
: obj : ` il2_rest . models . RecordModel ` : Added record information .
self
applicationId
payloadTagId
payload
rec_type
model
applicationId (
`int`): Application id of the record.
` int ` ) : Application id of the record .
payloadTagId (
`int`): Payload tag id of the record.
` int ` ) : Payload tag id of the record .
payload (
`int`): Payload data encoded as json
` int ` ) : Payload data encoded as json
rec_type (
`il2_rest.enumerations.RecordType`): Type of record.
` il2_rest . enumerations . RecordType ` ) : Type of record .
model (
`il2_rest.models.NewRecordModelAsJson`): Model with the description of the new record as JSON. **NOTE:**  if model is not None, the other arguments will be ignored.
` il2_rest . models . NewRecordModelAsJson ` ) : Model with the description of the new record as JSON . ** NOTE : ** if model is not None the other arguments will be ignored .
examples
None