mirror of
https://github.com/documize/community.git
synced 2025-08-08 06:55:28 +02:00
ugly version of the getup code
This commit is contained in:
parent
1e78245c0b
commit
2c865a7a5c
114 changed files with 2800 additions and 603 deletions
|
@ -17,7 +17,8 @@
|
||||||
"Tooltip",
|
"Tooltip",
|
||||||
"Drop",
|
"Drop",
|
||||||
"Dropzone",
|
"Dropzone",
|
||||||
"dragula"
|
"dragula",
|
||||||
|
"datetimepicker"
|
||||||
],
|
],
|
||||||
"browser": true,
|
"browser": true,
|
||||||
"boss": true,
|
"boss": true,
|
||||||
|
|
|
@ -25,8 +25,12 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
noRepos: false,
|
noRepos: false,
|
||||||
showCommits: false,
|
showCommits: false,
|
||||||
showIssueNum: false,
|
showIssueNum: false,
|
||||||
|
showLabels: false,
|
||||||
|
|
||||||
didReceiveAttrs() {
|
didReceiveAttrs() {
|
||||||
|
$.datetimepicker.setLocale('en');
|
||||||
|
$('#branch-since').datetimepicker();
|
||||||
|
|
||||||
let self = this;
|
let self = this;
|
||||||
let page = this.get('page');
|
let page = this.get('page');
|
||||||
|
|
||||||
|
@ -48,7 +52,7 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
branch: "",
|
branch: "",
|
||||||
branchURL: "",
|
branchURL: "",
|
||||||
branchSince: "",
|
branchSince: "",
|
||||||
branchLines: 30,
|
branchLines: "30",
|
||||||
issueNum: "1"
|
issueNum: "1"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -58,6 +62,9 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
config.repo = metaConfig.repo;
|
config.repo = metaConfig.repo;
|
||||||
config.report = metaConfig.report;
|
config.report = metaConfig.report;
|
||||||
config.lists = metaConfig.lists;
|
config.lists = metaConfig.lists;
|
||||||
|
config.branchSince = metaConfig.branchSince;
|
||||||
|
config.branchLines = metaConfig.branchLines;
|
||||||
|
config.issueNum = metaConfig.issueNum;
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
self.set('config', config);
|
self.set('config', config);
|
||||||
|
@ -86,7 +93,6 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
this.destroyTooltips();
|
this.destroyTooltips();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
getOwnerLists() {
|
getOwnerLists() {
|
||||||
this.set('busy', true);
|
this.set('busy', true);
|
||||||
|
|
||||||
|
@ -95,8 +101,6 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
let thisOwner = this.get('config.owner');
|
let thisOwner = this.get('config.owner');
|
||||||
let page = this.get('page');
|
let page = this.get('page');
|
||||||
|
|
||||||
console.log("owner", thisOwner);
|
|
||||||
|
|
||||||
if (is.null(thisOwner) || is.undefined(thisOwner)) {
|
if (is.null(thisOwner) || is.undefined(thisOwner)) {
|
||||||
if (owners.length) {
|
if (owners.length) {
|
||||||
thisOwner = owners[0];
|
thisOwner = owners[0];
|
||||||
|
@ -127,8 +131,6 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
let repos = this.get('repos');
|
let repos = this.get('repos');
|
||||||
let thisRepo = this.get('config.repo');
|
let thisRepo = this.get('config.repo');
|
||||||
|
|
||||||
console.log("repo", thisRepo);
|
|
||||||
|
|
||||||
if (is.null(repos) || is.undefined(repos) || repos.length === 0) {
|
if (is.null(repos) || is.undefined(repos) || repos.length === 0) {
|
||||||
this.set('noRepos', true);
|
this.set('noRepos', true);
|
||||||
return;
|
return;
|
||||||
|
@ -170,8 +172,6 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
|
|
||||||
let thisReport = this.get('config.report');
|
let thisReport = this.get('config.report');
|
||||||
|
|
||||||
console.log("report", thisReport);
|
|
||||||
|
|
||||||
if (is.null(thisReport) || is.undefined(thisReport)) {
|
if (is.null(thisReport) || is.undefined(thisReport)) {
|
||||||
thisReport = reports[0];
|
thisReport = reports[0];
|
||||||
this.set('config.report', thisReport);
|
this.set('config.report', thisReport);
|
||||||
|
@ -186,7 +186,14 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
},
|
},
|
||||||
|
|
||||||
renderSwitch(thisReport) {
|
renderSwitch(thisReport) {
|
||||||
|
|
||||||
|
let bl = this.get('config.branchLines');
|
||||||
|
if (is.undefined(bl) || bl === "" || bl <= 0) {
|
||||||
|
this.set('config.branchLines', "30");
|
||||||
|
}
|
||||||
|
|
||||||
this.set('showCommits', false);
|
this.set('showCommits', false);
|
||||||
|
this.set('showLabels', false);
|
||||||
this.set('showIssueNum', false);
|
this.set('showIssueNum', false);
|
||||||
switch (thisReport.id) {
|
switch (thisReport.id) {
|
||||||
case 'commits_data':
|
case 'commits_data':
|
||||||
|
@ -194,8 +201,8 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
this.getBranchLists();
|
this.getBranchLists();
|
||||||
break;
|
break;
|
||||||
case "issues_data":
|
case "issues_data":
|
||||||
// nothing to show yet
|
this.set('showLabels', true);
|
||||||
this.set('busy', false);
|
this.getLabelLists();
|
||||||
break;
|
break;
|
||||||
case "issuenum_data":
|
case "issuenum_data":
|
||||||
this.set('showIssueNum', true);
|
this.set('showIssueNum', true);
|
||||||
|
@ -207,8 +214,6 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
getBranchLists() {
|
getBranchLists() {
|
||||||
this.set('busy', true);
|
this.set('busy', true);
|
||||||
|
|
||||||
console.log("branches");
|
|
||||||
|
|
||||||
let self = this;
|
let self = this;
|
||||||
let page = this.get('page');
|
let page = this.get('page');
|
||||||
|
|
||||||
|
@ -223,8 +228,11 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
let noIncluded = true;
|
let noIncluded = true;
|
||||||
|
|
||||||
lists.forEach(function(list) {
|
lists.forEach(function(list) {
|
||||||
let saved = savedLists.findBy("id", list.id);
|
|
||||||
let included = false;
|
let included = false;
|
||||||
|
var saved;
|
||||||
|
if (is.not.undefined(savedLists)) {
|
||||||
|
saved = savedLists.findBy("id", list.id);
|
||||||
|
}
|
||||||
if (is.not.undefined(saved)) {
|
if (is.not.undefined(saved)) {
|
||||||
included = saved.included;
|
included = saved.included;
|
||||||
noIncluded = false;
|
noIncluded = false;
|
||||||
|
@ -247,6 +255,43 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getLabelLists() {
|
||||||
|
this.set('busy', true);
|
||||||
|
|
||||||
|
let self = this;
|
||||||
|
let page = this.get('page');
|
||||||
|
|
||||||
|
this.get('sectionService').fetch(page, "labels", self.get('config'))
|
||||||
|
.then(function(lists) {
|
||||||
|
let savedLists = self.get('config.lists');
|
||||||
|
if (savedLists === null) {
|
||||||
|
savedLists = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lists.length > 0) {
|
||||||
|
lists.forEach(function(list) {
|
||||||
|
var saved;
|
||||||
|
if (is.not.undefined(savedLists)) {
|
||||||
|
saved = savedLists.findBy("id", list.id);
|
||||||
|
}
|
||||||
|
let included = false;
|
||||||
|
if (is.not.undefined(saved)) {
|
||||||
|
included = saved.included;
|
||||||
|
}
|
||||||
|
list.included = included;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
self.set('config.lists', lists);
|
||||||
|
self.set('busy', false);
|
||||||
|
}, function(error) { //jshint ignore: line
|
||||||
|
self.set('busy', false);
|
||||||
|
self.set('authenticated', false);
|
||||||
|
self.showNotification("Unable to fetch repository labels");
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
isDirty() {
|
isDirty() {
|
||||||
return this.get('isDirty');
|
return this.get('isDirty');
|
||||||
|
@ -266,6 +311,21 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onLabelCheckbox(id) {
|
||||||
|
let lists = this.get('config.lists');
|
||||||
|
let list = lists.findBy('id', id);
|
||||||
|
|
||||||
|
// restore the list of branches to the default state
|
||||||
|
// lists.forEach(function(lst) {
|
||||||
|
// Ember.set(lst, 'included', false);
|
||||||
|
// });
|
||||||
|
|
||||||
|
if (list !== null) {
|
||||||
|
Ember.set(list, 'included', !list.included);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
authStage2() {
|
authStage2() {
|
||||||
let self = this;
|
let self = this;
|
||||||
self.set('authenticated', true);
|
self.set('authenticated', true);
|
||||||
|
@ -319,6 +379,10 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
this.getReportLists();
|
this.getReportLists();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
checkLinesChange(thisLines) {
|
||||||
|
console.log("onLinesChange", thisLines);
|
||||||
|
},
|
||||||
|
|
||||||
onCancel() {
|
onCancel() {
|
||||||
this.attrs.onCancel();
|
this.attrs.onCancel();
|
||||||
},
|
},
|
||||||
|
@ -326,6 +390,15 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
onAction(title) {
|
onAction(title) {
|
||||||
this.set('busy', true);
|
this.set('busy', true);
|
||||||
|
|
||||||
|
let thisLines = this.get('config.branchLines');
|
||||||
|
if (is.undefined(thisLines) || thisLines === "") {
|
||||||
|
this.set('config.branchLines', 30);
|
||||||
|
} else if (thisLines < 1) {
|
||||||
|
this.set('config.branchLines', 1);
|
||||||
|
} else if (thisLines > 100) {
|
||||||
|
this.set('config.branchLines', 100);
|
||||||
|
}
|
||||||
|
|
||||||
let self = this;
|
let self = this;
|
||||||
let page = this.get('page');
|
let page = this.get('page');
|
||||||
let meta = this.get('meta');
|
let meta = this.get('meta');
|
||||||
|
|
|
@ -29,3 +29,574 @@
|
||||||
filter: alpha(opacity=20);
|
filter: alpha(opacity=20);
|
||||||
}
|
}
|
||||||
/* FINISH dragula.js */
|
/* FINISH dragula.js */
|
||||||
|
|
||||||
|
/* START jquery.datetimepicker.full.min.js */
|
||||||
|
.xdsoft_datetimepicker {
|
||||||
|
box-shadow: 0 5px 15px -5px rgba(0, 0, 0, 0.506);
|
||||||
|
background: #fff;
|
||||||
|
border-bottom: 1px solid #bbb;
|
||||||
|
border-left: 1px solid #ccc;
|
||||||
|
border-right: 1px solid #ccc;
|
||||||
|
border-top: 1px solid #ccc;
|
||||||
|
color: #333;
|
||||||
|
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||||
|
padding: 8px;
|
||||||
|
padding-left: 0;
|
||||||
|
padding-top: 2px;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 9999;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.xdsoft_datetimepicker.xdsoft_rtl {
|
||||||
|
padding: 8px 0 8px 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker iframe {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 75px;
|
||||||
|
height: 210px;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*For IE8 or lower*/
|
||||||
|
.xdsoft_datetimepicker button {
|
||||||
|
border: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_noselect {
|
||||||
|
-webkit-touch-callout: none;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-khtml-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
-o-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_noselect::selection { background: transparent }
|
||||||
|
.xdsoft_noselect::-moz-selection { background: transparent }
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker.xdsoft_inline {
|
||||||
|
display: inline-block;
|
||||||
|
position: static;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker * {
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_datepicker, .xdsoft_datetimepicker .xdsoft_timepicker {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_datepicker.active, .xdsoft_datetimepicker .xdsoft_timepicker.active {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_datepicker {
|
||||||
|
width: 224px;
|
||||||
|
float: left;
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
|
.xdsoft_datetimepicker.xdsoft_rtl .xdsoft_datepicker {
|
||||||
|
float: right;
|
||||||
|
margin-right: 8px;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_datepicker {
|
||||||
|
width: 256px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_timepicker {
|
||||||
|
width: 58px;
|
||||||
|
float: left;
|
||||||
|
text-align: center;
|
||||||
|
margin-left: 8px;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
.xdsoft_datetimepicker.xdsoft_rtl .xdsoft_timepicker {
|
||||||
|
float: right;
|
||||||
|
margin-right: 8px;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_datepicker.active+.xdsoft_timepicker {
|
||||||
|
margin-top: 8px;
|
||||||
|
margin-bottom: 3px
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_monthpicker {
|
||||||
|
position: relative;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_label i,
|
||||||
|
.xdsoft_datetimepicker .xdsoft_prev,
|
||||||
|
.xdsoft_datetimepicker .xdsoft_next,
|
||||||
|
.xdsoft_datetimepicker .xdsoft_today_button {
|
||||||
|
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAYAAADaW7vzAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6Q0NBRjI1NjM0M0UwMTFFNDk4NkFGMzJFQkQzQjEwRUIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6Q0NBRjI1NjQ0M0UwMTFFNDk4NkFGMzJFQkQzQjEwRUIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpDQ0FGMjU2MTQzRTAxMUU0OTg2QUYzMkVCRDNCMTBFQiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpDQ0FGMjU2MjQzRTAxMUU0OTg2QUYzMkVCRDNCMTBFQiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PoNEP54AAAIOSURBVHja7Jq9TsMwEMcxrZD4WpBYeKUCe+kTMCACHZh4BFfHO/AAIHZGFhYkBBsSEqxsLCAgXKhbXYOTxh9pfJVP+qutnZ5s/5Lz2Y5I03QhWji2GIcgAokWgfCxNvcOCCGKqiSqhUp0laHOne05vdEyGMfkdxJDVjgwDlEQgYQBgx+ULJaWSXXS6r/ER5FBVR8VfGftTKcITNs+a1XpcFoExREIDF14AVIFxgQUS+h520cdud6wNkC0UBw6BCO/HoCYwBhD8QCkQ/x1mwDyD4plh4D6DDV0TAGyo4HcawLIBBSLDkHeH0Mg2yVP3l4TQMZQDDsEOl/MgHQqhMNuE0D+oBh0CIr8MAKyazBH9WyBuKxDWgbXfjNf32TZ1KWm/Ap1oSk/R53UtQ5xTh3LUlMmT8gt6g51Q9p+SobxgJQ/qmsfZhWywGFSl0yBjCLJCMgXail3b7+rumdVJ2YRss4cN+r6qAHDkPWjPjdJCF4n9RmAD/V9A/Wp4NQassDjwlB6XBiCxcJQWmZZb8THFilfy/lfrTvLghq2TqTHrRMTKNJ0sIhdo15RT+RpyWwFdY96UZ/LdQKBGjcXpcc1AlSFEfLmouD+1knuxBDUVrvOBmoOC/rEcN7OQxKVeJTCiAdUzUJhA2Oez9QTkp72OTVcxDcXY8iKNkxGAJXmJCOQwOa6dhyXsOa6XwEGAKdeb5ET3rQdAAAAAElFTkSuQmCC);
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_label i {
|
||||||
|
opacity: 0.5;
|
||||||
|
background-position: -92px -19px;
|
||||||
|
display: inline-block;
|
||||||
|
width: 9px;
|
||||||
|
height: 20px;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_prev {
|
||||||
|
float: left;
|
||||||
|
background-position: -20px 0;
|
||||||
|
}
|
||||||
|
.xdsoft_datetimepicker .xdsoft_today_button {
|
||||||
|
float: left;
|
||||||
|
background-position: -70px 0;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_next {
|
||||||
|
float: right;
|
||||||
|
background-position: 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_next,
|
||||||
|
.xdsoft_datetimepicker .xdsoft_prev ,
|
||||||
|
.xdsoft_datetimepicker .xdsoft_today_button {
|
||||||
|
background-color: transparent;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
border: 0 none;
|
||||||
|
cursor: pointer;
|
||||||
|
display: block;
|
||||||
|
height: 30px;
|
||||||
|
opacity: 0.5;
|
||||||
|
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
|
||||||
|
outline: medium none;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 0;
|
||||||
|
position: relative;
|
||||||
|
text-indent: 100%;
|
||||||
|
white-space: nowrap;
|
||||||
|
width: 20px;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev,
|
||||||
|
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_next {
|
||||||
|
float: none;
|
||||||
|
background-position: -40px -15px;
|
||||||
|
height: 15px;
|
||||||
|
width: 30px;
|
||||||
|
display: block;
|
||||||
|
margin-left: 14px;
|
||||||
|
margin-top: 7px;
|
||||||
|
}
|
||||||
|
.xdsoft_datetimepicker.xdsoft_rtl .xdsoft_timepicker .xdsoft_prev,
|
||||||
|
.xdsoft_datetimepicker.xdsoft_rtl .xdsoft_timepicker .xdsoft_next {
|
||||||
|
float: none;
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev {
|
||||||
|
background-position: -40px 0;
|
||||||
|
margin-bottom: 7px;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box {
|
||||||
|
height: 151px;
|
||||||
|
overflow: hidden;
|
||||||
|
border-bottom: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div {
|
||||||
|
background: #f5f5f5;
|
||||||
|
border-top: 1px solid #ddd;
|
||||||
|
color: #666;
|
||||||
|
font-size: 12px;
|
||||||
|
text-align: center;
|
||||||
|
border-collapse: collapse;
|
||||||
|
cursor: pointer;
|
||||||
|
border-bottom-width: 0;
|
||||||
|
height: 25px;
|
||||||
|
line-height: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div > div:first-child {
|
||||||
|
border-top-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_today_button:hover,
|
||||||
|
.xdsoft_datetimepicker .xdsoft_next:hover,
|
||||||
|
.xdsoft_datetimepicker .xdsoft_prev:hover {
|
||||||
|
opacity: 1;
|
||||||
|
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_label {
|
||||||
|
display: inline;
|
||||||
|
position: relative;
|
||||||
|
z-index: 9999;
|
||||||
|
margin: 0;
|
||||||
|
padding: 5px 3px;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 20px;
|
||||||
|
font-weight: bold;
|
||||||
|
background-color: #fff;
|
||||||
|
float: left;
|
||||||
|
width: 182px;
|
||||||
|
text-align: center;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_label:hover>span {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_label:hover i {
|
||||||
|
opacity: 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select {
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 30px;
|
||||||
|
z-index: 101;
|
||||||
|
display: none;
|
||||||
|
background: #fff;
|
||||||
|
max-height: 160px;
|
||||||
|
overflow-y: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select.xdsoft_monthselect{ right: -7px }
|
||||||
|
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select.xdsoft_yearselect{ right: 2px }
|
||||||
|
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover {
|
||||||
|
color: #fff;
|
||||||
|
background: #ff8000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option {
|
||||||
|
padding: 2px 10px 2px 5px;
|
||||||
|
text-decoration: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current {
|
||||||
|
background: #33aaff;
|
||||||
|
box-shadow: #178fe5 0 1px 3px 0 inset;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_month {
|
||||||
|
width: 100px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_calendar {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_year{
|
||||||
|
width: 48px;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_calendar table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_calendar td > div {
|
||||||
|
padding-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_calendar th {
|
||||||
|
height: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_calendar td,.xdsoft_datetimepicker .xdsoft_calendar th {
|
||||||
|
width: 14.2857142%;
|
||||||
|
background: #f5f5f5;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
color: #666;
|
||||||
|
font-size: 12px;
|
||||||
|
text-align: right;
|
||||||
|
vertical-align: middle;
|
||||||
|
padding: 0;
|
||||||
|
border-collapse: collapse;
|
||||||
|
cursor: pointer;
|
||||||
|
height: 25px;
|
||||||
|
}
|
||||||
|
.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_calendar td,.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_calendar th {
|
||||||
|
width: 12.5%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_calendar th {
|
||||||
|
background: #f1f1f1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_today {
|
||||||
|
color: #33aaff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_highlighted_default {
|
||||||
|
background: #ffe9d2;
|
||||||
|
box-shadow: #ffb871 0 1px 4px 0 inset;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_highlighted_mint {
|
||||||
|
background: #c1ffc9;
|
||||||
|
box-shadow: #00dd1c 0 1px 4px 0 inset;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_default,
|
||||||
|
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current,
|
||||||
|
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current {
|
||||||
|
background: #33aaff;
|
||||||
|
box-shadow: #178fe5 0 1px 3px 0 inset;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month,
|
||||||
|
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled,
|
||||||
|
.xdsoft_datetimepicker .xdsoft_time_box >div >div.xdsoft_disabled {
|
||||||
|
opacity: 0.5;
|
||||||
|
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month.xdsoft_disabled {
|
||||||
|
opacity: 0.2;
|
||||||
|
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=20)";
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_calendar td:hover,
|
||||||
|
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div:hover {
|
||||||
|
color: #fff !important;
|
||||||
|
background: #ff8000 !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current.xdsoft_disabled:hover,
|
||||||
|
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box>div>div.xdsoft_current.xdsoft_disabled:hover {
|
||||||
|
background: #33aaff !important;
|
||||||
|
box-shadow: #178fe5 0 1px 3px 0 inset !important;
|
||||||
|
color: #fff !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled:hover,
|
||||||
|
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_disabled:hover {
|
||||||
|
color: inherit !important;
|
||||||
|
background: inherit !important;
|
||||||
|
box-shadow: inherit !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_calendar th {
|
||||||
|
font-weight: 700;
|
||||||
|
text-align: center;
|
||||||
|
color: #999;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_copyright {
|
||||||
|
color: #ccc !important;
|
||||||
|
font-size: 10px;
|
||||||
|
clear: both;
|
||||||
|
float: none;
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker .xdsoft_copyright a { color: #eee !important }
|
||||||
|
.xdsoft_datetimepicker .xdsoft_copyright a:hover { color: #aaa !important }
|
||||||
|
|
||||||
|
.xdsoft_time_box {
|
||||||
|
position: relative;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
.xdsoft_scrollbar >.xdsoft_scroller {
|
||||||
|
background: #ccc !important;
|
||||||
|
height: 20px;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
.xdsoft_scrollbar {
|
||||||
|
position: absolute;
|
||||||
|
width: 7px;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.xdsoft_datetimepicker.xdsoft_rtl .xdsoft_scrollbar {
|
||||||
|
left: 0;
|
||||||
|
right: auto;
|
||||||
|
}
|
||||||
|
.xdsoft_scroller_box {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark {
|
||||||
|
box-shadow: 0 5px 15px -5px rgba(255, 255, 255, 0.506);
|
||||||
|
background: #000;
|
||||||
|
border-bottom: 1px solid #444;
|
||||||
|
border-left: 1px solid #333;
|
||||||
|
border-right: 1px solid #333;
|
||||||
|
border-top: 1px solid #333;
|
||||||
|
color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box {
|
||||||
|
border-bottom: 1px solid #222;
|
||||||
|
}
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div {
|
||||||
|
background: #0a0a0a;
|
||||||
|
border-top: 1px solid #222;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label {
|
||||||
|
background-color: #000;
|
||||||
|
}
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select {
|
||||||
|
border: 1px solid #333;
|
||||||
|
background: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover {
|
||||||
|
color: #000;
|
||||||
|
background: #007fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current {
|
||||||
|
background: #cc5500;
|
||||||
|
box-shadow: #b03e00 0 1px 3px 0 inset;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label i,
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_prev,
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_next,
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_today_button {
|
||||||
|
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAYAAADaW7vzAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUExQUUzOTA0M0UyMTFFNDlBM0FFQTJENTExRDVBODYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUExQUUzOTE0M0UyMTFFNDlBM0FFQTJENTExRDVBODYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQTFBRTM4RTQzRTIxMUU0OUEzQUVBMkQ1MTFENUE4NiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQTFBRTM4RjQzRTIxMUU0OUEzQUVBMkQ1MTFENUE4NiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pp0VxGEAAAIASURBVHja7JrNSgMxEMebtgh+3MSLr1T1Xn2CHoSKB08+QmR8Bx9A8e7RixdB9CKCoNdexIugxFlJa7rNZneTbLIpM/CnNLsdMvNjM8l0mRCiQ9Ye61IKCAgZAUnH+mU3MMZaHYChBnJUDzWOFZdVfc5+ZFLbrWDeXPwbxIqrLLfaeS0hEBVGIRQCEiZoHQwtlGSByCCdYBl8g8egTTAWoKQMRBRBcZxYlhzhKegqMOageErsCHVkk3hXIFooDgHB1KkHIHVgzKB4ADJQ/A1jAFmAYhkQqA5TOBtocrKrgXwQA8gcFIuAIO8sQSA7hidvPwaQGZSaAYHOUWJABhWWw2EMIH9QagQERU4SArJXo0ZZL18uvaxejXt/Em8xjVBXmvFr1KVm/AJ10tRe2XnraNqaJvKE3KHuUbfK1E+VHB0q40/y3sdQSxY4FHWeKJCunP8UyDdqJZenT3ntVV5jIYCAh20vT7ioP8tpf6E2lfEMwERe+whV1MHjwZB7PBiCxcGQWwKZKD62lfGNnP/1poFAA60T7rF1UgcKd2id3KDeUS+oLWV8DfWAepOfq00CgQabi9zjcgJVYVD7PVzQUAUGAQkbNJTBICDhgwYTjDYD6XeW08ZKh+A4pYkzenOxXUbvZcWz7E8ykRMnIHGX1XPl+1m2vPYpL+2qdb8CDAARlKFEz/ZVkAAAAABJRU5ErkJggg==);
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td,
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th {
|
||||||
|
background: #0a0a0a;
|
||||||
|
border: 1px solid #222;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th {
|
||||||
|
background: #0e0e0e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_today {
|
||||||
|
color: #cc5500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_highlighted_default {
|
||||||
|
background: #ffe9d2;
|
||||||
|
box-shadow: #ffb871 0 1px 4px 0 inset;
|
||||||
|
color:#000;
|
||||||
|
}
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_highlighted_mint {
|
||||||
|
background: #c1ffc9;
|
||||||
|
box-shadow: #00dd1c 0 1px 4px 0 inset;
|
||||||
|
color:#000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_default,
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_current,
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current {
|
||||||
|
background: #cc5500;
|
||||||
|
box-shadow: #b03e00 0 1px 3px 0 inset;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td:hover,
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div:hover {
|
||||||
|
color: #000 !important;
|
||||||
|
background: #007fff !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th {
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright { color: #333 !important }
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright a { color: #111 !important }
|
||||||
|
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright a:hover { color: #555 !important }
|
||||||
|
|
||||||
|
.xdsoft_dark .xdsoft_time_box {
|
||||||
|
border: 1px solid #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xdsoft_dark .xdsoft_scrollbar >.xdsoft_scroller {
|
||||||
|
background: #333 !important;
|
||||||
|
}
|
||||||
|
.xdsoft_datetimepicker .xdsoft_save_selected {
|
||||||
|
display: block;
|
||||||
|
border: 1px solid #dddddd !important;
|
||||||
|
margin-top: 5px;
|
||||||
|
width: 100%;
|
||||||
|
color: #454551;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
.xdsoft_datetimepicker .blue-gradient-button {
|
||||||
|
font-family: "museo-sans", "Book Antiqua", sans-serif;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: #82878c;
|
||||||
|
height: 28px;
|
||||||
|
position: relative;
|
||||||
|
padding: 4px 17px 4px 33px;
|
||||||
|
border: 1px solid #d7d8da;
|
||||||
|
background: -moz-linear-gradient(top, #fff 0%, #f4f8fa 73%);
|
||||||
|
/* FF3.6+ */
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fff), color-stop(73%, #f4f8fa));
|
||||||
|
/* Chrome,Safari4+ */
|
||||||
|
background: -webkit-linear-gradient(top, #fff 0%, #f4f8fa 73%);
|
||||||
|
/* Chrome10+,Safari5.1+ */
|
||||||
|
background: -o-linear-gradient(top, #fff 0%, #f4f8fa 73%);
|
||||||
|
/* Opera 11.10+ */
|
||||||
|
background: -ms-linear-gradient(top, #fff 0%, #f4f8fa 73%);
|
||||||
|
/* IE10+ */
|
||||||
|
background: linear-gradient(to bottom, #fff 0%, #f4f8fa 73%);
|
||||||
|
/* W3C */
|
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fff', endColorstr='#f4f8fa',GradientType=0 );
|
||||||
|
/* IE6-9 */
|
||||||
|
}
|
||||||
|
.xdsoft_datetimepicker .blue-gradient-button:hover, .xdsoft_datetimepicker .blue-gradient-button:focus, .xdsoft_datetimepicker .blue-gradient-button:hover span, .xdsoft_datetimepicker .blue-gradient-button:focus span {
|
||||||
|
color: #454551;
|
||||||
|
background: -moz-linear-gradient(top, #f4f8fa 0%, #FFF 73%);
|
||||||
|
/* FF3.6+ */
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f4f8fa), color-stop(73%, #FFF));
|
||||||
|
/* Chrome,Safari4+ */
|
||||||
|
background: -webkit-linear-gradient(top, #f4f8fa 0%, #FFF 73%);
|
||||||
|
/* Chrome10+,Safari5.1+ */
|
||||||
|
background: -o-linear-gradient(top, #f4f8fa 0%, #FFF 73%);
|
||||||
|
/* Opera 11.10+ */
|
||||||
|
background: -ms-linear-gradient(top, #f4f8fa 0%, #FFF 73%);
|
||||||
|
/* IE10+ */
|
||||||
|
background: linear-gradient(to bottom, #f4f8fa 0%, #FFF 73%);
|
||||||
|
/* W3C */
|
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f8fa', endColorstr='#FFF',GradientType=0 );
|
||||||
|
/* IE6-9 */
|
||||||
|
}
|
||||||
|
/* FINISH jquery.datetimepicker.full.min.js */
|
|
@ -34,8 +34,10 @@
|
||||||
<div class="tip">Select report type</div>
|
<div class="tip">Select report type</div>
|
||||||
{{ui-select id="report-dropdown" content=reports action=(action 'onReportChange') optionValuePath="id" optionLabelPath="name" selection=config.report}}
|
{{ui-select id="report-dropdown" content=reports action=(action 'onReportChange') optionValuePath="id" optionLabelPath="name" selection=config.report}}
|
||||||
</div>
|
</div>
|
||||||
|
Show items since {{input id="branch-since" value=config.branchSince type="text" }}<br>
|
||||||
|
Number of items to show {{input id="branch-lines" value=config.branchLines type="number" min="1" step="1" max="100" }}<br>
|
||||||
{{#if showIssueNum}}
|
{{#if showIssueNum}}
|
||||||
{{input id="issue-number" value=config.issueNum type="number" min="1" step="1" enter='onIssueNumChange'}}
|
Issue Number: {{input id="issue-number" value=config.issueNum type="number" min="1" step="1" }}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if showCommits}}
|
{{#if showCommits}}
|
||||||
<div class="input-control">
|
<div class="input-control">
|
||||||
|
@ -56,6 +58,25 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{#if showLabels}}
|
||||||
|
<div class="input-control">
|
||||||
|
<label>Labels</label>
|
||||||
|
<div class="tip">Select labels - an issue must have all labels to be shown, if no label is selected all issues are shown.</div>
|
||||||
|
<div class="github-board">
|
||||||
|
{{#each config.lists as |list|}}
|
||||||
|
<div class="github-list" {{action 'onLabelCheckbox' list.id}} >
|
||||||
|
{{#if list.included}}
|
||||||
|
<i class="material-icons widget-checkbox checkbox-gray github-list-checkbox">check_box</i>
|
||||||
|
{{else}}
|
||||||
|
<i class="material-icons widget-checkbox checkbox-gray github-list-checkbox">check_box_outline_blank</i>
|
||||||
|
{{/if}}
|
||||||
|
<span style="background-color:#{{list.color}}" class="github-list-title">{{list.name}}</span>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
<div class="clearfix" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
/* jshint node: true */
|
/* jshint node: true */
|
||||||
|
|
||||||
module.exports = function(environment) {
|
module.exports = function(environment) {
|
||||||
|
|
||||||
var ENV = {
|
var ENV = {
|
||||||
modulePrefix: 'documize',
|
modulePrefix: 'documize',
|
||||||
podModulePrefix: 'documize/pods',
|
podModulePrefix: 'documize/pods',
|
||||||
|
@ -25,13 +26,13 @@ module.exports = function(environment) {
|
||||||
EmberENV: {
|
EmberENV: {
|
||||||
FEATURES: {}
|
FEATURES: {}
|
||||||
},
|
},
|
||||||
"ember-cli-mirage": {
|
"ember-cli-mirage": {
|
||||||
enabled: false
|
enabled: false
|
||||||
},
|
},
|
||||||
APP: {
|
APP: {
|
||||||
// Allows to disable audit service in tests
|
// Allows to disable audit service in tests
|
||||||
auditEnabled: true,
|
auditEnabled: true,
|
||||||
intercomKey: ""
|
intercomKey: ""
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@ module.exports = function(environment) {
|
||||||
ENV.APP.LOG_TRANSITIONS = true;
|
ENV.APP.LOG_TRANSITIONS = true;
|
||||||
ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
|
ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
|
||||||
ENV['ember-cli-mirage'] = {
|
ENV['ember-cli-mirage'] = {
|
||||||
enabled: false
|
enabled: false
|
||||||
};
|
};
|
||||||
|
|
||||||
ENV.apiHost = "https://localhost:5001";
|
ENV.apiHost = "https://localhost:5001";
|
||||||
|
@ -56,7 +57,7 @@ module.exports = function(environment) {
|
||||||
ENV.locationType = 'none';
|
ENV.locationType = 'none';
|
||||||
ENV.APP.rootElement = '#ember-testing';
|
ENV.APP.rootElement = '#ember-testing';
|
||||||
ENV['ember-cli-mirage'] = {
|
ENV['ember-cli-mirage'] = {
|
||||||
enabled: true
|
enabled: true
|
||||||
};
|
};
|
||||||
ENV.APP.auditEnabled = false;
|
ENV.APP.auditEnabled = false;
|
||||||
|
|
||||||
|
@ -73,21 +74,21 @@ module.exports = function(environment) {
|
||||||
ENV.apiHost = "";
|
ENV.apiHost = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
process.argv.forEach(function(element) {
|
process.argv.forEach(function(element) {
|
||||||
if (element !== undefined) {
|
if (element !== undefined) {
|
||||||
if (element.startsWith("intercom=")) {
|
if (element.startsWith("intercom=")) {
|
||||||
element = element.replace("intercom=", "");
|
element = element.replace("intercom=", "");
|
||||||
ENV.APP.intercomKey = element;
|
ENV.APP.intercomKey = element;
|
||||||
}
|
}
|
||||||
if (element.startsWith("apiHost=")) {
|
if (element.startsWith("apiHost=")) {
|
||||||
element = element.replace("apiHost=", "");
|
element = element.replace("apiHost=", "");
|
||||||
ENV.apiHost = element;
|
ENV.apiHost = element;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ENV.apiNamespace = "api";
|
ENV.apiNamespace = "api";
|
||||||
ENV.contentSecurityPolicy = null;
|
ENV.contentSecurityPolicy = null;
|
||||||
|
|
||||||
return ENV;
|
return ENV;
|
||||||
};
|
};
|
|
@ -52,8 +52,9 @@ module.exports = function(defaults) {
|
||||||
app.import('vendor/tether.js');
|
app.import('vendor/tether.js');
|
||||||
app.import('vendor/drop.js');
|
app.import('vendor/drop.js');
|
||||||
app.import('vendor/tooltip.js');
|
app.import('vendor/tooltip.js');
|
||||||
app.import('vendor/markdown-it.min.js');
|
app.import('vendor/markdown-it.min.js');
|
||||||
app.import('vendor/dragula.js');
|
app.import('vendor/dragula.js');
|
||||||
|
app.import('vendor/datetimepicker.min.js');
|
||||||
|
|
||||||
return app.toTree();
|
return app.toTree();
|
||||||
};
|
};
|
2
app/vendor/datetimepicker.min.js
vendored
Normal file
2
app/vendor/datetimepicker.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -20,7 +20,6 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/documize/community/documize/api/request"
|
"github.com/documize/community/documize/api/request"
|
||||||
"github.com/documize/community/documize/section/provider"
|
"github.com/documize/community/documize/section/provider"
|
||||||
|
@ -177,8 +176,6 @@ func (t *Provider) Command(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
owners = sortOwners(owners)
|
owners = sortOwners(owners)
|
||||||
|
|
||||||
//fmt.Printf("DEBUG owners %#v\n", owners)
|
|
||||||
|
|
||||||
provider.WriteJSON(w, owners)
|
provider.WriteJSON(w, owners)
|
||||||
|
|
||||||
case "repos":
|
case "repos":
|
||||||
|
@ -193,7 +190,7 @@ func (t *Provider) Command(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var repos []gogithub.Repository
|
var repos []*gogithub.Repository
|
||||||
if config.Owner == *me.Login {
|
if config.Owner == *me.Login {
|
||||||
repos, _, err = client.Repositories.List(config.Owner, nil)
|
repos, _, err = client.Repositories.List(config.Owner, nil)
|
||||||
} else {
|
} else {
|
||||||
|
@ -251,6 +248,30 @@ func (t *Provider) Command(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
provider.WriteJSON(w, render)
|
provider.WriteJSON(w, render)
|
||||||
|
|
||||||
|
case "labels":
|
||||||
|
if config.Owner == "" || config.Repo == "" {
|
||||||
|
provider.WriteJSON(w, []githubBranch{}) // we have nothing to return
|
||||||
|
return
|
||||||
|
}
|
||||||
|
labels, _, err := client.Issues.ListLabels(config.Owner, config.Repo,
|
||||||
|
&gogithub.ListOptions{PerPage: 100})
|
||||||
|
if err != nil {
|
||||||
|
log.Error("github get labels:", err)
|
||||||
|
provider.WriteError(w, "github", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
render := make([]githubBranch, len(labels))
|
||||||
|
for kc, vb := range labels {
|
||||||
|
render[kc] = githubBranch{
|
||||||
|
Name: *vb.Name,
|
||||||
|
ID: fmt.Sprintf("%s:%s:%s", config.Owner, config.Repo, *vb.Name),
|
||||||
|
Included: false,
|
||||||
|
Color: *vb.Color,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
provider.WriteJSON(w, render)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log.ErrorString("Github connector unknown method: " + method)
|
log.ErrorString("Github connector unknown method: " + method)
|
||||||
provider.WriteEmpty(w)
|
provider.WriteEmpty(w)
|
||||||
|
@ -286,6 +307,7 @@ func (*Provider) getIssueNum(client *gogithub.Client, config githubConfig) ([]gi
|
||||||
}
|
}
|
||||||
ret = append(ret, githubIssueActivity{
|
ret = append(ret, githubIssueActivity{
|
||||||
Name: n,
|
Name: n,
|
||||||
|
Event: "TITLE",
|
||||||
Message: *issue.Title, // TODO move?
|
Message: *issue.Title, // TODO move?
|
||||||
Date: issue.UpdatedAt.Format("January 2 2006, 15:04"),
|
Date: issue.UpdatedAt.Format("January 2 2006, 15:04"),
|
||||||
Avatar: a,
|
Avatar: a,
|
||||||
|
@ -293,6 +315,7 @@ func (*Provider) getIssueNum(client *gogithub.Client, config githubConfig) ([]gi
|
||||||
})
|
})
|
||||||
ret = append(ret, githubIssueActivity{
|
ret = append(ret, githubIssueActivity{
|
||||||
Name: n,
|
Name: n,
|
||||||
|
Event: "DESCRIPTION",
|
||||||
Message: *issue.Body,
|
Message: *issue.Body,
|
||||||
Date: issue.UpdatedAt.Format("January 2 2006, 15:04"),
|
Date: issue.UpdatedAt.Format("January 2 2006, 15:04"),
|
||||||
Avatar: a,
|
Avatar: a,
|
||||||
|
@ -302,32 +325,59 @@ func (*Provider) getIssueNum(client *gogithub.Client, config githubConfig) ([]gi
|
||||||
return ret, err
|
return ret, err
|
||||||
}
|
}
|
||||||
|
|
||||||
guff, _, err := client.Issues.ListComments(config.Owner, config.Repo, config.IssueNum,
|
opts := &gogithub.ListOptions{PerPage: config.BranchLines}
|
||||||
&gogithub.IssueListCommentsOptions{ListOptions: gogithub.ListOptions{PerPage: 100}})
|
|
||||||
|
guff, _, err := client.Issues.ListIssueTimeline(config.Owner, config.Repo, config.IssueNum, opts)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ret, err
|
return ret, err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, v := range guff {
|
for _, v := range guff {
|
||||||
n := ""
|
if config.SincePtr == nil || v.CreatedAt.After(*config.SincePtr) {
|
||||||
a := ""
|
var n, a, m, u string
|
||||||
p := v.User
|
|
||||||
if p != nil {
|
p := v.Actor
|
||||||
if p.Name != nil {
|
if p != nil {
|
||||||
n = *p.Name
|
if p.Name != nil {
|
||||||
|
n = *p.Name
|
||||||
|
}
|
||||||
|
if p.AvatarURL != nil {
|
||||||
|
a = *p.AvatarURL
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if p.AvatarURL != nil {
|
|
||||||
a = *p.AvatarURL
|
u = fmt.Sprintf("https://github.com/%s/%s/issues/%d#event-%d",
|
||||||
|
config.Owner, config.Repo, config.IssueNum, *v.ID)
|
||||||
|
|
||||||
|
if *v.Event == "commented" {
|
||||||
|
ic, _, err := client.Issues.GetComment(config.Owner, config.Repo, *v.ID)
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorString("github error fetching issue event comment: " + err.Error())
|
||||||
|
} else {
|
||||||
|
m = *ic.Body
|
||||||
|
u = *ic.HTMLURL
|
||||||
|
p := ic.User
|
||||||
|
if p != nil {
|
||||||
|
if p.Name != nil {
|
||||||
|
n = *p.Name
|
||||||
|
}
|
||||||
|
if p.AvatarURL != nil {
|
||||||
|
a = *p.AvatarURL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = append(ret, githubIssueActivity{
|
||||||
|
Name: n,
|
||||||
|
Event: *v.Event,
|
||||||
|
Message: m,
|
||||||
|
Date: v.CreatedAt.Format("January 2 2006, 15:04"),
|
||||||
|
Avatar: a,
|
||||||
|
URL: u,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
ret = append(ret, githubIssueActivity{
|
|
||||||
Name: n,
|
|
||||||
Message: *v.Body,
|
|
||||||
Date: v.UpdatedAt.Format("January 2 2006, 15:04"),
|
|
||||||
Avatar: a,
|
|
||||||
URL: *v.HTMLURL,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret, nil
|
return ret, nil
|
||||||
|
@ -336,11 +386,23 @@ func (*Provider) getIssueNum(client *gogithub.Client, config githubConfig) ([]gi
|
||||||
|
|
||||||
func (*Provider) getIssues(client *gogithub.Client, config githubConfig) ([]githubIssue, error) {
|
func (*Provider) getIssues(client *gogithub.Client, config githubConfig) ([]githubIssue, error) {
|
||||||
|
|
||||||
guff, _, err := client.Issues.ListByRepo(config.Owner, config.Repo,
|
opts := &gogithub.IssueListByRepoOptions{
|
||||||
&gogithub.IssueListByRepoOptions{ListOptions: gogithub.ListOptions{PerPage: 100}})
|
ListOptions: gogithub.ListOptions{PerPage: config.BranchLines}}
|
||||||
|
|
||||||
|
if config.SincePtr != nil {
|
||||||
|
opts.Since = *config.SincePtr
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, lab := range config.Lists {
|
||||||
|
if lab.Included {
|
||||||
|
opts.Labels = append(opts.Labels, lab.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ret := []githubIssue{}
|
ret := []githubIssue{}
|
||||||
|
|
||||||
|
guff, _, err := client.Issues.ListByRepo(config.Owner, config.Repo, opts)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ret, err
|
return ret, err
|
||||||
}
|
}
|
||||||
|
@ -357,12 +419,17 @@ func (*Provider) getIssues(client *gogithub.Client, config githubConfig) ([]gith
|
||||||
a = *p.AvatarURL
|
a = *p.AvatarURL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
l := ""
|
||||||
|
for _, ll := range v.Labels {
|
||||||
|
l += `<span style="color:#` + *ll.Color + `">` + *ll.Name + `</span> `
|
||||||
|
}
|
||||||
ret = append(ret, githubIssue{
|
ret = append(ret, githubIssue{
|
||||||
Name: n,
|
Name: n,
|
||||||
Message: *v.Title,
|
Message: *v.Title,
|
||||||
Date: v.UpdatedAt.Format("January 2 2006, 15:04"),
|
Date: v.UpdatedAt.Format("January 2 2006, 15:04"),
|
||||||
Avatar: a,
|
Avatar: a,
|
||||||
URL: *v.HTMLURL,
|
URL: *v.HTMLURL,
|
||||||
|
Labels: l,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,11 +443,8 @@ func (*Provider) getCommits(client *gogithub.Client, config githubConfig) ([]git
|
||||||
SHA: config.Branch,
|
SHA: config.Branch,
|
||||||
ListOptions: gogithub.ListOptions{PerPage: config.BranchLines}}
|
ListOptions: gogithub.ListOptions{PerPage: config.BranchLines}}
|
||||||
|
|
||||||
var since time.Time
|
if config.SincePtr != nil {
|
||||||
|
opts.Since = *config.SincePtr
|
||||||
err := since.UnmarshalText([]byte(config.BranchSince)) // TODO date Picker format
|
|
||||||
if err == nil {
|
|
||||||
opts.Since = since
|
|
||||||
}
|
}
|
||||||
|
|
||||||
guff, _, err := client.Repositories.ListCommits(config.Owner, config.Repo, opts)
|
guff, _, err := client.Repositories.ListCommits(config.Owner, config.Repo, opts)
|
||||||
|
@ -508,7 +572,7 @@ func (t *Provider) Refresh(configJSON, data string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render ... just returns the data given, suitably formatted
|
// Render ... just returns the data given, suitably formatted
|
||||||
func (*Provider) Render(config, data string) string {
|
func (p *Provider) Render(config, data string) string {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
payload := githubRender{}
|
payload := githubRender{}
|
||||||
|
@ -524,6 +588,10 @@ func (*Provider) Render(config, data string) string {
|
||||||
c.Clean()
|
c.Clean()
|
||||||
payload.Config = c
|
payload.Config = c
|
||||||
payload.Repo = c.RepoInfo
|
payload.Repo = c.RepoInfo
|
||||||
|
payload.Limit = c.BranchLines
|
||||||
|
if len(c.BranchSince) > 0 {
|
||||||
|
payload.DateMessage = ", created after " + c.BranchSince
|
||||||
|
}
|
||||||
|
|
||||||
switch c.ReportInfo.ID {
|
switch c.ReportInfo.ID {
|
||||||
case "issuenum_data":
|
case "issuenum_data":
|
||||||
|
@ -537,6 +605,19 @@ func (*Provider) Render(config, data string) string {
|
||||||
return "Documize internal github json umarshall issue activity data error: " + err.Error()
|
return "Documize internal github json umarshall issue activity data error: " + err.Error()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opt := &gogithub.MarkdownOptions{Mode: "gfm", Context: c.Owner + "/" + c.Repo}
|
||||||
|
client := p.githubClient(c)
|
||||||
|
for k, v := range raw {
|
||||||
|
if v.Event == "commented" {
|
||||||
|
output, _, err := client.Markdown(v.Message, opt)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("convert commented text to markdown", err)
|
||||||
|
} else {
|
||||||
|
raw[k].Message = output
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
payload.IssueNumActivity = raw
|
payload.IssueNumActivity = raw
|
||||||
|
|
||||||
case "issues_data":
|
case "issues_data":
|
||||||
|
@ -550,6 +631,15 @@ func (*Provider) Render(config, data string) string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
payload.Issues = raw
|
payload.Issues = raw
|
||||||
|
if len(c.Lists) > 0 {
|
||||||
|
for _, v := range c.Lists {
|
||||||
|
if v.Included {
|
||||||
|
payload.ShowList = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
payload.List = c.Lists
|
||||||
|
}
|
||||||
|
|
||||||
default: // to handle legacy data, this handles commits
|
default: // to handle legacy data, this handles commits
|
||||||
raw := []githubBranchCommits{}
|
raw := []githubBranchCommits{}
|
||||||
|
|
|
@ -12,25 +12,33 @@
|
||||||
package github
|
package github
|
||||||
|
|
||||||
import (
|
import (
|
||||||
//"github.com/documize/community/wordsmith/log"
|
|
||||||
|
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/documize/community/wordsmith/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
type githubRender struct {
|
type githubRender struct {
|
||||||
Config githubConfig
|
Config githubConfig
|
||||||
Repo githubRepo
|
Repo githubRepo
|
||||||
|
List []githubBranch
|
||||||
|
ShowList bool
|
||||||
BranchCommits []githubBranchCommits
|
BranchCommits []githubBranchCommits
|
||||||
CommitCount int
|
CommitCount int
|
||||||
Issues []githubIssue
|
Issues []githubIssue
|
||||||
IssueNum int
|
IssueNum int
|
||||||
IssueNumActivity []githubIssueActivity
|
IssueNumActivity []githubIssueActivity
|
||||||
|
Limit int
|
||||||
|
DateMessage string
|
||||||
}
|
}
|
||||||
|
|
||||||
var renderTemplates = map[string]string{
|
var renderTemplates = map[string]string{
|
||||||
"commits_data": `
|
"commits_data": `
|
||||||
<div class="section-github-render">
|
<div class="section-github-render">
|
||||||
<p>There are {{ .CommitCount }} commits for branch <a href="{{.Config.BranchURL}}">{{.Config.Branch}}</a> of repository <a href="{{ .Repo.URL }}">{{.Repo.Name}}.</a></p>
|
<p>
|
||||||
|
There are {{ .CommitCount }} commits for branch <a href="{{.Config.BranchURL}}">{{.Config.Branch}}</a> of repository <a href="{{ .Repo.URL }}">{{.Repo.Name}}.</a>
|
||||||
|
Up to {{ .Limit }} items are shown{{ .DateMessage }}.
|
||||||
|
</p>
|
||||||
<div class="github-board">
|
<div class="github-board">
|
||||||
{{range $data := .BranchCommits}}
|
{{range $data := .BranchCommits}}
|
||||||
<div class="github-group-title">
|
<div class="github-group-title">
|
||||||
|
@ -58,7 +66,19 @@ var renderTemplates = map[string]string{
|
||||||
`,
|
`,
|
||||||
"issues_data": `
|
"issues_data": `
|
||||||
<div class="section-github-render">
|
<div class="section-github-render">
|
||||||
<p>The issues for repository <a href="{{ .Repo.URL }}/issues">{{.Repo.Name}}.</a></p>
|
<p>
|
||||||
|
The open issues for repository <a href="{{ .Repo.URL }}/issues">{{.Repo.Name}}</a>
|
||||||
|
{{if .ShowList}}
|
||||||
|
with label(s)
|
||||||
|
{{range $label := .List}}
|
||||||
|
{{if $label.Included}}
|
||||||
|
<span style="background-color:#{{$label.Color}}">{{$label.Name}}</span>
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
.
|
||||||
|
Up to {{ .Limit }} items are shown{{ .DateMessage }}.
|
||||||
|
</p>
|
||||||
<div class="github-board">
|
<div class="github-board">
|
||||||
<ul class="github-list">
|
<ul class="github-list">
|
||||||
{{range $data := .Issues}}
|
{{range $data := .Issues}}
|
||||||
|
@ -69,7 +89,9 @@ var renderTemplates = map[string]string{
|
||||||
</div>
|
</div>
|
||||||
<div class="github-commit-body">
|
<div class="github-commit-body">
|
||||||
<div class="github-commit-title">{{$data.Message}}</div>
|
<div class="github-commit-title">{{$data.Message}}</div>
|
||||||
<div class="github-commit-meta">{{$data.Name}} committed on {{$data.Date}}</div>
|
<div class="github-commit-meta">
|
||||||
|
{{$data.Name}} committed on {{$data.Date}} {{$data.Labels}}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<div class="clearfix" />
|
<div class="clearfix" />
|
||||||
|
@ -81,7 +103,10 @@ var renderTemplates = map[string]string{
|
||||||
`,
|
`,
|
||||||
"issuenum_data": `
|
"issuenum_data": `
|
||||||
<div class="section-github-render">
|
<div class="section-github-render">
|
||||||
<p>Activity for issue #{{.IssueNum}} in repository <a href="{{ .Repo.URL }}/issues">{{.Repo.Name}}.</a></p>
|
<p>
|
||||||
|
Activity for issue #{{.IssueNum}} in repository <a href="{{ .Repo.URL }}/issues">{{.Repo.Name}}.</a>
|
||||||
|
Up to {{ .Limit }} items are shown{{ .DateMessage }}.
|
||||||
|
</p>
|
||||||
<div class="github-board">
|
<div class="github-board">
|
||||||
<ul class="github-list">
|
<ul class="github-list">
|
||||||
{{range $data := .IssueNumActivity}}
|
{{range $data := .IssueNumActivity}}
|
||||||
|
@ -91,7 +116,7 @@ var renderTemplates = map[string]string{
|
||||||
<img alt="@{{$data.Name}}" src="{{$data.Avatar}}" height="36" width="36">
|
<img alt="@{{$data.Name}}" src="{{$data.Avatar}}" height="36" width="36">
|
||||||
</div>
|
</div>
|
||||||
<div class="github-commit-body">
|
<div class="github-commit-body">
|
||||||
<div class="github-commit-title">{{$data.Message}}</div>
|
<div class="github-commit-title">{{$data.Event}}: {{$data.Message}}</div>
|
||||||
<div class="github-commit-meta">{{$data.Name}} committed on {{$data.Date}}</div>
|
<div class="github-commit-meta">{{$data.Name}} committed on {{$data.Date}}</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
@ -129,6 +154,7 @@ type githubBranch struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Included bool `json:"included"`
|
Included bool `json:"included"`
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
|
Color string `json:"color,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type githubBranchCommits struct {
|
type githubBranchCommits struct {
|
||||||
|
@ -151,10 +177,12 @@ type githubIssue struct {
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Avatar string `json:"avatar"`
|
Avatar string `json:"avatar"`
|
||||||
|
Labels string `json:"labels"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type githubIssueActivity struct {
|
type githubIssueActivity struct {
|
||||||
Date string `json:"date"`
|
Date string `json:"date"`
|
||||||
|
Event string `json:"event"`
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
@ -169,7 +197,8 @@ type githubConfig struct {
|
||||||
Branch string `json:"branch"`
|
Branch string `json:"branch"`
|
||||||
BranchURL string `json:"branchURL"`
|
BranchURL string `json:"branchURL"`
|
||||||
BranchSince string `json:"branchSince,omitempty"`
|
BranchSince string `json:"branchSince,omitempty"`
|
||||||
BranchLines int `json:"branchLines,omitempty"`
|
SincePtr *time.Time `json:"-"`
|
||||||
|
BranchLines int `json:"branchLines,omitempty,string"`
|
||||||
OwnerInfo githubOwner `json:"owner"`
|
OwnerInfo githubOwner `json:"owner"`
|
||||||
RepoInfo githubRepo `json:"repo"`
|
RepoInfo githubRepo `json:"repo"`
|
||||||
ReportInfo githubReport `json:"report"`
|
ReportInfo githubReport `json:"report"`
|
||||||
|
@ -191,12 +220,19 @@ func (c *githubConfig) Clean() {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// var e error
|
if len(c.BranchSince) >= len("yyyy/mm/dd hh:ss") {
|
||||||
// c.IssueNum, e = strconv.Atoi(c.IssueNumString)
|
var since time.Time
|
||||||
// if e != nil {
|
tt := []byte("yyyy-mm-ddThh:mm:00Z")
|
||||||
// log.ErrorString("github clean issue number: " + e.Error())
|
for _, i := range []int{0, 1, 2, 3, 5, 6, 8, 9, 11, 12, 14, 15} {
|
||||||
// c.IssueNum = 1
|
tt[i] = byte(c.BranchSince[i])
|
||||||
// }
|
}
|
||||||
|
err := since.UnmarshalText(tt)
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorString("Date unmarshall '" + c.BranchSince + "'->'" + string(tt) + "' error: " + err.Error())
|
||||||
|
} else {
|
||||||
|
c.SincePtr = &since
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type githubCallbackT struct {
|
type githubCallbackT struct {
|
||||||
|
|
1
vendor/github.com/google/go-github/.gitignore
generated
vendored
1
vendor/github.com/google/go-github/.gitignore
generated
vendored
|
@ -1 +0,0 @@
|
||||||
*.test
|
|
22
vendor/github.com/google/go-github/.travis.yml
generated
vendored
22
vendor/github.com/google/go-github/.travis.yml
generated
vendored
|
@ -1,22 +0,0 @@
|
||||||
sudo: false
|
|
||||||
language: go
|
|
||||||
go:
|
|
||||||
- 1.5.4
|
|
||||||
- 1.6.2
|
|
||||||
- tip
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- go: 1.4.3
|
|
||||||
script:
|
|
||||||
- go get -t -v ./...
|
|
||||||
- go test -v -race ./...
|
|
||||||
allow_failures:
|
|
||||||
- go: tip
|
|
||||||
fast_finish: true
|
|
||||||
install:
|
|
||||||
- # Do nothing. This is needed to prevent default install action "go get -t -v ./..." from happening here (we want it to happen inside script step).
|
|
||||||
script:
|
|
||||||
- go get -t -v ./...
|
|
||||||
- diff -u <(echo -n) <(gofmt -d -s .)
|
|
||||||
- go tool vet .
|
|
||||||
- go test -v -race ./...
|
|
3
vendor/github.com/google/go-github/AUTHORS
generated
vendored
3
vendor/github.com/google/go-github/AUTHORS
generated
vendored
|
@ -2,6 +2,7 @@
|
||||||
# This file is distinct from the CONTRIBUTORS files.
|
# This file is distinct from the CONTRIBUTORS files.
|
||||||
# See the latter for an explanation.
|
# See the latter for an explanation.
|
||||||
|
|
||||||
|
Ainsley Chong <ainsley.chong@gmail.com>
|
||||||
Akeda Bagus <akeda@x-team.com>
|
Akeda Bagus <akeda@x-team.com>
|
||||||
Alec Thomas <alec@swapoff.org>
|
Alec Thomas <alec@swapoff.org>
|
||||||
Alexander Harkness <me@bearbin.net>
|
Alexander Harkness <me@bearbin.net>
|
||||||
|
@ -10,6 +11,7 @@ Andreas Garnæs <https://github.com/andreas>
|
||||||
Andrew Ryabchun <aryabchun@mail.ua>
|
Andrew Ryabchun <aryabchun@mail.ua>
|
||||||
Arıl Bozoluk <arilbozoluk@hotmail.com>
|
Arıl Bozoluk <arilbozoluk@hotmail.com>
|
||||||
Austin Dizzy <dizzy@wow.com>
|
Austin Dizzy <dizzy@wow.com>
|
||||||
|
Beshr Kayali <beshrkayali@gmail.com>
|
||||||
Beyang Liu <beyang.liu@gmail.com>
|
Beyang Liu <beyang.liu@gmail.com>
|
||||||
Björn Häuser <b.haeuser@rebuy.de>
|
Björn Häuser <b.haeuser@rebuy.de>
|
||||||
Brad Harris <bmharris@gmail.com>
|
Brad Harris <bmharris@gmail.com>
|
||||||
|
@ -30,6 +32,7 @@ erwinvaneyk <erwinvaneyk@gmail.com>
|
||||||
Filippo Valsorda <hi@filippo.io>
|
Filippo Valsorda <hi@filippo.io>
|
||||||
Francis <hello@francismakes.com>
|
Francis <hello@francismakes.com>
|
||||||
Fredrik Jönsson <fredrik.jonsson@izettle.com>
|
Fredrik Jönsson <fredrik.jonsson@izettle.com>
|
||||||
|
Garrett Squire <garrettsquire@gmail.com>
|
||||||
Georgy Buranov <gburanov@gmail.com>
|
Georgy Buranov <gburanov@gmail.com>
|
||||||
Google Inc.
|
Google Inc.
|
||||||
griffin_stewie <panterathefamilyguy@gmail.com>
|
griffin_stewie <panterathefamilyguy@gmail.com>
|
||||||
|
|
3
vendor/github.com/google/go-github/CONTRIBUTORS
generated
vendored
3
vendor/github.com/google/go-github/CONTRIBUTORS
generated
vendored
|
@ -10,6 +10,7 @@
|
||||||
# copyright _license_. You retain the copyright on your
|
# copyright _license_. You retain the copyright on your
|
||||||
# contributions.
|
# contributions.
|
||||||
|
|
||||||
|
Ainsley Chong <ainsley.chong@gmail.com>
|
||||||
Akeda Bagus <akeda@x-team.com>
|
Akeda Bagus <akeda@x-team.com>
|
||||||
Alec Thomas <alec@swapoff.org>
|
Alec Thomas <alec@swapoff.org>
|
||||||
Alex Bramley <a.bramley@gmail.com>
|
Alex Bramley <a.bramley@gmail.com>
|
||||||
|
@ -20,6 +21,7 @@ Andreas Garnæs <https://github.com/andreas>
|
||||||
Andrew Ryabchun <aryabchun@mail.ua>
|
Andrew Ryabchun <aryabchun@mail.ua>
|
||||||
Arıl Bozoluk <arilbozoluk@hotmail.com>
|
Arıl Bozoluk <arilbozoluk@hotmail.com>
|
||||||
Austin Dizzy <dizzy@wow.com>
|
Austin Dizzy <dizzy@wow.com>
|
||||||
|
Beshr Kayali <beshrkayali@gmail.com>
|
||||||
Beyang Liu <beyang.liu@gmail.com>
|
Beyang Liu <beyang.liu@gmail.com>
|
||||||
Billy Lynch <wlynch@google.com> <wlynch92@gmail.com>
|
Billy Lynch <wlynch@google.com> <wlynch92@gmail.com>
|
||||||
Björn Häuser <b.haeuser@rebuy.de>
|
Björn Häuser <b.haeuser@rebuy.de>
|
||||||
|
@ -45,6 +47,7 @@ erwinvaneyk <erwinvaneyk@gmail.com>
|
||||||
Filippo Valsorda <hi@filippo.io>
|
Filippo Valsorda <hi@filippo.io>
|
||||||
Francis <hello@francismakes.com>
|
Francis <hello@francismakes.com>
|
||||||
Fredrik Jönsson <fredrik.jonsson@izettle.com>
|
Fredrik Jönsson <fredrik.jonsson@izettle.com>
|
||||||
|
Garrett Squire <garrettsquire@gmail.com>
|
||||||
Georgy Buranov <gburanov@gmail.com>
|
Georgy Buranov <gburanov@gmail.com>
|
||||||
Glenn Lewis <gmlewis@google.com>
|
Glenn Lewis <gmlewis@google.com>
|
||||||
griffin_stewie <panterathefamilyguy@gmail.com>
|
griffin_stewie <panterathefamilyguy@gmail.com>
|
||||||
|
|
32
vendor/github.com/google/go-github/github/activity_events.go
generated
vendored
32
vendor/github.com/google/go-github/github/activity_events.go
generated
vendored
|
@ -85,7 +85,7 @@ func (e *Event) Payload() (payload interface{}) {
|
||||||
// ListEvents drinks from the firehose of all public events across GitHub.
|
// ListEvents drinks from the firehose of all public events across GitHub.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-public-events
|
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-public-events
|
||||||
func (s *ActivityService) ListEvents(opt *ListOptions) ([]Event, *Response, error) {
|
func (s *ActivityService) ListEvents(opt *ListOptions) ([]*Event, *Response, error) {
|
||||||
u, err := addOptions("events", opt)
|
u, err := addOptions("events", opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
@ -96,7 +96,7 @@ func (s *ActivityService) ListEvents(opt *ListOptions) ([]Event, *Response, erro
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
events := new([]Event)
|
events := new([]*Event)
|
||||||
resp, err := s.client.Do(req, events)
|
resp, err := s.client.Do(req, events)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -108,7 +108,7 @@ func (s *ActivityService) ListEvents(opt *ListOptions) ([]Event, *Response, erro
|
||||||
// ListRepositoryEvents lists events for a repository.
|
// ListRepositoryEvents lists events for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-repository-events
|
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-repository-events
|
||||||
func (s *ActivityService) ListRepositoryEvents(owner, repo string, opt *ListOptions) ([]Event, *Response, error) {
|
func (s *ActivityService) ListRepositoryEvents(owner, repo string, opt *ListOptions) ([]*Event, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/events", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/events", owner, repo)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -120,7 +120,7 @@ func (s *ActivityService) ListRepositoryEvents(owner, repo string, opt *ListOpti
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
events := new([]Event)
|
events := new([]*Event)
|
||||||
resp, err := s.client.Do(req, events)
|
resp, err := s.client.Do(req, events)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -132,7 +132,7 @@ func (s *ActivityService) ListRepositoryEvents(owner, repo string, opt *ListOpti
|
||||||
// ListIssueEventsForRepository lists issue events for a repository.
|
// ListIssueEventsForRepository lists issue events for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
|
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
|
||||||
func (s *ActivityService) ListIssueEventsForRepository(owner, repo string, opt *ListOptions) ([]Event, *Response, error) {
|
func (s *ActivityService) ListIssueEventsForRepository(owner, repo string, opt *ListOptions) ([]*Event, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/events", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/issues/events", owner, repo)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -144,7 +144,7 @@ func (s *ActivityService) ListIssueEventsForRepository(owner, repo string, opt *
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
events := new([]Event)
|
events := new([]*Event)
|
||||||
resp, err := s.client.Do(req, events)
|
resp, err := s.client.Do(req, events)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -156,7 +156,7 @@ func (s *ActivityService) ListIssueEventsForRepository(owner, repo string, opt *
|
||||||
// ListEventsForRepoNetwork lists public events for a network of repositories.
|
// ListEventsForRepoNetwork lists public events for a network of repositories.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-public-events-for-a-network-of-repositories
|
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-public-events-for-a-network-of-repositories
|
||||||
func (s *ActivityService) ListEventsForRepoNetwork(owner, repo string, opt *ListOptions) ([]Event, *Response, error) {
|
func (s *ActivityService) ListEventsForRepoNetwork(owner, repo string, opt *ListOptions) ([]*Event, *Response, error) {
|
||||||
u := fmt.Sprintf("networks/%v/%v/events", owner, repo)
|
u := fmt.Sprintf("networks/%v/%v/events", owner, repo)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -168,7 +168,7 @@ func (s *ActivityService) ListEventsForRepoNetwork(owner, repo string, opt *List
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
events := new([]Event)
|
events := new([]*Event)
|
||||||
resp, err := s.client.Do(req, events)
|
resp, err := s.client.Do(req, events)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -180,7 +180,7 @@ func (s *ActivityService) ListEventsForRepoNetwork(owner, repo string, opt *List
|
||||||
// ListEventsForOrganization lists public events for an organization.
|
// ListEventsForOrganization lists public events for an organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-public-events-for-an-organization
|
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-public-events-for-an-organization
|
||||||
func (s *ActivityService) ListEventsForOrganization(org string, opt *ListOptions) ([]Event, *Response, error) {
|
func (s *ActivityService) ListEventsForOrganization(org string, opt *ListOptions) ([]*Event, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/events", org)
|
u := fmt.Sprintf("orgs/%v/events", org)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -192,7 +192,7 @@ func (s *ActivityService) ListEventsForOrganization(org string, opt *ListOptions
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
events := new([]Event)
|
events := new([]*Event)
|
||||||
resp, err := s.client.Do(req, events)
|
resp, err := s.client.Do(req, events)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -205,7 +205,7 @@ func (s *ActivityService) ListEventsForOrganization(org string, opt *ListOptions
|
||||||
// true, only public events will be returned.
|
// true, only public events will be returned.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-events-performed-by-a-user
|
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-events-performed-by-a-user
|
||||||
func (s *ActivityService) ListEventsPerformedByUser(user string, publicOnly bool, opt *ListOptions) ([]Event, *Response, error) {
|
func (s *ActivityService) ListEventsPerformedByUser(user string, publicOnly bool, opt *ListOptions) ([]*Event, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if publicOnly {
|
if publicOnly {
|
||||||
u = fmt.Sprintf("users/%v/events/public", user)
|
u = fmt.Sprintf("users/%v/events/public", user)
|
||||||
|
@ -222,7 +222,7 @@ func (s *ActivityService) ListEventsPerformedByUser(user string, publicOnly bool
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
events := new([]Event)
|
events := new([]*Event)
|
||||||
resp, err := s.client.Do(req, events)
|
resp, err := s.client.Do(req, events)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -235,7 +235,7 @@ func (s *ActivityService) ListEventsPerformedByUser(user string, publicOnly bool
|
||||||
// true, only public events will be returned.
|
// true, only public events will be returned.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received
|
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received
|
||||||
func (s *ActivityService) ListEventsReceivedByUser(user string, publicOnly bool, opt *ListOptions) ([]Event, *Response, error) {
|
func (s *ActivityService) ListEventsReceivedByUser(user string, publicOnly bool, opt *ListOptions) ([]*Event, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if publicOnly {
|
if publicOnly {
|
||||||
u = fmt.Sprintf("users/%v/received_events/public", user)
|
u = fmt.Sprintf("users/%v/received_events/public", user)
|
||||||
|
@ -252,7 +252,7 @@ func (s *ActivityService) ListEventsReceivedByUser(user string, publicOnly bool,
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
events := new([]Event)
|
events := new([]*Event)
|
||||||
resp, err := s.client.Do(req, events)
|
resp, err := s.client.Do(req, events)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -265,7 +265,7 @@ func (s *ActivityService) ListEventsReceivedByUser(user string, publicOnly bool,
|
||||||
// must be authenticated as the user to view this.
|
// must be authenticated as the user to view this.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-events-for-an-organization
|
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-events-for-an-organization
|
||||||
func (s *ActivityService) ListUserEventsForOrganization(org, user string, opt *ListOptions) ([]Event, *Response, error) {
|
func (s *ActivityService) ListUserEventsForOrganization(org, user string, opt *ListOptions) ([]*Event, *Response, error) {
|
||||||
u := fmt.Sprintf("users/%v/events/orgs/%v", user, org)
|
u := fmt.Sprintf("users/%v/events/orgs/%v", user, org)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -277,7 +277,7 @@ func (s *ActivityService) ListUserEventsForOrganization(org, user string, opt *L
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
events := new([]Event)
|
events := new([]*Event)
|
||||||
resp, err := s.client.Do(req, events)
|
resp, err := s.client.Do(req, events)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
20
vendor/github.com/google/go-github/github/activity_events_test.go
generated
vendored
20
vendor/github.com/google/go-github/github/activity_events_test.go
generated
vendored
|
@ -31,7 +31,7 @@ func TestActivityService_ListEvents(t *testing.T) {
|
||||||
t.Errorf("Activities.ListEvents returned error: %v", err)
|
t.Errorf("Activities.ListEvents returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Event{{ID: String("1")}, {ID: String("2")}}
|
want := []*Event{{ID: String("1")}, {ID: String("2")}}
|
||||||
if !reflect.DeepEqual(events, want) {
|
if !reflect.DeepEqual(events, want) {
|
||||||
t.Errorf("Activities.ListEvents returned %+v, want %+v", events, want)
|
t.Errorf("Activities.ListEvents returned %+v, want %+v", events, want)
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ func TestActivityService_ListRepositoryEvents(t *testing.T) {
|
||||||
t.Errorf("Activities.ListRepositoryEvents returned error: %v", err)
|
t.Errorf("Activities.ListRepositoryEvents returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Event{{ID: String("1")}, {ID: String("2")}}
|
want := []*Event{{ID: String("1")}, {ID: String("2")}}
|
||||||
if !reflect.DeepEqual(events, want) {
|
if !reflect.DeepEqual(events, want) {
|
||||||
t.Errorf("Activities.ListRepositoryEvents returned %+v, want %+v", events, want)
|
t.Errorf("Activities.ListRepositoryEvents returned %+v, want %+v", events, want)
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ func TestActivityService_ListIssueEventsForRepository(t *testing.T) {
|
||||||
t.Errorf("Activities.ListIssueEventsForRepository returned error: %v", err)
|
t.Errorf("Activities.ListIssueEventsForRepository returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Event{{ID: String("1")}, {ID: String("2")}}
|
want := []*Event{{ID: String("1")}, {ID: String("2")}}
|
||||||
if !reflect.DeepEqual(events, want) {
|
if !reflect.DeepEqual(events, want) {
|
||||||
t.Errorf("Activities.ListIssueEventsForRepository returned %+v, want %+v", events, want)
|
t.Errorf("Activities.ListIssueEventsForRepository returned %+v, want %+v", events, want)
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ func TestActivityService_ListEventsForRepoNetwork(t *testing.T) {
|
||||||
t.Errorf("Activities.ListEventsForRepoNetwork returned error: %v", err)
|
t.Errorf("Activities.ListEventsForRepoNetwork returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Event{{ID: String("1")}, {ID: String("2")}}
|
want := []*Event{{ID: String("1")}, {ID: String("2")}}
|
||||||
if !reflect.DeepEqual(events, want) {
|
if !reflect.DeepEqual(events, want) {
|
||||||
t.Errorf("Activities.ListEventsForRepoNetwork returned %+v, want %+v", events, want)
|
t.Errorf("Activities.ListEventsForRepoNetwork returned %+v, want %+v", events, want)
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ func TestActivityService_ListEventsForOrganization(t *testing.T) {
|
||||||
t.Errorf("Activities.ListEventsForOrganization returned error: %v", err)
|
t.Errorf("Activities.ListEventsForOrganization returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Event{{ID: String("1")}, {ID: String("2")}}
|
want := []*Event{{ID: String("1")}, {ID: String("2")}}
|
||||||
if !reflect.DeepEqual(events, want) {
|
if !reflect.DeepEqual(events, want) {
|
||||||
t.Errorf("Activities.ListEventsForOrganization returned %+v, want %+v", events, want)
|
t.Errorf("Activities.ListEventsForOrganization returned %+v, want %+v", events, want)
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ func TestActivityService_ListEventsPerformedByUser_all(t *testing.T) {
|
||||||
t.Errorf("Events.ListPerformedByUser returned error: %v", err)
|
t.Errorf("Events.ListPerformedByUser returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Event{{ID: String("1")}, {ID: String("2")}}
|
want := []*Event{{ID: String("1")}, {ID: String("2")}}
|
||||||
if !reflect.DeepEqual(events, want) {
|
if !reflect.DeepEqual(events, want) {
|
||||||
t.Errorf("Events.ListPerformedByUser returned %+v, want %+v", events, want)
|
t.Errorf("Events.ListPerformedByUser returned %+v, want %+v", events, want)
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ func TestActivityService_ListEventsPerformedByUser_publicOnly(t *testing.T) {
|
||||||
t.Errorf("Events.ListPerformedByUser returned error: %v", err)
|
t.Errorf("Events.ListPerformedByUser returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Event{{ID: String("1")}, {ID: String("2")}}
|
want := []*Event{{ID: String("1")}, {ID: String("2")}}
|
||||||
if !reflect.DeepEqual(events, want) {
|
if !reflect.DeepEqual(events, want) {
|
||||||
t.Errorf("Events.ListPerformedByUser returned %+v, want %+v", events, want)
|
t.Errorf("Events.ListPerformedByUser returned %+v, want %+v", events, want)
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ func TestActivityService_ListEventsReceivedByUser_all(t *testing.T) {
|
||||||
t.Errorf("Events.ListReceivedByUser returned error: %v", err)
|
t.Errorf("Events.ListReceivedByUser returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Event{{ID: String("1")}, {ID: String("2")}}
|
want := []*Event{{ID: String("1")}, {ID: String("2")}}
|
||||||
if !reflect.DeepEqual(events, want) {
|
if !reflect.DeepEqual(events, want) {
|
||||||
t.Errorf("Events.ListReceivedUser returned %+v, want %+v", events, want)
|
t.Errorf("Events.ListReceivedUser returned %+v, want %+v", events, want)
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ func TestActivityService_ListEventsReceivedByUser_publicOnly(t *testing.T) {
|
||||||
t.Errorf("Events.ListReceivedByUser returned error: %v", err)
|
t.Errorf("Events.ListReceivedByUser returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Event{{ID: String("1")}, {ID: String("2")}}
|
want := []*Event{{ID: String("1")}, {ID: String("2")}}
|
||||||
if !reflect.DeepEqual(events, want) {
|
if !reflect.DeepEqual(events, want) {
|
||||||
t.Errorf("Events.ListReceivedByUser returned %+v, want %+v", events, want)
|
t.Errorf("Events.ListReceivedByUser returned %+v, want %+v", events, want)
|
||||||
}
|
}
|
||||||
|
@ -269,7 +269,7 @@ func TestActivityService_ListUserEventsForOrganization(t *testing.T) {
|
||||||
t.Errorf("Activities.ListUserEventsForOrganization returned error: %v", err)
|
t.Errorf("Activities.ListUserEventsForOrganization returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Event{{ID: String("1")}, {ID: String("2")}}
|
want := []*Event{{ID: String("1")}, {ID: String("2")}}
|
||||||
if !reflect.DeepEqual(events, want) {
|
if !reflect.DeepEqual(events, want) {
|
||||||
t.Errorf("Activities.ListUserEventsForOrganization returned %+v, want %+v", events, want)
|
t.Errorf("Activities.ListUserEventsForOrganization returned %+v, want %+v", events, want)
|
||||||
}
|
}
|
||||||
|
|
10
vendor/github.com/google/go-github/github/activity_notifications.go
generated
vendored
10
vendor/github.com/google/go-github/github/activity_notifications.go
generated
vendored
|
@ -42,12 +42,14 @@ type NotificationListOptions struct {
|
||||||
Participating bool `url:"participating,omitempty"`
|
Participating bool `url:"participating,omitempty"`
|
||||||
Since time.Time `url:"since,omitempty"`
|
Since time.Time `url:"since,omitempty"`
|
||||||
Before time.Time `url:"before,omitempty"`
|
Before time.Time `url:"before,omitempty"`
|
||||||
|
|
||||||
|
ListOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListNotifications lists all notifications for the authenticated user.
|
// ListNotifications lists all notifications for the authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API Docs: https://developer.github.com/v3/activity/notifications/#list-your-notifications
|
// GitHub API Docs: https://developer.github.com/v3/activity/notifications/#list-your-notifications
|
||||||
func (s *ActivityService) ListNotifications(opt *NotificationListOptions) ([]Notification, *Response, error) {
|
func (s *ActivityService) ListNotifications(opt *NotificationListOptions) ([]*Notification, *Response, error) {
|
||||||
u := fmt.Sprintf("notifications")
|
u := fmt.Sprintf("notifications")
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -59,7 +61,7 @@ func (s *ActivityService) ListNotifications(opt *NotificationListOptions) ([]Not
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var notifications []Notification
|
var notifications []*Notification
|
||||||
resp, err := s.client.Do(req, ¬ifications)
|
resp, err := s.client.Do(req, ¬ifications)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -72,7 +74,7 @@ func (s *ActivityService) ListNotifications(opt *NotificationListOptions) ([]Not
|
||||||
// for the authenticated user.
|
// for the authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API Docs: https://developer.github.com/v3/activity/notifications/#list-your-notifications-in-a-repository
|
// GitHub API Docs: https://developer.github.com/v3/activity/notifications/#list-your-notifications-in-a-repository
|
||||||
func (s *ActivityService) ListRepositoryNotifications(owner, repo string, opt *NotificationListOptions) ([]Notification, *Response, error) {
|
func (s *ActivityService) ListRepositoryNotifications(owner, repo string, opt *NotificationListOptions) ([]*Notification, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/notifications", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/notifications", owner, repo)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -84,7 +86,7 @@ func (s *ActivityService) ListRepositoryNotifications(owner, repo string, opt *N
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var notifications []Notification
|
var notifications []*Notification
|
||||||
resp, err := s.client.Do(req, ¬ifications)
|
resp, err := s.client.Do(req, ¬ifications)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
4
vendor/github.com/google/go-github/github/activity_notifications_test.go
generated
vendored
4
vendor/github.com/google/go-github/github/activity_notifications_test.go
generated
vendored
|
@ -41,7 +41,7 @@ func TestActivityService_ListNotification(t *testing.T) {
|
||||||
t.Errorf("Activity.ListNotifications returned error: %v", err)
|
t.Errorf("Activity.ListNotifications returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Notification{{ID: String("1"), Subject: &NotificationSubject{Title: String("t")}}}
|
want := []*Notification{{ID: String("1"), Subject: &NotificationSubject{Title: String("t")}}}
|
||||||
if !reflect.DeepEqual(notifications, want) {
|
if !reflect.DeepEqual(notifications, want) {
|
||||||
t.Errorf("Activity.ListNotifications returned %+v, want %+v", notifications, want)
|
t.Errorf("Activity.ListNotifications returned %+v, want %+v", notifications, want)
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ func TestActivityService_ListRepositoryNotification(t *testing.T) {
|
||||||
t.Errorf("Activity.ListRepositoryNotifications returned error: %v", err)
|
t.Errorf("Activity.ListRepositoryNotifications returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Notification{{ID: String("1")}}
|
want := []*Notification{{ID: String("1")}}
|
||||||
if !reflect.DeepEqual(notifications, want) {
|
if !reflect.DeepEqual(notifications, want) {
|
||||||
t.Errorf("Activity.ListRepositoryNotifications returned %+v, want %+v", notifications, want)
|
t.Errorf("Activity.ListRepositoryNotifications returned %+v, want %+v", notifications, want)
|
||||||
}
|
}
|
||||||
|
|
8
vendor/github.com/google/go-github/github/activity_star.go
generated
vendored
8
vendor/github.com/google/go-github/github/activity_star.go
generated
vendored
|
@ -22,7 +22,7 @@ type Stargazer struct {
|
||||||
// ListStargazers lists people who have starred the specified repo.
|
// ListStargazers lists people who have starred the specified repo.
|
||||||
//
|
//
|
||||||
// GitHub API Docs: https://developer.github.com/v3/activity/starring/#list-stargazers
|
// GitHub API Docs: https://developer.github.com/v3/activity/starring/#list-stargazers
|
||||||
func (s *ActivityService) ListStargazers(owner, repo string, opt *ListOptions) ([]Stargazer, *Response, error) {
|
func (s *ActivityService) ListStargazers(owner, repo string, opt *ListOptions) ([]*Stargazer, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/stargazers", owner, repo)
|
u := fmt.Sprintf("repos/%s/%s/stargazers", owner, repo)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -37,7 +37,7 @@ func (s *ActivityService) ListStargazers(owner, repo string, opt *ListOptions) (
|
||||||
// TODO: remove custom Accept header when this API fully launches
|
// TODO: remove custom Accept header when this API fully launches
|
||||||
req.Header.Set("Accept", mediaTypeStarringPreview)
|
req.Header.Set("Accept", mediaTypeStarringPreview)
|
||||||
|
|
||||||
stargazers := new([]Stargazer)
|
stargazers := new([]*Stargazer)
|
||||||
resp, err := s.client.Do(req, stargazers)
|
resp, err := s.client.Do(req, stargazers)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -64,7 +64,7 @@ type ActivityListStarredOptions struct {
|
||||||
// will list the starred repositories for the authenticated user.
|
// will list the starred repositories for the authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/activity/starring/#list-repositories-being-starred
|
// GitHub API docs: http://developer.github.com/v3/activity/starring/#list-repositories-being-starred
|
||||||
func (s *ActivityService) ListStarred(user string, opt *ActivityListStarredOptions) ([]StarredRepository, *Response, error) {
|
func (s *ActivityService) ListStarred(user string, opt *ActivityListStarredOptions) ([]*StarredRepository, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if user != "" {
|
if user != "" {
|
||||||
u = fmt.Sprintf("users/%v/starred", user)
|
u = fmt.Sprintf("users/%v/starred", user)
|
||||||
|
@ -84,7 +84,7 @@ func (s *ActivityService) ListStarred(user string, opt *ActivityListStarredOptio
|
||||||
// TODO: remove custom Accept header when this API fully launches
|
// TODO: remove custom Accept header when this API fully launches
|
||||||
req.Header.Set("Accept", mediaTypeStarringPreview)
|
req.Header.Set("Accept", mediaTypeStarringPreview)
|
||||||
|
|
||||||
repos := new([]StarredRepository)
|
repos := new([]*StarredRepository)
|
||||||
resp, err := s.client.Do(req, repos)
|
resp, err := s.client.Do(req, repos)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
6
vendor/github.com/google/go-github/github/activity_star_test.go
generated
vendored
6
vendor/github.com/google/go-github/github/activity_star_test.go
generated
vendored
|
@ -32,7 +32,7 @@ func TestActivityService_ListStargazers(t *testing.T) {
|
||||||
t.Errorf("Activity.ListStargazers returned error: %v", err)
|
t.Errorf("Activity.ListStargazers returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Stargazer{{StarredAt: &Timestamp{time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC)}, User: &User{ID: Int(1)}}}
|
want := []*Stargazer{{StarredAt: &Timestamp{time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC)}, User: &User{ID: Int(1)}}}
|
||||||
if !reflect.DeepEqual(stargazers, want) {
|
if !reflect.DeepEqual(stargazers, want) {
|
||||||
t.Errorf("Activity.ListStargazers returned %+v, want %+v", stargazers, want)
|
t.Errorf("Activity.ListStargazers returned %+v, want %+v", stargazers, want)
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ func TestActivityService_ListStarred_authenticatedUser(t *testing.T) {
|
||||||
t.Errorf("Activity.ListStarred returned error: %v", err)
|
t.Errorf("Activity.ListStarred returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []StarredRepository{{StarredAt: &Timestamp{time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC)}, Repository: &Repository{ID: Int(1)}}}
|
want := []*StarredRepository{{StarredAt: &Timestamp{time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC)}, Repository: &Repository{ID: Int(1)}}}
|
||||||
if !reflect.DeepEqual(repos, want) {
|
if !reflect.DeepEqual(repos, want) {
|
||||||
t.Errorf("Activity.ListStarred returned %+v, want %+v", repos, want)
|
t.Errorf("Activity.ListStarred returned %+v, want %+v", repos, want)
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ func TestActivityService_ListStarred_specifiedUser(t *testing.T) {
|
||||||
t.Errorf("Activity.ListStarred returned error: %v", err)
|
t.Errorf("Activity.ListStarred returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []StarredRepository{{StarredAt: &Timestamp{time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC)}, Repository: &Repository{ID: Int(2)}}}
|
want := []*StarredRepository{{StarredAt: &Timestamp{time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC)}, Repository: &Repository{ID: Int(2)}}}
|
||||||
if !reflect.DeepEqual(repos, want) {
|
if !reflect.DeepEqual(repos, want) {
|
||||||
t.Errorf("Activity.ListStarred returned %+v, want %+v", repos, want)
|
t.Errorf("Activity.ListStarred returned %+v, want %+v", repos, want)
|
||||||
}
|
}
|
||||||
|
|
8
vendor/github.com/google/go-github/github/activity_watching.go
generated
vendored
8
vendor/github.com/google/go-github/github/activity_watching.go
generated
vendored
|
@ -25,7 +25,7 @@ type Subscription struct {
|
||||||
// ListWatchers lists watchers of a particular repo.
|
// ListWatchers lists watchers of a particular repo.
|
||||||
//
|
//
|
||||||
// GitHub API Docs: http://developer.github.com/v3/activity/watching/#list-watchers
|
// GitHub API Docs: http://developer.github.com/v3/activity/watching/#list-watchers
|
||||||
func (s *ActivityService) ListWatchers(owner, repo string, opt *ListOptions) ([]User, *Response, error) {
|
func (s *ActivityService) ListWatchers(owner, repo string, opt *ListOptions) ([]*User, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/subscribers", owner, repo)
|
u := fmt.Sprintf("repos/%s/%s/subscribers", owner, repo)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -37,7 +37,7 @@ func (s *ActivityService) ListWatchers(owner, repo string, opt *ListOptions) ([]
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
watchers := new([]User)
|
watchers := new([]*User)
|
||||||
resp, err := s.client.Do(req, watchers)
|
resp, err := s.client.Do(req, watchers)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -50,7 +50,7 @@ func (s *ActivityService) ListWatchers(owner, repo string, opt *ListOptions) ([]
|
||||||
// the empty string will fetch watched repos for the authenticated user.
|
// the empty string will fetch watched repos for the authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API Docs: https://developer.github.com/v3/activity/watching/#list-repositories-being-watched
|
// GitHub API Docs: https://developer.github.com/v3/activity/watching/#list-repositories-being-watched
|
||||||
func (s *ActivityService) ListWatched(user string, opt *ListOptions) ([]Repository, *Response, error) {
|
func (s *ActivityService) ListWatched(user string, opt *ListOptions) ([]*Repository, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if user != "" {
|
if user != "" {
|
||||||
u = fmt.Sprintf("users/%v/subscriptions", user)
|
u = fmt.Sprintf("users/%v/subscriptions", user)
|
||||||
|
@ -67,7 +67,7 @@ func (s *ActivityService) ListWatched(user string, opt *ListOptions) ([]Reposito
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
watched := new([]Repository)
|
watched := new([]*Repository)
|
||||||
resp, err := s.client.Do(req, watched)
|
resp, err := s.client.Do(req, watched)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
7
vendor/github.com/google/go-github/github/activity_watching_test.go
generated
vendored
7
vendor/github.com/google/go-github/github/activity_watching_test.go
generated
vendored
|
@ -31,7 +31,7 @@ func TestActivityService_ListWatchers(t *testing.T) {
|
||||||
t.Errorf("Activity.ListWatchers returned error: %v", err)
|
t.Errorf("Activity.ListWatchers returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []User{{ID: Int(1)}}
|
want := []*User{{ID: Int(1)}}
|
||||||
if !reflect.DeepEqual(watchers, want) {
|
if !reflect.DeepEqual(watchers, want) {
|
||||||
t.Errorf("Activity.ListWatchers returned %+v, want %+v", watchers, want)
|
t.Errorf("Activity.ListWatchers returned %+v, want %+v", watchers, want)
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ func TestActivityService_ListWatched_authenticatedUser(t *testing.T) {
|
||||||
t.Errorf("Activity.ListWatched returned error: %v", err)
|
t.Errorf("Activity.ListWatched returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Repository{{ID: Int(1)}}
|
want := []*Repository{{ID: Int(1)}}
|
||||||
if !reflect.DeepEqual(watched, want) {
|
if !reflect.DeepEqual(watched, want) {
|
||||||
t.Errorf("Activity.ListWatched returned %+v, want %+v", watched, want)
|
t.Errorf("Activity.ListWatched returned %+v, want %+v", watched, want)
|
||||||
}
|
}
|
||||||
|
@ -73,12 +73,11 @@ func TestActivityService_ListWatched_specifiedUser(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
watched, _, err := client.Activity.ListWatched("u", &ListOptions{Page: 2})
|
watched, _, err := client.Activity.ListWatched("u", &ListOptions{Page: 2})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Activity.ListWatched returned error: %v", err)
|
t.Errorf("Activity.ListWatched returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Repository{{ID: Int(1)}}
|
want := []*Repository{{ID: Int(1)}}
|
||||||
if !reflect.DeepEqual(watched, want) {
|
if !reflect.DeepEqual(watched, want) {
|
||||||
t.Errorf("Activity.ListWatched returned %+v, want %+v", watched, want)
|
t.Errorf("Activity.ListWatched returned %+v, want %+v", watched, want)
|
||||||
}
|
}
|
||||||
|
|
85
vendor/github.com/google/go-github/github/authorizations.go
generated
vendored
85
vendor/github.com/google/go-github/github/authorizations.go
generated
vendored
|
@ -35,6 +35,9 @@ const (
|
||||||
ScopeReadPublicKey Scope = "read:public_key"
|
ScopeReadPublicKey Scope = "read:public_key"
|
||||||
ScopeWritePublicKey Scope = "write:public_key"
|
ScopeWritePublicKey Scope = "write:public_key"
|
||||||
ScopeAdminPublicKey Scope = "admin:public_key"
|
ScopeAdminPublicKey Scope = "admin:public_key"
|
||||||
|
ScopeReadGPGKey Scope = "read:gpg_key"
|
||||||
|
ScopeWriteGPGKey Scope = "write:gpg_key"
|
||||||
|
ScopeAdminGPGKey Scope = "admin:gpg_key"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AuthorizationsService handles communication with the authorization related
|
// AuthorizationsService handles communication with the authorization related
|
||||||
|
@ -82,6 +85,20 @@ func (a AuthorizationApp) String() string {
|
||||||
return Stringify(a)
|
return Stringify(a)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Grant represents an OAuth application that has been granted access to an account.
|
||||||
|
type Grant struct {
|
||||||
|
ID *int `json:"id,omitempty"`
|
||||||
|
URL *string `json:"url,omitempty"`
|
||||||
|
App *AuthorizationApp `json:"app,omitempty"`
|
||||||
|
CreatedAt *Timestamp `json:"created_at,omitempty"`
|
||||||
|
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
|
||||||
|
Scopes []string `json:"scopes,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g Grant) String() string {
|
||||||
|
return Stringify(g)
|
||||||
|
}
|
||||||
|
|
||||||
// AuthorizationRequest represents a request to create an authorization.
|
// AuthorizationRequest represents a request to create an authorization.
|
||||||
type AuthorizationRequest struct {
|
type AuthorizationRequest struct {
|
||||||
Scopes []Scope `json:"scopes,omitempty"`
|
Scopes []Scope `json:"scopes,omitempty"`
|
||||||
|
@ -119,7 +136,7 @@ func (a AuthorizationUpdateRequest) String() string {
|
||||||
// List the authorizations for the authenticated user.
|
// List the authorizations for the authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#list-your-authorizations
|
// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#list-your-authorizations
|
||||||
func (s *AuthorizationsService) List(opt *ListOptions) ([]Authorization, *Response, error) {
|
func (s *AuthorizationsService) List(opt *ListOptions) ([]*Authorization, *Response, error) {
|
||||||
u := "authorizations"
|
u := "authorizations"
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -131,7 +148,7 @@ func (s *AuthorizationsService) List(opt *ListOptions) ([]Authorization, *Respon
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
auths := new([]Authorization)
|
auths := new([]*Authorization)
|
||||||
resp, err := s.client.Do(req, auths)
|
resp, err := s.client.Do(req, auths)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -318,3 +335,67 @@ func (s *AuthorizationsService) Revoke(clientID string, token string) (*Response
|
||||||
|
|
||||||
return s.client.Do(req, nil)
|
return s.client.Do(req, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListGrants lists the set of OAuth applications that have been granted
|
||||||
|
// access to a user's account. This will return one entry for each application
|
||||||
|
// that has been granted access to the account, regardless of the number of
|
||||||
|
// tokens an application has generated for the user.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#list-your-grants
|
||||||
|
func (s *AuthorizationsService) ListGrants() ([]*Grant, *Response, error) {
|
||||||
|
req, err := s.client.NewRequest("GET", "applications/grants", nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: remove custom Accept header when this API fully launches.
|
||||||
|
req.Header.Set("Accept", mediaTypeOAuthGrantAuthorizationsPreview)
|
||||||
|
|
||||||
|
grants := []*Grant{}
|
||||||
|
resp, err := s.client.Do(req, &grants)
|
||||||
|
if err != nil {
|
||||||
|
return nil, resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return grants, resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetGrant gets a single OAuth application grant.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#get-a-single-grant
|
||||||
|
func (s *AuthorizationsService) GetGrant(id int) (*Grant, *Response, error) {
|
||||||
|
u := fmt.Sprintf("applications/grants/%d", id)
|
||||||
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: remove custom Accept header when this API fully launches.
|
||||||
|
req.Header.Set("Accept", mediaTypeOAuthGrantAuthorizationsPreview)
|
||||||
|
|
||||||
|
grant := new(Grant)
|
||||||
|
resp, err := s.client.Do(req, grant)
|
||||||
|
if err != nil {
|
||||||
|
return nil, resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return grant, resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteGrant deletes an OAuth application grant. Deleting an application's
|
||||||
|
// grant will also delete all OAuth tokens associated with the application for
|
||||||
|
// the user.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#delete-a-grant
|
||||||
|
func (s *AuthorizationsService) DeleteGrant(id int) (*Response, error) {
|
||||||
|
u := fmt.Sprintf("applications/grants/%d", id)
|
||||||
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: remove custom Accept header when this API fully launches.
|
||||||
|
req.Header.Set("Accept", mediaTypeOAuthGrantAuthorizationsPreview)
|
||||||
|
|
||||||
|
return s.client.Do(req, nil)
|
||||||
|
}
|
||||||
|
|
59
vendor/github.com/google/go-github/github/authorizations_test.go
generated
vendored
59
vendor/github.com/google/go-github/github/authorizations_test.go
generated
vendored
|
@ -29,7 +29,7 @@ func TestAuthorizationsService_List(t *testing.T) {
|
||||||
t.Errorf("Authorizations.List returned error: %v", err)
|
t.Errorf("Authorizations.List returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Authorization{{ID: Int(1)}}
|
want := []*Authorization{{ID: Int(1)}}
|
||||||
if !reflect.DeepEqual(got, want) {
|
if !reflect.DeepEqual(got, want) {
|
||||||
t.Errorf("Authorizations.List returned %+v, want %+v", *got[0].ID, *want[0].ID)
|
t.Errorf("Authorizations.List returned %+v, want %+v", *got[0].ID, *want[0].ID)
|
||||||
}
|
}
|
||||||
|
@ -249,3 +249,60 @@ func TestAuthorizationsService_Revoke(t *testing.T) {
|
||||||
t.Errorf("Authorizations.Revoke returned error: %v", err)
|
t.Errorf("Authorizations.Revoke returned error: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestListGrants(t *testing.T) {
|
||||||
|
setup()
|
||||||
|
defer teardown()
|
||||||
|
|
||||||
|
mux.HandleFunc("/applications/grants", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
testMethod(t, r, "GET")
|
||||||
|
testHeader(t, r, "Accept", mediaTypeOAuthGrantAuthorizationsPreview)
|
||||||
|
fmt.Fprint(w, `[{"id": 1}]`)
|
||||||
|
})
|
||||||
|
|
||||||
|
got, _, err := client.Authorizations.ListGrants()
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("OAuthAuthorizations.ListGrants returned error: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
want := []*Grant{{ID: Int(1)}}
|
||||||
|
if !reflect.DeepEqual(got, want) {
|
||||||
|
t.Errorf("OAuthAuthorizations.ListGrants = %+v, want %+v", got, want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGetGrant(t *testing.T) {
|
||||||
|
setup()
|
||||||
|
defer teardown()
|
||||||
|
|
||||||
|
mux.HandleFunc("/applications/grants/1", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
testMethod(t, r, "GET")
|
||||||
|
testHeader(t, r, "Accept", mediaTypeOAuthGrantAuthorizationsPreview)
|
||||||
|
fmt.Fprint(w, `{"id": 1}`)
|
||||||
|
})
|
||||||
|
|
||||||
|
got, _, err := client.Authorizations.GetGrant(1)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("OAuthAuthorizations.GetGrant returned error: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
want := &Grant{ID: Int(1)}
|
||||||
|
if !reflect.DeepEqual(got, want) {
|
||||||
|
t.Errorf("OAuthAuthorizations.GetGrant = %+v, want %+v", got, want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestDeleteGrant(t *testing.T) {
|
||||||
|
setup()
|
||||||
|
defer teardown()
|
||||||
|
|
||||||
|
mux.HandleFunc("/applications/grants/1", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
testMethod(t, r, "DELETE")
|
||||||
|
testHeader(t, r, "Accept", mediaTypeOAuthGrantAuthorizationsPreview)
|
||||||
|
})
|
||||||
|
|
||||||
|
_, err := client.Authorizations.DeleteGrant(1)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("OAuthAuthorizations.DeleteGrant returned error: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
2
vendor/github.com/google/go-github/github/doc.go
generated
vendored
2
vendor/github.com/google/go-github/github/doc.go
generated
vendored
|
@ -116,7 +116,7 @@ PullRequestListOptions). Pages information is available via Response struct.
|
||||||
ListOptions: github.ListOptions{PerPage: 10},
|
ListOptions: github.ListOptions{PerPage: 10},
|
||||||
}
|
}
|
||||||
// get all pages of results
|
// get all pages of results
|
||||||
var allRepos []github.Repository
|
var allRepos []*github.Repository
|
||||||
for {
|
for {
|
||||||
repos, resp, err := client.Repositories.ListByOrg("github", opt)
|
repos, resp, err := client.Repositories.ListByOrg("github", opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
17
vendor/github.com/google/go-github/github/event_types.go
generated
vendored
17
vendor/github.com/google/go-github/github/event_types.go
generated
vendored
|
@ -316,12 +316,19 @@ func (p PushEvent) String() string {
|
||||||
|
|
||||||
// PushEventCommit represents a git commit in a GitHub PushEvent.
|
// PushEventCommit represents a git commit in a GitHub PushEvent.
|
||||||
type PushEventCommit struct {
|
type PushEventCommit struct {
|
||||||
SHA *string `json:"sha,omitempty"`
|
Message *string `json:"message,omitempty"`
|
||||||
Message *string `json:"message,omitempty"`
|
Author *CommitAuthor `json:"author,omitempty"`
|
||||||
Author *CommitAuthor `json:"author,omitempty"`
|
URL *string `json:"url,omitempty"`
|
||||||
|
Distinct *bool `json:"distinct,omitempty"`
|
||||||
|
|
||||||
|
// The following fields are only populated by Events API.
|
||||||
|
SHA *string `json:"sha,omitempty"`
|
||||||
|
|
||||||
|
// The following fields are only populated by Webhook events.
|
||||||
|
ID *string `json:"id,omitempty"`
|
||||||
|
TreeID *string `json:"tree_id,omitempty"`
|
||||||
|
Timestamp *Timestamp `json:"timestamp,omitempty"`
|
||||||
Committer *CommitAuthor `json:"committer,omitempty"`
|
Committer *CommitAuthor `json:"committer,omitempty"`
|
||||||
URL *string `json:"url,omitempty"`
|
|
||||||
Distinct *bool `json:"distinct,omitempty"`
|
|
||||||
Added []string `json:"added,omitempty"`
|
Added []string `json:"added,omitempty"`
|
||||||
Removed []string `json:"removed,omitempty"`
|
Removed []string `json:"removed,omitempty"`
|
||||||
Modified []string `json:"modified,omitempty"`
|
Modified []string `json:"modified,omitempty"`
|
||||||
|
|
75
vendor/github.com/google/go-github/github/examples_test.go
generated
vendored
Normal file
75
vendor/github.com/google/go-github/github/examples_test.go
generated
vendored
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
// Copyright 2016 The go-github AUTHORS. All rights reserved.
|
||||||
|
//
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package github_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
|
||||||
|
"github.com/google/go-github/github"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ExampleClient_Markdown() {
|
||||||
|
client := github.NewClient(nil)
|
||||||
|
|
||||||
|
input := "# heading #\n\nLink to issue #1"
|
||||||
|
opt := &github.MarkdownOptions{Mode: "gfm", Context: "google/go-github"}
|
||||||
|
|
||||||
|
output, _, err := client.Markdown(input, opt)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(output)
|
||||||
|
}
|
||||||
|
|
||||||
|
func ExampleRepositoriesService_GetReadme() {
|
||||||
|
client := github.NewClient(nil)
|
||||||
|
|
||||||
|
readme, _, err := client.Repositories.GetReadme("google", "go-github", nil)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
content, err := readme.GetContent()
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("google/go-github README:\n%v\n", content)
|
||||||
|
}
|
||||||
|
|
||||||
|
func ExampleRepositoriesService_List() {
|
||||||
|
client := github.NewClient(nil)
|
||||||
|
|
||||||
|
user := "willnorris"
|
||||||
|
opt := &github.RepositoryListOptions{Type: "owner", Sort: "updated", Direction: "desc"}
|
||||||
|
|
||||||
|
repos, _, err := client.Repositories.List(user, opt)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("Recently updated repositories by %q: %v", user, github.Stringify(repos))
|
||||||
|
}
|
||||||
|
|
||||||
|
func ExampleUsersService_ListAll() {
|
||||||
|
client := github.NewClient(nil)
|
||||||
|
opts := &github.UserListOptions{}
|
||||||
|
for {
|
||||||
|
users, _, err := client.Users.ListAll(opts)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("error listing users: %v", err)
|
||||||
|
}
|
||||||
|
if len(users) == 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
opts.Since = *users[len(users)-1].ID
|
||||||
|
// Process users...
|
||||||
|
}
|
||||||
|
}
|
76
vendor/github.com/google/go-github/github/gists.go
generated
vendored
76
vendor/github.com/google/go-github/github/gists.go
generated
vendored
|
@ -52,6 +52,32 @@ func (g GistFile) String() string {
|
||||||
return Stringify(g)
|
return Stringify(g)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GistCommit represents a commit on a gist.
|
||||||
|
type GistCommit struct {
|
||||||
|
URL *string `json:"url,omitempty"`
|
||||||
|
Version *string `json:"version,omitempty"`
|
||||||
|
User *User `json:"user,omitempty"`
|
||||||
|
ChangeStatus *CommitStats `json:"change_status,omitempty"`
|
||||||
|
CommitedAt *Timestamp `json:"commited_at,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (gc GistCommit) String() string {
|
||||||
|
return Stringify(gc)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GistFork represents a fork of a gist.
|
||||||
|
type GistFork struct {
|
||||||
|
URL *string `json:"url,omitempty"`
|
||||||
|
User *User `json:"user,omitempty"`
|
||||||
|
ID *string `json:"id,omitempty"`
|
||||||
|
CreatedAt *Timestamp `json:"created_at,omitempty"`
|
||||||
|
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (gf GistFork) String() string {
|
||||||
|
return Stringify(gf)
|
||||||
|
}
|
||||||
|
|
||||||
// GistListOptions specifies the optional parameters to the
|
// GistListOptions specifies the optional parameters to the
|
||||||
// GistsService.List, GistsService.ListAll, and GistsService.ListStarred methods.
|
// GistsService.List, GistsService.ListAll, and GistsService.ListStarred methods.
|
||||||
type GistListOptions struct {
|
type GistListOptions struct {
|
||||||
|
@ -67,7 +93,7 @@ type GistListOptions struct {
|
||||||
// user.
|
// user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/gists/#list-gists
|
// GitHub API docs: http://developer.github.com/v3/gists/#list-gists
|
||||||
func (s *GistsService) List(user string, opt *GistListOptions) ([]Gist, *Response, error) {
|
func (s *GistsService) List(user string, opt *GistListOptions) ([]*Gist, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if user != "" {
|
if user != "" {
|
||||||
u = fmt.Sprintf("users/%v/gists", user)
|
u = fmt.Sprintf("users/%v/gists", user)
|
||||||
|
@ -84,7 +110,7 @@ func (s *GistsService) List(user string, opt *GistListOptions) ([]Gist, *Respons
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
gists := new([]Gist)
|
gists := new([]*Gist)
|
||||||
resp, err := s.client.Do(req, gists)
|
resp, err := s.client.Do(req, gists)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -96,7 +122,7 @@ func (s *GistsService) List(user string, opt *GistListOptions) ([]Gist, *Respons
|
||||||
// ListAll lists all public gists.
|
// ListAll lists all public gists.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/gists/#list-gists
|
// GitHub API docs: http://developer.github.com/v3/gists/#list-gists
|
||||||
func (s *GistsService) ListAll(opt *GistListOptions) ([]Gist, *Response, error) {
|
func (s *GistsService) ListAll(opt *GistListOptions) ([]*Gist, *Response, error) {
|
||||||
u, err := addOptions("gists/public", opt)
|
u, err := addOptions("gists/public", opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
@ -107,7 +133,7 @@ func (s *GistsService) ListAll(opt *GistListOptions) ([]Gist, *Response, error)
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
gists := new([]Gist)
|
gists := new([]*Gist)
|
||||||
resp, err := s.client.Do(req, gists)
|
resp, err := s.client.Do(req, gists)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -119,7 +145,7 @@ func (s *GistsService) ListAll(opt *GistListOptions) ([]Gist, *Response, error)
|
||||||
// ListStarred lists starred gists of authenticated user.
|
// ListStarred lists starred gists of authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/gists/#list-gists
|
// GitHub API docs: http://developer.github.com/v3/gists/#list-gists
|
||||||
func (s *GistsService) ListStarred(opt *GistListOptions) ([]Gist, *Response, error) {
|
func (s *GistsService) ListStarred(opt *GistListOptions) ([]*Gist, *Response, error) {
|
||||||
u, err := addOptions("gists/starred", opt)
|
u, err := addOptions("gists/starred", opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
@ -130,7 +156,7 @@ func (s *GistsService) ListStarred(opt *GistListOptions) ([]Gist, *Response, err
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
gists := new([]Gist)
|
gists := new([]*Gist)
|
||||||
resp, err := s.client.Do(req, gists)
|
resp, err := s.client.Do(req, gists)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -211,6 +237,25 @@ func (s *GistsService) Edit(id string, gist *Gist) (*Gist, *Response, error) {
|
||||||
return g, resp, err
|
return g, resp, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListCommits lists commits of a gist.
|
||||||
|
//
|
||||||
|
// Github API docs: https://developer.github.com/v3/gists/#list-gist-commits
|
||||||
|
func (s *GistsService) ListCommits(id string) ([]*GistCommit, *Response, error) {
|
||||||
|
u := fmt.Sprintf("gists/%v/commits", id)
|
||||||
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
gistCommits := new([]*GistCommit)
|
||||||
|
resp, err := s.client.Do(req, gistCommits)
|
||||||
|
if err != nil {
|
||||||
|
return nil, resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return *gistCommits, resp, err
|
||||||
|
}
|
||||||
|
|
||||||
// Delete a gist.
|
// Delete a gist.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/gists/#delete-a-gist
|
// GitHub API docs: http://developer.github.com/v3/gists/#delete-a-gist
|
||||||
|
@ -279,3 +324,22 @@ func (s *GistsService) Fork(id string) (*Gist, *Response, error) {
|
||||||
|
|
||||||
return g, resp, err
|
return g, resp, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListForks lists forks of a gist.
|
||||||
|
//
|
||||||
|
// Github API docs: https://developer.github.com/v3/gists/#list-gist-forks
|
||||||
|
func (s *GistsService) ListForks(id string) ([]*GistFork, *Response, error) {
|
||||||
|
u := fmt.Sprintf("gists/%v/forks", id)
|
||||||
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
gistForks := new([]*GistFork)
|
||||||
|
resp, err := s.client.Do(req, gistForks)
|
||||||
|
if err != nil {
|
||||||
|
return nil, resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return *gistForks, resp, err
|
||||||
|
}
|
||||||
|
|
4
vendor/github.com/google/go-github/github/gists_comments.go
generated
vendored
4
vendor/github.com/google/go-github/github/gists_comments.go
generated
vendored
|
@ -26,7 +26,7 @@ func (g GistComment) String() string {
|
||||||
// ListComments lists all comments for a gist.
|
// ListComments lists all comments for a gist.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/gists/comments/#list-comments-on-a-gist
|
// GitHub API docs: http://developer.github.com/v3/gists/comments/#list-comments-on-a-gist
|
||||||
func (s *GistsService) ListComments(gistID string, opt *ListOptions) ([]GistComment, *Response, error) {
|
func (s *GistsService) ListComments(gistID string, opt *ListOptions) ([]*GistComment, *Response, error) {
|
||||||
u := fmt.Sprintf("gists/%v/comments", gistID)
|
u := fmt.Sprintf("gists/%v/comments", gistID)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -38,7 +38,7 @@ func (s *GistsService) ListComments(gistID string, opt *ListOptions) ([]GistComm
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
comments := new([]GistComment)
|
comments := new([]*GistComment)
|
||||||
resp, err := s.client.Do(req, comments)
|
resp, err := s.client.Do(req, comments)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
4
vendor/github.com/google/go-github/github/gists_comments_test.go
generated
vendored
4
vendor/github.com/google/go-github/github/gists_comments_test.go
generated
vendored
|
@ -25,12 +25,11 @@ func TestGistsService_ListComments(t *testing.T) {
|
||||||
|
|
||||||
opt := &ListOptions{Page: 2}
|
opt := &ListOptions{Page: 2}
|
||||||
comments, _, err := client.Gists.ListComments("1", opt)
|
comments, _, err := client.Gists.ListComments("1", opt)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Gists.Comments returned error: %v", err)
|
t.Errorf("Gists.Comments returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []GistComment{{ID: Int(1)}}
|
want := []*GistComment{{ID: Int(1)}}
|
||||||
if !reflect.DeepEqual(comments, want) {
|
if !reflect.DeepEqual(comments, want) {
|
||||||
t.Errorf("Gists.ListComments returned %+v, want %+v", comments, want)
|
t.Errorf("Gists.ListComments returned %+v, want %+v", comments, want)
|
||||||
}
|
}
|
||||||
|
@ -51,7 +50,6 @@ func TestGistsService_GetComment(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
comment, _, err := client.Gists.GetComment("1", 2)
|
comment, _, err := client.Gists.GetComment("1", 2)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Gists.GetComment returned error: %v", err)
|
t.Errorf("Gists.GetComment returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
97
vendor/github.com/google/go-github/github/gists_test.go
generated
vendored
97
vendor/github.com/google/go-github/github/gists_test.go
generated
vendored
|
@ -30,12 +30,11 @@ func TestGistsService_List_specifiedUser(t *testing.T) {
|
||||||
|
|
||||||
opt := &GistListOptions{Since: time.Date(2013, time.January, 1, 0, 0, 0, 0, time.UTC)}
|
opt := &GistListOptions{Since: time.Date(2013, time.January, 1, 0, 0, 0, 0, time.UTC)}
|
||||||
gists, _, err := client.Gists.List("u", opt)
|
gists, _, err := client.Gists.List("u", opt)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Gists.List returned error: %v", err)
|
t.Errorf("Gists.List returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Gist{{ID: String("1")}}
|
want := []*Gist{{ID: String("1")}}
|
||||||
if !reflect.DeepEqual(gists, want) {
|
if !reflect.DeepEqual(gists, want) {
|
||||||
t.Errorf("Gists.List returned %+v, want %+v", gists, want)
|
t.Errorf("Gists.List returned %+v, want %+v", gists, want)
|
||||||
}
|
}
|
||||||
|
@ -55,7 +54,7 @@ func TestGistsService_List_authenticatedUser(t *testing.T) {
|
||||||
t.Errorf("Gists.List returned error: %v", err)
|
t.Errorf("Gists.List returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Gist{{ID: String("1")}}
|
want := []*Gist{{ID: String("1")}}
|
||||||
if !reflect.DeepEqual(gists, want) {
|
if !reflect.DeepEqual(gists, want) {
|
||||||
t.Errorf("Gists.List returned %+v, want %+v", gists, want)
|
t.Errorf("Gists.List returned %+v, want %+v", gists, want)
|
||||||
}
|
}
|
||||||
|
@ -82,12 +81,11 @@ func TestGistsService_ListAll(t *testing.T) {
|
||||||
|
|
||||||
opt := &GistListOptions{Since: time.Date(2013, time.January, 1, 0, 0, 0, 0, time.UTC)}
|
opt := &GistListOptions{Since: time.Date(2013, time.January, 1, 0, 0, 0, 0, time.UTC)}
|
||||||
gists, _, err := client.Gists.ListAll(opt)
|
gists, _, err := client.Gists.ListAll(opt)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Gists.ListAll returned error: %v", err)
|
t.Errorf("Gists.ListAll returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Gist{{ID: String("1")}}
|
want := []*Gist{{ID: String("1")}}
|
||||||
if !reflect.DeepEqual(gists, want) {
|
if !reflect.DeepEqual(gists, want) {
|
||||||
t.Errorf("Gists.ListAll returned %+v, want %+v", gists, want)
|
t.Errorf("Gists.ListAll returned %+v, want %+v", gists, want)
|
||||||
}
|
}
|
||||||
|
@ -109,12 +107,11 @@ func TestGistsService_ListStarred(t *testing.T) {
|
||||||
|
|
||||||
opt := &GistListOptions{Since: time.Date(2013, time.January, 1, 0, 0, 0, 0, time.UTC)}
|
opt := &GistListOptions{Since: time.Date(2013, time.January, 1, 0, 0, 0, 0, time.UTC)}
|
||||||
gists, _, err := client.Gists.ListStarred(opt)
|
gists, _, err := client.Gists.ListStarred(opt)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Gists.ListStarred returned error: %v", err)
|
t.Errorf("Gists.ListStarred returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Gist{{ID: String("1")}}
|
want := []*Gist{{ID: String("1")}}
|
||||||
if !reflect.DeepEqual(gists, want) {
|
if !reflect.DeepEqual(gists, want) {
|
||||||
t.Errorf("Gists.ListStarred returned %+v, want %+v", gists, want)
|
t.Errorf("Gists.ListStarred returned %+v, want %+v", gists, want)
|
||||||
}
|
}
|
||||||
|
@ -130,7 +127,6 @@ func TestGistsService_Get(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
gist, _, err := client.Gists.Get("1")
|
gist, _, err := client.Gists.Get("1")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Gists.Get returned error: %v", err)
|
t.Errorf("Gists.Get returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -156,7 +152,6 @@ func TestGistsService_GetRevision(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
gist, _, err := client.Gists.GetRevision("1", "s")
|
gist, _, err := client.Gists.GetRevision("1", "s")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Gists.Get returned error: %v", err)
|
t.Errorf("Gists.Get returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -286,6 +281,53 @@ func TestGistsService_Edit_invalidID(t *testing.T) {
|
||||||
testURLParseError(t, err)
|
testURLParseError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestGistsService_ListCommits(t *testing.T) {
|
||||||
|
setup()
|
||||||
|
defer teardown()
|
||||||
|
|
||||||
|
mux.HandleFunc("/gists/1/commits", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
testMethod(t, r, "GET")
|
||||||
|
testFormValues(t, r, nil)
|
||||||
|
fmt.Fprint(w, `
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"url": "https://api.github.com/gists/1/1",
|
||||||
|
"version": "1",
|
||||||
|
"user": {
|
||||||
|
"id": 1
|
||||||
|
},
|
||||||
|
"change_status": {
|
||||||
|
"deletions": 0,
|
||||||
|
"additions": 180,
|
||||||
|
"total": 180
|
||||||
|
},
|
||||||
|
"commited_at": "2010-01-01T00:00:00Z"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
`)
|
||||||
|
})
|
||||||
|
|
||||||
|
gistCommits, _, err := client.Gists.ListCommits("1")
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Gists.ListCommits returned error: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
want := []*GistCommit{{
|
||||||
|
URL: String("https://api.github.com/gists/1/1"),
|
||||||
|
Version: String("1"),
|
||||||
|
User: &User{ID: Int(1)},
|
||||||
|
CommitedAt: &Timestamp{time.Date(2010, 1, 1, 00, 00, 00, 0, time.UTC)},
|
||||||
|
ChangeStatus: &CommitStats{
|
||||||
|
Additions: Int(180),
|
||||||
|
Deletions: Int(0),
|
||||||
|
Total: Int(180),
|
||||||
|
}}}
|
||||||
|
|
||||||
|
if !reflect.DeepEqual(gistCommits, want) {
|
||||||
|
t.Errorf("Gists.ListCommits returned %+v, want %+v", gistCommits, want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestGistsService_Delete(t *testing.T) {
|
func TestGistsService_Delete(t *testing.T) {
|
||||||
setup()
|
setup()
|
||||||
defer teardown()
|
defer teardown()
|
||||||
|
@ -394,7 +436,6 @@ func TestGistsService_Fork(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
gist, _, err := client.Gists.Fork("1")
|
gist, _, err := client.Gists.Fork("1")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Gists.Fork returned error: %v", err)
|
t.Errorf("Gists.Fork returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -405,6 +446,42 @@ func TestGistsService_Fork(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestGistsService_ListForks(t *testing.T) {
|
||||||
|
setup()
|
||||||
|
defer teardown()
|
||||||
|
|
||||||
|
mux.HandleFunc("/gists/1/forks", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
testMethod(t, r, "GET")
|
||||||
|
testFormValues(t, r, nil)
|
||||||
|
fmt.Fprint(w, `
|
||||||
|
[
|
||||||
|
{"url": "https://api.github.com/gists/1",
|
||||||
|
"user": {"id": 1},
|
||||||
|
"id": "1",
|
||||||
|
"created_at": "2010-01-01T00:00:00Z",
|
||||||
|
"updated_at": "2013-01-01T00:00:00Z"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
`)
|
||||||
|
})
|
||||||
|
|
||||||
|
gistForks, _, err := client.Gists.ListForks("1")
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Gists.ListForks returned error: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
want := []*GistFork{{
|
||||||
|
URL: String("https://api.github.com/gists/1"),
|
||||||
|
ID: String("1"),
|
||||||
|
User: &User{ID: Int(1)},
|
||||||
|
CreatedAt: &Timestamp{time.Date(2010, 1, 1, 00, 00, 00, 0, time.UTC)},
|
||||||
|
UpdatedAt: &Timestamp{time.Date(2013, 1, 1, 00, 00, 00, 0, time.UTC)}}}
|
||||||
|
|
||||||
|
if !reflect.DeepEqual(gistForks, want) {
|
||||||
|
t.Errorf("Gists.ListForks returned %+v, want %+v", gistForks, want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestGistsService_Fork_invalidID(t *testing.T) {
|
func TestGistsService_Fork_invalidID(t *testing.T) {
|
||||||
_, _, err := client.Gists.Fork("%")
|
_, _, err := client.Gists.Fork("%")
|
||||||
testURLParseError(t, err)
|
testURLParseError(t, err)
|
||||||
|
|
28
vendor/github.com/google/go-github/github/git_commits.go
generated
vendored
28
vendor/github.com/google/go-github/github/git_commits.go
generated
vendored
|
@ -10,16 +10,25 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// SignatureVerification represents GPG signature verification.
|
||||||
|
type SignatureVerification struct {
|
||||||
|
Verified *bool `json:"verified,omitempty"`
|
||||||
|
Reason *string `json:"reason,omitempty"`
|
||||||
|
Signature *string `json:"signature,omitempty"`
|
||||||
|
Payload *string `json:"payload,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
// Commit represents a GitHub commit.
|
// Commit represents a GitHub commit.
|
||||||
type Commit struct {
|
type Commit struct {
|
||||||
SHA *string `json:"sha,omitempty"`
|
SHA *string `json:"sha,omitempty"`
|
||||||
Author *CommitAuthor `json:"author,omitempty"`
|
Author *CommitAuthor `json:"author,omitempty"`
|
||||||
Committer *CommitAuthor `json:"committer,omitempty"`
|
Committer *CommitAuthor `json:"committer,omitempty"`
|
||||||
Message *string `json:"message,omitempty"`
|
Message *string `json:"message,omitempty"`
|
||||||
Tree *Tree `json:"tree,omitempty"`
|
Tree *Tree `json:"tree,omitempty"`
|
||||||
Parents []Commit `json:"parents,omitempty"`
|
Parents []Commit `json:"parents,omitempty"`
|
||||||
Stats *CommitStats `json:"stats,omitempty"`
|
Stats *CommitStats `json:"stats,omitempty"`
|
||||||
URL *string `json:"url,omitempty"`
|
URL *string `json:"url,omitempty"`
|
||||||
|
Verification *SignatureVerification `json:"verification,omitempty"`
|
||||||
|
|
||||||
// CommentCount is the number of GitHub comments on the commit. This
|
// CommentCount is the number of GitHub comments on the commit. This
|
||||||
// is only populated for requests that fetch GitHub data like
|
// is only populated for requests that fetch GitHub data like
|
||||||
|
@ -56,6 +65,9 @@ func (s *GitService) GetCommit(owner string, repo string, sha string) (*Commit,
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: remove custom Accept header when this API fully launches.
|
||||||
|
req.Header.Set("Accept", mediaTypeGitSigningPreview)
|
||||||
|
|
||||||
c := new(Commit)
|
c := new(Commit)
|
||||||
resp, err := s.client.Do(req, c)
|
resp, err := s.client.Do(req, c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
1
vendor/github.com/google/go-github/github/git_commits_test.go
generated
vendored
1
vendor/github.com/google/go-github/github/git_commits_test.go
generated
vendored
|
@ -19,6 +19,7 @@ func TestGitService_GetCommit(t *testing.T) {
|
||||||
|
|
||||||
mux.HandleFunc("/repos/o/r/git/commits/s", func(w http.ResponseWriter, r *http.Request) {
|
mux.HandleFunc("/repos/o/r/git/commits/s", func(w http.ResponseWriter, r *http.Request) {
|
||||||
testMethod(t, r, "GET")
|
testMethod(t, r, "GET")
|
||||||
|
testHeader(t, r, "Accept", mediaTypeGitSigningPreview)
|
||||||
fmt.Fprint(w, `{"sha":"s","message":"m","author":{"name":"n"}}`)
|
fmt.Fprint(w, `{"sha":"s","message":"m","author":{"name":"n"}}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
4
vendor/github.com/google/go-github/github/git_refs.go
generated
vendored
4
vendor/github.com/google/go-github/github/git_refs.go
generated
vendored
|
@ -75,7 +75,7 @@ type ReferenceListOptions struct {
|
||||||
// ListRefs lists all refs in a repository.
|
// ListRefs lists all refs in a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/git/refs/#get-all-references
|
// GitHub API docs: http://developer.github.com/v3/git/refs/#get-all-references
|
||||||
func (s *GitService) ListRefs(owner, repo string, opt *ReferenceListOptions) ([]Reference, *Response, error) {
|
func (s *GitService) ListRefs(owner, repo string, opt *ReferenceListOptions) ([]*Reference, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if opt != nil && opt.Type != "" {
|
if opt != nil && opt.Type != "" {
|
||||||
u = fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, opt.Type)
|
u = fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, opt.Type)
|
||||||
|
@ -92,7 +92,7 @@ func (s *GitService) ListRefs(owner, repo string, opt *ReferenceListOptions) ([]
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var rs []Reference
|
var rs []*Reference
|
||||||
resp, err := s.client.Do(req, &rs)
|
resp, err := s.client.Do(req, &rs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
4
vendor/github.com/google/go-github/github/git_refs_test.go
generated
vendored
4
vendor/github.com/google/go-github/github/git_refs_test.go
generated
vendored
|
@ -89,7 +89,7 @@ func TestGitService_ListRefs(t *testing.T) {
|
||||||
t.Errorf("Git.ListRefs returned error: %v", err)
|
t.Errorf("Git.ListRefs returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Reference{
|
want := []*Reference{
|
||||||
{
|
{
|
||||||
Ref: String("refs/heads/branchA"),
|
Ref: String("refs/heads/branchA"),
|
||||||
URL: String("https://api.github.com/repos/o/r/git/refs/heads/branchA"),
|
URL: String("https://api.github.com/repos/o/r/git/refs/heads/branchA"),
|
||||||
|
@ -130,7 +130,7 @@ func TestGitService_ListRefs_options(t *testing.T) {
|
||||||
t.Errorf("Git.ListRefs returned error: %v", err)
|
t.Errorf("Git.ListRefs returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Reference{{Ref: String("r")}}
|
want := []*Reference{{Ref: String("r")}}
|
||||||
if !reflect.DeepEqual(refs, want) {
|
if !reflect.DeepEqual(refs, want) {
|
||||||
t.Errorf("Git.ListRefs returned %+v, want %+v", refs, want)
|
t.Errorf("Git.ListRefs returned %+v, want %+v", refs, want)
|
||||||
}
|
}
|
||||||
|
|
16
vendor/github.com/google/go-github/github/git_tags.go
generated
vendored
16
vendor/github.com/google/go-github/github/git_tags.go
generated
vendored
|
@ -11,12 +11,13 @@ import (
|
||||||
|
|
||||||
// Tag represents a tag object.
|
// Tag represents a tag object.
|
||||||
type Tag struct {
|
type Tag struct {
|
||||||
Tag *string `json:"tag,omitempty"`
|
Tag *string `json:"tag,omitempty"`
|
||||||
SHA *string `json:"sha,omitempty"`
|
SHA *string `json:"sha,omitempty"`
|
||||||
URL *string `json:"url,omitempty"`
|
URL *string `json:"url,omitempty"`
|
||||||
Message *string `json:"message,omitempty"`
|
Message *string `json:"message,omitempty"`
|
||||||
Tagger *CommitAuthor `json:"tagger,omitempty"`
|
Tagger *CommitAuthor `json:"tagger,omitempty"`
|
||||||
Object *GitObject `json:"object,omitempty"`
|
Object *GitObject `json:"object,omitempty"`
|
||||||
|
Verification *SignatureVerification `json:"verification,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// createTagRequest represents the body of a CreateTag request. This is mostly
|
// createTagRequest represents the body of a CreateTag request. This is mostly
|
||||||
|
@ -40,6 +41,9 @@ func (s *GitService) GetTag(owner string, repo string, sha string) (*Tag, *Respo
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: remove custom Accept header when this API fully launches.
|
||||||
|
req.Header.Set("Accept", mediaTypeGitSigningPreview)
|
||||||
|
|
||||||
tag := new(Tag)
|
tag := new(Tag)
|
||||||
resp, err := s.client.Do(req, tag)
|
resp, err := s.client.Do(req, tag)
|
||||||
return tag, resp, err
|
return tag, resp, err
|
||||||
|
|
2
vendor/github.com/google/go-github/github/git_tags_test.go
generated
vendored
2
vendor/github.com/google/go-github/github/git_tags_test.go
generated
vendored
|
@ -19,12 +19,12 @@ func TestGitService_GetTag(t *testing.T) {
|
||||||
|
|
||||||
mux.HandleFunc("/repos/o/r/git/tags/s", func(w http.ResponseWriter, r *http.Request) {
|
mux.HandleFunc("/repos/o/r/git/tags/s", func(w http.ResponseWriter, r *http.Request) {
|
||||||
testMethod(t, r, "GET")
|
testMethod(t, r, "GET")
|
||||||
|
testHeader(t, r, "Accept", mediaTypeGitSigningPreview)
|
||||||
|
|
||||||
fmt.Fprint(w, `{"tag": "t"}`)
|
fmt.Fprint(w, `{"tag": "t"}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
tag, _, err := client.Git.GetTag("o", "r", "s")
|
tag, _, err := client.Git.GetTag("o", "r", "s")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Git.GetTag returned error: %v", err)
|
t.Errorf("Git.GetTag returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
42
vendor/github.com/google/go-github/github/github.go
generated
vendored
42
vendor/github.com/google/go-github/github/github.go
generated
vendored
|
@ -29,7 +29,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
libraryVersion = "0.1"
|
libraryVersion = "2"
|
||||||
defaultBaseURL = "https://api.github.com/"
|
defaultBaseURL = "https://api.github.com/"
|
||||||
uploadBaseURL = "https://uploads.github.com/"
|
uploadBaseURL = "https://uploads.github.com/"
|
||||||
userAgent = "go-github/" + libraryVersion
|
userAgent = "go-github/" + libraryVersion
|
||||||
|
@ -39,9 +39,10 @@ const (
|
||||||
headerRateReset = "X-RateLimit-Reset"
|
headerRateReset = "X-RateLimit-Reset"
|
||||||
headerOTP = "X-GitHub-OTP"
|
headerOTP = "X-GitHub-OTP"
|
||||||
|
|
||||||
mediaTypeV3 = "application/vnd.github.v3+json"
|
mediaTypeV3 = "application/vnd.github.v3+json"
|
||||||
defaultMediaType = "application/octet-stream"
|
defaultMediaType = "application/octet-stream"
|
||||||
mediaTypeV3SHA = "application/vnd.github.v3.sha"
|
mediaTypeV3SHA = "application/vnd.github.v3.sha"
|
||||||
|
mediaTypeOrgPermissionRepo = "application/vnd.github.v3.repository+json"
|
||||||
|
|
||||||
// Media Type values to access preview APIs
|
// Media Type values to access preview APIs
|
||||||
|
|
||||||
|
@ -51,16 +52,9 @@ const (
|
||||||
// https://developer.github.com/changes/2014-12-09-new-attributes-for-stars-api/
|
// https://developer.github.com/changes/2014-12-09-new-attributes-for-stars-api/
|
||||||
mediaTypeStarringPreview = "application/vnd.github.v3.star+json"
|
mediaTypeStarringPreview = "application/vnd.github.v3.star+json"
|
||||||
|
|
||||||
// https://developer.github.com/changes/2015-06-24-api-enhancements-for-working-with-organization-permissions/
|
|
||||||
mediaTypeOrgPermissionPreview = "application/vnd.github.ironman-preview+json"
|
|
||||||
mediaTypeOrgPermissionRepoPreview = "application/vnd.github.ironman-preview.repository+json"
|
|
||||||
|
|
||||||
// https://developer.github.com/changes/2015-11-11-protected-branches-api/
|
// https://developer.github.com/changes/2015-11-11-protected-branches-api/
|
||||||
mediaTypeProtectedBranchesPreview = "application/vnd.github.loki-preview+json"
|
mediaTypeProtectedBranchesPreview = "application/vnd.github.loki-preview+json"
|
||||||
|
|
||||||
// https://developer.github.com/changes/2016-02-11-issue-locking-api/
|
|
||||||
mediaTypeIssueLockingPreview = "application/vnd.github.the-key-preview+json"
|
|
||||||
|
|
||||||
// https://help.github.com/enterprise/2.4/admin/guides/migrations/exporting-the-github-com-organization-s-repositories/
|
// https://help.github.com/enterprise/2.4/admin/guides/migrations/exporting-the-github-com-organization-s-repositories/
|
||||||
mediaTypeMigrationsPreview = "application/vnd.github.wyandotte-preview+json"
|
mediaTypeMigrationsPreview = "application/vnd.github.wyandotte-preview+json"
|
||||||
|
|
||||||
|
@ -72,6 +66,24 @@ const (
|
||||||
|
|
||||||
// https://developer.github.com/changes/2016-05-12-reactions-api-preview/
|
// https://developer.github.com/changes/2016-05-12-reactions-api-preview/
|
||||||
mediaTypeReactionsPreview = "application/vnd.github.squirrel-girl-preview"
|
mediaTypeReactionsPreview = "application/vnd.github.squirrel-girl-preview"
|
||||||
|
|
||||||
|
// https://developer.github.com/changes/2016-04-01-squash-api-preview/
|
||||||
|
mediaTypeSquashPreview = "application/vnd.github.polaris-preview+json"
|
||||||
|
|
||||||
|
// https://developer.github.com/changes/2016-04-04-git-signing-api-preview/
|
||||||
|
mediaTypeGitSigningPreview = "application/vnd.github.cryptographer-preview+json"
|
||||||
|
|
||||||
|
// https://developer.github.com/changes/2016-5-27-multiple-assignees/
|
||||||
|
mediaTypeMultipleAssigneesPreview = "application/vnd.github.cerberus-preview+json"
|
||||||
|
|
||||||
|
// https://developer.github.com/changes/2016-05-23-timeline-preview-api/
|
||||||
|
mediaTypeTimelinePreview = "application/vnd.github.mockingbird-preview+json"
|
||||||
|
|
||||||
|
// https://developer.github.com/changes/2016-06-14-repository-invitations/
|
||||||
|
mediaTypeRepositoryInvitationsPreview = "application/vnd.github.swamp-thing-preview+json"
|
||||||
|
|
||||||
|
// https://developer.github.com/changes/2016-04-21-oauth-authorizations-grants-api-preview/
|
||||||
|
mediaTypeOAuthGrantAuthorizationsPreview = "application/vnd.github.damage-preview+json"
|
||||||
)
|
)
|
||||||
|
|
||||||
// A Client manages communication with the GitHub API.
|
// A Client manages communication with the GitHub API.
|
||||||
|
@ -435,6 +447,10 @@ type ErrorResponse struct {
|
||||||
Reason string `json:"reason,omitempty"`
|
Reason string `json:"reason,omitempty"`
|
||||||
CreatedAt *Timestamp `json:"created_at,omitempty"`
|
CreatedAt *Timestamp `json:"created_at,omitempty"`
|
||||||
} `json:"block,omitempty"`
|
} `json:"block,omitempty"`
|
||||||
|
// Most errors will also include a documentation_url field pointing
|
||||||
|
// to some content that might help you resolve the error, see
|
||||||
|
// https://developer.github.com/v3/#client-errors
|
||||||
|
DocumentationURL string `json:"documentation_url,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *ErrorResponse) Error() string {
|
func (r *ErrorResponse) Error() string {
|
||||||
|
@ -490,6 +506,9 @@ These are the possible validation error codes:
|
||||||
the formatting of a field is invalid
|
the formatting of a field is invalid
|
||||||
already_exists:
|
already_exists:
|
||||||
another resource has the same valid as this field
|
another resource has the same valid as this field
|
||||||
|
custom:
|
||||||
|
some resources return this (e.g. github.User.CreateKey()), additional
|
||||||
|
information is set in the Message field of the Error
|
||||||
|
|
||||||
GitHub API docs: http://developer.github.com/v3/#client-errors
|
GitHub API docs: http://developer.github.com/v3/#client-errors
|
||||||
*/
|
*/
|
||||||
|
@ -497,6 +516,7 @@ type Error struct {
|
||||||
Resource string `json:"resource"` // resource on which the error occurred
|
Resource string `json:"resource"` // resource on which the error occurred
|
||||||
Field string `json:"field"` // field on which the error occurred
|
Field string `json:"field"` // field on which the error occurred
|
||||||
Code string `json:"code"` // validation error code
|
Code string `json:"code"` // validation error code
|
||||||
|
Message string `json:"message"` // Message describing the error. Errors with Code == "custom" will always have this set.
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *Error) Error() string {
|
func (e *Error) Error() string {
|
||||||
|
|
4
vendor/github.com/google/go-github/github/github_test.go
generated
vendored
4
vendor/github.com/google/go-github/github/github_test.go
generated
vendored
|
@ -397,7 +397,6 @@ func TestDo_rateLimit(t *testing.T) {
|
||||||
|
|
||||||
req, _ := client.NewRequest("GET", "/", nil)
|
req, _ := client.NewRequest("GET", "/", nil)
|
||||||
_, err := client.Do(req, nil)
|
_, err := client.Do(req, nil)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Do returned unexpected error: %v", err)
|
t.Errorf("Do returned unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -551,7 +550,6 @@ func TestDo_noContent(t *testing.T) {
|
||||||
|
|
||||||
req, _ := client.NewRequest("GET", "/", nil)
|
req, _ := client.NewRequest("GET", "/", nil)
|
||||||
_, err := client.Do(req, &body)
|
_, err := client.Do(req, &body)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Do returned unexpected error: %v", err)
|
t.Fatalf("Do returned unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -630,7 +628,6 @@ func TestCheckResponse_noBody(t *testing.T) {
|
||||||
|
|
||||||
func TestParseBooleanResponse_true(t *testing.T) {
|
func TestParseBooleanResponse_true(t *testing.T) {
|
||||||
result, err := parseBoolResponse(nil)
|
result, err := parseBoolResponse(nil)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("parseBoolResponse returned error: %+v", err)
|
t.Errorf("parseBoolResponse returned error: %+v", err)
|
||||||
}
|
}
|
||||||
|
@ -643,7 +640,6 @@ func TestParseBooleanResponse_true(t *testing.T) {
|
||||||
func TestParseBooleanResponse_false(t *testing.T) {
|
func TestParseBooleanResponse_false(t *testing.T) {
|
||||||
v := &ErrorResponse{Response: &http.Response{StatusCode: http.StatusNotFound}}
|
v := &ErrorResponse{Response: &http.Response{StatusCode: http.StatusNotFound}}
|
||||||
result, err := parseBoolResponse(v)
|
result, err := parseBoolResponse(v)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("parseBoolResponse returned error: %+v", err)
|
t.Errorf("parseBoolResponse returned error: %+v", err)
|
||||||
}
|
}
|
||||||
|
|
26
vendor/github.com/google/go-github/github/issues.go
generated
vendored
26
vendor/github.com/google/go-github/github/issues.go
generated
vendored
|
@ -37,6 +37,7 @@ type Issue struct {
|
||||||
PullRequestLinks *PullRequestLinks `json:"pull_request,omitempty"`
|
PullRequestLinks *PullRequestLinks `json:"pull_request,omitempty"`
|
||||||
Repository *Repository `json:"repository,omitempty"`
|
Repository *Repository `json:"repository,omitempty"`
|
||||||
Reactions *Reactions `json:"reactions,omitempty"`
|
Reactions *Reactions `json:"reactions,omitempty"`
|
||||||
|
Assignees []*User `json:"assignees,omitempty"`
|
||||||
|
|
||||||
// TextMatches is only populated from search results that request text matches
|
// TextMatches is only populated from search results that request text matches
|
||||||
// See: search.go and https://developer.github.com/v3/search/#text-match-metadata
|
// See: search.go and https://developer.github.com/v3/search/#text-match-metadata
|
||||||
|
@ -57,6 +58,7 @@ type IssueRequest struct {
|
||||||
Assignee *string `json:"assignee,omitempty"`
|
Assignee *string `json:"assignee,omitempty"`
|
||||||
State *string `json:"state,omitempty"`
|
State *string `json:"state,omitempty"`
|
||||||
Milestone *int `json:"milestone,omitempty"`
|
Milestone *int `json:"milestone,omitempty"`
|
||||||
|
Assignees *[]string `json:"assignees,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// IssueListOptions specifies the optional parameters to the IssuesService.List
|
// IssueListOptions specifies the optional parameters to the IssuesService.List
|
||||||
|
@ -102,7 +104,7 @@ type PullRequestLinks struct {
|
||||||
// repositories.
|
// repositories.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/issues/#list-issues
|
// GitHub API docs: http://developer.github.com/v3/issues/#list-issues
|
||||||
func (s *IssuesService) List(all bool, opt *IssueListOptions) ([]Issue, *Response, error) {
|
func (s *IssuesService) List(all bool, opt *IssueListOptions) ([]*Issue, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if all {
|
if all {
|
||||||
u = "issues"
|
u = "issues"
|
||||||
|
@ -116,12 +118,12 @@ func (s *IssuesService) List(all bool, opt *IssueListOptions) ([]Issue, *Respons
|
||||||
// authenticated user.
|
// authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/issues/#list-issues
|
// GitHub API docs: http://developer.github.com/v3/issues/#list-issues
|
||||||
func (s *IssuesService) ListByOrg(org string, opt *IssueListOptions) ([]Issue, *Response, error) {
|
func (s *IssuesService) ListByOrg(org string, opt *IssueListOptions) ([]*Issue, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/issues", org)
|
u := fmt.Sprintf("orgs/%v/issues", org)
|
||||||
return s.listIssues(u, opt)
|
return s.listIssues(u, opt)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *IssuesService) listIssues(u string, opt *IssueListOptions) ([]Issue, *Response, error) {
|
func (s *IssuesService) listIssues(u string, opt *IssueListOptions) ([]*Issue, *Response, error) {
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
@ -135,7 +137,7 @@ func (s *IssuesService) listIssues(u string, opt *IssueListOptions) ([]Issue, *R
|
||||||
// TODO: remove custom Accept header when this API fully launches.
|
// TODO: remove custom Accept header when this API fully launches.
|
||||||
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
||||||
|
|
||||||
issues := new([]Issue)
|
issues := new([]*Issue)
|
||||||
resp, err := s.client.Do(req, issues)
|
resp, err := s.client.Do(req, issues)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -187,7 +189,7 @@ type IssueListByRepoOptions struct {
|
||||||
// ListByRepo lists the issues for the specified repository.
|
// ListByRepo lists the issues for the specified repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/issues/#list-issues-for-a-repository
|
// GitHub API docs: http://developer.github.com/v3/issues/#list-issues-for-a-repository
|
||||||
func (s *IssuesService) ListByRepo(owner string, repo string, opt *IssueListByRepoOptions) ([]Issue, *Response, error) {
|
func (s *IssuesService) ListByRepo(owner string, repo string, opt *IssueListByRepoOptions) ([]*Issue, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/issues", owner, repo)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -202,7 +204,7 @@ func (s *IssuesService) ListByRepo(owner string, repo string, opt *IssueListByRe
|
||||||
// TODO: remove custom Accept header when this API fully launches.
|
// TODO: remove custom Accept header when this API fully launches.
|
||||||
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
||||||
|
|
||||||
issues := new([]Issue)
|
issues := new([]*Issue)
|
||||||
resp, err := s.client.Do(req, issues)
|
resp, err := s.client.Do(req, issues)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -243,6 +245,9 @@ func (s *IssuesService) Create(owner string, repo string, issue *IssueRequest) (
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: remove custom Accept header when this API fully launches.
|
||||||
|
req.Header.Set("Accept", mediaTypeMultipleAssigneesPreview)
|
||||||
|
|
||||||
i := new(Issue)
|
i := new(Issue)
|
||||||
resp, err := s.client.Do(req, i)
|
resp, err := s.client.Do(req, i)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -262,6 +267,9 @@ func (s *IssuesService) Edit(owner string, repo string, number int, issue *Issue
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: remove custom Accept header when this API fully launches.
|
||||||
|
req.Header.Set("Accept", mediaTypeMultipleAssigneesPreview)
|
||||||
|
|
||||||
i := new(Issue)
|
i := new(Issue)
|
||||||
resp, err := s.client.Do(req, i)
|
resp, err := s.client.Do(req, i)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -281,9 +289,6 @@ func (s *IssuesService) Lock(owner string, repo string, number int) (*Response,
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove custom Accept header when this API fully launches.
|
|
||||||
req.Header.Set("Accept", mediaTypeIssueLockingPreview)
|
|
||||||
|
|
||||||
return s.client.Do(req, nil)
|
return s.client.Do(req, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,8 +302,5 @@ func (s *IssuesService) Unlock(owner string, repo string, number int) (*Response
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove custom Accept header when this API fully launches.
|
|
||||||
req.Header.Set("Accept", mediaTypeIssueLockingPreview)
|
|
||||||
|
|
||||||
return s.client.Do(req, nil)
|
return s.client.Do(req, nil)
|
||||||
}
|
}
|
||||||
|
|
48
vendor/github.com/google/go-github/github/issues_assignees.go
generated
vendored
48
vendor/github.com/google/go-github/github/issues_assignees.go
generated
vendored
|
@ -11,7 +11,7 @@ import "fmt"
|
||||||
// which issues may be assigned.
|
// which issues may be assigned.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/issues/assignees/#list-assignees
|
// GitHub API docs: http://developer.github.com/v3/issues/assignees/#list-assignees
|
||||||
func (s *IssuesService) ListAssignees(owner string, repo string, opt *ListOptions) ([]User, *Response, error) {
|
func (s *IssuesService) ListAssignees(owner, repo string, opt *ListOptions) ([]*User, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/assignees", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/assignees", owner, repo)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -22,7 +22,7 @@ func (s *IssuesService) ListAssignees(owner string, repo string, opt *ListOption
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
assignees := new([]User)
|
assignees := new([]*User)
|
||||||
resp, err := s.client.Do(req, assignees)
|
resp, err := s.client.Do(req, assignees)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -34,7 +34,7 @@ func (s *IssuesService) ListAssignees(owner string, repo string, opt *ListOption
|
||||||
// IsAssignee checks if a user is an assignee for the specified repository.
|
// IsAssignee checks if a user is an assignee for the specified repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/issues/assignees/#check-assignee
|
// GitHub API docs: http://developer.github.com/v3/issues/assignees/#check-assignee
|
||||||
func (s *IssuesService) IsAssignee(owner string, repo string, user string) (bool, *Response, error) {
|
func (s *IssuesService) IsAssignee(owner, repo, user string) (bool, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/assignees/%v", owner, repo, user)
|
u := fmt.Sprintf("repos/%v/%v/assignees/%v", owner, repo, user)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -44,3 +44,45 @@ func (s *IssuesService) IsAssignee(owner string, repo string, user string) (bool
|
||||||
assignee, err := parseBoolResponse(err)
|
assignee, err := parseBoolResponse(err)
|
||||||
return assignee, resp, err
|
return assignee, resp, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddAssignees adds the provided GitHub users as assignees to the issue.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://developer.github.com/v3/issues/assignees/#add-assignees-to-an-issue
|
||||||
|
func (s *IssuesService) AddAssignees(owner, repo string, number int, assignees []string) (*Issue, *Response, error) {
|
||||||
|
users := &struct {
|
||||||
|
Assignees []string `json:"assignees,omitempty"`
|
||||||
|
}{Assignees: assignees}
|
||||||
|
u := fmt.Sprintf("repos/%v/%v/issues/%v/assignees", owner, repo, number)
|
||||||
|
req, err := s.client.NewRequest("POST", u, users)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: remove custom Accept header when this API fully launches.
|
||||||
|
req.Header.Set("Accept", mediaTypeMultipleAssigneesPreview)
|
||||||
|
|
||||||
|
issue := &Issue{}
|
||||||
|
resp, err := s.client.Do(req, issue)
|
||||||
|
return issue, resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveAssignees removes the provided GitHub users as assignees from the issue.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://developer.github.com/v3/issues/assignees/#remove-assignees-from-an-issue
|
||||||
|
func (s *IssuesService) RemoveAssignees(owner, repo string, number int, assignees []string) (*Issue, *Response, error) {
|
||||||
|
users := &struct {
|
||||||
|
Assignees []string `json:"assignees,omitempty"`
|
||||||
|
}{Assignees: assignees}
|
||||||
|
u := fmt.Sprintf("repos/%v/%v/issues/%v/assignees", owner, repo, number)
|
||||||
|
req, err := s.client.NewRequest("DELETE", u, users)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: remove custom Accept header when this API fully launches.
|
||||||
|
req.Header.Set("Accept", mediaTypeMultipleAssigneesPreview)
|
||||||
|
|
||||||
|
issue := &Issue{}
|
||||||
|
resp, err := s.client.Do(req, issue)
|
||||||
|
return issue, resp, err
|
||||||
|
}
|
||||||
|
|
65
vendor/github.com/google/go-github/github/issues_assignees_test.go
generated
vendored
65
vendor/github.com/google/go-github/github/issues_assignees_test.go
generated
vendored
|
@ -6,6 +6,7 @@
|
||||||
package github
|
package github
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
@ -25,10 +26,10 @@ func TestIssuesService_ListAssignees(t *testing.T) {
|
||||||
opt := &ListOptions{Page: 2}
|
opt := &ListOptions{Page: 2}
|
||||||
assignees, _, err := client.Issues.ListAssignees("o", "r", opt)
|
assignees, _, err := client.Issues.ListAssignees("o", "r", opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Issues.List returned error: %v", err)
|
t.Errorf("Issues.ListAssignees returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []User{{ID: Int(1)}}
|
want := []*User{{ID: Int(1)}}
|
||||||
if !reflect.DeepEqual(assignees, want) {
|
if !reflect.DeepEqual(assignees, want) {
|
||||||
t.Errorf("Issues.ListAssignees returned %+v, want %+v", assignees, want)
|
t.Errorf("Issues.ListAssignees returned %+v, want %+v", assignees, want)
|
||||||
}
|
}
|
||||||
|
@ -96,3 +97,63 @@ func TestIssuesService_IsAssignee_invalidOwner(t *testing.T) {
|
||||||
_, _, err := client.Issues.IsAssignee("%", "r", "u")
|
_, _, err := client.Issues.IsAssignee("%", "r", "u")
|
||||||
testURLParseError(t, err)
|
testURLParseError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIssuesService_AddAssignees(t *testing.T) {
|
||||||
|
setup()
|
||||||
|
defer teardown()
|
||||||
|
|
||||||
|
mux.HandleFunc("/repos/o/r/issues/1/assignees", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var assignees struct {
|
||||||
|
Assignees []string `json:"assignees,omitempty"`
|
||||||
|
}
|
||||||
|
json.NewDecoder(r.Body).Decode(&assignees)
|
||||||
|
|
||||||
|
testMethod(t, r, "POST")
|
||||||
|
testHeader(t, r, "Accept", mediaTypeMultipleAssigneesPreview)
|
||||||
|
want := []string{"user1", "user2"}
|
||||||
|
if !reflect.DeepEqual(assignees.Assignees, want) {
|
||||||
|
t.Errorf("assignees = %+v, want %+v", assignees, want)
|
||||||
|
}
|
||||||
|
fmt.Fprint(w, `{"number":1,"assignees":[{"login":"user1"},{"login":"user2"}]}`)
|
||||||
|
})
|
||||||
|
|
||||||
|
got, _, err := client.Issues.AddAssignees("o", "r", 1, []string{"user1", "user2"})
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Issues.AddAssignees returned error: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
want := &Issue{Number: Int(1), Assignees: []*User{{Login: String("user1")}, {Login: String("user2")}}}
|
||||||
|
if !reflect.DeepEqual(got, want) {
|
||||||
|
t.Errorf("Issues.AddAssignees = %+v, want %+v", got, want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestIssuesService_RemoveAssignees(t *testing.T) {
|
||||||
|
setup()
|
||||||
|
defer teardown()
|
||||||
|
|
||||||
|
mux.HandleFunc("/repos/o/r/issues/1/assignees", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var assignees struct {
|
||||||
|
Assignees []string `json:"assignees,omitempty"`
|
||||||
|
}
|
||||||
|
json.NewDecoder(r.Body).Decode(&assignees)
|
||||||
|
|
||||||
|
testMethod(t, r, "DELETE")
|
||||||
|
testHeader(t, r, "Accept", mediaTypeMultipleAssigneesPreview)
|
||||||
|
want := []string{"user1", "user2"}
|
||||||
|
if !reflect.DeepEqual(assignees.Assignees, want) {
|
||||||
|
t.Errorf("assignees = %+v, want %+v", assignees, want)
|
||||||
|
}
|
||||||
|
fmt.Fprint(w, `{"number":1,"assignees":[]}`)
|
||||||
|
})
|
||||||
|
|
||||||
|
got, _, err := client.Issues.RemoveAssignees("o", "r", 1, []string{"user1", "user2"})
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Issues.RemoveAssignees returned error: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
want := &Issue{Number: Int(1), Assignees: []*User{}}
|
||||||
|
if !reflect.DeepEqual(got, want) {
|
||||||
|
t.Errorf("Issues.RemoveAssignees = %+v, want %+v", got, want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
4
vendor/github.com/google/go-github/github/issues_comments.go
generated
vendored
4
vendor/github.com/google/go-github/github/issues_comments.go
generated
vendored
|
@ -46,7 +46,7 @@ type IssueListCommentsOptions struct {
|
||||||
// number of 0 will return all comments on all issues for the repository.
|
// number of 0 will return all comments on all issues for the repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/issues/comments/#list-comments-on-an-issue
|
// GitHub API docs: http://developer.github.com/v3/issues/comments/#list-comments-on-an-issue
|
||||||
func (s *IssuesService) ListComments(owner string, repo string, number int, opt *IssueListCommentsOptions) ([]IssueComment, *Response, error) {
|
func (s *IssuesService) ListComments(owner string, repo string, number int, opt *IssueListCommentsOptions) ([]*IssueComment, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if number == 0 {
|
if number == 0 {
|
||||||
u = fmt.Sprintf("repos/%v/%v/issues/comments", owner, repo)
|
u = fmt.Sprintf("repos/%v/%v/issues/comments", owner, repo)
|
||||||
|
@ -66,7 +66,7 @@ func (s *IssuesService) ListComments(owner string, repo string, number int, opt
|
||||||
// TODO: remove custom Accept header when this API fully launches.
|
// TODO: remove custom Accept header when this API fully launches.
|
||||||
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
||||||
|
|
||||||
comments := new([]IssueComment)
|
comments := new([]*IssueComment)
|
||||||
resp, err := s.client.Do(req, comments)
|
resp, err := s.client.Do(req, comments)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
4
vendor/github.com/google/go-github/github/issues_comments_test.go
generated
vendored
4
vendor/github.com/google/go-github/github/issues_comments_test.go
generated
vendored
|
@ -41,7 +41,7 @@ func TestIssuesService_ListComments_allIssues(t *testing.T) {
|
||||||
t.Errorf("Issues.ListComments returned error: %v", err)
|
t.Errorf("Issues.ListComments returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []IssueComment{{ID: Int(1)}}
|
want := []*IssueComment{{ID: Int(1)}}
|
||||||
if !reflect.DeepEqual(comments, want) {
|
if !reflect.DeepEqual(comments, want) {
|
||||||
t.Errorf("Issues.ListComments returned %+v, want %+v", comments, want)
|
t.Errorf("Issues.ListComments returned %+v, want %+v", comments, want)
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ func TestIssuesService_ListComments_specificIssue(t *testing.T) {
|
||||||
t.Errorf("Issues.ListComments returned error: %v", err)
|
t.Errorf("Issues.ListComments returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []IssueComment{{ID: Int(1)}}
|
want := []*IssueComment{{ID: Int(1)}}
|
||||||
if !reflect.DeepEqual(comments, want) {
|
if !reflect.DeepEqual(comments, want) {
|
||||||
t.Errorf("Issues.ListComments returned %+v, want %+v", comments, want)
|
t.Errorf("Issues.ListComments returned %+v, want %+v", comments, want)
|
||||||
}
|
}
|
||||||
|
|
8
vendor/github.com/google/go-github/github/issues_events.go
generated
vendored
8
vendor/github.com/google/go-github/github/issues_events.go
generated
vendored
|
@ -73,7 +73,7 @@ type IssueEvent struct {
|
||||||
// ListIssueEvents lists events for the specified issue.
|
// ListIssueEvents lists events for the specified issue.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/events/#list-events-for-an-issue
|
// GitHub API docs: https://developer.github.com/v3/issues/events/#list-events-for-an-issue
|
||||||
func (s *IssuesService) ListIssueEvents(owner, repo string, number int, opt *ListOptions) ([]IssueEvent, *Response, error) {
|
func (s *IssuesService) ListIssueEvents(owner, repo string, number int, opt *ListOptions) ([]*IssueEvent, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/%v/events", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/issues/%v/events", owner, repo, number)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -85,7 +85,7 @@ func (s *IssuesService) ListIssueEvents(owner, repo string, number int, opt *Lis
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var events []IssueEvent
|
var events []*IssueEvent
|
||||||
resp, err := s.client.Do(req, &events)
|
resp, err := s.client.Do(req, &events)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -97,7 +97,7 @@ func (s *IssuesService) ListIssueEvents(owner, repo string, number int, opt *Lis
|
||||||
// ListRepositoryEvents lists events for the specified repository.
|
// ListRepositoryEvents lists events for the specified repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/events/#list-events-for-a-repository
|
// GitHub API docs: https://developer.github.com/v3/issues/events/#list-events-for-a-repository
|
||||||
func (s *IssuesService) ListRepositoryEvents(owner, repo string, opt *ListOptions) ([]IssueEvent, *Response, error) {
|
func (s *IssuesService) ListRepositoryEvents(owner, repo string, opt *ListOptions) ([]*IssueEvent, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/events", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/issues/events", owner, repo)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -109,7 +109,7 @@ func (s *IssuesService) ListRepositoryEvents(owner, repo string, opt *ListOption
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var events []IssueEvent
|
var events []*IssueEvent
|
||||||
resp, err := s.client.Do(req, &events)
|
resp, err := s.client.Do(req, &events)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
7
vendor/github.com/google/go-github/github/issues_events_test.go
generated
vendored
7
vendor/github.com/google/go-github/github/issues_events_test.go
generated
vendored
|
@ -27,12 +27,11 @@ func TestIssuesService_ListIssueEvents(t *testing.T) {
|
||||||
|
|
||||||
opt := &ListOptions{Page: 1, PerPage: 2}
|
opt := &ListOptions{Page: 1, PerPage: 2}
|
||||||
events, _, err := client.Issues.ListIssueEvents("o", "r", 1, opt)
|
events, _, err := client.Issues.ListIssueEvents("o", "r", 1, opt)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Issues.ListIssueEvents returned error: %v", err)
|
t.Errorf("Issues.ListIssueEvents returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []IssueEvent{{ID: Int(1)}}
|
want := []*IssueEvent{{ID: Int(1)}}
|
||||||
if !reflect.DeepEqual(events, want) {
|
if !reflect.DeepEqual(events, want) {
|
||||||
t.Errorf("Issues.ListIssueEvents returned %+v, want %+v", events, want)
|
t.Errorf("Issues.ListIssueEvents returned %+v, want %+v", events, want)
|
||||||
}
|
}
|
||||||
|
@ -53,12 +52,11 @@ func TestIssuesService_ListRepositoryEvents(t *testing.T) {
|
||||||
|
|
||||||
opt := &ListOptions{Page: 1, PerPage: 2}
|
opt := &ListOptions{Page: 1, PerPage: 2}
|
||||||
events, _, err := client.Issues.ListRepositoryEvents("o", "r", opt)
|
events, _, err := client.Issues.ListRepositoryEvents("o", "r", opt)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Issues.ListRepositoryEvents returned error: %v", err)
|
t.Errorf("Issues.ListRepositoryEvents returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []IssueEvent{{ID: Int(1)}}
|
want := []*IssueEvent{{ID: Int(1)}}
|
||||||
if !reflect.DeepEqual(events, want) {
|
if !reflect.DeepEqual(events, want) {
|
||||||
t.Errorf("Issues.ListRepositoryEvents returned %+v, want %+v", events, want)
|
t.Errorf("Issues.ListRepositoryEvents returned %+v, want %+v", events, want)
|
||||||
}
|
}
|
||||||
|
@ -74,7 +72,6 @@ func TestIssuesService_GetEvent(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
event, _, err := client.Issues.GetEvent("o", "r", 1)
|
event, _, err := client.Issues.GetEvent("o", "r", 1)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Issues.GetEvent returned error: %v", err)
|
t.Errorf("Issues.GetEvent returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
20
vendor/github.com/google/go-github/github/issues_labels.go
generated
vendored
20
vendor/github.com/google/go-github/github/issues_labels.go
generated
vendored
|
@ -21,7 +21,7 @@ func (l Label) String() string {
|
||||||
// ListLabels lists all labels for a repository.
|
// ListLabels lists all labels for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository
|
// GitHub API docs: http://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository
|
||||||
func (s *IssuesService) ListLabels(owner string, repo string, opt *ListOptions) ([]Label, *Response, error) {
|
func (s *IssuesService) ListLabels(owner string, repo string, opt *ListOptions) ([]*Label, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/labels", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/labels", owner, repo)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -33,7 +33,7 @@ func (s *IssuesService) ListLabels(owner string, repo string, opt *ListOptions)
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
labels := new([]Label)
|
labels := new([]*Label)
|
||||||
resp, err := s.client.Do(req, labels)
|
resp, err := s.client.Do(req, labels)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -114,7 +114,7 @@ func (s *IssuesService) DeleteLabel(owner string, repo string, name string) (*Re
|
||||||
// ListLabelsByIssue lists all labels for an issue.
|
// ListLabelsByIssue lists all labels for an issue.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository
|
// GitHub API docs: http://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository
|
||||||
func (s *IssuesService) ListLabelsByIssue(owner string, repo string, number int, opt *ListOptions) ([]Label, *Response, error) {
|
func (s *IssuesService) ListLabelsByIssue(owner string, repo string, number int, opt *ListOptions) ([]*Label, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -126,7 +126,7 @@ func (s *IssuesService) ListLabelsByIssue(owner string, repo string, number int,
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
labels := new([]Label)
|
labels := new([]*Label)
|
||||||
resp, err := s.client.Do(req, labels)
|
resp, err := s.client.Do(req, labels)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -138,14 +138,14 @@ func (s *IssuesService) ListLabelsByIssue(owner string, repo string, number int,
|
||||||
// AddLabelsToIssue adds labels to an issue.
|
// AddLabelsToIssue adds labels to an issue.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository
|
// GitHub API docs: http://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository
|
||||||
func (s *IssuesService) AddLabelsToIssue(owner string, repo string, number int, labels []string) ([]Label, *Response, error) {
|
func (s *IssuesService) AddLabelsToIssue(owner string, repo string, number int, labels []string) ([]*Label, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number)
|
||||||
req, err := s.client.NewRequest("POST", u, labels)
|
req, err := s.client.NewRequest("POST", u, labels)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
l := new([]Label)
|
l := new([]*Label)
|
||||||
resp, err := s.client.Do(req, l)
|
resp, err := s.client.Do(req, l)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -169,14 +169,14 @@ func (s *IssuesService) RemoveLabelForIssue(owner string, repo string, number in
|
||||||
// ReplaceLabelsForIssue replaces all labels for an issue.
|
// ReplaceLabelsForIssue replaces all labels for an issue.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue
|
// GitHub API docs: http://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue
|
||||||
func (s *IssuesService) ReplaceLabelsForIssue(owner string, repo string, number int, labels []string) ([]Label, *Response, error) {
|
func (s *IssuesService) ReplaceLabelsForIssue(owner string, repo string, number int, labels []string) ([]*Label, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number)
|
||||||
req, err := s.client.NewRequest("PUT", u, labels)
|
req, err := s.client.NewRequest("PUT", u, labels)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
l := new([]Label)
|
l := new([]*Label)
|
||||||
resp, err := s.client.Do(req, l)
|
resp, err := s.client.Do(req, l)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -200,7 +200,7 @@ func (s *IssuesService) RemoveLabelsForIssue(owner string, repo string, number i
|
||||||
// ListLabelsForMilestone lists labels for every issue in a milestone.
|
// ListLabelsForMilestone lists labels for every issue in a milestone.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/issues/labels/#get-labels-for-every-issue-in-a-milestone
|
// GitHub API docs: http://developer.github.com/v3/issues/labels/#get-labels-for-every-issue-in-a-milestone
|
||||||
func (s *IssuesService) ListLabelsForMilestone(owner string, repo string, number int, opt *ListOptions) ([]Label, *Response, error) {
|
func (s *IssuesService) ListLabelsForMilestone(owner string, repo string, number int, opt *ListOptions) ([]*Label, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/milestones/%d/labels", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/milestones/%d/labels", owner, repo, number)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -212,7 +212,7 @@ func (s *IssuesService) ListLabelsForMilestone(owner string, repo string, number
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
labels := new([]Label)
|
labels := new([]*Label)
|
||||||
resp, err := s.client.Do(req, labels)
|
resp, err := s.client.Do(req, labels)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
10
vendor/github.com/google/go-github/github/issues_labels_test.go
generated
vendored
10
vendor/github.com/google/go-github/github/issues_labels_test.go
generated
vendored
|
@ -29,7 +29,7 @@ func TestIssuesService_ListLabels(t *testing.T) {
|
||||||
t.Errorf("Issues.ListLabels returned error: %v", err)
|
t.Errorf("Issues.ListLabels returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Label{{Name: String("a")}, {Name: String("b")}}
|
want := []*Label{{Name: String("a")}, {Name: String("b")}}
|
||||||
if !reflect.DeepEqual(labels, want) {
|
if !reflect.DeepEqual(labels, want) {
|
||||||
t.Errorf("Issues.ListLabels returned %+v, want %+v", labels, want)
|
t.Errorf("Issues.ListLabels returned %+v, want %+v", labels, want)
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ func TestIssuesService_ListLabelsByIssue(t *testing.T) {
|
||||||
t.Errorf("Issues.ListLabelsByIssue returned error: %v", err)
|
t.Errorf("Issues.ListLabelsByIssue returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Label{{Name: String("a")}, {Name: String("b")}}
|
want := []*Label{{Name: String("a")}, {Name: String("b")}}
|
||||||
if !reflect.DeepEqual(labels, want) {
|
if !reflect.DeepEqual(labels, want) {
|
||||||
t.Errorf("Issues.ListLabelsByIssue returned %+v, want %+v", labels, want)
|
t.Errorf("Issues.ListLabelsByIssue returned %+v, want %+v", labels, want)
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ func TestIssuesService_AddLabelsToIssue(t *testing.T) {
|
||||||
t.Errorf("Issues.AddLabelsToIssue returned error: %v", err)
|
t.Errorf("Issues.AddLabelsToIssue returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Label{{URL: String("u")}}
|
want := []*Label{{URL: String("u")}}
|
||||||
if !reflect.DeepEqual(labels, want) {
|
if !reflect.DeepEqual(labels, want) {
|
||||||
t.Errorf("Issues.AddLabelsToIssue returned %+v, want %+v", labels, want)
|
t.Errorf("Issues.AddLabelsToIssue returned %+v, want %+v", labels, want)
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ func TestIssuesService_ReplaceLabelsForIssue(t *testing.T) {
|
||||||
t.Errorf("Issues.ReplaceLabelsForIssue returned error: %v", err)
|
t.Errorf("Issues.ReplaceLabelsForIssue returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Label{{URL: String("u")}}
|
want := []*Label{{URL: String("u")}}
|
||||||
if !reflect.DeepEqual(labels, want) {
|
if !reflect.DeepEqual(labels, want) {
|
||||||
t.Errorf("Issues.ReplaceLabelsForIssue returned %+v, want %+v", labels, want)
|
t.Errorf("Issues.ReplaceLabelsForIssue returned %+v, want %+v", labels, want)
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ func TestIssuesService_ListLabelsForMilestone(t *testing.T) {
|
||||||
t.Errorf("Issues.ListLabelsForMilestone returned error: %v", err)
|
t.Errorf("Issues.ListLabelsForMilestone returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Label{{Name: String("a")}, {Name: String("b")}}
|
want := []*Label{{Name: String("a")}, {Name: String("b")}}
|
||||||
if !reflect.DeepEqual(labels, want) {
|
if !reflect.DeepEqual(labels, want) {
|
||||||
t.Errorf("Issues.ListLabelsForMilestone returned %+v, want %+v", labels, want)
|
t.Errorf("Issues.ListLabelsForMilestone returned %+v, want %+v", labels, want)
|
||||||
}
|
}
|
||||||
|
|
6
vendor/github.com/google/go-github/github/issues_milestones.go
generated
vendored
6
vendor/github.com/google/go-github/github/issues_milestones.go
generated
vendored
|
@ -47,12 +47,14 @@ type MilestoneListOptions struct {
|
||||||
// Direction in which to sort milestones. Possible values are: asc, desc.
|
// Direction in which to sort milestones. Possible values are: asc, desc.
|
||||||
// Default is "asc".
|
// Default is "asc".
|
||||||
Direction string `url:"direction,omitempty"`
|
Direction string `url:"direction,omitempty"`
|
||||||
|
|
||||||
|
ListOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListMilestones lists all milestones for a repository.
|
// ListMilestones lists all milestones for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
|
// GitHub API docs: https://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
|
||||||
func (s *IssuesService) ListMilestones(owner string, repo string, opt *MilestoneListOptions) ([]Milestone, *Response, error) {
|
func (s *IssuesService) ListMilestones(owner string, repo string, opt *MilestoneListOptions) ([]*Milestone, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/milestones", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/milestones", owner, repo)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -64,7 +66,7 @@ func (s *IssuesService) ListMilestones(owner string, repo string, opt *Milestone
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
milestones := new([]Milestone)
|
milestones := new([]*Milestone)
|
||||||
resp, err := s.client.Do(req, milestones)
|
resp, err := s.client.Do(req, milestones)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
5
vendor/github.com/google/go-github/github/issues_milestones_test.go
generated
vendored
5
vendor/github.com/google/go-github/github/issues_milestones_test.go
generated
vendored
|
@ -23,17 +23,18 @@ func TestIssuesService_ListMilestones(t *testing.T) {
|
||||||
"state": "closed",
|
"state": "closed",
|
||||||
"sort": "due_date",
|
"sort": "due_date",
|
||||||
"direction": "asc",
|
"direction": "asc",
|
||||||
|
"page": "2",
|
||||||
})
|
})
|
||||||
fmt.Fprint(w, `[{"number":1}]`)
|
fmt.Fprint(w, `[{"number":1}]`)
|
||||||
})
|
})
|
||||||
|
|
||||||
opt := &MilestoneListOptions{"closed", "due_date", "asc"}
|
opt := &MilestoneListOptions{"closed", "due_date", "asc", ListOptions{Page: 2}}
|
||||||
milestones, _, err := client.Issues.ListMilestones("o", "r", opt)
|
milestones, _, err := client.Issues.ListMilestones("o", "r", opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("IssuesService.ListMilestones returned error: %v", err)
|
t.Errorf("IssuesService.ListMilestones returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Milestone{{Number: Int(1)}}
|
want := []*Milestone{{Number: Int(1)}}
|
||||||
if !reflect.DeepEqual(milestones, want) {
|
if !reflect.DeepEqual(milestones, want) {
|
||||||
t.Errorf("IssuesService.ListMilestones returned %+v, want %+v", milestones, want)
|
t.Errorf("IssuesService.ListMilestones returned %+v, want %+v", milestones, want)
|
||||||
}
|
}
|
||||||
|
|
13
vendor/github.com/google/go-github/github/issues_test.go
generated
vendored
13
vendor/github.com/google/go-github/github/issues_test.go
generated
vendored
|
@ -40,12 +40,11 @@ func TestIssuesService_List_all(t *testing.T) {
|
||||||
ListOptions{Page: 1, PerPage: 2},
|
ListOptions{Page: 1, PerPage: 2},
|
||||||
}
|
}
|
||||||
issues, _, err := client.Issues.List(true, opt)
|
issues, _, err := client.Issues.List(true, opt)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Issues.List returned error: %v", err)
|
t.Errorf("Issues.List returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Issue{{Number: Int(1)}}
|
want := []*Issue{{Number: Int(1)}}
|
||||||
if !reflect.DeepEqual(issues, want) {
|
if !reflect.DeepEqual(issues, want) {
|
||||||
t.Errorf("Issues.List returned %+v, want %+v", issues, want)
|
t.Errorf("Issues.List returned %+v, want %+v", issues, want)
|
||||||
}
|
}
|
||||||
|
@ -66,7 +65,7 @@ func TestIssuesService_List_owned(t *testing.T) {
|
||||||
t.Errorf("Issues.List returned error: %v", err)
|
t.Errorf("Issues.List returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Issue{{Number: Int(1)}}
|
want := []*Issue{{Number: Int(1)}}
|
||||||
if !reflect.DeepEqual(issues, want) {
|
if !reflect.DeepEqual(issues, want) {
|
||||||
t.Errorf("Issues.List returned %+v, want %+v", issues, want)
|
t.Errorf("Issues.List returned %+v, want %+v", issues, want)
|
||||||
}
|
}
|
||||||
|
@ -87,7 +86,7 @@ func TestIssuesService_ListByOrg(t *testing.T) {
|
||||||
t.Errorf("Issues.ListByOrg returned error: %v", err)
|
t.Errorf("Issues.ListByOrg returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Issue{{Number: Int(1)}}
|
want := []*Issue{{Number: Int(1)}}
|
||||||
if !reflect.DeepEqual(issues, want) {
|
if !reflect.DeepEqual(issues, want) {
|
||||||
t.Errorf("Issues.List returned %+v, want %+v", issues, want)
|
t.Errorf("Issues.List returned %+v, want %+v", issues, want)
|
||||||
}
|
}
|
||||||
|
@ -129,7 +128,7 @@ func TestIssuesService_ListByRepo(t *testing.T) {
|
||||||
t.Errorf("Issues.ListByOrg returned error: %v", err)
|
t.Errorf("Issues.ListByOrg returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Issue{{Number: Int(1)}}
|
want := []*Issue{{Number: Int(1)}}
|
||||||
if !reflect.DeepEqual(issues, want) {
|
if !reflect.DeepEqual(issues, want) {
|
||||||
t.Errorf("Issues.List returned %+v, want %+v", issues, want)
|
t.Errorf("Issues.List returned %+v, want %+v", issues, want)
|
||||||
}
|
}
|
||||||
|
@ -189,6 +188,7 @@ func TestIssuesService_Create(t *testing.T) {
|
||||||
json.NewDecoder(r.Body).Decode(v)
|
json.NewDecoder(r.Body).Decode(v)
|
||||||
|
|
||||||
testMethod(t, r, "POST")
|
testMethod(t, r, "POST")
|
||||||
|
testHeader(t, r, "Accept", mediaTypeMultipleAssigneesPreview)
|
||||||
if !reflect.DeepEqual(v, input) {
|
if !reflect.DeepEqual(v, input) {
|
||||||
t.Errorf("Request body = %+v, want %+v", v, input)
|
t.Errorf("Request body = %+v, want %+v", v, input)
|
||||||
}
|
}
|
||||||
|
@ -223,6 +223,7 @@ func TestIssuesService_Edit(t *testing.T) {
|
||||||
json.NewDecoder(r.Body).Decode(v)
|
json.NewDecoder(r.Body).Decode(v)
|
||||||
|
|
||||||
testMethod(t, r, "PATCH")
|
testMethod(t, r, "PATCH")
|
||||||
|
testHeader(t, r, "Accept", mediaTypeMultipleAssigneesPreview)
|
||||||
if !reflect.DeepEqual(v, input) {
|
if !reflect.DeepEqual(v, input) {
|
||||||
t.Errorf("Request body = %+v, want %+v", v, input)
|
t.Errorf("Request body = %+v, want %+v", v, input)
|
||||||
}
|
}
|
||||||
|
@ -252,7 +253,6 @@ func TestIssuesService_Lock(t *testing.T) {
|
||||||
|
|
||||||
mux.HandleFunc("/repos/o/r/issues/1/lock", func(w http.ResponseWriter, r *http.Request) {
|
mux.HandleFunc("/repos/o/r/issues/1/lock", func(w http.ResponseWriter, r *http.Request) {
|
||||||
testMethod(t, r, "PUT")
|
testMethod(t, r, "PUT")
|
||||||
testHeader(t, r, "Accept", mediaTypeIssueLockingPreview)
|
|
||||||
|
|
||||||
w.WriteHeader(http.StatusNoContent)
|
w.WriteHeader(http.StatusNoContent)
|
||||||
})
|
})
|
||||||
|
@ -268,7 +268,6 @@ func TestIssuesService_Unlock(t *testing.T) {
|
||||||
|
|
||||||
mux.HandleFunc("/repos/o/r/issues/1/lock", func(w http.ResponseWriter, r *http.Request) {
|
mux.HandleFunc("/repos/o/r/issues/1/lock", func(w http.ResponseWriter, r *http.Request) {
|
||||||
testMethod(t, r, "DELETE")
|
testMethod(t, r, "DELETE")
|
||||||
testHeader(t, r, "Accept", mediaTypeIssueLockingPreview)
|
|
||||||
|
|
||||||
w.WriteHeader(http.StatusNoContent)
|
w.WriteHeader(http.StatusNoContent)
|
||||||
})
|
})
|
||||||
|
|
148
vendor/github.com/google/go-github/github/issues_timeline.go
generated
vendored
Normal file
148
vendor/github.com/google/go-github/github/issues_timeline.go
generated
vendored
Normal file
|
@ -0,0 +1,148 @@
|
||||||
|
// Copyright 2016 The go-github AUTHORS. All rights reserved.
|
||||||
|
//
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package github
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Timeline represents an event that occurred around an Issue or Pull Request.
|
||||||
|
//
|
||||||
|
// It is similar to an IssueEvent but may contain more information.
|
||||||
|
// GitHub API docs: https://developer.github.com/v3/issues/timeline/
|
||||||
|
type Timeline struct {
|
||||||
|
ID *int `json:"id,omitempty"`
|
||||||
|
URL *string `json:"url,omitempty"`
|
||||||
|
CommitURL *string `json:"commit_url,omitempty"`
|
||||||
|
|
||||||
|
// The User object that generated the event.
|
||||||
|
Actor *User `json:"actor,omitempty"`
|
||||||
|
|
||||||
|
// Event identifies the actual type of Event that occurred. Possible values
|
||||||
|
// are:
|
||||||
|
//
|
||||||
|
// assigned
|
||||||
|
// The issue was assigned to the assignee.
|
||||||
|
//
|
||||||
|
// closed
|
||||||
|
// The issue was closed by the actor. When the commit_id is present, it
|
||||||
|
// identifies the commit that closed the issue using "closes / fixes #NN"
|
||||||
|
// syntax.
|
||||||
|
//
|
||||||
|
// commented
|
||||||
|
// A comment was added to the issue.
|
||||||
|
//
|
||||||
|
// committed
|
||||||
|
// A commit was added to the pull request's 'HEAD' branch. Only provided
|
||||||
|
// for pull requests.
|
||||||
|
//
|
||||||
|
// cross-referenced
|
||||||
|
// The issue was referenced from another issue. The 'source' attribute
|
||||||
|
// contains the 'id', 'actor', and 'url' of the reference's source.
|
||||||
|
//
|
||||||
|
// demilestoned
|
||||||
|
// The issue was removed from a milestone.
|
||||||
|
//
|
||||||
|
// head_ref_deleted
|
||||||
|
// The pull request's branch was deleted.
|
||||||
|
//
|
||||||
|
// head_ref_restored
|
||||||
|
// The pull request's branch was restored.
|
||||||
|
//
|
||||||
|
// labeled
|
||||||
|
// A label was added to the issue.
|
||||||
|
//
|
||||||
|
// locked
|
||||||
|
// The issue was locked by the actor.
|
||||||
|
//
|
||||||
|
// mentioned
|
||||||
|
// The actor was @mentioned in an issue body.
|
||||||
|
//
|
||||||
|
// merged
|
||||||
|
// The issue was merged by the actor. The 'commit_id' attribute is the
|
||||||
|
// SHA1 of the HEAD commit that was merged.
|
||||||
|
//
|
||||||
|
// milestoned
|
||||||
|
// The issue was added to a milestone.
|
||||||
|
//
|
||||||
|
// referenced
|
||||||
|
// The issue was referenced from a commit message. The 'commit_id'
|
||||||
|
// attribute is the commit SHA1 of where that happened.
|
||||||
|
//
|
||||||
|
// renamed
|
||||||
|
// The issue title was changed.
|
||||||
|
//
|
||||||
|
// reopened
|
||||||
|
// The issue was reopened by the actor.
|
||||||
|
//
|
||||||
|
// subscribed
|
||||||
|
// The actor subscribed to receive notifications for an issue.
|
||||||
|
//
|
||||||
|
// unassigned
|
||||||
|
// The assignee was unassigned from the issue.
|
||||||
|
//
|
||||||
|
// unlabeled
|
||||||
|
// A label was removed from the issue.
|
||||||
|
//
|
||||||
|
// unlocked
|
||||||
|
// The issue was unlocked by the actor.
|
||||||
|
//
|
||||||
|
// unsubscribed
|
||||||
|
// The actor unsubscribed to stop receiving notifications for an issue.
|
||||||
|
//
|
||||||
|
Event *string `json:"event,omitempty"`
|
||||||
|
|
||||||
|
// The string SHA of a commit that referenced this Issue or Pull Request.
|
||||||
|
CommitID *string `json:"commit_id,omitempty"`
|
||||||
|
// The timestamp indicating when the event occurred.
|
||||||
|
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||||
|
// The Label object including `name` and `color` attributes. Only provided for
|
||||||
|
// 'labeled' and 'unlabeled' events.
|
||||||
|
Label *Label `json:"label,omitempty"`
|
||||||
|
// The User object which was assigned to (or unassigned from) this Issue or
|
||||||
|
// Pull Request. Only provided for 'assigned' and 'unassigned' events.
|
||||||
|
Assignee *User `json:"assignee,omitempty"`
|
||||||
|
// The Milestone object including a 'title' attribute.
|
||||||
|
// Only provided for 'milestoned' and 'demilestoned' events.
|
||||||
|
Milestone *Milestone `json:"milestone,omitempty"`
|
||||||
|
// The 'id', 'actor', and 'url' for the source of a reference from another issue.
|
||||||
|
// Only provided for 'cross-referenced' events.
|
||||||
|
Source *Source `json:"source,omitempty"`
|
||||||
|
// An object containing rename details including 'from' and 'to' attributes.
|
||||||
|
// Only provided for 'renamed' events.
|
||||||
|
Rename *Rename `json:"rename,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Source represents a reference's source.
|
||||||
|
type Source struct {
|
||||||
|
ID *int `json:"id,omitempty"`
|
||||||
|
URL *string `json:"url,omitempty"`
|
||||||
|
Actor *User `json:"actor,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListIssueTimeline lists events for the specified issue.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://developer.github.com/v3/issues/timeline/#list-events-for-an-issue
|
||||||
|
func (s *IssuesService) ListIssueTimeline(owner, repo string, number int, opt *ListOptions) ([]*Timeline, *Response, error) {
|
||||||
|
u := fmt.Sprintf("repos/%v/%v/issues/%v/timeline", owner, repo, number)
|
||||||
|
u, err := addOptions(u, opt)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: remove custom Accept header when this API fully launches.
|
||||||
|
req.Header.Set("Accept", mediaTypeTimelinePreview)
|
||||||
|
|
||||||
|
var events []*Timeline
|
||||||
|
resp, err := s.client.Do(req, &events)
|
||||||
|
return events, resp, err
|
||||||
|
}
|
39
vendor/github.com/google/go-github/github/issues_timeline_test.go
generated
vendored
Normal file
39
vendor/github.com/google/go-github/github/issues_timeline_test.go
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
// Copyright 2016 The go-github AUTHORS. All rights reserved.
|
||||||
|
//
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package github
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"reflect"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestIssuesService_ListIssueTimeline(t *testing.T) {
|
||||||
|
setup()
|
||||||
|
defer teardown()
|
||||||
|
|
||||||
|
mux.HandleFunc("/repos/o/r/issues/1/timeline", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
testMethod(t, r, "GET")
|
||||||
|
testHeader(t, r, "Accept", mediaTypeTimelinePreview)
|
||||||
|
testFormValues(t, r, values{
|
||||||
|
"page": "1",
|
||||||
|
"per_page": "2",
|
||||||
|
})
|
||||||
|
fmt.Fprint(w, `[{"id":1}]`)
|
||||||
|
})
|
||||||
|
|
||||||
|
opt := &ListOptions{Page: 1, PerPage: 2}
|
||||||
|
events, _, err := client.Issues.ListIssueTimeline("o", "r", 1, opt)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Issues.ListIssueTimeline returned error: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
want := []*Timeline{{ID: Int(1)}}
|
||||||
|
if !reflect.DeepEqual(events, want) {
|
||||||
|
t.Errorf("Issues.ListIssueTimeline = %+v, want %+v", events, want)
|
||||||
|
}
|
||||||
|
}
|
4
vendor/github.com/google/go-github/github/licenses.go
generated
vendored
4
vendor/github.com/google/go-github/github/licenses.go
generated
vendored
|
@ -39,7 +39,7 @@ func (l License) String() string {
|
||||||
// List popular open source licenses.
|
// List popular open source licenses.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/licenses/#list-all-licenses
|
// GitHub API docs: https://developer.github.com/v3/licenses/#list-all-licenses
|
||||||
func (s *LicensesService) List() ([]License, *Response, error) {
|
func (s *LicensesService) List() ([]*License, *Response, error) {
|
||||||
req, err := s.client.NewRequest("GET", "licenses", nil)
|
req, err := s.client.NewRequest("GET", "licenses", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
@ -48,7 +48,7 @@ func (s *LicensesService) List() ([]License, *Response, error) {
|
||||||
// TODO: remove custom Accept header when this API fully launches
|
// TODO: remove custom Accept header when this API fully launches
|
||||||
req.Header.Set("Accept", mediaTypeLicensesPreview)
|
req.Header.Set("Accept", mediaTypeLicensesPreview)
|
||||||
|
|
||||||
licenses := new([]License)
|
licenses := new([]*License)
|
||||||
resp, err := s.client.Do(req, licenses)
|
resp, err := s.client.Do(req, licenses)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
2
vendor/github.com/google/go-github/github/licenses_test.go
generated
vendored
2
vendor/github.com/google/go-github/github/licenses_test.go
generated
vendored
|
@ -27,7 +27,7 @@ func TestLicensesService_List(t *testing.T) {
|
||||||
t.Errorf("Licenses.List returned error: %v", err)
|
t.Errorf("Licenses.List returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []License{{
|
want := []*License{{
|
||||||
Key: String("mit"),
|
Key: String("mit"),
|
||||||
Name: String("MIT"),
|
Name: String("MIT"),
|
||||||
URL: String("https://api.github.com/licenses/mit"),
|
URL: String("https://api.github.com/licenses/mit"),
|
||||||
|
|
119
vendor/github.com/google/go-github/github/messages.go
generated
vendored
Normal file
119
vendor/github.com/google/go-github/github/messages.go
generated
vendored
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
// Copyright 2016 The go-github AUTHORS. All rights reserved.
|
||||||
|
//
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// This file provides functions for validating payloads from GitHub Webhooks.
|
||||||
|
// GitHub docs: https://developer.github.com/webhooks/securing/#validating-payloads-from-github
|
||||||
|
|
||||||
|
package github
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/hmac"
|
||||||
|
"crypto/sha1"
|
||||||
|
"crypto/sha256"
|
||||||
|
"crypto/sha512"
|
||||||
|
"encoding/hex"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"hash"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// sha1Prefix is the prefix used by GitHub before the HMAC hexdigest.
|
||||||
|
sha1Prefix = "sha1"
|
||||||
|
// sha256Prefix and sha512Prefix are provided for future compatibility.
|
||||||
|
sha256Prefix = "sha256"
|
||||||
|
sha512Prefix = "sha512"
|
||||||
|
// signatureHeader is the GitHub header key used to pass the HMAC hexdigest.
|
||||||
|
signatureHeader = "X-Hub-Signature"
|
||||||
|
)
|
||||||
|
|
||||||
|
// genMAC generates the HMAC signature for a message provided the secret key
|
||||||
|
// and hashFunc.
|
||||||
|
func genMAC(message, key []byte, hashFunc func() hash.Hash) []byte {
|
||||||
|
mac := hmac.New(hashFunc, key)
|
||||||
|
mac.Write(message)
|
||||||
|
return mac.Sum(nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// checkMAC reports whether messageMAC is a valid HMAC tag for message.
|
||||||
|
func checkMAC(message, messageMAC, key []byte, hashFunc func() hash.Hash) bool {
|
||||||
|
expectedMAC := genMAC(message, key, hashFunc)
|
||||||
|
return hmac.Equal(messageMAC, expectedMAC)
|
||||||
|
}
|
||||||
|
|
||||||
|
// messageMAC returns the hex-decoded HMAC tag from the signature and its
|
||||||
|
// corresponding hash function.
|
||||||
|
func messageMAC(signature string) ([]byte, func() hash.Hash, error) {
|
||||||
|
if signature == "" {
|
||||||
|
return nil, nil, errors.New("missing signature")
|
||||||
|
}
|
||||||
|
sigParts := strings.SplitN(signature, "=", 2)
|
||||||
|
if len(sigParts) != 2 {
|
||||||
|
return nil, nil, fmt.Errorf("error parsing signature %q", signature)
|
||||||
|
}
|
||||||
|
|
||||||
|
var hashFunc func() hash.Hash
|
||||||
|
switch sigParts[0] {
|
||||||
|
case sha1Prefix:
|
||||||
|
hashFunc = sha1.New
|
||||||
|
case sha256Prefix:
|
||||||
|
hashFunc = sha256.New
|
||||||
|
case sha512Prefix:
|
||||||
|
hashFunc = sha512.New
|
||||||
|
default:
|
||||||
|
return nil, nil, fmt.Errorf("unknown hash type prefix: %q", sigParts[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
buf, err := hex.DecodeString(sigParts[1])
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, fmt.Errorf("error decoding signature %q: %v", signature, err)
|
||||||
|
}
|
||||||
|
return buf, hashFunc, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidatePayload validates an incoming GitHub Webhook event request
|
||||||
|
// and returns the (JSON) payload.
|
||||||
|
// secretKey is the GitHub Webhook secret message.
|
||||||
|
//
|
||||||
|
// Example usage:
|
||||||
|
//
|
||||||
|
// func (s *GitHubEventMonitor) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
|
// payload, err := github.ValidatePayload(r, s.webhookSecretKey)
|
||||||
|
// if err != nil { ... }
|
||||||
|
// // Process payload...
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
func ValidatePayload(r *http.Request, secretKey []byte) (payload []byte, err error) {
|
||||||
|
payload, err = ioutil.ReadAll(r.Body)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
sig := r.Header.Get(signatureHeader)
|
||||||
|
if err := validateSignature(sig, payload, secretKey); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return payload, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// validateSignature validates the signature for the given payload.
|
||||||
|
// signature is the GitHub hash signature delivered in the X-Hub-Signature header.
|
||||||
|
// payload is the JSON payload sent by GitHub Webhooks.
|
||||||
|
// secretKey is the GitHub Webhook secret message.
|
||||||
|
//
|
||||||
|
// GitHub docs: https://developer.github.com/webhooks/securing/#validating-payloads-from-github
|
||||||
|
func validateSignature(signature string, payload, secretKey []byte) error {
|
||||||
|
messageMAC, hashFunc, err := messageMAC(signature)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if !checkMAC(payload, messageMAC, secretKey, hashFunc) {
|
||||||
|
return errors.New("payload signature check failed")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
81
vendor/github.com/google/go-github/github/messages_test.go
generated
vendored
Normal file
81
vendor/github.com/google/go-github/github/messages_test.go
generated
vendored
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
// Copyright 2016 The go-github AUTHORS. All rights reserved.
|
||||||
|
//
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package github
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"net/http"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestValidatePayload(t *testing.T) {
|
||||||
|
const defaultBody = `{"yo":true}` // All tests below use the default request body and signature.
|
||||||
|
const defaultSignature = "sha1=126f2c800419c60137ce748d7672e77b65cf16d6"
|
||||||
|
secretKey := []byte("0123456789abcdef")
|
||||||
|
tests := []struct {
|
||||||
|
signature string
|
||||||
|
eventID string
|
||||||
|
event string
|
||||||
|
wantEventID string
|
||||||
|
wantEvent string
|
||||||
|
wantPayload string
|
||||||
|
}{
|
||||||
|
// The following tests generate expected errors:
|
||||||
|
{}, // Missing signature
|
||||||
|
{signature: "yo"}, // Missing signature prefix
|
||||||
|
{signature: "sha1=yo"}, // Signature not hex string
|
||||||
|
{signature: "sha1=012345"}, // Invalid signature
|
||||||
|
// The following tests expect err=nil:
|
||||||
|
{
|
||||||
|
signature: defaultSignature,
|
||||||
|
eventID: "dead-beef",
|
||||||
|
event: "ping",
|
||||||
|
wantEventID: "dead-beef",
|
||||||
|
wantEvent: "ping",
|
||||||
|
wantPayload: defaultBody,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
signature: defaultSignature,
|
||||||
|
event: "ping",
|
||||||
|
wantEvent: "ping",
|
||||||
|
wantPayload: defaultBody,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
signature: "sha256=b1f8020f5b4cd42042f807dd939015c4a418bc1ff7f604dd55b0a19b5d953d9b",
|
||||||
|
event: "ping",
|
||||||
|
wantEvent: "ping",
|
||||||
|
wantPayload: defaultBody,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
signature: "sha512=8456767023c1195682e182a23b3f5d19150ecea598fde8cb85918f7281b16079471b1329f92b912c4d8bd7455cb159777db8f29608b20c7c87323ba65ae62e1f",
|
||||||
|
event: "ping",
|
||||||
|
wantEvent: "ping",
|
||||||
|
wantPayload: defaultBody,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, test := range tests {
|
||||||
|
buf := bytes.NewBufferString(defaultBody)
|
||||||
|
req, err := http.NewRequest("GET", "http://localhost/event", buf)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("NewRequest: %v", err)
|
||||||
|
}
|
||||||
|
if test.signature != "" {
|
||||||
|
req.Header.Set(signatureHeader, test.signature)
|
||||||
|
}
|
||||||
|
|
||||||
|
got, err := ValidatePayload(req, secretKey)
|
||||||
|
if err != nil {
|
||||||
|
if test.wantPayload != "" {
|
||||||
|
t.Errorf("ValidatePayload(%#v): err = %v, want nil", test, err)
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if string(got) != test.wantPayload {
|
||||||
|
t.Errorf("ValidatePayload = %q, want %q", got, test.wantPayload)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
8
vendor/github.com/google/go-github/github/migrations_source_import.go
generated
vendored
8
vendor/github.com/google/go-github/github/migrations_source_import.go
generated
vendored
|
@ -220,7 +220,7 @@ func (s *MigrationService) UpdateImport(owner, repo string, in *Import) (*Import
|
||||||
// information.
|
// information.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#get-commit-authors
|
// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#get-commit-authors
|
||||||
func (s *MigrationService) CommitAuthors(owner, repo string) ([]SourceImportAuthor, *Response, error) {
|
func (s *MigrationService) CommitAuthors(owner, repo string) ([]*SourceImportAuthor, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/import/authors", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/import/authors", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -230,7 +230,7 @@ func (s *MigrationService) CommitAuthors(owner, repo string) ([]SourceImportAuth
|
||||||
// TODO: remove custom Accept header when this API fully launches
|
// TODO: remove custom Accept header when this API fully launches
|
||||||
req.Header.Set("Accept", mediaTypeImportPreview)
|
req.Header.Set("Accept", mediaTypeImportPreview)
|
||||||
|
|
||||||
authors := new([]SourceImportAuthor)
|
authors := new([]*SourceImportAuthor)
|
||||||
resp, err := s.client.Do(req, authors)
|
resp, err := s.client.Do(req, authors)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -290,7 +290,7 @@ func (s *MigrationService) SetLFSPreference(owner, repo string, in *Import) (*Im
|
||||||
// LargeFiles lists files larger than 100MB found during the import.
|
// LargeFiles lists files larger than 100MB found during the import.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#get-large-files
|
// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#get-large-files
|
||||||
func (s *MigrationService) LargeFiles(owner, repo string) ([]LargeFile, *Response, error) {
|
func (s *MigrationService) LargeFiles(owner, repo string) ([]*LargeFile, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/import/large_files", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/import/large_files", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -300,7 +300,7 @@ func (s *MigrationService) LargeFiles(owner, repo string) ([]LargeFile, *Respons
|
||||||
// TODO: remove custom Accept header when this API fully launches
|
// TODO: remove custom Accept header when this API fully launches
|
||||||
req.Header.Set("Accept", mediaTypeImportPreview)
|
req.Header.Set("Accept", mediaTypeImportPreview)
|
||||||
|
|
||||||
files := new([]LargeFile)
|
files := new([]*LargeFile)
|
||||||
resp, err := s.client.Do(req, files)
|
resp, err := s.client.Do(req, files)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
4
vendor/github.com/google/go-github/github/migrations_source_import_test.go
generated
vendored
4
vendor/github.com/google/go-github/github/migrations_source_import_test.go
generated
vendored
|
@ -117,7 +117,7 @@ func TestMigrationService_CommitAuthors(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("CommitAuthors returned error: %v", err)
|
t.Errorf("CommitAuthors returned error: %v", err)
|
||||||
}
|
}
|
||||||
want := []SourceImportAuthor{
|
want := []*SourceImportAuthor{
|
||||||
{ID: Int(1), Name: String("a")},
|
{ID: Int(1), Name: String("a")},
|
||||||
{ID: Int(2), Name: String("b")},
|
{ID: Int(2), Name: String("b")},
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ func TestMigrationService_LargeFiles(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("LargeFiles returned error: %v", err)
|
t.Errorf("LargeFiles returned error: %v", err)
|
||||||
}
|
}
|
||||||
want := []LargeFile{
|
want := []*LargeFile{
|
||||||
{OID: String("a")},
|
{OID: String("a")},
|
||||||
{OID: String("b")},
|
{OID: String("b")},
|
||||||
}
|
}
|
||||||
|
|
4
vendor/github.com/google/go-github/github/misc.go
generated
vendored
4
vendor/github.com/google/go-github/github/misc.go
generated
vendored
|
@ -180,14 +180,14 @@ func (s *ServiceHook) String() string {
|
||||||
// ListServiceHooks lists all of the available service hooks.
|
// ListServiceHooks lists all of the available service hooks.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/webhooks/#services
|
// GitHub API docs: https://developer.github.com/webhooks/#services
|
||||||
func (c *Client) ListServiceHooks() ([]ServiceHook, *Response, error) {
|
func (c *Client) ListServiceHooks() ([]*ServiceHook, *Response, error) {
|
||||||
u := "hooks"
|
u := "hooks"
|
||||||
req, err := c.NewRequest("GET", u, nil)
|
req, err := c.NewRequest("GET", u, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
hooks := new([]ServiceHook)
|
hooks := new([]*ServiceHook)
|
||||||
resp, err := c.Do(req, hooks)
|
resp, err := c.Do(req, hooks)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
16
vendor/github.com/google/go-github/github/misc_test.go
generated
vendored
16
vendor/github.com/google/go-github/github/misc_test.go
generated
vendored
|
@ -46,20 +46,6 @@ func TestMarkdown(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExampleClient_Markdown() {
|
|
||||||
client := NewClient(nil)
|
|
||||||
|
|
||||||
input := "# heading #\n\nLink to issue #1"
|
|
||||||
opt := &MarkdownOptions{Mode: "gfm", Context: "google/go-github"}
|
|
||||||
|
|
||||||
output, _, err := client.Markdown(input, opt)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Println(output)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestListEmojis(t *testing.T) {
|
func TestListEmojis(t *testing.T) {
|
||||||
setup()
|
setup()
|
||||||
defer teardown()
|
defer teardown()
|
||||||
|
@ -172,7 +158,7 @@ func TestRepositoriesService_ListServiceHooks(t *testing.T) {
|
||||||
t.Errorf("Repositories.ListHooks returned error: %v", err)
|
t.Errorf("Repositories.ListHooks returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []ServiceHook{{
|
want := []*ServiceHook{{
|
||||||
Name: String("n"),
|
Name: String("n"),
|
||||||
Events: []string{"e"},
|
Events: []string{"e"},
|
||||||
SupportedEvents: []string{"s"},
|
SupportedEvents: []string{"s"},
|
||||||
|
|
10
vendor/github.com/google/go-github/github/orgs.go
generated
vendored
10
vendor/github.com/google/go-github/github/orgs.go
generated
vendored
|
@ -73,6 +73,8 @@ func (p Plan) String() string {
|
||||||
type OrganizationsListOptions struct {
|
type OrganizationsListOptions struct {
|
||||||
// Since filters Organizations by ID.
|
// Since filters Organizations by ID.
|
||||||
Since int `url:"since,omitempty"`
|
Since int `url:"since,omitempty"`
|
||||||
|
|
||||||
|
ListOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListAll lists all organizations, in the order that they were created on GitHub.
|
// ListAll lists all organizations, in the order that they were created on GitHub.
|
||||||
|
@ -82,7 +84,7 @@ type OrganizationsListOptions struct {
|
||||||
// as the opts.Since parameter for the next call.
|
// as the opts.Since parameter for the next call.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/#list-all-organizations
|
// GitHub API docs: https://developer.github.com/v3/orgs/#list-all-organizations
|
||||||
func (s *OrganizationsService) ListAll(opt *OrganizationsListOptions) ([]Organization, *Response, error) {
|
func (s *OrganizationsService) ListAll(opt *OrganizationsListOptions) ([]*Organization, *Response, error) {
|
||||||
u, err := addOptions("organizations", opt)
|
u, err := addOptions("organizations", opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
@ -93,7 +95,7 @@ func (s *OrganizationsService) ListAll(opt *OrganizationsListOptions) ([]Organiz
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
orgs := []Organization{}
|
orgs := []*Organization{}
|
||||||
resp, err := s.client.Do(req, &orgs)
|
resp, err := s.client.Do(req, &orgs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -105,7 +107,7 @@ func (s *OrganizationsService) ListAll(opt *OrganizationsListOptions) ([]Organiz
|
||||||
// organizations for the authenticated user.
|
// organizations for the authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/orgs/#list-user-organizations
|
// GitHub API docs: http://developer.github.com/v3/orgs/#list-user-organizations
|
||||||
func (s *OrganizationsService) List(user string, opt *ListOptions) ([]Organization, *Response, error) {
|
func (s *OrganizationsService) List(user string, opt *ListOptions) ([]*Organization, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if user != "" {
|
if user != "" {
|
||||||
u = fmt.Sprintf("users/%v/orgs", user)
|
u = fmt.Sprintf("users/%v/orgs", user)
|
||||||
|
@ -122,7 +124,7 @@ func (s *OrganizationsService) List(user string, opt *ListOptions) ([]Organizati
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
orgs := new([]Organization)
|
orgs := new([]*Organization)
|
||||||
resp, err := s.client.Do(req, orgs)
|
resp, err := s.client.Do(req, orgs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
4
vendor/github.com/google/go-github/github/orgs_hooks.go
generated
vendored
4
vendor/github.com/google/go-github/github/orgs_hooks.go
generated
vendored
|
@ -10,7 +10,7 @@ import "fmt"
|
||||||
// ListHooks lists all Hooks for the specified organization.
|
// ListHooks lists all Hooks for the specified organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#list-hooks
|
// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#list-hooks
|
||||||
func (s *OrganizationsService) ListHooks(org string, opt *ListOptions) ([]Hook, *Response, error) {
|
func (s *OrganizationsService) ListHooks(org string, opt *ListOptions) ([]*Hook, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/hooks", org)
|
u := fmt.Sprintf("orgs/%v/hooks", org)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -22,7 +22,7 @@ func (s *OrganizationsService) ListHooks(org string, opt *ListOptions) ([]Hook,
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
hooks := new([]Hook)
|
hooks := new([]*Hook)
|
||||||
resp, err := s.client.Do(req, hooks)
|
resp, err := s.client.Do(req, hooks)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
2
vendor/github.com/google/go-github/github/orgs_hooks_test.go
generated
vendored
2
vendor/github.com/google/go-github/github/orgs_hooks_test.go
generated
vendored
|
@ -30,7 +30,7 @@ func TestOrganizationsService_ListHooks(t *testing.T) {
|
||||||
t.Errorf("Organizations.ListHooks returned error: %v", err)
|
t.Errorf("Organizations.ListHooks returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Hook{{ID: Int(1)}, {ID: Int(2)}}
|
want := []*Hook{{ID: Int(1)}, {ID: Int(2)}}
|
||||||
if !reflect.DeepEqual(hooks, want) {
|
if !reflect.DeepEqual(hooks, want) {
|
||||||
t.Errorf("Organizations.ListHooks returned %+v, want %+v", hooks, want)
|
t.Errorf("Organizations.ListHooks returned %+v, want %+v", hooks, want)
|
||||||
}
|
}
|
||||||
|
|
12
vendor/github.com/google/go-github/github/orgs_members.go
generated
vendored
12
vendor/github.com/google/go-github/github/orgs_members.go
generated
vendored
|
@ -69,7 +69,7 @@ type ListMembersOptions struct {
|
||||||
// public members, otherwise it will only return public members.
|
// public members, otherwise it will only return public members.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/orgs/members/#members-list
|
// GitHub API docs: http://developer.github.com/v3/orgs/members/#members-list
|
||||||
func (s *OrganizationsService) ListMembers(org string, opt *ListMembersOptions) ([]User, *Response, error) {
|
func (s *OrganizationsService) ListMembers(org string, opt *ListMembersOptions) ([]*User, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if opt != nil && opt.PublicOnly {
|
if opt != nil && opt.PublicOnly {
|
||||||
u = fmt.Sprintf("orgs/%v/public_members", org)
|
u = fmt.Sprintf("orgs/%v/public_members", org)
|
||||||
|
@ -86,11 +86,7 @@ func (s *OrganizationsService) ListMembers(org string, opt *ListMembersOptions)
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if opt != nil && opt.Role != "" {
|
members := new([]*User)
|
||||||
req.Header.Set("Accept", mediaTypeOrgPermissionPreview)
|
|
||||||
}
|
|
||||||
|
|
||||||
members := new([]User)
|
|
||||||
resp, err := s.client.Do(req, members)
|
resp, err := s.client.Do(req, members)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -182,7 +178,7 @@ type ListOrgMembershipsOptions struct {
|
||||||
// ListOrgMemberships lists the organization memberships for the authenticated user.
|
// ListOrgMemberships lists the organization memberships for the authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/members/#list-your-organization-memberships
|
// GitHub API docs: https://developer.github.com/v3/orgs/members/#list-your-organization-memberships
|
||||||
func (s *OrganizationsService) ListOrgMemberships(opt *ListOrgMembershipsOptions) ([]Membership, *Response, error) {
|
func (s *OrganizationsService) ListOrgMemberships(opt *ListOrgMembershipsOptions) ([]*Membership, *Response, error) {
|
||||||
u := "user/memberships/orgs"
|
u := "user/memberships/orgs"
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -194,7 +190,7 @@ func (s *OrganizationsService) ListOrgMemberships(opt *ListOrgMembershipsOptions
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var memberships []Membership
|
var memberships []*Membership
|
||||||
resp, err := s.client.Do(req, &memberships)
|
resp, err := s.client.Do(req, &memberships)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
7
vendor/github.com/google/go-github/github/orgs_members_test.go
generated
vendored
7
vendor/github.com/google/go-github/github/orgs_members_test.go
generated
vendored
|
@ -19,7 +19,6 @@ func TestOrganizationsService_ListMembers(t *testing.T) {
|
||||||
|
|
||||||
mux.HandleFunc("/orgs/o/members", func(w http.ResponseWriter, r *http.Request) {
|
mux.HandleFunc("/orgs/o/members", func(w http.ResponseWriter, r *http.Request) {
|
||||||
testMethod(t, r, "GET")
|
testMethod(t, r, "GET")
|
||||||
testHeader(t, r, "Accept", mediaTypeOrgPermissionPreview)
|
|
||||||
testFormValues(t, r, values{
|
testFormValues(t, r, values{
|
||||||
"filter": "2fa_disabled",
|
"filter": "2fa_disabled",
|
||||||
"role": "admin",
|
"role": "admin",
|
||||||
|
@ -39,7 +38,7 @@ func TestOrganizationsService_ListMembers(t *testing.T) {
|
||||||
t.Errorf("Organizations.ListMembers returned error: %v", err)
|
t.Errorf("Organizations.ListMembers returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []User{{ID: Int(1)}}
|
want := []*User{{ID: Int(1)}}
|
||||||
if !reflect.DeepEqual(members, want) {
|
if !reflect.DeepEqual(members, want) {
|
||||||
t.Errorf("Organizations.ListMembers returned %+v, want %+v", members, want)
|
t.Errorf("Organizations.ListMembers returned %+v, want %+v", members, want)
|
||||||
}
|
}
|
||||||
|
@ -65,7 +64,7 @@ func TestOrganizationsService_ListMembers_public(t *testing.T) {
|
||||||
t.Errorf("Organizations.ListMembers returned error: %v", err)
|
t.Errorf("Organizations.ListMembers returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []User{{ID: Int(1)}}
|
want := []*User{{ID: Int(1)}}
|
||||||
if !reflect.DeepEqual(members, want) {
|
if !reflect.DeepEqual(members, want) {
|
||||||
t.Errorf("Organizations.ListMembers returned %+v, want %+v", members, want)
|
t.Errorf("Organizations.ListMembers returned %+v, want %+v", members, want)
|
||||||
}
|
}
|
||||||
|
@ -236,7 +235,7 @@ func TestOrganizationsService_ListOrgMemberships(t *testing.T) {
|
||||||
t.Errorf("Organizations.ListOrgMemberships returned error: %v", err)
|
t.Errorf("Organizations.ListOrgMemberships returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Membership{{URL: String("u")}}
|
want := []*Membership{{URL: String("u")}}
|
||||||
if !reflect.DeepEqual(memberships, want) {
|
if !reflect.DeepEqual(memberships, want) {
|
||||||
t.Errorf("Organizations.ListOrgMemberships returned %+v, want %+v", memberships, want)
|
t.Errorf("Organizations.ListOrgMemberships returned %+v, want %+v", memberships, want)
|
||||||
}
|
}
|
||||||
|
|
40
vendor/github.com/google/go-github/github/orgs_teams.go
generated
vendored
40
vendor/github.com/google/go-github/github/orgs_teams.go
generated
vendored
|
@ -44,7 +44,7 @@ func (t Team) String() string {
|
||||||
// ListTeams lists all of the teams for an organization.
|
// ListTeams lists all of the teams for an organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/orgs/teams/#list-teams
|
// GitHub API docs: http://developer.github.com/v3/orgs/teams/#list-teams
|
||||||
func (s *OrganizationsService) ListTeams(org string, opt *ListOptions) ([]Team, *Response, error) {
|
func (s *OrganizationsService) ListTeams(org string, opt *ListOptions) ([]*Team, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams", org)
|
u := fmt.Sprintf("orgs/%v/teams", org)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -56,7 +56,7 @@ func (s *OrganizationsService) ListTeams(org string, opt *ListOptions) ([]Team,
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
teams := new([]Team)
|
teams := new([]*Team)
|
||||||
resp, err := s.client.Do(req, teams)
|
resp, err := s.client.Do(req, teams)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -94,10 +94,6 @@ func (s *OrganizationsService) CreateTeam(org string, team *Team) (*Team, *Respo
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if team.Privacy != nil {
|
|
||||||
req.Header.Set("Accept", mediaTypeOrgPermissionPreview)
|
|
||||||
}
|
|
||||||
|
|
||||||
t := new(Team)
|
t := new(Team)
|
||||||
resp, err := s.client.Do(req, t)
|
resp, err := s.client.Do(req, t)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -117,10 +113,6 @@ func (s *OrganizationsService) EditTeam(id int, team *Team) (*Team, *Response, e
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if team.Privacy != nil {
|
|
||||||
req.Header.Set("Accept", mediaTypeOrgPermissionPreview)
|
|
||||||
}
|
|
||||||
|
|
||||||
t := new(Team)
|
t := new(Team)
|
||||||
resp, err := s.client.Do(req, t)
|
resp, err := s.client.Do(req, t)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -157,7 +149,7 @@ type OrganizationListTeamMembersOptions struct {
|
||||||
// team.
|
// team.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/orgs/teams/#list-team-members
|
// GitHub API docs: http://developer.github.com/v3/orgs/teams/#list-team-members
|
||||||
func (s *OrganizationsService) ListTeamMembers(team int, opt *OrganizationListTeamMembersOptions) ([]User, *Response, error) {
|
func (s *OrganizationsService) ListTeamMembers(team int, opt *OrganizationListTeamMembersOptions) ([]*User, *Response, error) {
|
||||||
u := fmt.Sprintf("teams/%v/members", team)
|
u := fmt.Sprintf("teams/%v/members", team)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -169,11 +161,7 @@ func (s *OrganizationsService) ListTeamMembers(team int, opt *OrganizationListTe
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if opt != nil && opt.Role != "" {
|
members := new([]*User)
|
||||||
req.Header.Set("Accept", mediaTypeOrgPermissionPreview)
|
|
||||||
}
|
|
||||||
|
|
||||||
members := new([]User)
|
|
||||||
resp, err := s.client.Do(req, members)
|
resp, err := s.client.Do(req, members)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -200,7 +188,7 @@ func (s *OrganizationsService) IsTeamMember(team int, user string) (bool, *Respo
|
||||||
// ListTeamRepos lists the repositories that the specified team has access to.
|
// ListTeamRepos lists the repositories that the specified team has access to.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/orgs/teams/#list-team-repos
|
// GitHub API docs: http://developer.github.com/v3/orgs/teams/#list-team-repos
|
||||||
func (s *OrganizationsService) ListTeamRepos(team int, opt *ListOptions) ([]Repository, *Response, error) {
|
func (s *OrganizationsService) ListTeamRepos(team int, opt *ListOptions) ([]*Repository, *Response, error) {
|
||||||
u := fmt.Sprintf("teams/%v/repos", team)
|
u := fmt.Sprintf("teams/%v/repos", team)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -212,7 +200,7 @@ func (s *OrganizationsService) ListTeamRepos(team int, opt *ListOptions) ([]Repo
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
repos := new([]Repository)
|
repos := new([]*Repository)
|
||||||
resp, err := s.client.Do(req, repos)
|
resp, err := s.client.Do(req, repos)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -225,7 +213,7 @@ func (s *OrganizationsService) ListTeamRepos(team int, opt *ListOptions) ([]Repo
|
||||||
// repository is managed by team, a Repository is returned which includes the
|
// repository is managed by team, a Repository is returned which includes the
|
||||||
// permissions team has for that repo.
|
// permissions team has for that repo.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/orgs/teams/#get-team-repo
|
// GitHub API docs: https://developer.github.com/v3/orgs/teams/#check-if-a-team-manages-a-repository
|
||||||
func (s *OrganizationsService) IsTeamRepo(team int, owner string, repo string) (*Repository, *Response, error) {
|
func (s *OrganizationsService) IsTeamRepo(team int, owner string, repo string) (*Repository, *Response, error) {
|
||||||
u := fmt.Sprintf("teams/%v/repos/%v/%v", team, owner, repo)
|
u := fmt.Sprintf("teams/%v/repos/%v/%v", team, owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -233,7 +221,7 @@ func (s *OrganizationsService) IsTeamRepo(team int, owner string, repo string) (
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
req.Header.Set("Accept", mediaTypeOrgPermissionRepoPreview)
|
req.Header.Set("Accept", mediaTypeOrgPermissionRepo)
|
||||||
|
|
||||||
repository := new(Repository)
|
repository := new(Repository)
|
||||||
resp, err := s.client.Do(req, repository)
|
resp, err := s.client.Do(req, repository)
|
||||||
|
@ -269,10 +257,6 @@ func (s *OrganizationsService) AddTeamRepo(team int, owner string, repo string,
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if opt != nil {
|
|
||||||
req.Header.Set("Accept", mediaTypeOrgPermissionPreview)
|
|
||||||
}
|
|
||||||
|
|
||||||
return s.client.Do(req, nil)
|
return s.client.Do(req, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,7 +277,7 @@ func (s *OrganizationsService) RemoveTeamRepo(team int, owner string, repo strin
|
||||||
|
|
||||||
// ListUserTeams lists a user's teams
|
// ListUserTeams lists a user's teams
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/teams/#list-user-teams
|
// GitHub API docs: https://developer.github.com/v3/orgs/teams/#list-user-teams
|
||||||
func (s *OrganizationsService) ListUserTeams(opt *ListOptions) ([]Team, *Response, error) {
|
func (s *OrganizationsService) ListUserTeams(opt *ListOptions) ([]*Team, *Response, error) {
|
||||||
u := "user/teams"
|
u := "user/teams"
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -305,7 +289,7 @@ func (s *OrganizationsService) ListUserTeams(opt *ListOptions) ([]Team, *Respons
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
teams := new([]Team)
|
teams := new([]*Team)
|
||||||
resp, err := s.client.Do(req, teams)
|
resp, err := s.client.Do(req, teams)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -372,10 +356,6 @@ func (s *OrganizationsService) AddTeamMembership(team int, user string, opt *Org
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if opt != nil {
|
|
||||||
req.Header.Set("Accept", mediaTypeOrgPermissionPreview)
|
|
||||||
}
|
|
||||||
|
|
||||||
t := new(Membership)
|
t := new(Membership)
|
||||||
resp, err := s.client.Do(req, t)
|
resp, err := s.client.Do(req, t)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
15
vendor/github.com/google/go-github/github/orgs_teams_test.go
generated
vendored
15
vendor/github.com/google/go-github/github/orgs_teams_test.go
generated
vendored
|
@ -29,7 +29,7 @@ func TestOrganizationsService_ListTeams(t *testing.T) {
|
||||||
t.Errorf("Organizations.ListTeams returned error: %v", err)
|
t.Errorf("Organizations.ListTeams returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Team{{ID: Int(1)}}
|
want := []*Team{{ID: Int(1)}}
|
||||||
if !reflect.DeepEqual(teams, want) {
|
if !reflect.DeepEqual(teams, want) {
|
||||||
t.Errorf("Organizations.ListTeams returned %+v, want %+v", teams, want)
|
t.Errorf("Organizations.ListTeams returned %+v, want %+v", teams, want)
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,6 @@ func TestOrganizationsService_CreateTeam(t *testing.T) {
|
||||||
json.NewDecoder(r.Body).Decode(v)
|
json.NewDecoder(r.Body).Decode(v)
|
||||||
|
|
||||||
testMethod(t, r, "POST")
|
testMethod(t, r, "POST")
|
||||||
testHeader(t, r, "Accept", mediaTypeOrgPermissionPreview)
|
|
||||||
if !reflect.DeepEqual(v, input) {
|
if !reflect.DeepEqual(v, input) {
|
||||||
t.Errorf("Request body = %+v, want %+v", v, input)
|
t.Errorf("Request body = %+v, want %+v", v, input)
|
||||||
}
|
}
|
||||||
|
@ -106,7 +105,6 @@ func TestOrganizationsService_EditTeam(t *testing.T) {
|
||||||
json.NewDecoder(r.Body).Decode(v)
|
json.NewDecoder(r.Body).Decode(v)
|
||||||
|
|
||||||
testMethod(t, r, "PATCH")
|
testMethod(t, r, "PATCH")
|
||||||
testHeader(t, r, "Accept", mediaTypeOrgPermissionPreview)
|
|
||||||
if !reflect.DeepEqual(v, input) {
|
if !reflect.DeepEqual(v, input) {
|
||||||
t.Errorf("Request body = %+v, want %+v", v, input)
|
t.Errorf("Request body = %+v, want %+v", v, input)
|
||||||
}
|
}
|
||||||
|
@ -145,7 +143,6 @@ func TestOrganizationsService_ListTeamMembers(t *testing.T) {
|
||||||
|
|
||||||
mux.HandleFunc("/teams/1/members", func(w http.ResponseWriter, r *http.Request) {
|
mux.HandleFunc("/teams/1/members", func(w http.ResponseWriter, r *http.Request) {
|
||||||
testMethod(t, r, "GET")
|
testMethod(t, r, "GET")
|
||||||
testHeader(t, r, "Accept", mediaTypeOrgPermissionPreview)
|
|
||||||
testFormValues(t, r, values{"role": "member", "page": "2"})
|
testFormValues(t, r, values{"role": "member", "page": "2"})
|
||||||
fmt.Fprint(w, `[{"id":1}]`)
|
fmt.Fprint(w, `[{"id":1}]`)
|
||||||
})
|
})
|
||||||
|
@ -156,7 +153,7 @@ func TestOrganizationsService_ListTeamMembers(t *testing.T) {
|
||||||
t.Errorf("Organizations.ListTeamMembers returned error: %v", err)
|
t.Errorf("Organizations.ListTeamMembers returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []User{{ID: Int(1)}}
|
want := []*User{{ID: Int(1)}}
|
||||||
if !reflect.DeepEqual(members, want) {
|
if !reflect.DeepEqual(members, want) {
|
||||||
t.Errorf("Organizations.ListTeamMembers returned %+v, want %+v", members, want)
|
t.Errorf("Organizations.ListTeamMembers returned %+v, want %+v", members, want)
|
||||||
}
|
}
|
||||||
|
@ -279,7 +276,7 @@ func TestOrganizationsService_ListTeamRepos(t *testing.T) {
|
||||||
t.Errorf("Organizations.ListTeamRepos returned error: %v", err)
|
t.Errorf("Organizations.ListTeamRepos returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Repository{{ID: Int(1)}}
|
want := []*Repository{{ID: Int(1)}}
|
||||||
if !reflect.DeepEqual(members, want) {
|
if !reflect.DeepEqual(members, want) {
|
||||||
t.Errorf("Organizations.ListTeamRepos returned %+v, want %+v", members, want)
|
t.Errorf("Organizations.ListTeamRepos returned %+v, want %+v", members, want)
|
||||||
}
|
}
|
||||||
|
@ -291,7 +288,7 @@ func TestOrganizationsService_IsTeamRepo_true(t *testing.T) {
|
||||||
|
|
||||||
mux.HandleFunc("/teams/1/repos/o/r", func(w http.ResponseWriter, r *http.Request) {
|
mux.HandleFunc("/teams/1/repos/o/r", func(w http.ResponseWriter, r *http.Request) {
|
||||||
testMethod(t, r, "GET")
|
testMethod(t, r, "GET")
|
||||||
testHeader(t, r, "Accept", mediaTypeOrgPermissionRepoPreview)
|
testHeader(t, r, "Accept", mediaTypeOrgPermissionRepo)
|
||||||
fmt.Fprint(w, `{"id":1}`)
|
fmt.Fprint(w, `{"id":1}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -364,7 +361,6 @@ func TestOrganizationsService_AddTeamRepo(t *testing.T) {
|
||||||
json.NewDecoder(r.Body).Decode(v)
|
json.NewDecoder(r.Body).Decode(v)
|
||||||
|
|
||||||
testMethod(t, r, "PUT")
|
testMethod(t, r, "PUT")
|
||||||
testHeader(t, r, "Accept", mediaTypeOrgPermissionPreview)
|
|
||||||
if !reflect.DeepEqual(v, opt) {
|
if !reflect.DeepEqual(v, opt) {
|
||||||
t.Errorf("Request body = %+v, want %+v", v, opt)
|
t.Errorf("Request body = %+v, want %+v", v, opt)
|
||||||
}
|
}
|
||||||
|
@ -449,7 +445,6 @@ func TestOrganizationsService_AddTeamMembership(t *testing.T) {
|
||||||
json.NewDecoder(r.Body).Decode(v)
|
json.NewDecoder(r.Body).Decode(v)
|
||||||
|
|
||||||
testMethod(t, r, "PUT")
|
testMethod(t, r, "PUT")
|
||||||
testHeader(t, r, "Accept", mediaTypeOrgPermissionPreview)
|
|
||||||
if !reflect.DeepEqual(v, opt) {
|
if !reflect.DeepEqual(v, opt) {
|
||||||
t.Errorf("Request body = %+v, want %+v", v, opt)
|
t.Errorf("Request body = %+v, want %+v", v, opt)
|
||||||
}
|
}
|
||||||
|
@ -499,7 +494,7 @@ func TestOrganizationsService_ListUserTeams(t *testing.T) {
|
||||||
t.Errorf("Organizations.ListUserTeams returned error: %v", err)
|
t.Errorf("Organizations.ListUserTeams returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Team{{ID: Int(1)}}
|
want := []*Team{{ID: Int(1)}}
|
||||||
if !reflect.DeepEqual(teams, want) {
|
if !reflect.DeepEqual(teams, want) {
|
||||||
t.Errorf("Organizations.ListUserTeams returned %+v, want %+v", teams, want)
|
t.Errorf("Organizations.ListUserTeams returned %+v, want %+v", teams, want)
|
||||||
}
|
}
|
||||||
|
|
6
vendor/github.com/google/go-github/github/orgs_test.go
generated
vendored
6
vendor/github.com/google/go-github/github/orgs_test.go
generated
vendored
|
@ -30,7 +30,7 @@ func TestOrganizationsService_ListAll(t *testing.T) {
|
||||||
t.Errorf("Organizations.ListAll returned error: %v", err)
|
t.Errorf("Organizations.ListAll returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Organization{{ID: Int(4314092)}}
|
want := []*Organization{{ID: Int(4314092)}}
|
||||||
if !reflect.DeepEqual(orgs, want) {
|
if !reflect.DeepEqual(orgs, want) {
|
||||||
t.Errorf("Organizations.ListAll returned %+v, want %+v", orgs, want)
|
t.Errorf("Organizations.ListAll returned %+v, want %+v", orgs, want)
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ func TestOrganizationsService_List_authenticatedUser(t *testing.T) {
|
||||||
t.Errorf("Organizations.List returned error: %v", err)
|
t.Errorf("Organizations.List returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Organization{{ID: Int(1)}, {ID: Int(2)}}
|
want := []*Organization{{ID: Int(1)}, {ID: Int(2)}}
|
||||||
if !reflect.DeepEqual(orgs, want) {
|
if !reflect.DeepEqual(orgs, want) {
|
||||||
t.Errorf("Organizations.List returned %+v, want %+v", orgs, want)
|
t.Errorf("Organizations.List returned %+v, want %+v", orgs, want)
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ func TestOrganizationsService_List_specifiedUser(t *testing.T) {
|
||||||
t.Errorf("Organizations.List returned error: %v", err)
|
t.Errorf("Organizations.List returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Organization{{ID: Int(1)}, {ID: Int(2)}}
|
want := []*Organization{{ID: Int(1)}, {ID: Int(2)}}
|
||||||
if !reflect.DeepEqual(orgs, want) {
|
if !reflect.DeepEqual(orgs, want) {
|
||||||
t.Errorf("Organizations.List returned %+v, want %+v", orgs, want)
|
t.Errorf("Organizations.List returned %+v, want %+v", orgs, want)
|
||||||
}
|
}
|
||||||
|
|
30
vendor/github.com/google/go-github/github/pulls.go
generated
vendored
30
vendor/github.com/google/go-github/github/pulls.go
generated
vendored
|
@ -91,7 +91,7 @@ type PullRequestListOptions struct {
|
||||||
// List the pull requests for the specified repository.
|
// List the pull requests for the specified repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/pulls/#list-pull-requests
|
// GitHub API docs: http://developer.github.com/v3/pulls/#list-pull-requests
|
||||||
func (s *PullRequestsService) List(owner string, repo string, opt *PullRequestListOptions) ([]PullRequest, *Response, error) {
|
func (s *PullRequestsService) List(owner string, repo string, opt *PullRequestListOptions) ([]*PullRequest, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -103,7 +103,7 @@ func (s *PullRequestsService) List(owner string, repo string, opt *PullRequestLi
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
pulls := new([]PullRequest)
|
pulls := new([]*PullRequest)
|
||||||
resp, err := s.client.Do(req, pulls)
|
resp, err := s.client.Do(req, pulls)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -181,7 +181,7 @@ func (s *PullRequestsService) Edit(owner string, repo string, number int, pull *
|
||||||
// ListCommits lists the commits in a pull request.
|
// ListCommits lists the commits in a pull request.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/#list-commits-on-a-pull-request
|
// GitHub API docs: https://developer.github.com/v3/pulls/#list-commits-on-a-pull-request
|
||||||
func (s *PullRequestsService) ListCommits(owner string, repo string, number int, opt *ListOptions) ([]RepositoryCommit, *Response, error) {
|
func (s *PullRequestsService) ListCommits(owner string, repo string, number int, opt *ListOptions) ([]*RepositoryCommit, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d/commits", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/pulls/%d/commits", owner, repo, number)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -193,7 +193,7 @@ func (s *PullRequestsService) ListCommits(owner string, repo string, number int,
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
commits := new([]RepositoryCommit)
|
commits := new([]*RepositoryCommit)
|
||||||
resp, err := s.client.Do(req, commits)
|
resp, err := s.client.Do(req, commits)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -205,7 +205,7 @@ func (s *PullRequestsService) ListCommits(owner string, repo string, number int,
|
||||||
// ListFiles lists the files in a pull request.
|
// ListFiles lists the files in a pull request.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/#list-pull-requests-files
|
// GitHub API docs: https://developer.github.com/v3/pulls/#list-pull-requests-files
|
||||||
func (s *PullRequestsService) ListFiles(owner string, repo string, number int, opt *ListOptions) ([]CommitFile, *Response, error) {
|
func (s *PullRequestsService) ListFiles(owner string, repo string, number int, opt *ListOptions) ([]*CommitFile, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d/files", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/pulls/%d/files", owner, repo, number)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -217,7 +217,7 @@ func (s *PullRequestsService) ListFiles(owner string, repo string, number int, o
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
commitFiles := new([]CommitFile)
|
commitFiles := new([]*CommitFile)
|
||||||
resp, err := s.client.Do(req, commitFiles)
|
resp, err := s.client.Do(req, commitFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -248,20 +248,30 @@ type PullRequestMergeResult struct {
|
||||||
Message *string `json:"message,omitempty"`
|
Message *string `json:"message,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PullRequestOptions lets you define how a pull request will be merged.
|
||||||
|
type PullRequestOptions struct {
|
||||||
|
Squash bool
|
||||||
|
}
|
||||||
|
|
||||||
type pullRequestMergeRequest struct {
|
type pullRequestMergeRequest struct {
|
||||||
CommitMessage *string `json:"commit_message"`
|
CommitMessage *string `json:"commit_message"`
|
||||||
|
Squash *bool `json:"squash,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Merge a pull request (Merge Button™).
|
// Merge a pull request (Merge Button™).
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-buttontrade
|
// GitHub API docs: https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-buttontrade
|
||||||
func (s *PullRequestsService) Merge(owner string, repo string, number int, commitMessage string) (*PullRequestMergeResult, *Response, error) {
|
func (s *PullRequestsService) Merge(owner string, repo string, number int, commitMessage string, options *PullRequestOptions) (*PullRequestMergeResult, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d/merge", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/pulls/%d/merge", owner, repo, number)
|
||||||
|
|
||||||
req, err := s.client.NewRequest("PUT", u, &pullRequestMergeRequest{
|
pullRequestBody := &pullRequestMergeRequest{CommitMessage: &commitMessage}
|
||||||
CommitMessage: &commitMessage,
|
if options != nil {
|
||||||
})
|
pullRequestBody.Squash = &options.Squash
|
||||||
|
}
|
||||||
|
req, err := s.client.NewRequest("PUT", u, pullRequestBody)
|
||||||
|
|
||||||
|
// TODO: This header will be unnecessary when the API is no longer in preview.
|
||||||
|
req.Header.Set("Accept", mediaTypeSquashPreview)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
4
vendor/github.com/google/go-github/github/pulls_comments.go
generated
vendored
4
vendor/github.com/google/go-github/github/pulls_comments.go
generated
vendored
|
@ -54,7 +54,7 @@ type PullRequestListCommentsOptions struct {
|
||||||
// the repository.
|
// the repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request
|
// GitHub API docs: https://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request
|
||||||
func (s *PullRequestsService) ListComments(owner string, repo string, number int, opt *PullRequestListCommentsOptions) ([]PullRequestComment, *Response, error) {
|
func (s *PullRequestsService) ListComments(owner string, repo string, number int, opt *PullRequestListCommentsOptions) ([]*PullRequestComment, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if number == 0 {
|
if number == 0 {
|
||||||
u = fmt.Sprintf("repos/%v/%v/pulls/comments", owner, repo)
|
u = fmt.Sprintf("repos/%v/%v/pulls/comments", owner, repo)
|
||||||
|
@ -74,7 +74,7 @@ func (s *PullRequestsService) ListComments(owner string, repo string, number int
|
||||||
// TODO: remove custom Accept header when this API fully launches.
|
// TODO: remove custom Accept header when this API fully launches.
|
||||||
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
||||||
|
|
||||||
comments := new([]PullRequestComment)
|
comments := new([]*PullRequestComment)
|
||||||
resp, err := s.client.Do(req, comments)
|
resp, err := s.client.Do(req, comments)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
9
vendor/github.com/google/go-github/github/pulls_comments_test.go
generated
vendored
9
vendor/github.com/google/go-github/github/pulls_comments_test.go
generated
vendored
|
@ -37,12 +37,11 @@ func TestPullRequestsService_ListComments_allPulls(t *testing.T) {
|
||||||
ListOptions: ListOptions{Page: 2},
|
ListOptions: ListOptions{Page: 2},
|
||||||
}
|
}
|
||||||
pulls, _, err := client.PullRequests.ListComments("o", "r", 0, opt)
|
pulls, _, err := client.PullRequests.ListComments("o", "r", 0, opt)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("PullRequests.ListComments returned error: %v", err)
|
t.Errorf("PullRequests.ListComments returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []PullRequestComment{{ID: Int(1)}}
|
want := []*PullRequestComment{{ID: Int(1)}}
|
||||||
if !reflect.DeepEqual(pulls, want) {
|
if !reflect.DeepEqual(pulls, want) {
|
||||||
t.Errorf("PullRequests.ListComments returned %+v, want %+v", pulls, want)
|
t.Errorf("PullRequests.ListComments returned %+v, want %+v", pulls, want)
|
||||||
}
|
}
|
||||||
|
@ -59,12 +58,11 @@ func TestPullRequestsService_ListComments_specificPull(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
pulls, _, err := client.PullRequests.ListComments("o", "r", 1, nil)
|
pulls, _, err := client.PullRequests.ListComments("o", "r", 1, nil)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("PullRequests.ListComments returned error: %v", err)
|
t.Errorf("PullRequests.ListComments returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []PullRequestComment{{ID: Int(1)}}
|
want := []*PullRequestComment{{ID: Int(1)}}
|
||||||
if !reflect.DeepEqual(pulls, want) {
|
if !reflect.DeepEqual(pulls, want) {
|
||||||
t.Errorf("PullRequests.ListComments returned %+v, want %+v", pulls, want)
|
t.Errorf("PullRequests.ListComments returned %+v, want %+v", pulls, want)
|
||||||
}
|
}
|
||||||
|
@ -86,7 +84,6 @@ func TestPullRequestsService_GetComment(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
comment, _, err := client.PullRequests.GetComment("o", "r", 1)
|
comment, _, err := client.PullRequests.GetComment("o", "r", 1)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("PullRequests.GetComment returned error: %v", err)
|
t.Errorf("PullRequests.GetComment returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -121,7 +118,6 @@ func TestPullRequestsService_CreateComment(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
comment, _, err := client.PullRequests.CreateComment("o", "r", 1, input)
|
comment, _, err := client.PullRequests.CreateComment("o", "r", 1, input)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("PullRequests.CreateComment returned error: %v", err)
|
t.Errorf("PullRequests.CreateComment returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -156,7 +152,6 @@ func TestPullRequestsService_EditComment(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
comment, _, err := client.PullRequests.EditComment("o", "r", 1, input)
|
comment, _, err := client.PullRequests.EditComment("o", "r", 1, input)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("PullRequests.EditComment returned error: %v", err)
|
t.Errorf("PullRequests.EditComment returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
14
vendor/github.com/google/go-github/github/pulls_test.go
generated
vendored
14
vendor/github.com/google/go-github/github/pulls_test.go
generated
vendored
|
@ -32,12 +32,11 @@ func TestPullRequestsService_List(t *testing.T) {
|
||||||
|
|
||||||
opt := &PullRequestListOptions{"closed", "h", "b", "created", "desc", ListOptions{Page: 2}}
|
opt := &PullRequestListOptions{"closed", "h", "b", "created", "desc", ListOptions{Page: 2}}
|
||||||
pulls, _, err := client.PullRequests.List("o", "r", opt)
|
pulls, _, err := client.PullRequests.List("o", "r", opt)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("PullRequests.List returned error: %v", err)
|
t.Errorf("PullRequests.List returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []PullRequest{{Number: Int(1)}}
|
want := []*PullRequest{{Number: Int(1)}}
|
||||||
if !reflect.DeepEqual(pulls, want) {
|
if !reflect.DeepEqual(pulls, want) {
|
||||||
t.Errorf("PullRequests.List returned %+v, want %+v", pulls, want)
|
t.Errorf("PullRequests.List returned %+v, want %+v", pulls, want)
|
||||||
}
|
}
|
||||||
|
@ -58,7 +57,6 @@ func TestPullRequestsService_Get(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
pull, _, err := client.PullRequests.Get("o", "r", 1)
|
pull, _, err := client.PullRequests.Get("o", "r", 1)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("PullRequests.Get returned error: %v", err)
|
t.Errorf("PullRequests.Get returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -79,7 +77,6 @@ func TestPullRequestsService_Get_headAndBase(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
pull, _, err := client.PullRequests.Get("o", "r", 1)
|
pull, _, err := client.PullRequests.Get("o", "r", 1)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("PullRequests.Get returned error: %v", err)
|
t.Errorf("PullRequests.Get returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -112,7 +109,6 @@ func TestPullRequestService_Get_DiffURLAndPatchURL(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
pull, _, err := client.PullRequests.Get("o", "r", 1)
|
pull, _, err := client.PullRequests.Get("o", "r", 1)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("PullRequests.Get returned error: %v", err)
|
t.Errorf("PullRequests.Get returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -230,7 +226,7 @@ func TestPullRequestsService_ListCommits(t *testing.T) {
|
||||||
t.Errorf("PullRequests.ListCommits returned error: %v", err)
|
t.Errorf("PullRequests.ListCommits returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []RepositoryCommit{
|
want := []*RepositoryCommit{
|
||||||
{
|
{
|
||||||
SHA: String("3"),
|
SHA: String("3"),
|
||||||
Parents: []Commit{
|
Parents: []Commit{
|
||||||
|
@ -289,7 +285,7 @@ func TestPullRequestsService_ListFiles(t *testing.T) {
|
||||||
t.Errorf("PullRequests.ListFiles returned error: %v", err)
|
t.Errorf("PullRequests.ListFiles returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []CommitFile{
|
want := []*CommitFile{
|
||||||
{
|
{
|
||||||
SHA: String("6dcb09b5b57875f334f61aebed695e2e4193db5e"),
|
SHA: String("6dcb09b5b57875f334f61aebed695e2e4193db5e"),
|
||||||
Filename: String("file1.txt"),
|
Filename: String("file1.txt"),
|
||||||
|
@ -341,6 +337,7 @@ func TestPullRequestsService_Merge(t *testing.T) {
|
||||||
|
|
||||||
mux.HandleFunc("/repos/o/r/pulls/1/merge", func(w http.ResponseWriter, r *http.Request) {
|
mux.HandleFunc("/repos/o/r/pulls/1/merge", func(w http.ResponseWriter, r *http.Request) {
|
||||||
testMethod(t, r, "PUT")
|
testMethod(t, r, "PUT")
|
||||||
|
testHeader(t, r, "Accept", mediaTypeSquashPreview)
|
||||||
fmt.Fprint(w, `
|
fmt.Fprint(w, `
|
||||||
{
|
{
|
||||||
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||||
|
@ -349,7 +346,8 @@ func TestPullRequestsService_Merge(t *testing.T) {
|
||||||
}`)
|
}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
merge, _, err := client.PullRequests.Merge("o", "r", 1, "merging pull request")
|
options := &PullRequestOptions{Squash: true}
|
||||||
|
merge, _, err := client.PullRequests.Merge("o", "r", 1, "merging pull request", options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("PullRequests.Merge returned error: %v", err)
|
t.Errorf("PullRequests.Merge returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
6
vendor/github.com/google/go-github/github/reactions.go
generated
vendored
6
vendor/github.com/google/go-github/github/reactions.go
generated
vendored
|
@ -18,8 +18,8 @@ type ReactionsService struct {
|
||||||
// Reaction represents a GitHub reaction.
|
// Reaction represents a GitHub reaction.
|
||||||
type Reaction struct {
|
type Reaction struct {
|
||||||
// ID is the Reaction ID.
|
// ID is the Reaction ID.
|
||||||
ID *int `json:"id,omitempty"`
|
ID *int `json:"id,omitempty"`
|
||||||
UserID *int `json:"user_id,omitempty"`
|
User *User `json:"user,omitempty"`
|
||||||
// Content is the type of reaction.
|
// Content is the type of reaction.
|
||||||
// Possible values are:
|
// Possible values are:
|
||||||
// "+1", "-1", "laugh", "confused", "heart", "hooray".
|
// "+1", "-1", "laugh", "confused", "heart", "hooray".
|
||||||
|
@ -258,7 +258,7 @@ func (s ReactionsService) CreatePullRequestCommentReaction(owner, repo string, i
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reaction/reactions/#delete-a-reaction-archive
|
// GitHub API docs: https://developer.github.com/v3/reaction/reactions/#delete-a-reaction-archive
|
||||||
func (s *ReactionsService) DeleteReaction(id int) (*Response, error) {
|
func (s *ReactionsService) DeleteReaction(id int) (*Response, error) {
|
||||||
u := fmt.Sprintf("/reactions/%v", id)
|
u := fmt.Sprintf("reactions/%v", id)
|
||||||
|
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
32
vendor/github.com/google/go-github/github/reactions_test.go
generated
vendored
32
vendor/github.com/google/go-github/github/reactions_test.go
generated
vendored
|
@ -20,14 +20,14 @@ func TestReactionsService_ListCommentReactions(t *testing.T) {
|
||||||
testHeader(t, r, "Accept", mediaTypeReactionsPreview)
|
testHeader(t, r, "Accept", mediaTypeReactionsPreview)
|
||||||
|
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
w.Write([]byte(`[{"id":1,"user_id":2,"content":"+1"}]`))
|
w.Write([]byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`))
|
||||||
})
|
})
|
||||||
|
|
||||||
got, _, err := client.Reactions.ListCommentReactions("o", "r", 1, nil)
|
got, _, err := client.Reactions.ListCommentReactions("o", "r", 1, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("ListCommentReactions returned error: %v", err)
|
t.Errorf("ListCommentReactions returned error: %v", err)
|
||||||
}
|
}
|
||||||
if want := []*Reaction{{ID: Int(1), UserID: Int(2), Content: String("+1")}}; !reflect.DeepEqual(got, want) {
|
if want := []*Reaction{{ID: Int(1), User: &User{Login: String("l"), ID: Int(2)}, Content: String("+1")}}; !reflect.DeepEqual(got, want) {
|
||||||
t.Errorf("ListCommentReactions = %+v, want %+v", got, want)
|
t.Errorf("ListCommentReactions = %+v, want %+v", got, want)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,14 +41,14 @@ func TestReactionsService_CreateCommentReaction(t *testing.T) {
|
||||||
testHeader(t, r, "Accept", mediaTypeReactionsPreview)
|
testHeader(t, r, "Accept", mediaTypeReactionsPreview)
|
||||||
|
|
||||||
w.WriteHeader(http.StatusCreated)
|
w.WriteHeader(http.StatusCreated)
|
||||||
w.Write([]byte(`{"id":1,"user_id":2,"content":"+1"}`))
|
w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`))
|
||||||
})
|
})
|
||||||
|
|
||||||
got, _, err := client.Reactions.CreateCommentReaction("o", "r", 1, "+1")
|
got, _, err := client.Reactions.CreateCommentReaction("o", "r", 1, "+1")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("CreateCommentReaction returned error: %v", err)
|
t.Errorf("CreateCommentReaction returned error: %v", err)
|
||||||
}
|
}
|
||||||
want := &Reaction{ID: Int(1), UserID: Int(2), Content: String("+1")}
|
want := &Reaction{ID: Int(1), User: &User{Login: String("l"), ID: Int(2)}, Content: String("+1")}
|
||||||
if !reflect.DeepEqual(got, want) {
|
if !reflect.DeepEqual(got, want) {
|
||||||
t.Errorf("CreateCommentReaction = %+v, want %+v", got, want)
|
t.Errorf("CreateCommentReaction = %+v, want %+v", got, want)
|
||||||
}
|
}
|
||||||
|
@ -63,14 +63,14 @@ func TestReactionsService_ListIssueReactions(t *testing.T) {
|
||||||
testHeader(t, r, "Accept", mediaTypeReactionsPreview)
|
testHeader(t, r, "Accept", mediaTypeReactionsPreview)
|
||||||
|
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
w.Write([]byte(`[{"id":1,"user_id":2,"content":"+1"}]`))
|
w.Write([]byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`))
|
||||||
})
|
})
|
||||||
|
|
||||||
got, _, err := client.Reactions.ListIssueReactions("o", "r", 1, nil)
|
got, _, err := client.Reactions.ListIssueReactions("o", "r", 1, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("ListIssueReactions returned error: %v", err)
|
t.Errorf("ListIssueReactions returned error: %v", err)
|
||||||
}
|
}
|
||||||
if want := []*Reaction{{ID: Int(1), UserID: Int(2), Content: String("+1")}}; !reflect.DeepEqual(got, want) {
|
if want := []*Reaction{{ID: Int(1), User: &User{Login: String("l"), ID: Int(2)}, Content: String("+1")}}; !reflect.DeepEqual(got, want) {
|
||||||
t.Errorf("ListIssueReactions = %+v, want %+v", got, want)
|
t.Errorf("ListIssueReactions = %+v, want %+v", got, want)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,14 +84,14 @@ func TestReactionsService_CreateIssueReaction(t *testing.T) {
|
||||||
testHeader(t, r, "Accept", mediaTypeReactionsPreview)
|
testHeader(t, r, "Accept", mediaTypeReactionsPreview)
|
||||||
|
|
||||||
w.WriteHeader(http.StatusCreated)
|
w.WriteHeader(http.StatusCreated)
|
||||||
w.Write([]byte(`{"id":1,"user_id":2,"content":"+1"}`))
|
w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`))
|
||||||
})
|
})
|
||||||
|
|
||||||
got, _, err := client.Reactions.CreateIssueReaction("o", "r", 1, "+1")
|
got, _, err := client.Reactions.CreateIssueReaction("o", "r", 1, "+1")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("CreateIssueReaction returned error: %v", err)
|
t.Errorf("CreateIssueReaction returned error: %v", err)
|
||||||
}
|
}
|
||||||
want := &Reaction{ID: Int(1), UserID: Int(2), Content: String("+1")}
|
want := &Reaction{ID: Int(1), User: &User{Login: String("l"), ID: Int(2)}, Content: String("+1")}
|
||||||
if !reflect.DeepEqual(got, want) {
|
if !reflect.DeepEqual(got, want) {
|
||||||
t.Errorf("CreateIssueReaction = %+v, want %+v", got, want)
|
t.Errorf("CreateIssueReaction = %+v, want %+v", got, want)
|
||||||
}
|
}
|
||||||
|
@ -106,14 +106,14 @@ func TestReactionsService_ListIssueCommentReactions(t *testing.T) {
|
||||||
testHeader(t, r, "Accept", mediaTypeReactionsPreview)
|
testHeader(t, r, "Accept", mediaTypeReactionsPreview)
|
||||||
|
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
w.Write([]byte(`[{"id":1,"user_id":2,"content":"+1"}]`))
|
w.Write([]byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`))
|
||||||
})
|
})
|
||||||
|
|
||||||
got, _, err := client.Reactions.ListIssueCommentReactions("o", "r", 1, nil)
|
got, _, err := client.Reactions.ListIssueCommentReactions("o", "r", 1, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("ListIssueCommentReactions returned error: %v", err)
|
t.Errorf("ListIssueCommentReactions returned error: %v", err)
|
||||||
}
|
}
|
||||||
if want := []*Reaction{{ID: Int(1), UserID: Int(2), Content: String("+1")}}; !reflect.DeepEqual(got, want) {
|
if want := []*Reaction{{ID: Int(1), User: &User{Login: String("l"), ID: Int(2)}, Content: String("+1")}}; !reflect.DeepEqual(got, want) {
|
||||||
t.Errorf("ListIssueCommentReactions = %+v, want %+v", got, want)
|
t.Errorf("ListIssueCommentReactions = %+v, want %+v", got, want)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,14 +127,14 @@ func TestReactionsService_CreateIssueCommentReaction(t *testing.T) {
|
||||||
testHeader(t, r, "Accept", mediaTypeReactionsPreview)
|
testHeader(t, r, "Accept", mediaTypeReactionsPreview)
|
||||||
|
|
||||||
w.WriteHeader(http.StatusCreated)
|
w.WriteHeader(http.StatusCreated)
|
||||||
w.Write([]byte(`{"id":1,"user_id":2,"content":"+1"}`))
|
w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`))
|
||||||
})
|
})
|
||||||
|
|
||||||
got, _, err := client.Reactions.CreateIssueCommentReaction("o", "r", 1, "+1")
|
got, _, err := client.Reactions.CreateIssueCommentReaction("o", "r", 1, "+1")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("CreateIssueCommentReaction returned error: %v", err)
|
t.Errorf("CreateIssueCommentReaction returned error: %v", err)
|
||||||
}
|
}
|
||||||
want := &Reaction{ID: Int(1), UserID: Int(2), Content: String("+1")}
|
want := &Reaction{ID: Int(1), User: &User{Login: String("l"), ID: Int(2)}, Content: String("+1")}
|
||||||
if !reflect.DeepEqual(got, want) {
|
if !reflect.DeepEqual(got, want) {
|
||||||
t.Errorf("CreateIssueCommentReaction = %+v, want %+v", got, want)
|
t.Errorf("CreateIssueCommentReaction = %+v, want %+v", got, want)
|
||||||
}
|
}
|
||||||
|
@ -149,14 +149,14 @@ func TestReactionsService_ListPullRequestCommentReactions(t *testing.T) {
|
||||||
testHeader(t, r, "Accept", mediaTypeReactionsPreview)
|
testHeader(t, r, "Accept", mediaTypeReactionsPreview)
|
||||||
|
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
w.Write([]byte(`[{"id":1,"user_id":2,"content":"+1"}]`))
|
w.Write([]byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`))
|
||||||
})
|
})
|
||||||
|
|
||||||
got, _, err := client.Reactions.ListPullRequestCommentReactions("o", "r", 1, nil)
|
got, _, err := client.Reactions.ListPullRequestCommentReactions("o", "r", 1, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("ListPullRequestCommentReactions returned error: %v", err)
|
t.Errorf("ListPullRequestCommentReactions returned error: %v", err)
|
||||||
}
|
}
|
||||||
if want := []*Reaction{{ID: Int(1), UserID: Int(2), Content: String("+1")}}; !reflect.DeepEqual(got, want) {
|
if want := []*Reaction{{ID: Int(1), User: &User{Login: String("l"), ID: Int(2)}, Content: String("+1")}}; !reflect.DeepEqual(got, want) {
|
||||||
t.Errorf("ListPullRequestCommentReactions = %+v, want %+v", got, want)
|
t.Errorf("ListPullRequestCommentReactions = %+v, want %+v", got, want)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,14 +170,14 @@ func TestReactionsService_CreatePullRequestCommentReaction(t *testing.T) {
|
||||||
testHeader(t, r, "Accept", mediaTypeReactionsPreview)
|
testHeader(t, r, "Accept", mediaTypeReactionsPreview)
|
||||||
|
|
||||||
w.WriteHeader(http.StatusCreated)
|
w.WriteHeader(http.StatusCreated)
|
||||||
w.Write([]byte(`{"id":1,"user_id":2,"content":"+1"}`))
|
w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`))
|
||||||
})
|
})
|
||||||
|
|
||||||
got, _, err := client.Reactions.CreatePullRequestCommentReaction("o", "r", 1, "+1")
|
got, _, err := client.Reactions.CreatePullRequestCommentReaction("o", "r", 1, "+1")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("CreatePullRequestCommentReaction returned error: %v", err)
|
t.Errorf("CreatePullRequestCommentReaction returned error: %v", err)
|
||||||
}
|
}
|
||||||
want := &Reaction{ID: Int(1), UserID: Int(2), Content: String("+1")}
|
want := &Reaction{ID: Int(1), User: &User{Login: String("l"), ID: Int(2)}, Content: String("+1")}
|
||||||
if !reflect.DeepEqual(got, want) {
|
if !reflect.DeepEqual(got, want) {
|
||||||
t.Errorf("CreatePullRequestCommentReaction = %+v, want %+v", got, want)
|
t.Errorf("CreatePullRequestCommentReaction = %+v, want %+v", got, want)
|
||||||
}
|
}
|
||||||
|
|
57
vendor/github.com/google/go-github/github/repos.go
generated
vendored
57
vendor/github.com/google/go-github/github/repos.go
generated
vendored
|
@ -110,16 +110,33 @@ func (r Repository) String() string {
|
||||||
// RepositoryListOptions specifies the optional parameters to the
|
// RepositoryListOptions specifies the optional parameters to the
|
||||||
// RepositoriesService.List method.
|
// RepositoriesService.List method.
|
||||||
type RepositoryListOptions struct {
|
type RepositoryListOptions struct {
|
||||||
// Type of repositories to list. Possible values are: all, owner, public,
|
// Visibility of repositories to list. Can be one of all, public, or private.
|
||||||
// private, member. Default is "all".
|
// Default: all
|
||||||
|
Visibility string `url:"visibility,omitempty"`
|
||||||
|
|
||||||
|
// List repos of given affiliation[s].
|
||||||
|
// Comma-separated list of values. Can include:
|
||||||
|
// * owner: Repositories that are owned by the authenticated user.
|
||||||
|
// * collaborator: Repositories that the user has been added to as a
|
||||||
|
// collaborator.
|
||||||
|
// * organization_member: Repositories that the user has access to through
|
||||||
|
// being a member of an organization. This includes every repository on
|
||||||
|
// every team that the user is on.
|
||||||
|
// Default: owner,collaborator,organization_member
|
||||||
|
Affiliation string `url:"affiliation,omitempty"`
|
||||||
|
|
||||||
|
// Type of repositories to list.
|
||||||
|
// Can be one of all, owner, public, private, member. Default: all
|
||||||
|
// Will cause a 422 error if used in the same request as visibility or
|
||||||
|
// affiliation.
|
||||||
Type string `url:"type,omitempty"`
|
Type string `url:"type,omitempty"`
|
||||||
|
|
||||||
// How to sort the repository list. Possible values are: created, updated,
|
// How to sort the repository list. Can be one of created, updated, pushed,
|
||||||
// pushed, full_name. Default is "full_name".
|
// full_name. Default: full_name
|
||||||
Sort string `url:"sort,omitempty"`
|
Sort string `url:"sort,omitempty"`
|
||||||
|
|
||||||
// Direction in which to sort repositories. Possible values are: asc, desc.
|
// Direction in which to sort repositories. Can be one of asc or desc.
|
||||||
// Default is "asc" when sort is "full_name", otherwise default is "desc".
|
// Default: when using full_name: asc; otherwise desc
|
||||||
Direction string `url:"direction,omitempty"`
|
Direction string `url:"direction,omitempty"`
|
||||||
|
|
||||||
ListOptions
|
ListOptions
|
||||||
|
@ -129,7 +146,7 @@ type RepositoryListOptions struct {
|
||||||
// repositories for the authenticated user.
|
// repositories for the authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/repos/#list-user-repositories
|
// GitHub API docs: http://developer.github.com/v3/repos/#list-user-repositories
|
||||||
func (s *RepositoriesService) List(user string, opt *RepositoryListOptions) ([]Repository, *Response, error) {
|
func (s *RepositoriesService) List(user string, opt *RepositoryListOptions) ([]*Repository, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if user != "" {
|
if user != "" {
|
||||||
u = fmt.Sprintf("users/%v/repos", user)
|
u = fmt.Sprintf("users/%v/repos", user)
|
||||||
|
@ -149,7 +166,7 @@ func (s *RepositoriesService) List(user string, opt *RepositoryListOptions) ([]R
|
||||||
// TODO: remove custom Accept header when license support fully launches
|
// TODO: remove custom Accept header when license support fully launches
|
||||||
req.Header.Set("Accept", mediaTypeLicensesPreview)
|
req.Header.Set("Accept", mediaTypeLicensesPreview)
|
||||||
|
|
||||||
repos := new([]Repository)
|
repos := new([]*Repository)
|
||||||
resp, err := s.client.Do(req, repos)
|
resp, err := s.client.Do(req, repos)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -171,7 +188,7 @@ type RepositoryListByOrgOptions struct {
|
||||||
// ListByOrg lists the repositories for an organization.
|
// ListByOrg lists the repositories for an organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/repos/#list-organization-repositories
|
// GitHub API docs: http://developer.github.com/v3/repos/#list-organization-repositories
|
||||||
func (s *RepositoriesService) ListByOrg(org string, opt *RepositoryListByOrgOptions) ([]Repository, *Response, error) {
|
func (s *RepositoriesService) ListByOrg(org string, opt *RepositoryListByOrgOptions) ([]*Repository, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/repos", org)
|
u := fmt.Sprintf("orgs/%v/repos", org)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -186,7 +203,7 @@ func (s *RepositoriesService) ListByOrg(org string, opt *RepositoryListByOrgOpti
|
||||||
// TODO: remove custom Accept header when license support fully launches
|
// TODO: remove custom Accept header when license support fully launches
|
||||||
req.Header.Set("Accept", mediaTypeLicensesPreview)
|
req.Header.Set("Accept", mediaTypeLicensesPreview)
|
||||||
|
|
||||||
repos := new([]Repository)
|
repos := new([]*Repository)
|
||||||
resp, err := s.client.Do(req, repos)
|
resp, err := s.client.Do(req, repos)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -207,7 +224,7 @@ type RepositoryListAllOptions struct {
|
||||||
// ListAll lists all GitHub repositories in the order that they were created.
|
// ListAll lists all GitHub repositories in the order that they were created.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/repos/#list-all-public-repositories
|
// GitHub API docs: http://developer.github.com/v3/repos/#list-all-public-repositories
|
||||||
func (s *RepositoriesService) ListAll(opt *RepositoryListAllOptions) ([]Repository, *Response, error) {
|
func (s *RepositoriesService) ListAll(opt *RepositoryListAllOptions) ([]*Repository, *Response, error) {
|
||||||
u, err := addOptions("repositories", opt)
|
u, err := addOptions("repositories", opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
@ -218,7 +235,7 @@ func (s *RepositoriesService) ListAll(opt *RepositoryListAllOptions) ([]Reposito
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
repos := new([]Repository)
|
repos := new([]*Repository)
|
||||||
resp, err := s.client.Do(req, repos)
|
resp, err := s.client.Do(req, repos)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -366,7 +383,7 @@ type ListContributorsOptions struct {
|
||||||
// ListContributors lists contributors for a repository.
|
// ListContributors lists contributors for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/repos/#list-contributors
|
// GitHub API docs: http://developer.github.com/v3/repos/#list-contributors
|
||||||
func (s *RepositoriesService) ListContributors(owner string, repository string, opt *ListContributorsOptions) ([]Contributor, *Response, error) {
|
func (s *RepositoriesService) ListContributors(owner string, repository string, opt *ListContributorsOptions) ([]*Contributor, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/contributors", owner, repository)
|
u := fmt.Sprintf("repos/%v/%v/contributors", owner, repository)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -378,7 +395,7 @@ func (s *RepositoriesService) ListContributors(owner string, repository string,
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
contributor := new([]Contributor)
|
contributor := new([]*Contributor)
|
||||||
resp, err := s.client.Do(req, contributor)
|
resp, err := s.client.Do(req, contributor)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
@ -416,7 +433,7 @@ func (s *RepositoriesService) ListLanguages(owner string, repo string) (map[stri
|
||||||
// ListTeams lists the teams for the specified repository.
|
// ListTeams lists the teams for the specified repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#list-teams
|
// GitHub API docs: https://developer.github.com/v3/repos/#list-teams
|
||||||
func (s *RepositoriesService) ListTeams(owner string, repo string, opt *ListOptions) ([]Team, *Response, error) {
|
func (s *RepositoriesService) ListTeams(owner string, repo string, opt *ListOptions) ([]*Team, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/teams", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/teams", owner, repo)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -428,7 +445,7 @@ func (s *RepositoriesService) ListTeams(owner string, repo string, opt *ListOpti
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
teams := new([]Team)
|
teams := new([]*Team)
|
||||||
resp, err := s.client.Do(req, teams)
|
resp, err := s.client.Do(req, teams)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -448,7 +465,7 @@ type RepositoryTag struct {
|
||||||
// ListTags lists tags for the specified repository.
|
// ListTags lists tags for the specified repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#list-tags
|
// GitHub API docs: https://developer.github.com/v3/repos/#list-tags
|
||||||
func (s *RepositoriesService) ListTags(owner string, repo string, opt *ListOptions) ([]RepositoryTag, *Response, error) {
|
func (s *RepositoriesService) ListTags(owner string, repo string, opt *ListOptions) ([]*RepositoryTag, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/tags", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/tags", owner, repo)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -460,7 +477,7 @@ func (s *RepositoriesService) ListTags(owner string, repo string, opt *ListOptio
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
tags := new([]RepositoryTag)
|
tags := new([]*RepositoryTag)
|
||||||
resp, err := s.client.Do(req, tags)
|
resp, err := s.client.Do(req, tags)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -497,7 +514,7 @@ type RequiredStatusChecks struct {
|
||||||
// ListBranches lists branches for the specified repository.
|
// ListBranches lists branches for the specified repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/repos/#list-branches
|
// GitHub API docs: http://developer.github.com/v3/repos/#list-branches
|
||||||
func (s *RepositoriesService) ListBranches(owner string, repo string, opt *ListOptions) ([]Branch, *Response, error) {
|
func (s *RepositoriesService) ListBranches(owner string, repo string, opt *ListOptions) ([]*Branch, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/branches", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/branches", owner, repo)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -511,7 +528,7 @@ func (s *RepositoriesService) ListBranches(owner string, repo string, opt *ListO
|
||||||
|
|
||||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||||
|
|
||||||
branches := new([]Branch)
|
branches := new([]*Branch)
|
||||||
resp, err := s.client.Do(req, branches)
|
resp, err := s.client.Do(req, branches)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
15
vendor/github.com/google/go-github/github/repos_collaborators.go
generated
vendored
15
vendor/github.com/google/go-github/github/repos_collaborators.go
generated
vendored
|
@ -10,7 +10,7 @@ import "fmt"
|
||||||
// ListCollaborators lists the Github users that have access to the repository.
|
// ListCollaborators lists the Github users that have access to the repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/repos/collaborators/#list
|
// GitHub API docs: http://developer.github.com/v3/repos/collaborators/#list
|
||||||
func (s *RepositoriesService) ListCollaborators(owner, repo string, opt *ListOptions) ([]User, *Response, error) {
|
func (s *RepositoriesService) ListCollaborators(owner, repo string, opt *ListOptions) ([]*User, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/collaborators", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/collaborators", owner, repo)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -22,9 +22,7 @@ func (s *RepositoriesService) ListCollaborators(owner, repo string, opt *ListOpt
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
req.Header.Set("Accept", mediaTypeOrgPermissionPreview)
|
users := new([]*User)
|
||||||
|
|
||||||
users := new([]User)
|
|
||||||
resp, err := s.client.Do(req, users)
|
resp, err := s.client.Do(req, users)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -60,13 +58,13 @@ type RepositoryAddCollaboratorOptions struct {
|
||||||
// push - team members can pull and push, but not administer this repository
|
// push - team members can pull and push, but not administer this repository
|
||||||
// admin - team members can pull, push and administer this repository
|
// admin - team members can pull, push and administer this repository
|
||||||
//
|
//
|
||||||
// Default value is "pull". This option is only valid for organization-owned repositories.
|
// Default value is "push". This option is only valid for organization-owned repositories.
|
||||||
Permission string `json:"permission,omitempty"`
|
Permission string `json:"permission,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddCollaborator adds the specified Github user as collaborator to the given repo.
|
// AddCollaborator adds the specified Github user as collaborator to the given repo.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/repos/collaborators/#add-collaborator
|
// GitHub API docs: https://developer.github.com/v3/repos/collaborators/#add-user-as-a-collaborator
|
||||||
func (s *RepositoriesService) AddCollaborator(owner, repo, user string, opt *RepositoryAddCollaboratorOptions) (*Response, error) {
|
func (s *RepositoriesService) AddCollaborator(owner, repo, user string, opt *RepositoryAddCollaboratorOptions) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user)
|
u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user)
|
||||||
req, err := s.client.NewRequest("PUT", u, opt)
|
req, err := s.client.NewRequest("PUT", u, opt)
|
||||||
|
@ -74,9 +72,8 @@ func (s *RepositoriesService) AddCollaborator(owner, repo, user string, opt *Rep
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if opt != nil {
|
// TODO: remove custom Accept header when this API fully launches.
|
||||||
req.Header.Set("Accept", mediaTypeOrgPermissionPreview)
|
req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
|
||||||
}
|
|
||||||
|
|
||||||
return s.client.Do(req, nil)
|
return s.client.Do(req, nil)
|
||||||
}
|
}
|
||||||
|
|
5
vendor/github.com/google/go-github/github/repos_collaborators_test.go
generated
vendored
5
vendor/github.com/google/go-github/github/repos_collaborators_test.go
generated
vendored
|
@ -19,7 +19,6 @@ func TestRepositoriesService_ListCollaborators(t *testing.T) {
|
||||||
|
|
||||||
mux.HandleFunc("/repos/o/r/collaborators", func(w http.ResponseWriter, r *http.Request) {
|
mux.HandleFunc("/repos/o/r/collaborators", func(w http.ResponseWriter, r *http.Request) {
|
||||||
testMethod(t, r, "GET")
|
testMethod(t, r, "GET")
|
||||||
testHeader(t, r, "Accept", mediaTypeOrgPermissionPreview)
|
|
||||||
testFormValues(t, r, values{"page": "2"})
|
testFormValues(t, r, values{"page": "2"})
|
||||||
fmt.Fprintf(w, `[{"id":1}, {"id":2}]`)
|
fmt.Fprintf(w, `[{"id":1}, {"id":2}]`)
|
||||||
})
|
})
|
||||||
|
@ -30,7 +29,7 @@ func TestRepositoriesService_ListCollaborators(t *testing.T) {
|
||||||
t.Errorf("Repositories.ListCollaborators returned error: %v", err)
|
t.Errorf("Repositories.ListCollaborators returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []User{{ID: Int(1)}, {ID: Int(2)}}
|
want := []*User{{ID: Int(1)}, {ID: Int(2)}}
|
||||||
if !reflect.DeepEqual(users, want) {
|
if !reflect.DeepEqual(users, want) {
|
||||||
t.Errorf("Repositories.ListCollaborators returned %+v, want %+v", users, want)
|
t.Errorf("Repositories.ListCollaborators returned %+v, want %+v", users, want)
|
||||||
}
|
}
|
||||||
|
@ -95,7 +94,7 @@ func TestRepositoriesService_AddCollaborator(t *testing.T) {
|
||||||
json.NewDecoder(r.Body).Decode(v)
|
json.NewDecoder(r.Body).Decode(v)
|
||||||
|
|
||||||
testMethod(t, r, "PUT")
|
testMethod(t, r, "PUT")
|
||||||
testHeader(t, r, "Accept", mediaTypeOrgPermissionPreview)
|
testHeader(t, r, "Accept", mediaTypeRepositoryInvitationsPreview)
|
||||||
if !reflect.DeepEqual(v, opt) {
|
if !reflect.DeepEqual(v, opt) {
|
||||||
t.Errorf("Request body = %+v, want %+v", v, opt)
|
t.Errorf("Request body = %+v, want %+v", v, opt)
|
||||||
}
|
}
|
||||||
|
|
8
vendor/github.com/google/go-github/github/repos_comments.go
generated
vendored
8
vendor/github.com/google/go-github/github/repos_comments.go
generated
vendored
|
@ -35,7 +35,7 @@ func (r RepositoryComment) String() string {
|
||||||
// ListComments lists all the comments for the repository.
|
// ListComments lists all the comments for the repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository
|
// GitHub API docs: http://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository
|
||||||
func (s *RepositoriesService) ListComments(owner, repo string, opt *ListOptions) ([]RepositoryComment, *Response, error) {
|
func (s *RepositoriesService) ListComments(owner, repo string, opt *ListOptions) ([]*RepositoryComment, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/comments", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/comments", owner, repo)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -50,7 +50,7 @@ func (s *RepositoriesService) ListComments(owner, repo string, opt *ListOptions)
|
||||||
// TODO: remove custom Accept header when this API fully launches.
|
// TODO: remove custom Accept header when this API fully launches.
|
||||||
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
||||||
|
|
||||||
comments := new([]RepositoryComment)
|
comments := new([]*RepositoryComment)
|
||||||
resp, err := s.client.Do(req, comments)
|
resp, err := s.client.Do(req, comments)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -62,7 +62,7 @@ func (s *RepositoriesService) ListComments(owner, repo string, opt *ListOptions)
|
||||||
// ListCommitComments lists all the comments for a given commit SHA.
|
// ListCommitComments lists all the comments for a given commit SHA.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/repos/comments/#list-comments-for-a-single-commit
|
// GitHub API docs: http://developer.github.com/v3/repos/comments/#list-comments-for-a-single-commit
|
||||||
func (s *RepositoriesService) ListCommitComments(owner, repo, sha string, opt *ListOptions) ([]RepositoryComment, *Response, error) {
|
func (s *RepositoriesService) ListCommitComments(owner, repo, sha string, opt *ListOptions) ([]*RepositoryComment, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/commits/%v/comments", owner, repo, sha)
|
u := fmt.Sprintf("repos/%v/%v/commits/%v/comments", owner, repo, sha)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -77,7 +77,7 @@ func (s *RepositoriesService) ListCommitComments(owner, repo, sha string, opt *L
|
||||||
// TODO: remove custom Accept header when this API fully launches.
|
// TODO: remove custom Accept header when this API fully launches.
|
||||||
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
||||||
|
|
||||||
comments := new([]RepositoryComment)
|
comments := new([]*RepositoryComment)
|
||||||
resp, err := s.client.Do(req, comments)
|
resp, err := s.client.Do(req, comments)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
4
vendor/github.com/google/go-github/github/repos_comments_test.go
generated
vendored
4
vendor/github.com/google/go-github/github/repos_comments_test.go
generated
vendored
|
@ -30,7 +30,7 @@ func TestRepositoriesService_ListComments(t *testing.T) {
|
||||||
t.Errorf("Repositories.ListComments returned error: %v", err)
|
t.Errorf("Repositories.ListComments returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []RepositoryComment{{ID: Int(1)}, {ID: Int(2)}}
|
want := []*RepositoryComment{{ID: Int(1)}, {ID: Int(2)}}
|
||||||
if !reflect.DeepEqual(comments, want) {
|
if !reflect.DeepEqual(comments, want) {
|
||||||
t.Errorf("Repositories.ListComments returned %+v, want %+v", comments, want)
|
t.Errorf("Repositories.ListComments returned %+v, want %+v", comments, want)
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ func TestRepositoriesService_ListCommitComments(t *testing.T) {
|
||||||
t.Errorf("Repositories.ListCommitComments returned error: %v", err)
|
t.Errorf("Repositories.ListCommitComments returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []RepositoryComment{{ID: Int(1)}, {ID: Int(2)}}
|
want := []*RepositoryComment{{ID: Int(1)}, {ID: Int(2)}}
|
||||||
if !reflect.DeepEqual(comments, want) {
|
if !reflect.DeepEqual(comments, want) {
|
||||||
t.Errorf("Repositories.ListCommitComments returned %+v, want %+v", comments, want)
|
t.Errorf("Repositories.ListCommitComments returned %+v, want %+v", comments, want)
|
||||||
}
|
}
|
||||||
|
|
9
vendor/github.com/google/go-github/github/repos_commits.go
generated
vendored
9
vendor/github.com/google/go-github/github/repos_commits.go
generated
vendored
|
@ -33,7 +33,7 @@ func (r RepositoryCommit) String() string {
|
||||||
return Stringify(r)
|
return Stringify(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CommitStats represents the number of additions / deletions from a file in a given RepositoryCommit.
|
// CommitStats represents the number of additions / deletions from a file in a given RepositoryCommit or GistCommit.
|
||||||
type CommitStats struct {
|
type CommitStats struct {
|
||||||
Additions *int `json:"additions,omitempty"`
|
Additions *int `json:"additions,omitempty"`
|
||||||
Deletions *int `json:"deletions,omitempty"`
|
Deletions *int `json:"deletions,omitempty"`
|
||||||
|
@ -104,7 +104,7 @@ type CommitsListOptions struct {
|
||||||
// ListCommits lists the commits of a repository.
|
// ListCommits lists the commits of a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/repos/commits/#list
|
// GitHub API docs: http://developer.github.com/v3/repos/commits/#list
|
||||||
func (s *RepositoriesService) ListCommits(owner, repo string, opt *CommitsListOptions) ([]RepositoryCommit, *Response, error) {
|
func (s *RepositoriesService) ListCommits(owner, repo string, opt *CommitsListOptions) ([]*RepositoryCommit, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/commits", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/commits", owner, repo)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -116,7 +116,7 @@ func (s *RepositoriesService) ListCommits(owner, repo string, opt *CommitsListOp
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
commits := new([]RepositoryCommit)
|
commits := new([]*RepositoryCommit)
|
||||||
resp, err := s.client.Do(req, commits)
|
resp, err := s.client.Do(req, commits)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -138,6 +138,9 @@ func (s *RepositoriesService) GetCommit(owner, repo, sha string) (*RepositoryCom
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: remove custom Accept header when this API fully launches.
|
||||||
|
req.Header.Set("Accept", mediaTypeGitSigningPreview)
|
||||||
|
|
||||||
commit := new(RepositoryCommit)
|
commit := new(RepositoryCommit)
|
||||||
resp, err := s.client.Do(req, commit)
|
resp, err := s.client.Do(req, commit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
3
vendor/github.com/google/go-github/github/repos_commits_test.go
generated
vendored
3
vendor/github.com/google/go-github/github/repos_commits_test.go
generated
vendored
|
@ -43,7 +43,7 @@ func TestRepositoriesService_ListCommits(t *testing.T) {
|
||||||
t.Errorf("Repositories.ListCommits returned error: %v", err)
|
t.Errorf("Repositories.ListCommits returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []RepositoryCommit{{SHA: String("s")}}
|
want := []*RepositoryCommit{{SHA: String("s")}}
|
||||||
if !reflect.DeepEqual(commits, want) {
|
if !reflect.DeepEqual(commits, want) {
|
||||||
t.Errorf("Repositories.ListCommits returned %+v, want %+v", commits, want)
|
t.Errorf("Repositories.ListCommits returned %+v, want %+v", commits, want)
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,7 @@ func TestRepositoriesService_GetCommit(t *testing.T) {
|
||||||
|
|
||||||
mux.HandleFunc("/repos/o/r/commits/s", func(w http.ResponseWriter, r *http.Request) {
|
mux.HandleFunc("/repos/o/r/commits/s", func(w http.ResponseWriter, r *http.Request) {
|
||||||
testMethod(t, r, "GET")
|
testMethod(t, r, "GET")
|
||||||
|
testHeader(t, r, "Accept", mediaTypeGitSigningPreview)
|
||||||
fmt.Fprintf(w, `{
|
fmt.Fprintf(w, `{
|
||||||
"sha": "s",
|
"sha": "s",
|
||||||
"commit": { "message": "m" },
|
"commit": { "message": "m" },
|
||||||
|
|
18
vendor/github.com/google/go-github/github/repos_contents_test.go
generated
vendored
18
vendor/github.com/google/go-github/github/repos_contents_test.go
generated
vendored
|
@ -119,24 +119,6 @@ func TestRepositoriesService_GetReadme(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRepositoriesService_GetReadme() {
|
|
||||||
client := NewClient(nil)
|
|
||||||
|
|
||||||
readme, _, err := client.Repositories.GetReadme("google", "go-github", nil)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
content, err := readme.GetContent()
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Printf("google/go-github README:\n%v\n", content)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestRepositoriesService_DownloadContents_Success(t *testing.T) {
|
func TestRepositoriesService_DownloadContents_Success(t *testing.T) {
|
||||||
setup()
|
setup()
|
||||||
defer teardown()
|
defer teardown()
|
||||||
|
|
8
vendor/github.com/google/go-github/github/repos_deployments.go
generated
vendored
8
vendor/github.com/google/go-github/github/repos_deployments.go
generated
vendored
|
@ -61,7 +61,7 @@ type DeploymentsListOptions struct {
|
||||||
// ListDeployments lists the deployments of a repository.
|
// ListDeployments lists the deployments of a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/deployments/#list-deployments
|
// GitHub API docs: https://developer.github.com/v3/repos/deployments/#list-deployments
|
||||||
func (s *RepositoriesService) ListDeployments(owner, repo string, opt *DeploymentsListOptions) ([]Deployment, *Response, error) {
|
func (s *RepositoriesService) ListDeployments(owner, repo string, opt *DeploymentsListOptions) ([]*Deployment, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/deployments", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/deployments", owner, repo)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -73,7 +73,7 @@ func (s *RepositoriesService) ListDeployments(owner, repo string, opt *Deploymen
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
deployments := new([]Deployment)
|
deployments := new([]*Deployment)
|
||||||
resp, err := s.client.Do(req, deployments)
|
resp, err := s.client.Do(req, deployments)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -134,7 +134,7 @@ type DeploymentStatusRequest struct {
|
||||||
// ListDeploymentStatuses lists the statuses of a given deployment of a repository.
|
// ListDeploymentStatuses lists the statuses of a given deployment of a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/deployments/#list-deployment-statuses
|
// GitHub API docs: https://developer.github.com/v3/repos/deployments/#list-deployment-statuses
|
||||||
func (s *RepositoriesService) ListDeploymentStatuses(owner, repo string, deployment int, opt *ListOptions) ([]DeploymentStatus, *Response, error) {
|
func (s *RepositoriesService) ListDeploymentStatuses(owner, repo string, deployment int, opt *ListOptions) ([]*DeploymentStatus, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses", owner, repo, deployment)
|
u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses", owner, repo, deployment)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -146,7 +146,7 @@ func (s *RepositoriesService) ListDeploymentStatuses(owner, repo string, deploym
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
statuses := new([]DeploymentStatus)
|
statuses := new([]*DeploymentStatus)
|
||||||
resp, err := s.client.Do(req, statuses)
|
resp, err := s.client.Do(req, statuses)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
4
vendor/github.com/google/go-github/github/repos_deployments_test.go
generated
vendored
4
vendor/github.com/google/go-github/github/repos_deployments_test.go
generated
vendored
|
@ -29,7 +29,7 @@ func TestRepositoriesService_ListDeployments(t *testing.T) {
|
||||||
t.Errorf("Repositories.ListDeployments returned error: %v", err)
|
t.Errorf("Repositories.ListDeployments returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Deployment{{ID: Int(1)}, {ID: Int(2)}}
|
want := []*Deployment{{ID: Int(1)}, {ID: Int(2)}}
|
||||||
if !reflect.DeepEqual(deployments, want) {
|
if !reflect.DeepEqual(deployments, want) {
|
||||||
t.Errorf("Repositories.ListDeployments returned %+v, want %+v", deployments, want)
|
t.Errorf("Repositories.ListDeployments returned %+v, want %+v", deployments, want)
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ func TestRepositoriesService_ListDeploymentStatuses(t *testing.T) {
|
||||||
t.Errorf("Repositories.ListDeploymentStatuses returned error: %v", err)
|
t.Errorf("Repositories.ListDeploymentStatuses returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []DeploymentStatus{{ID: Int(1)}, {ID: Int(2)}}
|
want := []*DeploymentStatus{{ID: Int(1)}, {ID: Int(2)}}
|
||||||
if !reflect.DeepEqual(statutses, want) {
|
if !reflect.DeepEqual(statutses, want) {
|
||||||
t.Errorf("Repositories.ListDeploymentStatuses returned %+v, want %+v", statutses, want)
|
t.Errorf("Repositories.ListDeploymentStatuses returned %+v, want %+v", statutses, want)
|
||||||
}
|
}
|
||||||
|
|
4
vendor/github.com/google/go-github/github/repos_forks.go
generated
vendored
4
vendor/github.com/google/go-github/github/repos_forks.go
generated
vendored
|
@ -20,7 +20,7 @@ type RepositoryListForksOptions struct {
|
||||||
// ListForks lists the forks of the specified repository.
|
// ListForks lists the forks of the specified repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/repos/forks/#list-forks
|
// GitHub API docs: http://developer.github.com/v3/repos/forks/#list-forks
|
||||||
func (s *RepositoriesService) ListForks(owner, repo string, opt *RepositoryListForksOptions) ([]Repository, *Response, error) {
|
func (s *RepositoriesService) ListForks(owner, repo string, opt *RepositoryListForksOptions) ([]*Repository, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/forks", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/forks", owner, repo)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -32,7 +32,7 @@ func (s *RepositoriesService) ListForks(owner, repo string, opt *RepositoryListF
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
repos := new([]Repository)
|
repos := new([]*Repository)
|
||||||
resp, err := s.client.Do(req, repos)
|
resp, err := s.client.Do(req, repos)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
2
vendor/github.com/google/go-github/github/repos_forks_test.go
generated
vendored
2
vendor/github.com/google/go-github/github/repos_forks_test.go
generated
vendored
|
@ -34,7 +34,7 @@ func TestRepositoriesService_ListForks(t *testing.T) {
|
||||||
t.Errorf("Repositories.ListForks returned error: %v", err)
|
t.Errorf("Repositories.ListForks returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Repository{{ID: Int(1)}, {ID: Int(2)}}
|
want := []*Repository{{ID: Int(1)}, {ID: Int(2)}}
|
||||||
if !reflect.DeepEqual(repos, want) {
|
if !reflect.DeepEqual(repos, want) {
|
||||||
t.Errorf("Repositories.ListForks returned %+v, want %+v", repos, want)
|
t.Errorf("Repositories.ListForks returned %+v, want %+v", repos, want)
|
||||||
}
|
}
|
||||||
|
|
6
vendor/github.com/google/go-github/github/repos_hooks.go
generated
vendored
6
vendor/github.com/google/go-github/github/repos_hooks.go
generated
vendored
|
@ -105,7 +105,7 @@ func (s *RepositoriesService) CreateHook(owner, repo string, hook *Hook) (*Hook,
|
||||||
// ListHooks lists all Hooks for the specified repository.
|
// ListHooks lists all Hooks for the specified repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/repos/hooks/#list
|
// GitHub API docs: http://developer.github.com/v3/repos/hooks/#list
|
||||||
func (s *RepositoriesService) ListHooks(owner, repo string, opt *ListOptions) ([]Hook, *Response, error) {
|
func (s *RepositoriesService) ListHooks(owner, repo string, opt *ListOptions) ([]*Hook, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/hooks", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/hooks", owner, repo)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -117,7 +117,7 @@ func (s *RepositoriesService) ListHooks(owner, repo string, opt *ListOptions) ([
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
hooks := new([]Hook)
|
hooks := new([]*Hook)
|
||||||
resp, err := s.client.Do(req, hooks)
|
resp, err := s.client.Do(req, hooks)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -191,6 +191,6 @@ func (s *RepositoriesService) TestHook(owner, repo string, id int) (*Response, e
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListServiceHooks is deprecated. Use Client.ListServiceHooks instead.
|
// ListServiceHooks is deprecated. Use Client.ListServiceHooks instead.
|
||||||
func (s *RepositoriesService) ListServiceHooks() ([]ServiceHook, *Response, error) {
|
func (s *RepositoriesService) ListServiceHooks() ([]*ServiceHook, *Response, error) {
|
||||||
return s.client.ListServiceHooks()
|
return s.client.ListServiceHooks()
|
||||||
}
|
}
|
||||||
|
|
2
vendor/github.com/google/go-github/github/repos_hooks_test.go
generated
vendored
2
vendor/github.com/google/go-github/github/repos_hooks_test.go
generated
vendored
|
@ -64,7 +64,7 @@ func TestRepositoriesService_ListHooks(t *testing.T) {
|
||||||
t.Errorf("Repositories.ListHooks returned error: %v", err)
|
t.Errorf("Repositories.ListHooks returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Hook{{ID: Int(1)}, {ID: Int(2)}}
|
want := []*Hook{{ID: Int(1)}, {ID: Int(2)}}
|
||||||
if !reflect.DeepEqual(hooks, want) {
|
if !reflect.DeepEqual(hooks, want) {
|
||||||
t.Errorf("Repositories.ListHooks returned %+v, want %+v", hooks, want)
|
t.Errorf("Repositories.ListHooks returned %+v, want %+v", hooks, want)
|
||||||
}
|
}
|
||||||
|
|
91
vendor/github.com/google/go-github/github/repos_invitations.go
generated
vendored
Normal file
91
vendor/github.com/google/go-github/github/repos_invitations.go
generated
vendored
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
// Copyright 2016 The go-github AUTHORS. All rights reserved.
|
||||||
|
//
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package github
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
// RepositoryInvitation represents an invitation to collaborate on a repo.
|
||||||
|
type RepositoryInvitation struct {
|
||||||
|
ID *int `json:"id,omitempty"`
|
||||||
|
Repo *Repository `json:"repository,omitempty"`
|
||||||
|
Invitee *User `json:"invitee,omitempty"`
|
||||||
|
Inviter *User `json:"inviter,omitempty"`
|
||||||
|
|
||||||
|
// Permissions represents the permissions that the associated user will have
|
||||||
|
// on the repository. Possible values are: "read", "write", "admin".
|
||||||
|
Permissions *string `json:"permissions,omitempty"`
|
||||||
|
CreatedAt *Timestamp `json:"created_at,omitempty"`
|
||||||
|
URL *string `json:"url,omitempty"`
|
||||||
|
HTMLURL *string `json:"html_url,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListInvitations lists all currently-open repository invitations.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://developer.github.com/v3/repos/invitations/#list-invitations-for-a-repository
|
||||||
|
func (s *RepositoriesService) ListInvitations(repoID int, opt *ListOptions) ([]*RepositoryInvitation, *Response, error) {
|
||||||
|
u := fmt.Sprintf("repositories/%v/invitations", repoID)
|
||||||
|
u, err := addOptions(u, opt)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: remove custom Accept header when this API fully launches.
|
||||||
|
req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
|
||||||
|
|
||||||
|
invites := []*RepositoryInvitation{}
|
||||||
|
resp, err := s.client.Do(req, &invites)
|
||||||
|
if err != nil {
|
||||||
|
return nil, resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return invites, resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteInvitation deletes a repository invitation.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://developer.github.com/v3/repos/invitations/#delete-a-repository-invitation
|
||||||
|
func (s *RepositoriesService) DeleteInvitation(repoID, invitationID int) (*Response, error) {
|
||||||
|
u := fmt.Sprintf("repositories/%v/invitations/%v", repoID, invitationID)
|
||||||
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: remove custom Accept header when this API fully launches.
|
||||||
|
req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
|
||||||
|
|
||||||
|
return s.client.Do(req, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateInvitation updates the permissions associated with a repository
|
||||||
|
// invitation.
|
||||||
|
//
|
||||||
|
// permissions represents the permissions that the associated user will have
|
||||||
|
// on the repository. Possible values are: "read", "write", "admin".
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://developer.github.com/v3/repos/invitations/#update-a-repository-invitation
|
||||||
|
func (s *RepositoriesService) UpdateInvitation(repoID, invitationID int, permissions string) (*RepositoryInvitation, *Response, error) {
|
||||||
|
opts := &struct {
|
||||||
|
Permissions string `json:"permissions"`
|
||||||
|
}{Permissions: permissions}
|
||||||
|
u := fmt.Sprintf("repositories/%v/invitations/%v", repoID, invitationID)
|
||||||
|
req, err := s.client.NewRequest("PATCH", u, opts)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: remove custom Accept header when this API fully launches.
|
||||||
|
req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
|
||||||
|
|
||||||
|
invite := &RepositoryInvitation{}
|
||||||
|
resp, err := s.client.Do(req, invite)
|
||||||
|
return invite, resp, err
|
||||||
|
}
|
73
vendor/github.com/google/go-github/github/repos_invitations_test.go
generated
vendored
Normal file
73
vendor/github.com/google/go-github/github/repos_invitations_test.go
generated
vendored
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
// Copyright 2016 The go-github AUTHORS. All rights reserved.
|
||||||
|
//
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package github
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"reflect"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestRepositoriesService_ListInvitations(t *testing.T) {
|
||||||
|
setup()
|
||||||
|
defer teardown()
|
||||||
|
|
||||||
|
mux.HandleFunc("/repositories/1/invitations", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
testMethod(t, r, "GET")
|
||||||
|
testHeader(t, r, "Accept", mediaTypeRepositoryInvitationsPreview)
|
||||||
|
testFormValues(t, r, values{"page": "2"})
|
||||||
|
fmt.Fprintf(w, `[{"id":1}, {"id":2}]`)
|
||||||
|
})
|
||||||
|
|
||||||
|
opt := &ListOptions{Page: 2}
|
||||||
|
got, _, err := client.Repositories.ListInvitations(1, opt)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Repositories.ListInvitations returned error: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
want := []*RepositoryInvitation{{ID: Int(1)}, {ID: Int(2)}}
|
||||||
|
if !reflect.DeepEqual(got, want) {
|
||||||
|
t.Errorf("Repositories.ListInvitations = %+v, want %+v", got, want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestRepositoriesService_DeleteInvitation(t *testing.T) {
|
||||||
|
setup()
|
||||||
|
defer teardown()
|
||||||
|
|
||||||
|
mux.HandleFunc("/repositories/1/invitations/2", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
testMethod(t, r, "DELETE")
|
||||||
|
testHeader(t, r, "Accept", mediaTypeRepositoryInvitationsPreview)
|
||||||
|
w.WriteHeader(http.StatusNoContent)
|
||||||
|
})
|
||||||
|
|
||||||
|
_, err := client.Repositories.DeleteInvitation(1, 2)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Repositories.DeleteInvitation returned error: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestRepositoriesService_UpdateInvitation(t *testing.T) {
|
||||||
|
setup()
|
||||||
|
defer teardown()
|
||||||
|
|
||||||
|
mux.HandleFunc("/repositories/1/invitations/2", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
testMethod(t, r, "PATCH")
|
||||||
|
testHeader(t, r, "Accept", mediaTypeRepositoryInvitationsPreview)
|
||||||
|
fmt.Fprintf(w, `{"id":1}`)
|
||||||
|
})
|
||||||
|
|
||||||
|
got, _, err := client.Repositories.UpdateInvitation(1, 2, "write")
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Repositories.UpdateInvitation returned error: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
want := &RepositoryInvitation{ID: Int(1)}
|
||||||
|
if !reflect.DeepEqual(got, want) {
|
||||||
|
t.Errorf("Repositories.UpdateInvitation = %+v, want %+v", got, want)
|
||||||
|
}
|
||||||
|
}
|
4
vendor/github.com/google/go-github/github/repos_keys.go
generated
vendored
4
vendor/github.com/google/go-github/github/repos_keys.go
generated
vendored
|
@ -12,7 +12,7 @@ import "fmt"
|
||||||
// ListKeys lists the deploy keys for a repository.
|
// ListKeys lists the deploy keys for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/repos/keys/#list
|
// GitHub API docs: http://developer.github.com/v3/repos/keys/#list
|
||||||
func (s *RepositoriesService) ListKeys(owner string, repo string, opt *ListOptions) ([]Key, *Response, error) {
|
func (s *RepositoriesService) ListKeys(owner string, repo string, opt *ListOptions) ([]*Key, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/keys", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/keys", owner, repo)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -24,7 +24,7 @@ func (s *RepositoriesService) ListKeys(owner string, repo string, opt *ListOptio
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
keys := new([]Key)
|
keys := new([]*Key)
|
||||||
resp, err := s.client.Do(req, keys)
|
resp, err := s.client.Do(req, keys)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
2
vendor/github.com/google/go-github/github/repos_keys_test.go
generated
vendored
2
vendor/github.com/google/go-github/github/repos_keys_test.go
generated
vendored
|
@ -29,7 +29,7 @@ func TestRepositoriesService_ListKeys(t *testing.T) {
|
||||||
t.Errorf("Repositories.ListKeys returned error: %v", err)
|
t.Errorf("Repositories.ListKeys returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []Key{{ID: Int(1)}}
|
want := []*Key{{ID: Int(1)}}
|
||||||
if !reflect.DeepEqual(keys, want) {
|
if !reflect.DeepEqual(keys, want) {
|
||||||
t.Errorf("Repositories.ListKeys returned %+v, want %+v", keys, want)
|
t.Errorf("Repositories.ListKeys returned %+v, want %+v", keys, want)
|
||||||
}
|
}
|
||||||
|
|
4
vendor/github.com/google/go-github/github/repos_pages.go
generated
vendored
4
vendor/github.com/google/go-github/github/repos_pages.go
generated
vendored
|
@ -54,14 +54,14 @@ func (s *RepositoriesService) GetPagesInfo(owner string, repo string) (*Pages, *
|
||||||
// ListPagesBuilds lists the builds for a GitHub Pages site.
|
// ListPagesBuilds lists the builds for a GitHub Pages site.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/pages/#list-pages-builds
|
// GitHub API docs: https://developer.github.com/v3/repos/pages/#list-pages-builds
|
||||||
func (s *RepositoriesService) ListPagesBuilds(owner string, repo string) ([]PagesBuild, *Response, error) {
|
func (s *RepositoriesService) ListPagesBuilds(owner string, repo string) ([]*PagesBuild, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pages/builds", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/pages/builds", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var pages []PagesBuild
|
var pages []*PagesBuild
|
||||||
resp, err := s.client.Do(req, &pages)
|
resp, err := s.client.Do(req, &pages)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
2
vendor/github.com/google/go-github/github/repos_pages_test.go
generated
vendored
2
vendor/github.com/google/go-github/github/repos_pages_test.go
generated
vendored
|
@ -46,7 +46,7 @@ func TestRepositoriesService_ListPagesBuilds(t *testing.T) {
|
||||||
t.Errorf("Repositories.ListPagesBuilds returned error: %v", err)
|
t.Errorf("Repositories.ListPagesBuilds returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []PagesBuild{{URL: String("u"), Status: String("s"), Commit: String("c")}}
|
want := []*PagesBuild{{URL: String("u"), Status: String("s"), Commit: String("c")}}
|
||||||
if !reflect.DeepEqual(pages, want) {
|
if !reflect.DeepEqual(pages, want) {
|
||||||
t.Errorf("Repositories.ListPagesBuilds returned %+v, want %+v", pages, want)
|
t.Errorf("Repositories.ListPagesBuilds returned %+v, want %+v", pages, want)
|
||||||
}
|
}
|
||||||
|
|
8
vendor/github.com/google/go-github/github/repos_releases.go
generated
vendored
8
vendor/github.com/google/go-github/github/repos_releases.go
generated
vendored
|
@ -64,7 +64,7 @@ func (r ReleaseAsset) String() string {
|
||||||
// ListReleases lists the releases for a repository.
|
// ListReleases lists the releases for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/repos/releases/#list-releases-for-a-repository
|
// GitHub API docs: http://developer.github.com/v3/repos/releases/#list-releases-for-a-repository
|
||||||
func (s *RepositoriesService) ListReleases(owner, repo string, opt *ListOptions) ([]RepositoryRelease, *Response, error) {
|
func (s *RepositoriesService) ListReleases(owner, repo string, opt *ListOptions) ([]*RepositoryRelease, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/releases", owner, repo)
|
u := fmt.Sprintf("repos/%s/%s/releases", owner, repo)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -76,7 +76,7 @@ func (s *RepositoriesService) ListReleases(owner, repo string, opt *ListOptions)
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
releases := new([]RepositoryRelease)
|
releases := new([]*RepositoryRelease)
|
||||||
resp, err := s.client.Do(req, releases)
|
resp, err := s.client.Do(req, releases)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -176,7 +176,7 @@ func (s *RepositoriesService) DeleteRelease(owner, repo string, id int) (*Respon
|
||||||
// ListReleaseAssets lists the release's assets.
|
// ListReleaseAssets lists the release's assets.
|
||||||
//
|
//
|
||||||
// GitHub API docs : http://developer.github.com/v3/repos/releases/#list-assets-for-a-release
|
// GitHub API docs : http://developer.github.com/v3/repos/releases/#list-assets-for-a-release
|
||||||
func (s *RepositoriesService) ListReleaseAssets(owner, repo string, id int, opt *ListOptions) ([]ReleaseAsset, *Response, error) {
|
func (s *RepositoriesService) ListReleaseAssets(owner, repo string, id int, opt *ListOptions) ([]*ReleaseAsset, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id)
|
u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -188,7 +188,7 @@ func (s *RepositoriesService) ListReleaseAssets(owner, repo string, id int, opt
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
assets := new([]ReleaseAsset)
|
assets := new([]*ReleaseAsset)
|
||||||
resp, err := s.client.Do(req, assets)
|
resp, err := s.client.Do(req, assets)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, nil
|
return nil, resp, nil
|
||||||
|
|
4
vendor/github.com/google/go-github/github/repos_releases_test.go
generated
vendored
4
vendor/github.com/google/go-github/github/repos_releases_test.go
generated
vendored
|
@ -32,7 +32,7 @@ func TestRepositoriesService_ListReleases(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Repositories.ListReleases returned error: %v", err)
|
t.Errorf("Repositories.ListReleases returned error: %v", err)
|
||||||
}
|
}
|
||||||
want := []RepositoryRelease{{ID: Int(1)}}
|
want := []*RepositoryRelease{{ID: Int(1)}}
|
||||||
if !reflect.DeepEqual(releases, want) {
|
if !reflect.DeepEqual(releases, want) {
|
||||||
t.Errorf("Repositories.ListReleases returned %+v, want %+v", releases, want)
|
t.Errorf("Repositories.ListReleases returned %+v, want %+v", releases, want)
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ func TestRepositoriesService_ListReleaseAssets(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Repositories.ListReleaseAssets returned error: %v", err)
|
t.Errorf("Repositories.ListReleaseAssets returned error: %v", err)
|
||||||
}
|
}
|
||||||
want := []ReleaseAsset{{ID: Int(1)}}
|
want := []*ReleaseAsset{{ID: Int(1)}}
|
||||||
if !reflect.DeepEqual(assets, want) {
|
if !reflect.DeepEqual(assets, want) {
|
||||||
t.Errorf("Repositories.ListReleaseAssets returned %+v, want %+v", assets, want)
|
t.Errorf("Repositories.ListReleaseAssets returned %+v, want %+v", assets, want)
|
||||||
}
|
}
|
||||||
|
|
20
vendor/github.com/google/go-github/github/repos_stats.go
generated
vendored
20
vendor/github.com/google/go-github/github/repos_stats.go
generated
vendored
|
@ -45,14 +45,14 @@ func (w WeeklyStats) String() string {
|
||||||
// delay of a second or so, should result in a successful request.
|
// delay of a second or so, should result in a successful request.
|
||||||
//
|
//
|
||||||
// GitHub API Docs: https://developer.github.com/v3/repos/statistics/#contributors
|
// GitHub API Docs: https://developer.github.com/v3/repos/statistics/#contributors
|
||||||
func (s *RepositoriesService) ListContributorsStats(owner, repo string) ([]ContributorStats, *Response, error) {
|
func (s *RepositoriesService) ListContributorsStats(owner, repo string) ([]*ContributorStats, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/stats/contributors", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/stats/contributors", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var contributorStats []ContributorStats
|
var contributorStats []*ContributorStats
|
||||||
resp, err := s.client.Do(req, &contributorStats)
|
resp, err := s.client.Do(req, &contributorStats)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -84,14 +84,14 @@ func (w WeeklyCommitActivity) String() string {
|
||||||
// delay of a second or so, should result in a successful request.
|
// delay of a second or so, should result in a successful request.
|
||||||
//
|
//
|
||||||
// GitHub API Docs: https://developer.github.com/v3/repos/statistics/#commit-activity
|
// GitHub API Docs: https://developer.github.com/v3/repos/statistics/#commit-activity
|
||||||
func (s *RepositoriesService) ListCommitActivity(owner, repo string) ([]WeeklyCommitActivity, *Response, error) {
|
func (s *RepositoriesService) ListCommitActivity(owner, repo string) ([]*WeeklyCommitActivity, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/stats/commit_activity", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/stats/commit_activity", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var weeklyCommitActivity []WeeklyCommitActivity
|
var weeklyCommitActivity []*WeeklyCommitActivity
|
||||||
resp, err := s.client.Do(req, &weeklyCommitActivity)
|
resp, err := s.client.Do(req, &weeklyCommitActivity)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
@ -105,7 +105,7 @@ func (s *RepositoriesService) ListCommitActivity(owner, repo string) ([]WeeklyCo
|
||||||
// additions and deletions, but not total commits.
|
// additions and deletions, but not total commits.
|
||||||
//
|
//
|
||||||
// GitHub API Docs: https://developer.github.com/v3/repos/statistics/#code-frequency
|
// GitHub API Docs: https://developer.github.com/v3/repos/statistics/#code-frequency
|
||||||
func (s *RepositoriesService) ListCodeFrequency(owner, repo string) ([]WeeklyStats, *Response, error) {
|
func (s *RepositoriesService) ListCodeFrequency(owner, repo string) ([]*WeeklyStats, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/stats/code_frequency", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/stats/code_frequency", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -116,12 +116,12 @@ func (s *RepositoriesService) ListCodeFrequency(owner, repo string) ([]WeeklySta
|
||||||
resp, err := s.client.Do(req, &weeks)
|
resp, err := s.client.Do(req, &weeks)
|
||||||
|
|
||||||
// convert int slices into WeeklyStats
|
// convert int slices into WeeklyStats
|
||||||
var stats []WeeklyStats
|
var stats []*WeeklyStats
|
||||||
for _, week := range weeks {
|
for _, week := range weeks {
|
||||||
if len(week) != 3 {
|
if len(week) != 3 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
stat := WeeklyStats{
|
stat := &WeeklyStats{
|
||||||
Week: &Timestamp{time.Unix(int64(week[0]), 0)},
|
Week: &Timestamp{time.Unix(int64(week[0]), 0)},
|
||||||
Additions: Int(week[1]),
|
Additions: Int(week[1]),
|
||||||
Deletions: Int(week[2]),
|
Deletions: Int(week[2]),
|
||||||
|
@ -186,7 +186,7 @@ type PunchCard struct {
|
||||||
// ListPunchCard returns the number of commits per hour in each day.
|
// ListPunchCard returns the number of commits per hour in each day.
|
||||||
//
|
//
|
||||||
// GitHub API Docs: https://developer.github.com/v3/repos/statistics/#punch-card
|
// GitHub API Docs: https://developer.github.com/v3/repos/statistics/#punch-card
|
||||||
func (s *RepositoriesService) ListPunchCard(owner, repo string) ([]PunchCard, *Response, error) {
|
func (s *RepositoriesService) ListPunchCard(owner, repo string) ([]*PunchCard, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/stats/punch_card", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/stats/punch_card", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -197,12 +197,12 @@ func (s *RepositoriesService) ListPunchCard(owner, repo string) ([]PunchCard, *R
|
||||||
resp, err := s.client.Do(req, &results)
|
resp, err := s.client.Do(req, &results)
|
||||||
|
|
||||||
// convert int slices into Punchcards
|
// convert int slices into Punchcards
|
||||||
var cards []PunchCard
|
var cards []*PunchCard
|
||||||
for _, result := range results {
|
for _, result := range results {
|
||||||
if len(result) != 3 {
|
if len(result) != 3 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
card := PunchCard{
|
card := &PunchCard{
|
||||||
Day: Int(result[0]),
|
Day: Int(result[0]),
|
||||||
Hour: Int(result[1]),
|
Hour: Int(result[1]),
|
||||||
Commits: Int(result[2]),
|
Commits: Int(result[2]),
|
||||||
|
|
8
vendor/github.com/google/go-github/github/repos_stats_test.go
generated
vendored
8
vendor/github.com/google/go-github/github/repos_stats_test.go
generated
vendored
|
@ -45,7 +45,7 @@ func TestRepositoriesService_ListContributorsStats(t *testing.T) {
|
||||||
t.Errorf("RepositoriesService.ListContributorsStats returned error: %v", err)
|
t.Errorf("RepositoriesService.ListContributorsStats returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []ContributorStats{
|
want := []*ContributorStats{
|
||||||
{
|
{
|
||||||
Author: &Contributor{
|
Author: &Contributor{
|
||||||
ID: Int(1),
|
ID: Int(1),
|
||||||
|
@ -90,7 +90,7 @@ func TestRepositoriesService_ListCommitActivity(t *testing.T) {
|
||||||
t.Errorf("RepositoriesService.ListCommitActivity returned error: %v", err)
|
t.Errorf("RepositoriesService.ListCommitActivity returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []WeeklyCommitActivity{
|
want := []*WeeklyCommitActivity{
|
||||||
{
|
{
|
||||||
Days: []int{0, 3, 26, 20, 39, 1, 0},
|
Days: []int{0, 3, 26, 20, 39, 1, 0},
|
||||||
Total: Int(89),
|
Total: Int(89),
|
||||||
|
@ -118,7 +118,7 @@ func TestRepositoriesService_ListCodeFrequency(t *testing.T) {
|
||||||
t.Errorf("RepositoriesService.ListCodeFrequency returned error: %v", err)
|
t.Errorf("RepositoriesService.ListCodeFrequency returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []WeeklyStats{{
|
want := []*WeeklyStats{{
|
||||||
Week: &Timestamp{time.Date(2011, 04, 17, 00, 00, 00, 0, time.UTC).Local()},
|
Week: &Timestamp{time.Date(2011, 04, 17, 00, 00, 00, 0, time.UTC).Local()},
|
||||||
Additions: Int(1124),
|
Additions: Int(1124),
|
||||||
Deletions: Int(-435),
|
Deletions: Int(-435),
|
||||||
|
@ -198,7 +198,7 @@ func TestRepositoriesService_ListPunchCard(t *testing.T) {
|
||||||
t.Errorf("RepositoriesService.ListPunchCard returned error: %v", err)
|
t.Errorf("RepositoriesService.ListPunchCard returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []PunchCard{
|
want := []*PunchCard{
|
||||||
{Day: Int(0), Hour: Int(0), Commits: Int(5)},
|
{Day: Int(0), Hour: Int(0), Commits: Int(5)},
|
||||||
{Day: Int(0), Hour: Int(1), Commits: Int(43)},
|
{Day: Int(0), Hour: Int(1), Commits: Int(43)},
|
||||||
{Day: Int(0), Hour: Int(2), Commits: Int(21)},
|
{Day: Int(0), Hour: Int(2), Commits: Int(21)},
|
||||||
|
|
4
vendor/github.com/google/go-github/github/repos_statuses.go
generated
vendored
4
vendor/github.com/google/go-github/github/repos_statuses.go
generated
vendored
|
@ -42,7 +42,7 @@ func (r RepoStatus) String() string {
|
||||||
// reference. ref can be a SHA, a branch name, or a tag name.
|
// reference. ref can be a SHA, a branch name, or a tag name.
|
||||||
//
|
//
|
||||||
// GitHub API docs: http://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref
|
// GitHub API docs: http://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref
|
||||||
func (s *RepositoriesService) ListStatuses(owner, repo, ref string, opt *ListOptions) ([]RepoStatus, *Response, error) {
|
func (s *RepositoriesService) ListStatuses(owner, repo, ref string, opt *ListOptions) ([]*RepoStatus, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/commits/%v/statuses", owner, repo, ref)
|
u := fmt.Sprintf("repos/%v/%v/commits/%v/statuses", owner, repo, ref)
|
||||||
u, err := addOptions(u, opt)
|
u, err := addOptions(u, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -54,7 +54,7 @@ func (s *RepositoriesService) ListStatuses(owner, repo, ref string, opt *ListOpt
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
statuses := new([]RepoStatus)
|
statuses := new([]*RepoStatus)
|
||||||
resp, err := s.client.Do(req, statuses)
|
resp, err := s.client.Do(req, statuses)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
2
vendor/github.com/google/go-github/github/repos_statuses_test.go
generated
vendored
2
vendor/github.com/google/go-github/github/repos_statuses_test.go
generated
vendored
|
@ -29,7 +29,7 @@ func TestRepositoriesService_ListStatuses(t *testing.T) {
|
||||||
t.Errorf("Repositories.ListStatuses returned error: %v", err)
|
t.Errorf("Repositories.ListStatuses returned error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := []RepoStatus{{ID: Int(1)}}
|
want := []*RepoStatus{{ID: Int(1)}}
|
||||||
if !reflect.DeepEqual(statuses, want) {
|
if !reflect.DeepEqual(statuses, want) {
|
||||||
t.Errorf("Repositories.ListStatuses returned %+v, want %+v", statuses, want)
|
t.Errorf("Repositories.ListStatuses returned %+v, want %+v", statuses, want)
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue