コード例 #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));
            }
                );
        }
コード例 #2
0
        public async Task <IActionResult> GetOrganisationAsync([FromQuery] string orgname)
        {
            var organization = await _githubService.GetRepositoryAsync(orgname);

            return(Ok(organization));
        }