vscode-apollo 2.5.6 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/config.yml +17 -0
- package/.github/workflows/E2E.yml +3 -2
- package/.github/workflows/build-prs.yml +2 -1
- package/.prettierignore +3 -0
- package/.semgrepignore +2 -0
- package/.vscode/settings.json +7 -2
- package/CHANGELOG.md +6 -0
- package/apollo.connectors.mapping.configuration.json +10 -0
- package/package.json +37 -3
- package/sampleWorkspace/connectors-community/.github/ISSUE_TEMPLATE/connector-bug-report.md +36 -0
- package/sampleWorkspace/connectors-community/.github/ISSUE_TEMPLATE/new-connector.md +10 -0
- package/sampleWorkspace/connectors-community/.github/renovate.json5 +3 -0
- package/sampleWorkspace/connectors-community/.vscode/extensions.json +3 -0
- package/sampleWorkspace/connectors-community/.vscode/settings.json +13 -0
- package/sampleWorkspace/connectors-community/.vscode/tasks.json +10 -0
- package/sampleWorkspace/connectors-community/README.md +108 -0
- package/sampleWorkspace/connectors-community/apollo.config.json +5 -0
- package/sampleWorkspace/connectors-community/connectors/.template/Dockerfile +5 -0
- package/sampleWorkspace/connectors-community/connectors/.template/README +46 -0
- package/sampleWorkspace/connectors-community/connectors/.template/connector.graphql +31 -0
- package/sampleWorkspace/connectors-community/connectors/.template/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/.template/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/JSONPlaceholder/README +12 -0
- package/sampleWorkspace/connectors-community/connectors/JSONPlaceholder/albums.graphql +48 -0
- package/sampleWorkspace/connectors-community/connectors/JSONPlaceholder/comments.graphql +54 -0
- package/sampleWorkspace/connectors-community/connectors/JSONPlaceholder/photos.graphql +54 -0
- package/sampleWorkspace/connectors-community/connectors/JSONPlaceholder/posts.graphql +51 -0
- package/sampleWorkspace/connectors-community/connectors/JSONPlaceholder/supergraph.yaml +26 -0
- package/sampleWorkspace/connectors-community/connectors/JSONPlaceholder/todos.graphql +51 -0
- package/sampleWorkspace/connectors-community/connectors/JSONPlaceholder/users.graphql +80 -0
- package/sampleWorkspace/connectors-community/connectors/TM-Forum/README.md +9 -0
- package/sampleWorkspace/connectors-community/connectors/TM-Forum/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/TM-Forum/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/TM-Forum/tmf622-ProductOrdering.graphql +296 -0
- package/sampleWorkspace/connectors-community/connectors/adobe-commerce-cloud/README.md +7 -0
- package/sampleWorkspace/connectors-community/connectors/adobe-commerce-cloud/addresses.graphql +30 -0
- package/sampleWorkspace/connectors-community/connectors/adobe-commerce-cloud/customer.graphql +77 -0
- package/sampleWorkspace/connectors-community/connectors/adobe-commerce-cloud/products.graphql +70 -0
- package/sampleWorkspace/connectors-community/connectors/adobe-commerce-cloud/router.yaml +24 -0
- package/sampleWorkspace/connectors-community/connectors/adobe-commerce-cloud/supergraph.yaml +14 -0
- package/sampleWorkspace/connectors-community/connectors/adobe-commerce-cloud/swagger.json +69226 -0
- package/sampleWorkspace/connectors-community/connectors/anthropic/Dockerfile +5 -0
- package/sampleWorkspace/connectors-community/connectors/anthropic/README +61 -0
- package/sampleWorkspace/connectors-community/connectors/anthropic/messages.graphql +258 -0
- package/sampleWorkspace/connectors-community/connectors/anthropic/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/anthropic/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/apollo-ecomm-simple/README +3 -0
- package/sampleWorkspace/connectors-community/connectors/apollo-ecomm-simple/connector.graphql +38 -0
- package/sampleWorkspace/connectors-community/connectors/apollo-ecomm-simple/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/apollo-ecomm-simple/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/apple/README +36 -0
- package/sampleWorkspace/connectors-community/connectors/apple/app-store-connect.graphql +100 -0
- package/sampleWorkspace/connectors-community/connectors/apple/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/apple/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/aws/README +125 -0
- package/sampleWorkspace/connectors-community/connectors/aws/dynamodb.graphql +130 -0
- package/sampleWorkspace/connectors-community/connectors/aws/json-responses/product-price.json +10 -0
- package/sampleWorkspace/connectors-community/connectors/aws/json-responses/products.json +53 -0
- package/sampleWorkspace/connectors-community/connectors/aws/lambda.graphql +179 -0
- package/sampleWorkspace/connectors-community/connectors/aws/router.yaml +54 -0
- package/sampleWorkspace/connectors-community/connectors/aws/supergraph.yaml +10 -0
- package/sampleWorkspace/connectors-community/connectors/bored/README.md +35 -0
- package/sampleWorkspace/connectors-community/connectors/bored/bored.graphql +87 -0
- package/sampleWorkspace/connectors-community/connectors/bored/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/common-room/README.md +23 -0
- package/sampleWorkspace/connectors-community/connectors/common-room/contacts.graphql +141 -0
- package/sampleWorkspace/connectors-community/connectors/common-room/json-responses/members_email_.json +61 -0
- package/sampleWorkspace/connectors-community/connectors/common-room/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/common-room/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/googlemaps/README.md +58 -0
- package/sampleWorkspace/connectors-community/connectors/googlemaps/distancematrix.graphql +155 -0
- package/sampleWorkspace/connectors-community/connectors/googlemaps/places-legacy.graphql +117 -0
- package/sampleWorkspace/connectors-community/connectors/googlemaps/places.graphql +399 -0
- package/sampleWorkspace/connectors-community/connectors/googlemaps/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/googlemaps/supergraph.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/googlemaps/timezone.graphql +64 -0
- package/sampleWorkspace/connectors-community/connectors/heygen/README +105 -0
- package/sampleWorkspace/connectors-community/connectors/heygen/avatars.graphql +79 -0
- package/sampleWorkspace/connectors-community/connectors/heygen/photo-avatars.graphql +454 -0
- package/sampleWorkspace/connectors-community/connectors/heygen/router.yaml +21 -0
- package/sampleWorkspace/connectors-community/connectors/heygen/supergraph.yaml +10 -0
- package/sampleWorkspace/connectors-community/connectors/jira/README +36 -0
- package/sampleWorkspace/connectors-community/connectors/jira/connector.graphql +197 -0
- package/sampleWorkspace/connectors-community/connectors/jira/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/jira/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/museums/README.md +40 -0
- package/sampleWorkspace/connectors-community/connectors/museums/chicagoArt.graphql +150 -0
- package/sampleWorkspace/connectors-community/connectors/museums/met.graphql +119 -0
- package/sampleWorkspace/connectors-community/connectors/museums/supergraph.yaml +10 -0
- package/sampleWorkspace/connectors-community/connectors/nws/README.md +45 -0
- package/sampleWorkspace/connectors-community/connectors/nws/alerts.graphql +598 -0
- package/sampleWorkspace/connectors-community/connectors/nws/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/odata/README +18 -0
- package/sampleWorkspace/connectors-community/connectors/odata/connector.graphql +171 -0
- package/sampleWorkspace/connectors-community/connectors/odata/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/odata/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/openai/README.md +61 -0
- package/sampleWorkspace/connectors-community/connectors/openai/assistants.graphql +285 -0
- package/sampleWorkspace/connectors-community/connectors/openai/chat-completions.graphql +169 -0
- package/sampleWorkspace/connectors-community/connectors/openai/models.graphql +47 -0
- package/sampleWorkspace/connectors-community/connectors/openai/router.yaml +24 -0
- package/sampleWorkspace/connectors-community/connectors/openai/supergraph.yaml +14 -0
- package/sampleWorkspace/connectors-community/connectors/pokeapi/README +45 -0
- package/sampleWorkspace/connectors-community/connectors/pokeapi/games.graphql +70 -0
- package/sampleWorkspace/connectors-community/connectors/pokeapi/locations.graphql +127 -0
- package/sampleWorkspace/connectors-community/connectors/pokeapi/moves.graphql +107 -0
- package/sampleWorkspace/connectors-community/connectors/pokeapi/pokemon.graphql +539 -0
- package/sampleWorkspace/connectors-community/connectors/pokeapi/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/pokeapi/supergraph.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/strapi/README.md +75 -0
- package/sampleWorkspace/connectors-community/connectors/strapi/router.yaml +19 -0
- package/sampleWorkspace/connectors-community/connectors/strapi/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/strapi/users.graphql +227 -0
- package/sampleWorkspace/connectors-community/connectors/stripe/README.md +83 -0
- package/sampleWorkspace/connectors-community/connectors/stripe/checkout.graphql +112 -0
- package/sampleWorkspace/connectors-community/connectors/stripe/core-resources.graphql +868 -0
- package/sampleWorkspace/connectors-community/connectors/stripe/payment-methods.graphql +526 -0
- package/sampleWorkspace/connectors-community/connectors/stripe/products.graphql +162 -0
- package/sampleWorkspace/connectors-community/connectors/stripe/router.yaml +26 -0
- package/sampleWorkspace/connectors-community/connectors/stripe/supergraph.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/supabase/README.md +80 -0
- package/sampleWorkspace/connectors-community/connectors/supabase/router.yaml +5 -0
- package/sampleWorkspace/connectors-community/connectors/supabase/supabase.graphql +143 -0
- package/sampleWorkspace/connectors-community/connectors/supabase/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/thespacedevs/README +46 -0
- package/sampleWorkspace/connectors-community/connectors/thespacedevs/agencies.graphql +193 -0
- package/sampleWorkspace/connectors-community/connectors/thespacedevs/api-throttle.graphql +33 -0
- package/sampleWorkspace/connectors-community/connectors/thespacedevs/astronauts.graphql +237 -0
- package/sampleWorkspace/connectors-community/connectors/thespacedevs/celestial-bodies.graphql +131 -0
- package/sampleWorkspace/connectors-community/connectors/thespacedevs/docking-events.graphql +3460 -0
- package/sampleWorkspace/connectors-community/connectors/thespacedevs/launches.graphql +1156 -0
- package/sampleWorkspace/connectors-community/connectors/thespacedevs/supergraph.yaml +77 -0
- package/sampleWorkspace/connectors-community/connectors/tint/README +35 -0
- package/sampleWorkspace/connectors-community/connectors/tint/accounts.graphql +69 -0
- package/sampleWorkspace/connectors-community/connectors/tint/router.yaml +21 -0
- package/sampleWorkspace/connectors-community/connectors/tint/social-feeds.graphql +62 -0
- package/sampleWorkspace/connectors-community/connectors/tint/supergraph.yaml +10 -0
- package/sampleWorkspace/connectors-community/connectors/todoist/README.md +48 -0
- package/sampleWorkspace/connectors-community/connectors/todoist/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/todoist/todoist.graphql +381 -0
- package/sampleWorkspace/connectors-community/connectors/trimblemaps/README +99 -0
- package/sampleWorkspace/connectors-community/connectors/trimblemaps/connector.graphql +66 -0
- package/sampleWorkspace/connectors-community/connectors/trimblemaps/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/trimblemaps/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/twilio/README.md +44 -0
- package/sampleWorkspace/connectors-community/connectors/twilio/messages.graphql +107 -0
- package/sampleWorkspace/connectors-community/connectors/twilio/router.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/twilio/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/usgs/earthquakes/README.md +44 -0
- package/sampleWorkspace/connectors-community/connectors/usgs/earthquakes/earthquakes.graphql +235 -0
- package/sampleWorkspace/connectors-community/connectors/usgs/earthquakes/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/usgs/earthquakes-nominatum/README.md +44 -0
- package/sampleWorkspace/connectors-community/connectors/usgs/earthquakes-nominatum/earthquake-simple.graphql +87 -0
- package/sampleWorkspace/connectors-community/connectors/usgs/earthquakes-nominatum/router.yaml +3 -0
- package/sampleWorkspace/connectors-community/connectors/usgs/earthquakes-nominatum/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/usps/README +36 -0
- package/sampleWorkspace/connectors-community/connectors/usps/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/usps/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/connectors/usps/tracking.graphql +118 -0
- package/sampleWorkspace/connectors-community/connectors/zendesk/README +36 -0
- package/sampleWorkspace/connectors-community/connectors/zendesk/connector.graphql +98 -0
- package/sampleWorkspace/connectors-community/connectors/zendesk/router.yaml +18 -0
- package/sampleWorkspace/connectors-community/connectors/zendesk/supergraph.yaml +6 -0
- package/sampleWorkspace/connectors-community/file-new/index.js +520 -0
- package/sampleWorkspace/connectors-community/package-lock.json +119 -0
- package/sampleWorkspace/connectors-community/package.json +20 -0
- package/sampleWorkspace/connectors-community/supergraph.yaml +6 -0
- package/sampleWorkspace/sampleWorkspace.code-workspace +29 -8
- package/src/__tests__/fixtures/textmate/test.apollo.connectors.mapping +213 -0
- package/src/__tests__/fixtures/textmate/test.connect.graphql +104 -0
- package/src/language-server/__tests__/fixtures/documents/functionCall.ts.snap +3 -3
- package/syntaxes/build.ts +266 -0
- package/syntaxes/connectors.mapping.json +532 -0
- package/syntaxes/connectors.mapping.yaml +440 -0
- package/syntaxes/graphql.connectors.json +426 -0
- package/syntaxes/graphql.connectors.yaml +254 -0
- package/syntaxes/graphql.json +8 -1
- package/syntaxes/tsconfig.json +6 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# AWS REST Connector
|
|
2
|
+
|
|
3
|
+
This connector currently enables the following features using AWS REST APIs:
|
|
4
|
+
|
|
5
|
+
- Lambda
|
|
6
|
+
- [Invoke Function](# https://docs.aws.amazon.com/lambda/latest/api/API_Invoke.html) - requires [lambda:InvokeFunction](https://docs.aws.amazon.com/IAM/latest/UserGuide/list_awslambda.html) permission
|
|
7
|
+
- DynamoDB
|
|
8
|
+
- [GetItem](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_GetItem.html) - requires dynamodb:GetItem or AmazonDynamoDBReadOnlyAccess for your instance
|
|
9
|
+
|
|
10
|
+
## Prerequisites
|
|
11
|
+
|
|
12
|
+
To use the `.graphql` files in this folder without modifying them, you must have AWS resources that mirror how the connectors are designed.
|
|
13
|
+
You can also modify the schema files to work with your existing resources. For example, you change the Lambda URL to have one of your function names in it and modify the selection to match what your Lambda returns.
|
|
14
|
+
|
|
15
|
+
### DynamoDB prerequisites
|
|
16
|
+
|
|
17
|
+
These prerequisites apply if you want to use the `dynamodb.graphql` schema file as-is.
|
|
18
|
+
|
|
19
|
+
1. Create a table called `product-catalog`.
|
|
20
|
+
2. Create items in that table that contain an `id`_(string)_, `name`_(string)_, `description`_(string)_ and `image` _(string)_.
|
|
21
|
+
|
|
22
|
+
### Lambda prerequisites
|
|
23
|
+
|
|
24
|
+
These prerequisites apply if you want to use the `lambda.graphql` schema file as-is.
|
|
25
|
+
|
|
26
|
+
1. Create a Lambda named "products" and have it return a body of products like this:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
return {
|
|
30
|
+
statusCode: 200,
|
|
31
|
+
body: [{
|
|
32
|
+
"id": "RANQi6AZkUXCbZ",
|
|
33
|
+
"name": "OG Olive Putter - Blade",
|
|
34
|
+
"description": "The traditional Block in a blade shape is made from a solid block of Olive wood. The head weight is approximately 360 grams with the addition of pure tungsten weights. Paired with a walnut center-line and white accents colors.",
|
|
35
|
+
"image": "https://keynote-strapi-production.up.railway.app/uploads/thumbnail_IMG_9102_3119483fac.png"
|
|
36
|
+
}],
|
|
37
|
+
};
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
1. Create a Lambda named `product-price` and have it return a price object based on the incoming `product_id`:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
const id = event.product_id;
|
|
44
|
+
const prices = [{
|
|
45
|
+
id: "RANQi6AZkUXCbZ",
|
|
46
|
+
price: {
|
|
47
|
+
default_price: 49900,
|
|
48
|
+
is_active: true,
|
|
49
|
+
currency: "usd",
|
|
50
|
+
billing_schema: "per_unit",
|
|
51
|
+
recurring: {
|
|
52
|
+
interval: 0,
|
|
53
|
+
interval_count: 3,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
}]
|
|
57
|
+
return prices.find((p) => p.id == id);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Getting started
|
|
61
|
+
|
|
62
|
+
1. If you haven't already, [create a new graph in GraphOS](https://www.apollographql.com/docs/graphos/get-started/guides/rest#step-1-set-up-your-graphql-api). Once you get to the **Set up your local development environment** modal in the [Create a graph](https://www.apollographql.com/docs/graphos/get-started/guides/rest#create-a-graph) section:
|
|
63
|
+
- Copy the `supergraph.yaml` and `router.yaml` files from this folder instead of the `supergraph.yaml` provided by the modal.
|
|
64
|
+
- Instead of downloading the example schema provided by the modal, copy the schema files you want to use for this connector—`dynamodb.graphql` and/or `lambda.graphql`
|
|
65
|
+
- *Note: If you only want to one of the schema files, you need to modify the `supergraph.yaml` file to only contain the respective schema file .*
|
|
66
|
+
1. Set up a user in your IAM AWS Console and give them the appropriate permissions. You'll need to then set the proper environment variables for [Sigv4 authentication](https://www.apollographql.com/docs/graphos/routing/security/subgraph-authentication#default-chain-authentication) - _see docs for `AWS_ROLE_ARN` configuration_:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
# AWS Lambda - requires [InvokeFunction](https://docs.aws.amazon.com/lambda/latest/api/API_Invoke.html) permission
|
|
70
|
+
# DynamoDB - requires [GetItem](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_GetItem.html) permission
|
|
71
|
+
|
|
72
|
+
export AWS_ACCESS_KEY_ID=....
|
|
73
|
+
export AWS_SECRET_ACCESS_KEY=....
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
_Note: You can look at the `router.yaml` file to see config options for Sigv4 in the comments._
|
|
77
|
+
|
|
78
|
+
1. Run `rover dev` to start the local development session:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
APOLLO_KEY=service:My-Graph-s1ff1u:•••••••••••••••••••••• \
|
|
82
|
+
APOLLO_GRAPH_REF=My-Graph-s1ff1u@main \
|
|
83
|
+
rover dev --supergraph-config supergraph.yaml --router-config router.yaml
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
You’re all set! Open up http://localhost:4000 to query your graph using Apollo Sandbox.
|
|
87
|
+
|
|
88
|
+
### Adding to an existing graph in GraphOS
|
|
89
|
+
|
|
90
|
+
1. Ensure you set up Sigv4 for your hosted router and configure the `router.yaml` as outlined in the [docs](https://www.apollographql.com/docs/graphos/routing/security/subgraph-authentication#default-chain-authentication).
|
|
91
|
+
|
|
92
|
+
1. Then, to add these connectors to an existing graph, publish the schema files to your graph ref using `rover subgraph publish`:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
APOLLO_KEY=service:My-Graph-s1ff1u:•••••••••••••••••••••• \
|
|
96
|
+
rover subgraph publish My-Graph-s1ff1u@main --name Lambda --schema lambda.graphql --routing-url http://lambda
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Additional Setup for VS Code Task runner
|
|
100
|
+
|
|
101
|
+
Edit your `.vscode/settings.json` to include the following keys:
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
{
|
|
105
|
+
"terminal.integrated.profiles.osx": {
|
|
106
|
+
"graphos": {
|
|
107
|
+
"path": "zsh",
|
|
108
|
+
"args": ["-l"],
|
|
109
|
+
"env": {
|
|
110
|
+
"API_KEY": "",
|
|
111
|
+
"APOLLO_KEY": "",
|
|
112
|
+
...
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"terminal.integrated.defaultProfile.osx": "graphos"
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Once you've set this up, you can execute the `Tasks: Run Task` command in VS Code to run the `rover dev` task.
|
|
121
|
+
Alternatively, you can open a new terminal window in VS Code with the `graphos` profile, then run `rover dev --supergraph-config supergraph.yaml --router-config router.yaml`.
|
|
122
|
+
|
|
123
|
+
## Contributing
|
|
124
|
+
|
|
125
|
+
You can contribute any AWS resources to this project. The functionality should be isolated to a `.graphql` file that represents the AWS resource. You can use the current modules in this folder as examples to work with.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
extend schema
|
|
2
|
+
@link(
|
|
3
|
+
url: "https://specs.apollo.dev/federation/v2.11"
|
|
4
|
+
import: ["@key", "@requires", "@override", "@external", "@shareable"]
|
|
5
|
+
)
|
|
6
|
+
@link(
|
|
7
|
+
url: "https://specs.apollo.dev/connect/v0.2"
|
|
8
|
+
import: ["@source", "@connect"]
|
|
9
|
+
)
|
|
10
|
+
# https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_GetItem.html
|
|
11
|
+
# See router.yaml for Sigv4 configuration
|
|
12
|
+
@source(
|
|
13
|
+
name: "dynamodb"
|
|
14
|
+
http: {
|
|
15
|
+
# If you want to use multiple regions, see router.yaml for configuration based on environment variables
|
|
16
|
+
baseURL: "https://dynamodb.us-east-1.amazonaws.com"
|
|
17
|
+
}
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
type DynamoTable {
|
|
21
|
+
id: ID
|
|
22
|
+
name: String
|
|
23
|
+
itemCount: Int
|
|
24
|
+
tableSizeBytes: Float
|
|
25
|
+
creationDateTime: Float
|
|
26
|
+
itemConnection(cursor: String = "", limit: Int = 5): ItemConnection
|
|
27
|
+
@connect(
|
|
28
|
+
source: "dynamodb"
|
|
29
|
+
http: {
|
|
30
|
+
POST: "/"
|
|
31
|
+
body: """
|
|
32
|
+
$args.cursor->match(
|
|
33
|
+
[null, $({
|
|
34
|
+
TableName: $this.name,
|
|
35
|
+
Limit: $args.limit,
|
|
36
|
+
})],
|
|
37
|
+
["", $({
|
|
38
|
+
TableName: $this.name,
|
|
39
|
+
Limit: $args.limit,
|
|
40
|
+
})],
|
|
41
|
+
[@, $({
|
|
42
|
+
TableName: $this.name,
|
|
43
|
+
Limit: $args.limit,
|
|
44
|
+
ExclusiveStartKey: { id: { S: @ } }
|
|
45
|
+
})]
|
|
46
|
+
)
|
|
47
|
+
"""
|
|
48
|
+
headers: [{ name: "X-Amz-Target", value: "DynamoDB_20120810.Scan" }]
|
|
49
|
+
}
|
|
50
|
+
selection: """
|
|
51
|
+
pageInfo: {
|
|
52
|
+
count: Count
|
|
53
|
+
total: ScannedCount
|
|
54
|
+
next: LastEvaluatedKey.id.S
|
|
55
|
+
}
|
|
56
|
+
items: $.Items {
|
|
57
|
+
id: id.S
|
|
58
|
+
}
|
|
59
|
+
"""
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
type ItemConnection {
|
|
64
|
+
items: [Item]
|
|
65
|
+
pageInfo: PageInfo
|
|
66
|
+
}
|
|
67
|
+
type Item {
|
|
68
|
+
id: ID!
|
|
69
|
+
}
|
|
70
|
+
type Mutation {
|
|
71
|
+
deleteTable(name: ID!): Boolean
|
|
72
|
+
@connect(
|
|
73
|
+
source: "dynamodb"
|
|
74
|
+
http: {
|
|
75
|
+
POST: "/"
|
|
76
|
+
body: """
|
|
77
|
+
TableName: $args.name
|
|
78
|
+
"""
|
|
79
|
+
headers: [{ name: "X-Amz-Target", value: "DynamoDB_20120810.DeleteTable" }]
|
|
80
|
+
}
|
|
81
|
+
selection: """
|
|
82
|
+
$(true)
|
|
83
|
+
"""
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
type PageInfo {
|
|
87
|
+
count: Int
|
|
88
|
+
total: Int
|
|
89
|
+
next: String
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
type Query {
|
|
93
|
+
tables(limit: Int = 10): [DynamoTable]
|
|
94
|
+
@connect(
|
|
95
|
+
source: "dynamodb"
|
|
96
|
+
http: {
|
|
97
|
+
POST: "/"
|
|
98
|
+
body: """
|
|
99
|
+
Limit: $args.limit
|
|
100
|
+
"""
|
|
101
|
+
headers: [{ name: "X-Amz-Target", value: "DynamoDB_20120810.ListTables" }]
|
|
102
|
+
}
|
|
103
|
+
selection: """
|
|
104
|
+
$.TableNames->map({name: @}) { name }
|
|
105
|
+
"""
|
|
106
|
+
)
|
|
107
|
+
table(
|
|
108
|
+
name: String!
|
|
109
|
+
): DynamoTable
|
|
110
|
+
@connect(
|
|
111
|
+
source: "dynamodb"
|
|
112
|
+
http: {
|
|
113
|
+
POST: "/"
|
|
114
|
+
body: """
|
|
115
|
+
TableName: $args.name
|
|
116
|
+
"""
|
|
117
|
+
headers: [{ name: "X-Amz-Target", value: "DynamoDB_20120810.DescribeTable" }]
|
|
118
|
+
}
|
|
119
|
+
selection: """
|
|
120
|
+
$.Table {
|
|
121
|
+
id: TableId
|
|
122
|
+
name: TableName
|
|
123
|
+
itemCount: ItemCount
|
|
124
|
+
tableSizeBytes: TableSizeBytes
|
|
125
|
+
creationDateTime: CreationDateTime
|
|
126
|
+
}
|
|
127
|
+
"""
|
|
128
|
+
entity: true
|
|
129
|
+
)
|
|
130
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"statusCode": 200,
|
|
3
|
+
"body": [
|
|
4
|
+
{
|
|
5
|
+
"id": "RANQi6AZkUXCbZ",
|
|
6
|
+
"name": "OG Olive Putter - Blade",
|
|
7
|
+
"description": "The traditional Block in a blade shape is made from a solid block of Olive wood. The head weight is approximately 360 grams with the addition of pure tungsten weights. Paired with a walnut center-line and white accents colors.",
|
|
8
|
+
"image": "https://keynote-strapi-production.up.railway.app/uploads/thumbnail_IMG_9102_3119483fac.png"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"id": "RANYrWRy876AA5",
|
|
12
|
+
"name": "Butter Knife Olive Putter- Blade",
|
|
13
|
+
"description": "The traditional Block in a extremely thin blade shape (~1\") is made from a solid block of Olive wood. The head weight is approximately 330 grams with the addition of pure tungsten weights.",
|
|
14
|
+
"image": "https://keynote-strapi-production.up.railway.app/uploads/thumbnail_IMG_9104_97c221e79c.png"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": "RANb0l4hEX1P5h",
|
|
18
|
+
"name": "Purple Heart Putter - Mallet",
|
|
19
|
+
"description": "The traditional Block in a mallet shape is made from a solid block of Purple Heart wood. The head weight is approximately 350 grams with the addition of pure tungsten weights. Paired with a cherrywood center-line.",
|
|
20
|
+
"image": "https://keynote-strapi-production.up.railway.app/uploads/thumbnail_IMG_9107_a64354f144.png"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"id": "R8Thrlp7oTghTr",
|
|
24
|
+
"name": "Purple Heart Putter - Blade",
|
|
25
|
+
"description": "The traditional Block in a blade shape is made from a solid block of Purple Heart wood. The head weight is approximately 350 grams with the addition of pure tungsten weights. Paired with a cherrywood center-line and white accents colors.",
|
|
26
|
+
"image": "https://keynote-strapi-production.up.railway.app/uploads/thumbnail_IMG_8808_028b0dc74f.png"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"id": "RANfaXNYj1y69D",
|
|
30
|
+
"name": "Purple Heart Putter - Mallet - Hardwood Hosel",
|
|
31
|
+
"description": "The traditional Block in a mallet shape is made from a solid block of Purple Heart wood. It also features an offset hardwood hosel lathed for a perfect fit. The head weight is approximately 350 grams with the addition of pure tungsten weights. Paired with a accents of your choice.",
|
|
32
|
+
"image": "https://keynote-strapi-production.up.railway.app/uploads/thumbnail_IMG_9108_cb1db8a258.png"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"id": "RANhWQ2gr4Nddk",
|
|
36
|
+
"name": "Bubinga Single-Step Putter - Blade",
|
|
37
|
+
"description": "The traditional Block in a blade shape that is made from a solid block of Bubinga wood. The head weight is approximately 350 grams with the addition of pure tungsten weights. Paired with a olivewood center-line and white accents colors.",
|
|
38
|
+
"image": "https://keynote-strapi-production.up.railway.app/uploads/thumbnail_IMG_9113_fdd623c915.png"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"id": "RANj7kJZbpaST9",
|
|
42
|
+
"name": "Creamy Purple Heart Putter - Mallet",
|
|
43
|
+
"description": "The traditional Block in a mallet shape that is made from a solid block of Purple Heart wood. The head weight is approximately 350 grams with the addition of pure tungsten weights. Paired with a cherrywood center-line and cream accents colors paired with drip for the weights.",
|
|
44
|
+
"image": "https://keynote-strapi-production.up.railway.app/uploads/thumbnail_IMG_9114_b81c1a597c.png"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"id": "RANlyfWstQOkdx",
|
|
48
|
+
"name": "Adjustable Walnut Putter - Mallet",
|
|
49
|
+
"description": "The prototype Block in a mallet shape that is made from a solid block of Walnut wood. The head weight is approximately 350 grams with the addition of pure tungsten weights. Paired with a cherrywood center-line and teal accents colors. It includes two adjustable weights to dial in the swingweight for your personal preference",
|
|
50
|
+
"image": "https://keynote-strapi-production.up.railway.app/uploads/thumbnail_IMG_9115_75fddf436a.png"
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
extend schema
|
|
2
|
+
@link(
|
|
3
|
+
url: "https://specs.apollo.dev/federation/v2.10"
|
|
4
|
+
import: ["@key", "@requires", "@override", "@external", "@shareable"]
|
|
5
|
+
)
|
|
6
|
+
@link(
|
|
7
|
+
url: "https://specs.apollo.dev/connect/v0.2"
|
|
8
|
+
import: ["@source", "@connect"]
|
|
9
|
+
)
|
|
10
|
+
# https://docs.aws.amazon.com/lambda/latest/api
|
|
11
|
+
# See router.yaml for Sigv4 configuration
|
|
12
|
+
@source(
|
|
13
|
+
name: "lambda"
|
|
14
|
+
# If you want to use multiple regions, see router.yaml for configuration based on environment variables
|
|
15
|
+
http: { baseURL: "https://lambda.us-east-1.amazonaws.com" }
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
type LambdaFunction {
|
|
19
|
+
name: String
|
|
20
|
+
configuration: LambdaFunctionConfiguration
|
|
21
|
+
concurrency: Int
|
|
22
|
+
code: LambdaFunctionCode
|
|
23
|
+
}
|
|
24
|
+
type LambdaFunctionCode {
|
|
25
|
+
sourceKMSKeyArn: String
|
|
26
|
+
resolvedImageUri: String
|
|
27
|
+
repositoryType: String
|
|
28
|
+
error: String
|
|
29
|
+
imageUri: String
|
|
30
|
+
location: String
|
|
31
|
+
}
|
|
32
|
+
input LambdaFunctionCodeInput {
|
|
33
|
+
imageUri: String
|
|
34
|
+
zipFile: String
|
|
35
|
+
s3Bucket: String
|
|
36
|
+
s3Key: String
|
|
37
|
+
s3ObjectVersion: String
|
|
38
|
+
publish: Boolean
|
|
39
|
+
}
|
|
40
|
+
type LambdaFunctionConfiguration {
|
|
41
|
+
description: String
|
|
42
|
+
tracingConfigMode: String
|
|
43
|
+
revisionId: String
|
|
44
|
+
lastModified: String
|
|
45
|
+
runtime: String
|
|
46
|
+
version: String
|
|
47
|
+
packageType: String
|
|
48
|
+
lastUpdateSuccess: Boolean
|
|
49
|
+
arn: String
|
|
50
|
+
kmsKeyArn: String
|
|
51
|
+
memorySize: Int
|
|
52
|
+
timeout: Int
|
|
53
|
+
handler: String
|
|
54
|
+
codeSha256: String
|
|
55
|
+
role: String
|
|
56
|
+
state: String
|
|
57
|
+
stateReason: String
|
|
58
|
+
architectures: [String]
|
|
59
|
+
}
|
|
60
|
+
type Mutation {
|
|
61
|
+
createFunction(
|
|
62
|
+
name: String!
|
|
63
|
+
roleArn: String!
|
|
64
|
+
code: LambdaFunctionCodeInput!
|
|
65
|
+
): LambdaFunction
|
|
66
|
+
@connect(
|
|
67
|
+
source: "lambda"
|
|
68
|
+
http: {
|
|
69
|
+
POST: "/2015-03-31/functions"
|
|
70
|
+
body: """
|
|
71
|
+
FunctionName: $args.name
|
|
72
|
+
Role: $args.roleArn
|
|
73
|
+
Code: $args.code
|
|
74
|
+
"""
|
|
75
|
+
}
|
|
76
|
+
selection: """
|
|
77
|
+
name: FunctionName
|
|
78
|
+
configuration: {
|
|
79
|
+
description: Description
|
|
80
|
+
tracingConfigMode: TracingConfig.Mode
|
|
81
|
+
revisionId: RevisionId
|
|
82
|
+
lastModified: LastModified
|
|
83
|
+
runtime: Runtime
|
|
84
|
+
version: Version
|
|
85
|
+
packageType: PackageType
|
|
86
|
+
arn: FunctionArn
|
|
87
|
+
kmsKeyArn: KMSKeyArn
|
|
88
|
+
memorySize: MemorySize
|
|
89
|
+
timeout: Timeout
|
|
90
|
+
handler: Handler
|
|
91
|
+
codeSha256: CodeSha256
|
|
92
|
+
role: Role
|
|
93
|
+
state: State
|
|
94
|
+
stateReason: StateReasonCode
|
|
95
|
+
architectures: Architectures
|
|
96
|
+
}
|
|
97
|
+
"""
|
|
98
|
+
)
|
|
99
|
+
deleteFunction(name: String!): Boolean
|
|
100
|
+
@connect(
|
|
101
|
+
source: "lambda"
|
|
102
|
+
http: { DELETE: "/2015-03-31/functions/{$args.name}" }
|
|
103
|
+
selection: """
|
|
104
|
+
$(true)
|
|
105
|
+
"""
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
type Query {
|
|
109
|
+
getFunction(name: String!): LambdaFunction
|
|
110
|
+
@connect(
|
|
111
|
+
source: "lambda"
|
|
112
|
+
http: { GET: "/2015-03-31/functions/{$args.name}" }
|
|
113
|
+
selection: """
|
|
114
|
+
name: $.Configuration.FunctionName
|
|
115
|
+
configuration: $.Configuration {
|
|
116
|
+
description: Description
|
|
117
|
+
tracingConfigMode: TracingConfig.Mode
|
|
118
|
+
revisionId: RevisionId
|
|
119
|
+
lastModified: LastModified
|
|
120
|
+
runtime: Runtime
|
|
121
|
+
version: Version
|
|
122
|
+
packageType: PackageType
|
|
123
|
+
lastUpdateSuccess: LastUpdateStatus->match(
|
|
124
|
+
["Successful", true],
|
|
125
|
+
["Unsuccessful", false]
|
|
126
|
+
)
|
|
127
|
+
arn: FunctionArn
|
|
128
|
+
kmsKeyArn: KMSKeyArn
|
|
129
|
+
memorySize: MemorySize
|
|
130
|
+
timeout: Timeout
|
|
131
|
+
handler: Handler
|
|
132
|
+
codeSha256: CodeSha256
|
|
133
|
+
role: Role
|
|
134
|
+
state: State
|
|
135
|
+
stateReason: StateReasonCode
|
|
136
|
+
architectures: Architectures
|
|
137
|
+
}
|
|
138
|
+
concurrency: Concurrency.ReservedConcurrentExecutions
|
|
139
|
+
code: $.Code {
|
|
140
|
+
sourceKMSKeyArn: SourceKMSKeyArn
|
|
141
|
+
resolvedImageUri: ResolvedImageUri
|
|
142
|
+
repositoryType: RepositoryType
|
|
143
|
+
error: Error
|
|
144
|
+
imageUri: ImageUri
|
|
145
|
+
location: Location
|
|
146
|
+
}
|
|
147
|
+
"""
|
|
148
|
+
entity: true
|
|
149
|
+
)
|
|
150
|
+
listFunctions(limit: Int = 10, next: String = ""): [LambdaFunction]
|
|
151
|
+
@connect(
|
|
152
|
+
source: "lambda"
|
|
153
|
+
http: { GET: "/2015-03-31/functions" }
|
|
154
|
+
selection: """
|
|
155
|
+
$.Functions {
|
|
156
|
+
name: FunctionName
|
|
157
|
+
configuration: {
|
|
158
|
+
description: Description
|
|
159
|
+
tracingConfigMode: TracingConfig.Mode
|
|
160
|
+
revisionId: RevisionId
|
|
161
|
+
lastModified: LastModified
|
|
162
|
+
runtime: Runtime
|
|
163
|
+
version: Version
|
|
164
|
+
packageType: PackageType
|
|
165
|
+
arn: FunctionArn
|
|
166
|
+
kmsKeyArn: KMSKeyArn
|
|
167
|
+
memorySize: MemorySize
|
|
168
|
+
timeout: Timeout
|
|
169
|
+
handler: Handler
|
|
170
|
+
codeSha256: CodeSha256
|
|
171
|
+
role: Role
|
|
172
|
+
state: State
|
|
173
|
+
stateReason: StateReasonCode
|
|
174
|
+
architectures: Architectures
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
"""
|
|
178
|
+
)
|
|
179
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
supergraph:
|
|
2
|
+
listen: 0.0.0.0:${env.PORT:-4000}
|
|
3
|
+
|
|
4
|
+
headers:
|
|
5
|
+
all:
|
|
6
|
+
request:
|
|
7
|
+
- propagate:
|
|
8
|
+
matching: .*
|
|
9
|
+
telemetry:
|
|
10
|
+
instrumentation:
|
|
11
|
+
spans:
|
|
12
|
+
mode: spec_compliant
|
|
13
|
+
connectors:
|
|
14
|
+
preview_connect_v0_2: true
|
|
15
|
+
authentication:
|
|
16
|
+
connector:
|
|
17
|
+
sources:
|
|
18
|
+
aws-lambda.lambda:
|
|
19
|
+
aws_sig_v4:
|
|
20
|
+
default_chain:
|
|
21
|
+
# You can also set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY as environment variables
|
|
22
|
+
# Docs: https://www.apollographql.com/docs/graphos/routing/security/subgraph-authentication#default-chain-authentication
|
|
23
|
+
profile_name: "default" #name of profile in .aws/configuration file
|
|
24
|
+
region: "us-east-1"
|
|
25
|
+
service_name: "lambda"
|
|
26
|
+
# assume_role:
|
|
27
|
+
# role_arn: "arn:aws:iam::{accountId}:role/{roleName}"
|
|
28
|
+
# session_name: "connector"
|
|
29
|
+
aws-dynamodb.dynamodb:
|
|
30
|
+
aws_sig_v4:
|
|
31
|
+
default_chain:
|
|
32
|
+
# You can also set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY as environment variables
|
|
33
|
+
# Docs: https://www.apollographql.com/docs/graphos/routing/security/subgraph-authentication#default-chain-authentication
|
|
34
|
+
profile_name: "default" #name of profile in .aws/configuration file
|
|
35
|
+
region: "us-east-1"
|
|
36
|
+
service_name: "dynamodb"
|
|
37
|
+
# assume_role:
|
|
38
|
+
# role_arn: "arn:aws:iam::{accountId}:role/{roleName}"
|
|
39
|
+
# session_name: "connector"
|
|
40
|
+
|
|
41
|
+
## If you want to override the url to use dynamic urls based on environment variables
|
|
42
|
+
# connectors:
|
|
43
|
+
# subgraphs:
|
|
44
|
+
# dynamodb: # The name of the subgraph
|
|
45
|
+
# sources:
|
|
46
|
+
# address: # Refers to @source(name: "v1")
|
|
47
|
+
# override_url: ${env.DYNAMODB_URL:-https://dynamodb.us-east-1.amazonaws.com}
|
|
48
|
+
# # $config: #<- if you wanted to have environment variables used in schema file (i.e. {$config.apiKey})
|
|
49
|
+
# # apiKey: ${env.API_KEY}
|
|
50
|
+
# lambda:
|
|
51
|
+
# sources:
|
|
52
|
+
# lambda:
|
|
53
|
+
# override_url: ${env.LAMBDA_URL:-https://lambda.us-east-1.amazonaws.com}
|
|
54
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Bored API REST Connector
|
|
2
|
+
|
|
3
|
+
This connector covers the full [Bored API](https://bored-api.appbrewery.com/). This is an API that retrieves random activites.
|
|
4
|
+
|
|
5
|
+
This API is considered a teaching tool and is best used for practice with Connectors. It has no business or production value, but sometimes that's nice.
|
|
6
|
+
|
|
7
|
+
API Requests are rate limited to 100 requests every 15 minutes.
|
|
8
|
+
|
|
9
|
+
## Additional Setup for VS Code Task runner
|
|
10
|
+
|
|
11
|
+
Edit your `.vscode/settings.json` to include the following keys:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
{
|
|
15
|
+
"terminal.integrated.profiles.osx": {
|
|
16
|
+
"graphos": {
|
|
17
|
+
"path": "zsh",
|
|
18
|
+
"args": ["-l"],
|
|
19
|
+
"env": {
|
|
20
|
+
"API_KEY": "",
|
|
21
|
+
"APOLLO_KEY": "",
|
|
22
|
+
...
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"terminal.integrated.defaultProfile.osx": "graphos"
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Once you've set this up, you can execute the `Tasks: Run Task` command in VS Code to run the `rover dev` task.
|
|
31
|
+
Alternatively, you can open a new terminal window in VS Code with the `graphos` profile, then run `rover dev --supergraph-config supergraph.yaml --router-config router.yaml`.
|
|
32
|
+
|
|
33
|
+
## Contributing
|
|
34
|
+
|
|
35
|
+
This conector will not evolve, however, contributions of other REST API connectors are welcome. Please see the [Contribution Guide](https://github.com/apollographql/connectors-community/tree/main?tab=readme-ov-file#contributing-a-connector-to-the-community)
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
extend schema
|
|
2
|
+
@link(
|
|
3
|
+
url: "https://specs.apollo.dev/federation/v2.11"
|
|
4
|
+
import: ["@key", "@shareable", "@external"]
|
|
5
|
+
) # Enable this schema to use Apollo Federation features
|
|
6
|
+
@link( # Enable this schema to use Apollo Connectors
|
|
7
|
+
url: "https://specs.apollo.dev/connect/v0.2"
|
|
8
|
+
import: ["@connect", "@source"]
|
|
9
|
+
)
|
|
10
|
+
@source(name: "bored", http: { baseURL: "https://bored-api.appbrewery.com" })
|
|
11
|
+
type Query {
|
|
12
|
+
getRandomActivity: Activity
|
|
13
|
+
@connect(
|
|
14
|
+
source: "bored"
|
|
15
|
+
http: { GET: "/random" }
|
|
16
|
+
selection: """
|
|
17
|
+
activity
|
|
18
|
+
availability
|
|
19
|
+
type
|
|
20
|
+
participants
|
|
21
|
+
price
|
|
22
|
+
accessibility
|
|
23
|
+
duration
|
|
24
|
+
kidFriendly
|
|
25
|
+
link
|
|
26
|
+
key
|
|
27
|
+
"""
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
getActivityByType(type: ActivityType!): [Activity]
|
|
31
|
+
@connect(
|
|
32
|
+
source: "bored"
|
|
33
|
+
http: {
|
|
34
|
+
GET: "/filter"
|
|
35
|
+
queryParams: """
|
|
36
|
+
type: $args.type->match(
|
|
37
|
+
["EDUCATION", "education"],
|
|
38
|
+
["RECREATIONAL", "recreational"],
|
|
39
|
+
["SOCIAL", "social"],
|
|
40
|
+
["DIY", "diy"],
|
|
41
|
+
["CHARITY", "charity"],
|
|
42
|
+
["COOKING", "cooking"],
|
|
43
|
+
["RELAXATION", "relaxation"],
|
|
44
|
+
["MUSIC", "music"],
|
|
45
|
+
["BUSYWORK", "busywork"]
|
|
46
|
+
)
|
|
47
|
+
"""
|
|
48
|
+
}
|
|
49
|
+
selection: """
|
|
50
|
+
activity
|
|
51
|
+
availability
|
|
52
|
+
type
|
|
53
|
+
participants
|
|
54
|
+
price
|
|
55
|
+
accessibility
|
|
56
|
+
duration
|
|
57
|
+
kidFriendly
|
|
58
|
+
link
|
|
59
|
+
key
|
|
60
|
+
"""
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
type Activity {
|
|
65
|
+
activity: String
|
|
66
|
+
availability: Float
|
|
67
|
+
type: String
|
|
68
|
+
participants: Int
|
|
69
|
+
price: Float
|
|
70
|
+
accessibility: String
|
|
71
|
+
duration: String
|
|
72
|
+
kidFriendly: Boolean
|
|
73
|
+
link: String
|
|
74
|
+
key: String
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
enum ActivityType {
|
|
78
|
+
EDUCATION
|
|
79
|
+
RECREATIONAL
|
|
80
|
+
SOCIAL
|
|
81
|
+
DIY
|
|
82
|
+
CHARITY
|
|
83
|
+
COOKING
|
|
84
|
+
RELAXATION
|
|
85
|
+
MUSIC
|
|
86
|
+
BUSYWORK
|
|
87
|
+
}
|