Skip to content

Commit 79c0b7c

Browse files
committed
Updated Documentation sequence
1 parent 119e89f commit 79c0b7c

File tree

18 files changed

+68
-57
lines changed

18 files changed

+68
-57
lines changed

lib/contentstackClient.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,15 @@ export default function contentstackClient ({ http }) {
127127
* @example
128128
* import * as contentstack from '@contentstack/management'
129129
* const client = contentstack.client()
130-
* const notice = client.logout()
130+
* client.logout()
131+
* .then((response) => console.log(response))
131132
*
132-
*/
133+
* @example
134+
* import * as contentstack from '@contentstack/management'
135+
* const client = contentstack.client()
136+
* client.logout('AUTHTOKEN')
137+
* .then((response) => console.log(response))
138+
* */
133139
function logout (authtoken) {
134140
if (authtoken !== undefined) {
135141
return http.delete('/user-session', {

lib/organization/index.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function Organization (http, data) {
2626
* import * as contentstack from '@contentstack/management'
2727
* const client = contentstack.client()
2828
*
29-
* client.organization('organization_uid).fetch()
29+
* client.organization('organization_uid').fetch()
3030
* .then((organization) => console.log(organization))
3131
*
3232
*/
@@ -48,8 +48,8 @@ export function Organization (http, data) {
4848
* import * as contentstack from '@contentstack/management'
4949
* const client = contentstack.client()
5050
*
51-
* client.organization('organization_uid).stacks({ include_count: true })
52-
* .then((organization) => console.log(organization))
51+
* client.organization('organization_uid').stacks({ include_count: true })
52+
* .then((collection) => console.log(collection))
5353
*
5454
*/
5555
this.stacks = async (param) => {
@@ -76,7 +76,7 @@ export function Organization (http, data) {
7676
* const client = contentstack.client()
7777
*
7878
* client.stack({ api_key: 'api_key'}).transferOwnership('emailId')
79-
* .then((notice) => console.log(notice))
79+
* .then((response) => console.log(response.notice))
8080
*
8181
*/
8282
this.transferOwnership = async (email) => {
@@ -93,15 +93,15 @@ export function Organization (http, data) {
9393
}
9494

9595
/**
96-
* @description The Unshare a stack call unshares a stack with a user and removes the user account from the list of collaborators.
96+
* @description The Add users to organization call allows you to send invitations to add users to your organization. Only the owner or the admin of the organization can add users.
9797
* @memberof Organization
9898
* @func addUser
9999
* @returns {ContentstackCollection} ContentstackCollection of instance.
100100
* @example
101101
* import * as contentstack from '@contentstack/management'
102102
* const client = contentstack.client()
103103
*
104-
* client.organization('organization_uid).addUser({ users: { 'abc@test.com': ['org_uid1', 'org_uid2' ]}, stacks: { 'abc@test.com': { 'api_key1': [ 'stack_role_id' ] } } })
104+
* client.organization('organization_uid').addUser({ users: { 'abc@test.com': ['org_uid1', 'org_uid2' ]}, stacks: { 'abc@test.com': { 'api_key1': [ 'stack_role_id' ] } } })
105105
* .then((response) => console.log(response))
106106
*
107107
*/
@@ -127,8 +127,8 @@ export function Organization (http, data) {
127127
* import * as contentstack from '@contentstack/management'
128128
* const client = contentstack.client()
129129
*
130-
* client.organization('organization_uid).getInvitations()
131-
* .then((notice) => console.log(notice))
130+
* client.organization('organization_uid').getInvitations()
131+
* .then((response) => console.log(response.notice))
132132
*
133133
*/
134134
this.getInvitations = async (param) => {
@@ -153,8 +153,8 @@ export function Organization (http, data) {
153153
* import * as contentstack from '@contentstack/management'
154154
* const client = contentstack.client()
155155
*
156-
* client.organization('organization_uid).resendInvitition('invitation_uid')
157-
* .then((notice) => console.log(notice))
156+
* client.organization('organization_uid').resendInvitition('invitation_uid')
157+
* .then((response) => console.log(response.notice))
158158
*
159159
*/
160160
this.resendInvitation = async (invitationUid) => {
@@ -171,7 +171,7 @@ export function Organization (http, data) {
171171
}
172172

173173
/**
174-
* @description The Unshare a stack call unshares a stack with a user and removes the user account from the list of collaborators.
174+
* @description A role is a collection of permissions that will be applicable to all the users who are assigned this role.
175175
* @memberof Organization
176176
* @func roles
177177
* @param {Int} limit The limit parameter will return a specific number of roles in the output.
@@ -185,7 +185,7 @@ export function Organization (http, data) {
185185
* import * as contentstack from '@contentstack/management'
186186
* const client = contentstack.client()
187187
*
188-
* client.organization('organization_uid).roles()
188+
* client.organization('organization_uid').roles()
189189
* .then((roles) => console.log(roles))
190190
*
191191
*/

lib/stack/asset/folders/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export function Folder (http, data = {}) {
5050
* const client = contentstack.client()
5151
*
5252
* client.stack({ api_key: 'api_key'}).asset().folder('uid').delete()
53-
* .then((notice) => console.log(notice))
53+
* .then((response) => console.log(response.notice))
5454
*/
5555
this.delete = deleteEntity(http)
5656

lib/stack/asset/index.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export function Asset (http, data = {}) {
5757
* const client = contentstack.client()
5858
*
5959
* client.stack({ api_key: 'api_key'}).asset('uid').delete()
60-
* .then((notice) => console.log(notice))
60+
* .then((response) => console.log(response.notice))
6161
*/
6262
this.delete = deleteEntity(http)
6363

@@ -79,7 +79,7 @@ export function Asset (http, data = {}) {
7979
/**
8080
* @description The Replace asset call will replace an existing asset with another file on the stack.
8181
* @memberof Asset
82-
* @func fetch
82+
* @func replace
8383
* @returns {Promise<Asset.Asset>} Promise for Asset instance
8484
* @example
8585
* import * as contentstack from '@contentstack/management'
@@ -124,7 +124,7 @@ export function Asset (http, data = {}) {
124124
* }
125125
*
126126
* client.stack({ api_key: 'api_key'}).asset('uid').publish({ publishDetails: asset, version: 1, scheduledAt: "2019-02-08T18:30:00.000Z"})
127-
* .then((notice) => console.log(notice))
127+
* .then((response) => console.log(response.notice))
128128
*
129129
*/
130130
this.publish = publish(http, 'asset')
@@ -148,20 +148,23 @@ export function Asset (http, data = {}) {
148148
* }
149149
*
150150
* client.stack({ api_key: 'api_key'}).asset('uid').unpublish({ publishDetails: asset, version: 1, scheduledAt: "2019-02-08T18:30:00.000Z"})
151-
* .then((notice) => console.log(notice))
151+
* .then((response) => console.log(response.notice))
152152
*
153153
*/
154154
this.unpublish = unpublish(http, 'asset')
155155
} else {
156156
/**
157-
* @description The Folder allows to fetch and create folders in assets.
158-
* @memberof Folder
159-
* @func create
160-
* @returns {Promise<Folder.Folder>} Promise for Entry instance
161-
*
162-
* @example
163-
* import * as contentstack from '@contentstack/management'
164-
* const client = contentstack.client()
157+
* @description The Folder allows to fetch and create folders in assets.
158+
* @memberof Asset
159+
* @func folder
160+
* @returns {Promise<Folder.Folder>} Promise for Entry instance
161+
*
162+
* @example
163+
* import * as contentstack from '@contentstack/management'
164+
* const client = contentstack.client()
165+
* const asset = {name: 'My New contentType'}
166+
* client.stack({ api_key: 'api_key'}).asset('uid').folder().create({ asset })
167+
* .then((folder) => console.log(folder))
165168
*/
166169
this.folder = (folderUid = null) => {
167170
const data = { stackHeaders: this.stackHeaders }

lib/stack/bulkOperation/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { publishUnpublish } from '../../entity'
33

44
/**
55
* Bulk operations such as Publish, Unpublish, and Delete on multiple entries or assets.
6+
* @namespace BulkOperation
67
*/
78
export function BulkOperation (http, data = {}) {
89
this.stackHeaders = data.stackHeaders
@@ -40,7 +41,7 @@ export function BulkOperation (http, data = {}) {
4041
* ]
4142
* }
4243
* client.stack({ api_key: 'api_key'}).publish({ details: publishDetails })
43-
* .then((notice) => { console.log(notice) })
44+
* .then((response) => { console.log(response.notice) })
4445
*
4546
*/
4647
this.publish = async (params = {}) => {
@@ -94,7 +95,7 @@ export function BulkOperation (http, data = {}) {
9495
* ]
9596
* }
9697
* client.stack({ api_key: 'api_key'}).unpublish({ details: publishDetails })
97-
* .then((notice) => { console.log(notice) })
98+
* .then((response) => { console.log(response.notice) })
9899
*
99100
*/
100101
this.unpublish = async (params = {}) => {
@@ -139,7 +140,7 @@ export function BulkOperation (http, data = {}) {
139140
* }]
140141
* }
141142
* client.stack({ api_key: 'api_key'}).delete({ details: publishDetails })
142-
* .then((notice) => { console.log(notice) })
143+
* .then((response) => { console.log(response.notice) })
143144
*
144145
*/
145146
this.delete = async (params = {}) => {

lib/stack/contentType/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export function ContentType (http, data = {}) {
5555
* const client = contentstack.client()
5656
*
5757
* client.stack({ api_key: 'api_key'}).contentType('content_type_uid').delete()
58-
* .then((notice) => console.log(notice))
58+
* .then((response) => console.log(response.notice))
5959
*/
6060
this.delete = deleteEntity(http)
6161

lib/stack/deliveryToken/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function DeliveryToken (http, data = {}) {
3939
* const client = contentstack.client()
4040
*
4141
* client.stack({ api_key: 'api_key'}).deliveryToken('delivery_token_uid').delete()
42-
* .then((notice) => console.log(notice))
42+
* .then((response) => console.log(response.notice))
4343
*/
4444
this.delete = deleteEntity(http)
4545

lib/stack/environment/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function Environment (http, data = {}) {
3737
* const client = contentstack.client()
3838
*
3939
* client.stack({ api_key: 'api_key'}).environment('uid').delete()
40-
* .then((notice) => console.log(notice))
40+
* .then((response) => console.log(response.notice))
4141
*/
4242
this.delete = deleteEntity(http)
4343

@@ -87,9 +87,9 @@ export function Environment (http, data = {}) {
8787

8888
/**
8989
* @description The Query on GlobalField will allow to fetch details of all or specific GlobalField
90-
* @memberof GlobalField
90+
* @memberof Environment
9191
* @func query
92-
* @returns {Array<GlobalField>} Array of GlobalField.
92+
* @returns {Array<Environment>} Array of GlobalField.
9393
*
9494
* @example
9595
* import * as contentstack from '@contentstack/management'

lib/stack/extension/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { createReadStream } from 'fs'
66

77
/**
88
* Extensions let you create custom fields and custom widgets that lets you customize Contentstack's default UI and behavior. Read more about <a href='https://www.contentstack.com/docs/developers/about-experience-extensions/'>Extensions</a>.
9-
*/
9+
* @namespace Extension
10+
* */
1011

1112
export function Extension (http, data = {}) {
1213
this.stackHeaders = data.stackHeaders
@@ -43,7 +44,7 @@ export function Extension (http, data = {}) {
4344
* const client = contentstack.client()
4445
*
4546
* client.stack({ api_key: 'api_key'}).extension('extension_uid').delete()
46-
* .then((notice) => console.log(notice))
47+
* .then((response) => console.log(response.notice))
4748
*/
4849
this.delete = deleteEntity(http)
4950

lib/stack/globalField/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function GlobalField (http, data = {}) {
4646
* const client = contentstack.client()
4747
*
4848
* client.stack({ api_key: 'api_key'}).globalField('global_field_uid').delete()
49-
* .then((notice) => console.log(notice))
49+
* .then((response) => console.log(response.notice))
5050
*/
5151
this.delete = deleteEntity(http)
5252

0 commit comments

Comments
 (0)