@dotcms/client 0.0.1-alpha.33 → 0.0.1-alpha.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +122 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,122 @@
1
+ # @dotcms/client
2
+
3
+ `@dotcms/client` is the official dotCMS JavaScript library designed to simplify interactions with the DotCMS REST APIs.
4
+
5
+ This client library provides a streamlined, promise-based interface to fetch pages and navigation API.
6
+
7
+ ## Features
8
+
9
+ - Easy-to-use methods to interact with the [DotCMS Page](https://www.dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas) and [Navigation APIs](https://www.dotcms.com/docs/latest/navigation-rest-api).
10
+ - Support for custom actions to communicate with the DotCMS page editor.
11
+ - Comprehensive TypeScript typings for better development experience.
12
+
13
+ ## Installation
14
+
15
+ Install the package via npm:
16
+
17
+ ```bash
18
+ npm install @dotcms/client
19
+ ```
20
+
21
+ Or using Yarn:
22
+
23
+ ```bash
24
+ yarn add @dotcms/client
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ `@dotcms/client` supports both ES modules and CommonJS. You can import it using either syntax:
30
+
31
+ ### ES Modules
32
+
33
+ ```javascript
34
+ import { dotcmsClient } from '@dotcms/client';
35
+ ```
36
+
37
+ ### CommonJS
38
+
39
+ ```javascript
40
+ const { dotcmsClient } = require('@dotcms/client');
41
+ ```
42
+
43
+ First, initialize the client with your DotCMS instance details.
44
+
45
+ ```javascript
46
+ const client = dotcmsClient.init({
47
+ dotcmsUrl: 'https://your-dotcms-instance.com',
48
+ authToken: 'your-auth-token',
49
+ siteId: 'your-site-id'
50
+ });
51
+ ```
52
+
53
+ ### Fetching a Page
54
+
55
+ Retrieve the elements of any page in your DotCMS system in JSON format.
56
+
57
+ ```javascript
58
+ const pageData = await client.page.get({
59
+ path: '/your-page-path',
60
+ language_id: 1,
61
+ personaId: 'optional-persona-id'
62
+ });
63
+
64
+ console.log(pageData);
65
+ ```
66
+
67
+ ### Fetching Navigation
68
+
69
+ Retrieve information about the DotCMS file and folder tree.
70
+
71
+ ```javascript
72
+ const navData = await client.nav.get({
73
+ path: '/',
74
+ depth: 2,
75
+ languageId: 1
76
+ });
77
+
78
+ console.log(navData);
79
+ ```
80
+
81
+ ## API Reference
82
+
83
+ Detailed documentation of the `@dotcms/client` methods, parameters, and types can be found below:
84
+
85
+ ### `dotcmsClient.init(config: ClientConfig): DotCmsClient`
86
+
87
+ Initializes the DotCMS client with the specified configuration.
88
+
89
+ ### `DotCmsClient.page.get(options: PageApiOptions): Promise<unknown>`
90
+
91
+ Retrieves the specified page's elements from your DotCMS system in JSON format.
92
+
93
+ ### `DotCmsClient.nav.get(options: NavApiOptions): Promise<unknown>`
94
+
95
+ Retrieves information about the DotCMS file and folder tree.
96
+
97
+ ## Contributing
98
+
99
+ GitHub pull requests are the preferred method to contribute code to dotCMS. Before any pull requests can be accepted, an automated tool will ask you to agree to the [dotCMS Contributor's Agreement](https://gist.github.com/wezell/85ef45298c48494b90d92755b583acb3).
100
+
101
+ ## Licensing
102
+
103
+ dotCMS comes in multiple editions and as such is dual licensed. The dotCMS Community Edition is licensed under the GPL 3.0 and is freely available for download, customization and deployment for use within organizations of all stripes. dotCMS Enterprise Editions (EE) adds a number of enterprise features and is available via a supported, indemnified commercial license from dotCMS. For the differences between the editions, see [the feature page](http://dotcms.com/cms-platform/features).
104
+
105
+ ## Support
106
+
107
+ If you need help or have any questions, please [open an issue](https://github.com/dotCMS/core/issues/new/choose) in the GitHub repository.
108
+
109
+ ## Documentation
110
+
111
+ Always refer to the official [DotCMS documentation](https://www.dotcms.com/docs/latest/) for comprehensive guides and API references.
112
+
113
+ ## Getting Help
114
+
115
+ | Source | Location |
116
+ | --------------- | ------------------------------------------------------------------- |
117
+ | Installation | [Installation](https://dotcms.com/docs/latest/installation) |
118
+ | Documentation | [Documentation](https://dotcms.com/docs/latest/table-of-contents) |
119
+ | Videos | [Helpful Videos](http://dotcms.com/videos/) |
120
+ | Forums/Listserv | [via Google Groups](https://groups.google.com/forum/#!forum/dotCMS) |
121
+ | Twitter | @dotCMS |
122
+ | Main Site | [dotCMS.com](https://dotcms.com/) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotcms/client",
3
- "version": "0.0.1-alpha.33",
3
+ "version": "0.0.1-alpha.35",
4
4
  "description": "Official JavaScript library for interacting with DotCMS REST APIs.",
5
5
  "repository": {
6
6
  "type": "git",