MCPcopy Create free account
hub / github.com/appium/appium / performApiRequest

Function performApiRequest

scripts/crowdin-common.mjs:54–75  ·  view source on GitHub ↗
(suffix = '', opts = {})

Source from the content-addressed store, hash-verified

52 * @returns {any}
53 */
54export async function performApiRequest(suffix = '', opts = {}) {
55 const {method = 'GET', payload, headers, params, isProjectSpecific = true} = opts;
56 const url = isProjectSpecific ? `${API_ROOT}/projects/${PROJECT_ID}${suffix}` : `${API_ROOT}${suffix}`;
57 log.debug(`Sending ${method} request to ${url}`);
58 if (util.isPlainObject(payload)) {
59 log.debug(`Request payload: ${JSON.stringify(payload)}`);
60 }
61 return (
62 await axios({
63 method,
64 headers: {
65 Authorization: `Bearer ${API_TOKEN}`,
66 'Content-Type': 'application/json',
67 'User-Agent': USER_AGENT,
68 ...headers,
69 },
70 url,
71 params,
72 data: payload,
73 })
74 ).data;
75}
76
77/**
78 * @typedef {Object} ApiRequestOptions

Callers 13

generateReportFunction · 0.90
checkReportStatusFunction · 0.90
downloadReportFunction · 0.90
getProjectInfoFunction · 0.90
addDirectoryFunction · 0.90
addFileFunction · 0.90
listFilesFunction · 0.90
deleteFileFunction · 0.90
listDirectoriesFunction · 0.90
addStorageFunction · 0.90
updateFilesFunction · 0.90
buildTranslationsFunction · 0.90

Calls 1

debugMethod · 0.65

Tested by

no test coverage detected