PNResult Class Reference

Inherits from NSObject
Declared in PNResult.h

Overview

This object contains response itself and also set of data which has been used to communicate with \b PubNub service to get this response.

@author Sergey Mamontov

Information

  statusCode

Stores HTTP status code with which \c request completed processing with \b PubNub service.

@property (nonatomic, readonly, assign) NSInteger statusCode

Availability

4.0

Declared In

PNResult.h

  operation

Represent type of operation which has been issued to \b PubNub service and received response stored in \c response and processed response in \c data.

@property (nonatomic, readonly, assign) PNOperationType operation

Availability

4.0

Declared In

PNResult.h

  TLSEnabled

Stores whether secured connection has been used to send request or not.

@property (nonatomic, readonly, assign, getter=isTLSEnabled) BOOL TLSEnabled

Availability

4.0

Declared In

PNResult.h

  uuid

UUID which is currently used by client to identify user on \b PubNub service.

@property (nonatomic, readonly, copy) NSString *uuid

Availability

4.0

Declared In

PNResult.h

  authKey

Authorization which is used to get access to protected remote resources.

@property (nonatomic, readonly, copy) NSString *authKey

Availability

4.0

Discussion

Some resources can be protected by \b PAM functionality and access done using this authorization key.

Declared In

PNResult.h

  origin

Stores reference on \b PubNub service host name or IP address against which \c request has been called.

@property (nonatomic, readonly, copy) NSString *origin

Availability

4.0

Declared In

PNResult.h

  clientRequest

Stores reference on copy of original request which has been used to fetch or push data to \b PubNub service.

@property (nonatomic, readonly, copy) NSURLRequest *clientRequest

Availability

4.0

Declared In

PNResult.h

Extension Methods

  serviceData

Stores reference on processed \c response which is ready to use by user.

@property (nonatomic, copy) NSDictionary *serviceData

Availability

4.0

Discussion

Content and format for this property different for API. Each method has description about expected fields and data stored inside.

Declared In

PNResult+Private.h

– copyWithMutatedData:

Make copy of current result object with mutated data which should be stored in it.

- (instancetype)copyWithMutatedData:(id)data

Parameters

data

Reference on data which should be stored within new instance.

Return Value

Copy of receiver with modified data.

Availability

4.0

Discussion

Method can be used to create sub-events (for example one for each message or presence event).

Declared In

PNResult+Private.h

– updateData:

Update data stored for result object.

- (void)updateData:(id)data

Parameters

data

New data which should be placed into result object.

Availability

4.0

Declared In

PNResult+Private.h

– stringifiedRepresentation

Convert result object to string which can be used to print out data

- (NSString *)stringifiedRepresentation

Return Value

Stringified object representation.

Availability

4.0

Declared In

PNResult+Private.h

Private Methods

+ objectForOperation:completedWithTaks:processedData:

Consntruct result instance in response to successful task completion.

+ (instancetype)objectForOperation:(PNOperationType)operation completedWithTaks:(NSURLSessionDataTask *)task processedData:(NSDictionary *)processedData

Parameters

operation

One of \b PNOperationType enum fields to describe what kind of operation has been processed.

task

Reference on data task which has been used to communicate with \b PubNub network.

processedData

Reference on data which has been loaded and pre-processed by corresponding parser.

Return Value

Constructed and ready to use result instance.

Availability

4.0

Declared In

PNResult+Private.h

– initForOperation:completedWithTaks:processedData:

Initialize result instance in response to successful task completion.

- (instancetype)initForOperation:(PNOperationType)operation completedWithTaks:(NSURLSessionDataTask *)task processedData:(NSDictionary *)processedData

Parameters

operation

One of \b PNOperationType enum fields to describe what kind of operation has been processed.

task

Reference on data task which has been used to communicate with \b PubNub network.

processedData

Reference on data which has been loaded and pre-processed by corresponding parser.

Return Value

Initialized and ready to use result instance.

Availability

4.0

Declared In

PNResult+Private.h

– dictionaryRepresentation

Convert result object to dictionary which can be used to print out structured data

- (NSDictionary *)dictionaryRepresentation

Return Value

Object in dictionary representation.

Availability

4.0

Declared In

PNResult+Private.h