@@ -28,99 +28,110 @@ The APIs in the `dgraph` namespace are below, organized by category.
2828
2929### Functions
3030
31- #### execute
31+ #### alterSchema
3232
33- Execute a Dgraph query or mutation using a Dgraph Request object .
33+ Alter the schema of a Dgraph database .
3434
3535``` ts
36- function execute( connectionName : string , request : Request ): Response
36+ function alterSchema( connection : string , schema : string ): string
3737```
3838
39- < ResponseField name = " connectionName " type = " string" required >
39+ < ResponseField name = " connection " type = " string" required >
4040 Name of the connection , as [defined in the
41- manifest ](../.. /app -manifest #connections ).
41+ manifest ](/ modus /app -manifest #connections ).
4242< / ResponseField >
4343
44- < ResponseField name = " request" type = " Request" required >
45- A Dgraph [` Request ` ](#request ) object , describing the query or mutation to
46- execute .
44+ < ResponseField name = " schema" type = " string" required >
45+ The schema to apply to the Dgraph database .
4746< / ResponseField >
4847
49- #### alterSchema
48+ #### dropAll
5049
51- Alter the schema of a Dgraph database .
50+ Drop all data from a Dgraph database .
5251
5352` ` ` ts
54- function alterSchema(connectionName: string, schema : string): string
53+ function dropAll(connection : string): string
5554` ` `
5655
57- < ResponseField name = " connectionName " type = " string" required >
56+ < ResponseField name = " connection " type = " string" required >
5857 Name of the connection , as [defined in the
59- manifest ](../../app -manifest #connections ).
60- < / ResponseField >
61-
62- < ResponseField name = " schema" type = " string" required >
63- The schema to apply to the Dgraph database .
58+ manifest ](/modus /app -manifest #connections ).
6459< / ResponseField >
6560
6661#### dropAttr
6762
6863Drop an attribute from a Dgraph schema .
6964
7065` ` ` ts
71- function dropAttr(connectionName : string, attr: string): string
66+ function dropAttr(connection : string, attr: string): string
7267` ` `
7368
74- < ResponseField name = " connectionName " type = " string" required >
69+ < ResponseField name = " connection " type = " string" required >
7570 Name of the connection , as [defined in the
76- manifest ](../.. /app -manifest #connections ).
71+ manifest ](/ modus /app -manifest #connections ).
7772< / ResponseField >
7873
7974< ResponseField name = " attr" type = " string" required >
8075 The attribute to drop from the Dgraph schema .
8176< / ResponseField >
8277
83- #### dropAll
78+ #### execute
8479
85- Drop all data from a Dgraph database .
80+ Execute a Dgraph query or mutation using a Dgraph Request object .
8681
8782` ` ` ts
88- function dropAll(connectionName : string): string
83+ function execute(connection : string, request: Request ): Response
8984` ` `
9085
91- < ResponseField name = " connectionName " type = " string" required >
86+ < ResponseField name = " connection " type = " string" required >
9287 Name of the connection , as [defined in the
93- manifest ](../../app -manifest #connections ).
88+ manifest ](/modus /app -manifest #connections ).
89+ < / ResponseField >
90+
91+ < ResponseField name = " request" type = " Request" required >
92+ A Dgraph [` Request ` ](#request ) object , describing the query or mutation to
93+ execute .
9494< / ResponseField >
9595
96- ### Objects
96+ ### Types
9797
98- #### Request
98+ #### Mutation
9999
100- A Dgraph request object , used to execute queries and mutations .
100+ A Dgraph mutation object , used to execute mutations .
101101
102102` ` ` ts
103- class Request {
104- constructor(Query: Query | null = null, Mutations: Mutation[] | null = null)
105- query: Query = new Query()
106- mutations: Mutation[] = []
103+ class Mutation {
104+ setJson: string,
105+ delJson: string,
106+ setNquads: string,
107+ delNquads: string,
108+ condition: string,
107109}
108110` ` `
109111
110- < ResponseField name = " new dgraph.Request(query, mutations)" >
111- Creates a new ` Request ` object with the given ` query ` and ` mutations ` .
112+ < ResponseField name = " new dgraph.Mutation(setJson, delJson, setNquads, delNquads, condition)" >
113+ Creates a new ` Mutation ` object with the given ` setJson ` , ` delJson ` ,
114+ ` setNquads ` , ` delNquads ` , and ` condition ` fields .
115+ < / ResponseField >
112116
113- The [` query ` ](#query ) and [` mutations ` ](#mutation ) fields are optional and
114- default to ` null ` .
117+ < ResponseField name = " setJson" type = " string" >
118+ A JSON string representing the data to set in the mutation .
119+ < / ResponseField >
115120
121+ < ResponseField name = " delJson" type = " string" >
122+ A JSON string representing the data to delete in the mutation .
116123< / ResponseField >
117124
118- < ResponseField name = " query " type = " Query " >
119- A Dgraph [ ` query ` ](# query ) object .
125+ < ResponseField name = " setNquads " type = " string " >
126+ A string representing the data to set in the mutation in NQuads format .
120127< / ResponseField >
121128
122- < ResponseField name = " mutations" type = " Mutation[]" >
123- An array of Dgraph [` mutation ` ](#mutation ) objects .
129+ < ResponseField name = " delNquads" type = " string" >
130+ A string representing the data to delete in the mutation in NQuads format .
131+ < / ResponseField >
132+
133+ < ResponseField name = " condition" type = " string" >
134+ A string representing the condition query for the mutation .
124135< / ResponseField >
125136
126137#### Query
@@ -129,7 +140,6 @@ A Dgraph query object, used to execute queries.
129140
130141` ` ` ts
131142class Query {
132- constructor(query: string = "", variables: Variables = new Variables())
133143 query: string = ""
134144 variables: Map<string, string> = new Map<string, string>()
135145}
@@ -149,63 +159,50 @@ class Query {
149159 A map of query variables .
150160< / ResponseField >
151161
152- #### Variables
162+ #### Request
153163
154- A Variables object used to set query variables in a Dgraph query .
164+ A Dgraph request object , used to execute queries and mutations .
155165
156166` ` ` ts
157- class Variables {
158- public set<T>(name: string, value: T): void
159- public toMap(): Map<string, string>
167+ class Request {
168+ query: Query = new Query()
169+ mutations: Mutation[] = []
160170}
161171` ` `
162172
163- < ResponseField name = " Variables.set(name, value)" >
164- Sets a query variable with the given ` name ` and ` value ` . ` name ` is of type
165- ` string ` , and ` value ` can be of any type .
166- < / ResponseField >
167-
168- < ResponseField name = " Variables.toMap()" >
169- Returns a map of all query variables set in the ` Variables ` object .
170- < / ResponseField >
173+ < ResponseField name = " new dgraph.Request(query, mutations)" >
171174
172- #### Mutation
175+ Creates a new ` Request ` object with the given ` query ` and ` mutations ` .
173176
174- A Dgraph mutation object , used to execute mutations .
175-
176- ` ` ` ts
177- class Mutation {
178- constructor(
179- public setJson: string = "",
180- public delJson: string = "",
181- public setNquads: string = "",
182- public delNquads: string = "",
183- public condition: string = "",
184- )
185- }
186- ` ` `
177+ The [` query ` ](#query ) and [` mutations ` ](#mutation ) fields are optional and
178+ default to ` null ` .
187179
188- < ResponseField name = " new dgraph.Mutation(setJson, delJson, setNquads, delNquads, condition)" >
189- Creates a new ` Mutation ` object with the given ` setJson ` , ` delJson ` ,
190- ` setNquads ` , ` delNquads ` , and ` condition ` fields .
191180< / ResponseField >
192181
193- < ResponseField name = " setJson " type = " string " >
194- A JSON string representing the data to set in the mutation .
182+ < ResponseField name = " query " type = " Query " >
183+ A Dgraph [ ` query ` ](# query ) object .
195184< / ResponseField >
196185
197- < ResponseField name = " delJson " type = " string " >
198- A JSON string representing the data to delete in the mutation .
186+ < ResponseField name = " mutations " type = " Mutation[] " >
187+ An array of Dgraph [ ` mutation ` ](# mutation ) objects .
199188< / ResponseField >
200189
201- < ResponseField name = " setNquads" type = " string" >
202- A string representing the data to set in the mutation in NQuads format .
203- < / ResponseField >
190+ #### Variables
204191
205- < ResponseField name = " delNquads" type = " string" >
206- A string representing the data to delete in the mutation in NQuads format .
192+ A Variables object used to set query variables in a Dgraph query .
193+
194+ ` ` ` ts
195+ class Variables {
196+ set<T>(name: string, value: T): void
197+ toMap(): Map<string, string>
198+ }
199+ ` ` `
200+
201+ < ResponseField name = " Variables.set(name, value)" >
202+ Sets a query variable with the given ` name ` and ` value ` . ` name ` is of type
203+ ` string ` , and ` value ` can be of any type .
207204< / ResponseField >
208205
209- < ResponseField name = " condition " type = " string " >
210- A string representing the condition query for the mutation .
206+ < ResponseField name = " Variables.toMap() " >
207+ Returns a map of all query variables set in the ` Variables ` object .
211208< / ResponseField >
0 commit comments