Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

agility-cms-management-sdk-typescript

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

agility-cms-management-sdk-typescript

Agility CMS Tyescript SDK for Management API.

unpublished
latest
Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Agility CMS & Management API TypeScript SDK

To start using the Agility CMS & .NET 5 Starter, sign up for a FREE account and create a new Instance using the Blog Template.

About the Management API SDK

  • Provides a facility to developers to use the new Agility Management API more effectively.
  • Provides methods to perform operations on Assets, Batches, Containers, Content, Models, Pages, and Users.
  • Supports the creation of Pages and Content in batches.
  • Ability to generate Content in bulk for a Website.

Getting Started

Prerequisites

  • Clone the repository agility-cms-management-sdk-typescript.
  • Import the index file to make use of the Options class.
  • Create an object of the Options class to provide values of -
    • token -> Bearer token to authenticate a Rest Request to perform an operation.
    • locale -> The locale under which your application is hosted. Example en-us.
    • guid -> The guid under which your application is hosted.
  • Create an object of Method class(es), which can be used to create and perform operations. Following is the description of Classes and their respective methods -

Making a Request

import * as index from "./index";

//initialize the Options Class
let options = new index.Options();

options.token = "<<Provide Auth Token>>";
options.guid = "<<Provide the Guid of the Website>>";
options.locale = "<<Provide the locale of the Website>>"; //Example: en-us

//Initialize the Method Class
let contentMethods = new index.ContentMethods(options);

//make the request: get a content item with the ID '22'
var contentItem = await contentMethods.getContentItem(22);

//To log the response of the contentItem object in console.
console.log(JSON.stringify(contentItem));

Class AssetMethods

This class is used to perform operations related to Assets. The following are the methods: -

upload

ParameterTypeDescription
formDataFormDataThis is an object of type FormData where files can be posted eg : const file = fs.readFileSync(<<Local File>>, null);const form = new FormData(); form.append('files',file,'<<File Name>>');
agilityFolderPathstringPath of the folder in Agility where the file(s) needs to be uploaded.
groupingIDnumberPath of the folder in Agility where the file(s) needs to be uploaded.

Returns: A collection of Media class Object.

deleteFile

ParameterTypeDescription
mediaIDnumberThe mediaID of the asset which needs to be deleted.
Returns
A string response if a file has been deleted.

moveFile

ParameterTypeDescription
mediaIDnumberThe mediaID of the file that needs to be moved.
newFolderstringThe new location (in Agility) where the file needs to be moved.

Returns: An object of Media class with the new location of the file.

getMediaList

ParameterTypeDescription
pageSizenumberThe page size on which the assets needs to selected.
recordOffsetnumberThe record offset value to skip search results.

Returns: An object of AssetMediaList class.

getAssetByID

ParameterTypeDescription
mediaIDnumberThe mediaID of the requested asset.

Returns: An object of Media class with the information of the asset.

getAssetByUrl

ParameterTypeDescription
urlstringThe url of the requested asset.

Returns: An object of Media class with the information of the asset.

Class BatchMethods

This class is used to perform operations related to Batches. The following are the methods: -

getBatch

ParameterTypeDescription
idnumberThe batchID of the requested batch.

Returns: A object of Batch class.

Class ContainerMethods

This class is used to perform operations related to Containers. The following are the methods: -

getContainerByID

ParameterTypeDescription
idnumberThe container id of the requested container.

Returns: A object of Container class.

getContainerByReferenceName

ParameterTypeDescription
referenceNamestringThe container reference name of the requested container.

Returns: A object of Container class.

getContainerSecurity

ParameterTypeDescription
idnumberThe container id of the requested container.

Returns: A object of Container class.

getContainerList

Returns: A collection object of Container class.

getNotificationList

ParameterTypeDescription
idnumberThe container id of the requested container.

Returns: A collection object of Notification class.

saveContainer

ParameterTypeDescription
containerContainerA Container type object to create or update a container.

Returns: An object of Container class.

deleteContainer

ParameterTypeDescription
idnumberThe container id of the requested container.

Returns: A string response if a container has been deleted.

Class ContentMethods

This class is used to perform operations related to Content. The following are the methods: -

getContentItem

ParameterTypeDescription
contentIDnumberThe contentid of the requested content.

Returns: An object of ContentItem class.

publishContent

ParameterTypeDescription
contentIDnumberThe contentid of the requested content.
commentsstringAdditional comments for a batch request.

Returns: An array of contentID of the requested content.

unPublishContent

ParameterTypeDescription
contentIDnumberThe contentid of the requested content.
commentsstringAdditional comments for a batch request.

Returns: An array of contentID of the requested content.

contentRequestApproval

