@arc-fusion/cli
Version:
CLI for running Arc Fusion on your local machine
72 lines (68 loc) • 1.81 kB
JavaScript
const axios = require('axios')
const { contentBase, accessToken } = require('../environment')
/**
* path:
* /photo/api/v2/settings:
* get:
* tags:
* - Photo Center Settings
* description: Photo Center settings
* responses:
* 200:
* description: returns object with global Photo Center settings such as default website
*/
const getPhotoSettings = async (req, res, next) => {
try {
const url = `${contentBase}/photo/api/v2/settings`
const options = accessToken && {
headers: {
Authorization: `Bearer ${accessToken}`
}
}
const photoSettings = await axios.get(url, options)
return res.status(200).send(photoSettings?.data)
} catch (error) {
console.error('INTEGRATION API ERROR: PHOTOS-SETTINGS-GET')
return res
.status(500)
.send({
message: error.message,
errorCode: 'errors.searchable.photoSettings.500'
})
}
}
/**
* path:
* /photo/api/v2/photos:
* get:
* tags:
* - Photo Center Photos List
* description: Photo Center Photos List
* responses:
* 200:
* description: returns array of photos from photo center
*/
const getPhotos = async (req, res, next) => {
try {
const url = contentBase && `${contentBase}/photo/api/v2/photos/`
const options = accessToken && {
headers: {
Authorization: `Bearer ${accessToken}`
}
}
const photos = await axios.get(url, options)
return res.status(200).send(photos?.data)
} catch (error) {
console.error('INTEGRATION API ERROR: PHOTOS-GET')
return res
.status(500)
.send({
message: error.message,
errorCode: 'errors.searchable.photoList.500'
})
}
}
module.exports = {
getPhotoSettings,
getPhotos
}