ZendriveDriverAttributes

@interface ZendriveDriverAttributes : NSObject <NSCopying>

Additional attributes of a Zendrive driver.

The application can specify both predefined and custom attributes for a driver. These attributes are associated with a SDK driverId at SDK initialization time. In addition to predefined special attributes, up to 4 custom key value attributes can be associated with a driver using the Zendrive SDK.

Warning

All attribute keys can be atmost 64 characters in length.

Warning

All attribute values can be atmost 1024 characters in length.
  • A unique id that associates the current user to a group. This groupId will be made available as a query parameter to filter users in the reports and API that Zendrive provides.

    For example, ‘EastCoast’ and ‘WestCoast’ can be groupIds to distinguish users from these regions. Another example would be using city names as groupIds. Check +[Zendrive isValidInputParameter:] method to validate group id. Setting an invalid groupId is a no-op and would log an error.

    Declaration

    Objective-C

    - (BOOL)setGroup:(nonnull NSString *)groupId;

    Parameters

    groupId

    A string representing the group of a user.

    Return Value

    YES, if the value was set, NO otherwise.

  • The service level of a driver. This is useful for applications where Zendrive supports different service levels for different drivers. See ServiceLevel for more information about this attribute.

    Declaration

    Objective-C

    - (BOOL)setServiceLevel:(ZendriveServiceLevel)serviceLevel;

    Parameters

    serviceLevel

    service tier of the user.

  • Set the custom attribute of the user.

    Up to 4 custom attributes can be set for a user. A new value for an existing key would be overwritten only if the value length is within 1024 characters, otherwise the original value would be retained.

    Declaration

    Objective-C

    - (BOOL)setCustomAttribute:(nonnull NSString *)value
                        forKey:(nonnull NSString *)key;

    Parameters

    key

    A key for the custom attribute. The maximum key length is 64 characters.

    value

    Value of the custom attribute. The maximum value length is 1024 characters.

    Return Value

    YES, if the value was set, NO otherwise.

  • Alias is a string placeholder offered as a convenience for developers to create a reference for a driver

    Declaration

    Objective-C

    - (BOOL)setAlias:(nonnull NSString *)alias;

    Parameters

    alias

    service tier of the user.

    Return Value

    YES, if the value was set, NO otherwise.

  • Returns the attributes as a json string.

    Declaration

    Objective-C

    - (nonnull NSString *)asJson;

    Return Value

    Driver attributes as a json string. nil if json serialization fails.

  • Returns the driver attributes as a dictionary.

    Declaration

    Objective-C

    - (nonnull NSDictionary *)asDictionary;

    Return Value

    Driver attributes as a dictionary.