{"id":39734721,"url":"https://github.com/convertigo/react-native-c8osdk","last_synced_at":"2026-01-18T11:04:20.650Z","repository":{"id":57335891,"uuid":"137074315","full_name":"convertigo/react-native-c8osdk","owner":"convertigo","description":"This is the react-native SDK for Convertigo. Developers can use this SDK from react-native apps to access all back end service provided by Convertigo mBaaS such as orchestrations, connectors data synchronization push notifications and remote logging","archived":false,"fork":false,"pushed_at":"2018-11-07T22:00:56.000Z","size":409,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-09-06T16:13:28.934Z","etag":null,"topics":["android","convertigo-server","ios","offline-app","react-native"],"latest_commit_sha":null,"homepage":"https://www.convertigo.com/document/latest/reference-manual/convertigo-mbaas-server/convertigo-client-sdk/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/convertigo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-12T13:17:07.000Z","updated_at":"2024-02-16T11:01:38.000Z","dependencies_parsed_at":"2022-09-15T15:10:16.454Z","dependency_job_id":null,"html_url":"https://github.com/convertigo/react-native-c8osdk","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/convertigo/react-native-c8osdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/convertigo%2Freact-native-c8osdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/convertigo%2Freact-native-c8osdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/convertigo%2Freact-native-c8osdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/convertigo%2Freact-native-c8osdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/convertigo","download_url":"https://codeload.github.com/convertigo/react-native-c8osdk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/convertigo%2Freact-native-c8osdk/sbom","scorecard":{"id":303765,"data":{"date":"2025-08-11","repo":{"name":"github.com/convertigo/react-native-c8osdk","commit":"dadbd769d598a4330b07caa50af0d07ab1bc0c31"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.6,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":9,"reason":"binaries present in source code","details":["Warn: binary detected: android/gradle/wrapper/gradle-wrapper.jar:1"],"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENCE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENCE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"46 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-ff7x-qrg7-qggm","Warn: Project is vulnerable to: GHSA-qrmc-fj45-qfc2","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-q42p-pg8m-cqh6","Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9","Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f","Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p","Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv","Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8","Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65","Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-vfrc-7r7c-w9mx","Warn: Project is vulnerable to: GHSA-7wwv-vh3v-89cq","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-xf5p-87ch-gxw2","Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj","Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T21:27:27.079Z","repository_id":57335891,"created_at":"2025-08-17T21:27:27.079Z","updated_at":"2025-08-17T21:27:27.079Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28535156,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T10:13:46.436Z","status":"ssl_error","status_checked_at":"2026-01-18T10:13:11.045Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","convertigo-server","ios","offline-app","react-native"],"created_at":"2026-01-18T11:04:20.387Z","updated_at":"2026-01-18T11:04:20.634Z","avatar_url":"https://github.com/convertigo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://www.convertigo.com/wp-content/themes/EightDegree/images/logo_convertigo.png\"\u003e\n  \u003ch2 align=\"center\"\u003e React Native C8oSDK\u003c/h2\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-Apache%202.0-blue.svg\" alt=\"License\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/react-native-c8osdk\"\u003e\u003cimg src=\"https://badge.fury.io/js/react-native-c8osdk.svg?style=flat-square\" alt=\"NPM version\"\u003e\u003c/a\u003e\n\u003c/p\u003e \n\n\n## TOC ##\n\n- [TOC](#toc)\n- [Introduction](#introduction)\n  - [About SDKs](#about-sdks)\n  - [About Convertigo Platform](#about-convertigo-platform)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Linking](#linking)\n- [Documentation](#documentation)\n  - [Import libraries](#import-libraries)\n  - [Initializing and creating a C8o instance for an Endpoint](#initializing-and-creating-a-c8o-instance-for-an-endpoint)\n  - [Advanced instance settings](#advanced-instance-settings)\n  - [Calling a Convertigo requestable](#calling-a-convertigo-requestable)\n  - [Call parameters](#call-parameters)\n  - [Chaining calls](#chaining-calls)\n  - [Handling failures](#handling-failures)\n  - [Writing the device logs to the Convertigo server](#writing-the-device-logs-to-the-convertigo-server)\n    - [Basic](#basic)\n    - [Advanced](#advanced)\n  - [Using the Local Cache](#using-the-local-cache)\n  - [Using the Full Sync](#using-the-full-sync)\n  - [Replicating Full Sync databases](#replicating-full-sync-databases)\n  - [Replicating Full Sync databases with continuous flag](#replicating-full-sync-databases-with-continuous-flag)\n  - [Full Sync FS_LIVE requests](#full-sync-fs_live-requests)\n  - [Full Sync Change Listener](#full-sync-change-listener)\n  - [React specific constraints](#react-specific-constraints)\n    - [Basic usage](#basic-usage)\n    - [Advanced usage](#advanced-usage)\n- [Building react-native-c8osdk](#building-react-native-c8osdk)\n- [Api documentation](#api-documentation)\n\n## Introduction ##\n\n### About SDKs ###\n\nThis is the Convertigo provider for React Native\n\nConvertigo Client SDK is a set of libraries used by mobile or Windows desktop applications to access Convertigo Server services. An application using the SDK can easily access Convertigo services such as Sequences and Transactions.\n\nThe Client SDK will abstract the programmer from handling the communication protocols, local cache, FullSync off line data management, UI thread management and remote logging. So the developer can focus on building the application.\n\nClient SDK is available for:\n* [Android Native](https://github.com/convertigo/c8osdk-android) apps as a standard Gradle dependency\n* [iOS native](https://github.com/convertigo/c8osdk-ios) apps as a standard Cocoapod\n* [React Native](https://github.com/convertigo/react-native-c8osdk) as a NPM package\n* [Google Angular framework](https://github.com/convertigo/c8osdk-angular) as typescript an NPM package\n* [Vue.js](https://github.com/convertigo/c8osdk-vuejs), [ReactJS](https://github.com/convertigo/c8osdk-vuejs), [AngularJS](https://github.com/convertigo/c8osdk-vuejs) Framework as a standard Javascript NPM package\n* [Windows desktop](https://github.com/convertigo/c8osdk-dotnet) or [Xamarin apps](https://github.com/convertigo/c8osdk-dotnet) as Nugets or Xamarin Components\n\nThis current package is the React Native SDK. For others SDKs see official [Convertigo Documentation.](https://www.convertigo.com/document/all/cmp-7/7-5-1/reference-manual/convertigo-mbaas-server/convertigo-client-sdk/programming-guide/)\n\n### About Convertigo Platform ###\n\nConvertigo Mobility Platform supports React Native developers. Services brought by the platform are available for React Native clients applications thanks to the Convertigo MBaaS SDK. SDK provides an React Native framework you can use to access Convertigo Server’s services such as:\n\n- Connectors to back-end data (SQL, NoSQL, REST/SOAP, SAP, - WEB HTML, AS/400, Mainframes)\n- Server Side Business Logic (Protocol transform, Business logic augmentation, ...)\n- Automatic offline replicated databases with FullSync technology\n- Security and access control (Identity managers, LDAP , SAML, oAuth)\n- Server side Cache\n- Push notifications (APND, GCM)\n- Auditing Analytics and logs (SQL, and Google Analytics)\n\n[Convertigo Technology Overview](http://download.convertigo.com/webrepository/Marketing/ConvertigoTechnologyOverview.pdf)\n\n[Access Convertigo mBaaS technical documentation](http://www.convertigo.com/document/latest/)\n\n[Access Convertigo SDK Documentations](https://www.convertigo.com/document/all/cmp-7/7-5-1/reference-manual/convertigo-mbaas-server/convertigo-client-sdk/)\n\n## Requirements ##\n\n* npm 6.1.x | yarn 1.7.x\n* react-native cli 2.0.x\n* iOS\n  * Xcode 9.4\n  * Cocoapods 1.5.3\n* Android\n  * Android Studio 3.1.x\n\n## Installation ##\n\nUsing npm:\n\n```shell\nnpm install --save react-native-c8osdk\n```\n\nor using yarn:\n\n```shell\nyarn add react-native-c8osdk\n```\n\n\n## Linking ##\n\n\n```shell\nreact-native link react-native-c8osdk\n```\n\nThen for each platform:\n\n\u003cdetails\u003e\n    \u003csummary\u003eiOS (via Cocoa Pods)\u003c/summary\u003e\n\nAdd the following dependencies to your the target of your `Podfile`\n\n`use_frameworks!`\n\n`pod 'SwiftyJSON', '4.0.0'`\n\n`pod 'Alamofire', '4.7.2'`\n\n`pod 'AEXML', '4.3.0'`\n\n\nAlso append the following posinstall script to your `Podfile`\n```shell\npost_install do |installer|\n  # List of Pods to use as Swift 4.1\n  myTargets = ['SwiftyJSON', 'Alamofire', 'AEXML']\n\n  installer.pods_project.targets.each do |target|\n    if myTargets.include? target.name\n      target.build_configurations.each do |config|\n        config.build_settings['SWIFT_VERSION'] = '4.1'\n      end\n    end\n  end\nend\n```\nThis will configure your pods in the correct swift version.\n\nThen run `Pod install`\n\nPlease be sure to use the workspace and not the project, so be sure to open Project.xcworkspace\n\nFinnaly go to main's Project target =\u003e Build Phases =\u003e Link Binary with Libraries and add C8o.framework\n\u003c/details\u003e\n\n\u003cdetails\u003e\n    \u003csummary\u003eAndroid\u003c/summary\u003e\n\nThere is nothing more than the react-native cli link, mentioned above, to do for android\n\u003c/details\u003e\n\n## Documentation ##\n\n### Import libraries ###\n```javascript\nimport {C8oSettings, C8o, C8oLogLevel} from \"react-native-c8osdk\";\n```\n\n### Initializing and creating a C8o instance for an Endpoint ###\nC8o Object must first be instanciated and then can be initialized, with a endpoint string parameter\n```javascript\n// Instanciate C8o\nlet c8o: C8o = new C8o();\n\n// Init C8o instance with a given endpoint, for example:\nc8o.init(\"http://c8o-dev.convertigo.net:80/cems/projects/ClientSDKtestig\");\n```\n\n### Advanced instance settings ###\nThe endpoint is the mandatory setting to get a C8o instance, but there is additional settings through the C8oSettings class.\n\nA C8oSettings instance should be passed after the endpoint. Settings are copied inside the C8o instance.\n\nSetters of C8oSettings always return its own instance and can be chained.\n\nA C8oSettings can be instantiated from an existing C8oSettings or C8o instance.\n```javascript\n// Instanciate C8oSettings\nlet settings = new C8oSettings();\n\n// Add Settings properties\nsettings\n.setTimeout(3000)\n.setDefaultDatabaseName(\"myfullsyncDbName\")\n.setTrustAllCertificates(true)\n.setLogLevelLocal(C8oLogLevel.TRACE);\n\n// Instanciate C8o\nlet c8o: C8o = new C8o();\n\n// Init C8o instance with a given endpoint and settings\nc8o.init(\"http://c8o-dev.convertigo.net:80/cems/projects/ClientSDKtestig\", settings);\n```\n\n### Calling a Convertigo requestable ###\nWith a C8o instance you can call Convertigo Sequence and Transaction or make query to your local FullSync database.\n\nThe call method expects the requester string of the following syntax:\n* For a transaction: [project].connector.transaction\n* For a sequence: [project].sequence\n\nThe project name is optional, i.e. if not specified, the project specified in the endpoint will be used.\n```javascript\n// Assuming c8o is a C8o instance properly instanciated and initiated as describe above, and '.login' is the name of a sequence of your project\n\n// Here using Javascript's Promises with awaiter syntax \nlet result = await this.c8o.callJson('.login')\n                       .async();\n\n// Here using Javascript's Promises with then/catch syntax\nthis.c8o.callJson(\".login\")\n    .async()\n    .then((response)=\u003e{\n      //handle result\n    });\n\n// Using C8oPromise that allow for example progress and Live. C8oPromise is described in Api doc in section Api documentation of this README\nthis.c8o.callJson(\".login\")\n    .then((response)=\u003e{\n      //handle result\n    });\n```\n\n### Call parameters ###\nConvertigo requestables generally needs key/value parameters encapsuled in a simple javascript object. \n\nThe key is always a string and the value can be any object but a string is the standard case.\n```javascript\n// Assuming c8o is a C8o instance properly instanciated and initiated as describe above, and '.login' is the name of a sequence of your project\n\n// Here using Javascript's Promises with awaiter syntax\nlet result = await this.c8o.callJson('.login', {\n                          login: \"barnett.christine\",\n                          password: \"mySuperPassword123\"\n                        })\n                        .async();\n\n// Here using Javascript's Promises with then/catch syntax\nthis.c8o.callJson('.login', {\n    login: \"barnett.christine\",\n    password: \"mySuperPassword123\"\n  })\n  .async()\n  .then((response)=\u003e{\n    // handle result\n  });\n\n// Using C8oPromise that allow for example progress and Live. C8oPromise is described in Api doc in section Api documentation of this README.\nthis.c8o.callJson(\".login\",{\n      login: \"barnett.christine\",\n      password: \"mySuperPassword123\"\n    })\n    .then((response)=\u003e{\n      //handle result\n    });\n```\n### Chaining calls ###\n\nThe .then() returns a C8oPromise that can be use to chain other promise methods, such as .then() or failure handlers. The last .then() must return a null value. .then() can be mixed but the returning type must be the same: Xml or Json.\n\n```javascript\nc8o.callJson(\".getSimpleData\", \"callNumber\", 1)\n.then((response) =\u003e {\n\t// you can do stuff here and return the next C8oPromise instead of deep nested blocks\n\treturn c8o.callJson(\".getSimpleData\", \"callNumber\", 2);\n})\n.then((response)=\u003e{\n  // you can do stuff here and even modify previous parameters\n  parameters[\"callNumber\"] = 3;\n  parameters[\"extraParameter\"] = \"ok\";\n  return c8o.callJsonObject(\".getSimpleData\", parameters);\n})\n.then((response)=\u003e{\n  // you can do stuff here and return null because this is the end of the chain\n  return null;\n})\n```\n\n### Handling failures ###\nA call can throw an error for many reasons: technical failure, network error and so on.\n\nThe standard try/catch should be used to handle this.\n\n```javascript\n// Assuming c8o is a C8o instance properly instantiated and initiated as describe above, and '.login' is the name of a sequence of your project\n\n// Here using Javascript's Promises with awaiter\ntry{\n  let result = await this.c8o.callJson('.login', {\n                login: \"barnett.christine\",\n                password: \"mySuperPassword123\"\n            }).async();\n}\ncatch(error){\n  // Do something with the error\n}\n\n// Here using Javascript's Promises\nthis.c8o.callJson('.login', {\n                login: \"barnett.christine\",\n                password: \"mySuperPassword123\"\n            }).\n            .async()\n            .then((response)=\u003e{\n              //handle result\n            })\n            .catch((error)=\u003e{\n              // Do something with the error\n            })\n\n// Using C8oPromise that allow for example progress and Live. C8oPromise is described in Api doc in section Api documentation of this README.\nthis.c8o.callJson('.login', {\n                login: \"barnett.christine\",\n                password: \"mySuperPassword123\"\n            }).\n            .then((response)=\u003e{\n              //handle result\n            })\n            .fail((error)=\u003e{\n              // Do something with the error\n            })\n```\n\n### Writing the device logs to the Convertigo server ###\n\n#### Basic ####\n\nAn application developer usually adds log information in his code. This is useful for the code execution tracking, statistics or debugging.\n\nThe Convertigo Client SDK offers an API to easily log on the standard device logger, generally in a dedicated console. To see this console, a device must be physically connected on a computer.\n\nFortunately, the same API also send log to the Convertigo server and they are merged with the server log. You can easily debug your device and server code on the same screen, on the same timeline. Logs from a device contain metadata, such as the device UUID and can help to filter logs on the server.\n\nA log level must be specified:\n\n* Fatal: used for critical error message\n* Error: used for common error message\n* Warn: used for not expected case\n* Info: used for high level messages\n* Debug: used for help the developer to understand the execution\n* Trace: used for help the developer to trace the code\n* To write a log string, use the C8oLogger instance of a C8o instance:\n\n```javascript\n// Assuming c8o is a C8o instance properly instanciated and initiated as describe above\n\nc8o.log.fatal(\"hello logs ! (level fatal)\");\nc8o.log.error(\"hello logs ! (level error)\");\nc8o.log.warn(\"hello logs ! (level warn)\");\nc8o.log.info(\"hello logs ! (level info)\");\nc8o.log.debug(\"hello logs ! (level debug)\");\nc8o.log.trace(\"hello logs ! (level trace)\");\n```\n\n#### Advanced ####\n\nA C8oLogger have 2 log levels, one for local logging and the other for the remote logging. With the Android SDK, the local logging is set by the logcat options. With the .Net SDK, the local logging depends of the LogLevelLocal setting of C8oSettings.\n\nThe remote logging level is enslaved by Convertigo server Log levels property: devices output logger. In case of failure, the remote logging is disabled and cannot be re-enabled for the current C8o instance. It can also be disabled using the LogRemote setting of C8oSettings, enabled with true (default) and disabled with false.\n\n```javascript\nC8oSettings()\n    .setLogC8o(false)   // disable log from the Convertigo Client SDK itself\n    .setLogRemote(false) // disable remote logging\n    .setLogLevelLocal(C8oLogLevel.TRACE);\n```\n\n### Using the Local Cache\nSometimes we would like to use local cache on C8o calls and responses, in order to:\n\n* save network traffic between the device and the server,\n* be able to display data when the device is not connected to the network.\n\nThe Local Cache feature allows to store locally on the device the responses to a C8o call, using the variables and their values as cache key.\n\nTo use the Local Cache, add to a call a pair parameter of \"__localCache\" and a C8oLocalCache instance. The constructor of C8oLocalCache needs some parameters:\n\n* C8oLocalCache.Priority (SERVER / LOCAL): defines whether the response should be retrieved from local cache or from Convertigo server when the device can access the network. When the device has no network access, the local cache response is used.\n* ttl: defines the time to live of the cached response, in milliseconds. If no value is passed, the time to live is infinite.\n* enabled: allows to enable or disable the local cache on a Convertigo requestable, default value is true.\n\n```javascript\n// Assuming c8o is a C8o instance properly instanciated and initiated as describe above.\n\n// Return the response if is already know and less than 180 seconds else call the server\nthis.c8o.callJson(\".getSimpleData\",\n            {\n              \"__localCache\": new C8oLocalCache(Priority.LOCAL, 180 * 1000)\n            })\n            .then((response)=\u003e{\n              // Do stuff \n            });\n\n// same sample but with parameters, also acting as cache keys\nthis.c8o.callJson(\".getSimpleData\",\n            {\n              \"firstname\": \"John\",\n\t\t          \"lastname\": \"Doe\",\n              \"__localCache\": new C8oLocalCache(Priority.LOCAL, 180 * 1000)\n            })\n            .then((response)=\u003e{\n              // Do stuff \n            });\n// make a standard network call with the server\n// but in case of offline move or network failure\n// return the response if is already know and less than 1 hour\nthis.c8o.callJson(\".getSimpleData\",\n            {\n              \"__localCache\": new C8oLocalCache(Priority.SERVER, 3600 * 1000)\n            })\n            .then((response)=\u003e{\n              // Do stuff \n            });\n```\n\n\n### Using the Full Sync ###\nFull Sync enables mobile apps to handle fully disconnected scenarios, still having data handled and controlled by back end business logic. See the presentation of the Full Sync architecture for more details.\n\nConvertigo Client SDK provides a high level access to local data following the standard Convertigo Sequence paradigm. They differ from standard sequences by a fs:// prefix. Calling these local Full Sync requestable will enable the app to read, write, query and delete data from the local database:\n\n* fs://\u003cdatabase\u003e.create creates the local database if not already exist\n* fs://\u003cdatabase\u003e.view queries a view from the local database\n* fs://\u003cdatabase\u003e.get reads an object from the local database\n* fs://\u003cdatabase\u003e.post writes/update an object to the local database\n* fs://\u003cdatabase\u003e.delete deletes an object from the local database\n* fs://\u003cdatabase\u003e.all gets all objects from the local database\n* fs://\u003cdatabase\u003e.sync synchronizes with server database\n* fs://\u003cdatabase\u003e.replicate_push pushes local modifications on the database server\n* fs://\u003cdatabase\u003e.replicate_pull gets all database server modifications\n* fs://\u003cdatabase\u003e.reset resets a database by removing all the data in it\n* fs://\u003cdatabase\u003e.put_attachment Puts (add) an attachment to a document in the database\n* fs://\u003cdatabase\u003e.get_attachment Gets an attachment from a document\n\nWhere fs://\u003cdatabase\u003e is the name of a specific FullSync Connector in the project specified in the endpoint. The fs://\u003cdatabase\u003e name is optional only if the default database name is specified with the method setDefaultDatabaseName on the C8oSetting.\n\nAn application can have many databases. On mobile (Android, iOS and Xamarin based) they are stored in the secure storage of the application. On Windows desktop application, they are stored in the user AppData/Local folder, without application isolation.\n\nAll platforms can specify a local database prefix that allows many local database copies of the same remote database. Use the method setFullSyncLocalSuffix on the C8oSetting.\n\n```javascript\n// Assuming c8o is a C8o instance properly instanciated and initiated as describe above.\n\n// clear or create the \"base\" database\n// resultReset mustbe equal to { \"ok\" : true }\nlet resultReset = await this.c8o.callJson('fs://base.reset');\n\n// creates a new document on \"base\", with 2 key/value pairs\n// resultPost mustbe equal to { \"ok\": true, \"id\": \"6f1b52df\",\"rev\":  \"1-b0620371\" }\nlet resultPost = await this.c8o.callJson('fs://base.post', {\n              firstname: \"Jhonn\",\n              lastname: \"Doe\"\n          });\n\n// retrieves the complet document from its \"docid\"\n// resultGet mustbe equal to { \"lastname\": \"Doe\", \"rev\": \"1-b0620371\", \"firstname\": \"John\", \"_id\": \"6f1b52df\" }\nlet resultGet = await this.c8o.callJson('fs://base.get', {\n              docid: resultPost['id']\n          });\n\n// Add an attachment to this new document, here content is a base64 string\nlet put_attachment = await this.c8o.callJson('fs://base.put_attachment', {\n              docid: resultPost['id'],\n              name: \"myText.txt\",\n              content_type: \"text/plain\",\n              content: \"U2FsdXQgIQo=\"\n          });\n```\n\n\n### Replicating Full Sync databases\nFullSync has the ability to replicate mobile and Convertigo server databases over unreliable connections still preserving integrity. Data can be replicated in upload or download or both directions. The replication can also be continuous: a new document is instantaneously replicated to the other side.\n\nThe client SDK offers the progress event to monitor the replication progression thanks to a C8oProgress instance.\n\nA device cannot pull private documents or push any document without authentication. A session must be established before and the Convertigo server must authenticate the session (using the Set authenticated user step for example).\n\n```javascript\n// Assuming c8o is a C8o instance properly instanciated and initiated as describe above.\n\nthis.c8o.callJson('.login')\n.then((response)=\u003e{\n    if(response == \"ok\"){\n      // The progress can be handled only with C8oPromise,\n      // replication_pull can also be sync or replication_push\n      this.c8o.callJson('fs://base.replication_pull')\n        .then((response)=\u003e{\n          // Do stuff with response\n        })\n        .progress((progress)=\u003e{\n          // Do stuff with progress\n        });\n    }\n});\n\n```\n\n### Replicating Full Sync databases with continuous flag ###\nAs mentioned above, a replication can also be continuous: a new document is instantaneously replicated to the other side.\n\nProgress will be called at each entering replication during the all life of the application until that you explicitely cancel that one\n\n```javascript\n// Assuming c8o is a C8o instance properly instanciated and initiated as describe above.\n\n// The progress can be handled only with C8oPromise\nthis.c8o.callJson('fs://base.replication_pull', {\"continuous\": true})\n    .then((response)=\u003e{\n      // Do stuff with response\n    })\n    .progress((progress)=\u003e{\n      // Do stuff with progress\n    })\n\n// this will cancel the previous replication\nthis.c8o.callJson('fs://base.replication_pull', {\"cancel\": true})\n    .then((response)=\u003e{\n      // Do stuff with response\n    })\n```\n\n### Full Sync FS_LIVE requests\n\n Full Sync has the ability to re-execute your fs:// calls if the database is modified. The then or thenUI following a FS_LIVE parameter is re-executed after each database update. Database update can be local modification or remote modification replicated.\n\nThis allow you keep your UI synchronized with database documents.\n\nA FS_LIVE parameter must have a string value, its liveid. The liveid allow to cancel a FS_LIVE request.\n\n```javascript\n// Assuming c8o is a C8o instance properly instanciated and initiated as describe above.\n\n// The then of the live requests can be handled only with C8oPromise\nthis.c8o.callJson(\"fs://base.view\",{\n    \"ddoc\": \"design\",\n    \"view\": \"customers\",\n    C8o[\"FS_LIVE\"]: \"customers\"\n    })\n    .then((response)=\u003e{\n      // will be call now and after each database update\n    })\n\n    // cancel the previous FS_LIVE request, can be on application page change for example\n    this.c8o.cancelLive(\"customers\")\n    .then(()=\u003e{\n      // do stuff\n    }\n    .catch((err)=\u003e{\n      // catch errors\n    });\n```\n### Full Sync Change Listener ###\nFull Sync has also the ability to notify your if there is any change on the database. The progress following a FS_LIVE parameter is triggered  after each database update. The changes contains the origin of the change, and other attributes :\n* isExternal\n* isCurrentRevision\n* isConflict\n* id\n* revisionId\n \n```javascript\n this.c8o.addFullSyncChangeListener(\"databaseName\", \"anyID\")\n         .progress((change)=\u003e{\n           // triggered at each change on the given databaseName\n           this.c8o.log.debug(\"progress addFullSyncChangeListener\");\n         })\n         .then((resp)=\u003e{\n            //resp returns \"ok\" if the change listener has been correctly added\n         })\n         .fail((err)=\u003e{\n           // Throw any error\n         })\n\n```\n \n### React specific constraints\nTo Manage Progress, in react-native we are constraits to pass by Native Event Emitters. In iOS, we use [RCTEventEmitter](https://facebook.github.io/react-native/docs/native-modules-ios.html#sending-events-to-javascript), and in Android [RCTDeviceEventEmitter](https://facebook.github.io/react-native/docs/native-modules-android#sending-events-to-javascript).\n\nAs we can declare dynamically events name in Android, each event are forwared directly to the adapted progress handler, whereas in iOS as we can't dynamically nammed an event, we are obliged to forward every event to a unique one: \"iOS\" and then dispatch from je javascript layers to the adapted progres handler.\n\nWe have to manage event emitter and remove them when we can.\n\n#### Basic usage ####\nBasically you can let c8o do the job by simple applying the rule bellow\n\nWe stronglly recomeded to call removeAllSubscriptions method of class c8o on componentWillUnmount page life cycle to properly remove all listeners.\n\n```javascript\n// Assuming c8o is a C8o instance properly instanciated and initiated as describe above.\ncomponentWillUnmount() {\n  this.c8o.removeAllSubscriptions()\n}\n```\n\n#### Advanced usage\nHowever if you need to manage by yourself event emitter life cycle\n\n* Simple calls eventEmitter's are automatically removed at the end of the progress process\n\n* Live calls eventEmitter's are removed when calling cancelLive method\n\n* Continuous calls eventEmitter's can be removed, as shown below\n```javascript\n// Assuming c8o is a C8o instance properly instanciated and initiated as describe above.\nlet idCall1 = null;\nthis.c8o.callJson(\"fs://base.sync\",{\n      \"ddoc\": \"design\",\n      \"view\": \"customers\",\n      \"continuous\": true\n    })\n    .progress((progress)=\u003e{\n      // do stuff with progress continuous\n    })\n    .then((response, id)=\u003e{\n      // initial response and id\n      idCall1 = id;\n    });\n    \n    // This will remove subscription\n    this.c8o.removeSpecificSubscriptions(idCall1);\n```\n\n\n## Building react-native-c8osdk ##\n\n(Not finished yet)\nPlease see the [wiki page](https://github.com/convertigo/react-native-c8osdk/wiki)\n\n## Api documentation\n* [\"c8o\"](apidoc/modules/_c8o_.md)\n* [\"c8oBase\"](apidoc/modules/_c8obase_.md)\n* [\"c8oLogLevel\"](apidoc/modules/_c8ologlevel_.md)\n* [\"c8oLogger\"](apidoc/modules/_c8ologger_.md)\n* [\"c8oPromise\"](apidoc/modules/_c8opromise_.md)\n* [\"c8oSettings\"](apidoc/modules/_c8osettings_.md)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconvertigo%2Freact-native-c8osdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconvertigo%2Freact-native-c8osdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconvertigo%2Freact-native-c8osdk/lists"}