Skip to content

Commit

Permalink
1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
MrRefactoring committed Aug 9, 2021
1 parent 00a3ca9 commit 75cd1d2
Show file tree
Hide file tree
Showing 9 changed files with 346 additions and 133 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### 1.1.1

- `expand` property added to `ContentAttachments.getAttachments`.

### 1.1.0

- Server API added
Expand Down
273 changes: 154 additions & 119 deletions package-lock.json

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "confluence.js",
"version": "1.1.0",
"version": "1.1.1",
"description": "confluence.js is a powerful Node.JS/Browser module that allows you to interact with the Confluence API very easily",
"main": "out/index.js",
"types": "out/index.d.ts",
Expand Down Expand Up @@ -37,25 +37,26 @@
"@types/jest": "^26.0.24",
"@types/oauth": "^0.9.1",
"@types/sinon": "^10.0.2",
"@typescript-eslint/eslint-plugin": "^4.28.2",
"@typescript-eslint/parser": "^4.28.2",
"@typescript-eslint/eslint-plugin": "^4.29.0",
"@typescript-eslint/parser": "^4.29.0",
"dotenv": "^10.0.0",
"eslint": "^7.30.0",
"eslint": "^7.32.0",
"eslint-config-airbnb-typescript": "^12.3.1",
"eslint-import-resolver-typescript": "^2.4.0",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-import": "^2.24.0",
"jest": "^26.6.3",
"prettier": "^2.3.2",
"prettier-plugin-jsdoc": "^0.3.23",
"sinon": "^11.1.1",
"sinon": "^11.1.2",
"ts-jest": "^26.5.6",
"typedoc": "^0.21.2",
"typedoc": "^0.21.5",
"typescript": "^4.3.5"
},
"dependencies": {
"atlassian-jwt": "^2.0.1",
"axios": "^0.21.1",
"oauth": "^0.9.15",
"telemetry.confluence.js": "<2"
"telemetry.confluence.js": "<2",
"tslib": "^2.3.0"
}
}
1 change: 1 addition & 0 deletions src/api/contentAttachments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class ContentAttachments {
limit: parameters.limit,
filename: parameters.filename,
mediaType: parameters.mediaType,
expand: parameters.expand,
},
};

