Retrieve User Schema¶
Description¶
This operation retrieves a list of the properties associated with the user schema.
Method¶
- (void)describeUserClassWithResponseHandler:^(NSArray<UserProperty *> * _Nonnull)responseHandler errorHandler:^(Fault * _Nonnull)errorHandler;
func describeUserClass(responseHandler: (([UserProperty]) -> Void)!, errorHandler: ((Fault) -> Void)!)
where:
Argument | Description |
---|---|
responseHandler |
Handles successful result of an asynchronous call. |
errorHandler |
Handles fault result of an asynchronous call. |
Return Value¶
An array of UserProperty
objects containing detailed specification of user properties (the columns in the Users table). Each object has the following properties:
[
{
"name":"emailaddress",
"required":true|false,
"type":"STRING"|"STRING_ID"|"DATETIME"|"RELATION"|"INT"|"DOUBLE",
"relatedTable":tableName,
"identity":true|false
"customRegex":"STRING" | null
"autoLoad":true|false
"isPrimaryKey":true|false
},
{
"name":"password",
"required":true|false,
"type":"STRING"|"STRING_ID"|"DATETIME"|"RELATION"|"INT"|"DOUBLE",
"relatedTable":tableName,
"identity":true|false
"customRegex":"STRING" | null
"autoLoad":true|false
"isPrimaryKey":true|false
}
]
where
Argument | Description |
---|---|
name |
Name of the property/column in the Users table. |
required |
Indicates whether the property is required for user registration. |
type |
Property data type. |
defaultValue |
Default value of the property. The value is used if it is not provided during the registration API call. |
identity |
Indicates whether the property is marked as user identity. |
relatedTable |
If type is "RELATION", contains the name of the related table. |
customRegex |
A regular expression assigned to the column as a validator. The validator applies when a new object is saved in the table or an existing one is updated. |
autoLoad |
Applies only to relations. If true, the property is set to auto-load related data for the data retrieval queries. |
isPrimaryKey |
true if the column is or is a part of a primary key. |
Example¶
The example below retrieves a list of the properties associated with the user schema.
[Backendless.shared.userService describeUserClassWithResponseHandler:^(NSArray<UserProperty *> *userProperties) {
for (UserProperty *userProperty in userProperties) {
NSLog(@"Property name - %@", userProperty.name);
NSLog(@"required - %i", userProperty.required);
NSLog(@"identity - %i", userProperty.identity);
NSLog(@"data type - %@", [userProperty getTypeName]);
}
} errorHandler:^(Fault *fault) {
NSLog(@"Error: %@", fault.message);
}];
Backendless.shared.userService.describeUserClass(responseHandler: { userProperties in
for userProperty in userProperties {
print("Property name - \(userProperty.name)")
print("required - \(userProperty.required)")
print("identity - \(userProperty.identity)")
print("data type - \(userProperty.getTypeName())")
}
}, errorHandler: { fault in
print("Error: \(fault.message ?? "")")
})