From 93a0b6be9892f03aa7677babfaf026880de08f12 Mon Sep 17 00:00:00 2001 From: Sam Park Date: Mon, 6 Jan 2020 16:20:24 -0800 Subject: [PATCH 01/13] Add github v4 client The golang Github client recommends this. --- go.mod | 14 ++--- go.sum | 179 +++++---------------------------------------------------- 2 files changed, 21 insertions(+), 172 deletions(-) diff --git a/go.mod b/go.mod index 3fa196abab..1e8b6fbb67 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/runatlantis/atlantis go 1.13 require ( - git.apache.org/thrift.git v0.12.0 // indirect + github.com/Laisky/graphql v1.0.4 github.com/Masterminds/semver v1.4.2 // indirect github.com/Masterminds/sprig v2.15.0+incompatible github.com/aokoli/goutils v1.0.1 // indirect @@ -23,7 +23,6 @@ require ( github.com/google/uuid v0.0.0-20161128191214-064e2069ce9c // indirect github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f // indirect github.com/gorilla/mux v1.6.2 - github.com/grpc-ecosystem/grpc-gateway v1.6.2 // indirect github.com/hashicorp/go-getter v1.4.0 github.com/hashicorp/go-version v1.2.0 github.com/hashicorp/hcl v0.0.0-20170914154624-68e816d1c783 // indirect @@ -36,17 +35,17 @@ require ( github.com/microcosm-cc/bluemonday v1.0.1 github.com/mitchellh/colorstring v0.0.0-20150917214807-8631ce90f286 github.com/mitchellh/go-homedir v1.0.0 - github.com/mitchellh/gox v1.0.1 // indirect github.com/mitchellh/mapstructure v0.0.0-20170523030023-d0303fe80992 // indirect github.com/mohae/deepcopy v0.0.0-20170603005431-491d3605edfb github.com/nlopes/slack v0.1.0 github.com/onsi/ginkgo v1.9.0 // indirect - github.com/openzipkin/zipkin-go v0.1.3 // indirect github.com/pelletier/go-buffruneio v0.2.0 // indirect github.com/pelletier/go-toml v1.0.0 // indirect - github.com/petergtz/pegomock v2.5.0+incompatible + github.com/petergtz/pegomock v2.7.0+incompatible github.com/pkg/errors v0.8.0 - github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829 // indirect + github.com/shurcooL/githubv4 v0.0.0-20191127044304-8f68eb5628d0 + github.com/shurcooL/graphql v0.0.0-20181231061246-d48a9a75455f // indirect + github.com/sirupsen/logrus v1.2.0 // indirect github.com/spf13/afero v0.0.0-20170901052352-ee1bd8ee15a1 // indirect github.com/spf13/cast v1.1.0 // indirect github.com/spf13/cobra v0.0.0-20170905172051-b78744579491 @@ -57,9 +56,8 @@ require ( github.com/urfave/cli v1.20.0 github.com/urfave/negroni v0.2.0 github.com/xanzy/go-gitlab v0.22.2-0.20191127083556-16a492660b8c - golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d // indirect golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5 - golang.org/x/net v0.0.0-20191126235420-ef20fe5d7933 // indirect + golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 // indirect golang.org/x/oauth2 v0.0.0-20191122200657-5d9234df094c // indirect google.golang.org/appengine v1.6.5 // indirect gopkg.in/go-playground/assert.v1 v1.2.1 // indirect diff --git a/go.sum b/go.sum index e403d02977..3da13ae344 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,5 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.31.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.36.0 h1:+aCSj7tOo2LODWVEuZDZeGCckdt6MlSF+X/rB3wUiS8= -cloud.google.com/go v0.36.0/go.mod h1:RUoy9p/M4ge0HzT8L+SDZ8jg+Q6fth0CiBuhFJpSV40= 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= @@ -10,14 +7,10 @@ cloud.google.com/go v0.45.1 h1:lRi0CHyU+ytlvylOlFKKq0af6JncuyoRh1J+QJBqQx0= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU= -dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU= -dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4= -dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= -git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= -git.apache.org/thrift.git v0.12.0/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/Laisky/graphql v1.0.4 h1:GQF3eKXK1m+viDIvafW7P3zB8qY0PxHwrNUlmonhIC8= +github.com/Laisky/graphql v1.0.4/go.mod h1:8nTxZuOwua8Ga6EFL1HuF9rNiJtvSEnwGXGLnW+9i9k= github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITgsTc= github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Masterminds/sprig v2.15.0+incompatible h1:0gSxPGWS9PAr7U2NsQ2YQg6juRDINkUyuvbb4b2Xm8w= @@ -25,9 +18,6 @@ github.com/Masterminds/sprig v2.15.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuN github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= -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/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/aokoli/goutils v1.0.1 h1:7fpzNGoJ3VA8qcrm++XEE1QUe0mIwNeLa02Nwq7RDkg= github.com/aokoli/goutils v1.0.1/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g9DP+DQ= github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= @@ -38,52 +28,38 @@ github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:l github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= github.com/aws/aws-sdk-go v1.17.14 h1:IjqZDIQoLyZ48A93BxVrZOaIGgZPRi4nXt6WQUMJplY= github.com/aws/aws-sdk-go v1.17.14/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= -github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/briandowns/spinner v0.0.0-20170614154858-48dbb65d7bd5 h1:osZyZB7J4kE1tKLeaUjV6+uZVBfS835T0I/RxmwWw1w= github.com/briandowns/spinner v0.0.0-20170614154858-48dbb65d7bd5/go.mod h1:hw/JEQBIE+c/BLI4aKM8UU8v+ZqrD3h7HC27kKt8JQU= github.com/bsm/go-vlq v0.0.0-20150828105119-ec6e8d4f5f4e/go.mod h1:N+BjUcTjSxc2mtRGSCPsat1kze3CUtvJN3/jTXlp29k= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= 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/docker/docker v0.0.0-20180620051407-e2593239d949 h1:La/qO5ApRpiO4c0wGWFs4YB/HdobJHArySoQZfXtaUQ= github.com/docker/docker v0.0.0-20180620051407-e2593239d949/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk= github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BMXYYRWTLOJKlh+lOBt6nUQgXAfB7oVIQt5cNreqSLI= github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:rZfgFAXFS/z/lEd6LJmf9HVZ1LkgYiHx5pHhV5DR16M= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= 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/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= -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-ozzo/ozzo-validation v0.0.0-20170913164239-85dcd8368eba h1:P0TvLfAFQ/hc8Q+VBsrgzGv52DxTjAu199VHbAI4LLQ= github.com/go-ozzo/ozzo-validation v0.0.0-20170913164239-85dcd8368eba/go.mod h1:gsEKFIVnabGBt6mXmxK0MoFy+cZoTJY6mu5Ll3LVLBU= github.com/go-playground/locales v0.12.1 h1:2FITxuFt/xuCNP1Acdhv62OzaCiviiE4kotfhkmOqEc= github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= github.com/go-playground/universal-translator v0.16.0 h1:X++omBR/4cE2MNg91AoC3rmGrCjJ8eAeUP/K/EKx4DM= github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-test/deep v1.0.1 h1:UQhStjbkDClarlmv0am7OXXO4/GaPdCGiUiMTvi28sg= -github.com/go-test/deep v1.0.1/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= 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/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= @@ -101,8 +77,6 @@ github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY= -github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= github.com/google/go-github/v28 v28.0.0 h1:+UjHI4+1W/vsXR4jJBWt0ZA74XHbvt5yBAvsf1M3bgM= github.com/google/go-github/v28 v28.0.0/go.mod h1:+5GboIspo7F0NG2qsvfYh7en6F3EK37uyqv+c35AR3s= github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= @@ -113,36 +87,22 @@ github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OI github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/uuid v0.0.0-20161128191214-064e2069ce9c h1:jWtZjFEUE/Bz0IeIhqCnyZ3HG6KRXSntXe4SjtuTH7c= github.com/google/uuid v0.0.0-20161128191214-064e2069ce9c/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go v2.0.0+incompatible h1:j0GKcs05QVmm7yesiZq2+9cxHkNK9YM6zKx4D2qucQU= -github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= -github.com/googleapis/gax-go/v2 v2.0.3 h1:siORttZ36U2R/WjiJuDz8znElWBiAlO9rVt+mqJt0Cc= -github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f h1:9oNbS1z4rVpbnkHBdPZU4jo9bSmrLpII768arSyMFgk= github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/mux v1.6.2 h1:Pgr17XVTNXAk3q/r4CpKzC5xBM/qW1uVLV+IhRZpIIk= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= -github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= -github.com/grpc-ecosystem/grpc-gateway v1.6.2/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= -github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce h1:prjrVgOk2Yg6w+PflHoszQNLTUh4kaByUcEWM/9uin4= -github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/graph-gophers/graphql-go v0.0.0-20191115155744-f33e81362277/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= github.com/hashicorp/errwrap v0.0.0-20180715044906-d6c0cd880357/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.0 h1:wvCrVc9TjDls6+YGAF2hAifE1E5U1+b4tH6KdvN3Gig= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-getter v1.2.0 h1:E05bVPilzyh2yXgT6srn7WEkfMZaH+LuX9tDJw/4kaE= -github.com/hashicorp/go-getter v1.2.0/go.mod h1:/O1k/AizTN0QmfEKknCYGvICeyKUDqCYA8vvWtGWDeQ= github.com/hashicorp/go-getter v1.4.0 h1:ENHNi8494porjD0ZhIrjlAHnveSFhY7hvOJrV/fsKkw= github.com/hashicorp/go-getter v1.4.0/go.mod h1:7qxyCd8rBfcShwsvxgIguu4KbS3l8bUCwg2Umn7RjeY= -github.com/hashicorp/go-multierror v0.0.0-20170622060955-83588e72410a h1:RUacJnONqfKgDeok3I3IqMa8e5+B3qzBIbNK4dZK65k= -github.com/hashicorp/go-multierror v0.0.0-20170622060955-83588e72410a/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= github.com/hashicorp/go-multierror v0.0.0-20180717150148-3d5d8f294aa0/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I= -github.com/hashicorp/go-version v1.0.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.1.0 h1:bPIoEKD27tNdebFGGxxYwcL4nepeY4j1QP23PFRGzg0= github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.2.0 h1:3vNe/fWF5CBgRIguda1meWhsZHy3m8gCJ5wx+dIzX/E= @@ -165,24 +125,20 @@ github.com/imdario/mergo v0.3.5 h1:JboBksRwiiAJWvIYJVo46AfV+IAIKZpfrSzVKj42R4Q= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= 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 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= 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/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.3/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/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/magiconair/properties v1.7.3 h1:6AOjgCKyZFMG/1yfReDPDz3CJZPxnYk7DGmj2HtyF24= github.com/magiconair/properties v1.7.3/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= @@ -191,13 +147,6 @@ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaO github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mcdafydd/go-azuredevops v0.8.4 h1:MVQgoF2xep/7mMPRrv0u6+nCbFSrMTImnwv4kwUlkok= -github.com/mcdafydd/go-azuredevops v0.8.4/go.mod h1:1RwqgbF/Afc2o/BLKsRy3dD/nNFQF0YqroNp0CkP4i0= -github.com/mcdafydd/go-azuredevops v0.9.0 h1:WX53H3Z4Mgz9QqRutZFs8+MR8sGJch2Jd6IvPp0GNfo= -github.com/mcdafydd/go-azuredevops v0.9.0/go.mod h1:1RwqgbF/Afc2o/BLKsRy3dD/nNFQF0YqroNp0CkP4i0= -github.com/mcdafydd/go-azuredevops v0.10.0 h1:gfwMWZ3Gn14qTDbx1U2Ut2YNzdu64DqPQ5/twqLl8H4= -github.com/mcdafydd/go-azuredevops v0.10.0/go.mod h1:/NYbgJ/1+9+SmG5CjETCoWm+FlLNcRwdiw1/AGW9zm0= github.com/mcdafydd/go-azuredevops v0.10.2 h1:cVAxfGqSUK7i4ZRc7s+EpeWSOrDgkBM4SzTRI/IUfoE= github.com/mcdafydd/go-azuredevops v0.10.2/go.mod h1:/NYbgJ/1+9+SmG5CjETCoWm+FlLNcRwdiw1/AGW9zm0= github.com/microcosm-cc/bluemonday v1.0.1 h1:SIYunPjnlXcW+gVfvm0IlSeR5U3WZUOLfVmqg85Go44= @@ -211,78 +160,37 @@ github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eI github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= -github.com/mitchellh/gox v1.0.1 h1:x0jD3dcHk9a9xPSDN6YEL4xL6Qz0dvNYm8yZqui5chI= -github.com/mitchellh/gox v1.0.1/go.mod h1:ED6BioOGXMswlXa2zxfh/xdd5QhwYliBFn9V18Ap4z4= -github.com/mitchellh/iochan v1.0.0 h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWeY= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20170523030023-d0303fe80992 h1:W7VHAEVflA5/eTyRvQ53Lz5j8bhRd1myHZlI/IZFvbU= github.com/mitchellh/mapstructure v0.0.0-20170523030023-d0303fe80992/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mohae/deepcopy v0.0.0-20170603005431-491d3605edfb h1:e+l77LJOEqXTIQihQJVkA6ZxPOUmfPM5e4H7rcpgtSk= github.com/mohae/deepcopy v0.0.0-20170603005431-491d3605edfb/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= -github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= github.com/nlopes/slack v0.1.0 h1:YnVhdQvWT/m0TDh3VNpSoCBDlD7Y4pz1qUqb/NrNyUs= github.com/nlopes/slack v0.1.0/go.mod h1:jVI4BBK3lSktibKahxBF74txcK2vyvkza1z/+rRnVAM= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.9.0 h1:SZjF721BByVj8QH636/8S2DnX4n0Re3SteMmw3N+tzc= github.com/onsi/ginkgo v1.9.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.2.0 h1:tQjc4uvqBp0z424R9V/S2L18penoUiwZftoY0t48IZ4= -github.com/onsi/gomega v1.2.0/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= 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.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= -github.com/openzipkin/zipkin-go v0.1.3/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pelletier/go-buffruneio v0.2.0 h1:U4t4R6YkofJ5xHm3dJzuRpPZ0mr5MMCoAWooScCR7aA= github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo= github.com/pelletier/go-toml v1.0.0 h1:QFDlmAXZrfPXEF6c9+15fMqhQIS3O0pxszhnk936vg4= github.com/pelletier/go-toml v1.0.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/petergtz/pegomock v2.5.0+incompatible h1:NgwX1/qc+tsl7I45OkDxYZ1mIonYWbOESnpZcd20sR0= -github.com/petergtz/pegomock v2.5.0+incompatible/go.mod h1:nuBLWZpVyv/fLo56qTwt/AUau7jgouO1h7bEvZCq82o= +github.com/petergtz/pegomock v2.7.0+incompatible h1:42rJ5wIOBAg9OGdkLaPW9PlF/RtqDc5aGl6PcTCXl3o= +github.com/petergtz/pegomock v2.7.0+incompatible/go.mod h1:nuBLWZpVyv/fLo56qTwt/AUau7jgouO1h7bEvZCq82o= github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= 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.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -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.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -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/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= -github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM= -github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470/go.mod h1:2dOwnU2uBioM+SGy2aZoq1f/Sd1l9OkAeAUvjSyvgU0= -github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= -github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= -github.com/shurcooL/gofontwoff v0.0.0-20180329035133-29b52fc0a18d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw= -github.com/shurcooL/gopherjslib v0.0.0-20160914041154-feb6d3990c2c/go.mod h1:8d3azKNyqcHP1GaQE/c6dDgjkgSx2BZ4IoEi4F1reUI= -github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b/go.mod h1:ZpfEhSmds4ytuByIcDnOLkTHGUI6KNqRNPDLHDk+mUU= -github.com/shurcooL/highlight_go v0.0.0-20181028180052-98c3abbbae20/go.mod h1:UDKB5a1T23gOMUJrI+uSuH0VRDStOiUVSjBTRDVBVag= -github.com/shurcooL/home v0.0.0-20181020052607-80b7ffcb30f9/go.mod h1:+rgNQw2P9ARFAs37qieuu7ohDNQ3gds9msbT2yn85sg= -github.com/shurcooL/htmlg v0.0.0-20170918183704-d01228ac9e50/go.mod h1:zPn1wHpTIePGnXSHpsVPWEktKXHr6+SS6x/IKRb7cpw= -github.com/shurcooL/httperror v0.0.0-20170206035902-86b7830d14cc/go.mod h1:aYMfkZ6DWSJPJ6c4Wwz3QtW22G7mf/PEgaB9k/ik5+Y= -github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= -github.com/shurcooL/httpgzip v0.0.0-20180522190206-b1c53ac65af9/go.mod h1:919LwcH0M7/W4fcZ0/jy0qGght1GIhqyS/EgWGH2j5Q= -github.com/shurcooL/issues v0.0.0-20181008053335-6292fdc1e191/go.mod h1:e2qWDig5bLteJ4fwvDAc2NHzqFEthkqn7aOZAOpj+PQ= -github.com/shurcooL/issuesapp v0.0.0-20180602232740-048589ce2241/go.mod h1:NPpHK2TI7iSaM0buivtFUc9offApnI0Alt/K8hcHy0I= -github.com/shurcooL/notifications v0.0.0-20181007000457-627ab5aea122/go.mod h1:b5uSkrEVM1jQUspwbixRBhaIjIzL2xazXp6kntxYle0= -github.com/shurcooL/octicon v0.0.0-20181028054416-fa4f57f9efb2/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ= -github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1lToEk4d2s07G3XGfz2QrgHXg4RJBvjrOozvoWfk= -github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95 h1:/vdW8Cb7EXrkqWGufVMES1OH2sU9gKVb2n9/1y5NMBY= -github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4= -github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= +github.com/shurcooL/githubv4 v0.0.0-20191127044304-8f68eb5628d0 h1:T9uus1QvcPgeLShS30YOnnzk3r9Vvygp45muhlrufgY= +github.com/shurcooL/githubv4 v0.0.0-20191127044304-8f68eb5628d0/go.mod h1:hAF0iLZy4td2EX+/8Tw+4nodhlMrwN3HupfaXj3zkGo= +github.com/shurcooL/graphql v0.0.0-20181231061246-d48a9a75455f h1:tygelZueB1EtXkPI6mQ4o9DQ0+FKW41hTbunoXZCTqk= +github.com/shurcooL/graphql v0.0.0-20181231061246-d48a9a75455f/go.mod h1:AuYgA5Kyo4c7HfUmvRGs/6rGlMMV/6B1bVnB9JxJEEg= github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= -github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= github.com/spf13/afero v0.0.0-20170901052352-ee1bd8ee15a1 h1:9YWfpAdlPISN1kBzsAokT9SbSipcgt/BBM0lI9lawmo= github.com/spf13/afero v0.0.0-20170901052352-ee1bd8ee15a1/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.1.0 h1:0Rhw4d6C8J9VPu6cjZLIhZ8+aAOHcDvGeKn+cq5Aq3k= @@ -291,8 +199,6 @@ github.com/spf13/cobra v0.0.0-20170905172051-b78744579491 h1:XOya2OGpG7Q4gS4MYHR github.com/spf13/cobra v0.0.0-20170905172051-b78744579491/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/jwalterweatherman v0.0.0-20170901151539-12bd96e66386 h1:zBoLErXXAvWnNsu+pWkRYl6Cx1KXmIfAVsIuYkPN6aY= github.com/spf13/jwalterweatherman v0.0.0-20170901151539-12bd96e66386/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.0 h1:oaPbdDe/x0UncahuwiPxW1GYJyilRAdsPnq3e1yaPcI= -github.com/spf13/pflag v1.0.0/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= @@ -303,8 +209,8 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ 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= -github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= github.com/ulikunitz/xz v0.5.6 h1:jGHAfXawEGZQ3blwU5wnWKQJvAraT7Ftq9EXjnXYgt8= github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= @@ -313,25 +219,14 @@ github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijb github.com/urfave/negroni v0.2.0 h1:cadBY8/+9L/dTagBqV7N0l/SJiB4Wg+os5QdmaFY5Wg= github.com/urfave/negroni v0.2.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= -github.com/xanzy/go-gitlab v0.20.2-0.20190819195750-b1d195859ad0 h1:Tlet1xQyD18wLp48WvTaB7LavL6TvMt6Ye/gwvDObLs= -github.com/xanzy/go-gitlab v0.20.2-0.20190819195750-b1d195859ad0/go.mod h1:LSfUQ9OPDnwRqulJk2HcWaAiFfCzaknyeGvjQI67MbE= -github.com/xanzy/go-gitlab v0.22.1 h1:TVxgHmoa35jQL+9FCkG0nwPDxU9dQZXknBTDtGaSFno= -github.com/xanzy/go-gitlab v0.22.1/go.mod h1:t4Bmvnxj7k37S4Y17lfLx+nLqkf/oQwT2HagfWKv5Og= github.com/xanzy/go-gitlab v0.22.2-0.20191127083556-16a492660b8c h1:3F9W4LSqOnDh5Jwxoo2aq5EZMDrueyScA53Ium7/ZpE= github.com/xanzy/go-gitlab v0.22.2-0.20191127083556-16a492660b8c/go.mod h1:t4Bmvnxj7k37S4Y17lfLx+nLqkf/oQwT2HagfWKv5Og= github.com/zclconf/go-cty v1.0.0 h1:EWtv3gKe2wPLIB9hQRQJa7k/059oIfAqcEkCNnaVckk= github.com/zclconf/go-cty v1.0.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= -go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= -go.opencensus.io v0.19.1 h1:gPYKQ/GAQYR2ksU+qXNmq3CrOZWT1kkryvW6O0v1acY= -go.opencensus.io v0.19.1/go.mod h1:gug0GbSHa8Pafr0d2urOSgoXHZ6x/RUlaiT0d9pqb4A= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= -golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16 h1:y6ce7gCWtnH+m3dCjzQ1PCuwl28DDIc3VNnvY29DlIA= -golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734 h1:p/H982KKEjUnLJkM3tt/LemDnOc1GiZL5FCVlORJ5zo= @@ -341,9 +236,7 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1/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/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -353,12 +246,8 @@ golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20180811021610-c39426892332/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-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181108082009-03003ca0c849/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 h1:HuTn7WObtcDo9uEEU7rEqL0jYthdXAmZ6PP+meazmaU= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= @@ -371,13 +260,10 @@ golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191126235420-ef20fe5d7933 h1:e6HwijUxhDe+hPNjZQQn9bA5PW3vNmnN64U2ZW759Lk= -golang.org/x/net v0.0.0-20191126235420-ef20fe5d7933/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 h1:efeOvDhwQ29Dj3SdAV/MJf8oukgn+8D8WgaCaRMchF8= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890 h1:uESlIz09WIHT2I+pasSXcpLYqYK8wHcdCetU3VuMBJE= -golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a h1:tImsplftrFpALCYumobsd0K86vlAs/eXGFms2txfJfA= golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -385,7 +271,6 @@ golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7O golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191122200657-5d9234df094c h1:HjRaKPaiWks0f5tA6ELVF7ZfqSppfPwOEEAvsrKUTO4= golang.org/x/oauth2 v0.0.0-20191122200657-5d9234df094c/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= 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= @@ -395,10 +280,6 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ 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-20181029174526-d69651ed3497/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-20181213200352-4d1cda033e06/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181218192612-074acd46bca6/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-20190312061237-fead79001313 h1:pczuHS43Cp2ktBEEmLwScxgjWsBSzdaQiKzUyf3DTTc= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -415,13 +296,9 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2 h1:z99zHgr7hKfrUcX/KsoJk5 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-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/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-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181219222714-6e267b5cc78e/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-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -432,21 +309,12 @@ golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0 h1:Dh6fw+p6FyRl5x/FvNswO1ji0lIGzm3KP8Y9VkS9PTE= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20191113232020-e2727e816f5a h1:3IG7HNvPBDvrxpnTWA6zpeNCS5ydX6cdt6oOiGlC8qg= -golang.org/x/tools v0.0.0-20191113232020-e2727e816f5a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.0.0-20181220000619-583d854617af/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.1.0 h1:K6z2u68e86TPdSdefXdzvXgR1zEMa+459vBSfWYAZkI= -google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.9.0 h1:jbyannxz0XFD3zdjgrSUsaJbgpH4eTrkdhRChkHPfO8= google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -456,11 +324,6 @@ google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww google.golang.org/appengine v1.6.5 h1:tycE03LOZYQNhDpS27tcQdAzLCVMaj7QT2SXxebnpCM= google.golang.org/appengine v1.6.5/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-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= -google.golang.org/genproto v0.0.0-20181219182458-5a97ab628bfb/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= -google.golang.org/genproto v0.0.0-20190201180003-4b09977fb922/go.mod h1:L3J43x8/uS+qIUoksaLKe6OS3nUKxOKuIFz1sl2/jx4= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19 h1:Lj2SnHtxkRGJDqnGaSjo+CCdIieEnwVazbOXILwQemk= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -469,15 +332,11 @@ google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRn google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= -google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -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 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -488,9 +347,6 @@ gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXa gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= gopkg.in/go-playground/validator.v9 v9.20.2 h1:6AVDyt8bk0FDiSYSeWivUfzqEjHyVSCMRkpTr6ZCIgk= gopkg.in/go-playground/validator.v9 v9.20.2/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= -gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/russross/blackfriday.v2 v2.0.0 h1:+FlnIV8DSQnT7NZ43hcVKcdJdzZoeCmJj4Ql8gq5keA= -gopkg.in/russross/blackfriday.v2 v2.0.0/go.mod h1:6sSBNz/GtOm/pJTuh5UmBK2ZHfmnxGbl2NZg1UliSOI= 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= @@ -498,13 +354,8 @@ gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= -grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= -honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20180920025451-e3ad64cb4ed3/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= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= -sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= From 610c9b2c372e336859ae02dfef0d56a88970e74b Mon Sep 17 00:00:00 2001 From: Sam Park Date: Mon, 6 Jan 2020 16:19:57 -0800 Subject: [PATCH 02/13] Add hide old comments VCS interface function And implement the Github version. The Golang Github client recommends using shurcooL/githubv4. --- server/events/vcs/azuredevops_client.go | 4 + server/events/vcs/bitbucketcloud/client.go | 4 + server/events/vcs/bitbucketserver/client.go | 4 + server/events/vcs/client.go | 4 + server/events/vcs/github_client.go | 82 +++++++++++++++++-- server/events/vcs/gitlab_client.go | 4 + .../events/vcs/not_configured_vcs_client.go | 3 + server/events/vcs/proxy.go | 4 + 8 files changed, 104 insertions(+), 5 deletions(-) diff --git a/server/events/vcs/azuredevops_client.go b/server/events/vcs/azuredevops_client.go index b3eee8d9eb..c7990045e6 100644 --- a/server/events/vcs/azuredevops_client.go +++ b/server/events/vcs/azuredevops_client.go @@ -124,6 +124,10 @@ func (g *AzureDevopsClient) CreateComment(repo models.Repo, pullNum int, comment return nil } +func (g *AzureDevopsClient) HideOldComments(repo models.Repo, pullNum int) error { + return nil +} + // PullIsApproved returns true if the merge request was approved. // https://docs.microsoft.com/en-us/azure/devops/repos/git/branch-policies?view=azure-devops#require-a-minimum-number-of-reviewers func (g *AzureDevopsClient) PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error) { diff --git a/server/events/vcs/bitbucketcloud/client.go b/server/events/vcs/bitbucketcloud/client.go index d55b7c598f..50f7294177 100644 --- a/server/events/vcs/bitbucketcloud/client.go +++ b/server/events/vcs/bitbucketcloud/client.go @@ -100,6 +100,10 @@ func (b *Client) CreateComment(repo models.Repo, pullNum int, comment string) er return err } +func (b *Client) HideOldComments(repo models.Repo, pullNum int) error { + return nil +} + // PullIsApproved returns true if the merge request was approved. func (b *Client) PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error) { path := fmt.Sprintf("%s/2.0/repositories/%s/pullrequests/%d", b.BaseURL, repo.FullName, pull.Num) diff --git a/server/events/vcs/bitbucketserver/client.go b/server/events/vcs/bitbucketserver/client.go index bff3b6258a..a577d2bcb3 100644 --- a/server/events/vcs/bitbucketserver/client.go +++ b/server/events/vcs/bitbucketserver/client.go @@ -141,6 +141,10 @@ func (b *Client) CreateComment(repo models.Repo, pullNum int, comment string) er return nil } +func (b *Client) HideOldComments(repo models.Repo, pullNum int) error { + return nil +} + // postComment actually posts the comment. It's a helper for CreateComment(). func (b *Client) postComment(repo models.Repo, pullNum int, comment string) error { bodyBytes, err := json.Marshal(map[string]string{"text": comment}) diff --git a/server/events/vcs/client.go b/server/events/vcs/client.go index 153af1265f..1a103c9db1 100644 --- a/server/events/vcs/client.go +++ b/server/events/vcs/client.go @@ -25,6 +25,10 @@ type Client interface { // relative to the repo root, e.g. parent/child/file.txt. GetModifiedFiles(repo models.Repo, pull models.PullRequest) ([]string, error) CreateComment(repo models.Repo, pullNum int, comment string) error + // HideOldComments will hide old comments left from previous plan runs to reduce + // clutter in a pull/merge request. This will not delete the comment, since the + // comment trail may be useful in auditing or backtracing problems. + HideOldComments(repo models.Repo, pullNum int) error PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error) PullIsMergeable(repo models.Repo, pull models.PullRequest) (bool, error) // UpdateStatus updates the commit status to state for pull. src is the diff --git a/server/events/vcs/github_client.go b/server/events/vcs/github_client.go index 11220b1958..3d0ee6bd0c 100644 --- a/server/events/vcs/github_client.go +++ b/server/events/vcs/github_client.go @@ -19,11 +19,13 @@ import ( "net/url" "strings" + "github.com/runatlantis/atlantis/server/events/models" "github.com/runatlantis/atlantis/server/events/vcs/common" + "github.com/Laisky/graphql" "github.com/google/go-github/v28/github" "github.com/pkg/errors" - "github.com/runatlantis/atlantis/server/events/models" + "github.com/shurcooL/githubv4" ) // maxCommentLength is the maximum number of chars allowed in a single comment @@ -32,8 +34,10 @@ const maxCommentLength = 65536 // GithubClient is used to perform GitHub actions. type GithubClient struct { - client *github.Client - ctx context.Context + user string + client *github.Client + v4MutateClient *graphql.Client + ctx context.Context } // NewGithubClient returns a valid GitHub client. @@ -43,6 +47,8 @@ func NewGithubClient(hostname string, user string, pass string) (*GithubClient, Password: strings.TrimSpace(pass), } client := github.NewClient(tp.Client()) + graphqlURL := "https://api.github.com/graphql" + // If we're using github.com then we don't need to do any additional configuration // for the client. It we're using Github Enterprise, then we need to manually // set the base url for the API. @@ -53,11 +59,31 @@ func NewGithubClient(hostname string, user string, pass string) (*GithubClient, return nil, errors.Wrapf(err, "Invalid github hostname trying to parse %s", baseURL) } client.BaseURL = base + graphqlURL = fmt.Sprintf("https://%s/graphql", hostname) + _, err = url.Parse(graphqlURL) + if err != nil { + return nil, errors.Wrapf(err, "Invalid GraphQL github hostname trying to parse %s", graphqlURL) + } } + // shurcooL's githubv4 library has a client ctor, but it doesn't support schema + // previews, which need custom Accept headers (https://developer.github.com/v4/previews) + // So for now use the graphql client, since the githubv4 library was basically + // a simple wrapper around it. And instead of using shurcooL's graphql lib, use + // Laisky's, since shurcooL's doesn't support custom headers. + // Once the Minimize Comment schema is official, this can revert back to using + // shurcooL's libraries completely. + v4MutateClient := graphql.NewClient( + graphqlURL, + tp.Client(), + graphql.WithHeader("Accept", "application/vnd.github.queen-beryl-preview+json"), + ) + return &GithubClient{ - client: client, - ctx: context.Background(), + user: user, + client: client, + v4MutateClient: v4MutateClient, + ctx: context.Background(), }, nil } @@ -113,6 +139,52 @@ func (g *GithubClient) CreateComment(repo models.Repo, pullNum int, comment stri return nil } +func (g *GithubClient) HideOldComments(repo models.Repo, pullNum int) error { + // TODO: Paginate issues. + comments, _, err := g.client.Issues.ListComments(g.ctx, repo.Owner, repo.Name, pullNum, &github.IssueListCommentsOptions{ + Sort: "created", + Direction: "asc", + ListOptions: github.ListOptions{}, + }) + if err != nil { + return err + } + + for _, comment := range comments { + if comment.User != nil && comment.User.GetLogin() != g.user { + continue + } + // Crude filtering: The comment templates typically include the command name + // somewhere in the first line. It's a bit of an assumption, but seems like + // a reasonable one, given we've already filtered the comments by the + // configured Atlantis user. + body := strings.Split(comment.GetBody(), "\n") + if !strings.Contains(body[0], models.ApplyCommand.String()) { + continue + } + var m struct { + MinimizeComment struct { + MinimizedComment struct { + IsMinimized githubv4.Boolean + MinimizedReason githubv4.String + ViewerCanMinimize githubv4.Boolean + } + } `graphql:"minimizeComment(input:$input)"` + } + input := map[string]interface{}{ + "input": githubv4.MinimizeCommentInput{ + Classifier: githubv4.ReportedContentClassifiersOutdated, + SubjectID: comment.GetNodeID(), + }, + } + if err := g.v4MutateClient.Mutate(g.ctx, &m, input); err != nil { + return errors.Wrapf(err, "minimize comment %s", comment.GetNodeID()) + } + } + + return nil +} + // PullIsApproved returns true if the pull request was approved. func (g *GithubClient) PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error) { nextPage := 0 diff --git a/server/events/vcs/gitlab_client.go b/server/events/vcs/gitlab_client.go index 002822805e..0caa87f761 100644 --- a/server/events/vcs/gitlab_client.go +++ b/server/events/vcs/gitlab_client.go @@ -139,6 +139,10 @@ func (g *GitlabClient) CreateComment(repo models.Repo, pullNum int, comment stri return err } +func (g *GitlabClient) HideOldComments(repo models.Repo, pullNum int) error { + return nil +} + // PullIsApproved returns true if the merge request was approved. func (g *GitlabClient) PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error) { approvals, _, err := g.Client.MergeRequests.GetMergeRequestApprovals(repo.FullName, pull.Num) diff --git a/server/events/vcs/not_configured_vcs_client.go b/server/events/vcs/not_configured_vcs_client.go index 98f5ab8ebd..f493c87eb3 100644 --- a/server/events/vcs/not_configured_vcs_client.go +++ b/server/events/vcs/not_configured_vcs_client.go @@ -32,6 +32,9 @@ func (a *NotConfiguredVCSClient) GetModifiedFiles(repo models.Repo, pull models. func (a *NotConfiguredVCSClient) CreateComment(repo models.Repo, pullNum int, comment string) error { return a.err() } +func (a *NotConfiguredVCSClient) HideOldComments(repo models.Repo, pullNum int) error { + return nil +} func (a *NotConfiguredVCSClient) PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error) { return false, a.err() } diff --git a/server/events/vcs/proxy.go b/server/events/vcs/proxy.go index 976eb3e851..8f56749020 100644 --- a/server/events/vcs/proxy.go +++ b/server/events/vcs/proxy.go @@ -60,6 +60,10 @@ func (d *ClientProxy) CreateComment(repo models.Repo, pullNum int, comment strin return d.clients[repo.VCSHost.Type].CreateComment(repo, pullNum, comment) } +func (d *ClientProxy) HideOldComments(repo models.Repo, pullNum int) error { + return nil +} + func (d *ClientProxy) PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error) { return d.clients[repo.VCSHost.Type].PullIsApproved(repo, pull) } From b4af6bc53b6a87033afc1049d9e741e0f8e2d541 Mon Sep 17 00:00:00 2001 From: Sam Park Date: Mon, 6 Jan 2020 16:21:29 -0800 Subject: [PATCH 03/13] Integ hide old comments to updatePull command runner So that every pull update will auto clean older comments --- server/events/command_runner.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/events/command_runner.go b/server/events/command_runner.go index 9f63690ab9..19d32d0404 100644 --- a/server/events/command_runner.go +++ b/server/events/command_runner.go @@ -425,6 +425,10 @@ func (c *DefaultCommandRunner) updatePull(ctx *CommandContext, command PullComma if err := c.VCSClient.CreateComment(ctx.BaseRepo, ctx.Pull.Num, comment); err != nil { ctx.Log.Err("unable to comment: %s", err) } + + if err := c.VCSClient.HideOldComments(ctx.BaseRepo, ctx.Pull.Num); err != nil { + ctx.Log.Err("unable to hide old comments: %s", err) + } } // logPanics logs and creates a comment on the pull request for panics. From 65567ebcc252ddfd2018525a042f4cf9dea95974 Mon Sep 17 00:00:00 2001 From: Sam Park Date: Mon, 6 Jan 2020 16:20:42 -0800 Subject: [PATCH 04/13] Update vendored code --- vendor/github.com/Laisky/graphql/.gitignore | 119 ++ vendor/github.com/Laisky/graphql/.travis.yml | 32 + vendor/github.com/Laisky/graphql/LICENSE | 21 + vendor/github.com/Laisky/graphql/README.md | 72 + vendor/github.com/Laisky/graphql/doc.go | 11 + vendor/github.com/Laisky/graphql/go.mod | 8 + vendor/github.com/Laisky/graphql/go.sum | 15 + vendor/github.com/Laisky/graphql/graphql.go | 193 ++ .../github.com/Laisky/graphql/ident/ident.go | 240 +++ .../graphql/internal/jsonutil/graphql.go | 311 +++ vendor/github.com/Laisky/graphql/query.go | 131 ++ vendor/github.com/Laisky/graphql/scalar.go | 51 + .../github.com/petergtz/pegomock/.gitignore | 1 - vendor/github.com/petergtz/pegomock/README.md | 42 + .../github.com/shurcooL/githubv4/.travis.yml | 16 + vendor/github.com/shurcooL/githubv4/LICENSE | 21 + vendor/github.com/shurcooL/githubv4/README.md | 408 ++++ vendor/github.com/shurcooL/githubv4/doc.go | 13 + vendor/github.com/shurcooL/githubv4/enum.go | 1382 +++++++++++++ .../github.com/shurcooL/githubv4/githubv4.go | 56 + vendor/github.com/shurcooL/githubv4/input.go | 1751 +++++++++++++++++ vendor/github.com/shurcooL/githubv4/scalar.go | 139 ++ .../github.com/shurcooL/graphql/.travis.yml | 16 + vendor/github.com/shurcooL/graphql/LICENSE | 21 + vendor/github.com/shurcooL/graphql/README.md | 293 +++ vendor/github.com/shurcooL/graphql/doc.go | 11 + vendor/github.com/shurcooL/graphql/graphql.go | 123 ++ .../shurcooL/graphql/ident/ident.go | 240 +++ .../graphql/internal/jsonutil/graphql.go | 311 +++ vendor/github.com/shurcooL/graphql/query.go | 131 ++ vendor/github.com/shurcooL/graphql/scalar.go | 51 + vendor/golang.org/x/net/html/const.go | 1 - vendor/golang.org/x/net/html/parse.go | 239 ++- vendor/golang.org/x/net/html/render.go | 31 +- vendor/golang.org/x/net/html/token.go | 3 +- vendor/modules.txt | 14 +- 36 files changed, 6373 insertions(+), 145 deletions(-) create mode 100644 vendor/github.com/Laisky/graphql/.gitignore create mode 100644 vendor/github.com/Laisky/graphql/.travis.yml create mode 100644 vendor/github.com/Laisky/graphql/LICENSE create mode 100644 vendor/github.com/Laisky/graphql/README.md create mode 100644 vendor/github.com/Laisky/graphql/doc.go create mode 100644 vendor/github.com/Laisky/graphql/go.mod create mode 100644 vendor/github.com/Laisky/graphql/go.sum create mode 100644 vendor/github.com/Laisky/graphql/graphql.go create mode 100644 vendor/github.com/Laisky/graphql/ident/ident.go create mode 100644 vendor/github.com/Laisky/graphql/internal/jsonutil/graphql.go create mode 100644 vendor/github.com/Laisky/graphql/query.go create mode 100644 vendor/github.com/Laisky/graphql/scalar.go create mode 100644 vendor/github.com/shurcooL/githubv4/.travis.yml create mode 100644 vendor/github.com/shurcooL/githubv4/LICENSE create mode 100644 vendor/github.com/shurcooL/githubv4/README.md create mode 100644 vendor/github.com/shurcooL/githubv4/doc.go create mode 100644 vendor/github.com/shurcooL/githubv4/enum.go create mode 100644 vendor/github.com/shurcooL/githubv4/githubv4.go create mode 100644 vendor/github.com/shurcooL/githubv4/input.go create mode 100644 vendor/github.com/shurcooL/githubv4/scalar.go create mode 100644 vendor/github.com/shurcooL/graphql/.travis.yml create mode 100644 vendor/github.com/shurcooL/graphql/LICENSE create mode 100644 vendor/github.com/shurcooL/graphql/README.md create mode 100644 vendor/github.com/shurcooL/graphql/doc.go create mode 100644 vendor/github.com/shurcooL/graphql/graphql.go create mode 100644 vendor/github.com/shurcooL/graphql/ident/ident.go create mode 100644 vendor/github.com/shurcooL/graphql/internal/jsonutil/graphql.go create mode 100644 vendor/github.com/shurcooL/graphql/query.go create mode 100644 vendor/github.com/shurcooL/graphql/scalar.go diff --git a/vendor/github.com/Laisky/graphql/.gitignore b/vendor/github.com/Laisky/graphql/.gitignore new file mode 100644 index 0000000000..55affff706 --- /dev/null +++ b/vendor/github.com/Laisky/graphql/.gitignore @@ -0,0 +1,119 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +downloads/ +eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.cache +nosetests.xml +coverage.xml + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# ipython +.ipynb_checkpoints/ + +# koala +koala-config.json + +# pyenv +/venv +/active + +# test +/data +/notebook +.tox + +# ctags +/.tags* + +# webassets +.webassets-cache/ +assets/ +.assets +html + +# node +node_modules/ +bower_components + +# sass +.sass-cache/ + +# docs +/site +/docs/source +/docs/build + +# virtualenv +venv +activate + +# eclipse workspace config +.idea/ +.project +.pydevproject + +# settings +/options/settings/settings_local.py +/settings/settings.yml + +# project +.vscode +tags +vendor +/go-ramjet +/main + +# pprof +memory.pprof +cpu.pprof + +# temporary +# docs + +coverage.txt +entrypoints/main.go diff --git a/vendor/github.com/Laisky/graphql/.travis.yml b/vendor/github.com/Laisky/graphql/.travis.yml new file mode 100644 index 0000000000..abad49bb02 --- /dev/null +++ b/vendor/github.com/Laisky/graphql/.travis.yml @@ -0,0 +1,32 @@ +language: go + +sudo: false + +go: + - 1.12.x + - 1.13.x + +env: + - GO111MODULE=on + +install: true + +git: + depth: 1 + +cache: + directories: + - vendor + - $HOME/.cache/go-build + - $GOPATH/pkg/mod + # - $GOPATH/src + + +script: + - git checkout $TRAVIS_COMMIT . # travis.ci will overwrite to master branch + - go mod vendor + - go test -race -mod=vendor -coverprofile=coverage.txt -covermode=atomic ./... + # - go test -bench ./... + +after_script: + - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/Laisky/graphql/LICENSE b/vendor/github.com/Laisky/graphql/LICENSE new file mode 100644 index 0000000000..ca4c77642d --- /dev/null +++ b/vendor/github.com/Laisky/graphql/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Dmitri Shuralyov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/Laisky/graphql/README.md b/vendor/github.com/Laisky/graphql/README.md new file mode 100644 index 0000000000..26e3ea8a77 --- /dev/null +++ b/vendor/github.com/Laisky/graphql/README.md @@ -0,0 +1,72 @@ +# Golang GraphQL Client + +![GitHub release](https://img.shields.io/github/release/Laisky/graphql.svg) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) +[![Go Report Card](https://goreportcard.com/badge/github.com/Laisky/graphql)](https://goreportcard.com/report/github.com/Laisky/graphql) +[![GoDoc](https://godoc.org/github.com/Laisky/graphql?status.svg)](https://godoc.org/github.com/Laisky/graphql) +[![Build Status](https://travis-ci.org/Laisky/graphql.svg?branch=master)](https://travis-ci.org/Laisky/graphql) +[![codecov](https://codecov.io/gh/Laisky/graphql/branch/master/graph/badge.svg)](https://codecov.io/gh/Laisky/graphql) + + +Fully compatible with v0.0.0-20181231061246-d48a9a75455f + +You can simply replace `github.com/shurcooL/graphql` --> `github.com/Laisky/graphql` to access new features. + + +## New Features + +### Cache friendly + +use HTTP GET when request graphql query, +use HTTP POST when request graphql mutation. + + +### Set Headers & Cookies + +```go +cli := NewClient( + "url", + httpClient, + graphql.WithCookie("cookieName", "cookieVal"), + graphql.WithHeader("headerName", "headerVal"), +) +``` + +## Usage + +```go +package test + +import ( + "context" + "net/http" + "testing" + + "github.com/Laisky/graphql" +) + +type gcpLockQuery struct { + Lock struct { + Name graphql.String `graphql:"name"` + ExpiresAt graphql.String `graphql:"expires_at"` + } `graphql:"Lock(name: $name)"` +} + +func TestQueryWithHTTPGet(t *testing.T) { + ctx := context.Background() + httpClient := http.DefaultClient + query := new(gcpLockQuery) + vars := map[string]interface{}{ + "name": graphql.String("laisky.123"), + } + gracli := graphql.NewClient( + "https://blog.laisky.com/graphql/query/", + httpClient, + ) + if err := gracli.Query(ctx, query, vars); err != nil { + t.Fatalf("%+v", err) + } + +} +``` diff --git a/vendor/github.com/Laisky/graphql/doc.go b/vendor/github.com/Laisky/graphql/doc.go new file mode 100644 index 0000000000..e045bb8537 --- /dev/null +++ b/vendor/github.com/Laisky/graphql/doc.go @@ -0,0 +1,11 @@ +// Package graphql provides a GraphQL client implementation. +// +// For more information, see package github.com/Laisky/githubv4, +// which is a specialized version targeting GitHub GraphQL API v4. +// That package is driving the feature development. +// +// Status: In active early research and development. The API will change when +// opportunities for improvement are discovered; it is not yet frozen. +// +// For now, see README for more details. +package graphql // import "github.com/Laisky/graphql" diff --git a/vendor/github.com/Laisky/graphql/go.mod b/vendor/github.com/Laisky/graphql/go.mod new file mode 100644 index 0000000000..765ab15ac8 --- /dev/null +++ b/vendor/github.com/Laisky/graphql/go.mod @@ -0,0 +1,8 @@ +module github.com/Laisky/graphql + +go 1.13 + +require ( + github.com/graph-gophers/graphql-go v0.0.0-20191115155744-f33e81362277 + github.com/stretchr/testify v1.4.0 // indirect +) diff --git a/vendor/github.com/Laisky/graphql/go.sum b/vendor/github.com/Laisky/graphql/go.sum new file mode 100644 index 0000000000..4c89b175e0 --- /dev/null +++ b/vendor/github.com/Laisky/graphql/go.sum @@ -0,0 +1,15 @@ +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/graph-gophers/graphql-go v0.0.0-20191115155744-f33e81362277 h1:E0whKxgp2ojts0FDgUA8dl62bmH0LxKanMoBr6MDTDM= +github.com/graph-gophers/graphql-go v0.0.0-20191115155744-f33e81362277/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= +github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/Laisky/graphql/graphql.go b/vendor/github.com/Laisky/graphql/graphql.go new file mode 100644 index 0000000000..414c3b1e52 --- /dev/null +++ b/vendor/github.com/Laisky/graphql/graphql.go @@ -0,0 +1,193 @@ +package graphql + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + + "github.com/Laisky/graphql/internal/jsonutil" +) + +var ( + defaultClientHeaders = map[string]string{ + "Content-Type": "application/json", + } +) + +// ClientOptFunc graphql client option +type ClientOptFunc func(*Client) + +// WithHeader set graphql client header +func WithHeader(key, val string) ClientOptFunc { + return func(c *Client) { + c.headers[key] = val + } +} + +// WithCookie set graphql client cookie +func WithCookie(key, val string) ClientOptFunc { + return func(c *Client) { + if c.cookies == nil { + c.cookies = map[string]string{} + } + c.cookies[key] = val + } +} + +// Client is a GraphQL client. +type Client struct { + url string // GraphQL server URL. + httpClient *http.Client + + headers, + cookies map[string]string +} + +// NewClient creates a GraphQL client targeting the specified GraphQL server URL. +// If httpClient is nil, then http.DefaultClient is used. +func NewClient(url string, httpClient *http.Client, opts ...ClientOptFunc) (c *Client) { + if httpClient == nil { + httpClient = http.DefaultClient + } + c = &Client{ + headers: defaultClientHeaders, + url: url, + httpClient: httpClient, + } + for _, optf := range opts { + optf(c) + } + return c +} + +// Query executes a single GraphQL query request, +// with a query derived from q, populating the response into it. +// q should be a pointer to struct that corresponds to the GraphQL schema. +func (c *Client) Query(ctx context.Context, q interface{}, variables map[string]interface{}) error { + return c.do(ctx, queryOperation, q, variables) +} + +// Mutate executes a single GraphQL mutation request, +// with a mutation derived from m, populating the response into it. +// m should be a pointer to struct that corresponds to the GraphQL schema. +func (c *Client) Mutate(ctx context.Context, m interface{}, variables map[string]interface{}) error { + return c.do(ctx, mutationOperation, m, variables) +} + +// do executes a single GraphQL operation. +func (c *Client) do(ctx context.Context, op operationType, v interface{}, variables map[string]interface{}) (err error) { + var query string + switch op { + case queryOperation: + query = constructQuery(v, variables) + case mutationOperation: + query = constructMutation(v, variables) + default: + return fmt.Errorf("unknown operationType, got %v", op) + } + + var ( + req *http.Request + resp *http.Response + ) + switch op { + case queryOperation: + if req, err = http.NewRequest("GET", c.url, nil); err != nil { + return err + } + + var buf bytes.Buffer + err := json.NewEncoder(&buf).Encode(variables) + if err != nil { + return err + } + q := req.URL.Query() + q.Add("query", query) + q.Add("variables", buf.String()) + req.URL.RawQuery = q.Encode() + case mutationOperation: + in := struct { + Query string `json:"query"` + Variables map[string]interface{} `json:"variables,omitempty"` + }{ + Query: query, + Variables: variables, + } + var buf bytes.Buffer + err := json.NewEncoder(&buf).Encode(in) + if err != nil { + return err + } + if req, err = http.NewRequest("POST", c.url, &buf); err != nil { + return err + } + } + + // set cookies and headers + var k, val string + for k, val = range c.headers { + req.Header.Set(k, val) + } + for k, val = range c.cookies { + req.AddCookie(&http.Cookie{Name: k, Value: val}) + } + + if resp, err = c.httpClient.Do(req.WithContext(ctx)); err != nil { + return err + } + + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + body, _ := ioutil.ReadAll(resp.Body) + return fmt.Errorf("non-200 OK status code: %v body: %q", resp.Status, body) + } + var out struct { + Data *json.RawMessage + Errors errors + //Extensions interface{} // Unused. + } + err = json.NewDecoder(resp.Body).Decode(&out) + if err != nil { + // TODO: Consider including response body in returned error, if deemed helpful. + return err + } + if out.Data != nil { + err := jsonutil.UnmarshalGraphQL(*out.Data, v) + if err != nil { + // TODO: Consider including response body in returned error, if deemed helpful. + return err + } + } + if len(out.Errors) > 0 { + return out.Errors + } + return nil +} + +// errors represents the "errors" array in a response from a GraphQL server. +// If returned via error interface, the slice is expected to contain at least 1 element. +// +// Specification: https://facebook.github.io/graphql/#sec-Errors. +type errors []struct { + Message string + Locations []struct { + Line int + Column int + } +} + +// Error implements error interface. +func (e errors) Error() string { + return e[0].Message +} + +type operationType uint8 + +const ( + queryOperation operationType = iota + mutationOperation + //subscriptionOperation // Unused. +) diff --git a/vendor/github.com/Laisky/graphql/ident/ident.go b/vendor/github.com/Laisky/graphql/ident/ident.go new file mode 100644 index 0000000000..29e498ed9e --- /dev/null +++ b/vendor/github.com/Laisky/graphql/ident/ident.go @@ -0,0 +1,240 @@ +// Package ident provides functions for parsing and converting identifier names +// between various naming convention. It has support for MixedCaps, lowerCamelCase, +// and SCREAMING_SNAKE_CASE naming conventions. +package ident + +import ( + "strings" + "unicode" + "unicode/utf8" +) + +// ParseMixedCaps parses a MixedCaps identifier name. +// +// E.g., "ClientMutationID" -> {"Client", "Mutation", "ID"}. +func ParseMixedCaps(name string) Name { + var words Name + + // Split name at any lower -> Upper or Upper -> Upper,lower transitions. + // Check each word for initialisms. + runes := []rune(name) + w, i := 0, 0 // Index of start of word, scan. + for i+1 <= len(runes) { + eow := false // Whether we hit the end of a word. + if i+1 == len(runes) { + eow = true + } else if unicode.IsLower(runes[i]) && unicode.IsUpper(runes[i+1]) { + // lower -> Upper. + eow = true + } else if i+2 < len(runes) && unicode.IsUpper(runes[i]) && unicode.IsUpper(runes[i+1]) && unicode.IsLower(runes[i+2]) { + // Upper -> Upper,lower. End of acronym, followed by a word. + eow = true + + if string(runes[i:i+3]) == "IDs" { // Special case, plural form of ID initialism. + eow = false + } + } + i++ + if !eow { + continue + } + + // [w, i) is a word. + word := string(runes[w:i]) + if initialism, ok := isInitialism(word); ok { + words = append(words, initialism) + } else if i1, i2, ok := isTwoInitialisms(word); ok { + words = append(words, i1, i2) + } else { + words = append(words, word) + } + w = i + } + return words +} + +// ParseLowerCamelCase parses a lowerCamelCase identifier name. +// +// E.g., "clientMutationId" -> {"client", "Mutation", "Id"}. +func ParseLowerCamelCase(name string) Name { + var words Name + + // Split name at any Upper letters. + runes := []rune(name) + w, i := 0, 0 // Index of start of word, scan. + for i+1 <= len(runes) { + eow := false // Whether we hit the end of a word. + if i+1 == len(runes) { + eow = true + } else if unicode.IsUpper(runes[i+1]) { + // Upper letter. + eow = true + } + i++ + if !eow { + continue + } + + // [w, i) is a word. + words = append(words, string(runes[w:i])) + w = i + } + return words +} + +// ParseScreamingSnakeCase parses a SCREAMING_SNAKE_CASE identifier name. +// +// E.g., "CLIENT_MUTATION_ID" -> {"CLIENT", "MUTATION", "ID"}. +func ParseScreamingSnakeCase(name string) Name { + var words Name + + // Split name at '_' characters. + runes := []rune(name) + w, i := 0, 0 // Index of start of word, scan. + for i+1 <= len(runes) { + eow := false // Whether we hit the end of a word. + if i+1 == len(runes) { + eow = true + } else if runes[i+1] == '_' { + // Underscore. + eow = true + } + i++ + if !eow { + continue + } + + // [w, i) is a word. + words = append(words, string(runes[w:i])) + if i < len(runes) && runes[i] == '_' { + // Skip underscore. + i++ + } + w = i + } + return words +} + +// Name is an identifier name, broken up into individual words. +type Name []string + +// ToMixedCaps expresses identifer name in MixedCaps naming convention. +// +// E.g., "ClientMutationID". +func (n Name) ToMixedCaps() string { + for i, word := range n { + if strings.EqualFold(word, "IDs") { // Special case, plural form of ID initialism. + n[i] = "IDs" + continue + } + if initialism, ok := isInitialism(word); ok { + n[i] = initialism + continue + } + if brand, ok := isBrand(word); ok { + n[i] = brand + continue + } + r, size := utf8.DecodeRuneInString(word) + n[i] = string(unicode.ToUpper(r)) + strings.ToLower(word[size:]) + } + return strings.Join(n, "") +} + +// ToLowerCamelCase expresses identifer name in lowerCamelCase naming convention. +// +// E.g., "clientMutationId". +func (n Name) ToLowerCamelCase() string { + for i, word := range n { + if i == 0 { + n[i] = strings.ToLower(word) + continue + } + r, size := utf8.DecodeRuneInString(word) + n[i] = string(unicode.ToUpper(r)) + strings.ToLower(word[size:]) + } + return strings.Join(n, "") +} + +// isInitialism reports whether word is an initialism. +func isInitialism(word string) (string, bool) { + initialism := strings.ToUpper(word) + _, ok := initialisms[initialism] + return initialism, ok +} + +// isTwoInitialisms reports whether word is two initialisms. +func isTwoInitialisms(word string) (string, string, bool) { + word = strings.ToUpper(word) + for i := 2; i <= len(word)-2; i++ { // Shortest initialism is 2 characters long. + _, ok1 := initialisms[word[:i]] + _, ok2 := initialisms[word[i:]] + if ok1 && ok2 { + return word[:i], word[i:], true + } + } + return "", "", false +} + +// initialisms is the set of initialisms in the MixedCaps naming convention. +// Only add entries that are highly unlikely to be non-initialisms. +// For instance, "ID" is fine (Freudian code is rare), but "AND" is not. +var initialisms = map[string]struct{}{ + // These are the common initialisms from golint. Keep them in sync + // with https://gotools.org/github.com/golang/lint#commonInitialisms. + "ACL": {}, + "API": {}, + "ASCII": {}, + "CPU": {}, + "CSS": {}, + "DNS": {}, + "EOF": {}, + "GUID": {}, + "HTML": {}, + "HTTP": {}, + "HTTPS": {}, + "ID": {}, + "IP": {}, + "JSON": {}, + "LHS": {}, + "QPS": {}, + "RAM": {}, + "RHS": {}, + "RPC": {}, + "SLA": {}, + "SMTP": {}, + "SQL": {}, + "SSH": {}, + "TCP": {}, + "TLS": {}, + "TTL": {}, + "UDP": {}, + "UI": {}, + "UID": {}, + "UUID": {}, + "URI": {}, + "URL": {}, + "UTF8": {}, + "VM": {}, + "XML": {}, + "XMPP": {}, + "XSRF": {}, + "XSS": {}, + + // Additional common initialisms. + "RSS": {}, +} + +// isBrand reports whether word is a brand. +func isBrand(word string) (string, bool) { + brand, ok := brands[strings.ToLower(word)] + return brand, ok +} + +// brands is the map of brands in the MixedCaps naming convention; +// see https://dmitri.shuralyov.com/idiomatic-go#for-brands-or-words-with-more-than-1-capital-letter-lowercase-all-letters. +// Key is the lower case version of the brand, value is the canonical brand spelling. +// Only add entries that are highly unlikely to be non-brands. +var brands = map[string]string{ + "github": "GitHub", +} diff --git a/vendor/github.com/Laisky/graphql/internal/jsonutil/graphql.go b/vendor/github.com/Laisky/graphql/internal/jsonutil/graphql.go new file mode 100644 index 0000000000..15bae246fd --- /dev/null +++ b/vendor/github.com/Laisky/graphql/internal/jsonutil/graphql.go @@ -0,0 +1,311 @@ +// Package jsonutil provides a function for decoding JSON +// into a GraphQL query data structure. +package jsonutil + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io" + "reflect" + "strings" +) + +// UnmarshalGraphQL parses the JSON-encoded GraphQL response data and stores +// the result in the GraphQL query data structure pointed to by v. +// +// The implementation is created on top of the JSON tokenizer available +// in "encoding/json".Decoder. +func UnmarshalGraphQL(data []byte, v interface{}) error { + dec := json.NewDecoder(bytes.NewReader(data)) + dec.UseNumber() + err := (&decoder{tokenizer: dec}).Decode(v) + if err != nil { + return err + } + tok, err := dec.Token() + switch err { + case io.EOF: + // Expect to get io.EOF. There shouldn't be any more + // tokens left after we've decoded v successfully. + return nil + case nil: + return fmt.Errorf("invalid token '%v' after top-level value", tok) + default: + return err + } +} + +// decoder is a JSON decoder that performs custom unmarshaling behavior +// for GraphQL query data structures. It's implemented on top of a JSON tokenizer. +type decoder struct { + tokenizer interface { + Token() (json.Token, error) + } + + // Stack of what part of input JSON we're in the middle of - objects, arrays. + parseState []json.Delim + + // Stacks of values where to unmarshal. + // The top of each stack is the reflect.Value where to unmarshal next JSON value. + // + // The reason there's more than one stack is because we might be unmarshaling + // a single JSON value into multiple GraphQL fragments or embedded structs, so + // we keep track of them all. + vs [][]reflect.Value +} + +// Decode decodes a single JSON value from d.tokenizer into v. +func (d *decoder) Decode(v interface{}) error { + rv := reflect.ValueOf(v) + if rv.Kind() != reflect.Ptr { + return fmt.Errorf("cannot decode into non-pointer %T", v) + } + d.vs = [][]reflect.Value{{rv.Elem()}} + return d.decode() +} + +// decode decodes a single JSON value from d.tokenizer into d.vs. +func (d *decoder) decode() error { + // The loop invariant is that the top of each d.vs stack + // is where we try to unmarshal the next JSON value we see. + for len(d.vs) > 0 { + tok, err := d.tokenizer.Token() + if err == io.EOF { + return errors.New("unexpected end of JSON input") + } else if err != nil { + return err + } + + switch { + + // Are we inside an object and seeing next key (rather than end of object)? + case d.state() == '{' && tok != json.Delim('}'): + key, ok := tok.(string) + if !ok { + return errors.New("unexpected non-key in JSON input") + } + someFieldExist := false + for i := range d.vs { + v := d.vs[i][len(d.vs[i])-1] + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + var f reflect.Value + if v.Kind() == reflect.Struct { + f = fieldByGraphQLName(v, key) + if f.IsValid() { + someFieldExist = true + } + } + d.vs[i] = append(d.vs[i], f) + } + if !someFieldExist { + return fmt.Errorf("struct field for %q doesn't exist in any of %v places to unmarshal", key, len(d.vs)) + } + + // We've just consumed the current token, which was the key. + // Read the next token, which should be the value, and let the rest of code process it. + tok, err = d.tokenizer.Token() + if err == io.EOF { + return errors.New("unexpected end of JSON input") + } else if err != nil { + return err + } + + // Are we inside an array and seeing next value (rather than end of array)? + case d.state() == '[' && tok != json.Delim(']'): + someSliceExist := false + for i := range d.vs { + v := d.vs[i][len(d.vs[i])-1] + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + var f reflect.Value + if v.Kind() == reflect.Slice { + v.Set(reflect.Append(v, reflect.Zero(v.Type().Elem()))) // v = append(v, T). + f = v.Index(v.Len() - 1) + someSliceExist = true + } + d.vs[i] = append(d.vs[i], f) + } + if !someSliceExist { + return fmt.Errorf("slice doesn't exist in any of %v places to unmarshal", len(d.vs)) + } + } + + switch tok := tok.(type) { + case string, json.Number, bool, nil: + // Value. + + for i := range d.vs { + v := d.vs[i][len(d.vs[i])-1] + if !v.IsValid() { + continue + } + err := unmarshalValue(tok, v) + if err != nil { + return err + } + } + d.popAllVs() + + case json.Delim: + switch tok { + case '{': + // Start of object. + + d.pushState(tok) + + frontier := make([]reflect.Value, len(d.vs)) // Places to look for GraphQL fragments/embedded structs. + for i := range d.vs { + v := d.vs[i][len(d.vs[i])-1] + frontier[i] = v + // TODO: Do this recursively or not? Add a test case if needed. + if v.Kind() == reflect.Ptr && v.IsNil() { + v.Set(reflect.New(v.Type().Elem())) // v = new(T). + } + } + // Find GraphQL fragments/embedded structs recursively, adding to frontier + // as new ones are discovered and exploring them further. + for len(frontier) > 0 { + v := frontier[0] + frontier = frontier[1:] + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + if v.Kind() != reflect.Struct { + continue + } + for i := 0; i < v.NumField(); i++ { + if isGraphQLFragment(v.Type().Field(i)) || v.Type().Field(i).Anonymous { + // Add GraphQL fragment or embedded struct. + d.vs = append(d.vs, []reflect.Value{v.Field(i)}) + frontier = append(frontier, v.Field(i)) + } + } + } + case '[': + // Start of array. + + d.pushState(tok) + + for i := range d.vs { + v := d.vs[i][len(d.vs[i])-1] + // TODO: Confirm this is needed, write a test case. + //if v.Kind() == reflect.Ptr && v.IsNil() { + // v.Set(reflect.New(v.Type().Elem())) // v = new(T). + //} + + // Reset slice to empty (in case it had non-zero initial value). + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + if v.Kind() != reflect.Slice { + continue + } + v.Set(reflect.MakeSlice(v.Type(), 0, 0)) // v = make(T, 0, 0). + } + case '}', ']': + // End of object or array. + d.popAllVs() + d.popState() + default: + return errors.New("unexpected delimiter in JSON input") + } + default: + return errors.New("unexpected token in JSON input") + } + } + return nil +} + +// pushState pushes a new parse state s onto the stack. +func (d *decoder) pushState(s json.Delim) { + d.parseState = append(d.parseState, s) +} + +// popState pops a parse state (already obtained) off the stack. +// The stack must be non-empty. +func (d *decoder) popState() { + d.parseState = d.parseState[:len(d.parseState)-1] +} + +// state reports the parse state on top of stack, or 0 if empty. +func (d *decoder) state() json.Delim { + if len(d.parseState) == 0 { + return 0 + } + return d.parseState[len(d.parseState)-1] +} + +// popAllVs pops from all d.vs stacks, keeping only non-empty ones. +func (d *decoder) popAllVs() { + var nonEmpty [][]reflect.Value + for i := range d.vs { + d.vs[i] = d.vs[i][:len(d.vs[i])-1] + if len(d.vs[i]) > 0 { + nonEmpty = append(nonEmpty, d.vs[i]) + } + } + d.vs = nonEmpty +} + +// fieldByGraphQLName returns an exported struct field of struct v +// that matches GraphQL name, or invalid reflect.Value if none found. +func fieldByGraphQLName(v reflect.Value, name string) reflect.Value { + for i := 0; i < v.NumField(); i++ { + if v.Type().Field(i).PkgPath != "" { + // Skip unexported field. + continue + } + if hasGraphQLName(v.Type().Field(i), name) { + return v.Field(i) + } + } + return reflect.Value{} +} + +// hasGraphQLName reports whether struct field f has GraphQL name. +func hasGraphQLName(f reflect.StructField, name string) bool { + value, ok := f.Tag.Lookup("graphql") + if !ok { + // TODO: caseconv package is relatively slow. Optimize it, then consider using it here. + //return caseconv.MixedCapsToLowerCamelCase(f.Name) == name + return strings.EqualFold(f.Name, name) + } + value = strings.TrimSpace(value) // TODO: Parse better. + if strings.HasPrefix(value, "...") { + // GraphQL fragment. It doesn't have a name. + return false + } + if i := strings.Index(value, "("); i != -1 { + value = value[:i] + } + if i := strings.Index(value, ":"); i != -1 { + value = value[:i] + } + return strings.TrimSpace(value) == name +} + +// isGraphQLFragment reports whether struct field f is a GraphQL fragment. +func isGraphQLFragment(f reflect.StructField) bool { + value, ok := f.Tag.Lookup("graphql") + if !ok { + return false + } + value = strings.TrimSpace(value) // TODO: Parse better. + return strings.HasPrefix(value, "...") +} + +// unmarshalValue unmarshals JSON value into v. +// v must be addressable and not obtained by the use of unexported +// struct fields, otherwise unmarshalValue will panic. +func unmarshalValue(value json.Token, v reflect.Value) error { + b, err := json.Marshal(value) // TODO: Short-circuit (if profiling says it's worth it). + if err != nil { + return err + } + return json.Unmarshal(b, v.Addr().Interface()) +} diff --git a/vendor/github.com/Laisky/graphql/query.go b/vendor/github.com/Laisky/graphql/query.go new file mode 100644 index 0000000000..34423e9951 --- /dev/null +++ b/vendor/github.com/Laisky/graphql/query.go @@ -0,0 +1,131 @@ +package graphql + +import ( + "bytes" + "encoding/json" + "io" + "reflect" + "sort" + + "github.com/Laisky/graphql/ident" +) + +func constructQuery(v interface{}, variables map[string]interface{}) string { + query := query(v) + if len(variables) > 0 { + return "query(" + queryArguments(variables) + ")" + query + } + return query +} + +func constructMutation(v interface{}, variables map[string]interface{}) string { + query := query(v) + if len(variables) > 0 { + return "mutation(" + queryArguments(variables) + ")" + query + } + return "mutation" + query +} + +// queryArguments constructs a minified arguments string for variables. +// +// E.g., map[string]interface{}{"a": Int(123), "b": NewBoolean(true)} -> "$a:Int!$b:Boolean". +func queryArguments(variables map[string]interface{}) string { + // Sort keys in order to produce deterministic output for testing purposes. + // TODO: If tests can be made to work with non-deterministic output, then no need to sort. + keys := make([]string, 0, len(variables)) + for k := range variables { + keys = append(keys, k) + } + sort.Strings(keys) + + var buf bytes.Buffer + for _, k := range keys { + io.WriteString(&buf, "$") + io.WriteString(&buf, k) + io.WriteString(&buf, ":") + writeArgumentType(&buf, reflect.TypeOf(variables[k]), true) + // Don't insert a comma here. + // Commas in GraphQL are insignificant, and we want minified output. + // See https://facebook.github.io/graphql/October2016/#sec-Insignificant-Commas. + } + return buf.String() +} + +// writeArgumentType writes a minified GraphQL type for t to w. +// value indicates whether t is a value (required) type or pointer (optional) type. +// If value is true, then "!" is written at the end of t. +func writeArgumentType(w io.Writer, t reflect.Type, value bool) { + if t.Kind() == reflect.Ptr { + // Pointer is an optional type, so no "!" at the end of the pointer's underlying type. + writeArgumentType(w, t.Elem(), false) + return + } + + switch t.Kind() { + case reflect.Slice, reflect.Array: + // List. E.g., "[Int]". + io.WriteString(w, "[") + writeArgumentType(w, t.Elem(), true) + io.WriteString(w, "]") + default: + // Named type. E.g., "Int". + name := t.Name() + if name == "string" { // HACK: Workaround for https://github.com/shurcooL/githubv4/issues/12 + name = "ID" + } + io.WriteString(w, name) + } + + if value { + // Value is a required type, so add "!" to the end. + io.WriteString(w, "!") + } +} + +// query uses writeQuery to recursively construct +// a minified query string from the provided struct v. +// +// E.g., struct{Foo Int, BarBaz *Boolean} -> "{foo,barBaz}". +func query(v interface{}) string { + var buf bytes.Buffer + writeQuery(&buf, reflect.TypeOf(v), false) + return buf.String() +} + +// writeQuery writes a minified query for t to w. +// If inline is true, the struct fields of t are inlined into parent struct. +func writeQuery(w io.Writer, t reflect.Type, inline bool) { + switch t.Kind() { + case reflect.Ptr, reflect.Slice: + writeQuery(w, t.Elem(), false) + case reflect.Struct: + // If the type implements json.Unmarshaler, it's a scalar. Don't expand it. + if reflect.PtrTo(t).Implements(jsonUnmarshaler) { + return + } + if !inline { + io.WriteString(w, "{") + } + for i := 0; i < t.NumField(); i++ { + if i != 0 { + io.WriteString(w, ",") + } + f := t.Field(i) + value, ok := f.Tag.Lookup("graphql") + inlineField := f.Anonymous && !ok + if !inlineField { + if ok { + io.WriteString(w, value) + } else { + io.WriteString(w, ident.ParseMixedCaps(f.Name).ToLowerCamelCase()) + } + } + writeQuery(w, f.Type, inlineField) + } + if !inline { + io.WriteString(w, "}") + } + } +} + +var jsonUnmarshaler = reflect.TypeOf((*json.Unmarshaler)(nil)).Elem() diff --git a/vendor/github.com/Laisky/graphql/scalar.go b/vendor/github.com/Laisky/graphql/scalar.go new file mode 100644 index 0000000000..306ecc45a9 --- /dev/null +++ b/vendor/github.com/Laisky/graphql/scalar.go @@ -0,0 +1,51 @@ +package graphql + +// Note: These custom types are meant to be used in queries for now. +// But the plan is to switch to using native Go types (string, int, bool, time.Time, etc.). +// See https://github.com/Laisky/githubv4/issues/9 for details. +// +// These custom types currently provide documentation, and their use +// is required for sending outbound queries. However, native Go types +// can be used for unmarshaling. Once https://github.com/Laisky/githubv4/issues/9 +// is resolved, native Go types can completely replace these. + +type ( + // Boolean represents true or false values. + Boolean bool + + // Float represents signed double-precision fractional values as + // specified by IEEE 754. + Float float64 + + // ID represents a unique identifier that is Base64 obfuscated. It + // is often used to refetch an object or as key for a cache. The ID + // type appears in a JSON response as a String; however, it is not + // intended to be human-readable. When expected as an input type, + // any string (such as "VXNlci0xMA==") or integer (such as 4) input + // value will be accepted as an ID. + ID interface{} + + // Int represents non-fractional signed whole numeric values. + // Int can represent values between -(2^31) and 2^31 - 1. + Int int32 + + // String represents textual data as UTF-8 character sequences. + // This type is most often used by GraphQL to represent free-form + // human-readable text. + String string +) + +// NewBoolean is a helper to make a new *Boolean. +func NewBoolean(v Boolean) *Boolean { return &v } + +// NewFloat is a helper to make a new *Float. +func NewFloat(v Float) *Float { return &v } + +// NewID is a helper to make a new *ID. +func NewID(v ID) *ID { return &v } + +// NewInt is a helper to make a new *Int. +func NewInt(v Int) *Int { return &v } + +// NewString is a helper to make a new *String. +func NewString(v String) *String { return &v } diff --git a/vendor/github.com/petergtz/pegomock/.gitignore b/vendor/github.com/petergtz/pegomock/.gitignore index a8b83fdd09..153ff9570f 100644 --- a/vendor/github.com/petergtz/pegomock/.gitignore +++ b/vendor/github.com/petergtz/pegomock/.gitignore @@ -1,5 +1,4 @@ mock_display_test.go -matchers debug.test .vscode *.coverprofile diff --git a/vendor/github.com/petergtz/pegomock/README.md b/vendor/github.com/petergtz/pegomock/README.md index bc2566f38e..56e30dcb04 100644 --- a/vendor/github.com/petergtz/pegomock/README.md +++ b/vendor/github.com/petergtz/pegomock/README.md @@ -13,6 +13,8 @@ go get github.com/petergtz/pegomock/... This will download the package and install an executable `pegomock` in your `$GOPATH/bin`. +See also section[Tracking the pegomock tool in your project](#tracking-the-pegomock-tool-in-your-project) for a per-project control of the tool version. + Getting Started =============== @@ -403,6 +405,46 @@ Install it via: go install github.com/petergtz/pegomock/pegomock ``` +Tracking the pegomock tool in your project +------------------------------------------ + +Go modules allow to pin not only a package but also a tool (that is, an executable). The steps are: + +1. Use a file named `tools.go` with contents similar to this: +```go +// +build tools + +// This file will never be compiled (see the build constraint above); it is +// used to record dependencies on build tools with the Go modules machinery. +// See https://github.com/go-modules-by-example/index/blob/master/010_tools/README.md + +package tools + +import ( + _ "github.com/petergtz/pegomock/pegomock" +) +``` +2. Set `$GOBIN` to a `bin` directory relative to your repo (this defines where tool dependencies will be installed). +2. Install the tool with `go install`: +```console +$ cd /path/to/myproject +$ export GOBIN=$PWD/bin +$ go install github.com/petergtz/pegomock/pegomock +``` +3. Use that `$GOBIN` when invoking `pegomock` for that project: +```console +$ $GOBIN/pegomock ... +``` +or +```console +$ export PATH=$GOBIN:$PATH +$ pegomock ... +``` + +See [Tools as dependencies] for details. + +[Tools as dependencies]: https://github.com/go-modules-by-example/index/blob/master/010_tools/README.md + Generating Mocks ---------------- diff --git a/vendor/github.com/shurcooL/githubv4/.travis.yml b/vendor/github.com/shurcooL/githubv4/.travis.yml new file mode 100644 index 0000000000..437c57db3d --- /dev/null +++ b/vendor/github.com/shurcooL/githubv4/.travis.yml @@ -0,0 +1,16 @@ +sudo: false +language: go +go: + - 1.x + - master +matrix: + allow_failures: + - go: master + fast_finish: true +install: + - # Do nothing. This is needed to prevent default install action "go get -t -v ./..." from happening here (we want it to happen inside script step). +script: + - go get -t -v ./... + - diff -u <(echo -n) <(gofmt -d -s .) + - go vet ./... + - go test -v -race ./... diff --git a/vendor/github.com/shurcooL/githubv4/LICENSE b/vendor/github.com/shurcooL/githubv4/LICENSE new file mode 100644 index 0000000000..ca4c77642d --- /dev/null +++ b/vendor/github.com/shurcooL/githubv4/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Dmitri Shuralyov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/shurcooL/githubv4/README.md b/vendor/github.com/shurcooL/githubv4/README.md new file mode 100644 index 0000000000..319a6428ab --- /dev/null +++ b/vendor/github.com/shurcooL/githubv4/README.md @@ -0,0 +1,408 @@ +githubv4 +======== + +[![Build Status](https://travis-ci.org/shurcooL/githubv4.svg?branch=master)](https://travis-ci.org/shurcooL/githubv4) [![GoDoc](https://godoc.org/github.com/shurcooL/githubv4?status.svg)](https://godoc.org/github.com/shurcooL/githubv4) + +Package `githubv4` is a client library for accessing GitHub GraphQL API v4 (https://developer.github.com/v4/). + +If you're looking for a client library for GitHub REST API v3, the recommended package is [`github.com/google/go-github/github`](https://godoc.org/github.com/google/go-github/github). + +**Status:** In research and development. The API will change when opportunities for improvement are discovered; it is not yet frozen. + +Focus +----- + +- Friendly, simple and powerful API. +- Correctness, high performance and efficiency. +- Support all of GitHub GraphQL API v4 via code generation from schema. + +Installation +------------ + +`githubv4` requires Go version 1.8 or later. + +```bash +go get -u github.com/shurcooL/githubv4 +``` + +Usage +----- + +### Authentication + +GitHub GraphQL API v4 [requires authentication](https://developer.github.com/v4/guides/forming-calls/#authenticating-with-graphql). The `githubv4` package does not directly handle authentication. Instead, when creating a new client, you're expected to pass an `http.Client` that performs authentication. The easiest and recommended way to do this is to use the [`golang.org/x/oauth2`](https://golang.org/x/oauth2) package. You'll need an OAuth token from GitHub (for example, a [personal API token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/)) with the right scopes. Then: + +```Go +import "golang.org/x/oauth2" + +func main() { + src := oauth2.StaticTokenSource( + &oauth2.Token{AccessToken: os.Getenv("GITHUB_TOKEN")}, + ) + httpClient := oauth2.NewClient(context.Background(), src) + + client := githubv4.NewClient(httpClient) + // Use client... +} +``` + +### Simple Query + +To make a query, you need to define a Go type that corresponds to the GitHub GraphQL schema, and contains the fields you're interested in querying. You can look up the GitHub GraphQL schema at https://developer.github.com/v4/query/. + +For example, to make the following GraphQL query: + +```GraphQL +query { + viewer { + login + createdAt + } +} +``` + +You can define this variable: + +```Go +var query struct { + Viewer struct { + Login githubv4.String + CreatedAt githubv4.DateTime + } +} +``` + +Then call `client.Query`, passing a pointer to it: + +```Go +err := client.Query(context.Background(), &query, nil) +if err != nil { + // Handle error. +} +fmt.Println(" Login:", query.Viewer.Login) +fmt.Println("CreatedAt:", query.Viewer.CreatedAt) + +// Output: +// Login: gopher +// CreatedAt: 2017-05-26 21:17:14 +0000 UTC +``` + +### Scalar Types + +For each scalar in the GitHub GraphQL schema listed at https://developer.github.com/v4/scalar/, there is a corresponding Go type in package `githubv4`. + +You can use these types when writing queries: + +```Go +var query struct { + Viewer struct { + Login githubv4.String + CreatedAt githubv4.DateTime + IsBountyHunter githubv4.Boolean + BioHTML githubv4.HTML + WebsiteURL githubv4.URI + } +} +// Call client.Query() and use results in query... +``` + +However, depending on how you're planning to use the results of your query, it's often more convenient to use other Go types. + +The `encoding/json` rules are used for converting individual JSON-encoded fields from a GraphQL response into Go values. See https://godoc.org/encoding/json#Unmarshal for details. The [`json.Unmarshaler`](https://godoc.org/encoding/json#Unmarshaler) interface is respected. + +That means you can simplify the earlier query by using predeclared Go types: + +```Go +// import "time" + +var query struct { + Viewer struct { + Login string // E.g., "gopher". + CreatedAt time.Time // E.g., time.Date(2017, 5, 26, 21, 17, 14, 0, time.UTC). + IsBountyHunter bool // E.g., true. + BioHTML string // E.g., `I am learning GraphQL!`. + WebsiteURL string // E.g., "https://golang.org". + } +} +// Call client.Query() and use results in query... +``` + +The [`DateTime`](https://developer.github.com/v4/scalar/datetime/) scalar is described as "an ISO-8601 encoded UTC date string". If you wanted to fetch in that form without parsing it into a `time.Time`, you can use the `string` type. For example, this would work: + +```Go +// import "html/template" + +type MyBoolean bool + +var query struct { + Viewer struct { + Login string // E.g., "gopher". + CreatedAt string // E.g., "2017-05-26T21:17:14Z". + IsBountyHunter MyBoolean // E.g., MyBoolean(true). + BioHTML template.HTML // E.g., template.HTML(`I am learning GraphQL!`). + WebsiteURL template.URL // E.g., template.URL("https://golang.org"). + } +} +// Call client.Query() and use results in query... +``` + +### Arguments and Variables + +Often, you'll want to specify arguments on some fields. You can use the `graphql` struct field tag for this. + +For example, to make the following GraphQL query: + +```GraphQL +{ + repository(owner: "octocat", name: "Hello-World") { + description + } +} +``` + +You can define this variable: + +```Go +var q struct { + Repository struct { + Description string + } `graphql:"repository(owner: \"octocat\", name: \"Hello-World\")"` +} +``` + +Then call `client.Query`: + +```Go +err := client.Query(context.Background(), &q, nil) +if err != nil { + // Handle error. +} +fmt.Println(q.Repository.Description) + +// Output: +// My first repository on GitHub! +``` + +However, that'll only work if the arguments are constant and known in advance. Otherwise, you will need to make use of variables. Replace the constants in the struct field tag with variable names: + +```Go +// fetchRepoDescription fetches description of repo with owner and name. +func fetchRepoDescription(ctx context.Context, owner, name string) (string, error) { + var q struct { + Repository struct { + Description string + } `graphql:"repository(owner: $owner, name: $name)"` + } +``` + +When sending variables to GraphQL, you need to use exact types that match GraphQL scalar types, otherwise the GraphQL server will return an error. + +So, define a `variables` map with their values that are converted to GraphQL scalar types: + +```Go + variables := map[string]interface{}{ + "owner": githubv4.String(owner), + "name": githubv4.String(name), + } +``` + +Finally, call `client.Query` providing `variables`: + +```Go + err := client.Query(ctx, &q, variables) + return q.Repository.Description, err +} +``` + +### Inline Fragments + +Some GraphQL queries contain inline fragments. You can use the `graphql` struct field tag to express them. + +For example, to make the following GraphQL query: + +```GraphQL +{ + repositoryOwner(login: "github") { + login + ... on Organization { + description + } + ... on User { + bio + } + } +} +``` + +You can define this variable: + +```Go +var q struct { + RepositoryOwner struct { + Login string + Organization struct { + Description string + } `graphql:"... on Organization"` + User struct { + Bio string + } `graphql:"... on User"` + } `graphql:"repositoryOwner(login: \"github\")"` +} +``` + +Alternatively, you can define the struct types corresponding to inline fragments, and use them as embedded fields in your query: + +```Go +type ( + OrganizationFragment struct { + Description string + } + UserFragment struct { + Bio string + } +) + +var q struct { + RepositoryOwner struct { + Login string + OrganizationFragment `graphql:"... on Organization"` + UserFragment `graphql:"... on User"` + } `graphql:"repositoryOwner(login: \"github\")"` +} +``` + +Then call `client.Query`: + +```Go +err := client.Query(context.Background(), &q, nil) +if err != nil { + // Handle error. +} +fmt.Println(q.RepositoryOwner.Login) +fmt.Println(q.RepositoryOwner.Description) +fmt.Println(q.RepositoryOwner.Bio) + +// Output: +// github +// How people build software. +// +``` + +### Pagination + +Imagine you wanted to get a complete list of comments in an issue, and not just the first 10 or so. To do that, you'll need to perform multiple queries and use pagination information. For example: + +```Go +type comment struct { + Body string + Author struct { + Login string + AvatarURL string `graphql:"avatarUrl(size: 72)"` + } + ViewerCanReact bool +} +var q struct { + Repository struct { + Issue struct { + Comments struct { + Nodes []comment + PageInfo struct { + EndCursor githubv4.String + HasNextPage bool + } + } `graphql:"comments(first: 100, after: $commentsCursor)"` // 100 per page. + } `graphql:"issue(number: $issueNumber)"` + } `graphql:"repository(owner: $repositoryOwner, name: $repositoryName)"` +} +variables := map[string]interface{}{ + "repositoryOwner": githubv4.String(owner), + "repositoryName": githubv4.String(name), + "issueNumber": githubv4.Int(issue), + "commentsCursor": (*githubv4.String)(nil), // Null after argument to get first page. +} + +// Get comments from all pages. +var allComments []comment +for { + err := s.clQL.Query(ctx, &q, variables) + if err != nil { + return err + } + allComments = append(allComments, q.Repository.Issue.Comments.Nodes...) + if !q.Repository.Issue.Comments.PageInfo.HasNextPage { + break + } + variables["commentsCursor"] = githubv4.NewString(q.Repository.Issue.Comments.PageInfo.EndCursor) +} +``` + +There is more than one way to perform pagination. Consider additional fields inside [`PageInfo`](https://developer.github.com/v4/object/pageinfo/) object. + +### Mutations + +Mutations often require information that you can only find out by performing a query first. Let's suppose you've already done that. + +For example, to make the following GraphQL mutation: + +```GraphQL +mutation($input: AddReactionInput!) { + addReaction(input: $input) { + reaction { + content + } + subject { + id + } + } +} +variables { + "input": { + "subjectId": "MDU6SXNzdWUyMTc5NTQ0OTc=", + "content": "HOORAY" + } +} +``` + +You can define: + +```Go +var m struct { + AddReaction struct { + Reaction struct { + Content githubv4.ReactionContent + } + Subject struct { + ID githubv4.ID + } + } `graphql:"addReaction(input: $input)"` +} +input := githubv4.AddReactionInput{ + SubjectID: targetIssue.ID, // ID of the target issue from a previous query. + Content: githubv4.ReactionContentHooray, +} +``` + +Then call `client.Mutate`: + +```Go +err := client.Mutate(context.Background(), &m, input, nil) +if err != nil { + // Handle error. +} +fmt.Printf("Added a %v reaction to subject with ID %#v!\n", m.AddReaction.Reaction.Content, m.AddReaction.Subject.ID) + +// Output: +// Added a HOORAY reaction to subject with ID "MDU6SXNzdWUyMTc5NTQ0OTc="! +``` + +Directories +----------- + +| Path | Synopsis | +|-------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------| +| [example/githubv4dev](https://godoc.org/github.com/shurcooL/githubv4/example/githubv4dev) | githubv4dev is a test program currently being used for developing githubv4 package. | + +License +------- + +- [MIT License](LICENSE) diff --git a/vendor/github.com/shurcooL/githubv4/doc.go b/vendor/github.com/shurcooL/githubv4/doc.go new file mode 100644 index 0000000000..0ce1a508a8 --- /dev/null +++ b/vendor/github.com/shurcooL/githubv4/doc.go @@ -0,0 +1,13 @@ +// Package githubv4 is a client library for accessing GitHub +// GraphQL API v4 (https://developer.github.com/v4/). +// +// If you're looking for a client library for GitHub REST API v3, +// the recommended package is github.com/google/go-github/github. +// +// Status: In active early research and development. The API will change when +// opportunities for improvement are discovered; it is not yet frozen. +// +// For now, see README for more details. +package githubv4 // import "github.com/shurcooL/githubv4" + +//go:generate go run gen.go diff --git a/vendor/github.com/shurcooL/githubv4/enum.go b/vendor/github.com/shurcooL/githubv4/enum.go new file mode 100644 index 0000000000..46fbeb0da1 --- /dev/null +++ b/vendor/github.com/shurcooL/githubv4/enum.go @@ -0,0 +1,1382 @@ +// Code generated by gen.go; DO NOT EDIT. + +package githubv4 + +// ActionExecutionCapabilitySetting represents the possible capabilities for action executions setting. +type ActionExecutionCapabilitySetting string + +// The possible capabilities for action executions setting. +const ( + ActionExecutionCapabilitySettingDisabled ActionExecutionCapabilitySetting = "DISABLED" // All action executions are disabled. + ActionExecutionCapabilitySettingAllActions ActionExecutionCapabilitySetting = "ALL_ACTIONS" // All action executions are enabled. + ActionExecutionCapabilitySettingLocalActionsOnly ActionExecutionCapabilitySetting = "LOCAL_ACTIONS_ONLY" // Only actions defined within the repo are allowed. + ActionExecutionCapabilitySettingNoPolicy ActionExecutionCapabilitySetting = "NO_POLICY" // Organization administrators action execution capabilities. +) + +// AuditLogOrderField represents properties by which Audit Log connections can be ordered. +type AuditLogOrderField string + +// Properties by which Audit Log connections can be ordered. +const ( + AuditLogOrderFieldCreatedAt AuditLogOrderField = "CREATED_AT" // Order audit log entries by timestamp. +) + +// CollaboratorAffiliation represents collaborators affiliation level with a subject. +type CollaboratorAffiliation string + +// Collaborators affiliation level with a subject. +const ( + CollaboratorAffiliationOutside CollaboratorAffiliation = "OUTSIDE" // All outside collaborators of an organization-owned subject. + CollaboratorAffiliationDirect CollaboratorAffiliation = "DIRECT" // All collaborators with permissions to an organization-owned subject, regardless of organization membership status. + CollaboratorAffiliationAll CollaboratorAffiliation = "ALL" // All collaborators the authenticated user can see. +) + +// CommentAuthorAssociation represents a comment author association with repository. +type CommentAuthorAssociation string + +// A comment author association with repository. +const ( + CommentAuthorAssociationMember CommentAuthorAssociation = "MEMBER" // Author is a member of the organization that owns the repository. + CommentAuthorAssociationOwner CommentAuthorAssociation = "OWNER" // Author is the owner of the repository. + CommentAuthorAssociationCollaborator CommentAuthorAssociation = "COLLABORATOR" // Author has been invited to collaborate on the repository. + CommentAuthorAssociationContributor CommentAuthorAssociation = "CONTRIBUTOR" // Author has previously committed to the repository. + CommentAuthorAssociationFirstTimeContributor CommentAuthorAssociation = "FIRST_TIME_CONTRIBUTOR" // Author has not previously committed to the repository. + CommentAuthorAssociationFirstTimer CommentAuthorAssociation = "FIRST_TIMER" // Author has not previously committed to GitHub. + CommentAuthorAssociationNone CommentAuthorAssociation = "NONE" // Author has no association with the repository. +) + +// CommentCannotUpdateReason represents the possible errors that will prevent a user from updating a comment. +type CommentCannotUpdateReason string + +// The possible errors that will prevent a user from updating a comment. +const ( + CommentCannotUpdateReasonArchived CommentCannotUpdateReason = "ARCHIVED" // Unable to create comment because repository is archived. + CommentCannotUpdateReasonInsufficientAccess CommentCannotUpdateReason = "INSUFFICIENT_ACCESS" // You must be the author or have write access to this repository to update this comment. + CommentCannotUpdateReasonLocked CommentCannotUpdateReason = "LOCKED" // Unable to create comment because issue is locked. + CommentCannotUpdateReasonLoginRequired CommentCannotUpdateReason = "LOGIN_REQUIRED" // You must be logged in to update this comment. + CommentCannotUpdateReasonMaintenance CommentCannotUpdateReason = "MAINTENANCE" // Repository is under maintenance. + CommentCannotUpdateReasonVerifiedEmailRequired CommentCannotUpdateReason = "VERIFIED_EMAIL_REQUIRED" // At least one email address must be verified to update this comment. + CommentCannotUpdateReasonDenied CommentCannotUpdateReason = "DENIED" // You cannot update this comment. +) + +// CommitContributionOrderField represents properties by which commit contribution connections can be ordered. +type CommitContributionOrderField string + +// Properties by which commit contribution connections can be ordered. +const ( + CommitContributionOrderFieldOccurredAt CommitContributionOrderField = "OCCURRED_AT" // Order commit contributions by when they were made. + CommitContributionOrderFieldCommitCount CommitContributionOrderField = "COMMIT_COUNT" // Order commit contributions by how many commits they represent. +) + +// ContributionOrderField represents properties by which contribution connections can be ordered. +type ContributionOrderField string + +// Properties by which contribution connections can be ordered. +const ( + ContributionOrderFieldOccurredAt ContributionOrderField = "OCCURRED_AT" // Order contributions by when they were made. +) + +// DefaultRepositoryPermissionField represents the possible default permissions for repositories. +type DefaultRepositoryPermissionField string + +// The possible default permissions for repositories. +const ( + DefaultRepositoryPermissionFieldNone DefaultRepositoryPermissionField = "NONE" // No access. + DefaultRepositoryPermissionFieldRead DefaultRepositoryPermissionField = "READ" // Can read repos by default. + DefaultRepositoryPermissionFieldWrite DefaultRepositoryPermissionField = "WRITE" // Can read and write repos by default. + DefaultRepositoryPermissionFieldAdmin DefaultRepositoryPermissionField = "ADMIN" // Can read, write, and administrate repos by default. +) + +// DeploymentOrderField represents properties by which deployment connections can be ordered. +type DeploymentOrderField string + +// Properties by which deployment connections can be ordered. +const ( + DeploymentOrderFieldCreatedAt DeploymentOrderField = "CREATED_AT" // Order collection by creation time. +) + +// DeploymentState represents the possible states in which a deployment can be. +type DeploymentState string + +// The possible states in which a deployment can be. +const ( + DeploymentStateAbandoned DeploymentState = "ABANDONED" // The pending deployment was not updated after 30 minutes. + DeploymentStateActive DeploymentState = "ACTIVE" // The deployment is currently active. + DeploymentStateDestroyed DeploymentState = "DESTROYED" // An inactive transient deployment. + DeploymentStateError DeploymentState = "ERROR" // The deployment experienced an error. + DeploymentStateFailure DeploymentState = "FAILURE" // The deployment has failed. + DeploymentStateInactive DeploymentState = "INACTIVE" // The deployment is inactive. + DeploymentStatePending DeploymentState = "PENDING" // The deployment is pending. + DeploymentStateQueued DeploymentState = "QUEUED" // The deployment has queued. + DeploymentStateInProgress DeploymentState = "IN_PROGRESS" // The deployment is in progress. +) + +// DeploymentStatusState represents the possible states for a deployment status. +type DeploymentStatusState string + +// The possible states for a deployment status. +const ( + DeploymentStatusStatePending DeploymentStatusState = "PENDING" // The deployment is pending. + DeploymentStatusStateSuccess DeploymentStatusState = "SUCCESS" // The deployment was successful. + DeploymentStatusStateFailure DeploymentStatusState = "FAILURE" // The deployment has failed. + DeploymentStatusStateInactive DeploymentStatusState = "INACTIVE" // The deployment is inactive. + DeploymentStatusStateError DeploymentStatusState = "ERROR" // The deployment experienced an error. + DeploymentStatusStateQueued DeploymentStatusState = "QUEUED" // The deployment is queued. + DeploymentStatusStateInProgress DeploymentStatusState = "IN_PROGRESS" // The deployment is in progress. +) + +// EnterpriseAdministratorInvitationOrderField represents properties by which enterprise administrator invitation connections can be ordered. +type EnterpriseAdministratorInvitationOrderField string + +// Properties by which enterprise administrator invitation connections can be ordered. +const ( + EnterpriseAdministratorInvitationOrderFieldCreatedAt EnterpriseAdministratorInvitationOrderField = "CREATED_AT" // Order enterprise administrator member invitations by creation time. +) + +// EnterpriseAdministratorRole represents the possible administrator roles in an enterprise account. +type EnterpriseAdministratorRole string + +// The possible administrator roles in an enterprise account. +const ( + EnterpriseAdministratorRoleOwner EnterpriseAdministratorRole = "OWNER" // Represents an owner of the enterprise account. + EnterpriseAdministratorRoleBillingManager EnterpriseAdministratorRole = "BILLING_MANAGER" // Represents a billing manager of the enterprise account. +) + +// EnterpriseDefaultRepositoryPermissionSettingValue represents the possible values for the enterprise default repository permission setting. +type EnterpriseDefaultRepositoryPermissionSettingValue string + +// The possible values for the enterprise default repository permission setting. +const ( + EnterpriseDefaultRepositoryPermissionSettingValueNoPolicy EnterpriseDefaultRepositoryPermissionSettingValue = "NO_POLICY" // Organizations in the enterprise choose default repository permissions for their members. + EnterpriseDefaultRepositoryPermissionSettingValueAdmin EnterpriseDefaultRepositoryPermissionSettingValue = "ADMIN" // Organization members will be able to clone, pull, push, and add new collaborators to all organization repositories. + EnterpriseDefaultRepositoryPermissionSettingValueWrite EnterpriseDefaultRepositoryPermissionSettingValue = "WRITE" // Organization members will be able to clone, pull, and push all organization repositories. + EnterpriseDefaultRepositoryPermissionSettingValueRead EnterpriseDefaultRepositoryPermissionSettingValue = "READ" // Organization members will be able to clone and pull all organization repositories. + EnterpriseDefaultRepositoryPermissionSettingValueNone EnterpriseDefaultRepositoryPermissionSettingValue = "NONE" // Organization members will only be able to clone and pull public repositories. +) + +// EnterpriseEnabledDisabledSettingValue represents the possible values for an enabled/disabled enterprise setting. +type EnterpriseEnabledDisabledSettingValue string + +// The possible values for an enabled/disabled enterprise setting. +const ( + EnterpriseEnabledDisabledSettingValueEnabled EnterpriseEnabledDisabledSettingValue = "ENABLED" // The setting is enabled for organizations in the enterprise. + EnterpriseEnabledDisabledSettingValueDisabled EnterpriseEnabledDisabledSettingValue = "DISABLED" // The setting is disabled for organizations in the enterprise. + EnterpriseEnabledDisabledSettingValueNoPolicy EnterpriseEnabledDisabledSettingValue = "NO_POLICY" // There is no policy set for organizations in the enterprise. +) + +// EnterpriseEnabledSettingValue represents the possible values for an enabled/no policy enterprise setting. +type EnterpriseEnabledSettingValue string + +// The possible values for an enabled/no policy enterprise setting. +const ( + EnterpriseEnabledSettingValueEnabled EnterpriseEnabledSettingValue = "ENABLED" // The setting is enabled for organizations in the enterprise. + EnterpriseEnabledSettingValueNoPolicy EnterpriseEnabledSettingValue = "NO_POLICY" // There is no policy set for organizations in the enterprise. +) + +// EnterpriseMemberOrderField represents properties by which enterprise member connections can be ordered. +type EnterpriseMemberOrderField string + +// Properties by which enterprise member connections can be ordered. +const ( + EnterpriseMemberOrderFieldLogin EnterpriseMemberOrderField = "LOGIN" // Order enterprise members by login. + EnterpriseMemberOrderFieldCreatedAt EnterpriseMemberOrderField = "CREATED_AT" // Order enterprise members by creation time. +) + +// EnterpriseMembersCanCreateRepositoriesSettingValue represents the possible values for the enterprise members can create repositories setting. +type EnterpriseMembersCanCreateRepositoriesSettingValue string + +// The possible values for the enterprise members can create repositories setting. +const ( + EnterpriseMembersCanCreateRepositoriesSettingValueNoPolicy EnterpriseMembersCanCreateRepositoriesSettingValue = "NO_POLICY" // Organization administrators choose whether to allow members to create repositories. + EnterpriseMembersCanCreateRepositoriesSettingValueAll EnterpriseMembersCanCreateRepositoriesSettingValue = "ALL" // Members will be able to create public and private repositories. + EnterpriseMembersCanCreateRepositoriesSettingValuePublic EnterpriseMembersCanCreateRepositoriesSettingValue = "PUBLIC" // Members will be able to create only public repositories. + EnterpriseMembersCanCreateRepositoriesSettingValuePrivate EnterpriseMembersCanCreateRepositoriesSettingValue = "PRIVATE" // Members will be able to create only private repositories. + EnterpriseMembersCanCreateRepositoriesSettingValueDisabled EnterpriseMembersCanCreateRepositoriesSettingValue = "DISABLED" // Members will not be able to create public or private repositories. +) + +// EnterpriseMembersCanMakePurchasesSettingValue represents the possible values for the members can make purchases setting. +type EnterpriseMembersCanMakePurchasesSettingValue string + +// The possible values for the members can make purchases setting. +const ( + EnterpriseMembersCanMakePurchasesSettingValueEnabled EnterpriseMembersCanMakePurchasesSettingValue = "ENABLED" // The setting is enabled for organizations in the enterprise. + EnterpriseMembersCanMakePurchasesSettingValueDisabled EnterpriseMembersCanMakePurchasesSettingValue = "DISABLED" // The setting is disabled for organizations in the enterprise. +) + +// EnterpriseMembershipType represents the possible values we have for filtering Platform::Objects::User#enterprises. +type EnterpriseMembershipType string + +// The possible values we have for filtering Platform::Objects::User#enterprises. +const ( + EnterpriseMembershipTypeAll EnterpriseMembershipType = "ALL" // Returns all enterprises in which the user is a member, admin, or billing manager. + EnterpriseMembershipTypeAdmin EnterpriseMembershipType = "ADMIN" // Returns all enterprises in which the user is an admin. + EnterpriseMembershipTypeBillingManager EnterpriseMembershipType = "BILLING_MANAGER" // Returns all enterprises in which the user is a billing manager. + EnterpriseMembershipTypeOrgMembership EnterpriseMembershipType = "ORG_MEMBERSHIP" // Returns all enterprises in which the user is a member of an org that is owned by the enterprise. +) + +// EnterpriseOrderField represents properties by which enterprise connections can be ordered. +type EnterpriseOrderField string + +// Properties by which enterprise connections can be ordered. +const ( + EnterpriseOrderFieldName EnterpriseOrderField = "NAME" // Order enterprises by name. +) + +// EnterpriseServerInstallationOrderField represents properties by which Enterprise Server installation connections can be ordered. +type EnterpriseServerInstallationOrderField string + +// Properties by which Enterprise Server installation connections can be ordered. +const ( + EnterpriseServerInstallationOrderFieldHostName EnterpriseServerInstallationOrderField = "HOST_NAME" // Order Enterprise Server installations by host name. + EnterpriseServerInstallationOrderFieldCustomerName EnterpriseServerInstallationOrderField = "CUSTOMER_NAME" // Order Enterprise Server installations by customer name. + EnterpriseServerInstallationOrderFieldCreatedAt EnterpriseServerInstallationOrderField = "CREATED_AT" // Order Enterprise Server installations by creation time. +) + +// EnterpriseServerUserAccountEmailOrderField represents properties by which Enterprise Server user account email connections can be ordered. +type EnterpriseServerUserAccountEmailOrderField string + +// Properties by which Enterprise Server user account email connections can be ordered. +const ( + EnterpriseServerUserAccountEmailOrderFieldEmail EnterpriseServerUserAccountEmailOrderField = "EMAIL" // Order emails by email. +) + +// EnterpriseServerUserAccountOrderField represents properties by which Enterprise Server user account connections can be ordered. +type EnterpriseServerUserAccountOrderField string + +// Properties by which Enterprise Server user account connections can be ordered. +const ( + EnterpriseServerUserAccountOrderFieldLogin EnterpriseServerUserAccountOrderField = "LOGIN" // Order user accounts by login. + EnterpriseServerUserAccountOrderFieldRemoteCreatedAt EnterpriseServerUserAccountOrderField = "REMOTE_CREATED_AT" // Order user accounts by creation time on the Enterprise Server installation. +) + +// EnterpriseServerUserAccountsUploadOrderField represents properties by which Enterprise Server user accounts upload connections can be ordered. +type EnterpriseServerUserAccountsUploadOrderField string + +// Properties by which Enterprise Server user accounts upload connections can be ordered. +const ( + EnterpriseServerUserAccountsUploadOrderFieldCreatedAt EnterpriseServerUserAccountsUploadOrderField = "CREATED_AT" // Order user accounts uploads by creation time. +) + +// EnterpriseServerUserAccountsUploadSyncState represents synchronization state of the Enterprise Server user accounts upload. +type EnterpriseServerUserAccountsUploadSyncState string + +// Synchronization state of the Enterprise Server user accounts upload. +const ( + EnterpriseServerUserAccountsUploadSyncStatePending EnterpriseServerUserAccountsUploadSyncState = "PENDING" // The synchronization of the upload is pending. + EnterpriseServerUserAccountsUploadSyncStateSuccess EnterpriseServerUserAccountsUploadSyncState = "SUCCESS" // The synchronization of the upload succeeded. + EnterpriseServerUserAccountsUploadSyncStateFailure EnterpriseServerUserAccountsUploadSyncState = "FAILURE" // The synchronization of the upload failed. +) + +// EnterpriseUserAccountMembershipRole represents the possible roles for enterprise membership. +type EnterpriseUserAccountMembershipRole string + +// The possible roles for enterprise membership. +const ( + EnterpriseUserAccountMembershipRoleMember EnterpriseUserAccountMembershipRole = "MEMBER" // The user is a member of the enterprise membership. + EnterpriseUserAccountMembershipRoleOwner EnterpriseUserAccountMembershipRole = "OWNER" // The user is an owner of the enterprise membership. +) + +// EnterpriseUserDeployment represents the possible GitHub Enterprise deployments where this user can exist. +type EnterpriseUserDeployment string + +// The possible GitHub Enterprise deployments where this user can exist. +const ( + EnterpriseUserDeploymentCloud EnterpriseUserDeployment = "CLOUD" // The user is part of a GitHub Enterprise Cloud deployment. + EnterpriseUserDeploymentServer EnterpriseUserDeployment = "SERVER" // The user is part of a GitHub Enterprise Server deployment. +) + +// FundingPlatform represents the possible funding platforms for repository funding links. +type FundingPlatform string + +// The possible funding platforms for repository funding links. +const ( + FundingPlatformGitHub FundingPlatform = "GITHUB" // GitHub funding platform. + FundingPlatformPatreon FundingPlatform = "PATREON" // Patreon funding platform. + FundingPlatformOpenCollective FundingPlatform = "OPEN_COLLECTIVE" // Open Collective funding platform. + FundingPlatformKoFi FundingPlatform = "KO_FI" // Ko-fi funding platform. + FundingPlatformTidelift FundingPlatform = "TIDELIFT" // Tidelift funding platform. + FundingPlatformCommunityBridge FundingPlatform = "COMMUNITY_BRIDGE" // Community Bridge funding platform. + FundingPlatformLiberapay FundingPlatform = "LIBERAPAY" // Liberapay funding platform. + FundingPlatformIssuehunt FundingPlatform = "ISSUEHUNT" // IssueHunt funding platform. + FundingPlatformOtechie FundingPlatform = "OTECHIE" // Otechie funding platform. + FundingPlatformCustom FundingPlatform = "CUSTOM" // Custom funding platform. +) + +// GistOrderField represents properties by which gist connections can be ordered. +type GistOrderField string + +// Properties by which gist connections can be ordered. +const ( + GistOrderFieldCreatedAt GistOrderField = "CREATED_AT" // Order gists by creation time. + GistOrderFieldUpdatedAt GistOrderField = "UPDATED_AT" // Order gists by update time. + GistOrderFieldPushedAt GistOrderField = "PUSHED_AT" // Order gists by push time. +) + +// GistPrivacy represents the privacy of a Gist. +type GistPrivacy string + +// The privacy of a Gist. +const ( + GistPrivacyPublic GistPrivacy = "PUBLIC" // Public. + GistPrivacySecret GistPrivacy = "SECRET" // Secret. + GistPrivacyAll GistPrivacy = "ALL" // Gists that are public and secret. +) + +// GitSignatureState represents the state of a Git signature. +type GitSignatureState string + +// The state of a Git signature. +const ( + GitSignatureStateValid GitSignatureState = "VALID" // Valid signature and verified by GitHub. + GitSignatureStateInvalid GitSignatureState = "INVALID" // Invalid signature. + GitSignatureStateMalformedSig GitSignatureState = "MALFORMED_SIG" // Malformed signature. + GitSignatureStateUnknownKey GitSignatureState = "UNKNOWN_KEY" // Key used for signing not known to GitHub. + GitSignatureStateBadEmail GitSignatureState = "BAD_EMAIL" // Invalid email used for signing. + GitSignatureStateUnverifiedEmail GitSignatureState = "UNVERIFIED_EMAIL" // Email used for signing unverified on GitHub. + GitSignatureStateNoUser GitSignatureState = "NO_USER" // Email used for signing not known to GitHub. + GitSignatureStateUnknownSigType GitSignatureState = "UNKNOWN_SIG_TYPE" // Unknown signature type. + GitSignatureStateUnsigned GitSignatureState = "UNSIGNED" // Unsigned. + GitSignatureStateGpgverifyUnavailable GitSignatureState = "GPGVERIFY_UNAVAILABLE" // Internal error - the GPG verification service is unavailable at the moment. + GitSignatureStateGpgverifyError GitSignatureState = "GPGVERIFY_ERROR" // Internal error - the GPG verification service misbehaved. + GitSignatureStateNotSigningKey GitSignatureState = "NOT_SIGNING_KEY" // The usage flags for the key that signed this don't allow signing. + GitSignatureStateExpiredKey GitSignatureState = "EXPIRED_KEY" // Signing key expired. + GitSignatureStateOcspPending GitSignatureState = "OCSP_PENDING" // Valid signature, pending certificate revocation checking. + GitSignatureStateOcspError GitSignatureState = "OCSP_ERROR" // Valid siganture, though certificate revocation check failed. + GitSignatureStateBadCert GitSignatureState = "BAD_CERT" // The signing certificate or its chain could not be verified. + GitSignatureStateOcspRevoked GitSignatureState = "OCSP_REVOKED" // One or more certificates in chain has been revoked. +) + +// IdentityProviderConfigurationState represents the possible states in which authentication can be configured with an identity provider. +type IdentityProviderConfigurationState string + +// The possible states in which authentication can be configured with an identity provider. +const ( + IdentityProviderConfigurationStateEnforced IdentityProviderConfigurationState = "ENFORCED" // Authentication with an identity provider is configured and enforced. + IdentityProviderConfigurationStateConfigured IdentityProviderConfigurationState = "CONFIGURED" // Authentication with an identity provider is configured but not enforced. + IdentityProviderConfigurationStateUnconfigured IdentityProviderConfigurationState = "UNCONFIGURED" // Authentication with an identity provider is not configured. +) + +// IssueOrderField represents properties by which issue connections can be ordered. +type IssueOrderField string + +// Properties by which issue connections can be ordered. +const ( + IssueOrderFieldCreatedAt IssueOrderField = "CREATED_AT" // Order issues by creation time. + IssueOrderFieldUpdatedAt IssueOrderField = "UPDATED_AT" // Order issues by update time. + IssueOrderFieldComments IssueOrderField = "COMMENTS" // Order issues by comment count. +) + +// IssuePubSubTopic represents the possible PubSub channels for an issue. +type IssuePubSubTopic string + +// The possible PubSub channels for an issue. +const ( + IssuePubSubTopicUpdated IssuePubSubTopic = "UPDATED" // The channel ID for observing issue updates. + IssuePubSubTopicMarkasread IssuePubSubTopic = "MARKASREAD" // The channel ID for marking an issue as read. + IssuePubSubTopicTimeline IssuePubSubTopic = "TIMELINE" // The channel ID for updating items on the issue timeline. + IssuePubSubTopicState IssuePubSubTopic = "STATE" // The channel ID for observing issue state updates. +) + +// IssueState represents the possible states of an issue. +type IssueState string + +// The possible states of an issue. +const ( + IssueStateOpen IssueState = "OPEN" // An issue that is still open. + IssueStateClosed IssueState = "CLOSED" // An issue that has been closed. +) + +// IssueTimelineItemsItemType represents the possible item types found in a timeline. +type IssueTimelineItemsItemType string + +// The possible item types found in a timeline. +const ( + IssueTimelineItemsItemTypeIssueComment IssueTimelineItemsItemType = "ISSUE_COMMENT" // Represents a comment on an Issue. + IssueTimelineItemsItemTypeCrossReferencedEvent IssueTimelineItemsItemType = "CROSS_REFERENCED_EVENT" // Represents a mention made by one issue or pull request to another. + IssueTimelineItemsItemTypeAddedToProjectEvent IssueTimelineItemsItemType = "ADDED_TO_PROJECT_EVENT" // Represents a 'added_to_project' event on a given issue or pull request. + IssueTimelineItemsItemTypeAssignedEvent IssueTimelineItemsItemType = "ASSIGNED_EVENT" // Represents an 'assigned' event on any assignable object. + IssueTimelineItemsItemTypeClosedEvent IssueTimelineItemsItemType = "CLOSED_EVENT" // Represents a 'closed' event on any `Closable`. + IssueTimelineItemsItemTypeCommentDeletedEvent IssueTimelineItemsItemType = "COMMENT_DELETED_EVENT" // Represents a 'comment_deleted' event on a given issue or pull request. + IssueTimelineItemsItemTypeConvertedNoteToIssueEvent IssueTimelineItemsItemType = "CONVERTED_NOTE_TO_ISSUE_EVENT" // Represents a 'converted_note_to_issue' event on a given issue or pull request. + IssueTimelineItemsItemTypeDemilestonedEvent IssueTimelineItemsItemType = "DEMILESTONED_EVENT" // Represents a 'demilestoned' event on a given issue or pull request. + IssueTimelineItemsItemTypeLabeledEvent IssueTimelineItemsItemType = "LABELED_EVENT" // Represents a 'labeled' event on a given issue or pull request. + IssueTimelineItemsItemTypeLockedEvent IssueTimelineItemsItemType = "LOCKED_EVENT" // Represents a 'locked' event on a given issue or pull request. + IssueTimelineItemsItemTypeMarkedAsDuplicateEvent IssueTimelineItemsItemType = "MARKED_AS_DUPLICATE_EVENT" // Represents a 'marked_as_duplicate' event on a given issue or pull request. + IssueTimelineItemsItemTypeMentionedEvent IssueTimelineItemsItemType = "MENTIONED_EVENT" // Represents a 'mentioned' event on a given issue or pull request. + IssueTimelineItemsItemTypeMilestonedEvent IssueTimelineItemsItemType = "MILESTONED_EVENT" // Represents a 'milestoned' event on a given issue or pull request. + IssueTimelineItemsItemTypeMovedColumnsInProjectEvent IssueTimelineItemsItemType = "MOVED_COLUMNS_IN_PROJECT_EVENT" // Represents a 'moved_columns_in_project' event on a given issue or pull request. + IssueTimelineItemsItemTypePinnedEvent IssueTimelineItemsItemType = "PINNED_EVENT" // Represents a 'pinned' event on a given issue or pull request. + IssueTimelineItemsItemTypeReferencedEvent IssueTimelineItemsItemType = "REFERENCED_EVENT" // Represents a 'referenced' event on a given `ReferencedSubject`. + IssueTimelineItemsItemTypeRemovedFromProjectEvent IssueTimelineItemsItemType = "REMOVED_FROM_PROJECT_EVENT" // Represents a 'removed_from_project' event on a given issue or pull request. + IssueTimelineItemsItemTypeRenamedTitleEvent IssueTimelineItemsItemType = "RENAMED_TITLE_EVENT" // Represents a 'renamed' event on a given issue or pull request. + IssueTimelineItemsItemTypeReopenedEvent IssueTimelineItemsItemType = "REOPENED_EVENT" // Represents a 'reopened' event on any `Closable`. + IssueTimelineItemsItemTypeSubscribedEvent IssueTimelineItemsItemType = "SUBSCRIBED_EVENT" // Represents a 'subscribed' event on a given `Subscribable`. + IssueTimelineItemsItemTypeTransferredEvent IssueTimelineItemsItemType = "TRANSFERRED_EVENT" // Represents a 'transferred' event on a given issue or pull request. + IssueTimelineItemsItemTypeUnassignedEvent IssueTimelineItemsItemType = "UNASSIGNED_EVENT" // Represents an 'unassigned' event on any assignable object. + IssueTimelineItemsItemTypeUnlabeledEvent IssueTimelineItemsItemType = "UNLABELED_EVENT" // Represents an 'unlabeled' event on a given issue or pull request. + IssueTimelineItemsItemTypeUnlockedEvent IssueTimelineItemsItemType = "UNLOCKED_EVENT" // Represents an 'unlocked' event on a given issue or pull request. + IssueTimelineItemsItemTypeUserBlockedEvent IssueTimelineItemsItemType = "USER_BLOCKED_EVENT" // Represents a 'user_blocked' event on a given user. + IssueTimelineItemsItemTypeUnpinnedEvent IssueTimelineItemsItemType = "UNPINNED_EVENT" // Represents an 'unpinned' event on a given issue or pull request. + IssueTimelineItemsItemTypeUnsubscribedEvent IssueTimelineItemsItemType = "UNSUBSCRIBED_EVENT" // Represents an 'unsubscribed' event on a given `Subscribable`. +) + +// LanguageOrderField represents properties by which language connections can be ordered. +type LanguageOrderField string + +// Properties by which language connections can be ordered. +const ( + LanguageOrderFieldSize LanguageOrderField = "SIZE" // Order languages by the size of all files containing the language. +) + +// LockReason represents the possible reasons that an issue or pull request was locked. +type LockReason string + +// The possible reasons that an issue or pull request was locked. +const ( + LockReasonOffTopic LockReason = "OFF_TOPIC" // The issue or pull request was locked because the conversation was off-topic. + LockReasonTooHeated LockReason = "TOO_HEATED" // The issue or pull request was locked because the conversation was too heated. + LockReasonResolved LockReason = "RESOLVED" // The issue or pull request was locked because the conversation was resolved. + LockReasonSpam LockReason = "SPAM" // The issue or pull request was locked because the conversation was spam. +) + +// MergeableState represents whether or not a PullRequest can be merged. +type MergeableState string + +// Whether or not a PullRequest can be merged. +const ( + MergeableStateMergeable MergeableState = "MERGEABLE" // The pull request can be merged. + MergeableStateConflicting MergeableState = "CONFLICTING" // The pull request cannot be merged due to merge conflicts. + MergeableStateUnknown MergeableState = "UNKNOWN" // The mergeability of the pull request is still being calculated. +) + +// MilestoneOrderField represents properties by which milestone connections can be ordered. +type MilestoneOrderField string + +// Properties by which milestone connections can be ordered. +const ( + MilestoneOrderFieldDueDate MilestoneOrderField = "DUE_DATE" // Order milestones by when they are due. + MilestoneOrderFieldCreatedAt MilestoneOrderField = "CREATED_AT" // Order milestones by when they were created. + MilestoneOrderFieldUpdatedAt MilestoneOrderField = "UPDATED_AT" // Order milestones by when they were last updated. + MilestoneOrderFieldNumber MilestoneOrderField = "NUMBER" // Order milestones by their number. +) + +// MilestoneState represents the possible states of a milestone. +type MilestoneState string + +// The possible states of a milestone. +const ( + MilestoneStateOpen MilestoneState = "OPEN" // A milestone that is still open. + MilestoneStateClosed MilestoneState = "CLOSED" // A milestone that has been closed. +) + +// OauthApplicationCreateAuditEntryState represents the state of an OAuth Application when it was created. +type OauthApplicationCreateAuditEntryState string + +// The state of an OAuth Application when it was created. +const ( + OauthApplicationCreateAuditEntryStateActive OauthApplicationCreateAuditEntryState = "ACTIVE" // The OAuth Application was active and allowed to have OAuth Accesses. + OauthApplicationCreateAuditEntryStateSuspended OauthApplicationCreateAuditEntryState = "SUSPENDED" // The OAuth Application was suspended from generating OAuth Accesses due to abuse or security concerns. + OauthApplicationCreateAuditEntryStatePendingDeletion OauthApplicationCreateAuditEntryState = "PENDING_DELETION" // The OAuth Application was in the process of being deleted. +) + +// OauthApplicationRevokeTokensAuditEntryState represents the state of an OAuth Application when its tokens were revoked. +type OauthApplicationRevokeTokensAuditEntryState string + +// The state of an OAuth Application when its tokens were revoked. +const ( + OauthApplicationRevokeTokensAuditEntryStateActive OauthApplicationRevokeTokensAuditEntryState = "ACTIVE" // The OAuth Application was active and allowed to have OAuth Accesses. + OauthApplicationRevokeTokensAuditEntryStateSuspended OauthApplicationRevokeTokensAuditEntryState = "SUSPENDED" // The OAuth Application was suspended from generating OAuth Accesses due to abuse or security concerns. + OauthApplicationRevokeTokensAuditEntryStatePendingDeletion OauthApplicationRevokeTokensAuditEntryState = "PENDING_DELETION" // The OAuth Application was in the process of being deleted. +) + +// OperationType represents the corresponding operation type for the action. +type OperationType string + +// The corresponding operation type for the action. +const ( + OperationTypeAccess OperationType = "ACCESS" // An existing resource was accessed. + OperationTypeAuthentication OperationType = "AUTHENTICATION" // A resource performed an authentication event. + OperationTypeCreate OperationType = "CREATE" // A new resource was created. + OperationTypeModify OperationType = "MODIFY" // An existing resource was modified. + OperationTypeRemove OperationType = "REMOVE" // An existing resource was removed. + OperationTypeRestore OperationType = "RESTORE" // An existing resource was restored. + OperationTypeTransfer OperationType = "TRANSFER" // An existing resource was transferred between multiple resources. +) + +// OrderDirection represents possible directions in which to order a list of items when provided an `orderBy` argument. +type OrderDirection string + +// Possible directions in which to order a list of items when provided an `orderBy` argument. +const ( + OrderDirectionAsc OrderDirection = "ASC" // Specifies an ascending order for a given `orderBy` argument. + OrderDirectionDesc OrderDirection = "DESC" // Specifies a descending order for a given `orderBy` argument. +) + +// OrgAddMemberAuditEntryPermission represents the permissions available to members on an Organization. +type OrgAddMemberAuditEntryPermission string + +// The permissions available to members on an Organization. +const ( + OrgAddMemberAuditEntryPermissionRead OrgAddMemberAuditEntryPermission = "READ" // Can read and clone repositories. + OrgAddMemberAuditEntryPermissionAdmin OrgAddMemberAuditEntryPermission = "ADMIN" // Can read, clone, push, and add collaborators to repositories. +) + +// OrgCreateAuditEntryBillingPlan represents the billing plans available for organizations. +type OrgCreateAuditEntryBillingPlan string + +// The billing plans available for organizations. +const ( + OrgCreateAuditEntryBillingPlanFree OrgCreateAuditEntryBillingPlan = "FREE" // Free Plan. + OrgCreateAuditEntryBillingPlanBusiness OrgCreateAuditEntryBillingPlan = "BUSINESS" // Team Plan. + OrgCreateAuditEntryBillingPlanBusinessPlus OrgCreateAuditEntryBillingPlan = "BUSINESS_PLUS" // Enterprise Cloud Plan. + OrgCreateAuditEntryBillingPlanUnlimited OrgCreateAuditEntryBillingPlan = "UNLIMITED" // Legacy Unlimited Plan. + OrgCreateAuditEntryBillingPlanTieredPerSeat OrgCreateAuditEntryBillingPlan = "TIERED_PER_SEAT" // Tiered Per Seat Plan. +) + +// OrgRemoveBillingManagerAuditEntryReason represents the reason a billing manager was removed from an Organization. +type OrgRemoveBillingManagerAuditEntryReason string + +// The reason a billing manager was removed from an Organization. +const ( + OrgRemoveBillingManagerAuditEntryReasonTwoFactorRequirementNonCompliance OrgRemoveBillingManagerAuditEntryReason = "TWO_FACTOR_REQUIREMENT_NON_COMPLIANCE" // The organization required 2FA of its billing managers and this user did not have 2FA enabled. + OrgRemoveBillingManagerAuditEntryReasonSamlExternalIdentityMissing OrgRemoveBillingManagerAuditEntryReason = "SAML_EXTERNAL_IDENTITY_MISSING" // SAML external identity missing. + OrgRemoveBillingManagerAuditEntryReasonSamlSsoEnforcementRequiresExternalIdentity OrgRemoveBillingManagerAuditEntryReason = "SAML_SSO_ENFORCEMENT_REQUIRES_EXTERNAL_IDENTITY" // SAML SSO enforcement requires an external identity. +) + +// OrgRemoveMemberAuditEntryMembershipType represents the type of membership a user has with an Organization. +type OrgRemoveMemberAuditEntryMembershipType string + +// The type of membership a user has with an Organization. +const ( + OrgRemoveMemberAuditEntryMembershipTypeDirectMember OrgRemoveMemberAuditEntryMembershipType = "DIRECT_MEMBER" // A direct member is a user that is a member of the Organization. + OrgRemoveMemberAuditEntryMembershipTypeAdmin OrgRemoveMemberAuditEntryMembershipType = "ADMIN" // Organization administrators have full access and can change several settings, including the names of repositories that belong to the Organization and Owners team membership. In addition, organization admins can delete the organization and all of its repositories. + OrgRemoveMemberAuditEntryMembershipTypeBillingManager OrgRemoveMemberAuditEntryMembershipType = "BILLING_MANAGER" // A billing manager is a user who manages the billing settings for the Organization, such as updating payment information. + OrgRemoveMemberAuditEntryMembershipTypeUnaffiliated OrgRemoveMemberAuditEntryMembershipType = "UNAFFILIATED" // An unaffiliated collaborator is a person who is not a member of the Organization and does not have access to any repositories in the Organization. + OrgRemoveMemberAuditEntryMembershipTypeOutsideCollaborator OrgRemoveMemberAuditEntryMembershipType = "OUTSIDE_COLLABORATOR" // An outside collaborator is a person who isn't explicitly a member of the Organization, but who has Read, Write, or Admin permissions to one or more repositories in the organization. +) + +// OrgRemoveMemberAuditEntryReason represents the reason a member was removed from an Organization. +type OrgRemoveMemberAuditEntryReason string + +// The reason a member was removed from an Organization. +const ( + OrgRemoveMemberAuditEntryReasonTwoFactorRequirementNonCompliance OrgRemoveMemberAuditEntryReason = "TWO_FACTOR_REQUIREMENT_NON_COMPLIANCE" // The organization required 2FA of its billing managers and this user did not have 2FA enabled. + OrgRemoveMemberAuditEntryReasonSamlExternalIdentityMissing OrgRemoveMemberAuditEntryReason = "SAML_EXTERNAL_IDENTITY_MISSING" // SAML external identity missing. + OrgRemoveMemberAuditEntryReasonSamlSsoEnforcementRequiresExternalIdentity OrgRemoveMemberAuditEntryReason = "SAML_SSO_ENFORCEMENT_REQUIRES_EXTERNAL_IDENTITY" // SAML SSO enforcement requires an external identity. +) + +// OrgRemoveOutsideCollaboratorAuditEntryMembershipType represents the type of membership a user has with an Organization. +type OrgRemoveOutsideCollaboratorAuditEntryMembershipType string + +// The type of membership a user has with an Organization. +const ( + OrgRemoveOutsideCollaboratorAuditEntryMembershipTypeOutsideCollaborator OrgRemoveOutsideCollaboratorAuditEntryMembershipType = "OUTSIDE_COLLABORATOR" // An outside collaborator is a person who isn't explicitly a member of the Organization, but who has Read, Write, or Admin permissions to one or more repositories in the organization. + OrgRemoveOutsideCollaboratorAuditEntryMembershipTypeUnaffiliated OrgRemoveOutsideCollaboratorAuditEntryMembershipType = "UNAFFILIATED" // An unaffiliated collaborator is a person who is not a member of the Organization and does not have access to any repositories in the organization. + OrgRemoveOutsideCollaboratorAuditEntryMembershipTypeBillingManager OrgRemoveOutsideCollaboratorAuditEntryMembershipType = "BILLING_MANAGER" // A billing manager is a user who manages the billing settings for the Organization, such as updating payment information. +) + +// OrgRemoveOutsideCollaboratorAuditEntryReason represents the reason an outside collaborator was removed from an Organization. +type OrgRemoveOutsideCollaboratorAuditEntryReason string + +// The reason an outside collaborator was removed from an Organization. +const ( + OrgRemoveOutsideCollaboratorAuditEntryReasonTwoFactorRequirementNonCompliance OrgRemoveOutsideCollaboratorAuditEntryReason = "TWO_FACTOR_REQUIREMENT_NON_COMPLIANCE" // The organization required 2FA of its billing managers and this user did not have 2FA enabled. + OrgRemoveOutsideCollaboratorAuditEntryReasonSamlExternalIdentityMissing OrgRemoveOutsideCollaboratorAuditEntryReason = "SAML_EXTERNAL_IDENTITY_MISSING" // SAML external identity missing. +) + +// OrgUpdateDefaultRepositoryPermissionAuditEntryPermission represents the default permission a repository can have in an Organization. +type OrgUpdateDefaultRepositoryPermissionAuditEntryPermission string + +// The default permission a repository can have in an Organization. +const ( + OrgUpdateDefaultRepositoryPermissionAuditEntryPermissionRead OrgUpdateDefaultRepositoryPermissionAuditEntryPermission = "READ" // Can read and clone repositories. + OrgUpdateDefaultRepositoryPermissionAuditEntryPermissionWrite OrgUpdateDefaultRepositoryPermissionAuditEntryPermission = "WRITE" // Can read, clone and push to repositories. + OrgUpdateDefaultRepositoryPermissionAuditEntryPermissionAdmin OrgUpdateDefaultRepositoryPermissionAuditEntryPermission = "ADMIN" // Can read, clone, push, and add collaborators to repositories. + OrgUpdateDefaultRepositoryPermissionAuditEntryPermissionNone OrgUpdateDefaultRepositoryPermissionAuditEntryPermission = "NONE" // No default permission value. +) + +// OrgUpdateMemberAuditEntryPermission represents the permissions available to members on an Organization. +type OrgUpdateMemberAuditEntryPermission string + +// The permissions available to members on an Organization. +const ( + OrgUpdateMemberAuditEntryPermissionRead OrgUpdateMemberAuditEntryPermission = "READ" // Can read and clone repositories. + OrgUpdateMemberAuditEntryPermissionAdmin OrgUpdateMemberAuditEntryPermission = "ADMIN" // Can read, clone, push, and add collaborators to repositories. +) + +// OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibility represents the permissions available for repository creation on an Organization. +type OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibility string + +// The permissions available for repository creation on an Organization. +const ( + OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibilityAll OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibility = "ALL" // All organization members are restricted from creating any repositories. + OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibilityPublic OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibility = "PUBLIC" // All organization members are restricted from creating public repositories. +) + +// OrganizationInvitationRole represents the possible organization invitation roles. +type OrganizationInvitationRole string + +// The possible organization invitation roles. +const ( + OrganizationInvitationRoleDirectMember OrganizationInvitationRole = "DIRECT_MEMBER" // The user is invited to be a direct member of the organization. + OrganizationInvitationRoleAdmin OrganizationInvitationRole = "ADMIN" // The user is invited to be an admin of the organization. + OrganizationInvitationRoleBillingManager OrganizationInvitationRole = "BILLING_MANAGER" // The user is invited to be a billing manager of the organization. + OrganizationInvitationRoleReinstate OrganizationInvitationRole = "REINSTATE" // The user's previous role will be reinstated. +) + +// OrganizationInvitationType represents the possible organization invitation types. +type OrganizationInvitationType string + +// The possible organization invitation types. +const ( + OrganizationInvitationTypeUser OrganizationInvitationType = "USER" // The invitation was to an existing user. + OrganizationInvitationTypeEmail OrganizationInvitationType = "EMAIL" // The invitation was to an email address. +) + +// OrganizationMemberRole represents the possible roles within an organization for its members. +type OrganizationMemberRole string + +// The possible roles within an organization for its members. +const ( + OrganizationMemberRoleMember OrganizationMemberRole = "MEMBER" // The user is a member of the organization. + OrganizationMemberRoleAdmin OrganizationMemberRole = "ADMIN" // The user is an administrator of the organization. +) + +// OrganizationMembersCanCreateRepositoriesSettingValue represents the possible values for the members can create repositories setting on an organization. +type OrganizationMembersCanCreateRepositoriesSettingValue string + +// The possible values for the members can create repositories setting on an organization. +const ( + OrganizationMembersCanCreateRepositoriesSettingValueAll OrganizationMembersCanCreateRepositoriesSettingValue = "ALL" // Members will be able to create public and private repositories. + OrganizationMembersCanCreateRepositoriesSettingValuePrivate OrganizationMembersCanCreateRepositoriesSettingValue = "PRIVATE" // Members will be able to create only private repositories. + OrganizationMembersCanCreateRepositoriesSettingValueDisabled OrganizationMembersCanCreateRepositoriesSettingValue = "DISABLED" // Members will not be able to create public or private repositories. +) + +// OrganizationOrderField represents properties by which organization connections can be ordered. +type OrganizationOrderField string + +// Properties by which organization connections can be ordered. +const ( + OrganizationOrderFieldCreatedAt OrganizationOrderField = "CREATED_AT" // Order organizations by creation time. + OrganizationOrderFieldLogin OrganizationOrderField = "LOGIN" // Order organizations by login. +) + +// PinnableItemType represents represents items that can be pinned to a profile page or dashboard. +type PinnableItemType string + +// Represents items that can be pinned to a profile page or dashboard. +const ( + PinnableItemTypeRepository PinnableItemType = "REPOSITORY" // A repository. + PinnableItemTypeGist PinnableItemType = "GIST" // A gist. + PinnableItemTypeIssue PinnableItemType = "ISSUE" // An issue. + PinnableItemTypeProject PinnableItemType = "PROJECT" // A project. + PinnableItemTypePullRequest PinnableItemType = "PULL_REQUEST" // A pull request. + PinnableItemTypeUser PinnableItemType = "USER" // A user. + PinnableItemTypeOrganization PinnableItemType = "ORGANIZATION" // An organization. + PinnableItemTypeTeam PinnableItemType = "TEAM" // A team. +) + +// ProjectCardArchivedState represents the possible archived states of a project card. +type ProjectCardArchivedState string + +// The possible archived states of a project card. +const ( + ProjectCardArchivedStateArchived ProjectCardArchivedState = "ARCHIVED" // A project card that is archived. + ProjectCardArchivedStateNotArchived ProjectCardArchivedState = "NOT_ARCHIVED" // A project card that is not archived. +) + +// ProjectCardState represents various content states of a ProjectCard. +type ProjectCardState string + +// Various content states of a ProjectCard. +const ( + ProjectCardStateContentOnly ProjectCardState = "CONTENT_ONLY" // The card has content only. + ProjectCardStateNoteOnly ProjectCardState = "NOTE_ONLY" // The card has a note only. + ProjectCardStateRedacted ProjectCardState = "REDACTED" // The card is redacted. +) + +// ProjectColumnPurpose represents the semantic purpose of the column - todo, in progress, or done. +type ProjectColumnPurpose string + +// The semantic purpose of the column - todo, in progress, or done. +const ( + ProjectColumnPurposeTodo ProjectColumnPurpose = "TODO" // The column contains cards still to be worked on. + ProjectColumnPurposeInProgress ProjectColumnPurpose = "IN_PROGRESS" // The column contains cards which are currently being worked on. + ProjectColumnPurposeDone ProjectColumnPurpose = "DONE" // The column contains cards which are complete. +) + +// ProjectOrderField represents properties by which project connections can be ordered. +type ProjectOrderField string + +// Properties by which project connections can be ordered. +const ( + ProjectOrderFieldCreatedAt ProjectOrderField = "CREATED_AT" // Order projects by creation time. + ProjectOrderFieldUpdatedAt ProjectOrderField = "UPDATED_AT" // Order projects by update time. + ProjectOrderFieldName ProjectOrderField = "NAME" // Order projects by name. +) + +// ProjectState represents state of the project; either 'open' or 'closed'. +type ProjectState string + +// State of the project; either 'open' or 'closed'. +const ( + ProjectStateOpen ProjectState = "OPEN" // The project is open. + ProjectStateClosed ProjectState = "CLOSED" // The project is closed. +) + +// ProjectTemplate represents gitHub-provided templates for Projects. +type ProjectTemplate string + +// GitHub-provided templates for Projects. +const ( + ProjectTemplateBasicKanban ProjectTemplate = "BASIC_KANBAN" // Create a board with columns for To do, In progress and Done. + ProjectTemplateAutomatedKanbanV2 ProjectTemplate = "AUTOMATED_KANBAN_V2" // Create a board with v2 triggers to automatically move cards across To do, In progress and Done columns. + ProjectTemplateAutomatedReviewsKanban ProjectTemplate = "AUTOMATED_REVIEWS_KANBAN" // Create a board with triggers to automatically move cards across columns with review automation. + ProjectTemplateBugTriage ProjectTemplate = "BUG_TRIAGE" // Create a board to triage and prioritize bugs with To do, priority, and Done columns. +) + +// PullRequestMergeMethod represents represents available types of methods to use when merging a pull request. +type PullRequestMergeMethod string + +// Represents available types of methods to use when merging a pull request. +const ( + PullRequestMergeMethodMerge PullRequestMergeMethod = "MERGE" // Add all commits from the head branch to the base branch with a merge commit. + PullRequestMergeMethodSquash PullRequestMergeMethod = "SQUASH" // Combine all commits from the head branch into a single commit in the base branch. + PullRequestMergeMethodRebase PullRequestMergeMethod = "REBASE" // Add all commits from the head branch onto the base branch individually. +) + +// PullRequestOrderField represents properties by which pull_requests connections can be ordered. +type PullRequestOrderField string + +// Properties by which pull_requests connections can be ordered. +const ( + PullRequestOrderFieldCreatedAt PullRequestOrderField = "CREATED_AT" // Order pull_requests by creation time. + PullRequestOrderFieldUpdatedAt PullRequestOrderField = "UPDATED_AT" // Order pull_requests by update time. +) + +// PullRequestPubSubTopic represents the possible PubSub channels for a pull request. +type PullRequestPubSubTopic string + +// The possible PubSub channels for a pull request. +const ( + PullRequestPubSubTopicUpdated PullRequestPubSubTopic = "UPDATED" // The channel ID for observing pull request updates. + PullRequestPubSubTopicMarkasread PullRequestPubSubTopic = "MARKASREAD" // The channel ID for marking an pull request as read. + PullRequestPubSubTopicHeadRef PullRequestPubSubTopic = "HEAD_REF" // The channel ID for observing head ref updates. + PullRequestPubSubTopicTimeline PullRequestPubSubTopic = "TIMELINE" // The channel ID for updating items on the pull request timeline. + PullRequestPubSubTopicState PullRequestPubSubTopic = "STATE" // The channel ID for observing pull request state updates. +) + +// PullRequestReviewCommentState represents the possible states of a pull request review comment. +type PullRequestReviewCommentState string + +// The possible states of a pull request review comment. +const ( + PullRequestReviewCommentStatePending PullRequestReviewCommentState = "PENDING" // A comment that is part of a pending review. + PullRequestReviewCommentStateSubmitted PullRequestReviewCommentState = "SUBMITTED" // A comment that is part of a submitted review. +) + +// PullRequestReviewEvent represents the possible events to perform on a pull request review. +type PullRequestReviewEvent string + +// The possible events to perform on a pull request review. +const ( + PullRequestReviewEventComment PullRequestReviewEvent = "COMMENT" // Submit general feedback without explicit approval. + PullRequestReviewEventApprove PullRequestReviewEvent = "APPROVE" // Submit feedback and approve merging these changes. + PullRequestReviewEventRequestChanges PullRequestReviewEvent = "REQUEST_CHANGES" // Submit feedback that must be addressed before merging. + PullRequestReviewEventDismiss PullRequestReviewEvent = "DISMISS" // Dismiss review so it now longer effects merging. +) + +// PullRequestReviewState represents the possible states of a pull request review. +type PullRequestReviewState string + +// The possible states of a pull request review. +const ( + PullRequestReviewStatePending PullRequestReviewState = "PENDING" // A review that has not yet been submitted. + PullRequestReviewStateCommented PullRequestReviewState = "COMMENTED" // An informational review. + PullRequestReviewStateApproved PullRequestReviewState = "APPROVED" // A review allowing the pull request to merge. + PullRequestReviewStateChangesRequested PullRequestReviewState = "CHANGES_REQUESTED" // A review blocking the pull request from merging. + PullRequestReviewStateDismissed PullRequestReviewState = "DISMISSED" // A review that has been dismissed. +) + +// PullRequestState represents the possible states of a pull request. +type PullRequestState string + +// The possible states of a pull request. +const ( + PullRequestStateOpen PullRequestState = "OPEN" // A pull request that is still open. + PullRequestStateClosed PullRequestState = "CLOSED" // A pull request that has been closed without being merged. + PullRequestStateMerged PullRequestState = "MERGED" // A pull request that has been closed by being merged. +) + +// PullRequestTimelineItemsItemType represents the possible item types found in a timeline. +type PullRequestTimelineItemsItemType string + +// The possible item types found in a timeline. +const ( + PullRequestTimelineItemsItemTypePullRequestCommit PullRequestTimelineItemsItemType = "PULL_REQUEST_COMMIT" // Represents a Git commit part of a pull request. + PullRequestTimelineItemsItemTypePullRequestCommitCommentThread PullRequestTimelineItemsItemType = "PULL_REQUEST_COMMIT_COMMENT_THREAD" // Represents a commit comment thread part of a pull request. + PullRequestTimelineItemsItemTypePullRequestReview PullRequestTimelineItemsItemType = "PULL_REQUEST_REVIEW" // A review object for a given pull request. + PullRequestTimelineItemsItemTypePullRequestReviewThread PullRequestTimelineItemsItemType = "PULL_REQUEST_REVIEW_THREAD" // A threaded list of comments for a given pull request. + PullRequestTimelineItemsItemTypePullRequestRevisionMarker PullRequestTimelineItemsItemType = "PULL_REQUEST_REVISION_MARKER" // Represents the latest point in the pull request timeline for which the viewer has seen the pull request's commits. + PullRequestTimelineItemsItemTypeBaseRefChangedEvent PullRequestTimelineItemsItemType = "BASE_REF_CHANGED_EVENT" // Represents a 'base_ref_changed' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeBaseRefForcePushedEvent PullRequestTimelineItemsItemType = "BASE_REF_FORCE_PUSHED_EVENT" // Represents a 'base_ref_force_pushed' event on a given pull request. + PullRequestTimelineItemsItemTypeDeployedEvent PullRequestTimelineItemsItemType = "DEPLOYED_EVENT" // Represents a 'deployed' event on a given pull request. + PullRequestTimelineItemsItemTypeDeploymentEnvironmentChangedEvent PullRequestTimelineItemsItemType = "DEPLOYMENT_ENVIRONMENT_CHANGED_EVENT" // Represents a 'deployment_environment_changed' event on a given pull request. + PullRequestTimelineItemsItemTypeHeadRefDeletedEvent PullRequestTimelineItemsItemType = "HEAD_REF_DELETED_EVENT" // Represents a 'head_ref_deleted' event on a given pull request. + PullRequestTimelineItemsItemTypeHeadRefForcePushedEvent PullRequestTimelineItemsItemType = "HEAD_REF_FORCE_PUSHED_EVENT" // Represents a 'head_ref_force_pushed' event on a given pull request. + PullRequestTimelineItemsItemTypeHeadRefRestoredEvent PullRequestTimelineItemsItemType = "HEAD_REF_RESTORED_EVENT" // Represents a 'head_ref_restored' event on a given pull request. + PullRequestTimelineItemsItemTypeMergedEvent PullRequestTimelineItemsItemType = "MERGED_EVENT" // Represents a 'merged' event on a given pull request. + PullRequestTimelineItemsItemTypeReviewDismissedEvent PullRequestTimelineItemsItemType = "REVIEW_DISMISSED_EVENT" // Represents a 'review_dismissed' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeReviewRequestedEvent PullRequestTimelineItemsItemType = "REVIEW_REQUESTED_EVENT" // Represents an 'review_requested' event on a given pull request. + PullRequestTimelineItemsItemTypeReviewRequestRemovedEvent PullRequestTimelineItemsItemType = "REVIEW_REQUEST_REMOVED_EVENT" // Represents an 'review_request_removed' event on a given pull request. + PullRequestTimelineItemsItemTypeReadyForReviewEvent PullRequestTimelineItemsItemType = "READY_FOR_REVIEW_EVENT" // Represents a 'ready_for_review' event on a given pull request. + PullRequestTimelineItemsItemTypeIssueComment PullRequestTimelineItemsItemType = "ISSUE_COMMENT" // Represents a comment on an Issue. + PullRequestTimelineItemsItemTypeCrossReferencedEvent PullRequestTimelineItemsItemType = "CROSS_REFERENCED_EVENT" // Represents a mention made by one issue or pull request to another. + PullRequestTimelineItemsItemTypeAddedToProjectEvent PullRequestTimelineItemsItemType = "ADDED_TO_PROJECT_EVENT" // Represents a 'added_to_project' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeAssignedEvent PullRequestTimelineItemsItemType = "ASSIGNED_EVENT" // Represents an 'assigned' event on any assignable object. + PullRequestTimelineItemsItemTypeClosedEvent PullRequestTimelineItemsItemType = "CLOSED_EVENT" // Represents a 'closed' event on any `Closable`. + PullRequestTimelineItemsItemTypeCommentDeletedEvent PullRequestTimelineItemsItemType = "COMMENT_DELETED_EVENT" // Represents a 'comment_deleted' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeConvertedNoteToIssueEvent PullRequestTimelineItemsItemType = "CONVERTED_NOTE_TO_ISSUE_EVENT" // Represents a 'converted_note_to_issue' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeDemilestonedEvent PullRequestTimelineItemsItemType = "DEMILESTONED_EVENT" // Represents a 'demilestoned' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeLabeledEvent PullRequestTimelineItemsItemType = "LABELED_EVENT" // Represents a 'labeled' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeLockedEvent PullRequestTimelineItemsItemType = "LOCKED_EVENT" // Represents a 'locked' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeMarkedAsDuplicateEvent PullRequestTimelineItemsItemType = "MARKED_AS_DUPLICATE_EVENT" // Represents a 'marked_as_duplicate' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeMentionedEvent PullRequestTimelineItemsItemType = "MENTIONED_EVENT" // Represents a 'mentioned' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeMilestonedEvent PullRequestTimelineItemsItemType = "MILESTONED_EVENT" // Represents a 'milestoned' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeMovedColumnsInProjectEvent PullRequestTimelineItemsItemType = "MOVED_COLUMNS_IN_PROJECT_EVENT" // Represents a 'moved_columns_in_project' event on a given issue or pull request. + PullRequestTimelineItemsItemTypePinnedEvent PullRequestTimelineItemsItemType = "PINNED_EVENT" // Represents a 'pinned' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeReferencedEvent PullRequestTimelineItemsItemType = "REFERENCED_EVENT" // Represents a 'referenced' event on a given `ReferencedSubject`. + PullRequestTimelineItemsItemTypeRemovedFromProjectEvent PullRequestTimelineItemsItemType = "REMOVED_FROM_PROJECT_EVENT" // Represents a 'removed_from_project' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeRenamedTitleEvent PullRequestTimelineItemsItemType = "RENAMED_TITLE_EVENT" // Represents a 'renamed' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeReopenedEvent PullRequestTimelineItemsItemType = "REOPENED_EVENT" // Represents a 'reopened' event on any `Closable`. + PullRequestTimelineItemsItemTypeSubscribedEvent PullRequestTimelineItemsItemType = "SUBSCRIBED_EVENT" // Represents a 'subscribed' event on a given `Subscribable`. + PullRequestTimelineItemsItemTypeTransferredEvent PullRequestTimelineItemsItemType = "TRANSFERRED_EVENT" // Represents a 'transferred' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeUnassignedEvent PullRequestTimelineItemsItemType = "UNASSIGNED_EVENT" // Represents an 'unassigned' event on any assignable object. + PullRequestTimelineItemsItemTypeUnlabeledEvent PullRequestTimelineItemsItemType = "UNLABELED_EVENT" // Represents an 'unlabeled' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeUnlockedEvent PullRequestTimelineItemsItemType = "UNLOCKED_EVENT" // Represents an 'unlocked' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeUserBlockedEvent PullRequestTimelineItemsItemType = "USER_BLOCKED_EVENT" // Represents a 'user_blocked' event on a given user. + PullRequestTimelineItemsItemTypeUnpinnedEvent PullRequestTimelineItemsItemType = "UNPINNED_EVENT" // Represents an 'unpinned' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeUnsubscribedEvent PullRequestTimelineItemsItemType = "UNSUBSCRIBED_EVENT" // Represents an 'unsubscribed' event on a given `Subscribable`. +) + +// PullRequestUpdateState represents the possible target states when updating a pull request. +type PullRequestUpdateState string + +// The possible target states when updating a pull request. +const ( + PullRequestUpdateStateOpen PullRequestUpdateState = "OPEN" // A pull request that is still open. + PullRequestUpdateStateClosed PullRequestUpdateState = "CLOSED" // A pull request that has been closed without being merged. +) + +// ReactionContent represents emojis that can be attached to Issues, Pull Requests and Comments. +type ReactionContent string + +// Emojis that can be attached to Issues, Pull Requests and Comments. +const ( + ReactionContentThumbsUp ReactionContent = "THUMBS_UP" // Represents the `:+1:` emoji. + ReactionContentThumbsDown ReactionContent = "THUMBS_DOWN" // Represents the `:-1:` emoji. + ReactionContentLaugh ReactionContent = "LAUGH" // Represents the `:laugh:` emoji. + ReactionContentHooray ReactionContent = "HOORAY" // Represents the `:hooray:` emoji. + ReactionContentConfused ReactionContent = "CONFUSED" // Represents the `:confused:` emoji. + ReactionContentHeart ReactionContent = "HEART" // Represents the `:heart:` emoji. + ReactionContentRocket ReactionContent = "ROCKET" // Represents the `:rocket:` emoji. + ReactionContentEyes ReactionContent = "EYES" // Represents the `:eyes:` emoji. +) + +// ReactionOrderField represents a list of fields that reactions can be ordered by. +type ReactionOrderField string + +// A list of fields that reactions can be ordered by. +const ( + ReactionOrderFieldCreatedAt ReactionOrderField = "CREATED_AT" // Allows ordering a list of reactions by when they were created. +) + +// RefOrderField represents properties by which ref connections can be ordered. +type RefOrderField string + +// Properties by which ref connections can be ordered. +const ( + RefOrderFieldTagCommitDate RefOrderField = "TAG_COMMIT_DATE" // Order refs by underlying commit date if the ref prefix is refs/tags/. + RefOrderFieldAlphabetical RefOrderField = "ALPHABETICAL" // Order refs by their alphanumeric name. +) + +// RegistryPackageDependencyType represents the possible types of a registry package dependency. +type RegistryPackageDependencyType string + +// The possible types of a registry package dependency. +const ( + RegistryPackageDependencyTypeDefault RegistryPackageDependencyType = "DEFAULT" // A default registry package dependency type. + RegistryPackageDependencyTypeDev RegistryPackageDependencyType = "DEV" // A dev registry package dependency type. + RegistryPackageDependencyTypeTest RegistryPackageDependencyType = "TEST" // A test registry package dependency type. + RegistryPackageDependencyTypePeer RegistryPackageDependencyType = "PEER" // A peer registry package dependency type. + RegistryPackageDependencyTypeOptional RegistryPackageDependencyType = "OPTIONAL" // An optional registry package dependency type. + RegistryPackageDependencyTypeBundled RegistryPackageDependencyType = "BUNDLED" // An optional registry package dependency type. +) + +// RegistryPackageFileState represents the possible states of a registry package file. +type RegistryPackageFileState string + +// The possible states of a registry package file. +const ( + RegistryPackageFileStateNew RegistryPackageFileState = "NEW" // Package file doesn't have a blob backing it. + RegistryPackageFileStateUploaded RegistryPackageFileState = "UPLOADED" // All Package file contents have been uploaded. +) + +// RegistryPackageType represents the possible types of a registry package. +type RegistryPackageType string + +// The possible types of a registry package. +const ( + RegistryPackageTypeNpm RegistryPackageType = "NPM" // An npm registry package. + RegistryPackageTypeRubygems RegistryPackageType = "RUBYGEMS" // A rubygems registry package. + RegistryPackageTypeMaven RegistryPackageType = "MAVEN" // A maven registry package. + RegistryPackageTypeDocker RegistryPackageType = "DOCKER" // A docker image. + RegistryPackageTypeDebian RegistryPackageType = "DEBIAN" // A debian package. + RegistryPackageTypeNuget RegistryPackageType = "NUGET" // A nuget package. + RegistryPackageTypePython RegistryPackageType = "PYTHON" // A python package. +) + +// ReleaseOrderField represents properties by which release connections can be ordered. +type ReleaseOrderField string + +// Properties by which release connections can be ordered. +const ( + ReleaseOrderFieldCreatedAt ReleaseOrderField = "CREATED_AT" // Order releases by creation time. + ReleaseOrderFieldName ReleaseOrderField = "NAME" // Order releases alphabetically by name. +) + +// RepoAccessAuditEntryVisibility represents the privacy of a repository. +type RepoAccessAuditEntryVisibility string + +// The privacy of a repository. +const ( + RepoAccessAuditEntryVisibilityInternal RepoAccessAuditEntryVisibility = "INTERNAL" // The repository is visible only to users in the same business. + RepoAccessAuditEntryVisibilityPrivate RepoAccessAuditEntryVisibility = "PRIVATE" // The repository is visible only to those with explicit access. + RepoAccessAuditEntryVisibilityPublic RepoAccessAuditEntryVisibility = "PUBLIC" // The repository is visible to everyone. +) + +// RepoAddMemberAuditEntryVisibility represents the privacy of a repository. +type RepoAddMemberAuditEntryVisibility string + +// The privacy of a repository. +const ( + RepoAddMemberAuditEntryVisibilityInternal RepoAddMemberAuditEntryVisibility = "INTERNAL" // The repository is visible only to users in the same business. + RepoAddMemberAuditEntryVisibilityPrivate RepoAddMemberAuditEntryVisibility = "PRIVATE" // The repository is visible only to those with explicit access. + RepoAddMemberAuditEntryVisibilityPublic RepoAddMemberAuditEntryVisibility = "PUBLIC" // The repository is visible to everyone. +) + +// RepoArchivedAuditEntryVisibility represents the privacy of a repository. +type RepoArchivedAuditEntryVisibility string + +// The privacy of a repository. +const ( + RepoArchivedAuditEntryVisibilityInternal RepoArchivedAuditEntryVisibility = "INTERNAL" // The repository is visible only to users in the same business. + RepoArchivedAuditEntryVisibilityPrivate RepoArchivedAuditEntryVisibility = "PRIVATE" // The repository is visible only to those with explicit access. + RepoArchivedAuditEntryVisibilityPublic RepoArchivedAuditEntryVisibility = "PUBLIC" // The repository is visible to everyone. +) + +// RepoChangeMergeSettingAuditEntryMergeType represents the merge options available for pull requests to this repository. +type RepoChangeMergeSettingAuditEntryMergeType string + +// The merge options available for pull requests to this repository. +const ( + RepoChangeMergeSettingAuditEntryMergeTypeMerge RepoChangeMergeSettingAuditEntryMergeType = "MERGE" // The pull request is added to the base branch in a merge commit. + RepoChangeMergeSettingAuditEntryMergeTypeRebase RepoChangeMergeSettingAuditEntryMergeType = "REBASE" // Commits from the pull request are added onto the base branch individually without a merge commit. + RepoChangeMergeSettingAuditEntryMergeTypeSquash RepoChangeMergeSettingAuditEntryMergeType = "SQUASH" // The pull request's commits are squashed into a single commit before they are merged to the base branch. +) + +// RepoCreateAuditEntryVisibility represents the privacy of a repository. +type RepoCreateAuditEntryVisibility string + +// The privacy of a repository. +const ( + RepoCreateAuditEntryVisibilityInternal RepoCreateAuditEntryVisibility = "INTERNAL" // The repository is visible only to users in the same business. + RepoCreateAuditEntryVisibilityPrivate RepoCreateAuditEntryVisibility = "PRIVATE" // The repository is visible only to those with explicit access. + RepoCreateAuditEntryVisibilityPublic RepoCreateAuditEntryVisibility = "PUBLIC" // The repository is visible to everyone. +) + +// RepoDestroyAuditEntryVisibility represents the privacy of a repository. +type RepoDestroyAuditEntryVisibility string + +// The privacy of a repository. +const ( + RepoDestroyAuditEntryVisibilityInternal RepoDestroyAuditEntryVisibility = "INTERNAL" // The repository is visible only to users in the same business. + RepoDestroyAuditEntryVisibilityPrivate RepoDestroyAuditEntryVisibility = "PRIVATE" // The repository is visible only to those with explicit access. + RepoDestroyAuditEntryVisibilityPublic RepoDestroyAuditEntryVisibility = "PUBLIC" // The repository is visible to everyone. +) + +// RepoRemoveMemberAuditEntryVisibility represents the privacy of a repository. +type RepoRemoveMemberAuditEntryVisibility string + +// The privacy of a repository. +const ( + RepoRemoveMemberAuditEntryVisibilityInternal RepoRemoveMemberAuditEntryVisibility = "INTERNAL" // The repository is visible only to users in the same business. + RepoRemoveMemberAuditEntryVisibilityPrivate RepoRemoveMemberAuditEntryVisibility = "PRIVATE" // The repository is visible only to those with explicit access. + RepoRemoveMemberAuditEntryVisibilityPublic RepoRemoveMemberAuditEntryVisibility = "PUBLIC" // The repository is visible to everyone. +) + +// ReportedContentClassifiers represents the reasons a piece of content can be reported or minimized. +type ReportedContentClassifiers string + +// The reasons a piece of content can be reported or minimized. +const ( + ReportedContentClassifiersSpam ReportedContentClassifiers = "SPAM" // A spammy piece of content. + ReportedContentClassifiersAbuse ReportedContentClassifiers = "ABUSE" // An abusive or harassing piece of content. + ReportedContentClassifiersOffTopic ReportedContentClassifiers = "OFF_TOPIC" // An irrelevant piece of content. + ReportedContentClassifiersOutdated ReportedContentClassifiers = "OUTDATED" // An outdated piece of content. + ReportedContentClassifiersResolved ReportedContentClassifiers = "RESOLVED" // The content has been resolved. +) + +// RepositoryAffiliation represents the affiliation of a user to a repository. +type RepositoryAffiliation string + +// The affiliation of a user to a repository. +const ( + RepositoryAffiliationOwner RepositoryAffiliation = "OWNER" // Repositories that are owned by the authenticated user. + RepositoryAffiliationCollaborator RepositoryAffiliation = "COLLABORATOR" // Repositories that the user has been added to as a collaborator. + RepositoryAffiliationOrganizationMember RepositoryAffiliation = "ORGANIZATION_MEMBER" // Repositories that the user has access to through being a member of an organization. This includes every repository on every team that the user is on. +) + +// RepositoryCollaboratorAffiliation represents the affiliation type between collaborator and repository. +type RepositoryCollaboratorAffiliation string + +// The affiliation type between collaborator and repository. +const ( + RepositoryCollaboratorAffiliationAll RepositoryCollaboratorAffiliation = "ALL" // All collaborators of the repository. + RepositoryCollaboratorAffiliationOutside RepositoryCollaboratorAffiliation = "OUTSIDE" // All outside collaborators of an organization-owned repository. +) + +// RepositoryContributionType represents the reason a repository is listed as 'contributed'. +type RepositoryContributionType string + +// The reason a repository is listed as 'contributed'. +const ( + RepositoryContributionTypeCommit RepositoryContributionType = "COMMIT" // Created a commit. + RepositoryContributionTypeIssue RepositoryContributionType = "ISSUE" // Created an issue. + RepositoryContributionTypePullRequest RepositoryContributionType = "PULL_REQUEST" // Created a pull request. + RepositoryContributionTypeRepository RepositoryContributionType = "REPOSITORY" // Created the repository. + RepositoryContributionTypePullRequestReview RepositoryContributionType = "PULL_REQUEST_REVIEW" // Reviewed a pull request. +) + +// RepositoryInvitationOrderField represents properties by which repository invitation connections can be ordered. +type RepositoryInvitationOrderField string + +// Properties by which repository invitation connections can be ordered. +const ( + RepositoryInvitationOrderFieldCreatedAt RepositoryInvitationOrderField = "CREATED_AT" // Order repository invitations by creation time. + RepositoryInvitationOrderFieldInviteeLogin RepositoryInvitationOrderField = "INVITEE_LOGIN" // Order repository invitations by invitee login. +) + +// RepositoryLockReason represents the possible reasons a given repository could be in a locked state. +type RepositoryLockReason string + +// The possible reasons a given repository could be in a locked state. +const ( + RepositoryLockReasonMoving RepositoryLockReason = "MOVING" // The repository is locked due to a move. + RepositoryLockReasonBilling RepositoryLockReason = "BILLING" // The repository is locked due to a billing related reason. + RepositoryLockReasonRename RepositoryLockReason = "RENAME" // The repository is locked due to a rename. + RepositoryLockReasonMigrating RepositoryLockReason = "MIGRATING" // The repository is locked due to a migration. +) + +// RepositoryOrderField represents properties by which repository connections can be ordered. +type RepositoryOrderField string + +// Properties by which repository connections can be ordered. +const ( + RepositoryOrderFieldCreatedAt RepositoryOrderField = "CREATED_AT" // Order repositories by creation time. + RepositoryOrderFieldUpdatedAt RepositoryOrderField = "UPDATED_AT" // Order repositories by update time. + RepositoryOrderFieldPushedAt RepositoryOrderField = "PUSHED_AT" // Order repositories by push time. + RepositoryOrderFieldName RepositoryOrderField = "NAME" // Order repositories by name. + RepositoryOrderFieldStargazers RepositoryOrderField = "STARGAZERS" // Order repositories by number of stargazers. +) + +// RepositoryPermission represents the access level to a repository. +type RepositoryPermission string + +// The access level to a repository. +const ( + RepositoryPermissionAdmin RepositoryPermission = "ADMIN" // Can read, clone, and push to this repository. Can also manage issues, pull requests, and repository settings, including adding collaborators. + RepositoryPermissionMaintain RepositoryPermission = "MAINTAIN" // Can read, clone, and push to this repository. They can also manage issues, pull requests, and some repository settings. + RepositoryPermissionWrite RepositoryPermission = "WRITE" // Can read, clone, and push to this repository. Can also manage issues and pull requests. + RepositoryPermissionTriage RepositoryPermission = "TRIAGE" // Can read and clone this repository. Can also manage issues and pull requests. + RepositoryPermissionRead RepositoryPermission = "READ" // Can read and clone this repository. Can also open and comment on issues and pull requests. +) + +// RepositoryPrivacy represents the privacy of a repository. +type RepositoryPrivacy string + +// The privacy of a repository. +const ( + RepositoryPrivacyPublic RepositoryPrivacy = "PUBLIC" // Public. + RepositoryPrivacyPrivate RepositoryPrivacy = "PRIVATE" // Private. +) + +// RepositoryVisibility represents the repository's visibility level. +type RepositoryVisibility string + +// The repository's visibility level. +const ( + RepositoryVisibilityPrivate RepositoryVisibility = "PRIVATE" // The repository is visible only to those with explicit access. + RepositoryVisibilityPublic RepositoryVisibility = "PUBLIC" // The repository is visible to everyone. + RepositoryVisibilityInternal RepositoryVisibility = "INTERNAL" // The repository is visible only to users in the same business. +) + +// SamlDigestAlgorithm represents the possible digest algorithms used to sign SAML requests for an identity provider. +type SamlDigestAlgorithm string + +// The possible digest algorithms used to sign SAML requests for an identity provider. +const ( + SamlDigestAlgorithmSha1 SamlDigestAlgorithm = "SHA1" // SHA1. + SamlDigestAlgorithmSha256 SamlDigestAlgorithm = "SHA256" // SHA256. + SamlDigestAlgorithmSha384 SamlDigestAlgorithm = "SHA384" // SHA384. + SamlDigestAlgorithmSha512 SamlDigestAlgorithm = "SHA512" // SHA512. +) + +// SamlSignatureAlgorithm represents the possible signature algorithms used to sign SAML requests for a Identity Provider. +type SamlSignatureAlgorithm string + +// The possible signature algorithms used to sign SAML requests for a Identity Provider. +const ( + SamlSignatureAlgorithmRsaSha1 SamlSignatureAlgorithm = "RSA_SHA1" // RSA-SHA1. + SamlSignatureAlgorithmRsaSha256 SamlSignatureAlgorithm = "RSA_SHA256" // RSA-SHA256. + SamlSignatureAlgorithmRsaSha384 SamlSignatureAlgorithm = "RSA_SHA384" // RSA-SHA384. + SamlSignatureAlgorithmRsaSha512 SamlSignatureAlgorithm = "RSA_SHA512" // RSA-SHA512. +) + +// SavedReplyOrderField represents properties by which saved reply connections can be ordered. +type SavedReplyOrderField string + +// Properties by which saved reply connections can be ordered. +const ( + SavedReplyOrderFieldUpdatedAt SavedReplyOrderField = "UPDATED_AT" // Order saved reply by when they were updated. +) + +// SearchType represents represents the individual results of a search. +type SearchType string + +// Represents the individual results of a search. +const ( + SearchTypeIssue SearchType = "ISSUE" // Returns results matching issues in repositories. + SearchTypeRepository SearchType = "REPOSITORY" // Returns results matching repositories. + SearchTypeUser SearchType = "USER" // Returns results matching users and organizations on GitHub. +) + +// SecurityAdvisoryEcosystem represents the possible ecosystems of a security vulnerability's package. +type SecurityAdvisoryEcosystem string + +// The possible ecosystems of a security vulnerability's package. +const ( + SecurityAdvisoryEcosystemRubygems SecurityAdvisoryEcosystem = "RUBYGEMS" // Ruby gems hosted at RubyGems.org. + SecurityAdvisoryEcosystemNpm SecurityAdvisoryEcosystem = "NPM" // JavaScript packages hosted at npmjs.com. + SecurityAdvisoryEcosystemPip SecurityAdvisoryEcosystem = "PIP" // Python packages hosted at PyPI.org. + SecurityAdvisoryEcosystemMaven SecurityAdvisoryEcosystem = "MAVEN" // Java artifacts hosted at the Maven central repository. + SecurityAdvisoryEcosystemNuget SecurityAdvisoryEcosystem = "NUGET" // .NET packages hosted at the NuGet Gallery. + SecurityAdvisoryEcosystemComposer SecurityAdvisoryEcosystem = "COMPOSER" // PHP packages hosted at packagist.org. +) + +// SecurityAdvisoryIdentifierType represents identifier formats available for advisories. +type SecurityAdvisoryIdentifierType string + +// Identifier formats available for advisories. +const ( + SecurityAdvisoryIdentifierTypeCve SecurityAdvisoryIdentifierType = "CVE" // Common Vulnerabilities and Exposures Identifier. + SecurityAdvisoryIdentifierTypeGhsa SecurityAdvisoryIdentifierType = "GHSA" // GitHub Security Advisory ID. +) + +// SecurityAdvisoryOrderField represents properties by which security advisory connections can be ordered. +type SecurityAdvisoryOrderField string + +// Properties by which security advisory connections can be ordered. +const ( + SecurityAdvisoryOrderFieldPublishedAt SecurityAdvisoryOrderField = "PUBLISHED_AT" // Order advisories by publication time. + SecurityAdvisoryOrderFieldUpdatedAt SecurityAdvisoryOrderField = "UPDATED_AT" // Order advisories by update time. +) + +// SecurityAdvisorySeverity represents severity of the vulnerability. +type SecurityAdvisorySeverity string + +// Severity of the vulnerability. +const ( + SecurityAdvisorySeverityLow SecurityAdvisorySeverity = "LOW" // Low. + SecurityAdvisorySeverityModerate SecurityAdvisorySeverity = "MODERATE" // Moderate. + SecurityAdvisorySeverityHigh SecurityAdvisorySeverity = "HIGH" // High. + SecurityAdvisorySeverityCritical SecurityAdvisorySeverity = "CRITICAL" // Critical. +) + +// SecurityVulnerabilityOrderField represents properties by which security vulnerability connections can be ordered. +type SecurityVulnerabilityOrderField string + +// Properties by which security vulnerability connections can be ordered. +const ( + SecurityVulnerabilityOrderFieldUpdatedAt SecurityVulnerabilityOrderField = "UPDATED_AT" // Order vulnerability by update time. +) + +// SponsorsTierOrderField represents properties by which Sponsors tiers connections can be ordered. +type SponsorsTierOrderField string + +// Properties by which Sponsors tiers connections can be ordered. +const ( + SponsorsTierOrderFieldCreatedAt SponsorsTierOrderField = "CREATED_AT" // Order tiers by creation time. + SponsorsTierOrderFieldMonthlyPriceInCents SponsorsTierOrderField = "MONTHLY_PRICE_IN_CENTS" // Order tiers by their monthly price in cents. +) + +// SponsorshipOrderField represents properties by which sponsorship connections can be ordered. +type SponsorshipOrderField string + +// Properties by which sponsorship connections can be ordered. +const ( + SponsorshipOrderFieldCreatedAt SponsorshipOrderField = "CREATED_AT" // Order sponsorship by creation time. +) + +// SponsorshipPrivacy represents the privacy of a sponsorship. +type SponsorshipPrivacy string + +// The privacy of a sponsorship. +const ( + SponsorshipPrivacyPublic SponsorshipPrivacy = "PUBLIC" // Public. + SponsorshipPrivacyPrivate SponsorshipPrivacy = "PRIVATE" // Private. +) + +// StarOrderField represents properties by which star connections can be ordered. +type StarOrderField string + +// Properties by which star connections can be ordered. +const ( + StarOrderFieldStarredAt StarOrderField = "STARRED_AT" // Allows ordering a list of stars by when they were created. +) + +// StatusState represents the possible commit status states. +type StatusState string + +// The possible commit status states. +const ( + StatusStateExpected StatusState = "EXPECTED" // Status is expected. + StatusStateError StatusState = "ERROR" // Status is errored. + StatusStateFailure StatusState = "FAILURE" // Status is failing. + StatusStatePending StatusState = "PENDING" // Status is pending. + StatusStateSuccess StatusState = "SUCCESS" // Status is successful. +) + +// SubscriptionState represents the possible states of a subscription. +type SubscriptionState string + +// The possible states of a subscription. +const ( + SubscriptionStateUnsubscribed SubscriptionState = "UNSUBSCRIBED" // The User is only notified when participating or @mentioned. + SubscriptionStateSubscribed SubscriptionState = "SUBSCRIBED" // The User is notified of all conversations. + SubscriptionStateIgnored SubscriptionState = "IGNORED" // The User is never notified. +) + +// TeamDiscussionCommentOrderField represents properties by which team discussion comment connections can be ordered. +type TeamDiscussionCommentOrderField string + +// Properties by which team discussion comment connections can be ordered. +const ( + TeamDiscussionCommentOrderFieldNumber TeamDiscussionCommentOrderField = "NUMBER" // Allows sequential ordering of team discussion comments (which is equivalent to chronological ordering). +) + +// TeamDiscussionOrderField represents properties by which team discussion connections can be ordered. +type TeamDiscussionOrderField string + +// Properties by which team discussion connections can be ordered. +const ( + TeamDiscussionOrderFieldCreatedAt TeamDiscussionOrderField = "CREATED_AT" // Allows chronological ordering of team discussions. +) + +// TeamMemberOrderField represents properties by which team member connections can be ordered. +type TeamMemberOrderField string + +// Properties by which team member connections can be ordered. +const ( + TeamMemberOrderFieldLogin TeamMemberOrderField = "LOGIN" // Order team members by login. + TeamMemberOrderFieldCreatedAt TeamMemberOrderField = "CREATED_AT" // Order team members by creation time. +) + +// TeamMemberRole represents the possible team member roles; either 'maintainer' or 'member'. +type TeamMemberRole string + +// The possible team member roles; either 'maintainer' or 'member'. +const ( + TeamMemberRoleMaintainer TeamMemberRole = "MAINTAINER" // A team maintainer has permission to add and remove team members. + TeamMemberRoleMember TeamMemberRole = "MEMBER" // A team member has no administrative permissions on the team. +) + +// TeamMembershipType represents defines which types of team members are included in the returned list. Can be one of IMMEDIATE, CHILD_TEAM or ALL. +type TeamMembershipType string + +// Defines which types of team members are included in the returned list. Can be one of IMMEDIATE, CHILD_TEAM or ALL. +const ( + TeamMembershipTypeImmediate TeamMembershipType = "IMMEDIATE" // Includes only immediate members of the team. + TeamMembershipTypeChildTeam TeamMembershipType = "CHILD_TEAM" // Includes only child team members for the team. + TeamMembershipTypeAll TeamMembershipType = "ALL" // Includes immediate and child team members for the team. +) + +// TeamOrderField represents properties by which team connections can be ordered. +type TeamOrderField string + +// Properties by which team connections can be ordered. +const ( + TeamOrderFieldName TeamOrderField = "NAME" // Allows ordering a list of teams by name. +) + +// TeamPrivacy represents the possible team privacy values. +type TeamPrivacy string + +// The possible team privacy values. +const ( + TeamPrivacySecret TeamPrivacy = "SECRET" // A secret team can only be seen by its members. + TeamPrivacyVisible TeamPrivacy = "VISIBLE" // A visible team can be seen and @mentioned by every member of the organization. +) + +// TeamRepositoryOrderField represents properties by which team repository connections can be ordered. +type TeamRepositoryOrderField string + +// Properties by which team repository connections can be ordered. +const ( + TeamRepositoryOrderFieldCreatedAt TeamRepositoryOrderField = "CREATED_AT" // Order repositories by creation time. + TeamRepositoryOrderFieldUpdatedAt TeamRepositoryOrderField = "UPDATED_AT" // Order repositories by update time. + TeamRepositoryOrderFieldPushedAt TeamRepositoryOrderField = "PUSHED_AT" // Order repositories by push time. + TeamRepositoryOrderFieldName TeamRepositoryOrderField = "NAME" // Order repositories by name. + TeamRepositoryOrderFieldPermission TeamRepositoryOrderField = "PERMISSION" // Order repositories by permission. + TeamRepositoryOrderFieldStargazers TeamRepositoryOrderField = "STARGAZERS" // Order repositories by number of stargazers. +) + +// TeamRole represents the role of a user on a team. +type TeamRole string + +// The role of a user on a team. +const ( + TeamRoleAdmin TeamRole = "ADMIN" // User has admin rights on the team. + TeamRoleMember TeamRole = "MEMBER" // User is a member of the team. +) + +// TopicSuggestionDeclineReason represents reason that the suggested topic is declined. +type TopicSuggestionDeclineReason string + +// Reason that the suggested topic is declined. +const ( + TopicSuggestionDeclineReasonNotRelevant TopicSuggestionDeclineReason = "NOT_RELEVANT" // The suggested topic is not relevant to the repository. + TopicSuggestionDeclineReasonTooSpecific TopicSuggestionDeclineReason = "TOO_SPECIFIC" // The suggested topic is too specific for the repository (e.g. #ruby-on-rails-version-4-2-1). + TopicSuggestionDeclineReasonPersonalPreference TopicSuggestionDeclineReason = "PERSONAL_PREFERENCE" // The viewer does not like the suggested topic. + TopicSuggestionDeclineReasonTooGeneral TopicSuggestionDeclineReason = "TOO_GENERAL" // The suggested topic is too general for the repository. +) + +// UserBlockDuration represents the possible durations that a user can be blocked for. +type UserBlockDuration string + +// The possible durations that a user can be blocked for. +const ( + UserBlockDurationOneDay UserBlockDuration = "ONE_DAY" // The user was blocked for 1 day. + UserBlockDurationThreeDays UserBlockDuration = "THREE_DAYS" // The user was blocked for 3 days. + UserBlockDurationOneWeek UserBlockDuration = "ONE_WEEK" // The user was blocked for 7 days. + UserBlockDurationOneMonth UserBlockDuration = "ONE_MONTH" // The user was blocked for 30 days. + UserBlockDurationPermanent UserBlockDuration = "PERMANENT" // The user was blocked permanently. +) + +// UserStatusOrderField represents properties by which user status connections can be ordered. +type UserStatusOrderField string + +// Properties by which user status connections can be ordered. +const ( + UserStatusOrderFieldUpdatedAt UserStatusOrderField = "UPDATED_AT" // Order user statuses by when they were updated. +) diff --git a/vendor/github.com/shurcooL/githubv4/githubv4.go b/vendor/github.com/shurcooL/githubv4/githubv4.go new file mode 100644 index 0000000000..3a544bf2b0 --- /dev/null +++ b/vendor/github.com/shurcooL/githubv4/githubv4.go @@ -0,0 +1,56 @@ +package githubv4 + +import ( + "context" + "net/http" + + "github.com/shurcooL/graphql" +) + +// Client is a GitHub GraphQL API v4 client. +type Client struct { + client *graphql.Client +} + +// NewClient creates a new GitHub GraphQL API v4 client with the provided http.Client. +// If httpClient is nil, then http.DefaultClient is used. +// +// Note that GitHub GraphQL API v4 requires authentication, so +// the provided http.Client is expected to take care of that. +func NewClient(httpClient *http.Client) *Client { + return &Client{ + client: graphql.NewClient("https://api.github.com/graphql", httpClient), + } +} + +// NewEnterpriseClient creates a new GitHub GraphQL API v4 client for the GitHub Enterprise +// instance with the specified GraphQL endpoint URL, using the provided http.Client. +// If httpClient is nil, then http.DefaultClient is used. +// +// Note that GitHub GraphQL API v4 requires authentication, so +// the provided http.Client is expected to take care of that. +func NewEnterpriseClient(url string, httpClient *http.Client) *Client { + return &Client{ + client: graphql.NewClient(url, httpClient), + } +} + +// Query executes a single GraphQL query request, +// with a query derived from q, populating the response into it. +// q should be a pointer to struct that corresponds to the GitHub GraphQL schema. +func (c *Client) Query(ctx context.Context, q interface{}, variables map[string]interface{}) error { + return c.client.Query(ctx, q, variables) +} + +// Mutate executes a single GraphQL mutation request, +// with a mutation derived from m, populating the response into it. +// m should be a pointer to struct that corresponds to the GitHub GraphQL schema. +// Provided input will be set as a variable named "input". +func (c *Client) Mutate(ctx context.Context, m interface{}, input Input, variables map[string]interface{}) error { + if variables == nil { + variables = map[string]interface{}{"input": input} + } else { + variables["input"] = input + } + return c.client.Mutate(ctx, m, variables) +} diff --git a/vendor/github.com/shurcooL/githubv4/input.go b/vendor/github.com/shurcooL/githubv4/input.go new file mode 100644 index 0000000000..91555f4e46 --- /dev/null +++ b/vendor/github.com/shurcooL/githubv4/input.go @@ -0,0 +1,1751 @@ +// Code generated by gen.go; DO NOT EDIT. + +package githubv4 + +// Input represents one of the Input structs: +// +// AcceptEnterpriseAdministratorInvitationInput, AcceptTopicSuggestionInput, AddAssigneesToAssignableInput, AddCommentInput, AddLabelsToLabelableInput, AddProjectCardInput, AddProjectColumnInput, AddPullRequestReviewCommentInput, AddPullRequestReviewInput, AddReactionInput, AddStarInput, ArchiveRepositoryInput, AuditLogOrder, CancelEnterpriseAdminInvitationInput, ChangeUserStatusInput, ClearLabelsFromLabelableInput, CloneProjectInput, CloneTemplateRepositoryInput, CloseIssueInput, ClosePullRequestInput, CommitAuthor, CommitContributionOrder, ContributionOrder, ConvertProjectCardNoteToIssueInput, CreateBranchProtectionRuleInput, CreateContentAttachmentInput, CreateEnterpriseOrganizationInput, CreateIssueInput, CreateProjectInput, CreatePullRequestInput, CreateRefInput, CreateRepositoryInput, CreateTeamDiscussionCommentInput, CreateTeamDiscussionInput, DeclineTopicSuggestionInput, DeleteBranchProtectionRuleInput, DeleteIssueCommentInput, DeleteIssueInput, DeletePackageVersionInput, DeleteProjectCardInput, DeleteProjectColumnInput, DeleteProjectInput, DeletePullRequestReviewCommentInput, DeletePullRequestReviewInput, DeleteRefInput, DeleteTeamDiscussionCommentInput, DeleteTeamDiscussionInput, DeploymentOrder, DismissPullRequestReviewInput, DraftPullRequestReviewComment, EnterpriseAdministratorInvitationOrder, EnterpriseMemberOrder, EnterpriseOrder, EnterpriseServerInstallationOrder, EnterpriseServerUserAccountEmailOrder, EnterpriseServerUserAccountOrder, EnterpriseServerUserAccountsUploadOrder, FollowUserInput, GistOrder, ImportProjectInput, InviteEnterpriseAdminInput, IssueFilters, IssueOrder, LanguageOrder, LinkRepositoryToProjectInput, LockLockableInput, MergeBranchInput, MergePullRequestInput, MilestoneOrder, MinimizeCommentInput, MoveProjectCardInput, MoveProjectColumnInput, OrganizationOrder, PinIssueInput, ProjectCardImport, ProjectColumnImport, ProjectOrder, PullRequestOrder, ReactionOrder, RefOrder, RegenerateEnterpriseIdentityProviderRecoveryCodesInput, RegistryPackageMetadatum, ReleaseOrder, RemoveAssigneesFromAssignableInput, RemoveEnterpriseAdminInput, RemoveEnterpriseOrganizationInput, RemoveLabelsFromLabelableInput, RemoveOutsideCollaboratorInput, RemoveReactionInput, RemoveStarInput, ReopenIssueInput, ReopenPullRequestInput, RepositoryInvitationOrder, RepositoryOrder, RequestReviewsInput, ResolveReviewThreadInput, SavedReplyOrder, SecurityAdvisoryIdentifierFilter, SecurityAdvisoryOrder, SecurityVulnerabilityOrder, SponsorsTierOrder, SponsorshipOrder, StarOrder, SubmitPullRequestReviewInput, TeamDiscussionCommentOrder, TeamDiscussionOrder, TeamMemberOrder, TeamOrder, TeamRepositoryOrder, TransferIssueInput, UnarchiveRepositoryInput, UnfollowUserInput, UnlinkRepositoryFromProjectInput, UnlockLockableInput, UnmarkIssueAsDuplicateInput, UnminimizeCommentInput, UnpinIssueInput, UnresolveReviewThreadInput, UpdateBranchProtectionRuleInput, UpdateEnterpriseActionExecutionCapabilitySettingInput, UpdateEnterpriseAdministratorRoleInput, UpdateEnterpriseAllowPrivateRepositoryForkingSettingInput, UpdateEnterpriseDefaultRepositoryPermissionSettingInput, UpdateEnterpriseMembersCanChangeRepositoryVisibilitySettingInput, UpdateEnterpriseMembersCanCreateRepositoriesSettingInput, UpdateEnterpriseMembersCanDeleteIssuesSettingInput, UpdateEnterpriseMembersCanDeleteRepositoriesSettingInput, UpdateEnterpriseMembersCanInviteCollaboratorsSettingInput, UpdateEnterpriseMembersCanMakePurchasesSettingInput, UpdateEnterpriseMembersCanUpdateProtectedBranchesSettingInput, UpdateEnterpriseMembersCanViewDependencyInsightsSettingInput, UpdateEnterpriseOrganizationProjectsSettingInput, UpdateEnterpriseProfileInput, UpdateEnterpriseRepositoryProjectsSettingInput, UpdateEnterpriseTeamDiscussionsSettingInput, UpdateEnterpriseTwoFactorAuthenticationRequiredSettingInput, UpdateIssueCommentInput, UpdateIssueInput, UpdateProjectCardInput, UpdateProjectColumnInput, UpdateProjectInput, UpdatePullRequestInput, UpdatePullRequestReviewCommentInput, UpdatePullRequestReviewInput, UpdateRefInput, UpdateRepositoryInput, UpdateSubscriptionInput, UpdateTeamDiscussionCommentInput, UpdateTeamDiscussionInput, UpdateTopicsInput, UserStatusOrder. +type Input interface{} + +// AcceptEnterpriseAdministratorInvitationInput is an autogenerated input type of AcceptEnterpriseAdministratorInvitation. +type AcceptEnterpriseAdministratorInvitationInput struct { + // The id of the invitation being accepted. (Required.) + InvitationID ID `json:"invitationId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// AcceptTopicSuggestionInput is an autogenerated input type of AcceptTopicSuggestion. +type AcceptTopicSuggestionInput struct { + // The Node ID of the repository. (Required.) + RepositoryID ID `json:"repositoryId"` + // The name of the suggested topic. (Required.) + Name String `json:"name"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// AddAssigneesToAssignableInput is an autogenerated input type of AddAssigneesToAssignable. +type AddAssigneesToAssignableInput struct { + // The id of the assignable object to add assignees to. (Required.) + AssignableID ID `json:"assignableId"` + // The id of users to add as assignees. (Required.) + AssigneeIDs []ID `json:"assigneeIds"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// AddCommentInput is an autogenerated input type of AddComment. +type AddCommentInput struct { + // The Node ID of the subject to modify. (Required.) + SubjectID ID `json:"subjectId"` + // The contents of the comment. (Required.) + Body String `json:"body"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// AddLabelsToLabelableInput is an autogenerated input type of AddLabelsToLabelable. +type AddLabelsToLabelableInput struct { + // The id of the labelable object to add labels to. (Required.) + LabelableID ID `json:"labelableId"` + // The ids of the labels to add. (Required.) + LabelIDs []ID `json:"labelIds"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// AddProjectCardInput is an autogenerated input type of AddProjectCard. +type AddProjectCardInput struct { + // The Node ID of the ProjectColumn. (Required.) + ProjectColumnID ID `json:"projectColumnId"` + + // The content of the card. Must be a member of the ProjectCardItem union. (Optional.) + ContentID *ID `json:"contentId,omitempty"` + // The note on the card. (Optional.) + Note *String `json:"note,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// AddProjectColumnInput is an autogenerated input type of AddProjectColumn. +type AddProjectColumnInput struct { + // The Node ID of the project. (Required.) + ProjectID ID `json:"projectId"` + // The name of the column. (Required.) + Name String `json:"name"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// AddPullRequestReviewCommentInput is an autogenerated input type of AddPullRequestReviewComment. +type AddPullRequestReviewCommentInput struct { + // The Node ID of the review to modify. (Required.) + PullRequestReviewID ID `json:"pullRequestReviewId"` + // The text of the comment. (Required.) + Body String `json:"body"` + + // The SHA of the commit to comment on. (Optional.) + CommitOID *GitObjectID `json:"commitOID,omitempty"` + // The relative path of the file to comment on. (Optional.) + Path *String `json:"path,omitempty"` + // The line index in the diff to comment on. (Optional.) + Position *Int `json:"position,omitempty"` + // The comment id to reply to. (Optional.) + InReplyTo *ID `json:"inReplyTo,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// AddPullRequestReviewInput is an autogenerated input type of AddPullRequestReview. +type AddPullRequestReviewInput struct { + // The Node ID of the pull request to modify. (Required.) + PullRequestID ID `json:"pullRequestId"` + + // The commit OID the review pertains to. (Optional.) + CommitOID *GitObjectID `json:"commitOID,omitempty"` + // The contents of the review body comment. (Optional.) + Body *String `json:"body,omitempty"` + // The event to perform on the pull request review. (Optional.) + Event *PullRequestReviewEvent `json:"event,omitempty"` + // The review line comments. (Optional.) + Comments *[]*DraftPullRequestReviewComment `json:"comments,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// AddReactionInput is an autogenerated input type of AddReaction. +type AddReactionInput struct { + // The Node ID of the subject to modify. (Required.) + SubjectID ID `json:"subjectId"` + // The name of the emoji to react with. (Required.) + Content ReactionContent `json:"content"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// AddStarInput is an autogenerated input type of AddStar. +type AddStarInput struct { + // The Starrable ID to star. (Required.) + StarrableID ID `json:"starrableId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// ArchiveRepositoryInput is an autogenerated input type of ArchiveRepository. +type ArchiveRepositoryInput struct { + // The ID of the repository to mark as archived. (Required.) + RepositoryID ID `json:"repositoryId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// AuditLogOrder represents ordering options for Audit Log connections. +type AuditLogOrder struct { + + // The field to order Audit Logs by. (Optional.) + Field *AuditLogOrderField `json:"field,omitempty"` + // The ordering direction. (Optional.) + Direction *OrderDirection `json:"direction,omitempty"` +} + +// CancelEnterpriseAdminInvitationInput is an autogenerated input type of CancelEnterpriseAdminInvitation. +type CancelEnterpriseAdminInvitationInput struct { + // The Node ID of the pending enterprise administrator invitation. (Required.) + InvitationID ID `json:"invitationId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// ChangeUserStatusInput is an autogenerated input type of ChangeUserStatus. +type ChangeUserStatusInput struct { + + // The emoji to represent your status. Can either be a native Unicode emoji or an emoji name with colons, e.g., :grinning:. (Optional.) + Emoji *String `json:"emoji,omitempty"` + // A short description of your current status. (Optional.) + Message *String `json:"message,omitempty"` + // The ID of the organization whose members will be allowed to see the status. If omitted, the status will be publicly visible. (Optional.) + OrganizationID *ID `json:"organizationId,omitempty"` + // Whether this status should indicate you are not fully available on GitHub, e.g., you are away. (Optional.) + LimitedAvailability *Boolean `json:"limitedAvailability,omitempty"` + // If set, the user status will not be shown after this date. (Optional.) + ExpiresAt *DateTime `json:"expiresAt,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// ClearLabelsFromLabelableInput is an autogenerated input type of ClearLabelsFromLabelable. +type ClearLabelsFromLabelableInput struct { + // The id of the labelable object to clear the labels from. (Required.) + LabelableID ID `json:"labelableId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// CloneProjectInput is an autogenerated input type of CloneProject. +type CloneProjectInput struct { + // The owner ID to create the project under. (Required.) + TargetOwnerID ID `json:"targetOwnerId"` + // The source project to clone. (Required.) + SourceID ID `json:"sourceId"` + // Whether or not to clone the source project's workflows. (Required.) + IncludeWorkflows Boolean `json:"includeWorkflows"` + // The name of the project. (Required.) + Name String `json:"name"` + + // The description of the project. (Optional.) + Body *String `json:"body,omitempty"` + // The visibility of the project, defaults to false (private). (Optional.) + Public *Boolean `json:"public,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// CloneTemplateRepositoryInput is an autogenerated input type of CloneTemplateRepository. +type CloneTemplateRepositoryInput struct { + // The Node ID of the template repository. (Required.) + RepositoryID ID `json:"repositoryId"` + // The name of the new repository. (Required.) + Name String `json:"name"` + // The ID of the owner for the new repository. (Required.) + OwnerID ID `json:"ownerId"` + // Indicates the repository's visibility level. (Required.) + Visibility RepositoryVisibility `json:"visibility"` + + // A short description of the new repository. (Optional.) + Description *String `json:"description,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// CloseIssueInput is an autogenerated input type of CloseIssue. +type CloseIssueInput struct { + // ID of the issue to be closed. (Required.) + IssueID ID `json:"issueId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// ClosePullRequestInput is an autogenerated input type of ClosePullRequest. +type ClosePullRequestInput struct { + // ID of the pull request to be closed. (Required.) + PullRequestID ID `json:"pullRequestId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// CommitAuthor specifies an author for filtering Git commits. +type CommitAuthor struct { + + // ID of a User to filter by. If non-null, only commits authored by this user will be returned. This field takes precedence over emails. (Optional.) + ID *ID `json:"id,omitempty"` + // Email addresses to filter by. Commits authored by any of the specified email addresses will be returned. (Optional.) + Emails *[]String `json:"emails,omitempty"` +} + +// CommitContributionOrder represents ordering options for commit contribution connections. +type CommitContributionOrder struct { + // The field by which to order commit contributions. (Required.) + Field CommitContributionOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + +// ContributionOrder represents ordering options for contribution connections. +type ContributionOrder struct { + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` + + // The field by which to order contributions. **Upcoming Change on 2019-10-01 UTC** **Description:** `field` will be removed. Only one order field is supported. **Reason:** `field` will be removed. (Optional.) + Field *ContributionOrderField `json:"field,omitempty"` +} + +// ConvertProjectCardNoteToIssueInput is an autogenerated input type of ConvertProjectCardNoteToIssue. +type ConvertProjectCardNoteToIssueInput struct { + // The ProjectCard ID to convert. (Required.) + ProjectCardID ID `json:"projectCardId"` + // The ID of the repository to create the issue in. (Required.) + RepositoryID ID `json:"repositoryId"` + + // The title of the newly created issue. Defaults to the card's note text. (Optional.) + Title *String `json:"title,omitempty"` + // The body of the newly created issue. (Optional.) + Body *String `json:"body,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// CreateBranchProtectionRuleInput is an autogenerated input type of CreateBranchProtectionRule. +type CreateBranchProtectionRuleInput struct { + // The global relay id of the repository in which a new branch protection rule should be created in. (Required.) + RepositoryID ID `json:"repositoryId"` + // The glob-like pattern used to determine matching branches. (Required.) + Pattern String `json:"pattern"` + + // Are approving reviews required to update matching branches. (Optional.) + RequiresApprovingReviews *Boolean `json:"requiresApprovingReviews,omitempty"` + // Number of approving reviews required to update matching branches. (Optional.) + RequiredApprovingReviewCount *Int `json:"requiredApprovingReviewCount,omitempty"` + // Are commits required to be signed. (Optional.) + RequiresCommitSignatures *Boolean `json:"requiresCommitSignatures,omitempty"` + // Can admins overwrite branch protection. (Optional.) + IsAdminEnforced *Boolean `json:"isAdminEnforced,omitempty"` + // Are status checks required to update matching branches. (Optional.) + RequiresStatusChecks *Boolean `json:"requiresStatusChecks,omitempty"` + // Are branches required to be up to date before merging. (Optional.) + RequiresStrictStatusChecks *Boolean `json:"requiresStrictStatusChecks,omitempty"` + // Are reviews from code owners required to update matching branches. (Optional.) + RequiresCodeOwnerReviews *Boolean `json:"requiresCodeOwnerReviews,omitempty"` + // Will new commits pushed to matching branches dismiss pull request review approvals. (Optional.) + DismissesStaleReviews *Boolean `json:"dismissesStaleReviews,omitempty"` + // Is dismissal of pull request reviews restricted. (Optional.) + RestrictsReviewDismissals *Boolean `json:"restrictsReviewDismissals,omitempty"` + // A list of User or Team IDs allowed to dismiss reviews on pull requests targeting matching branches. (Optional.) + ReviewDismissalActorIDs *[]ID `json:"reviewDismissalActorIds,omitempty"` + // Is pushing to matching branches restricted. (Optional.) + RestrictsPushes *Boolean `json:"restrictsPushes,omitempty"` + // A list of User, Team or App IDs allowed to push to matching branches. (Optional.) + PushActorIDs *[]ID `json:"pushActorIds,omitempty"` + // List of required status check contexts that must pass for commits to be accepted to matching branches. (Optional.) + RequiredStatusCheckContexts *[]String `json:"requiredStatusCheckContexts,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// CreateContentAttachmentInput is an autogenerated input type of CreateContentAttachment. +type CreateContentAttachmentInput struct { + // The node ID of the content_reference. (Required.) + ContentReferenceID ID `json:"contentReferenceId"` + // The title of the content attachment. (Required.) + Title String `json:"title"` + // The body of the content attachment, which may contain markdown. (Required.) + Body String `json:"body"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// CreateEnterpriseOrganizationInput is an autogenerated input type of CreateEnterpriseOrganization. +type CreateEnterpriseOrganizationInput struct { + // The ID of the enterprise owning the new organization. (Required.) + EnterpriseID ID `json:"enterpriseId"` + // The login of the new organization. (Required.) + Login String `json:"login"` + // The profile name of the new organization. (Required.) + ProfileName String `json:"profileName"` + // The email used for sending billing receipts. (Required.) + BillingEmail String `json:"billingEmail"` + // The logins for the administrators of the new organization. (Required.) + AdminLogins []String `json:"adminLogins"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// CreateIssueInput is an autogenerated input type of CreateIssue. +type CreateIssueInput struct { + // The Node ID of the repository. (Required.) + RepositoryID ID `json:"repositoryId"` + // The title for the issue. (Required.) + Title String `json:"title"` + + // The body for the issue description. (Optional.) + Body *String `json:"body,omitempty"` + // The Node ID for the user assignee for this issue. (Optional.) + AssigneeIDs *[]ID `json:"assigneeIds,omitempty"` + // The Node ID of the milestone for this issue. (Optional.) + MilestoneID *ID `json:"milestoneId,omitempty"` + // An array of Node IDs of labels for this issue. (Optional.) + LabelIDs *[]ID `json:"labelIds,omitempty"` + // An array of Node IDs for projects associated with this issue. (Optional.) + ProjectIDs *[]ID `json:"projectIds,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// CreateProjectInput is an autogenerated input type of CreateProject. +type CreateProjectInput struct { + // The owner ID to create the project under. (Required.) + OwnerID ID `json:"ownerId"` + // The name of project. (Required.) + Name String `json:"name"` + + // The description of project. (Optional.) + Body *String `json:"body,omitempty"` + // The name of the GitHub-provided template. (Optional.) + Template *ProjectTemplate `json:"template,omitempty"` + // A list of repository IDs to create as linked repositories for the project. (Optional.) + RepositoryIDs *[]ID `json:"repositoryIds,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// CreatePullRequestInput is an autogenerated input type of CreatePullRequest. +type CreatePullRequestInput struct { + // The Node ID of the repository. (Required.) + RepositoryID ID `json:"repositoryId"` + // The name of the branch you want your changes pulled into. This should be an existing branch on the current repository. You cannot update the base branch on a pull request to point to another repository. (Required.) + BaseRefName String `json:"baseRefName"` + // The name of the branch where your changes are implemented. For cross-repository pull requests in the same network, namespace `head_ref_name` with a user like this: `username:branch`. (Required.) + HeadRefName String `json:"headRefName"` + // The title of the pull request. (Required.) + Title String `json:"title"` + + // The contents of the pull request. (Optional.) + Body *String `json:"body,omitempty"` + // Indicates whether maintainers can modify the pull request. (Optional.) + MaintainerCanModify *Boolean `json:"maintainerCanModify,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// CreateRefInput is an autogenerated input type of CreateRef. +type CreateRefInput struct { + // The Node ID of the Repository to create the Ref in. (Required.) + RepositoryID ID `json:"repositoryId"` + // The fully qualified name of the new Ref (ie: `refs/heads/my_new_branch`). (Required.) + Name String `json:"name"` + // The GitObjectID that the new Ref shall target. Must point to a commit. (Required.) + Oid GitObjectID `json:"oid"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// CreateRepositoryInput is an autogenerated input type of CreateRepository. +type CreateRepositoryInput struct { + // The name of the new repository. (Required.) + Name String `json:"name"` + // Indicates the repository's visibility level. (Required.) + Visibility RepositoryVisibility `json:"visibility"` + + // The ID of the owner for the new repository. (Optional.) + OwnerID *ID `json:"ownerId,omitempty"` + // A short description of the new repository. (Optional.) + Description *String `json:"description,omitempty"` + // Whether this repository should be marked as a template such that anyone who can access it can create new repositories with the same files and directory structure. (Optional.) + Template *Boolean `json:"template,omitempty"` + // The URL for a web page about this repository. (Optional.) + HomepageURL *URI `json:"homepageUrl,omitempty"` + // Indicates if the repository should have the wiki feature enabled. (Optional.) + HasWikiEnabled *Boolean `json:"hasWikiEnabled,omitempty"` + // Indicates if the repository should have the issues feature enabled. (Optional.) + HasIssuesEnabled *Boolean `json:"hasIssuesEnabled,omitempty"` + // When an organization is specified as the owner, this ID identifies the team that should be granted access to the new repository. (Optional.) + TeamID *ID `json:"teamId,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// CreateTeamDiscussionCommentInput is an autogenerated input type of CreateTeamDiscussionComment. +type CreateTeamDiscussionCommentInput struct { + // The ID of the discussion to which the comment belongs. (Required.) + DiscussionID ID `json:"discussionId"` + // The content of the comment. (Required.) + Body String `json:"body"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// CreateTeamDiscussionInput is an autogenerated input type of CreateTeamDiscussion. +type CreateTeamDiscussionInput struct { + // The ID of the team to which the discussion belongs. (Required.) + TeamID ID `json:"teamId"` + // The title of the discussion. (Required.) + Title String `json:"title"` + // The content of the discussion. (Required.) + Body String `json:"body"` + + // If true, restricts the visiblity of this discussion to team members and organization admins. If false or not specified, allows any organization member to view this discussion. (Optional.) + Private *Boolean `json:"private,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// DeclineTopicSuggestionInput is an autogenerated input type of DeclineTopicSuggestion. +type DeclineTopicSuggestionInput struct { + // The Node ID of the repository. (Required.) + RepositoryID ID `json:"repositoryId"` + // The name of the suggested topic. (Required.) + Name String `json:"name"` + // The reason why the suggested topic is declined. (Required.) + Reason TopicSuggestionDeclineReason `json:"reason"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// DeleteBranchProtectionRuleInput is an autogenerated input type of DeleteBranchProtectionRule. +type DeleteBranchProtectionRuleInput struct { + // The global relay id of the branch protection rule to be deleted. (Required.) + BranchProtectionRuleID ID `json:"branchProtectionRuleId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// DeleteIssueCommentInput is an autogenerated input type of DeleteIssueComment. +type DeleteIssueCommentInput struct { + // The ID of the comment to delete. (Required.) + ID ID `json:"id"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// DeleteIssueInput is an autogenerated input type of DeleteIssue. +type DeleteIssueInput struct { + // The ID of the issue to delete. (Required.) + IssueID ID `json:"issueId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// DeletePackageVersionInput is an autogenerated input type of DeletePackageVersion. +type DeletePackageVersionInput struct { + // The ID of the package version to be deleted. (Required.) + PackageVersionID ID `json:"packageVersionId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// DeleteProjectCardInput is an autogenerated input type of DeleteProjectCard. +type DeleteProjectCardInput struct { + // The id of the card to delete. (Required.) + CardID ID `json:"cardId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// DeleteProjectColumnInput is an autogenerated input type of DeleteProjectColumn. +type DeleteProjectColumnInput struct { + // The id of the column to delete. (Required.) + ColumnID ID `json:"columnId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// DeleteProjectInput is an autogenerated input type of DeleteProject. +type DeleteProjectInput struct { + // The Project ID to update. (Required.) + ProjectID ID `json:"projectId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// DeletePullRequestReviewCommentInput is an autogenerated input type of DeletePullRequestReviewComment. +type DeletePullRequestReviewCommentInput struct { + // The ID of the comment to delete. (Required.) + ID ID `json:"id"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// DeletePullRequestReviewInput is an autogenerated input type of DeletePullRequestReview. +type DeletePullRequestReviewInput struct { + // The Node ID of the pull request review to delete. (Required.) + PullRequestReviewID ID `json:"pullRequestReviewId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// DeleteRefInput is an autogenerated input type of DeleteRef. +type DeleteRefInput struct { + // The Node ID of the Ref to be deleted. (Required.) + RefID ID `json:"refId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// DeleteTeamDiscussionCommentInput is an autogenerated input type of DeleteTeamDiscussionComment. +type DeleteTeamDiscussionCommentInput struct { + // The ID of the comment to delete. (Required.) + ID ID `json:"id"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// DeleteTeamDiscussionInput is an autogenerated input type of DeleteTeamDiscussion. +type DeleteTeamDiscussionInput struct { + // The discussion ID to delete. (Required.) + ID ID `json:"id"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// DeploymentOrder represents ordering options for deployment connections. +type DeploymentOrder struct { + // The field to order deployments by. (Required.) + Field DeploymentOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + +// DismissPullRequestReviewInput is an autogenerated input type of DismissPullRequestReview. +type DismissPullRequestReviewInput struct { + // The Node ID of the pull request review to modify. (Required.) + PullRequestReviewID ID `json:"pullRequestReviewId"` + // The contents of the pull request review dismissal message. (Required.) + Message String `json:"message"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// DraftPullRequestReviewComment specifies a review comment to be left with a Pull Request Review. +type DraftPullRequestReviewComment struct { + // Path to the file being commented on. (Required.) + Path String `json:"path"` + // Position in the file to leave a comment on. (Required.) + Position Int `json:"position"` + // Body of the comment to leave. (Required.) + Body String `json:"body"` +} + +// EnterpriseAdministratorInvitationOrder represents ordering options for enterprise administrator invitation connections. +type EnterpriseAdministratorInvitationOrder struct { + // The field to order enterprise administrator invitations by. (Required.) + Field EnterpriseAdministratorInvitationOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + +// EnterpriseMemberOrder represents ordering options for enterprise member connections. +type EnterpriseMemberOrder struct { + // The field to order enterprise members by. (Required.) + Field EnterpriseMemberOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + +// EnterpriseOrder represents ordering options for enterprises. +type EnterpriseOrder struct { + // The field to order enterprises by. (Required.) + Field EnterpriseOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + +// EnterpriseServerInstallationOrder represents ordering options for Enterprise Server installation connections. +type EnterpriseServerInstallationOrder struct { + // The field to order Enterprise Server installations by. (Required.) + Field EnterpriseServerInstallationOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + +// EnterpriseServerUserAccountEmailOrder represents ordering options for Enterprise Server user account email connections. +type EnterpriseServerUserAccountEmailOrder struct { + // The field to order emails by. (Required.) + Field EnterpriseServerUserAccountEmailOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + +// EnterpriseServerUserAccountOrder represents ordering options for Enterprise Server user account connections. +type EnterpriseServerUserAccountOrder struct { + // The field to order user accounts by. (Required.) + Field EnterpriseServerUserAccountOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + +// EnterpriseServerUserAccountsUploadOrder represents ordering options for Enterprise Server user accounts upload connections. +type EnterpriseServerUserAccountsUploadOrder struct { + // The field to order user accounts uploads by. (Required.) + Field EnterpriseServerUserAccountsUploadOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + +// FollowUserInput is an autogenerated input type of FollowUser. +type FollowUserInput struct { + // ID of the user to follow. (Required.) + UserID ID `json:"userId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// GistOrder represents ordering options for gist connections. +type GistOrder struct { + // The field to order repositories by. (Required.) + Field GistOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + +// ImportProjectInput is an autogenerated input type of ImportProject. +type ImportProjectInput struct { + // The name of the Organization or User to create the Project under. (Required.) + OwnerName String `json:"ownerName"` + // The name of Project. (Required.) + Name String `json:"name"` + // A list of columns containing issues and pull requests. (Required.) + ColumnImports []ProjectColumnImport `json:"columnImports"` + + // The description of Project. (Optional.) + Body *String `json:"body,omitempty"` + // Whether the Project is public or not. (Optional.) + Public *Boolean `json:"public,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// InviteEnterpriseAdminInput is an autogenerated input type of InviteEnterpriseAdmin. +type InviteEnterpriseAdminInput struct { + // The ID of the enterprise to which you want to invite an administrator. (Required.) + EnterpriseID ID `json:"enterpriseId"` + + // The login of a user to invite as an administrator. (Optional.) + Invitee *String `json:"invitee,omitempty"` + // The email of the person to invite as an administrator. (Optional.) + Email *String `json:"email,omitempty"` + // The role of the administrator. (Optional.) + Role *EnterpriseAdministratorRole `json:"role,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// IssueFilters represents ways in which to filter lists of issues. +type IssueFilters struct { + + // List issues assigned to given name. Pass in `null` for issues with no assigned user, and `*` for issues assigned to any user. (Optional.) + Assignee *String `json:"assignee,omitempty"` + // List issues created by given name. (Optional.) + CreatedBy *String `json:"createdBy,omitempty"` + // List issues where the list of label names exist on the issue. (Optional.) + Labels *[]String `json:"labels,omitempty"` + // List issues where the given name is mentioned in the issue. (Optional.) + Mentioned *String `json:"mentioned,omitempty"` + // List issues by given milestone argument. If an string representation of an integer is passed, it should refer to a milestone by its number field. Pass in `null` for issues with no milestone, and `*` for issues that are assigned to any milestone. (Optional.) + Milestone *String `json:"milestone,omitempty"` + // List issues that have been updated at or after the given date. (Optional.) + Since *DateTime `json:"since,omitempty"` + // List issues filtered by the list of states given. (Optional.) + States *[]IssueState `json:"states,omitempty"` + // List issues subscribed to by viewer. (Optional.) + ViewerSubscribed *Boolean `json:"viewerSubscribed,omitempty"` +} + +// IssueOrder represents ways in which lists of issues can be ordered upon return. +type IssueOrder struct { + // The field in which to order issues by. (Required.) + Field IssueOrderField `json:"field"` + // The direction in which to order issues by the specified field. (Required.) + Direction OrderDirection `json:"direction"` +} + +// LanguageOrder represents ordering options for language connections. +type LanguageOrder struct { + // The field to order languages by. (Required.) + Field LanguageOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + +// LinkRepositoryToProjectInput is an autogenerated input type of LinkRepositoryToProject. +type LinkRepositoryToProjectInput struct { + // The ID of the Project to link to a Repository. (Required.) + ProjectID ID `json:"projectId"` + // The ID of the Repository to link to a Project. (Required.) + RepositoryID ID `json:"repositoryId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// LockLockableInput is an autogenerated input type of LockLockable. +type LockLockableInput struct { + // ID of the issue or pull request to be locked. (Required.) + LockableID ID `json:"lockableId"` + + // A reason for why the issue or pull request will be locked. (Optional.) + LockReason *LockReason `json:"lockReason,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// MergeBranchInput is an autogenerated input type of MergeBranch. +type MergeBranchInput struct { + // The Node ID of the Repository containing the base branch that will be modified. (Required.) + RepositoryID ID `json:"repositoryId"` + // The name of the base branch that the provided head will be merged into. (Required.) + Base String `json:"base"` + // The head to merge into the base branch. This can be a branch name or a commit GitObjectID. (Required.) + Head String `json:"head"` + + // Message to use for the merge commit. If omitted, a default will be used. (Optional.) + CommitMessage *String `json:"commitMessage,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// MergePullRequestInput is an autogenerated input type of MergePullRequest. +type MergePullRequestInput struct { + // ID of the pull request to be merged. (Required.) + PullRequestID ID `json:"pullRequestId"` + + // Commit headline to use for the merge commit; if omitted, a default message will be used. (Optional.) + CommitHeadline *String `json:"commitHeadline,omitempty"` + // Commit body to use for the merge commit; if omitted, a default message will be used. (Optional.) + CommitBody *String `json:"commitBody,omitempty"` + // OID that the pull request head ref must match to allow merge; if omitted, no check is performed. (Optional.) + ExpectedHeadOid *GitObjectID `json:"expectedHeadOid,omitempty"` + // The merge method to use. If omitted, defaults to 'MERGE'. (Optional.) + MergeMethod *PullRequestMergeMethod `json:"mergeMethod,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// MilestoneOrder represents ordering options for milestone connections. +type MilestoneOrder struct { + // The field to order milestones by. (Required.) + Field MilestoneOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + +// MinimizeCommentInput is an autogenerated input type of MinimizeComment. +type MinimizeCommentInput struct { + // The Node ID of the subject to modify. (Required.) + SubjectID ID `json:"subjectId"` + // The classification of comment. (Required.) + Classifier ReportedContentClassifiers `json:"classifier"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// MoveProjectCardInput is an autogenerated input type of MoveProjectCard. +type MoveProjectCardInput struct { + // The id of the card to move. (Required.) + CardID ID `json:"cardId"` + // The id of the column to move it into. (Required.) + ColumnID ID `json:"columnId"` + + // Place the new card after the card with this id. Pass null to place it at the top. (Optional.) + AfterCardID *ID `json:"afterCardId,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// MoveProjectColumnInput is an autogenerated input type of MoveProjectColumn. +type MoveProjectColumnInput struct { + // The id of the column to move. (Required.) + ColumnID ID `json:"columnId"` + + // Place the new column after the column with this id. Pass null to place it at the front. (Optional.) + AfterColumnID *ID `json:"afterColumnId,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// OrganizationOrder represents ordering options for organization connections. +type OrganizationOrder struct { + // The field to order organizations by. (Required.) + Field OrganizationOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + +// PinIssueInput is an autogenerated input type of PinIssue. +type PinIssueInput struct { + // The ID of the issue to be pinned. (Required.) + IssueID ID `json:"issueId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// ProjectCardImport represents an issue or PR and its owning repository to be used in a project card. +type ProjectCardImport struct { + // Repository name with owner (owner/repository). (Required.) + Repository String `json:"repository"` + // The issue or pull request number. (Required.) + Number Int `json:"number"` +} + +// ProjectColumnImport represents a project column and a list of its issues and PRs. +type ProjectColumnImport struct { + // The name of the column. (Required.) + ColumnName String `json:"columnName"` + // The position of the column, starting from 0. (Required.) + Position Int `json:"position"` + + // A list of issues and pull requests in the column. (Optional.) + Issues *[]ProjectCardImport `json:"issues,omitempty"` +} + +// ProjectOrder represents ways in which lists of projects can be ordered upon return. +type ProjectOrder struct { + // The field in which to order projects by. (Required.) + Field ProjectOrderField `json:"field"` + // The direction in which to order projects by the specified field. (Required.) + Direction OrderDirection `json:"direction"` +} + +// PullRequestOrder represents ways in which lists of issues can be ordered upon return. +type PullRequestOrder struct { + // The field in which to order pull requests by. (Required.) + Field PullRequestOrderField `json:"field"` + // The direction in which to order pull requests by the specified field. (Required.) + Direction OrderDirection `json:"direction"` +} + +// ReactionOrder represents ways in which lists of reactions can be ordered upon return. +type ReactionOrder struct { + // The field in which to order reactions by. (Required.) + Field ReactionOrderField `json:"field"` + // The direction in which to order reactions by the specified field. (Required.) + Direction OrderDirection `json:"direction"` +} + +// RefOrder represents ways in which lists of git refs can be ordered upon return. +type RefOrder struct { + // The field in which to order refs by. (Required.) + Field RefOrderField `json:"field"` + // The direction in which to order refs by the specified field. (Required.) + Direction OrderDirection `json:"direction"` +} + +// RegenerateEnterpriseIdentityProviderRecoveryCodesInput is an autogenerated input type of RegenerateEnterpriseIdentityProviderRecoveryCodes. +type RegenerateEnterpriseIdentityProviderRecoveryCodesInput struct { + // The ID of the enterprise on which to set an identity provider. (Required.) + EnterpriseID ID `json:"enterpriseId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// RegistryPackageMetadatum represents represents a single registry metadatum. +type RegistryPackageMetadatum struct { + // Name of the metadatum. (Required.) + Name String `json:"name"` + // Value of the metadatum. (Required.) + Value String `json:"value"` + + // True, if the metadatum can be updated if it already exists. (Optional.) + Update *Boolean `json:"update,omitempty"` +} + +// ReleaseOrder represents ways in which lists of releases can be ordered upon return. +type ReleaseOrder struct { + // The field in which to order releases by. (Required.) + Field ReleaseOrderField `json:"field"` + // The direction in which to order releases by the specified field. (Required.) + Direction OrderDirection `json:"direction"` +} + +// RemoveAssigneesFromAssignableInput is an autogenerated input type of RemoveAssigneesFromAssignable. +type RemoveAssigneesFromAssignableInput struct { + // The id of the assignable object to remove assignees from. (Required.) + AssignableID ID `json:"assignableId"` + // The id of users to remove as assignees. (Required.) + AssigneeIDs []ID `json:"assigneeIds"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// RemoveEnterpriseAdminInput is an autogenerated input type of RemoveEnterpriseAdmin. +type RemoveEnterpriseAdminInput struct { + // The Enterprise ID from which to remove the administrator. (Required.) + EnterpriseID ID `json:"enterpriseId"` + // The login of the user to remove as an administrator. (Required.) + Login String `json:"login"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// RemoveEnterpriseOrganizationInput is an autogenerated input type of RemoveEnterpriseOrganization. +type RemoveEnterpriseOrganizationInput struct { + // The ID of the enterprise from which the organization should be removed. (Required.) + EnterpriseID ID `json:"enterpriseId"` + // The ID of the organization to remove from the enterprise. (Required.) + OrganizationID ID `json:"organizationId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// RemoveLabelsFromLabelableInput is an autogenerated input type of RemoveLabelsFromLabelable. +type RemoveLabelsFromLabelableInput struct { + // The id of the Labelable to remove labels from. (Required.) + LabelableID ID `json:"labelableId"` + // The ids of labels to remove. (Required.) + LabelIDs []ID `json:"labelIds"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// RemoveOutsideCollaboratorInput is an autogenerated input type of RemoveOutsideCollaborator. +type RemoveOutsideCollaboratorInput struct { + // The ID of the outside collaborator to remove. (Required.) + UserID ID `json:"userId"` + // The ID of the organization to remove the outside collaborator from. (Required.) + OrganizationID ID `json:"organizationId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// RemoveReactionInput is an autogenerated input type of RemoveReaction. +type RemoveReactionInput struct { + // The Node ID of the subject to modify. (Required.) + SubjectID ID `json:"subjectId"` + // The name of the emoji reaction to remove. (Required.) + Content ReactionContent `json:"content"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// RemoveStarInput is an autogenerated input type of RemoveStar. +type RemoveStarInput struct { + // The Starrable ID to unstar. (Required.) + StarrableID ID `json:"starrableId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// ReopenIssueInput is an autogenerated input type of ReopenIssue. +type ReopenIssueInput struct { + // ID of the issue to be opened. (Required.) + IssueID ID `json:"issueId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// ReopenPullRequestInput is an autogenerated input type of ReopenPullRequest. +type ReopenPullRequestInput struct { + // ID of the pull request to be reopened. (Required.) + PullRequestID ID `json:"pullRequestId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// RepositoryInvitationOrder represents ordering options for repository invitation connections. +type RepositoryInvitationOrder struct { + // The field to order repository invitations by. (Required.) + Field RepositoryInvitationOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + +// RepositoryOrder represents ordering options for repository connections. +type RepositoryOrder struct { + // The field to order repositories by. (Required.) + Field RepositoryOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + +// RequestReviewsInput is an autogenerated input type of RequestReviews. +type RequestReviewsInput struct { + // The Node ID of the pull request to modify. (Required.) + PullRequestID ID `json:"pullRequestId"` + + // The Node IDs of the user to request. (Optional.) + UserIDs *[]ID `json:"userIds,omitempty"` + // The Node IDs of the team to request. (Optional.) + TeamIDs *[]ID `json:"teamIds,omitempty"` + // Add users to the set rather than replace. (Optional.) + Union *Boolean `json:"union,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// ResolveReviewThreadInput is an autogenerated input type of ResolveReviewThread. +type ResolveReviewThreadInput struct { + // The ID of the thread to resolve. (Required.) + ThreadID ID `json:"threadId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// SavedReplyOrder represents ordering options for saved reply connections. +type SavedReplyOrder struct { + // The field to order saved replies by. (Required.) + Field SavedReplyOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + +// SecurityAdvisoryIdentifierFilter represents an advisory identifier to filter results on. +type SecurityAdvisoryIdentifierFilter struct { + // The identifier type. (Required.) + Type SecurityAdvisoryIdentifierType `json:"type"` + // The identifier string. Supports exact or partial matching. (Required.) + Value String `json:"value"` +} + +// SecurityAdvisoryOrder represents ordering options for security advisory connections. +type SecurityAdvisoryOrder struct { + // The field to order security advisories by. (Required.) + Field SecurityAdvisoryOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + +// SecurityVulnerabilityOrder represents ordering options for security vulnerability connections. +type SecurityVulnerabilityOrder struct { + // The field to order security vulnerabilities by. (Required.) + Field SecurityVulnerabilityOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + +// SponsorsTierOrder represents ordering options for Sponsors tiers connections. +type SponsorsTierOrder struct { + // The field to order tiers by. (Required.) + Field SponsorsTierOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + +// SponsorshipOrder represents ordering options for sponsorship connections. +type SponsorshipOrder struct { + // The field to order sponsorship by. (Required.) + Field SponsorshipOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + +// StarOrder represents ways in which star connections can be ordered. +type StarOrder struct { + // The field in which to order nodes by. (Required.) + Field StarOrderField `json:"field"` + // The direction in which to order nodes. (Required.) + Direction OrderDirection `json:"direction"` +} + +// SubmitPullRequestReviewInput is an autogenerated input type of SubmitPullRequestReview. +type SubmitPullRequestReviewInput struct { + // The Pull Request Review ID to submit. (Required.) + PullRequestReviewID ID `json:"pullRequestReviewId"` + // The event to send to the Pull Request Review. (Required.) + Event PullRequestReviewEvent `json:"event"` + + // The text field to set on the Pull Request Review. (Optional.) + Body *String `json:"body,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// TeamDiscussionCommentOrder represents ways in which team discussion comment connections can be ordered. +type TeamDiscussionCommentOrder struct { + // The field by which to order nodes. (Required.) + Field TeamDiscussionCommentOrderField `json:"field"` + // The direction in which to order nodes. (Required.) + Direction OrderDirection `json:"direction"` +} + +// TeamDiscussionOrder represents ways in which team discussion connections can be ordered. +type TeamDiscussionOrder struct { + // The field by which to order nodes. (Required.) + Field TeamDiscussionOrderField `json:"field"` + // The direction in which to order nodes. (Required.) + Direction OrderDirection `json:"direction"` +} + +// TeamMemberOrder represents ordering options for team member connections. +type TeamMemberOrder struct { + // The field to order team members by. (Required.) + Field TeamMemberOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + +// TeamOrder represents ways in which team connections can be ordered. +type TeamOrder struct { + // The field in which to order nodes by. (Required.) + Field TeamOrderField `json:"field"` + // The direction in which to order nodes. (Required.) + Direction OrderDirection `json:"direction"` +} + +// TeamRepositoryOrder represents ordering options for team repository connections. +type TeamRepositoryOrder struct { + // The field to order repositories by. (Required.) + Field TeamRepositoryOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + +// TransferIssueInput is an autogenerated input type of TransferIssue. +type TransferIssueInput struct { + // The Node ID of the issue to be transferred. (Required.) + IssueID ID `json:"issueId"` + // The Node ID of the repository the issue should be transferred to. (Required.) + RepositoryID ID `json:"repositoryId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UnarchiveRepositoryInput is an autogenerated input type of UnarchiveRepository. +type UnarchiveRepositoryInput struct { + // The ID of the repository to unarchive. (Required.) + RepositoryID ID `json:"repositoryId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UnfollowUserInput is an autogenerated input type of UnfollowUser. +type UnfollowUserInput struct { + // ID of the user to unfollow. (Required.) + UserID ID `json:"userId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UnlinkRepositoryFromProjectInput is an autogenerated input type of UnlinkRepositoryFromProject. +type UnlinkRepositoryFromProjectInput struct { + // The ID of the Project linked to the Repository. (Required.) + ProjectID ID `json:"projectId"` + // The ID of the Repository linked to the Project. (Required.) + RepositoryID ID `json:"repositoryId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UnlockLockableInput is an autogenerated input type of UnlockLockable. +type UnlockLockableInput struct { + // ID of the issue or pull request to be unlocked. (Required.) + LockableID ID `json:"lockableId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UnmarkIssueAsDuplicateInput is an autogenerated input type of UnmarkIssueAsDuplicate. +type UnmarkIssueAsDuplicateInput struct { + // ID of the issue or pull request currently marked as a duplicate. (Required.) + DuplicateID ID `json:"duplicateId"` + // ID of the issue or pull request currently considered canonical/authoritative/original. (Required.) + CanonicalID ID `json:"canonicalId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UnminimizeCommentInput is an autogenerated input type of UnminimizeComment. +type UnminimizeCommentInput struct { + // The Node ID of the subject to modify. (Required.) + SubjectID ID `json:"subjectId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UnpinIssueInput is an autogenerated input type of UnpinIssue. +type UnpinIssueInput struct { + // The ID of the issue to be unpinned. (Required.) + IssueID ID `json:"issueId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UnresolveReviewThreadInput is an autogenerated input type of UnresolveReviewThread. +type UnresolveReviewThreadInput struct { + // The ID of the thread to unresolve. (Required.) + ThreadID ID `json:"threadId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateBranchProtectionRuleInput is an autogenerated input type of UpdateBranchProtectionRule. +type UpdateBranchProtectionRuleInput struct { + // The global relay id of the branch protection rule to be updated. (Required.) + BranchProtectionRuleID ID `json:"branchProtectionRuleId"` + + // The glob-like pattern used to determine matching branches. (Optional.) + Pattern *String `json:"pattern,omitempty"` + // Are approving reviews required to update matching branches. (Optional.) + RequiresApprovingReviews *Boolean `json:"requiresApprovingReviews,omitempty"` + // Number of approving reviews required to update matching branches. (Optional.) + RequiredApprovingReviewCount *Int `json:"requiredApprovingReviewCount,omitempty"` + // Are commits required to be signed. (Optional.) + RequiresCommitSignatures *Boolean `json:"requiresCommitSignatures,omitempty"` + // Can admins overwrite branch protection. (Optional.) + IsAdminEnforced *Boolean `json:"isAdminEnforced,omitempty"` + // Are status checks required to update matching branches. (Optional.) + RequiresStatusChecks *Boolean `json:"requiresStatusChecks,omitempty"` + // Are branches required to be up to date before merging. (Optional.) + RequiresStrictStatusChecks *Boolean `json:"requiresStrictStatusChecks,omitempty"` + // Are reviews from code owners required to update matching branches. (Optional.) + RequiresCodeOwnerReviews *Boolean `json:"requiresCodeOwnerReviews,omitempty"` + // Will new commits pushed to matching branches dismiss pull request review approvals. (Optional.) + DismissesStaleReviews *Boolean `json:"dismissesStaleReviews,omitempty"` + // Is dismissal of pull request reviews restricted. (Optional.) + RestrictsReviewDismissals *Boolean `json:"restrictsReviewDismissals,omitempty"` + // A list of User or Team IDs allowed to dismiss reviews on pull requests targeting matching branches. (Optional.) + ReviewDismissalActorIDs *[]ID `json:"reviewDismissalActorIds,omitempty"` + // Is pushing to matching branches restricted. (Optional.) + RestrictsPushes *Boolean `json:"restrictsPushes,omitempty"` + // A list of User, Team or App IDs allowed to push to matching branches. (Optional.) + PushActorIDs *[]ID `json:"pushActorIds,omitempty"` + // List of required status check contexts that must pass for commits to be accepted to matching branches. (Optional.) + RequiredStatusCheckContexts *[]String `json:"requiredStatusCheckContexts,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateEnterpriseActionExecutionCapabilitySettingInput is an autogenerated input type of UpdateEnterpriseActionExecutionCapabilitySetting. +type UpdateEnterpriseActionExecutionCapabilitySettingInput struct { + // The ID of the enterprise on which to set the members can create repositories setting. (Required.) + EnterpriseID ID `json:"enterpriseId"` + // The value for the action execution capability setting on the enterprise. (Required.) + Capability ActionExecutionCapabilitySetting `json:"capability"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateEnterpriseAdministratorRoleInput is an autogenerated input type of UpdateEnterpriseAdministratorRole. +type UpdateEnterpriseAdministratorRoleInput struct { + // The ID of the Enterprise which the admin belongs to. (Required.) + EnterpriseID ID `json:"enterpriseId"` + // The login of a administrator whose role is being changed. (Required.) + Login String `json:"login"` + // The new role for the Enterprise administrator. (Required.) + Role EnterpriseAdministratorRole `json:"role"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateEnterpriseAllowPrivateRepositoryForkingSettingInput is an autogenerated input type of UpdateEnterpriseAllowPrivateRepositoryForkingSetting. +type UpdateEnterpriseAllowPrivateRepositoryForkingSettingInput struct { + // The ID of the enterprise on which to set the allow private repository forking setting. (Required.) + EnterpriseID ID `json:"enterpriseId"` + // The value for the allow private repository forking setting on the enterprise. (Required.) + SettingValue EnterpriseEnabledDisabledSettingValue `json:"settingValue"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateEnterpriseDefaultRepositoryPermissionSettingInput is an autogenerated input type of UpdateEnterpriseDefaultRepositoryPermissionSetting. +type UpdateEnterpriseDefaultRepositoryPermissionSettingInput struct { + // The ID of the enterprise on which to set the default repository permission setting. (Required.) + EnterpriseID ID `json:"enterpriseId"` + // The value for the default repository permission setting on the enterprise. (Required.) + SettingValue EnterpriseDefaultRepositoryPermissionSettingValue `json:"settingValue"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateEnterpriseMembersCanChangeRepositoryVisibilitySettingInput is an autogenerated input type of UpdateEnterpriseMembersCanChangeRepositoryVisibilitySetting. +type UpdateEnterpriseMembersCanChangeRepositoryVisibilitySettingInput struct { + // The ID of the enterprise on which to set the members can change repository visibility setting. (Required.) + EnterpriseID ID `json:"enterpriseId"` + // The value for the members can change repository visibility setting on the enterprise. (Required.) + SettingValue EnterpriseEnabledDisabledSettingValue `json:"settingValue"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateEnterpriseMembersCanCreateRepositoriesSettingInput is an autogenerated input type of UpdateEnterpriseMembersCanCreateRepositoriesSetting. +type UpdateEnterpriseMembersCanCreateRepositoriesSettingInput struct { + // The ID of the enterprise on which to set the members can create repositories setting. (Required.) + EnterpriseID ID `json:"enterpriseId"` + + // Value for the members can create repositories setting on the enterprise. This or the granular public/private/internal allowed fields (but not both) must be provided. (Optional.) + SettingValue *EnterpriseMembersCanCreateRepositoriesSettingValue `json:"settingValue,omitempty"` + // When false, allow member organizations to set their own repository creation member privileges. (Optional.) + MembersCanCreateRepositoriesPolicyEnabled *Boolean `json:"membersCanCreateRepositoriesPolicyEnabled,omitempty"` + // Allow members to create public repositories. Defaults to current value. (Optional.) + MembersCanCreatePublicRepositories *Boolean `json:"membersCanCreatePublicRepositories,omitempty"` + // Allow members to create private repositories. Defaults to current value. (Optional.) + MembersCanCreatePrivateRepositories *Boolean `json:"membersCanCreatePrivateRepositories,omitempty"` + // Allow members to create internal repositories. Defaults to current value. (Optional.) + MembersCanCreateInternalRepositories *Boolean `json:"membersCanCreateInternalRepositories,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateEnterpriseMembersCanDeleteIssuesSettingInput is an autogenerated input type of UpdateEnterpriseMembersCanDeleteIssuesSetting. +type UpdateEnterpriseMembersCanDeleteIssuesSettingInput struct { + // The ID of the enterprise on which to set the members can delete issues setting. (Required.) + EnterpriseID ID `json:"enterpriseId"` + // The value for the members can delete issues setting on the enterprise. (Required.) + SettingValue EnterpriseEnabledDisabledSettingValue `json:"settingValue"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateEnterpriseMembersCanDeleteRepositoriesSettingInput is an autogenerated input type of UpdateEnterpriseMembersCanDeleteRepositoriesSetting. +type UpdateEnterpriseMembersCanDeleteRepositoriesSettingInput struct { + // The ID of the enterprise on which to set the members can delete repositories setting. (Required.) + EnterpriseID ID `json:"enterpriseId"` + // The value for the members can delete repositories setting on the enterprise. (Required.) + SettingValue EnterpriseEnabledDisabledSettingValue `json:"settingValue"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateEnterpriseMembersCanInviteCollaboratorsSettingInput is an autogenerated input type of UpdateEnterpriseMembersCanInviteCollaboratorsSetting. +type UpdateEnterpriseMembersCanInviteCollaboratorsSettingInput struct { + // The ID of the enterprise on which to set the members can invite collaborators setting. (Required.) + EnterpriseID ID `json:"enterpriseId"` + // The value for the members can invite collaborators setting on the enterprise. (Required.) + SettingValue EnterpriseEnabledDisabledSettingValue `json:"settingValue"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateEnterpriseMembersCanMakePurchasesSettingInput is an autogenerated input type of UpdateEnterpriseMembersCanMakePurchasesSetting. +type UpdateEnterpriseMembersCanMakePurchasesSettingInput struct { + // The ID of the enterprise on which to set the members can make purchases setting. (Required.) + EnterpriseID ID `json:"enterpriseId"` + // The value for the members can make purchases setting on the enterprise. (Required.) + SettingValue EnterpriseMembersCanMakePurchasesSettingValue `json:"settingValue"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateEnterpriseMembersCanUpdateProtectedBranchesSettingInput is an autogenerated input type of UpdateEnterpriseMembersCanUpdateProtectedBranchesSetting. +type UpdateEnterpriseMembersCanUpdateProtectedBranchesSettingInput struct { + // The ID of the enterprise on which to set the members can update protected branches setting. (Required.) + EnterpriseID ID `json:"enterpriseId"` + // The value for the members can update protected branches setting on the enterprise. (Required.) + SettingValue EnterpriseEnabledDisabledSettingValue `json:"settingValue"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateEnterpriseMembersCanViewDependencyInsightsSettingInput is an autogenerated input type of UpdateEnterpriseMembersCanViewDependencyInsightsSetting. +type UpdateEnterpriseMembersCanViewDependencyInsightsSettingInput struct { + // The ID of the enterprise on which to set the members can view dependency insights setting. (Required.) + EnterpriseID ID `json:"enterpriseId"` + // The value for the members can view dependency insights setting on the enterprise. (Required.) + SettingValue EnterpriseEnabledDisabledSettingValue `json:"settingValue"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateEnterpriseOrganizationProjectsSettingInput is an autogenerated input type of UpdateEnterpriseOrganizationProjectsSetting. +type UpdateEnterpriseOrganizationProjectsSettingInput struct { + // The ID of the enterprise on which to set the organization projects setting. (Required.) + EnterpriseID ID `json:"enterpriseId"` + // The value for the organization projects setting on the enterprise. (Required.) + SettingValue EnterpriseEnabledDisabledSettingValue `json:"settingValue"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateEnterpriseProfileInput is an autogenerated input type of UpdateEnterpriseProfile. +type UpdateEnterpriseProfileInput struct { + // The Enterprise ID to update. (Required.) + EnterpriseID ID `json:"enterpriseId"` + + // The name of the enterprise. (Optional.) + Name *String `json:"name,omitempty"` + // The description of the enterprise. (Optional.) + Description *String `json:"description,omitempty"` + // The URL of the enterprise's website. (Optional.) + WebsiteURL *String `json:"websiteUrl,omitempty"` + // The location of the enterprise. (Optional.) + Location *String `json:"location,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateEnterpriseRepositoryProjectsSettingInput is an autogenerated input type of UpdateEnterpriseRepositoryProjectsSetting. +type UpdateEnterpriseRepositoryProjectsSettingInput struct { + // The ID of the enterprise on which to set the repository projects setting. (Required.) + EnterpriseID ID `json:"enterpriseId"` + // The value for the repository projects setting on the enterprise. (Required.) + SettingValue EnterpriseEnabledDisabledSettingValue `json:"settingValue"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateEnterpriseTeamDiscussionsSettingInput is an autogenerated input type of UpdateEnterpriseTeamDiscussionsSetting. +type UpdateEnterpriseTeamDiscussionsSettingInput struct { + // The ID of the enterprise on which to set the team discussions setting. (Required.) + EnterpriseID ID `json:"enterpriseId"` + // The value for the team discussions setting on the enterprise. (Required.) + SettingValue EnterpriseEnabledDisabledSettingValue `json:"settingValue"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateEnterpriseTwoFactorAuthenticationRequiredSettingInput is an autogenerated input type of UpdateEnterpriseTwoFactorAuthenticationRequiredSetting. +type UpdateEnterpriseTwoFactorAuthenticationRequiredSettingInput struct { + // The ID of the enterprise on which to set the two factor authentication required setting. (Required.) + EnterpriseID ID `json:"enterpriseId"` + // The value for the two factor authentication required setting on the enterprise. (Required.) + SettingValue EnterpriseEnabledSettingValue `json:"settingValue"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateIssueCommentInput is an autogenerated input type of UpdateIssueComment. +type UpdateIssueCommentInput struct { + // The ID of the IssueComment to modify. (Required.) + ID ID `json:"id"` + // The updated text of the comment. (Required.) + Body String `json:"body"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateIssueInput is an autogenerated input type of UpdateIssue. +type UpdateIssueInput struct { + // The ID of the Issue to modify. (Required.) + ID ID `json:"id"` + + // The title for the issue. (Optional.) + Title *String `json:"title,omitempty"` + // The body for the issue description. (Optional.) + Body *String `json:"body,omitempty"` + // An array of Node IDs of users for this issue. (Optional.) + AssigneeIDs *[]ID `json:"assigneeIds,omitempty"` + // The Node ID of the milestone for this issue. (Optional.) + MilestoneID *ID `json:"milestoneId,omitempty"` + // An array of Node IDs of labels for this issue. (Optional.) + LabelIDs *[]ID `json:"labelIds,omitempty"` + // The desired issue state. (Optional.) + State *IssueState `json:"state,omitempty"` + // An array of Node IDs for projects associated with this issue. (Optional.) + ProjectIDs *[]ID `json:"projectIds,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateProjectCardInput is an autogenerated input type of UpdateProjectCard. +type UpdateProjectCardInput struct { + // The ProjectCard ID to update. (Required.) + ProjectCardID ID `json:"projectCardId"` + + // Whether or not the ProjectCard should be archived. (Optional.) + IsArchived *Boolean `json:"isArchived,omitempty"` + // The note of ProjectCard. (Optional.) + Note *String `json:"note,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateProjectColumnInput is an autogenerated input type of UpdateProjectColumn. +type UpdateProjectColumnInput struct { + // The ProjectColumn ID to update. (Required.) + ProjectColumnID ID `json:"projectColumnId"` + // The name of project column. (Required.) + Name String `json:"name"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateProjectInput is an autogenerated input type of UpdateProject. +type UpdateProjectInput struct { + // The Project ID to update. (Required.) + ProjectID ID `json:"projectId"` + + // The name of project. (Optional.) + Name *String `json:"name,omitempty"` + // The description of project. (Optional.) + Body *String `json:"body,omitempty"` + // Whether the project is open or closed. (Optional.) + State *ProjectState `json:"state,omitempty"` + // Whether the project is public or not. (Optional.) + Public *Boolean `json:"public,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdatePullRequestInput is an autogenerated input type of UpdatePullRequest. +type UpdatePullRequestInput struct { + // The Node ID of the pull request. (Required.) + PullRequestID ID `json:"pullRequestId"` + + // The name of the branch you want your changes pulled into. This should be an existing branch on the current repository. (Optional.) + BaseRefName *String `json:"baseRefName,omitempty"` + // The title of the pull request. (Optional.) + Title *String `json:"title,omitempty"` + // The contents of the pull request. (Optional.) + Body *String `json:"body,omitempty"` + // The target state of the pull request. (Optional.) + State *PullRequestUpdateState `json:"state,omitempty"` + // Indicates whether maintainers can modify the pull request. (Optional.) + MaintainerCanModify *Boolean `json:"maintainerCanModify,omitempty"` + // An array of Node IDs of users for this pull request. (Optional.) + AssigneeIDs *[]ID `json:"assigneeIds,omitempty"` + // The Node ID of the milestone for this pull request. (Optional.) + MilestoneID *ID `json:"milestoneId,omitempty"` + // An array of Node IDs of labels for this pull request. (Optional.) + LabelIDs *[]ID `json:"labelIds,omitempty"` + // An array of Node IDs for projects associated with this pull request. (Optional.) + ProjectIDs *[]ID `json:"projectIds,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdatePullRequestReviewCommentInput is an autogenerated input type of UpdatePullRequestReviewComment. +type UpdatePullRequestReviewCommentInput struct { + // The Node ID of the comment to modify. (Required.) + PullRequestReviewCommentID ID `json:"pullRequestReviewCommentId"` + // The text of the comment. (Required.) + Body String `json:"body"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdatePullRequestReviewInput is an autogenerated input type of UpdatePullRequestReview. +type UpdatePullRequestReviewInput struct { + // The Node ID of the pull request review to modify. (Required.) + PullRequestReviewID ID `json:"pullRequestReviewId"` + // The contents of the pull request review body. (Required.) + Body String `json:"body"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateRefInput is an autogenerated input type of UpdateRef. +type UpdateRefInput struct { + // The Node ID of the Ref to be updated. (Required.) + RefID ID `json:"refId"` + // The GitObjectID that the Ref shall be updated to target. (Required.) + Oid GitObjectID `json:"oid"` + + // Permit updates of branch Refs that are not fast-forwards?. (Optional.) + Force *Boolean `json:"force,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateRepositoryInput is an autogenerated input type of UpdateRepository. +type UpdateRepositoryInput struct { + // The ID of the repository to update. (Required.) + RepositoryID ID `json:"repositoryId"` + + // The new name of the repository. (Optional.) + Name *String `json:"name,omitempty"` + // A new description for the repository. Pass an empty string to erase the existing description. (Optional.) + Description *String `json:"description,omitempty"` + // Whether this repository should be marked as a template such that anyone who can access it can create new repositories with the same files and directory structure. (Optional.) + Template *Boolean `json:"template,omitempty"` + // The URL for a web page about this repository. Pass an empty string to erase the existing URL. (Optional.) + HomepageURL *URI `json:"homepageUrl,omitempty"` + // Indicates if the repository should have the wiki feature enabled. (Optional.) + HasWikiEnabled *Boolean `json:"hasWikiEnabled,omitempty"` + // Indicates if the repository should have the issues feature enabled. (Optional.) + HasIssuesEnabled *Boolean `json:"hasIssuesEnabled,omitempty"` + // Indicates if the repository should have the project boards feature enabled. (Optional.) + HasProjectsEnabled *Boolean `json:"hasProjectsEnabled,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateSubscriptionInput is an autogenerated input type of UpdateSubscription. +type UpdateSubscriptionInput struct { + // The Node ID of the subscribable object to modify. (Required.) + SubscribableID ID `json:"subscribableId"` + // The new state of the subscription. (Required.) + State SubscriptionState `json:"state"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateTeamDiscussionCommentInput is an autogenerated input type of UpdateTeamDiscussionComment. +type UpdateTeamDiscussionCommentInput struct { + // The ID of the comment to modify. (Required.) + ID ID `json:"id"` + // The updated text of the comment. (Required.) + Body String `json:"body"` + + // The current version of the body content. (Optional.) + BodyVersion *String `json:"bodyVersion,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateTeamDiscussionInput is an autogenerated input type of UpdateTeamDiscussion. +type UpdateTeamDiscussionInput struct { + // The Node ID of the discussion to modify. (Required.) + ID ID `json:"id"` + + // The updated title of the discussion. (Optional.) + Title *String `json:"title,omitempty"` + // The updated text of the discussion. (Optional.) + Body *String `json:"body,omitempty"` + // The current version of the body content. If provided, this update operation will be rejected if the given version does not match the latest version on the server. (Optional.) + BodyVersion *String `json:"bodyVersion,omitempty"` + // If provided, sets the pinned state of the updated discussion. (Optional.) + Pinned *Boolean `json:"pinned,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateTopicsInput is an autogenerated input type of UpdateTopics. +type UpdateTopicsInput struct { + // The Node ID of the repository. (Required.) + RepositoryID ID `json:"repositoryId"` + // An array of topic names. (Required.) + TopicNames []String `json:"topicNames"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UserStatusOrder represents ordering options for user status connections. +type UserStatusOrder struct { + // The field to order user statuses by. (Required.) + Field UserStatusOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} diff --git a/vendor/github.com/shurcooL/githubv4/scalar.go b/vendor/github.com/shurcooL/githubv4/scalar.go new file mode 100644 index 0000000000..56a395303f --- /dev/null +++ b/vendor/github.com/shurcooL/githubv4/scalar.go @@ -0,0 +1,139 @@ +package githubv4 + +import ( + "crypto/x509" + "encoding/json" + "fmt" + "net/url" + "time" + + "github.com/shurcooL/graphql" +) + +// Note: These custom types are meant to be used in queries for now. +// But the plan is to switch to using native Go types (string, int, bool, time.Time, etc.). +// See https://github.com/shurcooL/githubv4/issues/9 for details. +// +// These custom types currently provide documentation, and their use +// is required for sending outbound queries. However, native Go types +// can be used for unmarshaling. Once https://github.com/shurcooL/githubv4/issues/9 +// is resolved, native Go types can completely replace these. + +type ( + // Boolean represents true or false values. + Boolean graphql.Boolean + + // Date is an ISO-8601 encoded date. + Date struct{ time.Time } + + // DateTime is an ISO-8601 encoded UTC date. + DateTime struct{ time.Time } + + // Float represents signed double-precision fractional values as + // specified by IEEE 754. + Float graphql.Float + + // GitObjectID is a Git object ID. For example, + // "912ec1990bd09f8fc128c3fa6b59105085aabc03". + GitObjectID string + + // GitTimestamp is an ISO-8601 encoded date. + // Unlike the DateTime type, GitTimestamp is not converted in UTC. + GitTimestamp struct{ time.Time } + + // HTML is a string containing HTML code. + HTML string + + // ID represents a unique identifier that is Base64 obfuscated. It + // is often used to refetch an object or as key for a cache. The ID + // type appears in a JSON response as a String; however, it is not + // intended to be human-readable. When expected as an input type, + // any string (such as "VXNlci0xMA==") or integer (such as 4) input + // value will be accepted as an ID. + ID graphql.ID + + // Int represents non-fractional signed whole numeric values. + // Int can represent values between -(2^31) and 2^31 - 1. + Int graphql.Int + + // String represents textual data as UTF-8 character sequences. + // This type is most often used by GraphQL to represent free-form + // human-readable text. + String graphql.String + + // URI is an RFC 3986, RFC 3987, and RFC 6570 (level 4) compliant URI. + URI struct{ *url.URL } + + // X509Certificate is a valid x509 certificate. + X509Certificate struct{ *x509.Certificate } +) + +// MarshalJSON implements the json.Marshaler interface. +// The URI is a quoted string. +func (u URI) MarshalJSON() ([]byte, error) { + return json.Marshal(u.String()) +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +// The URI is expected to be a quoted string. +func (u *URI) UnmarshalJSON(data []byte) error { + // Ignore null, like in the main JSON package. + if string(data) == "null" { + return nil + } + var s string + err := json.Unmarshal(data, &s) + if err != nil { + return err + } + u.URL, err = url.Parse(s) + return err +} + +// MarshalJSON implements the json.Marshaler interface. +func (x X509Certificate) MarshalJSON() ([]byte, error) { + // TODO: Implement. + return nil, fmt.Errorf("X509Certificate.MarshalJSON: not implemented") +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *X509Certificate) UnmarshalJSON(data []byte) error { + // TODO: Implement. + return fmt.Errorf("X509Certificate.UnmarshalJSON: not implemented") +} + +// NewBoolean is a helper to make a new *Boolean. +func NewBoolean(v Boolean) *Boolean { return &v } + +// NewDate is a helper to make a new *Date. +func NewDate(v Date) *Date { return &v } + +// NewDateTime is a helper to make a new *DateTime. +func NewDateTime(v DateTime) *DateTime { return &v } + +// NewFloat is a helper to make a new *Float. +func NewFloat(v Float) *Float { return &v } + +// NewGitObjectID is a helper to make a new *GitObjectID. +func NewGitObjectID(v GitObjectID) *GitObjectID { return &v } + +// NewGitTimestamp is a helper to make a new *GitTimestamp. +func NewGitTimestamp(v GitTimestamp) *GitTimestamp { return &v } + +// NewHTML is a helper to make a new *HTML. +func NewHTML(v HTML) *HTML { return &v } + +// NewID is a helper to make a new *ID. +func NewID(v ID) *ID { return &v } + +// NewInt is a helper to make a new *Int. +func NewInt(v Int) *Int { return &v } + +// NewString is a helper to make a new *String. +func NewString(v String) *String { return &v } + +// NewURI is a helper to make a new *URI. +func NewURI(v URI) *URI { return &v } + +// NewX509Certificate is a helper to make a new *X509Certificate. +func NewX509Certificate(v X509Certificate) *X509Certificate { return &v } diff --git a/vendor/github.com/shurcooL/graphql/.travis.yml b/vendor/github.com/shurcooL/graphql/.travis.yml new file mode 100644 index 0000000000..93b1fcdb31 --- /dev/null +++ b/vendor/github.com/shurcooL/graphql/.travis.yml @@ -0,0 +1,16 @@ +sudo: false +language: go +go: + - 1.x + - master +matrix: + allow_failures: + - go: master + fast_finish: true +install: + - # Do nothing. This is needed to prevent default install action "go get -t -v ./..." from happening here (we want it to happen inside script step). +script: + - go get -t -v ./... + - diff -u <(echo -n) <(gofmt -d -s .) + - go tool vet . + - go test -v -race ./... diff --git a/vendor/github.com/shurcooL/graphql/LICENSE b/vendor/github.com/shurcooL/graphql/LICENSE new file mode 100644 index 0000000000..ca4c77642d --- /dev/null +++ b/vendor/github.com/shurcooL/graphql/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Dmitri Shuralyov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/shurcooL/graphql/README.md b/vendor/github.com/shurcooL/graphql/README.md new file mode 100644 index 0000000000..6fa03bd4cd --- /dev/null +++ b/vendor/github.com/shurcooL/graphql/README.md @@ -0,0 +1,293 @@ +graphql +======= + +[![Build Status](https://travis-ci.org/shurcooL/graphql.svg?branch=master)](https://travis-ci.org/shurcooL/graphql) [![GoDoc](https://godoc.org/github.com/shurcooL/graphql?status.svg)](https://godoc.org/github.com/shurcooL/graphql) + +Package `graphql` provides a GraphQL client implementation. + +For more information, see package [`github.com/shurcooL/githubv4`](https://github.com/shurcooL/githubv4), which is a specialized version targeting GitHub GraphQL API v4. That package is driving the feature development. + +**Status:** In active early research and development. The API will change when opportunities for improvement are discovered; it is not yet frozen. + +Installation +------------ + +`graphql` requires Go version 1.8 or later. + +```bash +go get -u github.com/shurcooL/graphql +``` + +Usage +----- + +Construct a GraphQL client, specifying the GraphQL server URL. Then, you can use it to make GraphQL queries and mutations. + +```Go +client := graphql.NewClient("https://example.com/graphql", nil) +// Use client... +``` + +### Authentication + +Some GraphQL servers may require authentication. The `graphql` package does not directly handle authentication. Instead, when creating a new client, you're expected to pass an `http.Client` that performs authentication. The easiest and recommended way to do this is to use the [`golang.org/x/oauth2`](https://golang.org/x/oauth2) package. You'll need an OAuth token with the right scopes. Then: + +```Go +import "golang.org/x/oauth2" + +func main() { + src := oauth2.StaticTokenSource( + &oauth2.Token{AccessToken: os.Getenv("GRAPHQL_TOKEN")}, + ) + httpClient := oauth2.NewClient(context.Background(), src) + + client := graphql.NewClient("https://example.com/graphql", httpClient) + // Use client... +``` + +### Simple Query + +To make a GraphQL query, you need to define a corresponding Go type. + +For example, to make the following GraphQL query: + +```GraphQL +query { + me { + name + } +} +``` + +You can define this variable: + +```Go +var query struct { + Me struct { + Name graphql.String + } +} +``` + +Then call `client.Query`, passing a pointer to it: + +```Go +err := client.Query(context.Background(), &query, nil) +if err != nil { + // Handle error. +} +fmt.Println(query.Me.Name) + +// Output: Luke Skywalker +``` + +### Arguments and Variables + +Often, you'll want to specify arguments on some fields. You can use the `graphql` struct field tag for this. + +For example, to make the following GraphQL query: + +```GraphQL +{ + human(id: "1000") { + name + height(unit: METER) + } +} +``` + +You can define this variable: + +```Go +var q struct { + Human struct { + Name graphql.String + Height graphql.Float `graphql:"height(unit: METER)"` + } `graphql:"human(id: \"1000\")"` +} +``` + +Then call `client.Query`: + +```Go +err := client.Query(context.Background(), &q, nil) +if err != nil { + // Handle error. +} +fmt.Println(q.Human.Name) +fmt.Println(q.Human.Height) + +// Output: +// Luke Skywalker +// 1.72 +``` + +However, that'll only work if the arguments are constant and known in advance. Otherwise, you will need to make use of variables. Replace the constants in the struct field tag with variable names: + +```Go +var q struct { + Human struct { + Name graphql.String + Height graphql.Float `graphql:"height(unit: $unit)"` + } `graphql:"human(id: $id)"` +} +``` + +Then, define a `variables` map with their values: + +```Go +variables := map[string]interface{}{ + "id": graphql.ID(id), + "unit": starwars.LengthUnit("METER"), +} +``` + +Finally, call `client.Query` providing `variables`: + +```Go +err := client.Query(context.Background(), &q, variables) +if err != nil { + // Handle error. +} +``` + +### Inline Fragments + +Some GraphQL queries contain inline fragments. You can use the `graphql` struct field tag to express them. + +For example, to make the following GraphQL query: + +```GraphQL +{ + hero(episode: "JEDI") { + name + ... on Droid { + primaryFunction + } + ... on Human { + height + } + } +} +``` + +You can define this variable: + +```Go +var q struct { + Hero struct { + Name graphql.String + Droid struct { + PrimaryFunction graphql.String + } `graphql:"... on Droid"` + Human struct { + Height graphql.Float + } `graphql:"... on Human"` + } `graphql:"hero(episode: \"JEDI\")"` +} +``` + +Alternatively, you can define the struct types corresponding to inline fragments, and use them as embedded fields in your query: + +```Go +type ( + DroidFragment struct { + PrimaryFunction graphql.String + } + HumanFragment struct { + Height graphql.Float + } +) + +var q struct { + Hero struct { + Name graphql.String + DroidFragment `graphql:"... on Droid"` + HumanFragment `graphql:"... on Human"` + } `graphql:"hero(episode: \"JEDI\")"` +} +``` + +Then call `client.Query`: + +```Go +err := client.Query(context.Background(), &q, nil) +if err != nil { + // Handle error. +} +fmt.Println(q.Hero.Name) +fmt.Println(q.Hero.PrimaryFunction) +fmt.Println(q.Hero.Height) + +// Output: +// R2-D2 +// Astromech +// 0 +``` + +### Mutations + +Mutations often require information that you can only find out by performing a query first. Let's suppose you've already done that. + +For example, to make the following GraphQL mutation: + +```GraphQL +mutation($ep: Episode!, $review: ReviewInput!) { + createReview(episode: $ep, review: $review) { + stars + commentary + } +} +variables { + "ep": "JEDI", + "review": { + "stars": 5, + "commentary": "This is a great movie!" + } +} +``` + +You can define: + +```Go +var m struct { + CreateReview struct { + Stars graphql.Int + Commentary graphql.String + } `graphql:"createReview(episode: $ep, review: $review)"` +} +variables := map[string]interface{}{ + "ep": starwars.Episode("JEDI"), + "review": starwars.ReviewInput{ + Stars: graphql.Int(5), + Commentary: graphql.String("This is a great movie!"), + }, +} +``` + +Then call `client.Mutate`: + +```Go +err := client.Mutate(context.Background(), &m, variables) +if err != nil { + // Handle error. +} +fmt.Printf("Created a %v star review: %v\n", m.CreateReview.Stars, m.CreateReview.Commentary) + +// Output: +// Created a 5 star review: This is a great movie! +``` + +Directories +----------- + +| Path | Synopsis | +|----------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------| +| [example/graphqldev](https://godoc.org/github.com/shurcooL/graphql/example/graphqldev) | graphqldev is a test program currently being used for developing graphql package. | +| [ident](https://godoc.org/github.com/shurcooL/graphql/ident) | Package ident provides functions for parsing and converting identifier names between various naming convention. | +| [internal/jsonutil](https://godoc.org/github.com/shurcooL/graphql/internal/jsonutil) | Package jsonutil provides a function for decoding JSON into a GraphQL query data structure. | + +License +------- + +- [MIT License](LICENSE) diff --git a/vendor/github.com/shurcooL/graphql/doc.go b/vendor/github.com/shurcooL/graphql/doc.go new file mode 100644 index 0000000000..69ec4e0387 --- /dev/null +++ b/vendor/github.com/shurcooL/graphql/doc.go @@ -0,0 +1,11 @@ +// Package graphql provides a GraphQL client implementation. +// +// For more information, see package github.com/shurcooL/githubv4, +// which is a specialized version targeting GitHub GraphQL API v4. +// That package is driving the feature development. +// +// Status: In active early research and development. The API will change when +// opportunities for improvement are discovered; it is not yet frozen. +// +// For now, see README for more details. +package graphql // import "github.com/shurcooL/graphql" diff --git a/vendor/github.com/shurcooL/graphql/graphql.go b/vendor/github.com/shurcooL/graphql/graphql.go new file mode 100644 index 0000000000..85209562c6 --- /dev/null +++ b/vendor/github.com/shurcooL/graphql/graphql.go @@ -0,0 +1,123 @@ +package graphql + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + + "github.com/shurcooL/graphql/internal/jsonutil" + "golang.org/x/net/context/ctxhttp" +) + +// Client is a GraphQL client. +type Client struct { + url string // GraphQL server URL. + httpClient *http.Client +} + +// NewClient creates a GraphQL client targeting the specified GraphQL server URL. +// If httpClient is nil, then http.DefaultClient is used. +func NewClient(url string, httpClient *http.Client) *Client { + if httpClient == nil { + httpClient = http.DefaultClient + } + return &Client{ + url: url, + httpClient: httpClient, + } +} + +// Query executes a single GraphQL query request, +// with a query derived from q, populating the response into it. +// q should be a pointer to struct that corresponds to the GraphQL schema. +func (c *Client) Query(ctx context.Context, q interface{}, variables map[string]interface{}) error { + return c.do(ctx, queryOperation, q, variables) +} + +// Mutate executes a single GraphQL mutation request, +// with a mutation derived from m, populating the response into it. +// m should be a pointer to struct that corresponds to the GraphQL schema. +func (c *Client) Mutate(ctx context.Context, m interface{}, variables map[string]interface{}) error { + return c.do(ctx, mutationOperation, m, variables) +} + +// do executes a single GraphQL operation. +func (c *Client) do(ctx context.Context, op operationType, v interface{}, variables map[string]interface{}) error { + var query string + switch op { + case queryOperation: + query = constructQuery(v, variables) + case mutationOperation: + query = constructMutation(v, variables) + } + in := struct { + Query string `json:"query"` + Variables map[string]interface{} `json:"variables,omitempty"` + }{ + Query: query, + Variables: variables, + } + var buf bytes.Buffer + err := json.NewEncoder(&buf).Encode(in) + if err != nil { + return err + } + resp, err := ctxhttp.Post(ctx, c.httpClient, c.url, "application/json", &buf) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + body, _ := ioutil.ReadAll(resp.Body) + return fmt.Errorf("non-200 OK status code: %v body: %q", resp.Status, body) + } + var out struct { + Data *json.RawMessage + Errors errors + //Extensions interface{} // Unused. + } + err = json.NewDecoder(resp.Body).Decode(&out) + if err != nil { + // TODO: Consider including response body in returned error, if deemed helpful. + return err + } + if out.Data != nil { + err := jsonutil.UnmarshalGraphQL(*out.Data, v) + if err != nil { + // TODO: Consider including response body in returned error, if deemed helpful. + return err + } + } + if len(out.Errors) > 0 { + return out.Errors + } + return nil +} + +// errors represents the "errors" array in a response from a GraphQL server. +// If returned via error interface, the slice is expected to contain at least 1 element. +// +// Specification: https://facebook.github.io/graphql/#sec-Errors. +type errors []struct { + Message string + Locations []struct { + Line int + Column int + } +} + +// Error implements error interface. +func (e errors) Error() string { + return e[0].Message +} + +type operationType uint8 + +const ( + queryOperation operationType = iota + mutationOperation + //subscriptionOperation // Unused. +) diff --git a/vendor/github.com/shurcooL/graphql/ident/ident.go b/vendor/github.com/shurcooL/graphql/ident/ident.go new file mode 100644 index 0000000000..29e498ed9e --- /dev/null +++ b/vendor/github.com/shurcooL/graphql/ident/ident.go @@ -0,0 +1,240 @@ +// Package ident provides functions for parsing and converting identifier names +// between various naming convention. It has support for MixedCaps, lowerCamelCase, +// and SCREAMING_SNAKE_CASE naming conventions. +package ident + +import ( + "strings" + "unicode" + "unicode/utf8" +) + +// ParseMixedCaps parses a MixedCaps identifier name. +// +// E.g., "ClientMutationID" -> {"Client", "Mutation", "ID"}. +func ParseMixedCaps(name string) Name { + var words Name + + // Split name at any lower -> Upper or Upper -> Upper,lower transitions. + // Check each word for initialisms. + runes := []rune(name) + w, i := 0, 0 // Index of start of word, scan. + for i+1 <= len(runes) { + eow := false // Whether we hit the end of a word. + if i+1 == len(runes) { + eow = true + } else if unicode.IsLower(runes[i]) && unicode.IsUpper(runes[i+1]) { + // lower -> Upper. + eow = true + } else if i+2 < len(runes) && unicode.IsUpper(runes[i]) && unicode.IsUpper(runes[i+1]) && unicode.IsLower(runes[i+2]) { + // Upper -> Upper,lower. End of acronym, followed by a word. + eow = true + + if string(runes[i:i+3]) == "IDs" { // Special case, plural form of ID initialism. + eow = false + } + } + i++ + if !eow { + continue + } + + // [w, i) is a word. + word := string(runes[w:i]) + if initialism, ok := isInitialism(word); ok { + words = append(words, initialism) + } else if i1, i2, ok := isTwoInitialisms(word); ok { + words = append(words, i1, i2) + } else { + words = append(words, word) + } + w = i + } + return words +} + +// ParseLowerCamelCase parses a lowerCamelCase identifier name. +// +// E.g., "clientMutationId" -> {"client", "Mutation", "Id"}. +func ParseLowerCamelCase(name string) Name { + var words Name + + // Split name at any Upper letters. + runes := []rune(name) + w, i := 0, 0 // Index of start of word, scan. + for i+1 <= len(runes) { + eow := false // Whether we hit the end of a word. + if i+1 == len(runes) { + eow = true + } else if unicode.IsUpper(runes[i+1]) { + // Upper letter. + eow = true + } + i++ + if !eow { + continue + } + + // [w, i) is a word. + words = append(words, string(runes[w:i])) + w = i + } + return words +} + +// ParseScreamingSnakeCase parses a SCREAMING_SNAKE_CASE identifier name. +// +// E.g., "CLIENT_MUTATION_ID" -> {"CLIENT", "MUTATION", "ID"}. +func ParseScreamingSnakeCase(name string) Name { + var words Name + + // Split name at '_' characters. + runes := []rune(name) + w, i := 0, 0 // Index of start of word, scan. + for i+1 <= len(runes) { + eow := false // Whether we hit the end of a word. + if i+1 == len(runes) { + eow = true + } else if runes[i+1] == '_' { + // Underscore. + eow = true + } + i++ + if !eow { + continue + } + + // [w, i) is a word. + words = append(words, string(runes[w:i])) + if i < len(runes) && runes[i] == '_' { + // Skip underscore. + i++ + } + w = i + } + return words +} + +// Name is an identifier name, broken up into individual words. +type Name []string + +// ToMixedCaps expresses identifer name in MixedCaps naming convention. +// +// E.g., "ClientMutationID". +func (n Name) ToMixedCaps() string { + for i, word := range n { + if strings.EqualFold(word, "IDs") { // Special case, plural form of ID initialism. + n[i] = "IDs" + continue + } + if initialism, ok := isInitialism(word); ok { + n[i] = initialism + continue + } + if brand, ok := isBrand(word); ok { + n[i] = brand + continue + } + r, size := utf8.DecodeRuneInString(word) + n[i] = string(unicode.ToUpper(r)) + strings.ToLower(word[size:]) + } + return strings.Join(n, "") +} + +// ToLowerCamelCase expresses identifer name in lowerCamelCase naming convention. +// +// E.g., "clientMutationId". +func (n Name) ToLowerCamelCase() string { + for i, word := range n { + if i == 0 { + n[i] = strings.ToLower(word) + continue + } + r, size := utf8.DecodeRuneInString(word) + n[i] = string(unicode.ToUpper(r)) + strings.ToLower(word[size:]) + } + return strings.Join(n, "") +} + +// isInitialism reports whether word is an initialism. +func isInitialism(word string) (string, bool) { + initialism := strings.ToUpper(word) + _, ok := initialisms[initialism] + return initialism, ok +} + +// isTwoInitialisms reports whether word is two initialisms. +func isTwoInitialisms(word string) (string, string, bool) { + word = strings.ToUpper(word) + for i := 2; i <= len(word)-2; i++ { // Shortest initialism is 2 characters long. + _, ok1 := initialisms[word[:i]] + _, ok2 := initialisms[word[i:]] + if ok1 && ok2 { + return word[:i], word[i:], true + } + } + return "", "", false +} + +// initialisms is the set of initialisms in the MixedCaps naming convention. +// Only add entries that are highly unlikely to be non-initialisms. +// For instance, "ID" is fine (Freudian code is rare), but "AND" is not. +var initialisms = map[string]struct{}{ + // These are the common initialisms from golint. Keep them in sync + // with https://gotools.org/github.com/golang/lint#commonInitialisms. + "ACL": {}, + "API": {}, + "ASCII": {}, + "CPU": {}, + "CSS": {}, + "DNS": {}, + "EOF": {}, + "GUID": {}, + "HTML": {}, + "HTTP": {}, + "HTTPS": {}, + "ID": {}, + "IP": {}, + "JSON": {}, + "LHS": {}, + "QPS": {}, + "RAM": {}, + "RHS": {}, + "RPC": {}, + "SLA": {}, + "SMTP": {}, + "SQL": {}, + "SSH": {}, + "TCP": {}, + "TLS": {}, + "TTL": {}, + "UDP": {}, + "UI": {}, + "UID": {}, + "UUID": {}, + "URI": {}, + "URL": {}, + "UTF8": {}, + "VM": {}, + "XML": {}, + "XMPP": {}, + "XSRF": {}, + "XSS": {}, + + // Additional common initialisms. + "RSS": {}, +} + +// isBrand reports whether word is a brand. +func isBrand(word string) (string, bool) { + brand, ok := brands[strings.ToLower(word)] + return brand, ok +} + +// brands is the map of brands in the MixedCaps naming convention; +// see https://dmitri.shuralyov.com/idiomatic-go#for-brands-or-words-with-more-than-1-capital-letter-lowercase-all-letters. +// Key is the lower case version of the brand, value is the canonical brand spelling. +// Only add entries that are highly unlikely to be non-brands. +var brands = map[string]string{ + "github": "GitHub", +} diff --git a/vendor/github.com/shurcooL/graphql/internal/jsonutil/graphql.go b/vendor/github.com/shurcooL/graphql/internal/jsonutil/graphql.go new file mode 100644 index 0000000000..15bae246fd --- /dev/null +++ b/vendor/github.com/shurcooL/graphql/internal/jsonutil/graphql.go @@ -0,0 +1,311 @@ +// Package jsonutil provides a function for decoding JSON +// into a GraphQL query data structure. +package jsonutil + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io" + "reflect" + "strings" +) + +// UnmarshalGraphQL parses the JSON-encoded GraphQL response data and stores +// the result in the GraphQL query data structure pointed to by v. +// +// The implementation is created on top of the JSON tokenizer available +// in "encoding/json".Decoder. +func UnmarshalGraphQL(data []byte, v interface{}) error { + dec := json.NewDecoder(bytes.NewReader(data)) + dec.UseNumber() + err := (&decoder{tokenizer: dec}).Decode(v) + if err != nil { + return err + } + tok, err := dec.Token() + switch err { + case io.EOF: + // Expect to get io.EOF. There shouldn't be any more + // tokens left after we've decoded v successfully. + return nil + case nil: + return fmt.Errorf("invalid token '%v' after top-level value", tok) + default: + return err + } +} + +// decoder is a JSON decoder that performs custom unmarshaling behavior +// for GraphQL query data structures. It's implemented on top of a JSON tokenizer. +type decoder struct { + tokenizer interface { + Token() (json.Token, error) + } + + // Stack of what part of input JSON we're in the middle of - objects, arrays. + parseState []json.Delim + + // Stacks of values where to unmarshal. + // The top of each stack is the reflect.Value where to unmarshal next JSON value. + // + // The reason there's more than one stack is because we might be unmarshaling + // a single JSON value into multiple GraphQL fragments or embedded structs, so + // we keep track of them all. + vs [][]reflect.Value +} + +// Decode decodes a single JSON value from d.tokenizer into v. +func (d *decoder) Decode(v interface{}) error { + rv := reflect.ValueOf(v) + if rv.Kind() != reflect.Ptr { + return fmt.Errorf("cannot decode into non-pointer %T", v) + } + d.vs = [][]reflect.Value{{rv.Elem()}} + return d.decode() +} + +// decode decodes a single JSON value from d.tokenizer into d.vs. +func (d *decoder) decode() error { + // The loop invariant is that the top of each d.vs stack + // is where we try to unmarshal the next JSON value we see. + for len(d.vs) > 0 { + tok, err := d.tokenizer.Token() + if err == io.EOF { + return errors.New("unexpected end of JSON input") + } else if err != nil { + return err + } + + switch { + + // Are we inside an object and seeing next key (rather than end of object)? + case d.state() == '{' && tok != json.Delim('}'): + key, ok := tok.(string) + if !ok { + return errors.New("unexpected non-key in JSON input") + } + someFieldExist := false + for i := range d.vs { + v := d.vs[i][len(d.vs[i])-1] + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + var f reflect.Value + if v.Kind() == reflect.Struct { + f = fieldByGraphQLName(v, key) + if f.IsValid() { + someFieldExist = true + } + } + d.vs[i] = append(d.vs[i], f) + } + if !someFieldExist { + return fmt.Errorf("struct field for %q doesn't exist in any of %v places to unmarshal", key, len(d.vs)) + } + + // We've just consumed the current token, which was the key. + // Read the next token, which should be the value, and let the rest of code process it. + tok, err = d.tokenizer.Token() + if err == io.EOF { + return errors.New("unexpected end of JSON input") + } else if err != nil { + return err + } + + // Are we inside an array and seeing next value (rather than end of array)? + case d.state() == '[' && tok != json.Delim(']'): + someSliceExist := false + for i := range d.vs { + v := d.vs[i][len(d.vs[i])-1] + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + var f reflect.Value + if v.Kind() == reflect.Slice { + v.Set(reflect.Append(v, reflect.Zero(v.Type().Elem()))) // v = append(v, T). + f = v.Index(v.Len() - 1) + someSliceExist = true + } + d.vs[i] = append(d.vs[i], f) + } + if !someSliceExist { + return fmt.Errorf("slice doesn't exist in any of %v places to unmarshal", len(d.vs)) + } + } + + switch tok := tok.(type) { + case string, json.Number, bool, nil: + // Value. + + for i := range d.vs { + v := d.vs[i][len(d.vs[i])-1] + if !v.IsValid() { + continue + } + err := unmarshalValue(tok, v) + if err != nil { + return err + } + } + d.popAllVs() + + case json.Delim: + switch tok { + case '{': + // Start of object. + + d.pushState(tok) + + frontier := make([]reflect.Value, len(d.vs)) // Places to look for GraphQL fragments/embedded structs. + for i := range d.vs { + v := d.vs[i][len(d.vs[i])-1] + frontier[i] = v + // TODO: Do this recursively or not? Add a test case if needed. + if v.Kind() == reflect.Ptr && v.IsNil() { + v.Set(reflect.New(v.Type().Elem())) // v = new(T). + } + } + // Find GraphQL fragments/embedded structs recursively, adding to frontier + // as new ones are discovered and exploring them further. + for len(frontier) > 0 { + v := frontier[0] + frontier = frontier[1:] + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + if v.Kind() != reflect.Struct { + continue + } + for i := 0; i < v.NumField(); i++ { + if isGraphQLFragment(v.Type().Field(i)) || v.Type().Field(i).Anonymous { + // Add GraphQL fragment or embedded struct. + d.vs = append(d.vs, []reflect.Value{v.Field(i)}) + frontier = append(frontier, v.Field(i)) + } + } + } + case '[': + // Start of array. + + d.pushState(tok) + + for i := range d.vs { + v := d.vs[i][len(d.vs[i])-1] + // TODO: Confirm this is needed, write a test case. + //if v.Kind() == reflect.Ptr && v.IsNil() { + // v.Set(reflect.New(v.Type().Elem())) // v = new(T). + //} + + // Reset slice to empty (in case it had non-zero initial value). + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + if v.Kind() != reflect.Slice { + continue + } + v.Set(reflect.MakeSlice(v.Type(), 0, 0)) // v = make(T, 0, 0). + } + case '}', ']': + // End of object or array. + d.popAllVs() + d.popState() + default: + return errors.New("unexpected delimiter in JSON input") + } + default: + return errors.New("unexpected token in JSON input") + } + } + return nil +} + +// pushState pushes a new parse state s onto the stack. +func (d *decoder) pushState(s json.Delim) { + d.parseState = append(d.parseState, s) +} + +// popState pops a parse state (already obtained) off the stack. +// The stack must be non-empty. +func (d *decoder) popState() { + d.parseState = d.parseState[:len(d.parseState)-1] +} + +// state reports the parse state on top of stack, or 0 if empty. +func (d *decoder) state() json.Delim { + if len(d.parseState) == 0 { + return 0 + } + return d.parseState[len(d.parseState)-1] +} + +// popAllVs pops from all d.vs stacks, keeping only non-empty ones. +func (d *decoder) popAllVs() { + var nonEmpty [][]reflect.Value + for i := range d.vs { + d.vs[i] = d.vs[i][:len(d.vs[i])-1] + if len(d.vs[i]) > 0 { + nonEmpty = append(nonEmpty, d.vs[i]) + } + } + d.vs = nonEmpty +} + +// fieldByGraphQLName returns an exported struct field of struct v +// that matches GraphQL name, or invalid reflect.Value if none found. +func fieldByGraphQLName(v reflect.Value, name string) reflect.Value { + for i := 0; i < v.NumField(); i++ { + if v.Type().Field(i).PkgPath != "" { + // Skip unexported field. + continue + } + if hasGraphQLName(v.Type().Field(i), name) { + return v.Field(i) + } + } + return reflect.Value{} +} + +// hasGraphQLName reports whether struct field f has GraphQL name. +func hasGraphQLName(f reflect.StructField, name string) bool { + value, ok := f.Tag.Lookup("graphql") + if !ok { + // TODO: caseconv package is relatively slow. Optimize it, then consider using it here. + //return caseconv.MixedCapsToLowerCamelCase(f.Name) == name + return strings.EqualFold(f.Name, name) + } + value = strings.TrimSpace(value) // TODO: Parse better. + if strings.HasPrefix(value, "...") { + // GraphQL fragment. It doesn't have a name. + return false + } + if i := strings.Index(value, "("); i != -1 { + value = value[:i] + } + if i := strings.Index(value, ":"); i != -1 { + value = value[:i] + } + return strings.TrimSpace(value) == name +} + +// isGraphQLFragment reports whether struct field f is a GraphQL fragment. +func isGraphQLFragment(f reflect.StructField) bool { + value, ok := f.Tag.Lookup("graphql") + if !ok { + return false + } + value = strings.TrimSpace(value) // TODO: Parse better. + return strings.HasPrefix(value, "...") +} + +// unmarshalValue unmarshals JSON value into v. +// v must be addressable and not obtained by the use of unexported +// struct fields, otherwise unmarshalValue will panic. +func unmarshalValue(value json.Token, v reflect.Value) error { + b, err := json.Marshal(value) // TODO: Short-circuit (if profiling says it's worth it). + if err != nil { + return err + } + return json.Unmarshal(b, v.Addr().Interface()) +} diff --git a/vendor/github.com/shurcooL/graphql/query.go b/vendor/github.com/shurcooL/graphql/query.go new file mode 100644 index 0000000000..e10b77189b --- /dev/null +++ b/vendor/github.com/shurcooL/graphql/query.go @@ -0,0 +1,131 @@ +package graphql + +import ( + "bytes" + "encoding/json" + "io" + "reflect" + "sort" + + "github.com/shurcooL/graphql/ident" +) + +func constructQuery(v interface{}, variables map[string]interface{}) string { + query := query(v) + if len(variables) > 0 { + return "query(" + queryArguments(variables) + ")" + query + } + return query +} + +func constructMutation(v interface{}, variables map[string]interface{}) string { + query := query(v) + if len(variables) > 0 { + return "mutation(" + queryArguments(variables) + ")" + query + } + return "mutation" + query +} + +// queryArguments constructs a minified arguments string for variables. +// +// E.g., map[string]interface{}{"a": Int(123), "b": NewBoolean(true)} -> "$a:Int!$b:Boolean". +func queryArguments(variables map[string]interface{}) string { + // Sort keys in order to produce deterministic output for testing purposes. + // TODO: If tests can be made to work with non-deterministic output, then no need to sort. + keys := make([]string, 0, len(variables)) + for k := range variables { + keys = append(keys, k) + } + sort.Strings(keys) + + var buf bytes.Buffer + for _, k := range keys { + io.WriteString(&buf, "$") + io.WriteString(&buf, k) + io.WriteString(&buf, ":") + writeArgumentType(&buf, reflect.TypeOf(variables[k]), true) + // Don't insert a comma here. + // Commas in GraphQL are insignificant, and we want minified output. + // See https://facebook.github.io/graphql/October2016/#sec-Insignificant-Commas. + } + return buf.String() +} + +// writeArgumentType writes a minified GraphQL type for t to w. +// value indicates whether t is a value (required) type or pointer (optional) type. +// If value is true, then "!" is written at the end of t. +func writeArgumentType(w io.Writer, t reflect.Type, value bool) { + if t.Kind() == reflect.Ptr { + // Pointer is an optional type, so no "!" at the end of the pointer's underlying type. + writeArgumentType(w, t.Elem(), false) + return + } + + switch t.Kind() { + case reflect.Slice, reflect.Array: + // List. E.g., "[Int]". + io.WriteString(w, "[") + writeArgumentType(w, t.Elem(), true) + io.WriteString(w, "]") + default: + // Named type. E.g., "Int". + name := t.Name() + if name == "string" { // HACK: Workaround for https://github.com/shurcooL/githubv4/issues/12. + name = "ID" + } + io.WriteString(w, name) + } + + if value { + // Value is a required type, so add "!" to the end. + io.WriteString(w, "!") + } +} + +// query uses writeQuery to recursively construct +// a minified query string from the provided struct v. +// +// E.g., struct{Foo Int, BarBaz *Boolean} -> "{foo,barBaz}". +func query(v interface{}) string { + var buf bytes.Buffer + writeQuery(&buf, reflect.TypeOf(v), false) + return buf.String() +} + +// writeQuery writes a minified query for t to w. +// If inline is true, the struct fields of t are inlined into parent struct. +func writeQuery(w io.Writer, t reflect.Type, inline bool) { + switch t.Kind() { + case reflect.Ptr, reflect.Slice: + writeQuery(w, t.Elem(), false) + case reflect.Struct: + // If the type implements json.Unmarshaler, it's a scalar. Don't expand it. + if reflect.PtrTo(t).Implements(jsonUnmarshaler) { + return + } + if !inline { + io.WriteString(w, "{") + } + for i := 0; i < t.NumField(); i++ { + if i != 0 { + io.WriteString(w, ",") + } + f := t.Field(i) + value, ok := f.Tag.Lookup("graphql") + inlineField := f.Anonymous && !ok + if !inlineField { + if ok { + io.WriteString(w, value) + } else { + io.WriteString(w, ident.ParseMixedCaps(f.Name).ToLowerCamelCase()) + } + } + writeQuery(w, f.Type, inlineField) + } + if !inline { + io.WriteString(w, "}") + } + } +} + +var jsonUnmarshaler = reflect.TypeOf((*json.Unmarshaler)(nil)).Elem() diff --git a/vendor/github.com/shurcooL/graphql/scalar.go b/vendor/github.com/shurcooL/graphql/scalar.go new file mode 100644 index 0000000000..0f7ceea5e0 --- /dev/null +++ b/vendor/github.com/shurcooL/graphql/scalar.go @@ -0,0 +1,51 @@ +package graphql + +// Note: These custom types are meant to be used in queries for now. +// But the plan is to switch to using native Go types (string, int, bool, time.Time, etc.). +// See https://github.com/shurcooL/githubv4/issues/9 for details. +// +// These custom types currently provide documentation, and their use +// is required for sending outbound queries. However, native Go types +// can be used for unmarshaling. Once https://github.com/shurcooL/githubv4/issues/9 +// is resolved, native Go types can completely replace these. + +type ( + // Boolean represents true or false values. + Boolean bool + + // Float represents signed double-precision fractional values as + // specified by IEEE 754. + Float float64 + + // ID represents a unique identifier that is Base64 obfuscated. It + // is often used to refetch an object or as key for a cache. The ID + // type appears in a JSON response as a String; however, it is not + // intended to be human-readable. When expected as an input type, + // any string (such as "VXNlci0xMA==") or integer (such as 4) input + // value will be accepted as an ID. + ID interface{} + + // Int represents non-fractional signed whole numeric values. + // Int can represent values between -(2^31) and 2^31 - 1. + Int int32 + + // String represents textual data as UTF-8 character sequences. + // This type is most often used by GraphQL to represent free-form + // human-readable text. + String string +) + +// NewBoolean is a helper to make a new *Boolean. +func NewBoolean(v Boolean) *Boolean { return &v } + +// NewFloat is a helper to make a new *Float. +func NewFloat(v Float) *Float { return &v } + +// NewID is a helper to make a new *ID. +func NewID(v ID) *ID { return &v } + +// NewInt is a helper to make a new *Int. +func NewInt(v Int) *Int { return &v } + +// NewString is a helper to make a new *String. +func NewString(v String) *String { return &v } diff --git a/vendor/golang.org/x/net/html/const.go b/vendor/golang.org/x/net/html/const.go index a3a918f0b3..73804d3472 100644 --- a/vendor/golang.org/x/net/html/const.go +++ b/vendor/golang.org/x/net/html/const.go @@ -52,7 +52,6 @@ var isSpecialElementMap = map[string]bool{ "iframe": true, "img": true, "input": true, - "isindex": true, // The 'isindex' element has been removed, but keep it for backwards compatibility. "keygen": true, "li": true, "link": true, diff --git a/vendor/golang.org/x/net/html/parse.go b/vendor/golang.org/x/net/html/parse.go index c801a6a04e..2cd12fc816 100644 --- a/vendor/golang.org/x/net/html/parse.go +++ b/vendor/golang.org/x/net/html/parse.go @@ -184,6 +184,17 @@ func (p *parser) clearStackToContext(s scope) { } } +// parseGenericRawTextElements implements the generic raw text element parsing +// algorithm defined in 12.2.6.2. +// https://html.spec.whatwg.org/multipage/parsing.html#parsing-elements-that-contain-only-text +// TODO: Since both RAWTEXT and RCDATA states are treated as tokenizer's part +// officially, need to make tokenizer consider both states. +func (p *parser) parseGenericRawTextElement() { + p.addElement() + p.originalIM = p.im + p.im = textIM +} + // generateImpliedEndTags pops nodes off the stack of open elements as long as // the top node has a tag name of dd, dt, li, optgroup, option, p, rb, rp, rt or rtc. // If exceptions are specified, nodes with that name will not be popped off. @@ -192,16 +203,17 @@ func (p *parser) generateImpliedEndTags(exceptions ...string) { loop: for i = len(p.oe) - 1; i >= 0; i-- { n := p.oe[i] - if n.Type == ElementNode { - switch n.DataAtom { - case a.Dd, a.Dt, a.Li, a.Optgroup, a.Option, a.P, a.Rb, a.Rp, a.Rt, a.Rtc: - for _, except := range exceptions { - if n.Data == except { - break loop - } + if n.Type != ElementNode { + break + } + switch n.DataAtom { + case a.Dd, a.Dt, a.Li, a.Optgroup, a.Option, a.P, a.Rb, a.Rp, a.Rt, a.Rtc: + for _, except := range exceptions { + if n.Data == except { + break loop } - continue } + continue } break } @@ -369,8 +381,7 @@ findIdenticalElements: // Section 12.2.4.3. func (p *parser) clearActiveFormattingElements() { for { - n := p.afe.pop() - if len(p.afe) == 0 || n.Type == scopeMarkerNode { + if n := p.afe.pop(); len(p.afe) == 0 || n.Type == scopeMarkerNode { return } } @@ -625,25 +636,29 @@ func inHeadIM(p *parser) bool { switch p.tok.DataAtom { case a.Html: return inBodyIM(p) - case a.Base, a.Basefont, a.Bgsound, a.Command, a.Link, a.Meta: + case a.Base, a.Basefont, a.Bgsound, a.Link, a.Meta: p.addElement() p.oe.pop() p.acknowledgeSelfClosingTag() return true case a.Noscript: - p.addElement() if p.scripting { - p.setOriginalIM() - p.im = textIM - } else { - p.im = inHeadNoscriptIM + p.parseGenericRawTextElement() + return true } + p.addElement() + p.im = inHeadNoscriptIM + // Don't let the tokenizer go into raw text mode when scripting is disabled. + p.tokenizer.NextIsNotRawText() return true - case a.Script, a.Title, a.Noframes, a.Style: + case a.Script, a.Title: p.addElement() p.setOriginalIM() p.im = textIM return true + case a.Noframes, a.Style: + p.parseGenericRawTextElement() + return true case a.Head: // Ignore the token. return true @@ -855,7 +870,7 @@ func inBodyIM(p *parser) bool { return true } copyAttributes(p.oe[0], p.tok) - case a.Base, a.Basefont, a.Bgsound, a.Command, a.Link, a.Meta, a.Noframes, a.Script, a.Style, a.Template, a.Title: + case a.Base, a.Basefont, a.Bgsound, a.Link, a.Meta, a.Noframes, a.Script, a.Style, a.Template, a.Title: return inHeadIM(p) case a.Body: if p.oe.contains(a.Template) { @@ -1014,53 +1029,6 @@ func inBodyIM(p *parser) bool { p.tok.DataAtom = a.Img p.tok.Data = a.Img.String() return false - case a.Isindex: - if p.form != nil { - // Ignore the token. - return true - } - action := "" - prompt := "This is a searchable index. Enter search keywords: " - attr := []Attribute{{Key: "name", Val: "isindex"}} - for _, t := range p.tok.Attr { - switch t.Key { - case "action": - action = t.Val - case "name": - // Ignore the attribute. - case "prompt": - prompt = t.Val - default: - attr = append(attr, t) - } - } - p.acknowledgeSelfClosingTag() - p.popUntil(buttonScope, a.P) - p.parseImpliedToken(StartTagToken, a.Form, a.Form.String()) - if p.form == nil { - // NOTE: The 'isindex' element has been removed, - // and the 'template' element has not been designed to be - // collaborative with the index element. - // - // Ignore the token. - return true - } - if action != "" { - p.form.Attr = []Attribute{{Key: "action", Val: action}} - } - p.parseImpliedToken(StartTagToken, a.Hr, a.Hr.String()) - p.parseImpliedToken(StartTagToken, a.Label, a.Label.String()) - p.addText(prompt) - p.addChild(&Node{ - Type: ElementNode, - DataAtom: a.Input, - Data: a.Input.String(), - Attr: attr, - }) - p.oe.pop() - p.parseImpliedToken(EndTagToken, a.Label, a.Label.String()) - p.parseImpliedToken(StartTagToken, a.Hr, a.Hr.String()) - p.parseImpliedToken(EndTagToken, a.Form, a.Form.String()) case a.Textarea: p.addElement() p.setOriginalIM() @@ -1070,18 +1038,21 @@ func inBodyIM(p *parser) bool { p.popUntil(buttonScope, a.P) p.reconstructActiveFormattingElements() p.framesetOK = false - p.addElement() - p.setOriginalIM() - p.im = textIM + p.parseGenericRawTextElement() case a.Iframe: p.framesetOK = false + p.parseGenericRawTextElement() + case a.Noembed: + p.parseGenericRawTextElement() + case a.Noscript: + if p.scripting { + p.parseGenericRawTextElement() + return true + } + p.reconstructActiveFormattingElements() p.addElement() - p.setOriginalIM() - p.im = textIM - case a.Noembed, a.Noscript: - p.addElement() - p.setOriginalIM() - p.im = textIM + // Don't let the tokenizer go into raw text mode when scripting is disabled. + p.tokenizer.NextIsNotRawText() case a.Select: p.reconstructActiveFormattingElements() p.addElement() @@ -1198,14 +1169,13 @@ func inBodyIM(p *parser) bool { if len(p.templateStack) > 0 { p.im = inTemplateIM return false - } else { - for _, e := range p.oe { - switch e.DataAtom { - case a.Dd, a.Dt, a.Li, a.Optgroup, a.Option, a.P, a.Rb, a.Rp, a.Rt, a.Rtc, a.Tbody, a.Td, a.Tfoot, a.Th, - a.Thead, a.Tr, a.Body, a.Html: - default: - return true - } + } + for _, e := range p.oe { + switch e.DataAtom { + case a.Dd, a.Dt, a.Li, a.Optgroup, a.Option, a.P, a.Rb, a.Rp, a.Rt, a.Rtc, a.Tbody, a.Td, a.Tfoot, a.Th, + a.Thead, a.Tr, a.Body, a.Html: + default: + return true } } } @@ -1221,9 +1191,15 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom, tagName string) { // Once the code successfully parses the comprehensive test suite, we should // refactor this code to be more idiomatic. - // Steps 1-4. The outer loop. + // Steps 1-2 + if current := p.oe.top(); current.Data == tagName && p.afe.index(current) == -1 { + p.oe.pop() + return + } + + // Steps 3-5. The outer loop. for i := 0; i < 8; i++ { - // Step 5. Find the formatting element. + // Step 6. Find the formatting element. var formattingElement *Node for j := len(p.afe) - 1; j >= 0; j-- { if p.afe[j].Type == scopeMarkerNode { @@ -1238,17 +1214,22 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom, tagName string) { p.inBodyEndTagOther(tagAtom, tagName) return } + + // Step 7. Ignore the tag if formatting element is not in the stack of open elements. feIndex := p.oe.index(formattingElement) if feIndex == -1 { p.afe.remove(formattingElement) return } + // Step 8. Ignore the tag if formatting element is not in the scope. if !p.elementInScope(defaultScope, tagAtom) { // Ignore the tag. return } - // Steps 9-10. Find the furthest block. + // Step 9. This step is omitted because it's just a parse error but no need to return. + + // Steps 10-11. Find the furthest block. var furthestBlock *Node for _, e := range p.oe[feIndex:] { if isSpecialElement(e) { @@ -1265,47 +1246,65 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom, tagName string) { return } - // Steps 11-12. Find the common ancestor and bookmark node. + // Steps 12-13. Find the common ancestor and bookmark node. commonAncestor := p.oe[feIndex-1] bookmark := p.afe.index(formattingElement) - // Step 13. The inner loop. Find the lastNode to reparent. + // Step 14. The inner loop. Find the lastNode to reparent. lastNode := furthestBlock node := furthestBlock x := p.oe.index(node) - // Steps 13.1-13.2 - for j := 0; j < 3; j++ { - // Step 13.3. + // Step 14.1. + j := 0 + for { + // Step 14.2. + j++ + // Step. 14.3. x-- node = p.oe[x] - // Step 13.4 - 13.5. + // Step 14.4. Go to the next step if node is formatting element. + if node == formattingElement { + break + } + // Step 14.5. Remove node from the list of active formatting elements if + // inner loop counter is greater than three and node is in the list of + // active formatting elements. + if ni := p.afe.index(node); j > 3 && ni > -1 { + p.afe.remove(node) + // If any element of the list of active formatting elements is removed, + // we need to take care whether bookmark should be decremented or not. + // This is because the value of bookmark may exceed the size of the + // list by removing elements from the list. + if ni <= bookmark { + bookmark-- + } + continue + } + // Step 14.6. Continue the next inner loop if node is not in the list of + // active formatting elements. if p.afe.index(node) == -1 { p.oe.remove(node) continue } - // Step 13.6. - if node == formattingElement { - break - } - // Step 13.7. + // Step 14.7. clone := node.clone() p.afe[p.afe.index(node)] = clone p.oe[p.oe.index(node)] = clone node = clone - // Step 13.8. + // Step 14.8. if lastNode == furthestBlock { bookmark = p.afe.index(node) + 1 } - // Step 13.9. + // Step 14.9. if lastNode.Parent != nil { lastNode.Parent.RemoveChild(lastNode) } node.AppendChild(lastNode) - // Step 13.10. + // Step 14.10. lastNode = node } - // Step 14. Reparent lastNode to the common ancestor, + // Step 15. Reparent lastNode to the common ancestor, // or for misnested table nodes, to the foster parent. if lastNode.Parent != nil { lastNode.Parent.RemoveChild(lastNode) @@ -1317,13 +1316,13 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom, tagName string) { commonAncestor.AppendChild(lastNode) } - // Steps 15-17. Reparent nodes from the furthest block's children + // Steps 16-18. Reparent nodes from the furthest block's children // to a clone of the formatting element. clone := formattingElement.clone() reparentChildren(clone, furthestBlock) furthestBlock.AppendChild(clone) - // Step 18. Fix up the list of active formatting elements. + // Step 19. Fix up the list of active formatting elements. if oldLoc := p.afe.index(formattingElement); oldLoc != -1 && oldLoc < bookmark { // Move the bookmark with the rest of the list. bookmark-- @@ -1331,7 +1330,7 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom, tagName string) { p.afe.remove(formattingElement) p.afe.insert(bookmark, clone) - // Step 19. Fix up the stack of open elements. + // Step 20. Fix up the stack of open elements. p.oe.remove(formattingElement) p.oe.insert(p.oe.index(furthestBlock)+1, clone) } @@ -1502,14 +1501,13 @@ func inCaptionIM(p *parser) bool { case StartTagToken: switch p.tok.DataAtom { case a.Caption, a.Col, a.Colgroup, a.Tbody, a.Td, a.Tfoot, a.Thead, a.Tr: - if p.popUntil(tableScope, a.Caption) { - p.clearActiveFormattingElements() - p.im = inTableIM - return false - } else { + if !p.popUntil(tableScope, a.Caption) { // Ignore the token. return true } + p.clearActiveFormattingElements() + p.im = inTableIM + return false case a.Select: p.reconstructActiveFormattingElements() p.addElement() @@ -1526,14 +1524,13 @@ func inCaptionIM(p *parser) bool { } return true case a.Table: - if p.popUntil(tableScope, a.Caption) { - p.clearActiveFormattingElements() - p.im = inTableIM - return false - } else { + if !p.popUntil(tableScope, a.Caption) { // Ignore the token. return true } + p.clearActiveFormattingElements() + p.im = inTableIM + return false case a.Body, a.Col, a.Colgroup, a.Html, a.Tbody, a.Td, a.Tfoot, a.Th, a.Thead, a.Tr: // Ignore the token. return true @@ -1777,12 +1774,11 @@ func inSelectIM(p *parser) bool { } p.addElement() case a.Select: - if p.popUntil(selectScope, a.Select) { - p.resetInsertionMode() - } else { + if !p.popUntil(selectScope, a.Select) { // Ignore the token. return true } + p.resetInsertionMode() case a.Input, a.Keygen, a.Textarea: if p.elementInScope(selectScope, a.Select) { p.parseImpliedToken(EndTagToken, a.Select, a.Select.String()) @@ -1810,12 +1806,11 @@ func inSelectIM(p *parser) bool { p.oe = p.oe[:i] } case a.Select: - if p.popUntil(selectScope, a.Select) { - p.resetInsertionMode() - } else { + if !p.popUntil(selectScope, a.Select) { // Ignore the token. return true } + p.resetInsertionMode() case a.Template: return inHeadIM(p) } @@ -2352,8 +2347,7 @@ func ParseWithOptions(r io.Reader, opts ...ParseOption) (*Node, error) { f(p) } - err := p.parse() - if err != nil { + if err := p.parse(); err != nil { return nil, err } return p.doc, nil @@ -2411,8 +2405,7 @@ func ParseFragmentWithOptions(r io.Reader, context *Node, opts ...ParseOption) ( } } - err := p.parse() - if err != nil { + if err := p.parse(); err != nil { return nil, err } diff --git a/vendor/golang.org/x/net/html/render.go b/vendor/golang.org/x/net/html/render.go index d34564f49d..8bf47ede79 100644 --- a/vendor/golang.org/x/net/html/render.go +++ b/vendor/golang.org/x/net/html/render.go @@ -252,20 +252,19 @@ func writeQuoted(w writer, s string) error { // Section 12.1.2, "Elements", gives this list of void elements. Void elements // are those that can't have any contents. var voidElements = map[string]bool{ - "area": true, - "base": true, - "br": true, - "col": true, - "command": true, - "embed": true, - "hr": true, - "img": true, - "input": true, - "keygen": true, - "link": true, - "meta": true, - "param": true, - "source": true, - "track": true, - "wbr": true, + "area": true, + "base": true, + "br": true, + "col": true, + "embed": true, + "hr": true, + "img": true, + "input": true, + "keygen": true, + "link": true, + "meta": true, + "param": true, + "source": true, + "track": true, + "wbr": true, } diff --git a/vendor/golang.org/x/net/html/token.go b/vendor/golang.org/x/net/html/token.go index ae0d1b05cd..877709f991 100644 --- a/vendor/golang.org/x/net/html/token.go +++ b/vendor/golang.org/x/net/html/token.go @@ -296,8 +296,7 @@ func (z *Tokenizer) Buffered() []byte { // too many times in succession. func readAtLeastOneByte(r io.Reader, b []byte) (int, error) { for i := 0; i < 100; i++ { - n, err := r.Read(b) - if n != 0 || err != nil { + if n, err := r.Read(b); n != 0 || err != nil { return n, err } } diff --git a/vendor/modules.txt b/vendor/modules.txt index 7b7212283e..6426ee174f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -6,6 +6,10 @@ cloud.google.com/go/internal/optional cloud.google.com/go/internal/trace cloud.google.com/go/internal/version cloud.google.com/go/storage +# github.com/Laisky/graphql v1.0.4 +github.com/Laisky/graphql +github.com/Laisky/graphql/ident +github.com/Laisky/graphql/internal/jsonutil # github.com/Masterminds/semver v1.4.2 github.com/Masterminds/semver # github.com/Masterminds/sprig v2.15.0+incompatible @@ -173,11 +177,17 @@ github.com/onsi/gomega/format github.com/pelletier/go-buffruneio # github.com/pelletier/go-toml v1.0.0 github.com/pelletier/go-toml -# github.com/petergtz/pegomock v2.5.0+incompatible +# github.com/petergtz/pegomock v2.7.0+incompatible github.com/petergtz/pegomock github.com/petergtz/pegomock/internal/verify # github.com/pkg/errors v0.8.0 github.com/pkg/errors +# github.com/shurcooL/githubv4 v0.0.0-20191127044304-8f68eb5628d0 +github.com/shurcooL/githubv4 +# github.com/shurcooL/graphql v0.0.0-20181231061246-d48a9a75455f +github.com/shurcooL/graphql +github.com/shurcooL/graphql/ident +github.com/shurcooL/graphql/internal/jsonutil # github.com/sirupsen/logrus v1.2.0 github.com/sirupsen/logrus # github.com/spf13/afero v0.0.0-20170901052352-ee1bd8ee15a1 @@ -240,7 +250,7 @@ golang.org/x/crypto/openpgp/s2k golang.org/x/crypto/pbkdf2 golang.org/x/crypto/scrypt golang.org/x/crypto/ssh/terminal -# golang.org/x/net v0.0.0-20191126235420-ef20fe5d7933 +# golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 golang.org/x/net/context golang.org/x/net/context/ctxhttp golang.org/x/net/html From 815e91be36c25634afb58fee9fb91138d92cc4d0 Mon Sep 17 00:00:00 2001 From: Sam Park Date: Sun, 12 Jan 2020 17:26:53 -0800 Subject: [PATCH 05/13] Add tests --- server/events/vcs/github_client_test.go | 87 +++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/server/events/vcs/github_client_test.go b/server/events/vcs/github_client_test.go index 81045ff5d3..f8d4027ce9 100644 --- a/server/events/vcs/github_client_test.go +++ b/server/events/vcs/github_client_test.go @@ -14,6 +14,8 @@ import ( "github.com/runatlantis/atlantis/server/events/models" "github.com/runatlantis/atlantis/server/events/vcs" . "github.com/runatlantis/atlantis/testing" + + "github.com/shurcooL/githubv4" ) // GetModifiedFiles should make multiple requests if more than one page @@ -133,6 +135,91 @@ func TestGithubClient_GetModifiedFilesMovedFile(t *testing.T) { Equals(t, []string{"new/filename.txt", "previous/filename.txt"}, files) } +func TestGithubClient_HideOldComments(t *testing.T) { + // Only comment 6 should be minimized, because it's by the same Atlantis bot user + // and it has "apply" in the first line of the comment body. + issueResp := `[ + {"node_id": "1", "body": "asd\napply\nasd", "user": {"login": "someone-else"}}, + {"node_id": "2", "body": "asd apply\nasd", "user": {"login": "someone-else"}}, + {"node_id": "3", "body": "asdasdasd\nasdasdasd", "user": {"login": "someone-else"}}, + {"node_id": "4", "body": "asdasdasd\nasdasdasd", "user": {"login": "user"}}, + {"node_id": "5", "body": "asd\napply\nasd", "user": {"login": "user"}}, + {"node_id": "6", "body": "asd apply\nasd", "user": {"login": "user"}}, + {"node_id": "7", "body": "asdasdasd", "user": {"login": "user"}} +]` + minimizeResp := "{}" + type graphQLCall struct { + Variables struct { + Input githubv4.MinimizeCommentInput `json:"input"` + } `json:"variables"` + } + gotMinimizeCalls := make([]graphQLCall, 0, 1) + testServer := httptest.NewTLSServer( + http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.Method + " " + r.RequestURI { + // This gets the pull request's comments. + case "GET /api/v3/repos/owner/repo/issues/123/comments?direction=asc&sort=created": + w.Write([]byte(issueResp)) // nolint: errcheck + return + case "POST /graphql": + if accept, has := r.Header["Accept"]; !has || accept[0] != "application/vnd.github.queen-beryl-preview+json" { + t.Error("missing preview header") + http.Error(w, "bad request", http.StatusBadRequest) + return + } + defer r.Body.Close() // nolint: errcheck + body, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Errorf("read body error: %v", err) + http.Error(w, "server error", http.StatusInternalServerError) + return + } + t.Log(string(body)) + call := graphQLCall{} + err = json.Unmarshal(body, &call) + if err != nil { + t.Errorf("parse body error: %v", err) + http.Error(w, "server error", http.StatusInternalServerError) + return + } + gotMinimizeCalls = append(gotMinimizeCalls, call) + w.Write([]byte(minimizeResp)) // nolint: errcheck + return + default: + t.Errorf("got unexpected request at %q", r.RequestURI) + http.Error(w, "not found", http.StatusNotFound) + return + } + }), + ) + + testServerURL, err := url.Parse(testServer.URL) + Ok(t, err) + + client, err := vcs.NewGithubClient(testServerURL.Host, "user", "pass") + Ok(t, err) + defer disableSSLVerification()() + + err = client.HideOldComments( + models.Repo{ + FullName: "owner/repo", + Owner: "owner", + Name: "repo", + CloneURL: "", + SanitizedCloneURL: "", + VCSHost: models.VCSHost{ + Hostname: "github.com", + Type: models.Github, + }, + }, + 123, + ) + Ok(t, err) + Equals(t, 1, len(gotMinimizeCalls)) + Equals(t, "6", gotMinimizeCalls[0].Variables.Input.SubjectID) + Equals(t, githubv4.ReportedContentClassifiersOutdated, gotMinimizeCalls[0].Variables.Input.Classifier) +} + func TestGithubClient_UpdateStatus(t *testing.T) { cases := []struct { status models.CommitStatus From 68d2bd9ff056dbf4fc33e1604129548a87a2cd99 Mon Sep 17 00:00:00 2001 From: Sam Park Date: Tue, 21 Jan 2020 14:12:54 -0800 Subject: [PATCH 06/13] Update server/events/vcs/proxy.go Co-Authored-By: Luke Kysow <1034429+lkysow@users.noreply.github.com> --- server/events/vcs/proxy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/events/vcs/proxy.go b/server/events/vcs/proxy.go index 8f56749020..f49d6ae4b3 100644 --- a/server/events/vcs/proxy.go +++ b/server/events/vcs/proxy.go @@ -61,7 +61,7 @@ func (d *ClientProxy) CreateComment(repo models.Repo, pullNum int, comment strin } func (d *ClientProxy) HideOldComments(repo models.Repo, pullNum int) error { - return nil + return d.clients[repo.VCSHost.Type].HideOldComments(repo, pullNum) } func (d *ClientProxy) PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error) { From 041c45d4c150902287726b627903d0e405d919cb Mon Sep 17 00:00:00 2001 From: Sam Park Date: Fri, 24 Jan 2020 20:50:13 -0800 Subject: [PATCH 07/13] Move hide comments call up sooner --- server/events/command_runner.go | 11 +++++++---- server/events/vcs/client.go | 3 --- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/events/command_runner.go b/server/events/command_runner.go index 19d32d0404..9325d431bb 100644 --- a/server/events/command_runner.go +++ b/server/events/command_runner.go @@ -421,14 +421,17 @@ func (c *DefaultCommandRunner) updatePull(ctx *CommandContext, command PullComma ctx.Log.Warn(res.Failure) } + // HideOldComments will hide old comments left from previous plan runs to reduce + // clutter in a pull/merge request. This will not delete the comment, since the + // comment trail may be useful in auditing or backtracing problems. + if err := c.VCSClient.HideOldComments(ctx.BaseRepo, ctx.Pull.Num); err != nil { + ctx.Log.Err("unable to hide old comments: %s", err) + } + comment := c.MarkdownRenderer.Render(res, command.CommandName(), ctx.Log.History.String(), command.IsVerbose(), ctx.BaseRepo.VCSHost.Type) if err := c.VCSClient.CreateComment(ctx.BaseRepo, ctx.Pull.Num, comment); err != nil { ctx.Log.Err("unable to comment: %s", err) } - - if err := c.VCSClient.HideOldComments(ctx.BaseRepo, ctx.Pull.Num); err != nil { - ctx.Log.Err("unable to hide old comments: %s", err) - } } // logPanics logs and creates a comment on the pull request for panics. diff --git a/server/events/vcs/client.go b/server/events/vcs/client.go index 1a103c9db1..0aea645726 100644 --- a/server/events/vcs/client.go +++ b/server/events/vcs/client.go @@ -25,9 +25,6 @@ type Client interface { // relative to the repo root, e.g. parent/child/file.txt. GetModifiedFiles(repo models.Repo, pull models.PullRequest) ([]string, error) CreateComment(repo models.Repo, pullNum int, comment string) error - // HideOldComments will hide old comments left from previous plan runs to reduce - // clutter in a pull/merge request. This will not delete the comment, since the - // comment trail may be useful in auditing or backtracing problems. HideOldComments(repo models.Repo, pullNum int) error PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error) PullIsMergeable(repo models.Repo, pull models.PullRequest) (bool, error) From fd93af8a558dd89c93ea76ff0fe9271ac850b0f3 Mon Sep 17 00:00:00 2001 From: Sam Park Date: Fri, 24 Jan 2020 20:50:51 -0800 Subject: [PATCH 08/13] Fix body string check --- server/events/vcs/github_client.go | 3 ++- server/events/vcs/github_client_test.go | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/server/events/vcs/github_client.go b/server/events/vcs/github_client.go index 3d0ee6bd0c..9629e4e0bb 100644 --- a/server/events/vcs/github_client.go +++ b/server/events/vcs/github_client.go @@ -159,7 +159,8 @@ func (g *GithubClient) HideOldComments(repo models.Repo, pullNum int) error { // a reasonable one, given we've already filtered the comments by the // configured Atlantis user. body := strings.Split(comment.GetBody(), "\n") - if !strings.Contains(body[0], models.ApplyCommand.String()) { + firstLine := strings.ToLower(body[0]) + if !strings.Contains(firstLine, models.PlanCommand.String()) { continue } var m struct { diff --git a/server/events/vcs/github_client_test.go b/server/events/vcs/github_client_test.go index f8d4027ce9..1ae64d4093 100644 --- a/server/events/vcs/github_client_test.go +++ b/server/events/vcs/github_client_test.go @@ -137,14 +137,14 @@ func TestGithubClient_GetModifiedFilesMovedFile(t *testing.T) { func TestGithubClient_HideOldComments(t *testing.T) { // Only comment 6 should be minimized, because it's by the same Atlantis bot user - // and it has "apply" in the first line of the comment body. + // and it has "plan" in the first line of the comment body. issueResp := `[ - {"node_id": "1", "body": "asd\napply\nasd", "user": {"login": "someone-else"}}, - {"node_id": "2", "body": "asd apply\nasd", "user": {"login": "someone-else"}}, + {"node_id": "1", "body": "asd\nplan\nasd", "user": {"login": "someone-else"}}, + {"node_id": "2", "body": "asd plan\nasd", "user": {"login": "someone-else"}}, {"node_id": "3", "body": "asdasdasd\nasdasdasd", "user": {"login": "someone-else"}}, {"node_id": "4", "body": "asdasdasd\nasdasdasd", "user": {"login": "user"}}, - {"node_id": "5", "body": "asd\napply\nasd", "user": {"login": "user"}}, - {"node_id": "6", "body": "asd apply\nasd", "user": {"login": "user"}}, + {"node_id": "5", "body": "asd\nplan\nasd", "user": {"login": "user"}}, + {"node_id": "6", "body": "asd plan\nasd", "user": {"login": "user"}}, {"node_id": "7", "body": "asdasdasd", "user": {"login": "user"}} ]` minimizeResp := "{}" From dcd43bead1686f92e51fd902920e509cb71bfc56 Mon Sep 17 00:00:00 2001 From: Sam Park Date: Fri, 24 Jan 2020 21:15:28 -0800 Subject: [PATCH 09/13] Add pagination --- server/events/vcs/github_client.go | 25 +++--- server/events/vcs/github_client_test.go | 100 +++++++++++++++++++++++- 2 files changed, 115 insertions(+), 10 deletions(-) diff --git a/server/events/vcs/github_client.go b/server/events/vcs/github_client.go index 9629e4e0bb..ea2b0b029d 100644 --- a/server/events/vcs/github_client.go +++ b/server/events/vcs/github_client.go @@ -140,17 +140,24 @@ func (g *GithubClient) CreateComment(repo models.Repo, pullNum int, comment stri } func (g *GithubClient) HideOldComments(repo models.Repo, pullNum int) error { - // TODO: Paginate issues. - comments, _, err := g.client.Issues.ListComments(g.ctx, repo.Owner, repo.Name, pullNum, &github.IssueListCommentsOptions{ - Sort: "created", - Direction: "asc", - ListOptions: github.ListOptions{}, - }) - if err != nil { - return err + var allComments []*github.IssueComment + for page := 0; ; { + comments, resp, err := g.client.Issues.ListComments(g.ctx, repo.Owner, repo.Name, pullNum, &github.IssueListCommentsOptions{ + Sort: "created", + Direction: "asc", + ListOptions: github.ListOptions{Page: page}, + }) + if err != nil { + return err + } + allComments = append(allComments, comments...) + if resp.NextPage == 0 { + break + } + page = resp.NextPage } - for _, comment := range comments { + for _, comment := range allComments { if comment.User != nil && comment.User.GetLogin() != g.user { continue } diff --git a/server/events/vcs/github_client_test.go b/server/events/vcs/github_client_test.go index 1ae64d4093..8f3f03563a 100644 --- a/server/events/vcs/github_client_test.go +++ b/server/events/vcs/github_client_test.go @@ -135,6 +135,105 @@ func TestGithubClient_GetModifiedFilesMovedFile(t *testing.T) { Equals(t, []string{"new/filename.txt", "previous/filename.txt"}, files) } +func TestGithubClient_PaginatesComments(t *testing.T) { + calls := 0 + issueResps := []string{ + `[ + {"node_id": "1", "body": "asd\nplan\nasd", "user": {"login": "someone-else"}}, + {"node_id": "2", "body": "asd plan\nasd", "user": {"login": "user"}} +]`, + `[ + {"node_id": "3", "body": "asd", "user": {"login": "someone-else"}}, + {"node_id": "4", "body": "asdasd", "user": {"login": "someone-else"}} +]`, + `[ + {"node_id": "5", "body": "asd plan", "user": {"login": "someone-else"}}, + {"node_id": "6", "body": "asd\nplan", "user": {"login": "user"}} +]`, + `[ + {"node_id": "7", "body": "asd", "user": {"login": "user"}}, + {"node_id": "8", "body": "asd plan \n asd", "user": {"login": "user"}} +]`, + } + minimizeResp := "{}" + type graphQLCall struct { + Variables struct { + Input githubv4.MinimizeCommentInput `json:"input"` + } `json:"variables"` + } + gotMinimizeCalls := make([]graphQLCall, 0, 2) + testServer := httptest.NewTLSServer( + http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.Method + " " + r.RequestURI { + case "POST /graphql": + defer r.Body.Close() // nolint: errcheck + body, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Errorf("read body error: %v", err) + http.Error(w, "server error", http.StatusInternalServerError) + return + } + call := graphQLCall{} + err = json.Unmarshal(body, &call) + if err != nil { + t.Errorf("parse body error: %v", err) + http.Error(w, "server error", http.StatusInternalServerError) + return + } + gotMinimizeCalls = append(gotMinimizeCalls, call) + w.Write([]byte(minimizeResp)) // nolint: errcheck + return + default: + if r.Method != "GET" || !strings.HasPrefix(r.RequestURI, "/api/v3/repos/owner/repo/issues/123/comments") { + t.Errorf("got unexpected request at %q", r.RequestURI) + http.Error(w, "not found", http.StatusNotFound) + return + } + if (calls + 1) < len(issueResps) { + w.Header().Add( + "Link", + fmt.Sprintf( + `; rel="next"`, + r.Host, + calls+1, + ), + ) + } + w.Write([]byte(issueResps[calls])) // nolint: errcheck + calls += 1 + } + }), + ) + + testServerURL, err := url.Parse(testServer.URL) + Ok(t, err) + + client, err := vcs.NewGithubClient(testServerURL.Host, "user", "pass") + Ok(t, err) + defer disableSSLVerification()() + + err = client.HideOldComments( + models.Repo{ + FullName: "owner/repo", + Owner: "owner", + Name: "repo", + CloneURL: "", + SanitizedCloneURL: "", + VCSHost: models.VCSHost{ + Hostname: "github.com", + Type: models.Github, + }, + }, + 123, + ) + Ok(t, err) + Equals(t, 2, len(gotMinimizeCalls)) + Equals(t, "2", gotMinimizeCalls[0].Variables.Input.SubjectID) + Equals(t, "8", gotMinimizeCalls[1].Variables.Input.SubjectID) + Equals(t, githubv4.ReportedContentClassifiersOutdated, gotMinimizeCalls[0].Variables.Input.Classifier) + Equals(t, githubv4.ReportedContentClassifiersOutdated, gotMinimizeCalls[1].Variables.Input.Classifier) +} + func TestGithubClient_HideOldComments(t *testing.T) { // Only comment 6 should be minimized, because it's by the same Atlantis bot user // and it has "plan" in the first line of the comment body. @@ -174,7 +273,6 @@ func TestGithubClient_HideOldComments(t *testing.T) { http.Error(w, "server error", http.StatusInternalServerError) return } - t.Log(string(body)) call := graphQLCall{} err = json.Unmarshal(body, &call) if err != nil { From 782501b8e913bca1f7a490dfa40e3c1963ab81f9 Mon Sep 17 00:00:00 2001 From: Sam Park Date: Fri, 24 Jan 2020 22:07:00 -0800 Subject: [PATCH 10/13] Add a flag to control hiding behavior --- cmd/server.go | 6 ++++++ runatlantis.io/docs/server-configuration.md | 6 ++++++ server/events/command_runner.go | 8 ++++++-- server/server.go | 1 + server/user_config.go | 1 + 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/cmd/server.go b/cmd/server.go index 5d97e56263..61da84c1b6 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -61,6 +61,7 @@ const ( GitlabTokenFlag = "gitlab-token" GitlabUserFlag = "gitlab-user" GitlabWebhookSecretFlag = "gitlab-webhook-secret" // nolint: gosec + HidePrevPlanComments = "hide-prev-plan-comments" LogLevelFlag = "log-level" PortFlag = "port" RepoConfigFlag = "repo-config" @@ -250,6 +251,11 @@ var boolFlags = map[string]boolFlag{ description: "Disable \"atlantis apply\" command so a specific project/workspace/directory has to be specified for applies.", defaultValue: false, }, + HidePrevPlanComments: { + description: "Hide previous plan comments will be hidden to reduce clutter in a PR. " + + "VCS support is limited to: Github", + defaultValue: false, + }, RequireApprovalFlag: { description: "Require pull requests to be \"Approved\" before allowing the apply command to be run.", defaultValue: false, diff --git a/runatlantis.io/docs/server-configuration.md b/runatlantis.io/docs/server-configuration.md index bd91583def..f6791f0393 100644 --- a/runatlantis.io/docs/server-configuration.md +++ b/runatlantis.io/docs/server-configuration.md @@ -276,6 +276,12 @@ Values are chosen in this order: ``` View help. +* ### `--hide-prev-plan-comments` + ```bash + atlantis server --hide-prev-plan-comments + ``` + Hides previous plan comments to declutter PRs. + * ### `--log-level` ```bash atlantis server --log-level="" diff --git a/server/events/command_runner.go b/server/events/command_runner.go index 9325d431bb..bbcd9fdeaa 100644 --- a/server/events/command_runner.go +++ b/server/events/command_runner.go @@ -79,6 +79,8 @@ type DefaultCommandRunner struct { // this in our error message back to the user on a forked PR so they know // how to enable this functionality. AllowForkPRsFlag string + // HidePrevPlanComments will hide previous plan comments to declutter PRs. + HidePrevPlanComments bool // SilenceForkPRErrors controls whether to comment on Fork PRs when AllowForkPRs = False SilenceForkPRErrors bool // SilenceForkPRErrorsFlag is the name of the flag that controls fork PR's. We use @@ -424,8 +426,10 @@ func (c *DefaultCommandRunner) updatePull(ctx *CommandContext, command PullComma // HideOldComments will hide old comments left from previous plan runs to reduce // clutter in a pull/merge request. This will not delete the comment, since the // comment trail may be useful in auditing or backtracing problems. - if err := c.VCSClient.HideOldComments(ctx.BaseRepo, ctx.Pull.Num); err != nil { - ctx.Log.Err("unable to hide old comments: %s", err) + if c.HidePrevPlanComments { + if err := c.VCSClient.HideOldComments(ctx.BaseRepo, ctx.Pull.Num); err != nil { + ctx.Log.Err("unable to hide old comments: %s", err) + } } comment := c.MarkdownRenderer.Render(res, command.CommandName(), ctx.Log.History.String(), command.IsVerbose(), ctx.BaseRepo.VCSHost.Type) diff --git a/server/server.go b/server/server.go index 7e49c55399..1d0038f751 100644 --- a/server/server.go +++ b/server/server.go @@ -314,6 +314,7 @@ func NewServer(userConfig UserConfig, config Config) (*Server, error) { Logger: logger, AllowForkPRs: userConfig.AllowForkPRs, AllowForkPRsFlag: config.AllowForkPRsFlag, + HidePrevPlanComments: userConfig.HidePrevPlanComments, SilenceForkPRErrors: userConfig.SilenceForkPRErrors, SilenceForkPRErrorsFlag: config.SilenceForkPRErrorsFlag, DisableApplyAll: userConfig.DisableApplyAll, diff --git a/server/user_config.go b/server/user_config.go index 5435078ea2..b640c22cc8 100644 --- a/server/user_config.go +++ b/server/user_config.go @@ -29,6 +29,7 @@ type UserConfig struct { GitlabToken string `mapstructure:"gitlab-token"` GitlabUser string `mapstructure:"gitlab-user"` GitlabWebhookSecret string `mapstructure:"gitlab-webhook-secret"` + HidePrevPlanComments bool `mapstructure:"hide-prev-plan-comments"` LogLevel string `mapstructure:"log-level"` Port int `mapstructure:"port"` RepoConfig string `mapstructure:"repo-config"` From 3af4eb393e82d1f6f74c30923429830b4ea71059 Mon Sep 17 00:00:00 2001 From: Sam Park Date: Fri, 24 Jan 2020 22:53:54 -0800 Subject: [PATCH 11/13] Mocks --- server/events/vcs/mocks/mock_client.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/server/events/vcs/mocks/mock_client.go b/server/events/vcs/mocks/mock_client.go index f8e005906a..c338bce6c3 100644 --- a/server/events/vcs/mocks/mock_client.go +++ b/server/events/vcs/mocks/mock_client.go @@ -59,6 +59,21 @@ func (mock *MockClient) CreateComment(repo models.Repo, pullNum int, comment str return ret0 } +func (mock *MockClient) HideOldComments(repo models.Repo, pullNum int) error { + if mock == nil { + panic("mock must not be nil. Use myMock := NewMockClient().") + } + params := []pegomock.Param{repo, pullNum} + result := pegomock.GetGenericMockFrom(mock).Invoke("HideOldComments", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) + var ret0 error + if len(result) != 0 { + if result[0] != nil { + ret0 = result[0].(error) + } + } + return ret0 +} + func (mock *MockClient) PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockClient().") From 6a4236b24de51cffcf29b7e06e283671c91ef2c8 Mon Sep 17 00:00:00 2001 From: Sam Park Date: Fri, 24 Jan 2020 22:59:39 -0800 Subject: [PATCH 12/13] Fix lints --- server/events/vcs/github_client_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/events/vcs/github_client_test.go b/server/events/vcs/github_client_test.go index 8f3f03563a..c049053d1b 100644 --- a/server/events/vcs/github_client_test.go +++ b/server/events/vcs/github_client_test.go @@ -200,7 +200,7 @@ func TestGithubClient_PaginatesComments(t *testing.T) { ) } w.Write([]byte(issueResps[calls])) // nolint: errcheck - calls += 1 + calls++ } }), ) From 6e8b4eed1621b7ae5c75d1930da15743e67d6cad Mon Sep 17 00:00:00 2001 From: Luke Kysow <1034429+lkysow@users.noreply.github.com> Date: Wed, 15 Apr 2020 21:44:34 -0700 Subject: [PATCH 13/13] Small refactor --- cmd/server.go | 4 ++-- runatlantis.io/docs/server-configuration.md | 3 ++- server/events/command_runner.go | 4 ++-- server/events/vcs/azuredevops_client.go | 2 +- server/events/vcs/bitbucketcloud/client.go | 2 +- server/events/vcs/bitbucketserver/client.go | 2 +- server/events/vcs/client.go | 2 +- server/events/vcs/github_client.go | 17 ++++++++++++----- server/events/vcs/github_client_test.go | 4 ++-- server/events/vcs/gitlab_client.go | 2 +- server/events/vcs/mocks/mock_client.go | 4 ++-- server/events/vcs/not_configured_vcs_client.go | 2 +- server/events/vcs/proxy.go | 4 ++-- 13 files changed, 30 insertions(+), 22 deletions(-) diff --git a/cmd/server.go b/cmd/server.go index 61da84c1b6..125e300475 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -252,8 +252,8 @@ var boolFlags = map[string]boolFlag{ defaultValue: false, }, HidePrevPlanComments: { - description: "Hide previous plan comments will be hidden to reduce clutter in a PR. " + - "VCS support is limited to: Github", + description: "Hide previous plan comments to reduce clutter in the PR. " + + "VCS support is limited to: GitHub.", defaultValue: false, }, RequireApprovalFlag: { diff --git a/runatlantis.io/docs/server-configuration.md b/runatlantis.io/docs/server-configuration.md index f6791f0393..2c63af1090 100644 --- a/runatlantis.io/docs/server-configuration.md +++ b/runatlantis.io/docs/server-configuration.md @@ -280,7 +280,8 @@ Values are chosen in this order: ```bash atlantis server --hide-prev-plan-comments ``` - Hides previous plan comments to declutter PRs. + Hide previous plan comments to declutter PRs. This is only supported in + GitHub currently. * ### `--log-level` ```bash diff --git a/server/events/command_runner.go b/server/events/command_runner.go index bbcd9fdeaa..85f01b3b81 100644 --- a/server/events/command_runner.go +++ b/server/events/command_runner.go @@ -423,11 +423,11 @@ func (c *DefaultCommandRunner) updatePull(ctx *CommandContext, command PullComma ctx.Log.Warn(res.Failure) } - // HideOldComments will hide old comments left from previous plan runs to reduce + // HidePrevPlanComments will hide old comments left from previous plan runs to reduce // clutter in a pull/merge request. This will not delete the comment, since the // comment trail may be useful in auditing or backtracing problems. if c.HidePrevPlanComments { - if err := c.VCSClient.HideOldComments(ctx.BaseRepo, ctx.Pull.Num); err != nil { + if err := c.VCSClient.HidePrevPlanComments(ctx.BaseRepo, ctx.Pull.Num); err != nil { ctx.Log.Err("unable to hide old comments: %s", err) } } diff --git a/server/events/vcs/azuredevops_client.go b/server/events/vcs/azuredevops_client.go index c7990045e6..86243a5019 100644 --- a/server/events/vcs/azuredevops_client.go +++ b/server/events/vcs/azuredevops_client.go @@ -124,7 +124,7 @@ func (g *AzureDevopsClient) CreateComment(repo models.Repo, pullNum int, comment return nil } -func (g *AzureDevopsClient) HideOldComments(repo models.Repo, pullNum int) error { +func (g *AzureDevopsClient) HidePrevPlanComments(repo models.Repo, pullNum int) error { return nil } diff --git a/server/events/vcs/bitbucketcloud/client.go b/server/events/vcs/bitbucketcloud/client.go index 50f7294177..de7e74bfb8 100644 --- a/server/events/vcs/bitbucketcloud/client.go +++ b/server/events/vcs/bitbucketcloud/client.go @@ -100,7 +100,7 @@ func (b *Client) CreateComment(repo models.Repo, pullNum int, comment string) er return err } -func (b *Client) HideOldComments(repo models.Repo, pullNum int) error { +func (b *Client) HidePrevPlanComments(repo models.Repo, pullNum int) error { return nil } diff --git a/server/events/vcs/bitbucketserver/client.go b/server/events/vcs/bitbucketserver/client.go index a577d2bcb3..4293fa0e4d 100644 --- a/server/events/vcs/bitbucketserver/client.go +++ b/server/events/vcs/bitbucketserver/client.go @@ -141,7 +141,7 @@ func (b *Client) CreateComment(repo models.Repo, pullNum int, comment string) er return nil } -func (b *Client) HideOldComments(repo models.Repo, pullNum int) error { +func (b *Client) HidePrevPlanComments(repo models.Repo, pullNum int) error { return nil } diff --git a/server/events/vcs/client.go b/server/events/vcs/client.go index 0aea645726..e0a34eb79a 100644 --- a/server/events/vcs/client.go +++ b/server/events/vcs/client.go @@ -25,7 +25,7 @@ type Client interface { // relative to the repo root, e.g. parent/child/file.txt. GetModifiedFiles(repo models.Repo, pull models.PullRequest) ([]string, error) CreateComment(repo models.Repo, pullNum int, comment string) error - HideOldComments(repo models.Repo, pullNum int) error + HidePrevPlanComments(repo models.Repo, pullNum int) error PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error) PullIsMergeable(repo models.Repo, pull models.PullRequest) (bool, error) // UpdateStatus updates the commit status to state for pull. src is the diff --git a/server/events/vcs/github_client.go b/server/events/vcs/github_client.go index ea2b0b029d..2297aa6c6c 100644 --- a/server/events/vcs/github_client.go +++ b/server/events/vcs/github_client.go @@ -139,13 +139,14 @@ func (g *GithubClient) CreateComment(repo models.Repo, pullNum int, comment stri return nil } -func (g *GithubClient) HideOldComments(repo models.Repo, pullNum int) error { +func (g *GithubClient) HidePrevPlanComments(repo models.Repo, pullNum int) error { var allComments []*github.IssueComment - for page := 0; ; { + nextPage := 0 + for { comments, resp, err := g.client.Issues.ListComments(g.ctx, repo.Owner, repo.Name, pullNum, &github.IssueListCommentsOptions{ Sort: "created", Direction: "asc", - ListOptions: github.ListOptions{Page: page}, + ListOptions: github.ListOptions{Page: nextPage}, }) if err != nil { return err @@ -154,11 +155,14 @@ func (g *GithubClient) HideOldComments(repo models.Repo, pullNum int) error { if resp.NextPage == 0 { break } - page = resp.NextPage + nextPage = resp.NextPage } for _, comment := range allComments { - if comment.User != nil && comment.User.GetLogin() != g.user { + // Using a case insensitive compare here because usernames aren't case + // sensitive and users may enter their atlantis users with different + // cases. + if comment.User != nil && !strings.EqualFold(comment.User.GetLogin(), g.user) { continue } // Crude filtering: The comment templates typically include the command name @@ -166,6 +170,9 @@ func (g *GithubClient) HideOldComments(repo models.Repo, pullNum int) error { // a reasonable one, given we've already filtered the comments by the // configured Atlantis user. body := strings.Split(comment.GetBody(), "\n") + if len(body) == 0 { + continue + } firstLine := strings.ToLower(body[0]) if !strings.Contains(firstLine, models.PlanCommand.String()) { continue diff --git a/server/events/vcs/github_client_test.go b/server/events/vcs/github_client_test.go index c049053d1b..52e62c6d09 100644 --- a/server/events/vcs/github_client_test.go +++ b/server/events/vcs/github_client_test.go @@ -212,7 +212,7 @@ func TestGithubClient_PaginatesComments(t *testing.T) { Ok(t, err) defer disableSSLVerification()() - err = client.HideOldComments( + err = client.HidePrevPlanComments( models.Repo{ FullName: "owner/repo", Owner: "owner", @@ -298,7 +298,7 @@ func TestGithubClient_HideOldComments(t *testing.T) { Ok(t, err) defer disableSSLVerification()() - err = client.HideOldComments( + err = client.HidePrevPlanComments( models.Repo{ FullName: "owner/repo", Owner: "owner", diff --git a/server/events/vcs/gitlab_client.go b/server/events/vcs/gitlab_client.go index 0caa87f761..c18424585b 100644 --- a/server/events/vcs/gitlab_client.go +++ b/server/events/vcs/gitlab_client.go @@ -139,7 +139,7 @@ func (g *GitlabClient) CreateComment(repo models.Repo, pullNum int, comment stri return err } -func (g *GitlabClient) HideOldComments(repo models.Repo, pullNum int) error { +func (g *GitlabClient) HidePrevPlanComments(repo models.Repo, pullNum int) error { return nil } diff --git a/server/events/vcs/mocks/mock_client.go b/server/events/vcs/mocks/mock_client.go index c338bce6c3..faa79894fd 100644 --- a/server/events/vcs/mocks/mock_client.go +++ b/server/events/vcs/mocks/mock_client.go @@ -59,12 +59,12 @@ func (mock *MockClient) CreateComment(repo models.Repo, pullNum int, comment str return ret0 } -func (mock *MockClient) HideOldComments(repo models.Repo, pullNum int) error { +func (mock *MockClient) HidePrevPlanComments(repo models.Repo, pullNum int) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockClient().") } params := []pegomock.Param{repo, pullNum} - result := pegomock.GetGenericMockFrom(mock).Invoke("HideOldComments", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) + result := pegomock.GetGenericMockFrom(mock).Invoke("HidePrevPlanComments", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { if result[0] != nil { diff --git a/server/events/vcs/not_configured_vcs_client.go b/server/events/vcs/not_configured_vcs_client.go index f493c87eb3..5c3a9d71b8 100644 --- a/server/events/vcs/not_configured_vcs_client.go +++ b/server/events/vcs/not_configured_vcs_client.go @@ -32,7 +32,7 @@ func (a *NotConfiguredVCSClient) GetModifiedFiles(repo models.Repo, pull models. func (a *NotConfiguredVCSClient) CreateComment(repo models.Repo, pullNum int, comment string) error { return a.err() } -func (a *NotConfiguredVCSClient) HideOldComments(repo models.Repo, pullNum int) error { +func (a *NotConfiguredVCSClient) HidePrevPlanComments(repo models.Repo, pullNum int) error { return nil } func (a *NotConfiguredVCSClient) PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error) { diff --git a/server/events/vcs/proxy.go b/server/events/vcs/proxy.go index f49d6ae4b3..45e4a36cd3 100644 --- a/server/events/vcs/proxy.go +++ b/server/events/vcs/proxy.go @@ -60,8 +60,8 @@ func (d *ClientProxy) CreateComment(repo models.Repo, pullNum int, comment strin return d.clients[repo.VCSHost.Type].CreateComment(repo, pullNum, comment) } -func (d *ClientProxy) HideOldComments(repo models.Repo, pullNum int) error { - return d.clients[repo.VCSHost.Type].HideOldComments(repo, pullNum) +func (d *ClientProxy) HidePrevPlanComments(repo models.Repo, pullNum int) error { + return d.clients[repo.VCSHost.Type].HidePrevPlanComments(repo, pullNum) } func (d *ClientProxy) PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error) {