Skip to content

Commit

Permalink
wire in confluence v1 client
Browse files Browse the repository at this point in the history
  • Loading branch information
viqueen committed Nov 30, 2024
1 parent a0cd7ba commit 7ba735f
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 1 deletion.
28 changes: 28 additions & 0 deletions modules/apis/confluence-v1/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Copyright 2024 Hasnae Rehioui
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type { AxiosInstance } from 'axios';

import { contentApiV1, ContentApiV1 } from './content-api';

interface ConfluenceApiV1 {
contentApi: ContentApiV1;
}

const confluenceApiV1 = (client: AxiosInstance): ConfluenceApiV1 => ({
contentApi: contentApiV1(client)
});

export { confluenceApiV1 };
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
* limitations under the License.
*/
export * from './types';
export * from './api';
File renamed without changes.
2 changes: 1 addition & 1 deletion modules/apis/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
* limitations under the License.
*/
export * from './confluence';
export * from './confluence-cloud';
export * from './confluence-v1';
37 changes: 37 additions & 0 deletions modules/cli/clients/confluence-v1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Copyright 2024 Hasnae Rehioui
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import axios from 'axios';

import { confluenceApiV1 } from '../../apis';
import { environment } from '../conf';

const confluenceV1Client = () => {
const siteName = environment.CONFLUENCE_SITE_NAME;
const username = environment.CONFLUENCE_USERNAME;
const apiToken = environment.CONFLUENCE_API_TOKEN;
return confluenceApiV1(
axios.create({
baseURL: `https://${siteName}`,
auth: {
username,
password: apiToken
}
})
);
};

const confluenceV1 = confluenceV1Client();
export { confluenceV1 };

0 comments on commit 7ba735f

Please sign in to comment.