This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

feat(app): Adding the sn-client-js library

  • Loading branch information...
Anikó Litványi
Anikó Litványi committed Nov 29, 2016
0 parents commit 98a74a2349dbb86f1f16eade5e070eb23bb0362b
Showing with 7,017 additions and 0 deletions.
  1. +3 −0 .gitignore
  2. +21 −0 .travis.yml
  3. +4 −0 CONTRIBUTING.md
  4. +339 −0 LICENSE.txt
  5. +89 −0 README.md
  6. +141 −0 dist/src/Collection.js
  7. +1 −0 dist/src/Collection.js.map
  8. +20 −0 dist/src/Common.js
  9. +1 −0 dist/src/Common.js.map
  10. +348 −0 dist/src/Content.js
  11. +1 −0 dist/src/Content.js.map
  12. +68 −0 dist/src/ContentTypes.js
  13. +1 −0 dist/src/ContentTypes.js.map
  14. +172 −0 dist/src/FieldSettings.js
  15. +1 −0 dist/src/FieldSettings.js.map
  16. +21 −0 dist/src/Fields.js
  17. +1 −0 dist/src/Fields.js.map
  18. +72 −0 dist/src/ODataAPIActionObservables.js
  19. +1 −0 dist/src/ODataAPIActionObservables.js.map
  20. +160 −0 dist/src/ODataApi.js
  21. +1 −0 dist/src/ODataApi.js.map
  22. +80 −0 dist/src/ODataHelper.js
  23. +1 −0 dist/src/ODataHelper.js.map
  24. +15 −0 dist/src/Resources.js
  25. +1 −0 dist/src/Resources.js.map
  26. +42 −0 dist/src/SN.js
  27. +1 −0 dist/src/SN.js.map
  28. +251 −0 dist/src/Schema.js
  29. +1 −0 dist/src/Schema.js.map
  30. +37 −0 dist/src/Security.js
  31. +1 −0 dist/src/Security.js.map
  32. +100 −0 dist/test/CollectionTests.js
  33. +1 −0 dist/test/CollectionTests.js.map
  34. +361 −0 dist/test/ContentTests.js
  35. +1 −0 dist/test/ContentTests.js.map
  36. +32 −0 dist/test/ContentTypeTests.js
  37. +1 −0 dist/test/ContentTypeTests.js.map
  38. +91 −0 dist/test/FieldSettingsTest.js
  39. +1 −0 dist/test/FieldSettingsTest.js.map
  40. +14 −0 dist/test/FieldsTests.js
  41. +1 −0 dist/test/FieldsTests.js.map
  42. +60 −0 dist/test/ODataApiTests.js
  43. +1 −0 dist/test/ODataApiTests.js.map
  44. +82 −0 dist/test/ODataHelperTests.js
  45. +1 −0 dist/test/ODataHelperTests.js.map
  46. +43 −0 dist/test/SchemaTests.js
  47. +1 −0 dist/test/SchemaTests.js.map
  48. +97 −0 gulpfile.js
  49. +66 −0 package.json
  50. +362 −0 src/Collection.ts
  51. +82 −0 src/Common.ts
  52. +1,417 −0 src/Content.ts
  53. +172 −0 src/ContentTypes.ts
  54. +308 −0 src/FieldSettings.ts
  55. +37 −0 src/Fields.ts
  56. +148 −0 src/ODataAPIActionObservables.ts
  57. +281 −0 src/ODataApi.ts
  58. +111 −0 src/ODataHelper.ts
  59. +16 −0 src/Resources.ts
  60. +25 −0 src/SN.ts
  61. +324 −0 src/Schema.ts
  62. +63 −0 src/Security.ts
  63. +100 −0 test/CollectionTests.ts
  64. +360 −0 test/ContentTests.ts
  65. +32 −0 test/ContentTypeTests.ts
  66. +91 −0 test/FieldSettingsTest.ts
  67. +14 −0 test/FieldsTests.ts
  68. +60 −0 test/ODataApiTests.ts
  69. +81 −0 test/ODataHelperTests.ts
  70. +50 −0 test/SchemaTests.ts
  71. +23 −0 tsconfig.json
  72. +10 −0 tslint.json
