3.7.0 • Published 8 months ago

catdv v3.7.0

Weekly downloads
90
License
SEE LICENSE.txt
Repository
-
Last release
8 months ago

CatDV REST API Client Library

Allows NodeJS scripts to automate Square Box System's CatDV Media Asset Management System using the CatDV REST API.

Install

$ npm install catdv

Usage

Basic usage of the API is shown below:

var catdv = require('catdv');
var $catdv = new catdv.RestApi("http://catdvserver:8080");

$catdv.login("username", "password");

      :

$catdv.logout();

API

// Login/Out
login(username: string, encryptedPassword: string):SessionInfo
loginAsync(username, password, groupID: number, callback: (SessionInfo) => void)  
logout():any
logoutAsync(callback: () => void)

// Catalogs
getCatalog(catalogId: any):Catalog
getCatalogs():Catalog[]
getCatalogsAsync(callback: (Catalog[]) => void)
getCatalogsBasicInfo():Catalog[]
saveCatalog(catalog: Catalog):any
saveCatalogAsync(catalog: Catalog, callback: () => void)
deleteCatalog(catalogID: number):any

// Clips
getClip(clipId: any):Clip
getClipAsync(clipId: any, callback: (Clip) => void)
getClips(params: StdParams):PartialResultSet<Clip>
getClipsAsync(params: ClipQueryParams, callback: (PartialResultSet<Clip>) => void)
getClipIDs(params: StdParams):number[]
getClipIDsAsync(params: any, callback: (number[]) => void)
getClipCount(params):number
saveClip(clip: any):any
saveClips(clips: Clip[]):number
saveClipAsync(clip: any, callback: () => void)
deleteClip(clipID: number):any
bulkUpdateMediaLocation(fromDirectory: string, toDirectory: string)

// Smart Folders
getSmartFolders():SmartFolder[]
saveSmartFolder(smartFolder: any):any
deleteSmartFolder(smartFolderID: number):any

// Clip Lists
getClipLists():ClipList[]
addToClipList(clipListID: number, clipIDs: number[]):any
removeFromClipList(clipListID: number, clipIDs: number[]):any
saveClipList(clipList: any):number
deleteClipList(clipListID: number):any

// Field Groups / Field Definitions
getFieldGroup(fieldGroupID: number):FieldGroup
getFieldGroups(params: any):FieldGroup[]
getFieldListValues(field: string):string[]
getFields(params: any):PartialResultSet<FieldDefinition>
getFieldDefinitions(fieldIDs: string[]):FieldDefinition[]
getFieldDefinition(fieldDefID: number):PartialResultSet<FieldDefinition>
saveField(field: any):any
saveFieldGroup(fieldGroup: any):any
deleteField(fieldDefID: string, forceDelete: boolean):any
deleteFieldGroup(fieldGroupDefID: string):any

// Panel Definitions
getPanelSetsWithPanels():PanelDefinition[]
getPanelDefinitions(groupID: number):PanelDefinition[]
getSharedLinkPanelDefinitions(linkUID: string):PanelDefinition[]
getPanelFields(panelDefID: number):PanelField[]
savePanel(panel: PanelDefinition):any
updatePicklist(fieldID: string, picklist: Picklist):string[]

// View Definitions
getViewSetsWithViews():ViewDefinition[]
getViewDefinitions():ViewDefinition[]
getViewFields(viewType: string, viewDefID: number):ViewField[]
saveViewSet(viewType: string, viewSet: BaseViewSet):any
saveView(viewType: string, view: ViewDefinition):any
deleteViewSet(viewSetID: number):any
deleteView(viewID: number):any

// Form Definitions
getFormSetsWithForms():PanelDefinition[]
getCurrentUploadForm():PanelDefinition
getCurrentSearchForm():PanelDefinition
saveForm(form: FormDefinition):any

// Media Stores
getMediaStores():MediaStore[]
getMediaStore_MediaTypes():EnumItem[]
getMediaStore_PathTargets():EnumItem[]
saveMediaStore(mediaStore: MediaStore):MediaStore
saveMediaStorePath(mediaStorePath: MediaStorePath):MediaStorePath
deleteMediaStore(mediastoreID: number):any
deleteMediaStorePath(mediastoreID: number, mediastorePathID: number):any

// Shared Links
getSharedLinks(params: any):PartialResultSet<SharedLink>
getSharedLink(sharedLinkID: number):SharedLink[]
createSharedLink(sharedLink: SharedLink):any
updateSharedLink(sharedLink: SharedLink):any
deleteSharedLink(sharedLinkID: number):any

// Services / Jobs
getServices():Service[]
getJob(jobID: number):Job
getJobs(params: any):PartialResultSet<Job>

// Media / Thumbnails
getThumbnailsForMedia(mediaID: number):Thumbnail[]
getMedia(mediaID: number, params: any): any

// Uploads
initiateUpload(filename: string, fileSize: number, metadata: any):any

// Groups
getGroups(params: any):any
getGroupRolePermissions(groupID: number):Role[]
saveGroup(group: any):any
updateGroupRolePermissions(groupID: number, roles: Role[]):Role[]
deleteGroup(groupID: number):any

// Roles
getRoles(params: any):Role[]
getRoleGroupPermissions(roleID: number):Group[]
saveRole(role: any):any
updateRoleGroupPermissions(roleID: number, groups: Group[]):Role[]
deleteRole(roleID: number):any

// Users
getUser(userID: number):User
getUsers(params: any):User[]
insertUser(user: User):any
updateUser(user: User):any
deleteUser(userID: number):any

// Server Commands
getServerCommands(params: any)
callServerCommand(commandUID: string, params: any):CommandResults
execServerCommand(commandID: number, commandParams: CommandParams):CommandResults

// Audit Log
getLogEntries(params: any):PartialResultSet<LogEntry>

// Server Properties
getServerProperties(propertyNames: string[]):string[]
getServerProperty(propertyName: string):string
setServerProperties(propertySet: any)

Simple Example

The simple example below retrieve the list of catalogs from the server:

import catdv = require("catdv");

var $catdv = new catdv.RestApi("http://catdv_server:8080");

try
{
    $catdv.login("username", "password");
    
    var catalogs = $catdv.getCatalogsBasicInfo();
    console.log(JSON.stringify(catalogs, null, 4));
}
finally
{
     $catdv.logout();
}

Synchronous vs. Asynchrous Calls

Notice in the above example that the APIs are synchronous - that is execution waits for the reply from the server before continuing. This makes complex scripts, that make many API calls, much easier to write, but there is a substantial performance penality in making synchronous calls.

Because of this there are asynchronous versions of some API calls, that return thrie results via a callback. If a scripts needs to perform a large number of operations then it is is worth using the asynchronous version of the calls in the inner loop where available.

This is simple example of an asynchronous call:

import catdv = require("catdv");

var $catdv = new catdv.RestApi("http://catdv_server:8080");

 $catdv.login("username", "password");
    
$catdv.getCatalogsAsync((catalogs) => {
    console.log(JSON.stringify(catalogs, null, 4));
    $catdv.logout();
});
3.7.0

8 months ago

3.6.0

8 months ago

3.5.0

1 year ago

3.4.1

2 years ago

3.4.0

2 years ago

3.3.1

3 years ago

3.3.0

3 years ago

3.2.0

3 years ago

3.1.0

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.0.7

4 years ago

2.0.6

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.7.0

4 years ago

1.6.3

4 years ago

1.6.2

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.5.1

4 years ago

1.5.0

5 years ago

1.4.0

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

6 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

7 years ago

1.2.0

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago