Skip to content

add confluence app with actions and triggers #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ env:
ZOOM_REFRESH_TOKEN: ${{ secrets.ZOOM_REFRESH_TOKEN }}
ZOOM_CLIENT_ID: ${{ secrets.ZOOM_CLIENT_ID }}
ZOOM_CLIENT_SECRET: ${{ secrets.ZOOM_CLIENT_SECRET }}
CONFLUENCE_USERNAME: ${{ secrets.CONFLUENCE_USERNAME }}
CONFLUENCE_PASSWORD: ${{ secrets.CONFLUENCE_PASSWORD }}
CONFLUENCE_CLOUD_ID: ${{ secrets.CONFLUENCE_CLOUD_ID }}

jobs:
PullRequestTests:
Expand Down
1 change: 1 addition & 0 deletions ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"libsodium-wrappers": "^0.7.15",
"lodash": "^4.17.21",
"mime-types": "^3.0.1",
"node-html-parser": "^7.0.1",
"notion-to-md": "^3.1.1",
"semver": "^7.6.3",
"to-title-case": "^1.0.0",
Expand Down
2 changes: 2 additions & 0 deletions ts/src/ActionsCatalogue/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { Log } from '../decorators/Logger';
import { Locales } from '../i18n/i18n-types';
import { PiecesAppCatalogue } from '../pieces/piecesCatalogue';
import { Debugger, DebugLevels } from '../utils/Debugger';
import confluence from '../apps/confluence';

if (process.env.TS_DEBUG) {
Debugger.level = DebugLevels.Verbose;
Expand All @@ -56,6 +57,7 @@ export interface IQoreApi {
}

const NEW_APPS = {
confluence,
zoom,
googleContacts,
googleDocs,
Expand Down
113 changes: 113 additions & 0 deletions ts/src/apps/confluence/allowed-paths/blogposts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import { TAllowedPaths } from '@qoretechnologies/ts-toolkit';
import { OpenAPIV2 } from 'openapi-types';
import { buildActionsFromSwaggerSchema } from '../../../global/helpers';
import confluence from '../../../schemas/confluence.swagger.json';
import { CONFLUENCE_APP_NAME } from '../constants';
import { confluencePaginationResponseConverter } from '../helpers/constants';
import { getConfluenceBlogpostIdAllowedValues } from '../helpers/get-blogpost-id-allowed-values';
import { getConfluenceLabelIdAllowedValues } from '../helpers/get-label-id-allowed-values';
import { getConfluenceSpaceIdAllowedValues } from '../helpers/get-space-id-allowed-values';

export const CONFLUENCE_BLOG_POSTS_ALLOWED_PATHS = {
'/blogposts': {
GET: {
override_options: {
'space-id': {
type: {
type: 'list',
element_type: 'softstring',
},
get_element_allowed_values: getConfluenceSpaceIdAllowedValues,
},
},
response_data_converter: confluencePaginationResponseConverter,
},
POST: {
override_options: {
spaceId: {
type: 'softstring',
get_allowed_values: getConfluenceSpaceIdAllowedValues,
},
title: {
required: true,
},
},
},
},
'/blogposts/{id}': {
GET: {
override_options: {
id: {
type: 'softstring',
get_allowed_values: getConfluenceBlogpostIdAllowedValues,
},
},
},
PUT: {
override_options: {
id: {
type: 'softstring',
get_allowed_values: getConfluenceBlogpostIdAllowedValues,
},
spaceId: {
type: 'softstring',
get_allowed_values: getConfluenceSpaceIdAllowedValues,
},
},
request_data_converter: (req) => {
const id = req?.query?.id;

return {
...req,
body: {
...req.body,
id,
},
};
},
},
DELETE: {
override_options: {
id: {
type: 'softstring',
get_allowed_values: getConfluenceBlogpostIdAllowedValues,
},
},
},
},
'/spaces/{id}/blogposts': {
GET: {
override_options: {
id: {
type: 'softstring',
get_allowed_values: getConfluenceSpaceIdAllowedValues,
},
},
response_data_converter: confluencePaginationResponseConverter,
},
},
'/labels/{id}/blogposts': {
GET: {
override_options: {
id: {
type: 'softstring',
get_allowed_values: getConfluenceLabelIdAllowedValues,
},
'space-id': {
type: {
type: 'list',
element_type: 'softstring',
},
get_element_allowed_values: getConfluenceSpaceIdAllowedValues,
},
},
response_data_converter: confluencePaginationResponseConverter,
},
},
} satisfies TAllowedPaths;

export const CONFLUENCE_BLOG_POSTS_ACTIONS = buildActionsFromSwaggerSchema({
schema: confluence as unknown as OpenAPIV2.Document,
allowedPaths: CONFLUENCE_BLOG_POSTS_ALLOWED_PATHS,
app: CONFLUENCE_APP_NAME,
});
12 changes: 12 additions & 0 deletions ts/src/apps/confluence/allowed-paths/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { IQorePartialAppActionWithSwaggerPath } from '@qoretechnologies/ts-toolkit';
import { CONFLUENCE_BLOG_POSTS_ACTIONS } from './blogposts';
import { CONFLUENCE_PAGES_ACTIONS } from './pages';
import { CONFLUENCE_SPACES_ACTIONS } from './spaces';
import { CONFLUENCE_TASKS_ACTIONS } from './tasks';

export const CONFLUENCE_ACTIONS = [
...CONFLUENCE_BLOG_POSTS_ACTIONS,
...CONFLUENCE_PAGES_ACTIONS,
...CONFLUENCE_SPACES_ACTIONS,
...CONFLUENCE_TASKS_ACTIONS,
] satisfies IQorePartialAppActionWithSwaggerPath[];
120 changes: 120 additions & 0 deletions ts/src/apps/confluence/allowed-paths/pages.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
import { TAllowedPaths } from '@qoretechnologies/ts-toolkit';
import { OpenAPIV2 } from 'openapi-types';
import { buildActionsFromSwaggerSchema } from '../../../global/helpers';
import confluence from '../../../schemas/confluence.swagger.json';
import { CONFLUENCE_APP_NAME } from '../constants';
import { getConfluencePageIdAllowedValues } from '../helpers/get-page-id-allowed-values';
import { getConfluenceSpaceIdAllowedValues } from '../helpers/get-space-id-allowed-values';
import { getConfluenceLabelIdAllowedValues } from '../helpers/get-label-id-allowed-values';
import { confluencePaginationResponseConverter } from '../helpers/constants';

export const CONFLUENCE_PAGES_ALLOWED_PATHS = {
'/pages': {
GET: {
override_options: {
'space-id': {
type: {
type: 'list',
element_type: 'softstring',
},
get_element_allowed_values: getConfluenceSpaceIdAllowedValues,
},
},
response_data_converter: confluencePaginationResponseConverter,
},
POST: {
override_options: {
spaceId: {
type: 'softstring',
get_allowed_values: getConfluenceSpaceIdAllowedValues,
},
parentId: {
type: 'softstring',
get_allowed_values: getConfluencePageIdAllowedValues,
},
title: {
required: true,
},
},
},
},
'/pages/{id}': {
GET: {
override_options: {
id: {
type: 'softstring',
get_allowed_values: getConfluencePageIdAllowedValues,
},
},
},
PUT: {
override_options: {
id: {
type: 'softstring',
get_allowed_values: getConfluencePageIdAllowedValues,
},
spaceId: {
type: 'softstring',
get_allowed_values: getConfluenceSpaceIdAllowedValues,
},
parentId: {
type: 'softstring',
get_allowed_values: getConfluencePageIdAllowedValues,
},
},
},
DELETE: {
override_options: {
id: {
type: 'softstring',
get_allowed_values: getConfluencePageIdAllowedValues,
},
},
},
},
'/pages/{id}/title': {
PUT: {
override_options: {
id: {
type: 'softstring',
get_allowed_values: getConfluencePageIdAllowedValues,
},
},
},
},
'/spaces/{id}/pages': {
GET: {
override_options: {
id: {
type: 'softstring',
get_allowed_values: getConfluenceSpaceIdAllowedValues,
},
},
response_data_converter: confluencePaginationResponseConverter,
},
},
'/labels/{id}/pages': {
GET: {
override_options: {
id: {
type: 'softstring',
get_allowed_values: getConfluenceLabelIdAllowedValues,
},
'space-id': {
type: {
type: 'list',
element_type: 'softstring',
},
get_element_allowed_values: getConfluenceSpaceIdAllowedValues,
},
},
response_data_converter: confluencePaginationResponseConverter,
},
},
} satisfies TAllowedPaths;

export const CONFLUENCE_PAGES_ACTIONS = buildActionsFromSwaggerSchema({
schema: confluence as unknown as OpenAPIV2.Document,
allowedPaths: CONFLUENCE_PAGES_ALLOWED_PATHS,
app: CONFLUENCE_APP_NAME,
});
39 changes: 39 additions & 0 deletions ts/src/apps/confluence/allowed-paths/spaces.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { TAllowedPaths } from '@qoretechnologies/ts-toolkit';
import { OpenAPIV2 } from 'openapi-types';
import { buildActionsFromSwaggerSchema } from '../../../global/helpers';
import confluence from '../../../schemas/confluence.swagger.json';
import { CONFLUENCE_APP_NAME } from '../constants';
import { getConfluenceLabelIdAllowedValues } from '../helpers/get-label-id-allowed-values';
import { getConfluenceSpaceIdAllowedValues } from '../helpers/get-space-id-allowed-values';
import { confluencePaginationResponseConverter } from '../helpers/constants';

export const CONFLUENCE_SPACES_ALLOWED_PATHS = {
'/spaces': {
GET: {
response_data_converter: confluencePaginationResponseConverter,
},
},
'/spaces/{id}': {
GET: {
override_options: {
id: {
type: 'softstring',
get_allowed_values: getConfluenceSpaceIdAllowedValues,
},
labels: {
type: {
type: 'list',
element_type: 'softstring',
},
get_element_allowed_values: getConfluenceLabelIdAllowedValues,
},
},
},
},
} satisfies TAllowedPaths;

export const CONFLUENCE_SPACES_ACTIONS = buildActionsFromSwaggerSchema({
schema: confluence as unknown as OpenAPIV2.Document,
allowedPaths: CONFLUENCE_SPACES_ALLOWED_PATHS,
app: CONFLUENCE_APP_NAME,
});
Loading
Loading