diff options
Diffstat (limited to 'app/assets/javascripts/api')
-rw-r--r-- | app/assets/javascripts/api/integrations_api.js | 21 | ||||
-rw-r--r-- | app/assets/javascripts/api/tags_api.js | 12 | ||||
-rw-r--r-- | app/assets/javascripts/api/user_api.js | 18 |
3 files changed, 51 insertions, 0 deletions
diff --git a/app/assets/javascripts/api/integrations_api.js b/app/assets/javascripts/api/integrations_api.js new file mode 100644 index 00000000000..692aae21a4f --- /dev/null +++ b/app/assets/javascripts/api/integrations_api.js @@ -0,0 +1,21 @@ +import axios from '../lib/utils/axios_utils'; +import { buildApiUrl } from './api_utils'; + +const JIRA_CONNECT_SUBSCRIPTIONS_PATH = '/api/:version/integrations/jira_connect/subscriptions'; + +export function addJiraConnectSubscription(namespacePath, { jwt, accessToken }) { + const url = buildApiUrl(JIRA_CONNECT_SUBSCRIPTIONS_PATH); + + return axios.post( + url, + { + jwt, + namespace_path: namespacePath, + }, + { + headers: { + Authorization: `Bearer ${accessToken}`, // eslint-disable-line @gitlab/require-i18n-strings + }, + }, + ); +} diff --git a/app/assets/javascripts/api/tags_api.js b/app/assets/javascripts/api/tags_api.js new file mode 100644 index 00000000000..d4ee247ade6 --- /dev/null +++ b/app/assets/javascripts/api/tags_api.js @@ -0,0 +1,12 @@ +import axios from '../lib/utils/axios_utils'; +import { buildApiUrl } from './api_utils'; + +const TAG_PATH = '/api/:version/projects/:id/repository/tags/:tag_name'; + +export function getTag(id, tagName) { + const url = buildApiUrl(TAG_PATH) + .replace(':id', encodeURIComponent(id)) + .replace(':tag_name', encodeURIComponent(tagName)); + + return axios.get(url); +} diff --git a/app/assets/javascripts/api/user_api.js b/app/assets/javascripts/api/user_api.js index 09995fad628..c362253f52e 100644 --- a/app/assets/javascripts/api/user_api.js +++ b/app/assets/javascripts/api/user_api.js @@ -10,6 +10,9 @@ const USER_PATH = '/api/:version/users/:id'; const USER_STATUS_PATH = '/api/:version/users/:id/status'; const USER_PROJECTS_PATH = '/api/:version/users/:id/projects'; const USER_POST_STATUS_PATH = '/api/:version/user/status'; +const USER_FOLLOW_PATH = '/api/:version/users/:id/follow'; +const USER_UNFOLLOW_PATH = '/api/:version/users/:id/unfollow'; +const CURRENT_USER_PATH = '/api/:version/user'; export function getUsers(query, options) { const url = buildApiUrl(USERS_PATH); @@ -69,3 +72,18 @@ export function updateUserStatus({ emoji, message, availability, clearStatusAfte clear_status_after: clearStatusAfter, }); } + +export function followUser(userId) { + const url = buildApiUrl(USER_FOLLOW_PATH).replace(':id', encodeURIComponent(userId)); + return axios.post(url); +} + +export function unfollowUser(userId) { + const url = buildApiUrl(USER_UNFOLLOW_PATH).replace(':id', encodeURIComponent(userId)); + return axios.post(url); +} + +export function getCurrentUser(options) { + const url = buildApiUrl(CURRENT_USER_PATH); + return axios.get(url, { ...options }); +} |