Skip to content

Commit 78feb5b

Browse files
committed
updated GraphQL examples
1 parent d9ae583 commit 78feb5b

File tree

1 file changed

+258
-2
lines changed

1 file changed

+258
-2
lines changed

docs/graphQL_examples.md

Lines changed: 258 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,73 @@
11
# GraphQL examples for testing
2-
## Exact segment type with specific data
3-
```GraphQL
2+
## 1. Segments
3+
### All Segments
4+
```graphql
5+
query AllSegments {
6+
segment_list {
7+
id
8+
name
9+
network_label
10+
status
11+
segment_type
12+
segment_type_display
13+
install_date
14+
termination_date
15+
comments
16+
}
17+
}
18+
```
19+
### Segment detail
20+
```graphql
21+
query SegmentDetails($id: ID!) {
22+
segment(id: $id) {
23+
id
24+
name
25+
network_label
26+
status
27+
segment_type
28+
segment_type_display
29+
provider {
30+
id
31+
name
32+
}
33+
provider_segment_id
34+
provider_segment_name
35+
provider_segment_contract
36+
site_a {
37+
id
38+
name
39+
}
40+
location_a {
41+
id
42+
name
43+
}
44+
site_b {
45+
id
46+
name
47+
}
48+
location_b {
49+
id
50+
name
51+
}
52+
type_specific_data
53+
has_type_specific_data
54+
has_path_data
55+
path_length_km
56+
path_source_format
57+
path_notes
58+
comments
59+
}
60+
}
61+
```
62+
Variable must be set
63+
```json
64+
{
65+
"id": 10
66+
}
67+
```
68+
69+
### Exact segment type with specific data
70+
```graphql
471
query DarkFiber {
572
segment_list(
673
filters: {
@@ -16,3 +83,192 @@ query DarkFiber {
1683
}
1784
}
1885
```
86+
### Complex filtering - Active dark fiber segments with path data
87+
```graphql
88+
query ActiveDarkFiberWithPaths {
89+
segment_list(
90+
filters: {
91+
segment_type: { exact: "dark_fiber" },
92+
status: { exact: "active" },
93+
has_path_data: true
94+
}
95+
) {
96+
id
97+
name
98+
segment_type_display
99+
has_path_data
100+
path_length_km
101+
path_source_format
102+
}
103+
}
104+
```
105+
### Segments with path geometry data
106+
Heavy load - with all paths in GeoJSON
107+
```graphql
108+
query SegmentsWithPaths {
109+
segment_list(
110+
filters: {
111+
has_path_data: true
112+
}
113+
) {
114+
id
115+
name
116+
has_path_data
117+
path_length_km
118+
path_coordinates
119+
path_bounds {
120+
xmin
121+
ymin
122+
xmax
123+
ymax
124+
}
125+
path_geometry_geojson
126+
}
127+
}
128+
```
129+
130+
## 2. Service paths
131+
### Get all service paths with their segments
132+
```graphql
133+
query AllServicePaths {
134+
service_path_list {
135+
id
136+
name
137+
status
138+
kind
139+
segments {
140+
id
141+
name
142+
segment_type
143+
status
144+
}
145+
comments
146+
}
147+
}
148+
```
149+
### Get a specific service path with detailed segment information
150+
```graphql
151+
query ServicePathDetails($id: ID!) {
152+
service_path(id: $id) {
153+
id
154+
name
155+
status
156+
kind
157+
segments {
158+
id
159+
name
160+
segment_type
161+
segment_type_display
162+
provider {
163+
name
164+
}
165+
site_a {
166+
name
167+
}
168+
site_b {
169+
name
170+
}
171+
path_length_km
172+
has_path_data
173+
}
174+
comments
175+
}
176+
}
177+
```
178+
Variable must be set
179+
```json
180+
{
181+
"id": 10
182+
}
183+
```
184+
### Filtering - active core service paths
185+
```graphql
186+
query ActiveCore {
187+
service_path_list(
188+
filters: {
189+
status: { exact: "active" },
190+
kind: { exact: "core" }
191+
}
192+
) {
193+
id
194+
name
195+
status
196+
kind
197+
segments {
198+
id
199+
name
200+
}
201+
}
202+
}
203+
```
204+
## 3. Circuit Mapping
205+
### Get all segment-circuit mappings
206+
```graphql
207+
query SegmentCircuitMappings {
208+
segment_circuit_mapping_list {
209+
id
210+
segment {
211+
id
212+
name
213+
segment_type
214+
}
215+
circuit {
216+
id
217+
cid
218+
provider {
219+
name
220+
}
221+
}
222+
}
223+
}
224+
```
225+
### Get circuits for a specific segment
226+
```graphql
227+
query CircuitsForSegment($segmentId: ID!) {
228+
segment_circuit_mapping_list(
229+
filters: {
230+
segment: { id: $segmentId }
231+
}
232+
) {
233+
id
234+
circuit {
235+
id
236+
cid
237+
provider {
238+
name
239+
}
240+
status
241+
}
242+
}
243+
}
244+
```
245+
Variable must be set
246+
```json
247+
{
248+
"segmentId": 10
249+
}
250+
```
251+
### Get segments for a specific circuit
252+
```graphql
253+
query SegmentsForCircuit($circuitId: ID!) {
254+
segment_circuit_mapping_list(
255+
filters: {
256+
circuit: { id: $circuitId }
257+
}
258+
) {
259+
id
260+
segment {
261+
id
262+
name
263+
segment_type
264+
status
265+
}
266+
}
267+
}
268+
```
269+
Variable must be set
270+
```json
271+
{
272+
"circuitId": 10
273+
}
274+
```

0 commit comments

Comments
 (0)