Platform
Resources
Pricing
Sign in
Get started
senritsu
Workspace
Fork
Public
By
senritsu
Edited
Oct 1, 2023
Importers
1 star
Insert cell
Insert cell
Insert cell
username
=
''
Insert cell
accessToken
=
''
Insert cell
domain
=
'https://gitlab.com'
Insert cell
async
function
fetchFromGitLabRaw
(
url
)
{
url
=
url
.
startsWith
(
'/'
)
?
`${
domain
}/api/v4${
url
}`
:
url
const
response
=
await
fetch
(
url
,
{
mode
:
'cors'
,
headers
:
{
'Authorization'
:
`Bearer ${
accessToken
}`
}
}
)
return
response
}
Insert cell
async
function
fetchFromGitLab
(
url
)
{
const
response
=
await
fetchFromGitLabRaw
(
url
)
return
await
response
.
json
(
)
}
Insert cell
async
function
fetchAllPagesFromGitLab
(
url
)
{
const
results
=
[
]
let
page
=
0
while
(
url
)
{
const
response
=
await
fetchFromGitLabRaw
(
url
)
const
data
=
await
response
.
json
(
)
results
.
push
(
...
data
)
url
=
parseLinkHeader
(
response
.
headers
.
get
(
'Link'
)
)
?.
next
?.
url
}
return
results
}
Insert cell
parseLinkHeader
=
require
(
'https://bundle.run/parse-link-header@2.0.0'
)
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
username
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
accessToken
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
domain
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
fetchFromGitLabRaw
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
fetchFromGitLab
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
fetchAllPagesFromGitLab
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
parseLinkHeader
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML