mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Merge branch 'master' into master
This commit is contained in:
commit
55b594569c
@ -9,3 +9,6 @@ builds:
|
||||
- linux
|
||||
goarch:
|
||||
- amd64
|
||||
|
||||
archive:
|
||||
wrap_in_directory: true
|
||||
|
8
Gopkg.lock
generated
8
Gopkg.lock
generated
@ -88,6 +88,12 @@
|
||||
packages = ["."]
|
||||
revision = "71ecf1f4299c6d72b16d20da72405b7e85ac8720"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/xanzy/go-gitlab"
|
||||
packages = ["."]
|
||||
revision = "73e9df58a3194b1256edae4d2e819603f06d428c"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/yfronto/newrelic"
|
||||
@ -164,6 +170,6 @@
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "b0e632406212933c5f4d7652db7aa06e63f4ed94d38ceb823e5c51b865c20be0"
|
||||
inputs-digest = "fd122eb7175ffd7db7cb197de13e0b850231ec9269a63a8ca9d117a8aa50d7e5"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
@ -41,6 +41,10 @@
|
||||
name = "github.com/google/go-github"
|
||||
branch = "master"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/xanzy/go-gitlab"
|
||||
branch = "master"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/jessevdk/go-flags"
|
||||
version = "1.4.0"
|
||||
|
53
_site/content/posts/modules/circleci.md
Normal file
53
_site/content/posts/modules/circleci.md
Normal file
@ -0,0 +1,53 @@
|
||||
---
|
||||
title: "CircleCI"
|
||||
date: 2018-06-10T19:26:08-04:00
|
||||
draft: false
|
||||
---
|
||||
|
||||
Added in `v0.0.7`.
|
||||
|
||||
Displays build information for your CircleCI account.
|
||||
|
||||
<img src="/imgs/modules/circleci.png" width="609" height="150" alt="circleci screenshot" />
|
||||
|
||||
## Source Code
|
||||
|
||||
```bash
|
||||
wtf/circleci/
|
||||
```
|
||||
|
||||
## Required ENV Variables
|
||||
|
||||
<span class="caption">Key:</span> `WTF_CIRCLE_API_KEY` <br />
|
||||
<span class="caption">Value:</span> Your <a href="https://circleci.com/account/api">CircleCI API</a>
|
||||
token.
|
||||
|
||||
## Keyboard Commands
|
||||
|
||||
None.
|
||||
|
||||
## Configuration
|
||||
|
||||
```yaml
|
||||
circleci:
|
||||
enabled: true
|
||||
position:
|
||||
top: 4
|
||||
left: 1
|
||||
height: 1
|
||||
width: 2
|
||||
refreshInterval: 900
|
||||
```
|
||||
|
||||
### Attributes
|
||||
|
||||
`enabled` <br />
|
||||
Determines whether or not this module is executed and if its data displayed onscreen. <br />
|
||||
Values: `true`, `false`.
|
||||
|
||||
`position` <br />
|
||||
Defines where in the grid this module's widget will be displayed. <br />
|
||||
|
||||
`refreshInterval` <br />
|
||||
How often, in seconds, this module will update its data. <br />
|
||||
Values: A positive integer, `0..n`.
|
@ -19,11 +19,7 @@ wtf/gcal/
|
||||
|
||||
## Required ENV Variables
|
||||
|
||||
<span class="caption">Key:</span> `WTF_GOOGLE_CAL_CLIENT_ID` <br />
|
||||
<span class="caption">Value:</span> Your <a href="https://developers.google.com/calendar/auth">Google API</a> client ID.
|
||||
|
||||
<span class="caption">Key:</span> `WTF_GOOGLE_CAL_CLIENT_SECRET` <br />
|
||||
<span class="caption">Value:</span> Your <a href="https://developers.google.com/calendar/auth">Google API</a> client secret.
|
||||
None.
|
||||
|
||||
## Keyboard Commands
|
||||
|
||||
|
90
_site/content/posts/modules/gitlab.md
Normal file
90
_site/content/posts/modules/gitlab.md
Normal file
@ -0,0 +1,90 @@
|
||||
---
|
||||
title: "Gitlab"
|
||||
date: 2018-06-08T13:14:11-07:00
|
||||
draft: false
|
||||
---
|
||||
|
||||
Added in `v0.0.8`.
|
||||
|
||||
<img src="/imgs/modules/gitlab.png" width="640" height="384" alt="gitlab screenshot" />
|
||||
|
||||
Displays information about your projects hosted on Gitlab:
|
||||
|
||||
#### Open Approval Requests
|
||||
|
||||
All open merge requests that are requesting your approval.
|
||||
|
||||
#### Open Merge Requests
|
||||
|
||||
All open merge requests created by you.
|
||||
|
||||
## Source Code
|
||||
|
||||
```bash
|
||||
wtf/gitlab/
|
||||
```
|
||||
|
||||
## Required ENV Variables
|
||||
|
||||
<span class="caption">Key:</span> `WTF_GITLAB_TOKEN` <br />
|
||||
<span class="caption">Action:</span> A <a href="https://docs.gitlab.com/ce/user/profile/personal_access_tokens.html">Gitlab personal access token</a>. Requires at least `api` access.
|
||||
|
||||
## Keyboard Commands
|
||||
|
||||
<span class="caption">Key:</span> `/` <br />
|
||||
<span class="caption">Action:</span> Open/close the widget's help window.
|
||||
|
||||
<span class="caption">Key:</span> `h` <br />
|
||||
<span class="caption">Action:</span> Show the previous project.
|
||||
|
||||
<span class="caption">Key:</span> `l` <br />
|
||||
<span class="caption">Action:</span> Show the next project.
|
||||
|
||||
<span class="caption">Key:</span> `←` <br />
|
||||
<span class="caption">Action:</span> Show the previous project.
|
||||
|
||||
<span class="caption">Key:</span> `→` <br />
|
||||
<span class="caption">Action:</span> Show the next project.
|
||||
|
||||
## Configuration
|
||||
|
||||
```yaml
|
||||
gitlab:
|
||||
enabled: true
|
||||
position:
|
||||
top: 2
|
||||
left: 3
|
||||
height: 2
|
||||
width: 2
|
||||
refreshInterval: 300
|
||||
projects:
|
||||
tasks: "gitlab-org/release"
|
||||
gitlab-ce: "gitlab-org"
|
||||
username: "senorprogrammer"
|
||||
```
|
||||
|
||||
### Attributes
|
||||
|
||||
`enabled` <br />
|
||||
Determines whether or not this module is executed and if its data displayed onscreen. <br />
|
||||
Values: `true`, `false`.
|
||||
|
||||
`position` <br />
|
||||
Defines where in the grid this module's widget will be displayed. <br />
|
||||
|
||||
`refreshInterval` <br />
|
||||
How often, in seconds, this module will update its data. <br />
|
||||
Values: A positive integer, `0..n`.
|
||||
|
||||
`domain` <br />
|
||||
_Optional_. Your Gitlab corporate domain. <br />
|
||||
Values: A valid URI.
|
||||
|
||||
`projects` <br />
|
||||
A list of key/value pairs each describing a Gitlab project to fetch data
|
||||
for. <br />
|
||||
<span class="caption">Key:</span> The name of the project. <br />
|
||||
<span class="caption">Value:</span> The namespace of the project.
|
||||
|
||||
`username` <br />
|
||||
Your Gitlab username. Used to figure out which requests require your approval
|
70
_site/content/posts/modules/gspreadsheet.md
Normal file
70
_site/content/posts/modules/gspreadsheet.md
Normal file
@ -0,0 +1,70 @@
|
||||
---
|
||||
title: "Google Spreadsheets"
|
||||
date: 2018-06-10T18:26:26-04:00
|
||||
draft: false
|
||||
---
|
||||
|
||||
Added in `v0.0.7`.
|
||||
|
||||
Display information from cells in a Google Spreadsheet.
|
||||
|
||||
```bash
|
||||
wtf/gspreadsheets/
|
||||
```
|
||||
|
||||
## Required ENV Variables
|
||||
|
||||
None.
|
||||
|
||||
## Keyboard Commands
|
||||
|
||||
None.
|
||||
|
||||
## Configuration
|
||||
|
||||
```yaml
|
||||
gspreadsheets:
|
||||
colors:
|
||||
values: "green"
|
||||
cells:
|
||||
names:
|
||||
- "Cell 1 name"
|
||||
- "Cell 2 name"
|
||||
addresses:
|
||||
- "A1"
|
||||
- "A2"
|
||||
enabled: true
|
||||
position:
|
||||
top: 0
|
||||
left: 0
|
||||
width: 1
|
||||
height: 1
|
||||
refreshInterval: "300"
|
||||
secretFile: "~/.wtf/gspreadsheets/client_secret.json"
|
||||
sheetId: "id_of_google_spreadsheet"
|
||||
```
|
||||
|
||||
### Attributes
|
||||
|
||||
`colors.values` <br />
|
||||
The color to display the cell values in. <br />
|
||||
Values: Any <a href="https://en.wikipedia.org/wiki/X11_color_names">X11 color</a> name.
|
||||
|
||||
`cells.names` <br />
|
||||
|
||||
`cells.addresses` <br />
|
||||
|
||||
`enabled` <br />
|
||||
Whether or not this module is executed and if its data displayed onscreen. <br />
|
||||
Values: `true`, `false`.
|
||||
|
||||
`position` <br />
|
||||
Where in the grid this module's widget will be displayed. <br />
|
||||
|
||||
`refreshInterval` <br />
|
||||
How often, in seconds, this module will update its data. <br />
|
||||
Values: A positive integer, `0..n`.
|
||||
|
||||
`secretFile` <br />
|
||||
Your <a href="https://developers.google.com/sheets/api/quickstart/go">Google client secret</a> JSON file. <br />
|
||||
Values: A string representing a file path to the JSON secret file.
|
62
_site/content/posts/modules/ipapi.md
Normal file
62
_site/content/posts/modules/ipapi.md
Normal file
@ -0,0 +1,62 @@
|
||||
---
|
||||
title: "IP-API"
|
||||
date: 2018-06-10T19:41:52-04:00
|
||||
draft: false
|
||||
---
|
||||
|
||||
Added in `v0.0.7`.
|
||||
|
||||
Displays your current IP address information, from [IP-APIcom](http://ip-api.com).
|
||||
|
||||
**Note:** IP-API.com has a free-plan rate limit of 120 requests per
|
||||
minute.
|
||||
|
||||
## Source Code
|
||||
|
||||
```bash
|
||||
wtf/ipapi/
|
||||
```
|
||||
|
||||
## Required ENV Variables
|
||||
|
||||
None.
|
||||
|
||||
## Keyboard Commands
|
||||
|
||||
None.
|
||||
|
||||
## Configuration
|
||||
|
||||
```yaml
|
||||
ipinfo:
|
||||
colors:
|
||||
name: red
|
||||
value: white
|
||||
enabled: true
|
||||
position:
|
||||
top: 1
|
||||
left: 2
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 150
|
||||
```
|
||||
### Attributes
|
||||
|
||||
`colors.name` <br />
|
||||
The default colour for the row names. <br />
|
||||
Values: Any <a href="https://en.wikipedia.org/wiki/X11_color_names">X11 color</a> name.
|
||||
|
||||
`colors.value` <br />
|
||||
The default colour for the row values. <br />
|
||||
Values: Any <a href="https://en.wikipedia.org/wiki/X11_color_names">X11 color</a> name.
|
||||
|
||||
`enabled` <br />
|
||||
Determines whether or not this module is executed and if its data displayed onscreen. <br />
|
||||
Values: `true`, `false`.
|
||||
|
||||
`position` <br />
|
||||
Defines where in the grid this module's widget will be displayed. <br />
|
||||
|
||||
`refreshInterval` <br />
|
||||
How often, in seconds, this module will update its data. <br />
|
||||
Values: A positive integer, `0..n`.
|
63
_site/content/posts/modules/jenkins.md
Normal file
63
_site/content/posts/modules/jenkins.md
Normal file
@ -0,0 +1,63 @@
|
||||
---
|
||||
title: "Modules: Jenkins"
|
||||
date: 2018-06-09T20:53:35-07:00
|
||||
draft: false
|
||||
---
|
||||
|
||||
Added in `v0.0.8`.
|
||||
|
||||
Displays jenkins status of given builds in a project or view
|
||||
|
||||
<img src="/imgs/modules/jenkins.png" alt="jenkins screenshot",
|
||||
width="320" height="68" alt="jenkins screenshot" />
|
||||
|
||||
## Source Code
|
||||
|
||||
```bash
|
||||
wtf/jenkins/
|
||||
```
|
||||
|
||||
## Required ENV Variables
|
||||
|
||||
<span class="caption">Key:</span> `WTF_JENKINS_API_KEY` <br />
|
||||
<span class="caption">Value:</span> Your <a href="https://wiki.jenkins.io/display/JENKINS/Remote+access+API">Jenkins API</a> key.
|
||||
|
||||
## Keyboard Commands
|
||||
|
||||
None.
|
||||
|
||||
## Configuration
|
||||
|
||||
```yaml
|
||||
jenkins:
|
||||
enabled: true
|
||||
position:
|
||||
top: 2
|
||||
left: 3
|
||||
height: 2
|
||||
width: 3
|
||||
refreshInterval: 300
|
||||
url: "https://jenkins.domain.com/jenkins/view_url"
|
||||
user: "username"
|
||||
```
|
||||
|
||||
### Attributes
|
||||
|
||||
`enabled` <br />
|
||||
Determines whether or not this module is executed and if its data displayed onscreen. <br />
|
||||
Values: `true`, `false`.
|
||||
|
||||
`position` <br />
|
||||
Defines where in the grid this module's widget will be displayed.
|
||||
|
||||
`refreshInterval` <br />
|
||||
How often, in seconds, this module will update its data. <br />
|
||||
Values: A positive integer, `0..n`.
|
||||
|
||||
`user` <br />
|
||||
Your Jenkins username. <br />
|
||||
|
||||
`url` <br />
|
||||
The url to your Jenkins project or view. <br />
|
||||
Values: A valid URI.
|
||||
|
@ -25,6 +25,8 @@ None.
|
||||
|
||||
## Configuration
|
||||
|
||||
### Single Jira Project
|
||||
|
||||
```yaml
|
||||
jira:
|
||||
colors:
|
||||
@ -40,7 +42,32 @@ jira:
|
||||
left: 1
|
||||
height: 1
|
||||
width: 2
|
||||
project: "JIRA"
|
||||
project: "ProjectA"
|
||||
refreshInterval: 900
|
||||
username: "chris.cummer"
|
||||
```
|
||||
|
||||
### Multiple Jira Projects
|
||||
|
||||
If you want to monitor multiple Jira projects, use the following
|
||||
configuration (note the difference in `project`):
|
||||
|
||||
```yaml
|
||||
jira:
|
||||
colors:
|
||||
rows:
|
||||
even: "lightblue"
|
||||
odd: "white"
|
||||
domain: "https://umbrellacorp.atlassian.net"
|
||||
email: "chriscummer@me.com"
|
||||
enabled: true
|
||||
jql: "issueType = Story"
|
||||
position:
|
||||
top: 4
|
||||
left: 1
|
||||
height: 1
|
||||
width: 2
|
||||
project: ["ProjectA", "ProjectB"]
|
||||
refreshInterval: 900
|
||||
username: "chris.cummer"
|
||||
```
|
||||
|
BIN
_site/static/imgs/modules/circleci.png
Normal file
BIN
_site/static/imgs/modules/circleci.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 60 KiB |
BIN
_site/static/imgs/modules/gitlab.png
Normal file
BIN
_site/static/imgs/modules/gitlab.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
BIN
_site/static/imgs/modules/jenkins.png
Normal file
BIN
_site/static/imgs/modules/jenkins.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
@ -24,13 +24,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
@ -67,13 +67,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
BIN
docs/imgs/modules/circleci.png
Normal file
BIN
docs/imgs/modules/circleci.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 60 KiB |
BIN
docs/imgs/modules/gitlab.png
Normal file
BIN
docs/imgs/modules/gitlab.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
BIN
docs/imgs/modules/jenkins.png
Normal file
BIN
docs/imgs/modules/jenkins.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
@ -66,13 +66,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
@ -6,11 +6,86 @@
|
||||
<description>Recent content on WTF - A Terminal Dashboard</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>en-us</language>
|
||||
<lastBuildDate>Mon, 04 Jun 2018 20:06:40 -0700</lastBuildDate>
|
||||
<lastBuildDate>Sun, 10 Jun 2018 19:41:52 -0400</lastBuildDate>
|
||||
|
||||
<atom:link href="https://wtfutil.com/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
<item>
|
||||
<title>IP-API</title>
|
||||
<link>https://wtfutil.com/posts/modules/ipapi/</link>
|
||||
<pubDate>Sun, 10 Jun 2018 19:41:52 -0400</pubDate>
|
||||
|
||||
<guid>https://wtfutil.com/posts/modules/ipapi/</guid>
|
||||
<description>Added in v0.0.7.
|
||||
Displays your current IP address information, from IP-APIcom.
|
||||
Note: IP-API.com has a free-plan rate limit of 120 requests per minute.
|
||||
Source Code wtf/ipapi/ Required ENV Variables None.
|
||||
Keyboard Commands None.
|
||||
Configuration ipinfo:colors:name:redvalue:whiteenabled:trueposition:top:1left:2height:1width:1refreshInterval:150 Attributes colors.name The default colour for the row names. Values: Any X11 color name.
|
||||
colors.value The default colour for the row values. Values: Any X11 color name.
|
||||
enabled Determines whether or not this module is executed and if its data displayed onscreen.</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>CircleCI</title>
|
||||
<link>https://wtfutil.com/posts/modules/circleci/</link>
|
||||
<pubDate>Sun, 10 Jun 2018 19:26:08 -0400</pubDate>
|
||||
|
||||
<guid>https://wtfutil.com/posts/modules/circleci/</guid>
|
||||
<description>Added in v0.0.7.
|
||||
Displays build information for your CircleCI account.
|
||||
Source Code wtf/circleci/ Required ENV Variables Key: WTF_CIRCLE_API_KEY Value: Your CircleCI API token.
|
||||
Keyboard Commands None.
|
||||
Configuration circleci:enabled:trueposition:top:4left:1height:1width:2refreshInterval:900 Attributes enabled Determines whether or not this module is executed and if its data displayed onscreen. Values: true, false.
|
||||
position Defines where in the grid this module&rsquo;s widget will be displayed. refreshInterval How often, in seconds, this module will update its data.</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>Google Spreadsheets</title>
|
||||
<link>https://wtfutil.com/posts/modules/gspreadsheet/</link>
|
||||
<pubDate>Sun, 10 Jun 2018 18:26:26 -0400</pubDate>
|
||||
|
||||
<guid>https://wtfutil.com/posts/modules/gspreadsheet/</guid>
|
||||
<description>Added in v0.0.7.
|
||||
Display information from cells in a Google Spreadsheet.
|
||||
wtf/gspreadsheets/ Required ENV Variables None.
|
||||
Keyboard Commands None.
|
||||
Configuration gspreadsheets:colors:values:&#34;green&#34;cells:names:-&#34;Cell 1 name&#34;-&#34;Cell 2 name&#34;addresses:-&#34;A1&#34;-&#34;A2&#34;enabled:trueposition:top:0left:0width:1height:1refreshInterval:&#34;300&#34;secretFile:&#34;~/.wtf/gspreadsheets/client_secret.json&#34;sheetId:&#34;id_of_google_spreadsheet&#34; Attributes colors.values The color to display the cell values in. Values: Any X11 color name.
|
||||
cells.names cells.addresses enabled Whether or not this module is executed and if its data displayed onscreen. Values: true, false.
|
||||
position Where in the grid this module&rsquo;s widget will be displayed.</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>Modules: Jenkins</title>
|
||||
<link>https://wtfutil.com/posts/modules/jenkins/</link>
|
||||
<pubDate>Sat, 09 Jun 2018 20:53:35 -0700</pubDate>
|
||||
|
||||
<guid>https://wtfutil.com/posts/modules/jenkins/</guid>
|
||||
<description>Added in v0.0.8.
|
||||
Displays jenkins status of given builds in a project or view
|
||||
Source Code wtf/jenkins/ Required ENV Variables Key: WTF_JENKINS_API_KEY Value: Your Jenkins API key.
|
||||
Keyboard Commands None.
|
||||
Configuration jenkins:enabled:trueposition:top:2left:3height:2width:3refreshInterval:300url:&#34;https://jenkins.domain.com/jenkins/view_url&#34;user:&#34;username&#34; Attributes enabled Determines whether or not this module is executed and if its data displayed onscreen. Values: true, false.
|
||||
position Defines where in the grid this module&rsquo;s widget will be displayed.
|
||||
refreshInterval How often, in seconds, this module will update its data.</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>Gitlab</title>
|
||||
<link>https://wtfutil.com/posts/modules/gitlab/</link>
|
||||
<pubDate>Fri, 08 Jun 2018 13:14:11 -0700</pubDate>
|
||||
|
||||
<guid>https://wtfutil.com/posts/modules/gitlab/</guid>
|
||||
<description>Added in v0.0.8.
|
||||
Displays information about your projects hosted on Gitlab:
|
||||
Open Approval Requests All open merge requests that are requesting your approval.
|
||||
Open Merge Requests All open merge requests created by you.
|
||||
Source Code wtf/gitlab/ Required ENV Variables Key: WTF_GITLAB_TOKEN Action: A Gitlab personal access token. Requires at least api access.
|
||||
Keyboard Commands Key: / Action: Open/close the widget&rsquo;s help window.
|
||||
Key: h Action: Show the previous project.</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>Bittrex</title>
|
||||
<link>https://wtfutil.com/posts/modules/cryptocurrencies/bittrex/</link>
|
||||
@ -174,10 +249,8 @@ Key: j Action: Select the next item in the list.</description>
|
||||
<description>Displays all Jira issues assigned to you for the specified project.
|
||||
Source Code wtf/jira/ Required ENV Variables Key: WTF_JIRA_API_KEY Value: Your Jira API key.
|
||||
Keyboard Commands None.
|
||||
Configuration jira:colors:rows:even:&#34;lightblue&#34;odd:&#34;white&#34;domain:&#34;https://umbrellacorp.atlassian.net&#34;email:&#34;chriscummer@me.com&#34;enabled:truejql:&#34;issueType = Story&#34;position:top:4left:1height:1width:2project:&#34;JIRA&#34;refreshInterval:900username:&#34;chris.cummer&#34; Attributes colors.rows.even Define the foreground color for even-numbered rows. Values: Any X11 color name.
|
||||
colors.rows.odd Define the foreground color for odd-numbered rows. Values: Any X11 color name.
|
||||
domain Your Jira corporate domain. Values: A valid URI.
|
||||
email The email address associated with your Jira account.</description>
|
||||
Configuration Single Jira Project jira:colors:rows:even:&#34;lightblue&#34;odd:&#34;white&#34;domain:&#34;https://umbrellacorp.atlassian.net&#34;email:&#34;chriscummer@me.com&#34;enabled:truejql:&#34;issueType = Story&#34;position:top:4left:1height:1width:2project:&#34;ProjectA&#34;refreshInterval:900username:&#34;chris.cummer&#34; Multiple Jira Projects If you want to monitor multiple Jira projects, use the following configuration (note the difference in project):
|
||||
jira:colors:rows:even:&#34;lightblue&#34;odd:&#34;white&#34;domain:&#34;https://umbrellacorp.atlassian.net&#34;email:&#34;chriscummer@me.com&#34;enabled:truejql:&#34;issueType = Story&#34;position:top:4left:1height:1width:2project:[&#34;ProjectA&#34;,&#34;ProjectB&#34;]refreshInterval:900username:&#34;chris.cummer&#34; Attributes colors.rows.even Define the foreground color for even-numbered rows. Values: Any X11 color name.</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
@ -188,9 +261,9 @@ email The email address associated with your Jira account.</description>
|
||||
<guid>https://wtfutil.com/posts/modules/gcal/</guid>
|
||||
<description>Displays your upcoming Google calendar events.
|
||||
Not: Setting up access to Google Calendars for Go is a bit unobvious. Check out Google&rsquo;s Go Quickstart first and if you have problems, then take a look at this comment by WesleydeSouza which offers a slightly different approach.
|
||||
Source Code wtf/gcal/ Required ENV Variables Key: WTF_GOOGLE_CAL_CLIENT_ID Value: Your Google API client ID.
|
||||
Key: WTF_GOOGLE_CAL_CLIENT_SECRET Value: Your Google API client secret.
|
||||
Keyboard Commands None.</description>
|
||||
Source Code wtf/gcal/ Required ENV Variables None.
|
||||
Keyboard Commands None.
|
||||
Configuration gcal:colors:title:&#34;red&#34;description:&#34;lightblue&#34;highlights:-[&#39;1on1|1\/11&#39;,&#39;green&#39;]-[&#39;apple|google|aws&#39;,&#39;blue&#39;]-[&#39;interview|meet&#39;,&#39;magenta&#39;]-[&#39;lunch&#39;,&#39;yellow&#39;]past:&#34;gray&#34;conflictIcon:&#34;🚨&#34;currentIcon:&#34;💥&#34;displayResponseStatus:trueemail:&#34;chriscummer@me.com&#34;enabled:trueeventCount:12position:top:0left:0height:4width:1refreshInterval:300secretFile:&#34;~/.wtf/gcal/client_secret.json&#34;withLocation:true Attributes colors.title The default colour for calendar event titles. Values: Any X11 color name.</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
@ -67,13 +67,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
@ -99,6 +104,41 @@
|
||||
<h1 class="title">Posts</h1>
|
||||
<ul class="posts">
|
||||
<li>
|
||||
<span>
|
||||
<a href="https://wtfutil.com/posts/modules/ipapi/">IP-API</a>
|
||||
|
||||
<time class="pull-right post-list">Jun 10, 2018</time>
|
||||
|
||||
</span>
|
||||
</li><li>
|
||||
<span>
|
||||
<a href="https://wtfutil.com/posts/modules/circleci/">CircleCI</a>
|
||||
|
||||
<time class="pull-right post-list">Jun 10, 2018</time>
|
||||
|
||||
</span>
|
||||
</li><li>
|
||||
<span>
|
||||
<a href="https://wtfutil.com/posts/modules/gspreadsheet/">Google Spreadsheets</a>
|
||||
|
||||
<time class="pull-right post-list">Jun 10, 2018</time>
|
||||
|
||||
</span>
|
||||
</li><li>
|
||||
<span>
|
||||
<a href="https://wtfutil.com/posts/modules/jenkins/">Modules: Jenkins</a>
|
||||
|
||||
<time class="pull-right post-list">Jun 09, 2018</time>
|
||||
|
||||
</span>
|
||||
</li><li>
|
||||
<span>
|
||||
<a href="https://wtfutil.com/posts/modules/gitlab/">Gitlab</a>
|
||||
|
||||
<time class="pull-right post-list">Jun 08, 2018</time>
|
||||
|
||||
</span>
|
||||
</li><li>
|
||||
<span>
|
||||
<a href="https://wtfutil.com/posts/modules/cryptocurrencies/bittrex/">Bittrex</a>
|
||||
|
||||
|
@ -6,11 +6,86 @@
|
||||
<description>Recent content in Posts on WTF - A Terminal Dashboard</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>en-us</language>
|
||||
<lastBuildDate>Mon, 04 Jun 2018 20:06:40 -0700</lastBuildDate>
|
||||
<lastBuildDate>Sun, 10 Jun 2018 19:41:52 -0400</lastBuildDate>
|
||||
|
||||
<atom:link href="https://wtfutil.com/posts/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
<item>
|
||||
<title>IP-API</title>
|
||||
<link>https://wtfutil.com/posts/modules/ipapi/</link>
|
||||
<pubDate>Sun, 10 Jun 2018 19:41:52 -0400</pubDate>
|
||||
|
||||
<guid>https://wtfutil.com/posts/modules/ipapi/</guid>
|
||||
<description>Added in v0.0.7.
|
||||
Displays your current IP address information, from IP-APIcom.
|
||||
Note: IP-API.com has a free-plan rate limit of 120 requests per minute.
|
||||
Source Code wtf/ipapi/ Required ENV Variables None.
|
||||
Keyboard Commands None.
|
||||
Configuration ipinfo:colors:name:redvalue:whiteenabled:trueposition:top:1left:2height:1width:1refreshInterval:150 Attributes colors.name The default colour for the row names. Values: Any X11 color name.
|
||||
colors.value The default colour for the row values. Values: Any X11 color name.
|
||||
enabled Determines whether or not this module is executed and if its data displayed onscreen.</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>CircleCI</title>
|
||||
<link>https://wtfutil.com/posts/modules/circleci/</link>
|
||||
<pubDate>Sun, 10 Jun 2018 19:26:08 -0400</pubDate>
|
||||
|
||||
<guid>https://wtfutil.com/posts/modules/circleci/</guid>
|
||||
<description>Added in v0.0.7.
|
||||
Displays build information for your CircleCI account.
|
||||
Source Code wtf/circleci/ Required ENV Variables Key: WTF_CIRCLE_API_KEY Value: Your CircleCI API token.
|
||||
Keyboard Commands None.
|
||||
Configuration circleci:enabled:trueposition:top:4left:1height:1width:2refreshInterval:900 Attributes enabled Determines whether or not this module is executed and if its data displayed onscreen. Values: true, false.
|
||||
position Defines where in the grid this module&rsquo;s widget will be displayed. refreshInterval How often, in seconds, this module will update its data.</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>Google Spreadsheets</title>
|
||||
<link>https://wtfutil.com/posts/modules/gspreadsheet/</link>
|
||||
<pubDate>Sun, 10 Jun 2018 18:26:26 -0400</pubDate>
|
||||
|
||||
<guid>https://wtfutil.com/posts/modules/gspreadsheet/</guid>
|
||||
<description>Added in v0.0.7.
|
||||
Display information from cells in a Google Spreadsheet.
|
||||
wtf/gspreadsheets/ Required ENV Variables None.
|
||||
Keyboard Commands None.
|
||||
Configuration gspreadsheets:colors:values:&#34;green&#34;cells:names:-&#34;Cell 1 name&#34;-&#34;Cell 2 name&#34;addresses:-&#34;A1&#34;-&#34;A2&#34;enabled:trueposition:top:0left:0width:1height:1refreshInterval:&#34;300&#34;secretFile:&#34;~/.wtf/gspreadsheets/client_secret.json&#34;sheetId:&#34;id_of_google_spreadsheet&#34; Attributes colors.values The color to display the cell values in. Values: Any X11 color name.
|
||||
cells.names cells.addresses enabled Whether or not this module is executed and if its data displayed onscreen. Values: true, false.
|
||||
position Where in the grid this module&rsquo;s widget will be displayed.</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>Modules: Jenkins</title>
|
||||
<link>https://wtfutil.com/posts/modules/jenkins/</link>
|
||||
<pubDate>Sat, 09 Jun 2018 20:53:35 -0700</pubDate>
|
||||
|
||||
<guid>https://wtfutil.com/posts/modules/jenkins/</guid>
|
||||
<description>Added in v0.0.8.
|
||||
Displays jenkins status of given builds in a project or view
|
||||
Source Code wtf/jenkins/ Required ENV Variables Key: WTF_JENKINS_API_KEY Value: Your Jenkins API key.
|
||||
Keyboard Commands None.
|
||||
Configuration jenkins:enabled:trueposition:top:2left:3height:2width:3refreshInterval:300url:&#34;https://jenkins.domain.com/jenkins/view_url&#34;user:&#34;username&#34; Attributes enabled Determines whether or not this module is executed and if its data displayed onscreen. Values: true, false.
|
||||
position Defines where in the grid this module&rsquo;s widget will be displayed.
|
||||
refreshInterval How often, in seconds, this module will update its data.</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>Gitlab</title>
|
||||
<link>https://wtfutil.com/posts/modules/gitlab/</link>
|
||||
<pubDate>Fri, 08 Jun 2018 13:14:11 -0700</pubDate>
|
||||
|
||||
<guid>https://wtfutil.com/posts/modules/gitlab/</guid>
|
||||
<description>Added in v0.0.8.
|
||||
Displays information about your projects hosted on Gitlab:
|
||||
Open Approval Requests All open merge requests that are requesting your approval.
|
||||
Open Merge Requests All open merge requests created by you.
|
||||
Source Code wtf/gitlab/ Required ENV Variables Key: WTF_GITLAB_TOKEN Action: A Gitlab personal access token. Requires at least api access.
|
||||
Keyboard Commands Key: / Action: Open/close the widget&rsquo;s help window.
|
||||
Key: h Action: Show the previous project.</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>Bittrex</title>
|
||||
<link>https://wtfutil.com/posts/modules/cryptocurrencies/bittrex/</link>
|
||||
@ -174,10 +249,8 @@ Key: j Action: Select the next item in the list.</description>
|
||||
<description>Displays all Jira issues assigned to you for the specified project.
|
||||
Source Code wtf/jira/ Required ENV Variables Key: WTF_JIRA_API_KEY Value: Your Jira API key.
|
||||
Keyboard Commands None.
|
||||
Configuration jira:colors:rows:even:&#34;lightblue&#34;odd:&#34;white&#34;domain:&#34;https://umbrellacorp.atlassian.net&#34;email:&#34;chriscummer@me.com&#34;enabled:truejql:&#34;issueType = Story&#34;position:top:4left:1height:1width:2project:&#34;JIRA&#34;refreshInterval:900username:&#34;chris.cummer&#34; Attributes colors.rows.even Define the foreground color for even-numbered rows. Values: Any X11 color name.
|
||||
colors.rows.odd Define the foreground color for odd-numbered rows. Values: Any X11 color name.
|
||||
domain Your Jira corporate domain. Values: A valid URI.
|
||||
email The email address associated with your Jira account.</description>
|
||||
Configuration Single Jira Project jira:colors:rows:even:&#34;lightblue&#34;odd:&#34;white&#34;domain:&#34;https://umbrellacorp.atlassian.net&#34;email:&#34;chriscummer@me.com&#34;enabled:truejql:&#34;issueType = Story&#34;position:top:4left:1height:1width:2project:&#34;ProjectA&#34;refreshInterval:900username:&#34;chris.cummer&#34; Multiple Jira Projects If you want to monitor multiple Jira projects, use the following configuration (note the difference in project):
|
||||
jira:colors:rows:even:&#34;lightblue&#34;odd:&#34;white&#34;domain:&#34;https://umbrellacorp.atlassian.net&#34;email:&#34;chriscummer@me.com&#34;enabled:truejql:&#34;issueType = Story&#34;position:top:4left:1height:1width:2project:[&#34;ProjectA&#34;,&#34;ProjectB&#34;]refreshInterval:900username:&#34;chris.cummer&#34; Attributes colors.rows.even Define the foreground color for even-numbered rows. Values: Any X11 color name.</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
@ -188,9 +261,9 @@ email The email address associated with your Jira account.</description>
|
||||
<guid>https://wtfutil.com/posts/modules/gcal/</guid>
|
||||
<description>Displays your upcoming Google calendar events.
|
||||
Not: Setting up access to Google Calendars for Go is a bit unobvious. Check out Google&rsquo;s Go Quickstart first and if you have problems, then take a look at this comment by WesleydeSouza which offers a slightly different approach.
|
||||
Source Code wtf/gcal/ Required ENV Variables Key: WTF_GOOGLE_CAL_CLIENT_ID Value: Your Google API client ID.
|
||||
Key: WTF_GOOGLE_CAL_CLIENT_SECRET Value: Your Google API client secret.
|
||||
Keyboard Commands None.</description>
|
||||
Source Code wtf/gcal/ Required ENV Variables None.
|
||||
Keyboard Commands None.
|
||||
Configuration gcal:colors:title:&#34;red&#34;description:&#34;lightblue&#34;highlights:-[&#39;1on1|1\/11&#39;,&#39;green&#39;]-[&#39;apple|google|aws&#39;,&#39;blue&#39;]-[&#39;interview|meet&#39;,&#39;magenta&#39;]-[&#39;lunch&#39;,&#39;yellow&#39;]past:&#34;gray&#34;conflictIcon:&#34;🚨&#34;currentIcon:&#34;💥&#34;displayResponseStatus:trueemail:&#34;chriscummer@me.com&#34;enabled:trueeventCount:12position:top:0left:0height:4width:1refreshInterval:300secretFile:&#34;~/.wtf/gcal/client_secret.json&#34;withLocation:true Attributes colors.title The default colour for calendar event titles. Values: Any X11 color name.</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
172
docs/posts/modules/circleci/index.html
Normal file
172
docs/posts/modules/circleci/index.html
Normal file
@ -0,0 +1,172 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-us" class="wf-firasans-n4-active wf-active">
|
||||
<head>
|
||||
<link href="http://gmpg.org/xfn/11" rel="profile">
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<!-- Enable responsiveness on mobile devices -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
|
||||
|
||||
|
||||
<meta name="generator" content="Hugo 0.38.2" />
|
||||
|
||||
<title>CircleCI | WTF - A Terminal Dashboard</title>
|
||||
<meta content="CircleCI - WTF - A Terminal Dashboard" property="og:title">
|
||||
<meta content=" - " property="og:description">
|
||||
<!-- CSS -->
|
||||
<link rel="stylesheet" href="//cdn.rawgit.com/milligram/milligram/master/dist/milligram.min.css">
|
||||
<link href="https://fonts.googleapis.com/css?family=Fira+Sans:300,300i,400,400i|Roboto+Mono:300,300i,400,400i" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/print.css" media="print">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/poole.css">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/hyde.css">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/syntax.css">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/wtf.css">
|
||||
<!-- Font-Awesome -->
|
||||
<script defer src="https://use.fontawesome.com/releases/v5.0.9/js/all.js" integrity="sha384-8iPTk2s/jMVj81dnzb/iFR2sdA7u06vHJyyLlAd4snFpCl/SnyUjRrbdJsw1pGIl" crossorigin="anonymous"></script>
|
||||
|
||||
<!-- Customised CSS -->
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/custom.css">
|
||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<!-- Icons -->
|
||||
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/apple-touch-icon-144-precomposed.png">
|
||||
<link rel="shortcut icon" href="/favicon.png">
|
||||
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="sidebar">
|
||||
<div class="container">
|
||||
<div class="sidebar-about text-center">
|
||||
|
||||
<a href="https://wtfutil.com/"> <img src="/img/wtf.png" alt="WFT Logo" class="" width=""> </a>
|
||||
<p class="lead">
|
||||
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h3 style="color: white;">Content</h3>
|
||||
|
||||
<ul style="list-style-type: none;">
|
||||
<li class="sidebar-list-item-1"><a href="/posts/overview/">Overview</a></li>
|
||||
<li class="sidebar-list-item-1"><a href="/posts/installation/">Installation</a></li>
|
||||
<li class="sidebar-list-item-1"><a href="/posts/configuration/">Configuration</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/configuration/attributes/">Attributes</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/configuration/iterm2/">iTerm2</a></li>
|
||||
<li class="sidebar-list-item-1"><a href="https://github.com/senorprogrammer/wtf/releases">Releases</a></li>
|
||||
</ul>
|
||||
|
||||
<ul style="list-style-type: none;">
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/power/">Power</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/prettyweather/">PrettyWeather</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/security/">Security</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/textfile/">Text File</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/todo/">Todo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/weather/">Weather</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<p class="copyright">
|
||||
© 2018 Chris Cummer.
|
||||
<br />
|
||||
<a href="https://creativecommons.org/licenses/by/4.0">Some Rights Reserved</a>.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content container">
|
||||
<div class="post">
|
||||
<h1>CircleCI</h1>
|
||||
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<span class="text-left post-date meta">
|
||||
|
||||
|
||||
Jun 10, 2018
|
||||
|
||||
|
||||
|
||||
|
||||
<br/>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<p>Added in <code>v0.0.7</code>.</p>
|
||||
|
||||
<p>Displays build information for your CircleCI account.</p>
|
||||
|
||||
<p><img src="/imgs/modules/circleci.png" width="609" height="150" alt="circleci screenshot" /></p>
|
||||
|
||||
<h2 id="source-code">Source Code</h2>
|
||||
<div class="highlight"><pre class="chroma"><code class="language-bash" data-lang="bash">wtf/circleci/</code></pre></div>
|
||||
<h2 id="required-env-variables">Required ENV Variables</h2>
|
||||
|
||||
<p><span class="caption">Key:</span> <code>WTF_CIRCLE_API_KEY</code> <br />
|
||||
<span class="caption">Value:</span> Your <a href="https://circleci.com/account/api">CircleCI API</a>
|
||||
token.</p>
|
||||
|
||||
<h2 id="keyboard-commands">Keyboard Commands</h2>
|
||||
|
||||
<p>None.</p>
|
||||
|
||||
<h2 id="configuration">Configuration</h2>
|
||||
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">circleci<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>enabled<span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="w">
|
||||
</span><span class="w"> </span>position<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>top<span class="p">:</span><span class="w"> </span><span class="m">4</span><span class="w">
|
||||
</span><span class="w"> </span>left<span class="p">:</span><span class="w"> </span><span class="m">1</span><span class="w">
|
||||
</span><span class="w"> </span>height<span class="p">:</span><span class="w"> </span><span class="m">1</span><span class="w">
|
||||
</span><span class="w"> </span>width<span class="p">:</span><span class="w"> </span><span class="m">2</span><span class="w">
|
||||
</span><span class="w"> </span>refreshInterval<span class="p">:</span><span class="w"> </span><span class="m">900</span></code></pre></div>
|
||||
<h3 id="attributes">Attributes</h3>
|
||||
|
||||
<p><code>enabled</code> <br />
|
||||
Determines whether or not this module is executed and if its data displayed onscreen. <br />
|
||||
Values: <code>true</code>, <code>false</code>.</p>
|
||||
|
||||
<p><code>position</code> <br />
|
||||
Defines where in the grid this module’s widget will be displayed. <br /></p>
|
||||
|
||||
<p><code>refreshInterval</code> <br />
|
||||
How often, in seconds, this module will update its data. <br />
|
||||
Values: A positive integer, <code>0..n</code>.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
@ -124,11 +129,7 @@ first and if you have problems, then take a look at this <a href="https://github
|
||||
<div class="highlight"><pre class="chroma"><code class="language-bash" data-lang="bash">wtf/gcal/</code></pre></div>
|
||||
<h2 id="required-env-variables">Required ENV Variables</h2>
|
||||
|
||||
<p><span class="caption">Key:</span> <code>WTF_GOOGLE_CAL_CLIENT_ID</code> <br />
|
||||
<span class="caption">Value:</span> Your <a href="https://developers.google.com/calendar/auth">Google API</a> client ID.</p>
|
||||
|
||||
<p><span class="caption">Key:</span> <code>WTF_GOOGLE_CAL_CLIENT_SECRET</code> <br />
|
||||
<span class="caption">Value:</span> Your <a href="https://developers.google.com/calendar/auth">Google API</a> client secret.</p>
|
||||
<p>None.</p>
|
||||
|
||||
<h2 id="keyboard-commands">Keyboard Commands</h2>
|
||||
|
||||
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
209
docs/posts/modules/gitlab/index.html
Normal file
209
docs/posts/modules/gitlab/index.html
Normal file
@ -0,0 +1,209 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-us" class="wf-firasans-n4-active wf-active">
|
||||
<head>
|
||||
<link href="http://gmpg.org/xfn/11" rel="profile">
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<!-- Enable responsiveness on mobile devices -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
|
||||
|
||||
|
||||
<meta name="generator" content="Hugo 0.38.2" />
|
||||
|
||||
<title>Gitlab | WTF - A Terminal Dashboard</title>
|
||||
<meta content="Gitlab - WTF - A Terminal Dashboard" property="og:title">
|
||||
<meta content=" - " property="og:description">
|
||||
<!-- CSS -->
|
||||
<link rel="stylesheet" href="//cdn.rawgit.com/milligram/milligram/master/dist/milligram.min.css">
|
||||
<link href="https://fonts.googleapis.com/css?family=Fira+Sans:300,300i,400,400i|Roboto+Mono:300,300i,400,400i" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/print.css" media="print">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/poole.css">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/hyde.css">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/syntax.css">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/wtf.css">
|
||||
<!-- Font-Awesome -->
|
||||
<script defer src="https://use.fontawesome.com/releases/v5.0.9/js/all.js" integrity="sha384-8iPTk2s/jMVj81dnzb/iFR2sdA7u06vHJyyLlAd4snFpCl/SnyUjRrbdJsw1pGIl" crossorigin="anonymous"></script>
|
||||
|
||||
<!-- Customised CSS -->
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/custom.css">
|
||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<!-- Icons -->
|
||||
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/apple-touch-icon-144-precomposed.png">
|
||||
<link rel="shortcut icon" href="/favicon.png">
|
||||
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="sidebar">
|
||||
<div class="container">
|
||||
<div class="sidebar-about text-center">
|
||||
|
||||
<a href="https://wtfutil.com/"> <img src="/img/wtf.png" alt="WFT Logo" class="" width=""> </a>
|
||||
<p class="lead">
|
||||
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h3 style="color: white;">Content</h3>
|
||||
|
||||
<ul style="list-style-type: none;">
|
||||
<li class="sidebar-list-item-1"><a href="/posts/overview/">Overview</a></li>
|
||||
<li class="sidebar-list-item-1"><a href="/posts/installation/">Installation</a></li>
|
||||
<li class="sidebar-list-item-1"><a href="/posts/configuration/">Configuration</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/configuration/attributes/">Attributes</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/configuration/iterm2/">iTerm2</a></li>
|
||||
<li class="sidebar-list-item-1"><a href="https://github.com/senorprogrammer/wtf/releases">Releases</a></li>
|
||||
</ul>
|
||||
|
||||
<ul style="list-style-type: none;">
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/power/">Power</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/prettyweather/">PrettyWeather</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/security/">Security</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/textfile/">Text File</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/todo/">Todo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/weather/">Weather</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<p class="copyright">
|
||||
© 2018 Chris Cummer.
|
||||
<br />
|
||||
<a href="https://creativecommons.org/licenses/by/4.0">Some Rights Reserved</a>.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content container">
|
||||
<div class="post">
|
||||
<h1>Gitlab</h1>
|
||||
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<span class="text-left post-date meta">
|
||||
|
||||
|
||||
Jun 08, 2018
|
||||
|
||||
|
||||
|
||||
|
||||
<br/>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<p>Added in <code>v0.0.8</code>.</p>
|
||||
|
||||
<p><img src="/imgs/modules/gitlab.png" width="640" height="384" alt="gitlab screenshot" /></p>
|
||||
|
||||
<p>Displays information about your projects hosted on Gitlab:</p>
|
||||
|
||||
<h4 id="open-approval-requests">Open Approval Requests</h4>
|
||||
|
||||
<p>All open merge requests that are requesting your approval.</p>
|
||||
|
||||
<h4 id="open-merge-requests">Open Merge Requests</h4>
|
||||
|
||||
<p>All open merge requests created by you.</p>
|
||||
|
||||
<h2 id="source-code">Source Code</h2>
|
||||
<div class="highlight"><pre class="chroma"><code class="language-bash" data-lang="bash">wtf/gitlab/</code></pre></div>
|
||||
<h2 id="required-env-variables">Required ENV Variables</h2>
|
||||
|
||||
<p><span class="caption">Key:</span> <code>WTF_GITLAB_TOKEN</code> <br />
|
||||
<span class="caption">Action:</span> A <a href="https://docs.gitlab.com/ce/user/profile/personal_access_tokens.html">Gitlab personal access token</a>. Requires at least <code>api</code> access.</p>
|
||||
|
||||
<h2 id="keyboard-commands">Keyboard Commands</h2>
|
||||
|
||||
<p><span class="caption">Key:</span> <code>/</code> <br />
|
||||
<span class="caption">Action:</span> Open/close the widget’s help window.</p>
|
||||
|
||||
<p><span class="caption">Key:</span> <code>h</code> <br />
|
||||
<span class="caption">Action:</span> Show the previous project.</p>
|
||||
|
||||
<p><span class="caption">Key:</span> <code>l</code> <br />
|
||||
<span class="caption">Action:</span> Show the next project.</p>
|
||||
|
||||
<p><span class="caption">Key:</span> <code>←</code> <br />
|
||||
<span class="caption">Action:</span> Show the previous project.</p>
|
||||
|
||||
<p><span class="caption">Key:</span> <code>→</code> <br />
|
||||
<span class="caption">Action:</span> Show the next project.</p>
|
||||
|
||||
<h2 id="configuration">Configuration</h2>
|
||||
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">gitlab<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>enabled<span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="w">
|
||||
</span><span class="w"> </span>position<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>top<span class="p">:</span><span class="w"> </span><span class="m">2</span><span class="w">
|
||||
</span><span class="w"> </span>left<span class="p">:</span><span class="w"> </span><span class="m">3</span><span class="w">
|
||||
</span><span class="w"> </span>height<span class="p">:</span><span class="w"> </span><span class="m">2</span><span class="w">
|
||||
</span><span class="w"> </span>width<span class="p">:</span><span class="w"> </span><span class="m">2</span><span class="w">
|
||||
</span><span class="w"> </span>refreshInterval<span class="p">:</span><span class="w"> </span><span class="m">300</span><span class="w">
|
||||
</span><span class="w"> </span>projects<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>tasks<span class="p">:</span><span class="w"> </span><span class="s2">"gitlab-org/release"</span><span class="w">
|
||||
</span><span class="w"> </span>gitlab-ce<span class="p">:</span><span class="w"> </span><span class="s2">"gitlab-org"</span><span class="w">
|
||||
</span><span class="w"> </span>username<span class="p">:</span><span class="w"> </span><span class="s2">"senorprogrammer"</span></code></pre></div>
|
||||
<h3 id="attributes">Attributes</h3>
|
||||
|
||||
<p><code>enabled</code> <br />
|
||||
Determines whether or not this module is executed and if its data displayed onscreen. <br />
|
||||
Values: <code>true</code>, <code>false</code>.</p>
|
||||
|
||||
<p><code>position</code> <br />
|
||||
Defines where in the grid this module’s widget will be displayed. <br /></p>
|
||||
|
||||
<p><code>refreshInterval</code> <br />
|
||||
How often, in seconds, this module will update its data. <br />
|
||||
Values: A positive integer, <code>0..n</code>.</p>
|
||||
|
||||
<p><code>domain</code> <br />
|
||||
<em>Optional</em>. Your Gitlab corporate domain. <br />
|
||||
Values: A valid URI.</p>
|
||||
|
||||
<p><code>projects</code> <br />
|
||||
A list of key/value pairs each describing a Gitlab project to fetch data
|
||||
for. <br />
|
||||
<span class="caption">Key:</span> The name of the project. <br />
|
||||
<span class="caption">Value:</span> The namespace of the project.</p>
|
||||
|
||||
<p><code>username</code> <br />
|
||||
Your Gitlab username. Used to figure out which requests require your approval</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
189
docs/posts/modules/gspreadsheet/index.html
Normal file
189
docs/posts/modules/gspreadsheet/index.html
Normal file
@ -0,0 +1,189 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-us" class="wf-firasans-n4-active wf-active">
|
||||
<head>
|
||||
<link href="http://gmpg.org/xfn/11" rel="profile">
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<!-- Enable responsiveness on mobile devices -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
|
||||
|
||||
|
||||
<meta name="generator" content="Hugo 0.38.2" />
|
||||
|
||||
<title>Google Spreadsheets | WTF - A Terminal Dashboard</title>
|
||||
<meta content="Google Spreadsheets - WTF - A Terminal Dashboard" property="og:title">
|
||||
<meta content=" - " property="og:description">
|
||||
<!-- CSS -->
|
||||
<link rel="stylesheet" href="//cdn.rawgit.com/milligram/milligram/master/dist/milligram.min.css">
|
||||
<link href="https://fonts.googleapis.com/css?family=Fira+Sans:300,300i,400,400i|Roboto+Mono:300,300i,400,400i" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/print.css" media="print">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/poole.css">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/hyde.css">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/syntax.css">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/wtf.css">
|
||||
<!-- Font-Awesome -->
|
||||
<script defer src="https://use.fontawesome.com/releases/v5.0.9/js/all.js" integrity="sha384-8iPTk2s/jMVj81dnzb/iFR2sdA7u06vHJyyLlAd4snFpCl/SnyUjRrbdJsw1pGIl" crossorigin="anonymous"></script>
|
||||
|
||||
<!-- Customised CSS -->
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/custom.css">
|
||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<!-- Icons -->
|
||||
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/apple-touch-icon-144-precomposed.png">
|
||||
<link rel="shortcut icon" href="/favicon.png">
|
||||
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="sidebar">
|
||||
<div class="container">
|
||||
<div class="sidebar-about text-center">
|
||||
|
||||
<a href="https://wtfutil.com/"> <img src="/img/wtf.png" alt="WFT Logo" class="" width=""> </a>
|
||||
<p class="lead">
|
||||
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h3 style="color: white;">Content</h3>
|
||||
|
||||
<ul style="list-style-type: none;">
|
||||
<li class="sidebar-list-item-1"><a href="/posts/overview/">Overview</a></li>
|
||||
<li class="sidebar-list-item-1"><a href="/posts/installation/">Installation</a></li>
|
||||
<li class="sidebar-list-item-1"><a href="/posts/configuration/">Configuration</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/configuration/attributes/">Attributes</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/configuration/iterm2/">iTerm2</a></li>
|
||||
<li class="sidebar-list-item-1"><a href="https://github.com/senorprogrammer/wtf/releases">Releases</a></li>
|
||||
</ul>
|
||||
|
||||
<ul style="list-style-type: none;">
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/power/">Power</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/prettyweather/">PrettyWeather</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/security/">Security</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/textfile/">Text File</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/todo/">Todo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/weather/">Weather</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<p class="copyright">
|
||||
© 2018 Chris Cummer.
|
||||
<br />
|
||||
<a href="https://creativecommons.org/licenses/by/4.0">Some Rights Reserved</a>.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content container">
|
||||
<div class="post">
|
||||
<h1>Google Spreadsheets</h1>
|
||||
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<span class="text-left post-date meta">
|
||||
|
||||
|
||||
Jun 10, 2018
|
||||
|
||||
|
||||
|
||||
|
||||
<br/>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<p>Added in <code>v0.0.7</code>.</p>
|
||||
|
||||
<p>Display information from cells in a Google Spreadsheet.</p>
|
||||
<div class="highlight"><pre class="chroma"><code class="language-bash" data-lang="bash">wtf/gspreadsheets/</code></pre></div>
|
||||
<h2 id="required-env-variables">Required ENV Variables</h2>
|
||||
|
||||
<p>None.</p>
|
||||
|
||||
<h2 id="keyboard-commands">Keyboard Commands</h2>
|
||||
|
||||
<p>None.</p>
|
||||
|
||||
<h2 id="configuration">Configuration</h2>
|
||||
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">gspreadsheets<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>colors<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>values<span class="p">:</span><span class="w"> </span><span class="s2">"green"</span><span class="w">
|
||||
</span><span class="w"> </span>cells<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>names<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>-<span class="w"> </span><span class="s2">"Cell 1 name"</span><span class="w">
|
||||
</span><span class="w"> </span>-<span class="w"> </span><span class="s2">"Cell 2 name"</span><span class="w">
|
||||
</span><span class="w"> </span>addresses<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>-<span class="w"> </span><span class="s2">"A1"</span><span class="w">
|
||||
</span><span class="w"> </span>-<span class="w"> </span><span class="s2">"A2"</span><span class="w">
|
||||
</span><span class="w"> </span>enabled<span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="w">
|
||||
</span><span class="w"> </span>position<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>top<span class="p">:</span><span class="w"> </span><span class="m">0</span><span class="w">
|
||||
</span><span class="w"> </span>left<span class="p">:</span><span class="w"> </span><span class="m">0</span><span class="w">
|
||||
</span><span class="w"> </span>width<span class="p">:</span><span class="w"> </span><span class="m">1</span><span class="w">
|
||||
</span><span class="w"> </span>height<span class="p">:</span><span class="w"> </span><span class="m">1</span><span class="w">
|
||||
</span><span class="w"> </span>refreshInterval<span class="p">:</span><span class="w"> </span><span class="s2">"300"</span><span class="w">
|
||||
</span><span class="w"> </span>secretFile<span class="p">:</span><span class="w"> </span><span class="s2">"~/.wtf/gspreadsheets/client_secret.json"</span><span class="w">
|
||||
</span><span class="w"> </span>sheetId<span class="p">:</span><span class="w"> </span><span class="s2">"id_of_google_spreadsheet"</span></code></pre></div>
|
||||
<h3 id="attributes">Attributes</h3>
|
||||
|
||||
<p><code>colors.values</code> <br />
|
||||
The color to display the cell values in. <br />
|
||||
Values: Any <a href="https://en.wikipedia.org/wiki/X11_color_names">X11 color</a> name.</p>
|
||||
|
||||
<p><code>cells.names</code> <br /></p>
|
||||
|
||||
<p><code>cells.addresses</code> <br /></p>
|
||||
|
||||
<p><code>enabled</code> <br />
|
||||
Whether or not this module is executed and if its data displayed onscreen. <br />
|
||||
Values: <code>true</code>, <code>false</code>.</p>
|
||||
|
||||
<p><code>position</code> <br />
|
||||
Where in the grid this module’s widget will be displayed. <br /></p>
|
||||
|
||||
<p><code>refreshInterval</code> <br />
|
||||
How often, in seconds, this module will update its data. <br />
|
||||
Values: A positive integer, <code>0..n</code>.</p>
|
||||
|
||||
<p><code>secretFile</code> <br />
|
||||
Your <a href="https://developers.google.com/sheets/api/quickstart/go">Google client secret</a> JSON file. <br />
|
||||
Values: A string representing a file path to the JSON secret file.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
184
docs/posts/modules/gspreadsheets/index.html
Normal file
184
docs/posts/modules/gspreadsheets/index.html
Normal file
@ -0,0 +1,184 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-us" class="wf-firasans-n4-active wf-active">
|
||||
<head>
|
||||
<link href="http://gmpg.org/xfn/11" rel="profile">
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<!-- Enable responsiveness on mobile devices -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
|
||||
|
||||
|
||||
<meta name="generator" content="Hugo 0.38.2" />
|
||||
|
||||
<title>Google Spreadsheets | WTF - A Terminal Dashboard</title>
|
||||
<meta content="Google Spreadsheets - WTF - A Terminal Dashboard" property="og:title">
|
||||
<meta content=" - " property="og:description">
|
||||
<!-- CSS -->
|
||||
<link rel="stylesheet" href="//cdn.rawgit.com/milligram/milligram/master/dist/milligram.min.css">
|
||||
<link href="https://fonts.googleapis.com/css?family=Fira+Sans:300,300i,400,400i|Roboto+Mono:300,300i,400,400i" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/print.css" media="print">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/poole.css">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/hyde.css">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/syntax.css">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/wtf.css">
|
||||
<!-- Font-Awesome -->
|
||||
<script defer src="https://use.fontawesome.com/releases/v5.0.9/js/all.js" integrity="sha384-8iPTk2s/jMVj81dnzb/iFR2sdA7u06vHJyyLlAd4snFpCl/SnyUjRrbdJsw1pGIl" crossorigin="anonymous"></script>
|
||||
|
||||
<!-- Customised CSS -->
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/custom.css">
|
||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<!-- Icons -->
|
||||
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/apple-touch-icon-144-precomposed.png">
|
||||
<link rel="shortcut icon" href="/favicon.png">
|
||||
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="sidebar">
|
||||
<div class="container">
|
||||
<div class="sidebar-about text-center">
|
||||
|
||||
<a href="https://wtfutil.com/"> <img src="/img/wtf.png" alt="WFT Logo" class="" width=""> </a>
|
||||
<p class="lead">
|
||||
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h3 style="color: white;">Content</h3>
|
||||
|
||||
<ul style="list-style-type: none;">
|
||||
<li class="sidebar-list-item-1"><a href="/posts/overview/">Overview</a></li>
|
||||
<li class="sidebar-list-item-1"><a href="/posts/installation/">Installation</a></li>
|
||||
<li class="sidebar-list-item-1"><a href="/posts/configuration/">Configuration</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/configuration/attributes/">Attributes</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/configuration/iterm2/">iTerm2</a></li>
|
||||
<li class="sidebar-list-item-1"><a href="https://github.com/senorprogrammer/wtf/releases">Releases</a></li>
|
||||
</ul>
|
||||
|
||||
<ul style="list-style-type: none;">
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/power/">Power</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/prettyweather/">PrettyWeather</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/security/">Security</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/textfile/">Text File</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/todo/">Todo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/weather/">Weather</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<p class="copyright">
|
||||
© 2018 Chris Cummer.
|
||||
<br />
|
||||
<a href="https://creativecommons.org/licenses/by/4.0">Some Rights Reserved</a>.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content container">
|
||||
<div class="post">
|
||||
<h1>Google Spreadsheets</h1>
|
||||
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<span class="text-left post-date meta">
|
||||
|
||||
|
||||
Jun 10, 2018
|
||||
|
||||
|
||||
|
||||
|
||||
<br/>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<p>Added in <code>v0.0.7</code>.</p>
|
||||
|
||||
<p>Display information</p>
|
||||
<div class="highlight"><pre class="chroma"><code class="language-bash" data-lang="bash">wtf/gspreadsheets/</code></pre></div>
|
||||
<h2 id="required-env-variables">Required ENV Variables</h2>
|
||||
|
||||
<p>None.</p>
|
||||
|
||||
<h2 id="keyboard-commands">Keyboard Commands</h2>
|
||||
|
||||
<p>None.</p>
|
||||
|
||||
<h2 id="configuration">Configuration</h2>
|
||||
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">gspreadsheets<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>colors<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>values<span class="p">:</span><span class="w"> </span><span class="s2">"green"</span><span class="w">
|
||||
</span><span class="w"> </span>cells<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>names<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>-<span class="w"> </span><span class="s2">"Cell 1 name"</span><span class="w">
|
||||
</span><span class="w"> </span>-<span class="w"> </span><span class="s2">"Cell 2 name"</span><span class="w">
|
||||
</span><span class="w"> </span>addresses<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>-<span class="w"> </span><span class="s2">"A1"</span><span class="w">
|
||||
</span><span class="w"> </span>-<span class="w"> </span><span class="s2">"A2"</span><span class="w">
|
||||
</span><span class="w"> </span>enabled<span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="w">
|
||||
</span><span class="w"> </span>position<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>top<span class="p">:</span><span class="w"> </span><span class="m">0</span><span class="w">
|
||||
</span><span class="w"> </span>left<span class="p">:</span><span class="w"> </span><span class="m">0</span><span class="w">
|
||||
</span><span class="w"> </span>width<span class="p">:</span><span class="w"> </span><span class="m">1</span><span class="w">
|
||||
</span><span class="w"> </span>height<span class="p">:</span><span class="w"> </span><span class="m">1</span><span class="w">
|
||||
</span><span class="w"> </span>refreshInterval<span class="p">:</span><span class="w"> </span><span class="s2">"300"</span><span class="w">
|
||||
</span><span class="w"> </span>secretFile<span class="p">:</span><span class="w"> </span><span class="s2">"~/.wtf/gspreadsheets/client_secret.json"</span><span class="w">
|
||||
</span><span class="w"> </span>sheetId<span class="p">:</span><span class="w"> </span><span class="s2">"id_of_google_spreadsheet"</span></code></pre></div>
|
||||
<h3 id="attributes">Attributes</h3>
|
||||
|
||||
<p><code>colors.values</code> <br />
|
||||
The color to display the cell values in. <br />
|
||||
Values: Any <a href="https://en.wikipedia.org/wiki/X11_color_names">X11 color</a> name.</p>
|
||||
|
||||
<p><code>cells.names</code> <br /></p>
|
||||
|
||||
<p><code>cells.addresses</code> <br /></p>
|
||||
|
||||
<p><code>enabled</code> <br />
|
||||
Whether or not this module is executed and if its data displayed onscreen. <br />
|
||||
Values: <code>true</code>, <code>false</code>.</p>
|
||||
|
||||
<p><code>position</code> <br />
|
||||
Where in the grid this module’s widget will be displayed. <br /></p>
|
||||
|
||||
<p><code>refreshInterval</code> <br />
|
||||
How often, in seconds, this module will update its data. <br />
|
||||
Values: A positive integer, <code>0..n</code>.</p>
|
||||
|
||||
<p><code>secretFile</code> <br />
|
||||
Your <a href="https://developers.google.com/sheets/api/quickstart/go">Google client secret</a> JSON file. <br />
|
||||
Values: A string representing a file path to the JSON secret file.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
182
docs/posts/modules/ipapi/index.html
Normal file
182
docs/posts/modules/ipapi/index.html
Normal file
@ -0,0 +1,182 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-us" class="wf-firasans-n4-active wf-active">
|
||||
<head>
|
||||
<link href="http://gmpg.org/xfn/11" rel="profile">
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<!-- Enable responsiveness on mobile devices -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
|
||||
|
||||
|
||||
<meta name="generator" content="Hugo 0.38.2" />
|
||||
|
||||
<title>IP-API | WTF - A Terminal Dashboard</title>
|
||||
<meta content="IP-API - WTF - A Terminal Dashboard" property="og:title">
|
||||
<meta content=" - " property="og:description">
|
||||
<!-- CSS -->
|
||||
<link rel="stylesheet" href="//cdn.rawgit.com/milligram/milligram/master/dist/milligram.min.css">
|
||||
<link href="https://fonts.googleapis.com/css?family=Fira+Sans:300,300i,400,400i|Roboto+Mono:300,300i,400,400i" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/print.css" media="print">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/poole.css">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/hyde.css">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/syntax.css">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/wtf.css">
|
||||
<!-- Font-Awesome -->
|
||||
<script defer src="https://use.fontawesome.com/releases/v5.0.9/js/all.js" integrity="sha384-8iPTk2s/jMVj81dnzb/iFR2sdA7u06vHJyyLlAd4snFpCl/SnyUjRrbdJsw1pGIl" crossorigin="anonymous"></script>
|
||||
|
||||
<!-- Customised CSS -->
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/custom.css">
|
||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<!-- Icons -->
|
||||
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/apple-touch-icon-144-precomposed.png">
|
||||
<link rel="shortcut icon" href="/favicon.png">
|
||||
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="sidebar">
|
||||
<div class="container">
|
||||
<div class="sidebar-about text-center">
|
||||
|
||||
<a href="https://wtfutil.com/"> <img src="/img/wtf.png" alt="WFT Logo" class="" width=""> </a>
|
||||
<p class="lead">
|
||||
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h3 style="color: white;">Content</h3>
|
||||
|
||||
<ul style="list-style-type: none;">
|
||||
<li class="sidebar-list-item-1"><a href="/posts/overview/">Overview</a></li>
|
||||
<li class="sidebar-list-item-1"><a href="/posts/installation/">Installation</a></li>
|
||||
<li class="sidebar-list-item-1"><a href="/posts/configuration/">Configuration</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/configuration/attributes/">Attributes</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/configuration/iterm2/">iTerm2</a></li>
|
||||
<li class="sidebar-list-item-1"><a href="https://github.com/senorprogrammer/wtf/releases">Releases</a></li>
|
||||
</ul>
|
||||
|
||||
<ul style="list-style-type: none;">
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/power/">Power</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/prettyweather/">PrettyWeather</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/security/">Security</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/textfile/">Text File</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/todo/">Todo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/weather/">Weather</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<p class="copyright">
|
||||
© 2018 Chris Cummer.
|
||||
<br />
|
||||
<a href="https://creativecommons.org/licenses/by/4.0">Some Rights Reserved</a>.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content container">
|
||||
<div class="post">
|
||||
<h1>IP-API</h1>
|
||||
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<span class="text-left post-date meta">
|
||||
|
||||
|
||||
Jun 10, 2018
|
||||
|
||||
|
||||
|
||||
|
||||
<br/>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<p>Added in <code>v0.0.7</code>.</p>
|
||||
|
||||
<p>Displays your current IP address information, from <a href="http://ip-api.com">IP-APIcom</a>.</p>
|
||||
|
||||
<p><strong>Note:</strong> IP-API.com has a free-plan rate limit of 120 requests per
|
||||
minute.</p>
|
||||
|
||||
<h2 id="source-code">Source Code</h2>
|
||||
<div class="highlight"><pre class="chroma"><code class="language-bash" data-lang="bash">wtf/ipapi/</code></pre></div>
|
||||
<h2 id="required-env-variables">Required ENV Variables</h2>
|
||||
|
||||
<p>None.</p>
|
||||
|
||||
<h2 id="keyboard-commands">Keyboard Commands</h2>
|
||||
|
||||
<p>None.</p>
|
||||
|
||||
<h2 id="configuration">Configuration</h2>
|
||||
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">ipinfo<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>colors<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>name<span class="p">:</span><span class="w"> </span>red<span class="w">
|
||||
</span><span class="w"> </span>value<span class="p">:</span><span class="w"> </span>white<span class="w">
|
||||
</span><span class="w"> </span>enabled<span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="w">
|
||||
</span><span class="w"> </span>position<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>top<span class="p">:</span><span class="w"> </span><span class="m">1</span><span class="w">
|
||||
</span><span class="w"> </span>left<span class="p">:</span><span class="w"> </span><span class="m">2</span><span class="w">
|
||||
</span><span class="w"> </span>height<span class="p">:</span><span class="w"> </span><span class="m">1</span><span class="w">
|
||||
</span><span class="w"> </span>width<span class="p">:</span><span class="w"> </span><span class="m">1</span><span class="w">
|
||||
</span><span class="w"> </span>refreshInterval<span class="p">:</span><span class="w"> </span><span class="m">150</span></code></pre></div>
|
||||
<h3 id="attributes">Attributes</h3>
|
||||
|
||||
<p><code>colors.name</code> <br />
|
||||
The default colour for the row names. <br />
|
||||
Values: Any <a href="https://en.wikipedia.org/wiki/X11_color_names">X11 color</a> name.</p>
|
||||
|
||||
<p><code>colors.value</code> <br />
|
||||
The default colour for the row values. <br />
|
||||
Values: Any <a href="https://en.wikipedia.org/wiki/X11_color_names">X11 color</a> name.</p>
|
||||
|
||||
<p><code>enabled</code> <br />
|
||||
Determines whether or not this module is executed and if its data displayed onscreen. <br />
|
||||
Values: <code>true</code>, <code>false</code>.</p>
|
||||
|
||||
<p><code>position</code> <br />
|
||||
Defines where in the grid this module’s widget will be displayed. <br /></p>
|
||||
|
||||
<p><code>refreshInterval</code> <br />
|
||||
How often, in seconds, this module will update its data. <br />
|
||||
Values: A positive integer, <code>0..n</code>.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
181
docs/posts/modules/jenkins/index.html
Normal file
181
docs/posts/modules/jenkins/index.html
Normal file
@ -0,0 +1,181 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-us" class="wf-firasans-n4-active wf-active">
|
||||
<head>
|
||||
<link href="http://gmpg.org/xfn/11" rel="profile">
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<!-- Enable responsiveness on mobile devices -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
|
||||
|
||||
|
||||
<meta name="generator" content="Hugo 0.38.2" />
|
||||
|
||||
<title>Modules: Jenkins | WTF - A Terminal Dashboard</title>
|
||||
<meta content="Modules: Jenkins - WTF - A Terminal Dashboard" property="og:title">
|
||||
<meta content=" - " property="og:description">
|
||||
<!-- CSS -->
|
||||
<link rel="stylesheet" href="//cdn.rawgit.com/milligram/milligram/master/dist/milligram.min.css">
|
||||
<link href="https://fonts.googleapis.com/css?family=Fira+Sans:300,300i,400,400i|Roboto+Mono:300,300i,400,400i" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/print.css" media="print">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/poole.css">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/hyde.css">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/syntax.css">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/wtf.css">
|
||||
<!-- Font-Awesome -->
|
||||
<script defer src="https://use.fontawesome.com/releases/v5.0.9/js/all.js" integrity="sha384-8iPTk2s/jMVj81dnzb/iFR2sdA7u06vHJyyLlAd4snFpCl/SnyUjRrbdJsw1pGIl" crossorigin="anonymous"></script>
|
||||
|
||||
<!-- Customised CSS -->
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/custom.css">
|
||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<!-- Icons -->
|
||||
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/apple-touch-icon-144-precomposed.png">
|
||||
<link rel="shortcut icon" href="/favicon.png">
|
||||
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="sidebar">
|
||||
<div class="container">
|
||||
<div class="sidebar-about text-center">
|
||||
|
||||
<a href="https://wtfutil.com/"> <img src="/img/wtf.png" alt="WFT Logo" class="" width=""> </a>
|
||||
<p class="lead">
|
||||
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h3 style="color: white;">Content</h3>
|
||||
|
||||
<ul style="list-style-type: none;">
|
||||
<li class="sidebar-list-item-1"><a href="/posts/overview/">Overview</a></li>
|
||||
<li class="sidebar-list-item-1"><a href="/posts/installation/">Installation</a></li>
|
||||
<li class="sidebar-list-item-1"><a href="/posts/configuration/">Configuration</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/configuration/attributes/">Attributes</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/configuration/iterm2/">iTerm2</a></li>
|
||||
<li class="sidebar-list-item-1"><a href="https://github.com/senorprogrammer/wtf/releases">Releases</a></li>
|
||||
</ul>
|
||||
|
||||
<ul style="list-style-type: none;">
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/power/">Power</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/prettyweather/">PrettyWeather</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/security/">Security</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/textfile/">Text File</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/todo/">Todo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/weather/">Weather</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<p class="copyright">
|
||||
© 2018 Chris Cummer.
|
||||
<br />
|
||||
<a href="https://creativecommons.org/licenses/by/4.0">Some Rights Reserved</a>.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content container">
|
||||
<div class="post">
|
||||
<h1>Modules: Jenkins</h1>
|
||||
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<span class="text-left post-date meta">
|
||||
|
||||
|
||||
Jun 09, 2018
|
||||
|
||||
|
||||
|
||||
|
||||
<br/>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<p>Added in <code>v0.0.8</code>.</p>
|
||||
|
||||
<p>Displays jenkins status of given builds in a project or view</p>
|
||||
|
||||
<p><img src="/imgs/modules/jenkins.png" alt="jenkins screenshot",
|
||||
width="320" height="68" alt="jenkins screenshot" /></p>
|
||||
|
||||
<h2 id="source-code">Source Code</h2>
|
||||
<div class="highlight"><pre class="chroma"><code class="language-bash" data-lang="bash">wtf/jenkins/</code></pre></div>
|
||||
<h2 id="required-env-variables">Required ENV Variables</h2>
|
||||
|
||||
<p><span class="caption">Key:</span> <code>WTF_JENKINS_API_KEY</code> <br />
|
||||
<span class="caption">Value:</span> Your <a href="https://wiki.jenkins.io/display/JENKINS/Remote+access+API">Jenkins API</a> key.</p>
|
||||
|
||||
<h2 id="keyboard-commands">Keyboard Commands</h2>
|
||||
|
||||
<p>None.</p>
|
||||
|
||||
<h2 id="configuration">Configuration</h2>
|
||||
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">jenkins<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>enabled<span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="w">
|
||||
</span><span class="w"> </span>position<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>top<span class="p">:</span><span class="w"> </span><span class="m">2</span><span class="w">
|
||||
</span><span class="w"> </span>left<span class="p">:</span><span class="w"> </span><span class="m">3</span><span class="w">
|
||||
</span><span class="w"> </span>height<span class="p">:</span><span class="w"> </span><span class="m">2</span><span class="w">
|
||||
</span><span class="w"> </span>width<span class="p">:</span><span class="w"> </span><span class="m">3</span><span class="w">
|
||||
</span><span class="w"> </span>refreshInterval<span class="p">:</span><span class="w"> </span><span class="m">300</span><span class="w">
|
||||
</span><span class="w"> </span>url<span class="p">:</span><span class="w"> </span><span class="s2">"https://jenkins.domain.com/jenkins/view_url"</span><span class="w">
|
||||
</span><span class="w"> </span>user<span class="p">:</span><span class="w"> </span><span class="s2">"username"</span></code></pre></div>
|
||||
<h3 id="attributes">Attributes</h3>
|
||||
|
||||
<p><code>enabled</code> <br />
|
||||
Determines whether or not this module is executed and if its data displayed onscreen. <br />
|
||||
Values: <code>true</code>, <code>false</code>.</p>
|
||||
|
||||
<p><code>position</code> <br />
|
||||
Defines where in the grid this module’s widget will be displayed.</p>
|
||||
|
||||
<p><code>refreshInterval</code> <br />
|
||||
How often, in seconds, this module will update its data. <br />
|
||||
Values: A positive integer, <code>0..n</code>.</p>
|
||||
|
||||
<p><code>user</code> <br />
|
||||
Your Jenkins username. <br /></p>
|
||||
|
||||
<p><code>url</code> <br />
|
||||
The url to your Jenkins project or view. <br />
|
||||
Values: A valid URI.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
@ -129,6 +134,8 @@
|
||||
<p>None.</p>
|
||||
|
||||
<h2 id="configuration">Configuration</h2>
|
||||
|
||||
<h3 id="single-jira-project">Single Jira Project</h3>
|
||||
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">jira<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>colors<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>rows<span class="p">:</span><span class="w">
|
||||
@ -143,7 +150,28 @@
|
||||
</span><span class="w"> </span>left<span class="p">:</span><span class="w"> </span><span class="m">1</span><span class="w">
|
||||
</span><span class="w"> </span>height<span class="p">:</span><span class="w"> </span><span class="m">1</span><span class="w">
|
||||
</span><span class="w"> </span>width<span class="p">:</span><span class="w"> </span><span class="m">2</span><span class="w">
|
||||
</span><span class="w"> </span>project<span class="p">:</span><span class="w"> </span><span class="s2">"JIRA"</span><span class="w">
|
||||
</span><span class="w"> </span>project<span class="p">:</span><span class="w"> </span><span class="s2">"ProjectA"</span><span class="w">
|
||||
</span><span class="w"> </span>refreshInterval<span class="p">:</span><span class="w"> </span><span class="m">900</span><span class="w">
|
||||
</span><span class="w"> </span>username<span class="p">:</span><span class="w"> </span><span class="s2">"chris.cummer"</span></code></pre></div>
|
||||
<h3 id="multiple-jira-projects">Multiple Jira Projects</h3>
|
||||
|
||||
<p>If you want to monitor multiple Jira projects, use the following
|
||||
configuration (note the difference in <code>project</code>):</p>
|
||||
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">jira<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>colors<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>rows<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>even<span class="p">:</span><span class="w"> </span><span class="s2">"lightblue"</span><span class="w">
|
||||
</span><span class="w"> </span>odd<span class="p">:</span><span class="w"> </span><span class="s2">"white"</span><span class="w">
|
||||
</span><span class="w"> </span>domain<span class="p">:</span><span class="w"> </span><span class="s2">"https://umbrellacorp.atlassian.net"</span><span class="w">
|
||||
</span><span class="w"> </span>email<span class="p">:</span><span class="w"> </span><span class="s2">"chriscummer@me.com"</span><span class="w">
|
||||
</span><span class="w"> </span>enabled<span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="w">
|
||||
</span><span class="w"> </span>jql<span class="p">:</span><span class="w"> </span><span class="s2">"issueType = Story"</span><span class="w">
|
||||
</span><span class="w"> </span>position<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>top<span class="p">:</span><span class="w"> </span><span class="m">4</span><span class="w">
|
||||
</span><span class="w"> </span>left<span class="p">:</span><span class="w"> </span><span class="m">1</span><span class="w">
|
||||
</span><span class="w"> </span>height<span class="p">:</span><span class="w"> </span><span class="m">1</span><span class="w">
|
||||
</span><span class="w"> </span>width<span class="p">:</span><span class="w"> </span><span class="m">2</span><span class="w">
|
||||
</span><span class="w"> </span>project<span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"ProjectA"</span><span class="p">,</span><span class="w"> </span><span class="s2">"ProjectB"</span><span class="p">]</span><span class="w">
|
||||
</span><span class="w"> </span>refreshInterval<span class="p">:</span><span class="w"> </span><span class="m">900</span><span class="w">
|
||||
</span><span class="w"> </span>username<span class="p">:</span><span class="w"> </span><span class="s2">"chris.cummer"</span></code></pre></div>
|
||||
<h3 id="attributes">Attributes</h3>
|
||||
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
@ -65,13 +65,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
@ -2,6 +2,31 @@
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<url>
|
||||
<loc>https://wtfutil.com/posts/modules/ipapi/</loc>
|
||||
<lastmod>2018-06-10T19:41:52-04:00</lastmod>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://wtfutil.com/posts/modules/circleci/</loc>
|
||||
<lastmod>2018-06-10T19:26:08-04:00</lastmod>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://wtfutil.com/posts/modules/gspreadsheet/</loc>
|
||||
<lastmod>2018-06-10T18:26:26-04:00</lastmod>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://wtfutil.com/posts/modules/jenkins/</loc>
|
||||
<lastmod>2018-06-09T20:53:35-07:00</lastmod>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://wtfutil.com/posts/modules/gitlab/</loc>
|
||||
<lastmod>2018-06-08T13:14:11-07:00</lastmod>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://wtfutil.com/posts/modules/cryptocurrencies/bittrex/</loc>
|
||||
<lastmod>2018-06-04T20:06:40-07:00</lastmod>
|
||||
@ -134,7 +159,7 @@
|
||||
|
||||
<url>
|
||||
<loc>https://wtfutil.com/posts/</loc>
|
||||
<lastmod>2018-06-04T20:06:40-07:00</lastmod>
|
||||
<lastmod>2018-06-10T19:41:52-04:00</lastmod>
|
||||
<priority>0</priority>
|
||||
</url>
|
||||
|
||||
@ -145,7 +170,7 @@
|
||||
|
||||
<url>
|
||||
<loc>https://wtfutil.com/</loc>
|
||||
<lastmod>2018-06-04T20:06:40-07:00</lastmod>
|
||||
<lastmod>2018-06-10T19:41:52-04:00</lastmod>
|
||||
<priority>0</priority>
|
||||
</url>
|
||||
|
||||
|
@ -67,13 +67,18 @@
|
||||
<li class="sidebar-list-item-1"><a href="/posts/modules/">Modules</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/bamboohr/">BambooHR</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/bittrex/">Bittrex</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/circleci/">CircleCI</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/clocks/">Clocks</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cryptocurrencies/cryptolive/">CryptoLive</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/cmdrunner/">CmdRunner</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/git/">Git</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/github/">GitHub</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gitlab/">Gitlab</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gcal/">Google Calendar</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/gspreadsheet">Google Spreadsheet</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipapi/">IP-API</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/ipinfo/">IPInfo</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jenkins/">Jenkins</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/jira/">Jira</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/newrelic/">New Relic</a></li>
|
||||
<li class="sidebar-list-item-2"><a href="/posts/modules/opsgenie/">OpsGenie</a></li>
|
||||
|
75
gitlab/display.go
Normal file
75
gitlab/display.go
Normal file
@ -0,0 +1,75 @@
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/senorprogrammer/wtf/wtf"
|
||||
)
|
||||
|
||||
func (widget *Widget) display() {
|
||||
|
||||
project := widget.currentGitlabProject()
|
||||
if project == nil {
|
||||
fmt.Fprintf(widget.View, "%s", " Gitlab project data is unavailable (1)")
|
||||
return
|
||||
}
|
||||
|
||||
widget.View.SetTitle(fmt.Sprintf("%s- %s", widget.Name, widget.title(project)))
|
||||
|
||||
str := wtf.SigilStr(len(widget.GitlabProjects), widget.Idx, widget.View) + "\n"
|
||||
str = str + " [red]Stats[white]\n"
|
||||
str = str + widget.displayStats(project)
|
||||
str = str + "\n"
|
||||
str = str + " [red]Open Approval Requests[white]\n"
|
||||
str = str + widget.displayMyApprovalRequests(project, Config.UString("wtf.mods.gitlab.username"))
|
||||
str = str + "\n"
|
||||
str = str + " [red]My Merge Requests[white]\n"
|
||||
str = str + widget.displayMyMergeRequests(project, Config.UString("wtf.mods.gitlab.username"))
|
||||
|
||||
widget.View.SetText(str)
|
||||
}
|
||||
|
||||
func (widget *Widget) displayMyMergeRequests(project *GitlabProject, username string) string {
|
||||
mrs := project.myMergeRequests(username)
|
||||
|
||||
if len(mrs) == 0 {
|
||||
return " [grey]none[white]\n"
|
||||
}
|
||||
|
||||
str := ""
|
||||
for _, mr := range mrs {
|
||||
str = str + fmt.Sprintf(" [green]%4d[white] %s\n", mr.IID, mr.Title)
|
||||
}
|
||||
|
||||
return str
|
||||
}
|
||||
|
||||
func (widget *Widget) displayMyApprovalRequests(project *GitlabProject, username string) string {
|
||||
mrs := project.myApprovalRequests(username)
|
||||
|
||||
if len(mrs) == 0 {
|
||||
return " [grey]none[white]\n"
|
||||
}
|
||||
|
||||
str := ""
|
||||
for _, mr := range mrs {
|
||||
str = str + fmt.Sprintf(" [green]%4d[white] %s\n", mr.IID, mr.Title)
|
||||
}
|
||||
|
||||
return str
|
||||
}
|
||||
|
||||
func (widget *Widget) displayStats(project *GitlabProject) string {
|
||||
str := fmt.Sprintf(
|
||||
" MRs: %d Issues: %d Stars: %d\n",
|
||||
project.MergeRequestCount(),
|
||||
project.IssueCount(),
|
||||
project.StarCount(),
|
||||
)
|
||||
|
||||
return str
|
||||
}
|
||||
|
||||
func (widget *Widget) title(project *GitlabProject) string {
|
||||
return fmt.Sprintf("[green]%s [white]", project.Path)
|
||||
}
|
113
gitlab/gitlab_repo.go
Normal file
113
gitlab/gitlab_repo.go
Normal file
@ -0,0 +1,113 @@
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
glb "github.com/xanzy/go-gitlab"
|
||||
)
|
||||
|
||||
type GitlabProject struct {
|
||||
gitlab *glb.Client
|
||||
Path string
|
||||
|
||||
MergeRequests []*glb.MergeRequest
|
||||
RemoteProject *glb.Project
|
||||
}
|
||||
|
||||
func NewGitlabProject(name string, namespace string, gitlab *glb.Client) *GitlabProject {
|
||||
path := namespace + "/" + name
|
||||
project := GitlabProject{
|
||||
gitlab: gitlab,
|
||||
Path: path,
|
||||
}
|
||||
|
||||
return &project
|
||||
}
|
||||
|
||||
// Refresh reloads the gitlab data via the Gitlab API
|
||||
func (project *GitlabProject) Refresh() {
|
||||
project.MergeRequests, _ = project.loadMergeRequests()
|
||||
project.RemoteProject, _ = project.loadRemoteProject()
|
||||
}
|
||||
|
||||
/* -------------------- Counts -------------------- */
|
||||
|
||||
func (project *GitlabProject) IssueCount() int {
|
||||
if project.RemoteProject == nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
return project.RemoteProject.OpenIssuesCount
|
||||
}
|
||||
|
||||
func (project *GitlabProject) MergeRequestCount() int {
|
||||
return len(project.MergeRequests)
|
||||
}
|
||||
|
||||
func (project *GitlabProject) StarCount() int {
|
||||
if project.RemoteProject == nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
return project.RemoteProject.StarCount
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
// myMergeRequests returns a list of merge requests created by username on this project
|
||||
func (project *GitlabProject) myMergeRequests(username string) []*glb.MergeRequest {
|
||||
mrs := []*glb.MergeRequest{}
|
||||
|
||||
for _, mr := range project.MergeRequests {
|
||||
user := mr.Author
|
||||
|
||||
if user.Username == username {
|
||||
mrs = append(mrs, mr)
|
||||
}
|
||||
}
|
||||
|
||||
return mrs
|
||||
}
|
||||
|
||||
// myApprovalRequests returns a list of merge requests for which username has been
|
||||
// requested to approve
|
||||
func (project *GitlabProject) myApprovalRequests(username string) []*glb.MergeRequest {
|
||||
mrs := []*glb.MergeRequest{}
|
||||
|
||||
for _, mr := range project.MergeRequests {
|
||||
approvers, _, err := project.gitlab.MergeRequests.GetMergeRequestApprovals(project.Path, mr.IID)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
for _, approver := range approvers.Approvers {
|
||||
if approver.User.Username == username {
|
||||
mrs = append(mrs, mr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mrs
|
||||
}
|
||||
|
||||
func (project *GitlabProject) loadMergeRequests() ([]*glb.MergeRequest, error) {
|
||||
state := "opened"
|
||||
opts := glb.ListProjectMergeRequestsOptions{
|
||||
State: &state,
|
||||
}
|
||||
|
||||
mrs, _, err := project.gitlab.MergeRequests.ListProjectMergeRequests(project.Path, &opts)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return mrs, nil
|
||||
}
|
||||
|
||||
func (project *GitlabProject) loadRemoteProject() (*glb.Project, error) {
|
||||
projectsitory, _, err := project.gitlab.Projects.GetProject(project.Path)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return projectsitory, nil
|
||||
}
|
158
gitlab/widget.go
Normal file
158
gitlab/widget.go
Normal file
@ -0,0 +1,158 @@
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/gdamore/tcell"
|
||||
"github.com/olebedev/config"
|
||||
"github.com/rivo/tview"
|
||||
"github.com/senorprogrammer/wtf/wtf"
|
||||
glb "github.com/xanzy/go-gitlab"
|
||||
)
|
||||
|
||||
// Config is a pointer to the global config object
|
||||
var Config *config.Config
|
||||
|
||||
const HelpText = `
|
||||
Keyboard commands for Gitlab:
|
||||
|
||||
/: Show/hide this help window
|
||||
h: Previous project
|
||||
l: Next project
|
||||
r: Refresh the data
|
||||
|
||||
arrow left: Previous project
|
||||
arrow right: Next project
|
||||
`
|
||||
|
||||
type Widget struct {
|
||||
wtf.TextWidget
|
||||
|
||||
app *tview.Application
|
||||
pages *tview.Pages
|
||||
|
||||
gitlab *glb.Client
|
||||
|
||||
GitlabProjects []*GitlabProject
|
||||
Idx int
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
|
||||
apiKey := os.Getenv("WTF_GITLAB_TOKEN")
|
||||
baseURL := Config.UString("wtf.mods.gitlab.domain")
|
||||
gitlab := glb.NewClient(nil, apiKey)
|
||||
if baseURL != "" {
|
||||
gitlab.SetBaseURL(baseURL)
|
||||
}
|
||||
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(" Gitlab ", "gitlab", true),
|
||||
|
||||
app: app,
|
||||
pages: pages,
|
||||
|
||||
gitlab: gitlab,
|
||||
|
||||
Idx: 0,
|
||||
}
|
||||
|
||||
widget.GitlabProjects = widget.buildProjectCollection(Config.UMap("wtf.mods.gitlab.projects"))
|
||||
|
||||
widget.View.SetInputCapture(widget.keyboardIntercept)
|
||||
|
||||
return &widget
|
||||
}
|
||||
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
func (widget *Widget) Refresh() {
|
||||
for _, project := range widget.GitlabProjects {
|
||||
project.Refresh()
|
||||
}
|
||||
|
||||
widget.UpdateRefreshedAt()
|
||||
widget.display()
|
||||
}
|
||||
|
||||
func (widget *Widget) Next() {
|
||||
widget.Idx = widget.Idx + 1
|
||||
if widget.Idx == len(widget.GitlabProjects) {
|
||||
widget.Idx = 0
|
||||
}
|
||||
|
||||
widget.display()
|
||||
}
|
||||
|
||||
func (widget *Widget) Prev() {
|
||||
widget.Idx = widget.Idx - 1
|
||||
if widget.Idx < 0 {
|
||||
widget.Idx = len(widget.GitlabProjects) - 1
|
||||
}
|
||||
|
||||
widget.display()
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func (widget *Widget) buildProjectCollection(projectData map[string]interface{}) []*GitlabProject {
|
||||
gitlabProjects := []*GitlabProject{}
|
||||
|
||||
for name, namespace := range projectData {
|
||||
project := NewGitlabProject(name, namespace.(string), widget.gitlab)
|
||||
gitlabProjects = append(gitlabProjects, project)
|
||||
}
|
||||
|
||||
return gitlabProjects
|
||||
}
|
||||
|
||||
func (widget *Widget) currentGitlabProject() *GitlabProject {
|
||||
if len(widget.GitlabProjects) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
if widget.Idx < 0 || widget.Idx >= len(widget.GitlabProjects) {
|
||||
return nil
|
||||
}
|
||||
|
||||
return widget.GitlabProjects[widget.Idx]
|
||||
}
|
||||
|
||||
func (widget *Widget) keyboardIntercept(event *tcell.EventKey) *tcell.EventKey {
|
||||
switch string(event.Rune()) {
|
||||
case "/":
|
||||
widget.showHelp()
|
||||
return nil
|
||||
case "h":
|
||||
widget.Prev()
|
||||
return nil
|
||||
case "l":
|
||||
widget.Next()
|
||||
return nil
|
||||
case "r":
|
||||
widget.Refresh()
|
||||
return nil
|
||||
}
|
||||
|
||||
switch event.Key() {
|
||||
case tcell.KeyLeft:
|
||||
widget.Prev()
|
||||
return nil
|
||||
case tcell.KeyRight:
|
||||
widget.Next()
|
||||
return nil
|
||||
default:
|
||||
return event
|
||||
}
|
||||
}
|
||||
|
||||
func (widget *Widget) showHelp() {
|
||||
closeFunc := func() {
|
||||
widget.pages.RemovePage("help")
|
||||
widget.app.SetFocus(widget.View)
|
||||
}
|
||||
|
||||
modal := wtf.NewBillboardModal(HelpText, closeFunc)
|
||||
|
||||
widget.pages.AddPage("help", modal, false, true)
|
||||
widget.app.SetFocus(modal)
|
||||
}
|
64
jenkins/client.go
Normal file
64
jenkins/client.go
Normal file
@ -0,0 +1,64 @@
|
||||
package jenkins
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func Create(jenkinsURL string, username string, apiKey string) (*View, error) {
|
||||
const apiSuffix = "api/json?pretty=true"
|
||||
parsedSuffix, err := url.Parse(apiSuffix)
|
||||
if err != nil {
|
||||
return &View{}, err
|
||||
}
|
||||
|
||||
parsedJenkinsURL, err := url.Parse(ensureLastSlash(jenkinsURL))
|
||||
if err != nil {
|
||||
return &View{}, err
|
||||
}
|
||||
jenkinsAPIURL := parsedJenkinsURL.ResolveReference(parsedSuffix)
|
||||
|
||||
req, err := http.NewRequest("GET", jenkinsAPIURL.String(), nil)
|
||||
req.SetBasicAuth(username, apiKey)
|
||||
|
||||
httpClient := &http.Client{}
|
||||
resp, err := httpClient.Do(req)
|
||||
|
||||
if err != nil {
|
||||
return &View{}, err
|
||||
}
|
||||
|
||||
view := &View{}
|
||||
parseJson(view, resp.Body)
|
||||
|
||||
return view, nil
|
||||
}
|
||||
|
||||
func ensureLastSlash(URL string) string {
|
||||
return strings.TrimRight(URL, "/") + "/"
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
|
||||
func parseJson(obj interface{}, text io.Reader) {
|
||||
jsonStream, err := ioutil.ReadAll(text)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
decoder := json.NewDecoder(bytes.NewReader(jsonStream))
|
||||
|
||||
for {
|
||||
if err := decoder.Decode(obj); err == io.EOF {
|
||||
break
|
||||
} else if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
}
|
8
jenkins/job.go
Normal file
8
jenkins/job.go
Normal file
@ -0,0 +1,8 @@
|
||||
package jenkins
|
||||
|
||||
type Job struct {
|
||||
Class string `json:"_class"`
|
||||
Name string `json:"name"`
|
||||
Url string `json:"url"`
|
||||
Color string `json:"color"`
|
||||
}
|
10
jenkins/view.go
Normal file
10
jenkins/view.go
Normal file
@ -0,0 +1,10 @@
|
||||
package jenkins
|
||||
|
||||
type View struct {
|
||||
Class string `json:"_class"`
|
||||
Description string `json:"description"`
|
||||
Jobs []Job `json:"jobs"`
|
||||
Name string `json:"name"`
|
||||
Property []string `json:"property"`
|
||||
url string `json:"url"`
|
||||
}
|
83
jenkins/widget.go
Normal file
83
jenkins/widget.go
Normal file
@ -0,0 +1,83 @@
|
||||
package jenkins
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/olebedev/config"
|
||||
"github.com/senorprogrammer/wtf/wtf"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Config is a pointer to the global config object
|
||||
var Config *config.Config
|
||||
|
||||
type Widget struct {
|
||||
wtf.TextWidget
|
||||
}
|
||||
|
||||
func NewWidget() *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget("Jenkins", "jenkins", false),
|
||||
}
|
||||
|
||||
return &widget
|
||||
}
|
||||
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
func (widget *Widget) Refresh() {
|
||||
if widget.Disabled() {
|
||||
return
|
||||
}
|
||||
|
||||
view, err := Create(Config.UString("wtf.mods.jenkins.url"),
|
||||
Config.UString("wtf.mods.jenkins.user"), os.Getenv("WTF_JENKINS_API_KEY"))
|
||||
|
||||
widget.UpdateRefreshedAt()
|
||||
widget.View.Clear()
|
||||
|
||||
if err != nil {
|
||||
widget.View.SetWrap(true)
|
||||
widget.View.SetTitle(fmt.Sprintf(" %s ", widget.Name))
|
||||
fmt.Fprintf(widget.View, "%v", err)
|
||||
} else {
|
||||
widget.View.SetWrap(false)
|
||||
widget.View.SetTitle(
|
||||
fmt.Sprintf(
|
||||
" %s: [green] ",
|
||||
widget.Name,
|
||||
),
|
||||
)
|
||||
fmt.Fprintf(widget.View, "%s", widget.contentFrom(view))
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func (widget *Widget) contentFrom(view *View) string {
|
||||
str := fmt.Sprintf(" [red]%s[white]\n", view.Name);
|
||||
|
||||
for _, job := range view.Jobs {
|
||||
str = str + fmt.Sprintf(
|
||||
" [%s]%-6s[white]\n",
|
||||
widget.jobColor(&job),
|
||||
job.Name,
|
||||
)
|
||||
}
|
||||
|
||||
return str
|
||||
}
|
||||
|
||||
func (widget *Widget) jobColor(job *Job) string {
|
||||
var color string
|
||||
|
||||
switch job.Color {
|
||||
case "blue":
|
||||
color = "green"
|
||||
case "red":
|
||||
color = "red"
|
||||
default:
|
||||
color = "white"
|
||||
}
|
||||
|
||||
return color
|
||||
}
|
24
vendor/github.com/xanzy/go-gitlab/.gitignore
generated
vendored
Normal file
24
vendor/github.com/xanzy/go-gitlab/.gitignore
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
||||
*.test
|
||||
*.prof
|
27
vendor/github.com/xanzy/go-gitlab/.travis.yml
generated
vendored
Normal file
27
vendor/github.com/xanzy/go-gitlab/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
language: go
|
||||
|
||||
go:
|
||||
- 1.8.x
|
||||
- 1.9.x
|
||||
- 1.10.x
|
||||
- master
|
||||
|
||||
stages:
|
||||
- lint
|
||||
- test
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: lint
|
||||
script:
|
||||
- go get github.com/golang/lint/golint
|
||||
- golint -set_exit_status
|
||||
- go vet -v
|
||||
- stage: test
|
||||
script:
|
||||
- go test -v
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- go: master
|
||||
fast_finish: true
|
27
vendor/github.com/xanzy/go-gitlab/CHANGELOG.md
generated
vendored
Normal file
27
vendor/github.com/xanzy/go-gitlab/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
go-github CHANGELOG
|
||||
===================
|
||||
|
||||
0.6.0
|
||||
-----
|
||||
- Add support for the V4 Gitlab API. This means the older V3 API is no longer fully supported
|
||||
with this version. If you still need that version, please use the `f-api-v3` branch.
|
||||
|
||||
0.4.0
|
||||
-----
|
||||
- Add support to use [`sudo`](https://docs.gitlab.com/ce/api/README.html#sudo) for all API calls.
|
||||
- Add support for the Notification Settings API.
|
||||
- Add support for the Time Tracking API.
|
||||
- Make sure that the error response correctly outputs any returned errors.
|
||||
- And a reasonable number of smaller enhanchements and bugfixes.
|
||||
|
||||
0.3.0
|
||||
-----
|
||||
- Moved the tags related API calls to their own service, following the Gitlab API structure.
|
||||
|
||||
0.2.0
|
||||
-----
|
||||
- Convert all Option structs to use pointers for their fields.
|
||||
|
||||
0.1.0
|
||||
-----
|
||||
- Initial release.
|
202
vendor/github.com/xanzy/go-gitlab/LICENSE
generated
vendored
Normal file
202
vendor/github.com/xanzy/go-gitlab/LICENSE
generated
vendored
Normal file
@ -0,0 +1,202 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
171
vendor/github.com/xanzy/go-gitlab/README.md
generated
vendored
Normal file
171
vendor/github.com/xanzy/go-gitlab/README.md
generated
vendored
Normal file
@ -0,0 +1,171 @@
|
||||
# go-gitlab
|
||||
|
||||
A GitLab API client enabling Go programs to interact with GitLab in a simple and uniform way
|
||||
|
||||
[](https://travis-ci.org/xanzy/go-gitlab)
|
||||
[](https://github.com/xanzy/go-gitlab/blob/master/LICENSE)
|
||||
[](https://sourcegraph.com/github.com/xanzy/go-gitlab?badge)
|
||||
[](https://godoc.org/github.com/xanzy/go-gitlab)
|
||||
[](https://goreportcard.com/report/github.com/xanzy/go-gitlab)
|
||||
[](https://github.com/xanzy/go-gitlab/issues)
|
||||
|
||||
## NOTE
|
||||
|
||||
Release v0.6.0 (released on 25-08-2017) no longer supports the older V3 Gitlab API. If
|
||||
you need V3 support, please use the `f-api-v3` branch. This release contains some backwards
|
||||
incompatible changes that were needed to fully support the V4 Gitlab API.
|
||||
|
||||
## Coverage
|
||||
|
||||
This API client package covers most of the existing Gitlab API calls and is updated regularly
|
||||
to add new and/or missing endpoints. Currently the following services are supported:
|
||||
|
||||
- [x] Award Emojis
|
||||
- [x] Branches
|
||||
- [x] Broadcast Messages
|
||||
- [ ] Project-level Variables
|
||||
- [ ] Group-level Variables
|
||||
- [x] Commits
|
||||
- [ ] Custom Attributes
|
||||
- [x] Deployments
|
||||
- [x] Deploy Keys
|
||||
- [x] Environments
|
||||
- [ ] Epics
|
||||
- [ ] Epic Issues
|
||||
- [x] Events
|
||||
- [x] Feature flags
|
||||
- [ ] Geo Nodes
|
||||
- [x] Gitignores templates
|
||||
- [ ] GitLab CI Config templates
|
||||
- [x] Groups
|
||||
- [ ] Group Access Requests
|
||||
- [x] Group Members
|
||||
- [x] Issues
|
||||
- [x] Issue Boards
|
||||
- [x] Jobs
|
||||
- [ ] Keys
|
||||
- [x] Labels
|
||||
- [ ] License
|
||||
- [x] Merge Requests
|
||||
- [x] Merge Request Approvals
|
||||
- [x] Project Milestones
|
||||
- [ ] Group Milestones
|
||||
- [x] Namespaces
|
||||
- [x] Notes (comments)
|
||||
- [ ] Discussions (threaded comments)
|
||||
- [x] Notification settings
|
||||
- [ ] Open source license templates
|
||||
- [x] Pages Domains
|
||||
- [x] Pipelines
|
||||
- [x] Pipeline Triggers
|
||||
- [x] Pipeline Schedules
|
||||
- [x] Projects (including setting Webhooks)
|
||||
- [ ] Project Access Requests
|
||||
- [ ] Project badges
|
||||
- [ ] Project import/export
|
||||
- [x] Project Members
|
||||
- [x] Project Snippets
|
||||
- [x] Protected Branches
|
||||
- [x] Repositories
|
||||
- [x] Repository Files
|
||||
- [x] Runners
|
||||
- [ ] Search
|
||||
- [x] Services
|
||||
- [x] Settings
|
||||
- [x] Sidekiq metrics
|
||||
- [x] Session
|
||||
- [x] System Hooks
|
||||
- [x] Tags
|
||||
- [x] Todos
|
||||
- [x] Users
|
||||
- [x] Validate CI configuration
|
||||
- [x] Version
|
||||
- [x] Wikis
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
import "github.com/xanzy/go-gitlab"
|
||||
```
|
||||
|
||||
Construct a new GitLab client, then use the various services on the client to
|
||||
access different parts of the GitLab API. For example, to list all
|
||||
users:
|
||||
|
||||
```go
|
||||
git := gitlab.NewClient(nil, "yourtokengoeshere")
|
||||
//git.SetBaseURL("https://git.mydomain.com/api/v3")
|
||||
users, _, err := git.Users.ListUsers()
|
||||
```
|
||||
|
||||
Some API methods have optional parameters that can be passed. For example,
|
||||
to list all projects for user "svanharmelen":
|
||||
|
||||
```go
|
||||
git := gitlab.NewClient(nil)
|
||||
opt := &ListProjectsOptions{Search: gitlab.String("svanharmelen")}
|
||||
projects, _, err := git.Projects.ListProjects(opt)
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
The [examples](https://github.com/xanzy/go-gitlab/tree/master/examples) directory
|
||||
contains a couple for clear examples, of which one is partially listed here as well:
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/xanzy/go-gitlab"
|
||||
)
|
||||
|
||||
func main() {
|
||||
git := gitlab.NewClient(nil, "yourtokengoeshere")
|
||||
|
||||
// Create new project
|
||||
p := &gitlab.CreateProjectOptions{
|
||||
Name: gitlab.String("My Project"),
|
||||
Description: gitlab.String("Just a test project to play with"),
|
||||
MergeRequestsEnabled: gitlab.Bool(true),
|
||||
SnippetsEnabled: gitlab.Bool(true),
|
||||
Visibility: gitlab.Visibility(gitlab.PublicVisibility),
|
||||
}
|
||||
project, _, err := git.Projects.CreateProject(p)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
// Add a new snippet
|
||||
s := &gitlab.CreateProjectSnippetOptions{
|
||||
Title: gitlab.String("Dummy Snippet"),
|
||||
FileName: gitlab.String("snippet.go"),
|
||||
Code: gitlab.String("package main...."),
|
||||
Visibility: gitlab.Visibility(gitlab.PublicVisibility),
|
||||
}
|
||||
_, _, err = git.ProjectSnippets.CreateSnippet(project.ID, s)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
For complete usage of go-gitlab, see the full [package docs](https://godoc.org/github.com/xanzy/go-gitlab).
|
||||
|
||||
## ToDo
|
||||
|
||||
- The biggest thing this package still needs is tests :disappointed:
|
||||
|
||||
## Issues
|
||||
|
||||
- If you have an issue: report it on the [issue tracker](https://github.com/xanzy/go-gitlab/issues)
|
||||
|
||||
## Author
|
||||
|
||||
Sander van Harmelen (<sander@xanzy.io>)
|
||||
|
||||
## License
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at <http://www.apache.org/licenses/LICENSE-2.0>
|
460
vendor/github.com/xanzy/go-gitlab/award_emojis.go
generated
vendored
Normal file
460
vendor/github.com/xanzy/go-gitlab/award_emojis.go
generated
vendored
Normal file
@ -0,0 +1,460 @@
|
||||
//
|
||||
// Copyright 2017, Arkbriar
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"time"
|
||||
)
|
||||
|
||||
// AwardEmojiService handles communication with the emoji awards related methods
|
||||
// of the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/award_emoji.html
|
||||
type AwardEmojiService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// AwardEmoji represents a GitLab Award Emoji.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/award_emoji.html
|
||||
type AwardEmoji struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
User struct {
|
||||
Name string `json:"name"`
|
||||
Username string `json:"username"`
|
||||
ID int `json:"id"`
|
||||
State string `json:"state"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
WebURL string `json:"web_url"`
|
||||
} `json:"user"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updated_at"`
|
||||
AwardableID int `json:"awardable_id"`
|
||||
AwardableType string `json:"awardable_type"`
|
||||
}
|
||||
|
||||
const (
|
||||
awardMergeRequest = "merge_requests"
|
||||
awardIssue = "issues"
|
||||
awardSnippets = "snippets"
|
||||
)
|
||||
|
||||
// ListEmojiAwardsOptions represents the available options for listing emoji
|
||||
// for each resources
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html
|
||||
type ListEmojiAwardsOptions ListOptions
|
||||
|
||||
// ListMergeRequestAwardEmoji gets a list of all award emoji on the merge request.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#list-an-awardable-39-s-award-emoji
|
||||
func (s *AwardEmojiService) ListMergeRequestAwardEmoji(pid interface{}, mergeRequestIID int, opt *ListEmojiAwardsOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) {
|
||||
return s.listAwardEmoji(pid, awardMergeRequest, mergeRequestIID, opt, options...)
|
||||
}
|
||||
|
||||
// ListIssueAwardEmoji gets a list of all award emoji on the issue.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#list-an-awardable-39-s-award-emoji
|
||||
func (s *AwardEmojiService) ListIssueAwardEmoji(pid interface{}, issueIID int, opt *ListEmojiAwardsOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) {
|
||||
return s.listAwardEmoji(pid, awardIssue, issueIID, opt, options...)
|
||||
}
|
||||
|
||||
// ListSnippetAwardEmoji gets a list of all award emoji on the snippet.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#list-an-awardable-39-s-award-emoji
|
||||
func (s *AwardEmojiService) ListSnippetAwardEmoji(pid interface{}, snippetID int, opt *ListEmojiAwardsOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) {
|
||||
return s.listAwardEmoji(pid, awardSnippets, snippetID, opt, options...)
|
||||
}
|
||||
|
||||
func (s *AwardEmojiService) listAwardEmoji(pid interface{}, resource string, resourceID int, opt *ListEmojiAwardsOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/%s/%d/award_emoji",
|
||||
url.QueryEscape(project),
|
||||
resource,
|
||||
resourceID,
|
||||
)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var as []*AwardEmoji
|
||||
resp, err := s.client.Do(req, &as)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return as, resp, err
|
||||
}
|
||||
|
||||
// GetMergeRequestAwardEmoji get an award emoji from merge request.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#list-an-awardable-39-s-award-emoji
|
||||
func (s *AwardEmojiService) GetMergeRequestAwardEmoji(pid interface{}, mergeRequestIID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
|
||||
return s.getAwardEmoji(pid, awardMergeRequest, mergeRequestIID, awardID, options...)
|
||||
}
|
||||
|
||||
// GetIssueAwardEmoji get an award emoji from issue.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#list-an-awardable-39-s-award-emoji
|
||||
func (s *AwardEmojiService) GetIssueAwardEmoji(pid interface{}, issueIID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
|
||||
return s.getAwardEmoji(pid, awardIssue, issueIID, awardID, options...)
|
||||
}
|
||||
|
||||
// GetSnippetAwardEmoji get an award emoji from snippet.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#list-an-awardable-39-s-award-emoji
|
||||
func (s *AwardEmojiService) GetSnippetAwardEmoji(pid interface{}, snippetID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
|
||||
return s.getAwardEmoji(pid, awardSnippets, snippetID, awardID, options...)
|
||||
}
|
||||
|
||||
func (s *AwardEmojiService) getAwardEmoji(pid interface{}, resource string, resourceID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/%s/%d/award_emoji/%d",
|
||||
url.QueryEscape(project),
|
||||
resource,
|
||||
resourceID,
|
||||
awardID,
|
||||
)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
a := new(AwardEmoji)
|
||||
resp, err := s.client.Do(req, &a)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return a, resp, err
|
||||
}
|
||||
|
||||
// CreateMergeRequestAwardEmoji get an award emoji from merge request.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji
|
||||
func (s *AwardEmojiService) CreateMergeRequestAwardEmoji(pid interface{}, mergeRequestIID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
|
||||
return s.createAwardEmoji(pid, awardMergeRequest, mergeRequestIID, awardID, options...)
|
||||
}
|
||||
|
||||
// CreateIssueAwardEmoji get an award emoji from issue.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji
|
||||
func (s *AwardEmojiService) CreateIssueAwardEmoji(pid interface{}, issueIID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
|
||||
return s.createAwardEmoji(pid, awardIssue, issueIID, awardID, options...)
|
||||
}
|
||||
|
||||
// CreateSnippetAwardEmoji get an award emoji from snippet.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji
|
||||
func (s *AwardEmojiService) CreateSnippetAwardEmoji(pid interface{}, snippetID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
|
||||
return s.createAwardEmoji(pid, awardSnippets, snippetID, awardID, options...)
|
||||
}
|
||||
|
||||
func (s *AwardEmojiService) createAwardEmoji(pid interface{}, resource string, resourceID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/%s/%d/award_emoji/%d",
|
||||
url.QueryEscape(project),
|
||||
resource,
|
||||
resourceID,
|
||||
awardID,
|
||||
)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
a := new(AwardEmoji)
|
||||
resp, err := s.client.Do(req, &a)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return a, resp, err
|
||||
}
|
||||
|
||||
// DeleteIssueAwardEmoji delete award emoji on an issue.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji-on-a-note
|
||||
func (s *AwardEmojiService) DeleteIssueAwardEmoji(pid interface{}, issueIID, awardID int, options ...OptionFunc) (*Response, error) {
|
||||
return s.deleteAwardEmoji(pid, awardMergeRequest, issueIID, awardID, options...)
|
||||
}
|
||||
|
||||
// DeleteMergeRequestAwardEmoji delete award emoji on a merge request.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji-on-a-note
|
||||
func (s *AwardEmojiService) DeleteMergeRequestAwardEmoji(pid interface{}, mergeRequestIID, awardID int, options ...OptionFunc) (*Response, error) {
|
||||
return s.deleteAwardEmoji(pid, awardMergeRequest, mergeRequestIID, awardID, options...)
|
||||
}
|
||||
|
||||
// DeleteSnippetAwardEmoji delete award emoji on a snippet.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji-on-a-note
|
||||
func (s *AwardEmojiService) DeleteSnippetAwardEmoji(pid interface{}, snippetID, awardID int, options ...OptionFunc) (*Response, error) {
|
||||
return s.deleteAwardEmoji(pid, awardMergeRequest, snippetID, awardID, options...)
|
||||
}
|
||||
|
||||
// DeleteAwardEmoji Delete an award emoji on the specified resource.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#delete-an-award-emoji
|
||||
func (s *AwardEmojiService) deleteAwardEmoji(pid interface{}, resource string, resourceID, awardID int, options ...OptionFunc) (*Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/%s/%d/award_emoji/%d", url.QueryEscape(project), resource,
|
||||
resourceID, awardID)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return s.client.Do(req, nil)
|
||||
}
|
||||
|
||||
// ListIssuesAwardEmojiOnNote gets a list of all award emoji on a note from the
|
||||
// issue.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
|
||||
func (s *AwardEmojiService) ListIssuesAwardEmojiOnNote(pid interface{}, issueID, noteID int, opt *ListEmojiAwardsOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) {
|
||||
return s.listAwardEmojiOnNote(pid, awardIssue, issueID, noteID, opt, options...)
|
||||
}
|
||||
|
||||
// ListMergeRequestAwardEmojiOnNote gets a list of all award emoji on a note
|
||||
// from the merge request.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
|
||||
func (s *AwardEmojiService) ListMergeRequestAwardEmojiOnNote(pid interface{}, mergeRequestIID, noteID int, opt *ListEmojiAwardsOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) {
|
||||
return s.listAwardEmojiOnNote(pid, awardMergeRequest, mergeRequestIID, noteID, opt, options...)
|
||||
}
|
||||
|
||||
// ListSnippetAwardEmojiOnNote gets a list of all award emoji on a note from the
|
||||
// snippet.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
|
||||
func (s *AwardEmojiService) ListSnippetAwardEmojiOnNote(pid interface{}, snippetIID, noteID int, opt *ListEmojiAwardsOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) {
|
||||
return s.listAwardEmojiOnNote(pid, awardSnippets, snippetIID, noteID, opt, options...)
|
||||
}
|
||||
|
||||
func (s *AwardEmojiService) listAwardEmojiOnNote(pid interface{}, resources string, ressourceID, noteID int, opt *ListEmojiAwardsOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/%s/%d/notes/%d/award_emoji", url.QueryEscape(project), resources,
|
||||
ressourceID, noteID)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var as []*AwardEmoji
|
||||
resp, err := s.client.Do(req, &as)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return as, resp, err
|
||||
}
|
||||
|
||||
// GetIssuesAwardEmojiOnNote gets an award emoji on a note from an issue.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
|
||||
func (s *AwardEmojiService) GetIssuesAwardEmojiOnNote(pid interface{}, issueID, noteID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
|
||||
return s.getSingleNoteAwardEmoji(pid, awardIssue, issueID, noteID, awardID, options...)
|
||||
}
|
||||
|
||||
// GetMergeRequestAwardEmojiOnNote gets an award emoji on a note from a
|
||||
// merge request.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
|
||||
func (s *AwardEmojiService) GetMergeRequestAwardEmojiOnNote(pid interface{}, mergeRequestIID, noteID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
|
||||
return s.getSingleNoteAwardEmoji(pid, awardMergeRequest, mergeRequestIID, noteID, awardID,
|
||||
options...)
|
||||
}
|
||||
|
||||
// GetSnippetAwardEmojiOnNote gets an award emoji on a note from a snippet.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
|
||||
func (s *AwardEmojiService) GetSnippetAwardEmojiOnNote(pid interface{}, snippetIID, noteID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
|
||||
return s.getSingleNoteAwardEmoji(pid, awardSnippets, snippetIID, noteID, awardID, options...)
|
||||
}
|
||||
|
||||
func (s *AwardEmojiService) getSingleNoteAwardEmoji(pid interface{}, ressource string, resourceID, noteID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/%s/%d/notes/%d/award_emoji/%d",
|
||||
url.QueryEscape(project),
|
||||
ressource,
|
||||
resourceID,
|
||||
noteID,
|
||||
awardID,
|
||||
)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
a := new(AwardEmoji)
|
||||
resp, err := s.client.Do(req, &a)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return a, resp, err
|
||||
}
|
||||
|
||||
// CreateIssuesAwardEmojiOnNote gets an award emoji on a note from an issue.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
|
||||
func (s *AwardEmojiService) CreateIssuesAwardEmojiOnNote(pid interface{}, issueID, noteID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
|
||||
return s.createAwardEmojiOnNote(pid, awardIssue, issueID, noteID, options...)
|
||||
}
|
||||
|
||||
// CreateMergeRequestAwardEmojiOnNote gets an award emoji on a note from a
|
||||
// merge request.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
|
||||
func (s *AwardEmojiService) CreateMergeRequestAwardEmojiOnNote(pid interface{}, mergeRequestIID, noteID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
|
||||
return s.createAwardEmojiOnNote(pid, awardMergeRequest, mergeRequestIID, noteID, options...)
|
||||
}
|
||||
|
||||
// CreateSnippetAwardEmojiOnNote gets an award emoji on a note from a snippet.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
|
||||
func (s *AwardEmojiService) CreateSnippetAwardEmojiOnNote(pid interface{}, snippetIID, noteID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
|
||||
return s.createAwardEmojiOnNote(pid, awardSnippets, snippetIID, noteID, options...)
|
||||
}
|
||||
|
||||
// CreateAwardEmojiOnNote award emoji on a note.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji-on-a-note
|
||||
func (s *AwardEmojiService) createAwardEmojiOnNote(pid interface{}, resource string, resourceID, noteID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/%s/%d/notes/%d/award_emoji",
|
||||
url.QueryEscape(project),
|
||||
resource,
|
||||
resourceID,
|
||||
noteID,
|
||||
)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
a := new(AwardEmoji)
|
||||
resp, err := s.client.Do(req, &a)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return a, resp, err
|
||||
}
|
||||
|
||||
// DeleteIssuesAwardEmojiOnNote deletes an award emoji on a note from an issue.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
|
||||
func (s *AwardEmojiService) DeleteIssuesAwardEmojiOnNote(pid interface{}, issueID, noteID, awardID int, options ...OptionFunc) (*Response, error) {
|
||||
return s.deleteAwardEmojiOnNote(pid, awardIssue, issueID, noteID, awardID, options...)
|
||||
}
|
||||
|
||||
// DeleteMergeRequestAwardEmojiOnNote deletes an award emoji on a note from a
|
||||
// merge request.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
|
||||
func (s *AwardEmojiService) DeleteMergeRequestAwardEmojiOnNote(pid interface{}, mergeRequestIID, noteID, awardID int, options ...OptionFunc) (*Response, error) {
|
||||
return s.deleteAwardEmojiOnNote(pid, awardMergeRequest, mergeRequestIID, noteID, awardID,
|
||||
options...)
|
||||
}
|
||||
|
||||
// DeleteSnippetAwardEmojiOnNote deletes an award emoji on a note from a snippet.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
|
||||
func (s *AwardEmojiService) DeleteSnippetAwardEmojiOnNote(pid interface{}, snippetIID, noteID, awardID int, options ...OptionFunc) (*Response, error) {
|
||||
return s.deleteAwardEmojiOnNote(pid, awardSnippets, snippetIID, noteID, awardID, options...)
|
||||
}
|
||||
|
||||
func (s *AwardEmojiService) deleteAwardEmojiOnNote(pid interface{}, resource string, resourceID, noteID, awardID int, options ...OptionFunc) (*Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/%s/%d/notes/%d/award_emoji/%d",
|
||||
url.QueryEscape(project),
|
||||
resource,
|
||||
resourceID,
|
||||
noteID,
|
||||
awardID,
|
||||
)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(req, nil)
|
||||
}
|
261
vendor/github.com/xanzy/go-gitlab/boards.go
generated
vendored
Normal file
261
vendor/github.com/xanzy/go-gitlab/boards.go
generated
vendored
Normal file
@ -0,0 +1,261 @@
|
||||
//
|
||||
// Copyright 2015, Sander van Harmelen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// IssueBoardsService handles communication with the issue board related
|
||||
// methods of the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html
|
||||
type IssueBoardsService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// IssueBoard represents a GitLab issue board.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html
|
||||
type IssueBoard struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Project *Project `json:"project"`
|
||||
Milestone *Milestone `json:"milestone"`
|
||||
Lists []*BoardList `json:"lists"`
|
||||
}
|
||||
|
||||
func (b IssueBoard) String() string {
|
||||
return Stringify(b)
|
||||
}
|
||||
|
||||
// BoardList represents a GitLab board list.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html
|
||||
type BoardList struct {
|
||||
ID int `json:"id"`
|
||||
Labels []*Label `json:"labels"`
|
||||
Position int `json:"position"`
|
||||
}
|
||||
|
||||
func (b BoardList) String() string {
|
||||
return Stringify(b)
|
||||
}
|
||||
|
||||
// ListIssueBoardsOptions represents the available ListIssueBoards() options.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#project-board
|
||||
type ListIssueBoardsOptions ListOptions
|
||||
|
||||
// ListIssueBoards gets a list of all issue boards in a project.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#project-board
|
||||
func (s *IssueBoardsService) ListIssueBoards(pid interface{}, opt *ListIssueBoardsOptions, options ...OptionFunc) ([]*IssueBoard, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/boards", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var is []*IssueBoard
|
||||
resp, err := s.client.Do(req, &is)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return is, resp, err
|
||||
}
|
||||
|
||||
// GetIssueBoard gets a single issue board of a project.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#single-board
|
||||
func (s *IssueBoardsService) GetIssueBoard(pid interface{}, board int, options ...OptionFunc) (*IssueBoard, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/boards/%d", url.QueryEscape(project), board)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
ib := new(IssueBoard)
|
||||
resp, err := s.client.Do(req, ib)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return ib, resp, err
|
||||
}
|
||||
|
||||
// GetIssueBoardListsOptions represents the available GetIssueBoardLists() options.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#list-board-lists
|
||||
type GetIssueBoardListsOptions ListOptions
|
||||
|
||||
// GetIssueBoardLists gets a list of the issue board's lists. Does not include
|
||||
// backlog and closed lists.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#list-board-lists
|
||||
func (s *IssueBoardsService) GetIssueBoardLists(pid interface{}, board int, opt *GetIssueBoardListsOptions, options ...OptionFunc) ([]*BoardList, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/boards/%d/lists", url.QueryEscape(project), board)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var bl []*BoardList
|
||||
resp, err := s.client.Do(req, &bl)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return bl, resp, err
|
||||
}
|
||||
|
||||
// GetIssueBoardList gets a single issue board list.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#single-board-list
|
||||
func (s *IssueBoardsService) GetIssueBoardList(pid interface{}, board, list int, options ...OptionFunc) (*BoardList, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/boards/%d/lists/%d",
|
||||
url.QueryEscape(project),
|
||||
board,
|
||||
list,
|
||||
)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
bl := new(BoardList)
|
||||
resp, err := s.client.Do(req, bl)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return bl, resp, err
|
||||
}
|
||||
|
||||
// CreateIssueBoardListOptions represents the available CreateIssueBoardList()
|
||||
// options.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#new-board-list
|
||||
type CreateIssueBoardListOptions struct {
|
||||
LabelID *int `url:"label_id" json:"label_id"`
|
||||
}
|
||||
|
||||
// CreateIssueBoardList creates a new issue board list.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#new-board-list
|
||||
func (s *IssueBoardsService) CreateIssueBoardList(pid interface{}, board int, opt *CreateIssueBoardListOptions, options ...OptionFunc) (*BoardList, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/boards/%d/lists", url.QueryEscape(project), board)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
bl := new(BoardList)
|
||||
resp, err := s.client.Do(req, bl)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return bl, resp, err
|
||||
}
|
||||
|
||||
// UpdateIssueBoardListOptions represents the available UpdateIssueBoardList()
|
||||
// options.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#edit-board-list
|
||||
type UpdateIssueBoardListOptions struct {
|
||||
Position *int `url:"position" json:"position"`
|
||||
}
|
||||
|
||||
// UpdateIssueBoardList updates the position of an existing issue board list.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#edit-board-list
|
||||
func (s *IssueBoardsService) UpdateIssueBoardList(pid interface{}, board, list int, opt *UpdateIssueBoardListOptions, options ...OptionFunc) (*BoardList, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/boards/%d/lists/%d",
|
||||
url.QueryEscape(project),
|
||||
board,
|
||||
list,
|
||||
)
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
bl := new(BoardList)
|
||||
resp, err := s.client.Do(req, bl)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return bl, resp, err
|
||||
}
|
||||
|
||||
// DeleteIssueBoardList soft deletes an issue board list. Only for admins and
|
||||
// project owners.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/boards.html#delete-a-board-list
|
||||
func (s *IssueBoardsService) DeleteIssueBoardList(pid interface{}, board, list int, options ...OptionFunc) (*Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/boards/%d/lists/%d",
|
||||
url.QueryEscape(project),
|
||||
board,
|
||||
list,
|
||||
)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(req, nil)
|
||||
}
|
238
vendor/github.com/xanzy/go-gitlab/branches.go
generated
vendored
Normal file
238
vendor/github.com/xanzy/go-gitlab/branches.go
generated
vendored
Normal file
@ -0,0 +1,238 @@
|
||||
//
|
||||
// Copyright 2017, Sander van Harmelen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// BranchesService handles communication with the branch related methods
|
||||
// of the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/branches.html
|
||||
type BranchesService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// Branch represents a GitLab branch.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/branches.html
|
||||
type Branch struct {
|
||||
Commit *Commit `json:"commit"`
|
||||
Name string `json:"name"`
|
||||
Protected bool `json:"protected"`
|
||||
Merged bool `json:"merged"`
|
||||
DevelopersCanPush bool `json:"developers_can_push"`
|
||||
DevelopersCanMerge bool `json:"developers_can_merge"`
|
||||
}
|
||||
|
||||
func (b Branch) String() string {
|
||||
return Stringify(b)
|
||||
}
|
||||
|
||||
// ListBranchesOptions represents the available ListBranches() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/branches.html#list-repository-branches
|
||||
type ListBranchesOptions ListOptions
|
||||
|
||||
// ListBranches gets a list of repository branches from a project, sorted by
|
||||
// name alphabetically.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/branches.html#list-repository-branches
|
||||
func (s *BranchesService) ListBranches(pid interface{}, opts *ListBranchesOptions, options ...OptionFunc) ([]*Branch, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/repository/branches", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opts, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var b []*Branch
|
||||
resp, err := s.client.Do(req, &b)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return b, resp, err
|
||||
}
|
||||
|
||||
// GetBranch gets a single project repository branch.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/branches.html#get-single-repository-branch
|
||||
func (s *BranchesService) GetBranch(pid interface{}, branch string, options ...OptionFunc) (*Branch, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/repository/branches/%s", url.QueryEscape(project), url.QueryEscape(branch))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
b := new(Branch)
|
||||
resp, err := s.client.Do(req, b)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return b, resp, err
|
||||
}
|
||||
|
||||
// ProtectBranchOptions represents the available ProtectBranch() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/branches.html#protect-repository-branch
|
||||
type ProtectBranchOptions struct {
|
||||
DevelopersCanPush *bool `url:"developers_can_push,omitempty" json:"developers_can_push,omitempty"`
|
||||
DevelopersCanMerge *bool `url:"developers_can_merge,omitempty" json:"developers_can_merge,omitempty"`
|
||||
}
|
||||
|
||||
// ProtectBranch protects a single project repository branch. This is an
|
||||
// idempotent function, protecting an already protected repository branch
|
||||
// still returns a 200 OK status code.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/branches.html#protect-repository-branch
|
||||
func (s *BranchesService) ProtectBranch(pid interface{}, branch string, opts *ProtectBranchOptions, options ...OptionFunc) (*Branch, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/repository/branches/%s/protect", url.QueryEscape(project), url.QueryEscape(branch))
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opts, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
b := new(Branch)
|
||||
resp, err := s.client.Do(req, b)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return b, resp, err
|
||||
}
|
||||
|
||||
// UnprotectBranch unprotects a single project repository branch. This is an
|
||||
// idempotent function, unprotecting an already unprotected repository branch
|
||||
// still returns a 200 OK status code.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/branches.html#unprotect-repository-branch
|
||||
func (s *BranchesService) UnprotectBranch(pid interface{}, branch string, options ...OptionFunc) (*Branch, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/repository/branches/%s/unprotect", url.QueryEscape(project), url.QueryEscape(branch))
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
b := new(Branch)
|
||||
resp, err := s.client.Do(req, b)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return b, resp, err
|
||||
}
|
||||
|
||||
// CreateBranchOptions represents the available CreateBranch() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/branches.html#create-repository-branch
|
||||
type CreateBranchOptions struct {
|
||||
Branch *string `url:"branch,omitempty" json:"branch,omitempty"`
|
||||
Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
|
||||
}
|
||||
|
||||
// CreateBranch creates branch from commit SHA or existing branch.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/branches.html#create-repository-branch
|
||||
func (s *BranchesService) CreateBranch(pid interface{}, opt *CreateBranchOptions, options ...OptionFunc) (*Branch, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/repository/branches", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
b := new(Branch)
|
||||
resp, err := s.client.Do(req, b)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return b, resp, err
|
||||
}
|
||||
|
||||
// DeleteBranch deletes an existing branch.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/branches.html#delete-repository-branch
|
||||
func (s *BranchesService) DeleteBranch(pid interface{}, branch string, options ...OptionFunc) (*Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/repository/branches/%s", url.QueryEscape(project), url.QueryEscape(branch))
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(req, nil)
|
||||
}
|
||||
|
||||
// DeleteMergedBranches deletes all branches that are merged into the project's default branch.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/branches.html#delete-merged-branches
|
||||
func (s *BranchesService) DeleteMergedBranches(pid interface{}, options ...OptionFunc) (*Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/repository/merged_branches", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(req, nil)
|
||||
}
|
172
vendor/github.com/xanzy/go-gitlab/broadcast_messages.go
generated
vendored
Normal file
172
vendor/github.com/xanzy/go-gitlab/broadcast_messages.go
generated
vendored
Normal file
@ -0,0 +1,172 @@
|
||||
//
|
||||
// Copyright 2018, Sander van Harmelen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
// BroadcastMessagesService handles communication with the broadcast
|
||||
// messages methods of the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/broadcast_messages.html
|
||||
type BroadcastMessagesService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// BroadcastMessage represents a GitLab issue board.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/broadcast_messages.html#get-all-broadcast-messages
|
||||
type BroadcastMessage struct {
|
||||
Message string `json:"message"`
|
||||
StartsAt *time.Time `json:"starts_at"`
|
||||
EndsAt *time.Time `json:"ends_at"`
|
||||
Color string `json:"color"`
|
||||
Font string `json:"font"`
|
||||
ID int `json:"id"`
|
||||
Active bool `json:"active"`
|
||||
}
|
||||
|
||||
// ListBroadcastMessagesOptions represents the available ListBroadcastMessages()
|
||||
// options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/broadcast_messages.html#get-all-broadcast-messages
|
||||
type ListBroadcastMessagesOptions ListOptions
|
||||
|
||||
// ListBroadcastMessages gets a list of all broadcasted messages.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/broadcast_messages.html#get-all-broadcast-messages
|
||||
func (s *BroadcastMessagesService) ListBroadcastMessages(opt *ListBroadcastMessagesOptions, options ...OptionFunc) ([]*BroadcastMessage, *Response, error) {
|
||||
req, err := s.client.NewRequest("GET", "broadcast_messages", opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var bs []*BroadcastMessage
|
||||
resp, err := s.client.Do(req, &bs)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return bs, resp, err
|
||||
}
|
||||
|
||||
// GetBroadcastMessage gets a single broadcast message.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/broadcast_messages.html#get-a-specific-broadcast-message
|
||||
func (s *BroadcastMessagesService) GetBroadcastMessage(broadcast int, options ...OptionFunc) (*BroadcastMessage, *Response, error) {
|
||||
u := fmt.Sprintf("broadcast_messages/%d", broadcast)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
b := new(BroadcastMessage)
|
||||
resp, err := s.client.Do(req, &b)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return b, resp, err
|
||||
}
|
||||
|
||||
// CreateBroadcastMessageOptions represents the available CreateBroadcastMessage()
|
||||
// options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/broadcast_messages.html#create-a-broadcast-message
|
||||
type CreateBroadcastMessageOptions struct {
|
||||
Message *string `url:"message" json:"message"`
|
||||
StartsAt *time.Time `url:"starts_at,omitempty" json:"starts_at,omitempty"`
|
||||
EndsAt *time.Time `url:"ends_at,omitempty" json:"ends_at,omitempty"`
|
||||
Color *string `url:"color,omitempty" json:"color,omitempty"`
|
||||
Font *string `url:"font,omitempty" json:"font,omitempty"`
|
||||
}
|
||||
|
||||
// CreateBroadcastMessage creates a message to broadcast.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/broadcast_messages.html#create-a-broadcast-message
|
||||
func (s *BroadcastMessagesService) CreateBroadcastMessage(opt *CreateBroadcastMessageOptions, options ...OptionFunc) (*BroadcastMessage, *Response, error) {
|
||||
req, err := s.client.NewRequest("POST", "broadcast_messages", opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
b := new(BroadcastMessage)
|
||||
resp, err := s.client.Do(req, &b)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return b, resp, err
|
||||
}
|
||||
|
||||
// UpdateBroadcastMessageOptions represents the available CreateBroadcastMessage()
|
||||
// options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/broadcast_messages.html#update-a-broadcast-message
|
||||
type UpdateBroadcastMessageOptions struct {
|
||||
Message *string `url:"message,omitempty" json:"message,omitempty"`
|
||||
StartsAt *time.Time `url:"starts_at,omitempty" json:"starts_at,omitempty"`
|
||||
EndsAt *time.Time `url:"ends_at,omitempty" json:"ends_at,omitempty"`
|
||||
Color *string `url:"color,omitempty" json:"color,omitempty"`
|
||||
Font *string `url:"font,omitempty" json:"font,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateBroadcastMessage update a broadcasted message.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/broadcast_messages.html#update-a-broadcast-message
|
||||
func (s *BroadcastMessagesService) UpdateBroadcastMessage(broadcast int, opt *UpdateBroadcastMessageOptions, options ...OptionFunc) (*BroadcastMessage, *Response, error) {
|
||||
u := fmt.Sprintf("broadcast_messages/%d", broadcast)
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
b := new(BroadcastMessage)
|
||||
resp, err := s.client.Do(req, &b)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return b, resp, err
|
||||
}
|
||||
|
||||
// DeleteBroadcastMessage deletes a broadcasted message.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/broadcast_messages.html#delete-a-broadcast-message
|
||||
func (s *BroadcastMessagesService) DeleteBroadcastMessage(broadcast int, options ...OptionFunc) (*Response, error) {
|
||||
u := fmt.Sprintf("broadcast_messages/%d", broadcast)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(req, nil)
|
||||
}
|
173
vendor/github.com/xanzy/go-gitlab/build_variables.go
generated
vendored
Normal file
173
vendor/github.com/xanzy/go-gitlab/build_variables.go
generated
vendored
Normal file
@ -0,0 +1,173 @@
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// BuildVariablesService handles communication with the project variables related methods
|
||||
// of the Gitlab API
|
||||
//
|
||||
// Gitlab API Docs : https://docs.gitlab.com/ce/api/build_variables.html
|
||||
type BuildVariablesService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// BuildVariable represents a variable available for each build of the given project
|
||||
//
|
||||
// Gitlab API Docs : https://docs.gitlab.com/ce/api/build_variables.html
|
||||
type BuildVariable struct {
|
||||
Key string `json:"key"`
|
||||
Value string `json:"value"`
|
||||
Protected bool `json:"protected"`
|
||||
}
|
||||
|
||||
func (v BuildVariable) String() string {
|
||||
return Stringify(v)
|
||||
}
|
||||
|
||||
// ListBuildVariablesOptions are the parameters to ListBuildVariables()
|
||||
//
|
||||
// Gitlab API Docs:
|
||||
// https://docs.gitlab.com/ce/api/build_variables.html#list-project-variables
|
||||
type ListBuildVariablesOptions ListOptions
|
||||
|
||||
// ListBuildVariables gets the a list of project variables in a project
|
||||
//
|
||||
// Gitlab API Docs:
|
||||
// https://docs.gitlab.com/ce/api/build_variables.html#list-project-variables
|
||||
func (s *BuildVariablesService) ListBuildVariables(pid interface{}, opts *ListBuildVariablesOptions, options ...OptionFunc) ([]*BuildVariable, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/variables", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opts, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var v []*BuildVariable
|
||||
resp, err := s.client.Do(req, &v)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return v, resp, err
|
||||
}
|
||||
|
||||
// GetBuildVariable gets a single project variable of a project
|
||||
//
|
||||
// Gitlab API Docs:
|
||||
// https://docs.gitlab.com/ce/api/build_variables.html#show-variable-details
|
||||
func (s *BuildVariablesService) GetBuildVariable(pid interface{}, key string, options ...OptionFunc) (*BuildVariable, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/variables/%s", url.QueryEscape(project), key)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
v := new(BuildVariable)
|
||||
resp, err := s.client.Do(req, v)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return v, resp, err
|
||||
}
|
||||
|
||||
// CreateBuildVariableOptions are the parameters to CreateBuildVariable()
|
||||
//
|
||||
// Gitlab API Docs:
|
||||
// https://docs.gitlab.com/ce/api/build_variables.html#create-variable
|
||||
type CreateBuildVariableOptions struct {
|
||||
Key *string `url:"key" json:"key"`
|
||||
Value *string `url:"value" json:"value"`
|
||||
Protected *bool `url:"protected,omitempty" json:"protected,omitempty"`
|
||||
}
|
||||
|
||||
// CreateBuildVariable creates a variable for a given project
|
||||
//
|
||||
// Gitlab API Docs:
|
||||
// https://docs.gitlab.com/ce/api/build_variables.html#create-variable
|
||||
func (s *BuildVariablesService) CreateBuildVariable(pid interface{}, opt *CreateBuildVariableOptions, options ...OptionFunc) (*BuildVariable, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/variables", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
v := new(BuildVariable)
|
||||
resp, err := s.client.Do(req, v)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return v, resp, err
|
||||
}
|
||||
|
||||
// UpdateBuildVariableOptions are the parameters to UpdateBuildVariable()
|
||||
//
|
||||
// Gitlab API Docs:
|
||||
// https://docs.gitlab.com/ce/api/build_variables.html#update-variable
|
||||
type UpdateBuildVariableOptions struct {
|
||||
Key *string `url:"key" json:"key"`
|
||||
Value *string `url:"value" json:"value"`
|
||||
Protected *bool `url:"protected,omitempty" json:"protected,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateBuildVariable updates an existing project variable
|
||||
// The variable key must exist
|
||||
//
|
||||
// Gitlab API Docs:
|
||||
// https://docs.gitlab.com/ce/api/build_variables.html#update-variable
|
||||
func (s *BuildVariablesService) UpdateBuildVariable(pid interface{}, key string, opt *UpdateBuildVariableOptions, options ...OptionFunc) (*BuildVariable, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/variables/%s", url.QueryEscape(project), key)
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
v := new(BuildVariable)
|
||||
resp, err := s.client.Do(req, v)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return v, resp, err
|
||||
}
|
||||
|
||||
// RemoveBuildVariable removes a project variable of a given project identified by its key
|
||||
//
|
||||
// Gitlab API Docs:
|
||||
// https://docs.gitlab.com/ce/api/build_variables.html#remove-variable
|
||||
func (s *BuildVariablesService) RemoveBuildVariable(pid interface{}, key string, options ...OptionFunc) (*Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/variables/%s", url.QueryEscape(project), key)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(req, nil)
|
||||
}
|
448
vendor/github.com/xanzy/go-gitlab/commits.go
generated
vendored
Normal file
448
vendor/github.com/xanzy/go-gitlab/commits.go
generated
vendored
Normal file
@ -0,0 +1,448 @@
|
||||
//
|
||||
// Copyright 2017, Sander van Harmelen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"time"
|
||||
)
|
||||
|
||||
// CommitsService handles communication with the commit related methods
|
||||
// of the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html
|
||||
type CommitsService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// Commit represents a GitLab commit.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html
|
||||
type Commit struct {
|
||||
ID string `json:"id"`
|
||||
ShortID string `json:"short_id"`
|
||||
Title string `json:"title"`
|
||||
AuthorName string `json:"author_name"`
|
||||
AuthorEmail string `json:"author_email"`
|
||||
AuthoredDate *time.Time `json:"authored_date"`
|
||||
CommitterName string `json:"committer_name"`
|
||||
CommitterEmail string `json:"committer_email"`
|
||||
CommittedDate *time.Time `json:"committed_date"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
Message string `json:"message"`
|
||||
ParentIDs []string `json:"parent_ids"`
|
||||
Stats *CommitStats `json:"stats"`
|
||||
Status *BuildStateValue `json:"status"`
|
||||
}
|
||||
|
||||
// CommitStats represents the number of added and deleted files in a commit.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html
|
||||
type CommitStats struct {
|
||||
Additions int `json:"additions"`
|
||||
Deletions int `json:"deletions"`
|
||||
Total int `json:"total"`
|
||||
}
|
||||
|
||||
func (c Commit) String() string {
|
||||
return Stringify(c)
|
||||
}
|
||||
|
||||
// ListCommitsOptions represents the available ListCommits() options.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#list-repository-commits
|
||||
type ListCommitsOptions struct {
|
||||
ListOptions
|
||||
RefName *string `url:"ref_name,omitempty" json:"ref_name,omitempty"`
|
||||
Since *time.Time `url:"since,omitempty" json:"since,omitempty"`
|
||||
Until *time.Time `url:"until,omitempty" json:"until,omitempty"`
|
||||
Path *string `url:"path,omitempty" json:"path,omitempty"`
|
||||
All *bool `url:"all,omitempty" json:"all,omitempty"`
|
||||
}
|
||||
|
||||
// ListCommits gets a list of repository commits in a project.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#list-commits
|
||||
func (s *CommitsService) ListCommits(pid interface{}, opt *ListCommitsOptions, options ...OptionFunc) ([]*Commit, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/repository/commits", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var c []*Commit
|
||||
resp, err := s.client.Do(req, &c)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return c, resp, err
|
||||
}
|
||||
|
||||
// FileAction represents the available actions that can be performed on a file.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
|
||||
type FileAction string
|
||||
|
||||
// The available file actions.
|
||||
const (
|
||||
FileCreate FileAction = "create"
|
||||
FileDelete FileAction = "delete"
|
||||
FileMove FileAction = "move"
|
||||
FileUpdate FileAction = "update"
|
||||
)
|
||||
|
||||
// CommitAction represents a single file action within a commit.
|
||||
type CommitAction struct {
|
||||
Action FileAction `url:"action" json:"action"`
|
||||
FilePath string `url:"file_path" json:"file_path"`
|
||||
PreviousPath string `url:"previous_path,omitempty" json:"previous_path,omitempty"`
|
||||
Content string `url:"content,omitempty" json:"content,omitempty"`
|
||||
Encoding string `url:"encoding,omitempty" json:"encoding,omitempty"`
|
||||
}
|
||||
|
||||
// GetCommit gets a specific commit identified by the commit hash or name of a
|
||||
// branch or tag.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#get-a-single-commit
|
||||
func (s *CommitsService) GetCommit(pid interface{}, sha string, options ...OptionFunc) (*Commit, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/repository/commits/%s", url.QueryEscape(project), sha)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
c := new(Commit)
|
||||
resp, err := s.client.Do(req, c)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return c, resp, err
|
||||
}
|
||||
|
||||
// CreateCommitOptions represents the available options for a new commit.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
|
||||
type CreateCommitOptions struct {
|
||||
Branch *string `url:"branch" json:"branch"`
|
||||
CommitMessage *string `url:"commit_message" json:"commit_message"`
|
||||
StartBranch *string `url:"start_branch,omitempty" json:"start_branch,omitempty"`
|
||||
Actions []*CommitAction `url:"actions" json:"actions"`
|
||||
AuthorEmail *string `url:"author_email,omitempty" json:"author_email,omitempty"`
|
||||
AuthorName *string `url:"author_name,omitempty" json:"author_name,omitempty"`
|
||||
}
|
||||
|
||||
// CreateCommit creates a commit with multiple files and actions.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
|
||||
func (s *CommitsService) CreateCommit(pid interface{}, opt *CreateCommitOptions, options ...OptionFunc) (*Commit, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/repository/commits", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var c *Commit
|
||||
resp, err := s.client.Do(req, &c)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return c, resp, err
|
||||
}
|
||||
|
||||
// Diff represents a GitLab diff.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html
|
||||
type Diff struct {
|
||||
Diff string `json:"diff"`
|
||||
NewPath string `json:"new_path"`
|
||||
OldPath string `json:"old_path"`
|
||||
AMode string `json:"a_mode"`
|
||||
BMode string `json:"b_mode"`
|
||||
NewFile bool `json:"new_file"`
|
||||
RenamedFile bool `json:"renamed_file"`
|
||||
DeletedFile bool `json:"deleted_file"`
|
||||
}
|
||||
|
||||
func (d Diff) String() string {
|
||||
return Stringify(d)
|
||||
}
|
||||
|
||||
// GetCommitDiffOptions represents the available GetCommitDiff() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/commits.html#get-the-diff-of-a-commit
|
||||
type GetCommitDiffOptions ListOptions
|
||||
|
||||
// GetCommitDiff gets the diff of a commit in a project..
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/commits.html#get-the-diff-of-a-commit
|
||||
func (s *CommitsService) GetCommitDiff(pid interface{}, sha string, opt *GetCommitDiffOptions, options ...OptionFunc) ([]*Diff, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/repository/commits/%s/diff", url.QueryEscape(project), sha)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var d []*Diff
|
||||
resp, err := s.client.Do(req, &d)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return d, resp, err
|
||||
}
|
||||
|
||||
// CommitComment represents a GitLab commit comment.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html
|
||||
type CommitComment struct {
|
||||
Note string `json:"note"`
|
||||
Path string `json:"path"`
|
||||
Line int `json:"line"`
|
||||
LineType string `json:"line_type"`
|
||||
Author Author `json:"author"`
|
||||
}
|
||||
|
||||
// Author represents a GitLab commit author
|
||||
type Author struct {
|
||||
ID int `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
Name string `json:"name"`
|
||||
State string `json:"state"`
|
||||
Blocked bool `json:"blocked"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
func (c CommitComment) String() string {
|
||||
return Stringify(c)
|
||||
}
|
||||
|
||||
// GetCommitCommentsOptions represents the available GetCommitComments() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/commits.html#get-the-comments-of-a-commit
|
||||
type GetCommitCommentsOptions ListOptions
|
||||
|
||||
// GetCommitComments gets the comments of a commit in a project.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/commits.html#get-the-comments-of-a-commit
|
||||
func (s *CommitsService) GetCommitComments(pid interface{}, sha string, opt *GetCommitCommentsOptions, options ...OptionFunc) ([]*CommitComment, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/repository/commits/%s/comments", url.QueryEscape(project), sha)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var c []*CommitComment
|
||||
resp, err := s.client.Do(req, &c)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return c, resp, err
|
||||
}
|
||||
|
||||
// PostCommitCommentOptions represents the available PostCommitComment()
|
||||
// options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/commits.html#post-comment-to-commit
|
||||
type PostCommitCommentOptions struct {
|
||||
Note *string `url:"note,omitempty" json:"note,omitempty"`
|
||||
Path *string `url:"path" json:"path"`
|
||||
Line *int `url:"line" json:"line"`
|
||||
LineType *string `url:"line_type" json:"line_type"`
|
||||
}
|
||||
|
||||
// PostCommitComment adds a comment to a commit. Optionally you can post
|
||||
// comments on a specific line of a commit. Therefor both path, line_new and
|
||||
// line_old are required.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/commits.html#post-comment-to-commit
|
||||
func (s *CommitsService) PostCommitComment(pid interface{}, sha string, opt *PostCommitCommentOptions, options ...OptionFunc) (*CommitComment, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/repository/commits/%s/comments", url.QueryEscape(project), sha)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
c := new(CommitComment)
|
||||
resp, err := s.client.Do(req, c)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return c, resp, err
|
||||
}
|
||||
|
||||
// GetCommitStatusesOptions represents the available GetCommitStatuses() options.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#get-the-status-of-a-commit
|
||||
type GetCommitStatusesOptions struct {
|
||||
ListOptions
|
||||
Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
|
||||
Stage *string `url:"stage,omitempty" json:"stage,omitempty"`
|
||||
Name *string `url:"name,omitempty" json:"name,omitempty"`
|
||||
All *bool `url:"all,omitempty" json:"all,omitempty"`
|
||||
}
|
||||
|
||||
// CommitStatus represents a GitLab commit status.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#get-the-status-of-a-commit
|
||||
type CommitStatus struct {
|
||||
ID int `json:"id"`
|
||||
SHA string `json:"sha"`
|
||||
Ref string `json:"ref"`
|
||||
Status string `json:"status"`
|
||||
Name string `json:"name"`
|
||||
TargetURL string `json:"target_url"`
|
||||
Description string `json:"description"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
StartedAt *time.Time `json:"started_at"`
|
||||
FinishedAt *time.Time `json:"finished_at"`
|
||||
Author Author `json:"author"`
|
||||
}
|
||||
|
||||
// GetCommitStatuses gets the statuses of a commit in a project.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#get-the-status-of-a-commit
|
||||
func (s *CommitsService) GetCommitStatuses(pid interface{}, sha string, opt *GetCommitStatusesOptions, options ...OptionFunc) ([]*CommitStatus, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/repository/commits/%s/statuses", url.QueryEscape(project), sha)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var cs []*CommitStatus
|
||||
resp, err := s.client.Do(req, &cs)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return cs, resp, err
|
||||
}
|
||||
|
||||
// SetCommitStatusOptions represents the available SetCommitStatus() options.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#post-the-status-to-commit
|
||||
type SetCommitStatusOptions struct {
|
||||
State BuildStateValue `url:"state" json:"state"`
|
||||
Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
|
||||
Name *string `url:"name,omitempty" json:"name,omitempty"`
|
||||
Context *string `url:"context,omitempty" json:"context,omitempty"`
|
||||
TargetURL *string `url:"target_url,omitempty" json:"target_url,omitempty"`
|
||||
Description *string `url:"description,omitempty" json:"description,omitempty"`
|
||||
}
|
||||
|
||||
// SetCommitStatus sets the status of a commit in a project.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#post-the-status-to-commit
|
||||
func (s *CommitsService) SetCommitStatus(pid interface{}, sha string, opt *SetCommitStatusOptions, options ...OptionFunc) (*CommitStatus, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/statuses/%s", url.QueryEscape(project), sha)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var cs *CommitStatus
|
||||
resp, err := s.client.Do(req, &cs)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return cs, resp, err
|
||||
}
|
||||
|
||||
// CherryPickCommitOptions represents the available options for cherry-picking a commit.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#cherry-pick-a-commit
|
||||
type CherryPickCommitOptions struct {
|
||||
TargetBranch *string `url:"branch" json:"branch,omitempty"`
|
||||
}
|
||||
|
||||
// CherryPickCommit sherry picks a commit to a given branch.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#cherry-pick-a-commit
|
||||
func (s *CommitsService) CherryPickCommit(pid interface{}, sha string, opt *CherryPickCommitOptions, options ...OptionFunc) (*Commit, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/repository/commits/%s/cherry_pick",
|
||||
url.QueryEscape(project), url.QueryEscape(sha))
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var c *Commit
|
||||
resp, err := s.client.Do(req, &c)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return c, resp, err
|
||||
}
|
201
vendor/github.com/xanzy/go-gitlab/deploy_keys.go
generated
vendored
Normal file
201
vendor/github.com/xanzy/go-gitlab/deploy_keys.go
generated
vendored
Normal file
@ -0,0 +1,201 @@
|
||||
//
|
||||
// Copyright 2017, Sander van Harmelen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"time"
|
||||
)
|
||||
|
||||
// DeployKeysService handles communication with the keys related methods
|
||||
// of the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/deploy_keys.html
|
||||
type DeployKeysService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// DeployKey represents a GitLab deploy key.
|
||||
type DeployKey struct {
|
||||
ID int `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Key string `json:"key"`
|
||||
CanPush *bool `json:"can_push"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
func (k DeployKey) String() string {
|
||||
return Stringify(k)
|
||||
}
|
||||
|
||||
// ListAllDeployKeys gets a list of all deploy keys
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/deploy_keys.html#list-all-deploy-keys
|
||||
func (s *DeployKeysService) ListAllDeployKeys(options ...OptionFunc) ([]*DeployKey, *Response, error) {
|
||||
req, err := s.client.NewRequest("GET", "deploy_keys", nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var ks []*DeployKey
|
||||
resp, err := s.client.Do(req, &ks)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return ks, resp, err
|
||||
}
|
||||
|
||||
// ListProjectDeployKeysOptions represents the available ListProjectDeployKeys()
|
||||
// options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/deploy_keys.html#list-project-deploy-keys
|
||||
type ListProjectDeployKeysOptions ListOptions
|
||||
|
||||
// ListProjectDeployKeys gets a list of a project's deploy keys
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/deploy_keys.html#list-project-deploy-keys
|
||||
func (s *DeployKeysService) ListProjectDeployKeys(pid interface{}, opt *ListProjectDeployKeysOptions, options ...OptionFunc) ([]*DeployKey, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/deploy_keys", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var ks []*DeployKey
|
||||
resp, err := s.client.Do(req, &ks)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return ks, resp, err
|
||||
}
|
||||
|
||||
// GetDeployKey gets a single deploy key.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/deploy_keys.html#single-deploy-key
|
||||
func (s *DeployKeysService) GetDeployKey(pid interface{}, deployKey int, options ...OptionFunc) (*DeployKey, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/deploy_keys/%d", url.QueryEscape(project), deployKey)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
k := new(DeployKey)
|
||||
resp, err := s.client.Do(req, k)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return k, resp, err
|
||||
}
|
||||
|
||||
// AddDeployKeyOptions represents the available ADDDeployKey() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/deploy_keys.html#add-deploy-key
|
||||
type AddDeployKeyOptions struct {
|
||||
Title *string `url:"title,omitempty" json:"title,omitempty"`
|
||||
Key *string `url:"key,omitempty" json:"key,omitempty"`
|
||||
CanPush *bool `url:"can_push,omitempty" json:"can_push,omitempty"`
|
||||
}
|
||||
|
||||
// AddDeployKey creates a new deploy key for a project. If deploy key already
|
||||
// exists in another project - it will be joined to project but only if
|
||||
// original one was is accessible by same user.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/deploy_keys.html#add-deploy-key
|
||||
func (s *DeployKeysService) AddDeployKey(pid interface{}, opt *AddDeployKeyOptions, options ...OptionFunc) (*DeployKey, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/deploy_keys", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
k := new(DeployKey)
|
||||
resp, err := s.client.Do(req, k)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return k, resp, err
|
||||
}
|
||||
|
||||
// DeleteDeployKey deletes a deploy key from a project.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/deploy_keys.html#delete-deploy-key
|
||||
func (s *DeployKeysService) DeleteDeployKey(pid interface{}, deployKey int, options ...OptionFunc) (*Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/deploy_keys/%d", url.QueryEscape(project), deployKey)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(req, nil)
|
||||
}
|
||||
|
||||
// EnableDeployKey enables a deploy key.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/deploy_keys.html#enable-deploy-key
|
||||
func (s *DeployKeysService) EnableDeployKey(pid interface{}, deployKey int, options ...OptionFunc) (*DeployKey, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/deploy_keys/%d/enable", url.QueryEscape(project), deployKey)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
k := new(DeployKey)
|
||||
resp, err := s.client.Do(req, k)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return k, resp, err
|
||||
}
|
121
vendor/github.com/xanzy/go-gitlab/deployments.go
generated
vendored
Normal file
121
vendor/github.com/xanzy/go-gitlab/deployments.go
generated
vendored
Normal file
@ -0,0 +1,121 @@
|
||||
//
|
||||
// Copyright 2018, Sander van Harmelen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"time"
|
||||
)
|
||||
|
||||
// DeploymentsService handles communication with the deployment related methods
|
||||
// of the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/deployments.html
|
||||
type DeploymentsService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// Deployment represents the Gitlab deployment
|
||||
type Deployment struct {
|
||||
ID int `json:"id"`
|
||||
IID int `json:"iid"`
|
||||
Ref string `json:"ref"`
|
||||
Sha string `json:"sha"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
User *ProjectUser `json:"user"`
|
||||
Environment *Environment `json:"environment"`
|
||||
Deployable struct {
|
||||
ID int `json:"id"`
|
||||
Status string `json:"status"`
|
||||
Stage string `json:"stage"`
|
||||
Name string `json:"name"`
|
||||
Ref string `json:"ref"`
|
||||
Tag bool `json:"tag"`
|
||||
Coverage float64 `json:"coverage"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
StartedAt *time.Time `json:"started_at"`
|
||||
FinishedAt *time.Time `json:"finished_at"`
|
||||
Duration float64 `json:"duration"`
|
||||
User *User `json:"user"`
|
||||
Commit *Commit `json:"commit"`
|
||||
Pipeline struct {
|
||||
ID int `json:"id"`
|
||||
Sha string `json:"sha"`
|
||||
Ref string `json:"ref"`
|
||||
Status string `json:"status"`
|
||||
} `json:"pipeline"`
|
||||
Runner *Runner `json:"runner"`
|
||||
} `json:"deployable"`
|
||||
}
|
||||
|
||||
// ListProjectDeploymentsOptions represents the available ListProjectDeployments() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/deployments.html#list-project-deployments
|
||||
type ListProjectDeploymentsOptions struct {
|
||||
ListOptions
|
||||
OrderBy *OrderByValue `url:"order_by,omitempty" json:"order_by,omitempty"`
|
||||
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
|
||||
}
|
||||
|
||||
// ListProjectDeployments gets a list of deployments in a project.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/deployments.html#list-project-deployments
|
||||
func (s *DeploymentsService) ListProjectDeployments(pid interface{}, opts *ListProjectDeploymentsOptions, options ...OptionFunc) ([]*Deployment, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/deployments", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opts, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var ds []*Deployment
|
||||
resp, err := s.client.Do(req, &ds)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return ds, resp, err
|
||||
}
|
||||
|
||||
// GetProjectDeployment get a deployment for a project.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/deployments.html#get-a-specific-deployment
|
||||
func (s *DeploymentsService) GetProjectDeployment(pid interface{}, deployment int, options ...OptionFunc) (*Deployment, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/deployments/%d", url.QueryEscape(project), deployment)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
d := new(Deployment)
|
||||
resp, err := s.client.Do(req, d)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return d, resp, err
|
||||
}
|
166
vendor/github.com/xanzy/go-gitlab/environments.go
generated
vendored
Normal file
166
vendor/github.com/xanzy/go-gitlab/environments.go
generated
vendored
Normal file
@ -0,0 +1,166 @@
|
||||
//
|
||||
// Copyright 2017, Sander van Harmelen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// EnvironmentsService handles communication with the environment related methods
|
||||
// of the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/environments.html
|
||||
type EnvironmentsService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// Environment represents a GitLab environment.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/environments.html
|
||||
type Environment struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Slug string `json:"slug"`
|
||||
ExternalURL string `json:"external_url"`
|
||||
}
|
||||
|
||||
func (env Environment) String() string {
|
||||
return Stringify(env)
|
||||
}
|
||||
|
||||
// ListEnvironmentsOptions represents the available ListEnvironments() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ee/api/environments.html#list-environments
|
||||
type ListEnvironmentsOptions ListOptions
|
||||
|
||||
// ListEnvironments gets a list of environments from a project, sorted by name
|
||||
// alphabetically.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ee/api/environments.html#list-environments
|
||||
func (s *EnvironmentsService) ListEnvironments(pid interface{}, opts *ListEnvironmentsOptions, options ...OptionFunc) ([]*Environment, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/environments", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opts, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var envs []*Environment
|
||||
resp, err := s.client.Do(req, &envs)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return envs, resp, err
|
||||
}
|
||||
|
||||
// CreateEnvironmentOptions represents the available CreateEnvironment() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ee/api/environments.html#create-a-new-environment
|
||||
type CreateEnvironmentOptions struct {
|
||||
Name *string `url:"name,omitempty" json:"name,omitempty"`
|
||||
ExternalURL *string `url:"external_url,omitempty" json:"external_url,omitempty"`
|
||||
}
|
||||
|
||||
// CreateEnvironment adds a environment to a project. This is an idempotent
|
||||
// method and can be called multiple times with the same parameters. Createing
|
||||
// an environment that is already a environment does not affect the
|
||||
// existing environmentship.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ee/api/environments.html#create-a-new-environment
|
||||
func (s *EnvironmentsService) CreateEnvironment(pid interface{}, opt *CreateEnvironmentOptions, options ...OptionFunc) (*Environment, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/environments", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
env := new(Environment)
|
||||
resp, err := s.client.Do(req, env)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return env, resp, err
|
||||
}
|
||||
|
||||
// EditEnvironmentOptions represents the available EditEnvironment() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ee/api/environments.html#edit-an-existing-environment
|
||||
type EditEnvironmentOptions struct {
|
||||
Name *string `url:"name,omitempty" json:"name,omitempty"`
|
||||
ExternalURL *string `url:"external_url,omitempty" json:"external_url,omitempty"`
|
||||
}
|
||||
|
||||
// EditEnvironment updates a project team environment to a specified access level..
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ee/api/environments.html#edit-an-existing-environment
|
||||
func (s *EnvironmentsService) EditEnvironment(pid interface{}, environment int, opt *EditEnvironmentOptions, options ...OptionFunc) (*Environment, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/environments/%d", url.QueryEscape(project), environment)
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
env := new(Environment)
|
||||
resp, err := s.client.Do(req, env)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return env, resp, err
|
||||
}
|
||||
|
||||
// DeleteEnvironment removes a environment from a project team.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/environments.html#remove-a-environment-from-a-group-or-project
|
||||
func (s *EnvironmentsService) DeleteEnvironment(pid interface{}, environment int, options ...OptionFunc) (*Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/environments/%d", url.QueryEscape(project), environment)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(req, nil)
|
||||
}
|
649
vendor/github.com/xanzy/go-gitlab/event_types.go
generated
vendored
Normal file
649
vendor/github.com/xanzy/go-gitlab/event_types.go
generated
vendored
Normal file
@ -0,0 +1,649 @@
|
||||
//
|
||||
// Copyright 2017, Sander van Harmelen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// PushEvent represents a push event.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/web_hooks/web_hooks.html#push-events
|
||||
type PushEvent struct {
|
||||
ObjectKind string `json:"object_kind"`
|
||||
Before string `json:"before"`
|
||||
After string `json:"after"`
|
||||
Ref string `json:"ref"`
|
||||
CheckoutSha string `json:"checkout_sha"`
|
||||
UserID int `json:"user_id"`
|
||||
UserName string `json:"user_name"`
|
||||
UserEmail string `json:"user_email"`
|
||||
UserAvatar string `json:"user_avatar"`
|
||||
ProjectID int `json:"project_id"`
|
||||
Project struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
GitSSHURL string `json:"git_ssh_url"`
|
||||
GitHTTPURL string `json:"git_http_url"`
|
||||
Namespace string `json:"namespace"`
|
||||
PathWithNamespace string `json:"path_with_namespace"`
|
||||
DefaultBranch string `json:"default_branch"`
|
||||
Homepage string `json:"homepage"`
|
||||
URL string `json:"url"`
|
||||
SSHURL string `json:"ssh_url"`
|
||||
HTTPURL string `json:"http_url"`
|
||||
WebURL string `json:"web_url"`
|
||||
Visibility VisibilityValue `json:"visibility"`
|
||||
} `json:"project"`
|
||||
Repository *Repository `json:"repository"`
|
||||
Commits []*struct {
|
||||
ID string `json:"id"`
|
||||
Message string `json:"message"`
|
||||
Timestamp *time.Time `json:"timestamp"`
|
||||
URL string `json:"url"`
|
||||
Author struct {
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
} `json:"author"`
|
||||
Added []string `json:"added"`
|
||||
Modified []string `json:"modified"`
|
||||
Removed []string `json:"removed"`
|
||||
} `json:"commits"`
|
||||
TotalCommitsCount int `json:"total_commits_count"`
|
||||
}
|
||||
|
||||
// TagEvent represents a tag event.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/web_hooks/web_hooks.html#tag-events
|
||||
type TagEvent struct {
|
||||
ObjectKind string `json:"object_kind"`
|
||||
Before string `json:"before"`
|
||||
After string `json:"after"`
|
||||
Ref string `json:"ref"`
|
||||
CheckoutSha string `json:"checkout_sha"`
|
||||
UserID int `json:"user_id"`
|
||||
UserName string `json:"user_name"`
|
||||
UserAvatar string `json:"user_avatar"`
|
||||
ProjectID int `json:"project_id"`
|
||||
Project struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
GitSSHURL string `json:"git_ssh_url"`
|
||||
GitHTTPURL string `json:"git_http_url"`
|
||||
Namespace string `json:"namespace"`
|
||||
PathWithNamespace string `json:"path_with_namespace"`
|
||||
DefaultBranch string `json:"default_branch"`
|
||||
Homepage string `json:"homepage"`
|
||||
URL string `json:"url"`
|
||||
SSHURL string `json:"ssh_url"`
|
||||
HTTPURL string `json:"http_url"`
|
||||
WebURL string `json:"web_url"`
|
||||
Visibility VisibilityValue `json:"visibility"`
|
||||
} `json:"project"`
|
||||
Repository *Repository `json:"repository"`
|
||||
Commits []*struct {
|
||||
ID string `json:"id"`
|
||||
Message string `json:"message"`
|
||||
Timestamp *time.Time `json:"timestamp"`
|
||||
URL string `json:"url"`
|
||||
Author struct {
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
} `json:"author"`
|
||||
Added []string `json:"added"`
|
||||
Modified []string `json:"modified"`
|
||||
Removed []string `json:"removed"`
|
||||
} `json:"commits"`
|
||||
TotalCommitsCount int `json:"total_commits_count"`
|
||||
}
|
||||
|
||||
// IssueEvent represents a issue event.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/web_hooks/web_hooks.html#issues-events
|
||||
type IssueEvent struct {
|
||||
ObjectKind string `json:"object_kind"`
|
||||
User *User `json:"user"`
|
||||
Project struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
GitSSHURL string `json:"git_ssh_url"`
|
||||
GitHTTPURL string `json:"git_http_url"`
|
||||
Namespace string `json:"namespace"`
|
||||
PathWithNamespace string `json:"path_with_namespace"`
|
||||
DefaultBranch string `json:"default_branch"`
|
||||
Homepage string `json:"homepage"`
|
||||
URL string `json:"url"`
|
||||
SSHURL string `json:"ssh_url"`
|
||||
HTTPURL string `json:"http_url"`
|
||||
WebURL string `json:"web_url"`
|
||||
Visibility VisibilityValue `json:"visibility"`
|
||||
} `json:"project"`
|
||||
Repository *Repository `json:"repository"`
|
||||
ObjectAttributes struct {
|
||||
ID int `json:"id"`
|
||||
Title string `json:"title"`
|
||||
AssigneeID int `json:"assignee_id"`
|
||||
AuthorID int `json:"author_id"`
|
||||
ProjectID int `json:"project_id"`
|
||||
CreatedAt string `json:"created_at"` // Should be *time.Time (see Gitlab issue #21468)
|
||||
UpdatedAt string `json:"updated_at"` // Should be *time.Time (see Gitlab issue #21468)
|
||||
Position int `json:"position"`
|
||||
BranchName string `json:"branch_name"`
|
||||
Description string `json:"description"`
|
||||
MilestoneID int `json:"milestone_id"`
|
||||
State string `json:"state"`
|
||||
IID int `json:"iid"`
|
||||
URL string `json:"url"`
|
||||
Action string `json:"action"`
|
||||
} `json:"object_attributes"`
|
||||
Assignee struct {
|
||||
Name string `json:"name"`
|
||||
Username string `json:"username"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
} `json:"assignee"`
|
||||
}
|
||||
|
||||
// CommitCommentEvent represents a comment on a commit event.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/web_hooks/web_hooks.html#comment-on-commit
|
||||
type CommitCommentEvent struct {
|
||||
ObjectKind string `json:"object_kind"`
|
||||
User *User `json:"user"`
|
||||
ProjectID int `json:"project_id"`
|
||||
Project struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
GitSSHURL string `json:"git_ssh_url"`
|
||||
GitHTTPURL string `json:"git_http_url"`
|
||||
Namespace string `json:"namespace"`
|
||||
PathWithNamespace string `json:"path_with_namespace"`
|
||||
DefaultBranch string `json:"default_branch"`
|
||||
Homepage string `json:"homepage"`
|
||||
URL string `json:"url"`
|
||||
SSHURL string `json:"ssh_url"`
|
||||
HTTPURL string `json:"http_url"`
|
||||
WebURL string `json:"web_url"`
|
||||
Visibility VisibilityValue `json:"visibility"`
|
||||
} `json:"project"`
|
||||
Repository *Repository `json:"repository"`
|
||||
ObjectAttributes struct {
|
||||
ID int `json:"id"`
|
||||
Note string `json:"note"`
|
||||
NoteableType string `json:"noteable_type"`
|
||||
AuthorID int `json:"author_id"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
ProjectID int `json:"project_id"`
|
||||
Attachment string `json:"attachment"`
|
||||
LineCode string `json:"line_code"`
|
||||
CommitID string `json:"commit_id"`
|
||||
NoteableID int `json:"noteable_id"`
|
||||
System bool `json:"system"`
|
||||
StDiff struct {
|
||||
Diff string `json:"diff"`
|
||||
NewPath string `json:"new_path"`
|
||||
OldPath string `json:"old_path"`
|
||||
AMode string `json:"a_mode"`
|
||||
BMode string `json:"b_mode"`
|
||||
NewFile bool `json:"new_file"`
|
||||
RenamedFile bool `json:"renamed_file"`
|
||||
DeletedFile bool `json:"deleted_file"`
|
||||
} `json:"st_diff"`
|
||||
} `json:"object_attributes"`
|
||||
Commit *struct {
|
||||
ID string `json:"id"`
|
||||
Message string `json:"message"`
|
||||
Timestamp *time.Time `json:"timestamp"`
|
||||
URL string `json:"url"`
|
||||
Author struct {
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
} `json:"author"`
|
||||
} `json:"commit"`
|
||||
}
|
||||
|
||||
// MergeCommentEvent represents a comment on a merge event.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/web_hooks/web_hooks.html#comment-on-merge-request
|
||||
type MergeCommentEvent struct {
|
||||
ObjectKind string `json:"object_kind"`
|
||||
User *User `json:"user"`
|
||||
ProjectID int `json:"project_id"`
|
||||
Project struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
GitSSHURL string `json:"git_ssh_url"`
|
||||
GitHTTPURL string `json:"git_http_url"`
|
||||
Namespace string `json:"namespace"`
|
||||
PathWithNamespace string `json:"path_with_namespace"`
|
||||
DefaultBranch string `json:"default_branch"`
|
||||
Homepage string `json:"homepage"`
|
||||
URL string `json:"url"`
|
||||
SSHURL string `json:"ssh_url"`
|
||||
HTTPURL string `json:"http_url"`
|
||||
WebURL string `json:"web_url"`
|
||||
Visibility VisibilityValue `json:"visibility"`
|
||||
} `json:"project"`
|
||||
ObjectAttributes struct {
|
||||
ID int `json:"id"`
|
||||
Note string `json:"note"`
|
||||
NoteableType string `json:"noteable_type"`
|
||||
AuthorID int `json:"author_id"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
ProjectID int `json:"project_id"`
|
||||
Attachment string `json:"attachment"`
|
||||
LineCode string `json:"line_code"`
|
||||
CommitID string `json:"commit_id"`
|
||||
NoteableID int `json:"noteable_id"`
|
||||
System bool `json:"system"`
|
||||
StDiff *Diff `json:"st_diff"`
|
||||
URL string `json:"url"`
|
||||
} `json:"object_attributes"`
|
||||
Repository *Repository `json:"repository"`
|
||||
MergeRequest struct {
|
||||
ID int `json:"id"`
|
||||
TargetBranch string `json:"target_branch"`
|
||||
SourceBranch string `json:"source_branch"`
|
||||
SourceProjectID int `json:"source_project_id"`
|
||||
AuthorID int `json:"author_id"`
|
||||
AssigneeID int `json:"assignee_id"`
|
||||
Title string `json:"title"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
MilestoneID int `json:"milestone_id"`
|
||||
State string `json:"state"`
|
||||
MergeStatus string `json:"merge_status"`
|
||||
TargetProjectID int `json:"target_project_id"`
|
||||
IID int `json:"iid"`
|
||||
Description string `json:"description"`
|
||||
Position int `json:"position"`
|
||||
LockedAt string `json:"locked_at"`
|
||||
UpdatedByID int `json:"updated_by_id"`
|
||||
MergeError string `json:"merge_error"`
|
||||
MergeParams struct {
|
||||
ForceRemoveSourceBranch string `json:"force_remove_source_branch"`
|
||||
} `json:"merge_params"`
|
||||
MergeWhenPipelineSucceeds bool `json:"merge_when_pipeline_succeeds"`
|
||||
MergeUserID int `json:"merge_user_id"`
|
||||
MergeCommitSha string `json:"merge_commit_sha"`
|
||||
DeletedAt string `json:"deleted_at"`
|
||||
InProgressMergeCommitSha string `json:"in_progress_merge_commit_sha"`
|
||||
LockVersion int `json:"lock_version"`
|
||||
ApprovalsBeforeMerge string `json:"approvals_before_merge"`
|
||||
RebaseCommitSha string `json:"rebase_commit_sha"`
|
||||
TimeEstimate int `json:"time_estimate"`
|
||||
Squash bool `json:"squash"`
|
||||
LastEditedAt string `json:"last_edited_at"`
|
||||
LastEditedByID int `json:"last_edited_by_id"`
|
||||
Source *Repository `json:"source"`
|
||||
Target *Repository `json:"target"`
|
||||
LastCommit struct {
|
||||
ID string `json:"id"`
|
||||
Message string `json:"message"`
|
||||
Timestamp *time.Time `json:"timestamp"`
|
||||
URL string `json:"url"`
|
||||
Author struct {
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
} `json:"author"`
|
||||
} `json:"last_commit"`
|
||||
WorkInProgress bool `json:"work_in_progress"`
|
||||
TotalTimeSpent int `json:"total_time_spent"`
|
||||
} `json:"merge_request"`
|
||||
}
|
||||
|
||||
// IssueCommentEvent represents a comment on an issue event.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/web_hooks/web_hooks.html#comment-on-issue
|
||||
type IssueCommentEvent struct {
|
||||
ObjectKind string `json:"object_kind"`
|
||||
User *User `json:"user"`
|
||||
ProjectID int `json:"project_id"`
|
||||
Project struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
GitSSHURL string `json:"git_ssh_url"`
|
||||
GitHTTPURL string `json:"git_http_url"`
|
||||
Namespace string `json:"namespace"`
|
||||
PathWithNamespace string `json:"path_with_namespace"`
|
||||
DefaultBranch string `json:"default_branch"`
|
||||
Homepage string `json:"homepage"`
|
||||
URL string `json:"url"`
|
||||
SSHURL string `json:"ssh_url"`
|
||||
HTTPURL string `json:"http_url"`
|
||||
WebURL string `json:"web_url"`
|
||||
Visibility VisibilityValue `json:"visibility"`
|
||||
} `json:"project"`
|
||||
Repository *Repository `json:"repository"`
|
||||
ObjectAttributes struct {
|
||||
ID int `json:"id"`
|
||||
Note string `json:"note"`
|
||||
NoteableType string `json:"noteable_type"`
|
||||
AuthorID int `json:"author_id"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
ProjectID int `json:"project_id"`
|
||||
Attachment string `json:"attachment"`
|
||||
LineCode string `json:"line_code"`
|
||||
CommitID string `json:"commit_id"`
|
||||
NoteableID int `json:"noteable_id"`
|
||||
System bool `json:"system"`
|
||||
StDiff []*Diff `json:"st_diff"`
|
||||
URL string `json:"url"`
|
||||
} `json:"object_attributes"`
|
||||
Issue *Issue `json:"issue"`
|
||||
}
|
||||
|
||||
// SnippetCommentEvent represents a comment on a snippet event.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/web_hooks/web_hooks.html#comment-on-code-snippet
|
||||
type SnippetCommentEvent struct {
|
||||
ObjectKind string `json:"object_kind"`
|
||||
User *User `json:"user"`
|
||||
ProjectID int `json:"project_id"`
|
||||
Project struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
GitSSHURL string `json:"git_ssh_url"`
|
||||
GitHTTPURL string `json:"git_http_url"`
|
||||
Namespace string `json:"namespace"`
|
||||
PathWithNamespace string `json:"path_with_namespace"`
|
||||
DefaultBranch string `json:"default_branch"`
|
||||
Homepage string `json:"homepage"`
|
||||
URL string `json:"url"`
|
||||
SSHURL string `json:"ssh_url"`
|
||||
HTTPURL string `json:"http_url"`
|
||||
WebURL string `json:"web_url"`
|
||||
Visibility VisibilityValue `json:"visibility"`
|
||||
} `json:"project"`
|
||||
Repository *Repository `json:"repository"`
|
||||
ObjectAttributes struct {
|
||||
ID int `json:"id"`
|
||||
Note string `json:"note"`
|
||||
NoteableType string `json:"noteable_type"`
|
||||
AuthorID int `json:"author_id"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
ProjectID int `json:"project_id"`
|
||||
Attachment string `json:"attachment"`
|
||||
LineCode string `json:"line_code"`
|
||||
CommitID string `json:"commit_id"`
|
||||
NoteableID int `json:"noteable_id"`
|
||||
System bool `json:"system"`
|
||||
StDiff *Diff `json:"st_diff"`
|
||||
URL string `json:"url"`
|
||||
} `json:"object_attributes"`
|
||||
Snippet *Snippet `json:"snippet"`
|
||||
}
|
||||
|
||||
// MergeEvent represents a merge event.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/web_hooks/web_hooks.html#merge-request-events
|
||||
type MergeEvent struct {
|
||||
ObjectKind string `json:"object_kind"`
|
||||
User *User `json:"user"`
|
||||
Project struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
GitSSHURL string `json:"git_ssh_url"`
|
||||
GitHTTPURL string `json:"git_http_url"`
|
||||
Namespace string `json:"namespace"`
|
||||
PathWithNamespace string `json:"path_with_namespace"`
|
||||
DefaultBranch string `json:"default_branch"`
|
||||
Homepage string `json:"homepage"`
|
||||
URL string `json:"url"`
|
||||
SSHURL string `json:"ssh_url"`
|
||||
HTTPURL string `json:"http_url"`
|
||||
WebURL string `json:"web_url"`
|
||||
Visibility VisibilityValue `json:"visibility"`
|
||||
} `json:"project"`
|
||||
ObjectAttributes struct {
|
||||
ID int `json:"id"`
|
||||
TargetBranch string `json:"target_branch"`
|
||||
SourceBranch string `json:"source_branch"`
|
||||
SourceProjectID int `json:"source_project_id"`
|
||||
AuthorID int `json:"author_id"`
|
||||
AssigneeID int `json:"assignee_id"`
|
||||
Title string `json:"title"`
|
||||
CreatedAt string `json:"created_at"` // Should be *time.Time (see Gitlab issue #21468)
|
||||
UpdatedAt string `json:"updated_at"` // Should be *time.Time (see Gitlab issue #21468)
|
||||
StCommits []*Commit `json:"st_commits"`
|
||||
StDiffs []*Diff `json:"st_diffs"`
|
||||
MilestoneID int `json:"milestone_id"`
|
||||
State string `json:"state"`
|
||||
MergeStatus string `json:"merge_status"`
|
||||
TargetProjectID int `json:"target_project_id"`
|
||||
IID int `json:"iid"`
|
||||
Description string `json:"description"`
|
||||
Position int `json:"position"`
|
||||
LockedAt string `json:"locked_at"`
|
||||
UpdatedByID int `json:"updated_by_id"`
|
||||
MergeError string `json:"merge_error"`
|
||||
MergeParams struct {
|
||||
ForceRemoveSourceBranch string `json:"force_remove_source_branch"`
|
||||
} `json:"merge_params"`
|
||||
MergeWhenBuildSucceeds bool `json:"merge_when_build_succeeds"`
|
||||
MergeUserID int `json:"merge_user_id"`
|
||||
MergeCommitSha string `json:"merge_commit_sha"`
|
||||
DeletedAt string `json:"deleted_at"`
|
||||
ApprovalsBeforeMerge string `json:"approvals_before_merge"`
|
||||
RebaseCommitSha string `json:"rebase_commit_sha"`
|
||||
InProgressMergeCommitSha string `json:"in_progress_merge_commit_sha"`
|
||||
LockVersion int `json:"lock_version"`
|
||||
TimeEstimate int `json:"time_estimate"`
|
||||
Source *Repository `json:"source"`
|
||||
Target *Repository `json:"target"`
|
||||
LastCommit struct {
|
||||
ID string `json:"id"`
|
||||
Message string `json:"message"`
|
||||
Timestamp *time.Time `json:"timestamp"`
|
||||
URL string `json:"url"`
|
||||
Author struct {
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
} `json:"author"`
|
||||
} `json:"last_commit"`
|
||||
WorkInProgress bool `json:"work_in_progress"`
|
||||
URL string `json:"url"`
|
||||
Action string `json:"action"`
|
||||
Assignee struct {
|
||||
Name string `json:"name"`
|
||||
Username string `json:"username"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
} `json:"assignee"`
|
||||
} `json:"object_attributes"`
|
||||
Repository *Repository `json:"repository"`
|
||||
Assignee struct {
|
||||
Name string `json:"name"`
|
||||
Username string `json:"username"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
} `json:"assignee"`
|
||||
}
|
||||
|
||||
// WikiPageEvent represents a wiki page event.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/web_hooks/web_hooks.html#wiki-page-events
|
||||
type WikiPageEvent struct {
|
||||
ObjectKind string `json:"object_kind"`
|
||||
User *User `json:"user"`
|
||||
Project struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
GitSSHURL string `json:"git_ssh_url"`
|
||||
GitHTTPURL string `json:"git_http_url"`
|
||||
Namespace string `json:"namespace"`
|
||||
PathWithNamespace string `json:"path_with_namespace"`
|
||||
DefaultBranch string `json:"default_branch"`
|
||||
Homepage string `json:"homepage"`
|
||||
URL string `json:"url"`
|
||||
SSHURL string `json:"ssh_url"`
|
||||
HTTPURL string `json:"http_url"`
|
||||
WebURL string `json:"web_url"`
|
||||
Visibility VisibilityValue `json:"visibility"`
|
||||
} `json:"project"`
|
||||
Wiki struct {
|
||||
WebURL string `json:"web_url"`
|
||||
GitSSHURL string `json:"git_ssh_url"`
|
||||
GitHTTPURL string `json:"git_http_url"`
|
||||
PathWithNamespace string `json:"path_with_namespace"`
|
||||
DefaultBranch string `json:"default_branch"`
|
||||
} `json:"wiki"`
|
||||
ObjectAttributes struct {
|
||||
Title string `json:"title"`
|
||||
Content string `json:"content"`
|
||||
Format string `json:"format"`
|
||||
Message string `json:"message"`
|
||||
Slug string `json:"slug"`
|
||||
URL string `json:"url"`
|
||||
Action string `json:"action"`
|
||||
} `json:"object_attributes"`
|
||||
}
|
||||
|
||||
// PipelineEvent represents a pipeline event.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/web_hooks/web_hooks.html#pipeline-events
|
||||
type PipelineEvent struct {
|
||||
ObjectKind string `json:"object_kind"`
|
||||
ObjectAttributes struct {
|
||||
ID int `json:"id"`
|
||||
Ref string `json:"ref"`
|
||||
Tag bool `json:"tag"`
|
||||
Sha string `json:"sha"`
|
||||
BeforeSha string `json:"before_sha"`
|
||||
Status string `json:"status"`
|
||||
Stages []string `json:"stages"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
FinishedAt string `json:"finished_at"`
|
||||
Duration int `json:"duration"`
|
||||
} `json:"object_attributes"`
|
||||
User struct {
|
||||
Name string `json:"name"`
|
||||
Username string `json:"username"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
} `json:"user"`
|
||||
Project struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
GitSSHURL string `json:"git_ssh_url"`
|
||||
GitHTTPURL string `json:"git_http_url"`
|
||||
Namespace string `json:"namespace"`
|
||||
PathWithNamespace string `json:"path_with_namespace"`
|
||||
DefaultBranch string `json:"default_branch"`
|
||||
Homepage string `json:"homepage"`
|
||||
URL string `json:"url"`
|
||||
SSHURL string `json:"ssh_url"`
|
||||
HTTPURL string `json:"http_url"`
|
||||
WebURL string `json:"web_url"`
|
||||
Visibility VisibilityValue `json:"visibility"`
|
||||
} `json:"project"`
|
||||
Commit struct {
|
||||
ID string `json:"id"`
|
||||
Message string `json:"message"`
|
||||
Timestamp *time.Time `json:"timestamp"`
|
||||
URL string `json:"url"`
|
||||
Author struct {
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
} `json:"author"`
|
||||
} `json:"commit"`
|
||||
Builds []struct {
|
||||
ID int `json:"id"`
|
||||
Stage string `json:"stage"`
|
||||
Name string `json:"name"`
|
||||
Status string `json:"status"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
StartedAt string `json:"started_at"`
|
||||
FinishedAt string `json:"finished_at"`
|
||||
When string `json:"when"`
|
||||
Manual bool `json:"manual"`
|
||||
User struct {
|
||||
Name string `json:"name"`
|
||||
Username string `json:"username"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
} `json:"user"`
|
||||
Runner struct {
|
||||
ID int `json:"id"`
|
||||
Description string `json:"description"`
|
||||
Active bool `json:"active"`
|
||||
IsShared bool `json:"is_shared"`
|
||||
} `json:"runner"`
|
||||
ArtifactsFile struct {
|
||||
Filename string `json:"filename"`
|
||||
Size int `json:"size"`
|
||||
} `json:"artifacts_file"`
|
||||
} `json:"builds"`
|
||||
}
|
||||
|
||||
//BuildEvent represents a build event
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/web_hooks/web_hooks.html#build-events
|
||||
type BuildEvent struct {
|
||||
ObjectKind string `json:"object_kind"`
|
||||
Ref string `json:"ref"`
|
||||
Tag bool `json:"tag"`
|
||||
BeforeSha string `json:"before_sha"`
|
||||
Sha string `json:"sha"`
|
||||
BuildID int `json:"build_id"`
|
||||
BuildName string `json:"build_name"`
|
||||
BuildStage string `json:"build_stage"`
|
||||
BuildStatus string `json:"build_status"`
|
||||
BuildStartedAt string `json:"build_started_at"`
|
||||
BuildFinishedAt string `json:"build_finished_at"`
|
||||
BuildDuration float64 `json:"build_duration"`
|
||||
BuildAllowFailure bool `json:"build_allow_failure"`
|
||||
ProjectID int `json:"project_id"`
|
||||
ProjectName string `json:"project_name"`
|
||||
User struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
} `json:"user"`
|
||||
Commit struct {
|
||||
ID int `json:"id"`
|
||||
Sha string `json:"sha"`
|
||||
Message string `json:"message"`
|
||||
AuthorName string `json:"author_name"`
|
||||
AuthorEmail string `json:"author_email"`
|
||||
Status string `json:"status"`
|
||||
Duration int `json:"duration"`
|
||||
StartedAt string `json:"started_at"`
|
||||
FinishedAt string `json:"finished_at"`
|
||||
} `json:"commit"`
|
||||
Repository *Repository `json:"repository"`
|
||||
}
|
147
vendor/github.com/xanzy/go-gitlab/events.go
generated
vendored
Normal file
147
vendor/github.com/xanzy/go-gitlab/events.go
generated
vendored
Normal file
@ -0,0 +1,147 @@
|
||||
//
|
||||
// Copyright 2017, Sander van Harmelen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"time"
|
||||
)
|
||||
|
||||
// EventsService handles communication with the event related methods of
|
||||
// the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/events.html
|
||||
type EventsService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// ContributionEvent represents a user's contribution
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/events.html#get-user-contribution-events
|
||||
type ContributionEvent struct {
|
||||
Title string `json:"title"`
|
||||
ProjectID int `json:"project_id"`
|
||||
ActionName string `json:"action_name"`
|
||||
TargetID int `json:"target_id"`
|
||||
TargetIID int `json:"target_iid"`
|
||||
TargetType string `json:"target_type"`
|
||||
AuthorID int `json:"author_id"`
|
||||
TargetTitle string `json:"target_title"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
PushData struct {
|
||||
CommitCount int `json:"commit_count"`
|
||||
Action string `json:"action"`
|
||||
RefType string `json:"ref_type"`
|
||||
CommitFrom string `json:"commit_from"`
|
||||
CommitTo string `json:"commit_to"`
|
||||
Ref string `json:"ref"`
|
||||
CommitTitle string `json:"commit_title"`
|
||||
} `json:"push_data"`
|
||||
Note *Note `json:"note"`
|
||||
Author struct {
|
||||
Name string `json:"name"`
|
||||
Username string `json:"username"`
|
||||
ID int `json:"id"`
|
||||
State string `json:"state"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
WebURL string `json:"web_url"`
|
||||
} `json:"author"`
|
||||
AuthorUsername string `json:"author_username"`
|
||||
}
|
||||
|
||||
// ListContributionEventsOptions represents the options for GetUserContributionEvents
|
||||
//
|
||||
// GitLap API docs:
|
||||
// https://docs.gitlab.com/ce/api/events.html#get-user-contribution-events
|
||||
type ListContributionEventsOptions struct {
|
||||
ListOptions
|
||||
Action *EventTypeValue `json:"action,omitempty"`
|
||||
TargetType *EventTargetTypeValue `json:"target_type,omitempty"`
|
||||
Before *ISOTime `json:"before,omitempty"`
|
||||
After *ISOTime `json:"after,omitempty"`
|
||||
Sort *string `json:"sort,omitempty"`
|
||||
}
|
||||
|
||||
// ListUserContributionEvents retrieves user contribution events
|
||||
// for the specified user, sorted from newest to oldest.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/events.html#get-user-contribution-events
|
||||
func (s *UsersService) ListUserContributionEvents(uid interface{}, opt *ListContributionEventsOptions, options ...OptionFunc) ([]*ContributionEvent, *Response, error) {
|
||||
user, err := parseID(uid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("users/%s/events", user)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var cs []*ContributionEvent
|
||||
resp, err := s.client.Do(req, &cs)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return cs, resp, err
|
||||
}
|
||||
|
||||
// ListCurrentUserContributionEvents gets a list currently authenticated user's events
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/events.html#list-currently-authenticated-user-39-s-events
|
||||
func (s *EventsService) ListCurrentUserContributionEvents(opt *ListContributionEventsOptions, options ...OptionFunc) ([]*ContributionEvent, *Response, error) {
|
||||
req, err := s.client.NewRequest("GET", "events", opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var cs []*ContributionEvent
|
||||
resp, err := s.client.Do(req, &cs)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return cs, resp, err
|
||||
}
|
||||
|
||||
// ListProjectContributionEvents gets a list currently authenticated user's events
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/events.html#list-a-project-39-s-visible-events
|
||||
func (s *EventsService) ListProjectContributionEvents(pid interface{}, opt *ListContributionEventsOptions, options ...OptionFunc) ([]*ContributionEvent, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("%s/events", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var cs []*ContributionEvent
|
||||
resp, err := s.client.Do(req, &cs)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return cs, resp, err
|
||||
}
|
79
vendor/github.com/xanzy/go-gitlab/feature_flags.go
generated
vendored
Normal file
79
vendor/github.com/xanzy/go-gitlab/feature_flags.go
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// FeaturesService handles the communication with the application FeaturesService
|
||||
// related methods of the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/features.html
|
||||
type FeaturesService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// Feature represents a GitLab feature flag.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/features.html
|
||||
type Feature struct {
|
||||
Name string `json:"name"`
|
||||
State string `json:"state"`
|
||||
Gates []Gate
|
||||
}
|
||||
|
||||
// Gate represents a gate of a GitLab feature flag.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/features.html
|
||||
type Gate struct {
|
||||
Key string `json:"key"`
|
||||
Value interface{} `json:"value"`
|
||||
}
|
||||
|
||||
func (f Feature) String() string {
|
||||
return Stringify(f)
|
||||
}
|
||||
|
||||
// ListFeatures gets a list of feature flags
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/features.html#list-all-features
|
||||
func (s *FeaturesService) ListFeatures(options ...OptionFunc) ([]*Feature, *Response, error) {
|
||||
req, err := s.client.NewRequest("GET", "features", nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var f []*Feature
|
||||
resp, err := s.client.Do(req, &f)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
return f, resp, err
|
||||
}
|
||||
|
||||
// SetFeatureFlag sets or creates a feature flag gate
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/features.html#set-or-create-a-feature
|
||||
func (s *FeaturesService) SetFeatureFlag(name string, value interface{}, options ...OptionFunc) (*Feature, *Response, error) {
|
||||
u := fmt.Sprintf("features/%s", url.QueryEscape(name))
|
||||
|
||||
opt := struct {
|
||||
Value interface{} `url:"value" json:"value"`
|
||||
}{
|
||||
value,
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
f := &Feature{}
|
||||
resp, err := s.client.Do(req, f)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
return f, resp, err
|
||||
}
|
84
vendor/github.com/xanzy/go-gitlab/gitignore_templates.go
generated
vendored
Normal file
84
vendor/github.com/xanzy/go-gitlab/gitignore_templates.go
generated
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
//
|
||||
// Copyright 2018, Sander van Harmelen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// GitIgnoreTemplatesService handles communication with the gitignore
|
||||
// templates related methods of the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/templates/gitignores.html
|
||||
type GitIgnoreTemplatesService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// GitIgnoreTemplate represents a GitLab gitignore template.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/templates/gitignores.html
|
||||
type GitIgnoreTemplate struct {
|
||||
Name string `json:"name"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
// ListTemplatesOptions represents the available ListAllTemplates() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/templates/gitignores.html#list-gitignore-templates
|
||||
type ListTemplatesOptions ListOptions
|
||||
|
||||
// ListTemplates get a list of available git ignore templates
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/templates/gitignores.html#list-gitignore-templates
|
||||
func (s *GitIgnoreTemplatesService) ListTemplates(opt *ListTemplatesOptions, options ...OptionFunc) ([]*GitIgnoreTemplate, *Response, error) {
|
||||
req, err := s.client.NewRequest("GET", "templates/gitignores", opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var gs []*GitIgnoreTemplate
|
||||
resp, err := s.client.Do(req, &gs)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return gs, resp, err
|
||||
}
|
||||
|
||||
// GetTemplate get a git ignore template
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/templates/gitignores.html#single-gitignore-template
|
||||
func (s *GitIgnoreTemplatesService) GetTemplate(key string, options ...OptionFunc) (*GitIgnoreTemplate, *Response, error) {
|
||||
u := fmt.Sprintf("templates/gitignores/%s", url.QueryEscape(key))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
g := new(GitIgnoreTemplate)
|
||||
resp, err := s.client.Do(req, g)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return g, resp, err
|
||||
}
|
854
vendor/github.com/xanzy/go-gitlab/gitlab.go
generated
vendored
Normal file
854
vendor/github.com/xanzy/go-gitlab/gitlab.go
generated
vendored
Normal file
@ -0,0 +1,854 @@
|
||||
//
|
||||
// Copyright 2017, Sander van Harmelen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/google/go-querystring/query"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultBaseURL = "https://gitlab.com/"
|
||||
apiVersionPath = "api/v4/"
|
||||
userAgent = "go-gitlab"
|
||||
)
|
||||
|
||||
// authType represents an authentication type within GitLab.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/
|
||||
type authType int
|
||||
|
||||
// List of available authentication types.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/
|
||||
const (
|
||||
basicAuth authType = iota
|
||||
oAuthToken
|
||||
privateToken
|
||||
)
|
||||
|
||||
// AccessLevelValue represents a permission level within GitLab.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/permissions/permissions.html
|
||||
type AccessLevelValue int
|
||||
|
||||
// List of available access levels
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/permissions/permissions.html
|
||||
const (
|
||||
NoPermissions AccessLevelValue = 0
|
||||
GuestPermissions AccessLevelValue = 10
|
||||
ReporterPermissions AccessLevelValue = 20
|
||||
DeveloperPermissions AccessLevelValue = 30
|
||||
MasterPermissions AccessLevelValue = 40
|
||||
OwnerPermission AccessLevelValue = 50
|
||||
)
|
||||
|
||||
// BuildStateValue represents a GitLab build state.
|
||||
type BuildStateValue string
|
||||
|
||||
// These constants represent all valid build states.
|
||||
const (
|
||||
Pending BuildStateValue = "pending"
|
||||
Running BuildStateValue = "running"
|
||||
Success BuildStateValue = "success"
|
||||
Failed BuildStateValue = "failed"
|
||||
Canceled BuildStateValue = "canceled"
|
||||
Skipped BuildStateValue = "skipped"
|
||||
)
|
||||
|
||||
// ISOTime represents an ISO 8601 formatted date
|
||||
type ISOTime time.Time
|
||||
|
||||
// ISO 8601 date format
|
||||
const iso8601 = "2006-01-02"
|
||||
|
||||
// MarshalJSON implements the json.Marshaler interface
|
||||
func (t ISOTime) MarshalJSON() ([]byte, error) {
|
||||
if y := time.Time(t).Year(); y < 0 || y >= 10000 {
|
||||
// ISO 8901 uses 4 digits for the years
|
||||
return nil, errors.New("ISOTime.MarshalJSON: year outside of range [0,9999]")
|
||||
}
|
||||
|
||||
b := make([]byte, 0, len(iso8601)+2)
|
||||
b = append(b, '"')
|
||||
b = time.Time(t).AppendFormat(b, iso8601)
|
||||
b = append(b, '"')
|
||||
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements the json.Unmarshaler interface
|
||||
func (t *ISOTime) UnmarshalJSON(data []byte) error {
|
||||
// Ignore null, like in the main JSON package
|
||||
if string(data) == "null" {
|
||||
return nil
|
||||
}
|
||||
|
||||
isotime, err := time.Parse(`"`+iso8601+`"`, string(data))
|
||||
*t = ISOTime(isotime)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// String implements the Stringer interface
|
||||
func (t ISOTime) String() string {
|
||||
return time.Time(t).Format(iso8601)
|
||||
}
|
||||
|
||||
// NotificationLevelValue represents a notification level.
|
||||
type NotificationLevelValue int
|
||||
|
||||
// String implements the fmt.Stringer interface.
|
||||
func (l NotificationLevelValue) String() string {
|
||||
return notificationLevelNames[l]
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaler interface.
|
||||
func (l NotificationLevelValue) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(l.String())
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements the json.Unmarshaler interface.
|
||||
func (l *NotificationLevelValue) UnmarshalJSON(data []byte) error {
|
||||
var raw interface{}
|
||||
if err := json.Unmarshal(data, &raw); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
switch raw := raw.(type) {
|
||||
case float64:
|
||||
*l = NotificationLevelValue(raw)
|
||||
case string:
|
||||
*l = notificationLevelTypes[raw]
|
||||
case nil:
|
||||
// No action needed.
|
||||
default:
|
||||
return fmt.Errorf("json: cannot unmarshal %T into Go value of type %T", raw, *l)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// List of valid notification levels.
|
||||
const (
|
||||
DisabledNotificationLevel NotificationLevelValue = iota
|
||||
ParticipatingNotificationLevel
|
||||
WatchNotificationLevel
|
||||
GlobalNotificationLevel
|
||||
MentionNotificationLevel
|
||||
CustomNotificationLevel
|
||||
)
|
||||
|
||||
var notificationLevelNames = [...]string{
|
||||
"disabled",
|
||||
"participating",
|
||||
"watch",
|
||||
"global",
|
||||
"mention",
|
||||
"custom",
|
||||
}
|
||||
|
||||
var notificationLevelTypes = map[string]NotificationLevelValue{
|
||||
"disabled": DisabledNotificationLevel,
|
||||
"participating": ParticipatingNotificationLevel,
|
||||
"watch": WatchNotificationLevel,
|
||||
"global": GlobalNotificationLevel,
|
||||
"mention": MentionNotificationLevel,
|
||||
"custom": CustomNotificationLevel,
|
||||
}
|
||||
|
||||
// OrderByValue represent in which order to sort the item
|
||||
type OrderByValue string
|
||||
|
||||
// These constants represent all valid order by values.
|
||||
const (
|
||||
OrderByCreatedAt OrderByValue = "created_at"
|
||||
OrderByID OrderByValue = "id"
|
||||
OrderByIID OrderByValue = "iid"
|
||||
OrderByRef OrderByValue = "ref"
|
||||
OrderByStatus OrderByValue = "status"
|
||||
OrderByUserID OrderByValue = "user_id"
|
||||
)
|
||||
|
||||
// VisibilityValue represents a visibility level within GitLab.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/
|
||||
type VisibilityValue string
|
||||
|
||||
// List of available visibility levels
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/
|
||||
const (
|
||||
PrivateVisibility VisibilityValue = "private"
|
||||
InternalVisibility VisibilityValue = "internal"
|
||||
PublicVisibility VisibilityValue = "public"
|
||||
)
|
||||
|
||||
// MergeMethodValue represents a project merge type within GitLab.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#project-merge-method
|
||||
type MergeMethodValue string
|
||||
|
||||
// List of available merge type
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#project-merge-method
|
||||
const (
|
||||
NoFastForwardMerge MergeMethodValue = "merge"
|
||||
FastForwardMerge MergeMethodValue = "ff"
|
||||
RebaseMerge MergeMethodValue = "rebase_merge"
|
||||
)
|
||||
|
||||
// EventTypeValue represents actions type for contribution events
|
||||
type EventTypeValue string
|
||||
|
||||
// List of available action type
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/events.html#action-types
|
||||
const (
|
||||
CreatedEventType EventTypeValue = "created"
|
||||
UpdatedEventType EventTypeValue = "updated"
|
||||
ClosedEventType EventTypeValue = "closed"
|
||||
ReopenedEventType EventTypeValue = "reopened"
|
||||
PushedEventType EventTypeValue = "pushed"
|
||||
CommentedEventType EventTypeValue = "commented"
|
||||
MergedEventType EventTypeValue = "merged"
|
||||
JoinedEventType EventTypeValue = "joined"
|
||||
LeftEventType EventTypeValue = "left"
|
||||
DestroyedEventType EventTypeValue = "destroyed"
|
||||
ExpiredEventType EventTypeValue = "expired"
|
||||
)
|
||||
|
||||
// EventTargetTypeValue represents actions type value for contribution events
|
||||
type EventTargetTypeValue string
|
||||
|
||||
// List of available action type
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/events.html#target-types
|
||||
const (
|
||||
IssueEventTargetType EventTargetTypeValue = "issue"
|
||||
MilestoneEventTargetType EventTargetTypeValue = "milestone"
|
||||
MergeRequestEventTargetType EventTargetTypeValue = "merge_request"
|
||||
NoteEventTargetType EventTargetTypeValue = "note"
|
||||
ProjectEventTargetType EventTargetTypeValue = "project"
|
||||
SnippetEventTargetType EventTargetTypeValue = "snippet"
|
||||
UserEventTargetType EventTargetTypeValue = "user"
|
||||
)
|
||||
|
||||
// A Client manages communication with the GitLab API.
|
||||
type Client struct {
|
||||
// HTTP client used to communicate with the API.
|
||||
client *http.Client
|
||||
|
||||
// Base URL for API requests. Defaults to the public GitLab API, but can be
|
||||
// set to a domain endpoint to use with a self hosted GitLab server. baseURL
|
||||
// should always be specified with a trailing slash.
|
||||
baseURL *url.URL
|
||||
|
||||
// Token type used to make authenticated API calls.
|
||||
authType authType
|
||||
|
||||
// Username and password used for basix authentication.
|
||||
username, password string
|
||||
|
||||
// Token used to make authenticated API calls.
|
||||
token string
|
||||
|
||||
// User agent used when communicating with the GitLab API.
|
||||
UserAgent string
|
||||
|
||||
// Services used for talking to different parts of the GitLab API.
|
||||
AwardEmoji *AwardEmojiService
|
||||
Branches *BranchesService
|
||||
BuildVariables *BuildVariablesService
|
||||
BroadcastMessage *BroadcastMessagesService
|
||||
Commits *CommitsService
|
||||
DeployKeys *DeployKeysService
|
||||
Deployments *DeploymentsService
|
||||
Environments *EnvironmentsService
|
||||
Events *EventsService
|
||||
Features *FeaturesService
|
||||
GitIgnoreTemplates *GitIgnoreTemplatesService
|
||||
Groups *GroupsService
|
||||
GroupMembers *GroupMembersService
|
||||
GroupMilestones *GroupMilestonesService
|
||||
Issues *IssuesService
|
||||
IssueLinks *IssueLinksService
|
||||
Jobs *JobsService
|
||||
Boards *IssueBoardsService
|
||||
Labels *LabelsService
|
||||
MergeRequests *MergeRequestsService
|
||||
MergeRequestApprovals *MergeRequestApprovalsService
|
||||
Milestones *MilestonesService
|
||||
Namespaces *NamespacesService
|
||||
Notes *NotesService
|
||||
NotificationSettings *NotificationSettingsService
|
||||
PagesDomains *PagesDomainsService
|
||||
Pipelines *PipelinesService
|
||||
PipelineSchedules *PipelineSchedulesService
|
||||
PipelineTriggers *PipelineTriggersService
|
||||
Projects *ProjectsService
|
||||
ProjectMembers *ProjectMembersService
|
||||
ProjectSnippets *ProjectSnippetsService
|
||||
ProtectedBranches *ProtectedBranchesService
|
||||
Repositories *RepositoriesService
|
||||
RepositoryFiles *RepositoryFilesService
|
||||
Runners *RunnersService
|
||||
Search *SearchService
|
||||
Services *ServicesService
|
||||
Session *SessionService
|
||||
Settings *SettingsService
|
||||
Sidekiq *SidekiqService
|
||||
Snippets *SnippetsService
|
||||
SystemHooks *SystemHooksService
|
||||
Tags *TagsService
|
||||
Todos *TodosService
|
||||
Users *UsersService
|
||||
Validate *ValidateService
|
||||
Version *VersionService
|
||||
Wikis *WikisService
|
||||
}
|
||||
|
||||
// ListOptions specifies the optional parameters to various List methods that
|
||||
// support pagination.
|
||||
type ListOptions struct {
|
||||
// For paginated result sets, page of results to retrieve.
|
||||
Page int `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
// For paginated result sets, the number of results to include per page.
|
||||
PerPage int `url:"per_page,omitempty" json:"per_page,omitempty"`
|
||||
}
|
||||
|
||||
// NewClient returns a new GitLab API client. If a nil httpClient is
|
||||
// provided, http.DefaultClient will be used. To use API methods which require
|
||||
// authentication, provide a valid private or personal token.
|
||||
func NewClient(httpClient *http.Client, token string) *Client {
|
||||
client := newClient(httpClient)
|
||||
client.authType = privateToken
|
||||
client.token = token
|
||||
return client
|
||||
}
|
||||
|
||||
// NewBasicAuthClient returns a new GitLab API client. If a nil httpClient is
|
||||
// provided, http.DefaultClient will be used. To use API methods which require
|
||||
// authentication, provide a valid username and password.
|
||||
func NewBasicAuthClient(httpClient *http.Client, endpoint, username, password string) (*Client, error) {
|
||||
client := newClient(httpClient)
|
||||
client.authType = basicAuth
|
||||
client.username = username
|
||||
client.password = password
|
||||
client.SetBaseURL(endpoint)
|
||||
|
||||
err := client.requestOAuthToken(context.TODO())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return client, nil
|
||||
}
|
||||
|
||||
func (c *Client) requestOAuthToken(ctx context.Context) error {
|
||||
config := &oauth2.Config{
|
||||
Endpoint: oauth2.Endpoint{
|
||||
AuthURL: fmt.Sprintf("%s://%s/oauth/authorize", c.BaseURL().Scheme, c.BaseURL().Host),
|
||||
TokenURL: fmt.Sprintf("%s://%s/oauth/token", c.BaseURL().Scheme, c.BaseURL().Host),
|
||||
},
|
||||
}
|
||||
ctx = context.WithValue(ctx, oauth2.HTTPClient, c.client)
|
||||
t, err := config.PasswordCredentialsToken(ctx, c.username, c.password)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c.token = t.AccessToken
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewOAuthClient returns a new GitLab API client. If a nil httpClient is
|
||||
// provided, http.DefaultClient will be used. To use API methods which require
|
||||
// authentication, provide a valid oauth token.
|
||||
func NewOAuthClient(httpClient *http.Client, token string) *Client {
|
||||
client := newClient(httpClient)
|
||||
client.authType = oAuthToken
|
||||
client.token = token
|
||||
return client
|
||||
}
|
||||
|
||||
func newClient(httpClient *http.Client) *Client {
|
||||
if httpClient == nil {
|
||||
httpClient = http.DefaultClient
|
||||
}
|
||||
|
||||
c := &Client{client: httpClient, UserAgent: userAgent}
|
||||
if err := c.SetBaseURL(defaultBaseURL); err != nil {
|
||||
// Should never happen since defaultBaseURL is our constant.
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// Create the internal timeStats service.
|
||||
timeStats := &timeStatsService{client: c}
|
||||
|
||||
// Create all the public services.
|
||||
c.AwardEmoji = &AwardEmojiService{client: c}
|
||||
c.Branches = &BranchesService{client: c}
|
||||
c.BuildVariables = &BuildVariablesService{client: c}
|
||||
c.BroadcastMessage = &BroadcastMessagesService{client: c}
|
||||
c.Commits = &CommitsService{client: c}
|
||||
c.DeployKeys = &DeployKeysService{client: c}
|
||||
c.Deployments = &DeploymentsService{client: c}
|
||||
c.Environments = &EnvironmentsService{client: c}
|
||||
c.Events = &EventsService{client: c}
|
||||
c.Features = &FeaturesService{client: c}
|
||||
c.GitIgnoreTemplates = &GitIgnoreTemplatesService{client: c}
|
||||
c.Groups = &GroupsService{client: c}
|
||||
c.GroupMembers = &GroupMembersService{client: c}
|
||||
c.GroupMilestones = &GroupMilestonesService{client: c}
|
||||
c.Issues = &IssuesService{client: c, timeStats: timeStats}
|
||||
c.IssueLinks = &IssueLinksService{client: c}
|
||||
c.Jobs = &JobsService{client: c}
|
||||
c.Boards = &IssueBoardsService{client: c}
|
||||
c.Labels = &LabelsService{client: c}
|
||||
c.MergeRequests = &MergeRequestsService{client: c, timeStats: timeStats}
|
||||
c.MergeRequestApprovals = &MergeRequestApprovalsService{client: c}
|
||||
c.Milestones = &MilestonesService{client: c}
|
||||
c.Namespaces = &NamespacesService{client: c}
|
||||
c.Notes = &NotesService{client: c}
|
||||
c.NotificationSettings = &NotificationSettingsService{client: c}
|
||||
c.PagesDomains = &PagesDomainsService{client: c}
|
||||
c.Pipelines = &PipelinesService{client: c}
|
||||
c.PipelineSchedules = &PipelineSchedulesService{client: c}
|
||||
c.PipelineTriggers = &PipelineTriggersService{client: c}
|
||||
c.Projects = &ProjectsService{client: c}
|
||||
c.ProjectMembers = &ProjectMembersService{client: c}
|
||||
c.ProjectSnippets = &ProjectSnippetsService{client: c}
|
||||
c.ProtectedBranches = &ProtectedBranchesService{client: c}
|
||||
c.Repositories = &RepositoriesService{client: c}
|
||||
c.RepositoryFiles = &RepositoryFilesService{client: c}
|
||||
c.Runners = &RunnersService{client: c}
|
||||
c.Services = &ServicesService{client: c}
|
||||
c.Search = &SearchService{client: c}
|
||||
c.Session = &SessionService{client: c}
|
||||
c.Settings = &SettingsService{client: c}
|
||||
c.Sidekiq = &SidekiqService{client: c}
|
||||
c.Snippets = &SnippetsService{client: c}
|
||||
c.SystemHooks = &SystemHooksService{client: c}
|
||||
c.Tags = &TagsService{client: c}
|
||||
c.Todos = &TodosService{client: c}
|
||||
c.Users = &UsersService{client: c}
|
||||
c.Validate = &ValidateService{client: c}
|
||||
c.Version = &VersionService{client: c}
|
||||
c.Wikis = &WikisService{client: c}
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
// BaseURL return a copy of the baseURL.
|
||||
func (c *Client) BaseURL() *url.URL {
|
||||
u := *c.baseURL
|
||||
return &u
|
||||
}
|
||||
|
||||
// SetBaseURL sets the base URL for API requests to a custom endpoint. urlStr
|
||||
// should always be specified with a trailing slash.
|
||||
func (c *Client) SetBaseURL(urlStr string) error {
|
||||
// Make sure the given URL end with a slash
|
||||
if !strings.HasSuffix(urlStr, "/") {
|
||||
urlStr += "/"
|
||||
}
|
||||
|
||||
baseURL, err := url.Parse(urlStr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !strings.HasSuffix(baseURL.Path, apiVersionPath) {
|
||||
baseURL.Path += apiVersionPath
|
||||
}
|
||||
|
||||
// Update the base URL of the client.
|
||||
c.baseURL = baseURL
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewRequest creates an API request. A relative URL path can be provided in
|
||||
// urlStr, in which case it is resolved relative to the base URL of the Client.
|
||||
// Relative URL paths should always be specified without a preceding slash. If
|
||||
// specified, the value pointed to by body is JSON encoded and included as the
|
||||
// request body.
|
||||
func (c *Client) NewRequest(method, path string, opt interface{}, options []OptionFunc) (*http.Request, error) {
|
||||
u := *c.baseURL
|
||||
// Set the encoded opaque data
|
||||
u.Opaque = c.baseURL.Path + path
|
||||
|
||||
if opt != nil {
|
||||
q, err := query.Values(opt)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u.RawQuery = q.Encode()
|
||||
}
|
||||
|
||||
req := &http.Request{
|
||||
Method: method,
|
||||
URL: &u,
|
||||
Proto: "HTTP/1.1",
|
||||
ProtoMajor: 1,
|
||||
ProtoMinor: 1,
|
||||
Header: make(http.Header),
|
||||
Host: u.Host,
|
||||
}
|
||||
|
||||
for _, fn := range options {
|
||||
if fn == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
if err := fn(req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if method == "POST" || method == "PUT" {
|
||||
bodyBytes, err := json.Marshal(opt)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
bodyReader := bytes.NewReader(bodyBytes)
|
||||
|
||||
u.RawQuery = ""
|
||||
req.Body = ioutil.NopCloser(bodyReader)
|
||||
req.ContentLength = int64(bodyReader.Len())
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
}
|
||||
|
||||
req.Header.Set("Accept", "application/json")
|
||||
|
||||
switch c.authType {
|
||||
case basicAuth, oAuthToken:
|
||||
req.Header.Set("Authorization", "Bearer "+c.token)
|
||||
case privateToken:
|
||||
req.Header.Set("PRIVATE-TOKEN", c.token)
|
||||
}
|
||||
|
||||
if c.UserAgent != "" {
|
||||
req.Header.Set("User-Agent", c.UserAgent)
|
||||
}
|
||||
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// Response is a GitLab API response. This wraps the standard http.Response
|
||||
// returned from GitLab and provides convenient access to things like
|
||||
// pagination links.
|
||||
type Response struct {
|
||||
*http.Response
|
||||
|
||||
// These fields provide the page values for paginating through a set of
|
||||
// results. Any or all of these may be set to the zero value for
|
||||
// responses that are not part of a paginated set, or for which there
|
||||
// are no additional pages.
|
||||
TotalItems int
|
||||
TotalPages int
|
||||
ItemsPerPage int
|
||||
CurrentPage int
|
||||
NextPage int
|
||||
PreviousPage int
|
||||
}
|
||||
|
||||
// newResponse creates a new Response for the provided http.Response.
|
||||
func newResponse(r *http.Response) *Response {
|
||||
response := &Response{Response: r}
|
||||
response.populatePageValues()
|
||||
return response
|
||||
}
|
||||
|
||||
const (
|
||||
xTotal = "X-Total"
|
||||
xTotalPages = "X-Total-Pages"
|
||||
xPerPage = "X-Per-Page"
|
||||
xPage = "X-Page"
|
||||
xNextPage = "X-Next-Page"
|
||||
xPrevPage = "X-Prev-Page"
|
||||
)
|
||||
|
||||
// populatePageValues parses the HTTP Link response headers and populates the
|
||||
// various pagination link values in the Response.
|
||||
func (r *Response) populatePageValues() {
|
||||
if totalItems := r.Response.Header.Get(xTotal); totalItems != "" {
|
||||
r.TotalItems, _ = strconv.Atoi(totalItems)
|
||||
}
|
||||
if totalPages := r.Response.Header.Get(xTotalPages); totalPages != "" {
|
||||
r.TotalPages, _ = strconv.Atoi(totalPages)
|
||||
}
|
||||
if itemsPerPage := r.Response.Header.Get(xPerPage); itemsPerPage != "" {
|
||||
r.ItemsPerPage, _ = strconv.Atoi(itemsPerPage)
|
||||
}
|
||||
if currentPage := r.Response.Header.Get(xPage); currentPage != "" {
|
||||
r.CurrentPage, _ = strconv.Atoi(currentPage)
|
||||
}
|
||||
if nextPage := r.Response.Header.Get(xNextPage); nextPage != "" {
|
||||
r.NextPage, _ = strconv.Atoi(nextPage)
|
||||
}
|
||||
if previousPage := r.Response.Header.Get(xPrevPage); previousPage != "" {
|
||||
r.PreviousPage, _ = strconv.Atoi(previousPage)
|
||||
}
|
||||
}
|
||||
|
||||
// Do sends an API request and returns the API response. The API response is
|
||||
// JSON decoded and stored in the value pointed to by v, or returned as an
|
||||
// error if an API error has occurred. If v implements the io.Writer
|
||||
// interface, the raw response body will be written to v, without attempting to
|
||||
// first decode it.
|
||||
func (c *Client) Do(req *http.Request, v interface{}) (*Response, error) {
|
||||
resp, err := c.client.Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode == http.StatusUnauthorized && c.authType == basicAuth {
|
||||
err = c.requestOAuthToken(req.Context())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return c.Do(req, v)
|
||||
}
|
||||
|
||||
response := newResponse(resp)
|
||||
|
||||
err = CheckResponse(resp)
|
||||
if err != nil {
|
||||
// even though there was an error, we still return the response
|
||||
// in case the caller wants to inspect it further
|
||||
return response, err
|
||||
}
|
||||
|
||||
if v != nil {
|
||||
if w, ok := v.(io.Writer); ok {
|
||||
_, err = io.Copy(w, resp.Body)
|
||||
} else {
|
||||
err = json.NewDecoder(resp.Body).Decode(v)
|
||||
}
|
||||
}
|
||||
|
||||
return response, err
|
||||
}
|
||||
|
||||
// Helper function to accept and format both the project ID or name as project
|
||||
// identifier for all API calls.
|
||||
func parseID(id interface{}) (string, error) {
|
||||
switch v := id.(type) {
|
||||
case int:
|
||||
return strconv.Itoa(v), nil
|
||||
case string:
|
||||
return v, nil
|
||||
default:
|
||||
return "", fmt.Errorf("invalid ID type %#v, the ID must be an int or a string", id)
|
||||
}
|
||||
}
|
||||
|
||||
// An ErrorResponse reports one or more errors caused by an API request.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/README.html#data-validation-and-error-reporting
|
||||
type ErrorResponse struct {
|
||||
Response *http.Response
|
||||
Message string
|
||||
}
|
||||
|
||||
func (e *ErrorResponse) Error() string {
|
||||
path, _ := url.QueryUnescape(e.Response.Request.URL.Opaque)
|
||||
u := fmt.Sprintf("%s://%s%s", e.Response.Request.URL.Scheme, e.Response.Request.URL.Host, path)
|
||||
return fmt.Sprintf("%s %s: %d %s", e.Response.Request.Method, u, e.Response.StatusCode, e.Message)
|
||||
}
|
||||
|
||||
// CheckResponse checks the API response for errors, and returns them if present.
|
||||
func CheckResponse(r *http.Response) error {
|
||||
switch r.StatusCode {
|
||||
case 200, 201, 202, 204, 304:
|
||||
return nil
|
||||
}
|
||||
|
||||
errorResponse := &ErrorResponse{Response: r}
|
||||
data, err := ioutil.ReadAll(r.Body)
|
||||
if err == nil && data != nil {
|
||||
var raw interface{}
|
||||
if err := json.Unmarshal(data, &raw); err != nil {
|
||||
errorResponse.Message = "failed to parse unknown error format"
|
||||
}
|
||||
|
||||
errorResponse.Message = parseError(raw)
|
||||
}
|
||||
|
||||
return errorResponse
|
||||
}
|
||||
|
||||
// Format:
|
||||
// {
|
||||
// "message": {
|
||||
// "<property-name>": [
|
||||
// "<error-message>",
|
||||
// "<error-message>",
|
||||
// ...
|
||||
// ],
|
||||
// "<embed-entity>": {
|
||||
// "<property-name>": [
|
||||
// "<error-message>",
|
||||
// "<error-message>",
|
||||
// ...
|
||||
// ],
|
||||
// }
|
||||
// },
|
||||
// "error": "<error-message>"
|
||||
// }
|
||||
func parseError(raw interface{}) string {
|
||||
switch raw := raw.(type) {
|
||||
case string:
|
||||
return raw
|
||||
|
||||
case []interface{}:
|
||||
var errs []string
|
||||
for _, v := range raw {
|
||||
errs = append(errs, parseError(v))
|
||||
}
|
||||
return fmt.Sprintf("[%s]", strings.Join(errs, ", "))
|
||||
|
||||
case map[string]interface{}:
|
||||
var errs []string
|
||||
for k, v := range raw {
|
||||
errs = append(errs, fmt.Sprintf("{%s: %s}", k, parseError(v)))
|
||||
}
|
||||
sort.Strings(errs)
|
||||
return strings.Join(errs, ", ")
|
||||
|
||||
default:
|
||||
return fmt.Sprintf("failed to parse unexpected error type: %T", raw)
|
||||
}
|
||||
}
|
||||
|
||||
// OptionFunc can be passed to all API requests to make the API call as if you were
|
||||
// another user, provided your private token is from an administrator account.
|
||||
//
|
||||
// GitLab docs: https://docs.gitlab.com/ce/api/README.html#sudo
|
||||
type OptionFunc func(*http.Request) error
|
||||
|
||||
// WithSudo takes either a username or user ID and sets the SUDO request header
|
||||
func WithSudo(uid interface{}) OptionFunc {
|
||||
return func(req *http.Request) error {
|
||||
user, err := parseID(uid)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
req.Header.Set("SUDO", user)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithContext runs the request with the provided context
|
||||
func WithContext(ctx context.Context) OptionFunc {
|
||||
return func(req *http.Request) error {
|
||||
*req = *req.WithContext(ctx)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// Bool is a helper routine that allocates a new bool value
|
||||
// to store v and returns a pointer to it.
|
||||
func Bool(v bool) *bool {
|
||||
p := new(bool)
|
||||
*p = v
|
||||
return p
|
||||
}
|
||||
|
||||
// Int is a helper routine that allocates a new int32 value
|
||||
// to store v and returns a pointer to it, but unlike Int32
|
||||
// its argument value is an int.
|
||||
func Int(v int) *int {
|
||||
p := new(int)
|
||||
*p = v
|
||||
return p
|
||||
}
|
||||
|
||||
// String is a helper routine that allocates a new string value
|
||||
// to store v and returns a pointer to it.
|
||||
func String(v string) *string {
|
||||
p := new(string)
|
||||
*p = v
|
||||
return p
|
||||
}
|
||||
|
||||
// AccessLevel is a helper routine that allocates a new AccessLevelValue
|
||||
// to store v and returns a pointer to it.
|
||||
func AccessLevel(v AccessLevelValue) *AccessLevelValue {
|
||||
p := new(AccessLevelValue)
|
||||
*p = v
|
||||
return p
|
||||
}
|
||||
|
||||
// BuildState is a helper routine that allocates a new BuildStateValue
|
||||
// to store v and returns a pointer to it.
|
||||
func BuildState(v BuildStateValue) *BuildStateValue {
|
||||
p := new(BuildStateValue)
|
||||
*p = v
|
||||
return p
|
||||
}
|
||||
|
||||
// NotificationLevel is a helper routine that allocates a new NotificationLevelValue
|
||||
// to store v and returns a pointer to it.
|
||||
func NotificationLevel(v NotificationLevelValue) *NotificationLevelValue {
|
||||
p := new(NotificationLevelValue)
|
||||
*p = v
|
||||
return p
|
||||
}
|
||||
|
||||
// OrderBy is a helper routine that allocates a new OrderByValue
|
||||
// to store v and returns a pointer to it.
|
||||
func OrderBy(v OrderByValue) *OrderByValue {
|
||||
p := new(OrderByValue)
|
||||
*p = v
|
||||
return p
|
||||
}
|
||||
|
||||
// Visibility is a helper routine that allocates a new VisibilityValue
|
||||
// to store v and returns a pointer to it.
|
||||
func Visibility(v VisibilityValue) *VisibilityValue {
|
||||
p := new(VisibilityValue)
|
||||
*p = v
|
||||
return p
|
||||
}
|
||||
|
||||
// MergeMethod is a helper routine that allocates a new MergeMethod
|
||||
// to sotre v and returns a pointer to it.
|
||||
func MergeMethod(v MergeMethodValue) *MergeMethodValue {
|
||||
p := new(MergeMethodValue)
|
||||
*p = v
|
||||
return p
|
||||
}
|
195
vendor/github.com/xanzy/go-gitlab/group_members.go
generated
vendored
Normal file
195
vendor/github.com/xanzy/go-gitlab/group_members.go
generated
vendored
Normal file
@ -0,0 +1,195 @@
|
||||
//
|
||||
// Copyright 2017, Sander van Harmelen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"time"
|
||||
)
|
||||
|
||||
// GroupMembersService handles communication with the group members
|
||||
// related methods of the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/members.html
|
||||
type GroupMembersService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// GroupMember represents a GitLab group member.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/members.html
|
||||
type GroupMember struct {
|
||||
ID int `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
Name string `json:"name"`
|
||||
State string `json:"state"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
AccessLevel AccessLevelValue `json:"access_level"`
|
||||
ExpiresAt *ISOTime `json:"expires_at"`
|
||||
}
|
||||
|
||||
// ListGroupMembersOptions represents the available ListGroupMembers()
|
||||
// options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project
|
||||
type ListGroupMembersOptions struct {
|
||||
ListOptions
|
||||
Query *string `url:"query,omitempty" json:"query,omitempty"`
|
||||
}
|
||||
|
||||
// ListGroupMembers get a list of group members viewable by the authenticated
|
||||
// user.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project
|
||||
func (s *GroupsService) ListGroupMembers(gid interface{}, opt *ListGroupMembersOptions, options ...OptionFunc) ([]*GroupMember, *Response, error) {
|
||||
group, err := parseID(gid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("groups/%s/members", url.QueryEscape(group))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var gm []*GroupMember
|
||||
resp, err := s.client.Do(req, &gm)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return gm, resp, err
|
||||
}
|
||||
|
||||
// AddGroupMemberOptions represents the available AddGroupMember() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/members.html#add-a-member-to-a-group-or-project
|
||||
type AddGroupMemberOptions struct {
|
||||
UserID *int `url:"user_id,omitempty" json:"user_id,omitempty"`
|
||||
AccessLevel *AccessLevelValue `url:"access_level,omitempty" json:"access_level,omitempty"`
|
||||
ExpiresAt *string `url:"expires_at,omitempty" json:"expires_at"`
|
||||
}
|
||||
|
||||
// GetGroupMember gets a member of a group.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/members.html#get-a-member-of-a-group-or-project
|
||||
func (s *GroupMembersService) GetGroupMember(gid interface{}, user int, options ...OptionFunc) (*GroupMember, *Response, error) {
|
||||
group, err := parseID(gid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("groups/%s/members/%d", url.QueryEscape(group), user)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
gm := new(GroupMember)
|
||||
resp, err := s.client.Do(req, gm)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return gm, resp, err
|
||||
}
|
||||
|
||||
// AddGroupMember adds a user to the list of group members.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/members.html#add-a-member-to-a-group-or-project
|
||||
func (s *GroupMembersService) AddGroupMember(gid interface{}, opt *AddGroupMemberOptions, options ...OptionFunc) (*GroupMember, *Response, error) {
|
||||
group, err := parseID(gid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("groups/%s/members", url.QueryEscape(group))
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
gm := new(GroupMember)
|
||||
resp, err := s.client.Do(req, gm)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return gm, resp, err
|
||||
}
|
||||
|
||||
// EditGroupMemberOptions represents the available EditGroupMember()
|
||||
// options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/members.html#edit-a-member-of-a-group-or-project
|
||||
type EditGroupMemberOptions struct {
|
||||
AccessLevel *AccessLevelValue `url:"access_level,omitempty" json:"access_level,omitempty"`
|
||||
ExpiresAt *string `url:"expires_at,omitempty" json:"expires_at"`
|
||||
}
|
||||
|
||||
// EditGroupMember updates a member of a group.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/members.html#edit-a-member-of-a-group-or-project
|
||||
func (s *GroupMembersService) EditGroupMember(gid interface{}, user int, opt *EditGroupMemberOptions, options ...OptionFunc) (*GroupMember, *Response, error) {
|
||||
group, err := parseID(gid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("groups/%s/members/%d", url.QueryEscape(group), user)
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
gm := new(GroupMember)
|
||||
resp, err := s.client.Do(req, gm)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return gm, resp, err
|
||||
}
|
||||
|
||||
// RemoveGroupMember removes user from user team.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/members.html#remove-a-member-from-a-group-or-project
|
||||
func (s *GroupMembersService) RemoveGroupMember(gid interface{}, user int, options ...OptionFunc) (*Response, error) {
|
||||
group, err := parseID(gid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u := fmt.Sprintf("groups/%s/members/%d", url.QueryEscape(group), user)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(req, nil)
|
||||
}
|
250
vendor/github.com/xanzy/go-gitlab/group_milestones.go
generated
vendored
Normal file
250
vendor/github.com/xanzy/go-gitlab/group_milestones.go
generated
vendored
Normal file
@ -0,0 +1,250 @@
|
||||
//
|
||||
// Copyright 2018, Sander van Harmelen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"time"
|
||||
)
|
||||
|
||||
// GroupMilestonesService handles communication with the milestone related
|
||||
// methods of the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/group_milestones.html
|
||||
type GroupMilestonesService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// GroupMilestone represents a GitLab milestone.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/group_milestones.html
|
||||
type GroupMilestone struct {
|
||||
ID int `json:"id"`
|
||||
IID int `json:"iid"`
|
||||
GroupID int `json:"group_id"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
StartDate *ISOTime `json:"start_date"`
|
||||
DueDate *ISOTime `json:"due_date"`
|
||||
State string `json:"state"`
|
||||
UpdatedAt *time.Time `json:"updated_at"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
func (m GroupMilestone) String() string {
|
||||
return Stringify(m)
|
||||
}
|
||||
|
||||
// ListGroupMilestonesOptions represents the available
|
||||
// ListGroupMilestones() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/group_milestones.html#list-group-milestones
|
||||
type ListGroupMilestonesOptions struct {
|
||||
ListOptions
|
||||
IIDs []int `url:"iids,omitempty" json:"iids,omitempty"`
|
||||
State string `url:"state,omitempty" json:"state,omitempty"`
|
||||
Search string `url:"search,omitempty" json:"search,omitempty"`
|
||||
}
|
||||
|
||||
// ListGroupMilestones returns a list of group milestones.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/group_milestones.html#list-group-milestones
|
||||
func (s *GroupMilestonesService) ListGroupMilestones(gid interface{}, opt *ListGroupMilestonesOptions, options ...OptionFunc) ([]*GroupMilestone, *Response, error) {
|
||||
group, err := parseID(gid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("groups/%s/milestones", url.QueryEscape(group))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var m []*GroupMilestone
|
||||
resp, err := s.client.Do(req, &m)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return m, resp, err
|
||||
}
|
||||
|
||||
// GetGroupMilestone gets a single group milestone.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/group_milestones.html#get-single-milestone
|
||||
func (s *GroupMilestonesService) GetGroupMilestone(gid interface{}, milestone int, options ...OptionFunc) (*GroupMilestone, *Response, error) {
|
||||
group, err := parseID(gid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("groups/%s/milestones/%d", url.QueryEscape(group), milestone)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
m := new(GroupMilestone)
|
||||
resp, err := s.client.Do(req, m)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return m, resp, err
|
||||
}
|
||||
|
||||
// CreateGroupMilestoneOptions represents the available CreateGroupMilestone() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/group_milestones.html#create-new-milestone
|
||||
type CreateGroupMilestoneOptions struct {
|
||||
Title *string `url:"title,omitempty" json:"title,omitempty"`
|
||||
Description *string `url:"description,omitempty" json:"description,omitempty"`
|
||||
StartDate *ISOTime `url:"start_date,omitempty" json:"start_date,omitempty"`
|
||||
DueDate *ISOTime `url:"due_date,omitempty" json:"due_date,omitempty"`
|
||||
}
|
||||
|
||||
// CreateGroupMilestone creates a new group milestone.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/group_milestones.html#create-new-milestone
|
||||
func (s *GroupMilestonesService) CreateGroupMilestone(gid interface{}, opt *CreateGroupMilestoneOptions, options ...OptionFunc) (*GroupMilestone, *Response, error) {
|
||||
group, err := parseID(gid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("groups/%s/milestones", url.QueryEscape(group))
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
m := new(GroupMilestone)
|
||||
resp, err := s.client.Do(req, m)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return m, resp, err
|
||||
}
|
||||
|
||||
// UpdateGroupMilestoneOptions represents the available UpdateGroupMilestone() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/group_milestones.html#edit-milestone
|
||||
type UpdateGroupMilestoneOptions struct {
|
||||
Title *string `url:"title,omitempty" json:"title,omitempty"`
|
||||
Description *string `url:"description,omitempty" json:"description,omitempty"`
|
||||
StartDate *ISOTime `url:"start_date,omitempty" json:"start_date,omitempty"`
|
||||
DueDate *ISOTime `url:"due_date,omitempty" json:"due_date,omitempty"`
|
||||
StateEvent *string `url:"state_event,omitempty" json:"state_event,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateGroupMilestone updates an existing group milestone.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/group_milestones.html#edit-milestone
|
||||
func (s *GroupMilestonesService) UpdateGroupMilestone(gid interface{}, milestone int, opt *UpdateGroupMilestoneOptions, options ...OptionFunc) (*GroupMilestone, *Response, error) {
|
||||
group, err := parseID(gid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("groups/%s/milestones/%d", url.QueryEscape(group), milestone)
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
m := new(GroupMilestone)
|
||||
resp, err := s.client.Do(req, m)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return m, resp, err
|
||||
}
|
||||
|
||||
// GetGroupMilestoneIssuesOptions represents the available GetGroupMilestoneIssues() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/group_milestones.html#get-all-issues-assigned-to-a-single-milestone
|
||||
type GetGroupMilestoneIssuesOptions ListOptions
|
||||
|
||||
// GetGroupMilestoneIssues gets all issues assigned to a single group milestone.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/group_milestones.html#get-all-issues-assigned-to-a-single-milestone
|
||||
func (s *GroupMilestonesService) GetGroupMilestoneIssues(gid interface{}, milestone int, opt *GetGroupMilestoneIssuesOptions, options ...OptionFunc) ([]*Issue, *Response, error) {
|
||||
group, err := parseID(gid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("groups/%s/milestones/%d/issues", url.QueryEscape(group), milestone)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var i []*Issue
|
||||
resp, err := s.client.Do(req, &i)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return i, resp, err
|
||||
}
|
||||
|
||||
// GetGroupMilestoneMergeRequestsOptions represents the available
|
||||
// GetGroupMilestoneMergeRequests() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/group_milestones.html#get-all-merge-requests-assigned-to-a-single-milestone
|
||||
type GetGroupMilestoneMergeRequestsOptions ListOptions
|
||||
|
||||
// GetGroupMilestoneMergeRequests gets all merge requests assigned to a
|
||||
// single group milestone.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/group_milestones.html#get-all-merge-requests-assigned-to-a-single-milestone
|
||||
func (s *GroupMilestonesService) GetGroupMilestoneMergeRequests(gid interface{}, milestone int, opt *GetGroupMilestoneMergeRequestsOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
|
||||
group, err := parseID(gid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("groups/%s/milestones/%d/merge_requests", url.QueryEscape(group), milestone)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var mr []*MergeRequest
|
||||
resp, err := s.client.Do(req, &mr)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return mr, resp, err
|
||||
}
|
307
vendor/github.com/xanzy/go-gitlab/groups.go
generated
vendored
Normal file
307
vendor/github.com/xanzy/go-gitlab/groups.go
generated
vendored
Normal file
@ -0,0 +1,307 @@
|
||||
//
|
||||
// Copyright 2017, Sander van Harmelen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// GroupsService handles communication with the group related methods of
|
||||
// the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html
|
||||
type GroupsService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// Group represents a GitLab group.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html
|
||||
type Group struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Path string `json:"path"`
|
||||
Description string `json:"description"`
|
||||
Visibility *VisibilityValue `json:"visibility"`
|
||||
LFSEnabled bool `json:"lfs_enabled"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
WebURL string `json:"web_url"`
|
||||
RequestAccessEnabled bool `json:"request_access_enabled"`
|
||||
FullName string `json:"full_name"`
|
||||
FullPath string `json:"full_path"`
|
||||
ParentID int `json:"parent_id"`
|
||||
Projects []*Project `json:"projects"`
|
||||
Statistics *StorageStatistics `json:"statistics"`
|
||||
}
|
||||
|
||||
// ListGroupsOptions represents the available ListGroups() options.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#list-project-groups
|
||||
type ListGroupsOptions struct {
|
||||
ListOptions
|
||||
AllAvailable *bool `url:"all_available,omitempty" json:"all_available,omitempty"`
|
||||
OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
|
||||
Owned *bool `url:"owned,omitempty" json:"owned,omitempty"`
|
||||
Search *string `url:"search,omitempty" json:"search,omitempty"`
|
||||
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
|
||||
Statistics *bool `url:"statistics,omitempty" json:"statistics,omitempty"`
|
||||
}
|
||||
|
||||
// ListGroups gets a list of groups (as user: my groups, as admin: all groups).
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/groups.html#list-project-groups
|
||||
func (s *GroupsService) ListGroups(opt *ListGroupsOptions, options ...OptionFunc) ([]*Group, *Response, error) {
|
||||
req, err := s.client.NewRequest("GET", "groups", opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var g []*Group
|
||||
resp, err := s.client.Do(req, &g)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return g, resp, err
|
||||
}
|
||||
|
||||
// GetGroup gets all details of a group.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#details-of-a-group
|
||||
func (s *GroupsService) GetGroup(gid interface{}, options ...OptionFunc) (*Group, *Response, error) {
|
||||
group, err := parseID(gid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("groups/%s", url.QueryEscape(group))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
g := new(Group)
|
||||
resp, err := s.client.Do(req, g)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return g, resp, err
|
||||
}
|
||||
|
||||
// CreateGroupOptions represents the available CreateGroup() options.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#new-group
|
||||
type CreateGroupOptions struct {
|
||||
Name *string `url:"name,omitempty" json:"name,omitempty"`
|
||||
Path *string `url:"path,omitempty" json:"path,omitempty"`
|
||||
Description *string `url:"description,omitempty" json:"description,omitempty"`
|
||||
Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
|
||||
LFSEnabled *bool `url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"`
|
||||
RequestAccessEnabled *bool `url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"`
|
||||
ParentID *int `url:"parent_id,omitempty" json:"parent_id,omitempty"`
|
||||
}
|
||||
|
||||
// CreateGroup creates a new project group. Available only for users who can
|
||||
// create groups.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#new-group
|
||||
func (s *GroupsService) CreateGroup(opt *CreateGroupOptions, options ...OptionFunc) (*Group, *Response, error) {
|
||||
req, err := s.client.NewRequest("POST", "groups", opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
g := new(Group)
|
||||
resp, err := s.client.Do(req, g)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return g, resp, err
|
||||
}
|
||||
|
||||
// TransferGroup transfers a project to the Group namespace. Available only
|
||||
// for admin.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/groups.html#transfer-project-to-group
|
||||
func (s *GroupsService) TransferGroup(gid interface{}, pid interface{}, options ...OptionFunc) (*Group, *Response, error) {
|
||||
group, err := parseID(gid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
u := fmt.Sprintf("groups/%s/projects/%s", url.QueryEscape(group),
|
||||
url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
g := new(Group)
|
||||
resp, err := s.client.Do(req, g)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return g, resp, err
|
||||
}
|
||||
|
||||
// UpdateGroupOptions represents the set of available options to update a Group;
|
||||
// as of today these are exactly the same available when creating a new Group.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#update-group
|
||||
type UpdateGroupOptions CreateGroupOptions
|
||||
|
||||
// UpdateGroup updates an existing group; only available to group owners and
|
||||
// administrators.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#update-group
|
||||
func (s *GroupsService) UpdateGroup(gid interface{}, opt *UpdateGroupOptions, options ...OptionFunc) (*Group, *Response, error) {
|
||||
group, err := parseID(gid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("groups/%s", url.QueryEscape(group))
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
g := new(Group)
|
||||
resp, err := s.client.Do(req, g)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return g, resp, err
|
||||
}
|
||||
|
||||
// DeleteGroup removes group with all projects inside.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#remove-group
|
||||
func (s *GroupsService) DeleteGroup(gid interface{}, options ...OptionFunc) (*Response, error) {
|
||||
group, err := parseID(gid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u := fmt.Sprintf("groups/%s", url.QueryEscape(group))
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(req, nil)
|
||||
}
|
||||
|
||||
// SearchGroup get all groups that match your string in their name or path.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#search-for-group
|
||||
func (s *GroupsService) SearchGroup(query string, options ...OptionFunc) ([]*Group, *Response, error) {
|
||||
var q struct {
|
||||
Search string `url:"search,omitempty" json:"search,omitempty"`
|
||||
}
|
||||
q.Search = query
|
||||
|
||||
req, err := s.client.NewRequest("GET", "groups", &q, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var g []*Group
|
||||
resp, err := s.client.Do(req, &g)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return g, resp, err
|
||||
}
|
||||
|
||||
// ListGroupProjectsOptions represents the available ListGroupProjects()
|
||||
// options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/groups.html#list-a-group-39-s-projects
|
||||
type ListGroupProjectsOptions ListProjectsOptions
|
||||
|
||||
// ListGroupProjects get a list of group projects
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/groups.html#list-a-group-39-s-projects
|
||||
func (s *GroupsService) ListGroupProjects(gid interface{}, opt *ListGroupProjectsOptions, options ...OptionFunc) ([]*Project, *Response, error) {
|
||||
group, err := parseID(gid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("groups/%s/projects", url.QueryEscape(group))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var p []*Project
|
||||
resp, err := s.client.Do(req, &p)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return p, resp, err
|
||||
}
|
||||
|
||||
// ListSubgroupsOptions represents the available ListSubgroupsOptions()
|
||||
// options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/groups.html#list-a-groups-s-subgroups
|
||||
type ListSubgroupsOptions ListGroupsOptions
|
||||
|
||||
// ListSubgroups gets a list of subgroups for a given project.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/groups.html#list-a-groups-s-subgroups
|
||||
func (s *GroupsService) ListSubgroups(gid interface{}, opt *ListSubgroupsOptions, options ...OptionFunc) ([]*Group, *Response, error) {
|
||||
group, err := parseID(gid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("groups/%s/subgroups", url.QueryEscape(group))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var g []*Group
|
||||
resp, err := s.client.Do(req, &g)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return g, resp, err
|
||||
}
|
128
vendor/github.com/xanzy/go-gitlab/issue_links.go
generated
vendored
Normal file
128
vendor/github.com/xanzy/go-gitlab/issue_links.go
generated
vendored
Normal file
@ -0,0 +1,128 @@
|
||||
//
|
||||
// Copyright 2017, Arkbriar
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// IssueLinksService handles communication with the issue relations related methods
|
||||
// of the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ee/api/issue_links.html
|
||||
type IssueLinksService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// IssueLink represents a two-way relation between two issues.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ee/api/issue_links.html
|
||||
type IssueLink struct {
|
||||
SourceIssue *Issue `json:"source_issue"`
|
||||
TargetIssue *Issue `json:"target_issue"`
|
||||
}
|
||||
|
||||
// ListIssueRelations gets a list of related issues of a given issue,
|
||||
// sorted by the relationship creation datetime (ascending).
|
||||
//
|
||||
// Issues will be filtered according to the user authorizations.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ee/api/issue_links.html#list-issue-relations
|
||||
func (s *IssueLinksService) ListIssueRelations(pid interface{}, issueIID int, options ...OptionFunc) ([]*Issue, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/issues/%d/links", url.QueryEscape(project), issueIID)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var is []*Issue
|
||||
resp, err := s.client.Do(req, &is)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return is, resp, err
|
||||
}
|
||||
|
||||
// CreateIssueLinkOptions represents the available CreateIssueLink() options.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ee/api/issue_links.html
|
||||
type CreateIssueLinkOptions struct {
|
||||
TargetProjectID *string `json:"target_project_id"`
|
||||
TargetIssueIID *string `json:"target_issue_iid"`
|
||||
}
|
||||
|
||||
// CreateIssueLink creates a two-way relation between two issues.
|
||||
// User must be allowed to update both issues in order to succeed.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ee/api/issue_links.html#create-an-issue-link
|
||||
func (s *IssueLinksService) CreateIssueLink(pid interface{}, issueIID int, opt *CreateIssueLinkOptions, options ...OptionFunc) (*IssueLink, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/issues/%d/links", url.QueryEscape(project), issueIID)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
i := new(IssueLink)
|
||||
resp, err := s.client.Do(req, &i)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return i, resp, err
|
||||
}
|
||||
|
||||
// DeleteIssueLink deletes an issue link, thus removes the two-way relationship.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ee/api/issue_links.html#delete-an-issue-link
|
||||
func (s *IssueLinksService) DeleteIssueLink(pid interface{}, issueIID, issueLinkID int, options ...OptionFunc) (*IssueLink, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/issues/%d/links/%d",
|
||||
url.QueryEscape(project),
|
||||
issueIID,
|
||||
issueLinkID)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
i := new(IssueLink)
|
||||
resp, err := s.client.Do(req, &i)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return i, resp, err
|
||||
}
|
403
vendor/github.com/xanzy/go-gitlab/issues.go
generated
vendored
Normal file
403
vendor/github.com/xanzy/go-gitlab/issues.go
generated
vendored
Normal file
@ -0,0 +1,403 @@
|
||||
//
|
||||
// Copyright 2017, Sander van Harmelen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// IssuesService handles communication with the issue related methods
|
||||
// of the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html
|
||||
type IssuesService struct {
|
||||
client *Client
|
||||
timeStats *timeStatsService
|
||||
}
|
||||
|
||||
// Issue represents a GitLab issue.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html
|
||||
type Issue struct {
|
||||
ID int `json:"id"`
|
||||
IID int `json:"iid"`
|
||||
ProjectID int `json:"project_id"`
|
||||
Milestone *Milestone `json:"milestone"`
|
||||
Author struct {
|
||||
ID int `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
Name string `json:"name"`
|
||||
State string `json:"state"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
} `json:"author"`
|
||||
Description string `json:"description"`
|
||||
State string `json:"state"`
|
||||
Assignees []struct {
|
||||
ID int `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
Name string `json:"name"`
|
||||
State string `json:"state"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
} `json:"assignees"`
|
||||
Assignee struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Username string `json:"username"`
|
||||
State string `json:"state"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
WebURL string `json:"web_url"`
|
||||
} `json:"assignee"`
|
||||
Upvotes int `json:"upvotes"`
|
||||
Downvotes int `json:"downvotes"`
|
||||
Labels []string `json:"labels"`
|
||||
Title string `json:"title"`
|
||||
UpdatedAt *time.Time `json:"updated_at"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
ClosedAt *time.Time `json:"closed_at"`
|
||||
Subscribed bool `json:"subscribed"`
|
||||
UserNotesCount int `json:"user_notes_count"`
|
||||
DueDate *ISOTime `json:"due_date"`
|
||||
WebURL string `json:"web_url"`
|
||||
TimeStats *TimeStats `json:"time_stats"`
|
||||
Confidential bool `json:"confidential"`
|
||||
Weight int `json:"weight"`
|
||||
DiscussionLocked bool `json:"discussion_locked"`
|
||||
Links struct {
|
||||
Self string `json:"self"`
|
||||
Notes string `json:"notes"`
|
||||
AwardEmoji string `json:"award_emoji"`
|
||||
Project string `json:"project"`
|
||||
} `json:"_links"`
|
||||
IssueLinkID int `json:"issue_link_id"`
|
||||
}
|
||||
|
||||
func (i Issue) String() string {
|
||||
return Stringify(i)
|
||||
}
|
||||
|
||||
// Labels is a custom type with specific marshaling characteristics.
|
||||
type Labels []string
|
||||
|
||||
// MarshalJSON implements the json.Marshaler interface.
|
||||
func (l *Labels) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(strings.Join(*l, ","))
|
||||
}
|
||||
|
||||
// ListIssuesOptions represents the available ListIssues() options.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-issues
|
||||
type ListIssuesOptions struct {
|
||||
ListOptions
|
||||
State *string `url:"state,omitempty" json:"state,omitempty"`
|
||||
Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
|
||||
Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
|
||||
Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
|
||||
AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
|
||||
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
|
||||
MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
|
||||
IIDs []int `url:"iids[],omitempty" json:"iids,omitempty"`
|
||||
OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
|
||||
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
|
||||
Search *string `url:"search,omitempty" json:"search,omitempty"`
|
||||
CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
|
||||
CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
|
||||
UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
|
||||
UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
|
||||
}
|
||||
|
||||
// ListIssues gets all issues created by authenticated user. This function
|
||||
// takes pagination parameters page and per_page to restrict the list of issues.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-issues
|
||||
func (s *IssuesService) ListIssues(opt *ListIssuesOptions, options ...OptionFunc) ([]*Issue, *Response, error) {
|
||||
req, err := s.client.NewRequest("GET", "issues", opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var i []*Issue
|
||||
resp, err := s.client.Do(req, &i)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return i, resp, err
|
||||
}
|
||||
|
||||
// ListGroupIssuesOptions represents the available ListGroupIssues() options.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-group-issues
|
||||
type ListGroupIssuesOptions struct {
|
||||
ListOptions
|
||||
State *string `url:"state,omitempty" json:"state,omitempty"`
|
||||
Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
|
||||
IIDs []int `url:"iids[],omitempty" json:"iids,omitempty"`
|
||||
Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
|
||||
Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
|
||||
AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
|
||||
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
|
||||
MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
|
||||
OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
|
||||
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
|
||||
Search *string `url:"search,omitempty" json:"search,omitempty"`
|
||||
CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
|
||||
CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
|
||||
UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
|
||||
UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
|
||||
}
|
||||
|
||||
// ListGroupIssues gets a list of group issues. This function accepts
|
||||
// pagination parameters page and per_page to return the list of group issues.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-group-issues
|
||||
func (s *IssuesService) ListGroupIssues(pid interface{}, opt *ListGroupIssuesOptions, options ...OptionFunc) ([]*Issue, *Response, error) {
|
||||
group, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("groups/%s/issues", url.QueryEscape(group))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var i []*Issue
|
||||
resp, err := s.client.Do(req, &i)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return i, resp, err
|
||||
}
|
||||
|
||||
// ListProjectIssuesOptions represents the available ListProjectIssues() options.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-project-issues
|
||||
type ListProjectIssuesOptions struct {
|
||||
ListOptions
|
||||
IIDs []int `url:"iids[],omitempty" json:"iids,omitempty"`
|
||||
State *string `url:"state,omitempty" json:"state,omitempty"`
|
||||
Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
|
||||
Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
|
||||
Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
|
||||
AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
|
||||
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
|
||||
MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
|
||||
OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
|
||||
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
|
||||
Search *string `url:"search,omitempty" json:"search,omitempty"`
|
||||
CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
|
||||
CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
|
||||
UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
|
||||
UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
|
||||
}
|
||||
|
||||
// ListProjectIssues gets a list of project issues. This function accepts
|
||||
// pagination parameters page and per_page to return the list of project issues.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-project-issues
|
||||
func (s *IssuesService) ListProjectIssues(pid interface{}, opt *ListProjectIssuesOptions, options ...OptionFunc) ([]*Issue, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/issues", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var i []*Issue
|
||||
resp, err := s.client.Do(req, &i)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return i, resp, err
|
||||
}
|
||||
|
||||
// GetIssue gets a single project issue.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#single-issues
|
||||
func (s *IssuesService) GetIssue(pid interface{}, issue int, options ...OptionFunc) (*Issue, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/issues/%d", url.QueryEscape(project), issue)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
i := new(Issue)
|
||||
resp, err := s.client.Do(req, i)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return i, resp, err
|
||||
}
|
||||
|
||||
// CreateIssueOptions represents the available CreateIssue() options.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#new-issues
|
||||
type CreateIssueOptions struct {
|
||||
Title *string `url:"title,omitempty" json:"title,omitempty"`
|
||||
Description *string `url:"description,omitempty" json:"description,omitempty"`
|
||||
Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"`
|
||||
AssigneeIDs []int `url:"assignee_ids,omitempty" json:"assignee_ids,omitempty"`
|
||||
MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"`
|
||||
Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
|
||||
CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
|
||||
DueDate *ISOTime `url:"due_date,omitempty" json:"due_date,omitempty"`
|
||||
MergeRequestToResolveDiscussionsOf *int `url:"merge_request_to_resolve_discussions_of,omitempty" json:"merge_request_to_resolve_discussions_of,omitempty"`
|
||||
DiscussionToResolve *string `url:"discussion_to_resolve,omitempty" json:"discussion_to_resolve,omitempty"`
|
||||
Weight *int `url:"weight,omitempty" json:"weight,omitempty"`
|
||||
}
|
||||
|
||||
// CreateIssue creates a new project issue.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#new-issues
|
||||
func (s *IssuesService) CreateIssue(pid interface{}, opt *CreateIssueOptions, options ...OptionFunc) (*Issue, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/issues", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
i := new(Issue)
|
||||
resp, err := s.client.Do(req, i)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return i, resp, err
|
||||
}
|
||||
|
||||
// UpdateIssueOptions represents the available UpdateIssue() options.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#edit-issues
|
||||
type UpdateIssueOptions struct {
|
||||
Title *string `url:"title,omitempty" json:"title,omitempty"`
|
||||
Description *string `url:"description,omitempty" json:"description,omitempty"`
|
||||
Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"`
|
||||
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
|
||||
MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"`
|
||||
Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
|
||||
StateEvent *string `url:"state_event,omitempty" json:"state_event,omitempty"`
|
||||
UpdatedAt *time.Time `url:"updated_at,omitempty" json:"updated_at,omitempty"`
|
||||
DueDate *ISOTime `url:"due_date,omitempty" json:"due_date,omitempty"`
|
||||
DiscussionLocked *bool `url:"discussion_locked,omitempty" json:"discussion_locked,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateIssue updates an existing project issue. This function is also used
|
||||
// to mark an issue as closed.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#edit-issues
|
||||
func (s *IssuesService) UpdateIssue(pid interface{}, issue int, opt *UpdateIssueOptions, options ...OptionFunc) (*Issue, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/issues/%d", url.QueryEscape(project), issue)
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
i := new(Issue)
|
||||
resp, err := s.client.Do(req, i)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return i, resp, err
|
||||
}
|
||||
|
||||
// DeleteIssue deletes a single project issue.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#delete-an-issue
|
||||
func (s *IssuesService) DeleteIssue(pid interface{}, issue int, options ...OptionFunc) (*Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/issues/%d", url.QueryEscape(project), issue)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(req, nil)
|
||||
}
|
||||
|
||||
// SetTimeEstimate sets the time estimate for a single project issue.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/issues.html#set-a-time-estimate-for-an-issue
|
||||
func (s *IssuesService) SetTimeEstimate(pid interface{}, issue int, opt *SetTimeEstimateOptions, options ...OptionFunc) (*TimeStats, *Response, error) {
|
||||
return s.timeStats.setTimeEstimate(pid, "issues", issue, opt, options...)
|
||||
}
|
||||
|
||||
// ResetTimeEstimate resets the time estimate for a single project issue.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/issues.html#reset-the-time-estimate-for-an-issue
|
||||
func (s *IssuesService) ResetTimeEstimate(pid interface{}, issue int, options ...OptionFunc) (*TimeStats, *Response, error) {
|
||||
return s.timeStats.resetTimeEstimate(pid, "issues", issue, options...)
|
||||
}
|
||||
|
||||
// AddSpentTime adds spent time for a single project issue.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/issues.html#add-spent-time-for-an-issue
|
||||
func (s *IssuesService) AddSpentTime(pid interface{}, issue int, opt *AddSpentTimeOptions, options ...OptionFunc) (*TimeStats, *Response, error) {
|
||||
return s.timeStats.addSpentTime(pid, "issues", issue, opt, options...)
|
||||
}
|
||||
|
||||
// ResetSpentTime resets the spent time for a single project issue.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/issues.html#reset-spent-time-for-an-issue
|
||||
func (s *IssuesService) ResetSpentTime(pid interface{}, issue int, options ...OptionFunc) (*TimeStats, *Response, error) {
|
||||
return s.timeStats.resetSpentTime(pid, "issues", issue, options...)
|
||||
}
|
||||
|
||||
// GetTimeSpent gets the spent time for a single project issue.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/issues.html#get-time-tracking-stats
|
||||
func (s *IssuesService) GetTimeSpent(pid interface{}, issue int, options ...OptionFunc) (*TimeStats, *Response, error) {
|
||||
return s.timeStats.getTimeSpent(pid, "issues", issue, options...)
|
||||
}
|
350
vendor/github.com/xanzy/go-gitlab/jobs.go
generated
vendored
Normal file
350
vendor/github.com/xanzy/go-gitlab/jobs.go
generated
vendored
Normal file
@ -0,0 +1,350 @@
|
||||
//
|
||||
// Copyright 2017, Arkbriar
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/url"
|
||||
"time"
|
||||
)
|
||||
|
||||
// JobsService handles communication with the ci builds related methods
|
||||
// of the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/jobs.html
|
||||
type JobsService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// Job represents a ci build.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/jobs.html
|
||||
type Job struct {
|
||||
Commit *Commit `json:"commit"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
Coverage float64 `json:"coverage"`
|
||||
ArtifactsFile struct {
|
||||
Filename string `json:"filename"`
|
||||
Size int `json:"size"`
|
||||
} `json:"artifacts_file"`
|
||||
FinishedAt *time.Time `json:"finished_at"`
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Ref string `json:"ref"`
|
||||
Runner struct {
|
||||
ID int `json:"id"`
|
||||
Description string `json:"description"`
|
||||
Active bool `json:"active"`
|
||||
IsShared bool `json:"is_shared"`
|
||||
Name string `json:"name"`
|
||||
} `json:"runner"`
|
||||
Stage string `json:"stage"`
|
||||
StartedAt *time.Time `json:"started_at"`
|
||||
Status string `json:"status"`
|
||||
Tag bool `json:"tag"`
|
||||
User *User `json:"user"`
|
||||
}
|
||||
|
||||
// ListJobsOptions are options for two list apis
|
||||
type ListJobsOptions struct {
|
||||
ListOptions
|
||||
Scope []BuildStateValue `url:"scope,omitempty" json:"scope,omitempty"`
|
||||
}
|
||||
|
||||
// ListProjectJobs gets a list of jobs in a project.
|
||||
//
|
||||
// The scope of jobs to show, one or array of: created, pending, running,
|
||||
// failed, success, canceled, skipped; showing all jobs if none provided
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/jobs.html#list-project-jobs
|
||||
func (s *JobsService) ListProjectJobs(pid interface{}, opts *ListJobsOptions, options ...OptionFunc) ([]Job, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/jobs", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opts, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var jobs []Job
|
||||
resp, err := s.client.Do(req, &jobs)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return jobs, resp, err
|
||||
}
|
||||
|
||||
// ListPipelineJobs gets a list of jobs for specific pipeline in a
|
||||
// project. If the pipeline ID is not found, it will respond with 404.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/jobs.html#list-pipeline-jobs
|
||||
func (s *JobsService) ListPipelineJobs(pid interface{}, pipelineID int, opts *ListJobsOptions, options ...OptionFunc) ([]*Job, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/pipelines/%d/jobs", url.QueryEscape(project), pipelineID)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opts, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var jobs []*Job
|
||||
resp, err := s.client.Do(req, &jobs)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return jobs, resp, err
|
||||
}
|
||||
|
||||
// GetJob gets a single job of a project.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/jobs.html#get-a-single-job
|
||||
func (s *JobsService) GetJob(pid interface{}, jobID int, options ...OptionFunc) (*Job, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/jobs/%d", url.QueryEscape(project), jobID)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
job := new(Job)
|
||||
resp, err := s.client.Do(req, job)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return job, resp, err
|
||||
}
|
||||
|
||||
// GetJobArtifacts get jobs artifacts of a project
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/jobs.html#get-job-artifacts
|
||||
func (s *JobsService) GetJobArtifacts(pid interface{}, jobID int, options ...OptionFunc) (io.Reader, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/jobs/%d/artifacts", url.QueryEscape(project), jobID)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
artifactsBuf := new(bytes.Buffer)
|
||||
resp, err := s.client.Do(req, artifactsBuf)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return artifactsBuf, resp, err
|
||||
}
|
||||
|
||||
// DownloadArtifactsFile download the artifacts file from the given
|
||||
// reference name and job provided the job finished successfully.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/jobs.html#download-the-artifacts-file
|
||||
func (s *JobsService) DownloadArtifactsFile(pid interface{}, refName string, job string, options ...OptionFunc) (io.Reader, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/jobs/artifacts/%s/download?job=%s", url.QueryEscape(project), refName, job)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
artifactsBuf := new(bytes.Buffer)
|
||||
resp, err := s.client.Do(req, artifactsBuf)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return artifactsBuf, resp, err
|
||||
}
|
||||
|
||||
// GetTraceFile gets a trace of a specific job of a project
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/jobs.html#get-a-trace-file
|
||||
func (s *JobsService) GetTraceFile(pid interface{}, jobID int, options ...OptionFunc) (io.Reader, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/jobs/%d/trace", url.QueryEscape(project), jobID)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
traceBuf := new(bytes.Buffer)
|
||||
resp, err := s.client.Do(req, traceBuf)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return traceBuf, resp, err
|
||||
}
|
||||
|
||||
// CancelJob cancels a single job of a project.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/jobs.html#cancel-a-job
|
||||
func (s *JobsService) CancelJob(pid interface{}, jobID int, options ...OptionFunc) (*Job, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/jobs/%d/cancel", url.QueryEscape(project), jobID)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
job := new(Job)
|
||||
resp, err := s.client.Do(req, job)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return job, resp, err
|
||||
}
|
||||
|
||||
// RetryJob retries a single job of a project
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/jobs.html#retry-a-job
|
||||
func (s *JobsService) RetryJob(pid interface{}, jobID int, options ...OptionFunc) (*Job, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/jobs/%d/retry", url.QueryEscape(project), jobID)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
job := new(Job)
|
||||
resp, err := s.client.Do(req, job)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return job, resp, err
|
||||
}
|
||||
|
||||
// EraseJob erases a single job of a project, removes a job
|
||||
// artifacts and a job trace.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/jobs.html#erase-a-job
|
||||
func (s *JobsService) EraseJob(pid interface{}, jobID int, options ...OptionFunc) (*Job, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/jobs/%d/erase", url.QueryEscape(project), jobID)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
job := new(Job)
|
||||
resp, err := s.client.Do(req, job)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return job, resp, err
|
||||
}
|
||||
|
||||
// KeepArtifacts prevents artifacts from being deleted when
|
||||
// expiration is set.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/jobs.html#keep-artifacts
|
||||
func (s *JobsService) KeepArtifacts(pid interface{}, jobID int, options ...OptionFunc) (*Job, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/jobs/%d/artifacts/keep", url.QueryEscape(project), jobID)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
job := new(Job)
|
||||
resp, err := s.client.Do(req, job)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return job, resp, err
|
||||
}
|
||||
|
||||
// PlayJob triggers a manual action to start a job.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/jobs.html#play-a-job
|
||||
func (s *JobsService) PlayJob(pid interface{}, jobID int, options ...OptionFunc) (*Job, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/jobs/%d/play", url.QueryEscape(project), jobID)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
job := new(Job)
|
||||
resp, err := s.client.Do(req, job)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return job, resp, err
|
||||
}
|
228
vendor/github.com/xanzy/go-gitlab/labels.go
generated
vendored
Normal file
228
vendor/github.com/xanzy/go-gitlab/labels.go
generated
vendored
Normal file
@ -0,0 +1,228 @@
|
||||
//
|
||||
// Copyright 2017, Sander van Harmelen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// LabelsService handles communication with the label related methods of the
|
||||
// GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html
|
||||
type LabelsService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// Label represents a GitLab label.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html
|
||||
type Label struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Color string `json:"color"`
|
||||
Description string `json:"description"`
|
||||
OpenIssuesCount int `json:"open_issues_count"`
|
||||
ClosedIssuesCount int `json:"closed_issues_count"`
|
||||
OpenMergeRequestsCount int `json:"open_merge_requests_count"`
|
||||
Subscribed bool `json:"subscribed"`
|
||||
Priority int `json:"priority"`
|
||||
}
|
||||
|
||||
func (l Label) String() string {
|
||||
return Stringify(l)
|
||||
}
|
||||
|
||||
// ListLabelsOptions represents the available ListLabels() options.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#list-labels
|
||||
type ListLabelsOptions ListOptions
|
||||
|
||||
// ListLabels gets all labels for given project.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#list-labels
|
||||
func (s *LabelsService) ListLabels(pid interface{}, opt *ListLabelsOptions, options ...OptionFunc) ([]*Label, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/labels", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var l []*Label
|
||||
resp, err := s.client.Do(req, &l)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return l, resp, err
|
||||
}
|
||||
|
||||
// CreateLabelOptions represents the available CreateLabel() options.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#create-a-new-label
|
||||
type CreateLabelOptions struct {
|
||||
Name *string `url:"name,omitempty" json:"name,omitempty"`
|
||||
Color *string `url:"color,omitempty" json:"color,omitempty"`
|
||||
Description *string `url:"description,omitempty" json:"description,omitempty"`
|
||||
}
|
||||
|
||||
// CreateLabel creates a new label for given repository with given name and
|
||||
// color.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#create-a-new-label
|
||||
func (s *LabelsService) CreateLabel(pid interface{}, opt *CreateLabelOptions, options ...OptionFunc) (*Label, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/labels", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
l := new(Label)
|
||||
resp, err := s.client.Do(req, l)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return l, resp, err
|
||||
}
|
||||
|
||||
// DeleteLabelOptions represents the available DeleteLabel() options.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#delete-a-label
|
||||
type DeleteLabelOptions struct {
|
||||
Name *string `url:"name,omitempty" json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// DeleteLabel deletes a label given by its name.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#delete-a-label
|
||||
func (s *LabelsService) DeleteLabel(pid interface{}, opt *DeleteLabelOptions, options ...OptionFunc) (*Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/labels", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(req, nil)
|
||||
}
|
||||
|
||||
// UpdateLabelOptions represents the available UpdateLabel() options.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#delete-a-label
|
||||
type UpdateLabelOptions struct {
|
||||
Name *string `url:"name,omitempty" json:"name,omitempty"`
|
||||
NewName *string `url:"new_name,omitempty" json:"new_name,omitempty"`
|
||||
Color *string `url:"color,omitempty" json:"color,omitempty"`
|
||||
Description *string `url:"description,omitempty" json:"description,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateLabel updates an existing label with new name or now color. At least
|
||||
// one parameter is required, to update the label.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#edit-an-existing-label
|
||||
func (s *LabelsService) UpdateLabel(pid interface{}, opt *UpdateLabelOptions, options ...OptionFunc) (*Label, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/labels", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
l := new(Label)
|
||||
resp, err := s.client.Do(req, l)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return l, resp, err
|
||||
}
|
||||
|
||||
// SubscribeToLabel subscribes the authenticated user to a label to receive
|
||||
// notifications. If the user is already subscribed to the label, the status
|
||||
// code 304 is returned.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/labels.html#subscribe-to-a-label
|
||||
func (s *LabelsService) SubscribeToLabel(pid interface{}, labelID interface{}, options ...OptionFunc) (*Label, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
label, err := parseID(labelID)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/labels/%s/subscribe", url.QueryEscape(project), label)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
l := new(Label)
|
||||
resp, err := s.client.Do(req, l)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return l, resp, err
|
||||
}
|
||||
|
||||
// UnsubscribeFromLabel unsubscribes the authenticated user from a label to not
|
||||
// receive notifications from it. If the user is not subscribed to the label, the
|
||||
// status code 304 is returned.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/labels.html#unsubscribe-from-a-label
|
||||
func (s *LabelsService) UnsubscribeFromLabel(pid interface{}, labelID interface{}, options ...OptionFunc) (*Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
label, err := parseID(labelID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/labels/%s/unsubscribe", url.QueryEscape(project), label)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(req, nil)
|
||||
}
|
125
vendor/github.com/xanzy/go-gitlab/merge_request_approvals.go
generated
vendored
Normal file
125
vendor/github.com/xanzy/go-gitlab/merge_request_approvals.go
generated
vendored
Normal file
@ -0,0 +1,125 @@
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"time"
|
||||
)
|
||||
|
||||
// MergeRequestApprovalsService handles communication with the merge request
|
||||
// approvals related methods of the GitLab API. This includes reading/updating
|
||||
// approval settings and approve/unapproving merge requests
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ee/api/merge_request_approvals.html
|
||||
type MergeRequestApprovalsService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// MergeRequestApprovals represents GitLab merge request approvals.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ee/api/merge_request_approvals.html#merge-request-level-mr-approvals
|
||||
type MergeRequestApprovals struct {
|
||||
ID int `json:"id"`
|
||||
ProjectID int `json:"project_id"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
State string `json:"state"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updated_at"`
|
||||
MergeStatus string `json:"merge_status"`
|
||||
ApprovalsRequired int `json:"approvals_required"`
|
||||
ApprovalsLeft int `json:"approvals_left"`
|
||||
ApprovedBy []struct {
|
||||
User struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Username string `json:"username"`
|
||||
State string `json:"state"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
WebURL string `json:"web_url"`
|
||||
} `json:"user"`
|
||||
} `json:"approved_by"`
|
||||
Approvers []struct {
|
||||
User struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Username string `json:"username"`
|
||||
State string `json:"state"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
WebURL string `json:"web_url"`
|
||||
} `json:"user"`
|
||||
} `json:"approvers"`
|
||||
ApproverGroups []struct {
|
||||
Group struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Path string `json:"path"`
|
||||
Description string `json:"description"`
|
||||
Visibility string `json:"visibility"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
WebURL string `json:"web_url"`
|
||||
FullName string `json:"full_name"`
|
||||
FullPath string `json:"full_path"`
|
||||
LFSEnabled bool `json:"lfs_enabled"`
|
||||
RequestAccessEnabled bool `json:"request_access_enabled"`
|
||||
} `json:"group"`
|
||||
} `json:"approver_group"`
|
||||
}
|
||||
|
||||
func (m MergeRequestApprovals) String() string {
|
||||
return Stringify(m)
|
||||
}
|
||||
|
||||
// ApproveMergeRequestOptions represents the available ApproveMergeRequest() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ee/api/merge_request_approvals.html#approve-merge-request
|
||||
type ApproveMergeRequestOptions struct {
|
||||
Sha *string `url:"sha,omitempty" json:"sha,omitempty"`
|
||||
}
|
||||
|
||||
// ApproveMergeRequest approves a merge request on GitLab. If a non-empty sha
|
||||
// is provided then it must match the sha at the HEAD of the MR.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ee/api/merge_request_approvals.html#approve-merge-request
|
||||
func (s *MergeRequestApprovalsService) ApproveMergeRequest(pid interface{}, mr int, opt *ApproveMergeRequestOptions, options ...OptionFunc) (*MergeRequestApprovals, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/merge_requests/%d/approve", url.QueryEscape(project), mr)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
m := new(MergeRequestApprovals)
|
||||
resp, err := s.client.Do(req, m)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return m, resp, err
|
||||
}
|
||||
|
||||
// UnapproveMergeRequest unapproves a previously approved merge request on GitLab.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ee/api/merge_request_approvals.html#unapprove-merge-request
|
||||
func (s *MergeRequestApprovalsService) UnapproveMergeRequest(pid interface{}, mr int, options ...OptionFunc) (*Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/merge_requests/%d/unapprove", url.QueryEscape(project), mr)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(req, nil)
|
||||
}
|
743
vendor/github.com/xanzy/go-gitlab/merge_requests.go
generated
vendored
Normal file
743
vendor/github.com/xanzy/go-gitlab/merge_requests.go
generated
vendored
Normal file
@ -0,0 +1,743 @@
|
||||
//
|
||||
// Copyright 2017, Sander van Harmelen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"time"
|
||||
)
|
||||
|
||||
// MergeRequestsService handles communication with the merge requests related
|
||||
// methods of the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/merge_requests.html
|
||||
type MergeRequestsService struct {
|
||||
client *Client
|
||||
timeStats *timeStatsService
|
||||
}
|
||||
|
||||
// MergeRequest represents a GitLab merge request.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/merge_requests.html
|
||||
type MergeRequest struct {
|
||||
ID int `json:"id"`
|
||||
IID int `json:"iid"`
|
||||
TargetBranch string `json:"target_branch"`
|
||||
SourceBranch string `json:"source_branch"`
|
||||
ProjectID int `json:"project_id"`
|
||||
Title string `json:"title"`
|
||||
State string `json:"state"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updated_at"`
|
||||
Upvotes int `json:"upvotes"`
|
||||
Downvotes int `json:"downvotes"`
|
||||
Author struct {
|
||||
ID int `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Name string `json:"name"`
|
||||
State string `json:"state"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
} `json:"author"`
|
||||
Assignee struct {
|
||||
ID int `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Name string `json:"name"`
|
||||
State string `json:"state"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
} `json:"assignee"`
|
||||
SourceProjectID int `json:"source_project_id"`
|
||||
TargetProjectID int `json:"target_project_id"`
|
||||
Labels []string `json:"labels"`
|
||||
Description string `json:"description"`
|
||||
WorkInProgress bool `json:"work_in_progress"`
|
||||
Milestone *Milestone `json:"milestone"`
|
||||
MergeWhenPipelineSucceeds bool `json:"merge_when_pipeline_succeeds"`
|
||||
MergeStatus string `json:"merge_status"`
|
||||
MergedBy struct {
|
||||
ID int `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Name string `json:"name"`
|
||||
State string `json:"state"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
} `json:"merged_by"`
|
||||
MergedAt *time.Time `json:"merged_at"`
|
||||
ClosedBy struct {
|
||||
ID int `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Name string `json:"name"`
|
||||
State string `json:"state"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
} `json:"closed_by"`
|
||||
ClosedAt *time.Time `json:"closed_at"`
|
||||
Subscribed bool `json:"subscribed"`
|
||||
SHA string `json:"sha"`
|
||||
MergeCommitSHA string `json:"merge_commit_sha"`
|
||||
UserNotesCount int `json:"user_notes_count"`
|
||||
ChangesCount string `json:"changes_count"`
|
||||
ShouldRemoveSourceBranch bool `json:"should_remove_source_branch"`
|
||||
ForceRemoveSourceBranch bool `json:"force_remove_source_branch"`
|
||||
WebURL string `json:"web_url"`
|
||||
DiscussionLocked bool `json:"discussion_locked"`
|
||||
Changes []struct {
|
||||
OldPath string `json:"old_path"`
|
||||
NewPath string `json:"new_path"`
|
||||
AMode string `json:"a_mode"`
|
||||
BMode string `json:"b_mode"`
|
||||
Diff string `json:"diff"`
|
||||
NewFile bool `json:"new_file"`
|
||||
RenamedFile bool `json:"renamed_file"`
|
||||
DeletedFile bool `json:"deleted_file"`
|
||||
} `json:"changes"`
|
||||
TimeStats *TimeStats `json:"time_stats"`
|
||||
Squash bool `json:"squash"`
|
||||
Pipeline struct {
|
||||
ID int `json:"id"`
|
||||
Ref string `json:"ref"`
|
||||
SHA string `json:"sha"`
|
||||
Status string `json:"status"`
|
||||
} `json:"pipeline"`
|
||||
}
|
||||
|
||||
func (m MergeRequest) String() string {
|
||||
return Stringify(m)
|
||||
}
|
||||
|
||||
// MergeRequestDiffVersion represents Gitlab merge request version.
|
||||
//
|
||||
// Gitlab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#get-a-single-mr-diff-version
|
||||
type MergeRequestDiffVersion struct {
|
||||
ID int `json:"id"`
|
||||
HeadCommitSHA string `json:"head_commit_sha,omitempty"`
|
||||
BaseCommitSHA string `json:"base_commit_sha,omitempty"`
|
||||
StartCommitSHA string `json:"start_commit_sha,omitempty"`
|
||||
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||
MergeRequestID int `json:"merge_request_id,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
RealSize string `json:"real_size,omitempty"`
|
||||
Commits []*Commit `json:"commits,omitempty"`
|
||||
Diffs []*Diff `json:"diffs,omitempty"`
|
||||
}
|
||||
|
||||
func (m MergeRequestDiffVersion) String() string {
|
||||
return Stringify(m)
|
||||
}
|
||||
|
||||
// ListMergeRequestsOptions represents the available ListMergeRequests()
|
||||
// options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#list-merge-requests
|
||||
type ListMergeRequestsOptions struct {
|
||||
ListOptions
|
||||
State *string `url:"state,omitempty" json:"state,omitempty"`
|
||||
OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
|
||||
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
|
||||
Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
|
||||
View *string `url:"view,omitempty" json:"view,omitempty"`
|
||||
Labels Labels `url:"labels,omitempty" json:"labels,omitempty"`
|
||||
CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
|
||||
CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
|
||||
Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
|
||||
AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
|
||||
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
|
||||
MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
|
||||
}
|
||||
|
||||
// ListMergeRequests gets all merge requests. The state parameter can be used
|
||||
// to get only merge requests with a given state (opened, closed, or merged)
|
||||
// or all of them (all). The pagination parameters page and per_page can be
|
||||
// used to restrict the list of merge requests.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#list-merge-requests
|
||||
func (s *MergeRequestsService) ListMergeRequests(opt *ListMergeRequestsOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
|
||||
req, err := s.client.NewRequest("GET", "merge_requests", opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var m []*MergeRequest
|
||||
resp, err := s.client.Do(req, &m)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return m, resp, err
|
||||
}
|
||||
|
||||
// ListProjectMergeRequestsOptions represents the available ListMergeRequests()
|
||||
// options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#list-project-merge-requests
|
||||
type ListProjectMergeRequestsOptions struct {
|
||||
ListOptions
|
||||
IIDs []int `url:"iids[],omitempty" json:"iids,omitempty"`
|
||||
State *string `url:"state,omitempty" json:"state,omitempty"`
|
||||
OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
|
||||
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
|
||||
Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
|
||||
View *string `url:"view,omitempty" json:"view,omitempty"`
|
||||
Labels Labels `url:"labels,omitempty" json:"labels,omitempty"`
|
||||
CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
|
||||
CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
|
||||
Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
|
||||
AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
|
||||
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
|
||||
MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
|
||||
}
|
||||
|
||||
// ListProjectMergeRequests gets all merge requests for this project. The state
|
||||
// parameter can be used to get only merge requests with a given state (opened,
|
||||
// closed, or merged) or all of them (all). The pagination parameters page and
|
||||
// per_page can be used to restrict the list of merge requests.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#list-merge-requests
|
||||
func (s *MergeRequestsService) ListProjectMergeRequests(pid interface{}, opt *ListProjectMergeRequestsOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/merge_requests", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var m []*MergeRequest
|
||||
resp, err := s.client.Do(req, &m)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return m, resp, err
|
||||
}
|
||||
|
||||
// GetMergeRequest shows information about a single merge request.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#get-single-mr
|
||||
func (s *MergeRequestsService) GetMergeRequest(pid interface{}, mergeRequest int, options ...OptionFunc) (*MergeRequest, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/merge_requests/%d", url.QueryEscape(project), mergeRequest)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
m := new(MergeRequest)
|
||||
resp, err := s.client.Do(req, m)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return m, resp, err
|
||||
}
|
||||
|
||||
// GetMergeRequestApprovals gets information about a merge requests approvals
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ee/api/merge_request_approvals.html#merge-request-level-mr-approvals
|
||||
func (s *MergeRequestsService) GetMergeRequestApprovals(pid interface{}, mergeRequest int, options ...OptionFunc) (*MergeRequestApprovals, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/merge_requests/%d/approvals", url.QueryEscape(project), mergeRequest)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
a := new(MergeRequestApprovals)
|
||||
resp, err := s.client.Do(req, a)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return a, resp, err
|
||||
}
|
||||
|
||||
// GetMergeRequestCommitsOptions represents the available GetMergeRequestCommits()
|
||||
// options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#get-single-mr-commits
|
||||
type GetMergeRequestCommitsOptions ListOptions
|
||||
|
||||
// GetMergeRequestCommits gets a list of merge request commits.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#get-single-mr-commits
|
||||
func (s *MergeRequestsService) GetMergeRequestCommits(pid interface{}, mergeRequest int, opt *GetMergeRequestCommitsOptions, options ...OptionFunc) ([]*Commit, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/merge_requests/%d/commits", url.QueryEscape(project), mergeRequest)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var c []*Commit
|
||||
resp, err := s.client.Do(req, &c)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return c, resp, err
|
||||
}
|
||||
|
||||
// GetMergeRequestChanges shows information about the merge request including
|
||||
// its files and changes.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#get-single-mr-changes
|
||||
func (s *MergeRequestsService) GetMergeRequestChanges(pid interface{}, mergeRequest int, options ...OptionFunc) (*MergeRequest, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/merge_requests/%d/changes", url.QueryEscape(project), mergeRequest)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
m := new(MergeRequest)
|
||||
resp, err := s.client.Do(req, m)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return m, resp, err
|
||||
}
|
||||
|
||||
// ListMergeRequestPipelines gets all pipelines for the provided merge request.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#list-mr-pipelines
|
||||
func (s *MergeRequestsService) ListMergeRequestPipelines(pid interface{}, mergeRequest int, options ...OptionFunc) (PipelineList, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/merge_requests/%v/pipelines", url.QueryEscape(project), mergeRequest)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var p PipelineList
|
||||
resp, err := s.client.Do(req, &p)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return p, resp, err
|
||||
}
|
||||
|
||||
// GetIssuesClosedOnMergeOptions represents the available GetIssuesClosedOnMerge()
|
||||
// options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#list-issues-that-will-close-on-merge
|
||||
type GetIssuesClosedOnMergeOptions ListOptions
|
||||
|
||||
// GetIssuesClosedOnMerge gets all the issues that would be closed by merging the
|
||||
// provided merge request.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#list-issues-that-will-close-on-merge
|
||||
func (s *MergeRequestsService) GetIssuesClosedOnMerge(pid interface{}, mergeRequest int, opt *GetIssuesClosedOnMergeOptions, options ...OptionFunc) ([]*Issue, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("/projects/%s/merge_requests/%v/closes_issues", url.QueryEscape(project), mergeRequest)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var i []*Issue
|
||||
resp, err := s.client.Do(req, &i)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return i, resp, err
|
||||
}
|
||||
|
||||
// CreateMergeRequestOptions represents the available CreateMergeRequest()
|
||||
// options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#create-mr
|
||||
type CreateMergeRequestOptions struct {
|
||||
Title *string `url:"title,omitempty" json:"title,omitempty"`
|
||||
Description *string `url:"description,omitempty" json:"description,omitempty"`
|
||||
SourceBranch *string `url:"source_branch,omitempty" json:"source_branch,omitempty"`
|
||||
TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
|
||||
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
|
||||
TargetProjectID *int `url:"target_project_id,omitempty" json:"target_project_id,omitempty"`
|
||||
}
|
||||
|
||||
// CreateMergeRequest creates a new merge request.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#create-mr
|
||||
func (s *MergeRequestsService) CreateMergeRequest(pid interface{}, opt *CreateMergeRequestOptions, options ...OptionFunc) (*MergeRequest, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/merge_requests", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
m := new(MergeRequest)
|
||||
resp, err := s.client.Do(req, m)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return m, resp, err
|
||||
}
|
||||
|
||||
// UpdateMergeRequestOptions represents the available UpdateMergeRequest()
|
||||
// options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#update-mr
|
||||
type UpdateMergeRequestOptions struct {
|
||||
Title *string `url:"title,omitempty" json:"title,omitempty"`
|
||||
Description *string `url:"description,omitempty" json:"description,omitempty"`
|
||||
TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
|
||||
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
|
||||
Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
|
||||
MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"`
|
||||
StateEvent *string `url:"state_event,omitempty" json:"state_event,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateMergeRequest updates an existing project milestone.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#update-mr
|
||||
func (s *MergeRequestsService) UpdateMergeRequest(pid interface{}, mergeRequest int, opt *UpdateMergeRequestOptions, options ...OptionFunc) (*MergeRequest, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/merge_requests/%d", url.QueryEscape(project), mergeRequest)
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
m := new(MergeRequest)
|
||||
resp, err := s.client.Do(req, m)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return m, resp, err
|
||||
}
|
||||
|
||||
// DeleteMergeRequest deletes a merge request.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#delete-a-merge-request
|
||||
func (s *MergeRequestsService) DeleteMergeRequest(pid interface{}, mergeRequest int, options ...OptionFunc) (*Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/merge_requests/%d", url.QueryEscape(project), mergeRequest)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(req, nil)
|
||||
}
|
||||
|
||||
// AcceptMergeRequestOptions represents the available AcceptMergeRequest()
|
||||
// options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#accept-mr
|
||||
type AcceptMergeRequestOptions struct {
|
||||
MergeCommitMessage *string `url:"merge_commit_message,omitempty" json:"merge_commit_message,omitempty"`
|
||||
ShouldRemoveSourceBranch *bool `url:"should_remove_source_branch,omitempty" json:"should_remove_source_branch,omitempty"`
|
||||
MergeWhenPipelineSucceeds *bool `url:"merge_when_pipeline_succeeds,omitempty" json:"merge_when_pipeline_succeeds,omitempty"`
|
||||
Sha *string `url:"sha,omitempty" json:"sha,omitempty"`
|
||||
}
|
||||
|
||||
// AcceptMergeRequest merges changes submitted with MR using this API. If merge
|
||||
// success you get 200 OK. If it has some conflicts and can not be merged - you
|
||||
// get 405 and error message 'Branch cannot be merged'. If merge request is
|
||||
// already merged or closed - you get 405 and error message 'Method Not Allowed'
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#accept-mr
|
||||
func (s *MergeRequestsService) AcceptMergeRequest(pid interface{}, mergeRequest int, opt *AcceptMergeRequestOptions, options ...OptionFunc) (*MergeRequest, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/merge_requests/%d/merge", url.QueryEscape(project), mergeRequest)
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
m := new(MergeRequest)
|
||||
resp, err := s.client.Do(req, m)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return m, resp, err
|
||||
}
|
||||
|
||||
// CancelMergeWhenPipelineSucceeds cancels a merge when pipeline succeeds. If
|
||||
// you don't have permissions to accept this merge request - you'll get a 401.
|
||||
// If the merge request is already merged or closed - you get 405 and error
|
||||
// message 'Method Not Allowed'. In case the merge request is not set to be
|
||||
// merged when the pipeline succeeds, you'll also get a 406 error.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#cancel-merge-when-pipeline-succeeds
|
||||
func (s *MergeRequestsService) CancelMergeWhenPipelineSucceeds(pid interface{}, mergeRequest int, options ...OptionFunc) (*MergeRequest, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/merge_requests/%d/cancel_merge_when_pipeline_succeeds", url.QueryEscape(project), mergeRequest)
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
m := new(MergeRequest)
|
||||
resp, err := s.client.Do(req, m)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return m, resp, err
|
||||
}
|
||||
|
||||
// GetMergeRequestDiffVersionsOptions represents the available
|
||||
// GetMergeRequestDiffVersions() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#get-mr-diff-versions
|
||||
type GetMergeRequestDiffVersionsOptions ListOptions
|
||||
|
||||
// GetMergeRequestDiffVersions get a list of merge request diff versions.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#get-mr-diff-versions
|
||||
func (s *MergeRequestsService) GetMergeRequestDiffVersions(pid interface{}, mergeRequest int, opt *GetMergeRequestDiffVersionsOptions, options ...OptionFunc) ([]*MergeRequestDiffVersion, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/merge_requests/%d/versions", url.QueryEscape(project), mergeRequest)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var v []*MergeRequestDiffVersion
|
||||
resp, err := s.client.Do(req, &v)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return v, resp, err
|
||||
}
|
||||
|
||||
// GetSingleMergeRequestDiffVersion get a single MR diff version
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#get-a-single-mr-diff-version
|
||||
func (s *MergeRequestsService) GetSingleMergeRequestDiffVersion(pid interface{}, mergeRequest, version int, options ...OptionFunc) (*MergeRequestDiffVersion, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/merge_requests/%d/versions/%d", url.QueryEscape(project), mergeRequest, version)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var v = new(MergeRequestDiffVersion)
|
||||
resp, err := s.client.Do(req, v)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return v, resp, err
|
||||
}
|
||||
|
||||
// SubscribeToMergeRequest subscribes the authenticated user to the given merge request
|
||||
// to receive notifications. If the user is already subscribed to the
|
||||
// merge request, the status code 304 is returned.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#subscribe-to-a-merge-request
|
||||
func (s *MergeRequestsService) SubscribeToMergeRequest(pid interface{}, mergeRequest int, options ...OptionFunc) (*MergeRequest, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/merge_requests/%d/subscribe", url.QueryEscape(project), mergeRequest)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
m := new(MergeRequest)
|
||||
resp, err := s.client.Do(req, m)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return m, resp, err
|
||||
}
|
||||
|
||||
// UnsubscribeFromMergeRequest unsubscribes the authenticated user from the given merge request
|
||||
// to not receive notifications from that merge request. If the user is
|
||||
// not subscribed to the merge request, status code 304 is returned.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#unsubscribe-from-a-merge-request
|
||||
func (s *MergeRequestsService) UnsubscribeFromMergeRequest(pid interface{}, mergeRequest int, options ...OptionFunc) (*MergeRequest, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/merge_requests/%d/unsubscribe", url.QueryEscape(project), mergeRequest)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
m := new(MergeRequest)
|
||||
resp, err := s.client.Do(req, m)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return m, resp, err
|
||||
}
|
||||
|
||||
// CreateTodo manually creates a todo for the current user on a merge request.
|
||||
// If there already exists a todo for the user on that merge request,
|
||||
// status code 304 is returned.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#create-a-todo
|
||||
func (s *MergeRequestsService) CreateTodo(pid interface{}, mergeRequest int, options ...OptionFunc) (*Todo, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/merge_requests/%d/todo", url.QueryEscape(project), mergeRequest)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
t := new(Todo)
|
||||
resp, err := s.client.Do(req, t)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return t, resp, err
|
||||
}
|
||||
|
||||
// SetTimeEstimate sets the time estimate for a single project merge request.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#set-a-time-estimate-for-a-merge-request
|
||||
func (s *MergeRequestsService) SetTimeEstimate(pid interface{}, mergeRequest int, opt *SetTimeEstimateOptions, options ...OptionFunc) (*TimeStats, *Response, error) {
|
||||
return s.timeStats.setTimeEstimate(pid, "merge_requests", mergeRequest, opt, options...)
|
||||
}
|
||||
|
||||
// ResetTimeEstimate resets the time estimate for a single project merge request.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#reset-the-time-estimate-for-a-merge-request
|
||||
func (s *MergeRequestsService) ResetTimeEstimate(pid interface{}, mergeRequest int, options ...OptionFunc) (*TimeStats, *Response, error) {
|
||||
return s.timeStats.resetTimeEstimate(pid, "merge_requests", mergeRequest, options...)
|
||||
}
|
||||
|
||||
// AddSpentTime adds spent time for a single project merge request.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#add-spent-time-for-a-merge-request
|
||||
func (s *MergeRequestsService) AddSpentTime(pid interface{}, mergeRequest int, opt *AddSpentTimeOptions, options ...OptionFunc) (*TimeStats, *Response, error) {
|
||||
return s.timeStats.addSpentTime(pid, "merge_requests", mergeRequest, opt, options...)
|
||||
}
|
||||
|
||||
// ResetSpentTime resets the spent time for a single project merge request.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#reset-spent-time-for-a-merge-request
|
||||
func (s *MergeRequestsService) ResetSpentTime(pid interface{}, mergeRequest int, options ...OptionFunc) (*TimeStats, *Response, error) {
|
||||
return s.timeStats.resetSpentTime(pid, "merge_requests", mergeRequest, options...)
|
||||
}
|
||||
|
||||
// GetTimeSpent gets the spent time for a single project merge request.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/merge_requests.html#get-time-tracking-stats
|
||||
func (s *MergeRequestsService) GetTimeSpent(pid interface{}, mergeRequest int, options ...OptionFunc) (*TimeStats, *Response, error) {
|
||||
return s.timeStats.getTimeSpent(pid, "merge_requests", mergeRequest, options...)
|
||||
}
|
267
vendor/github.com/xanzy/go-gitlab/milestones.go
generated
vendored
Normal file
267
vendor/github.com/xanzy/go-gitlab/milestones.go
generated
vendored
Normal file
@ -0,0 +1,267 @@
|
||||
//
|
||||
// Copyright 2017, Sander van Harmelen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"time"
|
||||
)
|
||||
|
||||
// MilestonesService handles communication with the milestone related methods
|
||||
// of the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/milestones.html
|
||||
type MilestonesService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// Milestone represents a GitLab milestone.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/milestones.html
|
||||
type Milestone struct {
|
||||
ID int `json:"id"`
|
||||
IID int `json:"iid"`
|
||||
ProjectID int `json:"project_id"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
StartDate *ISOTime `json:"start_date"`
|
||||
DueDate *ISOTime `json:"due_date"`
|
||||
State string `json:"state"`
|
||||
UpdatedAt *time.Time `json:"updated_at"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
func (m Milestone) String() string {
|
||||
return Stringify(m)
|
||||
}
|
||||
|
||||
// ListMilestonesOptions represents the available ListMilestones() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/milestones.html#list-project-milestones
|
||||
type ListMilestonesOptions struct {
|
||||
ListOptions
|
||||
IIDs []int `url:"iids,omitempty" json:"iids,omitempty"`
|
||||
State string `url:"state,omitempty" json:"state,omitempty"`
|
||||
Search string `url:"search,omitempty" json:"search,omitempty"`
|
||||
}
|
||||
|
||||
// ListMilestones returns a list of project milestones.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/milestones.html#list-project-milestones
|
||||
func (s *MilestonesService) ListMilestones(pid interface{}, opt *ListMilestonesOptions, options ...OptionFunc) ([]*Milestone, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/milestones", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var m []*Milestone
|
||||
resp, err := s.client.Do(req, &m)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return m, resp, err
|
||||
}
|
||||
|
||||
// GetMilestone gets a single project milestone.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/milestones.html#get-single-milestone
|
||||
func (s *MilestonesService) GetMilestone(pid interface{}, milestone int, options ...OptionFunc) (*Milestone, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/milestones/%d", url.QueryEscape(project), milestone)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
m := new(Milestone)
|
||||
resp, err := s.client.Do(req, m)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return m, resp, err
|
||||
}
|
||||
|
||||
// CreateMilestoneOptions represents the available CreateMilestone() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/milestones.html#create-new-milestone
|
||||
type CreateMilestoneOptions struct {
|
||||
Title *string `url:"title,omitempty" json:"title,omitempty"`
|
||||
Description *string `url:"description,omitempty" json:"description,omitempty"`
|
||||
StartDate *ISOTime `url:"start_date,omitempty" json:"start_date,omitempty"`
|
||||
DueDate *ISOTime `url:"due_date,omitempty" json:"due_date,omitempty"`
|
||||
}
|
||||
|
||||
// CreateMilestone creates a new project milestone.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/milestones.html#create-new-milestone
|
||||
func (s *MilestonesService) CreateMilestone(pid interface{}, opt *CreateMilestoneOptions, options ...OptionFunc) (*Milestone, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/milestones", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
m := new(Milestone)
|
||||
resp, err := s.client.Do(req, m)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return m, resp, err
|
||||
}
|
||||
|
||||
// UpdateMilestoneOptions represents the available UpdateMilestone() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/milestones.html#edit-milestone
|
||||
type UpdateMilestoneOptions struct {
|
||||
Title *string `url:"title,omitempty" json:"title,omitempty"`
|
||||
Description *string `url:"description,omitempty" json:"description,omitempty"`
|
||||
StartDate *ISOTime `url:"start_date,omitempty" json:"start_date,omitempty"`
|
||||
DueDate *ISOTime `url:"due_date,omitempty" json:"due_date,omitempty"`
|
||||
StateEvent *string `url:"state_event,omitempty" json:"state_event,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateMilestone updates an existing project milestone.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/milestones.html#edit-milestone
|
||||
func (s *MilestonesService) UpdateMilestone(pid interface{}, milestone int, opt *UpdateMilestoneOptions, options ...OptionFunc) (*Milestone, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/milestones/%d", url.QueryEscape(project), milestone)
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
m := new(Milestone)
|
||||
resp, err := s.client.Do(req, m)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return m, resp, err
|
||||
}
|
||||
|
||||
// DeleteMilestone deletes a specified project milestone.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/milestones.html#delete-project-milestone
|
||||
func (s *MilestonesService) DeleteMilestone(pid interface{}, milestone int, options ...OptionFunc) (*Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/milestones/%d", url.QueryEscape(project), milestone)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return s.client.Do(req, nil)
|
||||
}
|
||||
|
||||
// GetMilestoneIssuesOptions represents the available GetMilestoneIssues() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/milestones.html#get-all-issues-assigned-to-a-single-milestone
|
||||
type GetMilestoneIssuesOptions ListOptions
|
||||
|
||||
// GetMilestoneIssues gets all issues assigned to a single project milestone.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/milestones.html#get-all-issues-assigned-to-a-single-milestone
|
||||
func (s *MilestonesService) GetMilestoneIssues(pid interface{}, milestone int, opt *GetMilestoneIssuesOptions, options ...OptionFunc) ([]*Issue, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/milestones/%d/issues", url.QueryEscape(project), milestone)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var i []*Issue
|
||||
resp, err := s.client.Do(req, &i)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return i, resp, err
|
||||
}
|
||||
|
||||
// GetMilestoneMergeRequestsOptions represents the available
|
||||
// GetMilestoneMergeRequests() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/milestones.html#get-all-merge-requests-assigned-to-a-single-milestone
|
||||
type GetMilestoneMergeRequestsOptions ListOptions
|
||||
|
||||
// GetMilestoneMergeRequests gets all merge requests assigned to a single
|
||||
// project milestone.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/milestones.html#get-all-merge-requests-assigned-to-a-single-milestone
|
||||
func (s *MilestonesService) GetMilestoneMergeRequests(pid interface{}, milestone int, opt *GetMilestoneMergeRequestsOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/milestones/%d/merge_requests", url.QueryEscape(project), milestone)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var mr []*MergeRequest
|
||||
resp, err := s.client.Do(req, &mr)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return mr, resp, err
|
||||
}
|
122
vendor/github.com/xanzy/go-gitlab/namespaces.go
generated
vendored
Normal file
122
vendor/github.com/xanzy/go-gitlab/namespaces.go
generated
vendored
Normal file
@ -0,0 +1,122 @@
|
||||
//
|
||||
// Copyright 2017, Sander van Harmelen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// NamespacesService handles communication with the namespace related methods
|
||||
// of the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/namespaces.html
|
||||
type NamespacesService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// Namespace represents a GitLab namespace.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/namespaces.html
|
||||
type Namespace struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Path string `json:"path"`
|
||||
Kind string `json:"kind"`
|
||||
FullPath string `json:"full_path"`
|
||||
ParentID int `json:"parent_id"`
|
||||
MembersCountWithDescendants int `json:"members_count_with_descendants"`
|
||||
}
|
||||
|
||||
func (n Namespace) String() string {
|
||||
return Stringify(n)
|
||||
}
|
||||
|
||||
// ListNamespacesOptions represents the available ListNamespaces() options.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/namespaces.html#list-namespaces
|
||||
type ListNamespacesOptions struct {
|
||||
ListOptions
|
||||
Search *string `url:"search,omitempty" json:"search,omitempty"`
|
||||
}
|
||||
|
||||
// ListNamespaces gets a list of projects accessible by the authenticated user.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/namespaces.html#list-namespaces
|
||||
func (s *NamespacesService) ListNamespaces(opt *ListNamespacesOptions, options ...OptionFunc) ([]*Namespace, *Response, error) {
|
||||
req, err := s.client.NewRequest("GET", "namespaces", opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var n []*Namespace
|
||||
resp, err := s.client.Do(req, &n)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return n, resp, err
|
||||
}
|
||||
|
||||
// SearchNamespace gets all namespaces that match your string in their name
|
||||
// or path.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/namespaces.html#search-for-namespace
|
||||
func (s *NamespacesService) SearchNamespace(query string, options ...OptionFunc) ([]*Namespace, *Response, error) {
|
||||
var q struct {
|
||||
Search string `url:"search,omitempty" json:"search,omitempty"`
|
||||
}
|
||||
q.Search = query
|
||||
|
||||
req, err := s.client.NewRequest("GET", "namespaces", &q, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var n []*Namespace
|
||||
resp, err := s.client.Do(req, &n)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return n, resp, err
|
||||
}
|
||||
|
||||
// GetNamespace gets a namespace by id.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/namespaces.html#get-namespace-by-id
|
||||
func (s *NamespacesService) GetNamespace(id interface{}, options ...OptionFunc) (*Namespace, *Response, error) {
|
||||
namespace, err := parseID(id)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("namespaces/%s", namespace)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
n := new(Namespace)
|
||||
resp, err := s.client.Do(req, n)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return n, resp, err
|
||||
}
|
490
vendor/github.com/xanzy/go-gitlab/notes.go
generated
vendored
Normal file
490
vendor/github.com/xanzy/go-gitlab/notes.go
generated
vendored
Normal file
@ -0,0 +1,490 @@
|
||||
//
|
||||
// Copyright 2017, Sander van Harmelen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"time"
|
||||
)
|
||||
|
||||
// NotesService handles communication with the notes related methods
|
||||
// of the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/notes.html
|
||||
type NotesService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// Note represents a GitLab note.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/notes.html
|
||||
type Note struct {
|
||||
ID int `json:"id"`
|
||||
Body string `json:"body"`
|
||||
Attachment string `json:"attachment"`
|
||||
Title string `json:"title"`
|
||||
FileName string `json:"file_name"`
|
||||
Author struct {
|
||||
ID int `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
Name string `json:"name"`
|
||||
State string `json:"state"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
WebURL string `json:"web_url"`
|
||||
} `json:"author"`
|
||||
System bool `json:"system"`
|
||||
ExpiresAt *time.Time `json:"expires_at"`
|
||||
UpdatedAt *time.Time `json:"updated_at"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
NoteableID int `json:"noteable_id"`
|
||||
NoteableType string `json:"noteable_type"`
|
||||
NoteableIID int `json:"noteable_iid"`
|
||||
}
|
||||
|
||||
func (n Note) String() string {
|
||||
return Stringify(n)
|
||||
}
|
||||
|
||||
// ListIssueNotesOptions represents the available ListIssueNotes() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notes.html#list-project-issue-notes
|
||||
type ListIssueNotesOptions ListOptions
|
||||
|
||||
// ListIssueNotes gets a list of all notes for a single issue.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notes.html#list-project-issue-notes
|
||||
func (s *NotesService) ListIssueNotes(pid interface{}, issue int, opt *ListIssueNotesOptions, options ...OptionFunc) ([]*Note, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/issues/%d/notes", url.QueryEscape(project), issue)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var n []*Note
|
||||
resp, err := s.client.Do(req, &n)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return n, resp, err
|
||||
}
|
||||
|
||||
// GetIssueNote returns a single note for a specific project issue.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notes.html#get-single-issue-note
|
||||
func (s *NotesService) GetIssueNote(pid interface{}, issue, note int, options ...OptionFunc) (*Note, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/issues/%d/notes/%d", url.QueryEscape(project), issue, note)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
n := new(Note)
|
||||
resp, err := s.client.Do(req, n)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return n, resp, err
|
||||
}
|
||||
|
||||
// CreateIssueNoteOptions represents the available CreateIssueNote()
|
||||
// options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notes.html#create-new-issue-note
|
||||
type CreateIssueNoteOptions struct {
|
||||
Body *string `url:"body,omitempty" json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// CreateIssueNote creates a new note to a single project issue.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notes.html#create-new-issue-note
|
||||
func (s *NotesService) CreateIssueNote(pid interface{}, issue int, opt *CreateIssueNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/issues/%d/notes", url.QueryEscape(project), issue)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
n := new(Note)
|
||||
resp, err := s.client.Do(req, n)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return n, resp, err
|
||||
}
|
||||
|
||||
// UpdateIssueNoteOptions represents the available UpdateIssueNote()
|
||||
// options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notes.html#modify-existing-issue-note
|
||||
type UpdateIssueNoteOptions struct {
|
||||
Body *string `url:"body,omitempty" json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateIssueNote modifies existing note of an issue.
|
||||
//
|
||||
// https://docs.gitlab.com/ce/api/notes.html#modify-existing-issue-note
|
||||
func (s *NotesService) UpdateIssueNote(pid interface{}, issue, note int, opt *UpdateIssueNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/issues/%d/notes/%d", url.QueryEscape(project), issue, note)
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
n := new(Note)
|
||||
resp, err := s.client.Do(req, n)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return n, resp, err
|
||||
}
|
||||
|
||||
// DeleteIssueNote deletes an existing note of an issue.
|
||||
//
|
||||
// https://docs.gitlab.com/ce/api/notes.html#delete-an-issue-note
|
||||
func (s *NotesService) DeleteIssueNote(pid interface{}, issue, note int, options ...OptionFunc) (*Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/issues/%d/notes/%d", url.QueryEscape(project), issue, note)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(req, nil)
|
||||
}
|
||||
|
||||
// ListSnippetNotesOptions represents the available ListSnippetNotes() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notes.html#list-all-snippet-notes
|
||||
type ListSnippetNotesOptions ListOptions
|
||||
|
||||
// ListSnippetNotes gets a list of all notes for a single snippet. Snippet
|
||||
// notes are comments users can post to a snippet.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notes.html#list-all-snippet-notes
|
||||
func (s *NotesService) ListSnippetNotes(pid interface{}, snippet int, opt *ListSnippetNotesOptions, options ...OptionFunc) ([]*Note, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/snippets/%d/notes", url.QueryEscape(project), snippet)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var n []*Note
|
||||
resp, err := s.client.Do(req, &n)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return n, resp, err
|
||||
}
|
||||
|
||||
// GetSnippetNote returns a single note for a given snippet.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notes.html#get-single-snippet-note
|
||||
func (s *NotesService) GetSnippetNote(pid interface{}, snippet, note int, options ...OptionFunc) (*Note, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/snippets/%d/notes/%d", url.QueryEscape(project), snippet, note)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
n := new(Note)
|
||||
resp, err := s.client.Do(req, n)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return n, resp, err
|
||||
}
|
||||
|
||||
// CreateSnippetNoteOptions represents the available CreateSnippetNote()
|
||||
// options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notes.html#create-new-snippet-note
|
||||
type CreateSnippetNoteOptions struct {
|
||||
Body *string `url:"body,omitempty" json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// CreateSnippetNote creates a new note for a single snippet. Snippet notes are
|
||||
// comments users can post to a snippet.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notes.html#create-new-snippet-note
|
||||
func (s *NotesService) CreateSnippetNote(pid interface{}, snippet int, opt *CreateSnippetNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/snippets/%d/notes", url.QueryEscape(project), snippet)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
n := new(Note)
|
||||
resp, err := s.client.Do(req, n)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return n, resp, err
|
||||
}
|
||||
|
||||
// UpdateSnippetNoteOptions represents the available UpdateSnippetNote()
|
||||
// options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notes.html#modify-existing-snippet-note
|
||||
type UpdateSnippetNoteOptions struct {
|
||||
Body *string `url:"body,omitempty" json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateSnippetNote modifies existing note of a snippet.
|
||||
//
|
||||
// https://docs.gitlab.com/ce/api/notes.html#modify-existing-snippet-note
|
||||
func (s *NotesService) UpdateSnippetNote(pid interface{}, snippet, note int, opt *UpdateSnippetNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/snippets/%d/notes/%d", url.QueryEscape(project), snippet, note)
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
n := new(Note)
|
||||
resp, err := s.client.Do(req, n)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return n, resp, err
|
||||
}
|
||||
|
||||
// DeleteSnippetNote deletes an existing note of a snippet.
|
||||
//
|
||||
// https://docs.gitlab.com/ce/api/notes.html#delete-a-snippet-note
|
||||
func (s *NotesService) DeleteSnippetNote(pid interface{}, snippet, note int, options ...OptionFunc) (*Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/snippets/%d/notes/%d", url.QueryEscape(project), snippet, note)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(req, nil)
|
||||
}
|
||||
|
||||
// ListMergeRequestNotesOptions represents the available ListMergeRequestNotes()
|
||||
// options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notes.html#list-all-merge-request-notes
|
||||
type ListMergeRequestNotesOptions ListOptions
|
||||
|
||||
// ListMergeRequestNotes gets a list of all notes for a single merge request.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notes.html#list-all-merge-request-notes
|
||||
func (s *NotesService) ListMergeRequestNotes(pid interface{}, mergeRequest int, opt *ListMergeRequestNotesOptions, options ...OptionFunc) ([]*Note, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/merge_requests/%d/notes", url.QueryEscape(project), mergeRequest)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var n []*Note
|
||||
resp, err := s.client.Do(req, &n)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return n, resp, err
|
||||
}
|
||||
|
||||
// GetMergeRequestNote returns a single note for a given merge request.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notes.html#get-single-merge-request-note
|
||||
func (s *NotesService) GetMergeRequestNote(pid interface{}, mergeRequest, note int, options ...OptionFunc) (*Note, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/merge_requests/%d/notes/%d", url.QueryEscape(project), mergeRequest, note)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
n := new(Note)
|
||||
resp, err := s.client.Do(req, n)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return n, resp, err
|
||||
}
|
||||
|
||||
// CreateMergeRequestNoteOptions represents the available
|
||||
// CreateMergeRequestNote() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notes.html#create-new-merge-request-note
|
||||
type CreateMergeRequestNoteOptions struct {
|
||||
Body *string `url:"body,omitempty" json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// CreateMergeRequestNote creates a new note for a single merge request.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notes.html#create-new-merge-request-note
|
||||
func (s *NotesService) CreateMergeRequestNote(pid interface{}, mergeRequest int, opt *CreateMergeRequestNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/merge_requests/%d/notes", url.QueryEscape(project), mergeRequest)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
n := new(Note)
|
||||
resp, err := s.client.Do(req, n)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return n, resp, err
|
||||
}
|
||||
|
||||
// UpdateMergeRequestNoteOptions represents the available
|
||||
// UpdateMergeRequestNote() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notes.html#modify-existing-merge-request-note
|
||||
type UpdateMergeRequestNoteOptions struct {
|
||||
Body *string `url:"body,omitempty" json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateMergeRequestNote modifies existing note of a merge request.
|
||||
//
|
||||
// https://docs.gitlab.com/ce/api/notes.html#modify-existing-merge-request-note
|
||||
func (s *NotesService) UpdateMergeRequestNote(pid interface{}, mergeRequest, note int, opt *UpdateMergeRequestNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf(
|
||||
"projects/%s/merge_requests/%d/notes/%d", url.QueryEscape(project), mergeRequest, note)
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
n := new(Note)
|
||||
resp, err := s.client.Do(req, n)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return n, resp, err
|
||||
}
|
||||
|
||||
// DeleteMergeRequestNote deletes an existing note of a merge request.
|
||||
//
|
||||
// https://docs.gitlab.com/ce/api/notes.html#delete-a-merge-request-note
|
||||
func (s *NotesService) DeleteMergeRequestNote(pid interface{}, mergeRequest, note int, options ...OptionFunc) (*Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u := fmt.Sprintf(
|
||||
"projects/%s/merge_requests/%d/notes/%d", url.QueryEscape(project), mergeRequest, note)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(req, nil)
|
||||
}
|
214
vendor/github.com/xanzy/go-gitlab/notifications.go
generated
vendored
Normal file
214
vendor/github.com/xanzy/go-gitlab/notifications.go
generated
vendored
Normal file
@ -0,0 +1,214 @@
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// NotificationSettingsService handles communication with the notification settings
|
||||
// related methods of the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/notification_settings.html
|
||||
type NotificationSettingsService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// NotificationSettings represents the Gitlab notification setting.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notification_settings.html#notification-settings
|
||||
type NotificationSettings struct {
|
||||
Level NotificationLevelValue `json:"level"`
|
||||
NotificationEmail string `json:"notification_email"`
|
||||
Events *NotificationEvents `json:"events"`
|
||||
}
|
||||
|
||||
// NotificationEvents represents the available notification setting events.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notification_settings.html#notification-settings
|
||||
type NotificationEvents struct {
|
||||
CloseIssue bool `json:"close_issue"`
|
||||
CloseMergeRequest bool `json:"close_merge_request"`
|
||||
FailedPipeline bool `json:"failed_pipeline"`
|
||||
MergeMergeRequest bool `json:"merge_merge_request"`
|
||||
NewIssue bool `json:"new_issue"`
|
||||
NewMergeRequest bool `json:"new_merge_request"`
|
||||
NewNote bool `json:"new_note"`
|
||||
ReassignIssue bool `json:"reassign_issue"`
|
||||
ReassignMergeRequest bool `json:"reassign_merge_request"`
|
||||
ReopenIssue bool `json:"reopen_issue"`
|
||||
ReopenMergeRequest bool `json:"reopen_merge_request"`
|
||||
SuccessPipeline bool `json:"success_pipeline"`
|
||||
}
|
||||
|
||||
func (ns NotificationSettings) String() string {
|
||||
return Stringify(ns)
|
||||
}
|
||||
|
||||
// GetGlobalSettings returns current notification settings and email address.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notification_settings.html#global-notification-settings
|
||||
func (s *NotificationSettingsService) GetGlobalSettings(options ...OptionFunc) (*NotificationSettings, *Response, error) {
|
||||
u := "notification_settings"
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
ns := new(NotificationSettings)
|
||||
resp, err := s.client.Do(req, ns)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return ns, resp, err
|
||||
}
|
||||
|
||||
// NotificationSettingsOptions represents the available options that can be passed
|
||||
// to the API when updating the notification settings.
|
||||
type NotificationSettingsOptions struct {
|
||||
Level *NotificationLevelValue `url:"level,omitempty" json:"level,omitempty"`
|
||||
NotificationEmail *string `url:"notification_email,omitempty" json:"notification_email,omitempty"`
|
||||
CloseIssue *bool `url:"close_issue,omitempty" json:"close_issue,omitempty"`
|
||||
CloseMergeRequest *bool `url:"close_merge_request,omitempty" json:"close_merge_request,omitempty"`
|
||||
FailedPipeline *bool `url:"failed_pipeline,omitempty" json:"failed_pipeline,omitempty"`
|
||||
MergeMergeRequest *bool `url:"merge_merge_request,omitempty" json:"merge_merge_request,omitempty"`
|
||||
NewIssue *bool `url:"new_issue,omitempty" json:"new_issue,omitempty"`
|
||||
NewMergeRequest *bool `url:"new_merge_request,omitempty" json:"new_merge_request,omitempty"`
|
||||
NewNote *bool `url:"new_note,omitempty" json:"new_note,omitempty"`
|
||||
ReassignIssue *bool `url:"reassign_issue,omitempty" json:"reassign_issue,omitempty"`
|
||||
ReassignMergeRequest *bool `url:"reassign_merge_request,omitempty" json:"reassign_merge_request,omitempty"`
|
||||
ReopenIssue *bool `url:"reopen_issue,omitempty" json:"reopen_issue,omitempty"`
|
||||
ReopenMergeRequest *bool `url:"reopen_merge_request,omitempty" json:"reopen_merge_request,omitempty"`
|
||||
SuccessPipeline *bool `url:"success_pipeline,omitempty" json:"success_pipeline,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateGlobalSettings updates current notification settings and email address.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notification_settings.html#update-global-notification-settings
|
||||
func (s *NotificationSettingsService) UpdateGlobalSettings(opt *NotificationSettingsOptions, options ...OptionFunc) (*NotificationSettings, *Response, error) {
|
||||
if opt.Level != nil && *opt.Level == GlobalNotificationLevel {
|
||||
return nil, nil, errors.New(
|
||||
"notification level 'global' is not valid for global notification settings")
|
||||
}
|
||||
|
||||
u := "notification_settings"
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
ns := new(NotificationSettings)
|
||||
resp, err := s.client.Do(req, ns)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return ns, resp, err
|
||||
}
|
||||
|
||||
// GetSettingsForGroup returns current group notification settings.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notification_settings.html#group-project-level-notification-settings
|
||||
func (s *NotificationSettingsService) GetSettingsForGroup(gid interface{}, options ...OptionFunc) (*NotificationSettings, *Response, error) {
|
||||
group, err := parseID(gid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("groups/%s/notification_settings", url.QueryEscape(group))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
ns := new(NotificationSettings)
|
||||
resp, err := s.client.Do(req, ns)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return ns, resp, err
|
||||
}
|
||||
|
||||
// GetSettingsForProject returns current project notification settings.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notification_settings.html#group-project-level-notification-settings
|
||||
func (s *NotificationSettingsService) GetSettingsForProject(pid interface{}, options ...OptionFunc) (*NotificationSettings, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/notification_settings", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
ns := new(NotificationSettings)
|
||||
resp, err := s.client.Do(req, ns)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return ns, resp, err
|
||||
}
|
||||
|
||||
// UpdateSettingsForGroup updates current group notification settings.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notification_settings.html#update-group-project-level-notification-settings
|
||||
func (s *NotificationSettingsService) UpdateSettingsForGroup(gid interface{}, opt *NotificationSettingsOptions, options ...OptionFunc) (*NotificationSettings, *Response, error) {
|
||||
group, err := parseID(gid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("groups/%s/notification_settings", url.QueryEscape(group))
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
ns := new(NotificationSettings)
|
||||
resp, err := s.client.Do(req, ns)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return ns, resp, err
|
||||
}
|
||||
|
||||
// UpdateSettingsForProject updates current project notification settings.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/notification_settings.html#update-group-project-level-notification-settings
|
||||
func (s *NotificationSettingsService) UpdateSettingsForProject(pid interface{}, opt *NotificationSettingsOptions, options ...OptionFunc) (*NotificationSettings, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/notification_settings", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
ns := new(NotificationSettings)
|
||||
resp, err := s.client.Do(req, ns)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return ns, resp, err
|
||||
}
|
175
vendor/github.com/xanzy/go-gitlab/pages_domains.go
generated
vendored
Normal file
175
vendor/github.com/xanzy/go-gitlab/pages_domains.go
generated
vendored
Normal file
@ -0,0 +1,175 @@
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"time"
|
||||
)
|
||||
|
||||
// PagesDomainsService handles communication with the pages domains
|
||||
// related methods of the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/pages_domains.html
|
||||
type PagesDomainsService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// PagesDomain represents a pages domain.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/pages_domains.html
|
||||
type PagesDomain struct {
|
||||
Domain string `json:"domain"`
|
||||
URL string `json:"url"`
|
||||
ProjectID int `json:"project_id"`
|
||||
Verified bool `json:"verified"`
|
||||
VerificationCode string `json:"verification_code"`
|
||||
EnabledUntil *time.Time `json:"enabled_until"`
|
||||
Certificate struct {
|
||||
Expired bool `json:"expired"`
|
||||
Expiration *time.Time `json:"expiration"`
|
||||
} `json:"certificate"`
|
||||
}
|
||||
|
||||
// ListPagesDomainsOptions represents the available ListPagesDomains() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pages_domains.html#list-pages-domains
|
||||
type ListPagesDomainsOptions ListOptions
|
||||
|
||||
// ListPagesDomains gets a list of project pages domains.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pages_domains.html#list-pages-domains
|
||||
func (s *PagesDomainsService) ListPagesDomains(pid interface{}, opt *ListPagesDomainsOptions, options ...OptionFunc) ([]*PagesDomain, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/pages/domains", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var pd []*PagesDomain
|
||||
resp, err := s.client.Do(req, &pd)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return pd, resp, err
|
||||
}
|
||||
|
||||
// GetPagesDomain get a specific pages domain for a project.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pages_domains.html#single-pages-domain
|
||||
func (s *PagesDomainsService) GetPagesDomain(pid interface{}, domain string, options ...OptionFunc) (*PagesDomain, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/pages/domains/%s", url.QueryEscape(project), domain)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
pd := new(PagesDomain)
|
||||
resp, err := s.client.Do(req, pd)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return pd, resp, err
|
||||
}
|
||||
|
||||
// CreatePagesDomainOptions represents the available CreatePagesDomain() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// // https://docs.gitlab.com/ce/api/pages_domains.html#create-new-pages-domain
|
||||
type CreatePagesDomainOptions struct {
|
||||
Domain *string `url:"domain,omitempty" json:"domain,omitempty"`
|
||||
Certificate *string `url:"certifiate,omitempty" json:"certifiate,omitempty"`
|
||||
Key *string `url:"key,omitempty" json:"key,omitempty"`
|
||||
}
|
||||
|
||||
// CreatePagesDomain creates a new project pages domain.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pages_domains.html#create-new-pages-domain
|
||||
func (s *PagesDomainsService) CreatePagesDomain(pid interface{}, opt *CreatePagesDomainOptions, options ...OptionFunc) (*PagesDomain, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/pages/domains", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
pd := new(PagesDomain)
|
||||
resp, err := s.client.Do(req, pd)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return pd, resp, err
|
||||
}
|
||||
|
||||
// UpdatePagesDomainOptions represents the available UpdatePagesDomain() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pages_domains.html#update-pages-domain
|
||||
type UpdatePagesDomainOptions struct {
|
||||
Cerificate *string `url:"certifiate" json:"certifiate"`
|
||||
Key *string `url:"key" json:"key"`
|
||||
}
|
||||
|
||||
// UpdatePagesDomain updates an existing project pages domain.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pages_domains.html#update-pages-domain
|
||||
func (s *PagesDomainsService) UpdatePagesDomain(pid interface{}, domain string, opt *UpdatePagesDomainOptions, options ...OptionFunc) (*PagesDomain, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/pages/domains/%s", url.QueryEscape(project), domain)
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
pd := new(PagesDomain)
|
||||
resp, err := s.client.Do(req, pd)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return pd, resp, err
|
||||
}
|
||||
|
||||
// DeletePagesDomain deletes an existing prject pages domain.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pages_domains.html#delete-pages-domain
|
||||
func (s *PagesDomainsService) DeletePagesDomain(pid interface{}, domain string, options ...OptionFunc) (*Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/pages/domains/%s", url.QueryEscape(project), domain)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(req, nil)
|
||||
}
|
341
vendor/github.com/xanzy/go-gitlab/pipeline_schedules.go
generated
vendored
Normal file
341
vendor/github.com/xanzy/go-gitlab/pipeline_schedules.go
generated
vendored
Normal file
@ -0,0 +1,341 @@
|
||||
//
|
||||
// Copyright 2018, Sander van Harmelen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"time"
|
||||
)
|
||||
|
||||
// PipelineSchedulesService handles communication with the pipeline
|
||||
// schedules related methods of the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/pipeline_schedules.html
|
||||
type PipelineSchedulesService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// PipelineVariable represents a pipeline schedule variable.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_schedules.html#pipeline-schedule-variable
|
||||
type PipelineVariable struct {
|
||||
Key string `json:"key"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
// PipelineSchedule represents a pipeline schedule.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_schedules.html
|
||||
type PipelineSchedule struct {
|
||||
ID int `json:"id"`
|
||||
Description string `json:"description"`
|
||||
Ref string `json:"ref"`
|
||||
Cron string `json:"cron"`
|
||||
CronTimezone string `json:"cron_timezone"`
|
||||
NextRunAt *time.Time `json:"next_run_at"`
|
||||
Active bool `json:"active"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updated_at"`
|
||||
Owner *User `json:"owner"`
|
||||
LastPipeline struct {
|
||||
ID int `json:"id"`
|
||||
Sha string `json:"sha"`
|
||||
Ref string `json:"ref"`
|
||||
Status string `json:"status"`
|
||||
} `json:"last_pipeline"`
|
||||
Variables []*PipelineVariable `json:"variables"`
|
||||
}
|
||||
|
||||
// ListPipelineSchedulesOptions represents the available ListPipelineTriggers() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_triggers.html#list-project-triggers
|
||||
type ListPipelineSchedulesOptions ListOptions
|
||||
|
||||
// ListPipelineSchedules gets a list of project triggers.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_schedules.html
|
||||
func (s *PipelineSchedulesService) ListPipelineSchedules(pid interface{}, opt *ListPipelineSchedulesOptions, options ...OptionFunc) ([]*PipelineSchedule, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/pipeline_schedules", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var ps []*PipelineSchedule
|
||||
resp, err := s.client.Do(req, &ps)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return ps, resp, err
|
||||
}
|
||||
|
||||
// GetPipelineSchedule gets a pipeline schedule.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_schedules.html
|
||||
func (s *PipelineSchedulesService) GetPipelineSchedule(pid interface{}, schedule int, options ...OptionFunc) (*PipelineSchedule, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/pipeline_schedules/%d", url.QueryEscape(project), schedule)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
p := new(PipelineSchedule)
|
||||
resp, err := s.client.Do(req, p)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return p, resp, err
|
||||
}
|
||||
|
||||
// CreatePipelineScheduleOptions represents the available
|
||||
// CreatePipelineSchedule() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_schedules.html#create-a-new-pipeline-schedule
|
||||
type CreatePipelineScheduleOptions struct {
|
||||
Description *string `url:"description" json:"description"`
|
||||
Ref *string `url:"ref" json:"ref"`
|
||||
Cron *string `url:"cron" json:"cron"`
|
||||
CronTimezone *string `url:"cron_timezone,omitempty" json:"cron_timezone,omitempty"`
|
||||
Active *bool `url:"active,omitempty" json:"active,omitempty"`
|
||||
}
|
||||
|
||||
// CreatePipelineSchedule creates a pipeline schedule.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_schedules.html#create-a-new-pipeline-schedule
|
||||
func (s *PipelineSchedulesService) CreatePipelineSchedule(pid interface{}, opt *CreatePipelineScheduleOptions, options ...OptionFunc) (*PipelineSchedule, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/pipeline_schedules", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
p := new(PipelineSchedule)
|
||||
resp, err := s.client.Do(req, p)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return p, resp, err
|
||||
}
|
||||
|
||||
// EditPipelineScheduleOptions represents the available
|
||||
// EditPipelineSchedule() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_schedules.html#create-a-new-pipeline-schedule
|
||||
type EditPipelineScheduleOptions struct {
|
||||
Description *string `url:"description,omitempty" json:"description,omitempty"`
|
||||
Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
|
||||
Cron *string `url:"cron,omitempty" json:"cron,omitempty"`
|
||||
CronTimezone *string `url:"cron_timezone,omitempty" json:"cron_timezone,omitempty"`
|
||||
Active *bool `url:"active,omitempty" json:"active,omitempty"`
|
||||
}
|
||||
|
||||
// EditPipelineSchedule edits a pipeline schedule.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_schedules.html#edit-a-pipeline-schedule
|
||||
func (s *PipelineSchedulesService) EditPipelineSchedule(pid interface{}, schedule int, opt *EditPipelineScheduleOptions, options ...OptionFunc) (*PipelineSchedule, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/pipeline_schedules/%d", url.QueryEscape(project), schedule)
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
p := new(PipelineSchedule)
|
||||
resp, err := s.client.Do(req, p)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return p, resp, err
|
||||
}
|
||||
|
||||
// TakeOwnershipOfPipelineSchedule sets the owner of the specified
|
||||
// pipeline schedule to the user issuing the request.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_schedules.html#take-ownership-of-a-pipeline-schedule
|
||||
func (s *PipelineSchedulesService) TakeOwnershipOfPipelineSchedule(pid interface{}, schedule int, options ...OptionFunc) (*PipelineSchedule, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/pipeline_schedules/%d/take_ownership", url.QueryEscape(project), schedule)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
p := new(PipelineSchedule)
|
||||
resp, err := s.client.Do(req, p)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return p, resp, err
|
||||
}
|
||||
|
||||
// DeletePipelineSchedule deletes a pipeline schedule.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_schedules.html#delete-a-pipeline-schedule
|
||||
func (s *PipelineSchedulesService) DeletePipelineSchedule(pid interface{}, schedule int, options ...OptionFunc) (*PipelineSchedule, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/pipeline_schedules/%d", url.QueryEscape(project), schedule)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
p := new(PipelineSchedule)
|
||||
resp, err := s.client.Do(req, p)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return p, resp, err
|
||||
}
|
||||
|
||||
// CreatePipelineScheduleVariableOptions represents the available
|
||||
// CreatePipelineScheduleVariable() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_schedules.html#create-a-new-pipeline-schedule
|
||||
type CreatePipelineScheduleVariableOptions struct {
|
||||
Key *string `url:"key" json:"key"`
|
||||
Value *string `url:"value" json:"value"`
|
||||
}
|
||||
|
||||
// CreatePipelineScheduleVariable creates a pipeline schedule variable.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_schedules.html#create-a-new-pipeline-schedule
|
||||
func (s *PipelineSchedulesService) CreatePipelineScheduleVariable(pid interface{}, schedule int, opt *CreatePipelineScheduleVariableOptions, options ...OptionFunc) (*PipelineVariable, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/pipeline_schedules/%d/variables", url.QueryEscape(project), schedule)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
p := new(PipelineVariable)
|
||||
resp, err := s.client.Do(req, p)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return p, resp, err
|
||||
}
|
||||
|
||||
// EditPipelineScheduleVariableOptions represents the available
|
||||
// EditPipelineScheduleVariable() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_schedules.html#edit-a-pipeline-schedule-variable
|
||||
type EditPipelineScheduleVariableOptions struct {
|
||||
Value *string `url:"value" json:"value"`
|
||||
}
|
||||
|
||||
// EditPipelineScheduleVariable creates a pipeline schedule variable.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_schedules.html#edit-a-pipeline-schedule-variable
|
||||
func (s *PipelineSchedulesService) EditPipelineScheduleVariable(pid interface{}, schedule int, key string, opt *EditPipelineScheduleVariableOptions, options ...OptionFunc) (*PipelineVariable, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/pipeline_schedules/%d/variables/%s", url.QueryEscape(project), schedule, key)
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
p := new(PipelineVariable)
|
||||
resp, err := s.client.Do(req, p)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return p, resp, err
|
||||
}
|
||||
|
||||
// DeletePipelineScheduleVariable creates a pipeline schedule variable.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_schedules.html#delete-a-pipeline-schedule-variable
|
||||
func (s *PipelineSchedulesService) DeletePipelineScheduleVariable(pid interface{}, schedule int, key string, options ...OptionFunc) (*PipelineVariable, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/pipeline_schedules/%d/variables/%s", url.QueryEscape(project), schedule, key)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
p := new(PipelineVariable)
|
||||
resp, err := s.client.Do(req, p)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return p, resp, err
|
||||
}
|
232
vendor/github.com/xanzy/go-gitlab/pipeline_triggers.go
generated
vendored
Normal file
232
vendor/github.com/xanzy/go-gitlab/pipeline_triggers.go
generated
vendored
Normal file
@ -0,0 +1,232 @@
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"time"
|
||||
)
|
||||
|
||||
// PipelineTriggersService handles Project pipeline triggers.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_triggers.html
|
||||
type PipelineTriggersService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// PipelineTrigger represents a project pipeline trigger.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_triggers.html#pipeline-triggers
|
||||
type PipelineTrigger struct {
|
||||
ID int `json:"id"`
|
||||
Description string `json:"description"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
DeletedAt *time.Time `json:"deleted_at"`
|
||||
LastUsed *time.Time `json:"last_used"`
|
||||
Token string `json:"token"`
|
||||
UpdatedAt *time.Time `json:"updated_at"`
|
||||
Owner *User `json:"owner"`
|
||||
}
|
||||
|
||||
// ListPipelineTriggersOptions represents the available ListPipelineTriggers() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_triggers.html#list-project-triggers
|
||||
type ListPipelineTriggersOptions ListOptions
|
||||
|
||||
// ListPipelineTriggers gets a list of project triggers.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_triggers.html#list-project-triggers
|
||||
func (s *PipelineTriggersService) ListPipelineTriggers(pid interface{}, opt *ListPipelineTriggersOptions, options ...OptionFunc) ([]*PipelineTrigger, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/triggers", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var pt []*PipelineTrigger
|
||||
resp, err := s.client.Do(req, &pt)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return pt, resp, err
|
||||
}
|
||||
|
||||
// GetPipelineTrigger gets a specific pipeline trigger for a project.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_triggers.html#get-trigger-details
|
||||
func (s *PipelineTriggersService) GetPipelineTrigger(pid interface{}, trigger int, options ...OptionFunc) (*PipelineTrigger, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/triggers/%d", url.QueryEscape(project), trigger)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
pt := new(PipelineTrigger)
|
||||
resp, err := s.client.Do(req, pt)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return pt, resp, err
|
||||
}
|
||||
|
||||
// AddPipelineTriggerOptions represents the available AddPipelineTrigger() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_triggers.html#create-a-project-trigger
|
||||
type AddPipelineTriggerOptions struct {
|
||||
Description *string `url:"description,omitempty" json:"description,omitempty"`
|
||||
}
|
||||
|
||||
// AddPipelineTrigger adds a pipeline trigger to a specified project.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_triggers.html#create-a-project-trigger
|
||||
func (s *PipelineTriggersService) AddPipelineTrigger(pid interface{}, opt *AddPipelineTriggerOptions, options ...OptionFunc) (*PipelineTrigger, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/triggers", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
pt := new(PipelineTrigger)
|
||||
resp, err := s.client.Do(req, pt)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return pt, resp, err
|
||||
}
|
||||
|
||||
// EditPipelineTriggerOptions represents the available EditPipelineTrigger() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_triggers.html#update-a-project-trigger
|
||||
type EditPipelineTriggerOptions struct {
|
||||
Description *string `url:"description,omitempty" json:"description,omitempty"`
|
||||
}
|
||||
|
||||
// EditPipelineTrigger edits a trigger for a specified project.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_triggers.html#update-a-project-trigger
|
||||
func (s *PipelineTriggersService) EditPipelineTrigger(pid interface{}, trigger int, opt *EditPipelineTriggerOptions, options ...OptionFunc) (*PipelineTrigger, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/triggers/%d", url.QueryEscape(project), trigger)
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
pt := new(PipelineTrigger)
|
||||
resp, err := s.client.Do(req, pt)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return pt, resp, err
|
||||
}
|
||||
|
||||
// TakeOwnershipOfPipelineTrigger sets the owner of the specified
|
||||
// pipeline trigger to the user issuing the request.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_triggers.html#take-ownership-of-a-project-trigger
|
||||
func (s *PipelineTriggersService) TakeOwnershipOfPipelineTrigger(pid interface{}, trigger int, options ...OptionFunc) (*PipelineTrigger, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/triggers/%d/take_ownership", url.QueryEscape(project), trigger)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
pt := new(PipelineTrigger)
|
||||
resp, err := s.client.Do(req, pt)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return pt, resp, err
|
||||
}
|
||||
|
||||
// DeletePipelineTrigger removes a trigger from a project.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipeline_triggers.html#remove-a-project-trigger
|
||||
func (s *PipelineTriggersService) DeletePipelineTrigger(pid interface{}, trigger int, options ...OptionFunc) (*Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/triggers/%d", url.QueryEscape(project), trigger)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(req, nil)
|
||||
}
|
||||
|
||||
// RunPipelineTriggerOptions represents the available RunPipelineTrigger() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/ci/triggers/README.html#triggering-a-pipeline
|
||||
type RunPipelineTriggerOptions struct {
|
||||
Ref *string `url:"ref" json:"ref"`
|
||||
Token *string `url:"token" json:"token"`
|
||||
Variables map[string]string `url:"variables,omitempty" json:"variables,omitempty"`
|
||||
}
|
||||
|
||||
// RunPipelineTrigger starts a trigger from a project.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/ci/triggers/README.html#triggering-a-pipeline
|
||||
func (s *PipelineTriggersService) RunPipelineTrigger(pid interface{}, opt *RunPipelineTriggerOptions, options ...OptionFunc) (*Pipeline, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/trigger/pipeline", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
pt := new(Pipeline)
|
||||
resp, err := s.client.Do(req, pt)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return pt, resp, err
|
||||
}
|
220
vendor/github.com/xanzy/go-gitlab/pipelines.go
generated
vendored
Normal file
220
vendor/github.com/xanzy/go-gitlab/pipelines.go
generated
vendored
Normal file
@ -0,0 +1,220 @@
|
||||
//
|
||||
// Copyright 2017, Igor Varavko
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"time"
|
||||
)
|
||||
|
||||
// PipelinesService handles communication with the repositories related
|
||||
// methods of the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html
|
||||
type PipelinesService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// Pipeline represents a GitLab pipeline.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html
|
||||
type Pipeline struct {
|
||||
ID int `json:"id"`
|
||||
Status string `json:"status"`
|
||||
Ref string `json:"ref"`
|
||||
Sha string `json:"sha"`
|
||||
BeforeSha string `json:"before_sha"`
|
||||
Tag bool `json:"tag"`
|
||||
YamlErrors string `json:"yaml_errors"`
|
||||
User struct {
|
||||
Name string `json:"name"`
|
||||
Username string `json:"username"`
|
||||
ID int `json:"id"`
|
||||
State string `json:"state"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
WebURL string `json:"web_url"`
|
||||
}
|
||||
UpdatedAt *time.Time `json:"updated_at"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
StartedAt *time.Time `json:"started_at"`
|
||||
FinishedAt *time.Time `json:"finished_at"`
|
||||
CommittedAt *time.Time `json:"committed_at"`
|
||||
Duration int `json:"duration"`
|
||||
Coverage string `json:"coverage"`
|
||||
}
|
||||
|
||||
func (i Pipeline) String() string {
|
||||
return Stringify(i)
|
||||
}
|
||||
|
||||
// PipelineList represents a GitLab list project pipelines
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html#list-project-pipelines
|
||||
type PipelineList []struct {
|
||||
ID int `json:"id"`
|
||||
Status string `json:"status"`
|
||||
Ref string `json:"ref"`
|
||||
Sha string `json:"sha"`
|
||||
}
|
||||
|
||||
func (i PipelineList) String() string {
|
||||
return Stringify(i)
|
||||
}
|
||||
|
||||
// ListProjectPipelinesOptions represents the available ListProjectPipelines() options.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html#list-project-pipelines
|
||||
type ListProjectPipelinesOptions struct {
|
||||
ListOptions
|
||||
Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
|
||||
Status *BuildStateValue `url:"status,omitempty" json:"status,omitempty"`
|
||||
Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
|
||||
YamlErrors *bool `url:"yaml_errors,omitempty" json:"yaml_errors,omitempty"`
|
||||
Name *string `url:"name,omitempty" json:"name,omitempty"`
|
||||
Username *string `url:"username,omitempty" json:"username,omitempty"`
|
||||
OrderBy *OrderByValue `url:"order_by,omitempty" json:"order_by,omitempty"`
|
||||
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
|
||||
}
|
||||
|
||||
// ListProjectPipelines gets a list of project piplines.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html#list-project-pipelines
|
||||
func (s *PipelinesService) ListProjectPipelines(pid interface{}, opt *ListProjectPipelinesOptions, options ...OptionFunc) (PipelineList, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/pipelines", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var p PipelineList
|
||||
resp, err := s.client.Do(req, &p)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
return p, resp, err
|
||||
}
|
||||
|
||||
// GetPipeline gets a single project pipeline.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html#get-a-single-pipeline
|
||||
func (s *PipelinesService) GetPipeline(pid interface{}, pipeline int, options ...OptionFunc) (*Pipeline, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/pipelines/%d", url.QueryEscape(project), pipeline)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
p := new(Pipeline)
|
||||
resp, err := s.client.Do(req, p)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return p, resp, err
|
||||
}
|
||||
|
||||
// CreatePipelineOptions represents the available CreatePipeline() options.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html#create-a-new-pipeline
|
||||
type CreatePipelineOptions struct {
|
||||
Ref *string `url:"ref,omitempty" json:"ref"`
|
||||
}
|
||||
|
||||
// CreatePipeline creates a new project pipeline.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html#create-a-new-pipeline
|
||||
func (s *PipelinesService) CreatePipeline(pid interface{}, opt *CreatePipelineOptions, options ...OptionFunc) (*Pipeline, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/pipeline", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
p := new(Pipeline)
|
||||
resp, err := s.client.Do(req, p)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return p, resp, err
|
||||
}
|
||||
|
||||
// RetryPipelineBuild retries failed builds in a pipeline
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/pipelines.html#retry-failed-builds-in-a-pipeline
|
||||
func (s *PipelinesService) RetryPipelineBuild(pid interface{}, pipelineID int, options ...OptionFunc) (*Pipeline, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/pipelines/%d/retry", project, pipelineID)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
p := new(Pipeline)
|
||||
resp, err := s.client.Do(req, p)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return p, resp, err
|
||||
}
|
||||
|
||||
// CancelPipelineBuild cancels a pipeline builds
|
||||
//
|
||||
// GitLab API docs:
|
||||
//https://docs.gitlab.com/ce/api/pipelines.html#cancel-a-pipelines-builds
|
||||
func (s *PipelinesService) CancelPipelineBuild(pid interface{}, pipelineID int, options ...OptionFunc) (*Pipeline, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/pipelines/%d/cancel", project, pipelineID)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
p := new(Pipeline)
|
||||
resp, err := s.client.Do(req, p)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return p, resp, err
|
||||
}
|
179
vendor/github.com/xanzy/go-gitlab/project_members.go
generated
vendored
Normal file
179
vendor/github.com/xanzy/go-gitlab/project_members.go
generated
vendored
Normal file
@ -0,0 +1,179 @@
|
||||
//
|
||||
// Copyright 2017, Sander van Harmelen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// ProjectMembersService handles communication with the project members
|
||||
// related methods of the GitLab API.
|
||||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/members.html
|
||||
type ProjectMembersService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// ListProjectMembersOptions represents the available ListProjectMembers()
|
||||
// options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project
|
||||
type ListProjectMembersOptions struct {
|
||||
ListOptions
|
||||
Query *string `url:"query,omitempty" json:"query,omitempty"`
|
||||
}
|
||||
|
||||
// ListProjectMembers gets a list of a project's team members.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project
|
||||
func (s *ProjectMembersService) ListProjectMembers(pid interface{}, opt *ListProjectMembersOptions, options ...OptionFunc) ([]*ProjectMember, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/members", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var pm []*ProjectMember
|
||||
resp, err := s.client.Do(req, &pm)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return pm, resp, err
|
||||
}
|
||||
|
||||
// GetProjectMember gets a project team member.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/members.html#get-a-member-of-a-group-or-project
|
||||
func (s *ProjectMembersService) GetProjectMember(pid interface{}, user int, options ...OptionFunc) (*ProjectMember, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/members/%d", url.QueryEscape(project), user)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
pm := new(ProjectMember)
|
||||
resp, err := s.client.Do(req, pm)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return pm, resp, err
|
||||
}
|
||||
|
||||
// AddProjectMemberOptions represents the available AddProjectMember() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/members.html#add-a-member-to-a-group-or-project
|
||||
type AddProjectMemberOptions struct {
|
||||
UserID *int `url:"user_id,omitempty" json:"user_id,omitempty"`
|
||||
AccessLevel *AccessLevelValue `url:"access_level,omitempty" json:"access_level,omitempty"`
|
||||
}
|
||||
|
||||
// AddProjectMember adds a user to a project team. This is an idempotent
|
||||
// method and can be called multiple times with the same parameters. Adding
|
||||
// team membership to a user that is already a member does not affect the
|
||||
// existing membership.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/members.html#add-a-member-to-a-group-or-project
|
||||
func (s *ProjectMembersService) AddProjectMember(pid interface{}, opt *AddProjectMemberOptions, options ...OptionFunc) (*ProjectMember, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/members", url.QueryEscape(project))
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
pm := new(ProjectMember)
|
||||
resp, err := s.client.Do(req, pm)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return pm, resp, err
|
||||
}
|
||||
|
||||
// EditProjectMemberOptions represents the available EditProjectMember() options.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/members.html#edit-a-member-of-a-group-or-project
|
||||
type EditProjectMemberOptions struct {
|
||||
AccessLevel *AccessLevelValue `url:"access_level,omitempty" json:"access_level,omitempty"`
|
||||
}
|
||||
|
||||
// EditProjectMember updates a project team member to a specified access level..
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/members.html#edit-a-member-of-a-group-or-project
|
||||
func (s *ProjectMembersService) EditProjectMember(pid interface{}, user int, opt *EditProjectMemberOptions, options ...OptionFunc) (*ProjectMember, *Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/members/%d", url.QueryEscape(project), user)
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
pm := new(ProjectMember)
|
||||
resp, err := s.client.Do(req, pm)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return pm, resp, err
|
||||
}
|
||||
|
||||
// DeleteProjectMember removes a user from a project team.
|
||||
//
|
||||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/members.html#remove-a-member-from-a-group-or-project
|
||||
func (s *ProjectMembersService) DeleteProjectMember(pid interface{}, user int, options ...OptionFunc) (*Response, error) {
|
||||
project, err := parseID(pid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/members/%d", url.QueryEscape(project), user)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(req, nil)
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user