我可以像这样查询第一个拉取请求:
query {
repository(owner: "test_owner", name: "test_name") {
pullRequests(first: 1) {
nodes {
id
number
title
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是我如何根据它查询某个拉取请求呢number?
以下不起作用:
query {
repository(owner: "test_owner", name: "test_name") {
pullRequests(first: 1, number: 50) { <-- CANNOT FILTER BY `number`
nodes {
id
number
title
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助!
我写了一个关于 google api 使用的例子。谷歌 NodeJS 客户端库。我已遵循指令集access_type : 'offline',但是对象返回不包含refresh_token.
我的代码:
var http = require('http');
var express = require('express');
var Session = require('express-session');
var google = require('googleapis');
var plus = google.plus('v1');
var OAuth2 = google.auth.OAuth2;
const ClientId = "251872680446-rvkcvm5mjn1ps32iabf4i2611hcg086e.apps.googleusercontent.com";
const ClientSecret = "F1qG9fFS-QwcrEfZbT8VmUnx";
const RedirectionUrl = "http://localhost:8081/oauthCallback";
var app = express();
app.use(Session({
secret: 'raysources-secret-19890913007',
resave: true,
saveUninitialized: true
}));
function getOAuthClient () {
return new OAuth2(ClientId , ClientSecret, RedirectionUrl);
}
function getAuthUrl () {
var oauth2Client …Run Code Online (Sandbox Code Playgroud) javascript google-api node.js google-oauth google-api-nodejs-client
我目前正在NodeJ中开发微服务架构。我的第一种方法是package.json每次服务。但是,对于所有微服务,在访问公共区域(使用日志记录或数据库实用程序)时可能会非常棘手。例如:
common-area >
logger.js
package.json - install module typeorm
service1 >
app.js - use logger.js
package.json - also install module typeorm
Run Code Online (Sandbox Code Playgroud)
运行node app.js(服务1)时,一旦完成两次不同的安装,最后将加载2个typeorm模块,其中一个安装在公共区域(由logger使用),另一个安装在service1。
我是否应该仅对package.json所有微服务使用一个,导致只创建一个node_modules文件夹?
所以,标题非常简单.我想从公司使用Web服务,我得到了.cer和.p12文件.据说,我应该在提出请求时使用.p12.我已将.cer导入windows中,我可以轻松地向邮递员提出请求.但是,当我尝试使用node.js进行请求时,我收到错误.这是代码,我正在使用request模块:
var headersOpt = {
"content-type": "application/json",
};
var options = {
url: 'https://some-url/api',
cert: fs.readFileSync(__dirname + '/certs/myCert.p12'),
headers: headersOpt
};
request.get(options, (error, response, body) => {
console.log(error);
console.log(response);
console.log(body);
});
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
{ Error: error:0906D06C:PEM routines:PEM_read_bio:no start line
at Object.createSecureContext (_tls_common.js:89:17)
at Object.exports.connect (_tls_wrap.js:1048:48)
at Agent.createConnection (https.js:111:22)
at Agent.createSocket (_http_agent.js:224:26)
at Agent.addRequest (_http_agent.js:192:10)
at new ClientRequest (_http_client.js:256:16)
at Object.request (http.js:39:10)
at Object.request (https.js:239:15)
at Request.start (D:\parser\node_modules\request\request.js:748:32)
at Request.end (D:\parser\node_modules\request\request.js:1512:10)
opensslErrorStack:
[ 'error:140DC009:SSL routines:SSL_CTX_use_certificate_chain_file:PEM lib' ] }
Run Code Online (Sandbox Code Playgroud) 我正在为我的组织构建的工具中使用GitHub 代码搜索 API。
我想在我们的整个存储库中提供搜索功能,以便您可以搜索一个词(例如“数组”)并.md在我们组织的任何存储库内的任何文件中找到它。(此工具的用例阻止我们使用平台内搜索功能,因此我需要使用 API。)
我面临的问题是我正在从我们的供应商 lib 文件夹中获取结果。我想排除那些。
是否可以为 Search API 提供附加参数以从搜索结果中排除(例如)名为“lib”的文件夹?
这是我目前使用的查询示例:
https://api.github.com/search/code?q=user:bradsk88+extension:js+array&per_page=2
Run Code Online (Sandbox Code Playgroud)
我试过使用path:!lib无济于事:
https://api.github.com/search/code?q=user:bradsk88+extension:js+path:!lib+array&per_page=2
Run Code Online (Sandbox Code Playgroud)
...这没有给我任何结果,尽管我的几个存储库中出现了“数组”这个词
{
"total_count": 0,
"incomplete_results": false,
"items": []
}
Run Code Online (Sandbox Code Playgroud) 给定用户的ID,我想获取所有请求请求审阅者的请求请求。
以下内容将不起作用,因为它仅允许我获取该用户打开的拉取请求:
query {
node(id: "$user") {
... on User {
pullRequests(first: 100) {
nodes {
reviewRequests(first: 100) {
nodes {
requestedReviewer {
... on User {
id
}
}
}
}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
有没有办法做到这一点?
谢谢!
我是 Nivo.rocks 的新手,这是一个基于 React 的图表库。我试图向栏添加一个单击处理程序,以便仅 console.log 该栏上的数据。目前,该组件带有自己的“工具提示”,当您将鼠标悬停在栏上时,它会显示此数据,但我不希望这样。
我查看了文档,但它没有清楚地显示如何执行此操作,这是否可能?到目前为止,我已经制作了一个按钮,可以从两个栏中注销数据
主要代码与此沙箱相同: https://codesandbox.io/s/nivo-0xy2m ?file=/src/index.js
我的按钮:
const clickHandler = () =>{
console.log(
`all the people that disagreed for ${data[0].statement} = ${data[0].disagree}`
)
}
Run Code Online (Sandbox Code Playgroud) 如何从curl 或github cli 创建webhook?
这个文档。没有多大帮助: https://docs.github.com/en/rest/reference/repos#create-a-repository-webhook--code-samples
尝试过这个:
curl -u <user>:<token>\
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/<org>/<repo>/hooks \
-d '{"name":"name"}'
Run Code Online (Sandbox Code Playgroud)
给我留下了疑问:
-d '{"name":"name"}'错误:
{
"message": "Validation Failed",
"errors": [
{
"resource": "Hook",
"code": "custom",
"message": "Config must contain URL for webhooks"
}
],
"documentation_url": "https://docs.github.com/rest/reference/repos#create-a-repository-webhook"
}
Run Code Online (Sandbox Code Playgroud) 当我在全屏窗口中生成折线图时,显示的颜色在声明的半径中,但是当我尝试调整窗口大小时,图表会正确调整大小,但渐变颜色会混乱.我试图通过听众解决这个问题,但它不起作用.
有人有想法吗?
这是我的代码:
var chrt = document.getElementById("mycanvas");
var ctx = chrt.getContext("2d");
var gradient = ctx.createLinearGradient(300, 0, 300, 600);
gradient.addColorStop(0, 'black');
gradient.addColorStop(0.25, 'red');
gradient.addColorStop(0.5, 'orange');
gradient.addColorStop(0.75, 'yellow');
gradient.addColorStop(1, 'green');
mycanvas.addEventListener("resize", gradient_declaration);
function gradient_declaration() {
var w = mycanvas.innerWidth;
var h = mycanvas.innerHeight;
if (gradient) { gradient.destroy(); } else {
var gradient = ctx.createLinearGradient(w / 2, 0, w / 2, h);
gradient.addColorStop(0, 'black');
gradient.addColorStop(0.25, 'red');
gradient.addColorStop(0.5, 'orange');
gradient.addColorStop(0.75, 'yellow');
gradient.addColorStop(1, 'green');
}
}
Run Code Online (Sandbox Code Playgroud) 我已经使用邮差(https://www.getpostman.com/)测试我的API,API在AWS ApiGateway和Lambda函数(NodeJS)中
(1)当我第一次向服务器发送post方法请求时,它给出了正确的响应,我暂时没有发送任何post参数。
这是请求标头-
Connection ?keep-alive
Content-Length ?61
Content-Type ?application/json
Date ?Fri, 24 Mar 2017 09:09:13 GMT
Via ?1.1 440f7503597ca64245c4258c03b08e0c.cloudfront.net (CloudFront)
X-Amz-Cf-Id ?t50_SeWgC3Qb2ZFtf4fksUTdi5viINCaAEj8MPTvhRbtMHu-LK1mwA==
X-Amzn-Trace-Id ?Root=1-58d4e239-76404c1ab9912d010fac33a2
X-Cache ?Miss from cloudfront
x-amzn-RequestId ?8c8f9bd2-1071-11e7-9490-79b68cde95e0
Run Code Online (Sandbox Code Playgroud)
这是回应
{
"response": "false",
"message": "Please enter a valid email !"
}
Run Code Online (Sandbox Code Playgroud)
当没有任何发布参数发送请求时,它的工作正常。
(2)现在,当我向请求发送参数时,请求标头已更改,并删除了一个标头prama X-Amzn-Trace-Id
这是请求标头-
Connection ?keep-alive
Content-Length ?37
Content-Type ?application/json
Date ?Fri, 24 Mar 2017 09:02:52 GMT
Via ?1.1 d6cd0a105a9b074288944d270dfa7321.cloudfront.net (CloudFront)
X-Amz-Cf-Id ?UZLUL1lYwAIrnwaa7kPVrPBx462sa7sV0x0WFQFGJ2OXVbrp9gaNYg==
X-Cache ?Error from cloudfront
x-amzn-RequestId ?a9c4116a-1070-11e7-b08c-c3cf73411cde
Run Code Online (Sandbox Code Playgroud)
这是请求正文
{
"userEmail":"rahul@gmail.com",
"userPasswod":"123456",
"userName":"rahul"
} …Run Code Online (Sandbox Code Playgroud) github ×4
github-api ×4
javascript ×3
node.js ×3
graphql ×2
api ×1
certificate ×1
charts ×1
curl ×1
d3.js ×1
github-cli ×1
google-api ×1
google-oauth ×1
gradient ×1
nivo-react ×1
openssl ×1
p12 ×1
postman ×1
reactjs ×1
responsive ×1
rest ×1
ssl ×1