@@ -0,0 +1,3 @@
node_modules
coverage
documentation
@@ -0,0 +1,21 @@
language: node_js
cache:
directories:
- node_modules
notifications:
email: false
node_js:
- '7'
- '6'
- '4'
before_script:
- npm prune
before_script:
- npm install -g gulp
script: gulp
after_success:
- npm run report-coverage
- npm run semantic-release
branches:
except:
- /^v\d+\.\d+\.\d+$/
@@ -0,0 +1,4 @@
# How to contribute
Thank you for checking out our project! :star2: :sunny: :deciduous_tree: :earth_americas:

Please visit the [contribution guide](https://github.com/SenseNet/sensenet/blob/master/CONTRIBUTING.md) in our main repository for advices on how to help the community.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,89 @@
# sn-client-js

[![gitter](https://img.shields.io/gitter/room/SenseNet/SN7ClientAPI.svg)](https://gitter.im/SenseNet/SN7ClientAPI)
[![travis](https://img.shields.io/travis/SenseNet/sn-client-js.svg)](https://travis-ci.org/SenseNet/sn-client-js)
[![coverage](https://img.shields.io/codecov/c/github/SenseNet/sn-client-js.svg)](https://codecov.io/gh/SenseNet/sn-client-js)
[![npm](https://img.shields.io/npm/v/sn-client-js.svg)](https://www.npmjs.com/package/sn-client-js)
[![downloads](https://img.shields.io/github/downloads/SenseNet/sn-client-js/total.svg)](https://github.com/SenseNet/sn-client-js)
[![license](https://img.shields.io/github/license/SenseNet/sn-client-js.svg)](https://github.com/SenseNet/sn-client-js/LICENSE.txt)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)

This component lets you work with the SenseNet ECM Content Repository (create or manage content, execute queries, etc.) by providing a JavaScript client API for the main content
operations.

This library connects to a SenseNet portal's REST API, but hides the underlying HTTP requests. You can work with simple load or create Content operations in JavaScript, instead of
having to construct ajax requests yourself.

It also provides you the full SenseNet Content Type system hierarchy through Typescript classes with all the fields defined in the CTDs and the Content Type schemas with FieldSettings
so that you can manage Content easy on client-side knowing the related fields and their settings.

### Examples

#### Creating a Folder with the name 'Hello world'

```ts
let content = new SenseNet.ContentTypes.Folder({ DisplayName: 'Hello world!' });
```

or

```ts
let content = SenseNet.Content.Create('Folder', { DisplayName: 'Hello world!' });
```

#### Load a Content by its id

```ts
var content = SenseNet.Content.load(1234, 'A.1', { expand: 'Avatar' });
content
.map(response => response.d)
.subscribe({
next: response => {
//do something with the response
},
error: error => console.error('something wrong occurred: ' + error),
complete: () => console.log('done'),
})
```

#### Get the Schema of the given ContentType

```javascript
let schema = SenseNet.Content.GetSchema('GenericContent');
```

#### Read Collection data

```ts
let collection = new Collection([]);
var options = new ODataAPI.ODataParams({
select: ["DisplayName", "Lead"],
orderby: 'DisplayName',
metadata: 'no' });
let fetchContent = collection.Read('/NewsDemo/External', options); //gets the list of the external Articles with their Id, Type and DisplayName fields.
fetchContent
.map(response => response.d.results)
.subscribe({
next: response => {
//do something with the response
},
error: error => console.error('something wrong occurred: ' + error),
complete: () => console.log('done'),
});
```

#### Delete a Content from a Collection

```ts
let deleteContent = myCollection.Remove(3);
deleteContent
.subscribe({
next: response => {
//do something after delete
},
error: error => console.error('something wrong occurred: ' + error),
complete: () => console.log('done'),
});
```

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 98a74a2

Please sign in to comment.