{"id":13403563,"url":"https://github.com/owncloud/owncloud-sdk","last_synced_at":"2025-03-14T08:31:58.491Z","repository":{"id":34643571,"uuid":"90605102","full_name":"owncloud/owncloud-sdk","owner":"owncloud","description":":cloud: ownCloud client library for JavaScript","archived":true,"fork":false,"pushed_at":"2024-06-05T10:14:13.000Z","size":8285,"stargazers_count":74,"open_issues_count":36,"forks_count":33,"subscribers_count":54,"default_branch":"master","last_synced_at":"2025-03-14T07:36:29.425Z","etag":null,"topics":["javascript","library","owncloud"],"latest_commit_sha":null,"homepage":"https://owncloud.dev/owncloud-sdk/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/owncloud.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-08T08:36:34.000Z","updated_at":"2024-12-14T15:34:56.000Z","dependencies_parsed_at":"2023-02-16T09:16:11.674Z","dependency_job_id":"fc5ebb3b-6909-44ee-883c-74733edc9006","html_url":"https://github.com/owncloud/owncloud-sdk","commit_stats":{"total_commits":1050,"total_committers":47,"mean_commits":"22.340425531914892","dds":0.8238095238095238,"last_synced_commit":"1f81cc833ae9128f13d2783150fba3717cefb6cd"},"previous_names":["noveens/js-owncloud-client"],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owncloud%2Fowncloud-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owncloud%2Fowncloud-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owncloud%2Fowncloud-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owncloud%2Fowncloud-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/owncloud","download_url":"https://codeload.github.com/owncloud/owncloud-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243547460,"owners_count":20308706,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["javascript","library","owncloud"],"created_at":"2024-07-30T19:01:31.655Z","updated_at":"2025-03-14T08:31:57.936Z","avatar_url":"https://github.com/owncloud.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"[![docs](https://img.shields.io/badge/api_docs-online-blue.svg)](https://owncloud.github.io/owncloud-sdk/)\n\n# ownCloud JavaScript SDK\n\n**Deprecation notice: The `owncloud-sdk` has been deprecated and discontinued in favor of the [web-client package](https://github.com/owncloud/web/tree/master/packages/web-client). This means the package won't get any updates in the future.**\n\nUse this light-weight JS library with a promise-based interface for seamless communication with your ownCloud instance, both from the browser and from Node backends.\n\n## Installation\n\nRun either \n\n```\nnpm install owncloud-sdk\n```\n\nor\n\n```\nyarn add owncloud-sdk\n```\n\nto add the `owncloud-sdk` to your project.\n\nIf you haven't done so already, you also need to add the following `peerDependencies` to your dependencies:\n\n```\nnpm install axios cross-fetch promise qs utf8 uuid webdav xml-js\n```\n\nor\n\n```\nyarn add axios cross-fetch promise qs utf8 uuid webdav xml-js\n```\n\n## Usage\n\n```js\nconst owncloud = require('owncloud-sdk');\nlet oc = new owncloud({\n      baseUrl: config.owncloudURL,\n      auth: {\n        basic: {\n          username: config.username,\n          password: config.password\n        }\n      }\n});\n\n// Login\noc.login().then(status =\u003e {\n    // STUFF\n}).catch(error =\u003e {\n    // HANDLE ERROR\n});\n\n// Share File With Link\noc.shares.shareFileWithLink('linkToYourFile').then(shareInfo =\u003e {\n    console.log(\"Link is : \" + shareInfo.getLink());\n}).catch(error =\u003e {\n    // HANDLE ERROR\n});\n\n// List all files\noc.files.list('/path/to/file/folder').then(files =\u003e {\n    console.log(files);\n}).catch(error =\u003e {\n    console.log(error);\n});\n```\n\n## Example Projects\n\n### ownCloud web\n\n[ownCloud web](https://github.com/owncloud/web) is the next generation web frontend for ownCloud.\n\n### ownCloud file-picker\n\n[ownCloud file-picker](github.com/owncloud/file-picker) is an integration to access the files in your ownCloud, e.g. in a chat app.\n\n## Documentation\n\nThe full API documentation is available [on the docs website](https://owncloud.dev/owncloud-sdk/).\n\n### Building the docs\n\nThe docs are based on JSDocs.\nTo build them, run the following command and follow the instructions on the terminal:\n\n```\nyarn build:docs\n```\n\n## Unit/Integration tests\n\n### Overview\n\n`owncloud-sdk` uses [pactjs](https://github.com/pact-foundation/pact-js) with jest for unit and integration tests.\n\nOn the pact provider side, tests have 4 different `interactions`:\n\n- interactions that work on both oc10 \u0026 ocis\n- interactions that are \"pending\" on oc10 but should work on ocis\n- interactions that are \"pending\" on ocis but should work on oc10\n- interactions that are \"pending\" on both ocis \u0026 oc10\n\nThe CI is not expected to fail for the interactions that are \"pending\" but it's expected to fail for those interactions that were already verified and started failing. Pact.io has a system to handle such a scenario called [pending pacts](https://docs.pact.io/pact_broker/advanced_topics/pending_pacts/ 'pending pacts'). This feature allows changed contracts to be verified without failing the provider's build.\n\nFour different pacts for the different buckets of interactions are created when running the provider tests. Pacts that are allowed to fail are marked as `pending` else not.\n\nIn a consumer test, a new mock provider is created using the function `createProvider`. It takes two parameters: `pendingOnOc10` and `pendingOnOcis` in order. Each parameter can have value `true` or `false` depending upon which provider-version the test is still pending.\n\nTo add a new consumer test which is expected to fail on ocis but pass on oc10 provider, provider should be created as:\n\n```js\ndescribe('feature', function () {\n  it('new test feature', function () {\n    const isPendingOnOc10 = true // set this as true if the test is allowed to fail on oc10 provider\n    const isPendingOnOcis = false // set this as true if the test is allowed to fail on ocis provider\n    const provider = createProvider(isPendingOnOc10, isPendingOnOcis)\n    // get interactions\n    // execute test\n    provider.executeTest(() =\u003e {\n      // test body\n    })\n  })\n})\n```\n### Running tests\n\nAt first, you need to create `config.json` file.\n\n```\ncp tests/config/config.sample.json tests/config/config.json\n```\n\n### Consumer tests\n\nThe pact consumer tests checks owncloud sdk against the pact mock server. In order to run these tests, use the following command:\n\n```\nyarn test-consumer\n```\n\n\u003e Note: If you have pacts from old test run in `tests/pacts` your tests will fail. Make sure to delete that before you run the tests again.\n\n\u003e Note: The pact tests need node 14. You can switch node versions locally with `nvm install 14` and then `make` to get all the correct dependencies.\n\n### Provider tests\n\nThe pact provider tests the pacts generated from the consumer tests against the real owncloud backend server. For this you will need an actual owncloud server running. Then you can run the pact tests with the following command:\n```\nPROVIDER_BASE_URL=\u003cowncloud-backend-url\u003e yarn test-provider\n```\n\n## Credits\n\nThis project was originally created by \u003ca href=\"https://github.com/noveens\"\u003eNoveen Sachdeva\u003c/a\u003e, \u003ca href=\"https://github.com/PVince81\"\u003eVincent Petry\u003c/a\u003e and \u003ca href=\"https://github.com/DeepDiver1975\"\u003eThomas Müller\u003c/a\u003e as part of the [2017 Google Summer of Code](https://summerofcode.withgoogle.com/archive/2017/projects/5166409181036544).\n\n## License\n\nThe ownCloud SDK is released under the [MIT License](https://github.com/owncloud/owncloud-sdk/blob/master/LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fowncloud%2Fowncloud-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fowncloud%2Fowncloud-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fowncloud%2Fowncloud-sdk/lists"}