PendingRequest

open class PendingRequest : ObjectBase

Represents a pending request from client to server, retained on the client during offline operation until it can be successfully uploaded to the server, or cancelled by the application.

  • For filtering/ordering by change set.

    Declaration

    Swift

    public static let changeSet: Property
  • For filtering/ordering by custom tag.

    Declaration

    Swift

    public static let customTag: Property
  • For filtering/ordering by first sent.

    Declaration

    Swift

    public static let firstSent: Property
  • For filtering/ordering by HTTP method.

    Declaration

    Swift

    public static let httpMethod: Property
  • For filtering/ordering by HTTP status.

    Declaration

    Swift

    public static let httpStatus: Property
  • For filtering/ordering by request ID.

    Declaration

    Swift

    public static let requestID: Property
  • For filtering/ordering by request URL.

    Declaration

    Swift

    public static let requestURL: Property
  • For filtering/ordering by upload group.

    Declaration

    Swift

    public static let uploadGroup: Property
  • Default initializer.

    Declaration

    Swift

    override public init()
  • Declaration

    Swift

    open func affectedEntity(fixRequest: Bool = false) throws -> EntityValue?

    Parameters

    fixRequest

    If the returned entity is to be used to directly fix this pending request, then true, otherwise false. Defaults to false.

    Return Value

    The latest client-side state of the entity (if any) that was affected by this request, or if fixRequest is true, then an entity that can be updated to directly fix this pending request.

  • Cancel this pending request any any other pending requests that depend on it.

    Declaration

    Swift

    open func cancel() throws
  • Client-specified change set for this request.

    Declaration

    Swift

    open var changeSet: String? { get }
  • Client-specified custom tag for this request.

    Declaration

    Swift

    open var customTag: String? { get }
  • Declaration

    Swift

    open func dependentRequests() throws -> PendingRequestList

    Return Value

    The other requests (if any) that depend on the successful completion of this request.

  • Entity set if applicable to this request, otherwise nil.

    Declaration

    Swift

    open var entitySet: EntitySet? { get }
  • Entity type if applicable to this request, otherwise nil.

    Declaration

    Swift

    open var entityType: EntityType? { get }
  • Declaration

    Swift

    open func errorResponse() throws -> ErrorResponse?

    Return Value

    The error response information, if hasError is true.

  • Date/time this request was first sent, or nil if unsent.

    Declaration

    Swift

    open var firstSent: GlobalDateTime? { get }
  • Indicates whether this request was previously sent (at least once) to the backend system, but failed to complete successfully due to network or service issues.

    Declaration

    Swift

    open var hasError: Bool { get }
  • HTTP request headers.

    Declaration

    Swift

    open var httpHeaders: HTTPHeaders { get }
  • HTTP request method.

    Declaration

    Swift

    open var httpMethod: String { get }
  • HTTP response status if available, otherwise nil.

    Declaration

    Swift

    open var httpStatus: Int? { get }
  • Declaration

    Swift

    open func latestDownload(fixRequest: Bool = false) throws -> EntityValue?

    Parameters

    fixRequest

    If the returned entity is to be used to directly fix this pending request (by reapplying the changes), then true, otherwise false. Defaults to false.

    Return Value

    The latest downloaded state of the entity (if any), that was affected by this request.

  • Enumeration value describing the method of this request.

    See also

    httpMethod.

    Declaration

    Swift

    open var method: RequestMethod { get }
  • Declaration

    Swift

    open func originalEntity(fixRequest: Bool = false) throws -> EntityValue?

    Parameters

    fixRequest

    If the returned entity is to be used to directly fix this pending request (by reapplying the changes), then true, otherwise false. Defaults to false.

    Return Value

    The original downloaded state of the entity (if any), that was affected by this request.

  • See also

    getRequestText.

    Declaration

    Swift

    open func requestData() throws -> Data?

    Return Value

    HTTP request body (as binary data) if available, otherwise nil.

  • Client-generated unique ID for this request.

    Declaration

    Swift

    open var requestID: Int64 { get }
  • See also

    getRequestData.

    Declaration

    Swift

    open func requestText() throws -> String?

    Return Value

    HTTP request body (as text string) if available, otherwise nil. If non-null, the returned value will typically be a JSON text string. Note: If method is createMedia, uploadMedia or uploadStream, then nil will be returned even if the stream’s media type indicates text.

  • HTTP request content type.

    Declaration

    Swift

    open var requestType: String? { get }
  • HTTP request URL, relative to the service root.

    Declaration

    Swift

    open var requestURL: String { get }
  • Declaration

    Swift

    open func responseData() throws -> Data?

    Return Value

    HTTP response body (as binary data) if available, otherwise nil.

  • Declaration

    Swift

    open func responseText() throws -> String?

    Return Value

    HTTP response body (as text string) if available, otherwise nil. If non-null, the returned value will typically be a JSON text string.

  • HTTP response content type.

    Declaration

    Swift

    open var responseType: String? { get }
  • Enumeration value describing the status of this request.

    See also

    httpStatus.

    Declaration

    Swift

    open var status: RequestStatus { get }
  • See also

    toStringWithDetails.

    Declaration

    Swift

    override open func toString() -> String

    Return Value

    String representation of this pending request, omitting request headers and content.

  • Declaration

    Swift

    open func toStringWithDetails(fetchDetails: Bool, includeHeaders: Bool = true, includeContent: Bool = true, hideCredentials: Bool = true) -> String

    Parameters

    fetchDetails

    Pass true to include details, otherwise the result will be the same as returned by toString and the remaining parameters will be ignored.

    includeHeaders

    If true, then the returned string will include request headers. Defaults to true.

    includeContent

    If true, then the returned string will include request headers. Defaults to true.

    hideCredentials

    If true, then the returned string will hide request credentials. Defaults to true.

    Return Value

    String representation of this pending request, with optional details.

  • Client-generated upload group for this request.

    Declaration

    Swift

    open var uploadGroup: String? { get }