type Linkedin = {
token: string
apiVersion: string
}
export async function main(resource: Linkedin) {
const endpoint = 'https://api.linkedin.com/rest/me'
const response = await fetch(endpoint, {
method: 'GET',
headers: {
Authorization: `Bearer ${resource.token}`,
'LinkedIn-Version': `${resource.apiVersion}`,
'X-Restli-Protocol-Version': '2.0.0'
}
})
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`)
}
const data = await response.json()
return data
}
Submitted by hugo697 140 days ago
type Linkedin = {
token: string
apiVersion: string
}
export async function main(resource: Linkedin) {
const endpoint = 'https://api.linkedin.com/rest/me'
const response = await fetch(endpoint, {
method: 'GET',
headers: {
Authorization: `Bearer ${resource.token}`,
'LinkedIn-Version': `${resource.apiVersion}`,
'X-Restli-Protocol-Version': '2.0.0'
}
})
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`)
}
const data = await response.json()
return data
}
Submitted by hugo697 140 days ago