ParameterTypeDescription
contentIDnumberThe contentid of the requested content.
commentsstringAdditional comments for a batch request.

Returns: An array of contentID of the requested content.

approveContent

ParameterTypeDescription
contentIDnumberThe contentid of the requested content.
commentsstringAdditional comments for a batch request.

Returns: An array of contentID of the requested content.

declineContent

ParameterTypeDescription
contentIDnumberThe contentid of the requested content.
commentsstringAdditional comments for a batch request.

Returns: An array of contentID of the requested content.

saveContentItem

ParameterTypeDescription
contentItemContentItemA contentItem object to create or update a content.

Returns: An array of contentID of the requested content.

saveContentItems

ParameterTypeDescription
contentItemsContentItem[]A collection of contentItems object to create or update multiple contents.

Returns: An array of contentID of the requested content.

deleteContent

ParameterTypeDescription
contentIDnumberThe contentid of the requested content.
commentsstringAdditional comments for a batch request.

Returns: An array of contentID of the requested content.

getContentItems

ParameterTypeDescription
referenceNamestringThe reference name of the container for the requested content.
filterstringThe filter condition for the requested content.
fieldsstringThe fields mapped to the container.
sortDirectionstringThe direction to sort the result.
sortFieldstringThe field on which the sort needs to be performed.
takenumberThe page size for the result.
skipnumberThe record offset for the result.

Returns: An object of ContentList class of the requested content.

Class InstanceUserMethods

This class is used to perform operations related to User. The following are the methods: -

getUsers

Returns: A collection of WebsiteUser class of the requested content.

saveUser

ParameterTypeDescription
emailAddressstringThe email address of the requested user.
rolesInstanceRole[]Collection object of InstanceRole class for the requested user.
firstNamestringThe first name of the requested user.
lastNamestringThe last name of the requested user.

Returns: An object of the InstanceUser class.

deleteUser

ParameterTypeDescription
userIDnumberThe userID of the requested user.

Returns: A string response if a user has been deleted.

Class ModelMethods

This class is used to perform operations related to Models. The following are the methods: -

getContentModel

ParameterTypeDescription
idnumberThe id of the requested model.

Returns: An object of Model class.

getContentModules

ParameterTypeDescription
includeDefaultsboolBoolean value to include defaults.
includeModulesboolBoolean value to include modules.

Returns: A collection object of Model class.

getPageModules

ParameterTypeDescription
includeDefaultboolBoolean value to include defaults.

Returns: A collection object of Model class.

saveModel

ParameterTypeDescription
modelModelThe object of Model to for the requested model.

Returns: An object of Model class.

deleteModel

ParameterTypeDescription
idnumberThe id for the requested model.

Returns: A string response if a model is deleted.

Class PageMethods

This class is used to perform operations related to Pages. The following are the methods: -

getSitemap

Returns: A collection object of Sitemap class.

getPage

ParameterTypeDescription
pageIDnumberThe id of the requested page.

Returns: An object of PageItem class.

publishPage

ParameterTypeDescription
pageIDnumberThe pageID of the requested page.
commentsstringAdditional comments for a batch request.

Returns: An array of pageID of the requested page.

unPublishPage

ParameterTypeDescription
pageIDnumberThe pageID of the requested page.
commentsstringAdditional comments for a batch request.

Returns: An array of pageID of the requested page.

deletePage

ParameterTypeDescription
pageIDnumberThe pageID of the requested page.
commentsstringAdditional comments for a batch request.

Returns: An array of pageID of the requested page.

approvePage

ParameterTypeDescription
pageIDnumberThe pageID of the requested page.
commentsstringAdditional comments for a batch request.

Returns: An array of pageID of the requested page.

declinePage

ParameterTypeDescription
pageIDnumberThe pageID of the requested page.
commentsstringAdditional comments for a batch request.

Returns: An array of pageID of the requested page.

pageRequestApproval

ParameterTypeDescription
pageIDnumberThe pageID of the requested page.
commentsstringAdditional comments for a batch request.

Returns: An array of pageID of the requested page.

savePage

ParameterTypeDescription
pageItemPageItemThe object of PageItem class for the requested Page.
parentPageIDnumberThe id of the parent page.
placeBeforePageItemIDnumberThe id of the page before the page.

Returns: An array of pageID of the requested page.

Running the SDK Locally

  • npm run clean
  • npm run prepare
  • npm run build

How It Works

Resources

Agility CMS

Community

Feedback and Questions

If you have feedback or questions about this starter, please use the Github Issues on this repo, join our Community Slack Channel or create a post on the Agility Developer Community.

Keywords

typescript

FAQs

Package last updated on 23 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts