DBRoute

@interface DBRoute : NSObject

Route object used to encapsulate route-specific information.

  • Name of the route.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic) NSString *_Nonnull name;

    Swift

    var name: String { get }
  • Namespace that the route is contained within.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic) NSString *_Nonnull namespace_;

    Swift

    var namespace_: String { get }
  • Whether the route is deprecated.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSNumber *_Nonnull deprecated;

    Swift

    var deprecated: NSNumber { get }
  • Class of the route’s result object type (must implement DBSerializable protocol).

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) Class<DBSerializable> resultType;

    Swift

    var resultType: DBSerializable.Type? { get }
  • Class of the route’s error object type (must implement DBSerializable protocol). Note: this class is only for route-specific errors, as opposed to more generic Dropbox API errors, as represented by the DBRequestError class.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) Class<DBSerializable> errorType;

    Swift

    var errorType: DBSerializable.Type? { get }
  • Custom attributes associated with each route (can pertain to authentication type, host cluster, request-type, etc.).

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable)
        NSDictionary<NSString *, NSString *> *attrs;

    Swift

    var attrs: [String : String]? { get }
  • Serialization block for the route’s result object type, if that result object type is an NSArray, otherwise nil.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) id _Nonnull (^)(id _Nonnull)
        dataStructSerialBlock;

    Swift

    var dataStructSerialBlock: ((Any) -> Any)? { get }
  • Deserialization block for the route’s result object type, if that result object type is a data structure, otherwise nil.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) id _Nonnull (^)(id _Nonnull)
        dataStructDeserialBlock;

    Swift

    var dataStructDeserialBlock: ((Any) -> Any)? { get }
  • Initializes the route object.

    Declaration

    Objective-C

    - (nonnull instancetype)init:(nonnull NSString *)name
                      namespace_:(nonnull NSString *)namespace_
                      deprecated:(nonnull NSNumber *)deprecated
                      resultType:(nullable Class<DBSerializable>)resultType
                       errorType:(nullable Class<DBSerializable>)errorType
                           attrs:
                               (nonnull NSDictionary<NSString *, NSString *> *)attrs
           dataStructSerialBlock:
               (nullable id _Nonnull (^)(id _Nonnull))dataStructSerialBlock
         dataStructDeserialBlock:
             (nullable id _Nonnull (^)(id _Nonnull))dataStructDeserialBlock;

    Swift

    init(_ name: String, namespace_: String, deprecated: NSNumber, resultType: DBSerializable.Type?, errorType: DBSerializable.Type?, attrs: [String : String], dataStructSerialBlock: ((Any) -> Any)?, dataStructDeserialBlock: ((Any) -> Any)? = nil)