ServiceItem
This is the most important class in the Rainbow SDK, as it holds all the information that is needed for an account. From that class, and that class only, we can create an instance of the Cloud Manager.
We can create an instance of that class by calling the constructor init:
RServiceItem *rServiceItem = [[RServiceItem alloc]init];
But, we shouldn’t call this method, unless we have all the variables that are needed to properly use it. Instead, we should get the entries that are stored in the connectedList variable of the corresponding Service instance.
There is no file with the suffix ServiceItem. This is because this class is in the Service files. We may change that in the future
Also, you should never create an instance of the RServiceItem class. This is a generic class, that has code that is used by the super-classes.
This class has two properties:
- name[NSString]: The name of the account. The Rainbow SDK sets the value of the rAPI.name to that value
- iD[NSString]: It is a guid and it used to distinguish them. Thus, you can create as many instances of that class with the same name
The ServiceItems for OAuth2 Login have a few more properties:
- oauthAccessToken[NSString]: The Access Token
- oauthRefreshToken[NSString]: The Refresh Token
- oauthExpirationDate[NSDate]: The Expiration Date
The above values are set by the instance of the API class, and except the Access Token, the other two variable may be an empty string.
The MediaFireServiceItem class has the properties: sessionToken, pkey, and time. The RSugarSyncServiceItem class has the properties: sugarSyncAccessTokenLocation, sugarSyncRefreshTokenLocation, and sugarSyncActivationDate. The RIDriveServiceItem class has the properties: userID, password, and baseURL
The ServiceItem class has one method to check and refresh the Access token.
[rServiceItem checkStatus];
That method calls the onStatusChecked(BOOL status) block to inform you about the status. You shouldn’t have to call that method. The Rainbow SDK is regularly calling it to validate the Access Token (whenever that is needed).
Finally, the ServiceItem class implements the NSCopying protocol. If you copy a ServiceItem instance, make sure not to call the checkStatus method on that instance.