Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
api_client
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
api_client
Merge requests
!115
Scaffolding for Graphql client
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Scaffolding for Graphql client
issue/api_client-3373029:graphql-client
into
canary
Overview
2
Commits
5
Pipelines
3
Changes
26
All threads resolved!
Hide all comments
Merged
Brian Perry
requested to merge
issue/api_client-3373029:graphql-client
into
canary
1 year ago
Overview
2
Commits
5
Pipelines
3
Changes
26
All threads resolved!
Hide all comments
Expand
0
0
Merge request reports
Compare
canary
version 2
bddb73a5
1 year ago
version 1
6a0abf64
1 year ago
canary (base)
and
latest version
latest version
6349b0dc
5 commits,
1 year ago
version 2
bddb73a5
4 commits,
1 year ago
version 1
6a0abf64
4 commits,
1 year ago
26 files
+
482
−
45
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
26
Search (e.g. *.vue) (Ctrl+P)
examples/graphql-client/src/main.ts
0 → 100644
+
31
−
0
Options
import
{
GraphqlClient
}
from
"
@drupal-api-client/graphql-client
"
;
const
baseUrl
=
import
.
meta
.
env
.
VITE_BASE_URL
?
import
.
meta
.
env
.
VITE_BASE_URL
:
"
https://dev-drupal-api-client-poc.pantheonsite.io
"
;
async
function
main
()
{
const
graphqlClient
=
new
GraphqlClient
(
baseUrl
,
{
authentication
:
{
type
:
"
Basic
"
,
credentials
:
{
username
:
import
.
meta
.
env
.
VITE_USERNAME
,
password
:
import
.
meta
.
env
.
VITE_PASSWORD
,
},
},
});
const
query
=
await
graphqlClient
.
query
(
`query GetArticles {
nodeArticles(first: 10) {
nodes {
title
}
}
}`
,
);
document
.
querySelector
<
HTMLDivElement
>
(
"
#app
"
)
!
.
innerHTML
=
`
<pre>
${
JSON
.
stringify
(
query
,
null
,
2
)}
</pre>`
;
}
main
();
Loading