-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathgraphql_client.fsx
27 lines (21 loc) · 1.11 KB
/
graphql_client.fsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Uncomment those to use build script client assembly using netstandard2.0
//#r "../../bin/FSharp.Data.GraphQL.Shared/netstandard2.0/FSharp.Data.GraphQL.Shared.dll"
//#r "../../bin/FSharp.Data.GraphQL.Client/netstandard2.0/FSharp.Data.GraphQL.Client.dll"
//Uncomment those to use dotnet build command for the client assembly using netstandard2.0
#r "../../src/FSharp.Data.GraphQL.Shared/bin/Debug/netstandard2.0/FSharp.Data.GraphQL.Shared.dll"
#r "../../src/FSharp.Data.GraphQL.Client/bin/Debug/netstandard2.0/FSharp.Data.GraphQL.Client.dll"
open FSharp.Data.GraphQL
let run () =
// Dispose the connection after using it.
use connection = new GraphQLClientConnection ()
let request : GraphQLRequest =
{ Query = """query q { viewer { login } }"""
Variables = [||]
ServerUrl = "https://api.github.com/graphql"
HttpHeaders =
[| "Authorization", "bearer [your bearer token here]"
"User-Agent", "[your github username here]" |]
OperationName = Some "q" }
let response = GraphQLClient.sendRequest connection request
printfn "%s" response
run ()