Method to add an item to a local collection and to the Content Repository through OData REST API at the same time.
Calls the method [CreateContent]{@link ODataApi.CreateContent} with the current collections path and the given content as parameters.
The item that has to be saved.
Returns an RxJS observable that you can subscribe of in your code.
let addContent = myCollection.Add({DisplayName: 'New content', }});
addContent
.subscribe({
next: response => {
//do something after delete
},
error: error => console.error('something wrong occurred: ' + error),
complete: () => console.log('done'),
});
Method that returns the list of types which can be added as children to the collection.
Returns an RxJS observable that you can subscribe of in your code.
let allowedChildTypes = collection.AllowedChildTypes();
allowedChildTypes.subscribe({
next: response => {
console.log(response);
},
error: error => console.error('something wrong occurred: ' + error.responseJSON.error.message.value),
complete: () => console.log('done'),
});
Method to copy multiple content to another container.
Returns an RxJS observable that you can subscribe of in your code.
let copy = myCollection.Copy([3, 5], '/Root/MyContent/MyFolder');
copy
.subscribe({
next: response => {
//do something after copy
},
error: error => console.error('something wrong occurred: ' + error),
complete: () => console.log('done'),
});
Returns the number of items in the collection.
collection.Count();
Returns an item by the given id.
The content's id
the specified content
collection.GetItem(1234);
Returns the items of the collection as an array.
collection.GetItems();
Method to move multiple content to another container.
Returns an RxJS observable that you can subscribe of in your code.
let move = myCollection.Move([3, 5], '/Root/MyContent/MyFolder');
move
.subscribe({
next: response => {
//do something after move
},
error: error => console.error('something wrong occurred: ' + error),
complete: () => console.log('done'),
});
Method to fetch Content from the Content Repository.
Calls the method [FetchContent]{@link ODataApi.FetchContent} with the current collections path and the given OData options. If you leave the options undefined only the Id and the Type fields will be in the response. These two fields are always the part of the reponse whether they're added or not to the options as selectable.
Path of the requested container item.
Represents an ODataOptions object based on the IODataOptions interface. Holds the possible url parameters as properties.
Returns an RxJS observable that you can subscribe of in your code.
let fetchContent = Collection.Read('newsdemo/external', {select: 'DisplayName'}); //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'),
});
Method to remove an item from a local collection and from the Content Repository through OData REST API at the same time.
Calls the method [DeleteContent]{@link ODataApi.DeleteContent} with the current collections path and the given items index as parameters.
Adjust if the Content should be moved to the Trash or deleted permanently.
Returns an RxJS observable that you can subscribe of in your code.
let deleteContent = myCollection.Remove([3, 4]);
deleteContent
.subscribe({
next: response => {
//do something after remove
},
error: error => console.error('something wrong occurred: ' + error),
complete: () => console.log('done'),
});
Uploads a stream or text to a content binary field (e.g. a file).
Returns an RxJS observable that you can subscribe of in your code.
Generated using TypeDoc
Collection