Exemplo n.º 1
0
        public GithubQuery(IGithubService githubService)
        {
            Field <GithubUserType>(
                name: "githublogin",
                arguments: new QueryArguments(
                    new QueryArgument <StringGraphType> {
                Name = "login"
            }),
                resolve: context =>
            {
                var login = context.GetArgument <string>("login");
                return(githubService.GetUserAsync(login));
            }
                );

            Field <GithubOrganizationType>(
                name: "githubOrganizationName",
                arguments: new QueryArguments(new QueryArgument <StringGraphType> {
                Name = "githubOrganizationName"
            }),
                resolve: context =>
            {
                var orgName = context.GetArgument <string>("githubOrganizationName");
                return(githubService.GetRepositoryAsync(orgName));
            }
                );
        }
Exemplo n.º 2
0
        public async Task <IActionResult> GetGithubUserAsync([FromQuery] string login)
        {
            var user = await _githubService.GetUserAsync(login);

            return(Ok(user));
        }