Diffusion Apple API  6.2.0
Unified Client Library for iOS, tvOS and OS X / macOS
 All Classes Functions Variables Properties Pages
Class Methods | Properties | Instance Methods | List of all members
PTDiffusionRecordV2 Class Reference

Introduction

An immutable record value with support for binary deltas.

Since
6.0
Inheritance diagram for PTDiffusionRecordV2:
PTDiffusionBytes

Class Methods

(PTDiffusionValueStream *) + valueStreamWithDelegate:
 
(PTDiffusionValueStream *) + timeSeriesEventValueStreamWithDelegate:
 
(PTDiffusionRequestHandler *) + requestHandlerWithDelegate:
 
(PTDiffusionRequestStream *) + requestStreamWithDelegate:
 
(PTDiffusionSessionResponseStream *) + sessionResponseStreamWithDelegate:
 

Properties

PTDiffusionRequestrequest
 
PTDiffusionResponseresponse
 
- Properties inherited from PTDiffusionBytes
NSData * data
 

Instance Methods

(nullable
PTDiffusionRecordV2Model *) 
- modelWithSchema:error:
 
(nullable
PTDiffusionRecordV2Model *) 
- validatedModelWithSchema:error:
 
(nullable NSArray< NSArray
< NSString * > * > *) 
- recordsWithError:
 
(nullable NSArray< NSString * > *) - fieldsWithError:
 
(PTDiffusionRecordV2Delta *) - diffFromOriginalRecord:
 
- Instance Methods inherited from PTDiffusionBytes
(instancetype) - initWithData:
 
(BOOL) - isEqualToBytes:
 

Method Documentation

- (PTDiffusionRecordV2Delta *) diffFromOriginalRecord: (PTDiffusionRecordV2 *)  originalRecord

Compare this value with an earlier version to calculate a structural delta.

Parameters
originalRecordThe original value to compare with this value.
Since
6.0.2
- (nullable NSArray<NSString *> *) fieldsWithError: (NSError **)  error

Returns the data value as an array of fields.

This disregards record boundaries. If there is more than one record, they are concatenated to produce a list of all of the fields.

Parameters
errorIf this method returns nil to indicate that an error occured then this will be populated with the reason for that failure.
Returns
An immutable array of fields derived from the data value; or nil if an error occurred, in which case *error will be populated with the failure reason.
Note
This method would normally only be used when it is known that there is only one record.
Since
6.0
- (nullable PTDiffusionRecordV2Model *) modelWithSchema: (PTDiffusionRecordV2Schema *)  schema
error: (NSError **)  error 

Parses the value into a model based upon a specified schema.

This assumes that data is compatible with the schema and does not do any validation. There is no need to validate the data if this has been done on entry or at the server. However, if the data is invalid then issues may occur when attempting to access it.

If it is not certain that the data is valid then the validatedModelWithSchema:error: method should be used instead.

Parameters
schemaThe schema to use for parsing the data.
errorIf this method returns nil to indicate that an error occured then this will be populated with the reason for that failure.
Returns
An immutable model derived from the data value; or nil if an error occurred, in which case *error will be populated with the failure reason. Reasons for failure include:
  • the data value does not contain correctly encoded record data.
Since
6.0
- (nullable NSArray<NSArray<NSString *> *> *) recordsWithError: (NSError **)  error

Returns the data value as an array of arrays of strings.

Parameters
errorIf this method returns nil to indicate that an error occured then this will be populated with the reason for that failure.
Returns
An immutable array of records derived from the data value; or nil if an error occurred, in which case *error will be populated with the failure reason.
Since
6.0
+ (PTDiffusionRequestHandler *) requestHandlerWithDelegate: (id< PTDiffusionRecordV2RequestDelegate >)  delegate

Creates a request handler capable of receiving record requests for a handler registered at the server.

Parameters
delegateThe object which will handle the incoming requests. A weak reference is maintained to this object by the returned handler.
Returns
An object reliant on the supplied delegate that can be registered at the server using the Messaging Control feature.
Exceptions
NSInvalidArgumentExceptionRaised if the delegate argument is nil.
See Also
PTDiffusionMessagingControlFeature
Since
6.0
+ (PTDiffusionRequestStream *) requestStreamWithDelegate: (id< PTDiffusionRecordV2RequestStreamDelegate >)  delegate

Creates a request stream capable of receiving record requests.

Parameters
delegateThe object which will handle the incoming requests. A weak reference is maintained to this object by the returned stream.
Returns
An object reliant on the supplied delegate that can be set as the receiver of requests using the Messaging feature.
Exceptions
NSInvalidArgumentExceptionRaised if the delegate argument is nil.
See Also
PTDiffusionMessagingFeature
Since
6.0
+ (PTDiffusionSessionResponseStream *) sessionResponseStreamWithDelegate: (id< PTDiffusionRecordV2SessionResponseStreamDelegate >)  delegate

Creates a response stream capable of receiving record responses from discrete sessions.

Parameters
delegateThe object which will handle the incoming responses. A weak reference is maintained to this object by the returned stream.
Returns
An object reliant on the supplied delegate that can be set as the receiver of requests using the Messaging Control feature.
Exceptions
NSInvalidArgumentExceptionRaised if the delegate argument is nil.
See Also
PTDiffusionMessagingControlFeature
Since
6.1
+ (PTDiffusionValueStream *) timeSeriesEventValueStreamWithDelegate: (id< PTDiffusionRecordV2TimeSeriesEventValueStreamDelegate >)  delegate

Creates a value stream capable of receiving record time series events.

Parameters
delegateThe object which will handle the incoming stream. A weak reference is maintained to this object by the returned stream.
Returns
An object reliant on the supplied delegate that can be added as a receiver of values using the Topics feature.
Exceptions
NSInvalidArgumentExceptionRaised if the delegate argument is nil.
See Also
PTDiffusionTopicsFeature
Since
6.0
- (nullable PTDiffusionRecordV2Model *) validatedModelWithSchema: (PTDiffusionRecordV2Schema *)  schema
error: (NSError **)  error 

Parses the value into a model based upon a specified schema.

Parameters
schemaThe schema to use for parsing the data.
errorIf this method returns nil to indicate that an error occured then this will be populated with the reason for that failure.
Returns
An immutable model derived from the data value; or nil if an error occurred, in which case *error will be populated with the failure reason. Reasons for failure include:
  • the data value does not contain correctly encoded record data.
  • the data value is incompatible with the supplied schema.
+ (PTDiffusionValueStream *) valueStreamWithDelegate: (id< PTDiffusionRecordV2ValueStreamDelegate >)  delegate

Creates a value stream capable of receiving record values.

Parameters
delegateThe object which will handle the incoming stream. A weak reference is maintained to this object by the returned stream.
Returns
An object reliant on the supplied delegate that can be added as a receiver of values using the Topics feature.
Exceptions
NSInvalidArgumentExceptionRaised if the delegate argument is nil.
See Also
PTDiffusionTopicsFeature
Since
6.0

Property Documentation

- (PTDiffusionRequest*) request
readnonatomicassign

A request that can be used to send this value using messaging.

Since
6.0.1
- (PTDiffusionResponse*) response
readnonatomicassign

A response that can be used to send this value using messaging.

Since
6.1