コード例 #1
0
        private async Task LoadData()
        {
            var response = await GraphQLClient.SendQueryAsync(new GraphQLRequest
            {
                Query = @"
                query {
                    viewer {
                        defaultLanguage,
                        id
                        firstName
                        lastName
                    }
                }
                "
            });

            foreach (var prop in response.Data.viewer)
            {
                var row = new TableRow();

                row.Cells.AddRange(new[]
                {
                    new TableCell {
                        Text = prop.Name, CssClass = "text-right font-weight-bold"
                    },
                    new TableCell {
                        Text = prop.Value.Value
                    }
                });
                profileTable.Rows.Add(row);
            }
        }
        private async Task <IGraphQLResponse> SendXrayGraphQLQuery <T>(Func <string, string> postStringFunction) where T : GraphQLApiResponse, new()
        {
            try
            {
                GraphQLRequest.Query = XrayGraphQLQueries.GetQueryByType(new T(), postStringFunction);
                GraphQLResponse      = await GraphQLClient.SendQueryAsync <T>(GraphQLRequest);

                return(GraphQLResponse);
            }
            catch (Exception)
            {
                return(GraphQLResponse);
            }
        }