Files
developer.sailpoint.com/src/services/DiscourseService.js
2023-05-31 16:08:11 -05:00

88 lines
1.9 KiB
JavaScript

export async function getTopPosts() {
try {
const response = await fetch(
'https://developer.sailpoint.com/discuss/top.json',
);
return await response.json();
} catch (error) {
return [];
}
}
export async function getBlogPosts(tags) {
let url = ''
if (tags) {
url = 'https://developer.sailpoint.com/discuss/search.json?q=category:blog+tags:' + tags
} else {
url = 'https://developer.sailpoint.com/discuss/search.json?q=category:blog'
}
try {
const response = await fetch(
url,
);
return await response.json();
} catch (error) {
return [];
}
}
export async function getMarketplacePosts(tags) {
let url = ''
if (tags) {
url = 'https://developer.identitysoon.com/discuss/search.json?q=category:show-and-tell+tags:' + tags
} else {
url = 'https://developer.identitysoon.com/discuss/search.json?q=category:show-and-tell'
}
try {
const response = await fetch(
url,
);
return await response.json();
} catch (error) {
return [];
}
}
export async function getTopic(id) {
try {
const response = await fetch(
'https://developer.sailpoint.com/discuss/t/' + id + '.json',
);
return await response.json();
} catch (error) {
return [];
}
}
export async function getMarketplaceTopic(id) {
try {
const response = await fetch(
'https://developer.identitysoon.com/discuss/t/' + id + '.json',
);
return await response.json();
} catch (error) {
return [];
}
}
export async function getMarketplaceTopicRaw(id) {
try {
const response = await fetch(
'https://developer.identitysoon.com/discuss/raw/' + id + '.json',
);
return await response.text();
} catch (error) {
return [];
}
}
export async function getTags() {
try {
const response = await fetch(
'https://developer.sailpoint.com/discuss/tags.json',
);
return await response.json();
} catch (error) {
return [];
}
}