@@ -11,51 +11,66 @@ A fast and modern graphql client designed with simplicity in mind.
1111
1212## Quick Start
1313
14- ``` python
15- from qlient import Client, Fields
14+ ```` python
15+ from qlient import Client
1616
1717client = Client(" https://api.spacex.land/graphql/" )
1818
19- mission_fields = Fields(" mission_id" , " mission_name" )
20- rocket_fields = Fields(" rocket_name" , fairings = " ship" )
19+ res = client.query.launchesPast(
20+ # spacex graphql input fields
21+ find = {" mission_name" : " Starlink" },
22+ limit = 5 ,
23+ sort = " mission_name" ,
2124
22- result = client.query.launchesPast(
23- limit = 3 ,
24- _fields = Fields(mission_fields, rocket = rocket_fields)
25+ # qlient specific
26+ _fields = [" mission_name" , " launch_success" , " launch_year" ]
2527)
26- print (result)
28+ ````
29+
30+ which sends the following query
31+
32+ ``` gql
33+ query launchesPast ($find : LaunchFind , $limit : Int , $sort : String ) {
34+ launchesPast (find : $find , limit : $limit , sort : $sort ) {
35+ mission_name
36+ launch_success
37+ launch_year
38+ }
39+ }
2740```
2841
29- ``` json
42+ to the server and return this body:
43+
44+ ```` json
3045{
3146 "data" : {
3247 "launchesPast" : [
3348 {
34- "mission_name" : " Starlink-15 (v1.0)" ,
35- "rocket" : {
36- "rocket_name" : " Falcon 9" ,
37- "fairings" : {
38- "ship" : " GOMSCHIEF"
39- }
40- }
49+ "mission_name" : " Paz / Starlink Demo" ,
50+ "launch_success" : true ,
51+ "launch_year" : " 2018"
52+ },
53+ {
54+ "mission_name" : " Starlink 1" ,
55+ "launch_success" : true ,
56+ "launch_year" : " 2019"
57+ },
58+ {
59+ "mission_name" : " Starlink 2" ,
60+ "launch_success" : true ,
61+ "launch_year" : " 2020"
4162 },
4263 {
43- "mission_name" : " Sentinel-6 Michael Freilich" ,
44- "rocket" : {
45- "rocket_name" : " Falcon 9" ,
46- "fairings" : {
47- "ship" : null
48- }
49- }
64+ "mission_name" : " Starlink 3" ,
65+ "launch_success" : true ,
66+ "launch_year" : " 2020"
5067 },
5168 {
52- "mission_name" : " Crew-1" ,
53- "rocket" : {
54- "rocket_name" : " Falcon 9" ,
55- "fairings" : null
56- }
69+ "mission_name" : " Starlink 4" ,
70+ "launch_success" : true ,
71+ "launch_year" : " 2020"
5772 }
5873 ]
5974 }
6075}
61- ```
76+ ````
0 commit comments