1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-22 12:54:53 -05:00

Vendor Update (#14696)

* github.com/yuin/goldmark v1.3.1 -> v1.3.2

* github.com/xanzy/go-gitlab v0.42.0 -> v0.44.0

* github.com/prometheus/client_golang v1.8.0 -> v1.9.0

* github.com/minio/minio-go v7.0.7 -> v7.0.9

* github.com/lafriks/xormstore v1.3.2 -> v1.4.0

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
6543 2021-02-17 04:47:24 +01:00 committed by GitHub
parent dc707aea09
commit fe628d8406
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
137 changed files with 3348 additions and 1312 deletions

18
go.mod
View file

@ -46,6 +46,8 @@ require (
github.com/google/go-github/v32 v32.1.0
github.com/google/uuid v1.2.0
github.com/gorilla/context v1.1.1
github.com/gorilla/sessions v1.2.1 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.6.8 // indirect
github.com/hashicorp/go-version v1.2.1
github.com/huandu/xstrings v1.3.2
@ -57,7 +59,7 @@ require (
github.com/keybase/go-crypto v0.0.0-20200123153347-de78d2cb44f4
github.com/klauspost/compress v1.11.7
github.com/klauspost/pgzip v1.2.5 // indirect
github.com/lafriks/xormstore v1.3.2
github.com/lafriks/xormstore v1.4.0
github.com/lib/pq v1.9.0
github.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96
github.com/markbates/goth v1.66.1
@ -69,7 +71,7 @@ require (
github.com/mholt/archiver/v3 v3.5.0
github.com/microcosm-cc/bluemonday v1.0.4
github.com/minio/md5-simd v1.1.1 // indirect
github.com/minio/minio-go/v7 v7.0.7
github.com/minio/minio-go/v7 v7.0.9
github.com/mitchellh/go-homedir v1.1.0
github.com/msteinert/pam v0.0.0-20200810204841-913b8f8cdf8b
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
@ -80,7 +82,7 @@ require (
github.com/pierrec/lz4/v4 v4.1.1 // indirect
github.com/pkg/errors v0.9.1
github.com/pquerna/otp v1.3.0
github.com/prometheus/client_golang v1.8.0
github.com/prometheus/client_golang v1.9.0
github.com/quasoft/websspi v1.0.0
github.com/rivo/uniseg v0.2.0 // indirect
github.com/sergi/go-diff v1.1.0
@ -98,16 +100,16 @@ require (
github.com/unrolled/render v1.0.3
github.com/urfave/cli v1.22.5
github.com/willf/bitset v1.1.11 // indirect
github.com/xanzy/go-gitlab v0.42.0
github.com/xanzy/go-gitlab v0.44.0
github.com/yohcop/openid-go v1.0.0
github.com/yuin/goldmark v1.3.1
github.com/yuin/goldmark v1.3.2
github.com/yuin/goldmark-highlighting v0.0.0-20200307114337-60d527fdb691
github.com/yuin/goldmark-meta v1.0.0
go.jolheiser.com/hcaptcha v0.0.4
go.jolheiser.com/pwn v0.0.3
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
golang.org/x/net v0.0.0-20210119194325-5f4716e94777
golang.org/x/oauth2 v0.0.0-20210126194326-f9ce19ea3013
golang.org/x/oauth2 v0.0.0-20210210192628-66670185b0cd
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c
golang.org/x/text v0.3.5
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 // indirect
@ -118,8 +120,8 @@ require (
gopkg.in/yaml.v2 v2.4.0
mvdan.cc/xurls/v2 v2.2.0
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251
xorm.io/builder v0.3.7
xorm.io/xorm v1.0.6
xorm.io/builder v0.3.9
xorm.io/xorm v1.0.7
)
replace github.com/hashicorp/go-version => github.com/6543/go-version v1.2.4

60
go.sum
View file

@ -1,6 +1,5 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.37.4/go.mod h1:NHPJ89PdicEuT9hdPXMROBD91xc5uRDxsMtSB16k7hw=
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
@ -183,7 +182,6 @@ github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cheggaaa/pb v1.0.29/go.mod h1:W40334L7FMC5JKWldsTWbdGjLo0RxUKK73K+TuPxX30=
github.com/chris-ramon/douceur v0.2.0 h1:IDMEdxlEUUBYBKE4z/mJnFyVXox+MjuEVDJNN27glkU=
github.com/chris-ramon/douceur v0.2.0/go.mod h1:wDW5xjJdeoMm1mRt4sD4c/LbF/mWdEpRXQKjTR8nIBE=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
@ -232,8 +230,6 @@ github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/denisenkom/go-mssqldb v0.0.0-20190707035753-2be1aa521ff4/go.mod h1:zAg7JM8CkOJ43xKXIj7eRO9kmWm/TW578qo+oDO6tuM=
github.com/denisenkom/go-mssqldb v0.0.0-20190924004331-208c0a498538/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
github.com/denisenkom/go-mssqldb v0.0.0-20191128021309-1d7a30a10f73/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzqk8QCaRC4os14xoKDdbHqqlJtJA0oc1ZAjg=
github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
@ -274,8 +270,6 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
github.com/ethantkoenig/rupture v1.0.0 h1:gPInt1N30UErGNzd8t5js5Qbnpjcd1l6yU2MCrJxIe8=
github.com/ethantkoenig/rupture v1.0.0/go.mod h1:GyE9QabHfxA6ch0NZgwsHopRbOLcYjUr9g4FTJmq0WM=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg=
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4=
@ -435,7 +429,6 @@ github.com/go-swagger/scan-repo-boundary v0.0.0-20180623220736-973b3573c013 h1:l
github.com/go-swagger/scan-repo-boundary v0.0.0-20180623220736-973b3573c013/go.mod h1:b65mBPzqzZWxOZGxSWrqs4GInLIn+u99Q9q7p+GKni0=
github.com/go-testfixtures/testfixtures/v3 v3.4.1 h1:Qz9y0wUOXPHzKhK6C79A/menChtEu/xd0Dn5ngVyMD0=
github.com/go-testfixtures/testfixtures/v3 v3.4.1/go.mod h1:P4L3WxgOsCLbAeUC50qX5rdj1ULZfUMqgCbqah3OH5U=
github.com/go-xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:56xuuqnHyryaerycW3BfssRdxQstACi0Epw/yC5E2xM=
github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0=
github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY=
github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg=
@ -565,6 +558,8 @@ github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+
github.com/gorilla/sessions v1.1.1/go.mod h1:8KCfur6+4Mqcc6S0FEfKuN15Vl5MgXW92AE8ovaJD0w=
github.com/gorilla/sessions v1.2.0 h1:S7P+1Hm5V/AT9cjEcUD5uDaQSX0OE577aCXgoaKpYbQ=
github.com/gorilla/sessions v1.2.0/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
github.com/gorilla/sessions v1.2.1 h1:DHd3rPN5lE3Ts3D8rKkQ8x/0kqfeNmBAaiSi+o7FsgI=
github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
@ -579,6 +574,8 @@ github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyN
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM=
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI=
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
@ -723,8 +720,8 @@ github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/lafriks/xormstore v1.3.2 h1:hqi3F8s/B4rz8GuEZZDuHuOxRjeuOpEI/cC7vcnWwH4=
github.com/lafriks/xormstore v1.3.2/go.mod h1:mVNIwIa25QIr8rfR7YlVjrqN/apswHkVdtLCyVYBzXw=
github.com/lafriks/xormstore v1.4.0 h1:DX1yS9WUhVY+MTHGaOJ2tDVpwL1w/247iro5KR0BQEQ=
github.com/lafriks/xormstore v1.4.0/go.mod h1:5a3wJ6Ro0TFJmJcH1ywtHO/fBEIWYfSfO4WTYmM7qEk=
github.com/lestrrat-go/jwx v0.9.0/go.mod h1:iEoxlYfZjvoGpuWwxUz+eR5e6KTJGsaRcy/YNA/UnBk=
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
@ -763,7 +760,6 @@ github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kN
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
@ -773,15 +769,12 @@ github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.10 h1:CoZ3S2P7pvtP45xOtBw+/mDL2z0RKI576gSkzRRpdGg=
github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus=
github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg=
@ -802,11 +795,10 @@ github.com/miekg/dns v1.1.30/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7
github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw=
github.com/minio/md5-simd v1.1.1 h1:9ojcLbuZ4gXbB2sX53MKn8JUZ0sB/2wfwsEcRw+I08U=
github.com/minio/md5-simd v1.1.1/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw=
github.com/minio/minio-go/v7 v7.0.7 h1:Qld/xb8C1Pwbu0jU46xAceyn9xXKCMW+3XfNbpmTB70=
github.com/minio/minio-go/v7 v7.0.7/go.mod h1:pEZBUa+L2m9oECoIA6IcSK8bv/qggtQVLovjeKK5jYc=
github.com/minio/minio-go/v7 v7.0.9 h1:v+RS2/dpRq+XaarlZItHd3MVjjQcN2noRn4HxmVdmg4=
github.com/minio/minio-go/v7 v7.0.9/go.mod h1:td4gW1ldOsj1PbSNS+WYK43j+P1XVhX/8W8awaYlBFo=
github.com/minio/sha256-simd v0.1.1 h1:5QHSlgo3nt5yKOJrC7W8w7X+NFl8cMPZm96iu8kKUJU=
github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM=
github.com/minio/sio v0.2.1/go.mod h1:8b0yPp2avGThviy/+OCJBI6OMpvxoUuiLvE6F1lebhw=
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
@ -927,8 +919,8 @@ github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDf
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og=
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
github.com/prometheus/client_golang v1.8.0 h1:zvJNkoCFAnYFNC24FV8nW4JdRJ3GIFcLbg65lL/JDcw=
github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM=
github.com/prometheus/client_golang v1.9.0 h1:Rrch9mh17XcxvEu9D9DEpb4isxjGBtcevQjKvxPRQIU=
github.com/prometheus/client_golang v1.9.0/go.mod h1:FqZLKOZnGdFAhOK4nqGHa7D66IdsO+O441Eve7ptJDU=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
@ -942,8 +934,8 @@ github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA=
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
github.com/prometheus/common v0.14.0 h1:RHRyE8UocrbjU+6UvRzwi6HjiDfxrrBU91TtbKzkGp4=
github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s=
github.com/prometheus/common v0.15.0 h1:4fgOnadei3EZvgRwxJ7RMpG1k1pOZth5Pc13tyspaKM=
github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
@ -997,14 +989,12 @@ github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/assertions v1.1.1 h1:T/YLemO5Yp7KPzS+lVtu+WsHn8yoSwTfItdAd1r3cck=
github.com/smartystreets/assertions v1.1.1/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM=
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
@ -1087,8 +1077,8 @@ github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv
github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
github.com/willf/bitset v1.1.11 h1:N7Z7E9UvjW+sGsEl7k/SJrvY2reP1A07MrGuCjIOjRE=
github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr3+MjI=
github.com/xanzy/go-gitlab v0.42.0 h1:daNdMFnw2FG+lDRBcX+YLnKbqIKMdefVyVztMHwsFhk=
github.com/xanzy/go-gitlab v0.42.0/go.mod h1:sPLojNBn68fMUWSxIJtdVVIP8uSBYqesTfDUseX11Ug=
github.com/xanzy/go-gitlab v0.44.0 h1:cEiGhqu7EpFGuei2a2etAwB+x6403E5CvpLn35y+GPs=
github.com/xanzy/go-gitlab v0.44.0/go.mod h1:sPLojNBn68fMUWSxIJtdVVIP8uSBYqesTfDUseX11Ug=
github.com/xanzy/ssh-agent v0.2.1 h1:TCbipTQL2JiiCprBWx9frJ2eJlCYT00NmctrHxVAr70=
github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4=
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=
@ -1104,8 +1094,8 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.1 h1:eVwehsLsZlCJCwXyGLgg+Q4iFWE/eTIMG0e8waCmm/I=
github.com/yuin/goldmark v1.3.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.3.2 h1:YjHC5TgyMmHpicTgEqDN0Q96Xo8K6tLXPnmNOHXCgs0=
github.com/yuin/goldmark v1.3.2/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark-highlighting v0.0.0-20200307114337-60d527fdb691 h1:VWSxtAiQNh3zgHJpdpkpVYjTPqRE3P6UZCOPa1nRDio=
github.com/yuin/goldmark-highlighting v0.0.0-20200307114337-60d527fdb691/go.mod h1:YLF3kDffRfUH/bTxOxHhV6lxwIB3Vfj91rEwNMS9MXo=
github.com/yuin/goldmark-meta v1.0.0 h1:ScsatUIT2gFS6azqzLGUjgOnELsBOxMXerM3ogdJhAM=
@ -1166,7 +1156,6 @@ golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACk
golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
@ -1276,8 +1265,8 @@ golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4Iltr
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20210126194326-f9ce19ea3013 h1:55H5j7lotzuFCEOKDsMch+fRNUQ9DgtyHOUP31FNqKc=
golang.org/x/oauth2 v0.0.0-20210126194326-f9ce19ea3013/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20210210192628-66670185b0cd h1:2arJsLyTCJGek+eeptQ3z49Rqndm0f+zvvpwNIXWNIA=
golang.org/x/oauth2 v0.0.0-20210210192628-66670185b0cd/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@ -1350,9 +1339,9 @@ golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201126233918-771906719818/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk=
@ -1471,16 +1460,13 @@ google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7
google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
google.golang.org/appengine v1.6.4/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
@ -1600,11 +1586,11 @@ sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251 h1:mUcz5b3FJbP5Cvdq7Khzn6J9OCUQJaBwgBkCR+MOwSs=
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251/go.mod h1:FJGmPh3vz9jSos1L/F91iAgnC/aejc0wIIrF2ZwJxdY=
xorm.io/builder v0.3.6/go.mod h1:LEFAPISnRzG+zxaxj2vPicRwz67BdhFreKg8yv8/TgU=
xorm.io/builder v0.3.7 h1:2pETdKRK+2QG4mLX4oODHEhn5Z8j1m8sXa7jfu+/SZI=
xorm.io/builder v0.3.7/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE=
xorm.io/core v0.7.2 h1:mEO22A2Z7a3fPaZMk6gKL/jMD80iiyNwRrX5HOv3XLw=
xorm.io/core v0.7.2/go.mod h1:jJfd0UAEzZ4t87nbQYtVjmqpIODugN6PD2D9E+dJvdM=
xorm.io/xorm v0.8.0/go.mod h1:ZkJLEYLoVyg7amJK/5r779bHyzs2AU8f8VMiP6BM7uY=
xorm.io/builder v0.3.9 h1:Sd65/LdWyO7LR8+Cbd+e7mm3sK/7U9k0jS3999IDHMc=
xorm.io/builder v0.3.9/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE=
xorm.io/xorm v1.0.6 h1:7eco1c8QUpGz+3dztpLDj9gU1bTiQdFC/KtmPaLxUJk=
xorm.io/xorm v1.0.6/go.mod h1:uF9EtbhODq5kNWxMbnBEj8hRRZnlcNSz2t2N7HW/+A4=
xorm.io/xorm v1.0.7 h1:26yBTDVI+CfQpVz2Y88fISh+aiJXIPP4eNoTJlwzsC4=
xorm.io/xorm v1.0.7/go.mod h1:uF9EtbhODq5kNWxMbnBEj8hRRZnlcNSz2t2N7HW/+A4=

View file

@ -41,7 +41,11 @@ Let's start with an example that shows the sessions API in a nutshell:
session.Values["foo"] = "bar"
session.Values[42] = 43
// Save it before we write to the response/return from the handler.
session.Save(r, w)
err := session.Save(r, w)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
}
```
@ -70,6 +74,7 @@ Other implementations of the `sessions.Store` interface:
- [github.com/EnumApps/clustersqlstore](https://github.com/EnumApps/clustersqlstore) - MySQL Cluster
- [github.com/antonlindstrom/pgstore](https://github.com/antonlindstrom/pgstore) - PostgreSQL
- [github.com/boj/redistore](https://github.com/boj/redistore) - Redis
- [github.com/rbcervilla/redisstore](https://github.com/rbcervilla/redisstore) - Redis (Single, Sentinel, Cluster)
- [github.com/boj/rethinkstore](https://github.com/boj/rethinkstore) - RethinkDB
- [github.com/boj/riakstore](https://github.com/boj/riakstore) - Riak
- [github.com/michaeljs1990/sqlitestore](https://github.com/michaeljs1990/sqlitestore) - SQLite
@ -77,6 +82,8 @@ Other implementations of the `sessions.Store` interface:
- [github.com/gernest/qlstore](https://github.com/gernest/qlstore) - ql
- [github.com/quasoft/memstore](https://github.com/quasoft/memstore) - In-memory implementation for use in unit tests
- [github.com/lafriks/xormstore](https://github.com/lafriks/xormstore) - XORM (MySQL, PostgreSQL, SQLite, Microsoft SQL Server, TiDB)
- [github.com/GoogleCloudPlatform/firestore-gorilla-sessions](https://github.com/GoogleCloudPlatform/firestore-gorilla-sessions) - Cloud Firestore
- [github.com/stephenafamo/crdbstore](https://github.com/stephenafamo/crdbstore) - CockroachDB
## License

View file

@ -30,7 +30,8 @@ Let's start with an example that shows the sessions API in a nutshell:
// environmental variable, or flag (or both), and don't accidentally commit it
// alongside your code. Ensure your key is sufficiently random - i.e. use Go's
// crypto/rand or securecookie.GenerateRandomKey(32) and persist the result.
var store = sessions.NewCookieStore(os.Getenv("SESSION_KEY"))
// Ensure SESSION_KEY exists in the environment, or sessions will fail.
var store = sessions.NewCookieStore([]byte(os.Getenv("SESSION_KEY")))
func MyHandler(w http.ResponseWriter, r *http.Request) {
// Get a session. Get() always returns a session, even if empty.
@ -44,7 +45,11 @@ Let's start with an example that shows the sessions API in a nutshell:
session.Values["foo"] = "bar"
session.Values[42] = 43
// Save it before we write to the response/return from the handler.
session.Save(r, w)
err = session.Save(r, w)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
}
First we initialize a session store calling NewCookieStore() and passing a
@ -82,7 +87,11 @@ flashes, call session.Flashes(). Here is an example:
// Set a new flash.
session.AddFlash("Hello, flash messages world!")
}
session.Save(r, w)
err = session.Save(r, w)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
}
Flash messages are useful to set information to be read after a redirection,
@ -185,7 +194,11 @@ at once: it's sessions.Save(). Here's an example:
session2, _ := store.Get(r, "session-two")
session2.Values[42] = 43
// Save all sessions.
sessions.Save(r, w)
err = sessions.Save(r, w)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
}
This is possible because when we call Get() from a session store, it adds the

View file

@ -32,6 +32,7 @@ func DefaultPooledTransport() *http.Transport {
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
ForceAttemptHTTP2: true,
MaxIdleConnsPerHost: runtime.GOMAXPROCS(0) + 1,
}
return transport

View file

@ -1 +1,3 @@
module github.com/hashicorp/go-cleanhttp
go 1.13

View file

@ -1,18 +1,19 @@
module github.com/lafriks/xormstore
go 1.11
go 1.13
require (
github.com/denisenkom/go-mssqldb v0.0.0-20190924004331-208c0a498538
github.com/go-sql-driver/mysql v1.4.1
github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc
github.com/go-sql-driver/mysql v1.5.0
github.com/golang/protobuf v1.3.1 // indirect
github.com/gorilla/context v1.1.1
github.com/gorilla/securecookie v1.1.1
github.com/gorilla/sessions v1.2.0
github.com/lib/pq v1.2.0
github.com/mattn/go-sqlite3 v1.11.0
github.com/kr/pretty v0.2.1 // indirect
github.com/lib/pq v1.7.0
github.com/mattn/go-sqlite3 v1.14.0
golang.org/x/crypto v0.0.0-20190927123631-a832865fa7ad // indirect
google.golang.org/appengine v1.6.4 // indirect
golang.org/x/text v0.3.2 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
xorm.io/core v0.7.2
xorm.io/xorm v0.8.0
xorm.io/xorm v1.0.6
)

View file

@ -1,171 +1,85 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.37.4/go.mod h1:NHPJ89PdicEuT9hdPXMROBD91xc5uRDxsMtSB16k7hw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGqTOXqu2aRi/XEQxDCBwM8yJtE6s=
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:EXuID2Zs0pAQhH8yz+DNjUbjppKQzKFAn28TMYPB6IU=
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/denisenkom/go-mssqldb v0.0.0-20190707035753-2be1aa521ff4/go.mod h1:zAg7JM8CkOJ43xKXIj7eRO9kmWm/TW578qo+oDO6tuM=
github.com/denisenkom/go-mssqldb v0.0.0-20190924004331-208c0a498538 h1:bpWCJ5MddHsv4Xtl3azkK89mZzd/vvut32mvAnKbyUA=
github.com/denisenkom/go-mssqldb v0.0.0-20190924004331-208c0a498538/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzqk8QCaRC4os14xoKDdbHqqlJtJA0oc1ZAjg=
github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA=
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:9wScpmSP5A3Bk8V3XHWUcJmYTh+ZnlHVyc+A4oZYS3Y=
github.com/go-xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:56xuuqnHyryaerycW3BfssRdxQstACi0Epw/yC5E2xM=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8=
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ=
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
github.com/gorilla/sessions v1.2.0 h1:S7P+1Hm5V/AT9cjEcUD5uDaQSX0OE577aCXgoaKpYbQ=
github.com/gorilla/sessions v1.2.0/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0=
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/mattn/go-sqlite3 v1.11.0 h1:LDdKkqtYlom37fkvqs8rMPFKAMe8+SgjbwZ6ex1/A/Q=
github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/lib/pq v1.7.0 h1:h93mCPfUSkaul3Ka/VG8uZdmW1uMHDGxzu0NWHuJmHY=
github.com/lib/pq v1.7.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/mattn/go-sqlite3 v1.14.0 h1:mLyGNKR8+Vv9CAU7PphKa2hkEqxxhn8i32J6FPj1/QA=
github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE=
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
github.com/ziutek/mymysql v1.5.4 h1:GB0qdRGsTwQSBVYuVShFBKaXSnSnYYC2d9knnE1LHFs=
github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0=
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190927123631-a832865fa7ad h1:5E5raQxcv+6CZ11RrBYQe5WRbUIWpScjh0kvHZkZIrQ=
golang.org/x/crypto v0.0.0-20190927123631-a832865fa7ad/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e h1:3G+cUijn7XD+S4eJFddp53Pv7+slrESplyjG25HgL+k=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.4 h1:WiKh4+/eMB2HaY7QhCfW/R7MuRAoA8QMCSJA6jP5/fo=
google.golang.org/appengine v1.6.4/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
xorm.io/builder v0.3.6 h1:ha28mQ2M+TFx96Hxo+iq6tQgnkC9IZkM6D8w9sKHHF8=
xorm.io/builder v0.3.6/go.mod h1:LEFAPISnRzG+zxaxj2vPicRwz67BdhFreKg8yv8/TgU=
xorm.io/core v0.7.2 h1:mEO22A2Z7a3fPaZMk6gKL/jMD80iiyNwRrX5HOv3XLw=
xorm.io/core v0.7.2/go.mod h1:jJfd0UAEzZ4t87nbQYtVjmqpIODugN6PD2D9E+dJvdM=
xorm.io/xorm v0.8.0 h1:iALxgJrX8O00f8Jk22GbZwPmxJNgssV5Mv4uc2HL9PM=
xorm.io/xorm v0.8.0/go.mod h1:ZkJLEYLoVyg7amJK/5r779bHyzs2AU8f8VMiP6BM7uY=
xorm.io/builder v0.3.7 h1:2pETdKRK+2QG4mLX4oODHEhn5Z8j1m8sXa7jfu+/SZI=
xorm.io/builder v0.3.7/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE=
xorm.io/xorm v1.0.6 h1:7eco1c8QUpGz+3dztpLDj9gU1bTiQdFC/KtmPaLxUJk=
xorm.io/xorm v1.0.6/go.mod h1:uF9EtbhODq5kNWxMbnBEj8hRRZnlcNSz2t2N7HW/+A4=

View file

@ -202,7 +202,7 @@ func (opts CopySrcOptions) validate() (err error) {
// Low level implementation of CopyObject API, supports only upto 5GiB worth of copy.
func (c Client) copyObjectDo(ctx context.Context, srcBucket, srcObject, destBucket, destObject string,
metadata map[string]string, dstOpts PutObjectOptions) (ObjectInfo, error) {
metadata map[string]string, srcOpts CopySrcOptions, dstOpts PutObjectOptions) (ObjectInfo, error) {
// Build headers.
headers := make(http.Header)
@ -240,7 +240,9 @@ func (c Client) copyObjectDo(ctx context.Context, srcBucket, srcObject, destBuck
// Set the source header
headers.Set("x-amz-copy-source", s3utils.EncodePath(srcBucket+"/"+srcObject))
if srcOpts.VersionID != "" {
headers.Set("x-amz-copy-source", s3utils.EncodePath(srcBucket+"/"+srcObject)+"?versionId="+srcOpts.VersionID)
}
// Send upload-part-copy request
resp, err := c.executeMethod(ctx, http.MethodPut, reqMetadata)
defer closeResponse(resp)

View file

@ -104,9 +104,23 @@ func (c Client) GetObject(ctx context.Context, bucketName, objectName string, op
// reached our EOF.
size, err := readFull(httpReader, req.Buffer)
if size > 0 && err == io.ErrUnexpectedEOF {
// If an EOF happens after reading some but not
// all the bytes ReadFull returns ErrUnexpectedEOF
err = io.EOF
if int64(size) < objectInfo.Size {
// In situations when returned size
// is less than the expected content
// length set by the server, make sure
// we return io.ErrUnexpectedEOF
err = io.ErrUnexpectedEOF
} else {
// If an EOF happens after reading some but not
// all the bytes ReadFull returns ErrUnexpectedEOF
err = io.EOF
}
} else if size == 0 && err == io.EOF && objectInfo.Size > 0 {
// Special cases when server writes more data
// than the content-length, net/http response
// body returns an error, instead of converting
// it to io.EOF - return unexpected EOF.
err = io.ErrUnexpectedEOF
}
// Send back the first response.
resCh <- getResponse{

View file

@ -28,7 +28,7 @@ import (
//AdvancedGetOptions for internal use by MinIO server - not intended for client use.
type AdvancedGetOptions struct {
ReplicationDeleteMarker bool
ReplicationProxyRequest bool
ReplicationProxyRequest string
}
// GetObjectOptions are used to specify additional headers or options
@ -56,8 +56,8 @@ func (o GetObjectOptions) Header() http.Header {
}
// this header is set for active-active replication scenario where GET/HEAD
// to site A is proxy'd to site B if object/version missing on site A.
if o.Internal.ReplicationProxyRequest {
headers.Set(minIOBucketReplicationProxyRequest, "true")
if o.Internal.ReplicationProxyRequest != "" {
headers.Set(minIOBucketReplicationProxyRequest, o.Internal.ReplicationProxyRequest)
}
return headers
}

View file

@ -108,7 +108,7 @@ type Options struct {
// Global constants.
const (
libraryName = "minio-go"
libraryVersion = "v7.0.7"
libraryVersion = "v7.0.9"
)
// User Agent should always following the below style.

View file

@ -56,8 +56,8 @@ func (c Core) ListObjectsV2(bucketName, objectPrefix, continuationToken string,
}
// CopyObject - copies an object from source object to destination object on server side.
func (c Core) CopyObject(ctx context.Context, sourceBucket, sourceObject, destBucket, destObject string, metadata map[string]string, dstOpts PutObjectOptions) (ObjectInfo, error) {
return c.copyObjectDo(ctx, sourceBucket, sourceObject, destBucket, destObject, metadata, dstOpts)
func (c Core) CopyObject(ctx context.Context, sourceBucket, sourceObject, destBucket, destObject string, metadata map[string]string, srcOpts CopySrcOptions, dstOpts PutObjectOptions) (ObjectInfo, error) {
return c.copyObjectDo(ctx, sourceBucket, sourceObject, destBucket, destObject, metadata, srcOpts, dstOpts)
}
// CopyObjectPart - creates a part in a multipart upload by copying (a

View file

@ -3,21 +3,17 @@ module github.com/minio/minio-go/v7
go 1.12
require (
github.com/cheggaaa/pb v1.0.29 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/google/uuid v1.1.1
github.com/json-iterator/go v1.1.10
github.com/klauspost/cpuid v1.3.1 // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/minio/md5-simd v1.1.0
github.com/minio/sha256-simd v0.1.1
github.com/minio/sio v0.2.1 // indirect
github.com/mitchellh/go-homedir v1.1.0
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/rs/xid v1.2.1
github.com/sirupsen/logrus v1.7.0 // indirect
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a // indirect
github.com/smartystreets/goconvey v1.6.4 // indirect
github.com/stretchr/testify v1.4.0 // indirect
golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899
golang.org/x/net v0.0.0-20200707034311-ab3426394381

View file

@ -1,12 +1,6 @@
github.com/cheggaaa/pb v1.0.29 h1:FckUN5ngEk2LpvuG0fw1GEFx6LtyY2pWI/Z2QgCnEYo=
github.com/cheggaaa/pb v1.0.29/go.mod h1:W40334L7FMC5JKWldsTWbdGjLo0RxUKK73K+TuPxX30=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
@ -25,19 +19,10 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM=
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/minio/md5-simd v1.1.0 h1:QPfiOqlZH+Cj9teu0t9b1nTBfPbyTl16Of5MeuShdK4=
github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw=
github.com/minio/sha256-simd v0.1.1 h1:5QHSlgo3nt5yKOJrC7W8w7X+NFl8cMPZm96iu8kKUJU=
github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM=
github.com/minio/sio v0.2.1 h1:NjzKiIMSMcHediVQR0AFVx2tp7Wxh9tKPfDI3kH7aHQ=
github.com/minio/sio v0.2.1/go.mod h1:8b0yPp2avGThviy/+OCJBI6OMpvxoUuiLvE6F1lebhw=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
@ -52,20 +37,16 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rs/xid v1.2.1 h1:mhH9Nq+C1fY2l1XIpgxIiUOfNpRBYH1kKcr+qfKgjRc=
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a h1:pa8hGb/2YqsZKovtsgrwcDH1RZhVbTKCjLp47XpqCDs=
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899 h1:DZhuSZLsGlFL4CmhA8BcRA0mnthyA/nZ00AqCUo7vHg=
golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
@ -74,10 +55,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
golang.org/x/net v0.0.0-20200707034311-ab3426394381 h1:VXak5I6aEWmAXeQjA+QSZzlgNrpq9mjcfDemuexIKsU=
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae h1:Ih9Yo4hSPImZOpfGuA4bR/ORKTAbhZo2AbWNRCnevdo=
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=

View file

@ -133,6 +133,10 @@ func New(provider Provider) *Credentials {
// If Credentials.Expire() was called the credentials Value will be force
// expired, and the next call to Get() will cause them to be refreshed.
func (c *Credentials) Get() (Value, error) {
if c == nil {
return Value{}, nil
}
c.Lock()
defer c.Unlock()

View file

@ -27,6 +27,7 @@ import (
"net/url"
"os"
"path"
"strings"
"time"
jsoniter "github.com/json-iterator/go"
@ -82,7 +83,11 @@ func (m *IAM) Retrieve() (Value, error) {
case len(os.Getenv("AWS_WEB_IDENTITY_TOKEN_FILE")) > 0:
if len(endpoint) == 0 {
if len(os.Getenv("AWS_REGION")) > 0 {
endpoint = "https://sts." + os.Getenv("AWS_REGION") + ".amazonaws.com"
if strings.HasPrefix(os.Getenv("AWS_REGION"), "cn-") {
endpoint = "https://sts." + os.Getenv("AWS_REGION") + ".amazonaws.com.cn"
} else {
endpoint = "https://sts." + os.Getenv("AWS_REGION") + ".amazonaws.com"
}
} else {
endpoint = defaultSTSRoleEndpoint
}

View file

@ -220,6 +220,11 @@ func (b ExpireDeleteMarker) MarshalXML(e *xml.Encoder, startElement xml.StartEle
return e.EncodeElement(expireDeleteMarkerWrapper(b), startElement)
}
// IsEnabled returns true if the auto delete-marker expiration is enabled
func (b ExpireDeleteMarker) IsEnabled() bool {
return bool(b)
}
// Expiration structure - expiration details of lifecycle configuration
type Expiration struct {
XMLName xml.Name `xml:"Expiration,omitempty" json:"-"`
@ -238,9 +243,14 @@ func (e Expiration) IsDateNull() bool {
return e.Date.Time.IsZero()
}
// IsDeleteMarkerExpirationEnabled returns true if the auto-expiration of delete marker is enabled
func (e Expiration) IsDeleteMarkerExpirationEnabled() bool {
return e.DeleteMarker.IsEnabled()
}
// IsNull returns true if both date and days fields are null
func (e Expiration) IsNull() bool {
return e.IsDaysNull() && e.IsDateNull()
return e.IsDaysNull() && e.IsDateNull() && !e.IsDeleteMarkerExpirationEnabled()
}
// MarshalXML is expiration is non null

View file

@ -95,6 +95,9 @@ var amazonS3HostDot = regexp.MustCompile(`^s3.(.*?).amazonaws.com$`)
// amazonS3ChinaHost - regular expression used to determine if the arg is s3 china host.
var amazonS3ChinaHost = regexp.MustCompile(`^s3.(cn.*?).amazonaws.com.cn$`)
// amazonS3ChinaHostDualStack - regular expression used to determine if the arg is s3 china host dualstack.
var amazonS3ChinaHostDualStack = regexp.MustCompile(`^s3.dualstack.(cn.*?).amazonaws.com.cn$`)
// Regular expression used to determine if the arg is elb host.
var elbAmazonRegex = regexp.MustCompile(`elb(.*?).amazonaws.com$`)
@ -128,6 +131,10 @@ func GetRegionFromURL(endpointURL url.URL) string {
if len(parts) > 1 {
return parts[1]
}
parts = amazonS3ChinaHostDualStack.FindStringSubmatch(endpointURL.Host)
if len(parts) > 1 {
return parts[1]
}
parts = amazonS3HostDot.FindStringSubmatch(endpointURL.Host)
if len(parts) > 1 {
return parts[1]

View file

@ -136,12 +136,11 @@ type tagSet struct {
}
func (tags tagSet) String() string {
s := []string{}
vals := make(url.Values)
for key, value := range tags.tagMap {
s = append(s, key+"="+value)
vals.Set(key, value)
}
return strings.Join(s, "&")
return vals.Encode()
}
func (tags *tagSet) remove(key string) {

View file

@ -42,8 +42,8 @@ var awsS3EndpointMap = map[string]string{
"sa-east-1": "s3.dualstack.sa-east-1.amazonaws.com",
"us-gov-west-1": "s3.dualstack.us-gov-west-1.amazonaws.com",
"us-gov-east-1": "s3.dualstack.us-gov-east-1.amazonaws.com",
"cn-north-1": "s3.cn-north-1.amazonaws.com.cn",
"cn-northwest-1": "s3.cn-northwest-1.amazonaws.com.cn",
"cn-north-1": "s3.dualstack.cn-north-1.amazonaws.com.cn",
"cn-northwest-1": "s3.dualstack.cn-northwest-1.amazonaws.com.cn",
}
// getS3Endpoint get Amazon S3 endpoint based on the bucket location.

View file

@ -1 +0,0 @@
checks = ["all", "-ST1005", "-ST1017", "-SA9004", "-ST1000", "-S1021"]

View file

@ -15,7 +15,11 @@ package prometheus
import (
"errors"
"fmt"
"io/ioutil"
"os"
"strconv"
"strings"
)
type processCollector struct {
@ -149,3 +153,20 @@ func (c *processCollector) reportError(ch chan<- Metric, desc *Desc, err error)
}
ch <- NewInvalidMetric(desc, err)
}
// NewPidFileFn returns a function that retrieves a pid from the specified file.
// It is meant to be used for the PidFn field in ProcessCollectorOpts.
func NewPidFileFn(pidFilePath string) func() (int, error) {
return func() (int, error) {
content, err := ioutil.ReadFile(pidFilePath)
if err != nil {
return 0, fmt.Errorf("can't read pid file %q: %+v", pidFilePath, err)
}
pid, err := strconv.Atoi(strings.TrimSpace(string(content)))
if err != nil {
return 0, fmt.Errorf("can't parse pid file %q: %+v", pidFilePath, err)
}
return pid, nil
}
}

View file

@ -99,7 +99,7 @@ func HandlerFor(reg prometheus.Gatherer, opts HandlerOpts) http.Handler {
inFlightSem = make(chan struct{}, opts.MaxRequestsInFlight)
}
if opts.Registry != nil {
// Initialize all possibilites that can occur below.
// Initialize all possibilities that can occur below.
errCnt.WithLabelValues("gathering")
errCnt.WithLabelValues("encoding")
if err := opts.Registry.Register(errCnt); err != nil {
@ -303,8 +303,12 @@ type Logger interface {
// HandlerOpts specifies options how to serve metrics via an http.Handler. The
// zero value of HandlerOpts is a reasonable default.
type HandlerOpts struct {
// ErrorLog specifies an optional logger for errors collecting and
// serving metrics. If nil, errors are not logged at all.
// ErrorLog specifies an optional Logger for errors collecting and
// serving metrics. If nil, errors are not logged at all. Note that the
// type of a reported error is often prometheus.MultiError, which
// formats into a multi-line error string. If you want to avoid the
// latter, create a Logger implementation that detects a
// prometheus.MultiError and formats the contained errors into one line.
ErrorLog Logger
// ErrorHandling defines how errors are handled. Note that errors are
// logged regardless of the configured ErrorHandling provided ErrorLog

View file

@ -43,14 +43,14 @@ func InstrumentHandlerInFlight(g prometheus.Gauge, next http.Handler) http.Handl
// InstrumentHandlerDuration is a middleware that wraps the provided
// http.Handler to observe the request duration with the provided ObserverVec.
// The ObserverVec must have zero, one, or two non-const non-curried labels. For
// those, the only allowed label names are "code" and "method". The function
// panics otherwise. The Observe method of the Observer in the ObserverVec is
// called with the request duration in seconds. Partitioning happens by HTTP
// status code and/or HTTP method if the respective instance label names are
// present in the ObserverVec. For unpartitioned observations, use an
// ObserverVec with zero labels. Note that partitioning of Histograms is
// expensive and should be used judiciously.
// The ObserverVec must have valid metric and label names and must have zero,
// one, or two non-const non-curried labels. For those, the only allowed label
// names are "code" and "method". The function panics otherwise. The Observe
// method of the Observer in the ObserverVec is called with the request duration
// in seconds. Partitioning happens by HTTP status code and/or HTTP method if
// the respective instance label names are present in the ObserverVec. For
// unpartitioned observations, use an ObserverVec with zero labels. Note that
// partitioning of Histograms is expensive and should be used judiciously.
//
// If the wrapped Handler does not set a status code, a status code of 200 is assumed.
//
@ -79,12 +79,13 @@ func InstrumentHandlerDuration(obs prometheus.ObserverVec, next http.Handler) ht
}
// InstrumentHandlerCounter is a middleware that wraps the provided http.Handler
// to observe the request result with the provided CounterVec. The CounterVec
// must have zero, one, or two non-const non-curried labels. For those, the only
// allowed label names are "code" and "method". The function panics
// otherwise. Partitioning of the CounterVec happens by HTTP status code and/or
// HTTP method if the respective instance label names are present in the
// CounterVec. For unpartitioned counting, use a CounterVec with zero labels.
// to observe the request result with the provided CounterVec. The CounterVec
// must have valid metric and label names and must have zero, one, or two
// non-const non-curried labels. For those, the only allowed label names are
// "code" and "method". The function panics otherwise. Partitioning of the
// CounterVec happens by HTTP status code and/or HTTP method if the respective
// instance label names are present in the CounterVec. For unpartitioned
// counting, use a CounterVec with zero labels.
//
// If the wrapped Handler does not set a status code, a status code of 200 is assumed.
//
@ -110,14 +111,15 @@ func InstrumentHandlerCounter(counter *prometheus.CounterVec, next http.Handler)
// InstrumentHandlerTimeToWriteHeader is a middleware that wraps the provided
// http.Handler to observe with the provided ObserverVec the request duration
// until the response headers are written. The ObserverVec must have zero, one,
// or two non-const non-curried labels. For those, the only allowed label names
// are "code" and "method". The function panics otherwise. The Observe method of
// the Observer in the ObserverVec is called with the request duration in
// seconds. Partitioning happens by HTTP status code and/or HTTP method if the
// respective instance label names are present in the ObserverVec. For
// unpartitioned observations, use an ObserverVec with zero labels. Note that
// partitioning of Histograms is expensive and should be used judiciously.
// until the response headers are written. The ObserverVec must have valid
// metric and label names and must have zero, one, or two non-const non-curried
// labels. For those, the only allowed label names are "code" and "method". The
// function panics otherwise. The Observe method of the Observer in the
// ObserverVec is called with the request duration in seconds. Partitioning
// happens by HTTP status code and/or HTTP method if the respective instance
// label names are present in the ObserverVec. For unpartitioned observations,
// use an ObserverVec with zero labels. Note that partitioning of Histograms is
// expensive and should be used judiciously.
//
// If the wrapped Handler panics before calling WriteHeader, no value is
// reported.
@ -139,15 +141,15 @@ func InstrumentHandlerTimeToWriteHeader(obs prometheus.ObserverVec, next http.Ha
}
// InstrumentHandlerRequestSize is a middleware that wraps the provided
// http.Handler to observe the request size with the provided ObserverVec. The
// ObserverVec must have zero, one, or two non-const non-curried labels. For
// those, the only allowed label names are "code" and "method". The function
// panics otherwise. The Observe method of the Observer in the ObserverVec is
// called with the request size in bytes. Partitioning happens by HTTP status
// code and/or HTTP method if the respective instance label names are present in
// the ObserverVec. For unpartitioned observations, use an ObserverVec with zero
// labels. Note that partitioning of Histograms is expensive and should be used
// judiciously.
// http.Handler to observe the request size with the provided ObserverVec. The
// ObserverVec must have valid metric and label names and must have zero, one,
// or two non-const non-curried labels. For those, the only allowed label names
// are "code" and "method". The function panics otherwise. The Observe method of
// the Observer in the ObserverVec is called with the request size in
// bytes. Partitioning happens by HTTP status code and/or HTTP method if the
// respective instance label names are present in the ObserverVec. For
// unpartitioned observations, use an ObserverVec with zero labels. Note that
// partitioning of Histograms is expensive and should be used judiciously.
//
// If the wrapped Handler does not set a status code, a status code of 200 is assumed.
//
@ -174,15 +176,15 @@ func InstrumentHandlerRequestSize(obs prometheus.ObserverVec, next http.Handler)
}
// InstrumentHandlerResponseSize is a middleware that wraps the provided
// http.Handler to observe the response size with the provided ObserverVec. The
// ObserverVec must have zero, one, or two non-const non-curried labels. For
// those, the only allowed label names are "code" and "method". The function
// panics otherwise. The Observe method of the Observer in the ObserverVec is
// called with the response size in bytes. Partitioning happens by HTTP status
// code and/or HTTP method if the respective instance label names are present in
// the ObserverVec. For unpartitioned observations, use an ObserverVec with zero
// labels. Note that partitioning of Histograms is expensive and should be used
// judiciously.
// http.Handler to observe the response size with the provided ObserverVec. The
// ObserverVec must have valid metric and label names and must have zero, one,
// or two non-const non-curried labels. For those, the only allowed label names
// are "code" and "method". The function panics otherwise. The Observe method of
// the Observer in the ObserverVec is called with the response size in
// bytes. Partitioning happens by HTTP status code and/or HTTP method if the
// respective instance label names are present in the ObserverVec. For
// unpartitioned observations, use an ObserverVec with zero labels. Note that
// partitioning of Histograms is expensive and should be used judiciously.
//
// If the wrapped Handler does not set a status code, a status code of 200 is assumed.
//
@ -198,6 +200,11 @@ func InstrumentHandlerResponseSize(obs prometheus.ObserverVec, next http.Handler
})
}
// checkLabels returns whether the provided Collector has a non-const,
// non-curried label named "code" and/or "method". It panics if the provided
// Collector does not have a Desc or has more than one Desc or its Desc is
// invalid. It also panics if the Collector has any non-const, non-curried
// labels that are not named "code" or "method".
func checkLabels(c prometheus.Collector) (code bool, method bool) {
// TODO(beorn7): Remove this hacky way to check for instance labels
// once Descriptors can have their dimensionality queried.
@ -225,6 +232,10 @@ func checkLabels(c prometheus.Collector) (code bool, method bool) {
close(descc)
// Make sure the Collector has a valid Desc by registering it with a
// temporary registry.
prometheus.NewRegistry().MustRegister(c)
// Create a ConstMetric with the Desc. Since we don't know how many
// variable labels there are, try for as long as it needs.
for err := errors.New("dummy"); err != nil; lvs = append(lvs, magicString) {

View file

@ -215,6 +215,8 @@ func (err AlreadyRegisteredError) Error() string {
// by a Gatherer to report multiple errors during MetricFamily gathering.
type MultiError []error
// Error formats the contained errors as a bullet point list, preceded by the
// total number of errors. Note that this results in a multi-line string.
func (errs MultiError) Error() string {
if len(errs) == 0 {
return ""

View file

@ -299,6 +299,17 @@ func (p *TextParser) startLabelName() stateFn {
p.parseError(fmt.Sprintf("expected '=' after label name, found %q", p.currentByte))
return nil
}
// Check for duplicate label names.
labels := make(map[string]struct{})
for _, l := range p.currentMetric.Label {
lName := l.GetName()
if _, exists := labels[lName]; !exists {
labels[lName] = struct{}{}
} else {
p.parseError(fmt.Sprintf("duplicate label names for metric %q", p.currentMF.GetName()))
return nil
}
}
return p.startLabelValue
}

View file

@ -1,23 +0,0 @@
language: go
arch:
- amd64
- ppc64le
go:
- 1.13.x
- 1.14.x
- 1.x
- master
before_install:
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/v1.35.0/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.35.0
script:
- golangci-lint run
- go test -v
matrix:
allow_failures:
- go: master
fast_finish: true

View file

@ -1,27 +0,0 @@
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.

View file

@ -178,7 +178,7 @@
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 "[]"
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
@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.

View file

@ -2,12 +2,10 @@
A GitLab API client enabling Go programs to interact with GitLab in a simple and uniform way
[![Build Status](https://travis-ci.org/xanzy/go-gitlab.svg?branch=master)](https://travis-ci.org/xanzy/go-gitlab)
[![GitHub license](https://img.shields.io/github/license/xanzy/go-gitlab.svg)](https://github.com/xanzy/go-gitlab/blob/master/LICENSE)
[![Build Status](https://github.com/xanzy/go-gitlab/workflows/Lint%20and%20Test/badge.svg)](https://github.com/xanzy/go-gitlab/actions?workflow=Lint%20and%20Test)
[![Sourcegraph](https://sourcegraph.com/github.com/xanzy/go-gitlab/-/badge.svg)](https://sourcegraph.com/github.com/xanzy/go-gitlab?badge)
[![GoDoc](https://godoc.org/github.com/xanzy/go-gitlab?status.svg)](https://godoc.org/github.com/xanzy/go-gitlab)
[![Go Report Card](https://goreportcard.com/badge/github.com/xanzy/go-gitlab)](https://goreportcard.com/report/github.com/xanzy/go-gitlab)
[![GitHub issues](https://img.shields.io/github/issues/xanzy/go-gitlab.svg)](https://github.com/xanzy/go-gitlab/issues)
## NOTE
@ -42,9 +40,11 @@ to add new and/or missing endpoints. Currently the following services are suppor
- [x] Group Issue Boards
- [x] Group Members
- [x] Group Milestones
- [x] Group Wikis
- [x] Group-Level Variables
- [x] Groups
- [x] Instance Clusters
- [x] Invites
- [x] Issue Boards
- [x] Issues
- [x] Jobs
@ -71,6 +71,7 @@ to add new and/or missing endpoints. Currently the following services are suppor
- [x] Project-Level Variables
- [x] Projects (including setting Webhooks)
- [x] Protected Branches
- [x] Protected Environments
- [x] Protected Tags
- [x] Repositories
- [x] Repository Files

View file

@ -1,7 +1,24 @@
//
// Copyright 2021, 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/http"
"time"
)
@ -46,7 +63,7 @@ func (s *AccessRequestsService) ListProjectAccessRequests(pid interface{}, opt *
}
u := fmt.Sprintf("projects/%s/access_requests", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -72,7 +89,7 @@ func (s *AccessRequestsService) ListGroupAccessRequests(gid interface{}, opt *Li
}
u := fmt.Sprintf("groups/%s/access_requests", pathEscape(group))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -98,7 +115,7 @@ func (s *AccessRequestsService) RequestProjectAccess(pid interface{}, options ..
}
u := fmt.Sprintf("projects/%s/access_requests", pathEscape(project))
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -124,7 +141,7 @@ func (s *AccessRequestsService) RequestGroupAccess(gid interface{}, options ...R
}
u := fmt.Sprintf("groups/%s/access_requests", pathEscape(group))
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -158,7 +175,7 @@ func (s *AccessRequestsService) ApproveProjectAccessRequest(pid interface{}, use
}
u := fmt.Sprintf("projects/%s/access_requests/%d/approve", pathEscape(project), user)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -183,7 +200,7 @@ func (s *AccessRequestsService) ApproveGroupAccessRequest(gid interface{}, user
}
u := fmt.Sprintf("groups/%s/access_requests/%d/approve", pathEscape(group), user)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -208,7 +225,7 @@ func (s *AccessRequestsService) DenyProjectAccessRequest(pid interface{}, user i
}
u := fmt.Sprintf("projects/%s/access_requests/%d", pathEscape(project), user)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -227,7 +244,7 @@ func (s *AccessRequestsService) DenyGroupAccessRequest(gid interface{}, user int
}
u := fmt.Sprintf("groups/%s/access_requests/%d", pathEscape(group), user)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Sander van Harmelen
// Copyright 2021, 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.
@ -16,7 +16,10 @@
package gitlab
import "fmt"
import (
"fmt"
"net/http"
)
// ApplicationsService handles communication with administrables applications
// of the Gitlab API.
@ -51,7 +54,7 @@ type CreateApplicationOptions struct {
//
// Gitlab API docs : https://docs.gitlab.com/ce/api/applications.html#create-an-application
func (s *ApplicationsService) CreateApplication(opt *CreateApplicationOptions, options ...RequestOptionFunc) (*Application, *Response, error) {
req, err := s.client.NewRequest("POST", "applications", opt, options)
req, err := s.client.NewRequest(http.MethodPost, "applications", opt, options)
if err != nil {
return nil, nil, err
}
@ -73,7 +76,7 @@ type ListApplicationsOptions ListOptions
//
// Gitlab API docs : https://docs.gitlab.com/ce/api/applications.html#list-all-applications
func (s *ApplicationsService) ListApplications(opt *ListApplicationsOptions, options ...RequestOptionFunc) ([]*Application, *Response, error) {
req, err := s.client.NewRequest("GET", "applications", opt, options)
req, err := s.client.NewRequest(http.MethodGet, "applications", opt, options)
if err != nil {
return nil, nil, err
}
@ -94,7 +97,7 @@ func (s *ApplicationsService) ListApplications(opt *ListApplicationsOptions, opt
func (s *ApplicationsService) DeleteApplication(application int, options ...RequestOptionFunc) (*Response, error) {
u := fmt.Sprintf("applications/%d", application)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

158
vendor/github.com/xanzy/go-gitlab/audit_events.go generated vendored Normal file
View file

@ -0,0 +1,158 @@
package gitlab
import (
"fmt"
"net/http"
"time"
)
// AuditEvent represents an audit event for a group or project.
//
// GitLab API docs: https://docs.gitlab.com/ee/api/audit_events.html
type AuditEvent struct {
ID int `json:"id"`
AuthorID int `json:"author_id"`
EntityID int `json:"entity_id"`
EntityType string `json:"entity_type"`
Details AuditEventDetails `json:"details"`
CreatedAt *time.Time `json:"created_at"`
}
// AuditEventDetails represents the details portion of an audit event for
// a group or project. The exact fields that are returned for an audit event
// depend on the action being recorded.
//
// GitLab API docs: https://docs.gitlab.com/ee/api/audit_events.html
type AuditEventDetails struct {
With string `json:"with"`
Add string `json:"add"`
As string `json:"as"`
Change string `json:"change"`
From string `json:"from"`
To string `json:"to"`
Remove string `json:"remove"`
CustomMessage string `json:"custom_message"`
AuthorName string `json:"author_name"`
TargetID interface{} `json:"target_id"`
TargetType string `json:"target_type"`
TargetDetails string `json:"target_details"`
IPAddress string `json:"ip_address"`
EntityPath string `json:"entity_path"`
}
// AuditEventsService handles communication with the project/group audit
// event related methods of the GitLab API.
//
// GitLab API docs: https://docs.gitlab.com/ee/api/audit_events.html
type AuditEventsService struct {
client *Client
}
// ListAuditEventsOptions represents the available ListProjectAuditEvents()
// or ListGroupAuditEvents() options.
//
// GitLab API docs: https://docs.gitlab.com/ee/api/audit_events.html
type ListAuditEventsOptions struct {
ListOptions
CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
}
// ListGroupAuditEvents gets a list of audit events for the specified group
// viewable by the authenticated user.
//
// GitLab API docs: https://docs.gitlab.com/ee/api/audit_events.html
func (s *AuditEventsService) ListGroupAuditEvents(gid interface{}, opt *ListAuditEventsOptions, options ...RequestOptionFunc) ([]*AuditEvent, *Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/audit_events", pathEscape(group))
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
var aes []*AuditEvent
resp, err := s.client.Do(req, &aes)
if err != nil {
return nil, resp, err
}
return aes, resp, err
}
// GetGroupAuditEvent gets a specific group audit event.
//
// GitLab API docs: https://docs.gitlab.com/ee/api/audit_events.html
func (s *AuditEventsService) GetGroupAuditEvent(gid interface{}, event int, options ...RequestOptionFunc) (*AuditEvent, *Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/audit_events/%d", pathEscape(group), event)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
ae := new(AuditEvent)
resp, err := s.client.Do(req, ae)
if err != nil {
return nil, resp, err
}
return ae, resp, err
}
// ListProjectAuditEvents gets a list of audit events for the specified project
// viewable by the authenticated user.
//
// GitLab API docs: https://docs.gitlab.com/ee/api/audit_events.html
func (s *AuditEventsService) ListProjectAuditEvents(pid interface{}, opt *ListAuditEventsOptions, options ...RequestOptionFunc) ([]*AuditEvent, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/audit_events", pathEscape(project))
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
var aes []*AuditEvent
resp, err := s.client.Do(req, &aes)
if err != nil {
return nil, resp, err
}
return aes, resp, err
}
// GetProjectAuditEvent gets a specific project audit event.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/audit_events.html
func (s *AuditEventsService) GetProjectAuditEvent(pid interface{}, event int, options ...RequestOptionFunc) (*AuditEvent, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/audit_events/%d", pathEscape(project), event)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
ae := new(AuditEvent)
resp, err := s.client.Do(req, ae)
if err != nil {
return nil, resp, err
}
return ae, resp, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Arkbriar
// Copyright 2021, Arkbriar
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"time"
)
@ -97,7 +98,7 @@ func (s *AwardEmojiService) listAwardEmoji(pid interface{}, resource string, res
resourceID,
)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -147,7 +148,7 @@ func (s *AwardEmojiService) getAwardEmoji(pid interface{}, resource string, reso
awardID,
)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -205,7 +206,7 @@ func (s *AwardEmojiService) createAwardEmoji(pid interface{}, resource string, r
resourceID,
)
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -255,7 +256,7 @@ func (s *AwardEmojiService) deleteAwardEmoji(pid interface{}, resource string, r
u := fmt.Sprintf("projects/%s/%s/%d/award_emoji/%d", pathEscape(project), resource,
resourceID, awardID)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -297,7 +298,7 @@ func (s *AwardEmojiService) listAwardEmojiOnNote(pid interface{}, resources stri
u := fmt.Sprintf("projects/%s/%s/%d/notes/%d/award_emoji", pathEscape(project), resources,
ressourceID, noteID)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -350,7 +351,7 @@ func (s *AwardEmojiService) getSingleNoteAwardEmoji(pid interface{}, ressource s
awardID,
)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -405,7 +406,7 @@ func (s *AwardEmojiService) createAwardEmojiOnNote(pid interface{}, resource str
noteID,
)
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -458,7 +459,7 @@ func (s *AwardEmojiService) deleteAwardEmojiOnNote(pid interface{}, resource str
awardID,
)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2015, Sander van Harmelen
// Copyright 2021, 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.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
)
// IssueBoardsService handles communication with the issue board related
@ -73,7 +74,7 @@ func (s *IssueBoardsService) CreateIssueBoard(pid interface{}, opt *CreateIssueB
}
u := fmt.Sprintf("projects/%s/boards", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -108,7 +109,7 @@ func (s *IssueBoardsService) UpdateIssueBoard(pid interface{}, board int, opt *U
}
u := fmt.Sprintf("projects/%s/boards/%d", pathEscape(project), board)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -132,7 +133,7 @@ func (s *IssueBoardsService) DeleteIssueBoard(pid interface{}, board int, option
}
u := fmt.Sprintf("projects/%s/boards/%d", pathEscape(project), board)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -155,7 +156,7 @@ func (s *IssueBoardsService) ListIssueBoards(pid interface{}, opt *ListIssueBoar
}
u := fmt.Sprintf("projects/%s/boards", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -179,7 +180,7 @@ func (s *IssueBoardsService) GetIssueBoard(pid interface{}, board int, options .
}
u := fmt.Sprintf("projects/%s/boards/%d", pathEscape(project), board)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -209,7 +210,7 @@ func (s *IssueBoardsService) GetIssueBoardLists(pid interface{}, board int, opt
}
u := fmt.Sprintf("projects/%s/boards/%d/lists", pathEscape(project), board)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -237,7 +238,7 @@ func (s *IssueBoardsService) GetIssueBoardList(pid interface{}, board, list int,
list,
)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -269,7 +270,7 @@ func (s *IssueBoardsService) CreateIssueBoardList(pid interface{}, board int, op
}
u := fmt.Sprintf("projects/%s/boards/%d/lists", pathEscape(project), board)
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -305,7 +306,7 @@ func (s *IssueBoardsService) UpdateIssueBoardList(pid interface{}, board, list i
list,
)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -335,7 +336,7 @@ func (s *IssueBoardsService) DeleteIssueBoardList(pid interface{}, board, list i
list,
)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Sander van Harmelen
// Copyright 2021, 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.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"net/url"
)
@ -69,7 +70,7 @@ func (s *BranchesService) ListBranches(pid interface{}, opts *ListBranchesOption
}
u := fmt.Sprintf("projects/%s/repository/branches", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opts, options)
req, err := s.client.NewRequest(http.MethodGet, u, opts, options)
if err != nil {
return nil, nil, err
}
@ -94,7 +95,7 @@ func (s *BranchesService) GetBranch(pid interface{}, branch string, options ...R
}
u := fmt.Sprintf("projects/%s/repository/branches/%s", pathEscape(project), url.PathEscape(branch))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -130,7 +131,7 @@ func (s *BranchesService) ProtectBranch(pid interface{}, branch string, opts *Pr
}
u := fmt.Sprintf("projects/%s/repository/branches/%s/protect", pathEscape(project), url.PathEscape(branch))
req, err := s.client.NewRequest("PUT", u, opts, options)
req, err := s.client.NewRequest(http.MethodPut, u, opts, options)
if err != nil {
return nil, nil, err
}
@ -157,7 +158,7 @@ func (s *BranchesService) UnprotectBranch(pid interface{}, branch string, option
}
u := fmt.Sprintf("projects/%s/repository/branches/%s/unprotect", pathEscape(project), url.PathEscape(branch))
req, err := s.client.NewRequest("PUT", u, nil, options)
req, err := s.client.NewRequest(http.MethodPut, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -191,7 +192,7 @@ func (s *BranchesService) CreateBranch(pid interface{}, opt *CreateBranchOptions
}
u := fmt.Sprintf("projects/%s/repository/branches", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -216,7 +217,7 @@ func (s *BranchesService) DeleteBranch(pid interface{}, branch string, options .
}
u := fmt.Sprintf("projects/%s/repository/branches/%s", pathEscape(project), url.PathEscape(branch))
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -235,7 +236,7 @@ func (s *BranchesService) DeleteMergedBranches(pid interface{}, options ...Reque
}
u := fmt.Sprintf("projects/%s/repository/merged_branches", pathEscape(project))
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2018, Sander van Harmelen
// Copyright 2021, 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.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"time"
)
@ -55,7 +56,7 @@ type ListBroadcastMessagesOptions ListOptions
// GitLab API docs:
// https://docs.gitlab.com/ce/api/broadcast_messages.html#get-all-broadcast-messages
func (s *BroadcastMessagesService) ListBroadcastMessages(opt *ListBroadcastMessagesOptions, options ...RequestOptionFunc) ([]*BroadcastMessage, *Response, error) {
req, err := s.client.NewRequest("GET", "broadcast_messages", opt, options)
req, err := s.client.NewRequest(http.MethodGet, "broadcast_messages", opt, options)
if err != nil {
return nil, nil, err
}
@ -76,7 +77,7 @@ func (s *BroadcastMessagesService) ListBroadcastMessages(opt *ListBroadcastMessa
func (s *BroadcastMessagesService) GetBroadcastMessage(broadcast int, options ...RequestOptionFunc) (*BroadcastMessage, *Response, error) {
u := fmt.Sprintf("broadcast_messages/%d", broadcast)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -108,7 +109,7 @@ type CreateBroadcastMessageOptions struct {
// GitLab API docs:
// https://docs.gitlab.com/ce/api/broadcast_messages.html#create-a-broadcast-message
func (s *BroadcastMessagesService) CreateBroadcastMessage(opt *CreateBroadcastMessageOptions, options ...RequestOptionFunc) (*BroadcastMessage, *Response, error) {
req, err := s.client.NewRequest("POST", "broadcast_messages", opt, options)
req, err := s.client.NewRequest(http.MethodPost, "broadcast_messages", opt, options)
if err != nil {
return nil, nil, err
}
@ -142,7 +143,7 @@ type UpdateBroadcastMessageOptions struct {
func (s *BroadcastMessagesService) UpdateBroadcastMessage(broadcast int, opt *UpdateBroadcastMessageOptions, options ...RequestOptionFunc) (*BroadcastMessage, *Response, error) {
u := fmt.Sprintf("broadcast_messages/%d", broadcast)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -163,7 +164,7 @@ func (s *BroadcastMessagesService) UpdateBroadcastMessage(broadcast int, opt *Up
func (s *BroadcastMessagesService) DeleteBroadcastMessage(broadcast int, options ...RequestOptionFunc) (*Response, error) {
u := fmt.Sprintf("broadcast_messages/%d", broadcast)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,7 +1,24 @@
//
// Copyright 2021, 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/http"
)
// CIYMLTemplatesService handles communication with the gitlab
@ -33,7 +50,7 @@ type ListCIYMLTemplatesOptions ListOptions
// GitLab API docs:
// https://docs.gitlab.com/ce/api/templates/gitlab_ci_ymls.html#list-gitlab-ci-yml-templates
func (s *CIYMLTemplatesService) ListAllTemplates(opt *ListCIYMLTemplatesOptions, options ...RequestOptionFunc) ([]*CIYMLTemplate, *Response, error) {
req, err := s.client.NewRequest("GET", "templates/gitlab_ci_ymls", opt, options)
req, err := s.client.NewRequest(http.MethodGet, "templates/gitlab_ci_ymls", opt, options)
if err != nil {
return nil, nil, err
}
@ -54,7 +71,7 @@ func (s *CIYMLTemplatesService) ListAllTemplates(opt *ListCIYMLTemplatesOptions,
func (s *CIYMLTemplatesService) GetTemplate(key string, options ...RequestOptionFunc) (*CIYMLTemplate, *Response, error) {
u := fmt.Sprintf("templates/gitlab_ci_ymls/%s", pathEscape(key))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,3 +1,19 @@
//
// Copyright 2021, 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 (

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Sander van Harmelen
// Copyright 2021, 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.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"net/url"
"time"
)
@ -90,7 +91,7 @@ func (s *CommitsService) ListCommits(pid interface{}, opt *ListCommitsOptions, o
}
u := fmt.Sprintf("projects/%s/repository/commits", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -133,7 +134,7 @@ func (s *CommitsService) GetCommitRefs(pid interface{}, sha string, opt *GetComm
}
u := fmt.Sprintf("projects/%s/repository/commits/%s/refs", pathEscape(project), url.PathEscape(sha))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -161,7 +162,7 @@ func (s *CommitsService) GetCommit(pid interface{}, sha string, options ...Reque
}
u := fmt.Sprintf("projects/%s/repository/commits/%s", pathEscape(project), url.PathEscape(sha))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -196,13 +197,13 @@ type CreateCommitOptions struct {
//
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
type CommitActionOptions struct {
Action *FileAction `url:"action,omitempty" json:"action,omitempty"`
FilePath *string `url:"file_path,omitempty" json:"file_path,omitempty"`
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"`
LastCommitID *string `url:"last_commit_id,omitempty" json:"last_commit_id,omitempty"`
ExecuteFilemode *bool `url:"execute_filemode,omitempty" json:"execute_filemode,omitempty"`
Action *FileActionValue `url:"action,omitempty" json:"action,omitempty"`
FilePath *string `url:"file_path,omitempty" json:"file_path,omitempty"`
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"`
LastCommitID *string `url:"last_commit_id,omitempty" json:"last_commit_id,omitempty"`
ExecuteFilemode *bool `url:"execute_filemode,omitempty" json:"execute_filemode,omitempty"`
}
// CreateCommit creates a commit with multiple files and actions.
@ -215,7 +216,7 @@ func (s *CommitsService) CreateCommit(pid interface{}, opt *CreateCommitOptions,
}
u := fmt.Sprintf("projects/%s/repository/commits", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -264,7 +265,7 @@ func (s *CommitsService) GetCommitDiff(pid interface{}, sha string, opt *GetComm
}
u := fmt.Sprintf("projects/%s/repository/commits/%s/diff", pathEscape(project), url.PathEscape(sha))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -321,7 +322,7 @@ func (s *CommitsService) GetCommitComments(pid interface{}, sha string, opt *Get
}
u := fmt.Sprintf("projects/%s/repository/commits/%s/comments", pathEscape(project), url.PathEscape(sha))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -360,7 +361,7 @@ func (s *CommitsService) PostCommitComment(pid interface{}, sha string, opt *Pos
}
u := fmt.Sprintf("projects/%s/repository/commits/%s/comments", pathEscape(project), url.PathEscape(sha))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -413,7 +414,7 @@ func (s *CommitsService) GetCommitStatuses(pid interface{}, sha string, opt *Get
}
u := fmt.Sprintf("projects/%s/repository/commits/%s/statuses", pathEscape(project), url.PathEscape(sha))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -451,7 +452,7 @@ func (s *CommitsService) SetCommitStatus(pid interface{}, sha string, opt *SetCo
}
u := fmt.Sprintf("projects/%s/statuses/%s", pathEscape(project), url.PathEscape(sha))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -476,7 +477,7 @@ func (s *CommitsService) GetMergeRequestsByCommit(pid interface{}, sha string, o
}
u := fmt.Sprintf("projects/%s/repository/commits/%s/merge_requests", pathEscape(project), url.PathEscape(sha))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -507,7 +508,7 @@ func (s *CommitsService) CherryPickCommit(pid interface{}, sha string, opt *Cher
}
u := fmt.Sprintf("projects/%s/repository/commits/%s/cherry_pick", pathEscape(project), url.PathEscape(sha))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -538,7 +539,7 @@ func (s *CommitsService) RevertCommit(pid interface{}, sha string, opt *RevertCo
}
u := fmt.Sprintf("projects/%s/repository/commits/%s/revert", pathEscape(project), url.PathEscape(sha))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -575,7 +576,7 @@ func (s *CommitsService) GetGPGSiganature(pid interface{}, sha string, options .
}
u := fmt.Sprintf("projects/%s/repository/commits/%s/signature", pathEscape(project), url.PathEscape(sha))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,7 +1,24 @@
//
// Copyright 2021, 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/http"
)
// CustomAttributesService handles communication with the group, project and
@ -46,7 +63,7 @@ func (s *CustomAttributesService) ListCustomProjectAttributes(project int, optio
func (s *CustomAttributesService) listCustomAttributes(resource string, id int, options ...RequestOptionFunc) ([]*CustomAttribute, *Response, error) {
u := fmt.Sprintf("%s/%d/custom_attributes", resource, id)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -85,7 +102,7 @@ func (s *CustomAttributesService) GetCustomProjectAttribute(project int, key str
func (s *CustomAttributesService) getCustomAttribute(resource string, id int, key string, options ...RequestOptionFunc) (*CustomAttribute, *Response, error) {
u := fmt.Sprintf("%s/%d/custom_attributes/%s", resource, id, key)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -124,7 +141,7 @@ func (s *CustomAttributesService) SetCustomProjectAttribute(project int, c Custo
func (s *CustomAttributesService) setCustomAttribute(resource string, id int, c CustomAttribute, options ...RequestOptionFunc) (*CustomAttribute, *Response, error) {
u := fmt.Sprintf("%s/%d/custom_attributes/%s", resource, id, c.Key)
req, err := s.client.NewRequest("PUT", u, c, options)
req, err := s.client.NewRequest(http.MethodPut, u, c, options)
if err != nil {
return nil, nil, err
}
@ -163,7 +180,7 @@ func (s *CustomAttributesService) DeleteCustomProjectAttribute(project int, key
func (s *CustomAttributesService) deleteCustomAttribute(resource string, id int, key string, options ...RequestOptionFunc) (*Response, error) {
u := fmt.Sprintf("%s/%d/custom_attributes/%s", resource, id, key)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Sander van Harmelen
// Copyright 2021, 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.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"time"
)
@ -47,7 +48,7 @@ func (k DeployKey) String() string {
// GitLab API docs:
// https://docs.gitlab.com/ce/api/deploy_keys.html#list-all-deploy-keys
func (s *DeployKeysService) ListAllDeployKeys(options ...RequestOptionFunc) ([]*DeployKey, *Response, error) {
req, err := s.client.NewRequest("GET", "deploy_keys", nil, options)
req, err := s.client.NewRequest(http.MethodGet, "deploy_keys", nil, options)
if err != nil {
return nil, nil, err
}
@ -79,7 +80,7 @@ func (s *DeployKeysService) ListProjectDeployKeys(pid interface{}, opt *ListProj
}
u := fmt.Sprintf("projects/%s/deploy_keys", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -104,7 +105,7 @@ func (s *DeployKeysService) GetDeployKey(pid interface{}, deployKey int, options
}
u := fmt.Sprintf("projects/%s/deploy_keys/%d", pathEscape(project), deployKey)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -141,7 +142,7 @@ func (s *DeployKeysService) AddDeployKey(pid interface{}, opt *AddDeployKeyOptio
}
u := fmt.Sprintf("projects/%s/deploy_keys", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -166,7 +167,7 @@ func (s *DeployKeysService) DeleteDeployKey(pid interface{}, deployKey int, opti
}
u := fmt.Sprintf("projects/%s/deploy_keys/%d", pathEscape(project), deployKey)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -185,7 +186,7 @@ func (s *DeployKeysService) EnableDeployKey(pid interface{}, deployKey int, opti
}
u := fmt.Sprintf("projects/%s/deploy_keys/%d/enable", pathEscape(project), deployKey)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -219,7 +220,7 @@ func (s *DeployKeysService) UpdateDeployKey(pid interface{}, deployKey int, opt
}
u := fmt.Sprintf("projects/%s/deploy_keys/%d", pathEscape(project), deployKey)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,7 +1,24 @@
//
// Copyright 2021, 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/http"
"time"
)
@ -32,7 +49,7 @@ func (k DeployToken) String() string {
// GitLab API docs:
// https://docs.gitlab.com/ce/api/deploy_tokens.html#list-all-deploy-tokens
func (s *DeployTokensService) ListAllDeployTokens(options ...RequestOptionFunc) ([]*DeployToken, *Response, error) {
req, err := s.client.NewRequest("GET", "deploy_tokens", nil, options)
req, err := s.client.NewRequest(http.MethodGet, "deploy_tokens", nil, options)
if err != nil {
return nil, nil, err
}
@ -64,7 +81,7 @@ func (s *DeployTokensService) ListProjectDeployTokens(pid interface{}, opt *List
}
u := fmt.Sprintf("projects/%s/deploy_tokens", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -100,7 +117,7 @@ func (s *DeployTokensService) CreateProjectDeployToken(pid interface{}, opt *Cre
}
u := fmt.Sprintf("projects/%s/deploy_tokens", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -125,7 +142,7 @@ func (s *DeployTokensService) DeleteProjectDeployToken(pid interface{}, deployTo
}
u := fmt.Sprintf("projects/%s/deploy_tokens/%d", pathEscape(project), deployToken)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -151,7 +168,7 @@ func (s *DeployTokensService) ListGroupDeployTokens(gid interface{}, opt *ListGr
}
u := fmt.Sprintf("groups/%s/deploy_tokens", pathEscape(group))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -187,7 +204,7 @@ func (s *DeployTokensService) CreateGroupDeployToken(gid interface{}, opt *Creat
}
u := fmt.Sprintf("groups/%s/deploy_tokens", pathEscape(group))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -212,7 +229,7 @@ func (s *DeployTokensService) DeleteGroupDeployToken(gid interface{}, deployToke
}
u := fmt.Sprintf("groups/%s/deploy_tokens/%d", pathEscape(group), deployToken)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2018, Sander van Harmelen
// Copyright 2021, 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.
@ -17,6 +17,7 @@ package gitlab
import (
"fmt"
"net/http"
"time"
)
@ -89,7 +90,7 @@ func (s *DeploymentsService) ListProjectDeployments(pid interface{}, opts *ListP
}
u := fmt.Sprintf("projects/%s/deployments", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opts, options)
req, err := s.client.NewRequest(http.MethodGet, u, opts, options)
if err != nil {
return nil, nil, err
}
@ -113,7 +114,7 @@ func (s *DeploymentsService) GetProjectDeployment(pid interface{}, deployment in
}
u := fmt.Sprintf("projects/%s/deployments/%d", pathEscape(project), deployment)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -149,7 +150,7 @@ func (s *DeploymentsService) CreateProjectDeployment(pid interface{}, opt *Creat
}
u := fmt.Sprintf("projects/%s/deployments", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -181,7 +182,7 @@ func (s *DeploymentsService) UpdateProjectDeployment(pid interface{}, deployment
}
u := fmt.Sprintf("projects/%s/deployments/%d", pathEscape(project), deployment)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2018, Sander van Harmelen
// Copyright 2021, 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.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"time"
)
@ -61,7 +62,7 @@ func (s *DiscussionsService) ListIssueDiscussions(pid interface{}, issue int, op
}
u := fmt.Sprintf("projects/%s/issues/%d/discussions", pathEscape(project), issue)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -90,7 +91,7 @@ func (s *DiscussionsService) GetIssueDiscussion(pid interface{}, issue int, disc
discussion,
)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -125,7 +126,7 @@ func (s *DiscussionsService) CreateIssueDiscussion(pid interface{}, issue int, o
}
u := fmt.Sprintf("projects/%s/issues/%d/discussions", pathEscape(project), issue)
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -164,7 +165,7 @@ func (s *DiscussionsService) AddIssueDiscussionNote(pid interface{}, issue int,
discussion,
)
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -204,7 +205,7 @@ func (s *DiscussionsService) UpdateIssueDiscussionNote(pid interface{}, issue in
note,
)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -234,7 +235,7 @@ func (s *DiscussionsService) DeleteIssueDiscussionNote(pid interface{}, issue in
note,
)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -261,7 +262,7 @@ func (s *DiscussionsService) ListSnippetDiscussions(pid interface{}, snippet int
}
u := fmt.Sprintf("projects/%s/snippets/%d/discussions", pathEscape(project), snippet)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -290,7 +291,7 @@ func (s *DiscussionsService) GetSnippetDiscussion(pid interface{}, snippet int,
discussion,
)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -326,7 +327,7 @@ func (s *DiscussionsService) CreateSnippetDiscussion(pid interface{}, snippet in
}
u := fmt.Sprintf("projects/%s/snippets/%d/discussions", pathEscape(project), snippet)
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -366,7 +367,7 @@ func (s *DiscussionsService) AddSnippetDiscussionNote(pid interface{}, snippet i
discussion,
)
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -406,7 +407,7 @@ func (s *DiscussionsService) UpdateSnippetDiscussionNote(pid interface{}, snippe
note,
)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -436,7 +437,7 @@ func (s *DiscussionsService) DeleteSnippetDiscussionNote(pid interface{}, snippe
note,
)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -466,7 +467,7 @@ func (s *DiscussionsService) ListGroupEpicDiscussions(gid interface{}, epic int,
epic,
)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -495,7 +496,7 @@ func (s *DiscussionsService) GetEpicDiscussion(gid interface{}, epic int, discus
discussion,
)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -534,7 +535,7 @@ func (s *DiscussionsService) CreateEpicDiscussion(gid interface{}, epic int, opt
epic,
)
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -573,7 +574,7 @@ func (s *DiscussionsService) AddEpicDiscussionNote(gid interface{}, epic int, di
discussion,
)
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -613,7 +614,7 @@ func (s *DiscussionsService) UpdateEpicDiscussionNote(gid interface{}, epic int,
note,
)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -643,7 +644,7 @@ func (s *DiscussionsService) DeleteEpicDiscussionNote(gid interface{}, epic int,
note,
)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -673,7 +674,7 @@ func (s *DiscussionsService) ListMergeRequestDiscussions(pid interface{}, mergeR
mergeRequest,
)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -703,7 +704,7 @@ func (s *DiscussionsService) GetMergeRequestDiscussion(pid interface{}, mergeReq
discussion,
)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -743,7 +744,7 @@ func (s *DiscussionsService) CreateMergeRequestDiscussion(pid interface{}, merge
mergeRequest,
)
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -782,7 +783,7 @@ func (s *DiscussionsService) ResolveMergeRequestDiscussion(pid interface{}, merg
discussion,
)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -822,7 +823,7 @@ func (s *DiscussionsService) AddMergeRequestDiscussionNote(pid interface{}, merg
discussion,
)
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -864,7 +865,7 @@ func (s *DiscussionsService) UpdateMergeRequestDiscussionNote(pid interface{}, m
note,
)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -895,7 +896,7 @@ func (s *DiscussionsService) DeleteMergeRequestDiscussionNote(pid interface{}, m
note,
)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -925,7 +926,7 @@ func (s *DiscussionsService) ListCommitDiscussions(pid interface{}, commit strin
commit,
)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -955,7 +956,7 @@ func (s *DiscussionsService) GetCommitDiscussion(pid interface{}, commit string,
discussion,
)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -994,7 +995,7 @@ func (s *DiscussionsService) CreateCommitDiscussion(pid interface{}, commit stri
commit,
)
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -1033,7 +1034,7 @@ func (s *DiscussionsService) AddCommitDiscussionNote(pid interface{}, commit str
discussion,
)
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -1073,7 +1074,7 @@ func (s *DiscussionsService) UpdateCommitDiscussionNote(pid interface{}, commit
note,
)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -1103,7 +1104,7 @@ func (s *DiscussionsService) DeleteCommitDiscussionNote(pid interface{}, commit
note,
)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Sander van Harmelen
// Copyright 2021, 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.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
)
// EnvironmentsService handles communication with the environment related methods
@ -63,7 +64,7 @@ func (s *EnvironmentsService) ListEnvironments(pid interface{}, opts *ListEnviro
}
u := fmt.Sprintf("projects/%s/environments", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opts, options)
req, err := s.client.NewRequest(http.MethodGet, u, opts, options)
if err != nil {
return nil, nil, err
}
@ -88,7 +89,7 @@ func (s *EnvironmentsService) GetEnvironment(pid interface{}, environment int, o
}
u := fmt.Sprintf("projects/%s/environments/%d", pathEscape(project), environment)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -125,7 +126,7 @@ func (s *EnvironmentsService) CreateEnvironment(pid interface{}, opt *CreateEnvi
}
u := fmt.Sprintf("projects/%s/environments", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -159,7 +160,7 @@ func (s *EnvironmentsService) EditEnvironment(pid interface{}, environment int,
}
u := fmt.Sprintf("projects/%s/environments/%d", pathEscape(project), environment)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -184,7 +185,7 @@ func (s *EnvironmentsService) DeleteEnvironment(pid interface{}, environment int
}
u := fmt.Sprintf("projects/%s/environments/%d", pathEscape(project), environment)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -203,7 +204,7 @@ func (s *EnvironmentsService) StopEnvironment(pid interface{}, environmentID int
}
u := fmt.Sprintf("projects/%s/environments/%d/stop", pathEscape(project), environmentID)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,6 +1,25 @@
//
// Copyright 2021, 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"
import (
"fmt"
"net/http"
)
// EpicIssuesService handles communication with the epic issue related methods
// of the GitLab API.
@ -31,7 +50,7 @@ func (s *EpicIssuesService) ListEpicIssues(gid interface{}, epic int, opt *ListO
}
u := fmt.Sprintf("groups/%s/epics/%d/issues", pathEscape(group), epic)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -56,7 +75,7 @@ func (s *EpicIssuesService) AssignEpicIssue(gid interface{}, epic, issue int, op
}
u := fmt.Sprintf("groups/%s/epics/%d/issues/%d", pathEscape(group), epic, issue)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -81,7 +100,7 @@ func (s *EpicIssuesService) RemoveEpicIssue(gid interface{}, epic, epicIssue int
}
u := fmt.Sprintf("groups/%s/epics/%d/issues/%d", pathEscape(group), epic, epicIssue)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -118,7 +137,7 @@ func (s *EpicIssuesService) UpdateEpicIssueAssignment(gid interface{}, epic, epi
}
u := fmt.Sprintf("groups/%s/epics/%d/issues/%d", pathEscape(group), epic, epicIssue)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,7 +1,24 @@
//
// Copyright 2021, 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/http"
"time"
)
@ -89,7 +106,7 @@ func (s *EpicsService) ListGroupEpics(gid interface{}, opt *ListGroupEpicsOption
}
u := fmt.Sprintf("groups/%s/epics", pathEscape(group))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -113,7 +130,7 @@ func (s *EpicsService) GetEpic(gid interface{}, epic int, options ...RequestOpti
}
u := fmt.Sprintf("groups/%s/epics/%d", pathEscape(group), epic)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -137,7 +154,7 @@ func (s *EpicsService) GetEpicLinks(gid interface{}, epic int, options ...Reques
}
u := fmt.Sprintf("groups/%s/epics/%d/epics", pathEscape(group), epic)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -174,7 +191,7 @@ func (s *EpicsService) CreateEpic(gid interface{}, opt *CreateEpicOptions, optio
}
u := fmt.Sprintf("groups/%s/epics", pathEscape(group))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -213,7 +230,7 @@ func (s *EpicsService) UpdateEpic(gid interface{}, epic int, opt *UpdateEpicOpti
}
u := fmt.Sprintf("groups/%s/epics/%d", pathEscape(group), epic)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -237,7 +254,7 @@ func (s *EpicsService) DeleteEpic(gid interface{}, epic int, options ...RequestO
}
u := fmt.Sprintf("groups/%s/epics/%d", pathEscape(group), epic)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,3 +1,19 @@
//
// Copyright 2021, 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 (

View file

@ -1,3 +1,19 @@
//
// Copyright 2021, 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
// systemHookEvent is used to pre-process events to determine the

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Sander van Harmelen
// Copyright 2021, 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.
@ -191,6 +191,10 @@ type IssueEvent struct {
Previous int `json:"previous"`
Current int `json:"current"`
} `json:"updated_by_id"`
TotalTimeSpent struct {
Previous int `json:"previous"`
Current int `json:"current"`
} `json:"total_time_spent"`
} `json:"changes"`
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Sander van Harmelen
// Copyright 2021, 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.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"time"
)
@ -90,7 +91,7 @@ func (s *UsersService) ListUserContributionEvents(uid interface{}, opt *ListCont
}
u := fmt.Sprintf("users/%s/events", user)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -108,7 +109,7 @@ func (s *UsersService) ListUserContributionEvents(uid interface{}, opt *ListCont
//
// 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 ...RequestOptionFunc) ([]*ContributionEvent, *Response, error) {
req, err := s.client.NewRequest("GET", "events", opt, options)
req, err := s.client.NewRequest(http.MethodGet, "events", opt, options)
if err != nil {
return nil, nil, err
}
@ -132,7 +133,7 @@ func (s *EventsService) ListProjectVisibleEvents(pid interface{}, opt *ListContr
}
u := fmt.Sprintf("projects/%s/events", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,7 +1,24 @@
//
// Copyright 2021, 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/http"
"net/url"
)
@ -39,7 +56,7 @@ func (f Feature) String() string {
// GitLab API docs:
// https://docs.gitlab.com/ce/api/features.html#list-all-features
func (s *FeaturesService) ListFeatures(options ...RequestOptionFunc) ([]*Feature, *Response, error) {
req, err := s.client.NewRequest("GET", "features", nil, options)
req, err := s.client.NewRequest(http.MethodGet, "features", nil, options)
if err != nil {
return nil, nil, err
}
@ -65,7 +82,7 @@ func (s *FeaturesService) SetFeatureFlag(name string, value interface{}, options
value,
}
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2020 Paul Cioanca
// Copyright 2021 Paul Cioanca
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"time"
)
@ -60,7 +61,7 @@ func (s *FreezePeriodsService) ListFreezePeriods(pid interface{}, opt *ListFreez
}
u := fmt.Sprintf("projects/%s/freeze_periods", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -85,7 +86,7 @@ func (s *FreezePeriodsService) GetFreezePeriod(pid interface{}, freezePeriod int
}
u := fmt.Sprintf("projects/%s/freeze_periods/%d", pathEscape(project), freezePeriod)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -121,7 +122,7 @@ func (s *FreezePeriodsService) CreateFreezePeriodOptions(pid interface{}, opt *C
}
u := fmt.Sprintf("projects/%s/freeze_periods", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -157,7 +158,7 @@ func (s *FreezePeriodsService) UpdateFreezePeriodOptions(pid interface{}, freeze
}
u := fmt.Sprintf("projects/%s/freeze_periods/%d", pathEscape(project), freezePeriod)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -184,7 +185,7 @@ func (s *FreezePeriodsService) DeleteFreezePeriod(pid interface{}, freezePeriod
}
u := fmt.Sprintf("projects/%s/freeze_periods/%d", pathEscape(project), freezePeriod)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2018, Sander van Harmelen
// Copyright 2021, 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.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"net/url"
)
@ -48,7 +49,7 @@ type ListTemplatesOptions ListOptions
// GitLab API docs:
// https://docs.gitlab.com/ce/api/templates/gitignores.html#list-gitignore-templates
func (s *GitIgnoreTemplatesService) ListTemplates(opt *ListTemplatesOptions, options ...RequestOptionFunc) ([]*GitIgnoreTemplate, *Response, error) {
req, err := s.client.NewRequest("GET", "templates/gitignores", opt, options)
req, err := s.client.NewRequest(http.MethodGet, "templates/gitignores", opt, options)
if err != nil {
return nil, nil, err
}
@ -69,7 +70,7 @@ func (s *GitIgnoreTemplatesService) ListTemplates(opt *ListTemplatesOptions, opt
func (s *GitIgnoreTemplatesService) GetTemplate(key string, options ...RequestOptionFunc) (*GitIgnoreTemplate, *Response, error) {
u := fmt.Sprintf("templates/gitignores/%s", url.PathEscape(key))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Sander van Harmelen
// Copyright 2021, 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.
@ -100,6 +100,7 @@ type Client struct {
// Services used for talking to different parts of the GitLab API.
AccessRequests *AccessRequestsService
Applications *ApplicationsService
AuditEvents *AuditEventsService
AwardEmoji *AwardEmojiService
Boards *IssueBoardsService
Branches *BranchesService
@ -126,9 +127,11 @@ type Client struct {
GroupMembers *GroupMembersService
GroupMilestones *GroupMilestonesService
GroupVariables *GroupVariablesService
GroupWikis *GroupWikisService
Groups *GroupsService
InstanceCluster *InstanceClustersService
InstanceVariables *InstanceVariablesService
Invites *InvitesService
IssueLinks *IssueLinksService
Issues *IssuesService
IssuesStatistics *IssuesStatisticsService
@ -143,6 +146,7 @@ type Client struct {
Namespaces *NamespacesService
Notes *NotesService
NotificationSettings *NotificationSettingsService
Packages *PackagesService
PagesDomains *PagesDomainsService
PipelineSchedules *PipelineSchedulesService
PipelineTriggers *PipelineTriggersService
@ -156,12 +160,14 @@ type Client struct {
ProjectVariables *ProjectVariablesService
Projects *ProjectsService
ProtectedBranches *ProtectedBranchesService
ProtectedEnvironments *ProtectedEnvironmentsService
ProtectedTags *ProtectedTagsService
ReleaseLinks *ReleaseLinksService
Releases *ReleasesService
Repositories *RepositoriesService
RepositoryFiles *RepositoryFilesService
ResourceLabelEvents *ResourceLabelEventsService
ResourceStateEvents *ResourceStateEventsService
Runners *RunnersService
Search *SearchService
Services *ServicesService
@ -264,6 +270,7 @@ func newClient(options ...ClientOptionFunc) (*Client, error) {
// Create all the public services.
c.AccessRequests = &AccessRequestsService{client: c}
c.Applications = &ApplicationsService{client: c}
c.AuditEvents = &AuditEventsService{client: c}
c.AwardEmoji = &AwardEmojiService{client: c}
c.Boards = &IssueBoardsService{client: c}
c.Branches = &BranchesService{client: c}
@ -290,9 +297,11 @@ func newClient(options ...ClientOptionFunc) (*Client, error) {
c.GroupMembers = &GroupMembersService{client: c}
c.GroupMilestones = &GroupMilestonesService{client: c}
c.GroupVariables = &GroupVariablesService{client: c}
c.GroupWikis = &GroupWikisService{client: c}
c.Groups = &GroupsService{client: c}
c.InstanceCluster = &InstanceClustersService{client: c}
c.InstanceVariables = &InstanceVariablesService{client: c}
c.Invites = &InvitesService{client: c}
c.IssueLinks = &IssueLinksService{client: c}
c.Issues = &IssuesService{client: c, timeStats: timeStats}
c.IssuesStatistics = &IssuesStatisticsService{client: c}
@ -307,6 +316,7 @@ func newClient(options ...ClientOptionFunc) (*Client, error) {
c.Namespaces = &NamespacesService{client: c}
c.Notes = &NotesService{client: c}
c.NotificationSettings = &NotificationSettingsService{client: c}
c.Packages = &PackagesService{client: c}
c.PagesDomains = &PagesDomainsService{client: c}
c.PipelineSchedules = &PipelineSchedulesService{client: c}
c.PipelineTriggers = &PipelineTriggersService{client: c}
@ -320,12 +330,14 @@ func newClient(options ...ClientOptionFunc) (*Client, error) {
c.ProjectVariables = &ProjectVariablesService{client: c}
c.Projects = &ProjectsService{client: c}
c.ProtectedBranches = &ProtectedBranchesService{client: c}
c.ProtectedEnvironments = &ProtectedEnvironmentsService{client: c}
c.ProtectedTags = &ProtectedTagsService{client: c}
c.ReleaseLinks = &ReleaseLinksService{client: c}
c.Releases = &ReleasesService{client: c}
c.Repositories = &RepositoriesService{client: c}
c.RepositoryFiles = &RepositoryFilesService{client: c}
c.ResourceLabelEvents = &ResourceLabelEventsService{client: c}
c.ResourceStateEvents = &ResourceStateEventsService{client: c}
c.Runners = &RunnersService{client: c}
c.Search = &SearchService{client: c}
c.Services = &ServicesService{client: c}
@ -402,7 +414,7 @@ func rateLimitBackoff(min, max time.Duration, attemptNum int, resp *http.Respons
}
// configureLimiter configures the rate limiter.
func (c *Client) configureLimiter() error {
func (c *Client) configureLimiter(ctx context.Context) error {
// Set default values for when rate limiting is disabled.
limit := rate.Inf
burst := 0
@ -413,7 +425,7 @@ func (c *Client) configureLimiter() error {
}()
// Create a new request.
req, err := http.NewRequest("GET", c.baseURL.String(), nil)
req, err := http.NewRequestWithContext(ctx, http.MethodGet, c.baseURL.String(), nil)
if err != nil {
return err
}
@ -497,7 +509,7 @@ func (c *Client) NewRequest(method, path string, opt interface{}, options []Requ
var body interface{}
switch {
case method == "POST" || method == "PUT":
case method == http.MethodPost || method == http.MethodPut:
reqHeaders.Set("Content-Type", "application/json")
if opt != nil {
@ -601,7 +613,7 @@ func (r *Response) populatePageValues() {
func (c *Client) Do(req *retryablehttp.Request, v interface{}) (*Response, error) {
// If not yet configured, try to configure the rate limiter. Fail
// silently as the limiter will be disabled in case of an error.
c.configureLimiterOnce.Do(func() { c.configureLimiter() })
c.configureLimiterOnce.Do(func() { c.configureLimiter(req.Context()) })
// Wait will block until the limiter can obtain a new token.
err := c.limiter.Wait(req.Context())

View file

@ -1,7 +1,24 @@
//
// Copyright 2021, 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/http"
)
// GroupBadgesService handles communication with the group badges
@ -51,7 +68,7 @@ func (s *GroupBadgesService) ListGroupBadges(gid interface{}, opt *ListGroupBadg
}
u := fmt.Sprintf("groups/%s/badges", pathEscape(group))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -76,7 +93,7 @@ func (s *GroupBadgesService) GetGroupBadge(gid interface{}, badge int, options .
}
u := fmt.Sprintf("groups/%s/badges/%d", pathEscape(group), badge)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -110,7 +127,7 @@ func (s *GroupBadgesService) AddGroupBadge(gid interface{}, opt *AddGroupBadgeOp
}
u := fmt.Sprintf("groups/%s/badges", pathEscape(group))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -144,7 +161,7 @@ func (s *GroupBadgesService) EditGroupBadge(gid interface{}, badge int, opt *Edi
}
u := fmt.Sprintf("groups/%s/badges/%d", pathEscape(group), badge)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -169,7 +186,7 @@ func (s *GroupBadgesService) DeleteGroupBadge(gid interface{}, badge int, option
}
u := fmt.Sprintf("groups/%s/badges/%d", pathEscape(group), badge)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -198,7 +215,7 @@ func (s *GroupBadgesService) PreviewGroupBadge(gid interface{}, opt *GroupBadgeP
}
u := fmt.Sprintf("groups/%s/badges/render", pathEscape(group))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2018, Patrick Webster
// Copyright 2021, Patrick Webster
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
)
// GroupIssueBoardsService handles communication with the group issue board
@ -63,7 +64,7 @@ func (s *GroupIssueBoardsService) ListGroupIssueBoards(gid interface{}, opt *Lis
}
u := fmt.Sprintf("groups/%s/boards", pathEscape(group))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -97,7 +98,7 @@ func (s *GroupIssueBoardsService) CreateGroupIssueBoard(gid interface{}, opt *Cr
}
u := fmt.Sprintf("groups/%s/boards", pathEscape(group))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -122,7 +123,7 @@ func (s *GroupIssueBoardsService) GetGroupIssueBoard(gid interface{}, board int,
}
u := fmt.Sprintf("groups/%s/boards/%d", pathEscape(group), board)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -159,7 +160,7 @@ func (s *GroupIssueBoardsService) UpdateIssueBoard(gid interface{}, board int, o
}
u := fmt.Sprintf("groups/%s/boards/%d", pathEscape(group), board)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -184,7 +185,7 @@ func (s *GroupIssueBoardsService) DeleteIssueBoard(gid interface{}, board int, o
}
u := fmt.Sprintf("groups/%s/boards/%d", pathEscape(group), board)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -210,7 +211,7 @@ func (s *GroupIssueBoardsService) ListGroupIssueBoardLists(gid interface{}, boar
}
u := fmt.Sprintf("groups/%s/boards/%d/lists", pathEscape(group), board)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -239,7 +240,7 @@ func (s *GroupIssueBoardsService) GetGroupIssueBoardList(gid interface{}, board,
list,
)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -273,7 +274,7 @@ func (s *GroupIssueBoardsService) CreateGroupIssueBoardList(gid interface{}, boa
}
u := fmt.Sprintf("groups/%s/boards/%d/lists", pathEscape(group), board)
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -312,7 +313,7 @@ func (s *GroupIssueBoardsService) UpdateIssueBoardList(gid interface{}, board, l
list,
)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -342,7 +343,7 @@ func (s *GroupIssueBoardsService) DeleteGroupIssueBoardList(gid interface{}, boa
list,
)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2019, Paul Shoemaker
// Copyright 2021, Paul Shoemaker
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"time"
)
@ -63,7 +64,7 @@ func (s *GroupClustersService) ListClusters(pid interface{}, options ...RequestO
}
u := fmt.Sprintf("groups/%s/clusters", pathEscape(group))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -88,7 +89,7 @@ func (s *GroupClustersService) GetCluster(pid interface{}, cluster int, options
}
u := fmt.Sprintf("groups/%s/clusters/%d", pathEscape(group), cluster)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -136,7 +137,7 @@ func (s *GroupClustersService) AddCluster(pid interface{}, opt *AddGroupClusterO
}
u := fmt.Sprintf("groups/%s/clusters/user", pathEscape(group))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -180,7 +181,7 @@ func (s *GroupClustersService) EditCluster(pid interface{}, cluster int, opt *Ed
}
u := fmt.Sprintf("groups/%s/clusters/%d", pathEscape(group), cluster)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -205,7 +206,7 @@ func (s *GroupClustersService) DeleteCluster(pid interface{}, cluster int, optio
}
u := fmt.Sprintf("groups/%s/clusters/%d", pathEscape(group), cluster)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2020, Eric Stevens
// Copyright 2021, Eric Stevens
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"time"
)
@ -53,7 +54,7 @@ func (s *GroupsService) ListGroupHooks(gid interface{}) ([]*GroupHook, *Response
}
u := fmt.Sprintf("groups/%s/hooks", pathEscape(group))
req, err := s.client.NewRequest("GET", u, nil, nil)
req, err := s.client.NewRequest(http.MethodGet, u, nil, nil)
if err != nil {
return nil, nil, err
}
@ -77,7 +78,7 @@ func (s *GroupsService) GetGroupHook(pid interface{}, hook int, options ...Reque
}
u := fmt.Sprintf("groups/%s/hooks/%d", pathEscape(group), hook)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -121,7 +122,7 @@ func (s *GroupsService) AddGroupHook(gid interface{}, opt *AddGroupHookOptions,
}
u := fmt.Sprintf("groups/%s/hooks", pathEscape(group))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -167,7 +168,7 @@ func (s *GroupsService) EditGroupHook(pid interface{}, hook int, opt *EditGroupH
}
u := fmt.Sprintf("groups/%s/hooks/%d", pathEscape(group), hook)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -193,7 +194,7 @@ func (s *GroupsService) DeleteGroupHook(pid interface{}, hook int, options ...Re
}
u := fmt.Sprintf("groups/%s/hooks/%d", pathEscape(group), hook)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,7 +1,24 @@
//
// Copyright 2021, 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/http"
)
// GroupLabelsService handles communication with the label related methods of the
@ -37,7 +54,7 @@ func (s *GroupLabelsService) ListGroupLabels(gid interface{}, opt *ListGroupLabe
}
u := fmt.Sprintf("groups/%s/labels", pathEscape(group))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -66,7 +83,7 @@ func (s *GroupLabelsService) GetGroupLabel(gid interface{}, labelID interface{},
}
u := fmt.Sprintf("groups/%s/labels/%s", pathEscape(group), label)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -98,7 +115,7 @@ func (s *GroupLabelsService) CreateGroupLabel(gid interface{}, opt *CreateGroupL
}
u := fmt.Sprintf("groups/%s/labels", pathEscape(group))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -128,7 +145,7 @@ func (s *GroupLabelsService) DeleteGroupLabel(gid interface{}, opt *DeleteGroupL
}
u := fmt.Sprintf("groups/%s/labels", pathEscape(group))
req, err := s.client.NewRequest("DELETE", u, opt, options)
req, err := s.client.NewRequest(http.MethodDelete, u, opt, options)
if err != nil {
return nil, err
}
@ -154,7 +171,7 @@ func (s *GroupLabelsService) UpdateGroupLabel(gid interface{}, opt *UpdateGroupL
}
u := fmt.Sprintf("groups/%s/labels", pathEscape(group))
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -185,7 +202,7 @@ func (s *GroupLabelsService) SubscribeToGroupLabel(gid interface{}, labelID inte
}
u := fmt.Sprintf("groups/%s/labels/%s/subscribe", pathEscape(group), label)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -216,7 +233,7 @@ func (s *GroupLabelsService) UnsubscribeFromGroupLabel(gid interface{}, labelID
}
u := fmt.Sprintf("groups/%s/labels/%s/unsubscribe", pathEscape(group), label)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Sander van Harmelen
// Copyright 2021, 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.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
)
// GroupMembersService handles communication with the group members
@ -76,7 +77,7 @@ func (s *GroupsService) ListGroupMembers(gid interface{}, opt *ListGroupMembersO
}
u := fmt.Sprintf("groups/%s/members", pathEscape(group))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -102,7 +103,7 @@ func (s *GroupsService) ListAllGroupMembers(gid interface{}, opt *ListGroupMembe
}
u := fmt.Sprintf("groups/%s/members/all", pathEscape(group))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -137,7 +138,7 @@ func (s *GroupMembersService) GetGroupMember(gid interface{}, user int, options
}
u := fmt.Sprintf("groups/%s/members/%d", pathEscape(group), user)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -151,6 +152,56 @@ func (s *GroupMembersService) GetGroupMember(gid interface{}, user int, options
return gm, resp, err
}
// BillableGroupMember represents a GitLab billable group member.
//
// GitLab API docs: https://docs.gitlab.com/ee/api/members.html#list-all-billable-members-of-a-group
type BillableGroupMember struct {
ID int `json:"id"`
Username string `json:"username"`
Name string `json:"name"`
State string `json:"state"`
AvatarURL string `json:"avatar_url"`
WebURL string `json:"web_url"`
Email string `json:"email"`
LastActivityOn ISOTime `json:"last_activity_on"`
}
// ListBillableGroupMembersOptions represents the available ListBillableGroupMembers() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/members.html#list-all-billable-members-of-a-group
type ListBillableGroupMembersOptions struct {
ListOptions
Search *string `url:"search,omitempty" json:"search,omitempty"`
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
}
// ListBillableGroupMembers Gets a list of group members that count as billable.
// The list includes members in the subgroup or subproject.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/members.html#list-all-billable-members-of-a-group
func (s *GroupsService) ListBillableGroupMembers(gid interface{}, opt *ListBillableGroupMembersOptions, options ...RequestOptionFunc) ([]*BillableGroupMember, *Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/billable_members", pathEscape(group))
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
var bgm []*BillableGroupMember
resp, err := s.client.Do(req, &bgm)
if err != nil {
return nil, resp, err
}
return bgm, resp, err
}
// AddGroupMember adds a user to the list of group members.
//
// GitLab API docs:
@ -162,7 +213,7 @@ func (s *GroupMembersService) AddGroupMember(gid interface{}, opt *AddGroupMembe
}
u := fmt.Sprintf("groups/%s/members", pathEscape(group))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -187,7 +238,7 @@ func (s *GroupMembersService) ShareWithGroup(gid interface{}, opt *ShareWithGrou
}
u := fmt.Sprintf("groups/%s/share", pathEscape(group))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -212,7 +263,7 @@ func (s *GroupMembersService) DeleteShareWithGroup(gid interface{}, groupID int,
}
u := fmt.Sprintf("groups/%s/share/%d", pathEscape(group), groupID)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -241,7 +292,7 @@ func (s *GroupMembersService) EditGroupMember(gid interface{}, user int, opt *Ed
}
u := fmt.Sprintf("groups/%s/members/%d", pathEscape(group), user)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -266,7 +317,7 @@ func (s *GroupMembersService) RemoveGroupMember(gid interface{}, user int, optio
}
u := fmt.Sprintf("groups/%s/members/%d", pathEscape(group), user)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2018, Sander van Harmelen
// Copyright 2021, 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.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"time"
)
@ -75,7 +76,7 @@ func (s *GroupMilestonesService) ListGroupMilestones(gid interface{}, opt *ListG
}
u := fmt.Sprintf("groups/%s/milestones", pathEscape(group))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -100,7 +101,7 @@ func (s *GroupMilestonesService) GetGroupMilestone(gid interface{}, milestone in
}
u := fmt.Sprintf("groups/%s/milestones/%d", pathEscape(group), milestone)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -136,7 +137,7 @@ func (s *GroupMilestonesService) CreateGroupMilestone(gid interface{}, opt *Crea
}
u := fmt.Sprintf("groups/%s/milestones", pathEscape(group))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -173,7 +174,7 @@ func (s *GroupMilestonesService) UpdateGroupMilestone(gid interface{}, milestone
}
u := fmt.Sprintf("groups/%s/milestones/%d", pathEscape(group), milestone)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -204,7 +205,7 @@ func (s *GroupMilestonesService) GetGroupMilestoneIssues(gid interface{}, milest
}
u := fmt.Sprintf("groups/%s/milestones/%d/issues", pathEscape(group), milestone)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -237,7 +238,7 @@ func (s *GroupMilestonesService) GetGroupMilestoneMergeRequests(gid interface{},
}
u := fmt.Sprintf("groups/%s/milestones/%d/merge_requests", pathEscape(group), milestone)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -280,7 +281,7 @@ func (s *GroupMilestonesService) GetGroupMilestoneBurndownChartEvents(gid interf
}
u := fmt.Sprintf("groups/%s/milestones/%d/burndown_events", pathEscape(group), milestone)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2018, Patrick Webster
// Copyright 2021, Patrick Webster
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"net/url"
)
@ -64,7 +65,7 @@ func (s *GroupVariablesService) ListVariables(gid interface{}, opt *ListGroupVar
}
u := fmt.Sprintf("groups/%s/variables", pathEscape(group))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -89,7 +90,7 @@ func (s *GroupVariablesService) GetVariable(gid interface{}, key string, options
}
u := fmt.Sprintf("groups/%s/variables/%s", pathEscape(group), url.PathEscape(key))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -127,7 +128,7 @@ func (s *GroupVariablesService) CreateVariable(gid interface{}, opt *CreateGroup
}
u := fmt.Sprintf("groups/%s/variables", pathEscape(group))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -165,7 +166,7 @@ func (s *GroupVariablesService) UpdateVariable(gid interface{}, key string, opt
}
u := fmt.Sprintf("groups/%s/variables/%s", pathEscape(group), url.PathEscape(key))
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -190,7 +191,7 @@ func (s *GroupVariablesService) RemoveVariable(gid interface{}, key string, opti
}
u := fmt.Sprintf("groups/%s/variables/%s", pathEscape(group), url.PathEscape(key))
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

194
vendor/github.com/xanzy/go-gitlab/group_wikis.go generated vendored Normal file
View file

@ -0,0 +1,194 @@
//
// Copyright 2021, Markus Lackner
//
// 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/http"
"net/url"
)
// GroupWikisService handles communication with the group wikis related methods of
// the Gitlab API.
//
// GitLab API docs: https://docs.gitlab.com/ee/api/group_wikis.html
type GroupWikisService struct {
client *Client
}
// GroupWiki represents a GitLab groups wiki.
//
// GitLab API docs: https://docs.gitlab.com/ee/api/group_wikis.html
type GroupWiki struct {
Content string `json:"content"`
Format WikiFormatValue `json:"format"`
Slug string `json:"slug"`
Title string `json:"title"`
}
func (w GroupWiki) String() string {
return Stringify(w)
}
// ListGroupWikisOptions represents the available ListGroupWikis options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/group_wikis.html#list-wiki-pages
type ListGroupWikisOptions struct {
WithContent *bool `url:"with_content,omitempty" json:"with_content,omitempty"`
}
// ListGroupWikis lists all pages of the wiki of the given group id.
// When with_content is set, it also returns the content of the pages.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/group_wikis.html#list-wiki-pages
func (s *GroupWikisService) ListGroupWikis(gid interface{}, opt *ListGroupWikisOptions, options ...RequestOptionFunc) ([]*GroupWiki, *Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/wikis", pathEscape(group))
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
var gws []*GroupWiki
resp, err := s.client.Do(req, &gws)
if err != nil {
return nil, resp, err
}
return gws, resp, err
}
// GetGroupWikiPage gets a wiki page for a given group.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/group_wikis.html#get-a-wiki-page
func (s *GroupWikisService) GetGroupWikiPage(gid interface{}, slug string, options ...RequestOptionFunc) (*GroupWiki, *Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/wikis/%s", pathEscape(group), url.PathEscape(slug))
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
gw := new(GroupWiki)
resp, err := s.client.Do(req, gw)
if err != nil {
return nil, resp, err
}
return gw, resp, err
}
// CreateGroupWikiPageOptions represents options to CreateGroupWikiPage.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/group_wikis.html#create-a-new-wiki-page
type CreateGroupWikiPageOptions struct {
Content *string `url:"content,omitempty" json:"content,omitempty"`
Title *string `url:"title,omitempty" json:"title,omitempty"`
Format *WikiFormatValue `url:"format,omitempty" json:"format,omitempty"`
}
// CreateGroupWikiPage creates a new wiki page for the given group with
// the given title, slug, and content.
//
// GitLab API docs:
// https://docs.gitlab.com/13.8/ee/api/group_wikis.html#create-a-new-wiki-page
func (s *GroupWikisService) CreateGroupWikiPage(gid interface{}, opt *CreateGroupWikiPageOptions, options ...RequestOptionFunc) (*GroupWiki, *Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/wikis", pathEscape(group))
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
w := new(GroupWiki)
resp, err := s.client.Do(req, w)
if err != nil {
return nil, resp, err
}
return w, resp, err
}
// EditGroupWikiPageOptions represents options to EditGroupWikiPage.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/group_wikis.html#edit-an-existing-wiki-page
type EditGroupWikiPageOptions struct {
Content *string `url:"content,omitempty" json:"content,omitempty"`
Title *string `url:"title,omitempty" json:"title,omitempty"`
Format *WikiFormatValue `url:"format,omitempty" json:"format,omitempty"`
}
// EditGroupWikiPage Updates an existing wiki page. At least one parameter is
// required to update the wiki page.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/group_wikis.html#edit-an-existing-wiki-page
func (s *GroupWikisService) EditGroupWikiPage(gid interface{}, slug string, opt *EditGroupWikiPageOptions, options ...RequestOptionFunc) (*GroupWiki, *Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/wikis/%s", pathEscape(group), url.PathEscape(slug))
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
w := new(GroupWiki)
resp, err := s.client.Do(req, w)
if err != nil {
return nil, resp, err
}
return w, resp, err
}
// DeleteGroupWikiPage deletes a wiki page with a given slug.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/group_wikis.html#delete-a-wiki-page
func (s *GroupWikisService) DeleteGroupWikiPage(gid interface{}, slug string, options ...RequestOptionFunc) (*Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, err
}
u := fmt.Sprintf("groups/%s/wikis/%s", pathEscape(group), url.PathEscape(slug))
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
return s.client.Do(req, nil)
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Sander van Harmelen
// Copyright 2021, 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.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"time"
)
@ -106,7 +107,7 @@ type ListGroupsOptions struct {
// GitLab API docs:
// https://docs.gitlab.com/ce/api/groups.html#list-project-groups
func (s *GroupsService) ListGroups(opt *ListGroupsOptions, options ...RequestOptionFunc) ([]*Group, *Response, error) {
req, err := s.client.NewRequest("GET", "groups", opt, options)
req, err := s.client.NewRequest(http.MethodGet, "groups", opt, options)
if err != nil {
return nil, nil, err
}
@ -130,7 +131,7 @@ func (s *GroupsService) GetGroup(gid interface{}, options ...RequestOptionFunc)
}
u := fmt.Sprintf("groups/%s", pathEscape(group))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -173,7 +174,7 @@ type CreateGroupOptions struct {
//
// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#new-group
func (s *GroupsService) CreateGroup(opt *CreateGroupOptions, options ...RequestOptionFunc) (*Group, *Response, error) {
req, err := s.client.NewRequest("POST", "groups", opt, options)
req, err := s.client.NewRequest(http.MethodPost, "groups", opt, options)
if err != nil {
return nil, nil, err
}
@ -203,7 +204,7 @@ func (s *GroupsService) TransferGroup(gid interface{}, pid interface{}, options
}
u := fmt.Sprintf("groups/%s/projects/%s", pathEscape(group), pathEscape(project))
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -234,7 +235,7 @@ func (s *GroupsService) UpdateGroup(gid interface{}, opt *UpdateGroupOptions, op
}
u := fmt.Sprintf("groups/%s", pathEscape(group))
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -258,7 +259,7 @@ func (s *GroupsService) DeleteGroup(gid interface{}, options ...RequestOptionFun
}
u := fmt.Sprintf("groups/%s", pathEscape(group))
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -277,7 +278,7 @@ func (s *GroupsService) RestoreGroup(gid interface{}, options ...RequestOptionFu
}
u := fmt.Sprintf("groups/%s/restore", pathEscape(group))
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -300,7 +301,7 @@ func (s *GroupsService) SearchGroup(query string, options ...RequestOptionFunc)
}
q.Search = query
req, err := s.client.NewRequest("GET", "groups", &q, options)
req, err := s.client.NewRequest(http.MethodGet, "groups", &q, options)
if err != nil {
return nil, nil, err
}
@ -320,19 +321,21 @@ func (s *GroupsService) SearchGroup(query string, options ...RequestOptionFunc)
// https://docs.gitlab.com/ce/api/groups.html#list-a-group-39-s-projects
type ListGroupProjectsOptions struct {
ListOptions
Archived *bool `url:"archived,omitempty" json:"archived,omitempty"`
Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,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"`
Simple *bool `url:"simple,omitempty" json:"simple,omitempty"`
Owned *bool `url:"owned,omitempty" json:"owned,omitempty"`
Starred *bool `url:"starred,omitempty" json:"starred,omitempty"`
WithIssuesEnabled *bool `url:"with_issues_enabled,omitempty" json:"with_issues_enabled,omitempty"`
WithMergeRequestsEnabled *bool `url:"with_merge_requests_enabled,omitempty" json:"with_merge_requests_enabled,omitempty"`
WithShared *bool `url:"with_shared,omitempty" json:"with_shared,omitempty"`
IncludeSubgroups *bool `url:"include_subgroups,omitempty" json:"include_subgroups,omitempty"`
WithCustomAttributes *bool `url:"with_custom_attributes,omitempty" json:"with_custom_attributes,omitempty"`
Archived *bool `url:"archived,omitempty" json:"archived,omitempty"`
Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,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"`
Simple *bool `url:"simple,omitempty" json:"simple,omitempty"`
Owned *bool `url:"owned,omitempty" json:"owned,omitempty"`
Starred *bool `url:"starred,omitempty" json:"starred,omitempty"`
WithIssuesEnabled *bool `url:"with_issues_enabled,omitempty" json:"with_issues_enabled,omitempty"`
WithMergeRequestsEnabled *bool `url:"with_merge_requests_enabled,omitempty" json:"with_merge_requests_enabled,omitempty"`
WithShared *bool `url:"with_shared,omitempty" json:"with_shared,omitempty"`
IncludeSubgroups *bool `url:"include_subgroups,omitempty" json:"include_subgroups,omitempty"`
MinAccessLevel *AccessLevelValue `url:"min_access_level,omitempty" json:"min_access_level,omitempty"`
WithCustomAttributes *bool `url:"with_custom_attributes,omitempty" json:"with_custom_attributes,omitempty"`
WithSecurityReports *bool `url:"with_security_reports,omitempty" json:"with_security_reports,omitempty"`
}
// ListGroupProjects get a list of group projects
@ -346,7 +349,7 @@ func (s *GroupsService) ListGroupProjects(gid interface{}, opt *ListGroupProject
}
u := fmt.Sprintf("groups/%s/projects", pathEscape(group))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -377,7 +380,7 @@ func (s *GroupsService) ListSubgroups(gid interface{}, opt *ListSubgroupsOptions
}
u := fmt.Sprintf("groups/%s/subgroups", pathEscape(group))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -409,7 +412,7 @@ func (s *GroupsService) ListDescendantGroups(gid interface{}, opt *ListDescendan
}
u := fmt.Sprintf("groups/%s/descendant_groups", pathEscape(group))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -435,7 +438,7 @@ func (s *GroupsService) ListGroupLDAPLinks(gid interface{}, options ...RequestOp
}
u := fmt.Sprintf("groups/%s/ldap_group_links", pathEscape(group))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -471,7 +474,7 @@ func (s *GroupsService) AddGroupLDAPLink(gid interface{}, opt *AddGroupLDAPLinkO
}
u := fmt.Sprintf("groups/%s/ldap_group_links", pathEscape(group))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -497,7 +500,7 @@ func (s *GroupsService) DeleteGroupLDAPLink(gid interface{}, cn string, options
}
u := fmt.Sprintf("groups/%s/ldap_group_links/%s", pathEscape(group), pathEscape(cn))
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -522,7 +525,61 @@ func (s *GroupsService) DeleteGroupLDAPLinkForProvider(gid interface{}, provider
pathEscape(cn),
)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
return s.client.Do(req, nil)
}
// ShareGroupWithGroupOptions represents the available ShareGroupWithGroup() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/groups.html#share-groups-with-groups
type ShareGroupWithGroupOptions struct {
GroupID *int `url:"group_id,omitempty" json:"group_id,omitempty"`
GroupAccess *AccessLevelValue `url:"group_access,omitempty" json:"group_access,omitempty"`
ExpiresAt *ISOTime `url:"expires_at,omitempty" json:"expires_at,omitempty"`
}
// ShareGroupWithGroup shares a group with another group.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/groups.html#create-a-link-to-share-a-group-with-another-group
func (s *GroupsService) ShareGroupWithGroup(gid interface{}, opt *ShareGroupWithGroupOptions, options ...RequestOptionFunc) (*Group, *Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/share", pathEscape(group))
req, err := s.client.NewRequest(http.MethodPost, 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
}
// UnshareGroupFromGroup unshares a group from another group.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/groups.html#delete-link-sharing-group-with-another-group
func (s *GroupsService) UnshareGroupFromGroup(gid interface{}, groupID int, options ...RequestOptionFunc) (*Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, err
}
u := fmt.Sprintf("groups/%s/share/%d", pathEscape(group), groupID)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -561,7 +618,7 @@ func (s *GroupsService) GetGroupPushRules(gid interface{}, options ...RequestOpt
}
u := fmt.Sprintf("groups/%s/push_rule", pathEscape(group))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -605,7 +662,7 @@ func (s *GroupsService) AddGroupPushRule(gid interface{}, opt *AddGroupPushRuleO
}
u := fmt.Sprintf("groups/%s/push_rule", pathEscape(group))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -649,7 +706,7 @@ func (s *GroupsService) EditGroupPushRule(gid interface{}, opt *EditGroupPushRul
}
u := fmt.Sprintf("groups/%s/push_rule", pathEscape(group))
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -674,7 +731,7 @@ func (s *GroupsService) DeleteGroupPushRule(gid interface{}, options ...RequestO
}
u := fmt.Sprintf("groups/%s/push_rule", pathEscape(group))
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2020, Serena Fang
// Copyright 2021, Serena Fang
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"time"
)
@ -59,7 +60,7 @@ func (v InstanceCluster) String() string {
func (s *InstanceClustersService) ListClusters(options ...RequestOptionFunc) ([]*InstanceCluster, *Response, error) {
u := "admin/clusters"
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -80,7 +81,7 @@ func (s *InstanceClustersService) ListClusters(options ...RequestOptionFunc) ([]
func (s *InstanceClustersService) GetCluster(cluster int, options ...RequestOptionFunc) (*InstanceCluster, *Response, error) {
u := fmt.Sprintf("admin/clusters/%d", cluster)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -101,7 +102,7 @@ func (s *InstanceClustersService) GetCluster(cluster int, options ...RequestOpti
func (s *InstanceClustersService) AddCluster(opt *AddClusterOptions, options ...RequestOptionFunc) (*InstanceCluster, *Response, error) {
u := "admin/clusters/add"
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -122,7 +123,7 @@ func (s *InstanceClustersService) AddCluster(opt *AddClusterOptions, options ...
func (s *InstanceClustersService) EditCluster(cluster int, opt *EditClusterOptions, options ...RequestOptionFunc) (*InstanceCluster, *Response, error) {
u := fmt.Sprintf("admin/clusters/%d", cluster)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -143,7 +144,7 @@ func (s *InstanceClustersService) EditCluster(cluster int, opt *EditClusterOptio
func (s *InstanceClustersService) DeleteCluster(cluster int, options ...RequestOptionFunc) (*Response, error) {
u := fmt.Sprintf("admin/clusters/%d", cluster)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2018, Patrick Webster
// Copyright 2021, Patrick Webster
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"net/url"
)
@ -60,7 +61,7 @@ type ListInstanceVariablesOptions ListOptions
func (s *InstanceVariablesService) ListVariables(opt *ListInstanceVariablesOptions, options ...RequestOptionFunc) ([]*InstanceVariable, *Response, error) {
u := "admin/ci/variables"
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -81,7 +82,7 @@ func (s *InstanceVariablesService) ListVariables(opt *ListInstanceVariablesOptio
func (s *InstanceVariablesService) GetVariable(key string, options ...RequestOptionFunc) (*InstanceVariable, *Response, error) {
u := fmt.Sprintf("admin/ci/variables/%s", url.PathEscape(key))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -115,7 +116,7 @@ type CreateInstanceVariableOptions struct {
func (s *InstanceVariablesService) CreateVariable(opt *CreateInstanceVariableOptions, options ...RequestOptionFunc) (*InstanceVariable, *Response, error) {
u := "admin/ci/variables"
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -149,7 +150,7 @@ type UpdateInstanceVariableOptions struct {
func (s *InstanceVariablesService) UpdateVariable(key string, opt *UpdateInstanceVariableOptions, options ...RequestOptionFunc) (*InstanceVariable, *Response, error) {
u := fmt.Sprintf("admin/ci/variables/%s", url.PathEscape(key))
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -170,7 +171,7 @@ func (s *InstanceVariablesService) UpdateVariable(key string, opt *UpdateInstanc
func (s *InstanceVariablesService) RemoveVariable(key string, options ...RequestOptionFunc) (*Response, error) {
u := fmt.Sprintf("admin/ci/variables/%s", url.PathEscape(key))
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

175
vendor/github.com/xanzy/go-gitlab/invites.go generated vendored Normal file
View file

@ -0,0 +1,175 @@
//
// Copyright 2021, 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/http"
"time"
)
// InvitesService handles communication with the invitation related
// methods of the GitLab API.
//
// GitLab API docs: https://docs.gitlab.com/ee/api/invitations.html
type InvitesService struct {
client *Client
}
// PendingInvite represents a pending invite.
//
// GitLab API docs: https://docs.gitlab.com/ee/api/invitations.html
type PendingInvite struct {
ID int `json:"id"`
InviteEmail string `json:"invite_email"`
CreatedAt *time.Time `json:"created_at"`
AccessLevel AccessLevelValue `json:"access_level"`
ExpiresAt *time.Time `json:"expires_at"`
UserName string `json:"user_name"`
CreatedByName string `json:"created_by_name"`
}
// ListPendingInvitationsOptions represents the available
// ListPendingInvitations() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/invitations.html#list-all-invitations-pending-for-a-group-or-project
type ListPendingInvitationsOptions struct {
ListOptions
Query *string `url:"query,omitempty" json:"query,omitempty"`
}
// ListPendingGroupInvitations gets a list of invited group members.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/invitations.html#list-all-invitations-pending-for-a-group-or-project
func (s *InvitesService) ListPendingGroupInvitations(gid interface{}, opt *ListPendingInvitationsOptions, options ...RequestOptionFunc) ([]*PendingInvite, *Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/invitations", pathEscape(group))
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
var pis []*PendingInvite
resp, err := s.client.Do(req, &pis)
if err != nil {
return nil, resp, err
}
return pis, resp, err
}
// ListPendingProjectInvitations gets a list of invited project members.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/invitations.html#list-all-invitations-pending-for-a-group-or-project
func (s *InvitesService) ListPendingProjectInvitations(pid interface{}, opt *ListPendingInvitationsOptions, options ...RequestOptionFunc) ([]*PendingInvite, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/invitations", pathEscape(project))
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
var pis []*PendingInvite
resp, err := s.client.Do(req, &pis)
if err != nil {
return nil, resp, err
}
return pis, resp, err
}
// InvitesOptions represents the available GroupInvites() and ProjectInvites()
// options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/invitations.html#invite-by-email-to-group-or-project
type InvitesOptions struct {
ID interface{} `url:"id,omitempty" json:"id,omitempty"`
Email *string `url:"email,omitempty" json:"email,omitempty"`
AccessLevel *AccessLevelValue `url:"access_level,omitempty" json:"access_level,omitempty"`
ExpiresAt *ISOTime `url:"expires_at,omitempty" json:"expires_at,omitempty"`
}
// InvitesResult represents an invitations result.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/invitations.html#invite-by-email-to-group-or-project
type InvitesResult struct {
Status string `json:"status"`
Message map[string]string `json:"message,omitempty"`
}
// GroupInvites invites new users by email to join a group.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/invitations.html#invite-by-email-to-group-or-project
func (s *InvitesService) GroupInvites(gid interface{}, opt *InvitesOptions, options ...RequestOptionFunc) (*InvitesResult, *Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/invitations", pathEscape(group))
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
ir := new(InvitesResult)
resp, err := s.client.Do(req, ir)
if err != nil {
return nil, resp, err
}
return ir, resp, err
}
// ProjectInvites invites new users by email to join a project.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/invitations.html#invite-by-email-to-group-or-project
func (s *InvitesService) ProjectInvites(pid interface{}, opt *InvitesOptions, options ...RequestOptionFunc) (*InvitesResult, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/invitations", pathEscape(project))
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
ir := new(InvitesResult)
resp, err := s.client.Do(req, ir)
if err != nil {
return nil, resp, err
}
return ir, resp, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Arkbriar
// Copyright 2021, Arkbriar
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
)
// IssueLinksService handles communication with the issue relations related methods
@ -51,7 +52,7 @@ func (s *IssueLinksService) ListIssueRelations(pid interface{}, issueIID int, op
}
u := fmt.Sprintf("projects/%s/issues/%d/links", pathEscape(project), issueIID)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -86,7 +87,7 @@ func (s *IssueLinksService) CreateIssueLink(pid interface{}, issueIID int, opt *
}
u := fmt.Sprintf("projects/%s/issues/%d/links", pathEscape(project), issueIID)
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -114,7 +115,7 @@ func (s *IssueLinksService) DeleteIssueLink(pid interface{}, issueIID, issueLink
issueIID,
issueLinkID)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Sander van Harmelen
// Copyright 2021, 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.
@ -20,6 +20,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"net/url"
"strings"
"time"
@ -232,7 +233,7 @@ type ListIssuesOptions struct {
//
// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-issues
func (s *IssuesService) ListIssues(opt *ListIssuesOptions, options ...RequestOptionFunc) ([]*Issue, *Response, error) {
req, err := s.client.NewRequest("GET", "issues", opt, options)
req, err := s.client.NewRequest(http.MethodGet, "issues", opt, options)
if err != nil {
return nil, nil, err
}
@ -288,7 +289,7 @@ func (s *IssuesService) ListGroupIssues(pid interface{}, opt *ListGroupIssuesOpt
}
u := fmt.Sprintf("groups/%s/issues", pathEscape(group))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -328,6 +329,7 @@ type ListProjectIssuesOptions struct {
In *string `url:"in,omitempty" json:"in,omitempty"`
CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
DueDate *string `url:"due_date,omitempty" json:"due_date,omitempty"`
UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"`
@ -344,7 +346,7 @@ func (s *IssuesService) ListProjectIssues(pid interface{}, opt *ListProjectIssue
}
u := fmt.Sprintf("projects/%s/issues", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -368,7 +370,7 @@ func (s *IssuesService) GetIssue(pid interface{}, issue int, options ...RequestO
}
u := fmt.Sprintf("projects/%s/issues/%d", pathEscape(project), issue)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -410,7 +412,7 @@ func (s *IssuesService) CreateIssue(pid interface{}, opt *CreateIssueOptions, op
}
u := fmt.Sprintf("projects/%s/issues", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -454,7 +456,7 @@ func (s *IssuesService) UpdateIssue(pid interface{}, issue int, opt *UpdateIssue
}
u := fmt.Sprintf("projects/%s/issues/%d", pathEscape(project), issue)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -478,7 +480,7 @@ func (s *IssuesService) DeleteIssue(pid interface{}, issue int, options ...Reque
}
u := fmt.Sprintf("projects/%s/issues/%d", pathEscape(project), issue)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -504,7 +506,7 @@ func (s *IssuesService) MoveIssue(pid interface{}, issue int, opt *MoveIssueOpti
}
u := fmt.Sprintf("projects/%s/issues/%d/move", pathEscape(project), issue)
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -531,7 +533,7 @@ func (s *IssuesService) SubscribeToIssue(pid interface{}, issue int, options ...
}
u := fmt.Sprintf("projects/%s/issues/%d/subscribe", pathEscape(project), issue)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -558,7 +560,7 @@ func (s *IssuesService) UnsubscribeFromIssue(pid interface{}, issue int, options
}
u := fmt.Sprintf("projects/%s/issues/%d/unsubscribe", pathEscape(project), issue)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -591,7 +593,7 @@ func (s *IssuesService) ListMergeRequestsClosingIssue(pid interface{}, issue int
}
u := fmt.Sprintf("/projects/%s/issues/%d/closed_by", pathEscape(project), issue)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -627,7 +629,7 @@ func (s *IssuesService) ListMergeRequestsRelatedToIssue(pid interface{}, issue i
issue,
)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -692,7 +694,7 @@ func (s *IssuesService) GetParticipants(pid interface{}, issue int, options ...R
}
u := fmt.Sprintf("projects/%s/issues/%d/participants", pathEscape(project), issue)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Sander van Harmelen
// Copyright 2021, 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.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"time"
)
@ -75,7 +76,7 @@ type GetIssuesStatisticsOptions struct {
// GitLab API docs:
// https://docs.gitlab.com/ee/api/issues_statistics.html#get-issues-statistics
func (s *IssuesStatisticsService) GetIssuesStatistics(opt *GetIssuesStatisticsOptions, options ...RequestOptionFunc) (*IssuesStatistics, *Response, error) {
req, err := s.client.NewRequest("GET", "issues_statistics", opt, options)
req, err := s.client.NewRequest(http.MethodGet, "issues_statistics", opt, options)
if err != nil {
return nil, nil, err
}
@ -97,7 +98,7 @@ func (s *IssuesStatisticsService) GetIssuesStatistics(opt *GetIssuesStatisticsOp
type GetGroupIssuesStatisticsOptions struct {
Labels Labels `url:"labels,omitempty" json:"labels,omitempty"`
IIDs []int `url:"iids,omitempty" json:"iids,omitempty"`
Milestone *Milestone `url:"milestone,omitempty" json:"milestone,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"`
AuthorUsername *string `url:"author_username,omitempty" json:"author_username,omitempty"`
@ -123,7 +124,7 @@ func (s *IssuesStatisticsService) GetGroupIssuesStatistics(gid interface{}, opt
}
u := fmt.Sprintf("groups/%s/issues_statistics", pathEscape(group))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -171,7 +172,7 @@ func (s *IssuesStatisticsService) GetProjectIssuesStatistics(pid interface{}, op
}
u := fmt.Sprintf("projects/%s/issues_statistics", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Arkbriar
// Copyright 2021, Arkbriar
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -19,6 +19,7 @@ package gitlab
import (
"bytes"
"fmt"
"net/http"
"time"
)
@ -118,7 +119,7 @@ func (s *JobsService) ListProjectJobs(pid interface{}, opts *ListJobsOptions, op
}
u := fmt.Sprintf("projects/%s/jobs", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opts, options)
req, err := s.client.NewRequest(http.MethodGet, u, opts, options)
if err != nil {
return nil, nil, err
}
@ -144,7 +145,7 @@ func (s *JobsService) ListPipelineJobs(pid interface{}, pipelineID int, opts *Li
}
u := fmt.Sprintf("projects/%s/pipelines/%d/jobs", pathEscape(project), pipelineID)
req, err := s.client.NewRequest("GET", u, opts, options)
req, err := s.client.NewRequest(http.MethodGet, u, opts, options)
if err != nil {
return nil, nil, err
}
@ -170,7 +171,7 @@ func (s *JobsService) ListPipelineBridges(pid interface{}, pipelineID int, opts
}
u := fmt.Sprintf("projects/%s/pipelines/%d/bridges", pathEscape(project), pipelineID)
req, err := s.client.NewRequest("GET", u, opts, options)
req, err := s.client.NewRequest(http.MethodGet, u, opts, options)
if err != nil {
return nil, nil, err
}
@ -195,7 +196,7 @@ func (s *JobsService) GetJob(pid interface{}, jobID int, options ...RequestOptio
}
u := fmt.Sprintf("projects/%s/jobs/%d", pathEscape(project), jobID)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -220,7 +221,7 @@ func (s *JobsService) GetJobArtifacts(pid interface{}, jobID int, options ...Req
}
u := fmt.Sprintf("projects/%s/jobs/%d/artifacts", pathEscape(project), jobID)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -255,7 +256,7 @@ func (s *JobsService) DownloadArtifactsFile(pid interface{}, refName string, opt
}
u := fmt.Sprintf("projects/%s/jobs/artifacts/%s/download", pathEscape(project), refName)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -289,7 +290,7 @@ func (s *JobsService) DownloadSingleArtifactsFile(pid interface{}, jobID int, ar
artifactPath,
)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -314,7 +315,7 @@ func (s *JobsService) GetTraceFile(pid interface{}, jobID int, options ...Reques
}
u := fmt.Sprintf("projects/%s/jobs/%d/trace", pathEscape(project), jobID)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -339,7 +340,7 @@ func (s *JobsService) CancelJob(pid interface{}, jobID int, options ...RequestOp
}
u := fmt.Sprintf("projects/%s/jobs/%d/cancel", pathEscape(project), jobID)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -364,7 +365,7 @@ func (s *JobsService) RetryJob(pid interface{}, jobID int, options ...RequestOpt
}
u := fmt.Sprintf("projects/%s/jobs/%d/retry", pathEscape(project), jobID)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -390,7 +391,7 @@ func (s *JobsService) EraseJob(pid interface{}, jobID int, options ...RequestOpt
}
u := fmt.Sprintf("projects/%s/jobs/%d/erase", pathEscape(project), jobID)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -416,7 +417,7 @@ func (s *JobsService) KeepArtifacts(pid interface{}, jobID int, options ...Reque
}
u := fmt.Sprintf("projects/%s/jobs/%d/artifacts/keep", pathEscape(project), jobID)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -441,7 +442,7 @@ func (s *JobsService) PlayJob(pid interface{}, jobID int, options ...RequestOpti
}
u := fmt.Sprintf("projects/%s/jobs/%d/play", pathEscape(project), jobID)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -466,7 +467,7 @@ func (s *JobsService) DeleteArtifacts(pid interface{}, jobID int, options ...Req
}
u := fmt.Sprintf("projects/%s/jobs/%d/artifacts", pathEscape(project), jobID)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2018, Patrick Webster
// Copyright 2021, Patrick Webster
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"time"
)
@ -50,7 +51,7 @@ type Key struct {
func (s *KeysService) GetKeyWithUser(key int, options ...RequestOptionFunc) (*Key, *Response, error) {
u := fmt.Sprintf("keys/%d", key)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Sander van Harmelen
// Copyright 2021, 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.
@ -19,6 +19,7 @@ package gitlab
import (
"encoding/json"
"fmt"
"net/http"
)
// LabelsService handles communication with the label related methods of the
@ -89,7 +90,7 @@ func (s *LabelsService) ListLabels(pid interface{}, opt *ListLabelsOptions, opti
}
u := fmt.Sprintf("projects/%s/labels", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -117,7 +118,7 @@ func (s *LabelsService) GetLabel(pid interface{}, labelID interface{}, options .
}
u := fmt.Sprintf("projects/%s/labels/%s", pathEscape(project), label)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -151,7 +152,7 @@ func (s *LabelsService) CreateLabel(pid interface{}, opt *CreateLabelOptions, op
}
u := fmt.Sprintf("projects/%s/labels", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -182,7 +183,7 @@ func (s *LabelsService) DeleteLabel(pid interface{}, opt *DeleteLabelOptions, op
}
u := fmt.Sprintf("projects/%s/labels", pathEscape(project))
req, err := s.client.NewRequest("DELETE", u, opt, options)
req, err := s.client.NewRequest(http.MethodDelete, u, opt, options)
if err != nil {
return nil, err
}
@ -211,7 +212,7 @@ func (s *LabelsService) UpdateLabel(pid interface{}, opt *UpdateLabelOptions, op
}
u := fmt.Sprintf("projects/%s/labels", pathEscape(project))
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -242,7 +243,7 @@ func (s *LabelsService) SubscribeToLabel(pid interface{}, labelID interface{}, o
}
u := fmt.Sprintf("projects/%s/labels/%s/subscribe", pathEscape(project), label)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -273,7 +274,7 @@ func (s *LabelsService) UnsubscribeFromLabel(pid interface{}, labelID interface{
}
u := fmt.Sprintf("projects/%s/labels/%s/unsubscribe", pathEscape(project), label)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, err
}
@ -296,7 +297,7 @@ func (s *LabelsService) PromoteLabel(pid interface{}, labelID interface{}, optio
}
u := fmt.Sprintf("projects/%s/labels/%s/promote", pathEscape(project), label)
req, err := s.client.NewRequest("PUT", u, nil, options)
req, err := s.client.NewRequest(http.MethodPut, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2018, Patrick Webster
// Copyright 2021, Patrick Webster
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -16,7 +16,10 @@
package gitlab
import "time"
import (
"net/http"
"time"
)
// LicenseService handles communication with the license
// related methods of the GitLab API.
@ -68,7 +71,7 @@ func (l License) String() string {
// GitLab API docs:
// https://docs.gitlab.com/ee/api/license.html#retrieve-information-about-the-current-license
func (s *LicenseService) GetLicense() (*License, *Response, error) {
req, err := s.client.NewRequest("GET", "license", nil, nil)
req, err := s.client.NewRequest(http.MethodGet, "license", nil, nil)
if err != nil {
return nil, nil, err
}
@ -94,7 +97,7 @@ type AddLicenseOptions struct {
// GitLab API docs:
// https://docs.gitlab.com/ee/api/license.html#add-a-new-license
func (s *LicenseService) AddLicense(opt *AddLicenseOptions, options ...RequestOptionFunc) (*License, *Response, error) {
req, err := s.client.NewRequest("POST", "license", opt, options)
req, err := s.client.NewRequest(http.MethodPost, "license", opt, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,7 +1,24 @@
//
// Copyright 2021, 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/http"
)
// LicenseTemplate represents a license template.
@ -45,7 +62,7 @@ type ListLicenseTemplatesOptions struct {
// GitLab API docs:
// https://docs.gitlab.com/ce/api/templates/licenses.html#list-license-templates
func (s *LicenseTemplatesService) ListLicenseTemplates(opt *ListLicenseTemplatesOptions, options ...RequestOptionFunc) ([]*LicenseTemplate, *Response, error) {
req, err := s.client.NewRequest("GET", "templates/licenses", opt, options)
req, err := s.client.NewRequest(http.MethodGet, "templates/licenses", opt, options)
if err != nil {
return nil, nil, err
}
@ -77,7 +94,7 @@ type GetLicenseTemplateOptions struct {
func (s *LicenseTemplatesService) GetLicenseTemplate(template string, opt *GetLicenseTemplateOptions, options ...RequestOptionFunc) (*LicenseTemplate, *Response, error) {
u := fmt.Sprintf("templates/licenses/%s", template)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,7 +1,24 @@
//
// Copyright 2021, 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/http"
"time"
)
@ -120,7 +137,7 @@ func (s *MergeRequestApprovalsService) ApproveMergeRequest(pid interface{}, mr i
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/approve", pathEscape(project), mr)
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -145,7 +162,7 @@ func (s *MergeRequestApprovalsService) UnapproveMergeRequest(pid interface{}, mr
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/unapprove", pathEscape(project), mr)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, err
}
@ -173,7 +190,7 @@ func (s *MergeRequestApprovalsService) GetConfiguration(pid interface{}, mr int,
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/approvals", pathEscape(project), mr)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -198,7 +215,7 @@ func (s *MergeRequestApprovalsService) ChangeApprovalConfiguration(pid interface
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/approvals", pathEscape(project), mergeRequest)
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -233,7 +250,7 @@ func (s *MergeRequestApprovalsService) ChangeAllowedApprovers(pid interface{}, m
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/approvers", pathEscape(project), mergeRequest)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -258,7 +275,7 @@ func (s *MergeRequestApprovalsService) GetApprovalRules(pid interface{}, mergeRe
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/approval_rules", pathEscape(project), mergeRequest)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -283,7 +300,7 @@ func (s *MergeRequestApprovalsService) GetApprovalState(pid interface{}, mergeRe
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/approval_state", pathEscape(project), mergeRequest)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -321,7 +338,7 @@ func (s *MergeRequestApprovalsService) CreateApprovalRule(pid interface{}, merge
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/approval_rules", pathEscape(project), mergeRequest)
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -358,7 +375,7 @@ func (s *MergeRequestApprovalsService) UpdateApprovalRule(pid interface{}, merge
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/approval_rules/%d", pathEscape(project), mergeRequest, approvalRule)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -383,7 +400,7 @@ func (s *MergeRequestApprovalsService) DeleteApprovalRule(pid interface{}, merge
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/approval_rules/%d", pathEscape(project), mergeRequest, approvalRule)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Sander van Harmelen
// Copyright 2021, 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.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"time"
)
@ -48,6 +49,7 @@ type MergeRequest struct {
Author *BasicUser `json:"author"`
Assignee *BasicUser `json:"assignee"`
Assignees []*BasicUser `json:"assignees"`
Reviewers []*BasicUser `json:"reviewers"`
SourceProjectID int `json:"source_project_id"`
TargetProjectID int `json:"target_project_id"`
Labels Labels `json:"labels"`
@ -69,6 +71,7 @@ type MergeRequest struct {
ChangesCount string `json:"changes_count"`
ShouldRemoveSourceBranch bool `json:"should_remove_source_branch"`
ForceRemoveSourceBranch bool `json:"force_remove_source_branch"`
AllowCollaboration bool `json:"allow_collaboration"`
WebURL string `json:"web_url"`
DiscussionLocked bool `json:"discussion_locked"`
Changes []struct {
@ -101,7 +104,9 @@ type MergeRequest struct {
Count int `json:"count"`
CompletedCount int `json:"completed_count"`
} `json:"task_completion_status"`
HasConflicts bool `json:"has_conflicts"`
HasConflicts bool `json:"has_conflicts"`
BlockingDiscussionsResolved bool `json:"blocking_discussions_resolved"`
Overflow bool `json:"overflow"`
}
func (m MergeRequest) String() string {
@ -152,6 +157,8 @@ type ListMergeRequestsOptions struct {
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"`
ReviewerID *int `url:"reviewer_id,omitempty" json:"reviewer_id,omitempty"`
ReviewerUsername *string `url:"reviewer_username,omitempty" json:"reviewer_username,omitempty"`
MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
SourceBranch *string `url:"source_branch,omitempty" json:"source_branch,omitempty"`
TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
@ -168,7 +175,7 @@ type ListMergeRequestsOptions struct {
// GitLab API docs:
// https://docs.gitlab.com/ce/api/merge_requests.html#list-merge-requests
func (s *MergeRequestsService) ListMergeRequests(opt *ListMergeRequestsOptions, options ...RequestOptionFunc) ([]*MergeRequest, *Response, error) {
req, err := s.client.NewRequest("GET", "merge_requests", opt, options)
req, err := s.client.NewRequest(http.MethodGet, "merge_requests", opt, options)
if err != nil {
return nil, nil, err
}
@ -205,6 +212,8 @@ type ListGroupMergeRequestsOptions struct {
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"`
ReviewerID *int `url:"reviewer_id,omitempty" json:"reviewer_id,omitempty"`
ReviewerUsername *string `url:"reviewer_username,omitempty" json:"reviewer_username,omitempty"`
MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
SourceBranch *string `url:"source_branch,omitempty" json:"source_branch,omitempty"`
TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
@ -222,7 +231,7 @@ func (s *MergeRequestsService) ListGroupMergeRequests(gid interface{}, opt *List
}
u := fmt.Sprintf("groups/%s/merge_requests", pathEscape(group))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -260,6 +269,8 @@ type ListProjectMergeRequestsOptions struct {
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"`
ReviewerID *int `url:"reviewer_id,omitempty" json:"reviewer_id,omitempty"`
ReviewerUsername *string `url:"reviewer_username,omitempty" json:"reviewer_username,omitempty"`
MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
SourceBranch *string `url:"source_branch,omitempty" json:"source_branch,omitempty"`
TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
@ -278,7 +289,7 @@ func (s *MergeRequestsService) ListProjectMergeRequests(pid interface{}, opt *Li
}
u := fmt.Sprintf("projects/%s/merge_requests", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -314,7 +325,7 @@ func (s *MergeRequestsService) GetMergeRequest(pid interface{}, mergeRequest int
}
u := fmt.Sprintf("projects/%s/merge_requests/%d", pathEscape(project), mergeRequest)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -339,7 +350,7 @@ func (s *MergeRequestsService) GetMergeRequestApprovals(pid interface{}, mergeRe
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/approvals", pathEscape(project), mergeRequest)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -371,7 +382,7 @@ func (s *MergeRequestsService) GetMergeRequestCommits(pid interface{}, mergeRequ
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/commits", pathEscape(project), mergeRequest)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -385,19 +396,28 @@ func (s *MergeRequestsService) GetMergeRequestCommits(pid interface{}, mergeRequ
return c, resp, err
}
// GetMergeRequestChangesOptions represents the available GetMergeRequestChanges()
// options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/merge_requests.html#get-single-mr-changes
type GetMergeRequestChangesOptions struct {
AccessRawDiffs *bool `url:"access_raw_diffs,omitempty" json:"access_raw_diffs,omitempty"`
}
// 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 ...RequestOptionFunc) (*MergeRequest, *Response, error) {
func (s *MergeRequestsService) GetMergeRequestChanges(pid interface{}, mergeRequest int, opt *GetMergeRequestChangesOptions, options ...RequestOptionFunc) (*MergeRequest, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/changes", pathEscape(project), mergeRequest)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -422,7 +442,7 @@ func (s *MergeRequestsService) GetMergeRequestParticipants(pid interface{}, merg
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/participants", pathEscape(project), mergeRequest)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -447,7 +467,7 @@ func (s *MergeRequestsService) ListMergeRequestPipelines(pid interface{}, mergeR
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/pipelines", pathEscape(project), mergeRequest)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -472,7 +492,7 @@ func (s *MergeRequestsService) CreateMergeRequestPipeline(pid interface{}, merge
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/pipelines", pathEscape(project), mergeRequest)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -505,7 +525,7 @@ func (s *MergeRequestsService) GetIssuesClosedOnMerge(pid interface{}, mergeRequ
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/closes_issues", pathEscape(project), mergeRequest)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -532,6 +552,7 @@ type CreateMergeRequestOptions struct {
Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
AssigneeIDs []int `url:"assignee_ids,omitempty" json:"assignee_ids,omitempty"`
ReviewerIDs []int `url:"reviewer_ids,omitempty" json:"reviewer_ids,omitempty"`
TargetProjectID *int `url:"target_project_id,omitempty" json:"target_project_id,omitempty"`
MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"`
RemoveSourceBranch *bool `url:"remove_source_branch,omitempty" json:"remove_source_branch,omitempty"`
@ -550,7 +571,7 @@ func (s *MergeRequestsService) CreateMergeRequest(pid interface{}, opt *CreateMe
}
u := fmt.Sprintf("projects/%s/merge_requests", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -575,6 +596,7 @@ type UpdateMergeRequestOptions struct {
TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
AssigneeIDs []int `url:"assignee_ids,omitempty" json:"assignee_ids,omitempty"`
ReviewerIDs []int `url:"reviewer_ids,omitempty" json:"reviewer_ids,omitempty"`
Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
AddLabels Labels `url:"add_labels,comma,omitempty" json:"add_labels,omitempty"`
RemoveLabels Labels `url:"remove_labels,comma,omitempty" json:"remove_labels,omitempty"`
@ -597,7 +619,7 @@ func (s *MergeRequestsService) UpdateMergeRequest(pid interface{}, mergeRequest
}
u := fmt.Sprintf("projects/%s/merge_requests/%d", pathEscape(project), mergeRequest)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -622,7 +644,7 @@ func (s *MergeRequestsService) DeleteMergeRequest(pid interface{}, mergeRequest
}
u := fmt.Sprintf("projects/%s/merge_requests/%d", pathEscape(project), mergeRequest)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -658,7 +680,7 @@ func (s *MergeRequestsService) AcceptMergeRequest(pid interface{}, mergeRequest
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/merge", pathEscape(project), mergeRequest)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -687,7 +709,7 @@ func (s *MergeRequestsService) CancelMergeWhenPipelineSucceeds(pid interface{},
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/cancel_merge_when_pipeline_succeeds", pathEscape(project), mergeRequest)
req, err := s.client.NewRequest("PUT", u, nil, options)
req, err := s.client.NewRequest(http.MethodPut, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -714,7 +736,7 @@ func (s *MergeRequestsService) RebaseMergeRequest(pid interface{}, mergeRequest
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/rebase", pathEscape(project), mergeRequest)
req, err := s.client.NewRequest("PUT", u, nil, options)
req, err := s.client.NewRequest(http.MethodPut, u, nil, options)
if err != nil {
return nil, err
}
@ -740,7 +762,7 @@ func (s *MergeRequestsService) GetMergeRequestDiffVersions(pid interface{}, merg
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/versions", pathEscape(project), mergeRequest)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -765,7 +787,7 @@ func (s *MergeRequestsService) GetSingleMergeRequestDiffVersion(pid interface{},
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/versions/%d", pathEscape(project), mergeRequest, version)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -792,7 +814,7 @@ func (s *MergeRequestsService) SubscribeToMergeRequest(pid interface{}, mergeReq
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/subscribe", pathEscape(project), mergeRequest)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -820,7 +842,7 @@ func (s *MergeRequestsService) UnsubscribeFromMergeRequest(pid interface{}, merg
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/unsubscribe", pathEscape(project), mergeRequest)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -847,7 +869,7 @@ func (s *MergeRequestsService) CreateTodo(pid interface{}, mergeRequest int, opt
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/todo", pathEscape(project), mergeRequest)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Sander van Harmelen
// Copyright 2021, 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.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"time"
)
@ -74,7 +75,7 @@ func (s *MilestonesService) ListMilestones(pid interface{}, opt *ListMilestonesO
}
u := fmt.Sprintf("projects/%s/milestones", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -99,7 +100,7 @@ func (s *MilestonesService) GetMilestone(pid interface{}, milestone int, options
}
u := fmt.Sprintf("projects/%s/milestones/%d", pathEscape(project), milestone)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -135,7 +136,7 @@ func (s *MilestonesService) CreateMilestone(pid interface{}, opt *CreateMileston
}
u := fmt.Sprintf("projects/%s/milestones", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -172,7 +173,7 @@ func (s *MilestonesService) UpdateMilestone(pid interface{}, milestone int, opt
}
u := fmt.Sprintf("projects/%s/milestones/%d", pathEscape(project), milestone)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -197,7 +198,7 @@ func (s *MilestonesService) DeleteMilestone(pid interface{}, milestone int, opti
}
u := fmt.Sprintf("projects/%s/milestones/%d", pathEscape(project), milestone)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -221,7 +222,7 @@ func (s *MilestonesService) GetMilestoneIssues(pid interface{}, milestone int, o
}
u := fmt.Sprintf("projects/%s/milestones/%d/issues", pathEscape(project), milestone)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -254,7 +255,7 @@ func (s *MilestonesService) GetMilestoneMergeRequests(pid interface{}, milestone
}
u := fmt.Sprintf("projects/%s/milestones/%d/merge_requests", pathEscape(project), milestone)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Sander van Harmelen
// Copyright 2021, 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.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
)
// NamespacesService handles communication with the namespace related methods
@ -57,7 +58,7 @@ type ListNamespacesOptions struct {
//
// GitLab API docs: https://docs.gitlab.com/ce/api/namespaces.html#list-namespaces
func (s *NamespacesService) ListNamespaces(opt *ListNamespacesOptions, options ...RequestOptionFunc) ([]*Namespace, *Response, error) {
req, err := s.client.NewRequest("GET", "namespaces", opt, options)
req, err := s.client.NewRequest(http.MethodGet, "namespaces", opt, options)
if err != nil {
return nil, nil, err
}
@ -82,7 +83,7 @@ func (s *NamespacesService) SearchNamespace(query string, options ...RequestOpti
}
q.Search = query
req, err := s.client.NewRequest("GET", "namespaces", &q, options)
req, err := s.client.NewRequest(http.MethodGet, "namespaces", &q, options)
if err != nil {
return nil, nil, err
}
@ -107,7 +108,7 @@ func (s *NamespacesService) GetNamespace(id interface{}, options ...RequestOptio
}
u := fmt.Sprintf("namespaces/%s", namespace)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Sander van Harmelen
// Copyright 2021, 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.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"time"
)
@ -120,7 +121,7 @@ func (s *NotesService) ListIssueNotes(pid interface{}, issue int, opt *ListIssue
}
u := fmt.Sprintf("projects/%s/issues/%d/notes", pathEscape(project), issue)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -145,7 +146,7 @@ func (s *NotesService) GetIssueNote(pid interface{}, issue, note int, options ..
}
u := fmt.Sprintf("projects/%s/issues/%d/notes/%d", pathEscape(project), issue, note)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -180,7 +181,7 @@ func (s *NotesService) CreateIssueNote(pid interface{}, issue int, opt *CreateIs
}
u := fmt.Sprintf("projects/%s/issues/%d/notes", pathEscape(project), issue)
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -214,7 +215,7 @@ func (s *NotesService) UpdateIssueNote(pid interface{}, issue, note int, opt *Up
}
u := fmt.Sprintf("projects/%s/issues/%d/notes/%d", pathEscape(project), issue, note)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -239,7 +240,7 @@ func (s *NotesService) DeleteIssueNote(pid interface{}, issue, note int, options
}
u := fmt.Sprintf("projects/%s/issues/%d/notes/%d", pathEscape(project), issue, note)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -269,7 +270,7 @@ func (s *NotesService) ListSnippetNotes(pid interface{}, snippet int, opt *ListS
}
u := fmt.Sprintf("projects/%s/snippets/%d/notes", pathEscape(project), snippet)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -294,7 +295,7 @@ func (s *NotesService) GetSnippetNote(pid interface{}, snippet, note int, option
}
u := fmt.Sprintf("projects/%s/snippets/%d/notes/%d", pathEscape(project), snippet, note)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -329,7 +330,7 @@ func (s *NotesService) CreateSnippetNote(pid interface{}, snippet int, opt *Crea
}
u := fmt.Sprintf("projects/%s/snippets/%d/notes", pathEscape(project), snippet)
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -363,7 +364,7 @@ func (s *NotesService) UpdateSnippetNote(pid interface{}, snippet, note int, opt
}
u := fmt.Sprintf("projects/%s/snippets/%d/notes/%d", pathEscape(project), snippet, note)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -388,7 +389,7 @@ func (s *NotesService) DeleteSnippetNote(pid interface{}, snippet, note int, opt
}
u := fmt.Sprintf("projects/%s/snippets/%d/notes/%d", pathEscape(project), snippet, note)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -418,7 +419,7 @@ func (s *NotesService) ListMergeRequestNotes(pid interface{}, mergeRequest int,
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/notes", pathEscape(project), mergeRequest)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -443,7 +444,7 @@ func (s *NotesService) GetMergeRequestNote(pid interface{}, mergeRequest, note i
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/notes/%d", pathEscape(project), mergeRequest, note)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -477,7 +478,7 @@ func (s *NotesService) CreateMergeRequestNote(pid interface{}, mergeRequest int,
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/notes", pathEscape(project), mergeRequest)
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -511,7 +512,7 @@ func (s *NotesService) UpdateMergeRequestNote(pid interface{}, mergeRequest, not
}
u := fmt.Sprintf(
"projects/%s/merge_requests/%d/notes/%d", pathEscape(project), mergeRequest, note)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -537,7 +538,7 @@ func (s *NotesService) DeleteMergeRequestNote(pid interface{}, mergeRequest, not
u := fmt.Sprintf(
"projects/%s/merge_requests/%d/notes/%d", pathEscape(project), mergeRequest, note)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -566,7 +567,7 @@ func (s *NotesService) ListEpicNotes(gid interface{}, epic int, opt *ListEpicNot
}
u := fmt.Sprintf("groups/%s/epics/%d/notes", pathEscape(group), epic)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -591,7 +592,7 @@ func (s *NotesService) GetEpicNote(gid interface{}, epic, note int, options ...R
}
u := fmt.Sprintf("groups/%s/epics/%d/notes/%d", pathEscape(group), epic, note)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -624,7 +625,7 @@ func (s *NotesService) CreateEpicNote(gid interface{}, epic int, opt *CreateEpic
}
u := fmt.Sprintf("groups/%s/epics/%d/notes", pathEscape(group), epic)
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -656,7 +657,7 @@ func (s *NotesService) UpdateEpicNote(gid interface{}, epic, note int, opt *Upda
}
u := fmt.Sprintf("groups/%s/epics/%d/notes/%d", pathEscape(group), epic, note)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -680,7 +681,7 @@ func (s *NotesService) DeleteEpicNote(gid interface{}, epic, note int, options .
}
u := fmt.Sprintf("groups/%s/epics/%d/notes/%d", pathEscape(group), epic, note)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,8 +1,25 @@
//
// Copyright 2021, 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 (
"errors"
"fmt"
"net/http"
)
// NotificationSettingsService handles communication with the notification settings
@ -53,7 +70,7 @@ func (ns NotificationSettings) String() string {
func (s *NotificationSettingsService) GetGlobalSettings(options ...RequestOptionFunc) (*NotificationSettings, *Response, error) {
u := "notification_settings"
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -98,7 +115,7 @@ func (s *NotificationSettingsService) UpdateGlobalSettings(opt *NotificationSett
u := "notification_settings"
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -123,7 +140,7 @@ func (s *NotificationSettingsService) GetSettingsForGroup(gid interface{}, optio
}
u := fmt.Sprintf("groups/%s/notification_settings", pathEscape(group))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -148,7 +165,7 @@ func (s *NotificationSettingsService) GetSettingsForProject(pid interface{}, opt
}
u := fmt.Sprintf("projects/%s/notification_settings", pathEscape(project))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -173,7 +190,7 @@ func (s *NotificationSettingsService) UpdateSettingsForGroup(gid interface{}, op
}
u := fmt.Sprintf("groups/%s/notification_settings", pathEscape(group))
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -198,7 +215,7 @@ func (s *NotificationSettingsService) UpdateSettingsForProject(pid interface{},
}
u := fmt.Sprintf("projects/%s/notification_settings", pathEscape(project))
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}

168
vendor/github.com/xanzy/go-gitlab/packages.go generated vendored Normal file
View file

@ -0,0 +1,168 @@
//
// Copyright 2021, Kordian Bruck
//
// 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/http"
"time"
)
// PackagesService handles communication with the packages related methods
// of the GitLab API.
//
// GitLab API docs: https://docs.gitlab.com/ee/api/packages.html
type PackagesService struct {
client *Client
}
// Package represents a GitLab single package.
//
// GitLab API docs: https://docs.gitlab.com/ee/api/packages.html
type Package struct {
ID int `json:"id"`
Name string `json:"name"`
Version string `json:"version"`
PackageType string `json:"package_type"`
Links *PackageLinks `json:"_links"`
CreatedAt *time.Time `json:"created_at"`
}
func (s Package) String() string {
return Stringify(s)
}
// PackageLinks holds links for itself and deleting.
type PackageLinks struct {
WebPath string `json:"web_path"`
DeleteAPIPath string `json:"delete_api_path"`
}
func (s PackageLinks) String() string {
return Stringify(s)
}
// PackageFile represents one file contained within a package.
//
// GitLab API docs: https://docs.gitlab.com/ee/api/packages.html
type PackageFile struct {
ID int `json:"id"`
PackageID int `json:"package_id"`
CreatedAt *time.Time `json:"created_at"`
FileName string `json:"file_name"`
Size int `json:"size"`
FileMD5 string `json:"file_md5"`
FileSHA1 string `json:"file_sha1"`
Pipeline *[]Pipeline `json:"pipelines"`
}
func (s PackageFile) String() string {
return Stringify(s)
}
// ListProjectPackagesOptions are the parameters available in a ListProjectPackages() Operation.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/packages.html#within-a-project
type ListProjectPackagesOptions struct {
ListOptions
OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
PackageType *string `url:"package_type,omitempty" json:"package_type,omitempty"`
PackageName *string `url:"package_name,omitempty" json:"package_name,omitempty"`
IncludeVersionless *bool `url:"include_versionless,omitempty" json:"include_versionless,omitempty"`
}
// ListProjectPackages gets a list of packages in a project.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/packages.html#within-a-project
func (s *PackagesService) ListProjectPackages(pid interface{}, opt *ListProjectPackagesOptions, options ...RequestOptionFunc) ([]*Package, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/packages", pathEscape(project))
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
var ps []*Package
resp, err := s.client.Do(req, &ps)
if err != nil {
return nil, resp, err
}
return ps, resp, err
}
// ListPackageFilesOptions represents the available
// ListPackageFiles() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/packages.html#list-package-files
type ListPackageFilesOptions ListOptions
// ListPackageFiles gets a list of files that are within a package
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/packages.html#list-package-files
func (s *PackagesService) ListPackageFiles(pid interface{}, pkg int, opt *ListPackageFilesOptions, options ...RequestOptionFunc) ([]*PackageFile, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf(
"projects/%s/packages/%d/package_files",
pathEscape(project),
pkg,
)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
var pfs []*PackageFile
resp, err := s.client.Do(req, &pfs)
if err != nil {
return nil, resp, err
}
return pfs, resp, err
}
// DeleteProjectPackage deletes a package in a project.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/packages.html#delete-a-project-package
func (s *PackagesService) DeleteProjectPackage(pid interface{}, pkg int, options ...RequestOptionFunc) (*Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, err
}
u := fmt.Sprintf("projects/%s/packages/%d", pathEscape(project), pkg)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
return s.client.Do(req, nil)
}

View file

@ -1,7 +1,24 @@
//
// Copyright 2021, 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/http"
"time"
)
@ -47,7 +64,7 @@ func (s *PagesDomainsService) ListPagesDomains(pid interface{}, opt *ListPagesDo
}
u := fmt.Sprintf("projects/%s/pages/domains", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -66,7 +83,7 @@ func (s *PagesDomainsService) ListPagesDomains(pid interface{}, opt *ListPagesDo
// GitLab API docs:
// https://docs.gitlab.com/ce/api/pages_domains.html#list-all-pages-domains
func (s *PagesDomainsService) ListAllPagesDomains(options ...RequestOptionFunc) ([]*PagesDomain, *Response, error) {
req, err := s.client.NewRequest("GET", "pages/domains", nil, options)
req, err := s.client.NewRequest(http.MethodGet, "pages/domains", nil, options)
if err != nil {
return nil, nil, err
}
@ -91,7 +108,7 @@ func (s *PagesDomainsService) GetPagesDomain(pid interface{}, domain string, opt
}
u := fmt.Sprintf("projects/%s/pages/domains/%s", pathEscape(project), domain)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -127,7 +144,7 @@ func (s *PagesDomainsService) CreatePagesDomain(pid interface{}, opt *CreatePage
}
u := fmt.Sprintf("projects/%s/pages/domains", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -162,7 +179,7 @@ func (s *PagesDomainsService) UpdatePagesDomain(pid interface{}, domain string,
}
u := fmt.Sprintf("projects/%s/pages/domains/%s", pathEscape(project), domain)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -187,7 +204,7 @@ func (s *PagesDomainsService) DeletePagesDomain(pid interface{}, domain string,
}
u := fmt.Sprintf("projects/%s/pages/domains/%s", pathEscape(project), domain)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2018, Sander van Harmelen
// Copyright 2021, 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.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"time"
)
@ -70,7 +71,7 @@ func (s *PipelineSchedulesService) ListPipelineSchedules(pid interface{}, opt *L
}
u := fmt.Sprintf("projects/%s/pipeline_schedules", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -95,7 +96,7 @@ func (s *PipelineSchedulesService) GetPipelineSchedule(pid interface{}, schedule
}
u := fmt.Sprintf("projects/%s/pipeline_schedules/%d", pathEscape(project), schedule)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -133,7 +134,7 @@ func (s *PipelineSchedulesService) CreatePipelineSchedule(pid interface{}, opt *
}
u := fmt.Sprintf("projects/%s/pipeline_schedules", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -171,7 +172,7 @@ func (s *PipelineSchedulesService) EditPipelineSchedule(pid interface{}, schedul
}
u := fmt.Sprintf("projects/%s/pipeline_schedules/%d", pathEscape(project), schedule)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -197,7 +198,7 @@ func (s *PipelineSchedulesService) TakeOwnershipOfPipelineSchedule(pid interface
}
u := fmt.Sprintf("projects/%s/pipeline_schedules/%d/take_ownership", pathEscape(project), schedule)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -222,7 +223,7 @@ func (s *PipelineSchedulesService) DeletePipelineSchedule(pid interface{}, sched
}
u := fmt.Sprintf("projects/%s/pipeline_schedules/%d", pathEscape(project), schedule)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -241,7 +242,7 @@ func (s *PipelineSchedulesService) RunPipelineSchedule(pid interface{}, schedule
}
u := fmt.Sprintf("projects/%s/pipeline_schedules/%d/play", pathEscape(project), schedule)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, err
}
@ -271,7 +272,7 @@ func (s *PipelineSchedulesService) CreatePipelineScheduleVariable(pid interface{
}
u := fmt.Sprintf("projects/%s/pipeline_schedules/%d/variables", pathEscape(project), schedule)
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -306,7 +307,7 @@ func (s *PipelineSchedulesService) EditPipelineScheduleVariable(pid interface{},
}
u := fmt.Sprintf("projects/%s/pipeline_schedules/%d/variables/%s", pathEscape(project), schedule, key)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -331,7 +332,7 @@ func (s *PipelineSchedulesService) DeletePipelineScheduleVariable(pid interface{
}
u := fmt.Sprintf("projects/%s/pipeline_schedules/%d/variables/%s", pathEscape(project), schedule, key)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,7 +1,24 @@
//
// Copyright 2021, 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/http"
"time"
)
@ -45,7 +62,7 @@ func (s *PipelineTriggersService) ListPipelineTriggers(pid interface{}, opt *Lis
}
u := fmt.Sprintf("projects/%s/triggers", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -70,7 +87,7 @@ func (s *PipelineTriggersService) GetPipelineTrigger(pid interface{}, trigger in
}
u := fmt.Sprintf("projects/%s/triggers/%d", pathEscape(project), trigger)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -103,7 +120,7 @@ func (s *PipelineTriggersService) AddPipelineTrigger(pid interface{}, opt *AddPi
}
u := fmt.Sprintf("projects/%s/triggers", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -136,7 +153,7 @@ func (s *PipelineTriggersService) EditPipelineTrigger(pid interface{}, trigger i
}
u := fmt.Sprintf("projects/%s/triggers/%d", pathEscape(project), trigger)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -162,7 +179,7 @@ func (s *PipelineTriggersService) TakeOwnershipOfPipelineTrigger(pid interface{}
}
u := fmt.Sprintf("projects/%s/triggers/%d/take_ownership", pathEscape(project), trigger)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -187,7 +204,7 @@ func (s *PipelineTriggersService) DeletePipelineTrigger(pid interface{}, trigger
}
u := fmt.Sprintf("projects/%s/triggers/%d", pathEscape(project), trigger)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -216,7 +233,7 @@ func (s *PipelineTriggersService) RunPipelineTrigger(pid interface{}, opt *RunPi
}
u := fmt.Sprintf("projects/%s/trigger/pipeline", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Igor Varavko
// Copyright 2021, Igor Varavko
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"time"
)
@ -170,7 +171,7 @@ func (s *PipelinesService) ListProjectPipelines(pid interface{}, opt *ListProjec
}
u := fmt.Sprintf("projects/%s/pipelines", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -194,7 +195,7 @@ func (s *PipelinesService) GetPipeline(pid interface{}, pipeline int, options ..
}
u := fmt.Sprintf("projects/%s/pipelines/%d", pathEscape(project), pipeline)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -218,7 +219,7 @@ func (s *PipelinesService) GetPipelineVariables(pid interface{}, pipeline int, o
}
u := fmt.Sprintf("projects/%s/pipelines/%d/variables", pathEscape(project), pipeline)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -242,7 +243,7 @@ func (s *PipelinesService) GetPipelineTestReport(pid interface{}, pipeline int)
}
u := fmt.Sprintf("projects/%s/pipelines/%d/test_report", pathEscape(project), pipeline)
req, err := s.client.NewRequest("GET", u, nil, nil)
req, err := s.client.NewRequest(http.MethodGet, u, nil, nil)
if err != nil {
return nil, nil, err
}
@ -274,7 +275,7 @@ func (s *PipelinesService) CreatePipeline(pid interface{}, opt *CreatePipelineOp
}
u := fmt.Sprintf("projects/%s/pipeline", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -299,7 +300,7 @@ func (s *PipelinesService) RetryPipelineBuild(pid interface{}, pipeline int, opt
}
u := fmt.Sprintf("projects/%s/pipelines/%d/retry", pathEscape(project), pipeline)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -324,7 +325,7 @@ func (s *PipelinesService) CancelPipelineBuild(pid interface{}, pipeline int, op
}
u := fmt.Sprintf("projects/%s/pipelines/%d/cancel", pathEscape(project), pipeline)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -349,7 +350,7 @@ func (s *PipelinesService) DeletePipeline(pid interface{}, pipeline int, options
}
u := fmt.Sprintf("projects/%s/pipelines/%d", pathEscape(project), pipeline)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,7 +1,24 @@
//
// Copyright 2021, 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/http"
)
// ProjectBadge represents a project badge.
@ -44,7 +61,7 @@ func (s *ProjectBadgesService) ListProjectBadges(pid interface{}, opt *ListProje
}
u := fmt.Sprintf("projects/%s/badges", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -69,7 +86,7 @@ func (s *ProjectBadgesService) GetProjectBadge(pid interface{}, badge int, optio
}
u := fmt.Sprintf("projects/%s/badges/%d", pathEscape(project), badge)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -103,7 +120,7 @@ func (s *ProjectBadgesService) AddProjectBadge(pid interface{}, opt *AddProjectB
}
u := fmt.Sprintf("projects/%s/badges", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -137,7 +154,7 @@ func (s *ProjectBadgesService) EditProjectBadge(pid interface{}, badge int, opt
}
u := fmt.Sprintf("projects/%s/badges/%d", pathEscape(project), badge)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -163,7 +180,7 @@ func (s *ProjectBadgesService) DeleteProjectBadge(pid interface{}, badge int, op
}
u := fmt.Sprintf("projects/%s/badges/%d", pathEscape(project), badge)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -192,7 +209,7 @@ func (s *ProjectBadgesService) PreviewProjectBadge(pid interface{}, opt *Project
}
u := fmt.Sprintf("projects/%s/badges/render", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2019, Matej Velikonja
// Copyright 2021, Matej Velikonja
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"time"
)
@ -83,7 +84,7 @@ func (s *ProjectClustersService) ListClusters(pid interface{}, options ...Reques
}
u := fmt.Sprintf("projects/%s/clusters", pathEscape(project))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -108,7 +109,7 @@ func (s *ProjectClustersService) GetCluster(pid interface{}, cluster int, option
}
u := fmt.Sprintf("projects/%s/clusters/%d", pathEscape(project), cluster)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -156,7 +157,7 @@ func (s *ProjectClustersService) AddCluster(pid interface{}, opt *AddClusterOpti
}
u := fmt.Sprintf("projects/%s/clusters/user", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -201,7 +202,7 @@ func (s *ProjectClustersService) EditCluster(pid interface{}, cluster int, opt *
}
u := fmt.Sprintf("projects/%s/clusters/%d", pathEscape(project), cluster)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -226,7 +227,7 @@ func (s *ProjectClustersService) DeleteCluster(pid interface{}, cluster int, opt
}
u := fmt.Sprintf("projects/%s/clusters/%d", pathEscape(project), cluster)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,8 +1,25 @@
//
// Copyright 2021, 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"
"fmt"
"net/http"
"time"
)
@ -81,7 +98,7 @@ func (s *ProjectImportExportService) ScheduleExport(pid interface{}, opt *Schedu
}
u := fmt.Sprintf("projects/%s/export", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, err
}
@ -100,7 +117,7 @@ func (s *ProjectImportExportService) ExportStatus(pid interface{}, options ...Re
}
u := fmt.Sprintf("projects/%s/export", pathEscape(project))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -125,7 +142,7 @@ func (s *ProjectImportExportService) ExportDownload(pid interface{}, options ...
}
u := fmt.Sprintf("projects/%s/export/download", pathEscape(project))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -156,7 +173,7 @@ type ImportFileOptions struct {
// GitLab API docs:
// https://docs.gitlab.com/ce/api/project_import_export.html#import-a-file
func (s *ProjectImportExportService) ImportFile(opt *ImportFileOptions, options ...RequestOptionFunc) (*ImportStatus, *Response, error) {
req, err := s.client.NewRequest("POST", "projects/import", opt, options)
req, err := s.client.NewRequest(http.MethodPost, "projects/import", opt, options)
if err != nil {
return nil, nil, err
}
@ -181,7 +198,7 @@ func (s *ProjectImportExportService) ImportStatus(pid interface{}, options ...Re
}
u := fmt.Sprintf("projects/%s/import", pathEscape(project))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Sander van Harmelen
// Copyright 2021, 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.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
)
// ProjectMembersService handles communication with the project members
@ -51,7 +52,7 @@ func (s *ProjectMembersService) ListProjectMembers(pid interface{}, opt *ListPro
}
u := fmt.Sprintf("projects/%s/members", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -78,7 +79,7 @@ func (s *ProjectMembersService) ListAllProjectMembers(pid interface{}, opt *List
}
u := fmt.Sprintf("projects/%s/members/all", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -103,7 +104,7 @@ func (s *ProjectMembersService) GetProjectMember(pid interface{}, user int, opti
}
u := fmt.Sprintf("projects/%s/members/%d", pathEscape(project), user)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -128,7 +129,7 @@ func (s *ProjectMembersService) GetInheritedProjectMember(pid interface{}, user
}
u := fmt.Sprintf("projects/%s/members/all/%d", pathEscape(project), user)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -147,7 +148,7 @@ func (s *ProjectMembersService) GetInheritedProjectMember(pid interface{}, user
// 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"`
UserID interface{} `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"`
}
@ -166,7 +167,7 @@ func (s *ProjectMembersService) AddProjectMember(pid interface{}, opt *AddProjec
}
u := fmt.Sprintf("projects/%s/members", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -200,7 +201,7 @@ func (s *ProjectMembersService) EditProjectMember(pid interface{}, user int, opt
}
u := fmt.Sprintf("projects/%s/members/%d", pathEscape(project), user)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -225,7 +226,7 @@ func (s *ProjectMembersService) DeleteProjectMember(pid interface{}, user int, o
}
u := fmt.Sprintf("projects/%s/members/%d", pathEscape(project), user)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Sander van Harmelen
// Copyright 2021, 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.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"time"
)
@ -56,7 +57,7 @@ func (s *ProjectMirrorService) ListProjectMirror(pid interface{}, options ...Req
}
u := fmt.Sprintf("projects/%s/remote_mirrors", pathEscape(project))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -93,7 +94,7 @@ func (s *ProjectMirrorService) AddProjectMirror(pid interface{}, opt *AddProject
}
u := fmt.Sprintf("projects/%s/remote_mirrors", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -129,7 +130,7 @@ func (s *ProjectMirrorService) EditProjectMirror(pid interface{}, mirror int, op
}
u := fmt.Sprintf("projects/%s/remote_mirrors/%d", pathEscape(project), mirror)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Sander van Harmelen
// Copyright 2021, 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.
@ -19,6 +19,7 @@ package gitlab
import (
"bytes"
"fmt"
"net/http"
)
// ProjectSnippetsService handles communication with the project snippets
@ -44,7 +45,7 @@ func (s *ProjectSnippetsService) ListSnippets(pid interface{}, opt *ListProjectS
}
u := fmt.Sprintf("projects/%s/snippets", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -69,7 +70,7 @@ func (s *ProjectSnippetsService) GetSnippet(pid interface{}, snippet int, option
}
u := fmt.Sprintf("projects/%s/snippets/%d", pathEscape(project), snippet)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -107,7 +108,7 @@ func (s *ProjectSnippetsService) CreateSnippet(pid interface{}, opt *CreateProje
}
u := fmt.Sprintf("projects/%s/snippets", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -145,7 +146,7 @@ func (s *ProjectSnippetsService) UpdateSnippet(pid interface{}, snippet int, opt
}
u := fmt.Sprintf("projects/%s/snippets/%d", pathEscape(project), snippet)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -172,7 +173,7 @@ func (s *ProjectSnippetsService) DeleteSnippet(pid interface{}, snippet int, opt
}
u := fmt.Sprintf("projects/%s/snippets/%d", pathEscape(project), snippet)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -191,7 +192,7 @@ func (s *ProjectSnippetsService) SnippetContent(pid interface{}, snippet int, op
}
u := fmt.Sprintf("projects/%s/snippets/%d/raw", pathEscape(project), snippet)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2018, Patrick Webster
// Copyright 2021, Patrick Webster
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"net/url"
)
@ -65,7 +66,7 @@ func (s *ProjectVariablesService) ListVariables(pid interface{}, opt *ListProjec
}
u := fmt.Sprintf("projects/%s/variables", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -90,7 +91,7 @@ func (s *ProjectVariablesService) GetVariable(pid interface{}, key string, optio
}
u := fmt.Sprintf("projects/%s/variables/%s", pathEscape(project), url.PathEscape(key))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -129,7 +130,7 @@ func (s *ProjectVariablesService) CreateVariable(pid interface{}, opt *CreatePro
}
u := fmt.Sprintf("projects/%s/variables", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -167,7 +168,7 @@ func (s *ProjectVariablesService) UpdateVariable(pid interface{}, key string, op
}
u := fmt.Sprintf("projects/%s/variables/%s", pathEscape(project), url.PathEscape(key))
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -192,7 +193,7 @@ func (s *ProjectVariablesService) RemoveVariable(pid interface{}, key string, op
}
u := fmt.Sprintf("projects/%s/variables/%s", pathEscape(project), url.PathEscape(key))
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Sander van Harmelen
// Copyright 2021, 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.
@ -22,6 +22,7 @@ import (
"io"
"io/ioutil"
"mime/multipart"
"net/http"
"os"
"time"
)
@ -38,71 +39,74 @@ type ProjectsService struct {
//
// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html
type Project struct {
ID int `json:"id"`
Description string `json:"description"`
DefaultBranch string `json:"default_branch"`
Public bool `json:"public"`
Visibility VisibilityValue `json:"visibility"`
SSHURLToRepo string `json:"ssh_url_to_repo"`
HTTPURLToRepo string `json:"http_url_to_repo"`
WebURL string `json:"web_url"`
ReadmeURL string `json:"readme_url"`
TagList []string `json:"tag_list"`
Owner *User `json:"owner"`
Name string `json:"name"`
NameWithNamespace string `json:"name_with_namespace"`
Path string `json:"path"`
PathWithNamespace string `json:"path_with_namespace"`
IssuesEnabled bool `json:"issues_enabled"`
OpenIssuesCount int `json:"open_issues_count"`
MergeRequestsEnabled bool `json:"merge_requests_enabled"`
ApprovalsBeforeMerge int `json:"approvals_before_merge"`
JobsEnabled bool `json:"jobs_enabled"`
WikiEnabled bool `json:"wiki_enabled"`
SnippetsEnabled bool `json:"snippets_enabled"`
ResolveOutdatedDiffDiscussions bool `json:"resolve_outdated_diff_discussions"`
ContainerRegistryEnabled bool `json:"container_registry_enabled"`
CreatedAt *time.Time `json:"created_at,omitempty"`
LastActivityAt *time.Time `json:"last_activity_at,omitempty"`
CreatorID int `json:"creator_id"`
Namespace *ProjectNamespace `json:"namespace"`
ImportStatus string `json:"import_status"`
ImportError string `json:"import_error"`
Permissions *Permissions `json:"permissions"`
MarkedForDeletionAt *ISOTime `json:"marked_for_deletion_at"`
Archived bool `json:"archived"`
AvatarURL string `json:"avatar_url"`
SharedRunnersEnabled bool `json:"shared_runners_enabled"`
ForksCount int `json:"forks_count"`
StarCount int `json:"star_count"`
RunnersToken string `json:"runners_token"`
PublicBuilds bool `json:"public_builds"`
AllowMergeOnSkippedPipeline bool `json:"allow_merge_on_skipped_pipeline"`
OnlyAllowMergeIfPipelineSucceeds bool `json:"only_allow_merge_if_pipeline_succeeds"`
OnlyAllowMergeIfAllDiscussionsAreResolved bool `json:"only_allow_merge_if_all_discussions_are_resolved"`
RemoveSourceBranchAfterMerge bool `json:"remove_source_branch_after_merge"`
LFSEnabled bool `json:"lfs_enabled"`
RequestAccessEnabled bool `json:"request_access_enabled"`
MergeMethod MergeMethodValue `json:"merge_method"`
ForkedFromProject *ForkParent `json:"forked_from_project"`
Mirror bool `json:"mirror"`
MirrorUserID int `json:"mirror_user_id"`
MirrorTriggerBuilds bool `json:"mirror_trigger_builds"`
OnlyMirrorProtectedBranches bool `json:"only_mirror_protected_branches"`
MirrorOverwritesDivergedBranches bool `json:"mirror_overwrites_diverged_branches"`
PackagesEnabled bool `json:"packages_enabled"`
ServiceDeskEnabled bool `json:"service_desk_enabled"`
ServiceDeskAddress string `json:"service_desk_address"`
IssuesAccessLevel AccessControlValue `json:"issues_access_level"`
RepositoryAccessLevel AccessControlValue `json:"repository_access_level"`
MergeRequestsAccessLevel AccessControlValue `json:"merge_requests_access_level"`
ForkingAccessLevel AccessControlValue `json:"forking_access_level"`
WikiAccessLevel AccessControlValue `json:"wiki_access_level"`
BuildsAccessLevel AccessControlValue `json:"builds_access_level"`
SnippetsAccessLevel AccessControlValue `json:"snippets_access_level"`
PagesAccessLevel AccessControlValue `json:"pages_access_level"`
AutocloseReferencedIssues bool `json:"autoclose_referenced_issues"`
CIForwardDeploymentEnabled bool `json:"ci_forward_deployment_enabled"`
ID int `json:"id"`
Description string `json:"description"`
DefaultBranch string `json:"default_branch"`
Public bool `json:"public"`
Visibility VisibilityValue `json:"visibility"`
SSHURLToRepo string `json:"ssh_url_to_repo"`
HTTPURLToRepo string `json:"http_url_to_repo"`
WebURL string `json:"web_url"`
ReadmeURL string `json:"readme_url"`
TagList []string `json:"tag_list"`
Owner *User `json:"owner"`
Name string `json:"name"`
NameWithNamespace string `json:"name_with_namespace"`
Path string `json:"path"`
PathWithNamespace string `json:"path_with_namespace"`
IssuesEnabled bool `json:"issues_enabled"`
OpenIssuesCount int `json:"open_issues_count"`
MergeRequestsEnabled bool `json:"merge_requests_enabled"`
ApprovalsBeforeMerge int `json:"approvals_before_merge"`
JobsEnabled bool `json:"jobs_enabled"`
WikiEnabled bool `json:"wiki_enabled"`
SnippetsEnabled bool `json:"snippets_enabled"`
ResolveOutdatedDiffDiscussions bool `json:"resolve_outdated_diff_discussions"`
ContainerExpirationPolicy *ContainerExpirationPolicy `json:"container_expiration_policy,omitempty"`
ContainerRegistryEnabled bool `json:"container_registry_enabled"`
CreatedAt *time.Time `json:"created_at,omitempty"`
LastActivityAt *time.Time `json:"last_activity_at,omitempty"`
CreatorID int `json:"creator_id"`
Namespace *ProjectNamespace `json:"namespace"`
ImportStatus string `json:"import_status"`
ImportError string `json:"import_error"`
Permissions *Permissions `json:"permissions"`
MarkedForDeletionAt *ISOTime `json:"marked_for_deletion_at"`
EmptyRepo bool `json:"empty_repo"`
Archived bool `json:"archived"`
AvatarURL string `json:"avatar_url"`
SharedRunnersEnabled bool `json:"shared_runners_enabled"`
ForksCount int `json:"forks_count"`
StarCount int `json:"star_count"`
RunnersToken string `json:"runners_token"`
PublicBuilds bool `json:"public_builds"`
AllowMergeOnSkippedPipeline bool `json:"allow_merge_on_skipped_pipeline"`
OnlyAllowMergeIfPipelineSucceeds bool `json:"only_allow_merge_if_pipeline_succeeds"`
OnlyAllowMergeIfAllDiscussionsAreResolved bool `json:"only_allow_merge_if_all_discussions_are_resolved"`
RemoveSourceBranchAfterMerge bool `json:"remove_source_branch_after_merge"`
LFSEnabled bool `json:"lfs_enabled"`
RequestAccessEnabled bool `json:"request_access_enabled"`
MergeMethod MergeMethodValue `json:"merge_method"`
ForkedFromProject *ForkParent `json:"forked_from_project"`
Mirror bool `json:"mirror"`
MirrorUserID int `json:"mirror_user_id"`
MirrorTriggerBuilds bool `json:"mirror_trigger_builds"`
OnlyMirrorProtectedBranches bool `json:"only_mirror_protected_branches"`
MirrorOverwritesDivergedBranches bool `json:"mirror_overwrites_diverged_branches"`
PackagesEnabled bool `json:"packages_enabled"`
ServiceDeskEnabled bool `json:"service_desk_enabled"`
ServiceDeskAddress string `json:"service_desk_address"`
IssuesAccessLevel AccessControlValue `json:"issues_access_level"`
RepositoryAccessLevel AccessControlValue `json:"repository_access_level"`
MergeRequestsAccessLevel AccessControlValue `json:"merge_requests_access_level"`
ForkingAccessLevel AccessControlValue `json:"forking_access_level"`
WikiAccessLevel AccessControlValue `json:"wiki_access_level"`
BuildsAccessLevel AccessControlValue `json:"builds_access_level"`
SnippetsAccessLevel AccessControlValue `json:"snippets_access_level"`
PagesAccessLevel AccessControlValue `json:"pages_access_level"`
OperationsAccessLevel AccessControlValue `json:"operations_access_level"`
AutocloseReferencedIssues bool `json:"autoclose_referenced_issues"`
CIForwardDeploymentEnabled bool `json:"ci_forward_deployment_enabled"`
SharedWithGroups []struct {
GroupID int `json:"group_id"`
GroupName string `json:"group_name"`
@ -116,6 +120,17 @@ type Project struct {
ComplianceFrameworks []string `json:"compliance_frameworks"`
}
// ContainerExpirationPolicy represents the container expiration policy.
type ContainerExpirationPolicy struct {
Cadence string `json:"cadence"`
KeepN int `json:"keep_n"`
OlderThan string `json:"older_than"`
NameRegexDelete string `json:"name_regex_delete"`
NameRegexKeep string `json:"name_regex_keep"`
Enabled bool `json:"enabled"`
NextRunAt *time.Time `json:"next_run_at"`
}
// Repository represents a repository.
type Repository struct {
Name string `json:"name"`
@ -257,7 +272,7 @@ type ListProjectsOptions struct {
//
// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#list-projects
func (s *ProjectsService) ListProjects(opt *ListProjectsOptions, options ...RequestOptionFunc) ([]*Project, *Response, error) {
req, err := s.client.NewRequest("GET", "projects", opt, options)
req, err := s.client.NewRequest(http.MethodGet, "projects", opt, options)
if err != nil {
return nil, nil, err
}
@ -282,7 +297,7 @@ func (s *ProjectsService) ListUserProjects(uid interface{}, opt *ListProjectsOpt
}
u := fmt.Sprintf("users/%s/projects", user)
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -325,7 +340,7 @@ func (s *ProjectsService) ListProjectsUsers(pid interface{}, opt *ListProjectUse
}
u := fmt.Sprintf("projects/%s/users", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -354,7 +369,7 @@ func (s *ProjectsService) GetProjectLanguages(pid interface{}, options ...Reques
}
u := fmt.Sprintf("projects/%s/languages", pathEscape(project))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -389,7 +404,7 @@ func (s *ProjectsService) GetProject(pid interface{}, opt *GetProjectOptions, op
}
u := fmt.Sprintf("projects/%s", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -450,7 +465,7 @@ func (s *ProjectsService) GetProjectEvents(pid interface{}, opt *GetProjectEvent
}
u := fmt.Sprintf("projects/%s/events", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -468,55 +483,57 @@ func (s *ProjectsService) GetProjectEvents(pid interface{}, opt *GetProjectEvent
//
// GitLab API docs: https://docs.gitlab.com/ee/api/projects.html#create-project
type CreateProjectOptions struct {
Name *string `url:"name,omitempty" json:"name,omitempty"`
Path *string `url:"path,omitempty" json:"path,omitempty"`
NamespaceID *int `url:"namespace_id,omitempty" json:"namespace_id,omitempty"`
DefaultBranch *string `url:"default_branch,omitempty" json:"default_branch,omitempty"`
Description *string `url:"description,omitempty" json:"description,omitempty"`
IssuesAccessLevel *AccessControlValue `url:"issues_access_level,omitempty" json:"issues_access_level,omitempty"`
RepositoryAccessLevel *AccessControlValue `url:"repository_access_level,omitempty" json:"repository_access_level,omitempty"`
MergeRequestsAccessLevel *AccessControlValue `url:"merge_requests_access_level,omitempty" json:"merge_requests_access_level,omitempty"`
ForkingAccessLevel *AccessControlValue `url:"forking_access_level,omitempty" json:"forking_access_level,omitempty"`
BuildsAccessLevel *AccessControlValue `url:"builds_access_level,omitempty" json:"builds_access_level,omitempty"`
WikiAccessLevel *AccessControlValue `url:"wiki_access_level,omitempty" json:"wiki_access_level,omitempty"`
SnippetsAccessLevel *AccessControlValue `url:"snippets_access_level,omitempty" json:"snippets_access_level,omitempty"`
PagesAccessLevel *AccessControlValue `url:"pages_access_level,omitempty" json:"pages_access_level,omitempty"`
EmailsDisabled *bool `url:"emails_disabled,omitempty" json:"emails_disabled,omitempty"`
ResolveOutdatedDiffDiscussions *bool `url:"resolve_outdated_diff_discussions,omitempty" json:"resolve_outdated_diff_discussions,omitempty"`
ContainerRegistryEnabled *bool `url:"container_registry_enabled,omitempty" json:"container_registry_enabled,omitempty"`
SharedRunnersEnabled *bool `url:"shared_runners_enabled,omitempty" json:"shared_runners_enabled,omitempty"`
Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
ImportURL *string `url:"import_url,omitempty" json:"import_url,omitempty"`
PublicBuilds *bool `url:"public_builds,omitempty" json:"public_builds,omitempty"`
AllowMergeOnSkippedPipeline *bool `url:"allow_merge_on_skipped_pipeline,omitempty" json:"allow_merge_on_skipped_pipeline,omitempty"`
OnlyAllowMergeIfPipelineSucceeds *bool `url:"only_allow_merge_if_pipeline_succeeds,omitempty" json:"only_allow_merge_if_pipeline_succeeds,omitempty"`
OnlyAllowMergeIfAllDiscussionsAreResolved *bool `url:"only_allow_merge_if_all_discussions_are_resolved,omitempty" json:"only_allow_merge_if_all_discussions_are_resolved,omitempty"`
MergeMethod *MergeMethodValue `url:"merge_method,omitempty" json:"merge_method,omitempty"`
RemoveSourceBranchAfterMerge *bool `url:"remove_source_branch_after_merge,omitempty" json:"remove_source_branch_after_merge,omitempty"`
LFSEnabled *bool `url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"`
RequestAccessEnabled *bool `url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"`
TagList *[]string `url:"tag_list,omitempty" json:"tag_list,omitempty"`
PrintingMergeRequestLinkEnabled *bool `url:"printing_merge_request_link_enabled,omitempty" json:"printing_merge_request_link_enabled,omitempty"`
BuildGitStrategy *string `url:"build_git_strategy,omitempty" json:"build_git_strategy,omitempty"`
BuildTimeout *int `url:"build_timeout,omitempty" json:"build_timeout,omitempty"`
AutoCancelPendingPipelines *string `url:"auto_cancel_pending_pipelines,omitempty" json:"auto_cancel_pending_pipelines,omitempty"`
BuildCoverageRegex *string `url:"build_coverage_regex,omitempty" json:"build_coverage_regex,omitempty"`
CIConfigPath *string `url:"ci_config_path,omitempty" json:"ci_config_path,omitempty"`
CIForwardDeploymentEnabled *bool `url:"ci_forward_deployment_enabled,omitempty" json:"ci_forward_deployment_enabled,omitempty"`
AutoDevopsEnabled *bool `url:"auto_devops_enabled,omitempty" json:"auto_devops_enabled,omitempty"`
AutoDevopsDeployStrategy *string `url:"auto_devops_deploy_strategy,omitempty" json:"auto_devops_deploy_strategy,omitempty"`
ApprovalsBeforeMerge *int `url:"approvals_before_merge,omitempty" json:"approvals_before_merge,omitempty"`
ExternalAuthorizationClassificationLabel *string `url:"external_authorization_classification_label,omitempty" json:"external_authorization_classification_label,omitempty"`
Mirror *bool `url:"mirror,omitempty" json:"mirror,omitempty"`
MirrorTriggerBuilds *bool `url:"mirror_trigger_builds,omitempty" json:"mirror_trigger_builds,omitempty"`
InitializeWithReadme *bool `url:"initialize_with_readme,omitempty" json:"initialize_with_readme,omitempty"`
TemplateName *string `url:"template_name,omitempty" json:"template_name,omitempty"`
TemplateProjectID *int `url:"template_project_id,omitempty" json:"template_project_id,omitempty"`
UseCustomTemplate *bool `url:"use_custom_template,omitempty" json:"use_custom_template,omitempty"`
GroupWithProjectTemplatesID *int `url:"group_with_project_templates_id,omitempty" json:"group_with_project_templates_id,omitempty"`
PackagesEnabled *bool `url:"packages_enabled,omitempty" json:"packages_enabled,omitempty"`
ServiceDeskEnabled *bool `url:"service_desk_enabled,omitempty" json:"service_desk_enabled,omitempty"`
AutocloseReferencedIssues *bool `url:"autoclose_referenced_issues,omitempty" json:"autoclose_referenced_issues,omitempty"`
Name *string `url:"name,omitempty" json:"name,omitempty"`
Path *string `url:"path,omitempty" json:"path,omitempty"`
NamespaceID *int `url:"namespace_id,omitempty" json:"namespace_id,omitempty"`
DefaultBranch *string `url:"default_branch,omitempty" json:"default_branch,omitempty"`
Description *string `url:"description,omitempty" json:"description,omitempty"`
IssuesAccessLevel *AccessControlValue `url:"issues_access_level,omitempty" json:"issues_access_level,omitempty"`
RepositoryAccessLevel *AccessControlValue `url:"repository_access_level,omitempty" json:"repository_access_level,omitempty"`
MergeRequestsAccessLevel *AccessControlValue `url:"merge_requests_access_level,omitempty" json:"merge_requests_access_level,omitempty"`
ForkingAccessLevel *AccessControlValue `url:"forking_access_level,omitempty" json:"forking_access_level,omitempty"`
BuildsAccessLevel *AccessControlValue `url:"builds_access_level,omitempty" json:"builds_access_level,omitempty"`
WikiAccessLevel *AccessControlValue `url:"wiki_access_level,omitempty" json:"wiki_access_level,omitempty"`
SnippetsAccessLevel *AccessControlValue `url:"snippets_access_level,omitempty" json:"snippets_access_level,omitempty"`
PagesAccessLevel *AccessControlValue `url:"pages_access_level,omitempty" json:"pages_access_level,omitempty"`
OperationsAccessLevel *AccessControlValue `url:"operations_access_level,omitempty" json:"operations_access_level,omitempty"`
EmailsDisabled *bool `url:"emails_disabled,omitempty" json:"emails_disabled,omitempty"`
ResolveOutdatedDiffDiscussions *bool `url:"resolve_outdated_diff_discussions,omitempty" json:"resolve_outdated_diff_discussions,omitempty"`
ContainerExpirationPolicyAttributes *ContainerExpirationPolicyAttributes `url:"container_expiration_policy_attributes,omitempty" json:"container_expiration_policy_attributes,omitempty"`
ContainerRegistryEnabled *bool `url:"container_registry_enabled,omitempty" json:"container_registry_enabled,omitempty"`
SharedRunnersEnabled *bool `url:"shared_runners_enabled,omitempty" json:"shared_runners_enabled,omitempty"`
Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
ImportURL *string `url:"import_url,omitempty" json:"import_url,omitempty"`
PublicBuilds *bool `url:"public_builds,omitempty" json:"public_builds,omitempty"`
AllowMergeOnSkippedPipeline *bool `url:"allow_merge_on_skipped_pipeline,omitempty" json:"allow_merge_on_skipped_pipeline,omitempty"`
OnlyAllowMergeIfPipelineSucceeds *bool `url:"only_allow_merge_if_pipeline_succeeds,omitempty" json:"only_allow_merge_if_pipeline_succeeds,omitempty"`
OnlyAllowMergeIfAllDiscussionsAreResolved *bool `url:"only_allow_merge_if_all_discussions_are_resolved,omitempty" json:"only_allow_merge_if_all_discussions_are_resolved,omitempty"`
MergeMethod *MergeMethodValue `url:"merge_method,omitempty" json:"merge_method,omitempty"`
RemoveSourceBranchAfterMerge *bool `url:"remove_source_branch_after_merge,omitempty" json:"remove_source_branch_after_merge,omitempty"`
LFSEnabled *bool `url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"`
RequestAccessEnabled *bool `url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"`
TagList *[]string `url:"tag_list,omitempty" json:"tag_list,omitempty"`
PrintingMergeRequestLinkEnabled *bool `url:"printing_merge_request_link_enabled,omitempty" json:"printing_merge_request_link_enabled,omitempty"`
BuildGitStrategy *string `url:"build_git_strategy,omitempty" json:"build_git_strategy,omitempty"`
BuildTimeout *int `url:"build_timeout,omitempty" json:"build_timeout,omitempty"`
AutoCancelPendingPipelines *string `url:"auto_cancel_pending_pipelines,omitempty" json:"auto_cancel_pending_pipelines,omitempty"`
BuildCoverageRegex *string `url:"build_coverage_regex,omitempty" json:"build_coverage_regex,omitempty"`
CIConfigPath *string `url:"ci_config_path,omitempty" json:"ci_config_path,omitempty"`
CIForwardDeploymentEnabled *bool `url:"ci_forward_deployment_enabled,omitempty" json:"ci_forward_deployment_enabled,omitempty"`
AutoDevopsEnabled *bool `url:"auto_devops_enabled,omitempty" json:"auto_devops_enabled,omitempty"`
AutoDevopsDeployStrategy *string `url:"auto_devops_deploy_strategy,omitempty" json:"auto_devops_deploy_strategy,omitempty"`
ApprovalsBeforeMerge *int `url:"approvals_before_merge,omitempty" json:"approvals_before_merge,omitempty"`
ExternalAuthorizationClassificationLabel *string `url:"external_authorization_classification_label,omitempty" json:"external_authorization_classification_label,omitempty"`
Mirror *bool `url:"mirror,omitempty" json:"mirror,omitempty"`
MirrorTriggerBuilds *bool `url:"mirror_trigger_builds,omitempty" json:"mirror_trigger_builds,omitempty"`
InitializeWithReadme *bool `url:"initialize_with_readme,omitempty" json:"initialize_with_readme,omitempty"`
TemplateName *string `url:"template_name,omitempty" json:"template_name,omitempty"`
TemplateProjectID *int `url:"template_project_id,omitempty" json:"template_project_id,omitempty"`
UseCustomTemplate *bool `url:"use_custom_template,omitempty" json:"use_custom_template,omitempty"`
GroupWithProjectTemplatesID *int `url:"group_with_project_templates_id,omitempty" json:"group_with_project_templates_id,omitempty"`
PackagesEnabled *bool `url:"packages_enabled,omitempty" json:"packages_enabled,omitempty"`
ServiceDeskEnabled *bool `url:"service_desk_enabled,omitempty" json:"service_desk_enabled,omitempty"`
AutocloseReferencedIssues *bool `url:"autoclose_referenced_issues,omitempty" json:"autoclose_referenced_issues,omitempty"`
// Deprecated members
IssuesEnabled *bool `url:"issues_enabled,omitempty" json:"issues_enabled,omitempty"`
@ -526,11 +543,34 @@ type CreateProjectOptions struct {
SnippetsEnabled *bool `url:"snippets_enabled,omitempty" json:"snippets_enabled,omitempty"`
}
// ContainerExpirationPolicyAttributes represents the available container
// expiration policy attributes.
//
// GitLab API docs: https://docs.gitlab.com/ee/api/projects.html#create-project
type ContainerExpirationPolicyAttributes struct {
Cadence *string `url:"cadence,omitempty" json:"cadence,omitempty"`
KeepN *int `url:"keep_n,omitempty" json:"keep_n,omitempty"`
OlderThan *string `url:"older_than,omitempty" json:"older_than,omitempty"`
NameRegexDelete *string `url:"name_regex_delete,omitempty" json:"name_regex_delete,omitempty"`
NameRegexKeep *string `url:"name_regex_keep,omitempty" json:"name_regex_keep,omitempty"`
Enabled *bool `url:"enabled,omitempty" json:"enabled,omitempty"`
// Deprecated members
NameRegex *string `url:"name_regex,omitempty" json:"name_regex,omitempty"`
}
// CreateProject creates a new project owned by the authenticated user.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#create-project
func (s *ProjectsService) CreateProject(opt *CreateProjectOptions, options ...RequestOptionFunc) (*Project, *Response, error) {
req, err := s.client.NewRequest("POST", "projects", opt, options)
if opt.ContainerExpirationPolicyAttributes != nil {
// This is needed to satisfy the API. Should be deleted
// when NameRegex is removed (it's now deprecated).
opt.ContainerExpirationPolicyAttributes.NameRegex =
opt.ContainerExpirationPolicyAttributes.NameRegexDelete
}
req, err := s.client.NewRequest(http.MethodPost, "projects", opt, options)
if err != nil {
return nil, nil, err
}
@ -557,9 +597,15 @@ type CreateProjectForUserOptions CreateProjectOptions
// GitLab API docs:
// https://docs.gitlab.com/ce/api/projects.html#create-project-for-user
func (s *ProjectsService) CreateProjectForUser(user int, opt *CreateProjectForUserOptions, options ...RequestOptionFunc) (*Project, *Response, error) {
u := fmt.Sprintf("projects/user/%d", user)
if opt.ContainerExpirationPolicyAttributes != nil {
// This is needed to satisfy the API. Should be deleted
// when NameRegex is removed (it's now deprecated).
opt.ContainerExpirationPolicyAttributes.NameRegex =
opt.ContainerExpirationPolicyAttributes.NameRegexDelete
}
req, err := s.client.NewRequest("POST", u, opt, options)
u := fmt.Sprintf("projects/user/%d", user)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -577,52 +623,54 @@ func (s *ProjectsService) CreateProjectForUser(user int, opt *CreateProjectForUs
//
// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#edit-project
type EditProjectOptions struct {
Name *string `url:"name,omitempty" json:"name,omitempty"`
Path *string `url:"path,omitempty" json:"path,omitempty"`
DefaultBranch *string `url:"default_branch,omitempty" json:"default_branch,omitempty"`
Description *string `url:"description,omitempty" json:"description,omitempty"`
IssuesAccessLevel *AccessControlValue `url:"issues_access_level,omitempty" json:"issues_access_level,omitempty"`
RepositoryAccessLevel *AccessControlValue `url:"repository_access_level,omitempty" json:"repository_access_level,omitempty"`
MergeRequestsAccessLevel *AccessControlValue `url:"merge_requests_access_level,omitempty" json:"merge_requests_access_level,omitempty"`
ForkingAccessLevel *AccessControlValue `url:"forking_access_level,omitempty" json:"forking_access_level,omitempty"`
BuildsAccessLevel *AccessControlValue `url:"builds_access_level,omitempty" json:"builds_access_level,omitempty"`
WikiAccessLevel *AccessControlValue `url:"wiki_access_level,omitempty" json:"wiki_access_level,omitempty"`
SnippetsAccessLevel *AccessControlValue `url:"snippets_access_level,omitempty" json:"snippets_access_level,omitempty"`
PagesAccessLevel *AccessControlValue `url:"pages_access_level,omitempty" json:"pages_access_level,omitempty"`
EmailsDisabled *bool `url:"emails_disabled,omitempty" json:"emails_disabled,omitempty"`
ResolveOutdatedDiffDiscussions *bool `url:"resolve_outdated_diff_discussions,omitempty" json:"resolve_outdated_diff_discussions,omitempty"`
ContainerRegistryEnabled *bool `url:"container_registry_enabled,omitempty" json:"container_registry_enabled,omitempty"`
SharedRunnersEnabled *bool `url:"shared_runners_enabled,omitempty" json:"shared_runners_enabled,omitempty"`
Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
ImportURL *string `url:"import_url,omitempty" json:"import_url,omitempty"`
PublicBuilds *bool `url:"public_builds,omitempty" json:"public_builds,omitempty"`
AllowMergeOnSkippedPipeline *bool `url:"allow_merge_on_skipped_pipeline,omitempty" json:"allow_merge_on_skipped_pipeline,omitempty"`
OnlyAllowMergeIfPipelineSucceeds *bool `url:"only_allow_merge_if_pipeline_succeeds,omitempty" json:"only_allow_merge_if_pipeline_succeeds,omitempty"`
OnlyAllowMergeIfAllDiscussionsAreResolved *bool `url:"only_allow_merge_if_all_discussions_are_resolved,omitempty" json:"only_allow_merge_if_all_discussions_are_resolved,omitempty"`
MergeMethod *MergeMethodValue `url:"merge_method,omitempty" json:"merge_method,omitempty"`
RemoveSourceBranchAfterMerge *bool `url:"remove_source_branch_after_merge,omitempty" json:"remove_source_branch_after_merge,omitempty"`
LFSEnabled *bool `url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"`
RequestAccessEnabled *bool `url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"`
TagList *[]string `url:"tag_list,omitempty" json:"tag_list,omitempty"`
BuildGitStrategy *string `url:"build_git_strategy,omitempty" json:"build_git_strategy,omitempty"`
BuildTimeout *int `url:"build_timeout,omitempty" json:"build_timeout,omitempty"`
AutoCancelPendingPipelines *string `url:"auto_cancel_pending_pipelines,omitempty" json:"auto_cancel_pending_pipelines,omitempty"`
BuildCoverageRegex *string `url:"build_coverage_regex,omitempty" json:"build_coverage_regex,omitempty"`
CIConfigPath *string `url:"ci_config_path,omitempty" json:"ci_config_path,omitempty"`
CIForwardDeploymentEnabled *bool `url:"ci_forward_deployment_enabled,omitempty" json:"ci_forward_deployment_enabled,omitempty"`
CIDefaultGitDepth *int `url:"ci_default_git_depth,omitempty" json:"ci_default_git_depth,omitempty"`
AutoDevopsEnabled *bool `url:"auto_devops_enabled,omitempty" json:"auto_devops_enabled,omitempty"`
AutoDevopsDeployStrategy *string `url:"auto_devops_deploy_strategy,omitempty" json:"auto_devops_deploy_strategy,omitempty"`
ApprovalsBeforeMerge *int `url:"approvals_before_merge,omitempty" json:"approvals_before_merge,omitempty"`
ExternalAuthorizationClassificationLabel *string `url:"external_authorization_classification_label,omitempty" json:"external_authorization_classification_label,omitempty"`
Mirror *bool `url:"mirror,omitempty" json:"mirror,omitempty"`
MirrorUserID *int `url:"mirror_user_id,omitempty" json:"mirror_user_id,omitempty"`
MirrorTriggerBuilds *bool `url:"mirror_trigger_builds,omitempty" json:"mirror_trigger_builds,omitempty"`
OnlyMirrorProtectedBranches *bool `url:"only_mirror_protected_branches,omitempty" json:"only_mirror_protected_branches,omitempty"`
MirrorOverwritesDivergedBranches *bool `url:"mirror_overwrites_diverged_branches,omitempty" json:"mirror_overwrites_diverged_branches,omitempty"`
PackagesEnabled *bool `url:"packages_enabled,omitempty" json:"packages_enabled,omitempty"`
ServiceDeskEnabled *bool `url:"service_desk_enabled,omitempty" json:"service_desk_enabled,omitempty"`
AutocloseReferencedIssues *bool `url:"autoclose_referenced_issues,omitempty" json:"autoclose_referenced_issues,omitempty"`
Name *string `url:"name,omitempty" json:"name,omitempty"`
Path *string `url:"path,omitempty" json:"path,omitempty"`
DefaultBranch *string `url:"default_branch,omitempty" json:"default_branch,omitempty"`
Description *string `url:"description,omitempty" json:"description,omitempty"`
IssuesAccessLevel *AccessControlValue `url:"issues_access_level,omitempty" json:"issues_access_level,omitempty"`
RepositoryAccessLevel *AccessControlValue `url:"repository_access_level,omitempty" json:"repository_access_level,omitempty"`
MergeRequestsAccessLevel *AccessControlValue `url:"merge_requests_access_level,omitempty" json:"merge_requests_access_level,omitempty"`
ForkingAccessLevel *AccessControlValue `url:"forking_access_level,omitempty" json:"forking_access_level,omitempty"`
BuildsAccessLevel *AccessControlValue `url:"builds_access_level,omitempty" json:"builds_access_level,omitempty"`
WikiAccessLevel *AccessControlValue `url:"wiki_access_level,omitempty" json:"wiki_access_level,omitempty"`
SnippetsAccessLevel *AccessControlValue `url:"snippets_access_level,omitempty" json:"snippets_access_level,omitempty"`
PagesAccessLevel *AccessControlValue `url:"pages_access_level,omitempty" json:"pages_access_level,omitempty"`
OperationsAccessLevel *AccessControlValue `url:"operations_access_level,omitempty" json:"operations_access_level,omitempty"`
EmailsDisabled *bool `url:"emails_disabled,omitempty" json:"emails_disabled,omitempty"`
ResolveOutdatedDiffDiscussions *bool `url:"resolve_outdated_diff_discussions,omitempty" json:"resolve_outdated_diff_discussions,omitempty"`
ContainerExpirationPolicyAttributes *ContainerExpirationPolicyAttributes `url:"container_expiration_policy_attributes,omitempty" json:"container_expiration_policy_attributes,omitempty"`
ContainerRegistryEnabled *bool `url:"container_registry_enabled,omitempty" json:"container_registry_enabled,omitempty"`
SharedRunnersEnabled *bool `url:"shared_runners_enabled,omitempty" json:"shared_runners_enabled,omitempty"`
Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
ImportURL *string `url:"import_url,omitempty" json:"import_url,omitempty"`
PublicBuilds *bool `url:"public_builds,omitempty" json:"public_builds,omitempty"`
AllowMergeOnSkippedPipeline *bool `url:"allow_merge_on_skipped_pipeline,omitempty" json:"allow_merge_on_skipped_pipeline,omitempty"`
OnlyAllowMergeIfPipelineSucceeds *bool `url:"only_allow_merge_if_pipeline_succeeds,omitempty" json:"only_allow_merge_if_pipeline_succeeds,omitempty"`
OnlyAllowMergeIfAllDiscussionsAreResolved *bool `url:"only_allow_merge_if_all_discussions_are_resolved,omitempty" json:"only_allow_merge_if_all_discussions_are_resolved,omitempty"`
MergeMethod *MergeMethodValue `url:"merge_method,omitempty" json:"merge_method,omitempty"`
RemoveSourceBranchAfterMerge *bool `url:"remove_source_branch_after_merge,omitempty" json:"remove_source_branch_after_merge,omitempty"`
LFSEnabled *bool `url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"`
RequestAccessEnabled *bool `url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"`
TagList *[]string `url:"tag_list,omitempty" json:"tag_list,omitempty"`
BuildGitStrategy *string `url:"build_git_strategy,omitempty" json:"build_git_strategy,omitempty"`
BuildTimeout *int `url:"build_timeout,omitempty" json:"build_timeout,omitempty"`
AutoCancelPendingPipelines *string `url:"auto_cancel_pending_pipelines,omitempty" json:"auto_cancel_pending_pipelines,omitempty"`
BuildCoverageRegex *string `url:"build_coverage_regex,omitempty" json:"build_coverage_regex,omitempty"`
CIConfigPath *string `url:"ci_config_path,omitempty" json:"ci_config_path,omitempty"`
CIForwardDeploymentEnabled *bool `url:"ci_forward_deployment_enabled,omitempty" json:"ci_forward_deployment_enabled,omitempty"`
CIDefaultGitDepth *int `url:"ci_default_git_depth,omitempty" json:"ci_default_git_depth,omitempty"`
AutoDevopsEnabled *bool `url:"auto_devops_enabled,omitempty" json:"auto_devops_enabled,omitempty"`
AutoDevopsDeployStrategy *string `url:"auto_devops_deploy_strategy,omitempty" json:"auto_devops_deploy_strategy,omitempty"`
ApprovalsBeforeMerge *int `url:"approvals_before_merge,omitempty" json:"approvals_before_merge,omitempty"`
ExternalAuthorizationClassificationLabel *string `url:"external_authorization_classification_label,omitempty" json:"external_authorization_classification_label,omitempty"`
Mirror *bool `url:"mirror,omitempty" json:"mirror,omitempty"`
MirrorUserID *int `url:"mirror_user_id,omitempty" json:"mirror_user_id,omitempty"`
MirrorTriggerBuilds *bool `url:"mirror_trigger_builds,omitempty" json:"mirror_trigger_builds,omitempty"`
OnlyMirrorProtectedBranches *bool `url:"only_mirror_protected_branches,omitempty" json:"only_mirror_protected_branches,omitempty"`
MirrorOverwritesDivergedBranches *bool `url:"mirror_overwrites_diverged_branches,omitempty" json:"mirror_overwrites_diverged_branches,omitempty"`
PackagesEnabled *bool `url:"packages_enabled,omitempty" json:"packages_enabled,omitempty"`
ServiceDeskEnabled *bool `url:"service_desk_enabled,omitempty" json:"service_desk_enabled,omitempty"`
AutocloseReferencedIssues *bool `url:"autoclose_referenced_issues,omitempty" json:"autoclose_referenced_issues,omitempty"`
// Deprecated members
IssuesEnabled *bool `url:"issues_enabled,omitempty" json:"issues_enabled,omitempty"`
@ -636,13 +684,20 @@ type EditProjectOptions struct {
//
// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#edit-project
func (s *ProjectsService) EditProject(pid interface{}, opt *EditProjectOptions, options ...RequestOptionFunc) (*Project, *Response, error) {
if opt.ContainerExpirationPolicyAttributes != nil {
// This is needed to satisfy the API. Should be deleted
// when NameRegex is removed (it's now deprecated).
opt.ContainerExpirationPolicyAttributes.NameRegex =
opt.ContainerExpirationPolicyAttributes.NameRegexDelete
}
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s", pathEscape(project))
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -676,7 +731,7 @@ func (s *ProjectsService) ForkProject(pid interface{}, opt *ForkProjectOptions,
}
u := fmt.Sprintf("projects/%s/fork", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -701,7 +756,7 @@ func (s *ProjectsService) StarProject(pid interface{}, options ...RequestOptionF
}
u := fmt.Sprintf("projects/%s/star", pathEscape(project))
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -726,7 +781,7 @@ func (s *ProjectsService) UnstarProject(pid interface{}, options ...RequestOptio
}
u := fmt.Sprintf("projects/%s/unstar", pathEscape(project))
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -752,7 +807,7 @@ func (s *ProjectsService) ArchiveProject(pid interface{}, options ...RequestOpti
}
u := fmt.Sprintf("projects/%s/archive", pathEscape(project))
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -778,7 +833,7 @@ func (s *ProjectsService) UnarchiveProject(pid interface{}, options ...RequestOp
}
u := fmt.Sprintf("projects/%s/unarchive", pathEscape(project))
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -803,7 +858,7 @@ func (s *ProjectsService) DeleteProject(pid interface{}, options ...RequestOptio
}
u := fmt.Sprintf("projects/%s", pathEscape(project))
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -830,7 +885,7 @@ func (s *ProjectsService) ShareProjectWithGroup(pid interface{}, opt *ShareWithG
}
u := fmt.Sprintf("projects/%s/share", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, err
}
@ -848,7 +903,7 @@ func (s *ProjectsService) DeleteSharedProjectFromGroup(pid interface{}, groupID
}
u := fmt.Sprintf("projects/%s/share/%d", pathEscape(project), groupID)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -913,7 +968,7 @@ func (s *ProjectsService) ListProjectHooks(pid interface{}, opt *ListProjectHook
}
u := fmt.Sprintf("projects/%s/hooks", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -938,7 +993,7 @@ func (s *ProjectsService) GetProjectHook(pid interface{}, hook int, options ...R
}
u := fmt.Sprintf("projects/%s/hooks/%d", pathEscape(project), hook)
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -985,7 +1040,7 @@ func (s *ProjectsService) AddProjectHook(pid interface{}, opt *AddProjectHookOpt
}
u := fmt.Sprintf("projects/%s/hooks", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -1032,7 +1087,7 @@ func (s *ProjectsService) EditProjectHook(pid interface{}, hook int, opt *EditPr
}
u := fmt.Sprintf("projects/%s/hooks/%d", pathEscape(project), hook)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -1058,7 +1113,7 @@ func (s *ProjectsService) DeleteProjectHook(pid interface{}, hook int, options .
}
u := fmt.Sprintf("projects/%s/hooks/%d", pathEscape(project), hook)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -1086,7 +1141,7 @@ type ProjectForkRelation struct {
func (s *ProjectsService) CreateProjectForkRelation(pid int, fork int, options ...RequestOptionFunc) (*ProjectForkRelation, *Response, error) {
u := fmt.Sprintf("projects/%d/fork/%d", pid, fork)
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -1107,7 +1162,7 @@ func (s *ProjectsService) CreateProjectForkRelation(pid int, fork int, options .
func (s *ProjectsService) DeleteProjectForkRelation(pid int, options ...RequestOptionFunc) (*Response, error) {
u := fmt.Sprintf("projects/%d/fork", pid)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -1162,7 +1217,7 @@ func (s *ProjectsService) UploadFile(pid interface{}, file string, options ...Re
req.Body = ioutil.NopCloser(b)
req.ContentLength = int64(b.Len())
req.Header.Set("Content-Type", w.FormDataContentType())
req.Method = "POST"
req.Method = http.MethodPost
uf := &ProjectFile{}
resp, err := s.client.Do(req, uf)
@ -1184,7 +1239,7 @@ func (s *ProjectsService) ListProjectForks(pid interface{}, opt *ListProjectsOpt
}
u := fmt.Sprintf("projects/%s/forks", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -1230,7 +1285,7 @@ func (s *ProjectsService) GetProjectPushRules(pid interface{}, options ...Reques
}
u := fmt.Sprintf("projects/%s/push_rule", pathEscape(project))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -1274,7 +1329,7 @@ func (s *ProjectsService) AddProjectPushRule(pid interface{}, opt *AddProjectPus
}
u := fmt.Sprintf("projects/%s/push_rule", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -1318,7 +1373,7 @@ func (s *ProjectsService) EditProjectPushRule(pid interface{}, opt *EditProjectP
}
u := fmt.Sprintf("projects/%s/push_rule", pathEscape(project))
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -1345,7 +1400,7 @@ func (s *ProjectsService) DeleteProjectPushRule(pid interface{}, options ...Requ
}
u := fmt.Sprintf("projects/%s/push_rule", pathEscape(project))
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -1378,7 +1433,7 @@ func (s *ProjectsService) GetApprovalConfiguration(pid interface{}, options ...R
}
u := fmt.Sprintf("projects/%s/approvals", pathEscape(project))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -1416,7 +1471,7 @@ func (s *ProjectsService) ChangeApprovalConfiguration(pid interface{}, opt *Chan
}
u := fmt.Sprintf("projects/%s/approvals", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -1441,7 +1496,7 @@ func (s *ProjectsService) GetProjectApprovalRules(pid interface{}, options ...Re
}
u := fmt.Sprintf("projects/%s/approval_rules", pathEscape(project))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -1479,7 +1534,7 @@ func (s *ProjectsService) CreateProjectApprovalRule(pid interface{}, opt *Create
}
u := fmt.Sprintf("projects/%s/approval_rules", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -1517,7 +1572,7 @@ func (s *ProjectsService) UpdateProjectApprovalRule(pid interface{}, approvalRul
}
u := fmt.Sprintf("projects/%s/approval_rules/%d", pathEscape(project), approvalRule)
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -1542,7 +1597,7 @@ func (s *ProjectsService) DeleteProjectApprovalRule(pid interface{}, approvalRul
}
u := fmt.Sprintf("projects/%s/approval_rules/%d", pathEscape(project), approvalRule)
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -1571,7 +1626,7 @@ func (s *ProjectsService) ChangeAllowedApprovers(pid interface{}, opt *ChangeAll
}
u := fmt.Sprintf("projects/%s/approvers", pathEscape(project))
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -1596,7 +1651,7 @@ func (s *ProjectsService) StartMirroringProject(pid interface{}, options ...Requ
}
u := fmt.Sprintf("projects/%s/mirror/pull", pathEscape(project))
req, err := s.client.NewRequest("POST", u, nil, options)
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, err
}
@ -1626,7 +1681,7 @@ func (s *ProjectsService) TransferProject(pid interface{}, opt *TransferProjectO
}
u := fmt.Sprintf("projects/%s/transfer", pathEscape(project))
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}

View file

@ -1,5 +1,5 @@
//
// Copyright 2017, Sander van Harmelen, Michael Lihs
// Copyright 2021, Sander van Harmelen, Michael Lihs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/http"
"net/url"
)
@ -30,18 +31,6 @@ type ProtectedBranchesService struct {
client *Client
}
// BranchAccessDescription represents the access description for a protected
// branch.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/protected_branches.html#protected-branches-api
type BranchAccessDescription struct {
AccessLevel AccessLevelValue `json:"access_level"`
UserID int `json:"user_id"`
GroupID int `json:"group_id"`
AccessLevelDescription string `json:"access_level_description"`
}
// ProtectedBranch represents a protected branch.
//
// GitLab API docs:
@ -55,6 +44,18 @@ type ProtectedBranch struct {
CodeOwnerApprovalRequired bool `json:"code_owner_approval_required"`
}
// BranchAccessDescription represents the access description for a protected
// branch.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/protected_branches.html#protected-branches-api
type BranchAccessDescription struct {
AccessLevel AccessLevelValue `json:"access_level"`
AccessLevelDescription string `json:"access_level_description"`
UserID int `json:"user_id"`
GroupID int `json:"group_id"`
}
// ListProtectedBranchesOptions represents the available ListProtectedBranches()
// options.
//
@ -73,7 +74,7 @@ func (s *ProtectedBranchesService) ListProtectedBranches(pid interface{}, opt *L
}
u := fmt.Sprintf("projects/%s/protected_branches", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -98,7 +99,7 @@ func (s *ProtectedBranchesService) GetProtectedBranch(pid interface{}, branch st
}
u := fmt.Sprintf("projects/%s/protected_branches/%s", pathEscape(project), url.PathEscape(branch))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@ -118,21 +119,21 @@ func (s *ProtectedBranchesService) GetProtectedBranch(pid interface{}, branch st
// GitLab API docs:
// https://docs.gitlab.com/ce/api/protected_branches.html#protect-repository-branches
type ProtectRepositoryBranchesOptions struct {
Name *string `url:"name,omitempty" json:"name,omitempty"`
PushAccessLevel *AccessLevelValue `url:"push_access_level,omitempty" json:"push_access_level,omitempty"`
MergeAccessLevel *AccessLevelValue `url:"merge_access_level,omitempty" json:"merge_access_level,omitempty"`
UnprotectAccessLevel *AccessLevelValue `url:"unprotect_access_level,omitempty" json:"unprotect_access_level,omitempty"`
AllowedToPush []*ProtectBranchPermissionOptions `url:"allowed_to_push,omitempty" json:"allowed_to_push,omitempty"`
AllowedToMerge []*ProtectBranchPermissionOptions `url:"allowed_to_merge,omitempty" json:"allowed_to_merge,omitempty"`
AllowedToUnprotect []*ProtectBranchPermissionOptions `url:"allowed_to_unprotect,omitempty" json:"allowed_to_unprotect,omitempty"`
CodeOwnerApprovalRequired *bool `url:"code_owner_approval_required,omitempty" json:"code_owner_approval_required,omitempty"`
Name *string `url:"name,omitempty" json:"name,omitempty"`
PushAccessLevel *AccessLevelValue `url:"push_access_level,omitempty" json:"push_access_level,omitempty"`
MergeAccessLevel *AccessLevelValue `url:"merge_access_level,omitempty" json:"merge_access_level,omitempty"`
UnprotectAccessLevel *AccessLevelValue `url:"unprotect_access_level,omitempty" json:"unprotect_access_level,omitempty"`
AllowedToPush []*BranchPermissionOptions `url:"allowed_to_push,omitempty" json:"allowed_to_push,omitempty"`
AllowedToMerge []*BranchPermissionOptions `url:"allowed_to_merge,omitempty" json:"allowed_to_merge,omitempty"`
AllowedToUnprotect []*BranchPermissionOptions `url:"allowed_to_unprotect,omitempty" json:"allowed_to_unprotect,omitempty"`
CodeOwnerApprovalRequired *bool `url:"code_owner_approval_required,omitempty" json:"code_owner_approval_required,omitempty"`
}
// ProtectBranchPermissionOptions represents a branch permission option.
// BranchPermissionOptions represents a branch permission option.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/protected_branches.html#protect-repository-branches
type ProtectBranchPermissionOptions struct {
type BranchPermissionOptions struct {
UserID *int `url:"user_id,omitempty" json:"user_id,omitempty"`
GroupID *int `url:"group_id,omitempty" json:"group_id,omitempty"`
AccessLevel *AccessLevelValue `url:"access_level,omitempty" json:"access_level,omitempty"`
@ -150,7 +151,7 @@ func (s *ProtectedBranchesService) ProtectRepositoryBranches(pid interface{}, op
}
u := fmt.Sprintf("projects/%s/protected_branches", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -176,7 +177,7 @@ func (s *ProtectedBranchesService) UnprotectRepositoryBranches(pid interface{},
}
u := fmt.Sprintf("projects/%s/protected_branches/%s", pathEscape(project), url.PathEscape(branch))
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@ -204,7 +205,7 @@ func (s *ProtectedBranchesService) RequireCodeOwnerApprovals(pid interface{}, br
}
u := fmt.Sprintf("projects/%s/protected_branches/%s", pathEscape(project), url.PathEscape(branch))
req, err := s.client.NewRequest("PATCH", u, opt, options)
req, err := s.client.NewRequest(http.MethodPatch, u, opt, options)
if err != nil {
return nil, err
}

View file

@ -0,0 +1,176 @@
//
// Copyright 2021, 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/http"
)
// ProtectedEnvironmentsService handles communication with the protected
// environment methods of the GitLab API.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/protected_environments.html
type ProtectedEnvironmentsService struct {
client *Client
}
// ProtectedEnvironment represents a protected environment.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/protected_environments.html
type ProtectedEnvironment struct {
Name string `json:"name"`
DeployAccessLevels []*EnvironmentAccessDescription `json:"deploy_access_levels"`
}
// EnvironmentAccessDescription represents the access decription for a protected
// environment.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/protected_environments.html
type EnvironmentAccessDescription struct {
AccessLevel AccessLevelValue `json:"access_level"`
AccessLevelDescription string `json:"access_level_description"`
UserID int `json:"user_id"`
GroupID int `json:"group_id"`
}
// ListProtectedEnvironmentsOptions represents the available
// ListProtectedEnvironments() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/protected_environments.html#list-protected-environments
type ListProtectedEnvironmentsOptions ListOptions
// ListProtectedEnvironments returns a list of protected environments from a project.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/protected_environments.html#list-protected-environments
func (s *ProtectedEnvironmentsService) ListProtectedEnvironments(pid interface{}, opt *ListProtectedEnvironmentsOptions, options ...RequestOptionFunc) ([]*ProtectedEnvironment, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/protected_environments", pathEscape(project))
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
var pes []*ProtectedEnvironment
resp, err := s.client.Do(req, &pes)
if err != nil {
return nil, resp, err
}
return pes, resp, err
}
// GetProtectedEnvironment returns a single protected environment or wildcard protected environment.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/protected_environments.html#get-a-single-protected-environment-or-wildcard-protected-environment
func (s *ProtectedEnvironmentsService) GetProtectedEnvironment(pid interface{}, environment string, options ...RequestOptionFunc) (*ProtectedEnvironment, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/protected_environments/%s", pathEscape(project), pathEscape(environment))
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
pe := new(ProtectedEnvironment)
resp, err := s.client.Do(req, pe)
if err != nil {
return nil, resp, err
}
return pe, resp, err
}
// ProtectRepositoryEnvironmentsOptions represents the available
// ProtectRepositoryEnvironments() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/protected_environments.html#protect-repository-environments
type ProtectRepositoryEnvironmentsOptions struct {
Name *string `url:"name,omitempty" json:"name,omitempty"`
DeployAccessLevels []*EnvironmentAccessOptions `url:"deploy_access_levels,omitempty" json:"deploy_access_levels,omitempty"`
}
// EnvironmentAccessOptions represents the options for an access decription for
// a protected environment.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/protected_environments.html#protect-repository-environments
type EnvironmentAccessOptions struct {
AccessLevel *AccessLevelValue `url:"access_level,omitempty" json:"access_level,omitempty"`
UserID *int `url:"user_id,omitempty" json:"user_id,omitempty"`
GroupID *int `url:"group_id,omitempty" json:"group_id,omitempty"`
}
// ProtectRepositoryEnvironments protects a single repository environment or several project
// repository environments using a wildcard protected environment.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/protected_environments.html#protect-repository-environments
func (s *ProtectedEnvironmentsService) ProtectRepositoryEnvironments(pid interface{}, opt *ProtectRepositoryEnvironmentsOptions, options ...RequestOptionFunc) (*ProtectedEnvironment, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/protected_environments", pathEscape(project))
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
pe := new(ProtectedEnvironment)
resp, err := s.client.Do(req, pe)
if err != nil {
return nil, resp, err
}
return pe, resp, err
}
// UnprotectEnvironment unprotects the given protected environment or wildcard
// protected environment.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/protected_environments.html#unprotect-repository-environments
func (s *ProtectedEnvironmentsService) UnprotectEnvironment(pid interface{}, environment string, options ...RequestOptionFunc) (*Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, err
}
u := fmt.Sprintf("projects/%s/protected_environments/%s", pathEscape(project), pathEscape(environment))
req, err := s.client.NewRequest(http.MethodDelete, 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