Expand Down
87 changes: 86 additions & 1 deletion src/api/parameters/getAttachments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export interface GetAttachments {
/** The ID of the content to be queried for its attachments. */
id: string;
/** A multi-value parameter indicating which properties of the content to expand. */
expand?: string[];
expand?: string | string[] | GetAttachments.Expand | GetAttachments.Expand[];
/** The starting index of the returned attachments. */
start?: number;
/** The maximum number of attachments to return per page. Note, this may be restricted by fixed system limits. */
Expand All @@ -12,3 +12,88 @@ export interface GetAttachments {
/** Filter the results to attachments that match the media type. */
mediaType?: string;
}

export namespace GetAttachments {
export enum Expand {
/**
* Returns whether the content has attachments, comments, or child pages. Use this if you only need to check whether
* the content has children of a particular type.
*/
AllChildTypes = 'childTypes.all',
/** Returns whether the content has attachments. */
AttachmentChildType = 'childTypes.attachment',
/** Returns whether the content has comments. */
CommentChildType = 'childTypes.comment',
/** Returns whether the content has child pages. */
PageChildType = 'childTypes.page',
/**
* Returns the space that the content is in. This is the same as the information returned by [Get
* space](https://developer.atlassian.com/cloud/confluence/rest/api-group-content---attachments/).
*/
Container = 'container',
/**
* Returns information about the current user in relation to the content, including when they last viewed it,
* modified it, contributed to it, or added it as a favorite.
*/
CurrentUserMetadata = 'metadata.currentuser',
/** Returns content properties that have been set via the Confluence REST API. */
PropertiesMetadata = 'metadata.properties',
/** Returns the labels that have been added to the content. */
LabelsMetadata = 'metadata.labels',
/** This property is only used by Atlassian. */
FrontendMetadata = 'metadata.frontend',
/** Returns the operations for the content, which are used when setting permissions. */
Operations = 'operations',
/** Returns pages that are descendants at the level immediately below the content. */
PageChildren = 'children.page',
/** Returns all attachments for the content. */
AttachmentChildren = 'children.attachment',
/** Returns all comments on the content. */
CommentChildren = 'children.comment',
/** Returns the users that have permission to read the content. */
ReadUserRestriction = 'restrictions.read.restrictions.user',
/**
* Returns the groups that have permission to read the content. Note that this may return deleted groups, because
* deleting a group doesn't remove associated restrictions.
*/
ReadGroupRestriction = 'restrictions.read.restrictions.group',
/** Returns the users that have permission to update the content. */
UpdateUserRestriction = 'restrictions.update.restrictions.user',
/**
* Returns the groups that have permission to update the content. Note that this may return deleted groups because
* deleting a group doesn't remove associated restrictions.
*/
UpdateGroupRestriction = 'restrictions.update.restrictions.group',
/** Returns the history of the content, including the date it was created. */
History = 'history',
/** Returns information about the most recent update of the content, including who updated it and when it was updated. */
LastUpdated = 'history.lastUpdated',
/** Returns information about the update prior to the current content update. */
PreviousVersion = 'history.previousVersion',
/** Returns all of the users who have contributed to the content. */
Contributors = 'history.contributors',
/** Returns information about the update after to the current content update. */
NextVersion = 'history.nextVersion',
/** Returns the parent page, if the content is a page. */
Ancestors = 'ancestors',
/** Returns the body of the content in different formats, including the editor format, view format, and export format. */
Body = 'body',
/** Returns information about the most recent update of the content, including who updated it and when it was updated. */
Version = 'version',
/** Returns pages that are descendants at any level below the content. */
PageDescendant = 'descendants.page',
/** Returns all attachments for the content, same as `children.attachment`. */
AttachmentDescendant = 'descendants.attachment',
/** Returns all comments on the content, same as `children.comment`. */
CommentDescendant = 'descendants.comment',
/**
* Returns the space that the content is in. This is the same as the information returned by [Get
* space](https://developer.atlassian.com/cloud/confluence/rest/api-group-content---attachments/).
*/
Space = 'space',
/** Returns inline comment-specific properties. */
InlineProperties = 'extensions.inlineProperties',
/** Returns the resolution status of each comment. */
Resolution = 'extensions.resolution',
}
}
4 changes: 2 additions & 2 deletions src/clients/baseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ export class BaseClient implements Client {
bodyExists: !!requestConfig.data,
callbackUsed: !!callback,
headersExists: !!requestConfig.headers,
libVersion: '1.1.0',
libVersionHash: '72812e30873455dcee2ce2d1ee26e4ab',
libVersion: '1.1.1',
libVersionHash: 'd7bc3c1c6285d1b988bd8ddfc55f75bc',
methodName: telemetryData?.methodName || 'sendRequest',
onErrorMiddlewareUsed: !!this.config.middlewares?.onError,
onResponseMiddlewareUsed: !!this.config.middlewares?.onResponse,
Expand Down
87 changes: 86 additions & 1 deletion src/server/parameters/getAttachments.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export interface GetAttachments {
id: string | number;
/** A comma separated list of properties to expand on the Attachments returned. Optional. */
expand?: string;
expand?: string | string[] | GetAttachments.Expand | GetAttachments.Expand[];
/** The index of the first item within the result set that should be returned. Optional. */
start?: number;
/** How many items should be returned after the start index. Optional. */
Expand All @@ -11,3 +11,88 @@ export interface GetAttachments {
/** (optional) filter parameter to return only Attachments with a matching Media-Type. Optional. */
mediaType?: string;
}

export namespace GetAttachments {
export enum Expand {
/**
* Returns whether the content has attachments, comments, or child pages. Use this if you only need to check whether
* the content has children of a particular type.
*/
AllChildTypes = 'childTypes.all',
/** Returns whether the content has attachments. */
AttachmentChildType = 'childTypes.attachment',
/** Returns whether the content has comments. */
CommentChildType = 'childTypes.comment',
/** Returns whether the content has child pages. */
PageChildType = 'childTypes.page',
/**
* Returns the space that the content is in. This is the same as the information returned by [Get
* space](https://developer.atlassian.com/cloud/confluence/rest/api-group-content---attachments/).
*/
Container = 'container',
/**
* Returns information about the current user in relation to the content, including when they last viewed it,
* modified it, contributed to it, or added it as a favorite.
*/
CurrentUserMetadata = 'metadata.currentuser',
/** Returns content properties that have been set via the Confluence REST API. */
PropertiesMetadata = 'metadata.properties',
/** Returns the labels that have been added to the content. */
LabelsMetadata = 'metadata.labels',
/** This property is only used by Atlassian. */
FrontendMetadata = 'metadata.frontend',
/** Returns the operations for the content, which are used when setting permissions. */
Operations = 'operations',
/** Returns pages that are descendants at the level immediately below the content. */
PageChildren = 'children.page',
/** Returns all attachments for the content. */
AttachmentChildren = 'children.attachment',
/** Returns all comments on the content. */
CommentChildren = 'children.comment',
/** Returns the users that have permission to read the content. */
ReadUserRestriction = 'restrictions.read.restrictions.user',
/**
* Returns the groups that have permission to read the content. Note that this may return deleted groups, because
* deleting a group doesn't remove associated restrictions.
*/
ReadGroupRestriction = 'restrictions.read.restrictions.group',
/** Returns the users that have permission to update the content. */
UpdateUserRestriction = 'restrictions.update.restrictions.user',
/**
* Returns the groups that have permission to update the content. Note that this may return deleted groups because
* deleting a group doesn't remove associated restrictions.
*/
UpdateGroupRestriction = 'restrictions.update.restrictions.group',
/** Returns the history of the content, including the date it was created. */
History = 'history',
/** Returns information about the most recent update of the content, including who updated it and when it was updated. */
LastUpdated = 'history.lastUpdated',
/** Returns information about the update prior to the current content update. */
PreviousVersion = 'history.previousVersion',
/** Returns all of the users who have contributed to the content. */
Contributors = 'history.contributors',
/** Returns information about the update after to the current content update. */
NextVersion = 'history.nextVersion',
/** Returns the parent page, if the content is a page. */
Ancestors = 'ancestors',
/** Returns the body of the content in different formats, including the editor format, view format, and export format. */
Body = 'body',
/** Returns information about the most recent update of the content, including who updated it and when it was updated. */
Version = 'version',
/** Returns pages that are descendants at any level below the content. */
PageDescendant = 'descendants.page',
/** Returns all attachments for the content, same as `children.attachment`. */
AttachmentDescendant = 'descendants.attachment',
/** Returns all comments on the content, same as `children.comment`. */
CommentDescendant = 'descendants.comment',
/**
* Returns the space that the content is in. This is the same as the information returned by [Get
* space](https://developer.atlassian.com/cloud/confluence/rest/api-group-content---attachments/).
*/
Space = 'space',
/** Returns inline comment-specific properties. */
InlineProperties = 'extensions.inlineProperties',
/** Returns the resolution status of each comment. */
Resolution = 'extensions.resolution',
}
}
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"module": "CommonJS",
"outDir": "out",
"strict": true,
"declaration": true
"declaration": true,
"importHelpers": true
},
"exclude": [
"node_modules",
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"module": "CommonJS",
"outDir": "out",
"strict": true,
"declaration": true
"declaration": true,
"importHelpers": true
},
"exclude": [
"node_modules",
Expand Down

0 comments on commit 75cd1d2

Please sign in to comment.