{"id":647,"date":"2020-03-03T15:41:17","date_gmt":"2020-03-03T15:41:17","guid":{"rendered":"https:\/\/dev.i-smartcloud.com\/?page_id=647"},"modified":"2020-03-24T16:41:26","modified_gmt":"2020-03-24T16:41:26","slug":"serviceitem-ios","status":"publish","type":"page","link":"https:\/\/dev.i-smartcloud.com\/index.php\/serviceitem-ios\/","title":{"rendered":"ServiceItem"},"content":{"rendered":"\n<p>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 <a href=\"https:\/\/dev.i-smartcloud.com\/index.php\/cloud-manager-ios\/\">Cloud Manager<\/a>.<\/p>\n\n\n\n<p>We can create an instance of that class by calling the constructor init:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RServiceItem *rServiceItem = [[RServiceItem alloc]init];<\/code><\/pre>\n\n\n\n<p>But, we shouldn&#8217;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 <strong>connectedList<\/strong> variable of the corresponding <a href=\"https:\/\/dev.i-smartcloud.com\/index.php\/service-ios\/\">Service<\/a> instance. <\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>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<\/p><p>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.<\/p><\/blockquote>\n\n\n\n<p>This class has two properties:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>name<\/strong>[NSString]: The name of the account. The Rainbow SDK sets the value of the <a href=\"https:\/\/dev.i-smartcloud.com\/index.php\/api-ios\/\">rAPI<\/a>.name to that value<\/li><li><strong>iD<\/strong>[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<\/li><\/ul>\n\n\n\n<p>The ServiceItems for OAuth2 Login have a few more properties:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>oauthAccessToken<\/strong>[NSString]: The Access Token<\/li><li><strong>oauthRefreshToken<\/strong>[NSString]: The Refresh Token<\/li><li><strong>oauthExpirationDate<\/strong>[NSDate]: The Expiration Date<\/li><\/ul>\n\n\n\n<p>The above values are set by the instance of the <a href=\"https:\/\/dev.i-smartcloud.com\/index.php\/api-ios\/\">API<\/a> class, and except the Access Token, the other two variable may be an empty string.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>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<\/p><\/blockquote>\n\n\n\n<p>The ServiceItem class has one method to check and refresh the Access token. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[rServiceItem checkStatus];<\/code><\/pre>\n\n\n\n<p>That method calls the <strong>onStatusChecked<\/strong>(BOOL status) block to inform you about the status.  You shouldn&#8217;t have to call that method. The Rainbow SDK is regularly calling it to validate the Access Token (whenever that is needed).<\/p>\n\n\n\n<p>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. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"class_list":["post-647","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>ServiceItem - Rainbow SDK<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/dev.i-smartcloud.com\/index.php\/serviceitem-ios\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ServiceItem - Rainbow SDK\" \/>\n<meta property=\"og:description\" content=\"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...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dev.i-smartcloud.com\/index.php\/serviceitem-ios\/\" \/>\n<meta property=\"og:site_name\" content=\"Rainbow SDK\" \/>\n<meta property=\"article:modified_time\" content=\"2020-03-24T16:41:26+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dev.i-smartcloud.com\/index.php\/serviceitem-ios\/\",\"url\":\"https:\/\/dev.i-smartcloud.com\/index.php\/serviceitem-ios\/\",\"name\":\"ServiceItem - Rainbow SDK\",\"isPartOf\":{\"@id\":\"https:\/\/dev.i-smartcloud.com\/#website\"},\"datePublished\":\"2020-03-03T15:41:17+00:00\",\"dateModified\":\"2020-03-24T16:41:26+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/dev.i-smartcloud.com\/index.php\/serviceitem-ios\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dev.i-smartcloud.com\/index.php\/serviceitem-ios\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dev.i-smartcloud.com\/index.php\/serviceitem-ios\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/dev.i-smartcloud.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ServiceItem\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/dev.i-smartcloud.com\/#website\",\"url\":\"https:\/\/dev.i-smartcloud.com\/\",\"name\":\"Rainbow SDK\",\"description\":\"The Rainbow Cloud Manager at your disposal\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/dev.i-smartcloud.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"ServiceItem - Rainbow SDK","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/dev.i-smartcloud.com\/index.php\/serviceitem-ios\/","og_locale":"en_US","og_type":"article","og_title":"ServiceItem - Rainbow SDK","og_description":"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...","og_url":"https:\/\/dev.i-smartcloud.com\/index.php\/serviceitem-ios\/","og_site_name":"Rainbow SDK","article_modified_time":"2020-03-24T16:41:26+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/dev.i-smartcloud.com\/index.php\/serviceitem-ios\/","url":"https:\/\/dev.i-smartcloud.com\/index.php\/serviceitem-ios\/","name":"ServiceItem - Rainbow SDK","isPartOf":{"@id":"https:\/\/dev.i-smartcloud.com\/#website"},"datePublished":"2020-03-03T15:41:17+00:00","dateModified":"2020-03-24T16:41:26+00:00","breadcrumb":{"@id":"https:\/\/dev.i-smartcloud.com\/index.php\/serviceitem-ios\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dev.i-smartcloud.com\/index.php\/serviceitem-ios\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/dev.i-smartcloud.com\/index.php\/serviceitem-ios\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/dev.i-smartcloud.com\/"},{"@type":"ListItem","position":2,"name":"ServiceItem"}]},{"@type":"WebSite","@id":"https:\/\/dev.i-smartcloud.com\/#website","url":"https:\/\/dev.i-smartcloud.com\/","name":"Rainbow SDK","description":"The Rainbow Cloud Manager at your disposal","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/dev.i-smartcloud.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/pages\/647","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/comments?post=647"}],"version-history":[{"count":25,"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/pages\/647\/revisions"}],"predecessor-version":[{"id":882,"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/pages\/647\/revisions\/882"}],"wp:attachment":[{"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/media?parent=647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}