Skip to content
This repository was archived by the owner on Sep 29, 2023. It is now read-only.

Commit d53849d

Browse files
authored
Merge pull request #310 from appwrite/fix-graphql
Fix graphql doc errors
2 parents 71a9c57 + 20f8b4c commit d53849d

File tree

4 files changed

+29
-81
lines changed

4 files changed

+29
-81
lines changed

app/views/docs/authentication.phtml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -591,9 +591,8 @@ let session = try await account.createEmailSession(
591591
<li>
592592
<h3>GraphQL</h3>
593593
<div class="ide" data-lang="graphql" data-lang-label="GraphQL">
594-
<pre class="line-numbers"><code class="prism language-graphql" data-prism>
595-
mutation {
596-
accountCreateEmailSession(userId: "unique()", email: "[email protected]", password: "password") {
594+
<pre class="line-numbers"><code class="prism language-graphql" data-prism>mutation {
595+
accountCreateEmailSession(email: "[email protected]", password: "password") {
597596
_id
598597
userId
599598
provider
@@ -676,8 +675,7 @@ let session = try await account.get()</code></pre>
676675
<li>
677676
<h3>GraphQL</h3>
678677
<div class="ide" data-lang="graphql" data-lang-label="GraphQL">
679-
<pre class="line-numbers"><code class="prism language-graphql" data-prism>
680-
query {
678+
<pre class="line-numbers"><code class="prism language-graphql" data-prism>query {
681679
accountGet {
682680
_id
683681
email

app/views/docs/databases.phtml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,12 @@ func main() async throws {
213213
documentId: "[DOCUMENT_ID]",
214214
data: "{}"
215215
) {
216-
id
217-
collectionId
218-
databaseId
219-
createdAt
220-
updatedAt
221-
permissions
216+
_id
217+
_collectionId
218+
_databaseId
219+
_createdAt
220+
_updatedAt
221+
_permissions
222222
data
223223
}
224224
}</code></pre>
@@ -357,7 +357,7 @@ func main() async throws{
357357
) {
358358
total
359359
documents {
360-
id
360+
_id
361361
data
362362
}
363363
}
@@ -562,7 +562,7 @@ func main() async throws {
562562
) {
563563
total
564564
documents {
565-
id
565+
_id
566566
data
567567
}
568568
}
@@ -722,7 +722,7 @@ func main() async throws {
722722
) {
723723
total
724724
documents {
725-
id
725+
_id
726726
data
727727
}
728728
}
@@ -849,7 +849,7 @@ func main() async throws {
849849
) {
850850
total
851851
documents {
852-
id
852+
_id
853853
data
854854
}
855855
}

app/views/docs/functions.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ func main() async throws {
622622
<div class="ide margin-bottom" data-lang="graphql" data-lang-label="GraphQL">
623623
<pre class="line-numbers"><code class="prism language-graphql" data-prism>mutation {
624624
functionsCreateExecution(functionId: "[FUNCTION_ID]") {
625-
id
625+
_id
626626
statusCode
627627
response
628628
stdout

app/views/docs/graphql.phtml

Lines changed: 15 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@
6161
</tbody>
6262
</table>
6363

64+
<div class="notice">
65+
<h2>GraphQL Model Parameters</h2>
66+
67+
<p>In Appwrite's GraphQL API, all internal model parameters are prefixed with <code>_</code> instead of <code>$</code> because <code>$</code> is reserved by GraphQL.</p>
68+
69+
<p>For example, <code>$collectionId</code> in the REST API would be referenced as <code>_collectionId</code> in the GraphQL API.</p>
70+
71+
</div>
72+
73+
6474
<h3><a href="/docs/graphql#get-requests" id="get-requests">GET Requests</a></h3>
6575

6676
<p>You can execute a GraphQL query via a GET request, passing a <code>query</code> and optionally <code>operationName</code> and <code>variables</code> as query parameters.</p>
@@ -105,6 +115,7 @@
105115
<div class="ide margin-bottom" data-lang="graphql" data-lang-label="GraphQL">
106116
<pre class="line-numbers"><code class="prism language-graphql" data-prism>query GetAccount {
107117
accountGet {
118+
_id
108119
email
109120
}
110121
}</code></pre></div>
@@ -214,6 +225,7 @@
214225
<div class="ide margin-bottom" data-lang="graphql" data-lang-label="GraphQL">
215226
<pre class="line-numbers"><code class="prism language-graphql" data-prism>query GetAccount {
216227
accountGet {
228+
_id
217229
email
218230
}
219231
}</code></pre></div>
@@ -224,6 +236,7 @@
224236
<pre class="line-numbers"><code class="prism language-json" data-prism>{
225237
"data": {
226238
"accountGet": {
239+
"_id": "...",
227240
"email": "..."
228241
}
229242
}
@@ -238,6 +251,7 @@
238251
<div class="ide margin-bottom" data-lang="graphql" data-lang-label="GraphQL">
239252
<pre class="line-numbers"><code class="prism language-graphql" data-prism>query GetAccountAndLocale {
240253
accountGet {
254+
_id
241255
email
242256
}
243257
localeGet {
@@ -251,6 +265,7 @@
251265
<pre class="line-numbers"><code class="prism language-json" data-prism>{
252266
"data": {
253267
"accountGet": {
268+
"_id": "...",
254269
"email": "..."
255270
},
256271
"localeGet": {
@@ -296,71 +311,6 @@
296311

297312
<p>This allows you to execute complex actions in a single network request.</p>
298313

299-
<!--<h3><a href="/docs/graphql#databases-integration" id="query-batching">Databases Integration</a></h3>-->
300-
<!---->
301-
<!--<p>The Appwrite GraphQL API integrates directly into your project's database's collections, providing a more convenient way to manipulate your collections.</p>-->
302-
<!---->
303-
<!--<p>For example, given a project with a collection with ID <b>movies</b>, with attributes <b>name</b> and <b>length</b>, of types <b>string</b> and <b>integer</b> respectively; the following queries could be executed:</p>-->
304-
<!---->
305-
<!--<ul class="phases clear" data-ui-phases>-->
306-
<!-- <li>-->
307-
<!-- <h3>Create</h3>-->
308-
<!-- <div class="ide margin-bottom" data-lang="graphql" data-lang-label="GraphQL">-->
309-
<!-- <pre class="line-numbers"><code class="prism language-graphql" data-prism>mutation CreateMovie($name: String!, $length: Int!) {-->
310-
<!-- moviesCreate(name: $name, length: $length) {-->
311-
<!-- _id-->
312-
<!-- name-->
313-
<!-- length-->
314-
<!-- }-->
315-
<!--}</code></pre>-->
316-
<!-- </div>-->
317-
<!-- </li>-->
318-
<!-- <li>-->
319-
<!-- <h3>List</h3>-->
320-
<!-- <div class="ide margin-bottom" data-lang="graphql" data-lang-label="GraphQL">-->
321-
<!-- <pre class="line-numbers"><code class="prism language-graphql" data-prism>query ListMovies($limit: Int, $offset: Int, cursor: String, cursorDirection: String, orderAttributes: [String!], orderTypes: [String!]) {-->
322-
<!-- moviesList(limit: $limit, offset: $offset, cursor: $cursor, cursorDirection: $cursorDirection, orderAttributes: $orderAttributes, orderTypes: $orderType) {-->
323-
<!-- _id-->
324-
<!-- name-->
325-
<!-- length-->
326-
<!-- }-->
327-
<!--}</code></pre>-->
328-
<!-- </div>-->
329-
<!-- </li>-->
330-
<!-- <li>-->
331-
<!-- <h3>Get</h3>-->
332-
<!-- <div class="ide margin-bottom" data-lang="graphql" data-lang-label="GraphQL">-->
333-
<!-- <pre class="line-numbers"><code class="prism language-graphql" data-prism>query GetMovie($id: String!) {-->
334-
<!-- moviesGet(id: $id) {-->
335-
<!-- _id-->
336-
<!-- name-->
337-
<!-- length-->
338-
<!-- }-->
339-
<!--}</code></pre>-->
340-
<!-- </div>-->
341-
<!-- </li>-->
342-
<!-- <li>-->
343-
<!-- <h3>Update</h3>-->
344-
<!-- <div class="ide margin-bottom" data-lang="graphql" data-lang-label="GraphQL">-->
345-
<!-- <pre class="line-numbers"><code class="prism language-graphql" data-prism>mutation UpdateMovie {-->
346-
<!-- moviesUpdate(name: $name, length: $length) {-->
347-
<!-- _id-->
348-
<!-- name-->
349-
<!-- length-->
350-
<!-- }-->
351-
<!--}</code></pre>-->
352-
<!-- </div>-->
353-
<!-- </li>-->
354-
<!-- <li>-->
355-
<!-- <h3>Delete</h3>-->
356-
<!-- <div class="ide margin-bottom" data-lang="graphql" data-lang-label="GraphQL">-->
357-
<!-- <pre class="line-numbers"><code class="prism language-graphql" data-prism>mutation DeleteMovie($id: String!) {-->
358-
<!-- moviesDelete(id: $id)-->
359-
<!--}</code></pre>-->
360-
<!-- </div>-->
361-
<!-- </li>-->
362-
<!--</ul>-->
363-
364314
<h3><a href="/docs/graphql#sdk-usage" id="sdk-usage">SDK Usage</a></h3>
365315

366316
<p>Appwrite SDKs also support GraphQL in addition to the REST services.</p>

0 commit comments

Comments
 (0)