@newsteam/cosmos
v1.0.11
Published
This library provides a convenient way for developers to interact with the CosMoS CMS API
Downloads
76
Readme
CosMoS Client Library
Welcome to the CosMoS Client Library! This library provides a convenient way for developers to interact with the CosMoS CMS API, empowering them to seamlessly integrate CosMoS functionalities into their applications.
About CosMoS CMS
CosMoS is a robust news publishing CMS developed by News Team. With CosMoS, publishers can efficiently manage their digital news content, from article creation and management to user authentication and subscription handling. The CMS offers a comprehensive set of API endpoints, allowing developers to perform various tasks such as retrieving articles, searching for content, managing authors, and more.
For detailed documentation on the features and capabilities of the CosMoS CMS API, please refer to the CosMoS Documentation Site.
About This Client Library
The CosMoS Client Library simplifies the process of interacting with the CosMoS API by providing a set of intuitive functions and utilities. By integrating this library into your project, you can leverage the full potential of the CosMoS CMS without the need to manage complex API requests manually.
Getting Started
To get started with the CosMoS Client Library, simply install it via NPM and follow the usage instructions provided in this documentation. Whether you're building a news website, corporate communications portal, content aggregator, or ANY other application that requires seamless access to digital news/media content, the CosMoS Client Library is here to streamline your development process.
npm install @newsteam/cosmos
Usage
To start using the CosMoS Client Library in your project, follow these simple steps:
- Initializing the API: Create an instance of the
NewsTeamCosmosAPI
class with the necessary configuration options. Here's an example:
import { NewsTeamCosmosAPI } from "@newsteam/cosmos";
const api = new NewsTeamCosmosAPI({
consumer: "your_consumer_key",
host: "https://your.cosmos_instance.com",
});
- Making API Calls: Use the instantiated API object to make calls to the CosMoS API endpoints. Here's an example of fetching articles:
const { data: articles, error: getArticlesError } = await api.articles.getAll({
limit: 20
});
if(getArticlesError){
// there was an error with this request
} else {
// articles has been returned sucessfully
console.log(articles.length);
}
That's it! You're now ready to integrate the CosMoS Client Library into your project and start leveraging the power of the CosMoS CMS API.
Documentation
For more details on available modules, methods, and configuration options, please refer to the See CosMoS Documentation Site.