From 93ef3ea4299942f8fb7ade7e03d467ea578b3e1a Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Sat, 21 Sep 2019 03:57:56 -0700 Subject: [PATCH] Update dependencies --- go.mod | 46 +- go.sum | 190 +- .../azure-devops-go-api/azuredevops/LICENSE | 21 + .../azuredevops/build/client.go | 3234 ++++++++++ .../azuredevops/build/models.go | 2301 +++++++ .../azure-devops-go-api/azuredevops/client.go | 417 ++ .../azuredevops/connection.go | 154 + .../azuredevops/core/client.go | 863 +++ .../azuredevops/core/models.go | 483 ++ .../delegatedauthorization/models.go | 350 ++ .../distributedtaskcommon/models.go | 80 + .../azure-devops-go-api/azuredevops/errors.go | 17 + .../azuredevops/git/client.go | 5456 +++++++++++++++++ .../azuredevops/git/models.go | 3129 ++++++++++ .../azure-devops-go-api/azuredevops/go.mod | 5 + .../azure-devops-go-api/azuredevops/go.sum | 2 + .../azuredevops/identity/client.go | 942 +++ .../azuredevops/identity/models.go | 234 + .../azure-devops-go-api/azuredevops/models.go | 130 + .../azuredevops/operations/client.go | 59 + .../azuredevops/operations/models.go | 77 + .../azuredevops/policy/client.go | 463 ++ .../azuredevops/policy/models.go | 134 + .../azuredevops/system/models.go | 97 + .../azuredevops/test/client.go | 2066 +++++++ .../azuredevops/test/models.go | 3564 +++++++++++ .../azuredevops/version.go | 58 + .../azuredevops/versionnegotiation.go | 72 + .../azuredevops/webapi/models.go | 315 + vendor/github.com/google/uuid/.travis.yml | 9 + vendor/github.com/google/uuid/CONTRIBUTING.md | 10 + vendor/github.com/google/uuid/CONTRIBUTORS | 9 + vendor/github.com/google/uuid/LICENSE | 27 + vendor/github.com/google/uuid/README.md | 19 + vendor/github.com/google/uuid/dce.go | 80 + vendor/github.com/google/uuid/doc.go | 12 + vendor/github.com/google/uuid/go.mod | 1 + vendor/github.com/google/uuid/hash.go | 53 + vendor/github.com/google/uuid/marshal.go | 37 + vendor/github.com/google/uuid/node.go | 90 + vendor/github.com/google/uuid/node_js.go | 12 + vendor/github.com/google/uuid/node_net.go | 33 + vendor/github.com/google/uuid/sql.go | 59 + vendor/github.com/google/uuid/time.go | 123 + vendor/github.com/google/uuid/util.go | 43 + vendor/github.com/google/uuid/uuid.go | 245 + vendor/github.com/google/uuid/version1.go | 44 + vendor/github.com/google/uuid/version4.go | 38 + vendor/modules.txt | 15 + 49 files changed, 25702 insertions(+), 216 deletions(-) create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/LICENSE create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/build/client.go create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/build/models.go create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/client.go create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/connection.go create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/core/client.go create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/core/models.go create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/delegatedauthorization/models.go create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/distributedtaskcommon/models.go create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/errors.go create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/git/client.go create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/git/models.go create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/go.mod create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/go.sum create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/identity/client.go create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/identity/models.go create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/models.go create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/operations/client.go create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/operations/models.go create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/policy/client.go create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/policy/models.go create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/system/models.go create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/test/client.go create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/test/models.go create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/version.go create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/versionnegotiation.go create mode 100644 vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/webapi/models.go create mode 100644 vendor/github.com/google/uuid/.travis.yml create mode 100644 vendor/github.com/google/uuid/CONTRIBUTING.md create mode 100644 vendor/github.com/google/uuid/CONTRIBUTORS create mode 100644 vendor/github.com/google/uuid/LICENSE create mode 100644 vendor/github.com/google/uuid/README.md create mode 100644 vendor/github.com/google/uuid/dce.go create mode 100644 vendor/github.com/google/uuid/doc.go create mode 100644 vendor/github.com/google/uuid/go.mod create mode 100644 vendor/github.com/google/uuid/hash.go create mode 100644 vendor/github.com/google/uuid/marshal.go create mode 100644 vendor/github.com/google/uuid/node.go create mode 100644 vendor/github.com/google/uuid/node_js.go create mode 100644 vendor/github.com/google/uuid/node_net.go create mode 100644 vendor/github.com/google/uuid/sql.go create mode 100644 vendor/github.com/google/uuid/time.go create mode 100644 vendor/github.com/google/uuid/util.go create mode 100644 vendor/github.com/google/uuid/uuid.go create mode 100644 vendor/github.com/google/uuid/version1.go create mode 100644 vendor/github.com/google/uuid/version4.go diff --git a/go.mod b/go.mod index 9005eb62..6f861614 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,6 @@ replace github.com/yfronto/newrelic => ./vendor/github.com/yfronto/newrelic require ( cloud.google.com/go v0.45.1 // indirect code.cloudfoundry.org/bytefmt v0.0.0-20180906201452-2aa6f33b730c - github.com/BurntSushi/xgb v0.0.0-20160522221800-27f122750802 // indirect github.com/Microsoft/go-winio v0.4.14 // indirect github.com/PagerDuty/go-pagerduty v0.0.0-20190503230806-cf1437c7c8d6 github.com/StackExchange/wmi v0.0.0-20190523213609-cbe66965904d // indirect @@ -17,96 +16,57 @@ require ( github.com/andygrunwald/go-gerrit v0.0.0-20190625080919-64931d233c2d github.com/briandowns/openweathermap v0.0.0-20180804155945-5f41b7c9d92d github.com/cenkalti/backoff v2.2.0+incompatible // indirect - github.com/coreos/bbolt v1.3.3 // indirect - github.com/coreos/etcd v3.3.15+incompatible // indirect - github.com/coreos/go-semver v0.3.0 // indirect - github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f // indirect - github.com/cosiner/argv v0.0.1 // indirect + github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect github.com/docker/distribution v2.7.1+incompatible // indirect github.com/docker/docker v1.13.1 github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.4.0 // indirect github.com/dustin/go-humanize v1.0.0 github.com/gdamore/tcell v1.2.0 - github.com/go-delve/delve v1.3.0 // indirect - github.com/go-kit/kit v0.9.0 // indirect github.com/go-ole/go-ole v1.2.4 // indirect github.com/godbus/dbus v5.0.1+incompatible // indirect github.com/gogo/protobuf v1.3.0 // indirect + github.com/google/btree v1.0.0 // indirect github.com/google/go-cmp v0.3.1 // indirect github.com/google/go-github/v26 v26.0.9 - github.com/google/pprof v0.0.0-20190723021845-34ac40c74b70 // indirect - github.com/gorilla/websocket v1.4.1 // indirect - github.com/grpc-ecosystem/grpc-gateway v1.11.1 // indirect github.com/hashicorp/go-cleanhttp v0.5.1 // indirect - github.com/hashicorp/golang-lru v0.5.3 // indirect github.com/hekmon/cunits v2.0.1+incompatible // indirect github.com/hekmon/transmissionrpc v0.0.0-20190525133028-1d589625bacd github.com/jessevdk/go-flags v1.4.0 - github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect - github.com/kr/pty v1.1.8 // indirect + github.com/json-iterator/go v1.1.7 // indirect github.com/logrusorgru/aurora v0.0.0-20190428105938-cea283e61946 - github.com/magiconair/properties v1.8.1 // indirect - github.com/mattn/go-colorable v0.1.2 // indirect github.com/mattn/go-isatty v0.0.9 // indirect - github.com/microsoft/azure-devops-go-api v0.0.0-20190912142452-3207b4a469d3 // indirect github.com/microsoft/azure-devops-go-api/azuredevops v0.0.0-20190912142452-3207b4a469d3 github.com/mmcdole/gofeed v1.0.0-beta2.0.20190420154928-0e68beaf6fdf - github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect github.com/olebedev/config v0.0.0-20190528211619-364964f3a8e4 github.com/onsi/ginkgo v1.10.1 // indirect github.com/onsi/gomega v1.7.0 // indirect github.com/opencontainers/go-digest v1.0.0-rc1 // indirect - github.com/pelletier/go-toml v1.4.0 // indirect - github.com/peterh/liner v1.1.0 // indirect github.com/pkg/errors v0.8.1 github.com/pkg/profile v1.3.0 - github.com/prometheus/client_golang v1.1.0 // indirect - github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 // indirect - github.com/prometheus/procfs v0.0.4 // indirect github.com/radovskyb/watcher v1.0.6 github.com/rivo/tview v0.0.0-20190829161255-f8bc69b90341 github.com/rivo/uniseg v0.1.0 // indirect - github.com/rogpeppe/fastuuid v1.2.0 // indirect - github.com/rogpeppe/go-internal v1.3.1 // indirect - github.com/russross/blackfriday v2.0.0+incompatible // indirect github.com/shirou/gopsutil v2.18.12+incompatible - github.com/sirupsen/logrus v1.4.2 // indirect - github.com/spf13/afero v1.2.2 // indirect - github.com/spf13/cobra v0.0.5 // indirect - github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/spf13/viper v1.4.0 // indirect github.com/sticreations/spotigopher v0.0.0-20181009182052-98632f6f94b0 - github.com/stretchr/objx v0.2.0 // indirect github.com/stretchr/testify v1.4.0 - github.com/ugorji/go v1.1.7 // indirect github.com/wtfutil/todoist v0.0.0-20180625015933-97395e581a76 github.com/xanzy/go-gitlab v0.18.0 github.com/yfronto/newrelic v0.0.0-20180622232530-7c9c2852e8f9 github.com/zmb3/spotify v0.0.0-20190520155326-158b1863f5b5 github.com/zorkian/go-datadog-api v2.21.0+incompatible - go.etcd.io/bbolt v1.3.3 // indirect go.opencensus.io v0.22.1 // indirect - go.starlark.net v0.0.0-20190820173200-988906f77f65 // indirect - golang.org/x/arch v0.0.0-20190815191158-8a70ba74b3a1 // indirect golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472 // indirect - golang.org/x/exp v0.0.0-20190829153037-c13cbed26979 // indirect - golang.org/x/image v0.0.0-20190902063713-cb417be4ba39 // indirect - golang.org/x/lint v0.0.0-20190511005446-959b441ac422 // indirect - golang.org/x/mobile v0.0.0-20190830201351-c6da95954960 // indirect golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 // indirect golang.org/x/oauth2 v0.0.0-20190614102709-0f29369cfe45 - golang.org/x/sync v0.0.0-20190427212804-112230192c58 // indirect golang.org/x/sys v0.0.0-20190902133755-9109b7679e13 // indirect golang.org/x/time v0.0.0-20190513212739-9d24e82272b4 // indirect - golang.org/x/tools v0.0.0-20190903025054-afe7f8212f0d // indirect google.golang.org/api v0.9.0 google.golang.org/appengine v1.6.2 // indirect google.golang.org/grpc v1.23.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/jarcoal/httpmock.v1 v1.0.0-20190314184232-a8ac0a50d0b5 // indirect gopkg.in/yaml.v2 v2.2.2 - honnef.co/go/tools v0.0.1-2019.2.3 // indirect k8s.io/apimachinery v0.0.0-20190802060556-6fa4771c83b3 k8s.io/client-go v12.0.0+incompatible ) diff --git a/go.sum b/go.sum index afa12fd4..1c5de571 100644 --- a/go.sum +++ b/go.sum @@ -13,12 +13,11 @@ github.com/Azure/go-autorest v11.1.2+incompatible h1:viZ3tV5l4gE2Sw0xrasFHytCGtz github.com/Azure/go-autorest v11.1.2+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= 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/BurntSushi/xgb v0.0.0-20160522221800-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/DATA-DOG/go-sqlmock v1.3.3 h1:CWUqKXe0s8A2z6qCgkP4Kru7wC11YoAnoupUKFDnH08= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/Microsoft/go-winio v0.4.14 h1:+hMXMk01us9KgxGb7ftKQt2Xpf5hH/yky+TDA+qxleU= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/PagerDuty/go-pagerduty v0.0.0-20190503230806-cf1437c7c8d6 h1:JucouG/P7B+i18/RJbFpbqJyaserYaQzFMlfK/eIEY8= github.com/PagerDuty/go-pagerduty v0.0.0-20190503230806-cf1437c7c8d6/go.mod h1:6hH58nzwYc9mw+TPyM1anW0ivbI0ti4lYc+ZBaKmWts= github.com/PuerkitoBio/goquery v1.5.0 h1:uGvmFXOA73IKluu/F84Xd1tt/z07GYm8X49XKHP7EJk= @@ -29,49 +28,28 @@ github.com/StackExchange/wmi v0.0.0-20190523213609-cbe66965904d h1:VWP4o43LuzNby github.com/StackExchange/wmi v0.0.0-20190523213609-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/adlio/trello v1.0.0 h1:7Mp6DnNXBHBAdhfcutftFDnX7K/G9yEtScAEplJzu+0= github.com/adlio/trello v1.0.0/go.mod h1:l2068AhUuUuQ9Vsb95ECMueHThYyAj4e85lWPmr2/LE= +github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U= github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI= github.com/alecthomas/chroma v0.6.3 h1:8H1D0yddf0mvgvO4JDBKnzLd9ERmzzAijBxnZXGV/FA= github.com/alecthomas/chroma v0.6.3/go.mod h1:quT2EpvJNqkuPi6DmBHB+E33FXBgBBPzyH5++Dn1LPc= +github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721 h1:JHZL0hZKJ1VENNfmXvHbgYlbUOvpzYzvy2aZU5gXVeo= github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0= github.com/alecthomas/kong v0.1.15/go.mod h1:0m2VYms8rH0qbCqVB2gvGHk74bqLIq0HXjCs5bNbNQU= github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= +github.com/alecthomas/repr v0.0.0-20181024024818-d37bc2a10ba1 h1:GDQdwm/gAcJcLAKQQZGOJ4knlw+7rfEQQcmwTbt4p5E= github.com/alecthomas/repr v0.0.0-20181024024818-d37bc2a10ba1/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= -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/andybalholm/cascadia v1.0.0 h1:hOCXnnZ5A+3eVDX8pvgl4kofXv2ELss0bKcqRySc45o= github.com/andybalholm/cascadia v1.0.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= github.com/andygrunwald/go-gerrit v0.0.0-20190625080919-64931d233c2d h1:VqtwQ/1Q39dznaTGQXmPzwdTbqKd2jdlfNgawTVM6YU= github.com/andygrunwald/go-gerrit v0.0.0-20190625080919-64931d233c2d/go.mod h1:0iuRQp6WJ44ts+iihy5E/WlPqfg5RNeQxOmzRkxCdtk= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/briandowns/openweathermap v0.0.0-20180804155945-5f41b7c9d92d h1:28xWzPQ9bdGxKAAwQpZipZZ9Xz8kQcgMPF9cZnvMeuI= github.com/briandowns/openweathermap v0.0.0-20180804155945-5f41b7c9d92d/go.mod h1:8g1Bgq9PbPpXIA3sdlWmWf2JpiWGJee/O4Q+ddYO6+k= github.com/cenkalti/backoff v2.2.0+incompatible h1:8qVbEY6GLhoLlLi1Ac2ZkVhedNwlhQXc39qivKp9+GI= github.com/cenkalti/backoff v2.2.0+incompatible/go.mod h1:b6Nc7NRH5C4aCISLry0tLnTjcuTEvoiqcWDdsU0sOGM= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/codegangsta/cli v1.20.0/go.mod h1:/qJNoX69yVSKu5o4jLyXAENLRyk1uhi7zkbQ3slBdOA= -github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/bbolt v1.3.3/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/etcd v3.3.15+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cosiner/argv v0.0.0-20170225145430-13bacc38a0a5/go.mod h1:p/NrK5tF6ICIly4qwEDsf6VDirFiWWz0FenfYBwJaKQ= -github.com/cosiner/argv v0.0.1/go.mod h1:p/NrK5tF6ICIly4qwEDsf6VDirFiWWz0FenfYBwJaKQ= -github.com/cpuguy83/go-md2man v1.0.8/go.mod h1:N6JayAiVKtlHSnuTCeuLSQVs75hb8q+dYQLjr7cDsKY= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= -github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ= github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk= -github.com/darkSasori/todoist v0.0.0-20180703032645-ec6b38b374ab h1:T9EEtA6FSJMVypkNlKjrRo04u1j5Tk+gghymflyivDw= -github.com/darkSasori/todoist v0.0.0-20180703032645-ec6b38b374ab/go.mod h1:dD/81kphWGY78UVdEu2sqkrUMYfvtdKAMaACFYHGkfU= github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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= @@ -80,7 +58,6 @@ github.com/dgrijalva/jwt-go v0.0.0-20160705203006-01aeca54ebda h1:NyywMz59neOoVR github.com/dgrijalva/jwt-go v0.0.0-20160705203006-01aeca54ebda/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dlclark/regexp2 v1.1.6 h1:CqB4MjHw0MFCDj+PHHjiESmHX+N7t0tJzKvC6M97BRg= github.com/dlclark/regexp2 v1.1.6/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug= @@ -98,6 +75,7 @@ github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkg github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/evanphx/json-patch v0.0.0-20190203023257-5858425f7550/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +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/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko= github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= @@ -105,30 +83,21 @@ github.com/gdamore/tcell v1.1.2/go.mod h1:h3kq4HO9l2On+V9ed8w8ewqQEmGCSSHOgQ+2h8 github.com/gdamore/tcell v1.2.0 h1:ikixzsxc8K8o3V2/CEmyoEW8mJZaNYQQ3NP3VIQdUe4= github.com/gdamore/tcell v1.2.0/go.mod h1:Hjvr+Ofd+gLglo7RYKxxnzCBmev3BzsS67MebKS4zMM= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-delve/delve v1.3.0/go.mod h1:LLw6qJfIsRK9WcwV2IRRqsdlgrqzOeuGrQOCOIhDpt8= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg= github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc= github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/godbus/dbus v5.0.1+incompatible h1:fsDsnr/6MFSIm3kl6JJpq5pH+vO/rA5jUunalLnzSc8= github.com/godbus/dbus v5.0.1+incompatible/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= github.com/gogo/protobuf v0.0.0-20171007142547-342cbe0a0415/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.0 h1:G8O7TerXerS4F6sx9OV7/nRfJdnXgHZu/S/7F2SN+UE= github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +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/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM39fZuwSd1LwSqqSW0hOdXCYYDX0R3I= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -144,6 +113,7 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= 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/v26 v26.0.9 h1:RDv6xjhoFvGuAeYJwsIOC69nCfRna8cdoGw9hvX/Pc0= github.com/google/go-github/v26 v26.0.9/go.mod h1:v6/FmX9au22j4CtYxnMhJJkP+JfOQDXALk7hI+MPDNM= @@ -156,8 +126,6 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190723021845-34ac40c74b70/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -169,71 +137,48 @@ github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d h1:7XGaL1e6bYS1 github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/gophercloud/gophercloud v0.0.0-20190126172459-c818fa66e4c8 h1:L9JPKrtsHMQ4VCRQfHvbbHBfB2Urn8xf6QZeXZ+OrN4= github.com/gophercloud/gophercloud v0.0.0-20190126172459-c818fa66e4c8/go.mod h1:3WdhXV3rUYy9p6AUW8d94kr+HS62Y4VL9mBnFxsD8q4= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gregjones/httpcache v0.0.0-20170728041850-787624de3eb7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.11.1/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hekmon/cunits v2.0.1+incompatible h1:yy/Wq5YvNtrweqfeRjvrvMdBMH6axBrlL8t7arLlm5A= github.com/hekmon/cunits v2.0.1+incompatible/go.mod h1:0QdfIGGkucx1VgStMNiHOYn84t/Ru65b+D3z1QszVPc= github.com/hekmon/transmissionrpc v0.0.0-20190525133028-1d589625bacd h1:bZZYKxyrUV8EsKB5AjsPsJiWE7n0FDURijlSzYZVqAM= github.com/hekmon/transmissionrpc v0.0.0-20190525133028-1d589625bacd/go.mod h1:b1R6hlzo+gEUNWGh53mw9mPWyYyODdZu/qlVqT+W+PU= +github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= 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/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v0.0.0-20180701071628-ab8a2e0c74be/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7 h1:KfgG9LzI+pYjr4xvmz/5H4FXjokeP+rlHLhv3iH62Fo= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= 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/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2/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.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= +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/logrusorgru/aurora v0.0.0-20190428105938-cea283e61946 h1:z+WaKrgu3kCpcdnbK9YG+JThpOCd1nU5jO5ToVmSlR4= github.com/logrusorgru/aurora v0.0.0-20190428105938-cea283e61946/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/lucasb-eyer/go-colorful v1.0.2 h1:mCMFu6PgSozg9tDNMMK3g18oJBX7oYGrC09mS6CXfO4= github.com/lucasb-eyer/go-colorful v1.0.2/go.mod h1:0MS4r+7BZKSJ5mw4/S5MPN+qHFF1fYclkSPilDOKW0s= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mattn/go-colorable v0.0.0-20170327083344-ded68f7a9561/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.9 h1:d5US/mDsogSGW37IV293h//ZFaeajb69h+EHFsv2xGg= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= -github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/microsoft/azure-devops-go-api v0.0.0-20190912142452-3207b4a469d3 h1:FhI3QJOcd1CaXz2+DeFHUNEsS47+gxDERzVhexlTGvg= -github.com/microsoft/azure-devops-go-api v0.0.0-20190912142452-3207b4a469d3/go.mod h1:HfrxIH2ObkhL6NepJKAuEwUYY8kNvspOWDp6HDRIRQs= github.com/microsoft/azure-devops-go-api/azuredevops v0.0.0-20190912142452-3207b4a469d3 h1:Q42uNxLRytr5ynbRkqspq37TjcfnuXwKmrS9APJv/Bw= github.com/microsoft/azure-devops-go-api/azuredevops v0.0.0-20190912142452-3207b4a469d3/go.mod h1:PoGiBqKSQK1vIfQ+yVaFcGjDySHvym6FM1cNYnwzbrY= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mmcdole/gofeed v1.0.0-beta2.0.20190420154928-0e68beaf6fdf h1:poo3e5STwUVGyyUX0e3fHQUwT1tV8IYEFUUpYd/7LuA= github.com/mmcdole/gofeed v1.0.0-beta2.0.20190420154928-0e68beaf6fdf/go.mod h1:tkVcyzS3qVMlQrQxJoEH1hkTiuo9a8emDzkMi7TZBu0= github.com/mmcdole/goxpp v0.0.0-20181012175147-0068e33feabf h1:sWGE2v+hO0Nd4yFU/S/mDBM5plIU8v/Qhfz41hkDIAI= @@ -246,53 +191,29 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olebedev/config v0.0.0-20190528211619-364964f3a8e4 h1:JnVsYEQzhEcOspy6ngIYNF2u0h2mjkXZptzX0IzZQ4g= github.com/olebedev/config v0.0.0-20190528211619-364964f3a8e4/go.mod h1:RL5+WRxWTAXqqCi9i+eZlHrUtO7AQujUqWi+xMohmc4= github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v0.0.0-20190113212917-5533ce8a0da3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= -github.com/peterh/liner v0.0.0-20170317030525-88609521dc4b/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= -github.com/peterh/liner v1.1.0/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/profile v0.0.0-20170413231811-06b906832ed0/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= github.com/pkg/profile v1.3.0 h1:OQIvuDgm00gWVWGTf4m4mCt6W1/0YqU7Ntg0mySWgaI= github.com/pkg/profile v1.3.0/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/prometheus/procfs v0.0.4/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/radovskyb/watcher v1.0.6 h1:8WIQ9UxEYMZjem1OwU7dVH94DXXk9mAIE1i8eqHD+IY= github.com/radovskyb/watcher v1.0.6/go.mod h1:78okwvY5wPdzcb1UYnip1pvrZNIVEIh/Cm+ZuvsUYIg= github.com/rivo/tview v0.0.0-20190829161255-f8bc69b90341 h1:d2Z5U4d3fenPRFFweaMCogbXiRywM5kgYtu20/hol3M= @@ -300,106 +221,52 @@ github.com/rivo/tview v0.0.0-20190829161255-f8bc69b90341/go.mod h1:+rKjP5+h9HMwW github.com/rivo/uniseg v0.0.0-20190513083848-b9f5b9457d44/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.3.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/russross/blackfriday v0.0.0-20180428102519-11635eb403ff/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/russross/blackfriday v2.0.0+incompatible/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/shirou/gopsutil v2.18.12+incompatible h1:1eaJvGomDnH74/5cF4CTmTbLHAriGFsTZppLXDX93OM= github.com/shirou/gopsutil v2.18.12+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= -github.com/sirupsen/logrus v0.0.0-20180523074243-ea8897e79973/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.0-20170417170307-b6cb39589372/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v0.0.0-20170417173400-9e4c21054fa1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.1/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= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/sticreations/spotigopher v0.0.0-20181009182052-98632f6f94b0 h1:WWyBZL7bRdl7Do39EvkJmBFXT11uXLACy0cJHHOZ7IE= github.com/sticreations/spotigopher v0.0.0-20181009182052-98632f6f94b0/go.mod h1:DjuRbAVIoxD4Lv7aE12Km2XYYYKrtXXNbpivYwXv2HE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/wtfutil/todoist v0.0.0-20180625015933-97395e581a76 h1:8pVwscQmyw1Dcca9R8QuHvLFTHr4h6MDlgbLM1A+WLA= github.com/wtfutil/todoist v0.0.0-20180625015933-97395e581a76/go.mod h1:YuuGLJSsTK6DGBD5Zaf3J8LSMfpEC2WtzYPey3XVOdI= -github.com/wtfutil/todoist v0.0.0-20180625015933-ab3a9f0b9d55 h1:vgdZK2w+IZiv18PsEuFeGwaGwVL76Nh4cWOqk10jZ+I= -github.com/wtfutil/todoist v0.0.0-20180625015933-ab3a9f0b9d55/go.mod h1:YuuGLJSsTK6DGBD5Zaf3J8LSMfpEC2WtzYPey3XVOdI= github.com/xanzy/go-gitlab v0.18.0 h1:LybNSWSIw8BK+GnxuETAhUXEzzh5rHsHjopqVkGJXRE= github.com/xanzy/go-gitlab v0.18.0/go.mod h1:LSfUQ9OPDnwRqulJk2HcWaAiFfCzaknyeGvjQI67MbE= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/yfronto/newrelic v0.0.0-20180622232530-7c9c2852e8f9 h1:MYjp+3xEmdmEs41pec7vbPtMg4Fe+za4FFA1lXV6RLo= github.com/yfronto/newrelic v0.0.0-20180622232530-7c9c2852e8f9/go.mod h1:0AAHfU8E7myJ9nLrWxqgrUDCCqNjTQ4/7cRLvYTHBnw= github.com/zmb3/spotify v0.0.0-20190520155326-158b1863f5b5 h1:UagwVflTu8e//SSwujymFEz0G9MUP5/fJJLCzdQy3as= github.com/zmb3/spotify v0.0.0-20190520155326-158b1863f5b5/go.mod h1:pHsWAmY9PfX7i/uwPZkmWrebc8JbK8FppKbvyevwzSU= github.com/zorkian/go-datadog-api v2.21.0+incompatible h1:0VoM99qhHpD3FusaEaeD3C6HikYgesr8cSSknq1vmTY= github.com/zorkian/go-datadog-api v2.21.0+incompatible/go.mod h1:PkXwHX9CUQa/FpB9ZwAD45N1uhCW4MT/Wj7m36PbKss= -go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.1 h1:8dP3SGL7MPB94crU3bEPplMPe83FI4EouesJUeFHv50= go.opencensus.io v0.22.1/go.mod h1:Ap50jQcDJrx6rB6VgeeFPtuPIf3wMRvRfrfYDO6+BmA= -go.starlark.net v0.0.0-20190702223751-32f345186213/go.mod h1:c1/X6cHgvdXj6pUlmWKMkuqRnW4K8x2vwt6JAaaircg= -go.starlark.net v0.0.0-20190820173200-988906f77f65/go.mod h1:c1/X6cHgvdXj6pUlmWKMkuqRnW4K8x2vwt6JAaaircg= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -golang.org/x/arch v0.0.0-20171004143515-077ac972c2e4/go.mod h1:cYlCBUl1MsqxdiKgmc4uh7TxZfWSFLOGSRR090WDxt8= -golang.org/x/arch v0.0.0-20190815191158-8a70ba74b3a1/go.mod h1:flIaEI6LNU6xOCD5PaJvn9wGP0agmIOqjrtsKGRguv4= -golang.org/x/crypto v0.0.0-20180614174826-fd5f17ee7299/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181025213731-e84da0312774/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472 h1:Gv7RPwsi3eZ2Fgewe3CBsuOebPwO27PoXzRpJPsvSSM= golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20190902063713-cb417be4ba39/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190511005446-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mobile v0.0.0-20190830201351-c6da95954960/go.mod h1:mJOp/i0LXPxJZ9weeIadcPqKVfS05Ai7m6/t9z1Hs/Y= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -415,7 +282,6 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -433,28 +299,20 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190427212804-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 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-20181107165924-66b7b1311ac8/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-20181128092732-4ed8d59d0b35/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/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-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190902133755-9109b7679e13 h1:tdsQdquKbTNMsSZLqnLELJGzCANp9oXhu6zFBW6ODx4= golang.org/x/sys v0.0.0-20190902133755-9109b7679e13/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -469,11 +327,9 @@ golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190513212739-9d24e82272b4 h1:RMGusaKverhgGR5KBERIKiTyWoWHRd84GCtsNlvLvIo= golang.org/x/time v0.0.0-20190513212739-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/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-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181120060634-fc4f04983f62/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= @@ -483,11 +339,7 @@ golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190903025054-afe7f8212f0d/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.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= @@ -510,26 +362,21 @@ google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2El google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 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.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0 h1:AzbTB6ux+okLTzP8Ru1Xs41C303zdcfEht7MQnYJt5A= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= gopkg.in/inf.v0 v0.9.0 h1:3zYtXIO92bvsdS3ggAdA8Gb4Azj0YU+TVY1uGYNFA8o= gopkg.in/inf.v0 v0.9.0/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/jarcoal/httpmock.v1 v1.0.0-20180615191036-16f9a43967d6/go.mod h1:d3R+NllX3X5e0zlG1Rful3uLvsGC/Q3OHut5464DEQw= gopkg.in/jarcoal/httpmock.v1 v1.0.0-20190314184232-a8ac0a50d0b5 h1:G5L6mi3mG1Ms5pQfIiUJEMNV64fqgQlpxlPf+4phLmw= gopkg.in/jarcoal/httpmock.v1 v1.0.0-20190314184232-a8ac0a50d0b5/go.mod h1:d3R+NllX3X5e0zlG1Rful3uLvsGC/Q3OHut5464DEQw= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +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.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -537,13 +384,11 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh 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= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= k8s.io/api v0.0.0-20190620084959-7cf5895f2711 h1:BblVYz/wE5WtBsD/Gvu54KyBUTJMflolzc5I2DTvh50= k8s.io/api v0.0.0-20190620084959-7cf5895f2711/go.mod h1:TBhBqb1AWbBQbW3XRusr7n7E4v2+5ZY8r8sAMnyFC5A= k8s.io/apimachinery v0.0.0-20190612205821-1799e75a0719/go.mod h1:I4A+glKBHiTgiEjQiCCQfCAIcIMFGt291SmsvcrFzJA= k8s.io/apimachinery v0.0.0-20190802060556-6fa4771c83b3 h1:ov3gR/oGSdOkfEetREkvyrTMbEUDAADeF9WMoihPv0w= k8s.io/apimachinery v0.0.0-20190802060556-6fa4771c83b3/go.mod h1:+ntn62igV2hyNj7/0brOvXSMONE2KxcePkSxK7/9FFQ= -k8s.io/client-go v11.0.0+incompatible h1:LBbX2+lOwY9flffWlJM7f1Ct8V2SRNiMRDFeiwnJo9o= k8s.io/client-go v12.0.0+incompatible h1:YlJxncpeVUC98/WMZKC3JZGk/OXQWCZjAB4Xr3B17RY= k8s.io/client-go v12.0.0+incompatible/go.mod h1:E95RaSlHr79aHaX0aGSwcPNfygDiPKOVXdmivCIZT0k= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= @@ -555,7 +400,6 @@ k8s.io/kube-openapi v0.0.0-20190709113604-33be087ad058/go.mod h1:nfDlWeOsu3pUf4y k8s.io/utils v0.0.0-20190221042446-c2654d5206da h1:ElyM7RPonbKnQqOcw7dG2IK5uvQQn3b/WPHqD5mBvP4= k8s.io/utils v0.0.0-20190221042446-c2654d5206da/go.mod h1:8k8uAuAQ0rXslZKaEWd0c3oVhZz7sSzSiPnVZayjIX0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/LICENSE b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/LICENSE new file mode 100644 index 00000000..4b1ad51b --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. All rights reserved. + + 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/Microsoft/azure-devops-go-api/azuredevops/build/client.go b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/build/client.go new file mode 100644 index 00000000..0d1a2346 --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/build/client.go @@ -0,0 +1,3234 @@ +// -------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// -------------------------------------------------------------------------------------------- +// Generated file, DO NOT EDIT +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// -------------------------------------------------------------------------------------------- + +package build + +import ( + "bytes" + "context" + "encoding/json" + "github.com/google/uuid" + "github.com/microsoft/azure-devops-go-api/azuredevops" + "github.com/microsoft/azure-devops-go-api/azuredevops/webapi" + "io" + "net/http" + "net/url" + "strconv" + "strings" +) + +var ResourceAreaId, _ = uuid.Parse("965220d5-5bb9-42cf-8d67-9b146df2a5a4") + +type Client struct { + Client azuredevops.Client +} + +func NewClient(ctx context.Context, connection *azuredevops.Connection) (*Client, error) { + client, err := connection.GetClientByResourceAreaId(ctx, ResourceAreaId) + if err != nil { + return nil, err + } + return &Client{ + Client: *client, + }, nil +} + +// Associates an artifact with a build. +func (client *Client) CreateArtifact(ctx context.Context, args CreateArtifactArgs) (*BuildArtifact, error) { + if args.Artifact == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Artifact"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + + body, marshalErr := json.Marshal(*args.Artifact) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("1db06c96-014e-44e1-ac91-90b2d4b3e984") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue BuildArtifact + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateArtifact function +type CreateArtifactArgs struct { + // (required) The artifact. + Artifact *BuildArtifact + // (required) Project ID or project name + Project *string + // (required) The ID of the build. + BuildId *int +} + +// Gets a specific artifact for a build. +func (client *Client) GetArtifact(ctx context.Context, args GetArtifactArgs) (*BuildArtifact, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + + queryParams := url.Values{} + if args.ArtifactName == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "artifactName"} + } + queryParams.Add("artifactName", *args.ArtifactName) + locationId, _ := uuid.Parse("1db06c96-014e-44e1-ac91-90b2d4b3e984") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue BuildArtifact + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetArtifact function +type GetArtifactArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the build. + BuildId *int + // (required) The name of the artifact. + ArtifactName *string +} + +// Gets a specific artifact for a build. +func (client *Client) GetArtifactContentZip(ctx context.Context, args GetArtifactContentZipArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + + queryParams := url.Values{} + if args.ArtifactName == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "artifactName"} + } + queryParams.Add("artifactName", *args.ArtifactName) + locationId, _ := uuid.Parse("1db06c96-014e-44e1-ac91-90b2d4b3e984") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/zip", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetArtifactContentZip function +type GetArtifactContentZipArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the build. + BuildId *int + // (required) The name of the artifact. + ArtifactName *string +} + +// Gets all artifacts for a build. +func (client *Client) GetArtifacts(ctx context.Context, args GetArtifactsArgs) (*[]BuildArtifact, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + + locationId, _ := uuid.Parse("1db06c96-014e-44e1-ac91-90b2d4b3e984") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []BuildArtifact + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetArtifacts function +type GetArtifactsArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the build. + BuildId *int +} + +// Gets a file from the build. +func (client *Client) GetFile(ctx context.Context, args GetFileArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + + queryParams := url.Values{} + if args.ArtifactName == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "artifactName"} + } + queryParams.Add("artifactName", *args.ArtifactName) + if args.FileId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "fileId"} + } + queryParams.Add("fileId", *args.FileId) + if args.FileName == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "fileName"} + } + queryParams.Add("fileName", *args.FileName) + locationId, _ := uuid.Parse("1db06c96-014e-44e1-ac91-90b2d4b3e984") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/octet-stream", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetFile function +type GetFileArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the build. + BuildId *int + // (required) The name of the artifact. + ArtifactName *string + // (required) The primary key for the file. + FileId *string + // (required) The name that the file will be set to. + FileName *string +} + +// [Preview API] Gets the list of attachments of a specific type that are associated with a build. +func (client *Client) GetAttachments(ctx context.Context, args GetAttachmentsArgs) (*[]Attachment, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + if args.Type == nil || *args.Type == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Type"} + } + routeValues["type"] = *args.Type + + locationId, _ := uuid.Parse("f2192269-89fa-4f94-baf6-8fb128c55159") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.2", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []Attachment + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetAttachments function +type GetAttachmentsArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the build. + BuildId *int + // (required) The type of attachment. + Type *string +} + +// [Preview API] Gets a specific attachment. +func (client *Client) GetAttachment(ctx context.Context, args GetAttachmentArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + if args.TimelineId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TimelineId"} + } + routeValues["timelineId"] = (*args.TimelineId).String() + if args.RecordId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RecordId"} + } + routeValues["recordId"] = (*args.RecordId).String() + if args.Type == nil || *args.Type == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Type"} + } + routeValues["type"] = *args.Type + if args.Name == nil || *args.Name == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Name"} + } + routeValues["name"] = *args.Name + + locationId, _ := uuid.Parse("af5122d3-3438-485e-a25a-2dbbfde84ee6") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.2", routeValues, nil, nil, "", "application/octet-stream", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetAttachment function +type GetAttachmentArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the build. + BuildId *int + // (required) The ID of the timeline. + TimelineId *uuid.UUID + // (required) The ID of the timeline record. + RecordId *uuid.UUID + // (required) The type of the attachment. + Type *string + // (required) The name of the attachment. + Name *string +} + +// [Preview API] +func (client *Client) AuthorizeProjectResources(ctx context.Context, args AuthorizeProjectResourcesArgs) (*[]DefinitionResourceReference, error) { + if args.Resources == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Resources"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + body, marshalErr := json.Marshal(*args.Resources) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("398c85bc-81aa-4822-947c-a194a05f0fef") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []DefinitionResourceReference + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the AuthorizeProjectResources function +type AuthorizeProjectResourcesArgs struct { + // (required) + Resources *[]DefinitionResourceReference + // (required) Project ID or project name + Project *string +} + +// [Preview API] +func (client *Client) GetProjectResources(ctx context.Context, args GetProjectResourcesArgs) (*[]DefinitionResourceReference, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + queryParams := url.Values{} + if args.Type != nil { + queryParams.Add("type", *args.Type) + } + if args.Id != nil { + queryParams.Add("id", *args.Id) + } + locationId, _ := uuid.Parse("398c85bc-81aa-4822-947c-a194a05f0fef") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []DefinitionResourceReference + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetProjectResources function +type GetProjectResourcesArgs struct { + // (required) Project ID or project name + Project *string + // (optional) + Type *string + // (optional) + Id *string +} + +// [Preview API] Gets a list of branches for the given source code repository. +func (client *Client) ListBranches(ctx context.Context, args ListBranchesArgs) (*[]string, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.ProviderName == nil || *args.ProviderName == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ProviderName"} + } + routeValues["providerName"] = *args.ProviderName + + queryParams := url.Values{} + if args.ServiceEndpointId != nil { + queryParams.Add("serviceEndpointId", (*args.ServiceEndpointId).String()) + } + if args.Repository != nil { + queryParams.Add("repository", *args.Repository) + } + if args.BranchName != nil { + queryParams.Add("branchName", *args.BranchName) + } + locationId, _ := uuid.Parse("e05d4403-9b81-4244-8763-20fde28d1976") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []string + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the ListBranches function +type ListBranchesArgs struct { + // (required) Project ID or project name + Project *string + // (required) The name of the source provider. + ProviderName *string + // (optional) If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. + ServiceEndpointId *uuid.UUID + // (optional) The vendor-specific identifier or the name of the repository to get branches. Can only be omitted for providers that do not support multiple repositories. + Repository *string + // (optional) If supplied, the name of the branch to check for specifically. + BranchName *string +} + +// [Preview API] Gets a badge that indicates the status of the most recent build for the specified branch. +func (client *Client) GetBuildBadge(ctx context.Context, args GetBuildBadgeArgs) (*BuildBadge, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RepoType == nil || *args.RepoType == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepoType"} + } + routeValues["repoType"] = *args.RepoType + + queryParams := url.Values{} + if args.RepoId != nil { + queryParams.Add("repoId", *args.RepoId) + } + if args.BranchName != nil { + queryParams.Add("branchName", *args.BranchName) + } + locationId, _ := uuid.Parse("21b3b9ce-fad5-4567-9ad0-80679794e003") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.2", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue BuildBadge + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetBuildBadge function +type GetBuildBadgeArgs struct { + // (required) Project ID or project name + Project *string + // (required) The repository type. + RepoType *string + // (optional) The repository ID. + RepoId *string + // (optional) The branch name. + BranchName *string +} + +// [Preview API] Gets a badge that indicates the status of the most recent build for the specified branch. +func (client *Client) GetBuildBadgeData(ctx context.Context, args GetBuildBadgeDataArgs) (*string, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RepoType == nil || *args.RepoType == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepoType"} + } + routeValues["repoType"] = *args.RepoType + + queryParams := url.Values{} + if args.RepoId != nil { + queryParams.Add("repoId", *args.RepoId) + } + if args.BranchName != nil { + queryParams.Add("branchName", *args.BranchName) + } + locationId, _ := uuid.Parse("21b3b9ce-fad5-4567-9ad0-80679794e003") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.2", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue string + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetBuildBadgeData function +type GetBuildBadgeDataArgs struct { + // (required) Project ID or project name + Project *string + // (required) The repository type. + RepoType *string + // (optional) The repository ID. + RepoId *string + // (optional) The branch name. + BranchName *string +} + +// Deletes a build. +func (client *Client) DeleteBuild(ctx context.Context, args DeleteBuildArgs) error { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + + locationId, _ := uuid.Parse("0cd358e1-9217-4d94-8269-1c1ee6f93dcf") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeleteBuild function +type DeleteBuildArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the build. + BuildId *int +} + +// Gets a build +func (client *Client) GetBuild(ctx context.Context, args GetBuildArgs) (*Build, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + + queryParams := url.Values{} + if args.PropertyFilters != nil { + queryParams.Add("propertyFilters", *args.PropertyFilters) + } + locationId, _ := uuid.Parse("0cd358e1-9217-4d94-8269-1c1ee6f93dcf") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue Build + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetBuild function +type GetBuildArgs struct { + // (required) Project ID or project name + Project *string + // (required) + BuildId *int + // (optional) + PropertyFilters *string +} + +// Gets a list of builds. +func (client *Client) GetBuilds(ctx context.Context, args GetBuildsArgs) (*GetBuildsResponseValue, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + queryParams := url.Values{} + if args.Definitions != nil { + var stringList []string + for _, item := range *args.Definitions { + stringList = append(stringList, strconv.Itoa(item)) + } + listAsString := strings.Join((stringList)[:], ",") + queryParams.Add("definitions", listAsString) + } + if args.Queues != nil { + var stringList []string + for _, item := range *args.Queues { + stringList = append(stringList, strconv.Itoa(item)) + } + listAsString := strings.Join((stringList)[:], ",") + queryParams.Add("definitions", listAsString) + } + if args.BuildNumber != nil { + queryParams.Add("buildNumber", *args.BuildNumber) + } + if args.MinTime != nil { + queryParams.Add("minTime", (*args.MinTime).String()) + } + if args.MaxTime != nil { + queryParams.Add("maxTime", (*args.MaxTime).String()) + } + if args.RequestedFor != nil { + queryParams.Add("requestedFor", *args.RequestedFor) + } + if args.ReasonFilter != nil { + queryParams.Add("reasonFilter", string(*args.ReasonFilter)) + } + if args.StatusFilter != nil { + queryParams.Add("statusFilter", string(*args.StatusFilter)) + } + if args.ResultFilter != nil { + queryParams.Add("resultFilter", string(*args.ResultFilter)) + } + if args.TagFilters != nil { + listAsString := strings.Join((*args.TagFilters)[:], ",") + queryParams.Add("tagFilters", listAsString) + } + if args.Properties != nil { + listAsString := strings.Join((*args.Properties)[:], ",") + queryParams.Add("properties", listAsString) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + if args.ContinuationToken != nil { + queryParams.Add("continuationToken", *args.ContinuationToken) + } + if args.MaxBuildsPerDefinition != nil { + queryParams.Add("maxBuildsPerDefinition", strconv.Itoa(*args.MaxBuildsPerDefinition)) + } + if args.DeletedFilter != nil { + queryParams.Add("deletedFilter", string(*args.DeletedFilter)) + } + if args.QueryOrder != nil { + queryParams.Add("queryOrder", string(*args.QueryOrder)) + } + if args.BranchName != nil { + queryParams.Add("branchName", *args.BranchName) + } + if args.BuildIds != nil { + var stringList []string + for _, item := range *args.BuildIds { + stringList = append(stringList, strconv.Itoa(item)) + } + listAsString := strings.Join((stringList)[:], ",") + queryParams.Add("definitions", listAsString) + } + if args.RepositoryId != nil { + queryParams.Add("repositoryId", *args.RepositoryId) + } + if args.RepositoryType != nil { + queryParams.Add("repositoryType", *args.RepositoryType) + } + locationId, _ := uuid.Parse("0cd358e1-9217-4d94-8269-1c1ee6f93dcf") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GetBuildsResponseValue + responseValue.ContinuationToken = resp.Header.Get(azuredevops.HeaderKeyContinuationToken) + err = client.Client.UnmarshalCollectionBody(resp, &responseValue.Value) + return &responseValue, err +} + +// Arguments for the GetBuilds function +type GetBuildsArgs struct { + // (required) Project ID or project name + Project *string + // (optional) A comma-delimited list of definition IDs. If specified, filters to builds for these definitions. + Definitions *[]int + // (optional) A comma-delimited list of queue IDs. If specified, filters to builds that ran against these queues. + Queues *[]int + // (optional) If specified, filters to builds that match this build number. Append * to do a prefix search. + BuildNumber *string + // (optional) If specified, filters to builds that finished/started/queued after this date based on the queryOrder specified. + MinTime *azuredevops.Time + // (optional) If specified, filters to builds that finished/started/queued before this date based on the queryOrder specified. + MaxTime *azuredevops.Time + // (optional) If specified, filters to builds requested for the specified user. + RequestedFor *string + // (optional) If specified, filters to builds that match this reason. + ReasonFilter *BuildReason + // (optional) If specified, filters to builds that match this status. + StatusFilter *BuildStatus + // (optional) If specified, filters to builds that match this result. + ResultFilter *BuildResult + // (optional) A comma-delimited list of tags. If specified, filters to builds that have the specified tags. + TagFilters *[]string + // (optional) A comma-delimited list of properties to retrieve. + Properties *[]string + // (optional) The maximum number of builds to return. + Top *int + // (optional) A continuation token, returned by a previous call to this method, that can be used to return the next set of builds. + ContinuationToken *string + // (optional) The maximum number of builds to return per definition. + MaxBuildsPerDefinition *int + // (optional) Indicates whether to exclude, include, or only return deleted builds. + DeletedFilter *QueryDeletedOption + // (optional) The order in which builds should be returned. + QueryOrder *BuildQueryOrder + // (optional) If specified, filters to builds that built branches that built this branch. + BranchName *string + // (optional) A comma-delimited list that specifies the IDs of builds to retrieve. + BuildIds *[]int + // (optional) If specified, filters to builds that built from this repository. + RepositoryId *string + // (optional) If specified, filters to builds that built from repositories of this type. + RepositoryType *string +} + +// Return type for the GetBuilds function +type GetBuildsResponseValue struct { + Value []Build + // The continuation token to be used to get the next page of results. + ContinuationToken string +} + +// Queues a build +func (client *Client) QueueBuild(ctx context.Context, args QueueBuildArgs) (*Build, error) { + if args.Build == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Build"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + queryParams := url.Values{} + if args.IgnoreWarnings != nil { + queryParams.Add("ignoreWarnings", strconv.FormatBool(*args.IgnoreWarnings)) + } + if args.CheckInTicket != nil { + queryParams.Add("checkInTicket", *args.CheckInTicket) + } + if args.SourceBuildId != nil { + queryParams.Add("sourceBuildId", strconv.Itoa(*args.SourceBuildId)) + } + body, marshalErr := json.Marshal(*args.Build) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("0cd358e1-9217-4d94-8269-1c1ee6f93dcf") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue Build + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the QueueBuild function +type QueueBuildArgs struct { + // (required) + Build *Build + // (required) Project ID or project name + Project *string + // (optional) + IgnoreWarnings *bool + // (optional) + CheckInTicket *string + // (optional) + SourceBuildId *int +} + +// Updates a build. +func (client *Client) UpdateBuild(ctx context.Context, args UpdateBuildArgs) (*Build, error) { + if args.Build == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Build"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + + queryParams := url.Values{} + if args.Retry != nil { + queryParams.Add("retry", strconv.FormatBool(*args.Retry)) + } + body, marshalErr := json.Marshal(*args.Build) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("0cd358e1-9217-4d94-8269-1c1ee6f93dcf") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue Build + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateBuild function +type UpdateBuildArgs struct { + // (required) The build. + Build *Build + // (required) Project ID or project name + Project *string + // (required) The ID of the build. + BuildId *int + // (optional) + Retry *bool +} + +// Updates multiple builds. +func (client *Client) UpdateBuilds(ctx context.Context, args UpdateBuildsArgs) (*[]Build, error) { + if args.Builds == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Builds"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + body, marshalErr := json.Marshal(*args.Builds) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("0cd358e1-9217-4d94-8269-1c1ee6f93dcf") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []Build + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateBuilds function +type UpdateBuildsArgs struct { + // (required) The builds to update. + Builds *[]Build + // (required) Project ID or project name + Project *string +} + +// Gets the changes associated with a build +func (client *Client) GetBuildChanges(ctx context.Context, args GetBuildChangesArgs) (*GetBuildChangesResponseValue, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + + queryParams := url.Values{} + if args.ContinuationToken != nil { + queryParams.Add("continuationToken", *args.ContinuationToken) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + if args.IncludeSourceChange != nil { + queryParams.Add("includeSourceChange", strconv.FormatBool(*args.IncludeSourceChange)) + } + locationId, _ := uuid.Parse("54572c7b-bbd3-45d4-80dc-28be08941620") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GetBuildChangesResponseValue + responseValue.ContinuationToken = resp.Header.Get(azuredevops.HeaderKeyContinuationToken) + err = client.Client.UnmarshalCollectionBody(resp, &responseValue.Value) + return &responseValue, err +} + +// Arguments for the GetBuildChanges function +type GetBuildChangesArgs struct { + // (required) Project ID or project name + Project *string + // (required) + BuildId *int + // (optional) + ContinuationToken *string + // (optional) The maximum number of changes to return + Top *int + // (optional) + IncludeSourceChange *bool +} + +// Return type for the GetBuildChanges function +type GetBuildChangesResponseValue struct { + Value []Change + // The continuation token to be used to get the next page of results. + ContinuationToken string +} + +// [Preview API] Gets the changes made to the repository between two given builds. +func (client *Client) GetChangesBetweenBuilds(ctx context.Context, args GetChangesBetweenBuildsArgs) (*[]Change, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + queryParams := url.Values{} + if args.FromBuildId != nil { + queryParams.Add("fromBuildId", strconv.Itoa(*args.FromBuildId)) + } + if args.ToBuildId != nil { + queryParams.Add("toBuildId", strconv.Itoa(*args.ToBuildId)) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + locationId, _ := uuid.Parse("f10f0ea5-18a1-43ec-a8fb-2042c7be9b43") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.2", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []Change + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetChangesBetweenBuilds function +type GetChangesBetweenBuildsArgs struct { + // (required) Project ID or project name + Project *string + // (optional) The ID of the first build. + FromBuildId *int + // (optional) The ID of the last build. + ToBuildId *int + // (optional) The maximum number of changes to return. + Top *int +} + +// Gets a controller +func (client *Client) GetBuildController(ctx context.Context, args GetBuildControllerArgs) (*BuildController, error) { + routeValues := make(map[string]string) + if args.ControllerId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ControllerId"} + } + routeValues["controllerId"] = strconv.Itoa(*args.ControllerId) + + locationId, _ := uuid.Parse("fcac1932-2ee1-437f-9b6f-7f696be858f6") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue BuildController + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetBuildController function +type GetBuildControllerArgs struct { + // (required) + ControllerId *int +} + +// Gets controller, optionally filtered by name +func (client *Client) GetBuildControllers(ctx context.Context, args GetBuildControllersArgs) (*[]BuildController, error) { + queryParams := url.Values{} + if args.Name != nil { + queryParams.Add("name", *args.Name) + } + locationId, _ := uuid.Parse("fcac1932-2ee1-437f-9b6f-7f696be858f6") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", nil, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []BuildController + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetBuildControllers function +type GetBuildControllersArgs struct { + // (optional) + Name *string +} + +// Creates a new definition. +func (client *Client) CreateDefinition(ctx context.Context, args CreateDefinitionArgs) (*BuildDefinition, error) { + if args.Definition == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Definition"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + queryParams := url.Values{} + if args.DefinitionToCloneId != nil { + queryParams.Add("definitionToCloneId", strconv.Itoa(*args.DefinitionToCloneId)) + } + if args.DefinitionToCloneRevision != nil { + queryParams.Add("definitionToCloneRevision", strconv.Itoa(*args.DefinitionToCloneRevision)) + } + body, marshalErr := json.Marshal(*args.Definition) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("dbeaf647-6167-421a-bda9-c9327b25e2e6") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue BuildDefinition + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateDefinition function +type CreateDefinitionArgs struct { + // (required) The definition. + Definition *BuildDefinition + // (required) Project ID or project name + Project *string + // (optional) + DefinitionToCloneId *int + // (optional) + DefinitionToCloneRevision *int +} + +// Deletes a definition and all associated builds. +func (client *Client) DeleteDefinition(ctx context.Context, args DeleteDefinitionArgs) error { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.DefinitionId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.DefinitionId"} + } + routeValues["definitionId"] = strconv.Itoa(*args.DefinitionId) + + locationId, _ := uuid.Parse("dbeaf647-6167-421a-bda9-c9327b25e2e6") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeleteDefinition function +type DeleteDefinitionArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the definition. + DefinitionId *int +} + +// Gets a definition, optionally at a specific revision. +func (client *Client) GetDefinition(ctx context.Context, args GetDefinitionArgs) (*BuildDefinition, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.DefinitionId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.DefinitionId"} + } + routeValues["definitionId"] = strconv.Itoa(*args.DefinitionId) + + queryParams := url.Values{} + if args.Revision != nil { + queryParams.Add("revision", strconv.Itoa(*args.Revision)) + } + if args.MinMetricsTime != nil { + queryParams.Add("minMetricsTime", (*args.MinMetricsTime).String()) + } + if args.PropertyFilters != nil { + listAsString := strings.Join((*args.PropertyFilters)[:], ",") + queryParams.Add("propertyFilters", listAsString) + } + if args.IncludeLatestBuilds != nil { + queryParams.Add("includeLatestBuilds", strconv.FormatBool(*args.IncludeLatestBuilds)) + } + locationId, _ := uuid.Parse("dbeaf647-6167-421a-bda9-c9327b25e2e6") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue BuildDefinition + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetDefinition function +type GetDefinitionArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the definition. + DefinitionId *int + // (optional) The revision number to retrieve. If this is not specified, the latest version will be returned. + Revision *int + // (optional) If specified, indicates the date from which metrics should be included. + MinMetricsTime *azuredevops.Time + // (optional) A comma-delimited list of properties to include in the results. + PropertyFilters *[]string + // (optional) + IncludeLatestBuilds *bool +} + +// Gets a list of definitions. +func (client *Client) GetDefinitions(ctx context.Context, args GetDefinitionsArgs) (*GetDefinitionsResponseValue, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + queryParams := url.Values{} + if args.Name != nil { + queryParams.Add("name", *args.Name) + } + if args.RepositoryId != nil { + queryParams.Add("repositoryId", *args.RepositoryId) + } + if args.RepositoryType != nil { + queryParams.Add("repositoryType", *args.RepositoryType) + } + if args.QueryOrder != nil { + queryParams.Add("queryOrder", string(*args.QueryOrder)) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + if args.ContinuationToken != nil { + queryParams.Add("continuationToken", *args.ContinuationToken) + } + if args.MinMetricsTime != nil { + queryParams.Add("minMetricsTime", (*args.MinMetricsTime).String()) + } + if args.DefinitionIds != nil { + var stringList []string + for _, item := range *args.DefinitionIds { + stringList = append(stringList, strconv.Itoa(item)) + } + listAsString := strings.Join((stringList)[:], ",") + queryParams.Add("definitions", listAsString) + } + if args.Path != nil { + queryParams.Add("path", *args.Path) + } + if args.BuiltAfter != nil { + queryParams.Add("builtAfter", (*args.BuiltAfter).String()) + } + if args.NotBuiltAfter != nil { + queryParams.Add("notBuiltAfter", (*args.NotBuiltAfter).String()) + } + if args.IncludeAllProperties != nil { + queryParams.Add("includeAllProperties", strconv.FormatBool(*args.IncludeAllProperties)) + } + if args.IncludeLatestBuilds != nil { + queryParams.Add("includeLatestBuilds", strconv.FormatBool(*args.IncludeLatestBuilds)) + } + if args.TaskIdFilter != nil { + queryParams.Add("taskIdFilter", (*args.TaskIdFilter).String()) + } + if args.ProcessType != nil { + queryParams.Add("processType", strconv.Itoa(*args.ProcessType)) + } + if args.YamlFilename != nil { + queryParams.Add("yamlFilename", *args.YamlFilename) + } + locationId, _ := uuid.Parse("dbeaf647-6167-421a-bda9-c9327b25e2e6") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GetDefinitionsResponseValue + responseValue.ContinuationToken = resp.Header.Get(azuredevops.HeaderKeyContinuationToken) + err = client.Client.UnmarshalCollectionBody(resp, &responseValue.Value) + return &responseValue, err +} + +// Arguments for the GetDefinitions function +type GetDefinitionsArgs struct { + // (required) Project ID or project name + Project *string + // (optional) If specified, filters to definitions whose names match this pattern. + Name *string + // (optional) A repository ID. If specified, filters to definitions that use this repository. + RepositoryId *string + // (optional) If specified, filters to definitions that have a repository of this type. + RepositoryType *string + // (optional) Indicates the order in which definitions should be returned. + QueryOrder *DefinitionQueryOrder + // (optional) The maximum number of definitions to return. + Top *int + // (optional) A continuation token, returned by a previous call to this method, that can be used to return the next set of definitions. + ContinuationToken *string + // (optional) If specified, indicates the date from which metrics should be included. + MinMetricsTime *azuredevops.Time + // (optional) A comma-delimited list that specifies the IDs of definitions to retrieve. + DefinitionIds *[]int + // (optional) If specified, filters to definitions under this folder. + Path *string + // (optional) If specified, filters to definitions that have builds after this date. + BuiltAfter *azuredevops.Time + // (optional) If specified, filters to definitions that do not have builds after this date. + NotBuiltAfter *azuredevops.Time + // (optional) Indicates whether the full definitions should be returned. By default, shallow representations of the definitions are returned. + IncludeAllProperties *bool + // (optional) Indicates whether to return the latest and latest completed builds for this definition. + IncludeLatestBuilds *bool + // (optional) If specified, filters to definitions that use the specified task. + TaskIdFilter *uuid.UUID + // (optional) If specified, filters to definitions with the given process type. + ProcessType *int + // (optional) If specified, filters to YAML definitions that match the given filename. + YamlFilename *string +} + +// Return type for the GetDefinitions function +type GetDefinitionsResponseValue struct { + Value []BuildDefinitionReference + // The continuation token to be used to get the next page of results. + ContinuationToken string +} + +// Restores a deleted definition +func (client *Client) RestoreDefinition(ctx context.Context, args RestoreDefinitionArgs) (*BuildDefinition, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.DefinitionId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.DefinitionId"} + } + routeValues["definitionId"] = strconv.Itoa(*args.DefinitionId) + + queryParams := url.Values{} + if args.Deleted == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "deleted"} + } + queryParams.Add("deleted", strconv.FormatBool(*args.Deleted)) + locationId, _ := uuid.Parse("dbeaf647-6167-421a-bda9-c9327b25e2e6") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue BuildDefinition + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the RestoreDefinition function +type RestoreDefinitionArgs struct { + // (required) Project ID or project name + Project *string + // (required) The identifier of the definition to restore. + DefinitionId *int + // (required) When false, restores a deleted definition. + Deleted *bool +} + +// Updates an existing definition. +func (client *Client) UpdateDefinition(ctx context.Context, args UpdateDefinitionArgs) (*BuildDefinition, error) { + if args.Definition == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Definition"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.DefinitionId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.DefinitionId"} + } + routeValues["definitionId"] = strconv.Itoa(*args.DefinitionId) + + queryParams := url.Values{} + if args.SecretsSourceDefinitionId != nil { + queryParams.Add("secretsSourceDefinitionId", strconv.Itoa(*args.SecretsSourceDefinitionId)) + } + if args.SecretsSourceDefinitionRevision != nil { + queryParams.Add("secretsSourceDefinitionRevision", strconv.Itoa(*args.SecretsSourceDefinitionRevision)) + } + body, marshalErr := json.Marshal(*args.Definition) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("dbeaf647-6167-421a-bda9-c9327b25e2e6") + resp, err := client.Client.Send(ctx, http.MethodPut, locationId, "5.1", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue BuildDefinition + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateDefinition function +type UpdateDefinitionArgs struct { + // (required) The new version of the defintion. + Definition *BuildDefinition + // (required) Project ID or project name + Project *string + // (required) The ID of the definition. + DefinitionId *int + // (optional) + SecretsSourceDefinitionId *int + // (optional) + SecretsSourceDefinitionRevision *int +} + +// [Preview API] Gets the contents of a file in the given source code repository. +func (client *Client) GetFileContents(ctx context.Context, args GetFileContentsArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.ProviderName == nil || *args.ProviderName == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ProviderName"} + } + routeValues["providerName"] = *args.ProviderName + + queryParams := url.Values{} + if args.ServiceEndpointId != nil { + queryParams.Add("serviceEndpointId", (*args.ServiceEndpointId).String()) + } + if args.Repository != nil { + queryParams.Add("repository", *args.Repository) + } + if args.CommitOrBranch != nil { + queryParams.Add("commitOrBranch", *args.CommitOrBranch) + } + if args.Path != nil { + queryParams.Add("path", *args.Path) + } + locationId, _ := uuid.Parse("29d12225-b1d9-425f-b668-6c594a981313") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "text/plain", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetFileContents function +type GetFileContentsArgs struct { + // (required) Project ID or project name + Project *string + // (required) The name of the source provider. + ProviderName *string + // (optional) If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. + ServiceEndpointId *uuid.UUID + // (optional) If specified, the vendor-specific identifier or the name of the repository to get branches. Can only be omitted for providers that do not support multiple repositories. + Repository *string + // (optional) The identifier of the commit or branch from which a file's contents are retrieved. + CommitOrBranch *string + // (optional) The path to the file to retrieve, relative to the root of the repository. + Path *string +} + +// [Preview API] Creates a new folder. +func (client *Client) CreateFolder(ctx context.Context, args CreateFolderArgs) (*Folder, error) { + if args.Folder == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Folder"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + queryParams := url.Values{} + if args.Path == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "path"} + } + queryParams.Add("path", *args.Path) + body, marshalErr := json.Marshal(*args.Folder) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("a906531b-d2da-4f55-bda7-f3e676cc50d9") + resp, err := client.Client.Send(ctx, http.MethodPut, locationId, "5.1-preview.2", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue Folder + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateFolder function +type CreateFolderArgs struct { + // (required) The folder. + Folder *Folder + // (required) Project ID or project name + Project *string + // (required) The full path of the folder. + Path *string +} + +// [Preview API] Deletes a definition folder. Definitions and their corresponding builds will also be deleted. +func (client *Client) DeleteFolder(ctx context.Context, args DeleteFolderArgs) error { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + queryParams := url.Values{} + if args.Path == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "path"} + } + queryParams.Add("path", *args.Path) + locationId, _ := uuid.Parse("a906531b-d2da-4f55-bda7-f3e676cc50d9") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1-preview.2", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeleteFolder function +type DeleteFolderArgs struct { + // (required) Project ID or project name + Project *string + // (required) The full path to the folder. + Path *string +} + +// [Preview API] Gets a list of build definition folders. +func (client *Client) GetFolders(ctx context.Context, args GetFoldersArgs) (*[]Folder, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.Path != nil && *args.Path != "" { + routeValues["path"] = *args.Path + } + + queryParams := url.Values{} + if args.QueryOrder != nil { + queryParams.Add("queryOrder", string(*args.QueryOrder)) + } + locationId, _ := uuid.Parse("a906531b-d2da-4f55-bda7-f3e676cc50d9") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.2", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []Folder + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetFolders function +type GetFoldersArgs struct { + // (required) Project ID or project name + Project *string + // (optional) The path to start with. + Path *string + // (optional) The order in which folders should be returned. + QueryOrder *FolderQueryOrder +} + +// [Preview API] Updates an existing folder at given existing path +func (client *Client) UpdateFolder(ctx context.Context, args UpdateFolderArgs) (*Folder, error) { + if args.Folder == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Folder"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + queryParams := url.Values{} + if args.Path == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "path"} + } + queryParams.Add("path", *args.Path) + body, marshalErr := json.Marshal(*args.Folder) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("a906531b-d2da-4f55-bda7-f3e676cc50d9") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.2", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue Folder + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateFolder function +type UpdateFolderArgs struct { + // (required) The new version of the folder. + Folder *Folder + // (required) Project ID or project name + Project *string + // (required) The full path to the folder. + Path *string +} + +// [Preview API] Gets the latest build for a definition, optionally scoped to a specific branch. +func (client *Client) GetLatestBuild(ctx context.Context, args GetLatestBuildArgs) (*Build, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.Definition == nil || *args.Definition == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Definition"} + } + routeValues["definition"] = *args.Definition + + queryParams := url.Values{} + if args.BranchName != nil { + queryParams.Add("branchName", *args.BranchName) + } + locationId, _ := uuid.Parse("54481611-01f4-47f3-998f-160da0f0c229") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue Build + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetLatestBuild function +type GetLatestBuildArgs struct { + // (required) Project ID or project name + Project *string + // (required) definition name with optional leading folder path, or the definition id + Definition *string + // (optional) optional parameter that indicates the specific branch to use + BranchName *string +} + +// Gets an individual log file for a build. +func (client *Client) GetBuildLog(ctx context.Context, args GetBuildLogArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + if args.LogId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.LogId"} + } + routeValues["logId"] = strconv.Itoa(*args.LogId) + + queryParams := url.Values{} + if args.StartLine != nil { + queryParams.Add("startLine", strconv.FormatUint(*args.StartLine, 10)) + } + if args.EndLine != nil { + queryParams.Add("endLine", strconv.FormatUint(*args.EndLine, 10)) + } + locationId, _ := uuid.Parse("35a80daf-7f30-45fc-86e8-6b813d9c90df") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "text/plain", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetBuildLog function +type GetBuildLogArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the build. + BuildId *int + // (required) The ID of the log file. + LogId *int + // (optional) The start line. + StartLine *uint64 + // (optional) The end line. + EndLine *uint64 +} + +// Gets an individual log file for a build. +func (client *Client) GetBuildLogLines(ctx context.Context, args GetBuildLogLinesArgs) (*[]string, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + if args.LogId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.LogId"} + } + routeValues["logId"] = strconv.Itoa(*args.LogId) + + queryParams := url.Values{} + if args.StartLine != nil { + queryParams.Add("startLine", strconv.FormatUint(*args.StartLine, 10)) + } + if args.EndLine != nil { + queryParams.Add("endLine", strconv.FormatUint(*args.EndLine, 10)) + } + locationId, _ := uuid.Parse("35a80daf-7f30-45fc-86e8-6b813d9c90df") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []string + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetBuildLogLines function +type GetBuildLogLinesArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the build. + BuildId *int + // (required) The ID of the log file. + LogId *int + // (optional) The start line. + StartLine *uint64 + // (optional) The end line. + EndLine *uint64 +} + +// Gets the logs for a build. +func (client *Client) GetBuildLogs(ctx context.Context, args GetBuildLogsArgs) (*[]BuildLog, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + + locationId, _ := uuid.Parse("35a80daf-7f30-45fc-86e8-6b813d9c90df") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []BuildLog + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetBuildLogs function +type GetBuildLogsArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the build. + BuildId *int +} + +// Gets the logs for a build. +func (client *Client) GetBuildLogsZip(ctx context.Context, args GetBuildLogsZipArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + + locationId, _ := uuid.Parse("35a80daf-7f30-45fc-86e8-6b813d9c90df") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/zip", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetBuildLogsZip function +type GetBuildLogsZipArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the build. + BuildId *int +} + +// Gets an individual log file for a build. +func (client *Client) GetBuildLogZip(ctx context.Context, args GetBuildLogZipArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + if args.LogId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.LogId"} + } + routeValues["logId"] = strconv.Itoa(*args.LogId) + + queryParams := url.Values{} + if args.StartLine != nil { + queryParams.Add("startLine", strconv.FormatUint(*args.StartLine, 10)) + } + if args.EndLine != nil { + queryParams.Add("endLine", strconv.FormatUint(*args.EndLine, 10)) + } + locationId, _ := uuid.Parse("35a80daf-7f30-45fc-86e8-6b813d9c90df") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/zip", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetBuildLogZip function +type GetBuildLogZipArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the build. + BuildId *int + // (required) The ID of the log file. + LogId *int + // (optional) The start line. + StartLine *uint64 + // (optional) The end line. + EndLine *uint64 +} + +// [Preview API] Gets build metrics for a project. +func (client *Client) GetProjectMetrics(ctx context.Context, args GetProjectMetricsArgs) (*[]BuildMetric, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.MetricAggregationType != nil && *args.MetricAggregationType != "" { + routeValues["metricAggregationType"] = *args.MetricAggregationType + } + + queryParams := url.Values{} + if args.MinMetricsTime != nil { + queryParams.Add("minMetricsTime", (*args.MinMetricsTime).String()) + } + locationId, _ := uuid.Parse("7433fae7-a6bc-41dc-a6e2-eef9005ce41a") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []BuildMetric + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetProjectMetrics function +type GetProjectMetricsArgs struct { + // (required) Project ID or project name + Project *string + // (optional) The aggregation type to use (hourly, daily). + MetricAggregationType *string + // (optional) The date from which to calculate metrics. + MinMetricsTime *azuredevops.Time +} + +// [Preview API] Gets build metrics for a definition. +func (client *Client) GetDefinitionMetrics(ctx context.Context, args GetDefinitionMetricsArgs) (*[]BuildMetric, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.DefinitionId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.DefinitionId"} + } + routeValues["definitionId"] = strconv.Itoa(*args.DefinitionId) + + queryParams := url.Values{} + if args.MinMetricsTime != nil { + queryParams.Add("minMetricsTime", (*args.MinMetricsTime).String()) + } + locationId, _ := uuid.Parse("d973b939-0ce0-4fec-91d8-da3940fa1827") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []BuildMetric + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetDefinitionMetrics function +type GetDefinitionMetricsArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the definition. + DefinitionId *int + // (optional) The date from which to calculate metrics. + MinMetricsTime *azuredevops.Time +} + +// Gets all build definition options supported by the system. +func (client *Client) GetBuildOptionDefinitions(ctx context.Context, args GetBuildOptionDefinitionsArgs) (*[]BuildOptionDefinition, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + + locationId, _ := uuid.Parse("591cb5a4-2d46-4f3a-a697-5cd42b6bd332") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []BuildOptionDefinition + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetBuildOptionDefinitions function +type GetBuildOptionDefinitionsArgs struct { + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Gets the contents of a directory in the given source code repository. +func (client *Client) GetPathContents(ctx context.Context, args GetPathContentsArgs) (*[]SourceRepositoryItem, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.ProviderName == nil || *args.ProviderName == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ProviderName"} + } + routeValues["providerName"] = *args.ProviderName + + queryParams := url.Values{} + if args.ServiceEndpointId != nil { + queryParams.Add("serviceEndpointId", (*args.ServiceEndpointId).String()) + } + if args.Repository != nil { + queryParams.Add("repository", *args.Repository) + } + if args.CommitOrBranch != nil { + queryParams.Add("commitOrBranch", *args.CommitOrBranch) + } + if args.Path != nil { + queryParams.Add("path", *args.Path) + } + locationId, _ := uuid.Parse("7944d6fb-df01-4709-920a-7a189aa34037") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []SourceRepositoryItem + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPathContents function +type GetPathContentsArgs struct { + // (required) Project ID or project name + Project *string + // (required) The name of the source provider. + ProviderName *string + // (optional) If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. + ServiceEndpointId *uuid.UUID + // (optional) If specified, the vendor-specific identifier or the name of the repository to get branches. Can only be omitted for providers that do not support multiple repositories. + Repository *string + // (optional) The identifier of the commit or branch from which a file's contents are retrieved. + CommitOrBranch *string + // (optional) The path contents to list, relative to the root of the repository. + Path *string +} + +// [Preview API] Gets properties for a build. +func (client *Client) GetBuildProperties(ctx context.Context, args GetBuildPropertiesArgs) (interface{}, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + + queryParams := url.Values{} + if args.Filter != nil { + listAsString := strings.Join((*args.Filter)[:], ",") + queryParams.Add("filter", listAsString) + } + locationId, _ := uuid.Parse("0a6312e9-0627-49b7-8083-7d74a64849c9") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue interface{} + err = client.Client.UnmarshalBody(resp, responseValue) + return responseValue, err +} + +// Arguments for the GetBuildProperties function +type GetBuildPropertiesArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the build. + BuildId *int + // (optional) A comma-delimited list of properties. If specified, filters to these specific properties. + Filter *[]string +} + +// [Preview API] Updates properties for a build. +func (client *Client) UpdateBuildProperties(ctx context.Context, args UpdateBuildPropertiesArgs) (interface{}, error) { + if args.Document == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Document"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + + body, marshalErr := json.Marshal(*args.Document) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("0a6312e9-0627-49b7-8083-7d74a64849c9") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json-patch+json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue interface{} + err = client.Client.UnmarshalBody(resp, responseValue) + return responseValue, err +} + +// Arguments for the UpdateBuildProperties function +type UpdateBuildPropertiesArgs struct { + // (required) A json-patch document describing the properties to update. + Document *[]webapi.JsonPatchOperation + // (required) Project ID or project name + Project *string + // (required) The ID of the build. + BuildId *int +} + +// [Preview API] Gets properties for a definition. +func (client *Client) GetDefinitionProperties(ctx context.Context, args GetDefinitionPropertiesArgs) (interface{}, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.DefinitionId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.DefinitionId"} + } + routeValues["definitionId"] = strconv.Itoa(*args.DefinitionId) + + queryParams := url.Values{} + if args.Filter != nil { + listAsString := strings.Join((*args.Filter)[:], ",") + queryParams.Add("filter", listAsString) + } + locationId, _ := uuid.Parse("d9826ad7-2a68-46a9-a6e9-677698777895") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue interface{} + err = client.Client.UnmarshalBody(resp, responseValue) + return responseValue, err +} + +// Arguments for the GetDefinitionProperties function +type GetDefinitionPropertiesArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the definition. + DefinitionId *int + // (optional) A comma-delimited list of properties. If specified, filters to these specific properties. + Filter *[]string +} + +// [Preview API] Updates properties for a definition. +func (client *Client) UpdateDefinitionProperties(ctx context.Context, args UpdateDefinitionPropertiesArgs) (interface{}, error) { + if args.Document == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Document"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.DefinitionId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.DefinitionId"} + } + routeValues["definitionId"] = strconv.Itoa(*args.DefinitionId) + + body, marshalErr := json.Marshal(*args.Document) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("d9826ad7-2a68-46a9-a6e9-677698777895") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json-patch+json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue interface{} + err = client.Client.UnmarshalBody(resp, responseValue) + return responseValue, err +} + +// Arguments for the UpdateDefinitionProperties function +type UpdateDefinitionPropertiesArgs struct { + // (required) A json-patch document describing the properties to update. + Document *[]webapi.JsonPatchOperation + // (required) Project ID or project name + Project *string + // (required) The ID of the definition. + DefinitionId *int +} + +// [Preview API] Gets a pull request object from source provider. +func (client *Client) GetPullRequest(ctx context.Context, args GetPullRequestArgs) (*PullRequest, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.ProviderName == nil || *args.ProviderName == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ProviderName"} + } + routeValues["providerName"] = *args.ProviderName + if args.PullRequestId == nil || *args.PullRequestId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = *args.PullRequestId + + queryParams := url.Values{} + if args.RepositoryId != nil { + queryParams.Add("repositoryId", *args.RepositoryId) + } + if args.ServiceEndpointId != nil { + queryParams.Add("serviceEndpointId", (*args.ServiceEndpointId).String()) + } + locationId, _ := uuid.Parse("d8763ec7-9ff0-4fb4-b2b2-9d757906ff14") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue PullRequest + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPullRequest function +type GetPullRequestArgs struct { + // (required) Project ID or project name + Project *string + // (required) The name of the source provider. + ProviderName *string + // (required) Vendor-specific id of the pull request. + PullRequestId *string + // (optional) Vendor-specific identifier or the name of the repository that contains the pull request. + RepositoryId *string + // (optional) If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. + ServiceEndpointId *uuid.UUID +} + +// [Preview API] Gets a build report. +func (client *Client) GetBuildReport(ctx context.Context, args GetBuildReportArgs) (*BuildReportMetadata, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + + queryParams := url.Values{} + if args.Type != nil { + queryParams.Add("type", *args.Type) + } + locationId, _ := uuid.Parse("45bcaa88-67e1-4042-a035-56d3b4a7d44c") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.2", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue BuildReportMetadata + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetBuildReport function +type GetBuildReportArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the build. + BuildId *int + // (optional) + Type *string +} + +// [Preview API] Gets a build report. +func (client *Client) GetBuildReportHtmlContent(ctx context.Context, args GetBuildReportHtmlContentArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + + queryParams := url.Values{} + if args.Type != nil { + queryParams.Add("type", *args.Type) + } + locationId, _ := uuid.Parse("45bcaa88-67e1-4042-a035-56d3b4a7d44c") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.2", routeValues, queryParams, nil, "", "text/html", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetBuildReportHtmlContent function +type GetBuildReportHtmlContentArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the build. + BuildId *int + // (optional) + Type *string +} + +// [Preview API] Gets a list of source code repositories. +func (client *Client) ListRepositories(ctx context.Context, args ListRepositoriesArgs) (*SourceRepositories, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.ProviderName == nil || *args.ProviderName == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ProviderName"} + } + routeValues["providerName"] = *args.ProviderName + + queryParams := url.Values{} + if args.ServiceEndpointId != nil { + queryParams.Add("serviceEndpointId", (*args.ServiceEndpointId).String()) + } + if args.Repository != nil { + queryParams.Add("repository", *args.Repository) + } + if args.ResultSet != nil { + queryParams.Add("resultSet", string(*args.ResultSet)) + } + if args.PageResults != nil { + queryParams.Add("pageResults", strconv.FormatBool(*args.PageResults)) + } + if args.ContinuationToken != nil { + queryParams.Add("continuationToken", *args.ContinuationToken) + } + locationId, _ := uuid.Parse("d44d1680-f978-4834-9b93-8c6e132329c9") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue SourceRepositories + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the ListRepositories function +type ListRepositoriesArgs struct { + // (required) Project ID or project name + Project *string + // (required) The name of the source provider. + ProviderName *string + // (optional) If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. + ServiceEndpointId *uuid.UUID + // (optional) If specified, the vendor-specific identifier or the name of a single repository to get. + Repository *string + // (optional) 'top' for the repositories most relevant for the endpoint. If not set, all repositories are returned. Ignored if 'repository' is set. + ResultSet *ResultSet + // (optional) If set to true, this will limit the set of results and will return a continuation token to continue the query. + PageResults *bool + // (optional) When paging results, this is a continuation token, returned by a previous call to this method, that can be used to return the next set of repositories. + ContinuationToken *string +} + +// [Preview API] +func (client *Client) AuthorizeDefinitionResources(ctx context.Context, args AuthorizeDefinitionResourcesArgs) (*[]DefinitionResourceReference, error) { + if args.Resources == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Resources"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.DefinitionId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.DefinitionId"} + } + routeValues["definitionId"] = strconv.Itoa(*args.DefinitionId) + + body, marshalErr := json.Marshal(*args.Resources) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("ea623316-1967-45eb-89ab-e9e6110cf2d6") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []DefinitionResourceReference + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the AuthorizeDefinitionResources function +type AuthorizeDefinitionResourcesArgs struct { + // (required) + Resources *[]DefinitionResourceReference + // (required) Project ID or project name + Project *string + // (required) + DefinitionId *int +} + +// [Preview API] +func (client *Client) GetDefinitionResources(ctx context.Context, args GetDefinitionResourcesArgs) (*[]DefinitionResourceReference, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.DefinitionId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.DefinitionId"} + } + routeValues["definitionId"] = strconv.Itoa(*args.DefinitionId) + + locationId, _ := uuid.Parse("ea623316-1967-45eb-89ab-e9e6110cf2d6") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []DefinitionResourceReference + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetDefinitionResources function +type GetDefinitionResourcesArgs struct { + // (required) Project ID or project name + Project *string + // (required) + DefinitionId *int +} + +// [Preview API] Gets information about build resources in the system. +func (client *Client) GetResourceUsage(ctx context.Context, args GetResourceUsageArgs) (*BuildResourceUsage, error) { + locationId, _ := uuid.Parse("3813d06c-9e36-4ea1-aac3-61a485d60e3d") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.2", nil, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue BuildResourceUsage + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetResourceUsage function +type GetResourceUsageArgs struct { +} + +// Gets all revisions of a definition. +func (client *Client) GetDefinitionRevisions(ctx context.Context, args GetDefinitionRevisionsArgs) (*[]BuildDefinitionRevision, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.DefinitionId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.DefinitionId"} + } + routeValues["definitionId"] = strconv.Itoa(*args.DefinitionId) + + locationId, _ := uuid.Parse("7c116775-52e5-453e-8c5d-914d9762d8c4") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []BuildDefinitionRevision + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetDefinitionRevisions function +type GetDefinitionRevisionsArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the definition. + DefinitionId *int +} + +// Gets the build settings. +func (client *Client) GetBuildSettings(ctx context.Context, args GetBuildSettingsArgs) (*BuildSettings, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + + locationId, _ := uuid.Parse("aa8c1c9c-ef8b-474a-b8c4-785c7b191d0d") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue BuildSettings + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetBuildSettings function +type GetBuildSettingsArgs struct { + // (optional) Project ID or project name + Project *string +} + +// Updates the build settings. +func (client *Client) UpdateBuildSettings(ctx context.Context, args UpdateBuildSettingsArgs) (*BuildSettings, error) { + if args.Settings == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Settings"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + + body, marshalErr := json.Marshal(*args.Settings) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("aa8c1c9c-ef8b-474a-b8c4-785c7b191d0d") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue BuildSettings + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateBuildSettings function +type UpdateBuildSettingsArgs struct { + // (required) The new settings. + Settings *BuildSettings + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Get a list of source providers and their capabilities. +func (client *Client) ListSourceProviders(ctx context.Context, args ListSourceProvidersArgs) (*[]SourceProviderAttributes, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + locationId, _ := uuid.Parse("3ce81729-954f-423d-a581-9fea01d25186") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []SourceProviderAttributes + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the ListSourceProviders function +type ListSourceProvidersArgs struct { + // (required) Project ID or project name + Project *string +} + +// [Preview API]

Gets the build status for a definition, optionally scoped to a specific branch, stage, job, and configuration.

If there are more than one, then it is required to pass in a stageName value when specifying a jobName, and the same rule then applies for both if passing a configuration parameter.

+func (client *Client) GetStatusBadge(ctx context.Context, args GetStatusBadgeArgs) (*string, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.Definition == nil || *args.Definition == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Definition"} + } + routeValues["definition"] = *args.Definition + + queryParams := url.Values{} + if args.BranchName != nil { + queryParams.Add("branchName", *args.BranchName) + } + if args.StageName != nil { + queryParams.Add("stageName", *args.StageName) + } + if args.JobName != nil { + queryParams.Add("jobName", *args.JobName) + } + if args.Configuration != nil { + queryParams.Add("configuration", *args.Configuration) + } + if args.Label != nil { + queryParams.Add("label", *args.Label) + } + locationId, _ := uuid.Parse("07acfdce-4757-4439-b422-ddd13a2fcc10") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue string + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetStatusBadge function +type GetStatusBadgeArgs struct { + // (required) Project ID or project name + Project *string + // (required) Either the definition name with optional leading folder path, or the definition id. + Definition *string + // (optional) Only consider the most recent build for this branch. + BranchName *string + // (optional) Use this stage within the pipeline to render the status. + StageName *string + // (optional) Use this job within a stage of the pipeline to render the status. + JobName *string + // (optional) Use this job configuration to render the status + Configuration *string + // (optional) Replaces the default text on the left side of the badge. + Label *string +} + +// Adds a tag to a build. +func (client *Client) AddBuildTag(ctx context.Context, args AddBuildTagArgs) (*[]string, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + if args.Tag == nil || *args.Tag == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Tag"} + } + routeValues["tag"] = *args.Tag + + locationId, _ := uuid.Parse("6e6114b2-8161-44c8-8f6c-c5505782427f") + resp, err := client.Client.Send(ctx, http.MethodPut, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []string + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the AddBuildTag function +type AddBuildTagArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the build. + BuildId *int + // (required) The tag to add. + Tag *string +} + +// Adds tags to a build. +func (client *Client) AddBuildTags(ctx context.Context, args AddBuildTagsArgs) (*[]string, error) { + if args.Tags == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Tags"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + + body, marshalErr := json.Marshal(*args.Tags) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("6e6114b2-8161-44c8-8f6c-c5505782427f") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []string + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the AddBuildTags function +type AddBuildTagsArgs struct { + // (required) The tags to add. + Tags *[]string + // (required) Project ID or project name + Project *string + // (required) The ID of the build. + BuildId *int +} + +// Removes a tag from a build. +func (client *Client) DeleteBuildTag(ctx context.Context, args DeleteBuildTagArgs) (*[]string, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + if args.Tag == nil || *args.Tag == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Tag"} + } + routeValues["tag"] = *args.Tag + + locationId, _ := uuid.Parse("6e6114b2-8161-44c8-8f6c-c5505782427f") + resp, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []string + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the DeleteBuildTag function +type DeleteBuildTagArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the build. + BuildId *int + // (required) The tag to remove. + Tag *string +} + +// Gets the tags for a build. +func (client *Client) GetBuildTags(ctx context.Context, args GetBuildTagsArgs) (*[]string, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + + locationId, _ := uuid.Parse("6e6114b2-8161-44c8-8f6c-c5505782427f") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []string + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetBuildTags function +type GetBuildTagsArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the build. + BuildId *int +} + +// Gets a list of all build and definition tags in the project. +func (client *Client) GetTags(ctx context.Context, args GetTagsArgs) (*[]string, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + locationId, _ := uuid.Parse("d84ac5c6-edc7-43d5-adc9-1b34be5dea09") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []string + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTags function +type GetTagsArgs struct { + // (required) Project ID or project name + Project *string +} + +// [Preview API] Adds a tag to a definition +func (client *Client) AddDefinitionTag(ctx context.Context, args AddDefinitionTagArgs) (*[]string, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.DefinitionId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.DefinitionId"} + } + routeValues["definitionId"] = strconv.Itoa(*args.DefinitionId) + if args.Tag == nil || *args.Tag == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Tag"} + } + routeValues["tag"] = *args.Tag + + locationId, _ := uuid.Parse("cb894432-134a-4d31-a839-83beceaace4b") + resp, err := client.Client.Send(ctx, http.MethodPut, locationId, "5.1-preview.2", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []string + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the AddDefinitionTag function +type AddDefinitionTagArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the definition. + DefinitionId *int + // (required) The tag to add. + Tag *string +} + +// [Preview API] Adds multiple tags to a definition. +func (client *Client) AddDefinitionTags(ctx context.Context, args AddDefinitionTagsArgs) (*[]string, error) { + if args.Tags == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Tags"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.DefinitionId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.DefinitionId"} + } + routeValues["definitionId"] = strconv.Itoa(*args.DefinitionId) + + body, marshalErr := json.Marshal(*args.Tags) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("cb894432-134a-4d31-a839-83beceaace4b") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.2", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []string + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the AddDefinitionTags function +type AddDefinitionTagsArgs struct { + // (required) The tags to add. + Tags *[]string + // (required) Project ID or project name + Project *string + // (required) The ID of the definition. + DefinitionId *int +} + +// [Preview API] Removes a tag from a definition. +func (client *Client) DeleteDefinitionTag(ctx context.Context, args DeleteDefinitionTagArgs) (*[]string, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.DefinitionId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.DefinitionId"} + } + routeValues["definitionId"] = strconv.Itoa(*args.DefinitionId) + if args.Tag == nil || *args.Tag == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Tag"} + } + routeValues["tag"] = *args.Tag + + locationId, _ := uuid.Parse("cb894432-134a-4d31-a839-83beceaace4b") + resp, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1-preview.2", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []string + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the DeleteDefinitionTag function +type DeleteDefinitionTagArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the definition. + DefinitionId *int + // (required) The tag to remove. + Tag *string +} + +// [Preview API] Gets the tags for a definition. +func (client *Client) GetDefinitionTags(ctx context.Context, args GetDefinitionTagsArgs) (*[]string, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.DefinitionId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.DefinitionId"} + } + routeValues["definitionId"] = strconv.Itoa(*args.DefinitionId) + + queryParams := url.Values{} + if args.Revision != nil { + queryParams.Add("revision", strconv.Itoa(*args.Revision)) + } + locationId, _ := uuid.Parse("cb894432-134a-4d31-a839-83beceaace4b") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.2", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []string + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetDefinitionTags function +type GetDefinitionTagsArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the definition. + DefinitionId *int + // (optional) The definition revision number. If not specified, uses the latest revision of the definition. + Revision *int +} + +// Deletes a build definition template. +func (client *Client) DeleteTemplate(ctx context.Context, args DeleteTemplateArgs) error { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.TemplateId == nil || *args.TemplateId == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.TemplateId"} + } + routeValues["templateId"] = *args.TemplateId + + locationId, _ := uuid.Parse("e884571e-7f92-4d6a-9274-3f5649900835") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeleteTemplate function +type DeleteTemplateArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the template. + TemplateId *string +} + +// Gets a specific build definition template. +func (client *Client) GetTemplate(ctx context.Context, args GetTemplateArgs) (*BuildDefinitionTemplate, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.TemplateId == nil || *args.TemplateId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.TemplateId"} + } + routeValues["templateId"] = *args.TemplateId + + locationId, _ := uuid.Parse("e884571e-7f92-4d6a-9274-3f5649900835") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue BuildDefinitionTemplate + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTemplate function +type GetTemplateArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the requested template. + TemplateId *string +} + +// Gets all definition templates. +func (client *Client) GetTemplates(ctx context.Context, args GetTemplatesArgs) (*[]BuildDefinitionTemplate, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + locationId, _ := uuid.Parse("e884571e-7f92-4d6a-9274-3f5649900835") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []BuildDefinitionTemplate + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTemplates function +type GetTemplatesArgs struct { + // (required) Project ID or project name + Project *string +} + +// Updates an existing build definition template. +func (client *Client) SaveTemplate(ctx context.Context, args SaveTemplateArgs) (*BuildDefinitionTemplate, error) { + if args.Template == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Template"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.TemplateId == nil || *args.TemplateId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.TemplateId"} + } + routeValues["templateId"] = *args.TemplateId + + body, marshalErr := json.Marshal(*args.Template) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("e884571e-7f92-4d6a-9274-3f5649900835") + resp, err := client.Client.Send(ctx, http.MethodPut, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue BuildDefinitionTemplate + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the SaveTemplate function +type SaveTemplateArgs struct { + // (required) The new version of the template. + Template *BuildDefinitionTemplate + // (required) Project ID or project name + Project *string + // (required) The ID of the template. + TemplateId *string +} + +// Gets details for a build +func (client *Client) GetBuildTimeline(ctx context.Context, args GetBuildTimelineArgs) (*Timeline, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + if args.TimelineId != nil { + routeValues["timelineId"] = (*args.TimelineId).String() + } + + queryParams := url.Values{} + if args.ChangeId != nil { + queryParams.Add("changeId", strconv.Itoa(*args.ChangeId)) + } + if args.PlanId != nil { + queryParams.Add("planId", (*args.PlanId).String()) + } + locationId, _ := uuid.Parse("8baac422-4c6e-4de5-8532-db96d92acffa") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue Timeline + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetBuildTimeline function +type GetBuildTimelineArgs struct { + // (required) Project ID or project name + Project *string + // (required) + BuildId *int + // (optional) + TimelineId *uuid.UUID + // (optional) + ChangeId *int + // (optional) + PlanId *uuid.UUID +} + +// [Preview API] Recreates the webhooks for the specified triggers in the given source code repository. +func (client *Client) RestoreWebhooks(ctx context.Context, args RestoreWebhooksArgs) error { + if args.TriggerTypes == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.TriggerTypes"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.ProviderName == nil || *args.ProviderName == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ProviderName"} + } + routeValues["providerName"] = *args.ProviderName + + queryParams := url.Values{} + if args.ServiceEndpointId != nil { + queryParams.Add("serviceEndpointId", (*args.ServiceEndpointId).String()) + } + if args.Repository != nil { + queryParams.Add("repository", *args.Repository) + } + body, marshalErr := json.Marshal(*args.TriggerTypes) + if marshalErr != nil { + return marshalErr + } + locationId, _ := uuid.Parse("793bceb8-9736-4030-bd2f-fb3ce6d6b478") + _, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the RestoreWebhooks function +type RestoreWebhooksArgs struct { + // (required) The types of triggers to restore webhooks for. + TriggerTypes *[]DefinitionTriggerType + // (required) Project ID or project name + Project *string + // (required) The name of the source provider. + ProviderName *string + // (optional) If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. + ServiceEndpointId *uuid.UUID + // (optional) If specified, the vendor-specific identifier or the name of the repository to get webhooks. Can only be omitted for providers that do not support multiple repositories. + Repository *string +} + +// [Preview API] Gets a list of webhooks installed in the given source code repository. +func (client *Client) ListWebhooks(ctx context.Context, args ListWebhooksArgs) (*[]RepositoryWebhook, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.ProviderName == nil || *args.ProviderName == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ProviderName"} + } + routeValues["providerName"] = *args.ProviderName + + queryParams := url.Values{} + if args.ServiceEndpointId != nil { + queryParams.Add("serviceEndpointId", (*args.ServiceEndpointId).String()) + } + if args.Repository != nil { + queryParams.Add("repository", *args.Repository) + } + locationId, _ := uuid.Parse("8f20ff82-9498-4812-9f6e-9c01bdc50e99") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []RepositoryWebhook + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the ListWebhooks function +type ListWebhooksArgs struct { + // (required) Project ID or project name + Project *string + // (required) The name of the source provider. + ProviderName *string + // (optional) If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. + ServiceEndpointId *uuid.UUID + // (optional) If specified, the vendor-specific identifier or the name of the repository to get webhooks. Can only be omitted for providers that do not support multiple repositories. + Repository *string +} + +// Gets the work items associated with a build. +func (client *Client) GetBuildWorkItemsRefs(ctx context.Context, args GetBuildWorkItemsRefsArgs) (*[]webapi.ResourceRef, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + + queryParams := url.Values{} + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + locationId, _ := uuid.Parse("5a21f5d2-5642-47e4-a0bd-1356e6731bee") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []webapi.ResourceRef + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetBuildWorkItemsRefs function +type GetBuildWorkItemsRefsArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the build. + BuildId *int + // (optional) The maximum number of work items to return. + Top *int +} + +// Gets the work items associated with a build, filtered to specific commits. +func (client *Client) GetBuildWorkItemsRefsFromCommits(ctx context.Context, args GetBuildWorkItemsRefsFromCommitsArgs) (*[]webapi.ResourceRef, error) { + if args.CommitIds == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.CommitIds"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BuildId"} + } + routeValues["buildId"] = strconv.Itoa(*args.BuildId) + + queryParams := url.Values{} + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + body, marshalErr := json.Marshal(*args.CommitIds) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("5a21f5d2-5642-47e4-a0bd-1356e6731bee") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []webapi.ResourceRef + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetBuildWorkItemsRefsFromCommits function +type GetBuildWorkItemsRefsFromCommitsArgs struct { + // (required) A comma-delimited list of commit IDs. + CommitIds *[]string + // (required) Project ID or project name + Project *string + // (required) The ID of the build. + BuildId *int + // (optional) The maximum number of work items to return, or the number of commits to consider if no commit IDs are specified. + Top *int +} + +// [Preview API] Gets all the work items between two builds. +func (client *Client) GetWorkItemsBetweenBuilds(ctx context.Context, args GetWorkItemsBetweenBuildsArgs) (*[]webapi.ResourceRef, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + queryParams := url.Values{} + if args.FromBuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "fromBuildId"} + } + queryParams.Add("fromBuildId", strconv.Itoa(*args.FromBuildId)) + if args.ToBuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "toBuildId"} + } + queryParams.Add("toBuildId", strconv.Itoa(*args.ToBuildId)) + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + locationId, _ := uuid.Parse("52ba8915-5518-42e3-a4bb-b0182d159e2d") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.2", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []webapi.ResourceRef + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetWorkItemsBetweenBuilds function +type GetWorkItemsBetweenBuildsArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the first build. + FromBuildId *int + // (required) The ID of the last build. + ToBuildId *int + // (optional) The maximum number of work items to return. + Top *int +} diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/build/models.go b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/build/models.go new file mode 100644 index 00000000..41e3eb33 --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/build/models.go @@ -0,0 +1,2301 @@ +// -------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// -------------------------------------------------------------------------------------------- +// Generated file, DO NOT EDIT +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// -------------------------------------------------------------------------------------------- + +package build + +import ( + "github.com/google/uuid" + "github.com/microsoft/azure-devops-go-api/azuredevops" + "github.com/microsoft/azure-devops-go-api/azuredevops/core" + "github.com/microsoft/azure-devops-go-api/azuredevops/distributedtaskcommon" + "github.com/microsoft/azure-devops-go-api/azuredevops/git" + "github.com/microsoft/azure-devops-go-api/azuredevops/test" + "github.com/microsoft/azure-devops-go-api/azuredevops/webapi" +) + +// Represents a queue for running builds. +type AgentPoolQueue struct { + Links interface{} `json:"_links,omitempty"` + // The ID of the queue. + Id *int `json:"id,omitempty"` + // The name of the queue. + Name *string `json:"name,omitempty"` + // The pool used by this queue. + Pool *TaskAgentPoolReference `json:"pool,omitempty"` + // The full http link to the resource. + Url *string `json:"url,omitempty"` +} + +// Represents a reference to an agent queue. +type AgentPoolQueueReference struct { + // An alias to be used when referencing the resource. + Alias *string `json:"alias,omitempty"` + // The ID of the queue. + Id *int `json:"id,omitempty"` +} + +// Describes how a phase should run against an agent queue. +type AgentPoolQueueTarget struct { + // The type of the target. + Type *int `json:"type,omitempty"` + // Agent specification of the target. + AgentSpecification *AgentSpecification `json:"agentSpecification,omitempty"` + // Enables scripts and other processes launched while executing phase to access the OAuth token + AllowScriptsAuthAccessOption *bool `json:"allowScriptsAuthAccessOption,omitempty"` + Demands *[]interface{} `json:"demands,omitempty"` + // The execution options. + ExecutionOptions *AgentTargetExecutionOptions `json:"executionOptions,omitempty"` + // The queue. + Queue *AgentPoolQueue `json:"queue,omitempty"` +} + +// Specification of the agent defined by the pool provider. +type AgentSpecification struct { + // Agent specification unique identifier. + Identifier *string `json:"identifier,omitempty"` +} + +type AgentStatus string + +type agentStatusValuesType struct { + Unavailable AgentStatus + Available AgentStatus + Offline AgentStatus +} + +var AgentStatusValues = agentStatusValuesType{ + // Indicates that the build agent cannot be contacted. + Unavailable: "unavailable", + // Indicates that the build agent is currently available. + Available: "available", + // Indicates that the build agent has taken itself offline. + Offline: "offline", +} + +// Additional options for running phases against an agent queue. +type AgentTargetExecutionOptions struct { + // Indicates the type of execution options. + Type *int `json:"type,omitempty"` +} + +type ArtifactResource struct { + Links interface{} `json:"_links,omitempty"` + // Type-specific data about the artifact. + Data *string `json:"data,omitempty"` + // A link to download the resource. + DownloadUrl *string `json:"downloadUrl,omitempty"` + // Type-specific properties of the artifact. + Properties *map[string]string `json:"properties,omitempty"` + // The type of the resource: File container, version control folder, UNC path, etc. + Type *string `json:"type,omitempty"` + // The full http link to the resource. + Url *string `json:"url,omitempty"` +} + +// Represents an attachment to a build. +type Attachment struct { + Links interface{} `json:"_links,omitempty"` + // The name of the attachment. + Name *string `json:"name,omitempty"` +} + +type AuditAction string + +type auditActionValuesType struct { + Add AuditAction + Update AuditAction + Delete AuditAction +} + +var AuditActionValues = auditActionValuesType{ + Add: "add", + Update: "update", + Delete: "delete", +} + +// Data representation of a build. +type Build struct { + Links interface{} `json:"_links,omitempty"` + // The agent specification for the build. + AgentSpecification *AgentSpecification `json:"agentSpecification,omitempty"` + // The build number/name of the build. + BuildNumber *string `json:"buildNumber,omitempty"` + // The build number revision. + BuildNumberRevision *int `json:"buildNumberRevision,omitempty"` + // The build controller. This is only set if the definition type is Xaml. + Controller *BuildController `json:"controller,omitempty"` + // The definition associated with the build. + Definition *DefinitionReference `json:"definition,omitempty"` + // Indicates whether the build has been deleted. + Deleted *bool `json:"deleted,omitempty"` + // The identity of the process or person that deleted the build. + DeletedBy *webapi.IdentityRef `json:"deletedBy,omitempty"` + // The date the build was deleted. + DeletedDate *azuredevops.Time `json:"deletedDate,omitempty"` + // The description of how the build was deleted. + DeletedReason *string `json:"deletedReason,omitempty"` + // A list of demands that represents the agent capabilities required by this build. + Demands *[]interface{} `json:"demands,omitempty"` + // The time that the build was completed. + FinishTime *azuredevops.Time `json:"finishTime,omitempty"` + // The ID of the build. + Id *int `json:"id,omitempty"` + // Indicates whether the build should be skipped by retention policies. + KeepForever *bool `json:"keepForever,omitempty"` + // The identity representing the process or person that last changed the build. + LastChangedBy *webapi.IdentityRef `json:"lastChangedBy,omitempty"` + // The date the build was last changed. + LastChangedDate *azuredevops.Time `json:"lastChangedDate,omitempty"` + // Information about the build logs. + Logs *BuildLogReference `json:"logs,omitempty"` + // The orchestration plan for the build. + OrchestrationPlan *TaskOrchestrationPlanReference `json:"orchestrationPlan,omitempty"` + // The parameters for the build. + Parameters *string `json:"parameters,omitempty"` + // Orchestration plans associated with the build (build, cleanup) + Plans *[]TaskOrchestrationPlanReference `json:"plans,omitempty"` + // The build's priority. + Priority *QueuePriority `json:"priority,omitempty"` + // The team project. + Project *core.TeamProjectReference `json:"project,omitempty"` + Properties interface{} `json:"properties,omitempty"` + // The quality of the xaml build (good, bad, etc.) + Quality *string `json:"quality,omitempty"` + // The queue. This is only set if the definition type is Build. + Queue *AgentPoolQueue `json:"queue,omitempty"` + // Additional options for queueing the build. + QueueOptions *QueueOptions `json:"queueOptions,omitempty"` + // The current position of the build in the queue. + QueuePosition *int `json:"queuePosition,omitempty"` + // The time that the build was queued. + QueueTime *azuredevops.Time `json:"queueTime,omitempty"` + // The reason that the build was created. + Reason *BuildReason `json:"reason,omitempty"` + // The repository. + Repository *BuildRepository `json:"repository,omitempty"` + // The identity that queued the build. + RequestedBy *webapi.IdentityRef `json:"requestedBy,omitempty"` + // The identity on whose behalf the build was queued. + RequestedFor *webapi.IdentityRef `json:"requestedFor,omitempty"` + // The build result. + Result *BuildResult `json:"result,omitempty"` + // Indicates whether the build is retained by a release. + RetainedByRelease *bool `json:"retainedByRelease,omitempty"` + // The source branch. + SourceBranch *string `json:"sourceBranch,omitempty"` + // The source version. + SourceVersion *string `json:"sourceVersion,omitempty"` + // The time that the build was started. + StartTime *azuredevops.Time `json:"startTime,omitempty"` + // The status of the build. + Status *BuildStatus `json:"status,omitempty"` + Tags *[]string `json:"tags,omitempty"` + // The build that triggered this build via a Build completion trigger. + TriggeredByBuild *Build `json:"triggeredByBuild,omitempty"` + // Sourceprovider-specific information about what triggered the build + TriggerInfo *map[string]string `json:"triggerInfo,omitempty"` + // The URI of the build. + Uri *string `json:"uri,omitempty"` + // The REST URL of the build. + Url *string `json:"url,omitempty"` + ValidationResults *[]BuildRequestValidationResult `json:"validationResults,omitempty"` +} + +type BuildAgent struct { + BuildDirectory *string `json:"buildDirectory,omitempty"` + Controller *XamlBuildControllerReference `json:"controller,omitempty"` + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + Description *string `json:"description,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Id *int `json:"id,omitempty"` + MessageQueueUrl *string `json:"messageQueueUrl,omitempty"` + Name *string `json:"name,omitempty"` + ReservedForBuild *string `json:"reservedForBuild,omitempty"` + Server *XamlBuildServerReference `json:"server,omitempty"` + Status *AgentStatus `json:"status,omitempty"` + StatusMessage *string `json:"statusMessage,omitempty"` + UpdatedDate *azuredevops.Time `json:"updatedDate,omitempty"` + Uri *string `json:"uri,omitempty"` + Url *string `json:"url,omitempty"` +} + +type BuildAgentReference struct { + // Id of the resource + Id *int `json:"id,omitempty"` + // Name of the linked resource (definition name, controller name, etc.) + Name *string `json:"name,omitempty"` + // Full http link to the resource + Url *string `json:"url,omitempty"` +} + +// Represents an artifact produced by a build. +type BuildArtifact struct { + // The artifact ID. + Id *int `json:"id,omitempty"` + // The name of the artifact. + Name *string `json:"name,omitempty"` + // The actual resource. + Resource *ArtifactResource `json:"resource,omitempty"` + // The artifact source, which will be the ID of the job that produced this artifact. + Source *string `json:"source,omitempty"` +} + +// Represents the desired scope of authorization for a build. +type BuildAuthorizationScope string + +type buildAuthorizationScopeValuesType struct { + ProjectCollection BuildAuthorizationScope + Project BuildAuthorizationScope +} + +var BuildAuthorizationScopeValues = buildAuthorizationScopeValuesType{ + // The identity used should have build service account permissions scoped to the project collection. This is useful when resources for a single build are spread across multiple projects. + ProjectCollection: "projectCollection", + // The identity used should have build service account permissions scoped to the project in which the build definition resides. This is useful for isolation of build jobs to a particular team project to avoid any unintentional escalation of privilege attacks during a build. + Project: "project", +} + +// Represents a build badge. +type BuildBadge struct { + // The ID of the build represented by this badge. + BuildId *int `json:"buildId,omitempty"` + // A link to the SVG resource. + ImageUrl *string `json:"imageUrl,omitempty"` +} + +type BuildCompletedEvent struct { + BuildId *int `json:"buildId,omitempty"` + Build *Build `json:"build,omitempty"` + // Changes associated with a build used for build notifications + Changes *[]Change `json:"changes,omitempty"` + // Pull request for the build used for build notifications + PullRequest *PullRequest `json:"pullRequest,omitempty"` + // Test results associated with a build used for build notifications + TestResults *test.AggregatedResultsAnalysis `json:"testResults,omitempty"` + // Timeline records associated with a build used for build notifications + TimelineRecords *[]TimelineRecord `json:"timelineRecords,omitempty"` + // Work items associated with a build used for build notifications + WorkItems *[]git.AssociatedWorkItem `json:"workItems,omitempty"` +} + +// Represents a build completion trigger. +type BuildCompletionTrigger struct { + BranchFilters *[]string `json:"branchFilters,omitempty"` + // A reference to the definition that should trigger builds for this definition. + Definition *DefinitionReference `json:"definition,omitempty"` + RequiresSuccessfulBuild *bool `json:"requiresSuccessfulBuild,omitempty"` +} + +type BuildController struct { + // Id of the resource + Id *int `json:"id,omitempty"` + // Name of the linked resource (definition name, controller name, etc.) + Name *string `json:"name,omitempty"` + // Full http link to the resource + Url *string `json:"url,omitempty"` + Links interface{} `json:"_links,omitempty"` + // The date the controller was created. + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + // The description of the controller. + Description *string `json:"description,omitempty"` + // Indicates whether the controller is enabled. + Enabled *bool `json:"enabled,omitempty"` + // The status of the controller. + Status *ControllerStatus `json:"status,omitempty"` + // The date the controller was last updated. + UpdatedDate *azuredevops.Time `json:"updatedDate,omitempty"` + // The controller's URI. + Uri *string `json:"uri,omitempty"` +} + +// Represents a build definition. +type BuildDefinition struct { + // The date this version of the definition was created. + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + // The ID of the referenced definition. + Id *int `json:"id,omitempty"` + // The name of the referenced definition. + Name *string `json:"name,omitempty"` + // The folder path of the definition. + Path *string `json:"path,omitempty"` + // A reference to the project. + Project *core.TeamProjectReference `json:"project,omitempty"` + // A value that indicates whether builds can be queued against this definition. + QueueStatus *DefinitionQueueStatus `json:"queueStatus,omitempty"` + // The definition revision number. + Revision *int `json:"revision,omitempty"` + // The type of the definition. + Type *DefinitionType `json:"type,omitempty"` + // The definition's URI. + Uri *string `json:"uri,omitempty"` + // The REST URL of the definition. + Url *string `json:"url,omitempty"` + Links interface{} `json:"_links,omitempty"` + // The author of the definition. + AuthoredBy *webapi.IdentityRef `json:"authoredBy,omitempty"` + // A reference to the definition that this definition is a draft of, if this is a draft definition. + DraftOf *DefinitionReference `json:"draftOf,omitempty"` + // The list of drafts associated with this definition, if this is not a draft definition. + Drafts *[]DefinitionReference `json:"drafts,omitempty"` + LatestBuild *Build `json:"latestBuild,omitempty"` + LatestCompletedBuild *Build `json:"latestCompletedBuild,omitempty"` + Metrics *[]BuildMetric `json:"metrics,omitempty"` + // The quality of the definition document (draft, etc.) + Quality *DefinitionQuality `json:"quality,omitempty"` + // The default queue for builds run against this definition. + Queue *AgentPoolQueue `json:"queue,omitempty"` + // Indicates whether badges are enabled for this definition. + BadgeEnabled *bool `json:"badgeEnabled,omitempty"` + // The build number format. + BuildNumberFormat *string `json:"buildNumberFormat,omitempty"` + // A save-time comment for the definition. + Comment *string `json:"comment,omitempty"` + Demands *[]interface{} `json:"demands,omitempty"` + // The description. + Description *string `json:"description,omitempty"` + // The drop location for the definition. + DropLocation *string `json:"dropLocation,omitempty"` + // The job authorization scope for builds queued against this definition. + JobAuthorizationScope *BuildAuthorizationScope `json:"jobAuthorizationScope,omitempty"` + // The job cancel timeout (in minutes) for builds cancelled by user for this definition. + JobCancelTimeoutInMinutes *int `json:"jobCancelTimeoutInMinutes,omitempty"` + // The job execution timeout (in minutes) for builds queued against this definition. + JobTimeoutInMinutes *int `json:"jobTimeoutInMinutes,omitempty"` + Options *[]BuildOption `json:"options,omitempty"` + // The build process. + Process interface{} `json:"process,omitempty"` + // The process parameters for this definition. + ProcessParameters *distributedtaskcommon.ProcessParameters `json:"processParameters,omitempty"` + Properties interface{} `json:"properties,omitempty"` + // The repository. + Repository *BuildRepository `json:"repository,omitempty"` + RetentionRules *[]RetentionPolicy `json:"retentionRules,omitempty"` + Tags *[]string `json:"tags,omitempty"` + Triggers *[]interface{} `json:"triggers,omitempty"` + VariableGroups *[]VariableGroup `json:"variableGroups,omitempty"` + Variables *map[string]BuildDefinitionVariable `json:"variables,omitempty"` +} + +// For back-compat with extensions that use the old Steps format instead of Process and Phases +type BuildDefinition3_2 struct { + // The date this version of the definition was created. + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + // The ID of the referenced definition. + Id *int `json:"id,omitempty"` + // The name of the referenced definition. + Name *string `json:"name,omitempty"` + // The folder path of the definition. + Path *string `json:"path,omitempty"` + // A reference to the project. + Project *core.TeamProjectReference `json:"project,omitempty"` + // A value that indicates whether builds can be queued against this definition. + QueueStatus *DefinitionQueueStatus `json:"queueStatus,omitempty"` + // The definition revision number. + Revision *int `json:"revision,omitempty"` + // The type of the definition. + Type *DefinitionType `json:"type,omitempty"` + // The definition's URI. + Uri *string `json:"uri,omitempty"` + // The REST URL of the definition. + Url *string `json:"url,omitempty"` + Links interface{} `json:"_links,omitempty"` + // The author of the definition. + AuthoredBy *webapi.IdentityRef `json:"authoredBy,omitempty"` + // A reference to the definition that this definition is a draft of, if this is a draft definition. + DraftOf *DefinitionReference `json:"draftOf,omitempty"` + // The list of drafts associated with this definition, if this is not a draft definition. + Drafts *[]DefinitionReference `json:"drafts,omitempty"` + Metrics *[]BuildMetric `json:"metrics,omitempty"` + // The quality of the definition document (draft, etc.) + Quality *DefinitionQuality `json:"quality,omitempty"` + // The default queue for builds run against this definition. + Queue *AgentPoolQueue `json:"queue,omitempty"` + // Indicates whether badges are enabled for this definition + BadgeEnabled *bool `json:"badgeEnabled,omitempty"` + Build *[]BuildDefinitionStep `json:"build,omitempty"` + // The build number format + BuildNumberFormat *string `json:"buildNumberFormat,omitempty"` + // The comment entered when saving the definition + Comment *string `json:"comment,omitempty"` + Demands *[]interface{} `json:"demands,omitempty"` + // The description + Description *string `json:"description,omitempty"` + // The drop location for the definition + DropLocation *string `json:"dropLocation,omitempty"` + // The job authorization scope for builds which are queued against this definition + JobAuthorizationScope *BuildAuthorizationScope `json:"jobAuthorizationScope,omitempty"` + // The job cancel timeout in minutes for builds which are cancelled by user for this definition + JobCancelTimeoutInMinutes *int `json:"jobCancelTimeoutInMinutes,omitempty"` + // The job execution timeout in minutes for builds which are queued against this definition + JobTimeoutInMinutes *int `json:"jobTimeoutInMinutes,omitempty"` + LatestBuild *Build `json:"latestBuild,omitempty"` + LatestCompletedBuild *Build `json:"latestCompletedBuild,omitempty"` + Options *[]BuildOption `json:"options,omitempty"` + // Process Parameters + ProcessParameters *distributedtaskcommon.ProcessParameters `json:"processParameters,omitempty"` + Properties interface{} `json:"properties,omitempty"` + // The repository + Repository *BuildRepository `json:"repository,omitempty"` + RetentionRules *[]RetentionPolicy `json:"retentionRules,omitempty"` + Tags *[]string `json:"tags,omitempty"` + Triggers *[]interface{} `json:"triggers,omitempty"` + Variables *map[string]BuildDefinitionVariable `json:"variables,omitempty"` +} + +// Represents a reference to a build definition. +type BuildDefinitionReference struct { + // The date this version of the definition was created. + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + // The ID of the referenced definition. + Id *int `json:"id,omitempty"` + // The name of the referenced definition. + Name *string `json:"name,omitempty"` + // The folder path of the definition. + Path *string `json:"path,omitempty"` + // A reference to the project. + Project *core.TeamProjectReference `json:"project,omitempty"` + // A value that indicates whether builds can be queued against this definition. + QueueStatus *DefinitionQueueStatus `json:"queueStatus,omitempty"` + // The definition revision number. + Revision *int `json:"revision,omitempty"` + // The type of the definition. + Type *DefinitionType `json:"type,omitempty"` + // The definition's URI. + Uri *string `json:"uri,omitempty"` + // The REST URL of the definition. + Url *string `json:"url,omitempty"` + Links interface{} `json:"_links,omitempty"` + // The author of the definition. + AuthoredBy *webapi.IdentityRef `json:"authoredBy,omitempty"` + // A reference to the definition that this definition is a draft of, if this is a draft definition. + DraftOf *DefinitionReference `json:"draftOf,omitempty"` + // The list of drafts associated with this definition, if this is not a draft definition. + Drafts *[]DefinitionReference `json:"drafts,omitempty"` + LatestBuild *Build `json:"latestBuild,omitempty"` + LatestCompletedBuild *Build `json:"latestCompletedBuild,omitempty"` + Metrics *[]BuildMetric `json:"metrics,omitempty"` + // The quality of the definition document (draft, etc.) + Quality *DefinitionQuality `json:"quality,omitempty"` + // The default queue for builds run against this definition. + Queue *AgentPoolQueue `json:"queue,omitempty"` +} + +// For back-compat with extensions that use the old Steps format instead of Process and Phases +type BuildDefinitionReference3_2 struct { + // The date this version of the definition was created. + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + // The ID of the referenced definition. + Id *int `json:"id,omitempty"` + // The name of the referenced definition. + Name *string `json:"name,omitempty"` + // The folder path of the definition. + Path *string `json:"path,omitempty"` + // A reference to the project. + Project *core.TeamProjectReference `json:"project,omitempty"` + // A value that indicates whether builds can be queued against this definition. + QueueStatus *DefinitionQueueStatus `json:"queueStatus,omitempty"` + // The definition revision number. + Revision *int `json:"revision,omitempty"` + // The type of the definition. + Type *DefinitionType `json:"type,omitempty"` + // The definition's URI. + Uri *string `json:"uri,omitempty"` + // The REST URL of the definition. + Url *string `json:"url,omitempty"` + Links interface{} `json:"_links,omitempty"` + // The author of the definition. + AuthoredBy *webapi.IdentityRef `json:"authoredBy,omitempty"` + // A reference to the definition that this definition is a draft of, if this is a draft definition. + DraftOf *DefinitionReference `json:"draftOf,omitempty"` + // The list of drafts associated with this definition, if this is not a draft definition. + Drafts *[]DefinitionReference `json:"drafts,omitempty"` + Metrics *[]BuildMetric `json:"metrics,omitempty"` + // The quality of the definition document (draft, etc.) + Quality *DefinitionQuality `json:"quality,omitempty"` + // The default queue for builds run against this definition. + Queue *AgentPoolQueue `json:"queue,omitempty"` +} + +// Represents a revision of a build definition. +type BuildDefinitionRevision struct { + // The identity of the person or process that changed the definition. + ChangedBy *webapi.IdentityRef `json:"changedBy,omitempty"` + // The date and time that the definition was changed. + ChangedDate *azuredevops.Time `json:"changedDate,omitempty"` + // The change type (add, edit, delete). + ChangeType *AuditAction `json:"changeType,omitempty"` + // The comment associated with the change. + Comment *string `json:"comment,omitempty"` + // A link to the definition at this revision. + DefinitionUrl *string `json:"definitionUrl,omitempty"` + // The name of the definition. + Name *string `json:"name,omitempty"` + // The revision number. + Revision *int `json:"revision,omitempty"` +} + +type BuildDefinitionSourceProvider struct { + // Uri of the associated definition + DefinitionUri *string `json:"definitionUri,omitempty"` + // fields associated with this build definition + Fields *map[string]string `json:"fields,omitempty"` + // Id of this source provider + Id *int `json:"id,omitempty"` + // The lst time this source provider was modified + LastModified *azuredevops.Time `json:"lastModified,omitempty"` + // Name of the source provider + Name *string `json:"name,omitempty"` + // Which trigger types are supported by this definition source provider + SupportedTriggerTypes *DefinitionTriggerType `json:"supportedTriggerTypes,omitempty"` +} + +// Represents a step in a build phase. +type BuildDefinitionStep struct { + // Indicates whether this step should run even if a previous step fails. + AlwaysRun *bool `json:"alwaysRun,omitempty"` + // A condition that determines whether this step should run. + Condition *string `json:"condition,omitempty"` + // Indicates whether the phase should continue even if this step fails. + ContinueOnError *bool `json:"continueOnError,omitempty"` + // The display name for this step. + DisplayName *string `json:"displayName,omitempty"` + // Indicates whether the step is enabled. + Enabled *bool `json:"enabled,omitempty"` + Environment *map[string]string `json:"environment,omitempty"` + Inputs *map[string]string `json:"inputs,omitempty"` + // The reference name for this step. + RefName *string `json:"refName,omitempty"` + // The task associated with this step. + Task *TaskDefinitionReference `json:"task,omitempty"` + // The time, in minutes, that this step is allowed to run. + TimeoutInMinutes *int `json:"timeoutInMinutes,omitempty"` +} + +// Represents a template from which new build definitions can be created. +type BuildDefinitionTemplate struct { + // Indicates whether the template can be deleted. + CanDelete *bool `json:"canDelete,omitempty"` + // The template category. + Category *string `json:"category,omitempty"` + // An optional hosted agent queue for the template to use by default. + DefaultHostedQueue *string `json:"defaultHostedQueue,omitempty"` + // A description of the template. + Description *string `json:"description,omitempty"` + Icons *map[string]string `json:"icons,omitempty"` + // The ID of the task whose icon is used when showing this template in the UI. + IconTaskId *uuid.UUID `json:"iconTaskId,omitempty"` + // The ID of the template. + Id *string `json:"id,omitempty"` + // The name of the template. + Name *string `json:"name,omitempty"` + // The actual template. + Template *BuildDefinition `json:"template,omitempty"` +} + +// For back-compat with extensions that use the old Steps format instead of Process and Phases +type BuildDefinitionTemplate3_2 struct { + CanDelete *bool `json:"canDelete,omitempty"` + Category *string `json:"category,omitempty"` + DefaultHostedQueue *string `json:"defaultHostedQueue,omitempty"` + Description *string `json:"description,omitempty"` + Icons *map[string]string `json:"icons,omitempty"` + IconTaskId *uuid.UUID `json:"iconTaskId,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Template *BuildDefinition3_2 `json:"template,omitempty"` +} + +// Represents a variable used by a build definition. +type BuildDefinitionVariable struct { + // Indicates whether the value can be set at queue time. + AllowOverride *bool `json:"allowOverride,omitempty"` + // Indicates whether the variable's value is a secret. + IsSecret *bool `json:"isSecret,omitempty"` + // The value of the variable. + Value *string `json:"value,omitempty"` +} + +type BuildDeletedEvent struct { + BuildId *int `json:"buildId,omitempty"` + Build *Build `json:"build,omitempty"` +} + +type BuildDeployment struct { + Deployment *BuildSummary `json:"deployment,omitempty"` + SourceBuild *XamlBuildReference `json:"sourceBuild,omitempty"` +} + +type BuildEvent struct { + Data *[]string `json:"data,omitempty"` + Identifier *string `json:"identifier,omitempty"` +} + +// Represents a build log. +type BuildLog struct { + // The ID of the log. + Id *int `json:"id,omitempty"` + // The type of the log location. + Type *string `json:"type,omitempty"` + // A full link to the log resource. + Url *string `json:"url,omitempty"` + // The date and time the log was created. + CreatedOn *azuredevops.Time `json:"createdOn,omitempty"` + // The date and time the log was last changed. + LastChangedOn *azuredevops.Time `json:"lastChangedOn,omitempty"` + // The number of lines in the log. + LineCount *uint64 `json:"lineCount,omitempty"` +} + +// Represents a reference to a build log. +type BuildLogReference struct { + // The ID of the log. + Id *int `json:"id,omitempty"` + // The type of the log location. + Type *string `json:"type,omitempty"` + // A full link to the log resource. + Url *string `json:"url,omitempty"` +} + +// Represents metadata about builds in the system. +type BuildMetric struct { + // The date for the scope. + Date *azuredevops.Time `json:"date,omitempty"` + // The value. + IntValue *int `json:"intValue,omitempty"` + // The name of the metric. + Name *string `json:"name,omitempty"` + // The scope. + Scope *string `json:"scope,omitempty"` +} + +// Represents the application of an optional behavior to a build definition. +type BuildOption struct { + // A reference to the build option. + Definition *BuildOptionDefinitionReference `json:"definition,omitempty"` + // Indicates whether the behavior is enabled. + Enabled *bool `json:"enabled,omitempty"` + Inputs *map[string]string `json:"inputs,omitempty"` +} + +// Represents an optional behavior that can be applied to a build definition. +type BuildOptionDefinition struct { + // The ID of the referenced build option. + Id *uuid.UUID `json:"id,omitempty"` + // The description. + Description *string `json:"description,omitempty"` + // The list of input groups defined for the build option. + Groups *[]BuildOptionGroupDefinition `json:"groups,omitempty"` + // The list of inputs defined for the build option. + Inputs *[]BuildOptionInputDefinition `json:"inputs,omitempty"` + // The name of the build option. + Name *string `json:"name,omitempty"` + // A value that indicates the relative order in which the behavior should be applied. + Ordinal *int `json:"ordinal,omitempty"` +} + +// Represents a reference to a build option definition. +type BuildOptionDefinitionReference struct { + // The ID of the referenced build option. + Id *uuid.UUID `json:"id,omitempty"` +} + +// Represents a group of inputs for a build option. +type BuildOptionGroupDefinition struct { + // The name of the group to display in the UI. + DisplayName *string `json:"displayName,omitempty"` + // Indicates whether the group is initially displayed as expanded in the UI. + IsExpanded *bool `json:"isExpanded,omitempty"` + // The internal name of the group. + Name *string `json:"name,omitempty"` +} + +// Represents an input for a build option. +type BuildOptionInputDefinition struct { + // The default value. + DefaultValue *string `json:"defaultValue,omitempty"` + // The name of the input group that this input belongs to. + GroupName *string `json:"groupName,omitempty"` + Help *map[string]string `json:"help,omitempty"` + // The label for the input. + Label *string `json:"label,omitempty"` + // The name of the input. + Name *string `json:"name,omitempty"` + Options *map[string]string `json:"options,omitempty"` + // Indicates whether the input is required to have a value. + Required *bool `json:"required,omitempty"` + // Indicates the type of the input value. + Type *BuildOptionInputType `json:"type,omitempty"` + // The rule that is applied to determine whether the input is visible in the UI. + VisibleRule *string `json:"visibleRule,omitempty"` +} + +type BuildOptionInputType string + +type buildOptionInputTypeValuesType struct { + String BuildOptionInputType + Boolean BuildOptionInputType + StringList BuildOptionInputType + Radio BuildOptionInputType + PickList BuildOptionInputType + MultiLine BuildOptionInputType + BranchFilter BuildOptionInputType +} + +var BuildOptionInputTypeValues = buildOptionInputTypeValuesType{ + String: "string", + Boolean: "boolean", + StringList: "stringList", + Radio: "radio", + PickList: "pickList", + MultiLine: "multiLine", + BranchFilter: "branchFilter", +} + +type BuildPhaseStatus string + +type buildPhaseStatusValuesType struct { + Unknown BuildPhaseStatus + Failed BuildPhaseStatus + Succeeded BuildPhaseStatus +} + +var BuildPhaseStatusValues = buildPhaseStatusValuesType{ + // The state is not known. + Unknown: "unknown", + // The build phase completed unsuccessfully. + Failed: "failed", + // The build phase completed successfully. + Succeeded: "succeeded", +} + +// Represents resources used by a build process. +type BuildProcessResources struct { + Endpoints *[]ServiceEndpointReference `json:"endpoints,omitempty"` + Files *[]SecureFileReference `json:"files,omitempty"` + Queues *[]AgentPoolQueueReference `json:"queues,omitempty"` + VariableGroups *[]VariableGroupReference `json:"variableGroups,omitempty"` +} + +type BuildProcessTemplate struct { + Description *string `json:"description,omitempty"` + FileExists *bool `json:"fileExists,omitempty"` + Id *int `json:"id,omitempty"` + Parameters *string `json:"parameters,omitempty"` + ServerPath *string `json:"serverPath,omitempty"` + SupportedReasons *BuildReason `json:"supportedReasons,omitempty"` + TeamProject *string `json:"teamProject,omitempty"` + TemplateType *ProcessTemplateType `json:"templateType,omitempty"` + Url *string `json:"url,omitempty"` + Version *string `json:"version,omitempty"` +} + +// Specifies the desired ordering of builds. +type BuildQueryOrder string + +type buildQueryOrderValuesType struct { + FinishTimeAscending BuildQueryOrder + FinishTimeDescending BuildQueryOrder + QueueTimeDescending BuildQueryOrder + QueueTimeAscending BuildQueryOrder + StartTimeDescending BuildQueryOrder + StartTimeAscending BuildQueryOrder +} + +var BuildQueryOrderValues = buildQueryOrderValuesType{ + // Order by finish time ascending. + FinishTimeAscending: "finishTimeAscending", + // Order by finish time descending. + FinishTimeDescending: "finishTimeDescending", + // Order by queue time descending. + QueueTimeDescending: "queueTimeDescending", + // Order by queue time ascending. + QueueTimeAscending: "queueTimeAscending", + // Order by start time descending. + StartTimeDescending: "startTimeDescending", + // Order by start time ascending. + StartTimeAscending: "startTimeAscending", +} + +type BuildQueuedEvent struct { + BuildId *int `json:"buildId,omitempty"` + Build *Build `json:"build,omitempty"` +} + +type BuildReason string + +type buildReasonValuesType struct { + None BuildReason + Manual BuildReason + IndividualCI BuildReason + BatchedCI BuildReason + Schedule BuildReason + ScheduleForced BuildReason + UserCreated BuildReason + ValidateShelveset BuildReason + CheckInShelveset BuildReason + PullRequest BuildReason + BuildCompletion BuildReason + Triggered BuildReason + All BuildReason +} + +var BuildReasonValues = buildReasonValuesType{ + // No reason. This value should not be used. + None: "none", + // The build was started manually. + Manual: "manual", + // The build was started for the trigger TriggerType.ContinuousIntegration. + IndividualCI: "individualCI", + // The build was started for the trigger TriggerType.BatchedContinuousIntegration. + BatchedCI: "batchedCI", + // The build was started for the trigger TriggerType.Schedule. + Schedule: "schedule", + // The build was started for the trigger TriggerType.ScheduleForced. + ScheduleForced: "scheduleForced", + // The build was created by a user. + UserCreated: "userCreated", + // The build was started manually for private validation. + ValidateShelveset: "validateShelveset", + // The build was started for the trigger ContinuousIntegrationType.Gated. + CheckInShelveset: "checkInShelveset", + // The build was started by a pull request. Added in resource version 3. + PullRequest: "pullRequest", + // The build was started when another build completed. + BuildCompletion: "buildCompletion", + // The build was triggered for retention policy purposes. + Triggered: "triggered", + // All reasons. + All: "all", +} + +// Represents a reference to a build. +type BuildReference struct { + Links interface{} `json:"_links,omitempty"` + // The build number. + BuildNumber *string `json:"buildNumber,omitempty"` + // Indicates whether the build has been deleted. + Deleted *bool `json:"deleted,omitempty"` + // The time that the build was completed. + FinishTime *azuredevops.Time `json:"finishTime,omitempty"` + // The ID of the build. + Id *int `json:"id,omitempty"` + // The time that the build was queued. + QueueTime *azuredevops.Time `json:"queueTime,omitempty"` + // The identity on whose behalf the build was queued. + RequestedFor *webapi.IdentityRef `json:"requestedFor,omitempty"` + // The build result. + Result *BuildResult `json:"result,omitempty"` + // The time that the build was started. + StartTime *azuredevops.Time `json:"startTime,omitempty"` + // The build status. + Status *BuildStatus `json:"status,omitempty"` +} + +// Represents information about a build report. +type BuildReportMetadata struct { + // The Id of the build. + BuildId *int `json:"buildId,omitempty"` + // The content of the report. + Content *string `json:"content,omitempty"` + // The type of the report. + Type *string `json:"type,omitempty"` +} + +// Represents a repository used by a build definition. +type BuildRepository struct { + // Indicates whether to checkout submodules. + CheckoutSubmodules *bool `json:"checkoutSubmodules,omitempty"` + // Indicates whether to clean the target folder when getting code from the repository. + Clean *string `json:"clean,omitempty"` + // The name of the default branch. + DefaultBranch *string `json:"defaultBranch,omitempty"` + // The ID of the repository. + Id *string `json:"id,omitempty"` + // The friendly name of the repository. + Name *string `json:"name,omitempty"` + Properties *map[string]string `json:"properties,omitempty"` + // The root folder. + RootFolder *string `json:"rootFolder,omitempty"` + // The type of the repository. + Type *string `json:"type,omitempty"` + // The URL of the repository. + Url *string `json:"url,omitempty"` +} + +// Represents the result of validating a build request. +type BuildRequestValidationResult struct { + // The message associated with the result. + Message *string `json:"message,omitempty"` + // The result. + Result *ValidationResult `json:"result,omitempty"` +} + +// Represents information about resources used by builds in the system. +type BuildResourceUsage struct { + // The number of build agents. + DistributedTaskAgents *int `json:"distributedTaskAgents,omitempty"` + // The number of paid private agent slots. + PaidPrivateAgentSlots *int `json:"paidPrivateAgentSlots,omitempty"` + // The total usage. + TotalUsage *int `json:"totalUsage,omitempty"` + // The number of XAML controllers. + XamlControllers *int `json:"xamlControllers,omitempty"` +} + +// This is not a Flags enum because we don't want to set multiple statuses on a build. However, when adding values, please stick to powers of 2 as if it were a Flags enum This will ensure that things that key off multiple result types (like labelling sources) continue to work +type BuildResult string + +type buildResultValuesType struct { + None BuildResult + Succeeded BuildResult + PartiallySucceeded BuildResult + Failed BuildResult + Canceled BuildResult +} + +var BuildResultValues = buildResultValuesType{ + // No result + None: "none", + // The build completed successfully. + Succeeded: "succeeded", + // The build completed compilation successfully but had other errors. + PartiallySucceeded: "partiallySucceeded", + // The build completed unsuccessfully. + Failed: "failed", + // The build was canceled before starting. + Canceled: "canceled", +} + +type BuildsDeletedEvent struct { + BuildIds *[]int `json:"buildIds,omitempty"` + // The ID of the definition. + DefinitionId *int `json:"definitionId,omitempty"` + // The ID of the project. + ProjectId *uuid.UUID `json:"projectId,omitempty"` +} + +type BuildsDeletedEvent1 struct { + BuildIds *[]int `json:"buildIds,omitempty"` + // The ID of the definition. + DefinitionId *int `json:"definitionId,omitempty"` + // The ID of the project. + ProjectId *uuid.UUID `json:"projectId,omitempty"` +} + +type BuildServer struct { + Agents *[]BuildAgentReference `json:"agents,omitempty"` + Controller *XamlBuildControllerReference `json:"controller,omitempty"` + Id *int `json:"id,omitempty"` + IsVirtual *bool `json:"isVirtual,omitempty"` + MessageQueueUrl *string `json:"messageQueueUrl,omitempty"` + Name *string `json:"name,omitempty"` + RequireClientCertificates *bool `json:"requireClientCertificates,omitempty"` + Status *ServiceHostStatus `json:"status,omitempty"` + StatusChangedDate *azuredevops.Time `json:"statusChangedDate,omitempty"` + Uri *string `json:"uri,omitempty"` + Url *string `json:"url,omitempty"` + Version *int `json:"version,omitempty"` +} + +// Represents system-wide build settings. +type BuildSettings struct { + // The number of days to keep records of deleted builds. + DaysToKeepDeletedBuildsBeforeDestroy *int `json:"daysToKeepDeletedBuildsBeforeDestroy,omitempty"` + // The default retention policy. + DefaultRetentionPolicy *RetentionPolicy `json:"defaultRetentionPolicy,omitempty"` + // The maximum retention policy. + MaximumRetentionPolicy *RetentionPolicy `json:"maximumRetentionPolicy,omitempty"` +} + +type BuildStatus string + +type buildStatusValuesType struct { + None BuildStatus + InProgress BuildStatus + Completed BuildStatus + Cancelling BuildStatus + Postponed BuildStatus + NotStarted BuildStatus + All BuildStatus +} + +var BuildStatusValues = buildStatusValuesType{ + // No status. + None: "none", + // The build is currently in progress. + InProgress: "inProgress", + // The build has completed. + Completed: "completed", + // The build is cancelling + Cancelling: "cancelling", + // The build is inactive in the queue. + Postponed: "postponed", + // The build has not yet started. + NotStarted: "notStarted", + // All status. + All: "all", +} + +type BuildSummary struct { + Build *XamlBuildReference `json:"build,omitempty"` + FinishTime *azuredevops.Time `json:"finishTime,omitempty"` + KeepForever *bool `json:"keepForever,omitempty"` + Quality *string `json:"quality,omitempty"` + Reason *BuildReason `json:"reason,omitempty"` + RequestedFor *webapi.IdentityRef `json:"requestedFor,omitempty"` + StartTime *azuredevops.Time `json:"startTime,omitempty"` + Status *BuildStatus `json:"status,omitempty"` +} + +type BuildTagsAddedEvent struct { + BuildId *int `json:"buildId,omitempty"` + Build *Build `json:"build,omitempty"` + AllTags *[]string `json:"allTags,omitempty"` + NewTags *[]string `json:"newTags,omitempty"` +} + +type BuildUpdatedEvent struct { + BuildId *int `json:"buildId,omitempty"` + Build *Build `json:"build,omitempty"` +} + +// Represents a workspace mapping. +type BuildWorkspace struct { + Mappings *[]MappingDetails `json:"mappings,omitempty"` +} + +// Represents a change associated with a build. +type Change struct { + // The author of the change. + Author *webapi.IdentityRef `json:"author,omitempty"` + // The location of a user-friendly representation of the resource. + DisplayUri *string `json:"displayUri,omitempty"` + // The identifier for the change. For a commit, this would be the SHA1. For a TFVC changeset, this would be the changeset ID. + Id *string `json:"id,omitempty"` + // The location of the full representation of the resource. + Location *string `json:"location,omitempty"` + // The description of the change. This might be a commit message or changeset description. + Message *string `json:"message,omitempty"` + // Indicates whether the message was truncated. + MessageTruncated *bool `json:"messageTruncated,omitempty"` + // The person or process that pushed the change. + Pusher *string `json:"pusher,omitempty"` + // The timestamp for the change. + Timestamp *azuredevops.Time `json:"timestamp,omitempty"` + // The type of change. "commit", "changeset", etc. + Type *string `json:"type,omitempty"` +} + +type ConsoleLogEvent struct { + BuildId *int `json:"buildId,omitempty"` + Lines *[]string `json:"lines,omitempty"` + StepRecordId *uuid.UUID `json:"stepRecordId,omitempty"` + TimelineId *uuid.UUID `json:"timelineId,omitempty"` + TimelineRecordId *uuid.UUID `json:"timelineRecordId,omitempty"` +} + +type ContinuousDeploymentDefinition struct { + // The connected service associated with the continuous deployment + ConnectedService *core.WebApiConnectedServiceRef `json:"connectedService,omitempty"` + // The definition associated with the continuous deployment + Definition *XamlDefinitionReference `json:"definition,omitempty"` + GitBranch *string `json:"gitBranch,omitempty"` + HostedServiceName *string `json:"hostedServiceName,omitempty"` + Project *core.TeamProjectReference `json:"project,omitempty"` + RepositoryId *string `json:"repositoryId,omitempty"` + StorageAccountName *string `json:"storageAccountName,omitempty"` + SubscriptionId *string `json:"subscriptionId,omitempty"` + Website *string `json:"website,omitempty"` + Webspace *string `json:"webspace,omitempty"` +} + +// Represents a continuous integration (CI) trigger. +type ContinuousIntegrationTrigger struct { + // Indicates whether changes should be batched while another CI build is running. + BatchChanges *bool `json:"batchChanges,omitempty"` + BranchFilters *[]string `json:"branchFilters,omitempty"` + // The maximum number of simultaneous CI builds that will run per branch. + MaxConcurrentBuildsPerBranch *int `json:"maxConcurrentBuildsPerBranch,omitempty"` + PathFilters *[]string `json:"pathFilters,omitempty"` + // The polling interval, in seconds. + PollingInterval *int `json:"pollingInterval,omitempty"` + // The ID of the job used to poll an external repository. + PollingJobId *uuid.UUID `json:"pollingJobId,omitempty"` + SettingsSourceType *int `json:"settingsSourceType,omitempty"` +} + +type ControllerStatus string + +type controllerStatusValuesType struct { + Unavailable ControllerStatus + Available ControllerStatus + Offline ControllerStatus +} + +var ControllerStatusValues = controllerStatusValuesType{ + // Indicates that the build controller cannot be contacted. + Unavailable: "unavailable", + // Indicates that the build controller is currently available. + Available: "available", + // Indicates that the build controller has taken itself offline. + Offline: "offline", +} + +type DefinitionQuality string + +type definitionQualityValuesType struct { + Definition DefinitionQuality + Draft DefinitionQuality +} + +var DefinitionQualityValues = definitionQualityValuesType{ + Definition: "definition", + Draft: "draft", +} + +// Specifies the desired ordering of definitions. +type DefinitionQueryOrder string + +type definitionQueryOrderValuesType struct { + None DefinitionQueryOrder + LastModifiedAscending DefinitionQueryOrder + LastModifiedDescending DefinitionQueryOrder + DefinitionNameAscending DefinitionQueryOrder + DefinitionNameDescending DefinitionQueryOrder +} + +var DefinitionQueryOrderValues = definitionQueryOrderValuesType{ + // No order + None: "none", + // Order by created on/last modified time ascending. + LastModifiedAscending: "lastModifiedAscending", + // Order by created on/last modified time descending. + LastModifiedDescending: "lastModifiedDescending", + // Order by definition name ascending. + DefinitionNameAscending: "definitionNameAscending", + // Order by definition name descending. + DefinitionNameDescending: "definitionNameDescending", +} + +type DefinitionQueueStatus string + +type definitionQueueStatusValuesType struct { + Enabled DefinitionQueueStatus + Paused DefinitionQueueStatus + Disabled DefinitionQueueStatus +} + +var DefinitionQueueStatusValues = definitionQueueStatusValuesType{ + // When enabled the definition queue allows builds to be queued by users, the system will queue scheduled, gated and continuous integration builds, and the queued builds will be started by the system. + Enabled: "enabled", + // When paused the definition queue allows builds to be queued by users and the system will queue scheduled, gated and continuous integration builds. Builds in the queue will not be started by the system. + Paused: "paused", + // When disabled the definition queue will not allow builds to be queued by users and the system will not queue scheduled, gated or continuous integration builds. Builds already in the queue will not be started by the system. + Disabled: "disabled", +} + +// Represents a reference to a definition. +type DefinitionReference struct { + // The date this version of the definition was created. + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + // The ID of the referenced definition. + Id *int `json:"id,omitempty"` + // The name of the referenced definition. + Name *string `json:"name,omitempty"` + // The folder path of the definition. + Path *string `json:"path,omitempty"` + // A reference to the project. + Project *core.TeamProjectReference `json:"project,omitempty"` + // A value that indicates whether builds can be queued against this definition. + QueueStatus *DefinitionQueueStatus `json:"queueStatus,omitempty"` + // The definition revision number. + Revision *int `json:"revision,omitempty"` + // The type of the definition. + Type *DefinitionType `json:"type,omitempty"` + // The definition's URI. + Uri *string `json:"uri,omitempty"` + // The REST URL of the definition. + Url *string `json:"url,omitempty"` +} + +type DefinitionResourceReference struct { + // Indicates whether the resource is authorized for use. + Authorized *bool `json:"authorized,omitempty"` + // The id of the resource. + Id *string `json:"id,omitempty"` + // A friendly name for the resource. + Name *string `json:"name,omitempty"` + // The type of the resource. + Type *string `json:"type,omitempty"` +} + +type DefinitionTriggerType string + +type definitionTriggerTypeValuesType struct { + None DefinitionTriggerType + ContinuousIntegration DefinitionTriggerType + BatchedContinuousIntegration DefinitionTriggerType + Schedule DefinitionTriggerType + GatedCheckIn DefinitionTriggerType + BatchedGatedCheckIn DefinitionTriggerType + PullRequest DefinitionTriggerType + BuildCompletion DefinitionTriggerType + All DefinitionTriggerType +} + +var DefinitionTriggerTypeValues = definitionTriggerTypeValuesType{ + // Manual builds only. + None: "none", + // A build should be started for each changeset. + ContinuousIntegration: "continuousIntegration", + // A build should be started for multiple changesets at a time at a specified interval. + BatchedContinuousIntegration: "batchedContinuousIntegration", + // A build should be started on a specified schedule whether or not changesets exist. + Schedule: "schedule", + // A validation build should be started for each check-in. + GatedCheckIn: "gatedCheckIn", + // A validation build should be started for each batch of check-ins. + BatchedGatedCheckIn: "batchedGatedCheckIn", + // A build should be triggered when a GitHub pull request is created or updated. Added in resource version 3 + PullRequest: "pullRequest", + // A build should be triggered when another build completes. + BuildCompletion: "buildCompletion", + // All types. + All: "all", +} + +type DefinitionType string + +type definitionTypeValuesType struct { + Xaml DefinitionType + Build DefinitionType +} + +var DefinitionTypeValues = definitionTypeValuesType{ + Xaml: "xaml", + Build: "build", +} + +type DeleteOptions string + +type deleteOptionsValuesType struct { + None DeleteOptions + DropLocation DeleteOptions + TestResults DeleteOptions + Label DeleteOptions + Details DeleteOptions + Symbols DeleteOptions + All DeleteOptions +} + +var DeleteOptionsValues = deleteOptionsValuesType{ + // No data should be deleted. This value should not be used. + None: "none", + // The drop location should be deleted. + DropLocation: "dropLocation", + // The test results should be deleted. + TestResults: "testResults", + // The version control label should be deleted. + Label: "label", + // The build should be deleted. + Details: "details", + // Published symbols should be deleted. + Symbols: "symbols", + // All data should be deleted. + All: "all", +} + +// Represents a dependency. +type Dependency struct { + // The event. The dependency is satisfied when the referenced object emits this event. + Event *string `json:"event,omitempty"` + // The scope. This names the object referenced by the dependency. + Scope *string `json:"scope,omitempty"` +} + +// Represents the data from the build information nodes for type "DeploymentInformation" for xaml builds +type Deployment struct { + Type *string `json:"type,omitempty"` +} + +// Deployment information for type "Build" +type DeploymentBuild struct { + Type *string `json:"type,omitempty"` + BuildId *int `json:"buildId,omitempty"` +} + +// Deployment information for type "Deploy" +type DeploymentDeploy struct { + Type *string `json:"type,omitempty"` + Message *string `json:"message,omitempty"` +} + +// Deployment information for type "Test" +type DeploymentTest struct { + Type *string `json:"type,omitempty"` + RunId *int `json:"runId,omitempty"` +} + +// Represents a build process supported by the build definition designer. +type DesignerProcess struct { + Phases *[]Phase `json:"phases,omitempty"` + // The target for the build process. + Target *DesignerProcessTarget `json:"target,omitempty"` +} + +// Represents the target for the build process. +type DesignerProcessTarget struct { + // Agent specification for the build process. + AgentSpecification *AgentSpecification `json:"agentSpecification,omitempty"` +} + +type DockerProcess struct { + Target *DockerProcessTarget `json:"target,omitempty"` +} + +// Represents the target for the docker build process. +type DockerProcessTarget struct { + // Agent specification for the build process. + AgentSpecification *AgentSpecification `json:"agentSpecification,omitempty"` +} + +// Represents a folder that contains build definitions. +type Folder struct { + // The process or person who created the folder. + CreatedBy *webapi.IdentityRef `json:"createdBy,omitempty"` + // The date the folder was created. + CreatedOn *azuredevops.Time `json:"createdOn,omitempty"` + // The description. + Description *string `json:"description,omitempty"` + // The process or person that last changed the folder. + LastChangedBy *webapi.IdentityRef `json:"lastChangedBy,omitempty"` + // The date the folder was last changed. + LastChangedDate *azuredevops.Time `json:"lastChangedDate,omitempty"` + // The full path. + Path *string `json:"path,omitempty"` + // The project. + Project *core.TeamProjectReference `json:"project,omitempty"` +} + +// Specifies the desired ordering of folders. +type FolderQueryOrder string + +type folderQueryOrderValuesType struct { + None FolderQueryOrder + FolderAscending FolderQueryOrder + FolderDescending FolderQueryOrder +} + +var FolderQueryOrderValues = folderQueryOrderValuesType{ + // No order + None: "none", + // Order by folder name and path ascending. + FolderAscending: "folderAscending", + // Order by folder name and path descending. + FolderDescending: "folderDescending", +} + +// Represents the ability to build forks of the selected repository. +type Forks struct { + // Indicates whether a build should use secrets when building forks of the selected repository. + AllowSecrets *bool `json:"allowSecrets,omitempty"` + // Indicates whether the trigger should queue builds for forks of the selected repository. + Enabled *bool `json:"enabled,omitempty"` +} + +// Represents a gated check-in trigger. +type GatedCheckInTrigger struct { + PathFilters *[]string `json:"pathFilters,omitempty"` + // Indicates whether CI triggers should run after the gated check-in succeeds. + RunContinuousIntegration *bool `json:"runContinuousIntegration,omitempty"` + // Indicates whether to take workspace mappings into account when determining whether a build should run. + UseWorkspaceMappings *bool `json:"useWorkspaceMappings,omitempty"` +} + +type GetOption string + +type getOptionValuesType struct { + LatestOnQueue GetOption + LatestOnBuild GetOption + Custom GetOption +} + +var GetOptionValues = getOptionValuesType{ + // Use the latest changeset at the time the build is queued. + LatestOnQueue: "latestOnQueue", + // Use the latest changeset at the time the build is started. + LatestOnBuild: "latestOnBuild", + // A user-specified version has been supplied. + Custom: "custom", +} + +// Data representation of an information node associated with a build +type InformationNode struct { + // Fields of the information node + Fields *map[string]string `json:"fields,omitempty"` + // Process or person that last modified this node + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // Date this node was last modified + LastModifiedDate *azuredevops.Time `json:"lastModifiedDate,omitempty"` + // Node Id of this information node + NodeId *int `json:"nodeId,omitempty"` + // Id of parent node (xml tree) + ParentId *int `json:"parentId,omitempty"` + // The type of the information node + Type *string `json:"type,omitempty"` +} + +// Represents an issue (error, warning) associated with a build. +type Issue struct { + // The category. + Category *string `json:"category,omitempty"` + Data *map[string]string `json:"data,omitempty"` + // A description of the issue. + Message *string `json:"message,omitempty"` + // The type (error, warning) of the issue. + Type *IssueType `json:"type,omitempty"` +} + +type IssueType string + +type issueTypeValuesType struct { + Error IssueType + Warning IssueType +} + +var IssueTypeValues = issueTypeValuesType{ + Error: "error", + Warning: "warning", +} + +type JustInTimeProcess struct { +} + +// Represents an entry in a workspace mapping. +type MappingDetails struct { + // The local path. + LocalPath *string `json:"localPath,omitempty"` + // The mapping type. + MappingType *string `json:"mappingType,omitempty"` + // The server path. + ServerPath *string `json:"serverPath,omitempty"` +} + +// Represents options for running a phase against multiple agents. +type MultipleAgentExecutionOptions struct { + // Indicates the type of execution options. + Type *int `json:"type,omitempty"` + // Indicates whether failure on one agent should prevent the phase from running on other agents. + ContinueOnError *bool `json:"continueOnError,omitempty"` + // The maximum number of agents to use simultaneously. + MaxConcurrency *int `json:"maxConcurrency,omitempty"` +} + +// Represents a phase of a build definition. +type Phase struct { + // The condition that must be true for this phase to execute. + Condition *string `json:"condition,omitempty"` + Dependencies *[]Dependency `json:"dependencies,omitempty"` + // The job authorization scope for builds queued against this definition. + JobAuthorizationScope *BuildAuthorizationScope `json:"jobAuthorizationScope,omitempty"` + // The cancellation timeout, in minutes, for builds queued against this definition. + JobCancelTimeoutInMinutes *int `json:"jobCancelTimeoutInMinutes,omitempty"` + // The job execution timeout, in minutes, for builds queued against this definition. + JobTimeoutInMinutes *int `json:"jobTimeoutInMinutes,omitempty"` + // The name of the phase. + Name *string `json:"name,omitempty"` + // The unique ref name of the phase. + RefName *string `json:"refName,omitempty"` + Steps *[]BuildDefinitionStep `json:"steps,omitempty"` + // The target (agent, server, etc.) for this phase. + Target *PhaseTarget `json:"target,omitempty"` + Variables *map[string]BuildDefinitionVariable `json:"variables,omitempty"` +} + +// Represents the target of a phase. +type PhaseTarget struct { + // The type of the target. + Type *int `json:"type,omitempty"` +} + +type ProcessTemplateType string + +type processTemplateTypeValuesType struct { + Custom ProcessTemplateType + Default ProcessTemplateType + Upgrade ProcessTemplateType +} + +var ProcessTemplateTypeValues = processTemplateTypeValuesType{ + // Indicates a custom template. + Custom: "custom", + // Indicates a default template. + Default: "default", + // Indicates an upgrade template. + Upgrade: "upgrade", +} + +// Represents a pull request object. These are retrieved from Source Providers. +type PullRequest struct { + // The links to other objects related to this object. + Links interface{} `json:"_links,omitempty"` + // Author of the pull request. + Author *webapi.IdentityRef `json:"author,omitempty"` + // Current state of the pull request, e.g. open, merged, closed, conflicts, etc. + CurrentState *string `json:"currentState,omitempty"` + // Description for the pull request. + Description *string `json:"description,omitempty"` + // Unique identifier for the pull request + Id *string `json:"id,omitempty"` + // The name of the provider this pull request is associated with. + ProviderName *string `json:"providerName,omitempty"` + // Source branch ref of this pull request + SourceBranchRef *string `json:"sourceBranchRef,omitempty"` + // Owner of the source repository of this pull request + SourceRepositoryOwner *string `json:"sourceRepositoryOwner,omitempty"` + // Target branch ref of this pull request + TargetBranchRef *string `json:"targetBranchRef,omitempty"` + // Owner of the target repository of this pull request + TargetRepositoryOwner *string `json:"targetRepositoryOwner,omitempty"` + // Title of the pull request. + Title *string `json:"title,omitempty"` +} + +// Represents a pull request trigger. +type PullRequestTrigger struct { + // Indicates if an update to a PR should delete current in-progress builds. + AutoCancel *bool `json:"autoCancel,omitempty"` + BranchFilters *[]string `json:"branchFilters,omitempty"` + Forks *Forks `json:"forks,omitempty"` + IsCommentRequiredForPullRequest *bool `json:"isCommentRequiredForPullRequest,omitempty"` + PathFilters *[]string `json:"pathFilters,omitempty"` + RequireCommentsForNonTeamMembersOnly *bool `json:"requireCommentsForNonTeamMembersOnly,omitempty"` + SettingsSourceType *int `json:"settingsSourceType,omitempty"` +} + +type QueryDeletedOption string + +type queryDeletedOptionValuesType struct { + ExcludeDeleted QueryDeletedOption + IncludeDeleted QueryDeletedOption + OnlyDeleted QueryDeletedOption +} + +var QueryDeletedOptionValues = queryDeletedOptionValuesType{ + // Include only non-deleted builds. + ExcludeDeleted: "excludeDeleted", + // Include deleted and non-deleted builds. + IncludeDeleted: "includeDeleted", + // Include only deleted builds. + OnlyDeleted: "onlyDeleted", +} + +// [Flags] +type QueueOptions string + +type queueOptionsValuesType struct { + None QueueOptions + DoNotRun QueueOptions +} + +var QueueOptionsValues = queueOptionsValuesType{ + // No queue options + None: "none", + // Create a plan Id for the build, do not run it + DoNotRun: "doNotRun", +} + +type QueuePriority string + +type queuePriorityValuesType struct { + Low QueuePriority + BelowNormal QueuePriority + Normal QueuePriority + AboveNormal QueuePriority + High QueuePriority +} + +var QueuePriorityValues = queuePriorityValuesType{ + // Low priority. + Low: "low", + // Below normal priority. + BelowNormal: "belowNormal", + // Normal priority. + Normal: "normal", + // Above normal priority. + AboveNormal: "aboveNormal", + // High priority. + High: "high", +} + +type RealtimeBuildEvent struct { + BuildId *int `json:"buildId,omitempty"` +} + +type RepositoryCleanOptions string + +type repositoryCleanOptionsValuesType struct { + Source RepositoryCleanOptions + SourceAndOutputDir RepositoryCleanOptions + SourceDir RepositoryCleanOptions + AllBuildDir RepositoryCleanOptions +} + +var RepositoryCleanOptionsValues = repositoryCleanOptionsValuesType{ + Source: "source", + SourceAndOutputDir: "sourceAndOutputDir", + // Re-create $(build.sourcesDirectory) + SourceDir: "sourceDir", + // Re-create $(agnet.buildDirectory) which contains $(build.sourcesDirectory), $(build.binariesDirectory) and any folders that left from previous build. + AllBuildDir: "allBuildDir", +} + +// Represents a repository's webhook returned from a source provider. +type RepositoryWebhook struct { + // The friendly name of the repository. + Name *string `json:"name,omitempty"` + Types *[]DefinitionTriggerType `json:"types,omitempty"` + // The URL of the repository. + Url *string `json:"url,omitempty"` +} + +// Represents a reference to a resource. +type ResourceReference struct { + // An alias to be used when referencing the resource. + Alias *string `json:"alias,omitempty"` +} + +type ResultSet string + +type resultSetValuesType struct { + All ResultSet + Top ResultSet +} + +var ResultSetValues = resultSetValuesType{ + // Include all repositories + All: "all", + // Include most relevant repositories for user + Top: "top", +} + +// Represents a retention policy for a build definition. +type RetentionPolicy struct { + Artifacts *[]string `json:"artifacts,omitempty"` + ArtifactTypesToDelete *[]string `json:"artifactTypesToDelete,omitempty"` + Branches *[]string `json:"branches,omitempty"` + // The number of days to keep builds. + DaysToKeep *int `json:"daysToKeep,omitempty"` + // Indicates whether the build record itself should be deleted. + DeleteBuildRecord *bool `json:"deleteBuildRecord,omitempty"` + // Indicates whether to delete test results associated with the build. + DeleteTestResults *bool `json:"deleteTestResults,omitempty"` + // The minimum number of builds to keep. + MinimumToKeep *int `json:"minimumToKeep,omitempty"` +} + +type Schedule struct { + BranchFilters *[]string `json:"branchFilters,omitempty"` + // Days for a build (flags enum for days of the week) + DaysToBuild *ScheduleDays `json:"daysToBuild,omitempty"` + // The Job Id of the Scheduled job that will queue the scheduled build. Since a single trigger can have multiple schedules and we want a single job to process a single schedule (since each schedule has a list of branches to build), the schedule itself needs to define the Job Id. This value will be filled in when a definition is added or updated. The UI does not provide it or use it. + ScheduleJobId *uuid.UUID `json:"scheduleJobId,omitempty"` + // Flag to determine if this schedule should only build if the associated source has been changed. + ScheduleOnlyWithChanges *bool `json:"scheduleOnlyWithChanges,omitempty"` + // Local timezone hour to start + StartHours *int `json:"startHours,omitempty"` + // Local timezone minute to start + StartMinutes *int `json:"startMinutes,omitempty"` + // Time zone of the build schedule (String representation of the time zone ID) + TimeZoneId *string `json:"timeZoneId,omitempty"` +} + +type ScheduleDays string + +type scheduleDaysValuesType struct { + None ScheduleDays + Monday ScheduleDays + Tuesday ScheduleDays + Wednesday ScheduleDays + Thursday ScheduleDays + Friday ScheduleDays + Saturday ScheduleDays + Sunday ScheduleDays + All ScheduleDays +} + +var ScheduleDaysValues = scheduleDaysValuesType{ + // Do not run. + None: "none", + // Run on Monday. + Monday: "monday", + // Run on Tuesday. + Tuesday: "tuesday", + // Run on Wednesday. + Wednesday: "wednesday", + // Run on Thursday. + Thursday: "thursday", + // Run on Friday. + Friday: "friday", + // Run on Saturday. + Saturday: "saturday", + // Run on Sunday. + Sunday: "sunday", + // Run on all days of the week. + All: "all", +} + +// Represents a schedule trigger. +type ScheduleTrigger struct { + Schedules *[]Schedule `json:"schedules,omitempty"` +} + +// Represents a reference to a secure file. +type SecureFileReference struct { + // An alias to be used when referencing the resource. + Alias *string `json:"alias,omitempty"` + // The ID of the secure file. + Id *uuid.UUID `json:"id,omitempty"` +} + +// Represents a phase target that runs on the server. +type ServerTarget struct { + // The type of the target. + Type *int `json:"type,omitempty"` + // The execution options. + ExecutionOptions *ServerTargetExecutionOptions `json:"executionOptions,omitempty"` +} + +// Represents options for running a phase on the server. +type ServerTargetExecutionOptions struct { + // The type. + Type *int `json:"type,omitempty"` +} + +// Represents a referenec to a service endpoint. +type ServiceEndpointReference struct { + // An alias to be used when referencing the resource. + Alias *string `json:"alias,omitempty"` + // The ID of the service endpoint. + Id *uuid.UUID `json:"id,omitempty"` +} + +type ServiceHostStatus string + +type serviceHostStatusValuesType struct { + Online ServiceHostStatus + Offline ServiceHostStatus +} + +var ServiceHostStatusValues = serviceHostStatusValuesType{ + // The service host is currently connected and accepting commands. + Online: "online", + // The service host is currently disconnected and not accepting commands. + Offline: "offline", +} + +type SourceProviderAttributes struct { + // The name of the source provider. + Name *string `json:"name,omitempty"` + // The capabilities supported by this source provider. + SupportedCapabilities *map[string]bool `json:"supportedCapabilities,omitempty"` + // The types of triggers supported by this source provider. + SupportedTriggers *[]SupportedTrigger `json:"supportedTriggers,omitempty"` +} + +type SourceProviderAvailability string + +type sourceProviderAvailabilityValuesType struct { + Hosted SourceProviderAvailability + OnPremises SourceProviderAvailability + All SourceProviderAvailability +} + +var SourceProviderAvailabilityValues = sourceProviderAvailabilityValuesType{ + // The source provider is available in the hosted environment. + Hosted: "hosted", + // The source provider is available in the on-premises environment. + OnPremises: "onPremises", + // The source provider is available in all environments. + All: "all", +} + +// Represents a work item related to some source item. These are retrieved from Source Providers. +type SourceRelatedWorkItem struct { + Links interface{} `json:"_links,omitempty"` + // Identity ref for the person that the work item is assigned to. + AssignedTo *webapi.IdentityRef `json:"assignedTo,omitempty"` + // Current state of the work item, e.g. Active, Resolved, Closed, etc. + CurrentState *string `json:"currentState,omitempty"` + // Long description for the work item. + Description *string `json:"description,omitempty"` + // Unique identifier for the work item + Id *string `json:"id,omitempty"` + // The name of the provider the work item is associated with. + ProviderName *string `json:"providerName,omitempty"` + // Short name for the work item. + Title *string `json:"title,omitempty"` + // Type of work item, e.g. Bug, Task, User Story, etc. + Type *string `json:"type,omitempty"` +} + +// A set of repositories returned from the source provider. +type SourceRepositories struct { + // A token used to continue this paged request; 'null' if the request is complete + ContinuationToken *string `json:"continuationToken,omitempty"` + // The number of repositories requested for each page + PageLength *int `json:"pageLength,omitempty"` + // A list of repositories + Repositories *[]SourceRepository `json:"repositories,omitempty"` + // The total number of pages, or '-1' if unknown + TotalPageCount *int `json:"totalPageCount,omitempty"` +} + +// Represents a repository returned from a source provider. +type SourceRepository struct { + // The name of the default branch. + DefaultBranch *string `json:"defaultBranch,omitempty"` + // The full name of the repository. + FullName *string `json:"fullName,omitempty"` + // The ID of the repository. + Id *string `json:"id,omitempty"` + // The friendly name of the repository. + Name *string `json:"name,omitempty"` + Properties *map[string]string `json:"properties,omitempty"` + // The name of the source provider the repository is from. + SourceProviderName *string `json:"sourceProviderName,omitempty"` + // The URL of the repository. + Url *string `json:"url,omitempty"` +} + +// Represents an item in a repository from a source provider. +type SourceRepositoryItem struct { + // Whether the item is able to have sub-items (e.g., is a folder). + IsContainer *bool `json:"isContainer,omitempty"` + // The full path of the item, relative to the root of the repository. + Path *string `json:"path,omitempty"` + // The type of the item (folder, file, etc). + Type *string `json:"type,omitempty"` + // The URL of the item. + Url *string `json:"url,omitempty"` +} + +type SupportedTrigger struct { + // The default interval to wait between polls (only relevant when NotificationType is Polling). + DefaultPollingInterval *int `json:"defaultPollingInterval,omitempty"` + // How the trigger is notified of changes. + NotificationType *string `json:"notificationType,omitempty"` + // The capabilities supported by this trigger. + SupportedCapabilities *map[string]SupportLevel `json:"supportedCapabilities,omitempty"` + // The type of trigger. + Type *DefinitionTriggerType `json:"type,omitempty"` +} + +type SupportLevel string + +type supportLevelValuesType struct { + Unsupported SupportLevel + Supported SupportLevel + Required SupportLevel +} + +var SupportLevelValues = supportLevelValuesType{ + // The functionality is not supported. + Unsupported: "unsupported", + // The functionality is supported. + Supported: "supported", + // The functionality is required. + Required: "required", +} + +// Represents a Subversion mapping entry. +type SvnMappingDetails struct { + // The depth. + Depth *int `json:"depth,omitempty"` + // Indicates whether to ignore externals. + IgnoreExternals *bool `json:"ignoreExternals,omitempty"` + // The local path. + LocalPath *string `json:"localPath,omitempty"` + // The revision. + Revision *string `json:"revision,omitempty"` + // The server path. + ServerPath *string `json:"serverPath,omitempty"` +} + +// Represents a subversion workspace. +type SvnWorkspace struct { + Mappings *[]SvnMappingDetails `json:"mappings,omitempty"` +} + +// Represents a reference to an agent pool. +type TaskAgentPoolReference struct { + // The pool ID. + Id *int `json:"id,omitempty"` + // A value indicating whether or not this pool is managed by the service. + IsHosted *bool `json:"isHosted,omitempty"` + // The pool name. + Name *string `json:"name,omitempty"` +} + +// A reference to a task definition. +type TaskDefinitionReference struct { + // The type of task (task or task group). + DefinitionType *string `json:"definitionType,omitempty"` + // The ID of the task. + Id *uuid.UUID `json:"id,omitempty"` + // The version of the task. + VersionSpec *string `json:"versionSpec,omitempty"` +} + +// Represents a reference to a plan group. +type TaskOrchestrationPlanGroupReference struct { + // The name of the plan group. + PlanGroup *string `json:"planGroup,omitempty"` + // The project ID. + ProjectId *uuid.UUID `json:"projectId,omitempty"` +} + +type TaskOrchestrationPlanGroupsStartedEvent struct { + PlanGroups *[]TaskOrchestrationPlanGroupReference `json:"planGroups,omitempty"` +} + +// Represents a reference to an orchestration plan. +type TaskOrchestrationPlanReference struct { + // The type of the plan. + OrchestrationType *int `json:"orchestrationType,omitempty"` + // The ID of the plan. + PlanId *uuid.UUID `json:"planId,omitempty"` +} + +// Represents a reference to a task. +type TaskReference struct { + // The ID of the task definition. + Id *uuid.UUID `json:"id,omitempty"` + // The name of the task definition. + Name *string `json:"name,omitempty"` + // The version of the task definition. + Version *string `json:"version,omitempty"` +} + +type TaskResult string + +type taskResultValuesType struct { + Succeeded TaskResult + SucceededWithIssues TaskResult + Failed TaskResult + Canceled TaskResult + Skipped TaskResult + Abandoned TaskResult +} + +var TaskResultValues = taskResultValuesType{ + Succeeded: "succeeded", + SucceededWithIssues: "succeededWithIssues", + Failed: "failed", + Canceled: "canceled", + Skipped: "skipped", + Abandoned: "abandoned", +} + +// Represents the timeline of a build. +type Timeline struct { + // The change ID. + ChangeId *int `json:"changeId,omitempty"` + // The ID of the timeline. + Id *uuid.UUID `json:"id,omitempty"` + // The REST URL of the timeline. + Url *string `json:"url,omitempty"` + // The process or person that last changed the timeline. + LastChangedBy *uuid.UUID `json:"lastChangedBy,omitempty"` + // The time the timeline was last changed. + LastChangedOn *azuredevops.Time `json:"lastChangedOn,omitempty"` + Records *[]TimelineRecord `json:"records,omitempty"` +} + +type TimelineAttempt struct { + // Gets or sets the attempt of the record. + Attempt *int `json:"attempt,omitempty"` + // Gets or sets the record identifier located within the specified timeline. + RecordId *uuid.UUID `json:"recordId,omitempty"` + // Gets or sets the timeline identifier which owns the record representing this attempt. + TimelineId *uuid.UUID `json:"timelineId,omitempty"` +} + +// Represents an entry in a build's timeline. +type TimelineRecord struct { + Links interface{} `json:"_links,omitempty"` + // Attempt number of record. + Attempt *int `json:"attempt,omitempty"` + // The change ID. + ChangeId *int `json:"changeId,omitempty"` + // A string that indicates the current operation. + CurrentOperation *string `json:"currentOperation,omitempty"` + // A reference to a sub-timeline. + Details *TimelineReference `json:"details,omitempty"` + // The number of errors produced by this operation. + ErrorCount *int `json:"errorCount,omitempty"` + // The finish time. + FinishTime *azuredevops.Time `json:"finishTime,omitempty"` + // The ID of the record. + Id *uuid.UUID `json:"id,omitempty"` + // String identifier that is consistent across attempts. + Identifier *string `json:"identifier,omitempty"` + Issues *[]Issue `json:"issues,omitempty"` + // The time the record was last modified. + LastModified *azuredevops.Time `json:"lastModified,omitempty"` + // A reference to the log produced by this operation. + Log *BuildLogReference `json:"log,omitempty"` + // The name. + Name *string `json:"name,omitempty"` + // An ordinal value relative to other records. + Order *int `json:"order,omitempty"` + // The ID of the record's parent. + ParentId *uuid.UUID `json:"parentId,omitempty"` + // The current completion percentage. + PercentComplete *int `json:"percentComplete,omitempty"` + PreviousAttempts *[]TimelineAttempt `json:"previousAttempts,omitempty"` + // The result. + Result *TaskResult `json:"result,omitempty"` + // The result code. + ResultCode *string `json:"resultCode,omitempty"` + // The start time. + StartTime *azuredevops.Time `json:"startTime,omitempty"` + // The state of the record. + State *TimelineRecordState `json:"state,omitempty"` + // A reference to the task represented by this timeline record. + Task *TaskReference `json:"task,omitempty"` + // The type of the record. + Type *string `json:"type,omitempty"` + // The REST URL of the timeline record. + Url *string `json:"url,omitempty"` + // The number of warnings produced by this operation. + WarningCount *int `json:"warningCount,omitempty"` + // The name of the agent running the operation. + WorkerName *string `json:"workerName,omitempty"` +} + +type TimelineRecordState string + +type timelineRecordStateValuesType struct { + Pending TimelineRecordState + InProgress TimelineRecordState + Completed TimelineRecordState +} + +var TimelineRecordStateValues = timelineRecordStateValuesType{ + Pending: "pending", + InProgress: "inProgress", + Completed: "completed", +} + +type TimelineRecordsUpdatedEvent struct { + BuildId *int `json:"buildId,omitempty"` + TimelineRecords *[]TimelineRecord `json:"timelineRecords,omitempty"` +} + +// Represents a reference to a timeline. +type TimelineReference struct { + // The change ID. + ChangeId *int `json:"changeId,omitempty"` + // The ID of the timeline. + Id *uuid.UUID `json:"id,omitempty"` + // The REST URL of the timeline. + Url *string `json:"url,omitempty"` +} + +type ValidationResult string + +type validationResultValuesType struct { + Ok ValidationResult + Warning ValidationResult + Error ValidationResult +} + +var ValidationResultValues = validationResultValuesType{ + Ok: "ok", + Warning: "warning", + Error: "error", +} + +// Represents a variable group. +type VariableGroup struct { + // The Name of the variable group. + Alias *string `json:"alias,omitempty"` + // The ID of the variable group. + Id *int `json:"id,omitempty"` + // The description. + Description *string `json:"description,omitempty"` + // The name of the variable group. + Name *string `json:"name,omitempty"` + // The type of the variable group. + Type *string `json:"type,omitempty"` + Variables *map[string]BuildDefinitionVariable `json:"variables,omitempty"` +} + +// Represents a reference to a variable group. +type VariableGroupReference struct { + // The Name of the variable group. + Alias *string `json:"alias,omitempty"` + // The ID of the variable group. + Id *int `json:"id,omitempty"` +} + +// Represents options for running a phase based on values specified by a list of variables. +type VariableMultipliersAgentExecutionOptions struct { + // Indicates the type of execution options. + Type *int `json:"type,omitempty"` + // Indicates whether failure on one agent should prevent the phase from running on other agents. + ContinueOnError *bool `json:"continueOnError,omitempty"` + // The maximum number of agents to use in parallel. + MaxConcurrency *int `json:"maxConcurrency,omitempty"` + Multipliers *[]string `json:"multipliers,omitempty"` +} + +// Represents options for running a phase based on values specified by a list of variables. +type VariableMultipliersServerExecutionOptions struct { + // The type. + Type *int `json:"type,omitempty"` + // Indicates whether failure of one job should prevent the phase from running in other jobs. + ContinueOnError *bool `json:"continueOnError,omitempty"` + // The maximum number of server jobs to run in parallel. + MaxConcurrency *int `json:"maxConcurrency,omitempty"` + Multipliers *[]string `json:"multipliers,omitempty"` +} + +// Mapping for a workspace +type WorkspaceMapping struct { + // Uri of the associated definition + DefinitionUri *string `json:"definitionUri,omitempty"` + // Depth of this mapping + Depth *int `json:"depth,omitempty"` + // local location of the definition + LocalItem *string `json:"localItem,omitempty"` + // type of workspace mapping + MappingType *WorkspaceMappingType `json:"mappingType,omitempty"` + // Server location of the definition + ServerItem *string `json:"serverItem,omitempty"` + // Id of the workspace + WorkspaceId *int `json:"workspaceId,omitempty"` +} + +type WorkspaceMappingType string + +type workspaceMappingTypeValuesType struct { + Map WorkspaceMappingType + Cloak WorkspaceMappingType +} + +var WorkspaceMappingTypeValues = workspaceMappingTypeValuesType{ + // The path is mapped in the workspace. + Map: "map", + // The path is cloaked in the workspace. + Cloak: "cloak", +} + +type WorkspaceTemplate struct { + // Uri of the associated definition + DefinitionUri *string `json:"definitionUri,omitempty"` + // The identity that last modified this template + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // The last time this template was modified + LastModifiedDate *azuredevops.Time `json:"lastModifiedDate,omitempty"` + // List of workspace mappings + Mappings *[]WorkspaceMapping `json:"mappings,omitempty"` + // Id of the workspace for this template + WorkspaceId *int `json:"workspaceId,omitempty"` +} + +type XamlBuildControllerReference struct { + // Id of the resource + Id *int `json:"id,omitempty"` + // Name of the linked resource (definition name, controller name, etc.) + Name *string `json:"name,omitempty"` + // Full http link to the resource + Url *string `json:"url,omitempty"` +} + +type XamlBuildDefinition struct { + // The date this version of the definition was created. + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + // The ID of the referenced definition. + Id *int `json:"id,omitempty"` + // The name of the referenced definition. + Name *string `json:"name,omitempty"` + // The folder path of the definition. + Path *string `json:"path,omitempty"` + // A reference to the project. + Project *core.TeamProjectReference `json:"project,omitempty"` + // A value that indicates whether builds can be queued against this definition. + QueueStatus *DefinitionQueueStatus `json:"queueStatus,omitempty"` + // The definition revision number. + Revision *int `json:"revision,omitempty"` + // The type of the definition. + Type *DefinitionType `json:"type,omitempty"` + // The definition's URI. + Uri *string `json:"uri,omitempty"` + // The REST URL of the definition. + Url *string `json:"url,omitempty"` + Links interface{} `json:"_links,omitempty"` + // Batch size of the definition + BatchSize *int `json:"batchSize,omitempty"` + BuildArgs *string `json:"buildArgs,omitempty"` + // The continuous integration quiet period + ContinuousIntegrationQuietPeriod *int `json:"continuousIntegrationQuietPeriod,omitempty"` + // The build controller + Controller *BuildController `json:"controller,omitempty"` + // The date this definition was created + CreatedOn *azuredevops.Time `json:"createdOn,omitempty"` + // Default drop location for builds from this definition + DefaultDropLocation *string `json:"defaultDropLocation,omitempty"` + // Description of the definition + Description *string `json:"description,omitempty"` + // The last build on this definition + LastBuild *XamlBuildReference `json:"lastBuild,omitempty"` + // The repository + Repository *BuildRepository `json:"repository,omitempty"` + // The reasons supported by the template + SupportedReasons *BuildReason `json:"supportedReasons,omitempty"` + // How builds are triggered from this definition + TriggerType *DefinitionTriggerType `json:"triggerType,omitempty"` +} + +type XamlBuildReference struct { + // Id of the resource + Id *int `json:"id,omitempty"` + // Name of the linked resource (definition name, controller name, etc.) + Name *string `json:"name,omitempty"` + // Full http link to the resource + Url *string `json:"url,omitempty"` +} + +type XamlBuildServerReference struct { + // Id of the resource + Id *int `json:"id,omitempty"` + // Name of the linked resource (definition name, controller name, etc.) + Name *string `json:"name,omitempty"` + // Full http link to the resource + Url *string `json:"url,omitempty"` +} + +type XamlDefinitionReference struct { + // Id of the resource + Id *int `json:"id,omitempty"` + // Name of the linked resource (definition name, controller name, etc.) + Name *string `json:"name,omitempty"` + // Full http link to the resource + Url *string `json:"url,omitempty"` +} + +// Represents a YAML process. +type YamlProcess struct { + Errors *[]string `json:"errors,omitempty"` + // The resources used by the build definition. + Resources *BuildProcessResources `json:"resources,omitempty"` + // The YAML filename. + YamlFilename *string `json:"yamlFilename,omitempty"` +} diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/client.go b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/client.go new file mode 100644 index 00000000..4e2afd99 --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/client.go @@ -0,0 +1,417 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azuredevops + +import ( + "bytes" + "context" + "encoding/json" + "github.com/google/uuid" + "io" + "io/ioutil" + "net/http" + "net/url" + "regexp" + "runtime" + "strings" + "sync" +) + +const ( + // header keys + headerKeyAccept = "Accept" + headerKeyAuthorization = "Authorization" + headerKeyContentType = "Content-Type" + HeaderKeyContinuationToken = "X-MS-ContinuationToken" + headerKeyFedAuthRedirect = "X-TFS-FedAuthRedirect" + headerKeyForceMsaPassThrough = "X-VSS-ForceMsaPassThrough" + headerKeySession = "X-TFS-Session" + headerUserAgent = "User-Agent" + + // media types + MediaTypeTextPlain = "text/plain" + MediaTypeApplicationJson = "application/json" +) + +// Unique session id to be used by all requests of this session. +var SessionId = uuid.New().String() + +// ApiResourceLocation Cache by Url +var apiResourceLocationCache = make(map[string]*map[uuid.UUID]ApiResourceLocation) +var apiResourceLocationCacheLock = sync.RWMutex{} + +// Base user agent string. The UserAgent set on the connection will be appended to this. +var baseUserAgent = "go/" + runtime.Version() + " (" + runtime.GOOS + " " + runtime.GOARCH + ") azure-devops-go-api/0.0.0" // todo: get real version + +func NewClient(connection *Connection, baseUrl string) *Client { + client := &http.Client{} + if connection.Timeout != nil { + client.Timeout = *connection.Timeout + } + return &Client{ + baseUrl: baseUrl, + client: client, + authorization: connection.AuthorizationString, + suppressFedAuthRedirect: connection.SuppressFedAuthRedirect, + forceMsaPassThrough: connection.ForceMsaPassThrough, + userAgent: connection.UserAgent, + } +} + +type Client struct { + baseUrl string + client *http.Client + authorization string + suppressFedAuthRedirect bool + forceMsaPassThrough bool + userAgent string +} + +func (client *Client) SendRequest(request *http.Request) (response *http.Response, err error) { + resp, err := client.client.Do(request) // todo: add retry logic + if resp != nil && (resp.StatusCode < 200 || resp.StatusCode >= 300) { + err = client.UnwrapError(resp) + } + return resp, err +} + +func (client *Client) Send(ctx context.Context, + httpMethod string, + locationId uuid.UUID, + apiVersion string, + routeValues map[string]string, + queryParameters url.Values, + body io.Reader, + mediaType string, + acceptMediaType string, + additionalHeaders map[string]string) (response *http.Response, err error) { + location, err := client.getResourceLocation(ctx, locationId) + if err != nil { + return nil, err + } + generatedUrl := client.GenerateUrl(location, routeValues, queryParameters) + fullUrl := combineUrl(client.baseUrl, generatedUrl) + negotiatedVersion, err := negotiateRequestVersion(location, apiVersion) + if err != nil { + return nil, err + } + + req, err := client.CreateRequestMessage(ctx, httpMethod, fullUrl, negotiatedVersion, body, mediaType, acceptMediaType, additionalHeaders) + if err != nil { + return nil, err + } + + resp, err := client.SendRequest(req) + if err != nil { + return nil, err + } + + // Set session if one was supplied in the response. + session, ok := resp.Header[headerKeySession] + if ok && len(session) > 0 { + SessionId = session[0] + } + + return resp, err +} + +func (client *Client) GenerateUrl(apiResourceLocation *ApiResourceLocation, routeValues map[string]string, queryParameters url.Values) (request string) { + builtUrl := *apiResourceLocation.RouteTemplate + if routeValues == nil { + routeValues = make(map[string]string) + } + routeValues["area"] = *apiResourceLocation.Area + routeValues["resource"] = *apiResourceLocation.ResourceName + builtUrl = transformRouteTemplate(builtUrl, routeValues) + if queryParameters != nil && len(queryParameters) > 0 { + builtUrl += "?" + queryParameters.Encode() + } + return builtUrl +} + +func (client *Client) CreateRequestMessage(ctx context.Context, + httpMethod string, + url string, + apiVersion string, + body io.Reader, + mediaType string, + acceptMediaType string, + additionalHeaders map[string]string) (request *http.Request, err error) { + req, err := http.NewRequest(httpMethod, url, body) + if err != nil { + return nil, err + } + + if ctx != nil { + req = req.WithContext(ctx) + } + + if client.authorization != "" { + req.Header.Add(headerKeyAuthorization, client.authorization) + } + accept := acceptMediaType + if apiVersion != "" { + accept += ";api-version=" + apiVersion + } + req.Header.Add(headerKeyAccept, accept) + if mediaType != "" { + req.Header.Add(headerKeyContentType, mediaType+";charset=utf-8") + } + if client.suppressFedAuthRedirect { + req.Header.Add(headerKeyFedAuthRedirect, "Suppress") + } + if client.forceMsaPassThrough { + req.Header.Add(headerKeyForceMsaPassThrough, "true") + } + + // set session if it has not already been set + _, ok := req.Header[headerKeySession] + if !ok { + req.Header.Add(headerKeySession, SessionId) + } + + userAgent := baseUserAgent + if client.userAgent != "" { + userAgent += " " + client.userAgent + } + req.Header.Add(headerUserAgent, userAgent) + + for key, value := range additionalHeaders { + req.Header.Add(key, value) + } + + return req, err +} + +func (client *Client) getResourceLocation(ctx context.Context, locationId uuid.UUID) (*ApiResourceLocation, error) { + locationsMap, ok := getApiResourceLocationCache(client.baseUrl) + if !ok { + locations, err := client.getResourceLocationsFromServer(ctx) + if err != nil { + return nil, err + } + newMap := make(map[uuid.UUID]ApiResourceLocation) + locationsMap = &newMap + for _, locationEntry := range locations { + (*locationsMap)[*locationEntry.Id] = locationEntry + } + + setApiResourceLocationCache(client.baseUrl, locationsMap) + } + + location, ok := (*locationsMap)[locationId] + if ok { + return &location, nil + } + + return nil, &LocationIdNotRegisteredError{locationId, client.baseUrl} +} + +func getApiResourceLocationCache(url string) (*map[uuid.UUID]ApiResourceLocation, bool) { + apiResourceLocationCacheLock.RLock() + defer apiResourceLocationCacheLock.RUnlock() + locationsMap, ok := apiResourceLocationCache[url] + return locationsMap, ok +} + +func setApiResourceLocationCache(url string, locationsMap *map[uuid.UUID]ApiResourceLocation) { + apiResourceLocationCacheLock.Lock() + defer apiResourceLocationCacheLock.Unlock() + apiResourceLocationCache[url] = locationsMap +} + +func (client *Client) getResourceLocationsFromServer(ctx context.Context) ([]ApiResourceLocation, error) { + optionsUri := combineUrl(client.baseUrl, "_apis") + request, err := client.CreateRequestMessage(ctx, http.MethodOptions, optionsUri, "", nil, "", MediaTypeApplicationJson, nil) + if err != nil { + return nil, err + } + + resp, err := client.SendRequest(request) + if err != nil { + return nil, err + } + + // Set session if one was supplied in the response. + session, ok := resp.Header[headerKeySession] + if ok && len(session) > 0 { + SessionId = session[0] + } + + if resp != nil && (resp.StatusCode < 200 || resp.StatusCode >= 300) { + return nil, client.UnwrapError(resp) + } + + var locations []ApiResourceLocation + err = client.UnmarshalCollectionBody(resp, &locations) + + return locations, err +} + +// Examples of api-version: 5.1, 5.1-preview, 5.1-preview.1 +var apiVersionRegEx = regexp.MustCompile(`(\d+(\.\d)?)(-preview(.(\d+))?)?`) + +func combineUrl(part1 string, part2 string) string { + return strings.TrimRight(part1, "/") + "/" + strings.TrimLeft(part2, "/") +} + +func transformRouteTemplate(routeTemplate string, routeValues map[string]string) string { + newTemplate := "" + routeTemplate = strings.Replace(routeTemplate, "{*", "{", -1) + segments := strings.Split(routeTemplate, "/") + for _, segment := range segments { + length := len(segment) + if length <= 2 || segment[0] != '{' || segment[length-1] != '}' { + newTemplate += "/" + segment + } else { + value, ok := routeValues[segment[1:length-1]] + if ok { + newTemplate += "/" + url.PathEscape(value) + } + // else this is an optional parameter that has not been supplied, so don't add it back + } + } + // following covers oddball templates with segments that include the token and additional constants + for key, value := range routeValues { + newTemplate = strings.Replace(newTemplate, "{"+key+"}", value, -1) + } + return newTemplate +} + +func (client *Client) UnmarshalBody(response *http.Response, v interface{}) (err error) { + if response != nil && response.Body != nil { + var err error + defer func() { + if closeError := response.Body.Close(); closeError != nil { + err = closeError + } + }() + body, err := ioutil.ReadAll(response.Body) + if err != nil { + return err + } + body = trimByteOrderMark(body) + return json.Unmarshal(body, &v) + } + return nil +} + +func (client *Client) UnmarshalCollectionBody(response *http.Response, v interface{}) (err error) { + if response != nil && response.Body != nil { + var err error + defer func() { + if closeError := response.Body.Close(); closeError != nil { + err = closeError + } + }() + body, err := ioutil.ReadAll(response.Body) + if err != nil { + return err + } + + body = trimByteOrderMark(body) + err = client.UnmarshalCollectionJson(body, v) + } + return nil +} + +func (client *Client) UnmarshalCollectionJson(jsonValue []byte, v interface{}) (err error) { + var wrappedResponse VssJsonCollectionWrapper + err = json.Unmarshal(jsonValue, &wrappedResponse) + if err != nil { + return err + } + + value, err := json.Marshal(wrappedResponse.Value) // todo: investigate better way to do this. + if err != nil { + return err + } + return json.Unmarshal(value, &v) +} + +// Returns slice of body without utf-8 byte order mark. +// If BOM does not exist body is returned unchanged. +func trimByteOrderMark(body []byte) []byte { + return bytes.TrimPrefix(body, []byte("\xef\xbb\xbf")) +} + +func (client *Client) UnwrapError(response *http.Response) (err error) { + if response.ContentLength == 0 { + message := "Request returned status: " + response.Status + return &WrappedError{ + Message: &message, + StatusCode: &response.StatusCode, + } + } + + defer func() { + if closeError := response.Body.Close(); closeError != nil { + err = closeError + } + }() + + body, err := ioutil.ReadAll(response.Body) + if err != nil { + return err + } + + body = trimByteOrderMark(body) + + contentType, ok := response.Header[headerKeyContentType] + if ok && len(contentType) > 0 && strings.Index(contentType[0], MediaTypeTextPlain) >= 0 { + message := string(body) + statusCode := response.StatusCode + return WrappedError{Message: &message, StatusCode: &statusCode} + } + + var wrappedError WrappedError + err = json.Unmarshal(body, &wrappedError) + if err != nil { + return err + } + + if wrappedError.Message == nil { + var wrappedImproperError WrappedImproperError + err = json.Unmarshal(body, &wrappedImproperError) + if err == nil && wrappedImproperError.Value != nil && wrappedImproperError.Value.Message != nil { + statusCode := response.StatusCode + return &WrappedError{ + Message: wrappedImproperError.Value.Message, + StatusCode: &statusCode, + } + } + } + + return wrappedError +} + +func (client *Client) GetResourceAreas(ctx context.Context) (*[]ResourceAreaInfo, error) { + queryParams := url.Values{} + locationId, _ := uuid.Parse("e81700f7-3be2-46de-8624-2eb35882fcaa") + resp, err := client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", nil, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []ResourceAreaInfo + err = client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +type LocationIdNotRegisteredError struct { + LocationId uuid.UUID + Url string +} + +func (e LocationIdNotRegisteredError) Error() string { + return "API resource location " + e.LocationId.String() + " is not registered on " + e.Url + "." +} + +type InvalidApiVersion struct { + ApiVersion string +} + +func (e InvalidApiVersion) Error() string { + return "The requested api-version is not in a valid format: " + e.ApiVersion +} diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/connection.go b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/connection.go new file mode 100644 index 00000000..8b90ee40 --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/connection.go @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azuredevops + +import ( + "context" + "encoding/base64" + "github.com/google/uuid" + "strings" + "sync" + "time" +) + +// Creates a new Azure DevOps connection instance using a personal access token. +func NewPatConnection(organizationUrl string, personalAccessToken string) *Connection { + authorizationString := CreateBasicAuthHeaderValue("", personalAccessToken) + organizationUrl = normalizeUrl(organizationUrl) + return &Connection{ + AuthorizationString: authorizationString, + BaseUrl: organizationUrl, + SuppressFedAuthRedirect: true, + } +} + +func NewAnonymousConnection(organizationUrl string) *Connection { + organizationUrl = normalizeUrl(organizationUrl) + return &Connection{ + BaseUrl: organizationUrl, + SuppressFedAuthRedirect: true, + } +} + +type Connection struct { + AuthorizationString string + BaseUrl string + UserAgent string + SuppressFedAuthRedirect bool + ForceMsaPassThrough bool + Timeout *time.Duration + clientCache map[string]Client + clientCacheLock sync.RWMutex + resourceAreaCache map[uuid.UUID]ResourceAreaInfo + resourceAreaCacheLock sync.RWMutex +} + +func CreateBasicAuthHeaderValue(username, password string) string { + auth := username + ":" + password + return "Basic " + base64.StdEncoding.EncodeToString([]byte(auth)) +} + +func normalizeUrl(url string) string { + return strings.ToLower(strings.TrimRight(url, "/")) +} + +func (connection *Connection) GetClientByResourceAreaId(ctx context.Context, resourceAreaID uuid.UUID) (*Client, error) { + resourceAreaInfo, err := connection.getResourceAreaInfo(ctx, resourceAreaID) + if err != nil { + return nil, err + } + var client *Client + if resourceAreaInfo != nil { + client = connection.GetClientByUrl(*resourceAreaInfo.LocationUrl) + } else { + // resourceAreaInfo will be nil for on prem servers + client = connection.GetClientByUrl(connection.BaseUrl) + } + return client, nil +} + +func (connection *Connection) GetClientByUrl(baseUrl string) *Client { + normalizedUrl := normalizeUrl(baseUrl) + azureDevOpsClient, ok := connection.getClientCacheEntry(normalizedUrl) + if !ok { + azureDevOpsClient = NewClient(connection, normalizedUrl) + connection.setClientCacheEntry(normalizedUrl, azureDevOpsClient) + } + return azureDevOpsClient +} + +func (connection *Connection) getResourceAreaInfo(ctx context.Context, resourceAreaId uuid.UUID) (*ResourceAreaInfo, error) { + resourceAreaInfo, ok := connection.getResourceAreaCacheEntry(resourceAreaId) + if !ok { + client := connection.GetClientByUrl(connection.BaseUrl) + resourceAreaInfos, err := client.GetResourceAreas(ctx) + if err != nil { + return nil, err + } + + if len(*resourceAreaInfos) > 0 { + for _, resourceEntry := range *resourceAreaInfos { + connection.setResourceAreaCacheEntry(*resourceEntry.Id, &resourceEntry) + } + resourceAreaInfo, ok = connection.getResourceAreaCacheEntry(resourceAreaId) + } else { + // on prem servers return an empty list + return nil, nil + } + } + + if ok { + return resourceAreaInfo, nil + } + + return nil, &ResourceAreaIdNotRegisteredError{resourceAreaId, connection.BaseUrl} +} + +// Client Cache by Url +func (connection *Connection) getClientCacheEntry(url string) (*Client, bool) { + if connection.clientCache == nil { + return nil, false + } + connection.clientCacheLock.RLock() + defer connection.clientCacheLock.RUnlock() + client, ok := connection.clientCache[url] + return &client, ok +} + +func (connection *Connection) setClientCacheEntry(url string, client *Client) { + connection.clientCacheLock.Lock() + defer connection.clientCacheLock.Unlock() + if connection.clientCache == nil { + connection.clientCache = make(map[string]Client) + } + connection.clientCache[url] = *client +} + +func (connection *Connection) getResourceAreaCacheEntry(resourceAreaId uuid.UUID) (*ResourceAreaInfo, bool) { + if connection.resourceAreaCache == nil { + return nil, false + } + connection.resourceAreaCacheLock.RLock() + defer connection.resourceAreaCacheLock.RUnlock() + resourceAreaInfo, ok := connection.resourceAreaCache[resourceAreaId] + return &resourceAreaInfo, ok +} + +func (connection *Connection) setResourceAreaCacheEntry(resourceAreaId uuid.UUID, resourceAreaInfo *ResourceAreaInfo) { + connection.resourceAreaCacheLock.Lock() + defer connection.resourceAreaCacheLock.Unlock() + if connection.resourceAreaCache == nil { + connection.resourceAreaCache = make(map[uuid.UUID]ResourceAreaInfo) + } + connection.resourceAreaCache[resourceAreaId] = *resourceAreaInfo +} + +type ResourceAreaIdNotRegisteredError struct { + ResourceAreaId uuid.UUID + Url string +} + +func (e ResourceAreaIdNotRegisteredError) Error() string { + return "API resource area Id " + e.ResourceAreaId.String() + " is not registered on " + e.Url + "." +} diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/core/client.go b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/core/client.go new file mode 100644 index 00000000..0ac180ca --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/core/client.go @@ -0,0 +1,863 @@ +// -------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// -------------------------------------------------------------------------------------------- +// Generated file, DO NOT EDIT +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// -------------------------------------------------------------------------------------------- + +package core + +import ( + "bytes" + "context" + "encoding/json" + "github.com/google/uuid" + "github.com/microsoft/azure-devops-go-api/azuredevops" + "github.com/microsoft/azure-devops-go-api/azuredevops/operations" + "github.com/microsoft/azure-devops-go-api/azuredevops/webapi" + "net/http" + "net/url" + "strconv" + "strings" +) + +var ResourceAreaId, _ = uuid.Parse("79134c72-4a58-4b42-976c-04e7115f32bf") + +type Client struct { + Client azuredevops.Client +} + +func NewClient(ctx context.Context, connection *azuredevops.Connection) (*Client, error) { + client, err := connection.GetClientByResourceAreaId(ctx, ResourceAreaId) + if err != nil { + return nil, err + } + return &Client{ + Client: *client, + }, nil +} + +// [Preview API] Removes the avatar for the project. +func (client *Client) RemoveProjectAvatar(ctx context.Context, args RemoveProjectAvatarArgs) error { + routeValues := make(map[string]string) + if args.ProjectId == nil || *args.ProjectId == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ProjectId"} + } + routeValues["projectId"] = *args.ProjectId + + locationId, _ := uuid.Parse("54b2a2a0-859b-4d05-827c-ec4c862f641a") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the RemoveProjectAvatar function +type RemoveProjectAvatarArgs struct { + // (required) The ID or name of the project. + ProjectId *string +} + +// [Preview API] Sets the avatar for the project. +func (client *Client) SetProjectAvatar(ctx context.Context, args SetProjectAvatarArgs) error { + if args.AvatarBlob == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.AvatarBlob"} + } + routeValues := make(map[string]string) + if args.ProjectId == nil || *args.ProjectId == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ProjectId"} + } + routeValues["projectId"] = *args.ProjectId + + body, marshalErr := json.Marshal(*args.AvatarBlob) + if marshalErr != nil { + return marshalErr + } + locationId, _ := uuid.Parse("54b2a2a0-859b-4d05-827c-ec4c862f641a") + _, err := client.Client.Send(ctx, http.MethodPut, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the SetProjectAvatar function +type SetProjectAvatarArgs struct { + // (required) The avatar blob data object to upload. + AvatarBlob *ProjectAvatar + // (required) The ID or name of the project. + ProjectId *string +} + +// [Preview API] +func (client *Client) CreateConnectedService(ctx context.Context, args CreateConnectedServiceArgs) (*WebApiConnectedService, error) { + if args.ConnectedServiceCreationData == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ConnectedServiceCreationData"} + } + routeValues := make(map[string]string) + if args.ProjectId == nil || *args.ProjectId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ProjectId"} + } + routeValues["projectId"] = *args.ProjectId + + body, marshalErr := json.Marshal(*args.ConnectedServiceCreationData) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("b4f70219-e18b-42c5-abe3-98b07d35525e") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WebApiConnectedService + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateConnectedService function +type CreateConnectedServiceArgs struct { + // (required) + ConnectedServiceCreationData *WebApiConnectedServiceDetails + // (required) + ProjectId *string +} + +// [Preview API] +func (client *Client) GetConnectedServiceDetails(ctx context.Context, args GetConnectedServiceDetailsArgs) (*WebApiConnectedServiceDetails, error) { + routeValues := make(map[string]string) + if args.ProjectId == nil || *args.ProjectId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ProjectId"} + } + routeValues["projectId"] = *args.ProjectId + if args.Name == nil || *args.Name == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Name"} + } + routeValues["name"] = *args.Name + + locationId, _ := uuid.Parse("b4f70219-e18b-42c5-abe3-98b07d35525e") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WebApiConnectedServiceDetails + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetConnectedServiceDetails function +type GetConnectedServiceDetailsArgs struct { + // (required) + ProjectId *string + // (required) + Name *string +} + +// [Preview API] +func (client *Client) GetConnectedServices(ctx context.Context, args GetConnectedServicesArgs) (*[]WebApiConnectedService, error) { + routeValues := make(map[string]string) + if args.ProjectId == nil || *args.ProjectId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ProjectId"} + } + routeValues["projectId"] = *args.ProjectId + + queryParams := url.Values{} + if args.Kind != nil { + queryParams.Add("kind", string(*args.Kind)) + } + locationId, _ := uuid.Parse("b4f70219-e18b-42c5-abe3-98b07d35525e") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []WebApiConnectedService + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetConnectedServices function +type GetConnectedServicesArgs struct { + // (required) + ProjectId *string + // (optional) + Kind *ConnectedServiceKind +} + +// Get a list of members for a specific team. +func (client *Client) GetTeamMembersWithExtendedProperties(ctx context.Context, args GetTeamMembersWithExtendedPropertiesArgs) (*[]webapi.TeamMember, error) { + routeValues := make(map[string]string) + if args.ProjectId == nil || *args.ProjectId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ProjectId"} + } + routeValues["projectId"] = *args.ProjectId + if args.TeamId == nil || *args.TeamId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.TeamId"} + } + routeValues["teamId"] = *args.TeamId + + queryParams := url.Values{} + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + if args.Skip != nil { + queryParams.Add("$skip", strconv.Itoa(*args.Skip)) + } + locationId, _ := uuid.Parse("294c494c-2600-4d7e-b76c-3dd50c3c95be") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []webapi.TeamMember + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTeamMembersWithExtendedProperties function +type GetTeamMembersWithExtendedPropertiesArgs struct { + // (required) The name or ID (GUID) of the team project the team belongs to. + ProjectId *string + // (required) The name or ID (GUID) of the team . + TeamId *string + // (optional) + Top *int + // (optional) + Skip *int +} + +// Get a process by ID. +func (client *Client) GetProcessById(ctx context.Context, args GetProcessByIdArgs) (*Process, error) { + routeValues := make(map[string]string) + if args.ProcessId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ProcessId"} + } + routeValues["processId"] = (*args.ProcessId).String() + + locationId, _ := uuid.Parse("93878975-88c5-4e6a-8abb-7ddd77a8a7d8") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue Process + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetProcessById function +type GetProcessByIdArgs struct { + // (required) ID for a process. + ProcessId *uuid.UUID +} + +// Get a list of processes. +func (client *Client) GetProcesses(ctx context.Context, args GetProcessesArgs) (*[]Process, error) { + locationId, _ := uuid.Parse("93878975-88c5-4e6a-8abb-7ddd77a8a7d8") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", nil, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []Process + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetProcesses function +type GetProcessesArgs struct { +} + +// Get project collection with the specified id or name. +func (client *Client) GetProjectCollection(ctx context.Context, args GetProjectCollectionArgs) (*TeamProjectCollection, error) { + routeValues := make(map[string]string) + if args.CollectionId == nil || *args.CollectionId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.CollectionId"} + } + routeValues["collectionId"] = *args.CollectionId + + locationId, _ := uuid.Parse("8031090f-ef1d-4af6-85fc-698cd75d42bf") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue TeamProjectCollection + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetProjectCollection function +type GetProjectCollectionArgs struct { + // (required) + CollectionId *string +} + +// Get project collection references for this application. +func (client *Client) GetProjectCollections(ctx context.Context, args GetProjectCollectionsArgs) (*[]TeamProjectCollectionReference, error) { + queryParams := url.Values{} + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + if args.Skip != nil { + queryParams.Add("$skip", strconv.Itoa(*args.Skip)) + } + locationId, _ := uuid.Parse("8031090f-ef1d-4af6-85fc-698cd75d42bf") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", nil, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []TeamProjectCollectionReference + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetProjectCollections function +type GetProjectCollectionsArgs struct { + // (optional) + Top *int + // (optional) + Skip *int +} + +// Get project with the specified id or name, optionally including capabilities. +func (client *Client) GetProject(ctx context.Context, args GetProjectArgs) (*TeamProject, error) { + routeValues := make(map[string]string) + if args.ProjectId == nil || *args.ProjectId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ProjectId"} + } + routeValues["projectId"] = *args.ProjectId + + queryParams := url.Values{} + if args.IncludeCapabilities != nil { + queryParams.Add("includeCapabilities", strconv.FormatBool(*args.IncludeCapabilities)) + } + if args.IncludeHistory != nil { + queryParams.Add("includeHistory", strconv.FormatBool(*args.IncludeHistory)) + } + locationId, _ := uuid.Parse("603fe2ac-9723-48b9-88ad-09305aa6c6e1") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue TeamProject + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetProject function +type GetProjectArgs struct { + // (required) + ProjectId *string + // (optional) Include capabilities (such as source control) in the team project result (default: false). + IncludeCapabilities *bool + // (optional) Search within renamed projects (that had such name in the past). + IncludeHistory *bool +} + +// Get all projects in the organization that the authenticated user has access to. +func (client *Client) GetProjects(ctx context.Context, args GetProjectsArgs) (*GetProjectsResponseValue, error) { + queryParams := url.Values{} + if args.StateFilter != nil { + queryParams.Add("stateFilter", string(*args.StateFilter)) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + if args.Skip != nil { + queryParams.Add("$skip", strconv.Itoa(*args.Skip)) + } + if args.ContinuationToken != nil { + queryParams.Add("continuationToken", *args.ContinuationToken) + } + if args.GetDefaultTeamImageUrl != nil { + queryParams.Add("getDefaultTeamImageUrl", strconv.FormatBool(*args.GetDefaultTeamImageUrl)) + } + locationId, _ := uuid.Parse("603fe2ac-9723-48b9-88ad-09305aa6c6e1") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", nil, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GetProjectsResponseValue + responseValue.ContinuationToken = resp.Header.Get(azuredevops.HeaderKeyContinuationToken) + err = client.Client.UnmarshalCollectionBody(resp, &responseValue.Value) + return &responseValue, err +} + +// Arguments for the GetProjects function +type GetProjectsArgs struct { + // (optional) Filter on team projects in a specific team project state (default: WellFormed). + StateFilter *ProjectState + // (optional) + Top *int + // (optional) + Skip *int + // (optional) + ContinuationToken *string + // (optional) + GetDefaultTeamImageUrl *bool +} + +// Return type for the GetProjects function +type GetProjectsResponseValue struct { + Value []TeamProjectReference + // The continuation token to be used to get the next page of results. + ContinuationToken string +} + +// Queues a project to be created. Use the [GetOperation](../../operations/operations/get) to periodically check for create project status. +func (client *Client) QueueCreateProject(ctx context.Context, args QueueCreateProjectArgs) (*operations.OperationReference, error) { + if args.ProjectToCreate == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ProjectToCreate"} + } + body, marshalErr := json.Marshal(*args.ProjectToCreate) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("603fe2ac-9723-48b9-88ad-09305aa6c6e1") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1", nil, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue operations.OperationReference + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the QueueCreateProject function +type QueueCreateProjectArgs struct { + // (required) The project to create. + ProjectToCreate *TeamProject +} + +// Queues a project to be deleted. Use the [GetOperation](../../operations/operations/get) to periodically check for delete project status. +func (client *Client) QueueDeleteProject(ctx context.Context, args QueueDeleteProjectArgs) (*operations.OperationReference, error) { + routeValues := make(map[string]string) + if args.ProjectId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ProjectId"} + } + routeValues["projectId"] = (*args.ProjectId).String() + + locationId, _ := uuid.Parse("603fe2ac-9723-48b9-88ad-09305aa6c6e1") + resp, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue operations.OperationReference + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the QueueDeleteProject function +type QueueDeleteProjectArgs struct { + // (required) The project id of the project to delete. + ProjectId *uuid.UUID +} + +// Update an existing project's name, abbreviation, description, or restore a project. +func (client *Client) UpdateProject(ctx context.Context, args UpdateProjectArgs) (*operations.OperationReference, error) { + if args.ProjectUpdate == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ProjectUpdate"} + } + routeValues := make(map[string]string) + if args.ProjectId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ProjectId"} + } + routeValues["projectId"] = (*args.ProjectId).String() + + body, marshalErr := json.Marshal(*args.ProjectUpdate) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("603fe2ac-9723-48b9-88ad-09305aa6c6e1") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue operations.OperationReference + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateProject function +type UpdateProjectArgs struct { + // (required) The updates for the project. The state must be set to wellFormed to restore the project. + ProjectUpdate *TeamProject + // (required) The project id of the project to update. + ProjectId *uuid.UUID +} + +// [Preview API] Get a collection of team project properties. +func (client *Client) GetProjectProperties(ctx context.Context, args GetProjectPropertiesArgs) (*[]ProjectProperty, error) { + routeValues := make(map[string]string) + if args.ProjectId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ProjectId"} + } + routeValues["projectId"] = (*args.ProjectId).String() + + queryParams := url.Values{} + if args.Keys != nil { + listAsString := strings.Join((*args.Keys)[:], ",") + queryParams.Add("keys", listAsString) + } + locationId, _ := uuid.Parse("4976a71a-4487-49aa-8aab-a1eda469037a") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []ProjectProperty + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetProjectProperties function +type GetProjectPropertiesArgs struct { + // (required) The team project ID. + ProjectId *uuid.UUID + // (optional) A comma-delimited string of team project property names. Wildcard characters ("?" and "*") are supported. If no key is specified, all properties will be returned. + Keys *[]string +} + +// [Preview API] Create, update, and delete team project properties. +func (client *Client) SetProjectProperties(ctx context.Context, args SetProjectPropertiesArgs) error { + if args.PatchDocument == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.PatchDocument"} + } + routeValues := make(map[string]string) + if args.ProjectId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.ProjectId"} + } + routeValues["projectId"] = (*args.ProjectId).String() + + body, marshalErr := json.Marshal(*args.PatchDocument) + if marshalErr != nil { + return marshalErr + } + locationId, _ := uuid.Parse("4976a71a-4487-49aa-8aab-a1eda469037a") + _, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json-patch+json", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the SetProjectProperties function +type SetProjectPropertiesArgs struct { + // (required) The team project ID. + ProjectId *uuid.UUID + // (required) A JSON Patch document that represents an array of property operations. See RFC 6902 for more details on JSON Patch. The accepted operation verbs are Add and Remove, where Add is used for both creating and updating properties. The path consists of a forward slash and a property name. + PatchDocument *[]webapi.JsonPatchOperation +} + +// [Preview API] +func (client *Client) CreateOrUpdateProxy(ctx context.Context, args CreateOrUpdateProxyArgs) (*Proxy, error) { + if args.Proxy == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Proxy"} + } + body, marshalErr := json.Marshal(*args.Proxy) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("ec1f4311-f2b4-4c15-b2b8-8990b80d2908") + resp, err := client.Client.Send(ctx, http.MethodPut, locationId, "5.1-preview.2", nil, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue Proxy + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateOrUpdateProxy function +type CreateOrUpdateProxyArgs struct { + // (required) + Proxy *Proxy +} + +// [Preview API] +func (client *Client) DeleteProxy(ctx context.Context, args DeleteProxyArgs) error { + queryParams := url.Values{} + if args.ProxyUrl == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "proxyUrl"} + } + queryParams.Add("proxyUrl", *args.ProxyUrl) + if args.Site != nil { + queryParams.Add("site", *args.Site) + } + locationId, _ := uuid.Parse("ec1f4311-f2b4-4c15-b2b8-8990b80d2908") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1-preview.2", nil, queryParams, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeleteProxy function +type DeleteProxyArgs struct { + // (required) + ProxyUrl *string + // (optional) + Site *string +} + +// [Preview API] +func (client *Client) GetProxies(ctx context.Context, args GetProxiesArgs) (*[]Proxy, error) { + queryParams := url.Values{} + if args.ProxyUrl != nil { + queryParams.Add("proxyUrl", *args.ProxyUrl) + } + locationId, _ := uuid.Parse("ec1f4311-f2b4-4c15-b2b8-8990b80d2908") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.2", nil, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []Proxy + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetProxies function +type GetProxiesArgs struct { + // (optional) + ProxyUrl *string +} + +// Create a team in a team project. +func (client *Client) CreateTeam(ctx context.Context, args CreateTeamArgs) (*WebApiTeam, error) { + if args.Team == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Team"} + } + routeValues := make(map[string]string) + if args.ProjectId == nil || *args.ProjectId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ProjectId"} + } + routeValues["projectId"] = *args.ProjectId + + body, marshalErr := json.Marshal(*args.Team) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("d30a3dd1-f8ba-442a-b86a-bd0c0c383e59") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WebApiTeam + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateTeam function +type CreateTeamArgs struct { + // (required) The team data used to create the team. + Team *WebApiTeam + // (required) The name or ID (GUID) of the team project in which to create the team. + ProjectId *string +} + +// Delete a team. +func (client *Client) DeleteTeam(ctx context.Context, args DeleteTeamArgs) error { + routeValues := make(map[string]string) + if args.ProjectId == nil || *args.ProjectId == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ProjectId"} + } + routeValues["projectId"] = *args.ProjectId + if args.TeamId == nil || *args.TeamId == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.TeamId"} + } + routeValues["teamId"] = *args.TeamId + + locationId, _ := uuid.Parse("d30a3dd1-f8ba-442a-b86a-bd0c0c383e59") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeleteTeam function +type DeleteTeamArgs struct { + // (required) The name or ID (GUID) of the team project containing the team to delete. + ProjectId *string + // (required) The name or ID of the team to delete. + TeamId *string +} + +// Get a specific team. +func (client *Client) GetTeam(ctx context.Context, args GetTeamArgs) (*WebApiTeam, error) { + routeValues := make(map[string]string) + if args.ProjectId == nil || *args.ProjectId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ProjectId"} + } + routeValues["projectId"] = *args.ProjectId + if args.TeamId == nil || *args.TeamId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.TeamId"} + } + routeValues["teamId"] = *args.TeamId + + queryParams := url.Values{} + if args.ExpandIdentity != nil { + queryParams.Add("$expandIdentity", strconv.FormatBool(*args.ExpandIdentity)) + } + locationId, _ := uuid.Parse("d30a3dd1-f8ba-442a-b86a-bd0c0c383e59") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WebApiTeam + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTeam function +type GetTeamArgs struct { + // (required) The name or ID (GUID) of the team project containing the team. + ProjectId *string + // (required) The name or ID (GUID) of the team. + TeamId *string + // (optional) A value indicating whether or not to expand Identity information in the result WebApiTeam object. + ExpandIdentity *bool +} + +// Get a list of teams. +func (client *Client) GetTeams(ctx context.Context, args GetTeamsArgs) (*[]WebApiTeam, error) { + routeValues := make(map[string]string) + if args.ProjectId == nil || *args.ProjectId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ProjectId"} + } + routeValues["projectId"] = *args.ProjectId + + queryParams := url.Values{} + if args.Mine != nil { + queryParams.Add("$mine", strconv.FormatBool(*args.Mine)) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + if args.Skip != nil { + queryParams.Add("$skip", strconv.Itoa(*args.Skip)) + } + if args.ExpandIdentity != nil { + queryParams.Add("$expandIdentity", strconv.FormatBool(*args.ExpandIdentity)) + } + locationId, _ := uuid.Parse("d30a3dd1-f8ba-442a-b86a-bd0c0c383e59") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []WebApiTeam + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTeams function +type GetTeamsArgs struct { + // (required) + ProjectId *string + // (optional) If true return all the teams requesting user is member, otherwise return all the teams user has read access. + Mine *bool + // (optional) Maximum number of teams to return. + Top *int + // (optional) Number of teams to skip. + Skip *int + // (optional) A value indicating whether or not to expand Identity information in the result WebApiTeam object. + ExpandIdentity *bool +} + +// Update a team's name and/or description. +func (client *Client) UpdateTeam(ctx context.Context, args UpdateTeamArgs) (*WebApiTeam, error) { + if args.TeamData == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TeamData"} + } + routeValues := make(map[string]string) + if args.ProjectId == nil || *args.ProjectId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ProjectId"} + } + routeValues["projectId"] = *args.ProjectId + if args.TeamId == nil || *args.TeamId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.TeamId"} + } + routeValues["teamId"] = *args.TeamId + + body, marshalErr := json.Marshal(*args.TeamData) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("d30a3dd1-f8ba-442a-b86a-bd0c0c383e59") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WebApiTeam + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateTeam function +type UpdateTeamArgs struct { + // (required) + TeamData *WebApiTeam + // (required) The name or ID (GUID) of the team project containing the team to update. + ProjectId *string + // (required) The name of ID of the team to update. + TeamId *string +} + +// [Preview API] Get a list of all teams. +func (client *Client) GetAllTeams(ctx context.Context, args GetAllTeamsArgs) (*[]WebApiTeam, error) { + queryParams := url.Values{} + if args.Mine != nil { + queryParams.Add("$mine", strconv.FormatBool(*args.Mine)) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + if args.Skip != nil { + queryParams.Add("$skip", strconv.Itoa(*args.Skip)) + } + if args.ExpandIdentity != nil { + queryParams.Add("$expandIdentity", strconv.FormatBool(*args.ExpandIdentity)) + } + locationId, _ := uuid.Parse("7a4d9ee9-3433-4347-b47a-7a80f1cf307e") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.3", nil, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []WebApiTeam + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetAllTeams function +type GetAllTeamsArgs struct { + // (optional) If true, then return all teams requesting user is member. Otherwise return all teams user has read access. + Mine *bool + // (optional) Maximum number of teams to return. + Top *int + // (optional) Number of teams to skip. + Skip *int + // (optional) A value indicating whether or not to expand Identity information in the result WebApiTeam object. + ExpandIdentity *bool +} diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/core/models.go b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/core/models.go new file mode 100644 index 00000000..e7564104 --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/core/models.go @@ -0,0 +1,483 @@ +// -------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// -------------------------------------------------------------------------------------------- +// Generated file, DO NOT EDIT +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// -------------------------------------------------------------------------------------------- + +package core + +import ( + "github.com/google/uuid" + "github.com/microsoft/azure-devops-go-api/azuredevops" + "github.com/microsoft/azure-devops-go-api/azuredevops/identity" + "github.com/microsoft/azure-devops-go-api/azuredevops/webapi" +) + +type ConnectedServiceKind string + +type connectedServiceKindValuesType struct { + Custom ConnectedServiceKind + AzureSubscription ConnectedServiceKind + Chef ConnectedServiceKind + Generic ConnectedServiceKind +} + +var ConnectedServiceKindValues = connectedServiceKindValuesType{ + // Custom or unknown service + Custom: "custom", + // Azure Subscription + AzureSubscription: "azureSubscription", + // Chef Connection + Chef: "chef", + // Generic Connection + Generic: "generic", +} + +type IdentityData struct { + IdentityIds *[]uuid.UUID `json:"identityIds,omitempty"` +} + +type Process struct { + Name *string `json:"name,omitempty"` + Url *string `json:"url,omitempty"` + Links interface{} `json:"_links,omitempty"` + Description *string `json:"description,omitempty"` + Id *uuid.UUID `json:"id,omitempty"` + IsDefault *bool `json:"isDefault,omitempty"` + Type *ProcessType `json:"type,omitempty"` +} + +// Type of process customization on a collection. +type ProcessCustomizationType string + +type processCustomizationTypeValuesType struct { + Xml ProcessCustomizationType + Inherited ProcessCustomizationType +} + +var ProcessCustomizationTypeValues = processCustomizationTypeValuesType{ + // Customization based on project-scoped xml customization + Xml: "xml", + // Customization based on process inheritance + Inherited: "inherited", +} + +type ProcessReference struct { + Name *string `json:"name,omitempty"` + Url *string `json:"url,omitempty"` +} + +type ProcessType string + +type processTypeValuesType struct { + System ProcessType + Custom ProcessType + Inherited ProcessType +} + +var ProcessTypeValues = processTypeValuesType{ + System: "system", + Custom: "custom", + Inherited: "inherited", +} + +// Contains the image data for project avatar. +type ProjectAvatar struct { + // The avatar image represented as a byte array. + Image *[]byte `json:"image,omitempty"` +} + +type ProjectChangeType string + +type projectChangeTypeValuesType struct { + Modified ProjectChangeType + Deleted ProjectChangeType + Added ProjectChangeType +} + +var ProjectChangeTypeValues = projectChangeTypeValuesType{ + Modified: "modified", + Deleted: "deleted", + Added: "added", +} + +// Contains information describing a project. +type ProjectInfo struct { + // The abbreviated name of the project. + Abbreviation *string `json:"abbreviation,omitempty"` + // The description of the project. + Description *string `json:"description,omitempty"` + // The id of the project. + Id *uuid.UUID `json:"id,omitempty"` + // The time that this project was last updated. + LastUpdateTime *azuredevops.Time `json:"lastUpdateTime,omitempty"` + // The name of the project. + Name *string `json:"name,omitempty"` + // A set of name-value pairs storing additional property data related to the project. + Properties *[]ProjectProperty `json:"properties,omitempty"` + // The current revision of the project. + Revision *uint64 `json:"revision,omitempty"` + // The current state of the project. + State *ProjectState `json:"state,omitempty"` + // A Uri that can be used to refer to this project. + Uri *string `json:"uri,omitempty"` + // The version number of the project. + Version *uint64 `json:"version,omitempty"` + // Indicates whom the project is visible to. + Visibility *ProjectVisibility `json:"visibility,omitempty"` +} + +type ProjectMessage struct { + Project *ProjectInfo `json:"project,omitempty"` + ProjectChangeType *ProjectChangeType `json:"projectChangeType,omitempty"` + ShouldInvalidateSystemStore *bool `json:"shouldInvalidateSystemStore,omitempty"` +} + +type ProjectProperties struct { + // The team project Id + ProjectId *uuid.UUID `json:"projectId,omitempty"` + // The collection of team project properties + Properties *[]ProjectProperty `json:"properties,omitempty"` +} + +// A named value associated with a project. +type ProjectProperty struct { + // The name of the property. + Name *string `json:"name,omitempty"` + // The value of the property. + Value interface{} `json:"value,omitempty"` +} + +type ProjectState string + +type projectStateValuesType struct { + Deleting ProjectState + New ProjectState + WellFormed ProjectState + CreatePending ProjectState + All ProjectState + Unchanged ProjectState + Deleted ProjectState +} + +var ProjectStateValues = projectStateValuesType{ + // Project is in the process of being deleted. + Deleting: "deleting", + // Project is in the process of being created. + New: "new", + // Project is completely created and ready to use. + WellFormed: "wellFormed", + // Project has been queued for creation, but the process has not yet started. + CreatePending: "createPending", + // All projects regardless of state. + All: "all", + // Project has not been changed. + Unchanged: "unchanged", + // Project has been deleted. + Deleted: "deleted", +} + +type ProjectVisibility string + +type projectVisibilityValuesType struct { + Private ProjectVisibility + Public ProjectVisibility +} + +var ProjectVisibilityValues = projectVisibilityValuesType{ + // The project is only visible to users with explicit access. + Private: "private", + // The project is visible to all. + Public: "public", +} + +type Proxy struct { + Authorization *ProxyAuthorization `json:"authorization,omitempty"` + // This is a description string + Description *string `json:"description,omitempty"` + // The friendly name of the server + FriendlyName *string `json:"friendlyName,omitempty"` + GlobalDefault *bool `json:"globalDefault,omitempty"` + // This is a string representation of the site that the proxy server is located in (e.g. "NA-WA-RED") + Site *string `json:"site,omitempty"` + SiteDefault *bool `json:"siteDefault,omitempty"` + // The URL of the proxy server + Url *string `json:"url,omitempty"` +} + +type ProxyAuthorization struct { + // Gets or sets the endpoint used to obtain access tokens from the configured token service. + AuthorizationUrl *string `json:"authorizationUrl,omitempty"` + // Gets or sets the client identifier for this proxy. + ClientId *uuid.UUID `json:"clientId,omitempty"` + // Gets or sets the user identity to authorize for on-prem. + Identity *string `json:"identity,omitempty"` + // Gets or sets the public key used to verify the identity of this proxy. Only specify on hosted. + PublicKey *webapi.PublicKey `json:"publicKey,omitempty"` +} + +type SourceControlTypes string + +type sourceControlTypesValuesType struct { + Tfvc SourceControlTypes + Git SourceControlTypes +} + +var SourceControlTypesValues = sourceControlTypesValuesType{ + Tfvc: "tfvc", + Git: "git", +} + +// The Team Context for an operation. +type TeamContext struct { + // The team project Id or name. Ignored if ProjectId is set. + Project *string `json:"project,omitempty"` + // The Team Project ID. Required if Project is not set. + ProjectId *uuid.UUID `json:"projectId,omitempty"` + // The Team Id or name. Ignored if TeamId is set. + Team *string `json:"team,omitempty"` + // The Team Id + TeamId *uuid.UUID `json:"teamId,omitempty"` +} + +// Represents a Team Project object. +type TeamProject struct { + // Project abbreviation. + Abbreviation *string `json:"abbreviation,omitempty"` + // Url to default team identity image. + DefaultTeamImageUrl *string `json:"defaultTeamImageUrl,omitempty"` + // The project's description (if any). + Description *string `json:"description,omitempty"` + // Project identifier. + Id *uuid.UUID `json:"id,omitempty"` + // Project last update time. + LastUpdateTime *azuredevops.Time `json:"lastUpdateTime,omitempty"` + // Project name. + Name *string `json:"name,omitempty"` + // Project revision. + Revision *uint64 `json:"revision,omitempty"` + // Project state. + State *ProjectState `json:"state,omitempty"` + // Url to the full version of the object. + Url *string `json:"url,omitempty"` + // Project visibility. + Visibility *ProjectVisibility `json:"visibility,omitempty"` + // The links to other objects related to this object. + Links interface{} `json:"_links,omitempty"` + // Set of capabilities this project has (such as process template & version control). + Capabilities *map[string]map[string]string `json:"capabilities,omitempty"` + // The shallow ref to the default team. + DefaultTeam *WebApiTeamRef `json:"defaultTeam,omitempty"` +} + +// Data contract for a TeamProjectCollection. +type TeamProjectCollection struct { + // Collection Id. + Id *uuid.UUID `json:"id,omitempty"` + // Collection Name. + Name *string `json:"name,omitempty"` + // Collection REST Url. + Url *string `json:"url,omitempty"` + // The links to other objects related to this object. + Links interface{} `json:"_links,omitempty"` + // Project collection description. + Description *string `json:"description,omitempty"` + // Process customization type on this collection. It can be Xml or Inherited. + ProcessCustomizationType *ProcessCustomizationType `json:"processCustomizationType,omitempty"` + // Project collection state. + State *string `json:"state,omitempty"` +} + +// Reference object for a TeamProjectCollection. +type TeamProjectCollectionReference struct { + // Collection Id. + Id *uuid.UUID `json:"id,omitempty"` + // Collection Name. + Name *string `json:"name,omitempty"` + // Collection REST Url. + Url *string `json:"url,omitempty"` +} + +// Represents a shallow reference to a TeamProject. +type TeamProjectReference struct { + // Project abbreviation. + Abbreviation *string `json:"abbreviation,omitempty"` + // Url to default team identity image. + DefaultTeamImageUrl *string `json:"defaultTeamImageUrl,omitempty"` + // The project's description (if any). + Description *string `json:"description,omitempty"` + // Project identifier. + Id *uuid.UUID `json:"id,omitempty"` + // Project last update time. + LastUpdateTime *azuredevops.Time `json:"lastUpdateTime,omitempty"` + // Project name. + Name *string `json:"name,omitempty"` + // Project revision. + Revision *uint64 `json:"revision,omitempty"` + // Project state. + State *ProjectState `json:"state,omitempty"` + // Url to the full version of the object. + Url *string `json:"url,omitempty"` + // Project visibility. + Visibility *ProjectVisibility `json:"visibility,omitempty"` +} + +// A data transfer object that stores the metadata associated with the creation of temporary data. +type TemporaryDataCreatedDTO struct { + ExpirationSeconds *int `json:"expirationSeconds,omitempty"` + Origin *string `json:"origin,omitempty"` + Value interface{} `json:"value,omitempty"` + ExpirationDate *azuredevops.Time `json:"expirationDate,omitempty"` + Id *uuid.UUID `json:"id,omitempty"` + Url *string `json:"url,omitempty"` +} + +// A data transfer object that stores the metadata associated with the temporary data. +type TemporaryDataDTO struct { + ExpirationSeconds *int `json:"expirationSeconds,omitempty"` + Origin *string `json:"origin,omitempty"` + Value interface{} `json:"value,omitempty"` +} + +// Updateable properties for a WebApiTeam. +type UpdateTeam struct { + // New description for the team. + Description *string `json:"description,omitempty"` + // New name for the team. + Name *string `json:"name,omitempty"` +} + +type WebApiConnectedService struct { + Url *string `json:"url,omitempty"` + // The user who did the OAuth authentication to created this service + AuthenticatedBy *webapi.IdentityRef `json:"authenticatedBy,omitempty"` + // Extra description on the service. + Description *string `json:"description,omitempty"` + // Friendly Name of service connection + FriendlyName *string `json:"friendlyName,omitempty"` + // Id/Name of the connection service. For Ex: Subscription Id for Azure Connection + Id *string `json:"id,omitempty"` + // The kind of service. + Kind *string `json:"kind,omitempty"` + // The project associated with this service + Project *TeamProjectReference `json:"project,omitempty"` + // Optional uri to connect directly to the service such as https://windows.azure.com + ServiceUri *string `json:"serviceUri,omitempty"` +} + +type WebApiConnectedServiceDetails struct { + Id *string `json:"id,omitempty"` + Url *string `json:"url,omitempty"` + // Meta data for service connection + ConnectedServiceMetaData *WebApiConnectedService `json:"connectedServiceMetaData,omitempty"` + // Credential info + CredentialsXml *string `json:"credentialsXml,omitempty"` + // Optional uri to connect directly to the service such as https://windows.azure.com + EndPoint *string `json:"endPoint,omitempty"` +} + +type WebApiConnectedServiceRef struct { + Id *string `json:"id,omitempty"` + Url *string `json:"url,omitempty"` +} + +// The representation of data needed to create a tag definition which is sent across the wire. +type WebApiCreateTagRequestData struct { + // Name of the tag definition that will be created. + Name *string `json:"name,omitempty"` +} + +type WebApiProject struct { + // Project abbreviation. + Abbreviation *string `json:"abbreviation,omitempty"` + // Url to default team identity image. + DefaultTeamImageUrl *string `json:"defaultTeamImageUrl,omitempty"` + // The project's description (if any). + Description *string `json:"description,omitempty"` + // Project identifier. + Id *uuid.UUID `json:"id,omitempty"` + // Project last update time. + LastUpdateTime *azuredevops.Time `json:"lastUpdateTime,omitempty"` + // Project name. + Name *string `json:"name,omitempty"` + // Project revision. + Revision *uint64 `json:"revision,omitempty"` + // Project state. + State *ProjectState `json:"state,omitempty"` + // Url to the full version of the object. + Url *string `json:"url,omitempty"` + // Project visibility. + Visibility *ProjectVisibility `json:"visibility,omitempty"` + // Set of capabilities this project has + Capabilities *map[string]map[string]string `json:"capabilities,omitempty"` + // Reference to collection which contains this project + Collection *WebApiProjectCollectionRef `json:"collection,omitempty"` + // Default team for this project + DefaultTeam *WebApiTeamRef `json:"defaultTeam,omitempty"` +} + +type WebApiProjectCollection struct { + // Collection Tfs Url (Host Url) + CollectionUrl *string `json:"collectionUrl,omitempty"` + // Collection Guid + Id *uuid.UUID `json:"id,omitempty"` + // Collection Name + Name *string `json:"name,omitempty"` + // Collection REST Url + Url *string `json:"url,omitempty"` + // Project collection description + Description *string `json:"description,omitempty"` + // Project collection state + State *string `json:"state,omitempty"` +} + +type WebApiProjectCollectionRef struct { + // Collection Tfs Url (Host Url) + CollectionUrl *string `json:"collectionUrl,omitempty"` + // Collection Guid + Id *uuid.UUID `json:"id,omitempty"` + // Collection Name + Name *string `json:"name,omitempty"` + // Collection REST Url + Url *string `json:"url,omitempty"` +} + +// The representation of a tag definition which is sent across the wire. +type WebApiTagDefinition struct { + // Whether or not the tag definition is active. + Active *bool `json:"active,omitempty"` + // ID of the tag definition. + Id *uuid.UUID `json:"id,omitempty"` + // The name of the tag definition. + Name *string `json:"name,omitempty"` + // Resource URL for the Tag Definition. + Url *string `json:"url,omitempty"` +} + +type WebApiTeam struct { + // Team (Identity) Guid. A Team Foundation ID. + Id *uuid.UUID `json:"id,omitempty"` + // Team name + Name *string `json:"name,omitempty"` + // Team REST API Url + Url *string `json:"url,omitempty"` + // Team description + Description *string `json:"description,omitempty"` + // Team identity. + Identity *identity.Identity `json:"identity,omitempty"` + // Identity REST API Url to this team + IdentityUrl *string `json:"identityUrl,omitempty"` + ProjectId *uuid.UUID `json:"projectId,omitempty"` + ProjectName *string `json:"projectName,omitempty"` +} + +type WebApiTeamRef struct { + // Team (Identity) Guid. A Team Foundation ID. + Id *uuid.UUID `json:"id,omitempty"` + // Team name + Name *string `json:"name,omitempty"` + // Team REST API Url + Url *string `json:"url,omitempty"` +} diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/delegatedauthorization/models.go b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/delegatedauthorization/models.go new file mode 100644 index 00000000..e26fb557 --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/delegatedauthorization/models.go @@ -0,0 +1,350 @@ +// -------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// -------------------------------------------------------------------------------------------- +// Generated file, DO NOT EDIT +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// -------------------------------------------------------------------------------------------- + +package delegatedauthorization + +import ( + "github.com/google/uuid" + "github.com/microsoft/azure-devops-go-api/azuredevops" + "github.com/microsoft/azure-devops-go-api/azuredevops/webapi" +) + +type AccessTokenResult struct { + AccessToken *webapi.JsonWebToken `json:"accessToken,omitempty"` + AccessTokenError *TokenError `json:"accessTokenError,omitempty"` + AuthorizationId *uuid.UUID `json:"authorizationId,omitempty"` + ErrorDescription *string `json:"errorDescription,omitempty"` + HasError *bool `json:"hasError,omitempty"` + RefreshToken *RefreshTokenGrant `json:"refreshToken,omitempty"` + TokenType *string `json:"tokenType,omitempty"` + ValidTo *azuredevops.Time `json:"validTo,omitempty"` +} + +type Authorization struct { + AccessIssued *azuredevops.Time `json:"accessIssued,omitempty"` + Audience *string `json:"audience,omitempty"` + AuthorizationId *uuid.UUID `json:"authorizationId,omitempty"` + IdentityId *uuid.UUID `json:"identityId,omitempty"` + IsAccessUsed *bool `json:"isAccessUsed,omitempty"` + IsValid *bool `json:"isValid,omitempty"` + RedirectUri *string `json:"redirectUri,omitempty"` + RegistrationId *uuid.UUID `json:"registrationId,omitempty"` + Scopes *string `json:"scopes,omitempty"` + Source *string `json:"source,omitempty"` + ValidFrom *azuredevops.Time `json:"validFrom,omitempty"` + ValidTo *azuredevops.Time `json:"validTo,omitempty"` +} + +type AuthorizationDecision struct { + Authorization *Authorization `json:"authorization,omitempty"` + AuthorizationError *AuthorizationError `json:"authorizationError,omitempty"` + AuthorizationGrant *AuthorizationGrant `json:"authorizationGrant,omitempty"` + HasError *bool `json:"hasError,omitempty"` + IsAuthorized *bool `json:"isAuthorized,omitempty"` +} + +type AuthorizationDescription struct { + ClientRegistration *Registration `json:"clientRegistration,omitempty"` + HasError *bool `json:"hasError,omitempty"` + InitiationError *InitiationError `json:"initiationError,omitempty"` + ScopeDescriptions *[]AuthorizationScopeDescription `json:"scopeDescriptions,omitempty"` +} + +type AuthorizationDetails struct { + Authorization *Authorization `json:"authorization,omitempty"` + ClientRegistration *Registration `json:"clientRegistration,omitempty"` + ScopeDescriptions *[]AuthorizationScopeDescription `json:"scopeDescriptions,omitempty"` +} + +type AuthorizationError string + +type authorizationErrorValuesType struct { + None AuthorizationError + ClientIdRequired AuthorizationError + InvalidClientId AuthorizationError + ResponseTypeRequired AuthorizationError + ResponseTypeNotSupported AuthorizationError + ScopeRequired AuthorizationError + InvalidScope AuthorizationError + RedirectUriRequired AuthorizationError + InsecureRedirectUri AuthorizationError + InvalidRedirectUri AuthorizationError + InvalidUserId AuthorizationError + InvalidUserType AuthorizationError + AccessDenied AuthorizationError +} + +var AuthorizationErrorValues = authorizationErrorValuesType{ + None: "none", + ClientIdRequired: "clientIdRequired", + InvalidClientId: "invalidClientId", + ResponseTypeRequired: "responseTypeRequired", + ResponseTypeNotSupported: "responseTypeNotSupported", + ScopeRequired: "scopeRequired", + InvalidScope: "invalidScope", + RedirectUriRequired: "redirectUriRequired", + InsecureRedirectUri: "insecureRedirectUri", + InvalidRedirectUri: "invalidRedirectUri", + InvalidUserId: "invalidUserId", + InvalidUserType: "invalidUserType", + AccessDenied: "accessDenied", +} + +type AuthorizationGrant struct { + GrantType *GrantType `json:"grantType,omitempty"` +} + +type AuthorizationScopeDescription struct { + Description *string `json:"description,omitempty"` + Market *string `json:"market,omitempty"` + Title *string `json:"title,omitempty"` +} + +type ClientType string + +type clientTypeValuesType struct { + Confidential ClientType + Public ClientType + MediumTrust ClientType + HighTrust ClientType + FullTrust ClientType +} + +var ClientTypeValues = clientTypeValuesType{ + Confidential: "confidential", + Public: "public", + MediumTrust: "mediumTrust", + HighTrust: "highTrust", + FullTrust: "fullTrust", +} + +type GrantType string + +type grantTypeValuesType struct { + None GrantType + JwtBearer GrantType + RefreshToken GrantType + Implicit GrantType + ClientCredentials GrantType +} + +var GrantTypeValues = grantTypeValuesType{ + None: "none", + JwtBearer: "jwtBearer", + RefreshToken: "refreshToken", + Implicit: "implicit", + ClientCredentials: "clientCredentials", +} + +type HostAuthorization struct { + HostId *uuid.UUID `json:"hostId,omitempty"` + Id *uuid.UUID `json:"id,omitempty"` + IsValid *bool `json:"isValid,omitempty"` + RegistrationId *uuid.UUID `json:"registrationId,omitempty"` +} + +type HostAuthorizationDecision struct { + HasError *bool `json:"hasError,omitempty"` + HostAuthorizationError *HostAuthorizationError `json:"hostAuthorizationError,omitempty"` + HostAuthorizationId *uuid.UUID `json:"hostAuthorizationId,omitempty"` +} + +type HostAuthorizationError string + +type hostAuthorizationErrorValuesType struct { + None HostAuthorizationError + ClientIdRequired HostAuthorizationError + AccessDenied HostAuthorizationError + FailedToAuthorizeHost HostAuthorizationError + ClientIdNotFound HostAuthorizationError + InvalidClientId HostAuthorizationError +} + +var HostAuthorizationErrorValues = hostAuthorizationErrorValuesType{ + None: "none", + ClientIdRequired: "clientIdRequired", + AccessDenied: "accessDenied", + FailedToAuthorizeHost: "failedToAuthorizeHost", + ClientIdNotFound: "clientIdNotFound", + InvalidClientId: "invalidClientId", +} + +type InitiationError string + +type initiationErrorValuesType struct { + None InitiationError + ClientIdRequired InitiationError + InvalidClientId InitiationError + ResponseTypeRequired InitiationError + ResponseTypeNotSupported InitiationError + ScopeRequired InitiationError + InvalidScope InitiationError + RedirectUriRequired InitiationError + InsecureRedirectUri InitiationError + InvalidRedirectUri InitiationError +} + +var InitiationErrorValues = initiationErrorValuesType{ + None: "none", + ClientIdRequired: "clientIdRequired", + InvalidClientId: "invalidClientId", + ResponseTypeRequired: "responseTypeRequired", + ResponseTypeNotSupported: "responseTypeNotSupported", + ScopeRequired: "scopeRequired", + InvalidScope: "invalidScope", + RedirectUriRequired: "redirectUriRequired", + InsecureRedirectUri: "insecureRedirectUri", + InvalidRedirectUri: "invalidRedirectUri", +} + +type RefreshTokenGrant struct { + GrantType *GrantType `json:"grantType,omitempty"` + Jwt *webapi.JsonWebToken `json:"jwt,omitempty"` +} + +type Registration struct { + ClientType *ClientType `json:"clientType,omitempty"` + IdentityId *uuid.UUID `json:"identityId,omitempty"` + Issuer *string `json:"issuer,omitempty"` + IsValid *bool `json:"isValid,omitempty"` + IsWellKnown *bool `json:"isWellKnown,omitempty"` + OrganizationLocation *string `json:"organizationLocation,omitempty"` + OrganizationName *string `json:"organizationName,omitempty"` + // Raw cert data string from public key. This will be used for authenticating medium trust clients. + PublicKey *string `json:"publicKey,omitempty"` + RedirectUris *[]string `json:"redirectUris,omitempty"` + RegistrationDescription *string `json:"registrationDescription,omitempty"` + RegistrationId *uuid.UUID `json:"registrationId,omitempty"` + RegistrationLocation *string `json:"registrationLocation,omitempty"` + RegistrationLogoSecureLocation *string `json:"registrationLogoSecureLocation,omitempty"` + RegistrationName *string `json:"registrationName,omitempty"` + RegistrationPrivacyStatementLocation *string `json:"registrationPrivacyStatementLocation,omitempty"` + RegistrationTermsOfServiceLocation *string `json:"registrationTermsOfServiceLocation,omitempty"` + ResponseTypes *string `json:"responseTypes,omitempty"` + Scopes *string `json:"scopes,omitempty"` + Secret *string `json:"secret,omitempty"` + SecretValidTo *azuredevops.Time `json:"secretValidTo,omitempty"` + SecretVersionId *uuid.UUID `json:"secretVersionId,omitempty"` + ValidFrom *azuredevops.Time `json:"validFrom,omitempty"` +} + +type ResponseType string + +type responseTypeValuesType struct { + None ResponseType + Assertion ResponseType + IdToken ResponseType + TenantPicker ResponseType + SignoutToken ResponseType + AppToken ResponseType + Code ResponseType +} + +var ResponseTypeValues = responseTypeValuesType{ + None: "none", + Assertion: "assertion", + IdToken: "idToken", + TenantPicker: "tenantPicker", + SignoutToken: "signoutToken", + AppToken: "appToken", + Code: "code", +} + +type SessionToken struct { + AccessId *uuid.UUID `json:"accessId,omitempty"` + // This is populated when user requests a compact token. The alternate token value is self describing token. + AlternateToken *string `json:"alternateToken,omitempty"` + AuthorizationId *uuid.UUID `json:"authorizationId,omitempty"` + Claims *map[string]string `json:"claims,omitempty"` + ClientId *uuid.UUID `json:"clientId,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + HostAuthorizationId *uuid.UUID `json:"hostAuthorizationId,omitempty"` + IsPublic *bool `json:"isPublic,omitempty"` + IsValid *bool `json:"isValid,omitempty"` + PublicData *string `json:"publicData,omitempty"` + Scope *string `json:"scope,omitempty"` + Source *string `json:"source,omitempty"` + TargetAccounts *[]uuid.UUID `json:"targetAccounts,omitempty"` + // This is computed and not returned in Get queries + Token *string `json:"token,omitempty"` + UserId *uuid.UUID `json:"userId,omitempty"` + ValidFrom *azuredevops.Time `json:"validFrom,omitempty"` + ValidTo *azuredevops.Time `json:"validTo,omitempty"` +} + +type TokenError string + +type tokenErrorValuesType struct { + None TokenError + GrantTypeRequired TokenError + AuthorizationGrantRequired TokenError + ClientSecretRequired TokenError + RedirectUriRequired TokenError + InvalidAuthorizationGrant TokenError + InvalidAuthorizationScopes TokenError + InvalidRefreshToken TokenError + AuthorizationNotFound TokenError + AuthorizationGrantExpired TokenError + AccessAlreadyIssued TokenError + InvalidRedirectUri TokenError + AccessTokenNotFound TokenError + InvalidAccessToken TokenError + AccessTokenAlreadyRefreshed TokenError + InvalidClientSecret TokenError + ClientSecretExpired TokenError + ServerError TokenError + AccessDenied TokenError + AccessTokenKeyRequired TokenError + InvalidAccessTokenKey TokenError + FailedToGetAccessToken TokenError + InvalidClientId TokenError + InvalidClient TokenError + InvalidValidTo TokenError + InvalidUserId TokenError + FailedToIssueAccessToken TokenError + AuthorizationGrantScopeMissing TokenError + InvalidPublicAccessTokenKey TokenError + InvalidPublicAccessToken TokenError + PublicFeatureFlagNotEnabled TokenError + SshPolicyDisabled TokenError +} + +var TokenErrorValues = tokenErrorValuesType{ + None: "none", + GrantTypeRequired: "grantTypeRequired", + AuthorizationGrantRequired: "authorizationGrantRequired", + ClientSecretRequired: "clientSecretRequired", + RedirectUriRequired: "redirectUriRequired", + InvalidAuthorizationGrant: "invalidAuthorizationGrant", + InvalidAuthorizationScopes: "invalidAuthorizationScopes", + InvalidRefreshToken: "invalidRefreshToken", + AuthorizationNotFound: "authorizationNotFound", + AuthorizationGrantExpired: "authorizationGrantExpired", + AccessAlreadyIssued: "accessAlreadyIssued", + InvalidRedirectUri: "invalidRedirectUri", + AccessTokenNotFound: "accessTokenNotFound", + InvalidAccessToken: "invalidAccessToken", + AccessTokenAlreadyRefreshed: "accessTokenAlreadyRefreshed", + InvalidClientSecret: "invalidClientSecret", + ClientSecretExpired: "clientSecretExpired", + ServerError: "serverError", + AccessDenied: "accessDenied", + AccessTokenKeyRequired: "accessTokenKeyRequired", + InvalidAccessTokenKey: "invalidAccessTokenKey", + FailedToGetAccessToken: "failedToGetAccessToken", + InvalidClientId: "invalidClientId", + InvalidClient: "invalidClient", + InvalidValidTo: "invalidValidTo", + InvalidUserId: "invalidUserId", + FailedToIssueAccessToken: "failedToIssueAccessToken", + AuthorizationGrantScopeMissing: "authorizationGrantScopeMissing", + InvalidPublicAccessTokenKey: "invalidPublicAccessTokenKey", + InvalidPublicAccessToken: "invalidPublicAccessToken", + PublicFeatureFlagNotEnabled: "publicFeatureFlagNotEnabled", + SshPolicyDisabled: "sshPolicyDisabled", +} diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/distributedtaskcommon/models.go b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/distributedtaskcommon/models.go new file mode 100644 index 00000000..bde84d22 --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/distributedtaskcommon/models.go @@ -0,0 +1,80 @@ +// -------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// -------------------------------------------------------------------------------------------- +// Generated file, DO NOT EDIT +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// -------------------------------------------------------------------------------------------- + +package distributedtaskcommon + +type AuthorizationHeader struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// Represents binding of data source for the service endpoint request. +type DataSourceBindingBase struct { + // Pagination format supported by this data source(ContinuationToken/SkipTop). + CallbackContextTemplate *string `json:"callbackContextTemplate,omitempty"` + // Subsequent calls needed? + CallbackRequiredTemplate *string `json:"callbackRequiredTemplate,omitempty"` + // Gets or sets the name of the data source. + DataSourceName *string `json:"dataSourceName,omitempty"` + // Gets or sets the endpoint Id. + EndpointId *string `json:"endpointId,omitempty"` + // Gets or sets the url of the service endpoint. + EndpointUrl *string `json:"endpointUrl,omitempty"` + // Gets or sets the authorization headers. + Headers *[]AuthorizationHeader `json:"headers,omitempty"` + // Defines the initial value of the query params + InitialContextTemplate *string `json:"initialContextTemplate,omitempty"` + // Gets or sets the parameters for the data source. + Parameters *map[string]string `json:"parameters,omitempty"` + // Gets or sets http request body + RequestContent *string `json:"requestContent,omitempty"` + // Gets or sets http request verb + RequestVerb *string `json:"requestVerb,omitempty"` + // Gets or sets the result selector. + ResultSelector *string `json:"resultSelector,omitempty"` + // Gets or sets the result template. + ResultTemplate *string `json:"resultTemplate,omitempty"` + // Gets or sets the target of the data source. + Target *string `json:"target,omitempty"` +} + +type ProcessParameters struct { + DataSourceBindings *[]DataSourceBindingBase `json:"dataSourceBindings,omitempty"` + Inputs *[]TaskInputDefinitionBase `json:"inputs,omitempty"` + SourceDefinitions *[]TaskSourceDefinitionBase `json:"sourceDefinitions,omitempty"` +} + +type TaskInputDefinitionBase struct { + Aliases *[]string `json:"aliases,omitempty"` + DefaultValue *string `json:"defaultValue,omitempty"` + GroupName *string `json:"groupName,omitempty"` + HelpMarkDown *string `json:"helpMarkDown,omitempty"` + Label *string `json:"label,omitempty"` + Name *string `json:"name,omitempty"` + Options *map[string]string `json:"options,omitempty"` + Properties *map[string]string `json:"properties,omitempty"` + Required *bool `json:"required,omitempty"` + Type *string `json:"type,omitempty"` + Validation *TaskInputValidation `json:"validation,omitempty"` + VisibleRule *string `json:"visibleRule,omitempty"` +} + +type TaskInputValidation struct { + // Conditional expression + Expression *string `json:"expression,omitempty"` + // Message explaining how user can correct if validation fails + Message *string `json:"message,omitempty"` +} + +type TaskSourceDefinitionBase struct { + AuthKey *string `json:"authKey,omitempty"` + Endpoint *string `json:"endpoint,omitempty"` + KeySelector *string `json:"keySelector,omitempty"` + Selector *string `json:"selector,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/errors.go b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/errors.go new file mode 100644 index 00000000..e7cf6a37 --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/errors.go @@ -0,0 +1,17 @@ +package azuredevops + +type ArgumentNilError struct { + ArgumentName string +} + +func (e ArgumentNilError) Error() string { + return "Argument " + e.ArgumentName + " can not be nil" +} + +type ArgumentNilOrEmptyError struct { + ArgumentName string +} + +func (e ArgumentNilOrEmptyError) Error() string { + return "Argument " + e.ArgumentName + " can not be nil or empty" +} diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/git/client.go b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/git/client.go new file mode 100644 index 00000000..e81fb401 --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/git/client.go @@ -0,0 +1,5456 @@ +// -------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// -------------------------------------------------------------------------------------------- +// Generated file, DO NOT EDIT +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// -------------------------------------------------------------------------------------------- + +package git + +import ( + "bytes" + "context" + "encoding/json" + "github.com/google/uuid" + "github.com/microsoft/azure-devops-go-api/azuredevops" + "github.com/microsoft/azure-devops-go-api/azuredevops/core" + "github.com/microsoft/azure-devops-go-api/azuredevops/policy" + "github.com/microsoft/azure-devops-go-api/azuredevops/webapi" + "io" + "net/http" + "net/url" + "strconv" +) + +var ResourceAreaId, _ = uuid.Parse("4e080c62-fa21-4fbc-8fef-2a10a2b38049") + +type Client struct { + Client azuredevops.Client +} + +func NewClient(ctx context.Context, connection *azuredevops.Connection) (*Client, error) { + client, err := connection.GetClientByResourceAreaId(ctx, ResourceAreaId) + if err != nil { + return nil, err + } + return &Client{ + Client: *client, + }, nil +} + +// [Preview API] Create an annotated tag. +func (client *Client) CreateAnnotatedTag(ctx context.Context, args CreateAnnotatedTagArgs) (*GitAnnotatedTag, error) { + if args.TagObject == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TagObject"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + body, marshalErr := json.Marshal(*args.TagObject) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("5e8a8081-3851-4626-b677-9891cc04102e") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitAnnotatedTag + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateAnnotatedTag function +type CreateAnnotatedTagArgs struct { + // (required) Object containing details of tag to be created. + TagObject *GitAnnotatedTag + // (required) Project ID or project name + Project *string + // (required) ID or name of the repository. + RepositoryId *string +} + +// [Preview API] Get an annotated tag. +func (client *Client) GetAnnotatedTag(ctx context.Context, args GetAnnotatedTagArgs) (*GitAnnotatedTag, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.ObjectId == nil || *args.ObjectId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ObjectId"} + } + routeValues["objectId"] = *args.ObjectId + + locationId, _ := uuid.Parse("5e8a8081-3851-4626-b677-9891cc04102e") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitAnnotatedTag + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetAnnotatedTag function +type GetAnnotatedTagArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID or name of the repository. + RepositoryId *string + // (required) ObjectId (Sha1Id) of tag to get. + ObjectId *string +} + +// Get a single blob. +func (client *Client) GetBlob(ctx context.Context, args GetBlobArgs) (*GitBlobRef, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.Sha1 == nil || *args.Sha1 == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Sha1"} + } + routeValues["sha1"] = *args.Sha1 + + queryParams := url.Values{} + if args.Download != nil { + queryParams.Add("download", strconv.FormatBool(*args.Download)) + } + if args.FileName != nil { + queryParams.Add("fileName", *args.FileName) + } + if args.ResolveLfs != nil { + queryParams.Add("resolveLfs", strconv.FormatBool(*args.ResolveLfs)) + } + locationId, _ := uuid.Parse("7b28e929-2c99-405d-9c5c-6167a06e6816") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitBlobRef + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetBlob function +type GetBlobArgs struct { + // (required) The name or ID of the repository. + RepositoryId *string + // (required) SHA1 hash of the file. You can get the SHA1 of a file using the "Git/Items/Get Item" endpoint. + Sha1 *string + // (optional) Project ID or project name + Project *string + // (optional) If true, prompt for a download rather than rendering in a browser. Note: this value defaults to true if $format is zip + Download *bool + // (optional) Provide a fileName to use for a download. + FileName *string + // (optional) If true, try to resolve a blob to its LFS contents, if it's an LFS pointer file. Only compatible with octet-stream Accept headers or $format types + ResolveLfs *bool +} + +// Get a single blob. +func (client *Client) GetBlobContent(ctx context.Context, args GetBlobContentArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.Sha1 == nil || *args.Sha1 == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Sha1"} + } + routeValues["sha1"] = *args.Sha1 + + queryParams := url.Values{} + if args.Download != nil { + queryParams.Add("download", strconv.FormatBool(*args.Download)) + } + if args.FileName != nil { + queryParams.Add("fileName", *args.FileName) + } + if args.ResolveLfs != nil { + queryParams.Add("resolveLfs", strconv.FormatBool(*args.ResolveLfs)) + } + locationId, _ := uuid.Parse("7b28e929-2c99-405d-9c5c-6167a06e6816") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/octet-stream", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetBlobContent function +type GetBlobContentArgs struct { + // (required) The name or ID of the repository. + RepositoryId *string + // (required) SHA1 hash of the file. You can get the SHA1 of a file using the "Git/Items/Get Item" endpoint. + Sha1 *string + // (optional) Project ID or project name + Project *string + // (optional) If true, prompt for a download rather than rendering in a browser. Note: this value defaults to true if $format is zip + Download *bool + // (optional) Provide a fileName to use for a download. + FileName *string + // (optional) If true, try to resolve a blob to its LFS contents, if it's an LFS pointer file. Only compatible with octet-stream Accept headers or $format types + ResolveLfs *bool +} + +// Gets one or more blobs in a zip file download. +func (client *Client) GetBlobsZip(ctx context.Context, args GetBlobsZipArgs) (io.ReadCloser, error) { + if args.BlobIds == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BlobIds"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.Filename != nil { + queryParams.Add("filename", *args.Filename) + } + body, marshalErr := json.Marshal(*args.BlobIds) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("7b28e929-2c99-405d-9c5c-6167a06e6816") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/zip", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetBlobsZip function +type GetBlobsZipArgs struct { + // (required) Blob IDs (SHA1 hashes) to be returned in the zip file. + BlobIds *[]string + // (required) The name or ID of the repository. + RepositoryId *string + // (optional) Project ID or project name + Project *string + // (optional) + Filename *string +} + +// Get a single blob. +func (client *Client) GetBlobZip(ctx context.Context, args GetBlobZipArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.Sha1 == nil || *args.Sha1 == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Sha1"} + } + routeValues["sha1"] = *args.Sha1 + + queryParams := url.Values{} + if args.Download != nil { + queryParams.Add("download", strconv.FormatBool(*args.Download)) + } + if args.FileName != nil { + queryParams.Add("fileName", *args.FileName) + } + if args.ResolveLfs != nil { + queryParams.Add("resolveLfs", strconv.FormatBool(*args.ResolveLfs)) + } + locationId, _ := uuid.Parse("7b28e929-2c99-405d-9c5c-6167a06e6816") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/zip", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetBlobZip function +type GetBlobZipArgs struct { + // (required) The name or ID of the repository. + RepositoryId *string + // (required) SHA1 hash of the file. You can get the SHA1 of a file using the "Git/Items/Get Item" endpoint. + Sha1 *string + // (optional) Project ID or project name + Project *string + // (optional) If true, prompt for a download rather than rendering in a browser. Note: this value defaults to true if $format is zip + Download *bool + // (optional) Provide a fileName to use for a download. + FileName *string + // (optional) If true, try to resolve a blob to its LFS contents, if it's an LFS pointer file. Only compatible with octet-stream Accept headers or $format types + ResolveLfs *bool +} + +// Retrieve statistics about a single branch. +func (client *Client) GetBranch(ctx context.Context, args GetBranchArgs) (*GitBranchStats, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.Name == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "name"} + } + queryParams.Add("name", *args.Name) + if args.BaseVersionDescriptor != nil { + if args.BaseVersionDescriptor.VersionType != nil { + queryParams.Add("baseVersionDescriptor.versionType", string(*args.BaseVersionDescriptor.VersionType)) + } + if args.BaseVersionDescriptor.Version != nil { + queryParams.Add("baseVersionDescriptor.version", *args.BaseVersionDescriptor.Version) + } + if args.BaseVersionDescriptor.VersionOptions != nil { + queryParams.Add("baseVersionDescriptor.versionOptions", string(*args.BaseVersionDescriptor.VersionOptions)) + } + } + locationId, _ := uuid.Parse("d5b216de-d8d5-4d32-ae76-51df755b16d3") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitBranchStats + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetBranch function +type GetBranchArgs struct { + // (required) The name or ID of the repository. + RepositoryId *string + // (required) Name of the branch. + Name *string + // (optional) Project ID or project name + Project *string + // (optional) Identifies the commit or branch to use as the base. + BaseVersionDescriptor *GitVersionDescriptor +} + +// Retrieve statistics about all branches within a repository. +func (client *Client) GetBranches(ctx context.Context, args GetBranchesArgs) (*[]GitBranchStats, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.BaseVersionDescriptor != nil { + if args.BaseVersionDescriptor.VersionType != nil { + queryParams.Add("baseVersionDescriptor.versionType", string(*args.BaseVersionDescriptor.VersionType)) + } + if args.BaseVersionDescriptor.Version != nil { + queryParams.Add("baseVersionDescriptor.version", *args.BaseVersionDescriptor.Version) + } + if args.BaseVersionDescriptor.VersionOptions != nil { + queryParams.Add("baseVersionDescriptor.versionOptions", string(*args.BaseVersionDescriptor.VersionOptions)) + } + } + locationId, _ := uuid.Parse("d5b216de-d8d5-4d32-ae76-51df755b16d3") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitBranchStats + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetBranches function +type GetBranchesArgs struct { + // (required) The name or ID of the repository. + RepositoryId *string + // (optional) Project ID or project name + Project *string + // (optional) Identifies the commit or branch to use as the base. + BaseVersionDescriptor *GitVersionDescriptor +} + +// Retrieve changes for a particular commit. +func (client *Client) GetChanges(ctx context.Context, args GetChangesArgs) (*GitCommitChanges, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.CommitId == nil || *args.CommitId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.CommitId"} + } + routeValues["commitId"] = *args.CommitId + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.Top != nil { + queryParams.Add("top", strconv.Itoa(*args.Top)) + } + if args.Skip != nil { + queryParams.Add("skip", strconv.Itoa(*args.Skip)) + } + locationId, _ := uuid.Parse("5bf884f5-3e07-42e9-afb8-1b872267bf16") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitCommitChanges + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetChanges function +type GetChangesArgs struct { + // (required) The id of the commit. + CommitId *string + // (required) The id or friendly name of the repository. To use the friendly name, projectId must also be specified. + RepositoryId *string + // (optional) Project ID or project name + Project *string + // (optional) The maximum number of changes to return. + Top *int + // (optional) The number of changes to skip. + Skip *int +} + +// [Preview API] Cherry pick a specific commit or commits that are associated to a pull request into a new branch. +func (client *Client) CreateCherryPick(ctx context.Context, args CreateCherryPickArgs) (*GitCherryPick, error) { + if args.CherryPickToCreate == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.CherryPickToCreate"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + body, marshalErr := json.Marshal(*args.CherryPickToCreate) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("033bad68-9a14-43d1-90e0-59cb8856fef6") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitCherryPick + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateCherryPick function +type CreateCherryPickArgs struct { + // (required) + CherryPickToCreate *GitAsyncRefOperationParameters + // (required) Project ID or project name + Project *string + // (required) ID of the repository. + RepositoryId *string +} + +// [Preview API] Retrieve information about a cherry pick by cherry pick Id. +func (client *Client) GetCherryPick(ctx context.Context, args GetCherryPickArgs) (*GitCherryPick, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.CherryPickId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.CherryPickId"} + } + routeValues["cherryPickId"] = strconv.Itoa(*args.CherryPickId) + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + locationId, _ := uuid.Parse("033bad68-9a14-43d1-90e0-59cb8856fef6") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitCherryPick + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetCherryPick function +type GetCherryPickArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the cherry pick. + CherryPickId *int + // (required) ID of the repository. + RepositoryId *string +} + +// [Preview API] Retrieve information about a cherry pick for a specific branch. +func (client *Client) GetCherryPickForRefName(ctx context.Context, args GetCherryPickForRefNameArgs) (*GitCherryPick, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.RefName == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "refName"} + } + queryParams.Add("refName", *args.RefName) + locationId, _ := uuid.Parse("033bad68-9a14-43d1-90e0-59cb8856fef6") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitCherryPick + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetCherryPickForRefName function +type GetCherryPickForRefNameArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the repository. + RepositoryId *string + // (required) The GitAsyncRefOperationParameters generatedRefName used for the cherry pick operation. + RefName *string +} + +// Find the closest common commit (the merge base) between base and target commits, and get the diff between either the base and target commits or common and target commits. +func (client *Client) GetCommitDiffs(ctx context.Context, args GetCommitDiffsArgs) (*GitCommitDiffs, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.DiffCommonCommit != nil { + queryParams.Add("diffCommonCommit", strconv.FormatBool(*args.DiffCommonCommit)) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + if args.Skip != nil { + queryParams.Add("$skip", strconv.Itoa(*args.Skip)) + } + if args.BaseVersionDescriptor != nil { + if args.BaseVersionDescriptor.BaseVersionType != nil { + queryParams.Add("baseVersionType", string(*args.BaseVersionDescriptor.BaseVersionType)) + } + if args.BaseVersionDescriptor.BaseVersion != nil { + queryParams.Add("baseVersion", *args.BaseVersionDescriptor.BaseVersion) + } + if args.BaseVersionDescriptor.BaseVersionOptions != nil { + queryParams.Add("baseVersionOptions", string(*args.BaseVersionDescriptor.BaseVersionOptions)) + } + } + if args.TargetVersionDescriptor != nil { + if args.TargetVersionDescriptor.TargetVersionType != nil { + queryParams.Add("targetVersionType", string(*args.TargetVersionDescriptor.TargetVersionType)) + } + if args.TargetVersionDescriptor.TargetVersion != nil { + queryParams.Add("targetVersion", *args.TargetVersionDescriptor.TargetVersion) + } + if args.TargetVersionDescriptor.TargetVersionOptions != nil { + queryParams.Add("targetVersionOptions", string(*args.TargetVersionDescriptor.TargetVersionOptions)) + } + } + locationId, _ := uuid.Parse("615588d5-c0c7-4b88-88f8-e625306446e8") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitCommitDiffs + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetCommitDiffs function +type GetCommitDiffsArgs struct { + // (required) The name or ID of the repository. + RepositoryId *string + // (optional) Project ID or project name + Project *string + // (optional) If true, diff between common and target commits. If false, diff between base and target commits. + DiffCommonCommit *bool + // (optional) Maximum number of changes to return. Defaults to 100. + Top *int + // (optional) Number of changes to skip + Skip *int + // (optional) Descriptor for base commit. + BaseVersionDescriptor *GitBaseVersionDescriptor + // (optional) Descriptor for target commit. + TargetVersionDescriptor *GitTargetVersionDescriptor +} + +// Retrieve a particular commit. +func (client *Client) GetCommit(ctx context.Context, args GetCommitArgs) (*GitCommit, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.CommitId == nil || *args.CommitId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.CommitId"} + } + routeValues["commitId"] = *args.CommitId + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.ChangeCount != nil { + queryParams.Add("changeCount", strconv.Itoa(*args.ChangeCount)) + } + locationId, _ := uuid.Parse("c2570c3b-5b3f-41b8-98bf-5407bfde8d58") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitCommit + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetCommit function +type GetCommitArgs struct { + // (required) The id of the commit. + CommitId *string + // (required) The id or friendly name of the repository. To use the friendly name, projectId must also be specified. + RepositoryId *string + // (optional) Project ID or project name + Project *string + // (optional) The number of changes to include in the result. + ChangeCount *int +} + +// Retrieve git commits for a project +func (client *Client) GetCommits(ctx context.Context, args GetCommitsArgs) (*[]GitCommitRef, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.SearchCriteria == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "searchCriteria"} + } + if args.SearchCriteria.Ids != nil { + for index, item := range *args.SearchCriteria.Ids { + queryParams.Add("searchCriteria.ids["+strconv.Itoa(index)+"]", item) + } + } + if args.SearchCriteria.FromDate != nil { + queryParams.Add("searchCriteria.fromDate", *args.SearchCriteria.FromDate) + } + if args.SearchCriteria.ToDate != nil { + queryParams.Add("searchCriteria.toDate", *args.SearchCriteria.ToDate) + } + if args.SearchCriteria.ItemVersion != nil { + if args.SearchCriteria.ItemVersion.VersionType != nil { + queryParams.Add("searchCriteria.itemVersion.versionType", string(*args.SearchCriteria.ItemVersion.VersionType)) + } + if args.SearchCriteria.ItemVersion.Version != nil { + queryParams.Add("searchCriteria.itemVersion.version", *args.SearchCriteria.ItemVersion.Version) + } + if args.SearchCriteria.ItemVersion.VersionOptions != nil { + queryParams.Add("searchCriteria.itemVersion.versionOptions", string(*args.SearchCriteria.ItemVersion.VersionOptions)) + } + } + if args.SearchCriteria.CompareVersion != nil { + if args.SearchCriteria.CompareVersion.VersionType != nil { + queryParams.Add("searchCriteria.compareVersion.versionType", string(*args.SearchCriteria.CompareVersion.VersionType)) + } + if args.SearchCriteria.CompareVersion.Version != nil { + queryParams.Add("searchCriteria.compareVersion.version", *args.SearchCriteria.CompareVersion.Version) + } + if args.SearchCriteria.CompareVersion.VersionOptions != nil { + queryParams.Add("searchCriteria.compareVersion.versionOptions", string(*args.SearchCriteria.CompareVersion.VersionOptions)) + } + } + if args.SearchCriteria.FromCommitId != nil { + queryParams.Add("searchCriteria.fromCommitId", *args.SearchCriteria.FromCommitId) + } + if args.SearchCriteria.ToCommitId != nil { + queryParams.Add("searchCriteria.toCommitId", *args.SearchCriteria.ToCommitId) + } + if args.SearchCriteria.User != nil { + queryParams.Add("searchCriteria.user", *args.SearchCriteria.User) + } + if args.SearchCriteria.Author != nil { + queryParams.Add("searchCriteria.author", *args.SearchCriteria.Author) + } + if args.SearchCriteria.ItemPath != nil { + queryParams.Add("searchCriteria.itemPath", *args.SearchCriteria.ItemPath) + } + if args.SearchCriteria.ExcludeDeletes != nil { + queryParams.Add("searchCriteria.excludeDeletes", strconv.FormatBool(*args.SearchCriteria.ExcludeDeletes)) + } + if args.SearchCriteria.Skip != nil { + queryParams.Add("searchCriteria.$skip", strconv.Itoa(*args.SearchCriteria.Skip)) + } + if args.SearchCriteria.Top != nil { + queryParams.Add("searchCriteria.$top", strconv.Itoa(*args.SearchCriteria.Top)) + } + if args.SearchCriteria.IncludeLinks != nil { + queryParams.Add("searchCriteria.includeLinks", strconv.FormatBool(*args.SearchCriteria.IncludeLinks)) + } + if args.SearchCriteria.IncludeWorkItems != nil { + queryParams.Add("searchCriteria.includeWorkItems", strconv.FormatBool(*args.SearchCriteria.IncludeWorkItems)) + } + if args.SearchCriteria.IncludeUserImageUrl != nil { + queryParams.Add("searchCriteria.includeUserImageUrl", strconv.FormatBool(*args.SearchCriteria.IncludeUserImageUrl)) + } + if args.SearchCriteria.IncludePushData != nil { + queryParams.Add("searchCriteria.includePushData", strconv.FormatBool(*args.SearchCriteria.IncludePushData)) + } + if args.SearchCriteria.HistoryMode != nil { + queryParams.Add("searchCriteria.historyMode", string(*args.SearchCriteria.HistoryMode)) + } + if args.Skip != nil { + queryParams.Add("$skip", strconv.Itoa(*args.Skip)) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + locationId, _ := uuid.Parse("c2570c3b-5b3f-41b8-98bf-5407bfde8d58") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitCommitRef + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetCommits function +type GetCommitsArgs struct { + // (required) The id or friendly name of the repository. To use the friendly name, projectId must also be specified. + RepositoryId *string + // (required) + SearchCriteria *GitQueryCommitsCriteria + // (optional) Project ID or project name + Project *string + // (optional) + Skip *int + // (optional) + Top *int +} + +// Retrieve a list of commits associated with a particular push. +func (client *Client) GetPushCommits(ctx context.Context, args GetPushCommitsArgs) (*[]GitCommitRef, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.PushId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "pushId"} + } + queryParams.Add("pushId", strconv.Itoa(*args.PushId)) + if args.Top != nil { + queryParams.Add("top", strconv.Itoa(*args.Top)) + } + if args.Skip != nil { + queryParams.Add("skip", strconv.Itoa(*args.Skip)) + } + if args.IncludeLinks != nil { + queryParams.Add("includeLinks", strconv.FormatBool(*args.IncludeLinks)) + } + locationId, _ := uuid.Parse("c2570c3b-5b3f-41b8-98bf-5407bfde8d58") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitCommitRef + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPushCommits function +type GetPushCommitsArgs struct { + // (required) The id or friendly name of the repository. To use the friendly name, projectId must also be specified. + RepositoryId *string + // (required) The id of the push. + PushId *int + // (optional) Project ID or project name + Project *string + // (optional) The maximum number of commits to return ("get the top x commits"). + Top *int + // (optional) The number of commits to skip. + Skip *int + // (optional) Set to false to avoid including REST Url links for resources. Defaults to true. + IncludeLinks *bool +} + +// Retrieve git commits for a project matching the search criteria +func (client *Client) GetCommitsBatch(ctx context.Context, args GetCommitsBatchArgs) (*[]GitCommitRef, error) { + if args.SearchCriteria == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.SearchCriteria"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.Skip != nil { + queryParams.Add("$skip", strconv.Itoa(*args.Skip)) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + if args.IncludeStatuses != nil { + queryParams.Add("includeStatuses", strconv.FormatBool(*args.IncludeStatuses)) + } + body, marshalErr := json.Marshal(*args.SearchCriteria) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("6400dfb2-0bcb-462b-b992-5a57f8f1416c") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitCommitRef + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetCommitsBatch function +type GetCommitsBatchArgs struct { + // (required) Search options + SearchCriteria *GitQueryCommitsCriteria + // (required) The name or ID of the repository. + RepositoryId *string + // (optional) Project ID or project name + Project *string + // (optional) Number of commits to skip. + Skip *int + // (optional) Maximum number of commits to return. + Top *int + // (optional) True to include additional commit status information. + IncludeStatuses *bool +} + +// [Preview API] Retrieve deleted git repositories. +func (client *Client) GetDeletedRepositories(ctx context.Context, args GetDeletedRepositoriesArgs) (*[]GitDeletedRepository, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + locationId, _ := uuid.Parse("2b6869c4-cb25-42b5-b7a3-0d3e6be0a11a") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitDeletedRepository + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetDeletedRepositories function +type GetDeletedRepositoriesArgs struct { + // (required) Project ID or project name + Project *string +} + +// [Preview API] Retrieve all forks of a repository in the collection. +func (client *Client) GetForks(ctx context.Context, args GetForksArgs) (*[]GitRepositoryRef, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryNameOrId == nil || *args.RepositoryNameOrId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryNameOrId"} + } + routeValues["repositoryNameOrId"] = *args.RepositoryNameOrId + if args.CollectionId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.CollectionId"} + } + routeValues["collectionId"] = (*args.CollectionId).String() + + queryParams := url.Values{} + if args.IncludeLinks != nil { + queryParams.Add("includeLinks", strconv.FormatBool(*args.IncludeLinks)) + } + locationId, _ := uuid.Parse("158c0340-bf6f-489c-9625-d572a1480d57") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitRepositoryRef + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetForks function +type GetForksArgs struct { + // (required) The name or ID of the repository. + RepositoryNameOrId *string + // (required) Team project collection ID. + CollectionId *uuid.UUID + // (optional) Project ID or project name + Project *string + // (optional) True to include links. + IncludeLinks *bool +} + +// [Preview API] Request that another repository's refs be fetched into this one. It syncs two existing forks. To create a fork, please see the repositories endpoint +func (client *Client) CreateForkSyncRequest(ctx context.Context, args CreateForkSyncRequestArgs) (*GitForkSyncRequest, error) { + if args.SyncParams == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.SyncParams"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryNameOrId == nil || *args.RepositoryNameOrId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryNameOrId"} + } + routeValues["repositoryNameOrId"] = *args.RepositoryNameOrId + + queryParams := url.Values{} + if args.IncludeLinks != nil { + queryParams.Add("includeLinks", strconv.FormatBool(*args.IncludeLinks)) + } + body, marshalErr := json.Marshal(*args.SyncParams) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("1703f858-b9d1-46af-ab62-483e9e1055b5") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitForkSyncRequest + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateForkSyncRequest function +type CreateForkSyncRequestArgs struct { + // (required) Source repository and ref mapping. + SyncParams *GitForkSyncRequestParameters + // (required) The name or ID of the repository. + RepositoryNameOrId *string + // (optional) Project ID or project name + Project *string + // (optional) True to include links + IncludeLinks *bool +} + +// [Preview API] Get a specific fork sync operation's details. +func (client *Client) GetForkSyncRequest(ctx context.Context, args GetForkSyncRequestArgs) (*GitForkSyncRequest, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryNameOrId == nil || *args.RepositoryNameOrId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryNameOrId"} + } + routeValues["repositoryNameOrId"] = *args.RepositoryNameOrId + if args.ForkSyncOperationId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ForkSyncOperationId"} + } + routeValues["forkSyncOperationId"] = strconv.Itoa(*args.ForkSyncOperationId) + + queryParams := url.Values{} + if args.IncludeLinks != nil { + queryParams.Add("includeLinks", strconv.FormatBool(*args.IncludeLinks)) + } + locationId, _ := uuid.Parse("1703f858-b9d1-46af-ab62-483e9e1055b5") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitForkSyncRequest + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetForkSyncRequest function +type GetForkSyncRequestArgs struct { + // (required) The name or ID of the repository. + RepositoryNameOrId *string + // (required) OperationId of the sync request. + ForkSyncOperationId *int + // (optional) Project ID or project name + Project *string + // (optional) True to include links. + IncludeLinks *bool +} + +// [Preview API] Retrieve all requested fork sync operations on this repository. +func (client *Client) GetForkSyncRequests(ctx context.Context, args GetForkSyncRequestsArgs) (*[]GitForkSyncRequest, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryNameOrId == nil || *args.RepositoryNameOrId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryNameOrId"} + } + routeValues["repositoryNameOrId"] = *args.RepositoryNameOrId + + queryParams := url.Values{} + if args.IncludeAbandoned != nil { + queryParams.Add("includeAbandoned", strconv.FormatBool(*args.IncludeAbandoned)) + } + if args.IncludeLinks != nil { + queryParams.Add("includeLinks", strconv.FormatBool(*args.IncludeLinks)) + } + locationId, _ := uuid.Parse("1703f858-b9d1-46af-ab62-483e9e1055b5") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitForkSyncRequest + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetForkSyncRequests function +type GetForkSyncRequestsArgs struct { + // (required) The name or ID of the repository. + RepositoryNameOrId *string + // (optional) Project ID or project name + Project *string + // (optional) True to include abandoned requests. + IncludeAbandoned *bool + // (optional) True to include links. + IncludeLinks *bool +} + +// [Preview API] Create an import request. +func (client *Client) CreateImportRequest(ctx context.Context, args CreateImportRequestArgs) (*GitImportRequest, error) { + if args.ImportRequest == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ImportRequest"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + body, marshalErr := json.Marshal(*args.ImportRequest) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("01828ddc-3600-4a41-8633-99b3a73a0eb3") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitImportRequest + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateImportRequest function +type CreateImportRequestArgs struct { + // (required) The import request to create. + ImportRequest *GitImportRequest + // (required) Project ID or project name + Project *string + // (required) The name or ID of the repository. + RepositoryId *string +} + +// [Preview API] Retrieve a particular import request. +func (client *Client) GetImportRequest(ctx context.Context, args GetImportRequestArgs) (*GitImportRequest, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.ImportRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ImportRequestId"} + } + routeValues["importRequestId"] = strconv.Itoa(*args.ImportRequestId) + + locationId, _ := uuid.Parse("01828ddc-3600-4a41-8633-99b3a73a0eb3") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitImportRequest + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetImportRequest function +type GetImportRequestArgs struct { + // (required) Project ID or project name + Project *string + // (required) The name or ID of the repository. + RepositoryId *string + // (required) The unique identifier for the import request. + ImportRequestId *int +} + +// [Preview API] Retrieve import requests for a repository. +func (client *Client) QueryImportRequests(ctx context.Context, args QueryImportRequestsArgs) (*[]GitImportRequest, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.IncludeAbandoned != nil { + queryParams.Add("includeAbandoned", strconv.FormatBool(*args.IncludeAbandoned)) + } + locationId, _ := uuid.Parse("01828ddc-3600-4a41-8633-99b3a73a0eb3") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitImportRequest + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the QueryImportRequests function +type QueryImportRequestsArgs struct { + // (required) Project ID or project name + Project *string + // (required) The name or ID of the repository. + RepositoryId *string + // (optional) True to include abandoned import requests in the results. + IncludeAbandoned *bool +} + +// [Preview API] Retry or abandon a failed import request. +func (client *Client) UpdateImportRequest(ctx context.Context, args UpdateImportRequestArgs) (*GitImportRequest, error) { + if args.ImportRequestToUpdate == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ImportRequestToUpdate"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.ImportRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ImportRequestId"} + } + routeValues["importRequestId"] = strconv.Itoa(*args.ImportRequestId) + + body, marshalErr := json.Marshal(*args.ImportRequestToUpdate) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("01828ddc-3600-4a41-8633-99b3a73a0eb3") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitImportRequest + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateImportRequest function +type UpdateImportRequestArgs struct { + // (required) The updated version of the import request. Currently, the only change allowed is setting the Status to Queued or Abandoned. + ImportRequestToUpdate *GitImportRequest + // (required) Project ID or project name + Project *string + // (required) The name or ID of the repository. + RepositoryId *string + // (required) The unique identifier for the import request to update. + ImportRequestId *int +} + +// Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content, which is always returned as a download. +func (client *Client) GetItem(ctx context.Context, args GetItemArgs) (*GitItem, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.Path == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "path"} + } + queryParams.Add("path", *args.Path) + if args.ScopePath != nil { + queryParams.Add("scopePath", *args.ScopePath) + } + if args.RecursionLevel != nil { + queryParams.Add("recursionLevel", string(*args.RecursionLevel)) + } + if args.IncludeContentMetadata != nil { + queryParams.Add("includeContentMetadata", strconv.FormatBool(*args.IncludeContentMetadata)) + } + if args.LatestProcessedChange != nil { + queryParams.Add("latestProcessedChange", strconv.FormatBool(*args.LatestProcessedChange)) + } + if args.Download != nil { + queryParams.Add("download", strconv.FormatBool(*args.Download)) + } + if args.VersionDescriptor != nil { + if args.VersionDescriptor.VersionType != nil { + queryParams.Add("versionDescriptor.versionType", string(*args.VersionDescriptor.VersionType)) + } + if args.VersionDescriptor.Version != nil { + queryParams.Add("versionDescriptor.version", *args.VersionDescriptor.Version) + } + if args.VersionDescriptor.VersionOptions != nil { + queryParams.Add("versionDescriptor.versionOptions", string(*args.VersionDescriptor.VersionOptions)) + } + } + if args.IncludeContent != nil { + queryParams.Add("includeContent", strconv.FormatBool(*args.IncludeContent)) + } + if args.ResolveLfs != nil { + queryParams.Add("resolveLfs", strconv.FormatBool(*args.ResolveLfs)) + } + locationId, _ := uuid.Parse("fb93c0db-47ed-4a31-8c20-47552878fb44") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitItem + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetItem function +type GetItemArgs struct { + // (required) The name or ID of the repository. + RepositoryId *string + // (required) The item path. + Path *string + // (optional) Project ID or project name + Project *string + // (optional) The path scope. The default is null. + ScopePath *string + // (optional) The recursion level of this request. The default is 'none', no recursion. + RecursionLevel *VersionControlRecursionType + // (optional) Set to true to include content metadata. Default is false. + IncludeContentMetadata *bool + // (optional) Set to true to include the latest changes. Default is false. + LatestProcessedChange *bool + // (optional) Set to true to download the response as a file. Default is false. + Download *bool + // (optional) Version descriptor. Default is the default branch for the repository. + VersionDescriptor *GitVersionDescriptor + // (optional) Set to true to include item content when requesting json. Default is false. + IncludeContent *bool + // (optional) Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false. + ResolveLfs *bool +} + +// Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content, which is always returned as a download. +func (client *Client) GetItemContent(ctx context.Context, args GetItemContentArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.Path == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "path"} + } + queryParams.Add("path", *args.Path) + if args.ScopePath != nil { + queryParams.Add("scopePath", *args.ScopePath) + } + if args.RecursionLevel != nil { + queryParams.Add("recursionLevel", string(*args.RecursionLevel)) + } + if args.IncludeContentMetadata != nil { + queryParams.Add("includeContentMetadata", strconv.FormatBool(*args.IncludeContentMetadata)) + } + if args.LatestProcessedChange != nil { + queryParams.Add("latestProcessedChange", strconv.FormatBool(*args.LatestProcessedChange)) + } + if args.Download != nil { + queryParams.Add("download", strconv.FormatBool(*args.Download)) + } + if args.VersionDescriptor != nil { + if args.VersionDescriptor.VersionType != nil { + queryParams.Add("versionDescriptor.versionType", string(*args.VersionDescriptor.VersionType)) + } + if args.VersionDescriptor.Version != nil { + queryParams.Add("versionDescriptor.version", *args.VersionDescriptor.Version) + } + if args.VersionDescriptor.VersionOptions != nil { + queryParams.Add("versionDescriptor.versionOptions", string(*args.VersionDescriptor.VersionOptions)) + } + } + if args.IncludeContent != nil { + queryParams.Add("includeContent", strconv.FormatBool(*args.IncludeContent)) + } + if args.ResolveLfs != nil { + queryParams.Add("resolveLfs", strconv.FormatBool(*args.ResolveLfs)) + } + locationId, _ := uuid.Parse("fb93c0db-47ed-4a31-8c20-47552878fb44") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/octet-stream", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetItemContent function +type GetItemContentArgs struct { + // (required) The name or ID of the repository. + RepositoryId *string + // (required) The item path. + Path *string + // (optional) Project ID or project name + Project *string + // (optional) The path scope. The default is null. + ScopePath *string + // (optional) The recursion level of this request. The default is 'none', no recursion. + RecursionLevel *VersionControlRecursionType + // (optional) Set to true to include content metadata. Default is false. + IncludeContentMetadata *bool + // (optional) Set to true to include the latest changes. Default is false. + LatestProcessedChange *bool + // (optional) Set to true to download the response as a file. Default is false. + Download *bool + // (optional) Version descriptor. Default is the default branch for the repository. + VersionDescriptor *GitVersionDescriptor + // (optional) Set to true to include item content when requesting json. Default is false. + IncludeContent *bool + // (optional) Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false. + ResolveLfs *bool +} + +// Get Item Metadata and/or Content for a collection of items. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download. +func (client *Client) GetItems(ctx context.Context, args GetItemsArgs) (*[]GitItem, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.ScopePath != nil { + queryParams.Add("scopePath", *args.ScopePath) + } + if args.RecursionLevel != nil { + queryParams.Add("recursionLevel", string(*args.RecursionLevel)) + } + if args.IncludeContentMetadata != nil { + queryParams.Add("includeContentMetadata", strconv.FormatBool(*args.IncludeContentMetadata)) + } + if args.LatestProcessedChange != nil { + queryParams.Add("latestProcessedChange", strconv.FormatBool(*args.LatestProcessedChange)) + } + if args.Download != nil { + queryParams.Add("download", strconv.FormatBool(*args.Download)) + } + if args.IncludeLinks != nil { + queryParams.Add("includeLinks", strconv.FormatBool(*args.IncludeLinks)) + } + if args.VersionDescriptor != nil { + if args.VersionDescriptor.VersionType != nil { + queryParams.Add("versionDescriptor.versionType", string(*args.VersionDescriptor.VersionType)) + } + if args.VersionDescriptor.Version != nil { + queryParams.Add("versionDescriptor.version", *args.VersionDescriptor.Version) + } + if args.VersionDescriptor.VersionOptions != nil { + queryParams.Add("versionDescriptor.versionOptions", string(*args.VersionDescriptor.VersionOptions)) + } + } + locationId, _ := uuid.Parse("fb93c0db-47ed-4a31-8c20-47552878fb44") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitItem + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetItems function +type GetItemsArgs struct { + // (required) The name or ID of the repository. + RepositoryId *string + // (optional) Project ID or project name + Project *string + // (optional) The path scope. The default is null. + ScopePath *string + // (optional) The recursion level of this request. The default is 'none', no recursion. + RecursionLevel *VersionControlRecursionType + // (optional) Set to true to include content metadata. Default is false. + IncludeContentMetadata *bool + // (optional) Set to true to include the latest changes. Default is false. + LatestProcessedChange *bool + // (optional) Set to true to download the response as a file. Default is false. + Download *bool + // (optional) Set to true to include links to items. Default is false. + IncludeLinks *bool + // (optional) Version descriptor. Default is the default branch for the repository. + VersionDescriptor *GitVersionDescriptor +} + +// Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content, which is always returned as a download. +func (client *Client) GetItemText(ctx context.Context, args GetItemTextArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.Path == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "path"} + } + queryParams.Add("path", *args.Path) + if args.ScopePath != nil { + queryParams.Add("scopePath", *args.ScopePath) + } + if args.RecursionLevel != nil { + queryParams.Add("recursionLevel", string(*args.RecursionLevel)) + } + if args.IncludeContentMetadata != nil { + queryParams.Add("includeContentMetadata", strconv.FormatBool(*args.IncludeContentMetadata)) + } + if args.LatestProcessedChange != nil { + queryParams.Add("latestProcessedChange", strconv.FormatBool(*args.LatestProcessedChange)) + } + if args.Download != nil { + queryParams.Add("download", strconv.FormatBool(*args.Download)) + } + if args.VersionDescriptor != nil { + if args.VersionDescriptor.VersionType != nil { + queryParams.Add("versionDescriptor.versionType", string(*args.VersionDescriptor.VersionType)) + } + if args.VersionDescriptor.Version != nil { + queryParams.Add("versionDescriptor.version", *args.VersionDescriptor.Version) + } + if args.VersionDescriptor.VersionOptions != nil { + queryParams.Add("versionDescriptor.versionOptions", string(*args.VersionDescriptor.VersionOptions)) + } + } + if args.IncludeContent != nil { + queryParams.Add("includeContent", strconv.FormatBool(*args.IncludeContent)) + } + if args.ResolveLfs != nil { + queryParams.Add("resolveLfs", strconv.FormatBool(*args.ResolveLfs)) + } + locationId, _ := uuid.Parse("fb93c0db-47ed-4a31-8c20-47552878fb44") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "text/plain", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetItemText function +type GetItemTextArgs struct { + // (required) The name or ID of the repository. + RepositoryId *string + // (required) The item path. + Path *string + // (optional) Project ID or project name + Project *string + // (optional) The path scope. The default is null. + ScopePath *string + // (optional) The recursion level of this request. The default is 'none', no recursion. + RecursionLevel *VersionControlRecursionType + // (optional) Set to true to include content metadata. Default is false. + IncludeContentMetadata *bool + // (optional) Set to true to include the latest changes. Default is false. + LatestProcessedChange *bool + // (optional) Set to true to download the response as a file. Default is false. + Download *bool + // (optional) Version descriptor. Default is the default branch for the repository. + VersionDescriptor *GitVersionDescriptor + // (optional) Set to true to include item content when requesting json. Default is false. + IncludeContent *bool + // (optional) Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false. + ResolveLfs *bool +} + +// Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content, which is always returned as a download. +func (client *Client) GetItemZip(ctx context.Context, args GetItemZipArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.Path == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "path"} + } + queryParams.Add("path", *args.Path) + if args.ScopePath != nil { + queryParams.Add("scopePath", *args.ScopePath) + } + if args.RecursionLevel != nil { + queryParams.Add("recursionLevel", string(*args.RecursionLevel)) + } + if args.IncludeContentMetadata != nil { + queryParams.Add("includeContentMetadata", strconv.FormatBool(*args.IncludeContentMetadata)) + } + if args.LatestProcessedChange != nil { + queryParams.Add("latestProcessedChange", strconv.FormatBool(*args.LatestProcessedChange)) + } + if args.Download != nil { + queryParams.Add("download", strconv.FormatBool(*args.Download)) + } + if args.VersionDescriptor != nil { + if args.VersionDescriptor.VersionType != nil { + queryParams.Add("versionDescriptor.versionType", string(*args.VersionDescriptor.VersionType)) + } + if args.VersionDescriptor.Version != nil { + queryParams.Add("versionDescriptor.version", *args.VersionDescriptor.Version) + } + if args.VersionDescriptor.VersionOptions != nil { + queryParams.Add("versionDescriptor.versionOptions", string(*args.VersionDescriptor.VersionOptions)) + } + } + if args.IncludeContent != nil { + queryParams.Add("includeContent", strconv.FormatBool(*args.IncludeContent)) + } + if args.ResolveLfs != nil { + queryParams.Add("resolveLfs", strconv.FormatBool(*args.ResolveLfs)) + } + locationId, _ := uuid.Parse("fb93c0db-47ed-4a31-8c20-47552878fb44") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/zip", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetItemZip function +type GetItemZipArgs struct { + // (required) The name or ID of the repository. + RepositoryId *string + // (required) The item path. + Path *string + // (optional) Project ID or project name + Project *string + // (optional) The path scope. The default is null. + ScopePath *string + // (optional) The recursion level of this request. The default is 'none', no recursion. + RecursionLevel *VersionControlRecursionType + // (optional) Set to true to include content metadata. Default is false. + IncludeContentMetadata *bool + // (optional) Set to true to include the latest changes. Default is false. + LatestProcessedChange *bool + // (optional) Set to true to download the response as a file. Default is false. + Download *bool + // (optional) Version descriptor. Default is the default branch for the repository. + VersionDescriptor *GitVersionDescriptor + // (optional) Set to true to include item content when requesting json. Default is false. + IncludeContent *bool + // (optional) Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false. + ResolveLfs *bool +} + +// Post for retrieving a creating a batch out of a set of items in a repo / project given a list of paths or a long path +func (client *Client) GetItemsBatch(ctx context.Context, args GetItemsBatchArgs) (*[][]GitItem, error) { + if args.RequestData == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RequestData"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + body, marshalErr := json.Marshal(*args.RequestData) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("630fd2e4-fb88-4f85-ad21-13f3fd1fbca9") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue [][]GitItem + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetItemsBatch function +type GetItemsBatchArgs struct { + // (required) Request data attributes: ItemDescriptors, IncludeContentMetadata, LatestProcessedChange, IncludeLinks. ItemDescriptors: Collection of items to fetch, including path, version, and recursion level. IncludeContentMetadata: Whether to include metadata for all items LatestProcessedChange: Whether to include shallow ref to commit that last changed each item. IncludeLinks: Whether to include the _links field on the shallow references. + RequestData *GitItemRequestData + // (required) The name or ID of the repository + RepositoryId *string + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Find the merge bases of two commits, optionally across forks. If otherRepositoryId is not specified, the merge bases will only be calculated within the context of the local repositoryNameOrId. +func (client *Client) GetMergeBases(ctx context.Context, args GetMergeBasesArgs) (*[]GitCommitRef, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryNameOrId == nil || *args.RepositoryNameOrId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryNameOrId"} + } + routeValues["repositoryNameOrId"] = *args.RepositoryNameOrId + if args.CommitId == nil || *args.CommitId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.CommitId"} + } + routeValues["commitId"] = *args.CommitId + + queryParams := url.Values{} + if args.OtherCommitId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "otherCommitId"} + } + queryParams.Add("otherCommitId", *args.OtherCommitId) + if args.OtherCollectionId != nil { + queryParams.Add("otherCollectionId", (*args.OtherCollectionId).String()) + } + if args.OtherRepositoryId != nil { + queryParams.Add("otherRepositoryId", (*args.OtherRepositoryId).String()) + } + locationId, _ := uuid.Parse("7cf2abb6-c964-4f7e-9872-f78c66e72e9c") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitCommitRef + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetMergeBases function +type GetMergeBasesArgs struct { + // (required) ID or name of the local repository. + RepositoryNameOrId *string + // (required) First commit, usually the tip of the target branch of the potential merge. + CommitId *string + // (required) Other commit, usually the tip of the source branch of the potential merge. + OtherCommitId *string + // (optional) Project ID or project name + Project *string + // (optional) The collection ID where otherCommitId lives. + OtherCollectionId *uuid.UUID + // (optional) The repository ID where otherCommitId lives. + OtherRepositoryId *uuid.UUID +} + +// [Preview API] Request a git merge operation. Currently we support merging only 2 commits. +func (client *Client) CreateMergeRequest(ctx context.Context, args CreateMergeRequestArgs) (*GitMerge, error) { + if args.MergeParameters == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.MergeParameters"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RepositoryNameOrId == nil || *args.RepositoryNameOrId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryNameOrId"} + } + routeValues["repositoryNameOrId"] = *args.RepositoryNameOrId + + queryParams := url.Values{} + if args.IncludeLinks != nil { + queryParams.Add("includeLinks", strconv.FormatBool(*args.IncludeLinks)) + } + body, marshalErr := json.Marshal(*args.MergeParameters) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("985f7ae9-844f-4906-9897-7ef41516c0e2") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitMerge + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateMergeRequest function +type CreateMergeRequestArgs struct { + // (required) Parents commitIds and merge commit messsage. + MergeParameters *GitMergeParameters + // (required) Project ID or project name + Project *string + // (required) The name or ID of the repository. + RepositoryNameOrId *string + // (optional) True to include links + IncludeLinks *bool +} + +// [Preview API] Get a specific merge operation's details. +func (client *Client) GetMergeRequest(ctx context.Context, args GetMergeRequestArgs) (*GitMerge, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RepositoryNameOrId == nil || *args.RepositoryNameOrId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryNameOrId"} + } + routeValues["repositoryNameOrId"] = *args.RepositoryNameOrId + if args.MergeOperationId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.MergeOperationId"} + } + routeValues["mergeOperationId"] = strconv.Itoa(*args.MergeOperationId) + + queryParams := url.Values{} + if args.IncludeLinks != nil { + queryParams.Add("includeLinks", strconv.FormatBool(*args.IncludeLinks)) + } + locationId, _ := uuid.Parse("985f7ae9-844f-4906-9897-7ef41516c0e2") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitMerge + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetMergeRequest function +type GetMergeRequestArgs struct { + // (required) Project ID or project name + Project *string + // (required) The name or ID of the repository. + RepositoryNameOrId *string + // (required) OperationId of the merge request. + MergeOperationId *int + // (optional) True to include links + IncludeLinks *bool +} + +// [Preview API] Retrieve a list of policy configurations by a given set of scope/filtering criteria. +func (client *Client) GetPolicyConfigurations(ctx context.Context, args GetPolicyConfigurationsArgs) (*GitPolicyConfigurationResponse, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + queryParams := url.Values{} + if args.RepositoryId != nil { + queryParams.Add("repositoryId", (*args.RepositoryId).String()) + } + if args.RefName != nil { + queryParams.Add("refName", *args.RefName) + } + if args.PolicyType != nil { + queryParams.Add("policyType", (*args.PolicyType).String()) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + if args.ContinuationToken != nil { + queryParams.Add("continuationToken", *args.ContinuationToken) + } + locationId, _ := uuid.Parse("2c420070-a0a2-49cc-9639-c9f271c5ff07") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseBodyValue []policy.PolicyConfiguration + err = client.Client.UnmarshalBody(resp, &responseBodyValue) + + var responseValue *GitPolicyConfigurationResponse + xmsContinuationTokenHeader := resp.Header.Get("x-ms-continuationtoken") + if err == nil { + responseValue = &GitPolicyConfigurationResponse{ + PolicyConfigurations: &responseBodyValue, + ContinuationToken: &xmsContinuationTokenHeader, + } + } + + return responseValue, err +} + +// Arguments for the GetPolicyConfigurations function +type GetPolicyConfigurationsArgs struct { + // (required) Project ID or project name + Project *string + // (optional) The repository id. + RepositoryId *uuid.UUID + // (optional) The fully-qualified Git ref name (e.g. refs/heads/master). + RefName *string + // (optional) The policy type filter. + PolicyType *uuid.UUID + // (optional) Maximum number of policies to return. + Top *int + // (optional) Pass a policy configuration ID to fetch the next page of results, up to top number of results, for this endpoint. + ContinuationToken *string +} + +// [Preview API] Attach a new file to a pull request. +func (client *Client) CreateAttachment(ctx context.Context, args CreateAttachmentArgs) (*Attachment, error) { + if args.UploadStream == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.UploadStream"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.FileName == nil || *args.FileName == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.FileName"} + } + routeValues["fileName"] = *args.FileName + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + + locationId, _ := uuid.Parse("965d9361-878b-413b-a494-45d5b5fd8ab7") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, nil, args.UploadStream, "application/octet-stream", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue Attachment + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateAttachment function +type CreateAttachmentArgs struct { + // (required) Stream to upload + UploadStream io.Reader + // (required) The name of the file. + FileName *string + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Delete a pull request attachment. +func (client *Client) DeleteAttachment(ctx context.Context, args DeleteAttachmentArgs) error { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.FileName == nil || *args.FileName == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.FileName"} + } + routeValues["fileName"] = *args.FileName + if args.RepositoryId == nil || *args.RepositoryId == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + + locationId, _ := uuid.Parse("965d9361-878b-413b-a494-45d5b5fd8ab7") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeleteAttachment function +type DeleteAttachmentArgs struct { + // (required) The name of the attachment to delete. + FileName *string + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Get the file content of a pull request attachment. +func (client *Client) GetAttachmentContent(ctx context.Context, args GetAttachmentContentArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.FileName == nil || *args.FileName == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.FileName"} + } + routeValues["fileName"] = *args.FileName + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + + locationId, _ := uuid.Parse("965d9361-878b-413b-a494-45d5b5fd8ab7") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/octet-stream", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetAttachmentContent function +type GetAttachmentContentArgs struct { + // (required) The name of the attachment. + FileName *string + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Get a list of files attached to a given pull request. +func (client *Client) GetAttachments(ctx context.Context, args GetAttachmentsArgs) (*[]Attachment, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + + locationId, _ := uuid.Parse("965d9361-878b-413b-a494-45d5b5fd8ab7") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []Attachment + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetAttachments function +type GetAttachmentsArgs struct { + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Get the file content of a pull request attachment. +func (client *Client) GetAttachmentZip(ctx context.Context, args GetAttachmentZipArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.FileName == nil || *args.FileName == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.FileName"} + } + routeValues["fileName"] = *args.FileName + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + + locationId, _ := uuid.Parse("965d9361-878b-413b-a494-45d5b5fd8ab7") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/zip", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetAttachmentZip function +type GetAttachmentZipArgs struct { + // (required) The name of the attachment. + FileName *string + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Add a like on a comment. +func (client *Client) CreateLike(ctx context.Context, args CreateLikeArgs) error { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.ThreadId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.ThreadId"} + } + routeValues["threadId"] = strconv.Itoa(*args.ThreadId) + if args.CommentId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.CommentId"} + } + routeValues["commentId"] = strconv.Itoa(*args.CommentId) + + locationId, _ := uuid.Parse("5f2e2851-1389-425b-a00b-fb2adb3ef31b") + _, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the CreateLike function +type CreateLikeArgs struct { + // (required) The repository ID of the pull request's target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) The ID of the thread that contains the comment. + ThreadId *int + // (required) The ID of the comment. + CommentId *int + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Delete a like on a comment. +func (client *Client) DeleteLike(ctx context.Context, args DeleteLikeArgs) error { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.ThreadId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.ThreadId"} + } + routeValues["threadId"] = strconv.Itoa(*args.ThreadId) + if args.CommentId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.CommentId"} + } + routeValues["commentId"] = strconv.Itoa(*args.CommentId) + + locationId, _ := uuid.Parse("5f2e2851-1389-425b-a00b-fb2adb3ef31b") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeleteLike function +type DeleteLikeArgs struct { + // (required) The repository ID of the pull request's target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) The ID of the thread that contains the comment. + ThreadId *int + // (required) The ID of the comment. + CommentId *int + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Get likes for a comment. +func (client *Client) GetLikes(ctx context.Context, args GetLikesArgs) (*[]webapi.IdentityRef, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.ThreadId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ThreadId"} + } + routeValues["threadId"] = strconv.Itoa(*args.ThreadId) + if args.CommentId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.CommentId"} + } + routeValues["commentId"] = strconv.Itoa(*args.CommentId) + + locationId, _ := uuid.Parse("5f2e2851-1389-425b-a00b-fb2adb3ef31b") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []webapi.IdentityRef + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetLikes function +type GetLikesArgs struct { + // (required) The repository ID of the pull request's target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) The ID of the thread that contains the comment. + ThreadId *int + // (required) The ID of the comment. + CommentId *int + // (optional) Project ID or project name + Project *string +} + +// Get the commits for the specified iteration of a pull request. +func (client *Client) GetPullRequestIterationCommits(ctx context.Context, args GetPullRequestIterationCommitsArgs) (*[]GitCommitRef, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.IterationId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.IterationId"} + } + routeValues["iterationId"] = strconv.Itoa(*args.IterationId) + + queryParams := url.Values{} + if args.Top != nil { + queryParams.Add("top", strconv.Itoa(*args.Top)) + } + if args.Skip != nil { + queryParams.Add("skip", strconv.Itoa(*args.Skip)) + } + locationId, _ := uuid.Parse("e7ea0883-095f-4926-b5fb-f24691c26fb9") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitCommitRef + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPullRequestIterationCommits function +type GetPullRequestIterationCommitsArgs struct { + // (required) ID or name of the repository. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) ID of the iteration from which to get the commits. + IterationId *int + // (optional) Project ID or project name + Project *string + // (optional) Maximum number of commits to return. The maximum number of commits that can be returned per batch is 500. + Top *int + // (optional) Number of commits to skip. + Skip *int +} + +// Get the commits for the specified pull request. +func (client *Client) GetPullRequestCommits(ctx context.Context, args GetPullRequestCommitsArgs) (*GetPullRequestCommitsResponseValue, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + + locationId, _ := uuid.Parse("52823034-34a8-4576-922c-8d8b77e9e4c4") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GetPullRequestCommitsResponseValue + responseValue.ContinuationToken = resp.Header.Get(azuredevops.HeaderKeyContinuationToken) + err = client.Client.UnmarshalCollectionBody(resp, &responseValue.Value) + return &responseValue, err +} + +// Arguments for the GetPullRequestCommits function +type GetPullRequestCommitsArgs struct { + // (required) ID or name of the repository. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (optional) Project ID or project name + Project *string +} + +// Return type for the GetPullRequestCommits function +type GetPullRequestCommitsResponseValue struct { + Value []GitCommitRef + // The continuation token to be used to get the next page of results. + ContinuationToken string +} + +// Retrieve the changes made in a pull request between two iterations. +func (client *Client) GetPullRequestIterationChanges(ctx context.Context, args GetPullRequestIterationChangesArgs) (*GitPullRequestIterationChanges, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.IterationId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.IterationId"} + } + routeValues["iterationId"] = strconv.Itoa(*args.IterationId) + + queryParams := url.Values{} + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + if args.Skip != nil { + queryParams.Add("$skip", strconv.Itoa(*args.Skip)) + } + if args.CompareTo != nil { + queryParams.Add("$compareTo", strconv.Itoa(*args.CompareTo)) + } + locationId, _ := uuid.Parse("4216bdcf-b6b1-4d59-8b82-c34cc183fc8b") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitPullRequestIterationChanges + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPullRequestIterationChanges function +type GetPullRequestIterationChangesArgs struct { + // (required) The repository ID of the pull request's target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) ID of the pull request iteration.
Iteration IDs are zero-based with zero indicating the common commit between the source and target branches. Iteration one is the head of the source branch at the time the pull request is created and subsequent iterations are created when there are pushes to the source branch. + IterationId *int + // (optional) Project ID or project name + Project *string + // (optional) Optional. The number of changes to retrieve. The default value is 100 and the maximum value is 2000. + Top *int + // (optional) Optional. The number of changes to ignore. For example, to retrieve changes 101-150, set top 50 and skip to 100. + Skip *int + // (optional) ID of the pull request iteration to compare against. The default value is zero which indicates the comparison is made against the common commit between the source and target branches + CompareTo *int +} + +// Get the specified iteration for a pull request. +func (client *Client) GetPullRequestIteration(ctx context.Context, args GetPullRequestIterationArgs) (*GitPullRequestIteration, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.IterationId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.IterationId"} + } + routeValues["iterationId"] = strconv.Itoa(*args.IterationId) + + locationId, _ := uuid.Parse("d43911ee-6958-46b0-a42b-8445b8a0d004") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitPullRequestIteration + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPullRequestIteration function +type GetPullRequestIterationArgs struct { + // (required) ID or name of the repository. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) ID of the pull request iteration to return. + IterationId *int + // (optional) Project ID or project name + Project *string +} + +// Get the list of iterations for the specified pull request. +func (client *Client) GetPullRequestIterations(ctx context.Context, args GetPullRequestIterationsArgs) (*[]GitPullRequestIteration, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + + queryParams := url.Values{} + if args.IncludeCommits != nil { + queryParams.Add("includeCommits", strconv.FormatBool(*args.IncludeCommits)) + } + locationId, _ := uuid.Parse("d43911ee-6958-46b0-a42b-8445b8a0d004") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitPullRequestIteration + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPullRequestIterations function +type GetPullRequestIterationsArgs struct { + // (required) ID or name of the repository. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (optional) Project ID or project name + Project *string + // (optional) If true, include the commits associated with each iteration in the response. + IncludeCommits *bool +} + +// [Preview API] Create a pull request status on the iteration. This operation will have the same result as Create status on pull request with specified iteration ID in the request body. +func (client *Client) CreatePullRequestIterationStatus(ctx context.Context, args CreatePullRequestIterationStatusArgs) (*GitPullRequestStatus, error) { + if args.Status == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Status"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.IterationId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.IterationId"} + } + routeValues["iterationId"] = strconv.Itoa(*args.IterationId) + + body, marshalErr := json.Marshal(*args.Status) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("75cf11c5-979f-4038-a76e-058a06adf2bf") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitPullRequestStatus + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreatePullRequestIterationStatus function +type CreatePullRequestIterationStatusArgs struct { + // (required) Pull request status to create. + Status *GitPullRequestStatus + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) ID of the pull request iteration. + IterationId *int + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Delete pull request iteration status. +func (client *Client) DeletePullRequestIterationStatus(ctx context.Context, args DeletePullRequestIterationStatusArgs) error { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.IterationId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.IterationId"} + } + routeValues["iterationId"] = strconv.Itoa(*args.IterationId) + if args.StatusId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.StatusId"} + } + routeValues["statusId"] = strconv.Itoa(*args.StatusId) + + locationId, _ := uuid.Parse("75cf11c5-979f-4038-a76e-058a06adf2bf") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeletePullRequestIterationStatus function +type DeletePullRequestIterationStatusArgs struct { + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) ID of the pull request iteration. + IterationId *int + // (required) ID of the pull request status. + StatusId *int + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Get the specific pull request iteration status by ID. The status ID is unique within the pull request across all iterations. +func (client *Client) GetPullRequestIterationStatus(ctx context.Context, args GetPullRequestIterationStatusArgs) (*GitPullRequestStatus, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.IterationId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.IterationId"} + } + routeValues["iterationId"] = strconv.Itoa(*args.IterationId) + if args.StatusId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.StatusId"} + } + routeValues["statusId"] = strconv.Itoa(*args.StatusId) + + locationId, _ := uuid.Parse("75cf11c5-979f-4038-a76e-058a06adf2bf") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitPullRequestStatus + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPullRequestIterationStatus function +type GetPullRequestIterationStatusArgs struct { + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) ID of the pull request iteration. + IterationId *int + // (required) ID of the pull request status. + StatusId *int + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Get all the statuses associated with a pull request iteration. +func (client *Client) GetPullRequestIterationStatuses(ctx context.Context, args GetPullRequestIterationStatusesArgs) (*[]GitPullRequestStatus, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.IterationId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.IterationId"} + } + routeValues["iterationId"] = strconv.Itoa(*args.IterationId) + + locationId, _ := uuid.Parse("75cf11c5-979f-4038-a76e-058a06adf2bf") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitPullRequestStatus + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPullRequestIterationStatuses function +type GetPullRequestIterationStatusesArgs struct { + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) ID of the pull request iteration. + IterationId *int + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Update pull request iteration statuses collection. The only supported operation type is `remove`. +func (client *Client) UpdatePullRequestIterationStatuses(ctx context.Context, args UpdatePullRequestIterationStatusesArgs) error { + if args.PatchDocument == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.PatchDocument"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.IterationId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.IterationId"} + } + routeValues["iterationId"] = strconv.Itoa(*args.IterationId) + + body, marshalErr := json.Marshal(*args.PatchDocument) + if marshalErr != nil { + return marshalErr + } + locationId, _ := uuid.Parse("75cf11c5-979f-4038-a76e-058a06adf2bf") + _, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json-patch+json", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the UpdatePullRequestIterationStatuses function +type UpdatePullRequestIterationStatusesArgs struct { + // (required) Operations to apply to the pull request statuses in JSON Patch format. + PatchDocument *[]webapi.JsonPatchOperation + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) ID of the pull request iteration. + IterationId *int + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Create a label for a specified pull request. The only required field is the name of the new label. +func (client *Client) CreatePullRequestLabel(ctx context.Context, args CreatePullRequestLabelArgs) (*core.WebApiTagDefinition, error) { + if args.Label == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Label"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + + queryParams := url.Values{} + if args.ProjectId != nil { + queryParams.Add("projectId", *args.ProjectId) + } + body, marshalErr := json.Marshal(*args.Label) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("f22387e3-984e-4c52-9c6d-fbb8f14c812d") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue core.WebApiTagDefinition + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreatePullRequestLabel function +type CreatePullRequestLabelArgs struct { + // (required) Label to assign to the pull request. + Label *core.WebApiCreateTagRequestData + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (optional) Project ID or project name + Project *string + // (optional) Project ID or project name. + ProjectId *string +} + +// [Preview API] Removes a label from the set of those assigned to the pull request. +func (client *Client) DeletePullRequestLabels(ctx context.Context, args DeletePullRequestLabelsArgs) error { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.LabelIdOrName == nil || *args.LabelIdOrName == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.LabelIdOrName"} + } + routeValues["labelIdOrName"] = *args.LabelIdOrName + + queryParams := url.Values{} + if args.ProjectId != nil { + queryParams.Add("projectId", *args.ProjectId) + } + locationId, _ := uuid.Parse("f22387e3-984e-4c52-9c6d-fbb8f14c812d") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeletePullRequestLabels function +type DeletePullRequestLabelsArgs struct { + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) The name or ID of the label requested. + LabelIdOrName *string + // (optional) Project ID or project name + Project *string + // (optional) Project ID or project name. + ProjectId *string +} + +// [Preview API] Retrieves a single label that has been assigned to a pull request. +func (client *Client) GetPullRequestLabel(ctx context.Context, args GetPullRequestLabelArgs) (*core.WebApiTagDefinition, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.LabelIdOrName == nil || *args.LabelIdOrName == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.LabelIdOrName"} + } + routeValues["labelIdOrName"] = *args.LabelIdOrName + + queryParams := url.Values{} + if args.ProjectId != nil { + queryParams.Add("projectId", *args.ProjectId) + } + locationId, _ := uuid.Parse("f22387e3-984e-4c52-9c6d-fbb8f14c812d") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue core.WebApiTagDefinition + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPullRequestLabel function +type GetPullRequestLabelArgs struct { + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) The name or ID of the label requested. + LabelIdOrName *string + // (optional) Project ID or project name + Project *string + // (optional) Project ID or project name. + ProjectId *string +} + +// [Preview API] Get all the labels assigned to a pull request. +func (client *Client) GetPullRequestLabels(ctx context.Context, args GetPullRequestLabelsArgs) (*[]core.WebApiTagDefinition, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + + queryParams := url.Values{} + if args.ProjectId != nil { + queryParams.Add("projectId", *args.ProjectId) + } + locationId, _ := uuid.Parse("f22387e3-984e-4c52-9c6d-fbb8f14c812d") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []core.WebApiTagDefinition + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPullRequestLabels function +type GetPullRequestLabelsArgs struct { + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (optional) Project ID or project name + Project *string + // (optional) Project ID or project name. + ProjectId *string +} + +// [Preview API] Get external properties of the pull request. +func (client *Client) GetPullRequestProperties(ctx context.Context, args GetPullRequestPropertiesArgs) (interface{}, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + + locationId, _ := uuid.Parse("48a52185-5b9e-4736-9dc1-bb1e2feac80b") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue interface{} + err = client.Client.UnmarshalBody(resp, responseValue) + return responseValue, err +} + +// Arguments for the GetPullRequestProperties function +type GetPullRequestPropertiesArgs struct { + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Create or update pull request external properties. The patch operation can be `add`, `replace` or `remove`. For `add` operation, the path can be empty. If the path is empty, the value must be a list of key value pairs. For `replace` operation, the path cannot be empty. If the path does not exist, the property will be added to the collection. For `remove` operation, the path cannot be empty. If the path does not exist, no action will be performed. +func (client *Client) UpdatePullRequestProperties(ctx context.Context, args UpdatePullRequestPropertiesArgs) (interface{}, error) { + if args.PatchDocument == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PatchDocument"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + + body, marshalErr := json.Marshal(*args.PatchDocument) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("48a52185-5b9e-4736-9dc1-bb1e2feac80b") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json-patch+json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue interface{} + err = client.Client.UnmarshalBody(resp, responseValue) + return responseValue, err +} + +// Arguments for the UpdatePullRequestProperties function +type UpdatePullRequestPropertiesArgs struct { + // (required) Properties to add, replace or remove in JSON Patch format. + PatchDocument *[]webapi.JsonPatchOperation + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (optional) Project ID or project name + Project *string +} + +// This API is used to find what pull requests are related to a given commit. It can be used to either find the pull request that created a particular merge commit or it can be used to find all pull requests that have ever merged a particular commit. The input is a list of queries which each contain a list of commits. For each commit that you search against, you will get back a dictionary of commit -> pull requests. +func (client *Client) GetPullRequestQuery(ctx context.Context, args GetPullRequestQueryArgs) (*GitPullRequestQuery, error) { + if args.Queries == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Queries"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + body, marshalErr := json.Marshal(*args.Queries) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("b3a6eebe-9cf0-49ea-b6cb-1a4c5f5007b0") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitPullRequestQuery + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPullRequestQuery function +type GetPullRequestQueryArgs struct { + // (required) The list of queries to perform. + Queries *GitPullRequestQuery + // (required) ID of the repository. + RepositoryId *string + // (optional) Project ID or project name + Project *string +} + +// Add a reviewer to a pull request or cast a vote. +func (client *Client) CreatePullRequestReviewer(ctx context.Context, args CreatePullRequestReviewerArgs) (*IdentityRefWithVote, error) { + if args.Reviewer == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Reviewer"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.ReviewerId == nil || *args.ReviewerId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ReviewerId"} + } + routeValues["reviewerId"] = *args.ReviewerId + + body, marshalErr := json.Marshal(*args.Reviewer) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("4b6702c7-aa35-4b89-9c96-b9abf6d3e540") + resp, err := client.Client.Send(ctx, http.MethodPut, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue IdentityRefWithVote + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreatePullRequestReviewer function +type CreatePullRequestReviewerArgs struct { + // (required) Reviewer's vote.
If the reviewer's ID is included here, it must match the reviewerID parameter.
Reviewers can set their own vote with this method. When adding other reviewers, vote must be set to zero. + Reviewer *IdentityRefWithVote + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) ID of the reviewer. + ReviewerId *string + // (optional) Project ID or project name + Project *string +} + +// Add reviewers to a pull request. +func (client *Client) CreatePullRequestReviewers(ctx context.Context, args CreatePullRequestReviewersArgs) (*[]IdentityRefWithVote, error) { + if args.Reviewers == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Reviewers"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + + body, marshalErr := json.Marshal(*args.Reviewers) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("4b6702c7-aa35-4b89-9c96-b9abf6d3e540") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []IdentityRefWithVote + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreatePullRequestReviewers function +type CreatePullRequestReviewersArgs struct { + // (required) Reviewers to add to the pull request. + Reviewers *[]webapi.IdentityRef + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (optional) Project ID or project name + Project *string +} + +// Remove a reviewer from a pull request. +func (client *Client) DeletePullRequestReviewer(ctx context.Context, args DeletePullRequestReviewerArgs) error { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.ReviewerId == nil || *args.ReviewerId == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ReviewerId"} + } + routeValues["reviewerId"] = *args.ReviewerId + + locationId, _ := uuid.Parse("4b6702c7-aa35-4b89-9c96-b9abf6d3e540") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeletePullRequestReviewer function +type DeletePullRequestReviewerArgs struct { + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) ID of the reviewer to remove. + ReviewerId *string + // (optional) Project ID or project name + Project *string +} + +// Retrieve information about a particular reviewer on a pull request +func (client *Client) GetPullRequestReviewer(ctx context.Context, args GetPullRequestReviewerArgs) (*IdentityRefWithVote, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.ReviewerId == nil || *args.ReviewerId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ReviewerId"} + } + routeValues["reviewerId"] = *args.ReviewerId + + locationId, _ := uuid.Parse("4b6702c7-aa35-4b89-9c96-b9abf6d3e540") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue IdentityRefWithVote + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPullRequestReviewer function +type GetPullRequestReviewerArgs struct { + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) ID of the reviewer. + ReviewerId *string + // (optional) Project ID or project name + Project *string +} + +// Retrieve the reviewers for a pull request +func (client *Client) GetPullRequestReviewers(ctx context.Context, args GetPullRequestReviewersArgs) (*[]IdentityRefWithVote, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + + locationId, _ := uuid.Parse("4b6702c7-aa35-4b89-9c96-b9abf6d3e540") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []IdentityRefWithVote + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPullRequestReviewers function +type GetPullRequestReviewersArgs struct { + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (optional) Project ID or project name + Project *string +} + +// Reset the votes of multiple reviewers on a pull request. NOTE: This endpoint only supports updating votes, but does not support updating required reviewers (use policy) or display names. +func (client *Client) UpdatePullRequestReviewers(ctx context.Context, args UpdatePullRequestReviewersArgs) error { + if args.PatchVotes == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.PatchVotes"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + + body, marshalErr := json.Marshal(*args.PatchVotes) + if marshalErr != nil { + return marshalErr + } + locationId, _ := uuid.Parse("4b6702c7-aa35-4b89-9c96-b9abf6d3e540") + _, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the UpdatePullRequestReviewers function +type UpdatePullRequestReviewersArgs struct { + // (required) IDs of the reviewers whose votes will be reset to zero + PatchVotes *[]IdentityRefWithVote + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request + PullRequestId *int + // (optional) Project ID or project name + Project *string +} + +// Retrieve a pull request. +func (client *Client) GetPullRequestById(ctx context.Context, args GetPullRequestByIdArgs) (*GitPullRequest, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + + locationId, _ := uuid.Parse("01a46dea-7d46-4d40-bc84-319e7c260d99") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitPullRequest + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPullRequestById function +type GetPullRequestByIdArgs struct { + // (required) The ID of the pull request to retrieve. + PullRequestId *int + // (optional) Project ID or project name + Project *string +} + +// Retrieve all pull requests matching a specified criteria. +func (client *Client) GetPullRequestsByProject(ctx context.Context, args GetPullRequestsByProjectArgs) (*[]GitPullRequest, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + queryParams := url.Values{} + if args.SearchCriteria == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "searchCriteria"} + } + if args.SearchCriteria.RepositoryId != nil { + queryParams.Add("searchCriteria.repositoryId", (*args.SearchCriteria.RepositoryId).String()) + } + if args.SearchCriteria.CreatorId != nil { + queryParams.Add("searchCriteria.creatorId", (*args.SearchCriteria.CreatorId).String()) + } + if args.SearchCriteria.ReviewerId != nil { + queryParams.Add("searchCriteria.reviewerId", (*args.SearchCriteria.ReviewerId).String()) + } + if args.SearchCriteria.Status != nil { + queryParams.Add("searchCriteria.status", string(*args.SearchCriteria.Status)) + } + if args.SearchCriteria.TargetRefName != nil { + queryParams.Add("searchCriteria.targetRefName", *args.SearchCriteria.TargetRefName) + } + if args.SearchCriteria.SourceRepositoryId != nil { + queryParams.Add("searchCriteria.sourceRepositoryId", (*args.SearchCriteria.SourceRepositoryId).String()) + } + if args.SearchCriteria.SourceRefName != nil { + queryParams.Add("searchCriteria.sourceRefName", *args.SearchCriteria.SourceRefName) + } + if args.SearchCriteria.IncludeLinks != nil { + queryParams.Add("searchCriteria.includeLinks", strconv.FormatBool(*args.SearchCriteria.IncludeLinks)) + } + if args.MaxCommentLength != nil { + queryParams.Add("maxCommentLength", strconv.Itoa(*args.MaxCommentLength)) + } + if args.Skip != nil { + queryParams.Add("$skip", strconv.Itoa(*args.Skip)) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + locationId, _ := uuid.Parse("a5d28130-9cd2-40fa-9f08-902e7daa9efb") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitPullRequest + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPullRequestsByProject function +type GetPullRequestsByProjectArgs struct { + // (required) Project ID or project name + Project *string + // (required) Pull requests will be returned that match this search criteria. + SearchCriteria *GitPullRequestSearchCriteria + // (optional) Not used. + MaxCommentLength *int + // (optional) The number of pull requests to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100. + Skip *int + // (optional) The number of pull requests to retrieve. + Top *int +} + +// Create a pull request. +func (client *Client) CreatePullRequest(ctx context.Context, args CreatePullRequestArgs) (*GitPullRequest, error) { + if args.GitPullRequestToCreate == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.GitPullRequestToCreate"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.SupportsIterations != nil { + queryParams.Add("supportsIterations", strconv.FormatBool(*args.SupportsIterations)) + } + body, marshalErr := json.Marshal(*args.GitPullRequestToCreate) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("9946fd70-0d40-406e-b686-b4744cbbcc37") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitPullRequest + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreatePullRequest function +type CreatePullRequestArgs struct { + // (required) The pull request to create. + GitPullRequestToCreate *GitPullRequest + // (required) The repository ID of the pull request's target branch. + RepositoryId *string + // (optional) Project ID or project name + Project *string + // (optional) If true, subsequent pushes to the pull request will be individually reviewable. Set this to false for large pull requests for performance reasons if this functionality is not needed. + SupportsIterations *bool +} + +// Retrieve a pull request. +func (client *Client) GetPullRequest(ctx context.Context, args GetPullRequestArgs) (*GitPullRequest, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + + queryParams := url.Values{} + if args.MaxCommentLength != nil { + queryParams.Add("maxCommentLength", strconv.Itoa(*args.MaxCommentLength)) + } + if args.Skip != nil { + queryParams.Add("$skip", strconv.Itoa(*args.Skip)) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + if args.IncludeCommits != nil { + queryParams.Add("includeCommits", strconv.FormatBool(*args.IncludeCommits)) + } + if args.IncludeWorkItemRefs != nil { + queryParams.Add("includeWorkItemRefs", strconv.FormatBool(*args.IncludeWorkItemRefs)) + } + locationId, _ := uuid.Parse("9946fd70-0d40-406e-b686-b4744cbbcc37") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitPullRequest + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPullRequest function +type GetPullRequestArgs struct { + // (required) The repository ID of the pull request's target branch. + RepositoryId *string + // (required) The ID of the pull request to retrieve. + PullRequestId *int + // (optional) Project ID or project name + Project *string + // (optional) Not used. + MaxCommentLength *int + // (optional) Not used. + Skip *int + // (optional) Not used. + Top *int + // (optional) If true, the pull request will be returned with the associated commits. + IncludeCommits *bool + // (optional) If true, the pull request will be returned with the associated work item references. + IncludeWorkItemRefs *bool +} + +// Retrieve all pull requests matching a specified criteria. +func (client *Client) GetPullRequests(ctx context.Context, args GetPullRequestsArgs) (*[]GitPullRequest, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.SearchCriteria == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "searchCriteria"} + } + if args.SearchCriteria.RepositoryId != nil { + queryParams.Add("searchCriteria.repositoryId", (*args.SearchCriteria.RepositoryId).String()) + } + if args.SearchCriteria.CreatorId != nil { + queryParams.Add("searchCriteria.creatorId", (*args.SearchCriteria.CreatorId).String()) + } + if args.SearchCriteria.ReviewerId != nil { + queryParams.Add("searchCriteria.reviewerId", (*args.SearchCriteria.ReviewerId).String()) + } + if args.SearchCriteria.Status != nil { + queryParams.Add("searchCriteria.status", string(*args.SearchCriteria.Status)) + } + if args.SearchCriteria.TargetRefName != nil { + queryParams.Add("searchCriteria.targetRefName", *args.SearchCriteria.TargetRefName) + } + if args.SearchCriteria.SourceRepositoryId != nil { + queryParams.Add("searchCriteria.sourceRepositoryId", (*args.SearchCriteria.SourceRepositoryId).String()) + } + if args.SearchCriteria.SourceRefName != nil { + queryParams.Add("searchCriteria.sourceRefName", *args.SearchCriteria.SourceRefName) + } + if args.SearchCriteria.IncludeLinks != nil { + queryParams.Add("searchCriteria.includeLinks", strconv.FormatBool(*args.SearchCriteria.IncludeLinks)) + } + if args.MaxCommentLength != nil { + queryParams.Add("maxCommentLength", strconv.Itoa(*args.MaxCommentLength)) + } + if args.Skip != nil { + queryParams.Add("$skip", strconv.Itoa(*args.Skip)) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + locationId, _ := uuid.Parse("9946fd70-0d40-406e-b686-b4744cbbcc37") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitPullRequest + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPullRequests function +type GetPullRequestsArgs struct { + // (required) The repository ID of the pull request's target branch. + RepositoryId *string + // (required) Pull requests will be returned that match this search criteria. + SearchCriteria *GitPullRequestSearchCriteria + // (optional) Project ID or project name + Project *string + // (optional) Not used. + MaxCommentLength *int + // (optional) The number of pull requests to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100. + Skip *int + // (optional) The number of pull requests to retrieve. + Top *int +} + +// Update a pull request +func (client *Client) UpdatePullRequest(ctx context.Context, args UpdatePullRequestArgs) (*GitPullRequest, error) { + if args.GitPullRequestToUpdate == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.GitPullRequestToUpdate"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + + body, marshalErr := json.Marshal(*args.GitPullRequestToUpdate) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("9946fd70-0d40-406e-b686-b4744cbbcc37") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitPullRequest + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdatePullRequest function +type UpdatePullRequestArgs struct { + // (required) The pull request content that should be updated. + GitPullRequestToUpdate *GitPullRequest + // (required) The repository ID of the pull request's target branch. + RepositoryId *string + // (required) ID of the pull request to update. + PullRequestId *int + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Sends an e-mail notification about a specific pull request to a set of recipients +func (client *Client) SharePullRequest(ctx context.Context, args SharePullRequestArgs) error { + if args.UserMessage == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.UserMessage"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + + body, marshalErr := json.Marshal(*args.UserMessage) + if marshalErr != nil { + return marshalErr + } + locationId, _ := uuid.Parse("696f3a82-47c9-487f-9117-b9d00972ca84") + _, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the SharePullRequest function +type SharePullRequestArgs struct { + // (required) + UserMessage *ShareNotificationContext + // (required) ID of the git repository. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Create a pull request status. +func (client *Client) CreatePullRequestStatus(ctx context.Context, args CreatePullRequestStatusArgs) (*GitPullRequestStatus, error) { + if args.Status == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Status"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + + body, marshalErr := json.Marshal(*args.Status) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("b5f6bb4f-8d1e-4d79-8d11-4c9172c99c35") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitPullRequestStatus + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreatePullRequestStatus function +type CreatePullRequestStatusArgs struct { + // (required) Pull request status to create. + Status *GitPullRequestStatus + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Delete pull request status. +func (client *Client) DeletePullRequestStatus(ctx context.Context, args DeletePullRequestStatusArgs) error { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.StatusId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.StatusId"} + } + routeValues["statusId"] = strconv.Itoa(*args.StatusId) + + locationId, _ := uuid.Parse("b5f6bb4f-8d1e-4d79-8d11-4c9172c99c35") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeletePullRequestStatus function +type DeletePullRequestStatusArgs struct { + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) ID of the pull request status. + StatusId *int + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Get the specific pull request status by ID. The status ID is unique within the pull request across all iterations. +func (client *Client) GetPullRequestStatus(ctx context.Context, args GetPullRequestStatusArgs) (*GitPullRequestStatus, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.StatusId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.StatusId"} + } + routeValues["statusId"] = strconv.Itoa(*args.StatusId) + + locationId, _ := uuid.Parse("b5f6bb4f-8d1e-4d79-8d11-4c9172c99c35") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitPullRequestStatus + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPullRequestStatus function +type GetPullRequestStatusArgs struct { + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) ID of the pull request status. + StatusId *int + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Get all the statuses associated with a pull request. +func (client *Client) GetPullRequestStatuses(ctx context.Context, args GetPullRequestStatusesArgs) (*[]GitPullRequestStatus, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + + locationId, _ := uuid.Parse("b5f6bb4f-8d1e-4d79-8d11-4c9172c99c35") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitPullRequestStatus + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPullRequestStatuses function +type GetPullRequestStatusesArgs struct { + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Update pull request statuses collection. The only supported operation type is `remove`. +func (client *Client) UpdatePullRequestStatuses(ctx context.Context, args UpdatePullRequestStatusesArgs) error { + if args.PatchDocument == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.PatchDocument"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + + body, marshalErr := json.Marshal(*args.PatchDocument) + if marshalErr != nil { + return marshalErr + } + locationId, _ := uuid.Parse("b5f6bb4f-8d1e-4d79-8d11-4c9172c99c35") + _, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json-patch+json", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the UpdatePullRequestStatuses function +type UpdatePullRequestStatusesArgs struct { + // (required) Operations to apply to the pull request statuses in JSON Patch format. + PatchDocument *[]webapi.JsonPatchOperation + // (required) The repository ID of the pull request’s target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (optional) Project ID or project name + Project *string +} + +// Create a comment on a specific thread in a pull request (up to 500 comments can be created per thread). +func (client *Client) CreateComment(ctx context.Context, args CreateCommentArgs) (*Comment, error) { + if args.Comment == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Comment"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.ThreadId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ThreadId"} + } + routeValues["threadId"] = strconv.Itoa(*args.ThreadId) + + body, marshalErr := json.Marshal(*args.Comment) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue Comment + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateComment function +type CreateCommentArgs struct { + // (required) The comment to create. Comments can be up to 150,000 characters. + Comment *Comment + // (required) The repository ID of the pull request's target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) ID of the thread that the desired comment is in. + ThreadId *int + // (optional) Project ID or project name + Project *string +} + +// Delete a comment associated with a specific thread in a pull request. +func (client *Client) DeleteComment(ctx context.Context, args DeleteCommentArgs) error { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.ThreadId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.ThreadId"} + } + routeValues["threadId"] = strconv.Itoa(*args.ThreadId) + if args.CommentId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.CommentId"} + } + routeValues["commentId"] = strconv.Itoa(*args.CommentId) + + locationId, _ := uuid.Parse("965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeleteComment function +type DeleteCommentArgs struct { + // (required) The repository ID of the pull request's target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) ID of the thread that the desired comment is in. + ThreadId *int + // (required) ID of the comment. + CommentId *int + // (optional) Project ID or project name + Project *string +} + +// Retrieve a comment associated with a specific thread in a pull request. +func (client *Client) GetComment(ctx context.Context, args GetCommentArgs) (*Comment, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.ThreadId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ThreadId"} + } + routeValues["threadId"] = strconv.Itoa(*args.ThreadId) + if args.CommentId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.CommentId"} + } + routeValues["commentId"] = strconv.Itoa(*args.CommentId) + + locationId, _ := uuid.Parse("965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue Comment + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetComment function +type GetCommentArgs struct { + // (required) The repository ID of the pull request's target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) ID of the thread that the desired comment is in. + ThreadId *int + // (required) ID of the comment. + CommentId *int + // (optional) Project ID or project name + Project *string +} + +// Retrieve all comments associated with a specific thread in a pull request. +func (client *Client) GetComments(ctx context.Context, args GetCommentsArgs) (*[]Comment, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.ThreadId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ThreadId"} + } + routeValues["threadId"] = strconv.Itoa(*args.ThreadId) + + locationId, _ := uuid.Parse("965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []Comment + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetComments function +type GetCommentsArgs struct { + // (required) The repository ID of the pull request's target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) ID of the thread. + ThreadId *int + // (optional) Project ID or project name + Project *string +} + +// Update a comment associated with a specific thread in a pull request. +func (client *Client) UpdateComment(ctx context.Context, args UpdateCommentArgs) (*Comment, error) { + if args.Comment == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Comment"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.ThreadId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ThreadId"} + } + routeValues["threadId"] = strconv.Itoa(*args.ThreadId) + if args.CommentId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.CommentId"} + } + routeValues["commentId"] = strconv.Itoa(*args.CommentId) + + body, marshalErr := json.Marshal(*args.Comment) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue Comment + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateComment function +type UpdateCommentArgs struct { + // (required) The comment content that should be updated. Comments can be up to 150,000 characters. + Comment *Comment + // (required) The repository ID of the pull request's target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) ID of the thread that the desired comment is in. + ThreadId *int + // (required) ID of the comment to update. + CommentId *int + // (optional) Project ID or project name + Project *string +} + +// Create a thread in a pull request. +func (client *Client) CreateThread(ctx context.Context, args CreateThreadArgs) (*GitPullRequestCommentThread, error) { + if args.CommentThread == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.CommentThread"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + + body, marshalErr := json.Marshal(*args.CommentThread) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("ab6e2e5d-a0b7-4153-b64a-a4efe0d49449") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitPullRequestCommentThread + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateThread function +type CreateThreadArgs struct { + // (required) The thread to create. Thread must contain at least one comment. + CommentThread *GitPullRequestCommentThread + // (required) Repository ID of the pull request's target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (optional) Project ID or project name + Project *string +} + +// Retrieve a thread in a pull request. +func (client *Client) GetPullRequestThread(ctx context.Context, args GetPullRequestThreadArgs) (*GitPullRequestCommentThread, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.ThreadId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ThreadId"} + } + routeValues["threadId"] = strconv.Itoa(*args.ThreadId) + + queryParams := url.Values{} + if args.Iteration != nil { + queryParams.Add("$iteration", strconv.Itoa(*args.Iteration)) + } + if args.BaseIteration != nil { + queryParams.Add("$baseIteration", strconv.Itoa(*args.BaseIteration)) + } + locationId, _ := uuid.Parse("ab6e2e5d-a0b7-4153-b64a-a4efe0d49449") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitPullRequestCommentThread + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPullRequestThread function +type GetPullRequestThreadArgs struct { + // (required) The repository ID of the pull request's target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) ID of the thread. + ThreadId *int + // (optional) Project ID or project name + Project *string + // (optional) If specified, thread position will be tracked using this iteration as the right side of the diff. + Iteration *int + // (optional) If specified, thread position will be tracked using this iteration as the left side of the diff. + BaseIteration *int +} + +// Retrieve all threads in a pull request. +func (client *Client) GetThreads(ctx context.Context, args GetThreadsArgs) (*[]GitPullRequestCommentThread, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + + queryParams := url.Values{} + if args.Iteration != nil { + queryParams.Add("$iteration", strconv.Itoa(*args.Iteration)) + } + if args.BaseIteration != nil { + queryParams.Add("$baseIteration", strconv.Itoa(*args.BaseIteration)) + } + locationId, _ := uuid.Parse("ab6e2e5d-a0b7-4153-b64a-a4efe0d49449") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitPullRequestCommentThread + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetThreads function +type GetThreadsArgs struct { + // (required) The repository ID of the pull request's target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (optional) Project ID or project name + Project *string + // (optional) If specified, thread positions will be tracked using this iteration as the right side of the diff. + Iteration *int + // (optional) If specified, thread positions will be tracked using this iteration as the left side of the diff. + BaseIteration *int +} + +// Update a thread in a pull request. +func (client *Client) UpdateThread(ctx context.Context, args UpdateThreadArgs) (*GitPullRequestCommentThread, error) { + if args.CommentThread == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.CommentThread"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + if args.ThreadId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ThreadId"} + } + routeValues["threadId"] = strconv.Itoa(*args.ThreadId) + + body, marshalErr := json.Marshal(*args.CommentThread) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("ab6e2e5d-a0b7-4153-b64a-a4efe0d49449") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitPullRequestCommentThread + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateThread function +type UpdateThreadArgs struct { + // (required) The thread content that should be updated. + CommentThread *GitPullRequestCommentThread + // (required) The repository ID of the pull request's target branch. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (required) ID of the thread to update. + ThreadId *int + // (optional) Project ID or project name + Project *string +} + +// Retrieve a list of work items associated with a pull request. +func (client *Client) GetPullRequestWorkItemRefs(ctx context.Context, args GetPullRequestWorkItemRefsArgs) (*[]webapi.ResourceRef, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PullRequestId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PullRequestId"} + } + routeValues["pullRequestId"] = strconv.Itoa(*args.PullRequestId) + + locationId, _ := uuid.Parse("0a637fcc-5370-4ce8-b0e8-98091f5f9482") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []webapi.ResourceRef + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPullRequestWorkItemRefs function +type GetPullRequestWorkItemRefsArgs struct { + // (required) ID or name of the repository. + RepositoryId *string + // (required) ID of the pull request. + PullRequestId *int + // (optional) Project ID or project name + Project *string +} + +// Push changes to the repository. +func (client *Client) CreatePush(ctx context.Context, args CreatePushArgs) (*GitPush, error) { + if args.Push == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Push"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + body, marshalErr := json.Marshal(*args.Push) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("ea98d07b-3c87-4971-8ede-a613694ffb55") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitPush + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreatePush function +type CreatePushArgs struct { + // (required) + Push *GitPush + // (required) The name or ID of the repository. + RepositoryId *string + // (optional) Project ID or project name + Project *string +} + +// Retrieves a particular push. +func (client *Client) GetPush(ctx context.Context, args GetPushArgs) (*GitPush, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.PushId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PushId"} + } + routeValues["pushId"] = strconv.Itoa(*args.PushId) + + queryParams := url.Values{} + if args.IncludeCommits != nil { + queryParams.Add("includeCommits", strconv.Itoa(*args.IncludeCommits)) + } + if args.IncludeRefUpdates != nil { + queryParams.Add("includeRefUpdates", strconv.FormatBool(*args.IncludeRefUpdates)) + } + locationId, _ := uuid.Parse("ea98d07b-3c87-4971-8ede-a613694ffb55") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitPush + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPush function +type GetPushArgs struct { + // (required) The name or ID of the repository. + RepositoryId *string + // (required) ID of the push. + PushId *int + // (optional) Project ID or project name + Project *string + // (optional) The number of commits to include in the result. + IncludeCommits *int + // (optional) If true, include the list of refs that were updated by the push. + IncludeRefUpdates *bool +} + +// Retrieves pushes associated with the specified repository. +func (client *Client) GetPushes(ctx context.Context, args GetPushesArgs) (*[]GitPush, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.Skip != nil { + queryParams.Add("$skip", strconv.Itoa(*args.Skip)) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + if args.SearchCriteria != nil { + if args.SearchCriteria.FromDate != nil { + queryParams.Add("searchCriteria.fromDate", (*args.SearchCriteria.FromDate).String()) + } + if args.SearchCriteria.ToDate != nil { + queryParams.Add("searchCriteria.toDate", (*args.SearchCriteria.ToDate).String()) + } + if args.SearchCriteria.PusherId != nil { + queryParams.Add("searchCriteria.pusherId", (*args.SearchCriteria.PusherId).String()) + } + if args.SearchCriteria.RefName != nil { + queryParams.Add("searchCriteria.refName", *args.SearchCriteria.RefName) + } + if args.SearchCriteria.IncludeRefUpdates != nil { + queryParams.Add("searchCriteria.includeRefUpdates", strconv.FormatBool(*args.SearchCriteria.IncludeRefUpdates)) + } + if args.SearchCriteria.IncludeLinks != nil { + queryParams.Add("searchCriteria.includeLinks", strconv.FormatBool(*args.SearchCriteria.IncludeLinks)) + } + } + locationId, _ := uuid.Parse("ea98d07b-3c87-4971-8ede-a613694ffb55") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitPush + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPushes function +type GetPushesArgs struct { + // (required) The name or ID of the repository. + RepositoryId *string + // (optional) Project ID or project name + Project *string + // (optional) Number of pushes to skip. + Skip *int + // (optional) Number of pushes to return. + Top *int + // (optional) Search criteria attributes: fromDate, toDate, pusherId, refName, includeRefUpdates or includeLinks. fromDate: Start date to search from. toDate: End date to search to. pusherId: Identity of the person who submitted the push. refName: Branch name to consider. includeRefUpdates: If true, include the list of refs that were updated by the push. includeLinks: Whether to include the _links field on the shallow references. + SearchCriteria *GitPushSearchCriteria +} + +// [Preview API] Destroy (hard delete) a soft-deleted Git repository. +func (client *Client) DeleteRepositoryFromRecycleBin(ctx context.Context, args DeleteRepositoryFromRecycleBinArgs) error { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RepositoryId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = (*args.RepositoryId).String() + + locationId, _ := uuid.Parse("a663da97-81db-4eb3-8b83-287670f63073") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeleteRepositoryFromRecycleBin function +type DeleteRepositoryFromRecycleBinArgs struct { + // (required) Project ID or project name + Project *string + // (required) The ID of the repository. + RepositoryId *uuid.UUID +} + +// [Preview API] Retrieve soft-deleted git repositories from the recycle bin. +func (client *Client) GetRecycleBinRepositories(ctx context.Context, args GetRecycleBinRepositoriesArgs) (*[]GitDeletedRepository, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + locationId, _ := uuid.Parse("a663da97-81db-4eb3-8b83-287670f63073") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitDeletedRepository + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetRecycleBinRepositories function +type GetRecycleBinRepositoriesArgs struct { + // (required) Project ID or project name + Project *string +} + +// [Preview API] Recover a soft-deleted Git repository. Recently deleted repositories go into a soft-delete state for a period of time before they are hard deleted and become unrecoverable. +func (client *Client) RestoreRepositoryFromRecycleBin(ctx context.Context, args RestoreRepositoryFromRecycleBinArgs) (*GitRepository, error) { + if args.RepositoryDetails == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RepositoryDetails"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RepositoryId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = (*args.RepositoryId).String() + + body, marshalErr := json.Marshal(*args.RepositoryDetails) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("a663da97-81db-4eb3-8b83-287670f63073") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitRepository + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the RestoreRepositoryFromRecycleBin function +type RestoreRepositoryFromRecycleBinArgs struct { + // (required) + RepositoryDetails *GitRecycleBinRepositoryDetails + // (required) Project ID or project name + Project *string + // (required) The ID of the repository. + RepositoryId *uuid.UUID +} + +// Queries the provided repository for its refs and returns them. +func (client *Client) GetRefs(ctx context.Context, args GetRefsArgs) (*GetRefsResponseValue, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.Filter != nil { + queryParams.Add("filter", *args.Filter) + } + if args.IncludeLinks != nil { + queryParams.Add("includeLinks", strconv.FormatBool(*args.IncludeLinks)) + } + if args.IncludeStatuses != nil { + queryParams.Add("includeStatuses", strconv.FormatBool(*args.IncludeStatuses)) + } + if args.IncludeMyBranches != nil { + queryParams.Add("includeMyBranches", strconv.FormatBool(*args.IncludeMyBranches)) + } + if args.LatestStatusesOnly != nil { + queryParams.Add("latestStatusesOnly", strconv.FormatBool(*args.LatestStatusesOnly)) + } + if args.PeelTags != nil { + queryParams.Add("peelTags", strconv.FormatBool(*args.PeelTags)) + } + if args.FilterContains != nil { + queryParams.Add("filterContains", *args.FilterContains) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + if args.ContinuationToken != nil { + queryParams.Add("continuationToken", *args.ContinuationToken) + } + locationId, _ := uuid.Parse("2d874a60-a811-4f62-9c9f-963a6ea0a55b") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GetRefsResponseValue + responseValue.ContinuationToken = resp.Header.Get(azuredevops.HeaderKeyContinuationToken) + err = client.Client.UnmarshalCollectionBody(resp, &responseValue.Value) + return &responseValue, err +} + +// Arguments for the GetRefs function +type GetRefsArgs struct { + // (required) The name or ID of the repository. + RepositoryId *string + // (optional) Project ID or project name + Project *string + // (optional) [optional] A filter to apply to the refs (starts with). + Filter *string + // (optional) [optional] Specifies if referenceLinks should be included in the result. default is false. + IncludeLinks *bool + // (optional) [optional] Includes up to the first 1000 commit statuses for each ref. The default value is false. + IncludeStatuses *bool + // (optional) [optional] Includes only branches that the user owns, the branches the user favorites, and the default branch. The default value is false. Cannot be combined with the filter parameter. + IncludeMyBranches *bool + // (optional) [optional] True to include only the tip commit status for each ref. This option requires `includeStatuses` to be true. The default value is false. + LatestStatusesOnly *bool + // (optional) [optional] Annotated tags will populate the PeeledObjectId property. default is false. + PeelTags *bool + // (optional) [optional] A filter to apply to the refs (contains). + FilterContains *string + // (optional) [optional] Maximum number of refs to return. It cannot be bigger than 1000. If it is not provided but continuationToken is, top will default to 100. + Top *int + // (optional) The continuation token used for pagination. + ContinuationToken *string +} + +// Return type for the GetRefs function +type GetRefsResponseValue struct { + Value []GitRef + // The continuation token to be used to get the next page of results. + ContinuationToken string +} + +// Lock or Unlock a branch. +func (client *Client) UpdateRef(ctx context.Context, args UpdateRefArgs) (*GitRef, error) { + if args.NewRefInfo == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.NewRefInfo"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.Filter == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "filter"} + } + queryParams.Add("filter", *args.Filter) + if args.ProjectId != nil { + queryParams.Add("projectId", *args.ProjectId) + } + body, marshalErr := json.Marshal(*args.NewRefInfo) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("2d874a60-a811-4f62-9c9f-963a6ea0a55b") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitRef + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateRef function +type UpdateRefArgs struct { + // (required) The ref update action (lock/unlock) to perform + NewRefInfo *GitRefUpdate + // (required) The name or ID of the repository. + RepositoryId *string + // (required) The name of the branch to lock/unlock + Filter *string + // (optional) Project ID or project name + Project *string + // (optional) ID or name of the team project. Optional if specifying an ID for repository. + ProjectId *string +} + +// Creating, updating, or deleting refs(branches). +func (client *Client) UpdateRefs(ctx context.Context, args UpdateRefsArgs) (*[]GitRefUpdateResult, error) { + if args.RefUpdates == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RefUpdates"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.ProjectId != nil { + queryParams.Add("projectId", *args.ProjectId) + } + body, marshalErr := json.Marshal(*args.RefUpdates) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("2d874a60-a811-4f62-9c9f-963a6ea0a55b") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitRefUpdateResult + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateRefs function +type UpdateRefsArgs struct { + // (required) List of ref updates to attempt to perform + RefUpdates *[]GitRefUpdate + // (required) The name or ID of the repository. + RepositoryId *string + // (optional) Project ID or project name + Project *string + // (optional) ID or name of the team project. Optional if specifying an ID for repository. + ProjectId *string +} + +// [Preview API] Creates a ref favorite +func (client *Client) CreateFavorite(ctx context.Context, args CreateFavoriteArgs) (*GitRefFavorite, error) { + if args.Favorite == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Favorite"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + body, marshalErr := json.Marshal(*args.Favorite) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("876f70af-5792-485a-a1c7-d0a7b2f42bbb") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitRefFavorite + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateFavorite function +type CreateFavoriteArgs struct { + // (required) The ref favorite to create. + Favorite *GitRefFavorite + // (required) Project ID or project name + Project *string +} + +// [Preview API] Deletes the refs favorite specified +func (client *Client) DeleteRefFavorite(ctx context.Context, args DeleteRefFavoriteArgs) error { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.FavoriteId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.FavoriteId"} + } + routeValues["favoriteId"] = strconv.Itoa(*args.FavoriteId) + + locationId, _ := uuid.Parse("876f70af-5792-485a-a1c7-d0a7b2f42bbb") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeleteRefFavorite function +type DeleteRefFavoriteArgs struct { + // (required) Project ID or project name + Project *string + // (required) The Id of the ref favorite to delete. + FavoriteId *int +} + +// [Preview API] Gets the refs favorite for a favorite Id. +func (client *Client) GetRefFavorite(ctx context.Context, args GetRefFavoriteArgs) (*GitRefFavorite, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.FavoriteId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.FavoriteId"} + } + routeValues["favoriteId"] = strconv.Itoa(*args.FavoriteId) + + locationId, _ := uuid.Parse("876f70af-5792-485a-a1c7-d0a7b2f42bbb") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitRefFavorite + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetRefFavorite function +type GetRefFavoriteArgs struct { + // (required) Project ID or project name + Project *string + // (required) The Id of the requested ref favorite. + FavoriteId *int +} + +// [Preview API] Gets the refs favorites for a repo and an identity. +func (client *Client) GetRefFavorites(ctx context.Context, args GetRefFavoritesArgs) (*[]GitRefFavorite, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + queryParams := url.Values{} + if args.RepositoryId != nil { + queryParams.Add("repositoryId", *args.RepositoryId) + } + if args.IdentityId != nil { + queryParams.Add("identityId", *args.IdentityId) + } + locationId, _ := uuid.Parse("876f70af-5792-485a-a1c7-d0a7b2f42bbb") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitRefFavorite + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetRefFavorites function +type GetRefFavoritesArgs struct { + // (required) Project ID or project name + Project *string + // (optional) The id of the repository. + RepositoryId *string + // (optional) The id of the identity whose favorites are to be retrieved. If null, the requesting identity is used. + IdentityId *string +} + +// Create a git repository in a team project. +func (client *Client) CreateRepository(ctx context.Context, args CreateRepositoryArgs) (*GitRepository, error) { + if args.GitRepositoryToCreate == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.GitRepositoryToCreate"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + + queryParams := url.Values{} + if args.SourceRef != nil { + queryParams.Add("sourceRef", *args.SourceRef) + } + body, marshalErr := json.Marshal(*args.GitRepositoryToCreate) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("225f7195-f9c7-4d14-ab28-a83f7ff77e1f") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitRepository + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateRepository function +type CreateRepositoryArgs struct { + // (required) Specify the repo name, team project and/or parent repository. Team project information can be ommitted from gitRepositoryToCreate if the request is project-scoped (i.e., includes project Id). + GitRepositoryToCreate *GitRepositoryCreateOptions + // (optional) Project ID or project name + Project *string + // (optional) [optional] Specify the source refs to use while creating a fork repo + SourceRef *string +} + +// Delete a git repository +func (client *Client) DeleteRepository(ctx context.Context, args DeleteRepositoryArgs) error { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = (*args.RepositoryId).String() + + locationId, _ := uuid.Parse("225f7195-f9c7-4d14-ab28-a83f7ff77e1f") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeleteRepository function +type DeleteRepositoryArgs struct { + // (required) The name or ID of the repository. + RepositoryId *uuid.UUID + // (optional) Project ID or project name + Project *string +} + +// Retrieve git repositories. +func (client *Client) GetRepositories(ctx context.Context, args GetRepositoriesArgs) (*[]GitRepository, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + + queryParams := url.Values{} + if args.IncludeLinks != nil { + queryParams.Add("includeLinks", strconv.FormatBool(*args.IncludeLinks)) + } + if args.IncludeAllUrls != nil { + queryParams.Add("includeAllUrls", strconv.FormatBool(*args.IncludeAllUrls)) + } + if args.IncludeHidden != nil { + queryParams.Add("includeHidden", strconv.FormatBool(*args.IncludeHidden)) + } + locationId, _ := uuid.Parse("225f7195-f9c7-4d14-ab28-a83f7ff77e1f") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitRepository + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetRepositories function +type GetRepositoriesArgs struct { + // (optional) Project ID or project name + Project *string + // (optional) [optional] True to include reference links. The default value is false. + IncludeLinks *bool + // (optional) [optional] True to include all remote URLs. The default value is false. + IncludeAllUrls *bool + // (optional) [optional] True to include hidden repositories. The default value is false. + IncludeHidden *bool +} + +// Retrieve a git repository. +func (client *Client) GetRepository(ctx context.Context, args GetRepositoryArgs) (*GitRepository, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + locationId, _ := uuid.Parse("225f7195-f9c7-4d14-ab28-a83f7ff77e1f") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitRepository + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetRepository function +type GetRepositoryArgs struct { + // (required) The name or ID of the repository. + RepositoryId *string + // (optional) Project ID or project name + Project *string +} + +// Retrieve a git repository. +func (client *Client) GetRepositoryWithParent(ctx context.Context, args GetRepositoryWithParentArgs) (*GitRepository, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.IncludeParent == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "includeParent"} + } + queryParams.Add("includeParent", strconv.FormatBool(*args.IncludeParent)) + locationId, _ := uuid.Parse("225f7195-f9c7-4d14-ab28-a83f7ff77e1f") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitRepository + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetRepositoryWithParent function +type GetRepositoryWithParentArgs struct { + // (required) The name or ID of the repository. + RepositoryId *string + // (required) True to include parent repository. Only available in authenticated calls. + IncludeParent *bool + // (optional) Project ID or project name + Project *string +} + +// Updates the Git repository with either a new repo name or a new default branch. +func (client *Client) UpdateRepository(ctx context.Context, args UpdateRepositoryArgs) (*GitRepository, error) { + if args.NewRepositoryInfo == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.NewRepositoryInfo"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = (*args.RepositoryId).String() + + body, marshalErr := json.Marshal(*args.NewRepositoryInfo) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("225f7195-f9c7-4d14-ab28-a83f7ff77e1f") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitRepository + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateRepository function +type UpdateRepositoryArgs struct { + // (required) Specify a new repo name or a new default branch of the repository + NewRepositoryInfo *GitRepository + // (required) The name or ID of the repository. + RepositoryId *uuid.UUID + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Starts the operation to create a new branch which reverts changes introduced by either a specific commit or commits that are associated to a pull request. +func (client *Client) CreateRevert(ctx context.Context, args CreateRevertArgs) (*GitRevert, error) { + if args.RevertToCreate == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RevertToCreate"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + body, marshalErr := json.Marshal(*args.RevertToCreate) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("bc866058-5449-4715-9cf1-a510b6ff193c") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitRevert + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateRevert function +type CreateRevertArgs struct { + // (required) + RevertToCreate *GitAsyncRefOperationParameters + // (required) Project ID or project name + Project *string + // (required) ID of the repository. + RepositoryId *string +} + +// [Preview API] Retrieve information about a revert operation by revert Id. +func (client *Client) GetRevert(ctx context.Context, args GetRevertArgs) (*GitRevert, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RevertId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RevertId"} + } + routeValues["revertId"] = strconv.Itoa(*args.RevertId) + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + locationId, _ := uuid.Parse("bc866058-5449-4715-9cf1-a510b6ff193c") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitRevert + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetRevert function +type GetRevertArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the revert operation. + RevertId *int + // (required) ID of the repository. + RepositoryId *string +} + +// [Preview API] Retrieve information about a revert operation for a specific branch. +func (client *Client) GetRevertForRefName(ctx context.Context, args GetRevertForRefNameArgs) (*GitRevert, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.RefName == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "refName"} + } + queryParams.Add("refName", *args.RefName) + locationId, _ := uuid.Parse("bc866058-5449-4715-9cf1-a510b6ff193c") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitRevert + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetRevertForRefName function +type GetRevertForRefNameArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the repository. + RepositoryId *string + // (required) The GitAsyncRefOperationParameters generatedRefName used for the revert operation. + RefName *string +} + +// Create Git commit status. +func (client *Client) CreateCommitStatus(ctx context.Context, args CreateCommitStatusArgs) (*GitStatus, error) { + if args.GitCommitStatusToCreate == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.GitCommitStatusToCreate"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.CommitId == nil || *args.CommitId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.CommitId"} + } + routeValues["commitId"] = *args.CommitId + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + body, marshalErr := json.Marshal(*args.GitCommitStatusToCreate) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("428dd4fb-fda5-4722-af02-9313b80305da") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitStatus + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateCommitStatus function +type CreateCommitStatusArgs struct { + // (required) Git commit status object to create. + GitCommitStatusToCreate *GitStatus + // (required) ID of the Git commit. + CommitId *string + // (required) ID of the repository. + RepositoryId *string + // (optional) Project ID or project name + Project *string +} + +// Get statuses associated with the Git commit. +func (client *Client) GetStatuses(ctx context.Context, args GetStatusesArgs) (*[]GitStatus, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.CommitId == nil || *args.CommitId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.CommitId"} + } + routeValues["commitId"] = *args.CommitId + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + queryParams := url.Values{} + if args.Top != nil { + queryParams.Add("top", strconv.Itoa(*args.Top)) + } + if args.Skip != nil { + queryParams.Add("skip", strconv.Itoa(*args.Skip)) + } + if args.LatestOnly != nil { + queryParams.Add("latestOnly", strconv.FormatBool(*args.LatestOnly)) + } + locationId, _ := uuid.Parse("428dd4fb-fda5-4722-af02-9313b80305da") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitStatus + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetStatuses function +type GetStatusesArgs struct { + // (required) ID of the Git commit. + CommitId *string + // (required) ID of the repository. + RepositoryId *string + // (optional) Project ID or project name + Project *string + // (optional) Optional. The number of statuses to retrieve. Default is 1000. + Top *int + // (optional) Optional. The number of statuses to ignore. Default is 0. For example, to retrieve results 101-150, set top to 50 and skip to 100. + Skip *int + // (optional) The flag indicates whether to get only latest statuses grouped by `Context.Name` and `Context.Genre`. + LatestOnly *bool +} + +// [Preview API] Retrieve a pull request suggestion for a particular repository or team project. +func (client *Client) GetSuggestions(ctx context.Context, args GetSuggestionsArgs) (*[]GitSuggestion, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + + locationId, _ := uuid.Parse("9393b4fb-4445-4919-972b-9ad16f442d83") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitSuggestion + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetSuggestions function +type GetSuggestionsArgs struct { + // (required) ID of the git repository. + RepositoryId *string + // (optional) Project ID or project name + Project *string +} + +// The Tree endpoint returns the collection of objects underneath the specified tree. Trees are folders in a Git repository. +func (client *Client) GetTree(ctx context.Context, args GetTreeArgs) (*GitTreeRef, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.Sha1 == nil || *args.Sha1 == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Sha1"} + } + routeValues["sha1"] = *args.Sha1 + + queryParams := url.Values{} + if args.ProjectId != nil { + queryParams.Add("projectId", *args.ProjectId) + } + if args.Recursive != nil { + queryParams.Add("recursive", strconv.FormatBool(*args.Recursive)) + } + if args.FileName != nil { + queryParams.Add("fileName", *args.FileName) + } + locationId, _ := uuid.Parse("729f6437-6f92-44ec-8bee-273a7111063c") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GitTreeRef + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTree function +type GetTreeArgs struct { + // (required) Repository Id. + RepositoryId *string + // (required) SHA1 hash of the tree object. + Sha1 *string + // (optional) Project ID or project name + Project *string + // (optional) Project Id. + ProjectId *string + // (optional) Search recursively. Include trees underneath this tree. Default is false. + Recursive *bool + // (optional) Name to use if a .zip file is returned. Default is the object ID. + FileName *string +} + +// The Tree endpoint returns the collection of objects underneath the specified tree. Trees are folders in a Git repository. +func (client *Client) GetTreeZip(ctx context.Context, args GetTreeZipArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.RepositoryId == nil || *args.RepositoryId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.RepositoryId"} + } + routeValues["repositoryId"] = *args.RepositoryId + if args.Sha1 == nil || *args.Sha1 == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Sha1"} + } + routeValues["sha1"] = *args.Sha1 + + queryParams := url.Values{} + if args.ProjectId != nil { + queryParams.Add("projectId", *args.ProjectId) + } + if args.Recursive != nil { + queryParams.Add("recursive", strconv.FormatBool(*args.Recursive)) + } + if args.FileName != nil { + queryParams.Add("fileName", *args.FileName) + } + locationId, _ := uuid.Parse("729f6437-6f92-44ec-8bee-273a7111063c") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/zip", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetTreeZip function +type GetTreeZipArgs struct { + // (required) Repository Id. + RepositoryId *string + // (required) SHA1 hash of the tree object. + Sha1 *string + // (optional) Project ID or project name + Project *string + // (optional) Project Id. + ProjectId *string + // (optional) Search recursively. Include trees underneath this tree. Default is false. + Recursive *bool + // (optional) Name to use if a .zip file is returned. Default is the object ID. + FileName *string +} diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/git/models.go b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/git/models.go new file mode 100644 index 00000000..44ad22e1 --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/git/models.go @@ -0,0 +1,3129 @@ +// -------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// -------------------------------------------------------------------------------------------- +// Generated file, DO NOT EDIT +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// -------------------------------------------------------------------------------------------- + +package git + +import ( + "github.com/google/uuid" + "github.com/microsoft/azure-devops-go-api/azuredevops" + "github.com/microsoft/azure-devops-go-api/azuredevops/core" + "github.com/microsoft/azure-devops-go-api/azuredevops/policy" + "github.com/microsoft/azure-devops-go-api/azuredevops/webapi" +) + +type AssociatedWorkItem struct { + AssignedTo *string `json:"assignedTo,omitempty"` + // Id of associated the work item. + Id *int `json:"id,omitempty"` + State *string `json:"state,omitempty"` + Title *string `json:"title,omitempty"` + // REST Url of the work item. + Url *string `json:"url,omitempty"` + WebUrl *string `json:"webUrl,omitempty"` + WorkItemType *string `json:"workItemType,omitempty"` +} + +type AsyncGitOperationNotification struct { + OperationId *int `json:"operationId,omitempty"` +} + +type AsyncRefOperationCommitLevelEventNotification struct { + OperationId *int `json:"operationId,omitempty"` + CommitId *string `json:"commitId,omitempty"` +} + +type AsyncRefOperationCompletedNotification struct { + OperationId *int `json:"operationId,omitempty"` + NewRefName *string `json:"newRefName,omitempty"` +} + +type AsyncRefOperationConflictNotification struct { + OperationId *int `json:"operationId,omitempty"` + CommitId *string `json:"commitId,omitempty"` +} + +type AsyncRefOperationGeneralFailureNotification struct { + OperationId *int `json:"operationId,omitempty"` +} + +type AsyncRefOperationProgressNotification struct { + OperationId *int `json:"operationId,omitempty"` + CommitId *string `json:"commitId,omitempty"` + Progress *float64 `json:"progress,omitempty"` +} + +type AsyncRefOperationTimeoutNotification struct { + OperationId *int `json:"operationId,omitempty"` +} + +// Meta data for a file attached to an artifact. +type Attachment struct { + // Links to other related objects. + Links interface{} `json:"_links,omitempty"` + // The person that uploaded this attachment. + Author *webapi.IdentityRef `json:"author,omitempty"` + // Content hash of on-disk representation of file content. Its calculated by the server by using SHA1 hash function. + ContentHash *string `json:"contentHash,omitempty"` + // The time the attachment was uploaded. + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + // The description of the attachment. + Description *string `json:"description,omitempty"` + // The display name of the attachment. Can't be null or empty. + DisplayName *string `json:"displayName,omitempty"` + // Id of the attachment. + Id *int `json:"id,omitempty"` + // Extended properties. + Properties interface{} `json:"properties,omitempty"` + // The url to download the content of the attachment. + Url *string `json:"url,omitempty"` +} + +// Real time event (SignalR) for an auto-complete update on a pull request +type AutoCompleteUpdatedEvent struct { + // The id of this event. Can be used to track send/receive state between client and server. + EventId *uuid.UUID `json:"eventId,omitempty"` + // The id of the pull request this event was generated for. + PullRequestId *int `json:"pullRequestId,omitempty"` +} + +// Real time event (SignalR) for a source/target branch update on a pull request +type BranchUpdatedEvent struct { + // The id of this event. Can be used to track send/receive state between client and server. + EventId *uuid.UUID `json:"eventId,omitempty"` + // The id of the pull request this event was generated for. + PullRequestId *int `json:"pullRequestId,omitempty"` + // If true, the source branch of the pull request was updated + IsSourceUpdate *bool `json:"isSourceUpdate,omitempty"` +} + +type Change struct { + // The type of change that was made to the item. + ChangeType *VersionControlChangeType `json:"changeType,omitempty"` + // Current version. + Item interface{} `json:"item,omitempty"` + // Content of the item after the change. + NewContent *ItemContent `json:"newContent,omitempty"` + // Path of the item on the server. + SourceServerItem *string `json:"sourceServerItem,omitempty"` + // URL to retrieve the item. + Url *string `json:"url,omitempty"` +} + +type ChangeCountDictionary struct { +} + +type ChangeList struct { + AllChangesIncluded *bool `json:"allChangesIncluded,omitempty"` + ChangeCounts *map[VersionControlChangeType]int `json:"changeCounts,omitempty"` + Changes *[]interface{} `json:"changes,omitempty"` + Comment *string `json:"comment,omitempty"` + CommentTruncated *bool `json:"commentTruncated,omitempty"` + CreationDate *azuredevops.Time `json:"creationDate,omitempty"` + Notes *[]CheckinNote `json:"notes,omitempty"` + Owner *string `json:"owner,omitempty"` + OwnerDisplayName *string `json:"ownerDisplayName,omitempty"` + OwnerId *uuid.UUID `json:"ownerId,omitempty"` + SortDate *azuredevops.Time `json:"sortDate,omitempty"` + Version *string `json:"version,omitempty"` +} + +// Criteria used in a search for change lists +type ChangeListSearchCriteria struct { + // If provided, a version descriptor to compare against base + CompareVersion *string `json:"compareVersion,omitempty"` + // If true, don't include delete history entries + ExcludeDeletes *bool `json:"excludeDeletes,omitempty"` + // Whether or not to follow renames for the given item being queried + FollowRenames *bool `json:"followRenames,omitempty"` + // If provided, only include history entries created after this date (string) + FromDate *string `json:"fromDate,omitempty"` + // If provided, a version descriptor for the earliest change list to include + FromVersion *string `json:"fromVersion,omitempty"` + // Path of item to search under. If the itemPaths memebr is used then it will take precedence over this. + ItemPath *string `json:"itemPath,omitempty"` + // List of item paths to search under. If this member is used then itemPath will be ignored. + ItemPaths *[]string `json:"itemPaths,omitempty"` + // Version of the items to search + ItemVersion *string `json:"itemVersion,omitempty"` + // Number of results to skip (used when clicking more...) + Skip *int `json:"skip,omitempty"` + // If provided, only include history entries created before this date (string) + ToDate *string `json:"toDate,omitempty"` + // If provided, the maximum number of history entries to return + Top *int `json:"top,omitempty"` + // If provided, a version descriptor for the latest change list to include + ToVersion *string `json:"toVersion,omitempty"` + // Alias or display name of user who made the changes + User *string `json:"user,omitempty"` +} + +type CheckinNote struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// Represents a comment which is one of potentially many in a comment thread. +type Comment struct { + // Links to other related objects. + Links interface{} `json:"_links,omitempty"` + // The author of the comment. + Author *webapi.IdentityRef `json:"author,omitempty"` + // The comment type at the time of creation. + CommentType *CommentType `json:"commentType,omitempty"` + // The comment content. + Content *string `json:"content,omitempty"` + // The comment ID. IDs start at 1 and are unique to a pull request. + Id *int `json:"id,omitempty"` + // Whether or not this comment was soft-deleted. + IsDeleted *bool `json:"isDeleted,omitempty"` + // The date the comment's content was last updated. + LastContentUpdatedDate *azuredevops.Time `json:"lastContentUpdatedDate,omitempty"` + // The date the comment was last updated. + LastUpdatedDate *azuredevops.Time `json:"lastUpdatedDate,omitempty"` + // The ID of the parent comment. This is used for replies. + ParentCommentId *int `json:"parentCommentId,omitempty"` + // The date the comment was first published. + PublishedDate *azuredevops.Time `json:"publishedDate,omitempty"` + // A list of the users who have liked this comment. + UsersLiked *[]webapi.IdentityRef `json:"usersLiked,omitempty"` +} + +// Comment iteration context is used to identify which diff was being viewed when the thread was created. +type CommentIterationContext struct { + // The iteration of the file on the left side of the diff when the thread was created. If this value is equal to SecondComparingIteration, then this version is the common commit between the source and target branches of the pull request. + FirstComparingIteration *int `json:"firstComparingIteration,omitempty"` + // The iteration of the file on the right side of the diff when the thread was created. + SecondComparingIteration *int `json:"secondComparingIteration,omitempty"` +} + +type CommentPosition struct { + // The line number of a thread's position. Starts at 1. + Line *int `json:"line,omitempty"` + // The character offset of a thread's position inside of a line. Starts at 0. + Offset *int `json:"offset,omitempty"` +} + +// Represents a comment thread of a pull request. A thread contains meta data about the file it was left on along with one or more comments (an initial comment and the subsequent replies). +type CommentThread struct { + // Links to other related objects. + Links interface{} `json:"_links,omitempty"` + // A list of the comments. + Comments *[]Comment `json:"comments,omitempty"` + // The comment thread id. + Id *int `json:"id,omitempty"` + // Set of identities related to this thread + Identities *map[string]webapi.IdentityRef `json:"identities,omitempty"` + // Specify if the thread is deleted which happens when all comments are deleted. + IsDeleted *bool `json:"isDeleted,omitempty"` + // The time this thread was last updated. + LastUpdatedDate *azuredevops.Time `json:"lastUpdatedDate,omitempty"` + // Optional properties associated with the thread as a collection of key-value pairs. + Properties interface{} `json:"properties,omitempty"` + // The time this thread was published. + PublishedDate *azuredevops.Time `json:"publishedDate,omitempty"` + // The status of the comment thread. + Status *CommentThreadStatus `json:"status,omitempty"` + // Specify thread context such as position in left/right file. + ThreadContext *CommentThreadContext `json:"threadContext,omitempty"` +} + +type CommentThreadContext struct { + // File path relative to the root of the repository. It's up to the client to use any path format. + FilePath *string `json:"filePath,omitempty"` + // Position of last character of the thread's span in left file. + LeftFileEnd *CommentPosition `json:"leftFileEnd,omitempty"` + // Position of first character of the thread's span in left file. + LeftFileStart *CommentPosition `json:"leftFileStart,omitempty"` + // Position of last character of the thread's span in right file. + RightFileEnd *CommentPosition `json:"rightFileEnd,omitempty"` + // Position of first character of the thread's span in right file. + RightFileStart *CommentPosition `json:"rightFileStart,omitempty"` +} + +// The status of a comment thread. +type CommentThreadStatus string + +type commentThreadStatusValuesType struct { + Unknown CommentThreadStatus + Active CommentThreadStatus + Fixed CommentThreadStatus + WontFix CommentThreadStatus + Closed CommentThreadStatus + ByDesign CommentThreadStatus + Pending CommentThreadStatus +} + +var CommentThreadStatusValues = commentThreadStatusValuesType{ + // The thread status is unknown. + Unknown: "unknown", + // The thread status is active. + Active: "active", + // The thread status is resolved as fixed. + Fixed: "fixed", + // The thread status is resolved as won't fix. + WontFix: "wontFix", + // The thread status is closed. + Closed: "closed", + // The thread status is resolved as by design. + ByDesign: "byDesign", + // The thread status is pending. + Pending: "pending", +} + +// Comment tracking criteria is used to identify which iteration context the thread has been tracked to (if any) along with some detail about the original position and filename. +type CommentTrackingCriteria struct { + // The iteration of the file on the left side of the diff that the thread will be tracked to. Threads were tracked if this is greater than 0. + FirstComparingIteration *int `json:"firstComparingIteration,omitempty"` + // Original filepath the thread was created on before tracking. This will be different than the current thread filepath if the file in question was renamed in a later iteration. + OrigFilePath *string `json:"origFilePath,omitempty"` + // Original position of last character of the thread's span in left file. + OrigLeftFileEnd *CommentPosition `json:"origLeftFileEnd,omitempty"` + // Original position of first character of the thread's span in left file. + OrigLeftFileStart *CommentPosition `json:"origLeftFileStart,omitempty"` + // Original position of last character of the thread's span in right file. + OrigRightFileEnd *CommentPosition `json:"origRightFileEnd,omitempty"` + // Original position of first character of the thread's span in right file. + OrigRightFileStart *CommentPosition `json:"origRightFileStart,omitempty"` + // The iteration of the file on the right side of the diff that the thread will be tracked to. Threads were tracked if this is greater than 0. + SecondComparingIteration *int `json:"secondComparingIteration,omitempty"` +} + +// The type of a comment. +type CommentType string + +type commentTypeValuesType struct { + Unknown CommentType + Text CommentType + CodeChange CommentType + System CommentType +} + +var CommentTypeValues = commentTypeValuesType{ + // The comment type is not known. + Unknown: "unknown", + // This is a regular user comment. + Text: "text", + // The comment comes as a result of a code change. + CodeChange: "codeChange", + // The comment represents a system message. + System: "system", +} + +// Real time event (SignalR) for a completion errors on a pull request +type CompletionErrorsEvent struct { + // The id of this event. Can be used to track send/receive state between client and server. + EventId *uuid.UUID `json:"eventId,omitempty"` + // The id of the pull request this event was generated for. + PullRequestId *int `json:"pullRequestId,omitempty"` + // The error message associated with the completion error + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// Real time event (SignalR) for a discussions update on a pull request +type DiscussionsUpdatedEvent struct { + // The id of this event. Can be used to track send/receive state between client and server. + EventId *uuid.UUID `json:"eventId,omitempty"` + // The id of the pull request this event was generated for. + PullRequestId *int `json:"pullRequestId,omitempty"` +} + +type FileContentMetadata struct { + ContentType *string `json:"contentType,omitempty"` + Encoding *int `json:"encoding,omitempty"` + Extension *string `json:"extension,omitempty"` + FileName *string `json:"fileName,omitempty"` + IsBinary *bool `json:"isBinary,omitempty"` + IsImage *bool `json:"isImage,omitempty"` + VsLink *string `json:"vsLink,omitempty"` +} + +// Provides properties that describe file differences +type FileDiff struct { + // The collection of line diff blocks + LineDiffBlocks *[]LineDiffBlock `json:"lineDiffBlocks,omitempty"` + // Original path of item if different from current path. + OriginalPath *string `json:"originalPath,omitempty"` + // Current path of item + Path *string `json:"path,omitempty"` +} + +// Provides parameters that describe inputs for the file diff +type FileDiffParams struct { + // Original path of the file + OriginalPath *string `json:"originalPath,omitempty"` + // Current path of the file + Path *string `json:"path,omitempty"` +} + +// Provides properties that describe inputs for the file diffs +type FileDiffsCriteria struct { + // Commit ID of the base version + BaseVersionCommit *string `json:"baseVersionCommit,omitempty"` + // List of parameters for each of the files for which we need to get the file diff + FileDiffParams *[]FileDiffParams `json:"fileDiffParams,omitempty"` + // Commit ID of the target version + TargetVersionCommit *string `json:"targetVersionCommit,omitempty"` +} + +// A Git annotated tag. +type GitAnnotatedTag struct { + // The tagging Message + Message *string `json:"message,omitempty"` + // The name of the annotated tag. + Name *string `json:"name,omitempty"` + // The objectId (Sha1Id) of the tag. + ObjectId *string `json:"objectId,omitempty"` + // User info and date of tagging. + TaggedBy *GitUserDate `json:"taggedBy,omitempty"` + // Tagged git object. + TaggedObject *GitObject `json:"taggedObject,omitempty"` + Url *string `json:"url,omitempty"` +} + +// Current status of the asynchronous operation. +type GitAsyncOperationStatus string + +type gitAsyncOperationStatusValuesType struct { + Queued GitAsyncOperationStatus + InProgress GitAsyncOperationStatus + Completed GitAsyncOperationStatus + Failed GitAsyncOperationStatus + Abandoned GitAsyncOperationStatus +} + +var GitAsyncOperationStatusValues = gitAsyncOperationStatusValuesType{ + // The operation is waiting in a queue and has not yet started. + Queued: "queued", + // The operation is currently in progress. + InProgress: "inProgress", + // The operation has completed. + Completed: "completed", + // The operation has failed. Check for an error message. + Failed: "failed", + // The operation has been abandoned. + Abandoned: "abandoned", +} + +type GitAsyncRefOperation struct { + Links interface{} `json:"_links,omitempty"` + DetailedStatus *GitAsyncRefOperationDetail `json:"detailedStatus,omitempty"` + Parameters *GitAsyncRefOperationParameters `json:"parameters,omitempty"` + Status *GitAsyncOperationStatus `json:"status,omitempty"` + // A URL that can be used to make further requests for status about the operation + Url *string `json:"url,omitempty"` +} + +// Information about the progress of a cherry pick or revert operation. +type GitAsyncRefOperationDetail struct { + // Indicates if there was a conflict generated when trying to cherry pick or revert the changes. + Conflict *bool `json:"conflict,omitempty"` + // The current commit from the list of commits that are being cherry picked or reverted. + CurrentCommitId *string `json:"currentCommitId,omitempty"` + // Detailed information about why the cherry pick or revert failed to complete. + FailureMessage *string `json:"failureMessage,omitempty"` + // A number between 0 and 1 indicating the percent complete of the operation. + Progress *float64 `json:"progress,omitempty"` + // Provides a status code that indicates the reason the cherry pick or revert failed. + Status *GitAsyncRefOperationFailureStatus `json:"status,omitempty"` + // Indicates if the operation went beyond the maximum time allowed for a cherry pick or revert operation. + Timedout *bool `json:"timedout,omitempty"` +} + +type GitAsyncRefOperationFailureStatus string + +type gitAsyncRefOperationFailureStatusValuesType struct { + None GitAsyncRefOperationFailureStatus + InvalidRefName GitAsyncRefOperationFailureStatus + RefNameConflict GitAsyncRefOperationFailureStatus + CreateBranchPermissionRequired GitAsyncRefOperationFailureStatus + WritePermissionRequired GitAsyncRefOperationFailureStatus + TargetBranchDeleted GitAsyncRefOperationFailureStatus + GitObjectTooLarge GitAsyncRefOperationFailureStatus + OperationIndentityNotFound GitAsyncRefOperationFailureStatus + AsyncOperationNotFound GitAsyncRefOperationFailureStatus + Other GitAsyncRefOperationFailureStatus + EmptyCommitterSignature GitAsyncRefOperationFailureStatus +} + +var GitAsyncRefOperationFailureStatusValues = gitAsyncRefOperationFailureStatusValuesType{ + // No status + None: "none", + // Indicates that the ref update request could not be completed because the ref name presented in the request was not valid. + InvalidRefName: "invalidRefName", + // The ref update could not be completed because, in case-insensitive mode, the ref name conflicts with an existing, differently-cased ref name. + RefNameConflict: "refNameConflict", + // The ref update request could not be completed because the user lacks the permission to create a branch + CreateBranchPermissionRequired: "createBranchPermissionRequired", + // The ref update request could not be completed because the user lacks write permissions required to write this ref + WritePermissionRequired: "writePermissionRequired", + // Target branch was deleted after Git async operation started + TargetBranchDeleted: "targetBranchDeleted", + // Git object is too large to materialize into memory + GitObjectTooLarge: "gitObjectTooLarge", + // Identity who authorized the operation was not found + OperationIndentityNotFound: "operationIndentityNotFound", + // Async operation was not found + AsyncOperationNotFound: "asyncOperationNotFound", + // Unexpected failure + Other: "other", + // Initiator of async operation has signature with empty name or email + EmptyCommitterSignature: "emptyCommitterSignature", +} + +// Parameters that are provided in the request body when requesting to cherry pick or revert. +type GitAsyncRefOperationParameters struct { + // Proposed target branch name for the cherry pick or revert operation. + GeneratedRefName *string `json:"generatedRefName,omitempty"` + // The target branch for the cherry pick or revert operation. + OntoRefName *string `json:"ontoRefName,omitempty"` + // The git repository for the cherry pick or revert operation. + Repository *GitRepository `json:"repository,omitempty"` + // Details about the source of the cherry pick or revert operation (e.g. A pull request or a specific commit). + Source *GitAsyncRefOperationSource `json:"source,omitempty"` +} + +// GitAsyncRefOperationSource specifies the pull request or list of commits to use when making a cherry pick and revert operation request. Only one should be provided. +type GitAsyncRefOperationSource struct { + // A list of commits to cherry pick or revert + CommitList *[]GitCommitRef `json:"commitList,omitempty"` + // Id of the pull request to cherry pick or revert + PullRequestId *int `json:"pullRequestId,omitempty"` +} + +type GitBaseVersionDescriptor struct { + // Version string identifier (name of tag/branch, SHA1 of commit) + Version *string `json:"version,omitempty"` + // Version options - Specify additional modifiers to version (e.g Previous) + VersionOptions *GitVersionOptions `json:"versionOptions,omitempty"` + // Version type (branch, tag, or commit). Determines how Id is interpreted + VersionType *GitVersionType `json:"versionType,omitempty"` + // Version string identifier (name of tag/branch, SHA1 of commit) + BaseVersion *string `json:"baseVersion,omitempty"` + // Version options - Specify additional modifiers to version (e.g Previous) + BaseVersionOptions *GitVersionOptions `json:"baseVersionOptions,omitempty"` + // Version type (branch, tag, or commit). Determines how Id is interpreted + BaseVersionType *GitVersionType `json:"baseVersionType,omitempty"` +} + +type GitBlobRef struct { + Links interface{} `json:"_links,omitempty"` + // SHA1 hash of git object + ObjectId *string `json:"objectId,omitempty"` + // Size of blob content (in bytes) + Size *uint64 `json:"size,omitempty"` + Url *string `json:"url,omitempty"` +} + +// Ahead and behind counts for a particular ref. +type GitBranchStats struct { + // Number of commits ahead. + AheadCount *int `json:"aheadCount,omitempty"` + // Number of commits behind. + BehindCount *int `json:"behindCount,omitempty"` + // Current commit. + Commit *GitCommitRef `json:"commit,omitempty"` + // True if this is the result for the base version. + IsBaseVersion *bool `json:"isBaseVersion,omitempty"` + // Name of the ref. + Name *string `json:"name,omitempty"` +} + +// This object is returned from Cherry Pick operations and provides the id and status of the operation +type GitCherryPick struct { + Links interface{} `json:"_links,omitempty"` + DetailedStatus *GitAsyncRefOperationDetail `json:"detailedStatus,omitempty"` + Parameters *GitAsyncRefOperationParameters `json:"parameters,omitempty"` + Status *GitAsyncOperationStatus `json:"status,omitempty"` + // A URL that can be used to make further requests for status about the operation + Url *string `json:"url,omitempty"` + CherryPickId *int `json:"cherryPickId,omitempty"` +} + +type GitCommit struct { + // A collection of related REST reference links. + Links interface{} `json:"_links,omitempty"` + // Author of the commit. + Author *GitUserDate `json:"author,omitempty"` + // Counts of the types of changes (edits, deletes, etc.) included with the commit. + ChangeCounts *ChangeCountDictionary `json:"changeCounts,omitempty"` + // An enumeration of the changes included with the commit. + Changes *[]interface{} `json:"changes,omitempty"` + // Comment or message of the commit. + Comment *string `json:"comment,omitempty"` + // Indicates if the comment is truncated from the full Git commit comment message. + CommentTruncated *bool `json:"commentTruncated,omitempty"` + // ID (SHA-1) of the commit. + CommitId *string `json:"commitId,omitempty"` + // Committer of the commit. + Committer *GitUserDate `json:"committer,omitempty"` + // An enumeration of the parent commit IDs for this commit. + Parents *[]string `json:"parents,omitempty"` + // The push associated with this commit. + Push *GitPushRef `json:"push,omitempty"` + // Remote URL path to the commit. + RemoteUrl *string `json:"remoteUrl,omitempty"` + // A list of status metadata from services and extensions that may associate additional information to the commit. + Statuses *[]GitStatus `json:"statuses,omitempty"` + // REST URL for this resource. + Url *string `json:"url,omitempty"` + // A list of workitems associated with this commit. + WorkItems *[]webapi.ResourceRef `json:"workItems,omitempty"` + TreeId *string `json:"treeId,omitempty"` +} + +type GitCommitChanges struct { + ChangeCounts *ChangeCountDictionary `json:"changeCounts,omitempty"` + Changes *[]interface{} `json:"changes,omitempty"` +} + +type GitCommitDiffs struct { + AheadCount *int `json:"aheadCount,omitempty"` + AllChangesIncluded *bool `json:"allChangesIncluded,omitempty"` + BaseCommit *string `json:"baseCommit,omitempty"` + BehindCount *int `json:"behindCount,omitempty"` + ChangeCounts *map[VersionControlChangeType]int `json:"changeCounts,omitempty"` + Changes *[]interface{} `json:"changes,omitempty"` + CommonCommit *string `json:"commonCommit,omitempty"` + TargetCommit *string `json:"targetCommit,omitempty"` +} + +// Provides properties that describe a Git commit and associated metadata. +type GitCommitRef struct { + // A collection of related REST reference links. + Links interface{} `json:"_links,omitempty"` + // Author of the commit. + Author *GitUserDate `json:"author,omitempty"` + // Counts of the types of changes (edits, deletes, etc.) included with the commit. + ChangeCounts *ChangeCountDictionary `json:"changeCounts,omitempty"` + // An enumeration of the changes included with the commit. + Changes *[]interface{} `json:"changes,omitempty"` + // Comment or message of the commit. + Comment *string `json:"comment,omitempty"` + // Indicates if the comment is truncated from the full Git commit comment message. + CommentTruncated *bool `json:"commentTruncated,omitempty"` + // ID (SHA-1) of the commit. + CommitId *string `json:"commitId,omitempty"` + // Committer of the commit. + Committer *GitUserDate `json:"committer,omitempty"` + // An enumeration of the parent commit IDs for this commit. + Parents *[]string `json:"parents,omitempty"` + // The push associated with this commit. + Push *GitPushRef `json:"push,omitempty"` + // Remote URL path to the commit. + RemoteUrl *string `json:"remoteUrl,omitempty"` + // A list of status metadata from services and extensions that may associate additional information to the commit. + Statuses *[]GitStatus `json:"statuses,omitempty"` + // REST URL for this resource. + Url *string `json:"url,omitempty"` + // A list of workitems associated with this commit. + WorkItems *[]webapi.ResourceRef `json:"workItems,omitempty"` +} + +type GitCommitToCreate struct { + BaseRef *GitRef `json:"baseRef,omitempty"` + Comment *string `json:"comment,omitempty"` + PathActions *[]GitPathAction `json:"pathActions,omitempty"` +} + +type GitConflict struct { + Links interface{} `json:"_links,omitempty"` + ConflictId *int `json:"conflictId,omitempty"` + ConflictPath *string `json:"conflictPath,omitempty"` + ConflictType *GitConflictType `json:"conflictType,omitempty"` + MergeBaseCommit *GitCommitRef `json:"mergeBaseCommit,omitempty"` + MergeOrigin *GitMergeOriginRef `json:"mergeOrigin,omitempty"` + MergeSourceCommit *GitCommitRef `json:"mergeSourceCommit,omitempty"` + MergeTargetCommit *GitCommitRef `json:"mergeTargetCommit,omitempty"` + ResolutionError *GitResolutionError `json:"resolutionError,omitempty"` + ResolutionStatus *GitResolutionStatus `json:"resolutionStatus,omitempty"` + ResolvedBy *webapi.IdentityRef `json:"resolvedBy,omitempty"` + ResolvedDate *azuredevops.Time `json:"resolvedDate,omitempty"` + Url *string `json:"url,omitempty"` +} + +// Data object for AddAdd conflict +type GitConflictAddAdd struct { + Links interface{} `json:"_links,omitempty"` + ConflictId *int `json:"conflictId,omitempty"` + ConflictPath *string `json:"conflictPath,omitempty"` + ConflictType *GitConflictType `json:"conflictType,omitempty"` + MergeBaseCommit *GitCommitRef `json:"mergeBaseCommit,omitempty"` + MergeOrigin *GitMergeOriginRef `json:"mergeOrigin,omitempty"` + MergeSourceCommit *GitCommitRef `json:"mergeSourceCommit,omitempty"` + MergeTargetCommit *GitCommitRef `json:"mergeTargetCommit,omitempty"` + ResolutionError *GitResolutionError `json:"resolutionError,omitempty"` + ResolutionStatus *GitResolutionStatus `json:"resolutionStatus,omitempty"` + ResolvedBy *webapi.IdentityRef `json:"resolvedBy,omitempty"` + ResolvedDate *azuredevops.Time `json:"resolvedDate,omitempty"` + Url *string `json:"url,omitempty"` + Resolution *GitResolutionMergeContent `json:"resolution,omitempty"` + SourceBlob *GitBlobRef `json:"sourceBlob,omitempty"` + TargetBlob *GitBlobRef `json:"targetBlob,omitempty"` +} + +// Data object for RenameAdd conflict +type GitConflictAddRename struct { + Links interface{} `json:"_links,omitempty"` + ConflictId *int `json:"conflictId,omitempty"` + ConflictPath *string `json:"conflictPath,omitempty"` + ConflictType *GitConflictType `json:"conflictType,omitempty"` + MergeBaseCommit *GitCommitRef `json:"mergeBaseCommit,omitempty"` + MergeOrigin *GitMergeOriginRef `json:"mergeOrigin,omitempty"` + MergeSourceCommit *GitCommitRef `json:"mergeSourceCommit,omitempty"` + MergeTargetCommit *GitCommitRef `json:"mergeTargetCommit,omitempty"` + ResolutionError *GitResolutionError `json:"resolutionError,omitempty"` + ResolutionStatus *GitResolutionStatus `json:"resolutionStatus,omitempty"` + ResolvedBy *webapi.IdentityRef `json:"resolvedBy,omitempty"` + ResolvedDate *azuredevops.Time `json:"resolvedDate,omitempty"` + Url *string `json:"url,omitempty"` + BaseBlob *GitBlobRef `json:"baseBlob,omitempty"` + Resolution *GitResolutionPathConflict `json:"resolution,omitempty"` + SourceBlob *GitBlobRef `json:"sourceBlob,omitempty"` + TargetBlob *GitBlobRef `json:"targetBlob,omitempty"` + TargetOriginalPath *string `json:"targetOriginalPath,omitempty"` +} + +// Data object for EditDelete conflict +type GitConflictDeleteEdit struct { + Links interface{} `json:"_links,omitempty"` + ConflictId *int `json:"conflictId,omitempty"` + ConflictPath *string `json:"conflictPath,omitempty"` + ConflictType *GitConflictType `json:"conflictType,omitempty"` + MergeBaseCommit *GitCommitRef `json:"mergeBaseCommit,omitempty"` + MergeOrigin *GitMergeOriginRef `json:"mergeOrigin,omitempty"` + MergeSourceCommit *GitCommitRef `json:"mergeSourceCommit,omitempty"` + MergeTargetCommit *GitCommitRef `json:"mergeTargetCommit,omitempty"` + ResolutionError *GitResolutionError `json:"resolutionError,omitempty"` + ResolutionStatus *GitResolutionStatus `json:"resolutionStatus,omitempty"` + ResolvedBy *webapi.IdentityRef `json:"resolvedBy,omitempty"` + ResolvedDate *azuredevops.Time `json:"resolvedDate,omitempty"` + Url *string `json:"url,omitempty"` + BaseBlob *GitBlobRef `json:"baseBlob,omitempty"` + Resolution *GitResolutionPickOneAction `json:"resolution,omitempty"` + TargetBlob *GitBlobRef `json:"targetBlob,omitempty"` +} + +// Data object for RenameDelete conflict +type GitConflictDeleteRename struct { + Links interface{} `json:"_links,omitempty"` + ConflictId *int `json:"conflictId,omitempty"` + ConflictPath *string `json:"conflictPath,omitempty"` + ConflictType *GitConflictType `json:"conflictType,omitempty"` + MergeBaseCommit *GitCommitRef `json:"mergeBaseCommit,omitempty"` + MergeOrigin *GitMergeOriginRef `json:"mergeOrigin,omitempty"` + MergeSourceCommit *GitCommitRef `json:"mergeSourceCommit,omitempty"` + MergeTargetCommit *GitCommitRef `json:"mergeTargetCommit,omitempty"` + ResolutionError *GitResolutionError `json:"resolutionError,omitempty"` + ResolutionStatus *GitResolutionStatus `json:"resolutionStatus,omitempty"` + ResolvedBy *webapi.IdentityRef `json:"resolvedBy,omitempty"` + ResolvedDate *azuredevops.Time `json:"resolvedDate,omitempty"` + Url *string `json:"url,omitempty"` + BaseBlob *GitBlobRef `json:"baseBlob,omitempty"` + Resolution *GitResolutionPickOneAction `json:"resolution,omitempty"` + TargetBlob *GitBlobRef `json:"targetBlob,omitempty"` + TargetNewPath *string `json:"targetNewPath,omitempty"` +} + +// Data object for FileDirectory conflict +type GitConflictDirectoryFile struct { + Links interface{} `json:"_links,omitempty"` + ConflictId *int `json:"conflictId,omitempty"` + ConflictPath *string `json:"conflictPath,omitempty"` + ConflictType *GitConflictType `json:"conflictType,omitempty"` + MergeBaseCommit *GitCommitRef `json:"mergeBaseCommit,omitempty"` + MergeOrigin *GitMergeOriginRef `json:"mergeOrigin,omitempty"` + MergeSourceCommit *GitCommitRef `json:"mergeSourceCommit,omitempty"` + MergeTargetCommit *GitCommitRef `json:"mergeTargetCommit,omitempty"` + ResolutionError *GitResolutionError `json:"resolutionError,omitempty"` + ResolutionStatus *GitResolutionStatus `json:"resolutionStatus,omitempty"` + ResolvedBy *webapi.IdentityRef `json:"resolvedBy,omitempty"` + ResolvedDate *azuredevops.Time `json:"resolvedDate,omitempty"` + Url *string `json:"url,omitempty"` + Resolution *GitResolutionPathConflict `json:"resolution,omitempty"` + SourceTree *GitTreeRef `json:"sourceTree,omitempty"` + TargetBlob *GitBlobRef `json:"targetBlob,omitempty"` +} + +// Data object for DeleteEdit conflict +type GitConflictEditDelete struct { + Links interface{} `json:"_links,omitempty"` + ConflictId *int `json:"conflictId,omitempty"` + ConflictPath *string `json:"conflictPath,omitempty"` + ConflictType *GitConflictType `json:"conflictType,omitempty"` + MergeBaseCommit *GitCommitRef `json:"mergeBaseCommit,omitempty"` + MergeOrigin *GitMergeOriginRef `json:"mergeOrigin,omitempty"` + MergeSourceCommit *GitCommitRef `json:"mergeSourceCommit,omitempty"` + MergeTargetCommit *GitCommitRef `json:"mergeTargetCommit,omitempty"` + ResolutionError *GitResolutionError `json:"resolutionError,omitempty"` + ResolutionStatus *GitResolutionStatus `json:"resolutionStatus,omitempty"` + ResolvedBy *webapi.IdentityRef `json:"resolvedBy,omitempty"` + ResolvedDate *azuredevops.Time `json:"resolvedDate,omitempty"` + Url *string `json:"url,omitempty"` + BaseBlob *GitBlobRef `json:"baseBlob,omitempty"` + Resolution *GitResolutionPickOneAction `json:"resolution,omitempty"` + SourceBlob *GitBlobRef `json:"sourceBlob,omitempty"` +} + +// Data object for EditEdit conflict +type GitConflictEditEdit struct { + Links interface{} `json:"_links,omitempty"` + ConflictId *int `json:"conflictId,omitempty"` + ConflictPath *string `json:"conflictPath,omitempty"` + ConflictType *GitConflictType `json:"conflictType,omitempty"` + MergeBaseCommit *GitCommitRef `json:"mergeBaseCommit,omitempty"` + MergeOrigin *GitMergeOriginRef `json:"mergeOrigin,omitempty"` + MergeSourceCommit *GitCommitRef `json:"mergeSourceCommit,omitempty"` + MergeTargetCommit *GitCommitRef `json:"mergeTargetCommit,omitempty"` + ResolutionError *GitResolutionError `json:"resolutionError,omitempty"` + ResolutionStatus *GitResolutionStatus `json:"resolutionStatus,omitempty"` + ResolvedBy *webapi.IdentityRef `json:"resolvedBy,omitempty"` + ResolvedDate *azuredevops.Time `json:"resolvedDate,omitempty"` + Url *string `json:"url,omitempty"` + BaseBlob *GitBlobRef `json:"baseBlob,omitempty"` + Resolution *GitResolutionMergeContent `json:"resolution,omitempty"` + SourceBlob *GitBlobRef `json:"sourceBlob,omitempty"` + TargetBlob *GitBlobRef `json:"targetBlob,omitempty"` +} + +// Data object for DirectoryFile conflict +type GitConflictFileDirectory struct { + Links interface{} `json:"_links,omitempty"` + ConflictId *int `json:"conflictId,omitempty"` + ConflictPath *string `json:"conflictPath,omitempty"` + ConflictType *GitConflictType `json:"conflictType,omitempty"` + MergeBaseCommit *GitCommitRef `json:"mergeBaseCommit,omitempty"` + MergeOrigin *GitMergeOriginRef `json:"mergeOrigin,omitempty"` + MergeSourceCommit *GitCommitRef `json:"mergeSourceCommit,omitempty"` + MergeTargetCommit *GitCommitRef `json:"mergeTargetCommit,omitempty"` + ResolutionError *GitResolutionError `json:"resolutionError,omitempty"` + ResolutionStatus *GitResolutionStatus `json:"resolutionStatus,omitempty"` + ResolvedBy *webapi.IdentityRef `json:"resolvedBy,omitempty"` + ResolvedDate *azuredevops.Time `json:"resolvedDate,omitempty"` + Url *string `json:"url,omitempty"` + Resolution *GitResolutionPathConflict `json:"resolution,omitempty"` + SourceBlob *GitBlobRef `json:"sourceBlob,omitempty"` + TargetTree *GitTreeRef `json:"targetTree,omitempty"` +} + +// Data object for Rename1to2 conflict +type GitConflictRename1to2 struct { + Links interface{} `json:"_links,omitempty"` + ConflictId *int `json:"conflictId,omitempty"` + ConflictPath *string `json:"conflictPath,omitempty"` + ConflictType *GitConflictType `json:"conflictType,omitempty"` + MergeBaseCommit *GitCommitRef `json:"mergeBaseCommit,omitempty"` + MergeOrigin *GitMergeOriginRef `json:"mergeOrigin,omitempty"` + MergeSourceCommit *GitCommitRef `json:"mergeSourceCommit,omitempty"` + MergeTargetCommit *GitCommitRef `json:"mergeTargetCommit,omitempty"` + ResolutionError *GitResolutionError `json:"resolutionError,omitempty"` + ResolutionStatus *GitResolutionStatus `json:"resolutionStatus,omitempty"` + ResolvedBy *webapi.IdentityRef `json:"resolvedBy,omitempty"` + ResolvedDate *azuredevops.Time `json:"resolvedDate,omitempty"` + Url *string `json:"url,omitempty"` + BaseBlob *GitBlobRef `json:"baseBlob,omitempty"` + Resolution *GitResolutionRename1to2 `json:"resolution,omitempty"` + SourceBlob *GitBlobRef `json:"sourceBlob,omitempty"` + SourceNewPath *string `json:"sourceNewPath,omitempty"` + TargetBlob *GitBlobRef `json:"targetBlob,omitempty"` + TargetNewPath *string `json:"targetNewPath,omitempty"` +} + +// Data object for Rename2to1 conflict +type GitConflictRename2to1 struct { + Links interface{} `json:"_links,omitempty"` + ConflictId *int `json:"conflictId,omitempty"` + ConflictPath *string `json:"conflictPath,omitempty"` + ConflictType *GitConflictType `json:"conflictType,omitempty"` + MergeBaseCommit *GitCommitRef `json:"mergeBaseCommit,omitempty"` + MergeOrigin *GitMergeOriginRef `json:"mergeOrigin,omitempty"` + MergeSourceCommit *GitCommitRef `json:"mergeSourceCommit,omitempty"` + MergeTargetCommit *GitCommitRef `json:"mergeTargetCommit,omitempty"` + ResolutionError *GitResolutionError `json:"resolutionError,omitempty"` + ResolutionStatus *GitResolutionStatus `json:"resolutionStatus,omitempty"` + ResolvedBy *webapi.IdentityRef `json:"resolvedBy,omitempty"` + ResolvedDate *azuredevops.Time `json:"resolvedDate,omitempty"` + Url *string `json:"url,omitempty"` + Resolution *GitResolutionPathConflict `json:"resolution,omitempty"` + SourceNewBlob *GitBlobRef `json:"sourceNewBlob,omitempty"` + SourceOriginalBlob *GitBlobRef `json:"sourceOriginalBlob,omitempty"` + SourceOriginalPath *string `json:"sourceOriginalPath,omitempty"` + TargetNewBlob *GitBlobRef `json:"targetNewBlob,omitempty"` + TargetOriginalBlob *GitBlobRef `json:"targetOriginalBlob,omitempty"` + TargetOriginalPath *string `json:"targetOriginalPath,omitempty"` +} + +// Data object for AddRename conflict +type GitConflictRenameAdd struct { + Links interface{} `json:"_links,omitempty"` + ConflictId *int `json:"conflictId,omitempty"` + ConflictPath *string `json:"conflictPath,omitempty"` + ConflictType *GitConflictType `json:"conflictType,omitempty"` + MergeBaseCommit *GitCommitRef `json:"mergeBaseCommit,omitempty"` + MergeOrigin *GitMergeOriginRef `json:"mergeOrigin,omitempty"` + MergeSourceCommit *GitCommitRef `json:"mergeSourceCommit,omitempty"` + MergeTargetCommit *GitCommitRef `json:"mergeTargetCommit,omitempty"` + ResolutionError *GitResolutionError `json:"resolutionError,omitempty"` + ResolutionStatus *GitResolutionStatus `json:"resolutionStatus,omitempty"` + ResolvedBy *webapi.IdentityRef `json:"resolvedBy,omitempty"` + ResolvedDate *azuredevops.Time `json:"resolvedDate,omitempty"` + Url *string `json:"url,omitempty"` + BaseBlob *GitBlobRef `json:"baseBlob,omitempty"` + Resolution *GitResolutionPathConflict `json:"resolution,omitempty"` + SourceBlob *GitBlobRef `json:"sourceBlob,omitempty"` + SourceOriginalPath *string `json:"sourceOriginalPath,omitempty"` + TargetBlob *GitBlobRef `json:"targetBlob,omitempty"` +} + +// Data object for DeleteRename conflict +type GitConflictRenameDelete struct { + Links interface{} `json:"_links,omitempty"` + ConflictId *int `json:"conflictId,omitempty"` + ConflictPath *string `json:"conflictPath,omitempty"` + ConflictType *GitConflictType `json:"conflictType,omitempty"` + MergeBaseCommit *GitCommitRef `json:"mergeBaseCommit,omitempty"` + MergeOrigin *GitMergeOriginRef `json:"mergeOrigin,omitempty"` + MergeSourceCommit *GitCommitRef `json:"mergeSourceCommit,omitempty"` + MergeTargetCommit *GitCommitRef `json:"mergeTargetCommit,omitempty"` + ResolutionError *GitResolutionError `json:"resolutionError,omitempty"` + ResolutionStatus *GitResolutionStatus `json:"resolutionStatus,omitempty"` + ResolvedBy *webapi.IdentityRef `json:"resolvedBy,omitempty"` + ResolvedDate *azuredevops.Time `json:"resolvedDate,omitempty"` + Url *string `json:"url,omitempty"` + BaseBlob *GitBlobRef `json:"baseBlob,omitempty"` + Resolution *GitResolutionPickOneAction `json:"resolution,omitempty"` + SourceBlob *GitBlobRef `json:"sourceBlob,omitempty"` + SourceNewPath *string `json:"sourceNewPath,omitempty"` +} + +// Data object for RenameRename conflict +type GitConflictRenameRename struct { + Links interface{} `json:"_links,omitempty"` + ConflictId *int `json:"conflictId,omitempty"` + ConflictPath *string `json:"conflictPath,omitempty"` + ConflictType *GitConflictType `json:"conflictType,omitempty"` + MergeBaseCommit *GitCommitRef `json:"mergeBaseCommit,omitempty"` + MergeOrigin *GitMergeOriginRef `json:"mergeOrigin,omitempty"` + MergeSourceCommit *GitCommitRef `json:"mergeSourceCommit,omitempty"` + MergeTargetCommit *GitCommitRef `json:"mergeTargetCommit,omitempty"` + ResolutionError *GitResolutionError `json:"resolutionError,omitempty"` + ResolutionStatus *GitResolutionStatus `json:"resolutionStatus,omitempty"` + ResolvedBy *webapi.IdentityRef `json:"resolvedBy,omitempty"` + ResolvedDate *azuredevops.Time `json:"resolvedDate,omitempty"` + Url *string `json:"url,omitempty"` + BaseBlob *GitBlobRef `json:"baseBlob,omitempty"` + OriginalPath *string `json:"originalPath,omitempty"` + Resolution *GitResolutionMergeContent `json:"resolution,omitempty"` + SourceBlob *GitBlobRef `json:"sourceBlob,omitempty"` + TargetBlob *GitBlobRef `json:"targetBlob,omitempty"` +} + +// The type of a merge conflict. +type GitConflictType string + +type gitConflictTypeValuesType struct { + None GitConflictType + AddAdd GitConflictType + AddRename GitConflictType + DeleteEdit GitConflictType + DeleteRename GitConflictType + DirectoryFile GitConflictType + DirectoryChild GitConflictType + EditDelete GitConflictType + EditEdit GitConflictType + FileDirectory GitConflictType + Rename1to2 GitConflictType + Rename2to1 GitConflictType + RenameAdd GitConflictType + RenameDelete GitConflictType + RenameRename GitConflictType +} + +var GitConflictTypeValues = gitConflictTypeValuesType{ + // No conflict + None: "none", + // Added on source and target; content differs + AddAdd: "addAdd", + // Added on source and rename destination on target + AddRename: "addRename", + // Deleted on source and edited on target + DeleteEdit: "deleteEdit", + // Deleted on source and renamed on target + DeleteRename: "deleteRename", + // Path is a directory on source and a file on target + DirectoryFile: "directoryFile", + // Children of directory which has DirectoryFile or FileDirectory conflict + DirectoryChild: "directoryChild", + // Edited on source and deleted on target + EditDelete: "editDelete", + // Edited on source and target; content differs + EditEdit: "editEdit", + // Path is a file on source and a directory on target + FileDirectory: "fileDirectory", + // Same file renamed on both source and target; destination paths differ + Rename1to2: "rename1to2", + // Different files renamed to same destination path on both source and target + Rename2to1: "rename2to1", + // Rename destination on source and new file on target + RenameAdd: "renameAdd", + // Renamed on source and deleted on target + RenameDelete: "renameDelete", + // Rename destination on both source and target; content differs + RenameRename: "renameRename", +} + +type GitConflictUpdateResult struct { + // Conflict ID that was provided by input + ConflictId *int `json:"conflictId,omitempty"` + // Reason for failing + CustomMessage *string `json:"customMessage,omitempty"` + // New state of the conflict after updating + UpdatedConflict *GitConflict `json:"updatedConflict,omitempty"` + // Status of the update on the server + UpdateStatus *GitConflictUpdateStatus `json:"updateStatus,omitempty"` +} + +// Represents the possible outcomes from a request to update a pull request conflict +type GitConflictUpdateStatus string + +type gitConflictUpdateStatusValuesType struct { + Succeeded GitConflictUpdateStatus + BadRequest GitConflictUpdateStatus + InvalidResolution GitConflictUpdateStatus + UnsupportedConflictType GitConflictUpdateStatus + NotFound GitConflictUpdateStatus +} + +var GitConflictUpdateStatusValues = gitConflictUpdateStatusValuesType{ + // Indicates that pull request conflict update request was completed successfully + Succeeded: "succeeded", + // Indicates that the update request did not fit the expected data contract + BadRequest: "badRequest", + // Indicates that the requested resolution was not valid + InvalidResolution: "invalidResolution", + // Indicates that the conflict in the update request was not a supported conflict type + UnsupportedConflictType: "unsupportedConflictType", + // Indicates that the conflict could not be found + NotFound: "notFound", +} + +type GitDeletedRepository struct { + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + DeletedBy *webapi.IdentityRef `json:"deletedBy,omitempty"` + DeletedDate *azuredevops.Time `json:"deletedDate,omitempty"` + Id *uuid.UUID `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Project *core.TeamProjectReference `json:"project,omitempty"` +} + +type GitFilePathsCollection struct { + CommitId *string `json:"commitId,omitempty"` + Paths *[]string `json:"paths,omitempty"` + Url *string `json:"url,omitempty"` +} + +// Status information about a requested fork operation. +type GitForkOperationStatusDetail struct { + // All valid steps for the forking process + AllSteps *[]string `json:"allSteps,omitempty"` + // Index into AllSteps for the current step + CurrentStep *int `json:"currentStep,omitempty"` + // Error message if the operation failed. + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// Information about a fork ref. +type GitForkRef struct { + Links interface{} `json:"_links,omitempty"` + Creator *webapi.IdentityRef `json:"creator,omitempty"` + IsLocked *bool `json:"isLocked,omitempty"` + IsLockedBy *webapi.IdentityRef `json:"isLockedBy,omitempty"` + Name *string `json:"name,omitempty"` + ObjectId *string `json:"objectId,omitempty"` + PeeledObjectId *string `json:"peeledObjectId,omitempty"` + Statuses *[]GitStatus `json:"statuses,omitempty"` + Url *string `json:"url,omitempty"` + // The repository ID of the fork. + Repository *GitRepository `json:"repository,omitempty"` +} + +// Request to sync data between two forks. +type GitForkSyncRequest struct { + // Collection of related links + Links interface{} `json:"_links,omitempty"` + DetailedStatus *GitForkOperationStatusDetail `json:"detailedStatus,omitempty"` + // Unique identifier for the operation. + OperationId *int `json:"operationId,omitempty"` + // Fully-qualified identifier for the source repository. + Source *GlobalGitRepositoryKey `json:"source,omitempty"` + // If supplied, the set of ref mappings to use when performing a "sync" or create. If missing, all refs will be synchronized. + SourceToTargetRefs *[]SourceToTargetRef `json:"sourceToTargetRefs,omitempty"` + Status *GitAsyncOperationStatus `json:"status,omitempty"` +} + +// Parameters for creating a fork request +type GitForkSyncRequestParameters struct { + // Fully-qualified identifier for the source repository. + Source *GlobalGitRepositoryKey `json:"source,omitempty"` + // If supplied, the set of ref mappings to use when performing a "sync" or create. If missing, all refs will be synchronized. + SourceToTargetRefs *[]SourceToTargetRef `json:"sourceToTargetRefs,omitempty"` +} + +type GitForkTeamProjectReference struct { +} + +// Accepted types of version +type GitHistoryMode string + +type gitHistoryModeValuesType struct { + SimplifiedHistory GitHistoryMode + FirstParent GitHistoryMode + FullHistory GitHistoryMode + FullHistorySimplifyMerges GitHistoryMode +} + +var GitHistoryModeValues = gitHistoryModeValuesType{ + // The history mode used by `git log`. This is the default. + SimplifiedHistory: "simplifiedHistory", + // The history mode used by `git log --first-parent` + FirstParent: "firstParent", + // The history mode used by `git log --full-history` + FullHistory: "fullHistory", + // The history mode used by `git log --full-history --simplify-merges` + FullHistorySimplifyMerges: "fullHistorySimplifyMerges", +} + +type GitImportFailedEvent struct { + SourceRepositoryName *string `json:"sourceRepositoryName,omitempty"` + TargetRepository *GitRepository `json:"targetRepository,omitempty"` +} + +// Parameter for creating a git import request when source is Git version control +type GitImportGitSource struct { + // Tells if this is a sync request or not + Overwrite *bool `json:"overwrite,omitempty"` + // Url for the source repo + Url *string `json:"url,omitempty"` +} + +// A request to import data from a remote source control system. +type GitImportRequest struct { + // Links to related resources. + Links interface{} `json:"_links,omitempty"` + // Detailed status of the import, including the current step and an error message, if applicable. + DetailedStatus *GitImportStatusDetail `json:"detailedStatus,omitempty"` + // The unique identifier for this import request. + ImportRequestId *int `json:"importRequestId,omitempty"` + // Parameters for creating the import request. + Parameters *GitImportRequestParameters `json:"parameters,omitempty"` + // The target repository for this import. + Repository *GitRepository `json:"repository,omitempty"` + // Current status of the import. + Status *GitAsyncOperationStatus `json:"status,omitempty"` + // A link back to this import request resource. + Url *string `json:"url,omitempty"` +} + +// Parameters for creating an import request +type GitImportRequestParameters struct { + // Option to delete service endpoint when import is done + DeleteServiceEndpointAfterImportIsDone *bool `json:"deleteServiceEndpointAfterImportIsDone,omitempty"` + // Source for importing git repository + GitSource *GitImportGitSource `json:"gitSource,omitempty"` + // Service Endpoint for connection to external endpoint + ServiceEndpointId *uuid.UUID `json:"serviceEndpointId,omitempty"` + // Source for importing tfvc repository + TfvcSource *GitImportTfvcSource `json:"tfvcSource,omitempty"` +} + +// Additional status information about an import request. +type GitImportStatusDetail struct { + // All valid steps for the import process + AllSteps *[]string `json:"allSteps,omitempty"` + // Index into AllSteps for the current step + CurrentStep *int `json:"currentStep,omitempty"` + // Error message if the operation failed. + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +type GitImportSucceededEvent struct { + SourceRepositoryName *string `json:"sourceRepositoryName,omitempty"` + TargetRepository *GitRepository `json:"targetRepository,omitempty"` +} + +// Parameter for creating a git import request when source is tfvc version control +type GitImportTfvcSource struct { + // Set true to import History, false otherwise + ImportHistory *bool `json:"importHistory,omitempty"` + // Get history for last n days (max allowed value is 180 days) + ImportHistoryDurationInDays *int `json:"importHistoryDurationInDays,omitempty"` + // Path which we want to import (this can be copied from Path Control in Explorer) + Path *string `json:"path,omitempty"` +} + +type GitItem struct { + Links interface{} `json:"_links,omitempty"` + Content *string `json:"content,omitempty"` + ContentMetadata *FileContentMetadata `json:"contentMetadata,omitempty"` + IsFolder *bool `json:"isFolder,omitempty"` + IsSymLink *bool `json:"isSymLink,omitempty"` + Path *string `json:"path,omitempty"` + Url *string `json:"url,omitempty"` + // SHA1 of commit item was fetched at + CommitId *string `json:"commitId,omitempty"` + // Type of object (Commit, Tree, Blob, Tag, ...) + GitObjectType *GitObjectType `json:"gitObjectType,omitempty"` + // Shallow ref to commit that last changed this item Only populated if latestProcessedChange is requested May not be accurate if latest change is not yet cached + LatestProcessedChange *GitCommitRef `json:"latestProcessedChange,omitempty"` + // Git object id + ObjectId *string `json:"objectId,omitempty"` + // Git object id + OriginalObjectId *string `json:"originalObjectId,omitempty"` +} + +type GitItemDescriptor struct { + // Path to item + Path *string `json:"path,omitempty"` + // Specifies whether to include children (OneLevel), all descendants (Full), or None + RecursionLevel *VersionControlRecursionType `json:"recursionLevel,omitempty"` + // Version string (interpretation based on VersionType defined in subclass + Version *string `json:"version,omitempty"` + // Version modifiers (e.g. previous) + VersionOptions *GitVersionOptions `json:"versionOptions,omitempty"` + // How to interpret version (branch,tag,commit) + VersionType *GitVersionType `json:"versionType,omitempty"` +} + +type GitItemRequestData struct { + // Whether to include metadata for all items + IncludeContentMetadata *bool `json:"includeContentMetadata,omitempty"` + // Whether to include the _links field on the shallow references + IncludeLinks *bool `json:"includeLinks,omitempty"` + // Collection of items to fetch, including path, version, and recursion level + ItemDescriptors *[]GitItemDescriptor `json:"itemDescriptors,omitempty"` + // Whether to include shallow ref to commit that last changed each item + LatestProcessedChange *bool `json:"latestProcessedChange,omitempty"` +} + +type GitLastChangeItem struct { + // Gets or sets the commit Id this item was modified most recently for the provided version. + CommitId *string `json:"commitId,omitempty"` + // Gets or sets the path of the item. + Path *string `json:"path,omitempty"` +} + +type GitLastChangeTreeItems struct { + // The list of commits referenced by Items, if they were requested. + Commits *[]GitCommitRef `json:"commits,omitempty"` + // The last change of items. + Items *[]GitLastChangeItem `json:"items,omitempty"` + // The last explored time, in case the result is not comprehensive. Null otherwise. + LastExploredTime *azuredevops.Time `json:"lastExploredTime,omitempty"` +} + +type GitMerge struct { + // Comment or message of the commit. + Comment *string `json:"comment,omitempty"` + // An enumeration of the parent commit IDs for the merge commit. + Parents *[]string `json:"parents,omitempty"` + // Reference links. + Links interface{} `json:"_links,omitempty"` + // Detailed status of the merge operation. + DetailedStatus *GitMergeOperationStatusDetail `json:"detailedStatus,omitempty"` + // Unique identifier for the merge operation. + MergeOperationId *int `json:"mergeOperationId,omitempty"` + // Status of the merge operation. + Status *GitAsyncOperationStatus `json:"status,omitempty"` +} + +// Status information about a requested merge operation. +type GitMergeOperationStatusDetail struct { + // Error message if the operation failed. + FailureMessage *string `json:"failureMessage,omitempty"` + // The commitId of the resultant merge commit. + MergeCommitId *string `json:"mergeCommitId,omitempty"` +} + +type GitMergeOriginRef struct { + PullRequestId *int `json:"pullRequestId,omitempty"` +} + +// Parameters required for performing git merge. +type GitMergeParameters struct { + // Comment or message of the commit. + Comment *string `json:"comment,omitempty"` + // An enumeration of the parent commit IDs for the merge commit. + Parents *[]string `json:"parents,omitempty"` +} + +// Git object identifier and type information. +type GitObject struct { + // Object Id (Sha1Id). + ObjectId *string `json:"objectId,omitempty"` + // Type of object (Commit, Tree, Blob, Tag) + ObjectType *GitObjectType `json:"objectType,omitempty"` +} + +type GitObjectType string + +type gitObjectTypeValuesType struct { + Bad GitObjectType + Commit GitObjectType + Tree GitObjectType + Blob GitObjectType + Tag GitObjectType + Ext2 GitObjectType + OfsDelta GitObjectType + RefDelta GitObjectType +} + +var GitObjectTypeValues = gitObjectTypeValuesType{ + Bad: "bad", + Commit: "commit", + Tree: "tree", + Blob: "blob", + Tag: "tag", + Ext2: "ext2", + OfsDelta: "ofsDelta", + RefDelta: "refDelta", +} + +type GitPathAction struct { + Action *GitPathActions `json:"action,omitempty"` + Base64Content *string `json:"base64Content,omitempty"` + Path *string `json:"path,omitempty"` + RawTextContent *string `json:"rawTextContent,omitempty"` + TargetPath *string `json:"targetPath,omitempty"` +} + +type GitPathActions string + +type gitPathActionsValuesType struct { + None GitPathActions + Edit GitPathActions + Delete GitPathActions + Add GitPathActions + Rename GitPathActions +} + +var GitPathActionsValues = gitPathActionsValuesType{ + None: "none", + Edit: "edit", + Delete: "delete", + Add: "add", + Rename: "rename", +} + +type GitPathToItemsCollection struct { + Items *map[string][]GitItem `json:"items,omitempty"` +} + +type GitPolicyConfigurationResponse struct { + // The HTTP client methods find the continuation token header in the response and populate this field. + ContinuationToken *string `json:"continuationToken,omitempty"` + PolicyConfigurations *[]policy.PolicyConfiguration `json:"policyConfigurations,omitempty"` +} + +// Represents all the data associated with a pull request. +type GitPullRequest struct { + // Links to other related objects. + Links interface{} `json:"_links,omitempty"` + // A string which uniquely identifies this pull request. To generate an artifact ID for a pull request, use this template: ```vstfs:///Git/PullRequestId/{projectId}/{repositoryId}/{pullRequestId}``` + ArtifactId *string `json:"artifactId,omitempty"` + // If set, auto-complete is enabled for this pull request and this is the identity that enabled it. + AutoCompleteSetBy *webapi.IdentityRef `json:"autoCompleteSetBy,omitempty"` + // The user who closed the pull request. + ClosedBy *webapi.IdentityRef `json:"closedBy,omitempty"` + // The date when the pull request was closed (completed, abandoned, or merged externally). + ClosedDate *azuredevops.Time `json:"closedDate,omitempty"` + // The code review ID of the pull request. Used internally. + CodeReviewId *int `json:"codeReviewId,omitempty"` + // The commits contained in the pull request. + Commits *[]GitCommitRef `json:"commits,omitempty"` + // Options which affect how the pull request will be merged when it is completed. + CompletionOptions *GitPullRequestCompletionOptions `json:"completionOptions,omitempty"` + // The most recent date at which the pull request entered the queue to be completed. Used internally. + CompletionQueueTime *azuredevops.Time `json:"completionQueueTime,omitempty"` + // The identity of the user who created the pull request. + CreatedBy *webapi.IdentityRef `json:"createdBy,omitempty"` + // The date when the pull request was created. + CreationDate *azuredevops.Time `json:"creationDate,omitempty"` + // The description of the pull request. + Description *string `json:"description,omitempty"` + // If this is a PR from a fork this will contain information about its source. + ForkSource *GitForkRef `json:"forkSource,omitempty"` + // Draft / WIP pull request. + IsDraft *bool `json:"isDraft,omitempty"` + // The labels associated with the pull request. + Labels *[]core.WebApiTagDefinition `json:"labels,omitempty"` + // The commit of the most recent pull request merge. If empty, the most recent merge is in progress or was unsuccessful. + LastMergeCommit *GitCommitRef `json:"lastMergeCommit,omitempty"` + // The commit at the head of the source branch at the time of the last pull request merge. + LastMergeSourceCommit *GitCommitRef `json:"lastMergeSourceCommit,omitempty"` + // The commit at the head of the target branch at the time of the last pull request merge. + LastMergeTargetCommit *GitCommitRef `json:"lastMergeTargetCommit,omitempty"` + // If set, pull request merge failed for this reason. + MergeFailureMessage *string `json:"mergeFailureMessage,omitempty"` + // The type of failure (if any) of the pull request merge. + MergeFailureType *PullRequestMergeFailureType `json:"mergeFailureType,omitempty"` + // The ID of the job used to run the pull request merge. Used internally. + MergeId *uuid.UUID `json:"mergeId,omitempty"` + // Options used when the pull request merge runs. These are separate from completion options since completion happens only once and a new merge will run every time the source branch of the pull request changes. + MergeOptions *GitPullRequestMergeOptions `json:"mergeOptions,omitempty"` + // The current status of the pull request merge. + MergeStatus *PullRequestAsyncStatus `json:"mergeStatus,omitempty"` + // The ID of the pull request. + PullRequestId *int `json:"pullRequestId,omitempty"` + // Used internally. + RemoteUrl *string `json:"remoteUrl,omitempty"` + // The repository containing the target branch of the pull request. + Repository *GitRepository `json:"repository,omitempty"` + // A list of reviewers on the pull request along with the state of their votes. + Reviewers *[]IdentityRefWithVote `json:"reviewers,omitempty"` + // The name of the source branch of the pull request. + SourceRefName *string `json:"sourceRefName,omitempty"` + // The status of the pull request. + Status *PullRequestStatus `json:"status,omitempty"` + // If true, this pull request supports multiple iterations. Iteration support means individual pushes to the source branch of the pull request can be reviewed and comments left in one iteration will be tracked across future iterations. + SupportsIterations *bool `json:"supportsIterations,omitempty"` + // The name of the target branch of the pull request. + TargetRefName *string `json:"targetRefName,omitempty"` + // The title of the pull request. + Title *string `json:"title,omitempty"` + // Used internally. + Url *string `json:"url,omitempty"` + // Any work item references associated with this pull request. + WorkItemRefs *[]webapi.ResourceRef `json:"workItemRefs,omitempty"` +} + +// Change made in a pull request. +type GitPullRequestChange struct { + // ID used to track files through multiple changes. + ChangeTrackingId *int `json:"changeTrackingId,omitempty"` +} + +// Represents a comment thread of a pull request. A thread contains meta data about the file it was left on (if any) along with one or more comments (an initial comment and the subsequent replies). +type GitPullRequestCommentThread struct { + // Links to other related objects. + Links interface{} `json:"_links,omitempty"` + // A list of the comments. + Comments *[]Comment `json:"comments,omitempty"` + // The comment thread id. + Id *int `json:"id,omitempty"` + // Set of identities related to this thread + Identities *map[string]webapi.IdentityRef `json:"identities,omitempty"` + // Specify if the thread is deleted which happens when all comments are deleted. + IsDeleted *bool `json:"isDeleted,omitempty"` + // The time this thread was last updated. + LastUpdatedDate *azuredevops.Time `json:"lastUpdatedDate,omitempty"` + // Optional properties associated with the thread as a collection of key-value pairs. + Properties interface{} `json:"properties,omitempty"` + // The time this thread was published. + PublishedDate *azuredevops.Time `json:"publishedDate,omitempty"` + // The status of the comment thread. + Status *CommentThreadStatus `json:"status,omitempty"` + // Specify thread context such as position in left/right file. + ThreadContext *CommentThreadContext `json:"threadContext,omitempty"` + // Extended context information unique to pull requests + PullRequestThreadContext *GitPullRequestCommentThreadContext `json:"pullRequestThreadContext,omitempty"` +} + +// Comment thread context contains details about what diffs were being viewed at the time of thread creation and whether or not the thread has been tracked from that original diff. +type GitPullRequestCommentThreadContext struct { + // Used to track a comment across iterations. This value can be found by looking at the iteration's changes list. Must be set for pull requests with iteration support. Otherwise, it's not required for 'legacy' pull requests. + ChangeTrackingId *int `json:"changeTrackingId,omitempty"` + // The iteration context being viewed when the thread was created. + IterationContext *CommentIterationContext `json:"iterationContext,omitempty"` + // The criteria used to track this thread. If this property is filled out when the thread is returned, then the thread has been tracked from its original location using the given criteria. + TrackingCriteria *CommentTrackingCriteria `json:"trackingCriteria,omitempty"` +} + +// Preferences about how the pull request should be completed. +type GitPullRequestCompletionOptions struct { + // If true, policies will be explicitly bypassed while the pull request is completed. + BypassPolicy *bool `json:"bypassPolicy,omitempty"` + // If policies are bypassed, this reason is stored as to why bypass was used. + BypassReason *string `json:"bypassReason,omitempty"` + // If true, the source branch of the pull request will be deleted after completion. + DeleteSourceBranch *bool `json:"deleteSourceBranch,omitempty"` + // If set, this will be used as the commit message of the merge commit. + MergeCommitMessage *string `json:"mergeCommitMessage,omitempty"` + // Specify the strategy used to merge the pull request during completion. If MergeStrategy is not set to any value, a no-FF merge will be created if SquashMerge == false. If MergeStrategy is not set to any value, the pull request commits will be squash if SquashMerge == true. The SquashMerge member is deprecated. It is recommended that you explicitly set MergeStrategy in all cases. If an explicit value is provided for MergeStrategy, the SquashMerge member will be ignored. + MergeStrategy *GitPullRequestMergeStrategy `json:"mergeStrategy,omitempty"` + // SquashMerge is deprecated. You should explicity set the value of MergeStrategy. If MergeStrategy is set to any value, the SquashMerge value will be ignored. If MergeStrategy is not set, the merge strategy will be no-fast-forward if this flag is false, or squash if true. + SquashMerge *bool `json:"squashMerge,omitempty"` + // If true, we will attempt to transition any work items linked to the pull request into the next logical state (i.e. Active -> Resolved) + TransitionWorkItems *bool `json:"transitionWorkItems,omitempty"` + // If true, the current completion attempt was triggered via auto-complete. Used internally. + TriggeredByAutoComplete *bool `json:"triggeredByAutoComplete,omitempty"` +} + +// Provides properties that describe a Git pull request iteration. Iterations are created as a result of creating and pushing updates to a pull request. +type GitPullRequestIteration struct { + // A collection of related REST reference links. + Links interface{} `json:"_links,omitempty"` + // Author of the pull request iteration. + Author *webapi.IdentityRef `json:"author,omitempty"` + // Changes included with the pull request iteration. + ChangeList *[]GitPullRequestChange `json:"changeList,omitempty"` + // The commits included with the pull request iteration. + Commits *[]GitCommitRef `json:"commits,omitempty"` + // The first common Git commit of the source and target refs. + CommonRefCommit *GitCommitRef `json:"commonRefCommit,omitempty"` + // The creation date of the pull request iteration. + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + // Description of the pull request iteration. + Description *string `json:"description,omitempty"` + // Indicates if the Commits property contains a truncated list of commits in this pull request iteration. + HasMoreCommits *bool `json:"hasMoreCommits,omitempty"` + // ID of the pull request iteration. Iterations are created as a result of creating and pushing updates to a pull request. + Id *int `json:"id,omitempty"` + // If the iteration reason is Retarget, this is the refName of the new target + NewTargetRefName *string `json:"newTargetRefName,omitempty"` + // If the iteration reason is Retarget, this is the original target refName + OldTargetRefName *string `json:"oldTargetRefName,omitempty"` + // The Git push information associated with this pull request iteration. + Push *GitPushRef `json:"push,omitempty"` + // The reason for which the pull request iteration was created. + Reason *IterationReason `json:"reason,omitempty"` + // The source Git commit of this iteration. + SourceRefCommit *GitCommitRef `json:"sourceRefCommit,omitempty"` + // The target Git commit of this iteration. + TargetRefCommit *GitCommitRef `json:"targetRefCommit,omitempty"` + // The updated date of the pull request iteration. + UpdatedDate *azuredevops.Time `json:"updatedDate,omitempty"` +} + +// Collection of changes made in a pull request. +type GitPullRequestIterationChanges struct { + // Changes made in the iteration. + ChangeEntries *[]GitPullRequestChange `json:"changeEntries,omitempty"` + // Value to specify as skip to get the next page of changes. This will be zero if there are no more changes. + NextSkip *int `json:"nextSkip,omitempty"` + // Value to specify as top to get the next page of changes. This will be zero if there are no more changes. + NextTop *int `json:"nextTop,omitempty"` +} + +// The options which are used when a pull request merge is created. +type GitPullRequestMergeOptions struct { + DetectRenameFalsePositives *bool `json:"detectRenameFalsePositives,omitempty"` + // If true, rename detection will not be performed during the merge. + DisableRenames *bool `json:"disableRenames,omitempty"` +} + +// Enumeration of possible merge strategies which can be used to complete a pull request. +type GitPullRequestMergeStrategy string + +type gitPullRequestMergeStrategyValuesType struct { + NoFastForward GitPullRequestMergeStrategy + Squash GitPullRequestMergeStrategy + Rebase GitPullRequestMergeStrategy + RebaseMerge GitPullRequestMergeStrategy +} + +var GitPullRequestMergeStrategyValues = gitPullRequestMergeStrategyValuesType{ + // A two-parent, no-fast-forward merge. The source branch is unchanged. This is the default behavior. + NoFastForward: "noFastForward", + // Put all changes from the pull request into a single-parent commit. + Squash: "squash", + // Rebase the source branch on top of the target branch HEAD commit, and fast-forward the target branch. The source branch is updated during the rebase operation. + Rebase: "rebase", + // Rebase the source branch on top of the target branch HEAD commit, and create a two-parent, no-fast-forward merge. The source branch is updated during the rebase operation. + RebaseMerge: "rebaseMerge", +} + +// A set of pull request queries and their results. +type GitPullRequestQuery struct { + // The queries to perform. + Queries *[]GitPullRequestQueryInput `json:"queries,omitempty"` + // The results of the queries. This matches the QueryInputs list so Results[n] are the results of QueryInputs[n]. Each entry in the list is a dictionary of commit->pull requests. + Results *[]map[string][]GitPullRequest `json:"results,omitempty"` +} + +// Pull request query input parameters. +type GitPullRequestQueryInput struct { + // The list of commit IDs to search for. + Items *[]string `json:"items,omitempty"` + // The type of query to perform. + Type *GitPullRequestQueryType `json:"type,omitempty"` +} + +// Accepted types of pull request queries. +type GitPullRequestQueryType string + +type gitPullRequestQueryTypeValuesType struct { + NotSet GitPullRequestQueryType + LastMergeCommit GitPullRequestQueryType + Commit GitPullRequestQueryType +} + +var GitPullRequestQueryTypeValues = gitPullRequestQueryTypeValuesType{ + // No query type set. + NotSet: "notSet", + // Search for pull requests that created the supplied merge commits. + LastMergeCommit: "lastMergeCommit", + // Search for pull requests that merged the supplied commits. + Commit: "commit", +} + +type GitPullRequestReviewFileContentInfo struct { + Links interface{} `json:"_links,omitempty"` + // The file change path. + Path *string `json:"path,omitempty"` + // Content hash of on-disk representation of file content. Its calculated by the client by using SHA1 hash function. Ensure that uploaded file has same encoding as in source control. + ShA1Hash *string `json:"shA1Hash,omitempty"` +} + +type GitPullRequestReviewFileType string + +type gitPullRequestReviewFileTypeValuesType struct { + ChangeEntry GitPullRequestReviewFileType + Attachment GitPullRequestReviewFileType +} + +var GitPullRequestReviewFileTypeValues = gitPullRequestReviewFileTypeValuesType{ + ChangeEntry: "changeEntry", + Attachment: "attachment", +} + +// Pull requests can be searched for matching this criteria. +type GitPullRequestSearchCriteria struct { + // If set, search for pull requests that were created by this identity. + CreatorId *uuid.UUID `json:"creatorId,omitempty"` + // Whether to include the _links field on the shallow references + IncludeLinks *bool `json:"includeLinks,omitempty"` + // If set, search for pull requests whose target branch is in this repository. + RepositoryId *uuid.UUID `json:"repositoryId,omitempty"` + // If set, search for pull requests that have this identity as a reviewer. + ReviewerId *uuid.UUID `json:"reviewerId,omitempty"` + // If set, search for pull requests from this branch. + SourceRefName *string `json:"sourceRefName,omitempty"` + // If set, search for pull requests whose source branch is in this repository. + SourceRepositoryId *uuid.UUID `json:"sourceRepositoryId,omitempty"` + // If set, search for pull requests that are in this state. Defaults to Active if unset. + Status *PullRequestStatus `json:"status,omitempty"` + // If set, search for pull requests into this branch. + TargetRefName *string `json:"targetRefName,omitempty"` +} + +// This class contains the metadata of a service/extension posting pull request status. Status can be associated with a pull request or an iteration. +type GitPullRequestStatus struct { + // Reference links. + Links interface{} `json:"_links,omitempty"` + // Context of the status. + Context *GitStatusContext `json:"context,omitempty"` + // Identity that created the status. + CreatedBy *webapi.IdentityRef `json:"createdBy,omitempty"` + // Creation date and time of the status. + CreationDate *azuredevops.Time `json:"creationDate,omitempty"` + // Status description. Typically describes current state of the status. + Description *string `json:"description,omitempty"` + // Status identifier. + Id *int `json:"id,omitempty"` + // State of the status. + State *GitStatusState `json:"state,omitempty"` + // URL with status details. + TargetUrl *string `json:"targetUrl,omitempty"` + // Last update date and time of the status. + UpdatedDate *azuredevops.Time `json:"updatedDate,omitempty"` + // ID of the iteration to associate status with. Minimum value is 1. + IterationId *int `json:"iterationId,omitempty"` + // Custom properties of the status. + Properties interface{} `json:"properties,omitempty"` +} + +type GitPush struct { + Links interface{} `json:"_links,omitempty"` + Date *azuredevops.Time `json:"date,omitempty"` + PushCorrelationId *uuid.UUID `json:"pushCorrelationId,omitempty"` + PushedBy *webapi.IdentityRef `json:"pushedBy,omitempty"` + PushId *int `json:"pushId,omitempty"` + Url *string `json:"url,omitempty"` + Commits *[]GitCommitRef `json:"commits,omitempty"` + RefUpdates *[]GitRefUpdate `json:"refUpdates,omitempty"` + Repository *GitRepository `json:"repository,omitempty"` +} + +type GitPushEventData struct { + AfterId *string `json:"afterId,omitempty"` + BeforeId *string `json:"beforeId,omitempty"` + Branch *string `json:"branch,omitempty"` + Commits *[]GitCommit `json:"commits,omitempty"` + Repository *GitRepository `json:"repository,omitempty"` +} + +type GitPushRef struct { + Links interface{} `json:"_links,omitempty"` + Date *azuredevops.Time `json:"date,omitempty"` + // Deprecated: This is unused as of Dev15 M115 and may be deleted in the future + PushCorrelationId *uuid.UUID `json:"pushCorrelationId,omitempty"` + PushedBy *webapi.IdentityRef `json:"pushedBy,omitempty"` + PushId *int `json:"pushId,omitempty"` + Url *string `json:"url,omitempty"` +} + +type GitPushSearchCriteria struct { + FromDate *azuredevops.Time `json:"fromDate,omitempty"` + // Whether to include the _links field on the shallow references + IncludeLinks *bool `json:"includeLinks,omitempty"` + IncludeRefUpdates *bool `json:"includeRefUpdates,omitempty"` + PusherId *uuid.UUID `json:"pusherId,omitempty"` + RefName *string `json:"refName,omitempty"` + ToDate *azuredevops.Time `json:"toDate,omitempty"` +} + +type GitQueryBranchStatsCriteria struct { + BaseCommit *GitVersionDescriptor `json:"baseCommit,omitempty"` + TargetCommits *[]GitVersionDescriptor `json:"targetCommits,omitempty"` +} + +type GitQueryCommitsCriteria struct { + // Number of entries to skip + Skip *int `json:"$skip,omitempty"` + // Maximum number of entries to retrieve + Top *int `json:"$top,omitempty"` + // Alias or display name of the author + Author *string `json:"author,omitempty"` + // Only applicable when ItemVersion specified. If provided, start walking history starting at this commit. + CompareVersion *GitVersionDescriptor `json:"compareVersion,omitempty"` + // Only applies when an itemPath is specified. This determines whether to exclude delete entries of the specified path. + ExcludeDeletes *bool `json:"excludeDeletes,omitempty"` + // If provided, a lower bound for filtering commits alphabetically + FromCommitId *string `json:"fromCommitId,omitempty"` + // If provided, only include history entries created after this date (string) + FromDate *string `json:"fromDate,omitempty"` + // What Git history mode should be used. This only applies to the search criteria when Ids = null and an itemPath is specified. + HistoryMode *GitHistoryMode `json:"historyMode,omitempty"` + // If provided, specifies the exact commit ids of the commits to fetch. May not be combined with other parameters. + Ids *[]string `json:"ids,omitempty"` + // Whether to include the _links field on the shallow references + IncludeLinks *bool `json:"includeLinks,omitempty"` + // Whether to include the push information + IncludePushData *bool `json:"includePushData,omitempty"` + // Whether to include the image Url for committers and authors + IncludeUserImageUrl *bool `json:"includeUserImageUrl,omitempty"` + // Whether to include linked work items + IncludeWorkItems *bool `json:"includeWorkItems,omitempty"` + // Path of item to search under + ItemPath *string `json:"itemPath,omitempty"` + // If provided, identifies the commit or branch to search + ItemVersion *GitVersionDescriptor `json:"itemVersion,omitempty"` + // If provided, an upper bound for filtering commits alphabetically + ToCommitId *string `json:"toCommitId,omitempty"` + // If provided, only include history entries created before this date (string) + ToDate *string `json:"toDate,omitempty"` + // Alias or display name of the committer + User *string `json:"user,omitempty"` +} + +type GitQueryRefsCriteria struct { + // List of commit Ids to be searched + CommitIds *[]string `json:"commitIds,omitempty"` + // List of complete or partial names for refs to be searched + RefNames *[]string `json:"refNames,omitempty"` + // Type of search on refNames, if provided + SearchType *GitRefSearchType `json:"searchType,omitempty"` +} + +type GitRecycleBinRepositoryDetails struct { + // Setting to false will undo earlier deletion and restore the repository. + Deleted *bool `json:"deleted,omitempty"` +} + +type GitRef struct { + Links interface{} `json:"_links,omitempty"` + Creator *webapi.IdentityRef `json:"creator,omitempty"` + IsLocked *bool `json:"isLocked,omitempty"` + IsLockedBy *webapi.IdentityRef `json:"isLockedBy,omitempty"` + Name *string `json:"name,omitempty"` + ObjectId *string `json:"objectId,omitempty"` + PeeledObjectId *string `json:"peeledObjectId,omitempty"` + Statuses *[]GitStatus `json:"statuses,omitempty"` + Url *string `json:"url,omitempty"` +} + +type GitRefFavorite struct { + Links interface{} `json:"_links,omitempty"` + Id *int `json:"id,omitempty"` + IdentityId *uuid.UUID `json:"identityId,omitempty"` + Name *string `json:"name,omitempty"` + RepositoryId *uuid.UUID `json:"repositoryId,omitempty"` + Type *RefFavoriteType `json:"type,omitempty"` + Url *string `json:"url,omitempty"` +} + +// Search type on ref name +type GitRefSearchType string + +type gitRefSearchTypeValuesType struct { + Exact GitRefSearchType + StartsWith GitRefSearchType + Contains GitRefSearchType +} + +var GitRefSearchTypeValues = gitRefSearchTypeValuesType{ + Exact: "exact", + StartsWith: "startsWith", + Contains: "contains", +} + +type GitRefUpdate struct { + IsLocked *bool `json:"isLocked,omitempty"` + Name *string `json:"name,omitempty"` + NewObjectId *string `json:"newObjectId,omitempty"` + OldObjectId *string `json:"oldObjectId,omitempty"` + RepositoryId *uuid.UUID `json:"repositoryId,omitempty"` +} + +// Enumerates the modes under which ref updates can be written to their repositories. +type GitRefUpdateMode string + +type gitRefUpdateModeValuesType struct { + BestEffort GitRefUpdateMode + AllOrNone GitRefUpdateMode +} + +var GitRefUpdateModeValues = gitRefUpdateModeValuesType{ + // Indicates the Git protocol model where any refs that can be updated will be updated, but any failures will not prevent other updates from succeeding. + BestEffort: "bestEffort", + // Indicates that all ref updates must succeed or none will succeed. All ref updates will be atomically written. If any failure is encountered, previously successful updates will be rolled back and the entire operation will fail. + AllOrNone: "allOrNone", +} + +type GitRefUpdateResult struct { + // Custom message for the result object For instance, Reason for failing. + CustomMessage *string `json:"customMessage,omitempty"` + // Whether the ref is locked or not + IsLocked *bool `json:"isLocked,omitempty"` + // Ref name + Name *string `json:"name,omitempty"` + // New object ID + NewObjectId *string `json:"newObjectId,omitempty"` + // Old object ID + OldObjectId *string `json:"oldObjectId,omitempty"` + // Name of the plugin that rejected the updated. + RejectedBy *string `json:"rejectedBy,omitempty"` + // Repository ID + RepositoryId *uuid.UUID `json:"repositoryId,omitempty"` + // True if the ref update succeeded, false otherwise + Success *bool `json:"success,omitempty"` + // Status of the update from the TFS server. + UpdateStatus *GitRefUpdateStatus `json:"updateStatus,omitempty"` +} + +// Represents the possible outcomes from a request to update a ref in a repository. +type GitRefUpdateStatus string + +type gitRefUpdateStatusValuesType struct { + Succeeded GitRefUpdateStatus + ForcePushRequired GitRefUpdateStatus + StaleOldObjectId GitRefUpdateStatus + InvalidRefName GitRefUpdateStatus + Unprocessed GitRefUpdateStatus + UnresolvableToCommit GitRefUpdateStatus + WritePermissionRequired GitRefUpdateStatus + ManageNotePermissionRequired GitRefUpdateStatus + CreateBranchPermissionRequired GitRefUpdateStatus + CreateTagPermissionRequired GitRefUpdateStatus + RejectedByPlugin GitRefUpdateStatus + Locked GitRefUpdateStatus + RefNameConflict GitRefUpdateStatus + RejectedByPolicy GitRefUpdateStatus + SucceededNonExistentRef GitRefUpdateStatus + SucceededCorruptRef GitRefUpdateStatus +} + +var GitRefUpdateStatusValues = gitRefUpdateStatusValuesType{ + // Indicates that the ref update request was completed successfully. + Succeeded: "succeeded", + // Indicates that the ref update request could not be completed because part of the graph would be disconnected by this change, and the caller does not have ForcePush permission on the repository. + ForcePushRequired: "forcePushRequired", + // Indicates that the ref update request could not be completed because the old object ID presented in the request was not the object ID of the ref when the database attempted the update. The most likely scenario is that the caller lost a race to update the ref. + StaleOldObjectId: "staleOldObjectId", + // Indicates that the ref update request could not be completed because the ref name presented in the request was not valid. + InvalidRefName: "invalidRefName", + // The request was not processed + Unprocessed: "unprocessed", + // The ref update request could not be completed because the new object ID for the ref could not be resolved to a commit object (potentially through any number of tags) + UnresolvableToCommit: "unresolvableToCommit", + // The ref update request could not be completed because the user lacks write permissions required to write this ref + WritePermissionRequired: "writePermissionRequired", + // The ref update request could not be completed because the user lacks note creation permissions required to write this note + ManageNotePermissionRequired: "manageNotePermissionRequired", + // The ref update request could not be completed because the user lacks the permission to create a branch + CreateBranchPermissionRequired: "createBranchPermissionRequired", + // The ref update request could not be completed because the user lacks the permission to create a tag + CreateTagPermissionRequired: "createTagPermissionRequired", + // The ref update could not be completed because it was rejected by the plugin. + RejectedByPlugin: "rejectedByPlugin", + // The ref update could not be completed because the ref is locked by another user. + Locked: "locked", + // The ref update could not be completed because, in case-insensitive mode, the ref name conflicts with an existing, differently-cased ref name. + RefNameConflict: "refNameConflict", + // The ref update could not be completed because it was rejected by policy. + RejectedByPolicy: "rejectedByPolicy", + // Indicates that the ref update request was completed successfully, but the ref doesn't actually exist so no changes were made. This should only happen during deletes. + SucceededNonExistentRef: "succeededNonExistentRef", + // Indicates that the ref update request was completed successfully, but the passed-in ref was corrupt - as in, the old object ID was bad. This should only happen during deletes. + SucceededCorruptRef: "succeededCorruptRef", +} + +type GitRepository struct { + Links interface{} `json:"_links,omitempty"` + DefaultBranch *string `json:"defaultBranch,omitempty"` + Id *uuid.UUID `json:"id,omitempty"` + // True if the repository was created as a fork + IsFork *bool `json:"isFork,omitempty"` + Name *string `json:"name,omitempty"` + ParentRepository *GitRepositoryRef `json:"parentRepository,omitempty"` + Project *core.TeamProjectReference `json:"project,omitempty"` + RemoteUrl *string `json:"remoteUrl,omitempty"` + // Compressed size (bytes) of the repository. + Size *uint64 `json:"size,omitempty"` + SshUrl *string `json:"sshUrl,omitempty"` + Url *string `json:"url,omitempty"` + ValidRemoteUrls *[]string `json:"validRemoteUrls,omitempty"` + WebUrl *string `json:"webUrl,omitempty"` +} + +type GitRepositoryCreateOptions struct { + Name *string `json:"name,omitempty"` + ParentRepository *GitRepositoryRef `json:"parentRepository,omitempty"` + Project *core.TeamProjectReference `json:"project,omitempty"` +} + +type GitRepositoryRef struct { + // Team Project Collection where this Fork resides + Collection *core.TeamProjectCollectionReference `json:"collection,omitempty"` + Id *uuid.UUID `json:"id,omitempty"` + // True if the repository was created as a fork + IsFork *bool `json:"isFork,omitempty"` + Name *string `json:"name,omitempty"` + Project *core.TeamProjectReference `json:"project,omitempty"` + RemoteUrl *string `json:"remoteUrl,omitempty"` + SshUrl *string `json:"sshUrl,omitempty"` + Url *string `json:"url,omitempty"` +} + +type GitRepositoryStats struct { + ActivePullRequestsCount *int `json:"activePullRequestsCount,omitempty"` + BranchesCount *int `json:"branchesCount,omitempty"` + CommitsCount *int `json:"commitsCount,omitempty"` + RepositoryId *string `json:"repositoryId,omitempty"` +} + +type GitResolution struct { + // User who created the resolution. + Author *webapi.IdentityRef `json:"author,omitempty"` +} + +// The type of a merge conflict. +type GitResolutionError string + +type gitResolutionErrorValuesType struct { + None GitResolutionError + MergeContentNotFound GitResolutionError + PathInUse GitResolutionError + InvalidPath GitResolutionError + UnknownAction GitResolutionError + UnknownMergeType GitResolutionError + OtherError GitResolutionError +} + +var GitResolutionErrorValues = gitResolutionErrorValuesType{ + // No error + None: "none", + // User set a blob id for resolving a content merge, but blob was not found in repo during application + MergeContentNotFound: "mergeContentNotFound", + // Attempted to resolve a conflict by moving a file to another path, but path was already in use + PathInUse: "pathInUse", + // No error + InvalidPath: "invalidPath", + // GitResolutionAction was set to an unrecognized value + UnknownAction: "unknownAction", + // GitResolutionMergeType was set to an unrecognized value + UnknownMergeType: "unknownMergeType", + // Any error for which a more specific code doesn't apply + OtherError: "otherError", +} + +type GitResolutionMergeContent struct { + // User who created the resolution. + Author *webapi.IdentityRef `json:"author,omitempty"` + MergeType *GitResolutionMergeType `json:"mergeType,omitempty"` + UserMergedBlob *GitBlobRef `json:"userMergedBlob,omitempty"` + UserMergedContent *[]byte `json:"userMergedContent,omitempty"` +} + +type GitResolutionMergeType string + +type gitResolutionMergeTypeValuesType struct { + Undecided GitResolutionMergeType + TakeSourceContent GitResolutionMergeType + TakeTargetContent GitResolutionMergeType + AutoMerged GitResolutionMergeType + UserMerged GitResolutionMergeType +} + +var GitResolutionMergeTypeValues = gitResolutionMergeTypeValuesType{ + Undecided: "undecided", + TakeSourceContent: "takeSourceContent", + TakeTargetContent: "takeTargetContent", + AutoMerged: "autoMerged", + UserMerged: "userMerged", +} + +type GitResolutionPathConflict struct { + // User who created the resolution. + Author *webapi.IdentityRef `json:"author,omitempty"` + Action *GitResolutionPathConflictAction `json:"action,omitempty"` + RenamePath *string `json:"renamePath,omitempty"` +} + +type GitResolutionPathConflictAction string + +type gitResolutionPathConflictActionValuesType struct { + Undecided GitResolutionPathConflictAction + KeepSourceRenameTarget GitResolutionPathConflictAction + KeepSourceDeleteTarget GitResolutionPathConflictAction + KeepTargetRenameSource GitResolutionPathConflictAction + KeepTargetDeleteSource GitResolutionPathConflictAction +} + +var GitResolutionPathConflictActionValues = gitResolutionPathConflictActionValuesType{ + Undecided: "undecided", + KeepSourceRenameTarget: "keepSourceRenameTarget", + KeepSourceDeleteTarget: "keepSourceDeleteTarget", + KeepTargetRenameSource: "keepTargetRenameSource", + KeepTargetDeleteSource: "keepTargetDeleteSource", +} + +type GitResolutionPickOneAction struct { + // User who created the resolution. + Author *webapi.IdentityRef `json:"author,omitempty"` + Action *GitResolutionWhichAction `json:"action,omitempty"` +} + +type GitResolutionRename1to2 struct { + // User who created the resolution. + Author *webapi.IdentityRef `json:"author,omitempty"` + MergeType *GitResolutionMergeType `json:"mergeType,omitempty"` + UserMergedBlob *GitBlobRef `json:"userMergedBlob,omitempty"` + UserMergedContent *[]byte `json:"userMergedContent,omitempty"` + Action *GitResolutionRename1to2Action `json:"action,omitempty"` +} + +type GitResolutionRename1to2Action string + +type gitResolutionRename1to2ActionValuesType struct { + Undecided GitResolutionRename1to2Action + KeepSourcePath GitResolutionRename1to2Action + KeepTargetPath GitResolutionRename1to2Action + KeepBothFiles GitResolutionRename1to2Action +} + +var GitResolutionRename1to2ActionValues = gitResolutionRename1to2ActionValuesType{ + Undecided: "undecided", + KeepSourcePath: "keepSourcePath", + KeepTargetPath: "keepTargetPath", + KeepBothFiles: "keepBothFiles", +} + +// Resolution status of a conflict. +type GitResolutionStatus string + +type gitResolutionStatusValuesType struct { + Unresolved GitResolutionStatus + PartiallyResolved GitResolutionStatus + Resolved GitResolutionStatus +} + +var GitResolutionStatusValues = gitResolutionStatusValuesType{ + Unresolved: "unresolved", + PartiallyResolved: "partiallyResolved", + Resolved: "resolved", +} + +type GitResolutionWhichAction string + +type gitResolutionWhichActionValuesType struct { + Undecided GitResolutionWhichAction + PickSourceAction GitResolutionWhichAction + PickTargetAction GitResolutionWhichAction +} + +var GitResolutionWhichActionValues = gitResolutionWhichActionValuesType{ + Undecided: "undecided", + PickSourceAction: "pickSourceAction", + PickTargetAction: "pickTargetAction", +} + +type GitRevert struct { + Links interface{} `json:"_links,omitempty"` + DetailedStatus *GitAsyncRefOperationDetail `json:"detailedStatus,omitempty"` + Parameters *GitAsyncRefOperationParameters `json:"parameters,omitempty"` + Status *GitAsyncOperationStatus `json:"status,omitempty"` + // A URL that can be used to make further requests for status about the operation + Url *string `json:"url,omitempty"` + RevertId *int `json:"revertId,omitempty"` +} + +// This class contains the metadata of a service/extension posting a status. +type GitStatus struct { + // Reference links. + Links interface{} `json:"_links,omitempty"` + // Context of the status. + Context *GitStatusContext `json:"context,omitempty"` + // Identity that created the status. + CreatedBy *webapi.IdentityRef `json:"createdBy,omitempty"` + // Creation date and time of the status. + CreationDate *azuredevops.Time `json:"creationDate,omitempty"` + // Status description. Typically describes current state of the status. + Description *string `json:"description,omitempty"` + // Status identifier. + Id *int `json:"id,omitempty"` + // State of the status. + State *GitStatusState `json:"state,omitempty"` + // URL with status details. + TargetUrl *string `json:"targetUrl,omitempty"` + // Last update date and time of the status. + UpdatedDate *azuredevops.Time `json:"updatedDate,omitempty"` +} + +// Status context that uniquely identifies the status. +type GitStatusContext struct { + // Genre of the status. Typically name of the service/tool generating the status, can be empty. + Genre *string `json:"genre,omitempty"` + // Name identifier of the status, cannot be null or empty. + Name *string `json:"name,omitempty"` +} + +// State of the status. +type GitStatusState string + +type gitStatusStateValuesType struct { + NotSet GitStatusState + Pending GitStatusState + Succeeded GitStatusState + Failed GitStatusState + Error GitStatusState + NotApplicable GitStatusState +} + +var GitStatusStateValues = gitStatusStateValuesType{ + // Status state not set. Default state. + NotSet: "notSet", + // Status pending. + Pending: "pending", + // Status succeeded. + Succeeded: "succeeded", + // Status failed. + Failed: "failed", + // Status with an error. + Error: "error", + // Status is not applicable to the target object. + NotApplicable: "notApplicable", +} + +// An object describing the git suggestion. Git suggestions are currently limited to suggested pull requests. +type GitSuggestion struct { + // Specific properties describing the suggestion. + Properties *map[string]interface{} `json:"properties,omitempty"` + // The type of suggestion (e.g. pull request). + Type *string `json:"type,omitempty"` +} + +type GitTargetVersionDescriptor struct { + // Version string identifier (name of tag/branch, SHA1 of commit) + Version *string `json:"version,omitempty"` + // Version options - Specify additional modifiers to version (e.g Previous) + VersionOptions *GitVersionOptions `json:"versionOptions,omitempty"` + // Version type (branch, tag, or commit). Determines how Id is interpreted + VersionType *GitVersionType `json:"versionType,omitempty"` + // Version string identifier (name of tag/branch, SHA1 of commit) + TargetVersion *string `json:"targetVersion,omitempty"` + // Version options - Specify additional modifiers to version (e.g Previous) + TargetVersionOptions *GitVersionOptions `json:"targetVersionOptions,omitempty"` + // Version type (branch, tag, or commit). Determines how Id is interpreted + TargetVersionType *GitVersionType `json:"targetVersionType,omitempty"` +} + +type GitTemplate struct { + // Name of the Template + Name *string `json:"name,omitempty"` + // Type of the Template + Type *string `json:"type,omitempty"` +} + +type GitTreeDiff struct { + // ObjectId of the base tree of this diff. + BaseTreeId *string `json:"baseTreeId,omitempty"` + // List of tree entries that differ between the base and target tree. Renames and object type changes are returned as a delete for the old object and add for the new object. If a continuation token is returned in the response header, some tree entries are yet to be processed and may yeild more diff entries. If the continuation token is not returned all the diff entries have been included in this response. + DiffEntries *[]GitTreeDiffEntry `json:"diffEntries,omitempty"` + // ObjectId of the target tree of this diff. + TargetTreeId *string `json:"targetTreeId,omitempty"` + // REST Url to this resource. + Url *string `json:"url,omitempty"` +} + +type GitTreeDiffEntry struct { + // SHA1 hash of the object in the base tree, if it exists. Will be null in case of adds. + BaseObjectId *string `json:"baseObjectId,omitempty"` + // Type of change that affected this entry. + ChangeType *VersionControlChangeType `json:"changeType,omitempty"` + // Object type of the tree entry. Blob, Tree or Commit("submodule") + ObjectType *GitObjectType `json:"objectType,omitempty"` + // Relative path in base and target trees. + Path *string `json:"path,omitempty"` + // SHA1 hash of the object in the target tree, if it exists. Will be null in case of deletes. + TargetObjectId *string `json:"targetObjectId,omitempty"` +} + +type GitTreeDiffResponse struct { + // The HTTP client methods find the continuation token header in the response and populate this field. + ContinuationToken *[]string `json:"continuationToken,omitempty"` + TreeDiff *GitTreeDiff `json:"treeDiff,omitempty"` +} + +type GitTreeEntryRef struct { + // Blob or tree + GitObjectType *GitObjectType `json:"gitObjectType,omitempty"` + // Mode represented as octal string + Mode *string `json:"mode,omitempty"` + // SHA1 hash of git object + ObjectId *string `json:"objectId,omitempty"` + // Path relative to parent tree object + RelativePath *string `json:"relativePath,omitempty"` + // Size of content + Size *uint64 `json:"size,omitempty"` + // url to retrieve tree or blob + Url *string `json:"url,omitempty"` +} + +type GitTreeRef struct { + Links interface{} `json:"_links,omitempty"` + // SHA1 hash of git object + ObjectId *string `json:"objectId,omitempty"` + // Sum of sizes of all children + Size *uint64 `json:"size,omitempty"` + // Blobs and trees under this tree + TreeEntries *[]GitTreeEntryRef `json:"treeEntries,omitempty"` + // Url to tree + Url *string `json:"url,omitempty"` +} + +// User info and date for Git operations. +type GitUserDate struct { + // Date of the Git operation. + Date *azuredevops.Time `json:"date,omitempty"` + // Email address of the user performing the Git operation. + Email *string `json:"email,omitempty"` + // Url for the user's avatar. + ImageUrl *string `json:"imageUrl,omitempty"` + // Name of the user performing the Git operation. + Name *string `json:"name,omitempty"` +} + +type GitVersionDescriptor struct { + // Version string identifier (name of tag/branch, SHA1 of commit) + Version *string `json:"version,omitempty"` + // Version options - Specify additional modifiers to version (e.g Previous) + VersionOptions *GitVersionOptions `json:"versionOptions,omitempty"` + // Version type (branch, tag, or commit). Determines how Id is interpreted + VersionType *GitVersionType `json:"versionType,omitempty"` +} + +// Accepted types of version options +type GitVersionOptions string + +type gitVersionOptionsValuesType struct { + None GitVersionOptions + PreviousChange GitVersionOptions + FirstParent GitVersionOptions +} + +var GitVersionOptionsValues = gitVersionOptionsValuesType{ + // Not specified + None: "none", + // Commit that changed item prior to the current version + PreviousChange: "previousChange", + // First parent of commit (HEAD^) + FirstParent: "firstParent", +} + +// Accepted types of version +type GitVersionType string + +type gitVersionTypeValuesType struct { + Branch GitVersionType + Tag GitVersionType + Commit GitVersionType +} + +var GitVersionTypeValues = gitVersionTypeValuesType{ + // Interpret the version as a branch name + Branch: "branch", + // Interpret the version as a tag name + Tag: "tag", + // Interpret the version as a commit ID (SHA1) + Commit: "commit", +} + +// Globally unique key for a repository. +type GlobalGitRepositoryKey struct { + // Team Project Collection ID of the collection for the repository. + CollectionId *uuid.UUID `json:"collectionId,omitempty"` + // Team Project ID of the project for the repository. + ProjectId *uuid.UUID `json:"projectId,omitempty"` + // ID of the repository. + RepositoryId *uuid.UUID `json:"repositoryId,omitempty"` +} + +type HistoryEntry struct { + // The Change list (changeset/commit/shelveset) for this point in history + ChangeList interface{} `json:"changeList,omitempty"` + // The change made to the item from this change list (only relevant for File history, not folders) + ItemChangeType *VersionControlChangeType `json:"itemChangeType,omitempty"` + // The path of the item at this point in history (only relevant for File history, not folders) + ServerItem *string `json:"serverItem,omitempty"` +} + +// Identity information including a vote on a pull request. +type IdentityRefWithVote struct { + // Indicates if this is a required reviewer for this pull request.
Branches can have policies that require particular reviewers are required for pull requests. + IsRequired *bool `json:"isRequired,omitempty"` + // URL to retrieve information about this identity + ReviewerUrl *string `json:"reviewerUrl,omitempty"` + // Vote on a pull request:
10 - approved 5 - approved with suggestions 0 - no vote -5 - waiting for author -10 - rejected + Vote *int `json:"vote,omitempty"` + // Groups or teams that that this reviewer contributed to.
Groups and teams can be reviewers on pull requests but can not vote directly. When a member of the group or team votes, that vote is rolled up into the group or team vote. VotedFor is a list of such votes. + VotedFor *[]IdentityRefWithVote `json:"votedFor,omitempty"` +} + +type ImportRepositoryValidation struct { + GitSource *GitImportGitSource `json:"gitSource,omitempty"` + Password *string `json:"password,omitempty"` + TfvcSource *GitImportTfvcSource `json:"tfvcSource,omitempty"` + Username *string `json:"username,omitempty"` +} + +type IncludedGitCommit struct { + CommitId *string `json:"commitId,omitempty"` + CommitTime *azuredevops.Time `json:"commitTime,omitempty"` + ParentCommitIds *[]string `json:"parentCommitIds,omitempty"` + RepositoryId *uuid.UUID `json:"repositoryId,omitempty"` +} + +// Real time event (SignalR) for IsDraft update on a pull request +type IsDraftUpdatedEvent struct { + // The id of this event. Can be used to track send/receive state between client and server. + EventId *uuid.UUID `json:"eventId,omitempty"` + // The id of the pull request this event was generated for. + PullRequestId *int `json:"pullRequestId,omitempty"` +} + +type ItemContent struct { + Content *string `json:"content,omitempty"` + ContentType *ItemContentType `json:"contentType,omitempty"` +} + +// [Flags] +type ItemContentType string + +type itemContentTypeValuesType struct { + RawText ItemContentType + Base64Encoded ItemContentType +} + +var ItemContentTypeValues = itemContentTypeValuesType{ + RawText: "rawText", + Base64Encoded: "base64Encoded", +} + +// Optional details to include when returning an item model +type ItemDetailsOptions struct { + // If true, include metadata about the file type + IncludeContentMetadata *bool `json:"includeContentMetadata,omitempty"` + // Specifies whether to include children (OneLevel), all descendants (Full) or None for folder items + RecursionLevel *VersionControlRecursionType `json:"recursionLevel,omitempty"` +} + +type ItemModel struct { + Links interface{} `json:"_links,omitempty"` + Content *string `json:"content,omitempty"` + ContentMetadata *FileContentMetadata `json:"contentMetadata,omitempty"` + IsFolder *bool `json:"isFolder,omitempty"` + IsSymLink *bool `json:"isSymLink,omitempty"` + Path *string `json:"path,omitempty"` + Url *string `json:"url,omitempty"` +} + +// [Flags] The reason for which the pull request iteration was created. +type IterationReason string + +type iterationReasonValuesType struct { + Push IterationReason + ForcePush IterationReason + Create IterationReason + Rebase IterationReason + Unknown IterationReason + Retarget IterationReason +} + +var IterationReasonValues = iterationReasonValuesType{ + Push: "push", + ForcePush: "forcePush", + Create: "create", + Rebase: "rebase", + Unknown: "unknown", + Retarget: "retarget", +} + +// Real time event (SignalR) for updated labels on a pull request +type LabelsUpdatedEvent struct { + // The id of this event. Can be used to track send/receive state between client and server. + EventId *uuid.UUID `json:"eventId,omitempty"` + // The id of the pull request this event was generated for. + PullRequestId *int `json:"pullRequestId,omitempty"` +} + +// The class to represent the line diff block +type LineDiffBlock struct { + // Type of change that was made to the block. + ChangeType *LineDiffBlockChangeType `json:"changeType,omitempty"` + // Line number where this block starts in modified file. + ModifiedLineNumberStart *int `json:"modifiedLineNumberStart,omitempty"` + // Count of lines in this block in modified file. + ModifiedLinesCount *int `json:"modifiedLinesCount,omitempty"` + // Line number where this block starts in original file. + OriginalLineNumberStart *int `json:"originalLineNumberStart,omitempty"` + // Count of lines in this block in original file. + OriginalLinesCount *int `json:"originalLinesCount,omitempty"` +} + +// Type of change for a line diff block +type LineDiffBlockChangeType string + +type lineDiffBlockChangeTypeValuesType struct { + None LineDiffBlockChangeType + Add LineDiffBlockChangeType + Delete LineDiffBlockChangeType + Edit LineDiffBlockChangeType +} + +var LineDiffBlockChangeTypeValues = lineDiffBlockChangeTypeValuesType{ + // No change - both the blocks are identical + None: "none", + // Lines were added to the block in the modified file + Add: "add", + // Lines were deleted from the block in the original file + Delete: "delete", + // Lines were modified + Edit: "edit", +} + +// Real time event (SignalR) for a merge completed on a pull request +type MergeCompletedEvent struct { + // The id of this event. Can be used to track send/receive state between client and server. + EventId *uuid.UUID `json:"eventId,omitempty"` + // The id of the pull request this event was generated for. + PullRequestId *int `json:"pullRequestId,omitempty"` +} + +// Real time event (SignalR) for a policy evaluation update on a pull request +type PolicyEvaluationUpdatedEvent struct { + // The id of this event. Can be used to track send/receive state between client and server. + EventId *uuid.UUID `json:"eventId,omitempty"` + // The id of the pull request this event was generated for. + PullRequestId *int `json:"pullRequestId,omitempty"` +} + +// The status of a pull request merge. +type PullRequestAsyncStatus string + +type pullRequestAsyncStatusValuesType struct { + NotSet PullRequestAsyncStatus + Queued PullRequestAsyncStatus + Conflicts PullRequestAsyncStatus + Succeeded PullRequestAsyncStatus + RejectedByPolicy PullRequestAsyncStatus + Failure PullRequestAsyncStatus +} + +var PullRequestAsyncStatusValues = pullRequestAsyncStatusValuesType{ + // Status is not set. Default state. + NotSet: "notSet", + // Pull request merge is queued. + Queued: "queued", + // Pull request merge failed due to conflicts. + Conflicts: "conflicts", + // Pull request merge succeeded. + Succeeded: "succeeded", + // Pull request merge rejected by policy. + RejectedByPolicy: "rejectedByPolicy", + // Pull request merge failed. + Failure: "failure", +} + +// Real time event (SignalR) for pull request creation +type PullRequestCreatedEvent struct { + // The id of this event. Can be used to track send/receive state between client and server. + EventId *uuid.UUID `json:"eventId,omitempty"` + // The id of the pull request this event was generated for. + PullRequestId *int `json:"pullRequestId,omitempty"` +} + +// The specific type of a pull request merge failure. +type PullRequestMergeFailureType string + +type pullRequestMergeFailureTypeValuesType struct { + None PullRequestMergeFailureType + Unknown PullRequestMergeFailureType + CaseSensitive PullRequestMergeFailureType + ObjectTooLarge PullRequestMergeFailureType +} + +var PullRequestMergeFailureTypeValues = pullRequestMergeFailureTypeValuesType{ + // Type is not set. Default type. + None: "none", + // Pull request merge failure type unknown. + Unknown: "unknown", + // Pull request merge failed due to case mismatch. + CaseSensitive: "caseSensitive", + // Pull request merge failed due to an object being too large. + ObjectTooLarge: "objectTooLarge", +} + +// Status of a pull request. +type PullRequestStatus string + +type pullRequestStatusValuesType struct { + NotSet PullRequestStatus + Active PullRequestStatus + Abandoned PullRequestStatus + Completed PullRequestStatus + All PullRequestStatus +} + +var PullRequestStatusValues = pullRequestStatusValuesType{ + // Status not set. Default state. + NotSet: "notSet", + // Pull request is active. + Active: "active", + // Pull request is abandoned. + Abandoned: "abandoned", + // Pull request is completed. + Completed: "completed", + // Used in pull request search criterias to include all statuses. + All: "all", +} + +// Initial config contract sent to extensions creating tabs on the pull request page +type PullRequestTabExtensionConfig struct { + PullRequestId *int `json:"pullRequestId,omitempty"` + RepositoryId *string `json:"repositoryId,omitempty"` +} + +// Base contract for a real time pull request event (SignalR) +type RealTimePullRequestEvent struct { + // The id of this event. Can be used to track send/receive state between client and server. + EventId *uuid.UUID `json:"eventId,omitempty"` + // The id of the pull request this event was generated for. + PullRequestId *int `json:"pullRequestId,omitempty"` +} + +type RefFavoriteType string + +type refFavoriteTypeValuesType struct { + Invalid RefFavoriteType + Folder RefFavoriteType + Ref RefFavoriteType +} + +var RefFavoriteTypeValues = refFavoriteTypeValuesType{ + Invalid: "invalid", + Folder: "folder", + Ref: "ref", +} + +// Real time event (SignalR) for when the target branch of a pull request is changed +type RetargetEvent struct { + // The id of this event. Can be used to track send/receive state between client and server. + EventId *uuid.UUID `json:"eventId,omitempty"` + // The id of the pull request this event was generated for. + PullRequestId *int `json:"pullRequestId,omitempty"` +} + +// Real time event (SignalR) for an update to reviewers on a pull request +type ReviewersUpdatedEvent struct { + // The id of this event. Can be used to track send/receive state between client and server. + EventId *uuid.UUID `json:"eventId,omitempty"` + // The id of the pull request this event was generated for. + PullRequestId *int `json:"pullRequestId,omitempty"` +} + +// Real time event (SignalR) for reviewer votes being reset on a pull request +type ReviewersVotesResetEvent struct { + // The id of this event. Can be used to track send/receive state between client and server. + EventId *uuid.UUID `json:"eventId,omitempty"` + // The id of the pull request this event was generated for. + PullRequestId *int `json:"pullRequestId,omitempty"` +} + +// Real time event (SignalR) for a reviewer vote update on a pull request +type ReviewerVoteUpdatedEvent struct { + // The id of this event. Can be used to track send/receive state between client and server. + EventId *uuid.UUID `json:"eventId,omitempty"` + // The id of the pull request this event was generated for. + PullRequestId *int `json:"pullRequestId,omitempty"` +} + +// Context used while sharing a pull request. +type ShareNotificationContext struct { + // Optional user note or message. + Message *string `json:"message,omitempty"` + // Identities of users who will receive a share notification. + Receivers *[]webapi.IdentityRef `json:"receivers,omitempty"` +} + +type SourceToTargetRef struct { + // The source ref to copy. For example, refs/heads/master. + SourceRef *string `json:"sourceRef,omitempty"` + // The target ref to update. For example, refs/heads/master. + TargetRef *string `json:"targetRef,omitempty"` +} + +// Real time event (SignalR) for an added status on a pull request +type StatusAddedEvent struct { + // The id of this event. Can be used to track send/receive state between client and server. + EventId *uuid.UUID `json:"eventId,omitempty"` + // The id of the pull request this event was generated for. + PullRequestId *int `json:"pullRequestId,omitempty"` +} + +// Real time event (SignalR) for deleted statuses on a pull request +type StatusesDeletedEvent struct { + // The id of this event. Can be used to track send/receive state between client and server. + EventId *uuid.UUID `json:"eventId,omitempty"` + // The id of the pull request this event was generated for. + PullRequestId *int `json:"pullRequestId,omitempty"` +} + +// Real time event (SignalR) for a status update on a pull request +type StatusUpdatedEvent struct { + // The id of this event. Can be used to track send/receive state between client and server. + EventId *uuid.UUID `json:"eventId,omitempty"` + // The id of the pull request this event was generated for. + PullRequestId *int `json:"pullRequestId,omitempty"` +} + +// Represents a Supported IDE entity. +type SupportedIde struct { + // The download URL for the IDE. + DownloadUrl *string `json:"downloadUrl,omitempty"` + // The type of the IDE. + IdeType *SupportedIdeType `json:"ideType,omitempty"` + // The name of the IDE. + Name *string `json:"name,omitempty"` + // The URL to open the protocol handler for the IDE. + ProtocolHandlerUrl *string `json:"protocolHandlerUrl,omitempty"` + // A list of SupportedPlatforms. + SupportedPlatforms *[]string `json:"supportedPlatforms,omitempty"` +} + +// Enumeration that represents the types of IDEs supported. +type SupportedIdeType string + +type supportedIdeTypeValuesType struct { + Unknown SupportedIdeType + AndroidStudio SupportedIdeType + AppCode SupportedIdeType + CLion SupportedIdeType + DataGrip SupportedIdeType + Eclipse SupportedIdeType + IntelliJ SupportedIdeType + Mps SupportedIdeType + PhpStorm SupportedIdeType + PyCharm SupportedIdeType + RubyMine SupportedIdeType + Tower SupportedIdeType + VisualStudio SupportedIdeType + VsCode SupportedIdeType + WebStorm SupportedIdeType +} + +var SupportedIdeTypeValues = supportedIdeTypeValuesType{ + Unknown: "unknown", + AndroidStudio: "androidStudio", + AppCode: "appCode", + CLion: "cLion", + DataGrip: "dataGrip", + Eclipse: "eclipse", + IntelliJ: "intelliJ", + Mps: "mps", + PhpStorm: "phpStorm", + PyCharm: "pyCharm", + RubyMine: "rubyMine", + Tower: "tower", + VisualStudio: "visualStudio", + VsCode: "vsCode", + WebStorm: "webStorm", +} + +type TfvcBranch struct { + // Path for the branch. + Path *string `json:"path,omitempty"` + // A collection of REST reference links. + Links interface{} `json:"_links,omitempty"` + // Creation date of the branch. + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + // Description of the branch. + Description *string `json:"description,omitempty"` + // Is the branch deleted? + IsDeleted *bool `json:"isDeleted,omitempty"` + // Alias or display name of user + Owner *webapi.IdentityRef `json:"owner,omitempty"` + // URL to retrieve the item. + Url *string `json:"url,omitempty"` + // List of children for the branch. + Children *[]TfvcBranch `json:"children,omitempty"` + // List of branch mappings. + Mappings *[]TfvcBranchMapping `json:"mappings,omitempty"` + // Path of the branch's parent. + Parent *TfvcShallowBranchRef `json:"parent,omitempty"` + // List of paths of the related branches. + RelatedBranches *[]TfvcShallowBranchRef `json:"relatedBranches,omitempty"` +} + +type TfvcBranchMapping struct { + // Depth of the branch. + Depth *string `json:"depth,omitempty"` + // Server item for the branch. + ServerItem *string `json:"serverItem,omitempty"` + // Type of the branch. + Type *string `json:"type,omitempty"` +} + +type TfvcBranchRef struct { + // Path for the branch. + Path *string `json:"path,omitempty"` + // A collection of REST reference links. + Links interface{} `json:"_links,omitempty"` + // Creation date of the branch. + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + // Description of the branch. + Description *string `json:"description,omitempty"` + // Is the branch deleted? + IsDeleted *bool `json:"isDeleted,omitempty"` + // Alias or display name of user + Owner *webapi.IdentityRef `json:"owner,omitempty"` + // URL to retrieve the item. + Url *string `json:"url,omitempty"` +} + +type TfvcChange struct { + // List of merge sources in case of rename or branch creation. + MergeSources *[]TfvcMergeSource `json:"mergeSources,omitempty"` + // Version at which a (shelved) change was pended against + PendingVersion *int `json:"pendingVersion,omitempty"` +} + +type TfvcChangeset struct { + // A collection of REST reference links. + Links interface{} `json:"_links,omitempty"` + // Alias or display name of user + Author *webapi.IdentityRef `json:"author,omitempty"` + // Id of the changeset. + ChangesetId *int `json:"changesetId,omitempty"` + // Alias or display name of user + CheckedInBy *webapi.IdentityRef `json:"checkedInBy,omitempty"` + // Comment for the changeset. + Comment *string `json:"comment,omitempty"` + // Was the Comment result truncated? + CommentTruncated *bool `json:"commentTruncated,omitempty"` + // Creation date of the changeset. + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + // URL to retrieve the item. + Url *string `json:"url,omitempty"` + // Account Id of the changeset. + AccountId *uuid.UUID `json:"accountId,omitempty"` + // List of associated changes. + Changes *[]TfvcChange `json:"changes,omitempty"` + // Checkin Notes for the changeset. + CheckinNotes *[]CheckinNote `json:"checkinNotes,omitempty"` + // Collection Id of the changeset. + CollectionId *uuid.UUID `json:"collectionId,omitempty"` + // Are more changes available. + HasMoreChanges *bool `json:"hasMoreChanges,omitempty"` + // Policy Override for the changeset. + PolicyOverride *TfvcPolicyOverrideInfo `json:"policyOverride,omitempty"` + // Team Project Ids for the changeset. + TeamProjectIds *[]uuid.UUID `json:"teamProjectIds,omitempty"` + // List of work items associated with the changeset. + WorkItems *[]AssociatedWorkItem `json:"workItems,omitempty"` +} + +type TfvcChangesetRef struct { + // A collection of REST reference links. + Links interface{} `json:"_links,omitempty"` + // Alias or display name of user + Author *webapi.IdentityRef `json:"author,omitempty"` + // Id of the changeset. + ChangesetId *int `json:"changesetId,omitempty"` + // Alias or display name of user + CheckedInBy *webapi.IdentityRef `json:"checkedInBy,omitempty"` + // Comment for the changeset. + Comment *string `json:"comment,omitempty"` + // Was the Comment result truncated? + CommentTruncated *bool `json:"commentTruncated,omitempty"` + // Creation date of the changeset. + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + // URL to retrieve the item. + Url *string `json:"url,omitempty"` +} + +// Criteria used in a search for change lists +type TfvcChangesetSearchCriteria struct { + // Alias or display name of user who made the changes + Author *string `json:"author,omitempty"` + // Whether or not to follow renames for the given item being queried + FollowRenames *bool `json:"followRenames,omitempty"` + // If provided, only include changesets created after this date (string) Think of a better name for this. + FromDate *string `json:"fromDate,omitempty"` + // If provided, only include changesets after this changesetID + FromId *int `json:"fromId,omitempty"` + // Whether to include the _links field on the shallow references + IncludeLinks *bool `json:"includeLinks,omitempty"` + // Path of item to search under + ItemPath *string `json:"itemPath,omitempty"` + Mappings *[]TfvcMappingFilter `json:"mappings,omitempty"` + // If provided, only include changesets created before this date (string) Think of a better name for this. + ToDate *string `json:"toDate,omitempty"` + // If provided, a version descriptor for the latest change list to include + ToId *int `json:"toId,omitempty"` +} + +type TfvcChangesetsRequestData struct { + // List of changeset Ids. + ChangesetIds *[]int `json:"changesetIds,omitempty"` + // Length of the comment. + CommentLength *int `json:"commentLength,omitempty"` + // Whether to include the _links field on the shallow references + IncludeLinks *bool `json:"includeLinks,omitempty"` +} + +type TfvcCheckinEventData struct { + Changeset *TfvcChangeset `json:"changeset,omitempty"` + Project *core.TeamProjectReference `json:"project,omitempty"` +} + +type TfvcHistoryEntry struct { + // The encoding of the item at this point in history (only relevant for File history, not folders) + Encoding *int `json:"encoding,omitempty"` + // The file id of the item at this point in history (only relevant for File history, not folders) + FileId *int `json:"fileId,omitempty"` +} + +type TfvcItem struct { + Links interface{} `json:"_links,omitempty"` + Content *string `json:"content,omitempty"` + ContentMetadata *FileContentMetadata `json:"contentMetadata,omitempty"` + IsFolder *bool `json:"isFolder,omitempty"` + IsSymLink *bool `json:"isSymLink,omitempty"` + Path *string `json:"path,omitempty"` + Url *string `json:"url,omitempty"` + ChangeDate *azuredevops.Time `json:"changeDate,omitempty"` + DeletionId *int `json:"deletionId,omitempty"` + // File encoding from database, -1 represents binary. + Encoding *int `json:"encoding,omitempty"` + // MD5 hash as a base 64 string, applies to files only. + HashValue *string `json:"hashValue,omitempty"` + IsBranch *bool `json:"isBranch,omitempty"` + IsPendingChange *bool `json:"isPendingChange,omitempty"` + // The size of the file, if applicable. + Size *uint64 `json:"size,omitempty"` + Version *int `json:"version,omitempty"` +} + +// Item path and Version descriptor properties +type TfvcItemDescriptor struct { + Path *string `json:"path,omitempty"` + RecursionLevel *VersionControlRecursionType `json:"recursionLevel,omitempty"` + Version *string `json:"version,omitempty"` + VersionOption *TfvcVersionOption `json:"versionOption,omitempty"` + VersionType *TfvcVersionType `json:"versionType,omitempty"` +} + +type TfvcItemPreviousHash struct { + Links interface{} `json:"_links,omitempty"` + Content *string `json:"content,omitempty"` + ContentMetadata *FileContentMetadata `json:"contentMetadata,omitempty"` + IsFolder *bool `json:"isFolder,omitempty"` + IsSymLink *bool `json:"isSymLink,omitempty"` + Path *string `json:"path,omitempty"` + Url *string `json:"url,omitempty"` + ChangeDate *azuredevops.Time `json:"changeDate,omitempty"` + DeletionId *int `json:"deletionId,omitempty"` + // File encoding from database, -1 represents binary. + Encoding *int `json:"encoding,omitempty"` + // MD5 hash as a base 64 string, applies to files only. + HashValue *string `json:"hashValue,omitempty"` + IsBranch *bool `json:"isBranch,omitempty"` + IsPendingChange *bool `json:"isPendingChange,omitempty"` + // The size of the file, if applicable. + Size *uint64 `json:"size,omitempty"` + Version *int `json:"version,omitempty"` + // MD5 hash as a base 64 string, applies to files only. + PreviousHashValue *string `json:"previousHashValue,omitempty"` +} + +type TfvcItemRequestData struct { + // If true, include metadata about the file type + IncludeContentMetadata *bool `json:"includeContentMetadata,omitempty"` + // Whether to include the _links field on the shallow references + IncludeLinks *bool `json:"includeLinks,omitempty"` + ItemDescriptors *[]TfvcItemDescriptor `json:"itemDescriptors,omitempty"` +} + +type TfvcLabel struct { + Links interface{} `json:"_links,omitempty"` + Description *string `json:"description,omitempty"` + Id *int `json:"id,omitempty"` + LabelScope *string `json:"labelScope,omitempty"` + ModifiedDate *azuredevops.Time `json:"modifiedDate,omitempty"` + Name *string `json:"name,omitempty"` + Owner *webapi.IdentityRef `json:"owner,omitempty"` + Url *string `json:"url,omitempty"` + Items *[]TfvcItem `json:"items,omitempty"` +} + +type TfvcLabelRef struct { + Links interface{} `json:"_links,omitempty"` + Description *string `json:"description,omitempty"` + Id *int `json:"id,omitempty"` + LabelScope *string `json:"labelScope,omitempty"` + ModifiedDate *azuredevops.Time `json:"modifiedDate,omitempty"` + Name *string `json:"name,omitempty"` + Owner *webapi.IdentityRef `json:"owner,omitempty"` + Url *string `json:"url,omitempty"` +} + +type TfvcLabelRequestData struct { + // Whether to include the _links field on the shallow references + IncludeLinks *bool `json:"includeLinks,omitempty"` + ItemLabelFilter *string `json:"itemLabelFilter,omitempty"` + LabelScope *string `json:"labelScope,omitempty"` + MaxItemCount *int `json:"maxItemCount,omitempty"` + Name *string `json:"name,omitempty"` + Owner *string `json:"owner,omitempty"` +} + +type TfvcMappingFilter struct { + Exclude *bool `json:"exclude,omitempty"` + ServerPath *string `json:"serverPath,omitempty"` +} + +type TfvcMergeSource struct { + // Indicates if this a rename source. If false, it is a merge source. + IsRename *bool `json:"isRename,omitempty"` + // The server item of the merge source + ServerItem *string `json:"serverItem,omitempty"` + // Start of the version range + VersionFrom *int `json:"versionFrom,omitempty"` + // End of the version range + VersionTo *int `json:"versionTo,omitempty"` +} + +type TfvcPolicyFailureInfo struct { + Message *string `json:"message,omitempty"` + PolicyName *string `json:"policyName,omitempty"` +} + +type TfvcPolicyOverrideInfo struct { + Comment *string `json:"comment,omitempty"` + PolicyFailures *[]TfvcPolicyFailureInfo `json:"policyFailures,omitempty"` +} + +type TfvcShallowBranchRef struct { + // Path for the branch. + Path *string `json:"path,omitempty"` +} + +// This is the deep shelveset class +type TfvcShelveset struct { + Links interface{} `json:"_links,omitempty"` + Comment *string `json:"comment,omitempty"` + CommentTruncated *bool `json:"commentTruncated,omitempty"` + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Owner *webapi.IdentityRef `json:"owner,omitempty"` + Url *string `json:"url,omitempty"` + Changes *[]TfvcChange `json:"changes,omitempty"` + Notes *[]CheckinNote `json:"notes,omitempty"` + PolicyOverride *TfvcPolicyOverrideInfo `json:"policyOverride,omitempty"` + WorkItems *[]AssociatedWorkItem `json:"workItems,omitempty"` +} + +// This is the shallow shelveset class +type TfvcShelvesetRef struct { + Links interface{} `json:"_links,omitempty"` + Comment *string `json:"comment,omitempty"` + CommentTruncated *bool `json:"commentTruncated,omitempty"` + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Owner *webapi.IdentityRef `json:"owner,omitempty"` + Url *string `json:"url,omitempty"` +} + +type TfvcShelvesetRequestData struct { + // Whether to include policyOverride and notes Only applies when requesting a single deep shelveset + IncludeDetails *bool `json:"includeDetails,omitempty"` + // Whether to include the _links field on the shallow references. Does not apply when requesting a single deep shelveset object. Links will always be included in the deep shelveset. + IncludeLinks *bool `json:"includeLinks,omitempty"` + // Whether to include workItems + IncludeWorkItems *bool `json:"includeWorkItems,omitempty"` + // Max number of changes to include + MaxChangeCount *int `json:"maxChangeCount,omitempty"` + // Max length of comment + MaxCommentLength *int `json:"maxCommentLength,omitempty"` + // Shelveset's name + Name *string `json:"name,omitempty"` + // Owner's ID. Could be a name or a guid. + Owner *string `json:"owner,omitempty"` +} + +type TfvcStatistics struct { + // Id of the last changeset the stats are based on. + ChangesetId *int `json:"changesetId,omitempty"` + // Count of files at the requested scope. + FileCountTotal *uint64 `json:"fileCountTotal,omitempty"` +} + +type TfvcVersionDescriptor struct { + Version *string `json:"version,omitempty"` + VersionOption *TfvcVersionOption `json:"versionOption,omitempty"` + VersionType *TfvcVersionType `json:"versionType,omitempty"` +} + +type TfvcVersionOption string + +type tfvcVersionOptionValuesType struct { + None TfvcVersionOption + Previous TfvcVersionOption + UseRename TfvcVersionOption +} + +var TfvcVersionOptionValues = tfvcVersionOptionValuesType{ + None: "none", + Previous: "previous", + UseRename: "useRename", +} + +type TfvcVersionType string + +type tfvcVersionTypeValuesType struct { + None TfvcVersionType + Changeset TfvcVersionType + Shelveset TfvcVersionType + Change TfvcVersionType + Date TfvcVersionType + Latest TfvcVersionType + Tip TfvcVersionType + MergeSource TfvcVersionType +} + +var TfvcVersionTypeValues = tfvcVersionTypeValuesType{ + None: "none", + Changeset: "changeset", + Shelveset: "shelveset", + Change: "change", + Date: "date", + Latest: "latest", + Tip: "tip", + MergeSource: "mergeSource", +} + +// Real time event (SignalR) for a title/description update on a pull request +type TitleDescriptionUpdatedEvent struct { + // The id of this event. Can be used to track send/receive state between client and server. + EventId *uuid.UUID `json:"eventId,omitempty"` + // The id of the pull request this event was generated for. + PullRequestId *int `json:"pullRequestId,omitempty"` +} + +type UpdateRefsRequest struct { + RefUpdateRequests *[]GitRefUpdate `json:"refUpdateRequests,omitempty"` + UpdateMode *GitRefUpdateMode `json:"updateMode,omitempty"` +} + +// [Flags] +type VersionControlChangeType string + +type versionControlChangeTypeValuesType struct { + None VersionControlChangeType + Add VersionControlChangeType + Edit VersionControlChangeType + Encoding VersionControlChangeType + Rename VersionControlChangeType + Delete VersionControlChangeType + Undelete VersionControlChangeType + Branch VersionControlChangeType + Merge VersionControlChangeType + Lock VersionControlChangeType + Rollback VersionControlChangeType + SourceRename VersionControlChangeType + TargetRename VersionControlChangeType + Property VersionControlChangeType + All VersionControlChangeType +} + +var VersionControlChangeTypeValues = versionControlChangeTypeValuesType{ + None: "none", + Add: "add", + Edit: "edit", + Encoding: "encoding", + Rename: "rename", + Delete: "delete", + Undelete: "undelete", + Branch: "branch", + Merge: "merge", + Lock: "lock", + Rollback: "rollback", + SourceRename: "sourceRename", + TargetRename: "targetRename", + Property: "property", + All: "all", +} + +type VersionControlProjectInfo struct { + DefaultSourceControlType *core.SourceControlTypes `json:"defaultSourceControlType,omitempty"` + Project *core.TeamProjectReference `json:"project,omitempty"` + SupportsGit *bool `json:"supportsGit,omitempty"` + SupportsTFVC *bool `json:"supportsTFVC,omitempty"` +} + +type VersionControlRecursionType string + +type versionControlRecursionTypeValuesType struct { + None VersionControlRecursionType + OneLevel VersionControlRecursionType + OneLevelPlusNestedEmptyFolders VersionControlRecursionType + Full VersionControlRecursionType +} + +var VersionControlRecursionTypeValues = versionControlRecursionTypeValuesType{ + // Only return the specified item. + None: "none", + // Return the specified item and its direct children. + OneLevel: "oneLevel", + // Return the specified item and its direct children, as well as recursive chains of nested child folders that only contain a single folder. + OneLevelPlusNestedEmptyFolders: "oneLevelPlusNestedEmptyFolders", + // Return specified item and all descendants + Full: "full", +} diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/go.mod b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/go.mod new file mode 100644 index 00000000..0486f058 --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/go.mod @@ -0,0 +1,5 @@ +module github.com/microsoft/azure-devops-go-api/azuredevops + +go 1.12 + +require github.com/google/uuid v1.1.1 diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/go.sum b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/go.sum new file mode 100644 index 00000000..b864886e --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/go.sum @@ -0,0 +1,2 @@ +github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/identity/client.go b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/identity/client.go new file mode 100644 index 00000000..e3778f47 --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/identity/client.go @@ -0,0 +1,942 @@ +// -------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// -------------------------------------------------------------------------------------------- +// Generated file, DO NOT EDIT +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// -------------------------------------------------------------------------------------------- + +package identity + +import ( + "bytes" + "context" + "encoding/json" + "github.com/google/uuid" + "github.com/microsoft/azure-devops-go-api/azuredevops" + "github.com/microsoft/azure-devops-go-api/azuredevops/delegatedauthorization" + "github.com/microsoft/azure-devops-go-api/azuredevops/webapi" + "net/http" + "net/url" + "strconv" +) + +var ResourceAreaId, _ = uuid.Parse("8a3d49b8-91f0-46ef-b33d-dda338c25db3") + +type Client struct { + Client azuredevops.Client +} + +func NewClient(ctx context.Context, connection *azuredevops.Connection) (*Client, error) { + client, err := connection.GetClientByResourceAreaId(ctx, ResourceAreaId) + if err != nil { + return nil, err + } + return &Client{ + Client: *client, + }, nil +} + +// [Preview API] +func (client *Client) CreateOrBindWithClaims(ctx context.Context, args CreateOrBindWithClaimsArgs) (*Identity, error) { + if args.SourceIdentity == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.SourceIdentity"} + } + body, marshalErr := json.Marshal(*args.SourceIdentity) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("90ddfe71-171c-446c-bf3b-b597cd562afd") + resp, err := client.Client.Send(ctx, http.MethodPut, locationId, "5.1-preview.1", nil, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue Identity + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateOrBindWithClaims function +type CreateOrBindWithClaimsArgs struct { + // (required) + SourceIdentity *Identity +} + +// [Preview API] +func (client *Client) GetDescriptorById(ctx context.Context, args GetDescriptorByIdArgs) (*string, error) { + routeValues := make(map[string]string) + if args.Id == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Id"} + } + routeValues["id"] = (*args.Id).String() + + queryParams := url.Values{} + if args.IsMasterId != nil { + queryParams.Add("isMasterId", strconv.FormatBool(*args.IsMasterId)) + } + locationId, _ := uuid.Parse("a230389a-94f2-496c-839f-c929787496dd") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue string + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetDescriptorById function +type GetDescriptorByIdArgs struct { + // (required) + Id *uuid.UUID + // (optional) + IsMasterId *bool +} + +func (client *Client) CreateGroups(ctx context.Context, args CreateGroupsArgs) (*[]Identity, error) { + if args.Container == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Container"} + } + body, marshalErr := json.Marshal(args.Container) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("5966283b-4196-4d57-9211-1b68f41ec1c2") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1", nil, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []Identity + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateGroups function +type CreateGroupsArgs struct { + // (required) + Container interface{} +} + +func (client *Client) DeleteGroup(ctx context.Context, args DeleteGroupArgs) error { + routeValues := make(map[string]string) + if args.GroupId == nil || *args.GroupId == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.GroupId"} + } + routeValues["groupId"] = *args.GroupId + + locationId, _ := uuid.Parse("5966283b-4196-4d57-9211-1b68f41ec1c2") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeleteGroup function +type DeleteGroupArgs struct { + // (required) + GroupId *string +} + +func (client *Client) ListGroups(ctx context.Context, args ListGroupsArgs) (*[]Identity, error) { + queryParams := url.Values{} + if args.ScopeIds != nil { + queryParams.Add("scopeIds", *args.ScopeIds) + } + if args.Recurse != nil { + queryParams.Add("recurse", strconv.FormatBool(*args.Recurse)) + } + if args.Deleted != nil { + queryParams.Add("deleted", strconv.FormatBool(*args.Deleted)) + } + if args.Properties != nil { + queryParams.Add("properties", *args.Properties) + } + locationId, _ := uuid.Parse("5966283b-4196-4d57-9211-1b68f41ec1c2") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", nil, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []Identity + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the ListGroups function +type ListGroupsArgs struct { + // (optional) + ScopeIds *string + // (optional) + Recurse *bool + // (optional) + Deleted *bool + // (optional) + Properties *string +} + +func (client *Client) GetIdentityChanges(ctx context.Context, args GetIdentityChangesArgs) (*ChangedIdentities, error) { + queryParams := url.Values{} + if args.IdentitySequenceId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "identitySequenceId"} + } + queryParams.Add("identitySequenceId", strconv.Itoa(*args.IdentitySequenceId)) + if args.GroupSequenceId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "groupSequenceId"} + } + queryParams.Add("groupSequenceId", strconv.Itoa(*args.GroupSequenceId)) + if args.OrganizationIdentitySequenceId != nil { + queryParams.Add("organizationIdentitySequenceId", strconv.Itoa(*args.OrganizationIdentitySequenceId)) + } + if args.PageSize != nil { + queryParams.Add("pageSize", strconv.Itoa(*args.PageSize)) + } + if args.ScopeId != nil { + queryParams.Add("scopeId", (*args.ScopeId).String()) + } + locationId, _ := uuid.Parse("28010c54-d0c0-4c89-a5b0-1c9e188b9fb7") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", nil, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue ChangedIdentities + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetIdentityChanges function +type GetIdentityChangesArgs struct { + // (required) + IdentitySequenceId *int + // (required) + GroupSequenceId *int + // (optional) + OrganizationIdentitySequenceId *int + // (optional) + PageSize *int + // (optional) + ScopeId *uuid.UUID +} + +func (client *Client) GetUserIdentityIdsByDomainId(ctx context.Context, args GetUserIdentityIdsByDomainIdArgs) (*[]uuid.UUID, error) { + queryParams := url.Values{} + if args.DomainId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "domainId"} + } + queryParams.Add("domainId", (*args.DomainId).String()) + locationId, _ := uuid.Parse("28010c54-d0c0-4c89-a5b0-1c9e188b9fb7") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", nil, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []uuid.UUID + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetUserIdentityIdsByDomainId function +type GetUserIdentityIdsByDomainIdArgs struct { + // (required) + DomainId *uuid.UUID +} + +func (client *Client) ReadIdentities(ctx context.Context, args ReadIdentitiesArgs) (*[]Identity, error) { + queryParams := url.Values{} + if args.Descriptors != nil { + queryParams.Add("descriptors", *args.Descriptors) + } + if args.IdentityIds != nil { + queryParams.Add("identityIds", *args.IdentityIds) + } + if args.SubjectDescriptors != nil { + queryParams.Add("subjectDescriptors", *args.SubjectDescriptors) + } + if args.SocialDescriptors != nil { + queryParams.Add("socialDescriptors", *args.SocialDescriptors) + } + if args.SearchFilter != nil { + queryParams.Add("searchFilter", *args.SearchFilter) + } + if args.FilterValue != nil { + queryParams.Add("filterValue", *args.FilterValue) + } + if args.QueryMembership != nil { + queryParams.Add("queryMembership", string(*args.QueryMembership)) + } + if args.Properties != nil { + queryParams.Add("properties", *args.Properties) + } + if args.IncludeRestrictedVisibility != nil { + queryParams.Add("includeRestrictedVisibility", strconv.FormatBool(*args.IncludeRestrictedVisibility)) + } + if args.Options != nil { + queryParams.Add("options", string(*args.Options)) + } + locationId, _ := uuid.Parse("28010c54-d0c0-4c89-a5b0-1c9e188b9fb7") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", nil, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []Identity + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the ReadIdentities function +type ReadIdentitiesArgs struct { + // (optional) + Descriptors *string + // (optional) + IdentityIds *string + // (optional) + SubjectDescriptors *string + // (optional) + SocialDescriptors *string + // (optional) + SearchFilter *string + // (optional) + FilterValue *string + // (optional) + QueryMembership *QueryMembership + // (optional) + Properties *string + // (optional) + IncludeRestrictedVisibility *bool + // (optional) + Options *ReadIdentitiesOptions +} + +func (client *Client) ReadIdentitiesByScope(ctx context.Context, args ReadIdentitiesByScopeArgs) (*[]Identity, error) { + queryParams := url.Values{} + if args.ScopeId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "scopeId"} + } + queryParams.Add("scopeId", (*args.ScopeId).String()) + if args.QueryMembership != nil { + queryParams.Add("queryMembership", string(*args.QueryMembership)) + } + if args.Properties != nil { + queryParams.Add("properties", *args.Properties) + } + locationId, _ := uuid.Parse("28010c54-d0c0-4c89-a5b0-1c9e188b9fb7") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", nil, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []Identity + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the ReadIdentitiesByScope function +type ReadIdentitiesByScopeArgs struct { + // (required) + ScopeId *uuid.UUID + // (optional) + QueryMembership *QueryMembership + // (optional) + Properties *string +} + +func (client *Client) ReadIdentity(ctx context.Context, args ReadIdentityArgs) (*Identity, error) { + routeValues := make(map[string]string) + if args.IdentityId == nil || *args.IdentityId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.IdentityId"} + } + routeValues["identityId"] = *args.IdentityId + + queryParams := url.Values{} + if args.QueryMembership != nil { + queryParams.Add("queryMembership", string(*args.QueryMembership)) + } + if args.Properties != nil { + queryParams.Add("properties", *args.Properties) + } + locationId, _ := uuid.Parse("28010c54-d0c0-4c89-a5b0-1c9e188b9fb7") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue Identity + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the ReadIdentity function +type ReadIdentityArgs struct { + // (required) + IdentityId *string + // (optional) + QueryMembership *QueryMembership + // (optional) + Properties *string +} + +func (client *Client) UpdateIdentities(ctx context.Context, args UpdateIdentitiesArgs) (*[]IdentityUpdateData, error) { + if args.Identities == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Identities"} + } + body, marshalErr := json.Marshal(*args.Identities) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("28010c54-d0c0-4c89-a5b0-1c9e188b9fb7") + resp, err := client.Client.Send(ctx, http.MethodPut, locationId, "5.1", nil, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []IdentityUpdateData + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateIdentities function +type UpdateIdentitiesArgs struct { + // (required) + Identities *azuredevops.VssJsonCollectionWrapper +} + +func (client *Client) UpdateIdentity(ctx context.Context, args UpdateIdentityArgs) error { + if args.Identity == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.Identity"} + } + routeValues := make(map[string]string) + if args.IdentityId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.IdentityId"} + } + routeValues["identityId"] = (*args.IdentityId).String() + + body, marshalErr := json.Marshal(*args.Identity) + if marshalErr != nil { + return marshalErr + } + locationId, _ := uuid.Parse("28010c54-d0c0-4c89-a5b0-1c9e188b9fb7") + _, err := client.Client.Send(ctx, http.MethodPut, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the UpdateIdentity function +type UpdateIdentityArgs struct { + // (required) + Identity *Identity + // (required) + IdentityId *uuid.UUID +} + +func (client *Client) CreateIdentity(ctx context.Context, args CreateIdentityArgs) (*Identity, error) { + if args.FrameworkIdentityInfo == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.FrameworkIdentityInfo"} + } + body, marshalErr := json.Marshal(*args.FrameworkIdentityInfo) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("dd55f0eb-6ea2-4fe4-9ebe-919e7dd1dfb4") + resp, err := client.Client.Send(ctx, http.MethodPut, locationId, "5.1", nil, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue Identity + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateIdentity function +type CreateIdentityArgs struct { + // (required) + FrameworkIdentityInfo *FrameworkIdentityInfo +} + +// [Preview API] +func (client *Client) ReadIdentityBatch(ctx context.Context, args ReadIdentityBatchArgs) (*[]Identity, error) { + if args.BatchInfo == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.BatchInfo"} + } + body, marshalErr := json.Marshal(*args.BatchInfo) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("299e50df-fe45-4d3a-8b5b-a5836fac74dc") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", nil, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []Identity + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the ReadIdentityBatch function +type ReadIdentityBatchArgs struct { + // (required) + BatchInfo *IdentityBatchInfo +} + +// [Preview API] +func (client *Client) GetIdentitySnapshot(ctx context.Context, args GetIdentitySnapshotArgs) (*IdentitySnapshot, error) { + routeValues := make(map[string]string) + if args.ScopeId == nil || *args.ScopeId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ScopeId"} + } + routeValues["scopeId"] = *args.ScopeId + + locationId, _ := uuid.Parse("d56223df-8ccd-45c9-89b4-eddf692400d7") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue IdentitySnapshot + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetIdentitySnapshot function +type GetIdentitySnapshotArgs struct { + // (required) + ScopeId *string +} + +// Read the max sequence id of all the identities. +func (client *Client) GetMaxSequenceId(ctx context.Context, args GetMaxSequenceIdArgs) (*uint64, error) { + locationId, _ := uuid.Parse("e4a70778-cb2c-4e85-b7cc-3f3c7ae2d408") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", nil, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue uint64 + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetMaxSequenceId function +type GetMaxSequenceIdArgs struct { +} + +// Read identity of the home tenant request user. +func (client *Client) GetSelf(ctx context.Context, args GetSelfArgs) (*IdentitySelf, error) { + locationId, _ := uuid.Parse("4bb02b5b-c120-4be2-b68e-21f7c50a4b82") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", nil, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue IdentitySelf + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetSelf function +type GetSelfArgs struct { +} + +// [Preview API] +func (client *Client) AddMember(ctx context.Context, args AddMemberArgs) (*bool, error) { + routeValues := make(map[string]string) + if args.ContainerId == nil || *args.ContainerId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ContainerId"} + } + routeValues["containerId"] = *args.ContainerId + if args.MemberId == nil || *args.MemberId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.MemberId"} + } + routeValues["memberId"] = *args.MemberId + + locationId, _ := uuid.Parse("8ba35978-138e-41f8-8963-7b1ea2c5f775") + resp, err := client.Client.Send(ctx, http.MethodPut, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue bool + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the AddMember function +type AddMemberArgs struct { + // (required) + ContainerId *string + // (required) + MemberId *string +} + +// [Preview API] +func (client *Client) ReadMember(ctx context.Context, args ReadMemberArgs) (*string, error) { + routeValues := make(map[string]string) + if args.ContainerId == nil || *args.ContainerId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ContainerId"} + } + routeValues["containerId"] = *args.ContainerId + if args.MemberId == nil || *args.MemberId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.MemberId"} + } + routeValues["memberId"] = *args.MemberId + + queryParams := url.Values{} + if args.QueryMembership != nil { + queryParams.Add("queryMembership", string(*args.QueryMembership)) + } + locationId, _ := uuid.Parse("8ba35978-138e-41f8-8963-7b1ea2c5f775") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue string + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the ReadMember function +type ReadMemberArgs struct { + // (required) + ContainerId *string + // (required) + MemberId *string + // (optional) + QueryMembership *QueryMembership +} + +// [Preview API] +func (client *Client) ReadMembers(ctx context.Context, args ReadMembersArgs) (*[]string, error) { + routeValues := make(map[string]string) + if args.ContainerId == nil || *args.ContainerId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ContainerId"} + } + routeValues["containerId"] = *args.ContainerId + + queryParams := url.Values{} + if args.QueryMembership != nil { + queryParams.Add("queryMembership", string(*args.QueryMembership)) + } + locationId, _ := uuid.Parse("8ba35978-138e-41f8-8963-7b1ea2c5f775") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []string + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the ReadMembers function +type ReadMembersArgs struct { + // (required) + ContainerId *string + // (optional) + QueryMembership *QueryMembership +} + +// [Preview API] +func (client *Client) RemoveMember(ctx context.Context, args RemoveMemberArgs) (*bool, error) { + routeValues := make(map[string]string) + if args.ContainerId == nil || *args.ContainerId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ContainerId"} + } + routeValues["containerId"] = *args.ContainerId + if args.MemberId == nil || *args.MemberId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.MemberId"} + } + routeValues["memberId"] = *args.MemberId + + locationId, _ := uuid.Parse("8ba35978-138e-41f8-8963-7b1ea2c5f775") + resp, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue bool + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the RemoveMember function +type RemoveMemberArgs struct { + // (required) + ContainerId *string + // (required) + MemberId *string +} + +// [Preview API] +func (client *Client) ReadMemberOf(ctx context.Context, args ReadMemberOfArgs) (*string, error) { + routeValues := make(map[string]string) + if args.MemberId == nil || *args.MemberId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.MemberId"} + } + routeValues["memberId"] = *args.MemberId + if args.ContainerId == nil || *args.ContainerId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ContainerId"} + } + routeValues["containerId"] = *args.ContainerId + + queryParams := url.Values{} + if args.QueryMembership != nil { + queryParams.Add("queryMembership", string(*args.QueryMembership)) + } + locationId, _ := uuid.Parse("22865b02-9e4a-479e-9e18-e35b8803b8a0") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue string + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the ReadMemberOf function +type ReadMemberOfArgs struct { + // (required) + MemberId *string + // (required) + ContainerId *string + // (optional) + QueryMembership *QueryMembership +} + +// [Preview API] +func (client *Client) ReadMembersOf(ctx context.Context, args ReadMembersOfArgs) (*[]string, error) { + routeValues := make(map[string]string) + if args.MemberId == nil || *args.MemberId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.MemberId"} + } + routeValues["memberId"] = *args.MemberId + + queryParams := url.Values{} + if args.QueryMembership != nil { + queryParams.Add("queryMembership", string(*args.QueryMembership)) + } + locationId, _ := uuid.Parse("22865b02-9e4a-479e-9e18-e35b8803b8a0") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []string + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the ReadMembersOf function +type ReadMembersOfArgs struct { + // (required) + MemberId *string + // (optional) + QueryMembership *QueryMembership +} + +// [Preview API] +func (client *Client) CreateScope(ctx context.Context, args CreateScopeArgs) (*IdentityScope, error) { + if args.Info == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Info"} + } + routeValues := make(map[string]string) + if args.ScopeId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ScopeId"} + } + routeValues["scopeId"] = (*args.ScopeId).String() + + body, marshalErr := json.Marshal(*args.Info) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("4e11e2bf-1e79-4eb5-8f34-a6337bd0de38") + resp, err := client.Client.Send(ctx, http.MethodPut, locationId, "5.1-preview.2", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue IdentityScope + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateScope function +type CreateScopeArgs struct { + // (required) + Info *CreateScopeInfo + // (required) + ScopeId *uuid.UUID +} + +// [Preview API] +func (client *Client) DeleteScope(ctx context.Context, args DeleteScopeArgs) error { + routeValues := make(map[string]string) + if args.ScopeId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.ScopeId"} + } + routeValues["scopeId"] = (*args.ScopeId).String() + + locationId, _ := uuid.Parse("4e11e2bf-1e79-4eb5-8f34-a6337bd0de38") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1-preview.2", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeleteScope function +type DeleteScopeArgs struct { + // (required) + ScopeId *uuid.UUID +} + +// [Preview API] +func (client *Client) GetScopeById(ctx context.Context, args GetScopeByIdArgs) (*IdentityScope, error) { + routeValues := make(map[string]string) + if args.ScopeId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ScopeId"} + } + routeValues["scopeId"] = (*args.ScopeId).String() + + locationId, _ := uuid.Parse("4e11e2bf-1e79-4eb5-8f34-a6337bd0de38") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.2", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue IdentityScope + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetScopeById function +type GetScopeByIdArgs struct { + // (required) + ScopeId *uuid.UUID +} + +// [Preview API] +func (client *Client) GetScopeByName(ctx context.Context, args GetScopeByNameArgs) (*IdentityScope, error) { + queryParams := url.Values{} + if args.ScopeName == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "scopeName"} + } + queryParams.Add("scopeName", *args.ScopeName) + locationId, _ := uuid.Parse("4e11e2bf-1e79-4eb5-8f34-a6337bd0de38") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.2", nil, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue IdentityScope + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetScopeByName function +type GetScopeByNameArgs struct { + // (required) + ScopeName *string +} + +// [Preview API] +func (client *Client) UpdateScope(ctx context.Context, args UpdateScopeArgs) error { + if args.PatchDocument == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.PatchDocument"} + } + routeValues := make(map[string]string) + if args.ScopeId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.ScopeId"} + } + routeValues["scopeId"] = (*args.ScopeId).String() + + body, marshalErr := json.Marshal(*args.PatchDocument) + if marshalErr != nil { + return marshalErr + } + locationId, _ := uuid.Parse("4e11e2bf-1e79-4eb5-8f34-a6337bd0de38") + _, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1-preview.2", routeValues, nil, bytes.NewReader(body), "application/json-patch+json", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the UpdateScope function +type UpdateScopeArgs struct { + // (required) + PatchDocument *[]webapi.JsonPatchOperation + // (required) + ScopeId *uuid.UUID +} + +// [Preview API] +func (client *Client) GetSignedInToken(ctx context.Context, args GetSignedInTokenArgs) (*delegatedauthorization.AccessTokenResult, error) { + locationId, _ := uuid.Parse("6074ff18-aaad-4abb-a41e-5c75f6178057") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", nil, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue delegatedauthorization.AccessTokenResult + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetSignedInToken function +type GetSignedInTokenArgs struct { +} + +// [Preview API] +func (client *Client) GetSignoutToken(ctx context.Context, args GetSignoutTokenArgs) (*delegatedauthorization.AccessTokenResult, error) { + locationId, _ := uuid.Parse("be39e83c-7529-45e9-9c67-0410885880da") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", nil, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue delegatedauthorization.AccessTokenResult + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetSignoutToken function +type GetSignoutTokenArgs struct { +} + +// [Preview API] +func (client *Client) GetTenant(ctx context.Context, args GetTenantArgs) (*TenantInfo, error) { + routeValues := make(map[string]string) + if args.TenantId == nil || *args.TenantId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.TenantId"} + } + routeValues["tenantId"] = *args.TenantId + + locationId, _ := uuid.Parse("5f0a1723-2e2c-4c31-8cae-002d01bdd592") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue TenantInfo + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTenant function +type GetTenantArgs struct { + // (required) + TenantId *string +} diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/identity/models.go b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/identity/models.go new file mode 100644 index 00000000..54f9b75e --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/identity/models.go @@ -0,0 +1,234 @@ +// -------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// -------------------------------------------------------------------------------------------- +// Generated file, DO NOT EDIT +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// -------------------------------------------------------------------------------------------- + +package identity + +import ( + "github.com/google/uuid" +) + +// Container class for changed identities +type ChangedIdentities struct { + // Changed Identities + Identities *[]Identity `json:"identities,omitempty"` + // More data available, set to true if pagesize is specified. + MoreData *bool `json:"moreData,omitempty"` + // Last Identity SequenceId + SequenceContext *ChangedIdentitiesContext `json:"sequenceContext,omitempty"` +} + +// Context class for changed identities +type ChangedIdentitiesContext struct { + // Last Group SequenceId + GroupSequenceId *int `json:"groupSequenceId,omitempty"` + // Last Identity SequenceId + IdentitySequenceId *int `json:"identitySequenceId,omitempty"` + // Last Group OrganizationIdentitySequenceId + OrganizationIdentitySequenceId *int `json:"organizationIdentitySequenceId,omitempty"` + // Page size + PageSize *int `json:"pageSize,omitempty"` +} + +type CreateScopeInfo struct { + AdminGroupDescription *string `json:"adminGroupDescription,omitempty"` + AdminGroupName *string `json:"adminGroupName,omitempty"` + CreatorId *uuid.UUID `json:"creatorId,omitempty"` + ParentScopeId *uuid.UUID `json:"parentScopeId,omitempty"` + ScopeName *string `json:"scopeName,omitempty"` + ScopeType *GroupScopeType `json:"scopeType,omitempty"` +} + +type FrameworkIdentityInfo struct { + DisplayName *string `json:"displayName,omitempty"` + Identifier *string `json:"identifier,omitempty"` + IdentityType *FrameworkIdentityType `json:"identityType,omitempty"` + Role *string `json:"role,omitempty"` +} + +type FrameworkIdentityType string + +type frameworkIdentityTypeValuesType struct { + None FrameworkIdentityType + ServiceIdentity FrameworkIdentityType + AggregateIdentity FrameworkIdentityType + ImportedIdentity FrameworkIdentityType +} + +var FrameworkIdentityTypeValues = frameworkIdentityTypeValuesType{ + None: "none", + ServiceIdentity: "serviceIdentity", + AggregateIdentity: "aggregateIdentity", + ImportedIdentity: "importedIdentity", +} + +type GroupMembership struct { + Active *bool `json:"active,omitempty"` + Descriptor *string `json:"descriptor,omitempty"` + Id *uuid.UUID `json:"id,omitempty"` + QueriedId *uuid.UUID `json:"queriedId,omitempty"` +} + +type GroupScopeType string + +type groupScopeTypeValuesType struct { + Generic GroupScopeType + ServiceHost GroupScopeType + TeamProject GroupScopeType +} + +var GroupScopeTypeValues = groupScopeTypeValuesType{ + Generic: "generic", + ServiceHost: "serviceHost", + TeamProject: "teamProject", +} + +type Identity struct { + // The custom display name for the identity (if any). Setting this property to an empty string will clear the existing custom display name. Setting this property to null will not affect the existing persisted value (since null values do not get sent over the wire or to the database) + CustomDisplayName *string `json:"customDisplayName,omitempty"` + Descriptor *string `json:"descriptor,omitempty"` + Id *uuid.UUID `json:"id,omitempty"` + IsActive *bool `json:"isActive,omitempty"` + IsContainer *bool `json:"isContainer,omitempty"` + MasterId *uuid.UUID `json:"masterId,omitempty"` + MemberIds *[]uuid.UUID `json:"memberIds,omitempty"` + MemberOf *[]string `json:"memberOf,omitempty"` + Members *[]string `json:"members,omitempty"` + MetaTypeId *int `json:"metaTypeId,omitempty"` + Properties interface{} `json:"properties,omitempty"` + // The display name for the identity as specified by the source identity provider. + ProviderDisplayName *string `json:"providerDisplayName,omitempty"` + ResourceVersion *int `json:"resourceVersion,omitempty"` + SocialDescriptor *string `json:"socialDescriptor,omitempty"` + SubjectDescriptor *string `json:"subjectDescriptor,omitempty"` + UniqueUserId *int `json:"uniqueUserId,omitempty"` +} + +// Base Identity class to allow "trimmed" identity class in the GetConnectionData API Makes sure that on-the-wire representations of the derived classes are compatible with each other (e.g. Server responds with PublicIdentity object while client deserializes it as Identity object) Derived classes should not have additional [DataMember] properties +type IdentityBase struct { + // The custom display name for the identity (if any). Setting this property to an empty string will clear the existing custom display name. Setting this property to null will not affect the existing persisted value (since null values do not get sent over the wire or to the database) + CustomDisplayName *string `json:"customDisplayName,omitempty"` + Descriptor *string `json:"descriptor,omitempty"` + Id *uuid.UUID `json:"id,omitempty"` + IsActive *bool `json:"isActive,omitempty"` + IsContainer *bool `json:"isContainer,omitempty"` + MasterId *uuid.UUID `json:"masterId,omitempty"` + MemberIds *[]uuid.UUID `json:"memberIds,omitempty"` + MemberOf *[]string `json:"memberOf,omitempty"` + Members *[]string `json:"members,omitempty"` + MetaTypeId *int `json:"metaTypeId,omitempty"` + Properties interface{} `json:"properties,omitempty"` + // The display name for the identity as specified by the source identity provider. + ProviderDisplayName *string `json:"providerDisplayName,omitempty"` + ResourceVersion *int `json:"resourceVersion,omitempty"` + SocialDescriptor *string `json:"socialDescriptor,omitempty"` + SubjectDescriptor *string `json:"subjectDescriptor,omitempty"` + UniqueUserId *int `json:"uniqueUserId,omitempty"` +} + +type IdentityBatchInfo struct { + Descriptors *[]string `json:"descriptors,omitempty"` + IdentityIds *[]uuid.UUID `json:"identityIds,omitempty"` + IncludeRestrictedVisibility *bool `json:"includeRestrictedVisibility,omitempty"` + PropertyNames *[]string `json:"propertyNames,omitempty"` + QueryMembership *QueryMembership `json:"queryMembership,omitempty"` + SocialDescriptors *[]string `json:"socialDescriptors,omitempty"` + SubjectDescriptors *[]string `json:"subjectDescriptors,omitempty"` +} + +type IdentityScope struct { + Administrators *string `json:"administrators,omitempty"` + Id *uuid.UUID `json:"id,omitempty"` + IsActive *bool `json:"isActive,omitempty"` + IsGlobal *bool `json:"isGlobal,omitempty"` + LocalScopeId *uuid.UUID `json:"localScopeId,omitempty"` + Name *string `json:"name,omitempty"` + ParentId *uuid.UUID `json:"parentId,omitempty"` + ScopeType *GroupScopeType `json:"scopeType,omitempty"` + SecuringHostId *uuid.UUID `json:"securingHostId,omitempty"` + SubjectDescriptor *string `json:"subjectDescriptor,omitempty"` +} + +// Identity information. +type IdentitySelf struct { + // The UserPrincipalName (UPN) of the account. This value comes from the source provider. + AccountName *string `json:"accountName,omitempty"` + // The display name. For AAD accounts with multiple tenants this is the display name of the profile in the home tenant. + DisplayName *string `json:"displayName,omitempty"` + // This represents the name of the container of origin. For AAD accounts this is the tenantID of the home tenant. For MSA accounts this is the string "Windows Live ID". + Domain *string `json:"domain,omitempty"` + // This is the VSID of the home tenant profile. If the profile is signed into the home tenant or if the profile has no tenants then this Id is the same as the Id returned by the profile/profiles/me endpoint. Going forward it is recommended that you use the combined values of Origin, OriginId and Domain to uniquely identify a user rather than this Id. + Id *uuid.UUID `json:"id,omitempty"` + // The type of source provider for the origin identifier. For MSA accounts this is "msa". For AAD accounts this is "aad". + Origin *string `json:"origin,omitempty"` + // The unique identifier from the system of origin. If there are multiple tenants this is the unique identifier of the account in the home tenant. (For MSA this is the PUID in hex notation, for AAD this is the object id.) + OriginId *string `json:"originId,omitempty"` + // For AAD accounts this is all of the tenants that this account is a member of. + Tenants *[]TenantInfo `json:"tenants,omitempty"` +} + +type IdentitySnapshot struct { + Groups *[]Identity `json:"groups,omitempty"` + IdentityIds *[]uuid.UUID `json:"identityIds,omitempty"` + Memberships *[]GroupMembership `json:"memberships,omitempty"` + ScopeId *uuid.UUID `json:"scopeId,omitempty"` + Scopes *[]IdentityScope `json:"scopes,omitempty"` +} + +type IdentityUpdateData struct { + Id *uuid.UUID `json:"id,omitempty"` + Index *int `json:"index,omitempty"` + Updated *bool `json:"updated,omitempty"` +} + +type QueryMembership string + +type queryMembershipValuesType struct { + None QueryMembership + Direct QueryMembership + Expanded QueryMembership + ExpandedUp QueryMembership + ExpandedDown QueryMembership +} + +var QueryMembershipValues = queryMembershipValuesType{ + // Query will not return any membership data + None: "none", + // Query will return only direct membership data + Direct: "direct", + // Query will return expanded membership data + Expanded: "expanded", + // Query will return expanded up membership data (parents only) + ExpandedUp: "expandedUp", + // Query will return expanded down membership data (children only) + ExpandedDown: "expandedDown", +} + +// [Flags] +type ReadIdentitiesOptions string + +type readIdentitiesOptionsValuesType struct { + None ReadIdentitiesOptions + FilterIllegalMemberships ReadIdentitiesOptions +} + +var ReadIdentitiesOptionsValues = readIdentitiesOptionsValuesType{ + None: "none", + FilterIllegalMemberships: "filterIllegalMemberships", +} + +type SwapIdentityInfo struct { + Id1 *uuid.UUID `json:"id1,omitempty"` + Id2 *uuid.UUID `json:"id2,omitempty"` +} + +type TenantInfo struct { + HomeTenant *bool `json:"homeTenant,omitempty"` + TenantId *uuid.UUID `json:"tenantId,omitempty"` + TenantName *string `json:"tenantName,omitempty"` + VerifiedDomains *[]string `json:"verifiedDomains,omitempty"` +} diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/models.go b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/models.go new file mode 100644 index 00000000..3a3505b9 --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/models.go @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azuredevops + +import ( + "encoding/json" + "github.com/google/uuid" + "strconv" + "time" +) + +// ApiResourceLocation Information about the location of a REST API resource +type ApiResourceLocation struct { + // Area name for this resource + Area *string `json:"area,omitempty"` + // Unique Identifier for this location + Id *uuid.UUID `json:"id,omitempty"` + // Maximum api version that this resource supports (current server version for this resource) + MaxVersion *string `json:"maxVersion,omitempty"` + // Minimum api version that this resource supports + MinVersion *string `json:"minVersion,omitempty"` + // The latest version of this resource location that is in "Release" (non-preview) mode + ReleasedVersion *string `json:"releasedVersion,omitempty"` + // Resource name + ResourceName *string `json:"resourceName,omitempty"` + // The current resource version supported by this resource location + ResourceVersion *int `json:"resourceVersion,omitempty"` + // This location's route template (templated relative path) + RouteTemplate *string `json:"routeTemplate,omitempty"` +} + +// WrappedImproperError +type WrappedImproperError struct { + Count *int `json:"count,omitEmpty"` + Value *ImproperError `json:"value,omitEmpty"` +} + +// ImproperError +type ImproperError struct { + Message *string `json:"Message,omitEmpty"` +} + +// KeyValuePair +type KeyValuePair struct { + Key *interface{} `json:"key,omitEmpty"` + Value *interface{} `json:"value,omitEmpty"` +} + +// ResourceAreaInfo +type ResourceAreaInfo struct { + Id *uuid.UUID `json:"id,omitempty"` + LocationUrl *string `json:"locationUrl,omitempty"` + Name *string `json:"name,omitempty"` +} + +type Time struct { + Time time.Time +} + +func (t *Time) UnmarshalJSON(b []byte) error { + t2 := time.Time{} + err := json.Unmarshal(b, &t2) + + // ignore errors for 0001-01-01T00:00:00 dates. The Azure DevOps service + // returns default dates in a format that is invalid for a time.Time. The + // correct value would have a 'z' at the end to represent utc. We are going + // to ignore this error, and set the value to the default time.Time value. + // https://github.com/microsoft/azure-devops-go-api/issues/17 + if err != nil { + if parseError, ok := err.(*time.ParseError); ok && parseError.Value == "\"0001-01-01T00:00:00\"" { + err = nil + } + } + + t.Time = t2 + return err +} + +func (t *Time) MarshalJSON() ([]byte, error) { + return json.Marshal(t.Time) +} + +func (t Time) String() string { + return t.Time.String() +} + +func (t Time) Equal(u Time) bool { + return t.Time.Equal(u.Time) +} + +// ServerSystemError +type ServerSystemError struct { + ClassName *string `json:"className,omitempty"` + InnerException *ServerSystemError `json:"innerException,omitempty"` + Message *string `json:"message,omitempty"` +} + +func (e ServerSystemError) Error() string { + return *e.Message +} + +// VssJsonCollectionWrapper - +type VssJsonCollectionWrapper struct { + Count *int `json:"count"` + Value *[]interface{} `json:"value"` +} + +// WrappedError +type WrappedError struct { + ExceptionId *string `json:"$id,omitempty"` + InnerError *WrappedError `json:"innerException,omitempty"` + Message *string `json:"message,omitempty"` + TypeName *string `json:"typeName,omitempty"` + TypeKey *string `json:"typeKey,omitempty"` + ErrorCode *int `json:"errorCode,omitempty"` + EventId *int `json:"eventId,omitempty"` + CustomProperties *map[string]interface{} `json:"customProperties,omitempty"` + StatusCode *int +} + +func (e WrappedError) Error() string { + if e.Message == nil { + if e.StatusCode != nil { + return "REST call returned status code " + strconv.Itoa(*e.StatusCode) + } + return "" + } + return *e.Message +} diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/operations/client.go b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/operations/client.go new file mode 100644 index 00000000..20361d4a --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/operations/client.go @@ -0,0 +1,59 @@ +// -------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// -------------------------------------------------------------------------------------------- +// Generated file, DO NOT EDIT +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// -------------------------------------------------------------------------------------------- + +package operations + +import ( + "context" + "github.com/google/uuid" + "github.com/microsoft/azure-devops-go-api/azuredevops" + "net/http" + "net/url" +) + +type Client struct { + Client azuredevops.Client +} + +func NewClient(ctx context.Context, connection *azuredevops.Connection) *Client { + client := connection.GetClientByUrl(connection.BaseUrl) + return &Client{ + Client: *client, + } +} + +// Gets an operation from the the operationId using the given pluginId. +func (client *Client) GetOperation(ctx context.Context, args GetOperationArgs) (*Operation, error) { + routeValues := make(map[string]string) + if args.OperationId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.OperationId"} + } + routeValues["operationId"] = (*args.OperationId).String() + + queryParams := url.Values{} + if args.PluginId != nil { + queryParams.Add("pluginId", (*args.PluginId).String()) + } + locationId, _ := uuid.Parse("9a1b74b4-2ca8-4a9f-8470-c2f2e6fdc949") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue Operation + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetOperation function +type GetOperationArgs struct { + // (required) The ID for the operation. + OperationId *uuid.UUID + // (optional) The ID for the plugin. + PluginId *uuid.UUID +} diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/operations/models.go b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/operations/models.go new file mode 100644 index 00000000..49abd0b0 --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/operations/models.go @@ -0,0 +1,77 @@ +// -------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// -------------------------------------------------------------------------------------------- +// Generated file, DO NOT EDIT +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// -------------------------------------------------------------------------------------------- + +package operations + +import ( + "github.com/google/uuid" +) + +// Contains information about the progress or result of an async operation. +type Operation struct { + // Unique identifier for the operation. + Id *uuid.UUID `json:"id,omitempty"` + // Unique identifier for the plugin. + PluginId *uuid.UUID `json:"pluginId,omitempty"` + // The current status of the operation. + Status *OperationStatus `json:"status,omitempty"` + // URL to get the full operation object. + Url *string `json:"url,omitempty"` + // Links to other related objects. + Links interface{} `json:"_links,omitempty"` + // Detailed messaged about the status of an operation. + DetailedMessage *string `json:"detailedMessage,omitempty"` + // Result message for an operation. + ResultMessage *string `json:"resultMessage,omitempty"` + // URL to the operation result. + ResultUrl *OperationResultReference `json:"resultUrl,omitempty"` +} + +// Reference for an async operation. +type OperationReference struct { + // Unique identifier for the operation. + Id *uuid.UUID `json:"id,omitempty"` + // Unique identifier for the plugin. + PluginId *uuid.UUID `json:"pluginId,omitempty"` + // The current status of the operation. + Status *OperationStatus `json:"status,omitempty"` + // URL to get the full operation object. + Url *string `json:"url,omitempty"` +} + +type OperationResultReference struct { + // URL to the operation result. + ResultUrl *string `json:"resultUrl,omitempty"` +} + +// The status of an operation. +type OperationStatus string + +type operationStatusValuesType struct { + NotSet OperationStatus + Queued OperationStatus + InProgress OperationStatus + Cancelled OperationStatus + Succeeded OperationStatus + Failed OperationStatus +} + +var OperationStatusValues = operationStatusValuesType{ + // The operation does not have a status set. + NotSet: "notSet", + // The operation has been queued. + Queued: "queued", + // The operation is in progress. + InProgress: "inProgress", + // The operation was cancelled by the user. + Cancelled: "cancelled", + // The operation completed successfully. + Succeeded: "succeeded", + // The operation completed with a failure. + Failed: "failed", +} diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/policy/client.go b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/policy/client.go new file mode 100644 index 00000000..5a22ec01 --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/policy/client.go @@ -0,0 +1,463 @@ +// -------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// -------------------------------------------------------------------------------------------- +// Generated file, DO NOT EDIT +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// -------------------------------------------------------------------------------------------- + +package policy + +import ( + "bytes" + "context" + "encoding/json" + "github.com/google/uuid" + "github.com/microsoft/azure-devops-go-api/azuredevops" + "net/http" + "net/url" + "strconv" +) + +var ResourceAreaId, _ = uuid.Parse("fb13a388-40dd-4a04-b530-013a739c72ef") + +type Client struct { + Client azuredevops.Client +} + +func NewClient(ctx context.Context, connection *azuredevops.Connection) (*Client, error) { + client, err := connection.GetClientByResourceAreaId(ctx, ResourceAreaId) + if err != nil { + return nil, err + } + return &Client{ + Client: *client, + }, nil +} + +// Create a policy configuration of a given policy type. +func (client *Client) CreatePolicyConfiguration(ctx context.Context, args CreatePolicyConfigurationArgs) (*PolicyConfiguration, error) { + if args.Configuration == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Configuration"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.ConfigurationId != nil { + routeValues["configurationId"] = strconv.Itoa(*args.ConfigurationId) + } + + body, marshalErr := json.Marshal(*args.Configuration) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("dad91cbe-d183-45f8-9c6e-9c1164472121") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue PolicyConfiguration + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreatePolicyConfiguration function +type CreatePolicyConfigurationArgs struct { + // (required) The policy configuration to create. + Configuration *PolicyConfiguration + // (required) Project ID or project name + Project *string + // (optional) + ConfigurationId *int +} + +// Delete a policy configuration by its ID. +func (client *Client) DeletePolicyConfiguration(ctx context.Context, args DeletePolicyConfigurationArgs) error { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.ConfigurationId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.ConfigurationId"} + } + routeValues["configurationId"] = strconv.Itoa(*args.ConfigurationId) + + locationId, _ := uuid.Parse("dad91cbe-d183-45f8-9c6e-9c1164472121") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeletePolicyConfiguration function +type DeletePolicyConfigurationArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the policy configuration to delete. + ConfigurationId *int +} + +// Get a policy configuration by its ID. +func (client *Client) GetPolicyConfiguration(ctx context.Context, args GetPolicyConfigurationArgs) (*PolicyConfiguration, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.ConfigurationId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ConfigurationId"} + } + routeValues["configurationId"] = strconv.Itoa(*args.ConfigurationId) + + locationId, _ := uuid.Parse("dad91cbe-d183-45f8-9c6e-9c1164472121") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue PolicyConfiguration + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPolicyConfiguration function +type GetPolicyConfigurationArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the policy configuration + ConfigurationId *int +} + +// Get a list of policy configurations in a project. +func (client *Client) GetPolicyConfigurations(ctx context.Context, args GetPolicyConfigurationsArgs) (*GetPolicyConfigurationsResponseValue, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + queryParams := url.Values{} + if args.Scope != nil { + queryParams.Add("scope", *args.Scope) + } + if args.PolicyType != nil { + queryParams.Add("policyType", (*args.PolicyType).String()) + } + locationId, _ := uuid.Parse("dad91cbe-d183-45f8-9c6e-9c1164472121") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue GetPolicyConfigurationsResponseValue + responseValue.ContinuationToken = resp.Header.Get(azuredevops.HeaderKeyContinuationToken) + err = client.Client.UnmarshalCollectionBody(resp, &responseValue.Value) + return &responseValue, err +} + +// Arguments for the GetPolicyConfigurations function +type GetPolicyConfigurationsArgs struct { + // (required) Project ID or project name + Project *string + // (optional) [Provided for legacy reasons] The scope on which a subset of policies is defined. + Scope *string + // (optional) Filter returned policies to only this type + PolicyType *uuid.UUID +} + +// Return type for the GetPolicyConfigurations function +type GetPolicyConfigurationsResponseValue struct { + Value []PolicyConfiguration + // The continuation token to be used to get the next page of results. + ContinuationToken string +} + +// Update a policy configuration by its ID. +func (client *Client) UpdatePolicyConfiguration(ctx context.Context, args UpdatePolicyConfigurationArgs) (*PolicyConfiguration, error) { + if args.Configuration == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Configuration"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.ConfigurationId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ConfigurationId"} + } + routeValues["configurationId"] = strconv.Itoa(*args.ConfigurationId) + + body, marshalErr := json.Marshal(*args.Configuration) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("dad91cbe-d183-45f8-9c6e-9c1164472121") + resp, err := client.Client.Send(ctx, http.MethodPut, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue PolicyConfiguration + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdatePolicyConfiguration function +type UpdatePolicyConfigurationArgs struct { + // (required) The policy configuration to update. + Configuration *PolicyConfiguration + // (required) Project ID or project name + Project *string + // (required) ID of the existing policy configuration to be updated. + ConfigurationId *int +} + +// [Preview API] Gets the present evaluation state of a policy. +func (client *Client) GetPolicyEvaluation(ctx context.Context, args GetPolicyEvaluationArgs) (*PolicyEvaluationRecord, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.EvaluationId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.EvaluationId"} + } + routeValues["evaluationId"] = (*args.EvaluationId).String() + + locationId, _ := uuid.Parse("46aecb7a-5d2c-4647-897b-0209505a9fe4") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue PolicyEvaluationRecord + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPolicyEvaluation function +type GetPolicyEvaluationArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the policy evaluation to be retrieved. + EvaluationId *uuid.UUID +} + +// [Preview API] Requeue the policy evaluation. +func (client *Client) RequeuePolicyEvaluation(ctx context.Context, args RequeuePolicyEvaluationArgs) (*PolicyEvaluationRecord, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.EvaluationId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.EvaluationId"} + } + routeValues["evaluationId"] = (*args.EvaluationId).String() + + locationId, _ := uuid.Parse("46aecb7a-5d2c-4647-897b-0209505a9fe4") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue PolicyEvaluationRecord + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the RequeuePolicyEvaluation function +type RequeuePolicyEvaluationArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the policy evaluation to be retrieved. + EvaluationId *uuid.UUID +} + +// [Preview API] Retrieves a list of all the policy evaluation statuses for a specific pull request. +func (client *Client) GetPolicyEvaluations(ctx context.Context, args GetPolicyEvaluationsArgs) (*[]PolicyEvaluationRecord, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + queryParams := url.Values{} + if args.ArtifactId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "artifactId"} + } + queryParams.Add("artifactId", *args.ArtifactId) + if args.IncludeNotApplicable != nil { + queryParams.Add("includeNotApplicable", strconv.FormatBool(*args.IncludeNotApplicable)) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + if args.Skip != nil { + queryParams.Add("$skip", strconv.Itoa(*args.Skip)) + } + locationId, _ := uuid.Parse("c23ddff5-229c-4d04-a80b-0fdce9f360c8") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []PolicyEvaluationRecord + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPolicyEvaluations function +type GetPolicyEvaluationsArgs struct { + // (required) Project ID or project name + Project *string + // (required) A string which uniquely identifies the target of a policy evaluation. + ArtifactId *string + // (optional) Some policies might determine that they do not apply to a specific pull request. Setting this parameter to true will return evaluation records even for policies which don't apply to this pull request. + IncludeNotApplicable *bool + // (optional) The number of policy evaluation records to retrieve. + Top *int + // (optional) The number of policy evaluation records to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100. + Skip *int +} + +// Retrieve a specific revision of a given policy by ID. +func (client *Client) GetPolicyConfigurationRevision(ctx context.Context, args GetPolicyConfigurationRevisionArgs) (*PolicyConfiguration, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.ConfigurationId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ConfigurationId"} + } + routeValues["configurationId"] = strconv.Itoa(*args.ConfigurationId) + if args.RevisionId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RevisionId"} + } + routeValues["revisionId"] = strconv.Itoa(*args.RevisionId) + + locationId, _ := uuid.Parse("fe1e68a2-60d3-43cb-855b-85e41ae97c95") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue PolicyConfiguration + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPolicyConfigurationRevision function +type GetPolicyConfigurationRevisionArgs struct { + // (required) Project ID or project name + Project *string + // (required) The policy configuration ID. + ConfigurationId *int + // (required) The revision ID. + RevisionId *int +} + +// Retrieve all revisions for a given policy. +func (client *Client) GetPolicyConfigurationRevisions(ctx context.Context, args GetPolicyConfigurationRevisionsArgs) (*[]PolicyConfiguration, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.ConfigurationId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ConfigurationId"} + } + routeValues["configurationId"] = strconv.Itoa(*args.ConfigurationId) + + queryParams := url.Values{} + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + if args.Skip != nil { + queryParams.Add("$skip", strconv.Itoa(*args.Skip)) + } + locationId, _ := uuid.Parse("fe1e68a2-60d3-43cb-855b-85e41ae97c95") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []PolicyConfiguration + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPolicyConfigurationRevisions function +type GetPolicyConfigurationRevisionsArgs struct { + // (required) Project ID or project name + Project *string + // (required) The policy configuration ID. + ConfigurationId *int + // (optional) The number of revisions to retrieve. + Top *int + // (optional) The number of revisions to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100. + Skip *int +} + +// Retrieve a specific policy type by ID. +func (client *Client) GetPolicyType(ctx context.Context, args GetPolicyTypeArgs) (*PolicyType, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.TypeId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TypeId"} + } + routeValues["typeId"] = (*args.TypeId).String() + + locationId, _ := uuid.Parse("44096322-2d3d-466a-bb30-d1b7de69f61f") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue PolicyType + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPolicyType function +type GetPolicyTypeArgs struct { + // (required) Project ID or project name + Project *string + // (required) The policy ID. + TypeId *uuid.UUID +} + +// Retrieve all available policy types. +func (client *Client) GetPolicyTypes(ctx context.Context, args GetPolicyTypesArgs) (*[]PolicyType, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + locationId, _ := uuid.Parse("44096322-2d3d-466a-bb30-d1b7de69f61f") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []PolicyType + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPolicyTypes function +type GetPolicyTypesArgs struct { + // (required) Project ID or project name + Project *string +} diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/policy/models.go b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/policy/models.go new file mode 100644 index 00000000..c0c405c3 --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/policy/models.go @@ -0,0 +1,134 @@ +// -------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// -------------------------------------------------------------------------------------------- +// Generated file, DO NOT EDIT +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// -------------------------------------------------------------------------------------------- + +package policy + +import ( + "github.com/google/uuid" + "github.com/microsoft/azure-devops-go-api/azuredevops" + "github.com/microsoft/azure-devops-go-api/azuredevops/webapi" +) + +// The full policy configuration with settings. +type PolicyConfiguration struct { + // The policy configuration ID. + Id *int `json:"id,omitempty"` + // The policy configuration type. + Type *PolicyTypeRef `json:"type,omitempty"` + // The URL where the policy configuration can be retrieved. + Url *string `json:"url,omitempty"` + // The policy configuration revision ID. + Revision *int `json:"revision,omitempty"` + // The links to other objects related to this object. + Links interface{} `json:"_links,omitempty"` + // A reference to the identity that created the policy. + CreatedBy *webapi.IdentityRef `json:"createdBy,omitempty"` + // The date and time when the policy was created. + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + // Indicates whether the policy is blocking. + IsBlocking *bool `json:"isBlocking,omitempty"` + // Indicates whether the policy has been (soft) deleted. + IsDeleted *bool `json:"isDeleted,omitempty"` + // Indicates whether the policy is enabled. + IsEnabled *bool `json:"isEnabled,omitempty"` + // The policy configuration settings. + Settings interface{} `json:"settings,omitempty"` +} + +// Policy configuration reference. +type PolicyConfigurationRef struct { + // The policy configuration ID. + Id *int `json:"id,omitempty"` + // The policy configuration type. + Type *PolicyTypeRef `json:"type,omitempty"` + // The URL where the policy configuration can be retrieved. + Url *string `json:"url,omitempty"` +} + +// This record encapsulates the current state of a policy as it applies to one specific pull request. Each pull request has a unique PolicyEvaluationRecord for each pull request which the policy applies to. +type PolicyEvaluationRecord struct { + // Links to other related objects + Links interface{} `json:"_links,omitempty"` + // A string which uniquely identifies the target of a policy evaluation. + ArtifactId *string `json:"artifactId,omitempty"` + // Time when this policy finished evaluating on this pull request. + CompletedDate *azuredevops.Time `json:"completedDate,omitempty"` + // Contains all configuration data for the policy which is being evaluated. + Configuration *PolicyConfiguration `json:"configuration,omitempty"` + // Internal context data of this policy evaluation. + Context interface{} `json:"context,omitempty"` + // Guid which uniquely identifies this evaluation record (one policy running on one pull request). + EvaluationId *uuid.UUID `json:"evaluationId,omitempty"` + // Time when this policy was first evaluated on this pull request. + StartedDate *azuredevops.Time `json:"startedDate,omitempty"` + // Status of the policy (Running, Approved, Failed, etc.) + Status *PolicyEvaluationStatus `json:"status,omitempty"` +} + +// Status of a policy which is running against a specific pull request. +type PolicyEvaluationStatus string + +type policyEvaluationStatusValuesType struct { + Queued PolicyEvaluationStatus + Running PolicyEvaluationStatus + Approved PolicyEvaluationStatus + Rejected PolicyEvaluationStatus + NotApplicable PolicyEvaluationStatus + Broken PolicyEvaluationStatus +} + +var PolicyEvaluationStatusValues = policyEvaluationStatusValuesType{ + // The policy is either queued to run, or is waiting for some event before progressing. + Queued: "queued", + // The policy is currently running. + Running: "running", + // The policy has been fulfilled for this pull request. + Approved: "approved", + // The policy has rejected this pull request. + Rejected: "rejected", + // The policy does not apply to this pull request. + NotApplicable: "notApplicable", + // The policy has encountered an unexpected error. + Broken: "broken", +} + +// User-friendly policy type with description (used for querying policy types). +type PolicyType struct { + // Display name of the policy type. + DisplayName *string `json:"displayName,omitempty"` + // The policy type ID. + Id *uuid.UUID `json:"id,omitempty"` + // The URL where the policy type can be retrieved. + Url *string `json:"url,omitempty"` + // The links to other objects related to this object. + Links interface{} `json:"_links,omitempty"` + // Detailed description of the policy type. + Description *string `json:"description,omitempty"` +} + +// Policy type reference. +type PolicyTypeRef struct { + // Display name of the policy type. + DisplayName *string `json:"displayName,omitempty"` + // The policy type ID. + Id *uuid.UUID `json:"id,omitempty"` + // The URL where the policy type can be retrieved. + Url *string `json:"url,omitempty"` +} + +// A particular revision for a policy configuration. +type VersionedPolicyConfigurationRef struct { + // The policy configuration ID. + Id *int `json:"id,omitempty"` + // The policy configuration type. + Type *PolicyTypeRef `json:"type,omitempty"` + // The URL where the policy configuration can be retrieved. + Url *string `json:"url,omitempty"` + // The policy configuration revision ID. + Revision *int `json:"revision,omitempty"` +} diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/system/models.go b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/system/models.go new file mode 100644 index 00000000..245ca996 --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/system/models.go @@ -0,0 +1,97 @@ +// -------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// -------------------------------------------------------------------------------------------- +// Generated file, DO NOT EDIT +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// -------------------------------------------------------------------------------------------- + +package system + +type SqlDbType string + +type sqlDbTypeValuesType struct { + BigInt SqlDbType + Binary SqlDbType + Bit SqlDbType + Char SqlDbType + DateTime SqlDbType + Decimal SqlDbType + Float SqlDbType + Image SqlDbType + Int SqlDbType + Money SqlDbType + NChar SqlDbType + NText SqlDbType + NVarChar SqlDbType + Real SqlDbType + UniqueIdentifier SqlDbType + SmallDateTime SqlDbType + SmallInt SqlDbType + SmallMoney SqlDbType + Text SqlDbType + Timestamp SqlDbType + TinyInt SqlDbType + VarBinary SqlDbType + VarChar SqlDbType + Variant SqlDbType + Xml SqlDbType + Udt SqlDbType + Structured SqlDbType + Date SqlDbType + Time SqlDbType + DateTime2 SqlDbType + DateTimeOffset SqlDbType +} + +var SqlDbTypeValues = sqlDbTypeValuesType{ + BigInt: "bigInt", + Binary: "binary", + Bit: "bit", + Char: "char", + DateTime: "dateTime", + Decimal: "decimal", + Float: "float", + Image: "image", + Int: "int", + Money: "money", + NChar: "nChar", + NText: "nText", + NVarChar: "nVarChar", + Real: "real", + UniqueIdentifier: "uniqueIdentifier", + SmallDateTime: "smallDateTime", + SmallInt: "smallInt", + SmallMoney: "smallMoney", + Text: "text", + Timestamp: "timestamp", + TinyInt: "tinyInt", + VarBinary: "varBinary", + VarChar: "varChar", + Variant: "variant", + Xml: "xml", + Udt: "udt", + Structured: "structured", + Date: "date", + Time: "time", + DateTime2: "dateTime2", + DateTimeOffset: "dateTimeOffset", +} + +type TraceLevel string + +type traceLevelValuesType struct { + Off TraceLevel + Error TraceLevel + Warning TraceLevel + Info TraceLevel + Verbose TraceLevel +} + +var TraceLevelValues = traceLevelValuesType{ + Off: "off", + Error: "error", + Warning: "warning", + Info: "info", + Verbose: "verbose", +} diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/test/client.go b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/test/client.go new file mode 100644 index 00000000..9e9c0087 --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/test/client.go @@ -0,0 +1,2066 @@ +// -------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// -------------------------------------------------------------------------------------------- +// Generated file, DO NOT EDIT +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// -------------------------------------------------------------------------------------------- + +package test + +import ( + "bytes" + "context" + "encoding/json" + "github.com/google/uuid" + "github.com/microsoft/azure-devops-go-api/azuredevops" + "io" + "net/http" + "net/url" + "strconv" + "strings" +) + +var ResourceAreaId, _ = uuid.Parse("c2aa639c-3ccc-4740-b3b6-ce2a1e1d984e") + +type Client struct { + Client azuredevops.Client +} + +func NewClient(ctx context.Context, connection *azuredevops.Connection) (*Client, error) { + client, err := connection.GetClientByResourceAreaId(ctx, ResourceAreaId) + if err != nil { + return nil, err + } + return &Client{ + Client: *client, + }, nil +} + +// Gets the action results for an iteration in a test result. +func (client *Client) GetActionResults(ctx context.Context, args GetActionResultsArgs) (*[]TestActionResultModel, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + if args.TestCaseResultId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TestCaseResultId"} + } + routeValues["testCaseResultId"] = strconv.Itoa(*args.TestCaseResultId) + if args.IterationId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.IterationId"} + } + routeValues["iterationId"] = strconv.Itoa(*args.IterationId) + if args.ActionPath != nil && *args.ActionPath != "" { + routeValues["actionPath"] = *args.ActionPath + } + + locationId, _ := uuid.Parse("eaf40c31-ff84-4062-aafd-d5664be11a37") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []TestActionResultModel + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetActionResults function +type GetActionResultsArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the test run that contains the result. + RunId *int + // (required) ID of the test result that contains the iterations. + TestCaseResultId *int + // (required) ID of the iteration that contains the actions. + IterationId *int + // (optional) Path of a specific action, used to get just that action. + ActionPath *string +} + +// [Preview API] Attach a file to a test result. +func (client *Client) CreateTestResultAttachment(ctx context.Context, args CreateTestResultAttachmentArgs) (*TestAttachmentReference, error) { + if args.AttachmentRequestModel == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.AttachmentRequestModel"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + if args.TestCaseResultId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TestCaseResultId"} + } + routeValues["testCaseResultId"] = strconv.Itoa(*args.TestCaseResultId) + + body, marshalErr := json.Marshal(*args.AttachmentRequestModel) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("2bffebe9-2f0f-4639-9af8-56129e9fed2d") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue TestAttachmentReference + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateTestResultAttachment function +type CreateTestResultAttachmentArgs struct { + // (required) Attachment details TestAttachmentRequestModel + AttachmentRequestModel *TestAttachmentRequestModel + // (required) Project ID or project name + Project *string + // (required) ID of the test run that contains the result. + RunId *int + // (required) ID of the test result against which attachment has to be uploaded. + TestCaseResultId *int +} + +// [Preview API] Attach a file to a test result +func (client *Client) CreateTestSubResultAttachment(ctx context.Context, args CreateTestSubResultAttachmentArgs) (*TestAttachmentReference, error) { + if args.AttachmentRequestModel == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.AttachmentRequestModel"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + if args.TestCaseResultId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TestCaseResultId"} + } + routeValues["testCaseResultId"] = strconv.Itoa(*args.TestCaseResultId) + + queryParams := url.Values{} + if args.TestSubResultId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "testSubResultId"} + } + queryParams.Add("testSubResultId", strconv.Itoa(*args.TestSubResultId)) + body, marshalErr := json.Marshal(*args.AttachmentRequestModel) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("2bffebe9-2f0f-4639-9af8-56129e9fed2d") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue TestAttachmentReference + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateTestSubResultAttachment function +type CreateTestSubResultAttachmentArgs struct { + // (required) Attachment Request Model. + AttachmentRequestModel *TestAttachmentRequestModel + // (required) Project ID or project name + Project *string + // (required) ID of the test run that contains the result. + RunId *int + // (required) ID of the test results that contains sub result. + TestCaseResultId *int + // (required) ID of the test sub results against which attachment has to be uploaded. + TestSubResultId *int +} + +// [Preview API] Download a test result attachment by its ID. +func (client *Client) GetTestResultAttachmentContent(ctx context.Context, args GetTestResultAttachmentContentArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + if args.TestCaseResultId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TestCaseResultId"} + } + routeValues["testCaseResultId"] = strconv.Itoa(*args.TestCaseResultId) + if args.AttachmentId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.AttachmentId"} + } + routeValues["attachmentId"] = strconv.Itoa(*args.AttachmentId) + + locationId, _ := uuid.Parse("2bffebe9-2f0f-4639-9af8-56129e9fed2d") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/octet-stream", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetTestResultAttachmentContent function +type GetTestResultAttachmentContentArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the test run that contains the testCaseResultId. + RunId *int + // (required) ID of the test result whose attachment has to be downloaded. + TestCaseResultId *int + // (required) ID of the test result attachment to be downloaded. + AttachmentId *int +} + +// [Preview API] Get list of test result attachments reference. +func (client *Client) GetTestResultAttachments(ctx context.Context, args GetTestResultAttachmentsArgs) (*[]TestAttachment, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + if args.TestCaseResultId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TestCaseResultId"} + } + routeValues["testCaseResultId"] = strconv.Itoa(*args.TestCaseResultId) + + locationId, _ := uuid.Parse("2bffebe9-2f0f-4639-9af8-56129e9fed2d") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []TestAttachment + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTestResultAttachments function +type GetTestResultAttachmentsArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the test run that contains the result. + RunId *int + // (required) ID of the test result. + TestCaseResultId *int +} + +// [Preview API] Download a test result attachment by its ID. +func (client *Client) GetTestResultAttachmentZip(ctx context.Context, args GetTestResultAttachmentZipArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + if args.TestCaseResultId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TestCaseResultId"} + } + routeValues["testCaseResultId"] = strconv.Itoa(*args.TestCaseResultId) + if args.AttachmentId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.AttachmentId"} + } + routeValues["attachmentId"] = strconv.Itoa(*args.AttachmentId) + + locationId, _ := uuid.Parse("2bffebe9-2f0f-4639-9af8-56129e9fed2d") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/zip", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetTestResultAttachmentZip function +type GetTestResultAttachmentZipArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the test run that contains the testCaseResultId. + RunId *int + // (required) ID of the test result whose attachment has to be downloaded. + TestCaseResultId *int + // (required) ID of the test result attachment to be downloaded. + AttachmentId *int +} + +// [Preview API] Download a test sub result attachment +func (client *Client) GetTestSubResultAttachmentContent(ctx context.Context, args GetTestSubResultAttachmentContentArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + if args.TestCaseResultId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TestCaseResultId"} + } + routeValues["testCaseResultId"] = strconv.Itoa(*args.TestCaseResultId) + if args.AttachmentId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.AttachmentId"} + } + routeValues["attachmentId"] = strconv.Itoa(*args.AttachmentId) + + queryParams := url.Values{} + if args.TestSubResultId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "testSubResultId"} + } + queryParams.Add("testSubResultId", strconv.Itoa(*args.TestSubResultId)) + locationId, _ := uuid.Parse("2bffebe9-2f0f-4639-9af8-56129e9fed2d") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/octet-stream", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetTestSubResultAttachmentContent function +type GetTestSubResultAttachmentContentArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the test run that contains the result. + RunId *int + // (required) ID of the test results that contains sub result. + TestCaseResultId *int + // (required) ID of the test result attachment to be downloaded + AttachmentId *int + // (required) ID of the test sub result whose attachment has to be downloaded + TestSubResultId *int +} + +// [Preview API] Get list of test sub result attachments +func (client *Client) GetTestSubResultAttachments(ctx context.Context, args GetTestSubResultAttachmentsArgs) (*[]TestAttachment, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + if args.TestCaseResultId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TestCaseResultId"} + } + routeValues["testCaseResultId"] = strconv.Itoa(*args.TestCaseResultId) + + queryParams := url.Values{} + if args.TestSubResultId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "testSubResultId"} + } + queryParams.Add("testSubResultId", strconv.Itoa(*args.TestSubResultId)) + locationId, _ := uuid.Parse("2bffebe9-2f0f-4639-9af8-56129e9fed2d") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []TestAttachment + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTestSubResultAttachments function +type GetTestSubResultAttachmentsArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the test run that contains the result. + RunId *int + // (required) ID of the test results that contains sub result. + TestCaseResultId *int + // (required) ID of the test sub result whose attachment has to be downloaded + TestSubResultId *int +} + +// [Preview API] Download a test sub result attachment +func (client *Client) GetTestSubResultAttachmentZip(ctx context.Context, args GetTestSubResultAttachmentZipArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + if args.TestCaseResultId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TestCaseResultId"} + } + routeValues["testCaseResultId"] = strconv.Itoa(*args.TestCaseResultId) + if args.AttachmentId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.AttachmentId"} + } + routeValues["attachmentId"] = strconv.Itoa(*args.AttachmentId) + + queryParams := url.Values{} + if args.TestSubResultId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "testSubResultId"} + } + queryParams.Add("testSubResultId", strconv.Itoa(*args.TestSubResultId)) + locationId, _ := uuid.Parse("2bffebe9-2f0f-4639-9af8-56129e9fed2d") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/zip", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetTestSubResultAttachmentZip function +type GetTestSubResultAttachmentZipArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the test run that contains the result. + RunId *int + // (required) ID of the test results that contains sub result. + TestCaseResultId *int + // (required) ID of the test result attachment to be downloaded + AttachmentId *int + // (required) ID of the test sub result whose attachment has to be downloaded + TestSubResultId *int +} + +// [Preview API] Attach a file to a test run. +func (client *Client) CreateTestRunAttachment(ctx context.Context, args CreateTestRunAttachmentArgs) (*TestAttachmentReference, error) { + if args.AttachmentRequestModel == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.AttachmentRequestModel"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + + body, marshalErr := json.Marshal(*args.AttachmentRequestModel) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("4f004af4-a507-489c-9b13-cb62060beb11") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue TestAttachmentReference + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateTestRunAttachment function +type CreateTestRunAttachmentArgs struct { + // (required) Attachment details TestAttachmentRequestModel + AttachmentRequestModel *TestAttachmentRequestModel + // (required) Project ID or project name + Project *string + // (required) ID of the test run against which attachment has to be uploaded. + RunId *int +} + +// [Preview API] Download a test run attachment by its ID. +func (client *Client) GetTestRunAttachmentContent(ctx context.Context, args GetTestRunAttachmentContentArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + if args.AttachmentId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.AttachmentId"} + } + routeValues["attachmentId"] = strconv.Itoa(*args.AttachmentId) + + locationId, _ := uuid.Parse("4f004af4-a507-489c-9b13-cb62060beb11") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/octet-stream", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetTestRunAttachmentContent function +type GetTestRunAttachmentContentArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the test run whose attachment has to be downloaded. + RunId *int + // (required) ID of the test run attachment to be downloaded. + AttachmentId *int +} + +// [Preview API] Get list of test run attachments reference. +func (client *Client) GetTestRunAttachments(ctx context.Context, args GetTestRunAttachmentsArgs) (*[]TestAttachment, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + + locationId, _ := uuid.Parse("4f004af4-a507-489c-9b13-cb62060beb11") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []TestAttachment + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTestRunAttachments function +type GetTestRunAttachmentsArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the test run. + RunId *int +} + +// [Preview API] Download a test run attachment by its ID. +func (client *Client) GetTestRunAttachmentZip(ctx context.Context, args GetTestRunAttachmentZipArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + if args.AttachmentId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.AttachmentId"} + } + routeValues["attachmentId"] = strconv.Itoa(*args.AttachmentId) + + locationId, _ := uuid.Parse("4f004af4-a507-489c-9b13-cb62060beb11") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/zip", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetTestRunAttachmentZip function +type GetTestRunAttachmentZipArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the test run whose attachment has to be downloaded. + RunId *int + // (required) ID of the test run attachment to be downloaded. + AttachmentId *int +} + +// [Preview API] Get code coverage data for a build. +func (client *Client) GetBuildCodeCoverage(ctx context.Context, args GetBuildCodeCoverageArgs) (*[]BuildCoverage, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + queryParams := url.Values{} + if args.BuildId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "buildId"} + } + queryParams.Add("buildId", strconv.Itoa(*args.BuildId)) + if args.Flags == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "flags"} + } + queryParams.Add("flags", strconv.Itoa(*args.Flags)) + locationId, _ := uuid.Parse("77560e8a-4e8c-4d59-894e-a5f264c24444") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []BuildCoverage + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetBuildCodeCoverage function +type GetBuildCodeCoverageArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the build for which code coverage data needs to be fetched. + BuildId *int + // (required) Value of flags determine the level of code coverage details to be fetched. Flags are additive. Expected Values are 1 for Modules, 2 for Functions, 4 for BlockData. + Flags *int +} + +// [Preview API] Get code coverage data for a test run +func (client *Client) GetTestRunCodeCoverage(ctx context.Context, args GetTestRunCodeCoverageArgs) (*[]TestRunCoverage, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + + queryParams := url.Values{} + if args.Flags == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "flags"} + } + queryParams.Add("flags", strconv.Itoa(*args.Flags)) + locationId, _ := uuid.Parse("9629116f-3b89-4ed8-b358-d4694efda160") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []TestRunCoverage + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTestRunCodeCoverage function +type GetTestRunCodeCoverageArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the test run for which code coverage data needs to be fetched. + RunId *int + // (required) Value of flags determine the level of code coverage details to be fetched. Flags are additive. Expected Values are 1 for Modules, 2 for Functions, 4 for BlockData. + Flags *int +} + +// Get iteration for a result +func (client *Client) GetTestIteration(ctx context.Context, args GetTestIterationArgs) (*TestIterationDetailsModel, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + if args.TestCaseResultId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TestCaseResultId"} + } + routeValues["testCaseResultId"] = strconv.Itoa(*args.TestCaseResultId) + if args.IterationId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.IterationId"} + } + routeValues["iterationId"] = strconv.Itoa(*args.IterationId) + + queryParams := url.Values{} + if args.IncludeActionResults != nil { + queryParams.Add("includeActionResults", strconv.FormatBool(*args.IncludeActionResults)) + } + locationId, _ := uuid.Parse("73eb9074-3446-4c44-8296-2f811950ff8d") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue TestIterationDetailsModel + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTestIteration function +type GetTestIterationArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the test run that contains the result. + RunId *int + // (required) ID of the test result that contains the iterations. + TestCaseResultId *int + // (required) Id of the test results Iteration. + IterationId *int + // (optional) Include result details for each action performed in the test iteration. ActionResults refer to outcome (pass/fail) of test steps that are executed as part of a running a manual test. Including the ActionResults flag gets the outcome of test steps in the actionResults section and test parameters in the parameters section for each test iteration. + IncludeActionResults *bool +} + +// Get iterations for a result +func (client *Client) GetTestIterations(ctx context.Context, args GetTestIterationsArgs) (*[]TestIterationDetailsModel, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + if args.TestCaseResultId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TestCaseResultId"} + } + routeValues["testCaseResultId"] = strconv.Itoa(*args.TestCaseResultId) + + queryParams := url.Values{} + if args.IncludeActionResults != nil { + queryParams.Add("includeActionResults", strconv.FormatBool(*args.IncludeActionResults)) + } + locationId, _ := uuid.Parse("73eb9074-3446-4c44-8296-2f811950ff8d") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []TestIterationDetailsModel + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTestIterations function +type GetTestIterationsArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the test run that contains the result. + RunId *int + // (required) ID of the test result that contains the iterations. + TestCaseResultId *int + // (optional) Include result details for each action performed in the test iteration. ActionResults refer to outcome (pass/fail) of test steps that are executed as part of a running a manual test. Including the ActionResults flag gets the outcome of test steps in the actionResults section and test parameters in the parameters section for each test iteration. + IncludeActionResults *bool +} + +// Get a list of parameterized results +func (client *Client) GetResultParameters(ctx context.Context, args GetResultParametersArgs) (*[]TestResultParameterModel, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + if args.TestCaseResultId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TestCaseResultId"} + } + routeValues["testCaseResultId"] = strconv.Itoa(*args.TestCaseResultId) + if args.IterationId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.IterationId"} + } + routeValues["iterationId"] = strconv.Itoa(*args.IterationId) + + queryParams := url.Values{} + if args.ParamName != nil { + queryParams.Add("paramName", *args.ParamName) + } + locationId, _ := uuid.Parse("7c69810d-3354-4af3-844a-180bd25db08a") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []TestResultParameterModel + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetResultParameters function +type GetResultParametersArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the test run that contains the result. + RunId *int + // (required) ID of the test result that contains the iterations. + TestCaseResultId *int + // (required) ID of the iteration that contains the parameterized results. + IterationId *int + // (optional) Name of the parameter. + ParamName *string +} + +// Get a test point. +func (client *Client) GetPoint(ctx context.Context, args GetPointArgs) (*TestPoint, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.PlanId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PlanId"} + } + routeValues["planId"] = strconv.Itoa(*args.PlanId) + if args.SuiteId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.SuiteId"} + } + routeValues["suiteId"] = strconv.Itoa(*args.SuiteId) + if args.PointIds == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PointIds"} + } + routeValues["pointIds"] = strconv.Itoa(*args.PointIds) + + queryParams := url.Values{} + if args.WitFields != nil { + queryParams.Add("witFields", *args.WitFields) + } + locationId, _ := uuid.Parse("3bcfd5c8-be62-488e-b1da-b8289ce9299c") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue TestPoint + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPoint function +type GetPointArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the test plan. + PlanId *int + // (required) ID of the suite that contains the point. + SuiteId *int + // (required) ID of the test point to get. + PointIds *int + // (optional) Comma-separated list of work item field names. + WitFields *string +} + +// Get a list of test points. +func (client *Client) GetPoints(ctx context.Context, args GetPointsArgs) (*[]TestPoint, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.PlanId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PlanId"} + } + routeValues["planId"] = strconv.Itoa(*args.PlanId) + if args.SuiteId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.SuiteId"} + } + routeValues["suiteId"] = strconv.Itoa(*args.SuiteId) + + queryParams := url.Values{} + if args.WitFields != nil { + queryParams.Add("witFields", *args.WitFields) + } + if args.ConfigurationId != nil { + queryParams.Add("configurationId", *args.ConfigurationId) + } + if args.TestCaseId != nil { + queryParams.Add("testCaseId", *args.TestCaseId) + } + if args.TestPointIds != nil { + queryParams.Add("testPointIds", *args.TestPointIds) + } + if args.IncludePointDetails != nil { + queryParams.Add("includePointDetails", strconv.FormatBool(*args.IncludePointDetails)) + } + if args.Skip != nil { + queryParams.Add("$skip", strconv.Itoa(*args.Skip)) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + locationId, _ := uuid.Parse("3bcfd5c8-be62-488e-b1da-b8289ce9299c") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []TestPoint + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPoints function +type GetPointsArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the test plan. + PlanId *int + // (required) ID of the suite that contains the points. + SuiteId *int + // (optional) Comma-separated list of work item field names. + WitFields *string + // (optional) Get test points for specific configuration. + ConfigurationId *string + // (optional) Get test points for a specific test case, valid when configurationId is not set. + TestCaseId *string + // (optional) Get test points for comma-separated list of test point IDs, valid only when configurationId and testCaseId are not set. + TestPointIds *string + // (optional) Include all properties for the test point. + IncludePointDetails *bool + // (optional) Number of test points to skip.. + Skip *int + // (optional) Number of test points to return. + Top *int +} + +// Update test points. +func (client *Client) UpdateTestPoints(ctx context.Context, args UpdateTestPointsArgs) (*[]TestPoint, error) { + if args.PointUpdateModel == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PointUpdateModel"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.PlanId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PlanId"} + } + routeValues["planId"] = strconv.Itoa(*args.PlanId) + if args.SuiteId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.SuiteId"} + } + routeValues["suiteId"] = strconv.Itoa(*args.SuiteId) + if args.PointIds == nil || *args.PointIds == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.PointIds"} + } + routeValues["pointIds"] = *args.PointIds + + body, marshalErr := json.Marshal(*args.PointUpdateModel) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("3bcfd5c8-be62-488e-b1da-b8289ce9299c") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []TestPoint + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateTestPoints function +type UpdateTestPointsArgs struct { + // (required) Data to update. + PointUpdateModel *PointUpdateModel + // (required) Project ID or project name + Project *string + // (required) ID of the test plan. + PlanId *int + // (required) ID of the suite that contains the points. + SuiteId *int + // (required) ID of the test point to get. Use a comma-separated list of IDs to update multiple test points. + PointIds *string +} + +// [Preview API] Get test points using query. +func (client *Client) GetPointsByQuery(ctx context.Context, args GetPointsByQueryArgs) (*TestPointsQuery, error) { + if args.Query == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Query"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + queryParams := url.Values{} + if args.Skip != nil { + queryParams.Add("$skip", strconv.Itoa(*args.Skip)) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + body, marshalErr := json.Marshal(*args.Query) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("b4264fd0-a5d1-43e2-82a5-b9c46b7da9ce") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.2", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue TestPointsQuery + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPointsByQuery function +type GetPointsByQueryArgs struct { + // (required) TestPointsQuery to get test points. + Query *TestPointsQuery + // (required) Project ID or project name + Project *string + // (optional) Number of test points to skip.. + Skip *int + // (optional) Number of test points to return. + Top *int +} + +// [Preview API] Get test result retention settings +func (client *Client) GetResultRetentionSettings(ctx context.Context, args GetResultRetentionSettingsArgs) (*ResultRetentionSettings, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + locationId, _ := uuid.Parse("a3206d9e-fa8d-42d3-88cb-f75c51e69cde") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue ResultRetentionSettings + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetResultRetentionSettings function +type GetResultRetentionSettingsArgs struct { + // (required) Project ID or project name + Project *string +} + +// [Preview API] Update test result retention settings +func (client *Client) UpdateResultRetentionSettings(ctx context.Context, args UpdateResultRetentionSettingsArgs) (*ResultRetentionSettings, error) { + if args.RetentionSettings == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RetentionSettings"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + body, marshalErr := json.Marshal(*args.RetentionSettings) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("a3206d9e-fa8d-42d3-88cb-f75c51e69cde") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue ResultRetentionSettings + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateResultRetentionSettings function +type UpdateResultRetentionSettingsArgs struct { + // (required) Test result retention settings details to be updated + RetentionSettings *ResultRetentionSettings + // (required) Project ID or project name + Project *string +} + +// Add test results to a test run. +func (client *Client) AddTestResultsToTestRun(ctx context.Context, args AddTestResultsToTestRunArgs) (*[]TestCaseResult, error) { + if args.Results == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Results"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + + body, marshalErr := json.Marshal(*args.Results) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("4637d869-3a76-4468-8057-0bb02aa385cf") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []TestCaseResult + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the AddTestResultsToTestRun function +type AddTestResultsToTestRunArgs struct { + // (required) List of test results to add. + Results *[]TestCaseResult + // (required) Project ID or project name + Project *string + // (required) Test run ID into which test results to add. + RunId *int +} + +// Get a test result for a test run. +func (client *Client) GetTestResultById(ctx context.Context, args GetTestResultByIdArgs) (*TestCaseResult, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + if args.TestCaseResultId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TestCaseResultId"} + } + routeValues["testCaseResultId"] = strconv.Itoa(*args.TestCaseResultId) + + queryParams := url.Values{} + if args.DetailsToInclude != nil { + queryParams.Add("detailsToInclude", string(*args.DetailsToInclude)) + } + locationId, _ := uuid.Parse("4637d869-3a76-4468-8057-0bb02aa385cf") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue TestCaseResult + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTestResultById function +type GetTestResultByIdArgs struct { + // (required) Project ID or project name + Project *string + // (required) Test run ID of a test result to fetch. + RunId *int + // (required) Test result ID. + TestCaseResultId *int + // (optional) Details to include with test results. Default is None. Other values are Iterations, WorkItems and SubResults. + DetailsToInclude *ResultDetails +} + +// Get test results for a test run. +func (client *Client) GetTestResults(ctx context.Context, args GetTestResultsArgs) (*[]TestCaseResult, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + + queryParams := url.Values{} + if args.DetailsToInclude != nil { + queryParams.Add("detailsToInclude", string(*args.DetailsToInclude)) + } + if args.Skip != nil { + queryParams.Add("$skip", strconv.Itoa(*args.Skip)) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + if args.Outcomes != nil { + var stringList []string + for _, item := range *args.Outcomes { + stringList = append(stringList, string(item)) + } + listAsString := strings.Join((stringList)[:], ",") + queryParams.Add("definitions", listAsString) + } + locationId, _ := uuid.Parse("4637d869-3a76-4468-8057-0bb02aa385cf") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []TestCaseResult + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTestResults function +type GetTestResultsArgs struct { + // (required) Project ID or project name + Project *string + // (required) Test run ID of test results to fetch. + RunId *int + // (optional) Details to include with test results. Default is None. Other values are Iterations and WorkItems. + DetailsToInclude *ResultDetails + // (optional) Number of test results to skip from beginning. + Skip *int + // (optional) Number of test results to return. Maximum is 1000 when detailsToInclude is None and 200 otherwise. + Top *int + // (optional) Comma separated list of test outcomes to filter test results. + Outcomes *[]TestOutcome +} + +// Update test results in a test run. +func (client *Client) UpdateTestResults(ctx context.Context, args UpdateTestResultsArgs) (*[]TestCaseResult, error) { + if args.Results == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Results"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + + body, marshalErr := json.Marshal(*args.Results) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("4637d869-3a76-4468-8057-0bb02aa385cf") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []TestCaseResult + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateTestResults function +type UpdateTestResultsArgs struct { + // (required) List of test results to update. + Results *[]TestCaseResult + // (required) Project ID or project name + Project *string + // (required) Test run ID whose test results to update. + RunId *int +} + +// Get test run statistics , used when we want to get summary of a run by outcome. +func (client *Client) GetTestRunStatistics(ctx context.Context, args GetTestRunStatisticsArgs) (*TestRunStatistic, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + + locationId, _ := uuid.Parse("0a42c424-d764-4a16-a2d5-5c85f87d0ae8") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue TestRunStatistic + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTestRunStatistics function +type GetTestRunStatisticsArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the run to get. + RunId *int +} + +// Create new test run. +func (client *Client) CreateTestRun(ctx context.Context, args CreateTestRunArgs) (*TestRun, error) { + if args.TestRun == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TestRun"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + body, marshalErr := json.Marshal(*args.TestRun) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("cadb3810-d47d-4a3c-a234-fe5f3be50138") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue TestRun + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateTestRun function +type CreateTestRunArgs struct { + // (required) Run details RunCreateModel + TestRun *RunCreateModel + // (required) Project ID or project name + Project *string +} + +// Delete a test run by its ID. +func (client *Client) DeleteTestRun(ctx context.Context, args DeleteTestRunArgs) error { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + + locationId, _ := uuid.Parse("cadb3810-d47d-4a3c-a234-fe5f3be50138") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeleteTestRun function +type DeleteTestRunArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the run to delete. + RunId *int +} + +// Get a test run by its ID. +func (client *Client) GetTestRunById(ctx context.Context, args GetTestRunByIdArgs) (*TestRun, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + + queryParams := url.Values{} + if args.IncludeDetails != nil { + queryParams.Add("includeDetails", strconv.FormatBool(*args.IncludeDetails)) + } + locationId, _ := uuid.Parse("cadb3810-d47d-4a3c-a234-fe5f3be50138") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue TestRun + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTestRunById function +type GetTestRunByIdArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the run to get. + RunId *int + // (optional) Defualt value is true. It includes details like run statistics,release,build,Test enviornment,Post process state and more + IncludeDetails *bool +} + +// Get a list of test runs. +func (client *Client) GetTestRuns(ctx context.Context, args GetTestRunsArgs) (*[]TestRun, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + queryParams := url.Values{} + if args.BuildUri != nil { + queryParams.Add("buildUri", *args.BuildUri) + } + if args.Owner != nil { + queryParams.Add("owner", *args.Owner) + } + if args.TmiRunId != nil { + queryParams.Add("tmiRunId", *args.TmiRunId) + } + if args.PlanId != nil { + queryParams.Add("planId", strconv.Itoa(*args.PlanId)) + } + if args.IncludeRunDetails != nil { + queryParams.Add("includeRunDetails", strconv.FormatBool(*args.IncludeRunDetails)) + } + if args.Automated != nil { + queryParams.Add("automated", strconv.FormatBool(*args.Automated)) + } + if args.Skip != nil { + queryParams.Add("$skip", strconv.Itoa(*args.Skip)) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + locationId, _ := uuid.Parse("cadb3810-d47d-4a3c-a234-fe5f3be50138") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []TestRun + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTestRuns function +type GetTestRunsArgs struct { + // (required) Project ID or project name + Project *string + // (optional) URI of the build that the runs used. + BuildUri *string + // (optional) Team foundation ID of the owner of the runs. + Owner *string + // (optional) + TmiRunId *string + // (optional) ID of the test plan that the runs are a part of. + PlanId *int + // (optional) If true, include all the properties of the runs. + IncludeRunDetails *bool + // (optional) If true, only returns automated runs. + Automated *bool + // (optional) Number of test runs to skip. + Skip *int + // (optional) Number of test runs to return. + Top *int +} + +// Query Test Runs based on filters. Mandatory fields are minLastUpdatedDate and maxLastUpdatedDate. +func (client *Client) QueryTestRuns(ctx context.Context, args QueryTestRunsArgs) (*QueryTestRunsResponseValue, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + queryParams := url.Values{} + if args.MinLastUpdatedDate == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "minLastUpdatedDate"} + } + queryParams.Add("minLastUpdatedDate", (*args.MinLastUpdatedDate).String()) + if args.MaxLastUpdatedDate == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "maxLastUpdatedDate"} + } + queryParams.Add("maxLastUpdatedDate", (*args.MaxLastUpdatedDate).String()) + if args.State != nil { + queryParams.Add("state", string(*args.State)) + } + if args.PlanIds != nil { + var stringList []string + for _, item := range *args.PlanIds { + stringList = append(stringList, strconv.Itoa(item)) + } + listAsString := strings.Join((stringList)[:], ",") + queryParams.Add("definitions", listAsString) + } + if args.IsAutomated != nil { + queryParams.Add("isAutomated", strconv.FormatBool(*args.IsAutomated)) + } + if args.PublishContext != nil { + queryParams.Add("publishContext", string(*args.PublishContext)) + } + if args.BuildIds != nil { + var stringList []string + for _, item := range *args.BuildIds { + stringList = append(stringList, strconv.Itoa(item)) + } + listAsString := strings.Join((stringList)[:], ",") + queryParams.Add("definitions", listAsString) + } + if args.BuildDefIds != nil { + var stringList []string + for _, item := range *args.BuildDefIds { + stringList = append(stringList, strconv.Itoa(item)) + } + listAsString := strings.Join((stringList)[:], ",") + queryParams.Add("definitions", listAsString) + } + if args.BranchName != nil { + queryParams.Add("branchName", *args.BranchName) + } + if args.ReleaseIds != nil { + var stringList []string + for _, item := range *args.ReleaseIds { + stringList = append(stringList, strconv.Itoa(item)) + } + listAsString := strings.Join((stringList)[:], ",") + queryParams.Add("definitions", listAsString) + } + if args.ReleaseDefIds != nil { + var stringList []string + for _, item := range *args.ReleaseDefIds { + stringList = append(stringList, strconv.Itoa(item)) + } + listAsString := strings.Join((stringList)[:], ",") + queryParams.Add("definitions", listAsString) + } + if args.ReleaseEnvIds != nil { + var stringList []string + for _, item := range *args.ReleaseEnvIds { + stringList = append(stringList, strconv.Itoa(item)) + } + listAsString := strings.Join((stringList)[:], ",") + queryParams.Add("definitions", listAsString) + } + if args.ReleaseEnvDefIds != nil { + var stringList []string + for _, item := range *args.ReleaseEnvDefIds { + stringList = append(stringList, strconv.Itoa(item)) + } + listAsString := strings.Join((stringList)[:], ",") + queryParams.Add("definitions", listAsString) + } + if args.RunTitle != nil { + queryParams.Add("runTitle", *args.RunTitle) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + if args.ContinuationToken != nil { + queryParams.Add("continuationToken", *args.ContinuationToken) + } + locationId, _ := uuid.Parse("cadb3810-d47d-4a3c-a234-fe5f3be50138") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue QueryTestRunsResponseValue + responseValue.ContinuationToken = resp.Header.Get(azuredevops.HeaderKeyContinuationToken) + err = client.Client.UnmarshalCollectionBody(resp, &responseValue.Value) + return &responseValue, err +} + +// Arguments for the QueryTestRuns function +type QueryTestRunsArgs struct { + // (required) Project ID or project name + Project *string + // (required) Minimum Last Modified Date of run to be queried (Mandatory). + MinLastUpdatedDate *azuredevops.Time + // (required) Maximum Last Modified Date of run to be queried (Mandatory, difference between min and max date can be atmost 7 days). + MaxLastUpdatedDate *azuredevops.Time + // (optional) Current state of the Runs to be queried. + State *TestRunState + // (optional) Plan Ids of the Runs to be queried, comma seperated list of valid ids (limit no. of ids 10). + PlanIds *[]int + // (optional) Automation type of the Runs to be queried. + IsAutomated *bool + // (optional) PublishContext of the Runs to be queried. + PublishContext *TestRunPublishContext + // (optional) Build Ids of the Runs to be queried, comma seperated list of valid ids (limit no. of ids 10). + BuildIds *[]int + // (optional) Build Definition Ids of the Runs to be queried, comma seperated list of valid ids (limit no. of ids 10). + BuildDefIds *[]int + // (optional) Source Branch name of the Runs to be queried. + BranchName *string + // (optional) Release Ids of the Runs to be queried, comma seperated list of valid ids (limit no. of ids 10). + ReleaseIds *[]int + // (optional) Release Definition Ids of the Runs to be queried, comma seperated list of valid ids (limit no. of ids 10). + ReleaseDefIds *[]int + // (optional) Release Environment Ids of the Runs to be queried, comma seperated list of valid ids (limit no. of ids 10). + ReleaseEnvIds *[]int + // (optional) Release Environment Definition Ids of the Runs to be queried, comma seperated list of valid ids (limit no. of ids 10). + ReleaseEnvDefIds *[]int + // (optional) Run Title of the Runs to be queried. + RunTitle *string + // (optional) Number of runs to be queried. Limit is 100 + Top *int + // (optional) continuationToken received from previous batch or null for first batch. It is not supposed to be created (or altered, if received from last batch) by user. + ContinuationToken *string +} + +// Return type for the QueryTestRuns function +type QueryTestRunsResponseValue struct { + Value []TestRun + // The continuation token to be used to get the next page of results. + ContinuationToken string +} + +// Update test run by its ID. +func (client *Client) UpdateTestRun(ctx context.Context, args UpdateTestRunArgs) (*TestRun, error) { + if args.RunUpdateModel == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunUpdateModel"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.RunId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RunId"} + } + routeValues["runId"] = strconv.Itoa(*args.RunId) + + body, marshalErr := json.Marshal(*args.RunUpdateModel) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("cadb3810-d47d-4a3c-a234-fe5f3be50138") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue TestRun + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateTestRun function +type UpdateTestRunArgs struct { + // (required) Run details RunUpdateModel + RunUpdateModel *RunUpdateModel + // (required) Project ID or project name + Project *string + // (required) ID of the run to update. + RunId *int +} + +// [Preview API] Create a test session +func (client *Client) CreateTestSession(ctx context.Context, args CreateTestSessionArgs) (*TestSession, error) { + if args.TestSession == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TestSession"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.Team != nil && *args.Team != "" { + routeValues["team"] = *args.Team + } + + body, marshalErr := json.Marshal(*args.TestSession) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("1500b4b4-6c69-4ca6-9b18-35e9e97fe2ac") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue TestSession + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateTestSession function +type CreateTestSessionArgs struct { + // (required) Test session details for creation + TestSession *TestSession + // (required) Project ID or project name + Project *string + // (optional) Team ID or team name + Team *string +} + +// [Preview API] Get a list of test sessions +func (client *Client) GetTestSessions(ctx context.Context, args GetTestSessionsArgs) (*[]TestSession, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.Team != nil && *args.Team != "" { + routeValues["team"] = *args.Team + } + + queryParams := url.Values{} + if args.Period != nil { + queryParams.Add("period", strconv.Itoa(*args.Period)) + } + if args.AllSessions != nil { + queryParams.Add("allSessions", strconv.FormatBool(*args.AllSessions)) + } + if args.IncludeAllProperties != nil { + queryParams.Add("includeAllProperties", strconv.FormatBool(*args.IncludeAllProperties)) + } + if args.Source != nil { + queryParams.Add("source", string(*args.Source)) + } + if args.IncludeOnlyCompletedSessions != nil { + queryParams.Add("includeOnlyCompletedSessions", strconv.FormatBool(*args.IncludeOnlyCompletedSessions)) + } + locationId, _ := uuid.Parse("1500b4b4-6c69-4ca6-9b18-35e9e97fe2ac") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []TestSession + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTestSessions function +type GetTestSessionsArgs struct { + // (required) Project ID or project name + Project *string + // (optional) Team ID or team name + Team *string + // (optional) Period in days from now, for which test sessions are fetched. + Period *int + // (optional) If false, returns test sessions for current user. Otherwise, it returns test sessions for all users + AllSessions *bool + // (optional) If true, it returns all properties of the test sessions. Otherwise, it returns the skinny version. + IncludeAllProperties *bool + // (optional) Source of the test session. + Source *TestSessionSource + // (optional) If true, it returns test sessions in completed state. Otherwise, it returns test sessions for all states + IncludeOnlyCompletedSessions *bool +} + +// [Preview API] Update a test session +func (client *Client) UpdateTestSession(ctx context.Context, args UpdateTestSessionArgs) (*TestSession, error) { + if args.TestSession == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TestSession"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.Team != nil && *args.Team != "" { + routeValues["team"] = *args.Team + } + + body, marshalErr := json.Marshal(*args.TestSession) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("1500b4b4-6c69-4ca6-9b18-35e9e97fe2ac") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue TestSession + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateTestSession function +type UpdateTestSessionArgs struct { + // (required) Test session details for update + TestSession *TestSession + // (required) Project ID or project name + Project *string + // (optional) Team ID or team name + Team *string +} + +// Add test cases to suite. +func (client *Client) AddTestCasesToSuite(ctx context.Context, args AddTestCasesToSuiteArgs) (*[]SuiteTestCase, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.PlanId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PlanId"} + } + routeValues["planId"] = strconv.Itoa(*args.PlanId) + if args.SuiteId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.SuiteId"} + } + routeValues["suiteId"] = strconv.Itoa(*args.SuiteId) + if args.TestCaseIds == nil || *args.TestCaseIds == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.TestCaseIds"} + } + routeValues["testCaseIds"] = *args.TestCaseIds + routeValues["action"] = "TestCases" + + locationId, _ := uuid.Parse("a4a1ec1c-b03f-41ca-8857-704594ecf58e") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []SuiteTestCase + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the AddTestCasesToSuite function +type AddTestCasesToSuiteArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the test plan that contains the suite. + PlanId *int + // (required) ID of the test suite to which the test cases must be added. + SuiteId *int + // (required) IDs of the test cases to add to the suite. Ids are specified in comma separated format. + TestCaseIds *string +} + +// Get a specific test case in a test suite with test case id. +func (client *Client) GetTestCaseById(ctx context.Context, args GetTestCaseByIdArgs) (*SuiteTestCase, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.PlanId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PlanId"} + } + routeValues["planId"] = strconv.Itoa(*args.PlanId) + if args.SuiteId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.SuiteId"} + } + routeValues["suiteId"] = strconv.Itoa(*args.SuiteId) + if args.TestCaseIds == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TestCaseIds"} + } + routeValues["testCaseIds"] = strconv.Itoa(*args.TestCaseIds) + routeValues["action"] = "TestCases" + + locationId, _ := uuid.Parse("a4a1ec1c-b03f-41ca-8857-704594ecf58e") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue SuiteTestCase + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTestCaseById function +type GetTestCaseByIdArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the test plan that contains the suites. + PlanId *int + // (required) ID of the suite that contains the test case. + SuiteId *int + // (required) ID of the test case to get. + TestCaseIds *int +} + +// Get all test cases in a suite. +func (client *Client) GetTestCases(ctx context.Context, args GetTestCasesArgs) (*[]SuiteTestCase, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.PlanId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PlanId"} + } + routeValues["planId"] = strconv.Itoa(*args.PlanId) + if args.SuiteId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.SuiteId"} + } + routeValues["suiteId"] = strconv.Itoa(*args.SuiteId) + routeValues["action"] = "TestCases" + + locationId, _ := uuid.Parse("a4a1ec1c-b03f-41ca-8857-704594ecf58e") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []SuiteTestCase + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTestCases function +type GetTestCasesArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the test plan that contains the suites. + PlanId *int + // (required) ID of the suite to get. + SuiteId *int +} + +// The test points associated with the test cases are removed from the test suite. The test case work item is not deleted from the system. See test cases resource to delete a test case permanently. +func (client *Client) RemoveTestCasesFromSuiteUrl(ctx context.Context, args RemoveTestCasesFromSuiteUrlArgs) error { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.PlanId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.PlanId"} + } + routeValues["planId"] = strconv.Itoa(*args.PlanId) + if args.SuiteId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.SuiteId"} + } + routeValues["suiteId"] = strconv.Itoa(*args.SuiteId) + if args.TestCaseIds == nil || *args.TestCaseIds == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.TestCaseIds"} + } + routeValues["testCaseIds"] = *args.TestCaseIds + routeValues["action"] = "TestCases" + + locationId, _ := uuid.Parse("a4a1ec1c-b03f-41ca-8857-704594ecf58e") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the RemoveTestCasesFromSuiteUrl function +type RemoveTestCasesFromSuiteUrlArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID of the test plan that contains the suite. + PlanId *int + // (required) ID of the suite to get. + SuiteId *int + // (required) IDs of the test cases to remove from the suite. + TestCaseIds *string +} + +// Updates the properties of the test case association in a suite. +func (client *Client) UpdateSuiteTestCases(ctx context.Context, args UpdateSuiteTestCasesArgs) (*[]SuiteTestCase, error) { + if args.SuiteTestCaseUpdateModel == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.SuiteTestCaseUpdateModel"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.PlanId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PlanId"} + } + routeValues["planId"] = strconv.Itoa(*args.PlanId) + if args.SuiteId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.SuiteId"} + } + routeValues["suiteId"] = strconv.Itoa(*args.SuiteId) + if args.TestCaseIds == nil || *args.TestCaseIds == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.TestCaseIds"} + } + routeValues["testCaseIds"] = *args.TestCaseIds + routeValues["action"] = "TestCases" + + body, marshalErr := json.Marshal(*args.SuiteTestCaseUpdateModel) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("a4a1ec1c-b03f-41ca-8857-704594ecf58e") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []SuiteTestCase + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateSuiteTestCases function +type UpdateSuiteTestCasesArgs struct { + // (required) Model for updation of the properties of test case suite association. + SuiteTestCaseUpdateModel *SuiteTestCaseUpdateModel + // (required) Project ID or project name + Project *string + // (required) ID of the test plan that contains the suite. + PlanId *int + // (required) ID of the test suite to which the test cases must be added. + SuiteId *int + // (required) IDs of the test cases to add to the suite. Ids are specified in comma separated format. + TestCaseIds *string +} + +// [Preview API] Delete a test case. +func (client *Client) DeleteTestCase(ctx context.Context, args DeleteTestCaseArgs) error { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.TestCaseId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.TestCaseId"} + } + routeValues["testCaseId"] = strconv.Itoa(*args.TestCaseId) + + locationId, _ := uuid.Parse("4d472e0f-e32c-4ef8-adf4-a4078772889c") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeleteTestCase function +type DeleteTestCaseArgs struct { + // (required) Project ID or project name + Project *string + // (required) Id of test case to delete. + TestCaseId *int +} + +// [Preview API] Get history of a test method using TestHistoryQuery +func (client *Client) QueryTestHistory(ctx context.Context, args QueryTestHistoryArgs) (*TestHistoryQuery, error) { + if args.Filter == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Filter"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + body, marshalErr := json.Marshal(*args.Filter) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("929fd86c-3e38-4d8c-b4b6-90df256e5971") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.2", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue TestHistoryQuery + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the QueryTestHistory function +type QueryTestHistoryArgs struct { + // (required) TestHistoryQuery to get history + Filter *TestHistoryQuery + // (required) Project ID or project name + Project *string +} diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/test/models.go b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/test/models.go new file mode 100644 index 00000000..47c1f1e2 --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/test/models.go @@ -0,0 +1,3564 @@ +// -------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// -------------------------------------------------------------------------------------------- +// Generated file, DO NOT EDIT +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// -------------------------------------------------------------------------------------------- + +package test + +import ( + "github.com/google/uuid" + "github.com/microsoft/azure-devops-go-api/azuredevops" + "github.com/microsoft/azure-devops-go-api/azuredevops/core" + "github.com/microsoft/azure-devops-go-api/azuredevops/system" + "github.com/microsoft/azure-devops-go-api/azuredevops/webapi" +) + +type AbortTestRunRequest struct { + Options *int `json:"options,omitempty"` + ProjectName *string `json:"projectName,omitempty"` + Revision *int `json:"revision,omitempty"` + TestRunId *int `json:"testRunId,omitempty"` +} + +type AfnStrip struct { + // Auxiliary Url to be consumed by MTM + AuxiliaryUrl *string `json:"auxiliaryUrl,omitempty"` + // Creation date of the AfnStrip + CreationDate *azuredevops.Time `json:"creationDate,omitempty"` + // File name of the attachment created + FileName *string `json:"fileName,omitempty"` + // ID of AfnStrip. This is same as the attachment ID. + Id *int `json:"id,omitempty"` + // Project identifier which contains AfnStrip + Project *string `json:"project,omitempty"` + // Service in which this attachment is stored in + StoredIn *string `json:"storedIn,omitempty"` + // Afn strip stream. + Stream *string `json:"stream,omitempty"` + // ID of the testcase. + TestCaseId *int `json:"testCaseId,omitempty"` + // Backing test result id. + TestResultId *int `json:"testResultId,omitempty"` + // Backing test run id. + TestRunId *int `json:"testRunId,omitempty"` + // Byte stream (uncompressed) length of Afn strip. + UnCompressedStreamLength *uint64 `json:"unCompressedStreamLength,omitempty"` + // Url of the attachment created. + Url *string `json:"url,omitempty"` +} + +type AggregatedDataForResultTrend struct { + // This is tests execution duration. + Duration interface{} `json:"duration,omitempty"` + ResultsByOutcome *map[TestOutcome]AggregatedResultsByOutcome `json:"resultsByOutcome,omitempty"` + RunSummaryByState *map[TestRunState]AggregatedRunsByState `json:"runSummaryByState,omitempty"` + TestResultsContext *TestResultsContext `json:"testResultsContext,omitempty"` + TotalTests *int `json:"totalTests,omitempty"` +} + +type AggregatedResultsAnalysis struct { + Duration interface{} `json:"duration,omitempty"` + NotReportedResultsByOutcome *map[TestOutcome]AggregatedResultsByOutcome `json:"notReportedResultsByOutcome,omitempty"` + PreviousContext *TestResultsContext `json:"previousContext,omitempty"` + ResultsByOutcome *map[TestOutcome]AggregatedResultsByOutcome `json:"resultsByOutcome,omitempty"` + ResultsDifference *AggregatedResultsDifference `json:"resultsDifference,omitempty"` + RunSummaryByOutcome *map[TestRunOutcome]AggregatedRunsByOutcome `json:"runSummaryByOutcome,omitempty"` + RunSummaryByState *map[TestRunState]AggregatedRunsByState `json:"runSummaryByState,omitempty"` + TotalTests *int `json:"totalTests,omitempty"` +} + +type AggregatedResultsByOutcome struct { + Count *int `json:"count,omitempty"` + Duration interface{} `json:"duration,omitempty"` + GroupByField *string `json:"groupByField,omitempty"` + GroupByValue interface{} `json:"groupByValue,omitempty"` + Outcome *TestOutcome `json:"outcome,omitempty"` + RerunResultCount *int `json:"rerunResultCount,omitempty"` +} + +type AggregatedResultsDifference struct { + IncreaseInDuration interface{} `json:"increaseInDuration,omitempty"` + IncreaseInFailures *int `json:"increaseInFailures,omitempty"` + IncreaseInOtherTests *int `json:"increaseInOtherTests,omitempty"` + IncreaseInPassedTests *int `json:"increaseInPassedTests,omitempty"` + IncreaseInTotalTests *int `json:"increaseInTotalTests,omitempty"` +} + +type AggregatedRunsByOutcome struct { + Outcome *TestRunOutcome `json:"outcome,omitempty"` + RunsCount *int `json:"runsCount,omitempty"` +} + +type AggregatedRunsByState struct { + ResultsByOutcome *map[TestOutcome]AggregatedResultsByOutcome `json:"resultsByOutcome,omitempty"` + RunsCount *int `json:"runsCount,omitempty"` + State *TestRunState `json:"state,omitempty"` +} + +// The types of test attachments. +type AttachmentType string + +type attachmentTypeValuesType struct { + GeneralAttachment AttachmentType + CodeCoverage AttachmentType + ConsoleLog AttachmentType +} + +var AttachmentTypeValues = attachmentTypeValuesType{ + // Attachment type GeneralAttachment , use this as default type unless you have other type. + GeneralAttachment: "generalAttachment", + // Attachment type CodeCoverage. + CodeCoverage: "codeCoverage", + // Attachment type ConsoleLog. + ConsoleLog: "consoleLog", +} + +type BatchResponse struct { + Error *string `json:"error,omitempty"` + Responses *[]Response `json:"responses,omitempty"` + Status *string `json:"status,omitempty"` +} + +// BuildConfiguration Details. +type BuildConfiguration struct { + // Branch name for which build is generated. + BranchName *string `json:"branchName,omitempty"` + // BuildDefinitionId for build. + BuildDefinitionId *int `json:"buildDefinitionId,omitempty"` + // Build system. + BuildSystem *string `json:"buildSystem,omitempty"` + // Build Creation Date. + CreationDate *azuredevops.Time `json:"creationDate,omitempty"` + // Build flavor (eg Build/Release). + Flavor *string `json:"flavor,omitempty"` + // BuildConfiguration Id. + Id *int `json:"id,omitempty"` + // Build Number. + Number *string `json:"number,omitempty"` + // BuildConfiguration Platform. + Platform *string `json:"platform,omitempty"` + // Project associated with this BuildConfiguration. + Project *ShallowReference `json:"project,omitempty"` + // Repository Guid for the Build. + RepositoryGuid *string `json:"repositoryGuid,omitempty"` + // Deprecated: Use RepositoryGuid instead + RepositoryId *int `json:"repositoryId,omitempty"` + // Repository Type (eg. TFSGit). + RepositoryType *string `json:"repositoryType,omitempty"` + // Source Version(/first commit) for the build was triggered. + SourceVersion *string `json:"sourceVersion,omitempty"` + // Target BranchName. + TargetBranchName *string `json:"targetBranchName,omitempty"` + // Build Uri. + Uri *string `json:"uri,omitempty"` +} + +// Build Coverage Detail +type BuildCoverage struct { + // Code Coverage File Url + CodeCoverageFileUrl *string `json:"codeCoverageFileUrl,omitempty"` + // Build Configuration + Configuration *BuildConfiguration `json:"configuration,omitempty"` + // Last Error + LastError *string `json:"lastError,omitempty"` + // List of Modules + Modules *[]ModuleCoverage `json:"modules,omitempty"` + // State + State *string `json:"state,omitempty"` +} + +// Reference to a build. +type BuildReference struct { + // Branch name. + BranchName *string `json:"branchName,omitempty"` + // Build system. + BuildSystem *string `json:"buildSystem,omitempty"` + // Build Definition ID. + DefinitionId *int `json:"definitionId,omitempty"` + // Build ID. + Id *int `json:"id,omitempty"` + // Build Number. + Number *string `json:"number,omitempty"` + // Repository ID. + RepositoryId *string `json:"repositoryId,omitempty"` + // Build URI. + Uri *string `json:"uri,omitempty"` +} + +type BuildReference2 struct { + BranchName *string `json:"branchName,omitempty"` + BuildConfigurationId *int `json:"buildConfigurationId,omitempty"` + BuildDefinitionId *int `json:"buildDefinitionId,omitempty"` + BuildDeleted *bool `json:"buildDeleted,omitempty"` + BuildFlavor *string `json:"buildFlavor,omitempty"` + BuildId *int `json:"buildId,omitempty"` + BuildNumber *string `json:"buildNumber,omitempty"` + BuildPlatform *string `json:"buildPlatform,omitempty"` + BuildSystem *string `json:"buildSystem,omitempty"` + BuildUri *string `json:"buildUri,omitempty"` + CoverageId *int `json:"coverageId,omitempty"` + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + ProjectId *uuid.UUID `json:"projectId,omitempty"` + RepoId *string `json:"repoId,omitempty"` + RepoType *string `json:"repoType,omitempty"` + SourceVersion *string `json:"sourceVersion,omitempty"` +} + +type BulkResultUpdateRequest struct { + ProjectName *string `json:"projectName,omitempty"` + Requests *[]ResultUpdateRequest `json:"requests,omitempty"` +} + +// Detail About Clone Operation. +type CloneOperationInformation struct { + // Clone Statistics + CloneStatistics *CloneStatistics `json:"cloneStatistics,omitempty"` + // If the operation is complete, the DateTime of completion. If operation is not complete, this is DateTime.MaxValue + CompletionDate *azuredevops.Time `json:"completionDate,omitempty"` + // DateTime when the operation was started + CreationDate *azuredevops.Time `json:"creationDate,omitempty"` + // Shallow reference of the destination + DestinationObject *ShallowReference `json:"destinationObject,omitempty"` + // Shallow reference of the destination + DestinationPlan *ShallowReference `json:"destinationPlan,omitempty"` + // Shallow reference of the destination + DestinationProject *ShallowReference `json:"destinationProject,omitempty"` + // If the operation has Failed, Message contains the reason for failure. Null otherwise. + Message *string `json:"message,omitempty"` + // The ID of the operation + OpId *int `json:"opId,omitempty"` + // The type of the object generated as a result of the Clone operation + ResultObjectType *ResultObjectType `json:"resultObjectType,omitempty"` + // Shallow reference of the source + SourceObject *ShallowReference `json:"sourceObject,omitempty"` + // Shallow reference of the source + SourcePlan *ShallowReference `json:"sourcePlan,omitempty"` + // Shallow reference of the source + SourceProject *ShallowReference `json:"sourceProject,omitempty"` + // Current state of the operation. When State reaches Suceeded or Failed, the operation is complete + State *CloneOperationState `json:"state,omitempty"` + // Url for getting the clone information + Url *string `json:"url,omitempty"` +} + +// Enum of type Clone Operation Type. +type CloneOperationState string + +type cloneOperationStateValuesType struct { + Failed CloneOperationState + InProgress CloneOperationState + Queued CloneOperationState + Succeeded CloneOperationState +} + +var CloneOperationStateValues = cloneOperationStateValuesType{ + // value for Failed State + Failed: "failed", + // value for Inprogress state + InProgress: "inProgress", + // Value for Queued State + Queued: "queued", + // value for Success state + Succeeded: "succeeded", +} + +// Clone options for cloning the test suite. +type CloneOptions struct { + // If set to true requirements will be cloned + CloneRequirements *bool `json:"cloneRequirements,omitempty"` + // copy all suites from a source plan + CopyAllSuites *bool `json:"copyAllSuites,omitempty"` + // copy ancestor hierarchy + CopyAncestorHierarchy *bool `json:"copyAncestorHierarchy,omitempty"` + // Name of the workitem type of the clone + DestinationWorkItemType *string `json:"destinationWorkItemType,omitempty"` + // Key value pairs where the key value is overridden by the value. + OverrideParameters *map[string]string `json:"overrideParameters,omitempty"` + // Comment on the link that will link the new clone test case to the original Set null for no comment + RelatedLinkComment *string `json:"relatedLinkComment,omitempty"` +} + +// Clone Statistics Details. +type CloneStatistics struct { + // Number of requirements cloned so far. + ClonedRequirementsCount *int `json:"clonedRequirementsCount,omitempty"` + // Number of shared steps cloned so far. + ClonedSharedStepsCount *int `json:"clonedSharedStepsCount,omitempty"` + // Number of test cases cloned so far + ClonedTestCasesCount *int `json:"clonedTestCasesCount,omitempty"` + // Total number of requirements to be cloned + TotalRequirementsCount *int `json:"totalRequirementsCount,omitempty"` + // Total number of test cases to be cloned + TotalTestCasesCount *int `json:"totalTestCasesCount,omitempty"` +} + +// Represents the build configuration (platform, flavor) and coverage data for the build +type CodeCoverageData struct { + // Flavor of build for which data is retrieved/published + BuildFlavor *string `json:"buildFlavor,omitempty"` + // Platform of build for which data is retrieved/published + BuildPlatform *string `json:"buildPlatform,omitempty"` + // List of coverage data for the build + CoverageStats *[]CodeCoverageStatistics `json:"coverageStats,omitempty"` +} + +// Represents the code coverage statistics for a particular coverage label (modules, statements, blocks, etc.) +type CodeCoverageStatistics struct { + // Covered units + Covered *int `json:"covered,omitempty"` + // Delta of coverage + Delta *float64 `json:"delta,omitempty"` + // Is delta valid + IsDeltaAvailable *bool `json:"isDeltaAvailable,omitempty"` + // Label of coverage data ("Blocks", "Statements", "Modules", etc.) + Label *string `json:"label,omitempty"` + // Position of label + Position *int `json:"position,omitempty"` + // Total units + Total *int `json:"total,omitempty"` +} + +// Represents the code coverage summary results Used to publish or retrieve code coverage summary against a build +type CodeCoverageSummary struct { + // Uri of build for which data is retrieved/published + Build *ShallowReference `json:"build,omitempty"` + // List of coverage data and details for the build + CoverageData *[]CodeCoverageData `json:"coverageData,omitempty"` + // Uri of build against which difference in coverage is computed + DeltaBuild *ShallowReference `json:"deltaBuild,omitempty"` + // Uri of build against which difference in coverage is computed + Status *CoverageSummaryStatus `json:"status,omitempty"` +} + +type CodeCoverageSummary2 struct { + BuildConfigurationId *int `json:"buildConfigurationId,omitempty"` + Covered *int `json:"covered,omitempty"` + Label *string `json:"label,omitempty"` + Position *int `json:"position,omitempty"` + ProjectId *uuid.UUID `json:"projectId,omitempty"` + Total *int `json:"total,omitempty"` +} + +type Coverage2 struct { + CoverageId *int `json:"coverageId,omitempty"` + DateCreated *azuredevops.Time `json:"dateCreated,omitempty"` + DateModified *azuredevops.Time `json:"dateModified,omitempty"` + LastError *string `json:"lastError,omitempty"` + State *byte `json:"state,omitempty"` +} + +// [Flags] Used to choose which coverage data is returned by a QueryXXXCoverage() call. +type CoverageQueryFlags string + +type coverageQueryFlagsValuesType struct { + Modules CoverageQueryFlags + Functions CoverageQueryFlags + BlockData CoverageQueryFlags +} + +var CoverageQueryFlagsValues = coverageQueryFlagsValuesType{ + // If set, the Coverage.Modules property will be populated. + Modules: "modules", + // If set, the ModuleCoverage.Functions properties will be populated. + Functions: "functions", + // If set, the ModuleCoverage.CoverageData field will be populated. + BlockData: "blockData", +} + +type CoverageStatistics struct { + BlocksCovered *int `json:"blocksCovered,omitempty"` + BlocksNotCovered *int `json:"blocksNotCovered,omitempty"` + LinesCovered *int `json:"linesCovered,omitempty"` + LinesNotCovered *int `json:"linesNotCovered,omitempty"` + LinesPartiallyCovered *int `json:"linesPartiallyCovered,omitempty"` +} + +type CoverageStatus string + +type coverageStatusValuesType struct { + Covered CoverageStatus + NotCovered CoverageStatus + PartiallyCovered CoverageStatus +} + +var CoverageStatusValues = coverageStatusValuesType{ + Covered: "covered", + NotCovered: "notCovered", + PartiallyCovered: "partiallyCovered", +} + +// Represents status of code coverage summary for a build +type CoverageSummaryStatus string + +type coverageSummaryStatusValuesType struct { + None CoverageSummaryStatus + InProgress CoverageSummaryStatus + Completed CoverageSummaryStatus + Finalized CoverageSummaryStatus + Pending CoverageSummaryStatus +} + +var CoverageSummaryStatusValues = coverageSummaryStatusValuesType{ + // No coverage status + None: "none", + // The summary evaluation is in progress + InProgress: "inProgress", + // The summary evaluation for the previous request is completed. Summary can change in future + Completed: "completed", + // The summary evaluation is finalized and won't change + Finalized: "finalized", + // The summary evaluation is pending + Pending: "pending", +} + +type CreateTestMessageLogEntryRequest struct { + ProjectName *string `json:"projectName,omitempty"` + TestMessageLogEntry *[]TestMessageLogEntry `json:"testMessageLogEntry,omitempty"` + TestRunId *int `json:"testRunId,omitempty"` +} + +type CreateTestResultsRequest struct { + ProjectName *string `json:"projectName,omitempty"` + Results *[]LegacyTestCaseResult `json:"results,omitempty"` +} + +type CreateTestRunRequest struct { + ProjectName *string `json:"projectName,omitempty"` + Results *[]LegacyTestCaseResult `json:"results,omitempty"` + TestRun *LegacyTestRun `json:"testRun,omitempty"` + TestSettings *LegacyTestSettings `json:"testSettings,omitempty"` +} + +// A custom field information. Allowed Key : Value pairs - ( AttemptId: int value, IsTestResultFlaky: bool) +type CustomTestField struct { + // Field Name. + FieldName *string `json:"fieldName,omitempty"` + // Field value. + Value interface{} `json:"value,omitempty"` +} + +type CustomTestFieldDefinition struct { + FieldId *int `json:"fieldId,omitempty"` + FieldName *string `json:"fieldName,omitempty"` + FieldType *CustomTestFieldType `json:"fieldType,omitempty"` + Scope *CustomTestFieldScope `json:"scope,omitempty"` +} + +// [Flags] +type CustomTestFieldScope string + +type customTestFieldScopeValuesType struct { + None CustomTestFieldScope + TestRun CustomTestFieldScope + TestResult CustomTestFieldScope + System CustomTestFieldScope + All CustomTestFieldScope +} + +var CustomTestFieldScopeValues = customTestFieldScopeValuesType{ + None: "none", + TestRun: "testRun", + TestResult: "testResult", + System: "system", + All: "all", +} + +type CustomTestFieldType string + +type customTestFieldTypeValuesType struct { + Bit CustomTestFieldType + DateTime CustomTestFieldType + Int CustomTestFieldType + Float CustomTestFieldType + String CustomTestFieldType + Guid CustomTestFieldType +} + +var CustomTestFieldTypeValues = customTestFieldTypeValuesType{ + Bit: "bit", + DateTime: "dateTime", + Int: "int", + Float: "float", + String: "string", + Guid: "guid", +} + +type DatedTestFieldData struct { + Date *azuredevops.Time `json:"date,omitempty"` + Value *TestFieldData `json:"value,omitempty"` +} + +type DefaultAfnStripBinding struct { + TestCaseId *int `json:"testCaseId,omitempty"` + TestResultId *int `json:"testResultId,omitempty"` + TestRunId *int `json:"testRunId,omitempty"` +} + +type DeleteTestRunRequest struct { + ProjectName *string `json:"projectName,omitempty"` + TestRunIds *[]int `json:"testRunIds,omitempty"` +} + +type DownloadAttachmentsRequest struct { + Ids *[]int `json:"ids,omitempty"` + Lengths *[]uint64 `json:"lengths,omitempty"` +} + +// This is a temporary class to provide the details for the test run environment. +type DtlEnvironmentDetails struct { + CsmContent *string `json:"csmContent,omitempty"` + CsmParameters *string `json:"csmParameters,omitempty"` + SubscriptionName *string `json:"subscriptionName,omitempty"` +} + +// Failing since information of a test result. +type FailingSince struct { + // Build reference since failing. + Build *BuildReference `json:"build,omitempty"` + // Time since failing. + Date *azuredevops.Time `json:"date,omitempty"` + // Release reference since failing. + Release *ReleaseReference `json:"release,omitempty"` +} + +type FetchTestResultsRequest struct { + IdAndRevs *[]TestCaseResultIdAndRev `json:"idAndRevs,omitempty"` + IncludeActionResults *bool `json:"includeActionResults,omitempty"` + ProjectName *string `json:"projectName,omitempty"` +} + +type FetchTestResultsResponse struct { + ActionResults *[]TestActionResult `json:"actionResults,omitempty"` + Attachments *[]TestResultAttachment `json:"attachments,omitempty"` + DeletedIds *[]LegacyTestCaseResultIdentifier `json:"deletedIds,omitempty"` + Results *[]LegacyTestCaseResult `json:"results,omitempty"` + TestParameters *[]TestResultParameter `json:"testParameters,omitempty"` +} + +type FieldDetailsForTestResults struct { + // Group by field name + FieldName *string `json:"fieldName,omitempty"` + // Group by field values + GroupsForField *[]interface{} `json:"groupsForField,omitempty"` +} + +type FileCoverage struct { + // List of line blocks along with their coverage status + LineBlocksCoverage *[]LineBlockCoverage `json:"lineBlocksCoverage,omitempty"` + // File path for which coverage information is sought for + Path *string `json:"path,omitempty"` +} + +type FileCoverageRequest struct { + FilePath *string `json:"filePath,omitempty"` + PullRequestBaseIterationId *int `json:"pullRequestBaseIterationId,omitempty"` + PullRequestId *int `json:"pullRequestId,omitempty"` + PullRequestIterationId *int `json:"pullRequestIterationId,omitempty"` + RepoId *string `json:"repoId,omitempty"` +} + +type FilterPointQuery struct { + PlanId *int `json:"planId,omitempty"` + PointIds *[]int `json:"pointIds,omitempty"` + PointOutcome *[]byte `json:"pointOutcome,omitempty"` + ResultState *[]byte `json:"resultState,omitempty"` +} + +type FlakyDetection struct { + // FlakyDetectionPipelines defines Pipelines for Detection. + FlakyDetectionPipelines *FlakyDetectionPipelines `json:"flakyDetectionPipelines,omitempty"` + // FlakyDetectionType defines Detection type i.e. 1. System or 2. Manual. + FlakyDetectionType *FlakyDetectionType `json:"flakyDetectionType,omitempty"` +} + +type FlakyDetectionPipelines struct { + // AllowedPipelines - List All Pipelines allowed for detection. + AllowedPipelines *[]int `json:"allowedPipelines,omitempty"` + // IsAllPipelinesAllowed if users configure all system's pipelines. + IsAllPipelinesAllowed *bool `json:"isAllPipelinesAllowed,omitempty"` +} + +type FlakyDetectionType string + +type flakyDetectionTypeValuesType struct { + Custom FlakyDetectionType + System FlakyDetectionType +} + +var FlakyDetectionTypeValues = flakyDetectionTypeValuesType{ + // Custom defines manual detection type. + Custom: "custom", + // Defines System detection type. + System: "system", +} + +type FlakySettings struct { + // FlakyDetection defines types of detection. + FlakyDetection *FlakyDetection `json:"flakyDetection,omitempty"` + // FlakyInSummaryReport defines flaky data should show in summary report or not. + FlakyInSummaryReport *bool `json:"flakyInSummaryReport,omitempty"` + // ManualMarkUnmarkFlaky defines manual marking unmarking of flaky testcase. + ManualMarkUnmarkFlaky *bool `json:"manualMarkUnmarkFlaky,omitempty"` +} + +type FunctionCoverage struct { + Class *string `json:"class,omitempty"` + Name *string `json:"name,omitempty"` + Namespace *string `json:"namespace,omitempty"` + SourceFile *string `json:"sourceFile,omitempty"` + Statistics *CoverageStatistics `json:"statistics,omitempty"` +} + +type FunctionCoverage2 struct { + BlocksCovered *int `json:"blocksCovered,omitempty"` + BlocksNotCovered *int `json:"blocksNotCovered,omitempty"` + Class *string `json:"class,omitempty"` + CoverageId *int `json:"coverageId,omitempty"` + FunctionId *int `json:"functionId,omitempty"` + LinesCovered *int `json:"linesCovered,omitempty"` + LinesNotCovered *int `json:"linesNotCovered,omitempty"` + LinesPartiallyCovered *int `json:"linesPartiallyCovered,omitempty"` + ModuleId *int `json:"moduleId,omitempty"` + Name *string `json:"name,omitempty"` + Namespace *string `json:"namespace,omitempty"` + SourceFile *string `json:"sourceFile,omitempty"` +} + +type HttpPostedTcmAttachment struct { + AttachmentContent *string `json:"attachmentContent,omitempty"` + ContentLength *int `json:"contentLength,omitempty"` + ContentType *string `json:"contentType,omitempty"` + FileName *string `json:"fileName,omitempty"` +} + +// Job in pipeline. This is related to matrixing in YAML. +type JobReference struct { + // Attempt number of the job + Attempt *int `json:"attempt,omitempty"` + // Matrixing in YAML generates copies of a job with different inputs in matrix. JobName is the name of those input. Maximum supported length for name is 256 character. + JobName *string `json:"jobName,omitempty"` +} + +// Last result details of test point. +type LastResultDetails struct { + // CompletedDate of LastResult. + DateCompleted *azuredevops.Time `json:"dateCompleted,omitempty"` + // Duration of LastResult. + Duration *uint64 `json:"duration,omitempty"` + // RunBy. + RunBy *webapi.IdentityRef `json:"runBy,omitempty"` +} + +type LegacyBuildConfiguration struct { + BranchName *string `json:"branchName,omitempty"` + BuildConfigurationId *int `json:"buildConfigurationId,omitempty"` + BuildDefinitionId *int `json:"buildDefinitionId,omitempty"` + BuildDefinitionName *string `json:"buildDefinitionName,omitempty"` + BuildFlavor *string `json:"buildFlavor,omitempty"` + BuildId *int `json:"buildId,omitempty"` + BuildNumber *string `json:"buildNumber,omitempty"` + BuildPlatform *string `json:"buildPlatform,omitempty"` + BuildQuality *string `json:"buildQuality,omitempty"` + BuildSystem *string `json:"buildSystem,omitempty"` + BuildUri *string `json:"buildUri,omitempty"` + CompletedDate *azuredevops.Time `json:"completedDate,omitempty"` + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + OldBuildConfigurationId *int `json:"oldBuildConfigurationId,omitempty"` + RepositoryId *string `json:"repositoryId,omitempty"` + RepositoryType *string `json:"repositoryType,omitempty"` + SourceVersion *string `json:"sourceVersion,omitempty"` + TeamProjectName *string `json:"teamProjectName,omitempty"` +} + +type LegacyReleaseReference struct { + Attempt *int `json:"attempt,omitempty"` + EnvironmentCreationDate *azuredevops.Time `json:"environmentCreationDate,omitempty"` + PrimaryArtifactBuildId *int `json:"primaryArtifactBuildId,omitempty"` + PrimaryArtifactProjectId *string `json:"primaryArtifactProjectId,omitempty"` + PrimaryArtifactType *string `json:"primaryArtifactType,omitempty"` + ReleaseCreationDate *azuredevops.Time `json:"releaseCreationDate,omitempty"` + ReleaseDefId *int `json:"releaseDefId,omitempty"` + ReleaseEnvDefId *int `json:"releaseEnvDefId,omitempty"` + ReleaseEnvId *int `json:"releaseEnvId,omitempty"` + ReleaseEnvName *string `json:"releaseEnvName,omitempty"` + ReleaseEnvUri *string `json:"releaseEnvUri,omitempty"` + ReleaseId *int `json:"releaseId,omitempty"` + ReleaseName *string `json:"releaseName,omitempty"` + ReleaseRefId *int `json:"releaseRefId,omitempty"` + ReleaseUri *string `json:"releaseUri,omitempty"` +} + +type LegacyTestCaseResult struct { + AfnStripId *int `json:"afnStripId,omitempty"` + AreaId *int `json:"areaId,omitempty"` + AreaUri *string `json:"areaUri,omitempty"` + AutomatedTestId *string `json:"automatedTestId,omitempty"` + AutomatedTestName *string `json:"automatedTestName,omitempty"` + AutomatedTestStorage *string `json:"automatedTestStorage,omitempty"` + AutomatedTestType *string `json:"automatedTestType,omitempty"` + AutomatedTestTypeId *string `json:"automatedTestTypeId,omitempty"` + BuildNumber *string `json:"buildNumber,omitempty"` + BuildReference *LegacyBuildConfiguration `json:"buildReference,omitempty"` + Comment *string `json:"comment,omitempty"` + ComputerName *string `json:"computerName,omitempty"` + ConfigurationId *int `json:"configurationId,omitempty"` + ConfigurationName *string `json:"configurationName,omitempty"` + CreationDate *azuredevops.Time `json:"creationDate,omitempty"` + CustomFields *[]TestExtensionField `json:"customFields,omitempty"` + DateCompleted *azuredevops.Time `json:"dateCompleted,omitempty"` + DateStarted *azuredevops.Time `json:"dateStarted,omitempty"` + Duration *uint64 `json:"duration,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` + FailingSince *FailingSince `json:"failingSince,omitempty"` + FailureType *byte `json:"failureType,omitempty"` + Id *LegacyTestCaseResultIdentifier `json:"id,omitempty"` + IsRerun *bool `json:"isRerun,omitempty"` + LastUpdated *azuredevops.Time `json:"lastUpdated,omitempty"` + LastUpdatedBy *uuid.UUID `json:"lastUpdatedBy,omitempty"` + LastUpdatedByName *string `json:"lastUpdatedByName,omitempty"` + Outcome *byte `json:"outcome,omitempty"` + Owner *uuid.UUID `json:"owner,omitempty"` + OwnerName *string `json:"ownerName,omitempty"` + Priority *byte `json:"priority,omitempty"` + ReleaseReference *LegacyReleaseReference `json:"releaseReference,omitempty"` + ResetCount *int `json:"resetCount,omitempty"` + ResolutionStateId *int `json:"resolutionStateId,omitempty"` + ResultGroupType *ResultGroupType `json:"resultGroupType,omitempty"` + Revision *int `json:"revision,omitempty"` + RunBy *uuid.UUID `json:"runBy,omitempty"` + RunByName *string `json:"runByName,omitempty"` + SequenceId *int `json:"sequenceId,omitempty"` + StackTrace *TestExtensionField `json:"stackTrace,omitempty"` + State *byte `json:"state,omitempty"` + SubResultCount *int `json:"subResultCount,omitempty"` + SuiteName *string `json:"suiteName,omitempty"` + TestCaseArea *string `json:"testCaseArea,omitempty"` + TestCaseAreaUri *string `json:"testCaseAreaUri,omitempty"` + TestCaseId *int `json:"testCaseId,omitempty"` + TestCaseReferenceId *int `json:"testCaseReferenceId,omitempty"` + TestCaseRevision *int `json:"testCaseRevision,omitempty"` + TestCaseTitle *string `json:"testCaseTitle,omitempty"` + TestPlanId *int `json:"testPlanId,omitempty"` + TestPointId *int `json:"testPointId,omitempty"` + TestResultId *int `json:"testResultId,omitempty"` + TestRunId *int `json:"testRunId,omitempty"` + TestRunTitle *string `json:"testRunTitle,omitempty"` + TestSuiteId *int `json:"testSuiteId,omitempty"` +} + +type LegacyTestCaseResultIdentifier struct { + AreaUri *string `json:"areaUri,omitempty"` + TestResultId *int `json:"testResultId,omitempty"` + TestRunId *int `json:"testRunId,omitempty"` +} + +type LegacyTestRun struct { + BugsCount *int `json:"bugsCount,omitempty"` + BuildConfigurationId *int `json:"buildConfigurationId,omitempty"` + BuildFlavor *string `json:"buildFlavor,omitempty"` + BuildNumber *string `json:"buildNumber,omitempty"` + BuildPlatform *string `json:"buildPlatform,omitempty"` + BuildReference *LegacyBuildConfiguration `json:"buildReference,omitempty"` + BuildUri *string `json:"buildUri,omitempty"` + Comment *string `json:"comment,omitempty"` + CompleteDate *azuredevops.Time `json:"completeDate,omitempty"` + ConfigurationIds *[]int `json:"configurationIds,omitempty"` + Controller *string `json:"controller,omitempty"` + CreationDate *azuredevops.Time `json:"creationDate,omitempty"` + CsmContent *string `json:"csmContent,omitempty"` + CsmParameters *string `json:"csmParameters,omitempty"` + CustomFields *[]TestExtensionField `json:"customFields,omitempty"` + DropLocation *string `json:"dropLocation,omitempty"` + DtlAutEnvironment *ShallowReference `json:"dtlAutEnvironment,omitempty"` + DtlTestEnvironment *ShallowReference `json:"dtlTestEnvironment,omitempty"` + DueDate *azuredevops.Time `json:"dueDate,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` + Filter *RunFilter `json:"filter,omitempty"` + IncompleteTests *int `json:"incompleteTests,omitempty"` + IsAutomated *bool `json:"isAutomated,omitempty"` + IsBvt *bool `json:"isBvt,omitempty"` + Iteration *string `json:"iteration,omitempty"` + IterationId *int `json:"iterationId,omitempty"` + LastUpdated *azuredevops.Time `json:"lastUpdated,omitempty"` + LastUpdatedBy *uuid.UUID `json:"lastUpdatedBy,omitempty"` + LastUpdatedByName *string `json:"lastUpdatedByName,omitempty"` + LegacySharePath *string `json:"legacySharePath,omitempty"` + NotApplicableTests *int `json:"notApplicableTests,omitempty"` + Owner *uuid.UUID `json:"owner,omitempty"` + OwnerName *string `json:"ownerName,omitempty"` + PassedTests *int `json:"passedTests,omitempty"` + PostProcessState *byte `json:"postProcessState,omitempty"` + PublicTestSettingsId *int `json:"publicTestSettingsId,omitempty"` + ReleaseEnvironmentUri *string `json:"releaseEnvironmentUri,omitempty"` + ReleaseReference *LegacyReleaseReference `json:"releaseReference,omitempty"` + ReleaseUri *string `json:"releaseUri,omitempty"` + Revision *int `json:"revision,omitempty"` + RowVersion *[]byte `json:"rowVersion,omitempty"` + RunHasDtlEnvironment *bool `json:"runHasDtlEnvironment,omitempty"` + RunTimeout interface{} `json:"runTimeout,omitempty"` + ServiceVersion *string `json:"serviceVersion,omitempty"` + SourceWorkflow *string `json:"sourceWorkflow,omitempty"` + StartDate *azuredevops.Time `json:"startDate,omitempty"` + State *byte `json:"state,omitempty"` + SubscriptionName *string `json:"subscriptionName,omitempty"` + Substate *byte `json:"substate,omitempty"` + TeamProject *string `json:"teamProject,omitempty"` + TeamProjectUri *string `json:"teamProjectUri,omitempty"` + TestConfigurationsMapping *string `json:"testConfigurationsMapping,omitempty"` + TestEnvironmentId *uuid.UUID `json:"testEnvironmentId,omitempty"` + TestMessageLogEntries *[]TestMessageLogDetails `json:"testMessageLogEntries,omitempty"` + TestMessageLogId *int `json:"testMessageLogId,omitempty"` + TestPlanId *int `json:"testPlanId,omitempty"` + TestRunId *int `json:"testRunId,omitempty"` + TestRunStatistics *[]LegacyTestRunStatistic `json:"testRunStatistics,omitempty"` + TestSettingsId *int `json:"testSettingsId,omitempty"` + Title *string `json:"title,omitempty"` + TotalTests *int `json:"totalTests,omitempty"` + Type *byte `json:"type,omitempty"` + UnanalyzedTests *int `json:"unanalyzedTests,omitempty"` + Version *int `json:"version,omitempty"` +} + +type LegacyTestRunStatistic struct { + Count *int `json:"count,omitempty"` + Outcome *byte `json:"outcome,omitempty"` + ResolutionState *TestResolutionState `json:"resolutionState,omitempty"` + State *byte `json:"state,omitempty"` + TestRunId *int `json:"testRunId,omitempty"` +} + +type LegacyTestSettings struct { + AreaId *int `json:"areaId,omitempty"` + AreaPath *string `json:"areaPath,omitempty"` + CreatedBy *uuid.UUID `json:"createdBy,omitempty"` + CreatedByName *string `json:"createdByName,omitempty"` + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + Description *string `json:"description,omitempty"` + Id *int `json:"id,omitempty"` + IsAutomated *bool `json:"isAutomated,omitempty"` + IsPublic *bool `json:"isPublic,omitempty"` + LastUpdated *azuredevops.Time `json:"lastUpdated,omitempty"` + LastUpdatedBy *uuid.UUID `json:"lastUpdatedBy,omitempty"` + LastUpdatedByName *string `json:"lastUpdatedByName,omitempty"` + MachineRoles *[]TestSettingsMachineRole `json:"machineRoles,omitempty"` + Name *string `json:"name,omitempty"` + Revision *int `json:"revision,omitempty"` + Settings *string `json:"settings,omitempty"` + TeamProjectUri *string `json:"teamProjectUri,omitempty"` +} + +type LineBlockCoverage struct { + // End of line block + End *int `json:"end,omitempty"` + // Start of line block + Start *int `json:"start,omitempty"` + // Coverage status. Covered: 0, NotCovered: 1, PartiallyCovered: 2 + Status *int `json:"status,omitempty"` +} + +type LinkedWorkItemsQuery struct { + AutomatedTestNames *[]string `json:"automatedTestNames,omitempty"` + PlanId *int `json:"planId,omitempty"` + PointIds *[]int `json:"pointIds,omitempty"` + SuiteIds *[]int `json:"suiteIds,omitempty"` + TestCaseIds *[]int `json:"testCaseIds,omitempty"` + WorkItemCategory *string `json:"workItemCategory,omitempty"` +} + +type LinkedWorkItemsQueryResult struct { + AutomatedTestName *string `json:"automatedTestName,omitempty"` + PlanId *int `json:"planId,omitempty"` + PointId *int `json:"pointId,omitempty"` + SuiteId *int `json:"suiteId,omitempty"` + TestCaseId *int `json:"testCaseId,omitempty"` + WorkItems *[]WorkItemReference `json:"workItems,omitempty"` +} + +type ModuleCoverage struct { + BlockCount *int `json:"blockCount,omitempty"` + BlockData *[]byte `json:"blockData,omitempty"` + // Code Coverage File Url + FileUrl *string `json:"fileUrl,omitempty"` + Functions *[]FunctionCoverage `json:"functions,omitempty"` + Name *string `json:"name,omitempty"` + Signature *uuid.UUID `json:"signature,omitempty"` + SignatureAge *int `json:"signatureAge,omitempty"` + Statistics *CoverageStatistics `json:"statistics,omitempty"` +} + +type ModuleCoverage2 struct { + BlockCount *int `json:"blockCount,omitempty"` + BlockData *[]byte `json:"blockData,omitempty"` + BlockDataLength *int `json:"blockDataLength,omitempty"` + BlocksCovered *int `json:"blocksCovered,omitempty"` + BlocksNotCovered *int `json:"blocksNotCovered,omitempty"` + CoverageFileUrl *string `json:"coverageFileUrl,omitempty"` + CoverageId *int `json:"coverageId,omitempty"` + LinesCovered *int `json:"linesCovered,omitempty"` + LinesNotCovered *int `json:"linesNotCovered,omitempty"` + LinesPartiallyCovered *int `json:"linesPartiallyCovered,omitempty"` + ModuleId *int `json:"moduleId,omitempty"` + Name *string `json:"name,omitempty"` + Signature *uuid.UUID `json:"signature,omitempty"` + SignatureAge *int `json:"signatureAge,omitempty"` +} + +// Name value pair +type NameValuePair struct { + // Name + Name *string `json:"name,omitempty"` + // Value + Value *string `json:"value,omitempty"` +} + +type OperationType string + +type operationTypeValuesType struct { + Add OperationType + Delete OperationType +} + +var OperationTypeValues = operationTypeValuesType{ + Add: "add", + Delete: "delete", +} + +// Phase in pipeline +type PhaseReference struct { + // Attempt number of the phase + Attempt *int `json:"attempt,omitempty"` + // Name of the phase. Maximum supported length for name is 256 character. + PhaseName *string `json:"phaseName,omitempty"` +} + +// Pipeline reference +type PipelineReference struct { + // Reference of the job + JobReference *JobReference `json:"jobReference,omitempty"` + // Reference of the phase. + PhaseReference *PhaseReference `json:"phaseReference,omitempty"` + // Reference of the pipeline with which this pipeline instance is related. + PipelineId *int `json:"pipelineId,omitempty"` + // Reference of the stage. + StageReference *StageReference `json:"stageReference,omitempty"` +} + +// A model class used for creating and updating test plans. +type PlanUpdateModel struct { + // Area path to which the test plan belongs. This should be set to area path of the team that works on this test plan. + Area *ShallowReference `json:"area,omitempty"` + // Build ID of the build whose quality is tested by the tests in this test plan. For automated testing, this build ID is used to find the test binaries that contain automated test methods. + Build *ShallowReference `json:"build,omitempty"` + // The Build Definition that generates a build associated with this test plan. + BuildDefinition *ShallowReference `json:"buildDefinition,omitempty"` + // IDs of configurations to be applied when new test suites and test cases are added to the test plan. + ConfigurationIds *[]int `json:"configurationIds,omitempty"` + // Description of the test plan. + Description *string `json:"description,omitempty"` + // End date for the test plan. + EndDate *string `json:"endDate,omitempty"` + // Iteration path assigned to the test plan. This indicates when the target iteration by which the testing in this plan is supposed to be complete and the product is ready to be released. + Iteration *string `json:"iteration,omitempty"` + // Name of the test plan. + Name *string `json:"name,omitempty"` + // Owner of the test plan. + Owner *webapi.IdentityRef `json:"owner,omitempty"` + // Release Environment to be used to deploy the build and run automated tests from this test plan. + ReleaseEnvironmentDefinition *ReleaseEnvironmentDefinitionReference `json:"releaseEnvironmentDefinition,omitempty"` + // Start date for the test plan. + StartDate *string `json:"startDate,omitempty"` + // State of the test plan. + State *string `json:"state,omitempty"` + // Test Outcome settings + TestOutcomeSettings *TestOutcomeSettings `json:"testOutcomeSettings,omitempty"` +} + +// Adding test cases to a suite creates one of more test points based on the default configurations and testers assigned to the test suite. PointAssignment is the list of test points that were created for each of the test cases that were added to the test suite. +type PointAssignment struct { + // Configuration that was assigned to the test case. + Configuration *ShallowReference `json:"configuration,omitempty"` + // Tester that was assigned to the test case + Tester *webapi.IdentityRef `json:"tester,omitempty"` +} + +type PointLastResult struct { + LastUpdatedDate *azuredevops.Time `json:"lastUpdatedDate,omitempty"` + PointId *int `json:"pointId,omitempty"` +} + +// Filter class for test point. +type PointsFilter struct { + // List of Configurations for filtering. + ConfigurationNames *[]string `json:"configurationNames,omitempty"` + // List of test case id for filtering. + TestcaseIds *[]int `json:"testcaseIds,omitempty"` + // List of tester for filtering. + Testers *[]webapi.IdentityRef `json:"testers,omitempty"` +} + +type PointsReference2 struct { + PlanId *int `json:"planId,omitempty"` + PointId *int `json:"pointId,omitempty"` +} + +type PointsResults2 struct { + ChangeNumber *int `json:"changeNumber,omitempty"` + LastFailureType *byte `json:"lastFailureType,omitempty"` + LastResolutionStateId *int `json:"lastResolutionStateId,omitempty"` + LastResultOutcome *byte `json:"lastResultOutcome,omitempty"` + LastResultState *byte `json:"lastResultState,omitempty"` + LastTestResultId *int `json:"lastTestResultId,omitempty"` + LastTestRunId *int `json:"lastTestRunId,omitempty"` + LastUpdated *azuredevops.Time `json:"lastUpdated,omitempty"` + LastUpdatedBy *uuid.UUID `json:"lastUpdatedBy,omitempty"` + PlanId *int `json:"planId,omitempty"` + PointId *int `json:"pointId,omitempty"` +} + +// Model to update test point. +type PointUpdateModel struct { + // Outcome to update. + Outcome *string `json:"outcome,omitempty"` + // Reset test point to active. + ResetToActive *bool `json:"resetToActive,omitempty"` + // Tester to update. Type IdentityRef. + Tester *webapi.IdentityRef `json:"tester,omitempty"` +} + +// Test point workitem property. +type PointWorkItemProperty struct { + // key value pair of test point work item property. + WorkItem *azuredevops.KeyValuePair `json:"workItem,omitempty"` +} + +// The class to represent a Generic store for test session data. +type PropertyBag struct { + // Generic store for test session data + Bag *map[string]string `json:"bag,omitempty"` +} + +type QueryByPointRequest struct { + ProjectName *string `json:"projectName,omitempty"` + TestPlanId *int `json:"testPlanId,omitempty"` + TestPointId *int `json:"testPointId,omitempty"` +} + +type QueryByRunRequest struct { + IncludeActionResults *bool `json:"includeActionResults,omitempty"` + Outcome *byte `json:"outcome,omitempty"` + Owner *uuid.UUID `json:"owner,omitempty"` + PageSize *int `json:"pageSize,omitempty"` + ProjectName *string `json:"projectName,omitempty"` + State *byte `json:"state,omitempty"` + TestRunId *int `json:"testRunId,omitempty"` +} + +type QueryModel struct { + Query *string `json:"query,omitempty"` +} + +type QueryTestActionResultRequest struct { + Identifier *LegacyTestCaseResultIdentifier `json:"identifier,omitempty"` + ProjectName *string `json:"projectName,omitempty"` +} + +type QueryTestActionResultResponse struct { + TestActionResults *[]TestActionResult `json:"testActionResults,omitempty"` + TestAttachments *[]TestResultAttachment `json:"testAttachments,omitempty"` + TestResultParameters *[]TestResultParameter `json:"testResultParameters,omitempty"` +} + +type QueryTestMessageLogEntryRequest struct { + ProjectName *string `json:"projectName,omitempty"` + TestMessageLogId *int `json:"testMessageLogId,omitempty"` + TestRunId *int `json:"testRunId,omitempty"` +} + +type QueryTestRuns2Request struct { + IncludeStatistics *bool `json:"includeStatistics,omitempty"` + Query *ResultsStoreQuery `json:"query,omitempty"` +} + +type QueryTestRunsRequest struct { + BuildUri *string `json:"buildUri,omitempty"` + Owner *uuid.UUID `json:"owner,omitempty"` + PlanId *int `json:"planId,omitempty"` + Skip *int `json:"skip,omitempty"` + TeamProjectName *string `json:"teamProjectName,omitempty"` + TestRunId *int `json:"testRunId,omitempty"` + Top *int `json:"top,omitempty"` +} + +type QueryTestRunStatsRequest struct { + TeamProjectName *string `json:"teamProjectName,omitempty"` + TestRunId *int `json:"testRunId,omitempty"` +} + +// Reference to release environment resource. +type ReleaseEnvironmentDefinitionReference struct { + // ID of the release definition that contains the release environment definition. + DefinitionId *int `json:"definitionId,omitempty"` + // ID of the release environment definition. + EnvironmentDefinitionId *int `json:"environmentDefinitionId,omitempty"` +} + +// Reference to a release. +type ReleaseReference struct { + // Number of Release Attempt. + Attempt *int `json:"attempt,omitempty"` + // Release Creation Date. + CreationDate *azuredevops.Time `json:"creationDate,omitempty"` + // Release definition ID. + DefinitionId *int `json:"definitionId,omitempty"` + // Environment creation Date. + EnvironmentCreationDate *azuredevops.Time `json:"environmentCreationDate,omitempty"` + // Release environment definition ID. + EnvironmentDefinitionId *int `json:"environmentDefinitionId,omitempty"` + // Release environment definition name. + EnvironmentDefinitionName *string `json:"environmentDefinitionName,omitempty"` + // Release environment ID. + EnvironmentId *int `json:"environmentId,omitempty"` + // Release environment name. + EnvironmentName *string `json:"environmentName,omitempty"` + // Release ID. + Id *int `json:"id,omitempty"` + // Release name. + Name *string `json:"name,omitempty"` +} + +type ReleaseReference2 struct { + Attempt *int `json:"attempt,omitempty"` + EnvironmentCreationDate *azuredevops.Time `json:"environmentCreationDate,omitempty"` + ProjectId *uuid.UUID `json:"projectId,omitempty"` + ReleaseCreationDate *azuredevops.Time `json:"releaseCreationDate,omitempty"` + ReleaseDefId *int `json:"releaseDefId,omitempty"` + ReleaseEnvDefId *int `json:"releaseEnvDefId,omitempty"` + ReleaseEnvId *int `json:"releaseEnvId,omitempty"` + ReleaseEnvName *string `json:"releaseEnvName,omitempty"` + ReleaseEnvUri *string `json:"releaseEnvUri,omitempty"` + ReleaseId *int `json:"releaseId,omitempty"` + ReleaseName *string `json:"releaseName,omitempty"` + ReleaseRefId *int `json:"releaseRefId,omitempty"` + ReleaseUri *string `json:"releaseUri,omitempty"` +} + +type RequirementsToTestsMapping2 struct { + CreatedBy *uuid.UUID `json:"createdBy,omitempty"` + CreationDate *azuredevops.Time `json:"creationDate,omitempty"` + DeletedBy *uuid.UUID `json:"deletedBy,omitempty"` + DeletionDate *azuredevops.Time `json:"deletionDate,omitempty"` + IsMigratedToWIT *bool `json:"isMigratedToWIT,omitempty"` + ProjectId *uuid.UUID `json:"projectId,omitempty"` + TestMetadataId *int `json:"testMetadataId,omitempty"` + WorkItemId *int `json:"workItemId,omitempty"` +} + +type ResetTestResultsRequest struct { + Ids *[]LegacyTestCaseResultIdentifier `json:"ids,omitempty"` + ProjectName *string `json:"projectName,omitempty"` +} + +type Response struct { + Error *string `json:"error,omitempty"` + Id *uuid.UUID `json:"id,omitempty"` + Status *string `json:"status,omitempty"` + Url *string `json:"url,omitempty"` +} + +// Additional details with test result +type ResultDetails string + +type resultDetailsValuesType struct { + None ResultDetails + Iterations ResultDetails + WorkItems ResultDetails + SubResults ResultDetails + Point ResultDetails +} + +var ResultDetailsValues = resultDetailsValuesType{ + // Core fields of test result. Core fields includes State, Outcome, Priority, AutomatedTestName, AutomatedTestStorage, Comments, ErrorMessage etc. + None: "none", + // Test iteration details in a test result. + Iterations: "iterations", + // Workitems associated with a test result. + WorkItems: "workItems", + // Subresults in a test result. + SubResults: "subResults", + // Point and plan detail in a test result. + Point: "point", +} + +// Hierarchy type of the result/subresults. +type ResultGroupType string + +type resultGroupTypeValuesType struct { + None ResultGroupType + Rerun ResultGroupType + DataDriven ResultGroupType + OrderedTest ResultGroupType + Generic ResultGroupType +} + +var ResultGroupTypeValues = resultGroupTypeValuesType{ + // Leaf node of test result. + None: "none", + // Hierarchy type of test result. + Rerun: "rerun", + // Hierarchy type of test result. + DataDriven: "dataDriven", + // Hierarchy type of test result. + OrderedTest: "orderedTest", + // Unknown hierarchy type. + Generic: "generic", +} + +// Additional details with test result metadata +type ResultMetaDataDetails string + +type resultMetaDataDetailsValuesType struct { + None ResultMetaDataDetails + FlakyIdentifiers ResultMetaDataDetails +} + +var ResultMetaDataDetailsValues = resultMetaDataDetailsValuesType{ + // Core fields of test result metadata. + None: "none", + // Test FlakyIdentifiers details in test result metadata. + FlakyIdentifiers: "flakyIdentifiers", +} + +// The top level entity that is being cloned as part of a Clone operation +type ResultObjectType string + +type resultObjectTypeValuesType struct { + TestSuite ResultObjectType + TestPlan ResultObjectType +} + +var ResultObjectTypeValues = resultObjectTypeValuesType{ + // Suite Clone + TestSuite: "testSuite", + // Plan Clone + TestPlan: "testPlan", +} + +// Test result retention settings +type ResultRetentionSettings struct { + // Automated test result retention duration in days + AutomatedResultsRetentionDuration *int `json:"automatedResultsRetentionDuration,omitempty"` + // Last Updated by identity + LastUpdatedBy *webapi.IdentityRef `json:"lastUpdatedBy,omitempty"` + // Last updated date + LastUpdatedDate *azuredevops.Time `json:"lastUpdatedDate,omitempty"` + // Manual test result retention duration in days + ManualResultsRetentionDuration *int `json:"manualResultsRetentionDuration,omitempty"` +} + +type ResultsByQueryRequest struct { + PageSize *int `json:"pageSize,omitempty"` + Query *ResultsStoreQuery `json:"query,omitempty"` +} + +type ResultsByQueryResponse struct { + ExcessIds *[]LegacyTestCaseResultIdentifier `json:"excessIds,omitempty"` + TestResults *[]LegacyTestCaseResult `json:"testResults,omitempty"` +} + +type ResultsFilter struct { + AutomatedTestName *string `json:"automatedTestName,omitempty"` + Branch *string `json:"branch,omitempty"` + ExecutedIn *Service `json:"executedIn,omitempty"` + GroupBy *string `json:"groupBy,omitempty"` + MaxCompleteDate *azuredevops.Time `json:"maxCompleteDate,omitempty"` + ResultsCount *int `json:"resultsCount,omitempty"` + TestCaseId *int `json:"testCaseId,omitempty"` + TestCaseReferenceIds *[]int `json:"testCaseReferenceIds,omitempty"` + TestPlanId *int `json:"testPlanId,omitempty"` + TestPointIds *[]int `json:"testPointIds,omitempty"` + TestResultsContext *TestResultsContext `json:"testResultsContext,omitempty"` + TrendDays *int `json:"trendDays,omitempty"` +} + +type ResultsStoreQuery struct { + DayPrecision *bool `json:"dayPrecision,omitempty"` + QueryText *string `json:"queryText,omitempty"` + TeamProjectName *string `json:"teamProjectName,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` +} + +type ResultUpdateRequest struct { + ActionResultDeletes *[]TestActionResult `json:"actionResultDeletes,omitempty"` + ActionResults *[]TestActionResult `json:"actionResults,omitempty"` + AttachmentDeletes *[]TestResultAttachmentIdentity `json:"attachmentDeletes,omitempty"` + Attachments *[]TestResultAttachment `json:"attachments,omitempty"` + ParameterDeletes *[]TestResultParameter `json:"parameterDeletes,omitempty"` + Parameters *[]TestResultParameter `json:"parameters,omitempty"` + TestCaseResult *LegacyTestCaseResult `json:"testCaseResult,omitempty"` + TestResultId *int `json:"testResultId,omitempty"` + TestRunId *int `json:"testRunId,omitempty"` +} + +type ResultUpdateRequestModel struct { + ActionResultDeletes *[]TestActionResultModel `json:"actionResultDeletes,omitempty"` + ActionResults *[]TestActionResultModel `json:"actionResults,omitempty"` + ParameterDeletes *[]TestResultParameterModel `json:"parameterDeletes,omitempty"` + Parameters *[]TestResultParameterModel `json:"parameters,omitempty"` + TestCaseResult *TestCaseResultUpdateModel `json:"testCaseResult,omitempty"` +} + +type ResultUpdateResponse struct { + AttachmentIds *[]int `json:"attachmentIds,omitempty"` + LastUpdated *azuredevops.Time `json:"lastUpdated,omitempty"` + LastUpdatedBy *uuid.UUID `json:"lastUpdatedBy,omitempty"` + LastUpdatedByName *string `json:"lastUpdatedByName,omitempty"` + MaxReservedSubResultId *int `json:"maxReservedSubResultId,omitempty"` + Revision *int `json:"revision,omitempty"` + TestPlanId *int `json:"testPlanId,omitempty"` + TestResultId *int `json:"testResultId,omitempty"` +} + +type ResultUpdateResponseModel struct { + Revision *int `json:"revision,omitempty"` +} + +// Test run create details. +type RunCreateModel struct { + // true if test run is automated, false otherwise. By default it will be false. + Automated *bool `json:"automated,omitempty"` + // An abstracted reference to the build that it belongs. + Build *ShallowReference `json:"build,omitempty"` + // Drop location of the build used for test run. + BuildDropLocation *string `json:"buildDropLocation,omitempty"` + // Flavor of the build used for test run. (E.g: Release, Debug) + BuildFlavor *string `json:"buildFlavor,omitempty"` + // Platform of the build used for test run. (E.g.: x86, amd64) + BuildPlatform *string `json:"buildPlatform,omitempty"` + // BuildReference of the test run. + BuildReference *BuildConfiguration `json:"buildReference,omitempty"` + // Comments entered by those analyzing the run. + Comment *string `json:"comment,omitempty"` + // Completed date time of the run. + CompleteDate *string `json:"completeDate,omitempty"` + // IDs of the test configurations associated with the run. + ConfigurationIds *[]int `json:"configurationIds,omitempty"` + // Name of the test controller used for automated run. + Controller *string `json:"controller,omitempty"` + // Additional properties of test Run. + CustomTestFields *[]CustomTestField `json:"customTestFields,omitempty"` + // An abstracted reference to DtlAutEnvironment. + DtlAutEnvironment *ShallowReference `json:"dtlAutEnvironment,omitempty"` + // An abstracted reference to DtlTestEnvironment. + DtlTestEnvironment *ShallowReference `json:"dtlTestEnvironment,omitempty"` + // Due date and time for test run. + DueDate *string `json:"dueDate,omitempty"` + EnvironmentDetails *DtlEnvironmentDetails `json:"environmentDetails,omitempty"` + // Error message associated with the run. + ErrorMessage *string `json:"errorMessage,omitempty"` + // Filter used for discovering the Run. + Filter *RunFilter `json:"filter,omitempty"` + // The iteration in which to create the run. Root iteration of the team project will be default + Iteration *string `json:"iteration,omitempty"` + // Name of the test run. + Name *string `json:"name,omitempty"` + // Display name of the owner of the run. + Owner *webapi.IdentityRef `json:"owner,omitempty"` + // Reference of the pipeline to which this test run belongs. PipelineReference.PipelineId should be equal to RunCreateModel.Build.Id + PipelineReference *PipelineReference `json:"pipelineReference,omitempty"` + // An abstracted reference to the plan that it belongs. + Plan *ShallowReference `json:"plan,omitempty"` + // IDs of the test points to use in the run. + PointIds *[]int `json:"pointIds,omitempty"` + // URI of release environment associated with the run. + ReleaseEnvironmentUri *string `json:"releaseEnvironmentUri,omitempty"` + // Reference to release associated with test run. + ReleaseReference *ReleaseReference `json:"releaseReference,omitempty"` + // URI of release associated with the run. + ReleaseUri *string `json:"releaseUri,omitempty"` + // Run summary for run Type = NoConfigRun. + RunSummary *[]RunSummaryModel `json:"runSummary,omitempty"` + // Timespan till the run times out. + RunTimeout interface{} `json:"runTimeout,omitempty"` + // SourceWorkFlow(CI/CD) of the test run. + SourceWorkflow *string `json:"sourceWorkflow,omitempty"` + // Start date time of the run. + StartDate *string `json:"startDate,omitempty"` + // The state of the run. Type TestRunState Valid states - Unspecified ,NotStarted, InProgress, Completed, Waiting, Aborted, NeedsInvestigation + State *string `json:"state,omitempty"` + // Tags to attach with the test run, maximum of 5 tags can be added to run. + Tags *[]TestTag `json:"tags,omitempty"` + // TestConfigurationMapping of the test run. + TestConfigurationsMapping *string `json:"testConfigurationsMapping,omitempty"` + // ID of the test environment associated with the run. + TestEnvironmentId *string `json:"testEnvironmentId,omitempty"` + // An abstracted reference to the test settings resource. + TestSettings *ShallowReference `json:"testSettings,omitempty"` + // Type of the run(RunType) Valid Values : (Unspecified, Normal, Blocking, Web, MtrRunInitiatedFromWeb, RunWithDtlEnv, NoConfigRun) + Type *string `json:"type,omitempty"` +} + +// This class is used to provide the filters used for discovery +type RunFilter struct { + // filter for the test case sources (test containers) + SourceFilter *string `json:"sourceFilter,omitempty"` + // filter for the test cases + TestCaseFilter *string `json:"testCaseFilter,omitempty"` +} + +// Test run statistics per outcome. +type RunStatistic struct { + // Test result count fo the given outcome. + Count *int `json:"count,omitempty"` + // Test result outcome + Outcome *string `json:"outcome,omitempty"` + // Test run Resolution State. + ResolutionState *TestResolutionState `json:"resolutionState,omitempty"` + // State of the test run + State *string `json:"state,omitempty"` +} + +// Run summary for each output type of test. +type RunSummaryModel struct { + // Total time taken in milliseconds. + Duration *uint64 `json:"duration,omitempty"` + // Number of results for Outcome TestOutcome + ResultCount *int `json:"resultCount,omitempty"` + // Summary is based on outcome + TestOutcome *TestOutcome `json:"testOutcome,omitempty"` +} + +type RunType string + +type runTypeValuesType struct { + Unspecified RunType + Normal RunType + Blocking RunType + Web RunType + MtrRunInitiatedFromWeb RunType + RunWithDtlEnv RunType + NoConfigRun RunType +} + +var RunTypeValues = runTypeValuesType{ + // Only used during an update to preserve the existing value. + Unspecified: "unspecified", + // Normal test run. + Normal: "normal", + // Test run created for the blocked result when a test point is blocked. + Blocking: "blocking", + // Test run created from Web. + Web: "web", + // Run initiated from web through MTR + MtrRunInitiatedFromWeb: "mtrRunInitiatedFromWeb", + // These test run would require DTL environment. These could be either of automated or manual test run. + RunWithDtlEnv: "runWithDtlEnv", + // These test run may or may not have published test results but it will have summary like total test, passed test, failed test etc. These are automated tests. + NoConfigRun: "noConfigRun", +} + +type RunUpdateModel struct { + // An abstracted reference to the build that it belongs. + Build *ShallowReference `json:"build,omitempty"` + // Drop location of the build used for test run. + BuildDropLocation *string `json:"buildDropLocation,omitempty"` + // Flavor of the build used for test run. (E.g: Release, Debug) + BuildFlavor *string `json:"buildFlavor,omitempty"` + // Platform of the build used for test run. (E.g.: x86, amd64) + BuildPlatform *string `json:"buildPlatform,omitempty"` + // Comments entered by those analyzing the run. + Comment *string `json:"comment,omitempty"` + // Completed date time of the run. + CompletedDate *string `json:"completedDate,omitempty"` + // Name of the test controller used for automated run. + Controller *string `json:"controller,omitempty"` + // true to delete inProgess Results , false otherwise. + DeleteInProgressResults *bool `json:"deleteInProgressResults,omitempty"` + // An abstracted reference to DtlAutEnvironment. + DtlAutEnvironment *ShallowReference `json:"dtlAutEnvironment,omitempty"` + // An abstracted reference to DtlEnvironment. + DtlEnvironment *ShallowReference `json:"dtlEnvironment,omitempty"` + DtlEnvironmentDetails *DtlEnvironmentDetails `json:"dtlEnvironmentDetails,omitempty"` + // Due date and time for test run. + DueDate *string `json:"dueDate,omitempty"` + // Error message associated with the run. + ErrorMessage *string `json:"errorMessage,omitempty"` + // The iteration in which to create the run. + Iteration *string `json:"iteration,omitempty"` + // Log entries associated with the run. Use a comma-separated list of multiple log entry objects. { logEntry }, { logEntry }, ... + LogEntries *[]TestMessageLogDetails `json:"logEntries,omitempty"` + // Name of the test run. + Name *string `json:"name,omitempty"` + // URI of release environment associated with the run. + ReleaseEnvironmentUri *string `json:"releaseEnvironmentUri,omitempty"` + // URI of release associated with the run. + ReleaseUri *string `json:"releaseUri,omitempty"` + // Run summary for run Type = NoConfigRun. + RunSummary *[]RunSummaryModel `json:"runSummary,omitempty"` + // SourceWorkFlow(CI/CD) of the test run. + SourceWorkflow *string `json:"sourceWorkflow,omitempty"` + // Start date time of the run. + StartedDate *string `json:"startedDate,omitempty"` + // The state of the test run Below are the valid values - NotStarted, InProgress, Completed, Aborted, Waiting + State *string `json:"state,omitempty"` + // The types of sub states for test run. + Substate *TestRunSubstate `json:"substate,omitempty"` + // Tags to attach with the test run. + Tags *[]TestTag `json:"tags,omitempty"` + // ID of the test environment associated with the run. + TestEnvironmentId *string `json:"testEnvironmentId,omitempty"` + // An abstracted reference to test setting resource. + TestSettings *ShallowReference `json:"testSettings,omitempty"` +} + +type Service string + +type serviceValuesType struct { + Any Service + Tcm Service + Tfs Service +} + +var ServiceValues = serviceValuesType{ + Any: "any", + Tcm: "tcm", + Tfs: "tfs", +} + +// An abstracted reference to some other resource. This class is used to provide the build data contracts with a uniform way to reference other resources in a way that provides easy traversal through links. +type ShallowReference struct { + // ID of the resource + Id *string `json:"id,omitempty"` + // Name of the linked resource (definition name, controller name, etc.) + Name *string `json:"name,omitempty"` + // Full http link to the resource + Url *string `json:"url,omitempty"` +} + +type ShallowTestCaseResult struct { + AutomatedTestName *string `json:"automatedTestName,omitempty"` + AutomatedTestStorage *string `json:"automatedTestStorage,omitempty"` + DurationInMs *float64 `json:"durationInMs,omitempty"` + Id *int `json:"id,omitempty"` + IsReRun *bool `json:"isReRun,omitempty"` + Outcome *string `json:"outcome,omitempty"` + Owner *string `json:"owner,omitempty"` + Priority *int `json:"priority,omitempty"` + RefId *int `json:"refId,omitempty"` + RunId *int `json:"runId,omitempty"` + Tags *[]string `json:"tags,omitempty"` + TestCaseTitle *string `json:"testCaseTitle,omitempty"` +} + +// Reference to shared step workitem. +type SharedStepModel struct { + // WorkItem shared step ID. + Id *int `json:"id,omitempty"` + // Shared step workitem revision. + Revision *int `json:"revision,omitempty"` +} + +// Stage in pipeline +type StageReference struct { + // Attempt number of stage + Attempt *int `json:"attempt,omitempty"` + // Name of the stage. Maximum supported length for name is 256 character. + StageName *string `json:"stageName,omitempty"` +} + +// Suite create model +type SuiteCreateModel struct { + // Name of test suite. + Name *string `json:"name,omitempty"` + // For query based suites, query string that defines the suite. + QueryString *string `json:"queryString,omitempty"` + // For requirements test suites, the IDs of the requirements. + RequirementIds *[]int `json:"requirementIds,omitempty"` + // Type of test suite to create. It can have value from DynamicTestSuite, StaticTestSuite and RequirementTestSuite. + SuiteType *string `json:"suiteType,omitempty"` +} + +// A suite entry defines properties for a test suite. +type SuiteEntry struct { + // Id of child suite in the test suite. + ChildSuiteId *int `json:"childSuiteId,omitempty"` + // Sequence number for the test case or child test suite in the test suite. + SequenceNumber *int `json:"sequenceNumber,omitempty"` + // Id for the test suite. + SuiteId *int `json:"suiteId,omitempty"` + // Id of a test case in the test suite. + TestCaseId *int `json:"testCaseId,omitempty"` +} + +// A model to define sequence of test suite entries in a test suite. +type SuiteEntryUpdateModel struct { + // Id of the child suite in the test suite. + ChildSuiteId *int `json:"childSuiteId,omitempty"` + // Updated sequence number for the test case or child test suite in the test suite. + SequenceNumber *int `json:"sequenceNumber,omitempty"` + // Id of the test case in the test suite. + TestCaseId *int `json:"testCaseId,omitempty"` +} + +// [Flags] Option to get details in response +type SuiteExpand string + +type suiteExpandValuesType struct { + Children SuiteExpand + DefaultTesters SuiteExpand +} + +var SuiteExpandValues = suiteExpandValuesType{ + // Include children in response. + Children: "children", + // Include default testers in response. + DefaultTesters: "defaultTesters", +} + +// Test case for the suite. +type SuiteTestCase struct { + // Point Assignment for test suite's test case. + PointAssignments *[]PointAssignment `json:"pointAssignments,omitempty"` + // Test case workItem reference. + TestCase *WorkItemReference `json:"testCase,omitempty"` +} + +// Test suite update model. +type SuiteTestCaseUpdateModel struct { + // Shallow reference of configurations for the test cases in the suite. + Configurations *[]ShallowReference `json:"configurations,omitempty"` +} + +// Test suite update model. +type SuiteUpdateModel struct { + // Shallow reference of default configurations for the suite. + DefaultConfigurations *[]ShallowReference `json:"defaultConfigurations,omitempty"` + // Shallow reference of test suite. + DefaultTesters *[]ShallowReference `json:"defaultTesters,omitempty"` + // Specifies if the default configurations have to be inherited from the parent test suite in which the test suite is created. + InheritDefaultConfigurations *bool `json:"inheritDefaultConfigurations,omitempty"` + // Test suite name + Name *string `json:"name,omitempty"` + // Shallow reference of the parent. + Parent *ShallowReference `json:"parent,omitempty"` + // For query based suites, the new query string. + QueryString *string `json:"queryString,omitempty"` +} + +type TCMPropertyBag2 struct { + ArtifactId *int `json:"artifactId,omitempty"` + ArtifactType *int `json:"artifactType,omitempty"` + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +type TCMServiceDataMigrationStatus string + +type tcmServiceDataMigrationStatusValuesType struct { + NotStarted TCMServiceDataMigrationStatus + InProgress TCMServiceDataMigrationStatus + Completed TCMServiceDataMigrationStatus + Failed TCMServiceDataMigrationStatus +} + +var TCMServiceDataMigrationStatusValues = tcmServiceDataMigrationStatusValuesType{ + // Migration Not Started + NotStarted: "notStarted", + // Migration InProgress + InProgress: "inProgress", + // Migration Completed + Completed: "completed", + // Migration Failed + Failed: "failed", +} + +type TestActionResult struct { + ActionPath *string `json:"actionPath,omitempty"` + Comment *string `json:"comment,omitempty"` + CreationDate *azuredevops.Time `json:"creationDate,omitempty"` + DateCompleted *azuredevops.Time `json:"dateCompleted,omitempty"` + DateStarted *azuredevops.Time `json:"dateStarted,omitempty"` + Duration *uint64 `json:"duration,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` + Id *LegacyTestCaseResultIdentifier `json:"id,omitempty"` + IterationId *int `json:"iterationId,omitempty"` + LastUpdated *azuredevops.Time `json:"lastUpdated,omitempty"` + LastUpdatedBy *uuid.UUID `json:"lastUpdatedBy,omitempty"` + Outcome *byte `json:"outcome,omitempty"` + SharedStepId *int `json:"sharedStepId,omitempty"` + SharedStepRevision *int `json:"sharedStepRevision,omitempty"` +} + +type TestActionResult2 struct { + ActionPath *string `json:"actionPath,omitempty"` + Comment *string `json:"comment,omitempty"` + CreationDate *azuredevops.Time `json:"creationDate,omitempty"` + DateCompleted *azuredevops.Time `json:"dateCompleted,omitempty"` + DateStarted *azuredevops.Time `json:"dateStarted,omitempty"` + Duration *uint64 `json:"duration,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` + IterationId *int `json:"iterationId,omitempty"` + LastUpdated *azuredevops.Time `json:"lastUpdated,omitempty"` + Outcome *byte `json:"outcome,omitempty"` + SharedStepId *int `json:"sharedStepId,omitempty"` + SharedStepRevision *int `json:"sharedStepRevision,omitempty"` + TestResultId *int `json:"testResultId,omitempty"` + TestRunId *int `json:"testRunId,omitempty"` +} + +// Represents a test step result. +type TestActionResultModel struct { + // Comment in result. + Comment *string `json:"comment,omitempty"` + // Time when execution completed. + CompletedDate *azuredevops.Time `json:"completedDate,omitempty"` + // Duration of execution. + DurationInMs *float64 `json:"durationInMs,omitempty"` + // Error message in result. + ErrorMessage *string `json:"errorMessage,omitempty"` + // Test outcome of result. + Outcome *string `json:"outcome,omitempty"` + // Time when execution started. + StartedDate *azuredevops.Time `json:"startedDate,omitempty"` + // Path identifier test step in test case workitem. + ActionPath *string `json:"actionPath,omitempty"` + // Iteration ID of test action result. + IterationId *int `json:"iterationId,omitempty"` + // Reference to shared step workitem. + SharedStepModel *SharedStepModel `json:"sharedStepModel,omitempty"` + // This is step Id of test case. For shared step, it is step Id of shared step in test case workitem; step Id in shared step. Example: TestCase workitem has two steps: 1) Normal step with Id = 1 2) Shared Step with Id = 2. Inside shared step: a) Normal Step with Id = 1 Value for StepIdentifier for First step: "1" Second step: "2;1" + StepIdentifier *string `json:"stepIdentifier,omitempty"` + // Url of test action result. + Url *string `json:"url,omitempty"` +} + +type TestAttachment struct { + // Attachment type. + AttachmentType *AttachmentType `json:"attachmentType,omitempty"` + // Comment associated with attachment. + Comment *string `json:"comment,omitempty"` + // Attachment created date. + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + // Attachment file name + FileName *string `json:"fileName,omitempty"` + // ID of the attachment. + Id *int `json:"id,omitempty"` + // Attachment size. + Size *uint64 `json:"size,omitempty"` + // Attachment Url. + Url *string `json:"url,omitempty"` +} + +// Reference to test attachment. +type TestAttachmentReference struct { + // ID of the attachment. + Id *int `json:"id,omitempty"` + // Url to download the attachment. + Url *string `json:"url,omitempty"` +} + +// Test attachment request model +type TestAttachmentRequestModel struct { + // Attachment type By Default it will be GeneralAttachment. It can be one of the following type. { GeneralAttachment, AfnStrip, BugFilingData, CodeCoverage, IntermediateCollectorData, RunConfig, TestImpactDetails, TmiTestRunDeploymentFiles, TmiTestRunReverseDeploymentFiles, TmiTestResultDetail, TmiTestRunSummary } + AttachmentType *string `json:"attachmentType,omitempty"` + // Comment associated with attachment + Comment *string `json:"comment,omitempty"` + // Attachment filename + FileName *string `json:"fileName,omitempty"` + // Base64 encoded file stream + Stream *string `json:"stream,omitempty"` +} + +type TestAuthoringDetails struct { + ConfigurationId *int `json:"configurationId,omitempty"` + IsAutomated *bool `json:"isAutomated,omitempty"` + LastUpdated *azuredevops.Time `json:"lastUpdated,omitempty"` + PointId *int `json:"pointId,omitempty"` + Priority *byte `json:"priority,omitempty"` + RunBy *uuid.UUID `json:"runBy,omitempty"` + State *TestPointState `json:"state,omitempty"` + SuiteId *int `json:"suiteId,omitempty"` + TesterId *uuid.UUID `json:"testerId,omitempty"` +} + +type TestCaseMetadata2 struct { + Container *string `json:"container,omitempty"` + Name *string `json:"name,omitempty"` + ProjectId *uuid.UUID `json:"projectId,omitempty"` + TestMetadataId *int `json:"testMetadataId,omitempty"` +} + +type TestCaseReference2 struct { + AreaId *int `json:"areaId,omitempty"` + AutomatedTestId *string `json:"automatedTestId,omitempty"` + AutomatedTestName *string `json:"automatedTestName,omitempty"` + AutomatedTestNameHash *[]byte `json:"automatedTestNameHash,omitempty"` + AutomatedTestStorage *string `json:"automatedTestStorage,omitempty"` + AutomatedTestStorageHash *[]byte `json:"automatedTestStorageHash,omitempty"` + AutomatedTestType *string `json:"automatedTestType,omitempty"` + ConfigurationId *int `json:"configurationId,omitempty"` + CreatedBy *uuid.UUID `json:"createdBy,omitempty"` + CreationDate *azuredevops.Time `json:"creationDate,omitempty"` + LastRefTestRunDate *azuredevops.Time `json:"lastRefTestRunDate,omitempty"` + Owner *string `json:"owner,omitempty"` + Priority *byte `json:"priority,omitempty"` + ProjectId *uuid.UUID `json:"projectId,omitempty"` + TestCaseId *int `json:"testCaseId,omitempty"` + TestCaseRefId *int `json:"testCaseRefId,omitempty"` + TestCaseRevision *int `json:"testCaseRevision,omitempty"` + TestCaseTitle *string `json:"testCaseTitle,omitempty"` + TestPointId *int `json:"testPointId,omitempty"` +} + +// Represents a test result. +type TestCaseResult struct { + // Test attachment ID of action recording. + AfnStripId *int `json:"afnStripId,omitempty"` + // Reference to area path of test. + Area *ShallowReference `json:"area,omitempty"` + // Reference to bugs linked to test result. + AssociatedBugs *[]ShallowReference `json:"associatedBugs,omitempty"` + // ID representing test method in a dll. + AutomatedTestId *string `json:"automatedTestId,omitempty"` + // Fully qualified name of test executed. + AutomatedTestName *string `json:"automatedTestName,omitempty"` + // Container to which test belongs. + AutomatedTestStorage *string `json:"automatedTestStorage,omitempty"` + // Type of automated test. + AutomatedTestType *string `json:"automatedTestType,omitempty"` + // TypeId of automated test. + AutomatedTestTypeId *string `json:"automatedTestTypeId,omitempty"` + // Shallow reference to build associated with test result. + Build *ShallowReference `json:"build,omitempty"` + // Reference to build associated with test result. + BuildReference *BuildReference `json:"buildReference,omitempty"` + // Comment in a test result with maxSize= 1000 chars. + Comment *string `json:"comment,omitempty"` + // Time when test execution completed. Completed date should be greater than StartedDate. + CompletedDate *azuredevops.Time `json:"completedDate,omitempty"` + // Machine name where test executed. + ComputerName *string `json:"computerName,omitempty"` + // Reference to test configuration. Type ShallowReference. + Configuration *ShallowReference `json:"configuration,omitempty"` + // Timestamp when test result created. + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + // Additional properties of test result. + CustomFields *[]CustomTestField `json:"customFields,omitempty"` + // Duration of test execution in milliseconds. If not provided value will be set as CompletedDate - StartedDate + DurationInMs *float64 `json:"durationInMs,omitempty"` + // Error message in test execution. + ErrorMessage *string `json:"errorMessage,omitempty"` + // Information when test results started failing. + FailingSince *FailingSince `json:"failingSince,omitempty"` + // Failure type of test result. Valid Value= (Known Issue, New Issue, Regression, Unknown, None) + FailureType *string `json:"failureType,omitempty"` + // ID of a test result. + Id *int `json:"id,omitempty"` + // Test result details of test iterations used only for Manual Testing. + IterationDetails *[]TestIterationDetailsModel `json:"iterationDetails,omitempty"` + // Reference to identity last updated test result. + LastUpdatedBy *webapi.IdentityRef `json:"lastUpdatedBy,omitempty"` + // Last updated datetime of test result. + LastUpdatedDate *azuredevops.Time `json:"lastUpdatedDate,omitempty"` + // Test outcome of test result. Valid values = (Unspecified, None, Passed, Failed, Inconclusive, Timeout, Aborted, Blocked, NotExecuted, Warning, Error, NotApplicable, Paused, InProgress, NotImpacted) + Outcome *string `json:"outcome,omitempty"` + // Reference to test owner. + Owner *webapi.IdentityRef `json:"owner,omitempty"` + // Priority of test executed. + Priority *int `json:"priority,omitempty"` + // Reference to team project. + Project *ShallowReference `json:"project,omitempty"` + // Shallow reference to release associated with test result. + Release *ShallowReference `json:"release,omitempty"` + // Reference to release associated with test result. + ReleaseReference *ReleaseReference `json:"releaseReference,omitempty"` + // ResetCount. + ResetCount *int `json:"resetCount,omitempty"` + // Resolution state of test result. + ResolutionState *string `json:"resolutionState,omitempty"` + // ID of resolution state. + ResolutionStateId *int `json:"resolutionStateId,omitempty"` + // Hierarchy type of the result, default value of None means its leaf node. + ResultGroupType *ResultGroupType `json:"resultGroupType,omitempty"` + // Revision number of test result. + Revision *int `json:"revision,omitempty"` + // Reference to identity executed the test. + RunBy *webapi.IdentityRef `json:"runBy,omitempty"` + // Stacktrace with maxSize= 1000 chars. + StackTrace *string `json:"stackTrace,omitempty"` + // Time when test execution started. + StartedDate *azuredevops.Time `json:"startedDate,omitempty"` + // State of test result. Type TestRunState. + State *string `json:"state,omitempty"` + // List of sub results inside a test result, if ResultGroupType is not None, it holds corresponding type sub results. + SubResults *[]TestSubResult `json:"subResults,omitempty"` + // Reference to the test executed. + TestCase *ShallowReference `json:"testCase,omitempty"` + // Reference ID of test used by test result. Type TestResultMetaData + TestCaseReferenceId *int `json:"testCaseReferenceId,omitempty"` + // TestCaseRevision Number. + TestCaseRevision *int `json:"testCaseRevision,omitempty"` + // Name of test. + TestCaseTitle *string `json:"testCaseTitle,omitempty"` + // Reference to test plan test case workitem is part of. + TestPlan *ShallowReference `json:"testPlan,omitempty"` + // Reference to the test point executed. + TestPoint *ShallowReference `json:"testPoint,omitempty"` + // Reference to test run. + TestRun *ShallowReference `json:"testRun,omitempty"` + // Reference to test suite test case workitem is part of. + TestSuite *ShallowReference `json:"testSuite,omitempty"` + // Url of test result. + Url *string `json:"url,omitempty"` +} + +// Test attachment information in a test iteration. +type TestCaseResultAttachmentModel struct { + // Path identifier test step in test case workitem. + ActionPath *string `json:"actionPath,omitempty"` + // Attachment ID. + Id *int `json:"id,omitempty"` + // Iteration ID. + IterationId *int `json:"iterationId,omitempty"` + // Name of attachment. + Name *string `json:"name,omitempty"` + // Attachment size. + Size *uint64 `json:"size,omitempty"` + // Url to attachment. + Url *string `json:"url,omitempty"` +} + +type TestCaseResultIdAndRev struct { + Id *LegacyTestCaseResultIdentifier `json:"id,omitempty"` + Revision *int `json:"revision,omitempty"` +} + +// Reference to a test result. +type TestCaseResultIdentifier struct { + // Test result ID. + TestResultId *int `json:"testResultId,omitempty"` + // Test run ID. + TestRunId *int `json:"testRunId,omitempty"` +} + +type TestCaseResultUpdateModel struct { + AssociatedWorkItems *[]int `json:"associatedWorkItems,omitempty"` + AutomatedTestTypeId *string `json:"automatedTestTypeId,omitempty"` + Comment *string `json:"comment,omitempty"` + CompletedDate *string `json:"completedDate,omitempty"` + ComputerName *string `json:"computerName,omitempty"` + CustomFields *[]CustomTestField `json:"customFields,omitempty"` + DurationInMs *string `json:"durationInMs,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` + FailureType *string `json:"failureType,omitempty"` + Outcome *string `json:"outcome,omitempty"` + Owner *webapi.IdentityRef `json:"owner,omitempty"` + ResolutionState *string `json:"resolutionState,omitempty"` + RunBy *webapi.IdentityRef `json:"runBy,omitempty"` + StackTrace *string `json:"stackTrace,omitempty"` + StartedDate *string `json:"startedDate,omitempty"` + State *string `json:"state,omitempty"` + TestCasePriority *string `json:"testCasePriority,omitempty"` + TestResult *ShallowReference `json:"testResult,omitempty"` +} + +// Test configuration +type TestConfiguration struct { + // Area of the configuration + Area *ShallowReference `json:"area,omitempty"` + // Description of the configuration + Description *string `json:"description,omitempty"` + // Id of the configuration + Id *int `json:"id,omitempty"` + // Is the configuration a default for the test plans + IsDefault *bool `json:"isDefault,omitempty"` + // Last Updated By Reference + LastUpdatedBy *webapi.IdentityRef `json:"lastUpdatedBy,omitempty"` + // Last Updated Data + LastUpdatedDate *azuredevops.Time `json:"lastUpdatedDate,omitempty"` + // Name of the configuration + Name *string `json:"name,omitempty"` + // Project to which the configuration belongs + Project *ShallowReference `json:"project,omitempty"` + // Revision of the the configuration + Revision *int `json:"revision,omitempty"` + // State of the configuration + State *TestConfigurationState `json:"state,omitempty"` + // Url of Configuration Resource + Url *string `json:"url,omitempty"` + // Dictionary of Test Variable, Selected Value + Values *[]NameValuePair `json:"values,omitempty"` +} + +// Represents the state of an ITestConfiguration object. +type TestConfigurationState string + +type testConfigurationStateValuesType struct { + Active TestConfigurationState + Inactive TestConfigurationState +} + +var TestConfigurationStateValues = testConfigurationStateValuesType{ + // The configuration can be used for new test runs. + Active: "active", + // The configuration has been retired and should not be used for new test runs. + Inactive: "inactive", +} + +type TestExecutionReportData struct { + ReportData *[]DatedTestFieldData `json:"reportData,omitempty"` +} + +type TestExtensionField struct { + Field *TestExtensionFieldDetails `json:"field,omitempty"` + Value interface{} `json:"value,omitempty"` +} + +type TestExtensionFieldDetails struct { + Id *int `json:"id,omitempty"` + IsResultScoped *bool `json:"isResultScoped,omitempty"` + IsRunScoped *bool `json:"isRunScoped,omitempty"` + IsSystemField *bool `json:"isSystemField,omitempty"` + Name *string `json:"name,omitempty"` + Type *system.SqlDbType `json:"type,omitempty"` +} + +type TestFailureDetails struct { + Count *int `json:"count,omitempty"` + TestResults *[]TestCaseResultIdentifier `json:"testResults,omitempty"` +} + +type TestFailuresAnalysis struct { + ExistingFailures *TestFailureDetails `json:"existingFailures,omitempty"` + FixedTests *TestFailureDetails `json:"fixedTests,omitempty"` + NewFailures *TestFailureDetails `json:"newFailures,omitempty"` + PreviousContext *TestResultsContext `json:"previousContext,omitempty"` +} + +type TestFailureType struct { + Id *int `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Project *ShallowReference `json:"project,omitempty"` +} + +type TestFieldData struct { + Dimensions *map[string]interface{} `json:"dimensions,omitempty"` + Measure *uint64 `json:"measure,omitempty"` +} + +type TestFieldsEx2 struct { + FieldId *int `json:"fieldId,omitempty"` + FieldName *string `json:"fieldName,omitempty"` + FieldType *byte `json:"fieldType,omitempty"` + IsResultScoped *bool `json:"isResultScoped,omitempty"` + IsRunScoped *bool `json:"isRunScoped,omitempty"` + IsSystemField *bool `json:"isSystemField,omitempty"` + ProjectId *uuid.UUID `json:"projectId,omitempty"` +} + +// Test Flaky Identifier +type TestFlakyIdentifier struct { + // Branch Name where Flakiness has to be Marked/Unmarked + BranchName *string `json:"branchName,omitempty"` + // State for Flakiness + IsFlaky *bool `json:"isFlaky,omitempty"` +} + +// Filter to get TestCase result history. +type TestHistoryQuery struct { + // Automated test name of the TestCase. + AutomatedTestName *string `json:"automatedTestName,omitempty"` + // Results to be get for a particular branches. + Branch *string `json:"branch,omitempty"` + // Get the results history only for this BuildDefinitionId. This to get used in query GroupBy should be Branch. If this is provided, Branch will have no use. + BuildDefinitionId *int `json:"buildDefinitionId,omitempty"` + // It will be filled by server. If not null means there are some results still to be get, and we need to call this REST API with this ContinuousToken. It is not supposed to be created (or altered, if received from server in last batch) by user. + ContinuationToken *string `json:"continuationToken,omitempty"` + // Group the result on the basis of TestResultGroupBy. This can be Branch, Environment or null(if results are fetched by BuildDefinitionId) + GroupBy *TestResultGroupBy `json:"groupBy,omitempty"` + // History to get between time interval MaxCompleteDate and (MaxCompleteDate - TrendDays). Default is current date time. + MaxCompleteDate *azuredevops.Time `json:"maxCompleteDate,omitempty"` + // Get the results history only for this ReleaseEnvDefinitionId. This to get used in query GroupBy should be Environment. + ReleaseEnvDefinitionId *int `json:"releaseEnvDefinitionId,omitempty"` + // List of TestResultHistoryForGroup which are grouped by GroupBy + ResultsForGroup *[]TestResultHistoryForGroup `json:"resultsForGroup,omitempty"` + // Get the results history only for this testCaseId. This to get used in query to filter the result along with automatedtestname + TestCaseId *int `json:"testCaseId,omitempty"` + // Number of days for which history to collect. Maximum supported value is 7 days. Default is 7 days. + TrendDays *int `json:"trendDays,omitempty"` +} + +// Represents a test iteration result. +type TestIterationDetailsModel struct { + // Test step results in an iteration. + ActionResults *[]TestActionResultModel `json:"actionResults,omitempty"` + // Reference to attachments in test iteration result. + Attachments *[]TestCaseResultAttachmentModel `json:"attachments,omitempty"` + // Comment in test iteration result. + Comment *string `json:"comment,omitempty"` + // Time when execution completed. + CompletedDate *azuredevops.Time `json:"completedDate,omitempty"` + // Duration of execution. + DurationInMs *float64 `json:"durationInMs,omitempty"` + // Error message in test iteration result execution. + ErrorMessage *string `json:"errorMessage,omitempty"` + // ID of test iteration result. + Id *int `json:"id,omitempty"` + // Test outcome if test iteration result. + Outcome *string `json:"outcome,omitempty"` + // Test parameters in an iteration. + Parameters *[]TestResultParameterModel `json:"parameters,omitempty"` + // Time when execution started. + StartedDate *azuredevops.Time `json:"startedDate,omitempty"` + // Url to test iteration result. + Url *string `json:"url,omitempty"` +} + +// Represents Test Log Result object. +type TestLog struct { + // Test Log Context run, build + LogReference *TestLogReference `json:"logReference,omitempty"` + MetaData *map[string]string `json:"metaData,omitempty"` + // LastUpdatedDate for Log file + ModifiedOn *azuredevops.Time `json:"modifiedOn,omitempty"` + // Size in Bytes for Log file + Size *uint64 `json:"size,omitempty"` +} + +type TestLogReference struct { + // BuildId for test log, if context is build + BuildId *int `json:"buildId,omitempty"` + // FileName for log file + FilePath *string `json:"filePath,omitempty"` + // ReleaseEnvId for test log, if context is Release + ReleaseEnvId *int `json:"releaseEnvId,omitempty"` + // ReleaseId for test log, if context is Release + ReleaseId *int `json:"releaseId,omitempty"` + // Resultid for test log, if context is run and log is related to result + ResultId *int `json:"resultId,omitempty"` + // runid for test log, if context is run + RunId *int `json:"runId,omitempty"` + // Test Log Reference object + Scope *TestLogScope `json:"scope,omitempty"` + // SubResultid for test log, if context is run and log is related to subresult + SubResultId *int `json:"subResultId,omitempty"` + // Log Type + Type *TestLogType `json:"type,omitempty"` +} + +// Test Log Context +type TestLogScope string + +type testLogScopeValuesType struct { + Run TestLogScope + Build TestLogScope + Release TestLogScope +} + +var TestLogScopeValues = testLogScopeValuesType{ + // Log file is associated with Run, result, subresult + Run: "run", + // Log File associated with Build + Build: "build", + // Log File associated with Release + Release: "release", +} + +// Represents Test Log Status object. +type TestLogStatus struct { + // Exception message + Exception *string `json:"exception,omitempty"` + // Test Log Status code + Status *TestLogStatusCode `json:"status,omitempty"` + // Blob Transfer Error code + TransferFailureType *string `json:"transferFailureType,omitempty"` +} + +// Test Log Status codes. +type TestLogStatusCode string + +type testLogStatusCodeValuesType struct { + Success TestLogStatusCode + Failed TestLogStatusCode + FileAlreadyExists TestLogStatusCode + InvalidInput TestLogStatusCode + InvalidFileName TestLogStatusCode + InvalidContainer TestLogStatusCode + TransferFailed TestLogStatusCode + FeatureDisabled TestLogStatusCode + BuildDoesNotExist TestLogStatusCode + RunDoesNotExist TestLogStatusCode + ContainerNotCreated TestLogStatusCode + ApiNotSupported TestLogStatusCode + FileSizeExceeds TestLogStatusCode + ContainerNotFound TestLogStatusCode + FileNotFound TestLogStatusCode + DirectoryNotFound TestLogStatusCode +} + +var TestLogStatusCodeValues = testLogStatusCodeValuesType{ + Success: "success", + Failed: "failed", + FileAlreadyExists: "fileAlreadyExists", + InvalidInput: "invalidInput", + InvalidFileName: "invalidFileName", + InvalidContainer: "invalidContainer", + TransferFailed: "transferFailed", + FeatureDisabled: "featureDisabled", + BuildDoesNotExist: "buildDoesNotExist", + RunDoesNotExist: "runDoesNotExist", + ContainerNotCreated: "containerNotCreated", + ApiNotSupported: "apiNotSupported", + FileSizeExceeds: "fileSizeExceeds", + ContainerNotFound: "containerNotFound", + FileNotFound: "fileNotFound", + DirectoryNotFound: "directoryNotFound", +} + +// Represents Test Log store endpoint details. +type TestLogStoreEndpointDetails struct { + // Test log store connection Uri. + EndpointSASUri *string `json:"endpointSASUri,omitempty"` + // Test log store endpoint type. + EndpointType *TestLogStoreEndpointType `json:"endpointType,omitempty"` + // Test log store status code + Status *TestLogStatusCode `json:"status,omitempty"` +} + +type TestLogStoreEndpointType string + +type testLogStoreEndpointTypeValuesType struct { + Root TestLogStoreEndpointType + File TestLogStoreEndpointType +} + +var TestLogStoreEndpointTypeValues = testLogStoreEndpointTypeValuesType{ + Root: "root", + File: "file", +} + +type TestLogStoreOperationType string + +type testLogStoreOperationTypeValuesType struct { + Read TestLogStoreOperationType + Create TestLogStoreOperationType + ReadAndCreate TestLogStoreOperationType +} + +var TestLogStoreOperationTypeValues = testLogStoreOperationTypeValuesType{ + Read: "read", + Create: "create", + ReadAndCreate: "readAndCreate", +} + +// Test Log Types +type TestLogType string + +type testLogTypeValuesType struct { + GeneralAttachment TestLogType + CodeCoverage TestLogType + TestImpact TestLogType + Intermediate TestLogType +} + +var TestLogTypeValues = testLogTypeValuesType{ + // Any gereric attachment. + GeneralAttachment: "generalAttachment", + // Code Coverage files + CodeCoverage: "codeCoverage", + // Test Impact details. + TestImpact: "testImpact", + // Temporary files + Intermediate: "intermediate", +} + +type TestMessageLog2 struct { + TestMessageLogId *int `json:"testMessageLogId,omitempty"` +} + +// An abstracted reference to some other resource. This class is used to provide the build data contracts with a uniform way to reference other resources in a way that provides easy traversal through links. +type TestMessageLogDetails struct { + // Date when the resource is created + DateCreated *azuredevops.Time `json:"dateCreated,omitempty"` + // Id of the resource + EntryId *int `json:"entryId,omitempty"` + // Message of the resource + Message *string `json:"message,omitempty"` +} + +type TestMessageLogEntry struct { + DateCreated *azuredevops.Time `json:"dateCreated,omitempty"` + EntryId *int `json:"entryId,omitempty"` + LogLevel *byte `json:"logLevel,omitempty"` + LogUser *uuid.UUID `json:"logUser,omitempty"` + LogUserName *string `json:"logUserName,omitempty"` + Message *string `json:"message,omitempty"` + TestMessageLogId *int `json:"testMessageLogId,omitempty"` +} + +type TestMessageLogEntry2 struct { + DateCreated *azuredevops.Time `json:"dateCreated,omitempty"` + EntryId *int `json:"entryId,omitempty"` + LogLevel *byte `json:"logLevel,omitempty"` + LogUser *uuid.UUID `json:"logUser,omitempty"` + Message *string `json:"message,omitempty"` + TestMessageLogId *int `json:"testMessageLogId,omitempty"` +} + +type TestMethod struct { + Container *string `json:"container,omitempty"` + Name *string `json:"name,omitempty"` +} + +// Class representing a reference to an operation. +type TestOperationReference struct { + Id *string `json:"id,omitempty"` + Status *string `json:"status,omitempty"` + Url *string `json:"url,omitempty"` +} + +// Valid TestOutcome values. +type TestOutcome string + +type testOutcomeValuesType struct { + Unspecified TestOutcome + None TestOutcome + Passed TestOutcome + Failed TestOutcome + Inconclusive TestOutcome + Timeout TestOutcome + Aborted TestOutcome + Blocked TestOutcome + NotExecuted TestOutcome + Warning TestOutcome + Error TestOutcome + NotApplicable TestOutcome + Paused TestOutcome + InProgress TestOutcome + NotImpacted TestOutcome +} + +var TestOutcomeValues = testOutcomeValuesType{ + // Only used during an update to preserve the existing value. + Unspecified: "unspecified", + // Test has not been completed, or the test type does not report pass/failure. + None: "none", + // Test was executed w/o any issues. + Passed: "passed", + // Test was executed, but there were issues. Issues may involve exceptions or failed assertions. + Failed: "failed", + // Test has completed, but we can't say if it passed or failed. May be used for aborted tests... + Inconclusive: "inconclusive", + // The test timed out + Timeout: "timeout", + // Test was aborted. This was not caused by a user gesture, but rather by a framework decision. + Aborted: "aborted", + // Test had it chance for been executed but was not, as ITestElement.IsRunnable == false. + Blocked: "blocked", + // Test was not executed. This was caused by a user gesture - e.g. user hit stop button. + NotExecuted: "notExecuted", + // To be used by Run level results. This is not a failure. + Warning: "warning", + // There was a system error while we were trying to execute a test. + Error: "error", + // Test is Not Applicable for execution. + NotApplicable: "notApplicable", + // Test is paused. + Paused: "paused", + // Test is currently executing. Added this for TCM charts + InProgress: "inProgress", + // Test is not impacted. Added fot TIA. + NotImpacted: "notImpacted", +} + +// Test outcome settings +type TestOutcomeSettings struct { + // Value to configure how test outcomes for the same tests across suites are shown + SyncOutcomeAcrossSuites *bool `json:"syncOutcomeAcrossSuites,omitempty"` +} + +type TestParameter2 struct { + ActionPath *string `json:"actionPath,omitempty"` + Actual *[]byte `json:"actual,omitempty"` + CreationDate *azuredevops.Time `json:"creationDate,omitempty"` + DataType *byte `json:"dataType,omitempty"` + DateModified *azuredevops.Time `json:"dateModified,omitempty"` + Expected *[]byte `json:"expected,omitempty"` + IterationId *int `json:"iterationId,omitempty"` + ParameterName *string `json:"parameterName,omitempty"` + TestResultId *int `json:"testResultId,omitempty"` + TestRunId *int `json:"testRunId,omitempty"` +} + +// The test plan resource. +type TestPlan struct { + // Area of the test plan. + Area *ShallowReference `json:"area,omitempty"` + // Build to be tested. + Build *ShallowReference `json:"build,omitempty"` + // The Build Definition that generates a build associated with this test plan. + BuildDefinition *ShallowReference `json:"buildDefinition,omitempty"` + // Description of the test plan. + Description *string `json:"description,omitempty"` + // End date for the test plan. + EndDate *azuredevops.Time `json:"endDate,omitempty"` + // ID of the test plan. + Id *int `json:"id,omitempty"` + // Iteration path of the test plan. + Iteration *string `json:"iteration,omitempty"` + // Name of the test plan. + Name *string `json:"name,omitempty"` + // Owner of the test plan. + Owner *webapi.IdentityRef `json:"owner,omitempty"` + PreviousBuild *ShallowReference `json:"previousBuild,omitempty"` + // Project which contains the test plan. + Project *ShallowReference `json:"project,omitempty"` + // Release Environment to be used to deploy the build and run automated tests from this test plan. + ReleaseEnvironmentDefinition *ReleaseEnvironmentDefinitionReference `json:"releaseEnvironmentDefinition,omitempty"` + // Revision of the test plan. + Revision *int `json:"revision,omitempty"` + // Root test suite of the test plan. + RootSuite *ShallowReference `json:"rootSuite,omitempty"` + // Start date for the test plan. + StartDate *azuredevops.Time `json:"startDate,omitempty"` + // State of the test plan. + State *string `json:"state,omitempty"` + // Value to configure how same tests across test suites under a test plan need to behave + TestOutcomeSettings *TestOutcomeSettings `json:"testOutcomeSettings,omitempty"` + UpdatedBy *webapi.IdentityRef `json:"updatedBy,omitempty"` + UpdatedDate *azuredevops.Time `json:"updatedDate,omitempty"` + // URL of the test plan resource. + Url *string `json:"url,omitempty"` +} + +type TestPlanCloneRequest struct { + DestinationTestPlan *TestPlan `json:"destinationTestPlan,omitempty"` + Options *CloneOptions `json:"options,omitempty"` + SuiteIds *[]int `json:"suiteIds,omitempty"` +} + +type TestPlanHubData struct { + SelectedSuiteId *int `json:"selectedSuiteId,omitempty"` + TestPlan *TestPlan `json:"testPlan,omitempty"` + TestPoints *[]TestPoint `json:"testPoints,omitempty"` + TestSuites *[]TestSuite `json:"testSuites,omitempty"` + TotalTestPoints *int `json:"totalTestPoints,omitempty"` +} + +type TestPlansWithSelection struct { + LastSelectedPlan *int `json:"lastSelectedPlan,omitempty"` + LastSelectedSuite *int `json:"lastSelectedSuite,omitempty"` + Plans *[]TestPlan `json:"plans,omitempty"` +} + +// Test point. +type TestPoint struct { + // AssignedTo. Type IdentityRef. + AssignedTo *webapi.IdentityRef `json:"assignedTo,omitempty"` + // Automated. + Automated *bool `json:"automated,omitempty"` + // Comment associated with test point. + Comment *string `json:"comment,omitempty"` + // Configuration. Type ShallowReference. + Configuration *ShallowReference `json:"configuration,omitempty"` + // Failure type of test point. + FailureType *string `json:"failureType,omitempty"` + // ID of the test point. + Id *int `json:"id,omitempty"` + // Last date when test point was reset to Active. + LastResetToActive *azuredevops.Time `json:"lastResetToActive,omitempty"` + // Last resolution state id of test point. + LastResolutionStateId *int `json:"lastResolutionStateId,omitempty"` + // Last result of test point. Type ShallowReference. + LastResult *ShallowReference `json:"lastResult,omitempty"` + // Last result details of test point. Type LastResultDetails. + LastResultDetails *LastResultDetails `json:"lastResultDetails,omitempty"` + // Last result state of test point. + LastResultState *string `json:"lastResultState,omitempty"` + // LastRun build number of test point. + LastRunBuildNumber *string `json:"lastRunBuildNumber,omitempty"` + // Last testRun of test point. Type ShallowReference. + LastTestRun *ShallowReference `json:"lastTestRun,omitempty"` + // Test point last updated by. Type IdentityRef. + LastUpdatedBy *webapi.IdentityRef `json:"lastUpdatedBy,omitempty"` + // Last updated date of test point. + LastUpdatedDate *azuredevops.Time `json:"lastUpdatedDate,omitempty"` + // Outcome of test point. + Outcome *string `json:"outcome,omitempty"` + // Revision number. + Revision *int `json:"revision,omitempty"` + // State of test point. + State *string `json:"state,omitempty"` + // Suite of test point. Type ShallowReference. + Suite *ShallowReference `json:"suite,omitempty"` + // TestCase associated to test point. Type WorkItemReference. + TestCase *WorkItemReference `json:"testCase,omitempty"` + // TestPlan of test point. Type ShallowReference. + TestPlan *ShallowReference `json:"testPlan,omitempty"` + // Test point Url. + Url *string `json:"url,omitempty"` + // Work item properties of test point. + WorkItemProperties *[]interface{} `json:"workItemProperties,omitempty"` +} + +type TestPointReference struct { + Id *int `json:"id,omitempty"` + State *TestPointState `json:"state,omitempty"` +} + +type TestPointsEvent struct { + ProjectName *string `json:"projectName,omitempty"` + TestPoints *[]TestPointReference `json:"testPoints,omitempty"` +} + +// Test point query class. +type TestPointsQuery struct { + // Order by results. + OrderBy *string `json:"orderBy,omitempty"` + // List of test points + Points *[]TestPoint `json:"points,omitempty"` + // Filter + PointsFilter *PointsFilter `json:"pointsFilter,omitempty"` + // List of workitem fields to get. + WitFields *[]string `json:"witFields,omitempty"` +} + +type TestPointState string + +type testPointStateValuesType struct { + None TestPointState + Ready TestPointState + Completed TestPointState + NotReady TestPointState + InProgress TestPointState + MaxValue TestPointState +} + +var TestPointStateValues = testPointStateValuesType{ + // Default + None: "none", + // The test point needs to be executed in order for the test pass to be considered complete. Either the test has not been run before or the previous run failed. + Ready: "ready", + // The test has passed successfully and does not need to be re-run for the test pass to be considered complete. + Completed: "completed", + // The test point needs to be executed but is not able to. + NotReady: "notReady", + // The test is being executed. + InProgress: "inProgress", + MaxValue: "maxValue", +} + +type TestPointsUpdatedEvent struct { + ProjectName *string `json:"projectName,omitempty"` + TestPoints *[]TestPointReference `json:"testPoints,omitempty"` +} + +// Test Resolution State Details. +type TestResolutionState struct { + // Test Resolution state Id. + Id *int `json:"id,omitempty"` + // Test Resolution State Name. + Name *string `json:"name,omitempty"` + Project *ShallowReference `json:"project,omitempty"` +} + +type TestResult2 struct { + AfnStripId *int `json:"afnStripId,omitempty"` + ComputerName *string `json:"computerName,omitempty"` + CreationDate *azuredevops.Time `json:"creationDate,omitempty"` + DateCompleted *azuredevops.Time `json:"dateCompleted,omitempty"` + DateStarted *azuredevops.Time `json:"dateStarted,omitempty"` + EffectivePointState *byte `json:"effectivePointState,omitempty"` + FailureType *byte `json:"failureType,omitempty"` + LastUpdated *azuredevops.Time `json:"lastUpdated,omitempty"` + LastUpdatedBy *uuid.UUID `json:"lastUpdatedBy,omitempty"` + Outcome *byte `json:"outcome,omitempty"` + Owner *uuid.UUID `json:"owner,omitempty"` + ProjectId *uuid.UUID `json:"projectId,omitempty"` + ResetCount *int `json:"resetCount,omitempty"` + ResolutionStateId *int `json:"resolutionStateId,omitempty"` + Revision *int `json:"revision,omitempty"` + RunBy *uuid.UUID `json:"runBy,omitempty"` + State *byte `json:"state,omitempty"` + TestCaseRefId *int `json:"testCaseRefId,omitempty"` + TestResultId *int `json:"testResultId,omitempty"` + TestRunId *int `json:"testRunId,omitempty"` +} + +type TestResultAcrossProjectResponse struct { + ProjectName *string `json:"projectName,omitempty"` + TestResult *LegacyTestCaseResult `json:"testResult,omitempty"` +} + +type TestResultAttachment struct { + ActionPath *string `json:"actionPath,omitempty"` + AttachmentType *AttachmentType `json:"attachmentType,omitempty"` + Comment *string `json:"comment,omitempty"` + CreationDate *azuredevops.Time `json:"creationDate,omitempty"` + DownloadQueryString *string `json:"downloadQueryString,omitempty"` + FileName *string `json:"fileName,omitempty"` + Id *int `json:"id,omitempty"` + IsComplete *bool `json:"isComplete,omitempty"` + IterationId *int `json:"iterationId,omitempty"` + Length *uint64 `json:"length,omitempty"` + SessionId *int `json:"sessionId,omitempty"` + TestResultId *int `json:"testResultId,omitempty"` + TestRunId *int `json:"testRunId,omitempty"` + TmiRunId *uuid.UUID `json:"tmiRunId,omitempty"` +} + +type TestResultAttachmentIdentity struct { + AttachmentId *int `json:"attachmentId,omitempty"` + SessionId *int `json:"sessionId,omitempty"` + TestResultId *int `json:"testResultId,omitempty"` + TestRunId *int `json:"testRunId,omitempty"` +} + +type TestResultCreateModel struct { + Area *ShallowReference `json:"area,omitempty"` + AssociatedWorkItems *[]int `json:"associatedWorkItems,omitempty"` + AutomatedTestId *string `json:"automatedTestId,omitempty"` + AutomatedTestName *string `json:"automatedTestName,omitempty"` + AutomatedTestStorage *string `json:"automatedTestStorage,omitempty"` + AutomatedTestType *string `json:"automatedTestType,omitempty"` + AutomatedTestTypeId *string `json:"automatedTestTypeId,omitempty"` + Comment *string `json:"comment,omitempty"` + CompletedDate *string `json:"completedDate,omitempty"` + ComputerName *string `json:"computerName,omitempty"` + Configuration *ShallowReference `json:"configuration,omitempty"` + CustomFields *[]CustomTestField `json:"customFields,omitempty"` + DurationInMs *string `json:"durationInMs,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` + FailureType *string `json:"failureType,omitempty"` + Outcome *string `json:"outcome,omitempty"` + Owner *webapi.IdentityRef `json:"owner,omitempty"` + ResolutionState *string `json:"resolutionState,omitempty"` + RunBy *webapi.IdentityRef `json:"runBy,omitempty"` + StackTrace *string `json:"stackTrace,omitempty"` + StartedDate *string `json:"startedDate,omitempty"` + State *string `json:"state,omitempty"` + TestCase *ShallowReference `json:"testCase,omitempty"` + TestCasePriority *string `json:"testCasePriority,omitempty"` + TestCaseTitle *string `json:"testCaseTitle,omitempty"` + TestPoint *ShallowReference `json:"testPoint,omitempty"` +} + +type TestResultDocument struct { + OperationReference *TestOperationReference `json:"operationReference,omitempty"` + Payload *TestResultPayload `json:"payload,omitempty"` +} + +// Group by for results +type TestResultGroupBy string + +type testResultGroupByValuesType struct { + Branch TestResultGroupBy + Environment TestResultGroupBy +} + +var TestResultGroupByValues = testResultGroupByValuesType{ + // Group the results by branches + Branch: "branch", + // Group the results by environment + Environment: "environment", +} + +type TestResultHistory struct { + GroupByField *string `json:"groupByField,omitempty"` + ResultsForGroup *[]TestResultHistoryDetailsForGroup `json:"resultsForGroup,omitempty"` +} + +type TestResultHistoryDetailsForGroup struct { + GroupByValue interface{} `json:"groupByValue,omitempty"` + LatestResult *TestCaseResult `json:"latestResult,omitempty"` +} + +// List of test results filtered on the basis of GroupByValue +type TestResultHistoryForGroup struct { + // Display name of the group. + DisplayName *string `json:"displayName,omitempty"` + // Name or Id of the group identifier by which results are grouped together. + GroupByValue *string `json:"groupByValue,omitempty"` + // List of results for GroupByValue + Results *[]TestCaseResult `json:"results,omitempty"` +} + +// Represents a Meta Data of a test result. +type TestResultMetaData struct { + // AutomatedTestName of test result. + AutomatedTestName *string `json:"automatedTestName,omitempty"` + // AutomatedTestStorage of test result. + AutomatedTestStorage *string `json:"automatedTestStorage,omitempty"` + // List of Flaky Identifier for TestCaseReferenceId + FlakyIdentifiers *[]TestFlakyIdentifier `json:"flakyIdentifiers,omitempty"` + // Owner of test result. + Owner *string `json:"owner,omitempty"` + // Priority of test result. + Priority *int `json:"priority,omitempty"` + // ID of TestCaseReference. + TestCaseReferenceId *int `json:"testCaseReferenceId,omitempty"` + // TestCaseTitle of test result. + TestCaseTitle *string `json:"testCaseTitle,omitempty"` +} + +// Represents a TestResultMetaData Input +type TestResultMetaDataUpdateInput struct { + // List of Flaky Identifiers + FlakyIdentifiers *[]TestFlakyIdentifier `json:"flakyIdentifiers,omitempty"` +} + +type TestResultMetaDataUpdateResponse struct { + Status *string `json:"status,omitempty"` +} + +type TestResultModelBase struct { + // Comment in result. + Comment *string `json:"comment,omitempty"` + // Time when execution completed. + CompletedDate *azuredevops.Time `json:"completedDate,omitempty"` + // Duration of execution. + DurationInMs *float64 `json:"durationInMs,omitempty"` + // Error message in result. + ErrorMessage *string `json:"errorMessage,omitempty"` + // Test outcome of result. + Outcome *string `json:"outcome,omitempty"` + // Time when execution started. + StartedDate *azuredevops.Time `json:"startedDate,omitempty"` +} + +type TestResultParameter struct { + ActionPath *string `json:"actionPath,omitempty"` + Actual *[]byte `json:"actual,omitempty"` + Expected *[]byte `json:"expected,omitempty"` + IterationId *int `json:"iterationId,omitempty"` + ParameterName *string `json:"parameterName,omitempty"` + TestResultId *int `json:"testResultId,omitempty"` + TestRunId *int `json:"testRunId,omitempty"` +} + +// Test parameter information in a test iteration. +type TestResultParameterModel struct { + // Test step path where parameter is referenced. + ActionPath *string `json:"actionPath,omitempty"` + // Iteration ID. + IterationId *int `json:"iterationId,omitempty"` + // Name of parameter. + ParameterName *string `json:"parameterName,omitempty"` + // This is step Id of test case. For shared step, it is step Id of shared step in test case workitem; step Id in shared step. Example: TestCase workitem has two steps: 1) Normal step with Id = 1 2) Shared Step with Id = 2. Inside shared step: a) Normal Step with Id = 1 Value for StepIdentifier for First step: "1" Second step: "2;1" + StepIdentifier *string `json:"stepIdentifier,omitempty"` + // Url of test parameter. + Url *string `json:"url,omitempty"` + // Value of parameter. + Value *string `json:"value,omitempty"` +} + +type TestResultPayload struct { + Comment *string `json:"comment,omitempty"` + Name *string `json:"name,omitempty"` + Stream *string `json:"stream,omitempty"` +} + +type TestResultReset2 struct { + AuditIdentity *uuid.UUID `json:"auditIdentity,omitempty"` + DateModified *azuredevops.Time `json:"dateModified,omitempty"` + ProjectId *uuid.UUID `json:"projectId,omitempty"` + Revision *int `json:"revision,omitempty"` + TestResultId *int `json:"testResultId,omitempty"` + TestResultRV *[]byte `json:"testResultRV,omitempty"` + TestRunId *int `json:"testRunId,omitempty"` +} + +type TestResultsContext struct { + Build *BuildReference `json:"build,omitempty"` + ContextType *TestResultsContextType `json:"contextType,omitempty"` + Release *ReleaseReference `json:"release,omitempty"` +} + +type TestResultsContextType string + +type testResultsContextTypeValuesType struct { + Build TestResultsContextType + Release TestResultsContextType +} + +var TestResultsContextTypeValues = testResultsContextTypeValuesType{ + Build: "build", + Release: "release", +} + +type TestResultsDetails struct { + GroupByField *string `json:"groupByField,omitempty"` + ResultsForGroup *[]TestResultsDetailsForGroup `json:"resultsForGroup,omitempty"` +} + +type TestResultsDetailsForGroup struct { + GroupByValue interface{} `json:"groupByValue,omitempty"` + Results *[]TestCaseResult `json:"results,omitempty"` + ResultsCountByOutcome *map[TestOutcome]AggregatedResultsByOutcome `json:"resultsCountByOutcome,omitempty"` + Tags *[]string `json:"tags,omitempty"` +} + +type TestResultsEx2 struct { + BitValue *bool `json:"bitValue,omitempty"` + CreationDate *azuredevops.Time `json:"creationDate,omitempty"` + DateTimeValue *azuredevops.Time `json:"dateTimeValue,omitempty"` + FieldId *int `json:"fieldId,omitempty"` + FieldName *string `json:"fieldName,omitempty"` + FloatValue *float64 `json:"floatValue,omitempty"` + GuidValue *uuid.UUID `json:"guidValue,omitempty"` + IntValue *int `json:"intValue,omitempty"` + ProjectId *uuid.UUID `json:"projectId,omitempty"` + StringValue *string `json:"stringValue,omitempty"` + TestResultId *int `json:"testResultId,omitempty"` + TestRunId *int `json:"testRunId,omitempty"` +} + +type TestResultsGroupsForBuild struct { + // BuildId for which groupby result is fetched. + BuildId *int `json:"buildId,omitempty"` + // The group by results + Fields *[]FieldDetailsForTestResults `json:"fields,omitempty"` +} + +type TestResultsGroupsForRelease struct { + // The group by results + Fields *[]FieldDetailsForTestResults `json:"fields,omitempty"` + // Release Environment Id for which groupby result is fetched. + ReleaseEnvId *int `json:"releaseEnvId,omitempty"` + // ReleaseId for which groupby result is fetched. + ReleaseId *int `json:"releaseId,omitempty"` +} + +type TestResultsQuery struct { + Fields *[]string `json:"fields,omitempty"` + Results *[]TestCaseResult `json:"results,omitempty"` + ResultsFilter *ResultsFilter `json:"resultsFilter,omitempty"` +} + +type TestResultsSettings struct { + // IsRequired and EmitDefaultValue are passed as false as if users doesn't pass anything, should not come for serialisation and deserialisation. + FlakySettings *FlakySettings `json:"flakySettings,omitempty"` +} + +type TestResultsSettingsType string + +type testResultsSettingsTypeValuesType struct { + All TestResultsSettingsType + Flaky TestResultsSettingsType +} + +var TestResultsSettingsTypeValues = testResultsSettingsTypeValuesType{ + // Returns All Test Settings. + All: "all", + // Returns Flaky Test Settings. + Flaky: "flaky", +} + +type TestResultSummary struct { + AggregatedResultsAnalysis *AggregatedResultsAnalysis `json:"aggregatedResultsAnalysis,omitempty"` + NoConfigRunsCount *int `json:"noConfigRunsCount,omitempty"` + TeamProject *core.TeamProjectReference `json:"teamProject,omitempty"` + TestFailures *TestFailuresAnalysis `json:"testFailures,omitempty"` + TestResultsContext *TestResultsContext `json:"testResultsContext,omitempty"` + TotalRunsCount *int `json:"totalRunsCount,omitempty"` +} + +type TestResultsUpdateSettings struct { + // FlakySettings defines Flaky Settings Data. + FlakySettings *FlakySettings `json:"flakySettings,omitempty"` +} + +type TestResultsWithWatermark struct { + ChangedDate *azuredevops.Time `json:"changedDate,omitempty"` + PointsResults *[]PointsResults2 `json:"pointsResults,omitempty"` + ResultId *int `json:"resultId,omitempty"` + RunId *int `json:"runId,omitempty"` +} + +type TestResultTrendFilter struct { + BranchNames *[]string `json:"branchNames,omitempty"` + BuildCount *int `json:"buildCount,omitempty"` + DefinitionIds *[]int `json:"definitionIds,omitempty"` + EnvDefinitionIds *[]int `json:"envDefinitionIds,omitempty"` + MaxCompleteDate *azuredevops.Time `json:"maxCompleteDate,omitempty"` + PublishContext *string `json:"publishContext,omitempty"` + TestRunTitles *[]string `json:"testRunTitles,omitempty"` + TrendDays *int `json:"trendDays,omitempty"` +} + +// Test run details. +type TestRun struct { + // Build associated with this test run. + Build *ShallowReference `json:"build,omitempty"` + // Build configuration details associated with this test run. + BuildConfiguration *BuildConfiguration `json:"buildConfiguration,omitempty"` + // Comments entered by those analyzing the run. + Comment *string `json:"comment,omitempty"` + // Completed date time of the run. + CompletedDate *azuredevops.Time `json:"completedDate,omitempty"` + // Test Run Controller. + Controller *string `json:"controller,omitempty"` + // Test Run CreatedDate. + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + // List of Custom Fields for TestRun. + CustomFields *[]CustomTestField `json:"customFields,omitempty"` + // Drop Location for the test Run. + DropLocation *string `json:"dropLocation,omitempty"` + DtlAutEnvironment *ShallowReference `json:"dtlAutEnvironment,omitempty"` + DtlEnvironment *ShallowReference `json:"dtlEnvironment,omitempty"` + DtlEnvironmentCreationDetails *DtlEnvironmentDetails `json:"dtlEnvironmentCreationDetails,omitempty"` + // Due date and time for test run. + DueDate *azuredevops.Time `json:"dueDate,omitempty"` + // Error message associated with the run. + ErrorMessage *string `json:"errorMessage,omitempty"` + Filter *RunFilter `json:"filter,omitempty"` + // ID of the test run. + Id *int `json:"id,omitempty"` + // Number of Incomplete Tests. + IncompleteTests *int `json:"incompleteTests,omitempty"` + // true if test run is automated, false otherwise. + IsAutomated *bool `json:"isAutomated,omitempty"` + // The iteration to which the run belongs. + Iteration *string `json:"iteration,omitempty"` + // Team foundation ID of the last updated the test run. + LastUpdatedBy *webapi.IdentityRef `json:"lastUpdatedBy,omitempty"` + // Last updated date and time + LastUpdatedDate *azuredevops.Time `json:"lastUpdatedDate,omitempty"` + // Name of the test run. + Name *string `json:"name,omitempty"` + // Number of Not Applicable Tests. + NotApplicableTests *int `json:"notApplicableTests,omitempty"` + // Team Foundation ID of the owner of the runs. + Owner *webapi.IdentityRef `json:"owner,omitempty"` + // Number of passed tests in the run + PassedTests *int `json:"passedTests,omitempty"` + // Phase/State for the testRun. + Phase *string `json:"phase,omitempty"` + // Reference of the pipeline to which this test run belongs. + PipelineReference *PipelineReference `json:"pipelineReference,omitempty"` + // Test plan associated with this test run. + Plan *ShallowReference `json:"plan,omitempty"` + // Post Process State. + PostProcessState *string `json:"postProcessState,omitempty"` + // Project associated with this run. + Project *ShallowReference `json:"project,omitempty"` + // Release Reference for the Test Run. + Release *ReleaseReference `json:"release,omitempty"` + // Release Environment Uri for TestRun. + ReleaseEnvironmentUri *string `json:"releaseEnvironmentUri,omitempty"` + // Release Uri for TestRun. + ReleaseUri *string `json:"releaseUri,omitempty"` + Revision *int `json:"revision,omitempty"` + // RunSummary by outcome. + RunStatistics *[]RunStatistic `json:"runStatistics,omitempty"` + // Start date time of the run. + StartedDate *azuredevops.Time `json:"startedDate,omitempty"` + // The state of the run. Type TestRunState Valid states - Unspecified ,NotStarted, InProgress, Completed, Waiting, Aborted, NeedsInvestigation + State *string `json:"state,omitempty"` + // TestRun Substate. + Substate *TestRunSubstate `json:"substate,omitempty"` + // Tags attached with this test run. + Tags *[]TestTag `json:"tags,omitempty"` + TestMessageLogId *int `json:"testMessageLogId,omitempty"` + TestSettings *ShallowReference `json:"testSettings,omitempty"` + // Total tests in the run + TotalTests *int `json:"totalTests,omitempty"` + // Number of failed tests in the run. + UnanalyzedTests *int `json:"unanalyzedTests,omitempty"` + // Url of the test run + Url *string `json:"url,omitempty"` + // Web Access Url for TestRun. + WebAccessUrl *string `json:"webAccessUrl,omitempty"` +} + +type TestRun2 struct { + BuildConfigurationId *int `json:"buildConfigurationId,omitempty"` + BuildNumber *string `json:"buildNumber,omitempty"` + Comment *string `json:"comment,omitempty"` + CompleteDate *azuredevops.Time `json:"completeDate,omitempty"` + Controller *string `json:"controller,omitempty"` + CoverageId *int `json:"coverageId,omitempty"` + CreationDate *azuredevops.Time `json:"creationDate,omitempty"` + DeletedOn *azuredevops.Time `json:"deletedOn,omitempty"` + DropLocation *string `json:"dropLocation,omitempty"` + DueDate *azuredevops.Time `json:"dueDate,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` + IncompleteTests *int `json:"incompleteTests,omitempty"` + IsAutomated *bool `json:"isAutomated,omitempty"` + IsBvt *bool `json:"isBvt,omitempty"` + IsMigrated *bool `json:"isMigrated,omitempty"` + IterationId *int `json:"iterationId,omitempty"` + LastUpdated *azuredevops.Time `json:"lastUpdated,omitempty"` + LastUpdatedBy *uuid.UUID `json:"lastUpdatedBy,omitempty"` + LegacySharePath *string `json:"legacySharePath,omitempty"` + MaxReservedResultId *int `json:"maxReservedResultId,omitempty"` + NotApplicableTests *int `json:"notApplicableTests,omitempty"` + Owner *uuid.UUID `json:"owner,omitempty"` + PassedTests *int `json:"passedTests,omitempty"` + PostProcessState *byte `json:"postProcessState,omitempty"` + ProjectId *uuid.UUID `json:"projectId,omitempty"` + PublicTestSettingsId *int `json:"publicTestSettingsId,omitempty"` + ReleaseEnvironmentUri *string `json:"releaseEnvironmentUri,omitempty"` + ReleaseUri *string `json:"releaseUri,omitempty"` + Revision *int `json:"revision,omitempty"` + StartDate *azuredevops.Time `json:"startDate,omitempty"` + State *byte `json:"state,omitempty"` + TestEnvironmentId *uuid.UUID `json:"testEnvironmentId,omitempty"` + TestMessageLogId *int `json:"testMessageLogId,omitempty"` + TestPlanId *int `json:"testPlanId,omitempty"` + TestRunContextId *int `json:"testRunContextId,omitempty"` + TestRunId *int `json:"testRunId,omitempty"` + TestSettingsId *int `json:"testSettingsId,omitempty"` + Title *string `json:"title,omitempty"` + TotalTests *int `json:"totalTests,omitempty"` + Type *byte `json:"type,omitempty"` + UnanalyzedTests *int `json:"unanalyzedTests,omitempty"` + Version *int `json:"version,omitempty"` +} + +type TestRunCanceledEvent struct { + TestRun *TestRun `json:"testRun,omitempty"` +} + +type TestRunContext2 struct { + BuildRefId *int `json:"buildRefId,omitempty"` + ProjectId *uuid.UUID `json:"projectId,omitempty"` + ReleaseRefId *int `json:"releaseRefId,omitempty"` + SourceWorkflow *string `json:"sourceWorkflow,omitempty"` + TestRunContextId *int `json:"testRunContextId,omitempty"` +} + +// Test Run Code Coverage Details +type TestRunCoverage struct { + // Last Error + LastError *string `json:"lastError,omitempty"` + // List of Modules Coverage + Modules *[]ModuleCoverage `json:"modules,omitempty"` + // State + State *string `json:"state,omitempty"` + // Reference of test Run. + TestRun *ShallowReference `json:"testRun,omitempty"` +} + +type TestRunCreatedEvent struct { + TestRun *TestRun `json:"testRun,omitempty"` +} + +type TestRunEvent struct { + TestRun *TestRun `json:"testRun,omitempty"` +} + +type TestRunEx2 struct { + BitValue *bool `json:"bitValue,omitempty"` + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + DateTimeValue *azuredevops.Time `json:"dateTimeValue,omitempty"` + FieldId *int `json:"fieldId,omitempty"` + FieldName *string `json:"fieldName,omitempty"` + FloatValue *float64 `json:"floatValue,omitempty"` + GuidValue *uuid.UUID `json:"guidValue,omitempty"` + IntValue *int `json:"intValue,omitempty"` + ProjectId *uuid.UUID `json:"projectId,omitempty"` + StringValue *string `json:"stringValue,omitempty"` + TestRunId *int `json:"testRunId,omitempty"` +} + +type TestRunExtended2 struct { + AutEnvironmentUrl *string `json:"autEnvironmentUrl,omitempty"` + CsmContent *string `json:"csmContent,omitempty"` + CsmParameters *string `json:"csmParameters,omitempty"` + ProjectId *uuid.UUID `json:"projectId,omitempty"` + SourceFilter *string `json:"sourceFilter,omitempty"` + SubscriptionName *string `json:"subscriptionName,omitempty"` + Substate *byte `json:"substate,omitempty"` + TestCaseFilter *string `json:"testCaseFilter,omitempty"` + TestEnvironmentUrl *string `json:"testEnvironmentUrl,omitempty"` + TestRunId *int `json:"testRunId,omitempty"` +} + +// The types of outcomes for test run. +type TestRunOutcome string + +type testRunOutcomeValuesType struct { + Passed TestRunOutcome + Failed TestRunOutcome + NotImpacted TestRunOutcome + Others TestRunOutcome +} + +var TestRunOutcomeValues = testRunOutcomeValuesType{ + // Run with zero failed tests and has at least one impacted test + Passed: "passed", + // Run with at-least one failed test. + Failed: "failed", + // Run with no impacted tests. + NotImpacted: "notImpacted", + // Runs with All tests in other category. + Others: "others", +} + +// The types of publish context for run. +type TestRunPublishContext string + +type testRunPublishContextValuesType struct { + Build TestRunPublishContext + Release TestRunPublishContext + All TestRunPublishContext +} + +var TestRunPublishContextValues = testRunPublishContextValuesType{ + // Run is published for Build Context. + Build: "build", + // Run is published for Release Context. + Release: "release", + // Run is published for any Context. + All: "all", +} + +type TestRunStartedEvent struct { + TestRun *TestRun `json:"testRun,omitempty"` +} + +// The types of states for test run. +type TestRunState string + +type testRunStateValuesType struct { + Unspecified TestRunState + NotStarted TestRunState + InProgress TestRunState + Completed TestRunState + Aborted TestRunState + Waiting TestRunState + NeedsInvestigation TestRunState +} + +var TestRunStateValues = testRunStateValuesType{ + // Only used during an update to preserve the existing value. + Unspecified: "unspecified", + // The run is still being created. No tests have started yet. + NotStarted: "notStarted", + // Tests are running. + InProgress: "inProgress", + // All tests have completed or been skipped. + Completed: "completed", + // Run is stopped and remaining tests have been aborted + Aborted: "aborted", + // Run is currently initializing This is a legacy state and should not be used any more + Waiting: "waiting", + // Run requires investigation because of a test point failure This is a legacy state and should not be used any more + NeedsInvestigation: "needsInvestigation", +} + +// Test run statistics. +type TestRunStatistic struct { + Run *ShallowReference `json:"run,omitempty"` + RunStatistics *[]RunStatistic `json:"runStatistics,omitempty"` +} + +// The types of sub states for test run. It gives the user more info about the test run beyond the high level test run state +type TestRunSubstate string + +type testRunSubstateValuesType struct { + None TestRunSubstate + CreatingEnvironment TestRunSubstate + RunningTests TestRunSubstate + CanceledByUser TestRunSubstate + AbortedBySystem TestRunSubstate + TimedOut TestRunSubstate + PendingAnalysis TestRunSubstate + Analyzed TestRunSubstate + CancellationInProgress TestRunSubstate +} + +var TestRunSubstateValues = testRunSubstateValuesType{ + // Run with noState. + None: "none", + // Run state while Creating Environment. + CreatingEnvironment: "creatingEnvironment", + // Run state while Running Tests. + RunningTests: "runningTests", + // Run state while Creating Environment. + CanceledByUser: "canceledByUser", + // Run state when it is Aborted By the System. + AbortedBySystem: "abortedBySystem", + // Run state when run has timedOut. + TimedOut: "timedOut", + // Run state while Pending Analysis. + PendingAnalysis: "pendingAnalysis", + // Run state after being Analysed. + Analyzed: "analyzed", + // Run state when cancellation is in Progress. + CancellationInProgress: "cancellationInProgress", +} + +type TestRunSummary2 struct { + IsRerun *bool `json:"isRerun,omitempty"` + ProjectId *uuid.UUID `json:"projectId,omitempty"` + ResultCount *int `json:"resultCount,omitempty"` + ResultDuration *uint64 `json:"resultDuration,omitempty"` + RunDuration *uint64 `json:"runDuration,omitempty"` + TestOutcome *byte `json:"testOutcome,omitempty"` + TestRunCompletedDate *azuredevops.Time `json:"testRunCompletedDate,omitempty"` + TestRunContextId *int `json:"testRunContextId,omitempty"` + TestRunId *int `json:"testRunId,omitempty"` + TestRunStatsId *int `json:"testRunStatsId,omitempty"` +} + +type TestRunWithDtlEnvEvent struct { + TestRun *TestRun `json:"testRun,omitempty"` + ConfigurationIds *[]int `json:"configurationIds,omitempty"` + MappedTestRunEventType *string `json:"mappedTestRunEventType,omitempty"` + RunTimeout interface{} `json:"runTimeout,omitempty"` + TestConfigurationsMapping *string `json:"testConfigurationsMapping,omitempty"` +} + +// Test Session +type TestSession struct { + // Area path of the test session + Area *ShallowReference `json:"area,omitempty"` + // Comments in the test session + Comment *string `json:"comment,omitempty"` + // Duration of the session + EndDate *azuredevops.Time `json:"endDate,omitempty"` + // Id of the test session + Id *int `json:"id,omitempty"` + // Last Updated By Reference + LastUpdatedBy *webapi.IdentityRef `json:"lastUpdatedBy,omitempty"` + // Last updated date + LastUpdatedDate *azuredevops.Time `json:"lastUpdatedDate,omitempty"` + // Owner of the test session + Owner *webapi.IdentityRef `json:"owner,omitempty"` + // Project to which the test session belongs + Project *ShallowReference `json:"project,omitempty"` + // Generic store for test session data + PropertyBag *PropertyBag `json:"propertyBag,omitempty"` + // Revision of the test session + Revision *int `json:"revision,omitempty"` + // Source of the test session + Source *TestSessionSource `json:"source,omitempty"` + // Start date + StartDate *azuredevops.Time `json:"startDate,omitempty"` + // State of the test session + State *TestSessionState `json:"state,omitempty"` + // Title of the test session + Title *string `json:"title,omitempty"` + // Url of Test Session Resource + Url *string `json:"url,omitempty"` +} + +type TestSessionExploredWorkItemReference struct { + // Id of the workitem + Id *int `json:"id,omitempty"` + // Type of the workitem + Type *string `json:"type,omitempty"` + // Workitem references of workitems filed as a part of the current workitem exploration. + AssociatedWorkItems *[]TestSessionWorkItemReference `json:"associatedWorkItems,omitempty"` + // Time when exploration of workitem ended. + EndTime *azuredevops.Time `json:"endTime,omitempty"` + // Time when explore of workitem was started. + StartTime *azuredevops.Time `json:"startTime,omitempty"` +} + +// Represents the source from which the test session was created +type TestSessionSource string + +type testSessionSourceValuesType struct { + Unknown TestSessionSource + XtDesktop TestSessionSource + FeedbackDesktop TestSessionSource + XtWeb TestSessionSource + FeedbackWeb TestSessionSource + XtDesktop2 TestSessionSource + SessionInsightsForAll TestSessionSource +} + +var TestSessionSourceValues = testSessionSourceValuesType{ + // Source of test session uncertain as it is stale + Unknown: "unknown", + // The session was created from Microsoft Test Manager exploratory desktop tool. + XtDesktop: "xtDesktop", + // The session was created from feedback client. + FeedbackDesktop: "feedbackDesktop", + // The session was created from browser extension. + XtWeb: "xtWeb", + // The session was created from browser extension. + FeedbackWeb: "feedbackWeb", + // The session was created from web access using Microsoft Test Manager exploratory desktop tool. + XtDesktop2: "xtDesktop2", + // To show sessions from all supported sources. + SessionInsightsForAll: "sessionInsightsForAll", +} + +// Represents the state of the test session. +type TestSessionState string + +type testSessionStateValuesType struct { + Unspecified TestSessionState + NotStarted TestSessionState + InProgress TestSessionState + Paused TestSessionState + Completed TestSessionState + Declined TestSessionState +} + +var TestSessionStateValues = testSessionStateValuesType{ + // Only used during an update to preserve the existing value. + Unspecified: "unspecified", + // The session is still being created. + NotStarted: "notStarted", + // The session is running. + InProgress: "inProgress", + // The session has paused. + Paused: "paused", + // The session has completed. + Completed: "completed", + // This is required for Feedback session which are declined + Declined: "declined", +} + +type TestSessionWorkItemReference struct { + // Id of the workitem + Id *int `json:"id,omitempty"` + // Type of the workitem + Type *string `json:"type,omitempty"` +} + +// Represents the test settings of the run. Used to create test settings and fetch test settings +type TestSettings struct { + // Area path required to create test settings + AreaPath *string `json:"areaPath,omitempty"` + // Description of the test settings. Used in create test settings. + Description *string `json:"description,omitempty"` + // Indicates if the tests settings is public or private.Used in create test settings. + IsPublic *bool `json:"isPublic,omitempty"` + // Xml string of machine roles. Used in create test settings. + MachineRoles *string `json:"machineRoles,omitempty"` + // Test settings content. + TestSettingsContent *string `json:"testSettingsContent,omitempty"` + // Test settings id. + TestSettingsId *int `json:"testSettingsId,omitempty"` + // Test settings name. + TestSettingsName *string `json:"testSettingsName,omitempty"` +} + +// Represents the test settings of the run. Used to create test settings and fetch test settings +type TestSettings2 struct { + // Area path required to create test settings + AreaPath *string `json:"areaPath,omitempty"` + CreatedBy *webapi.IdentityRef `json:"createdBy,omitempty"` + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + // Description of the test settings. Used in create test settings. + Description *string `json:"description,omitempty"` + // Indicates if the tests settings is public or private.Used in create test settings. + IsPublic *bool `json:"isPublic,omitempty"` + LastUpdatedBy *webapi.IdentityRef `json:"lastUpdatedBy,omitempty"` + LastUpdatedDate *azuredevops.Time `json:"lastUpdatedDate,omitempty"` + // Xml string of machine roles. Used in create test settings. + MachineRoles *string `json:"machineRoles,omitempty"` + // Test settings content. + TestSettingsContent *string `json:"testSettingsContent,omitempty"` + // Test settings id. + TestSettingsId *int `json:"testSettingsId,omitempty"` + // Test settings name. + TestSettingsName *string `json:"testSettingsName,omitempty"` +} + +type TestSettingsMachineRole struct { + IsExecution *bool `json:"isExecution,omitempty"` + Name *string `json:"name,omitempty"` +} + +// Represents a sub result of a test result. +type TestSubResult struct { + // Comment in sub result. + Comment *string `json:"comment,omitempty"` + // Time when test execution completed. + CompletedDate *azuredevops.Time `json:"completedDate,omitempty"` + // Machine where test executed. + ComputerName *string `json:"computerName,omitempty"` + // Reference to test configuration. + Configuration *ShallowReference `json:"configuration,omitempty"` + // Additional properties of sub result. + CustomFields *[]CustomTestField `json:"customFields,omitempty"` + // Name of sub result. + DisplayName *string `json:"displayName,omitempty"` + // Duration of test execution. + DurationInMs *uint64 `json:"durationInMs,omitempty"` + // Error message in sub result. + ErrorMessage *string `json:"errorMessage,omitempty"` + // ID of sub result. + Id *int `json:"id,omitempty"` + // Time when result last updated. + LastUpdatedDate *azuredevops.Time `json:"lastUpdatedDate,omitempty"` + // Outcome of sub result. + Outcome *string `json:"outcome,omitempty"` + // Immediate parent ID of sub result. + ParentId *int `json:"parentId,omitempty"` + // Hierarchy type of the result, default value of None means its leaf node. + ResultGroupType *ResultGroupType `json:"resultGroupType,omitempty"` + // Index number of sub result. + SequenceId *int `json:"sequenceId,omitempty"` + // Stacktrace. + StackTrace *string `json:"stackTrace,omitempty"` + // Time when test execution started. + StartedDate *azuredevops.Time `json:"startedDate,omitempty"` + // List of sub results inside a sub result, if ResultGroupType is not None, it holds corresponding type sub results. + SubResults *[]TestSubResult `json:"subResults,omitempty"` + // Reference to test result. + TestResult *TestCaseResultIdentifier `json:"testResult,omitempty"` + // Url of sub result. + Url *string `json:"url,omitempty"` +} + +// Test suite +type TestSuite struct { + // Area uri of the test suite. + AreaUri *string `json:"areaUri,omitempty"` + // Child test suites of current test suite. + Children *[]TestSuite `json:"children,omitempty"` + // Test suite default configuration. + DefaultConfigurations *[]ShallowReference `json:"defaultConfigurations,omitempty"` + // Test suite default testers. + DefaultTesters *[]ShallowReference `json:"defaultTesters,omitempty"` + // Id of test suite. + Id *int `json:"id,omitempty"` + // Default configuration was inherited or not. + InheritDefaultConfigurations *bool `json:"inheritDefaultConfigurations,omitempty"` + // Last error for test suite. + LastError *string `json:"lastError,omitempty"` + // Last populated date. + LastPopulatedDate *azuredevops.Time `json:"lastPopulatedDate,omitempty"` + // IdentityRef of user who has updated test suite recently. + LastUpdatedBy *webapi.IdentityRef `json:"lastUpdatedBy,omitempty"` + // Last update date. + LastUpdatedDate *azuredevops.Time `json:"lastUpdatedDate,omitempty"` + // Name of test suite. + Name *string `json:"name,omitempty"` + // Test suite parent shallow reference. + Parent *ShallowReference `json:"parent,omitempty"` + // Test plan to which the test suite belongs. + Plan *ShallowReference `json:"plan,omitempty"` + // Test suite project shallow reference. + Project *ShallowReference `json:"project,omitempty"` + // Test suite query string, for dynamic suites. + QueryString *string `json:"queryString,omitempty"` + // Test suite requirement id. + RequirementId *int `json:"requirementId,omitempty"` + // Test suite revision. + Revision *int `json:"revision,omitempty"` + // State of test suite. + State *string `json:"state,omitempty"` + // List of shallow reference of suites. + Suites *[]ShallowReference `json:"suites,omitempty"` + // Test suite type. + SuiteType *string `json:"suiteType,omitempty"` + // Test cases count. + TestCaseCount *int `json:"testCaseCount,omitempty"` + // Test case url. + TestCasesUrl *string `json:"testCasesUrl,omitempty"` + // Used in tree view. If test suite is root suite then, it is name of plan otherwise title of the suite. + Text *string `json:"text,omitempty"` + // Url of test suite. + Url *string `json:"url,omitempty"` +} + +// Test suite clone request +type TestSuiteCloneRequest struct { + // Clone options for cloning the test suite. + CloneOptions *CloneOptions `json:"cloneOptions,omitempty"` + // Suite id under which, we have to clone the suite. + DestinationSuiteId *int `json:"destinationSuiteId,omitempty"` + // Destination suite project name. + DestinationSuiteProjectName *string `json:"destinationSuiteProjectName,omitempty"` +} + +type TestSummaryForWorkItem struct { + Summary *AggregatedDataForResultTrend `json:"summary,omitempty"` + WorkItem *WorkItemReference `json:"workItem,omitempty"` +} + +// Tag attached to a run or result. +type TestTag struct { + // Name of the tag, alphanumeric value less than 30 chars + Name *string `json:"name,omitempty"` +} + +// Test tag summary for build or release grouped by test run. +type TestTagSummary struct { + // Dictionary which contains tags associated with a test run. + TagsGroupByTestArtifact *map[int][]TestTag `json:"tagsGroupByTestArtifact,omitempty"` +} + +// Tags to update to a run or result. +type TestTagsUpdateModel struct { + Tags *[]azuredevops.KeyValuePair `json:"tags,omitempty"` +} + +type TestToWorkItemLinks struct { + Test *TestMethod `json:"test,omitempty"` + WorkItems *[]WorkItemReference `json:"workItems,omitempty"` +} + +type TestVariable struct { + // Description of the test variable + Description *string `json:"description,omitempty"` + // Id of the test variable + Id *int `json:"id,omitempty"` + // Name of the test variable + Name *string `json:"name,omitempty"` + // Project to which the test variable belongs + Project *ShallowReference `json:"project,omitempty"` + // Revision + Revision *int `json:"revision,omitempty"` + // Url of the test variable + Url *string `json:"url,omitempty"` + // List of allowed values + Values *[]string `json:"values,omitempty"` +} + +type UpdatedProperties struct { + Id *int `json:"id,omitempty"` + LastUpdated *azuredevops.Time `json:"lastUpdated,omitempty"` + LastUpdatedBy *uuid.UUID `json:"lastUpdatedBy,omitempty"` + LastUpdatedByName *string `json:"lastUpdatedByName,omitempty"` + Revision *int `json:"revision,omitempty"` +} + +type UpdateTestRunRequest struct { + AttachmentsToAdd *[]TestResultAttachment `json:"attachmentsToAdd,omitempty"` + AttachmentsToDelete *[]TestResultAttachmentIdentity `json:"attachmentsToDelete,omitempty"` + ProjectName *string `json:"projectName,omitempty"` + ShouldHyderate *bool `json:"shouldHyderate,omitempty"` + TestRun *LegacyTestRun `json:"testRun,omitempty"` +} + +type UpdateTestRunResponse struct { + AttachmentIds *[]int `json:"attachmentIds,omitempty"` + UpdatedProperties *UpdatedProperties `json:"updatedProperties,omitempty"` +} + +type UploadAttachmentsRequest struct { + Attachments *[]HttpPostedTcmAttachment `json:"attachments,omitempty"` + RequestParams *map[string]string `json:"requestParams,omitempty"` +} + +// WorkItem reference Details. +type WorkItemReference struct { + // WorkItem Id. + Id *string `json:"id,omitempty"` + // WorkItem Name. + Name *string `json:"name,omitempty"` + // WorkItem Type. + Type *string `json:"type,omitempty"` + // WorkItem Url. Valid Values : (Bug, Task, User Story, Test Case) + Url *string `json:"url,omitempty"` + // WorkItem WebUrl. + WebUrl *string `json:"webUrl,omitempty"` +} + +type WorkItemToTestLinks struct { + ExecutedIn *Service `json:"executedIn,omitempty"` + Tests *[]TestMethod `json:"tests,omitempty"` + WorkItem *WorkItemReference `json:"workItem,omitempty"` +} diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/version.go b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/version.go new file mode 100644 index 00000000..443147c5 --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/version.go @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azuredevops + +import ( + "strconv" + "strings" +) + +type Version struct { + Major int + Minor int +} + +func NewVersion(version string) (*Version, error) { + split := strings.Split(version, ".") + if len(split) > 1 { + major, err := strconv.Atoi(split[0]) + if err != nil { + return nil, err + } + minor, err := strconv.Atoi(split[1]) + if err != nil { + return nil, err + } + return &Version{ + Major: major, + Minor: minor, + }, nil + } + return nil, &InvalidVersionStringError{version: version} +} + +func (version Version) CompareTo(compareToVersion Version) int { + if version.Major > compareToVersion.Major { + return 1 + } else if version.Major < compareToVersion.Major { + return -1 + } else if version.Minor > compareToVersion.Minor { + return 1 + } else if version.Minor < compareToVersion.Minor { + return -1 + } + return 0 +} + +func (version Version) String() string { + return strconv.Itoa(version.Major) + "." + strconv.Itoa(version.Minor) +} + +type InvalidVersionStringError struct { + version string +} + +func (e *InvalidVersionStringError) Error() string { + return "The version string was invalid: " + e.version +} diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/versionnegotiation.go b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/versionnegotiation.go new file mode 100644 index 00000000..f1a2a2f3 --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/versionnegotiation.go @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azuredevops + +import "strconv" + +func negotiateRequestVersion(location *ApiResourceLocation, apiVersion string) (string, error) { + if apiVersion == "" { + // if no api-version is sent to the server, the server will decide the version. The server uses the latest + // released version if the endpoint has been released, otherwise it will use the latest preview version. + return apiVersion, nil + } + + matches := apiVersionRegEx.FindStringSubmatch(apiVersion) + if len(matches) == 0 && matches[0] != "" { + return apiVersion, &InvalidApiVersion{apiVersion} + } + + requestedApiVersion, err := NewVersion(matches[1]) + if err != nil { + return apiVersion, err + } + locationMinVersion, err := NewVersion(*location.MinVersion) + if err != nil { + return apiVersion, err + } + if locationMinVersion.CompareTo(*requestedApiVersion) > 0 { + // Client is older than the server. The server no longer supports this + // resource (deprecated). + return apiVersion, nil + } else { + locationMaxVersion, err := NewVersion(*location.MaxVersion) + if err != nil { + return apiVersion, err + } + if locationMaxVersion.CompareTo(*requestedApiVersion) < 0 { + // Client is newer than the server. Negotiate down to the latest version + // on the server + negotiatedVersion := string(*location.MaxVersion) + if *location.ReleasedVersion < *location.MaxVersion { + negotiatedVersion += "-preview" + } + return negotiatedVersion, nil + } else { + // We can send at the requested api version. Make sure the resource version + // is not bigger than what the server supports + negotiatedVersion := matches[1] + if len(matches) > 3 && matches[3] != "" { // matches '-preview' + negotiatedVersion += "-preview" + if len(matches) > 5 && matches[5] != "" { // has a resource version + requestedResourceVersion, _ := strconv.Atoi(matches[5]) + if *location.ResourceVersion < requestedResourceVersion { + negotiatedVersion += "." + strconv.Itoa(*location.ResourceVersion) + } else { + negotiatedVersion += "." + matches[5] + } + } + } else { + // requesting released version, ensure server supports a released version, and if not append '-preview' + locationReleasedVersion, err := NewVersion(*location.ReleasedVersion) + if err != nil { + return apiVersion, err + } + if (locationReleasedVersion.Major == 0 && locationReleasedVersion.Minor == 0) || locationReleasedVersion.CompareTo(*requestedApiVersion) < 0 { + negotiatedVersion += "-preview" + } + } + return negotiatedVersion, nil + } + } +} diff --git a/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/webapi/models.go b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/webapi/models.go new file mode 100644 index 00000000..7a06cb4d --- /dev/null +++ b/vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/webapi/models.go @@ -0,0 +1,315 @@ +// -------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// -------------------------------------------------------------------------------------------- +// Generated file, DO NOT EDIT +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// -------------------------------------------------------------------------------------------- + +package webapi + +import ( + "github.com/google/uuid" + "github.com/microsoft/azure-devops-go-api/azuredevops" + "github.com/microsoft/azure-devops-go-api/azuredevops/system" +) + +// Information about the location of a REST API resource +type ApiResourceLocation struct { + // Area name for this resource + Area *string `json:"area,omitempty"` + // Unique Identifier for this location + Id *uuid.UUID `json:"id,omitempty"` + // Maximum api version that this resource supports (current server version for this resource) + MaxVersion *string `json:"maxVersion,omitempty"` + // Minimum api version that this resource supports + MinVersion *string `json:"minVersion,omitempty"` + // The latest version of this resource location that is in "Release" (non-preview) mode + ReleasedVersion *string `json:"releasedVersion,omitempty"` + // Resource name + ResourceName *string `json:"resourceName,omitempty"` + // The current resource version supported by this resource location + ResourceVersion *int `json:"resourceVersion,omitempty"` + // This location's route template (templated relative path) + RouteTemplate *string `json:"routeTemplate,omitempty"` +} + +// [Flags] Enumeration of the options that can be passed in on Connect. +type ConnectOptions string + +type connectOptionsValuesType struct { + None ConnectOptions + IncludeServices ConnectOptions + IncludeLastUserAccess ConnectOptions + IncludeInheritedDefinitionsOnly ConnectOptions + IncludeNonInheritedDefinitionsOnly ConnectOptions +} + +var ConnectOptionsValues = connectOptionsValuesType{ + // Retrieve no optional data. + None: "none", + // Includes information about AccessMappings and ServiceDefinitions. + IncludeServices: "includeServices", + // Includes the last user access for this host. + IncludeLastUserAccess: "includeLastUserAccess", + // This is only valid on the deployment host and when true. Will only return inherited definitions. + IncludeInheritedDefinitionsOnly: "includeInheritedDefinitionsOnly", + // When true will only return non inherited definitions. Only valid at non-deployment host. + IncludeNonInheritedDefinitionsOnly: "includeNonInheritedDefinitionsOnly", +} + +// [Flags] +type DeploymentFlags string + +type deploymentFlagsValuesType struct { + None DeploymentFlags + Hosted DeploymentFlags + OnPremises DeploymentFlags +} + +var DeploymentFlagsValues = deploymentFlagsValuesType{ + None: "none", + Hosted: "hosted", + OnPremises: "onPremises", +} + +// Defines an "actor" for an event. +type EventActor struct { + // Required: This is the identity of the user for the specified role. + Id *uuid.UUID `json:"id,omitempty"` + // Required: The event specific name of a role. + Role *string `json:"role,omitempty"` +} + +// Defines a scope for an event. +type EventScope struct { + // Required: This is the identity of the scope for the type. + Id *uuid.UUID `json:"id,omitempty"` + // Optional: The display name of the scope + Name *string `json:"name,omitempty"` + // Required: The event specific type of a scope. + Type *string `json:"type,omitempty"` +} + +type IdentityRef struct { + // Deprecated - Can be retrieved by querying the Graph user referenced in the "self" entry of the IdentityRef "_links" dictionary + DirectoryAlias *string `json:"directoryAlias,omitempty"` + Id *string `json:"id,omitempty"` + // Deprecated - Available in the "avatar" entry of the IdentityRef "_links" dictionary + ImageUrl *string `json:"imageUrl,omitempty"` + // Deprecated - Can be retrieved by querying the Graph membership state referenced in the "membershipState" entry of the GraphUser "_links" dictionary + Inactive *bool `json:"inactive,omitempty"` + // Deprecated - Can be inferred from the subject type of the descriptor (Descriptor.IsAadUserType/Descriptor.IsAadGroupType) + IsAadIdentity *bool `json:"isAadIdentity,omitempty"` + // Deprecated - Can be inferred from the subject type of the descriptor (Descriptor.IsGroupType) + IsContainer *bool `json:"isContainer,omitempty"` + IsDeletedInOrigin *bool `json:"isDeletedInOrigin,omitempty"` + // Deprecated - not in use in most preexisting implementations of ToIdentityRef + ProfileUrl *string `json:"profileUrl,omitempty"` + // Deprecated - use Domain+PrincipalName instead + UniqueName *string `json:"uniqueName,omitempty"` +} + +type IdentityRefWithEmail struct { + // Deprecated - Can be retrieved by querying the Graph user referenced in the "self" entry of the IdentityRef "_links" dictionary + DirectoryAlias *string `json:"directoryAlias,omitempty"` + Id *string `json:"id,omitempty"` + // Deprecated - Available in the "avatar" entry of the IdentityRef "_links" dictionary + ImageUrl *string `json:"imageUrl,omitempty"` + // Deprecated - Can be retrieved by querying the Graph membership state referenced in the "membershipState" entry of the GraphUser "_links" dictionary + Inactive *bool `json:"inactive,omitempty"` + // Deprecated - Can be inferred from the subject type of the descriptor (Descriptor.IsAadUserType/Descriptor.IsAadGroupType) + IsAadIdentity *bool `json:"isAadIdentity,omitempty"` + // Deprecated - Can be inferred from the subject type of the descriptor (Descriptor.IsGroupType) + IsContainer *bool `json:"isContainer,omitempty"` + IsDeletedInOrigin *bool `json:"isDeletedInOrigin,omitempty"` + // Deprecated - not in use in most preexisting implementations of ToIdentityRef + ProfileUrl *string `json:"profileUrl,omitempty"` + // Deprecated - use Domain+PrincipalName instead + UniqueName *string `json:"uniqueName,omitempty"` + PreferredEmailAddress *string `json:"preferredEmailAddress,omitempty"` +} + +// The JSON model for a JSON Patch operation +type JsonPatchOperation struct { + // The path to copy from for the Move/Copy operation. + From *string `json:"from,omitempty"` + // The patch operation + Op *Operation `json:"op,omitempty"` + // The path for the operation. In the case of an array, a zero based index can be used to specify the position in the array (e.g. /biscuits/0/name). The "-" character can be used instead of an index to insert at the end of the array (e.g. /biscuits/-). + Path *string `json:"path,omitempty"` + // The value for the operation. This is either a primitive or a JToken. + Value interface{} `json:"value,omitempty"` +} + +type JsonWebToken struct { +} + +type JWTAlgorithm string + +type jwtAlgorithmValuesType struct { + None JWTAlgorithm + HS256 JWTAlgorithm + RS256 JWTAlgorithm +} + +var JWTAlgorithmValues = jwtAlgorithmValuesType{ + None: "none", + HS256: "hS256", + RS256: "rS256", +} + +type Operation string + +type operationValuesType struct { + Add Operation + Remove Operation + Replace Operation + Move Operation + Copy Operation + Test Operation +} + +var OperationValues = operationValuesType{ + Add: "add", + Remove: "remove", + Replace: "replace", + Move: "move", + Copy: "copy", + Test: "test", +} + +// Represents the public key portion of an RSA asymmetric key. +type PublicKey struct { + // Gets or sets the exponent for the public key. + Exponent *[]byte `json:"exponent,omitempty"` + // Gets or sets the modulus for the public key. + Modulus *[]byte `json:"modulus,omitempty"` +} + +type Publisher struct { + // Name of the publishing service. + Name *string `json:"name,omitempty"` + // Service Owner Guid Eg. Tfs : 00025394-6065-48CA-87D9-7F5672854EF7 + ServiceOwnerId *uuid.UUID `json:"serviceOwnerId,omitempty"` +} + +// The class to represent a REST reference link. RFC: http://tools.ietf.org/html/draft-kelly-json-hal-06 The RFC is not fully implemented, additional properties are allowed on the reference link but as of yet we don't have a need for them. +type ReferenceLink struct { + Href *string `json:"href,omitempty"` +} + +type ResourceRef struct { + Id *string `json:"id,omitempty"` + Url *string `json:"url,omitempty"` +} + +type ServiceEvent struct { + // This is the id of the type. Constants that will be used by subscribers to identify/filter events being published on a topic. + EventType *string `json:"eventType,omitempty"` + // This is the service that published this event. + Publisher *Publisher `json:"publisher,omitempty"` + // The resource object that carries specific information about the event. The object must have the ServiceEventObject applied for serialization/deserialization to work. + Resource interface{} `json:"resource,omitempty"` + // This dictionary carries the context descriptors along with their ids. + ResourceContainers *map[string]interface{} `json:"resourceContainers,omitempty"` + // This is the version of the resource. + ResourceVersion *string `json:"resourceVersion,omitempty"` +} + +// A signed url allowing limited-time anonymous access to private resources. +type SignedUrl struct { + SignatureExpires *azuredevops.Time `json:"signatureExpires,omitempty"` + Url *string `json:"url,omitempty"` +} + +type TeamMember struct { + Identity *IdentityRef `json:"identity,omitempty"` + IsTeamAdmin *bool `json:"isTeamAdmin,omitempty"` +} + +// A single secured timing consisting of a duration and start time +type TimingEntry struct { + // Duration of the entry in ticks + ElapsedTicks *uint64 `json:"elapsedTicks,omitempty"` + // Properties to distinguish timings within the same group or to provide data to send with telemetry + Properties *map[string]interface{} `json:"properties,omitempty"` + // Offset from Server Request Context start time in microseconds + StartOffset *uint64 `json:"startOffset,omitempty"` +} + +// A set of secured performance timings all keyed off of the same string +type TimingGroup struct { + // The total number of timing entries associated with this group + Count *int `json:"count,omitempty"` + // Overall duration of all entries in this group in ticks + ElapsedTicks *uint64 `json:"elapsedTicks,omitempty"` + // A list of timing entries in this group. Only the first few entries in each group are collected. + Timings *[]TimingEntry `json:"timings,omitempty"` +} + +// This class describes a trace filter, i.e. a set of criteria on whether or not a trace event should be emitted +type TraceFilter struct { + Area *string `json:"area,omitempty"` + ExceptionType *string `json:"exceptionType,omitempty"` + IsEnabled *bool `json:"isEnabled,omitempty"` + Layer *string `json:"layer,omitempty"` + Level *system.TraceLevel `json:"level,omitempty"` + Method *string `json:"method,omitempty"` + // Used to serialize additional identity information (display name, etc) to clients. Not set by default. Server-side callers should use OwnerId. + Owner *IdentityRef `json:"owner,omitempty"` + OwnerId *uuid.UUID `json:"ownerId,omitempty"` + Path *string `json:"path,omitempty"` + ProcessName *string `json:"processName,omitempty"` + Service *string `json:"service,omitempty"` + ServiceHost *uuid.UUID `json:"serviceHost,omitempty"` + TimeCreated *azuredevops.Time `json:"timeCreated,omitempty"` + TraceId *uuid.UUID `json:"traceId,omitempty"` + Tracepoint *int `json:"tracepoint,omitempty"` + Uri *string `json:"uri,omitempty"` + UserAgent *string `json:"userAgent,omitempty"` + UserLogin *string `json:"userLogin,omitempty"` +} + +type VssJsonCollectionWrapper struct { + Count *int `json:"count,omitempty"` + Value *[]interface{} `json:"value,omitempty"` +} + +type VssJsonCollectionWrapperBase struct { + Count *int `json:"count,omitempty"` +} + +// This is the type used for firing notifications intended for the subsystem in the Notifications SDK. For components that can't take a dependency on the Notifications SDK directly, they can use ITeamFoundationEventService.PublishNotification and the Notifications SDK ISubscriber implementation will get it. +type VssNotificationEvent struct { + // Optional: A list of actors which are additional identities with corresponding roles that are relevant to the event. + Actors *[]EventActor `json:"actors,omitempty"` + // Optional: A list of artifacts referenced or impacted by this event. + ArtifactUris *[]string `json:"artifactUris,omitempty"` + // Required: The event payload. If Data is a string, it must be in Json or XML format. Otherwise it must have a serialization format attribute. + Data interface{} `json:"data,omitempty"` + // Required: The name of the event. This event must be registered in the context it is being fired. + EventType *string `json:"eventType,omitempty"` + // How long before the event expires and will be cleaned up. The default is to use the system default. + ExpiresIn interface{} `json:"expiresIn,omitempty"` + // The id of the item, artifact, extension, project, etc. + ItemId *string `json:"itemId,omitempty"` + // How long to wait before processing this event. The default is to process immediately. + ProcessDelay interface{} `json:"processDelay,omitempty"` + // Optional: A list of scopes which are are relevant to the event. + Scopes *[]EventScope `json:"scopes,omitempty"` + // This is the time the original source event for this VssNotificationEvent was created. For example, for something like a build completion notification SourceEventCreatedTime should be the time the build finished not the time this event was raised. + SourceEventCreatedTime *azuredevops.Time `json:"sourceEventCreatedTime,omitempty"` +} + +type WrappedException struct { + CustomProperties *map[string]interface{} `json:"customProperties,omitempty"` + ErrorCode *int `json:"errorCode,omitempty"` + EventId *int `json:"eventId,omitempty"` + HelpLink *string `json:"helpLink,omitempty"` + InnerException *WrappedException `json:"innerException,omitempty"` + Message *string `json:"message,omitempty"` + StackTrace *string `json:"stackTrace,omitempty"` + TypeKey *string `json:"typeKey,omitempty"` + TypeName *string `json:"typeName,omitempty"` +} diff --git a/vendor/github.com/google/uuid/.travis.yml b/vendor/github.com/google/uuid/.travis.yml new file mode 100644 index 00000000..d8156a60 --- /dev/null +++ b/vendor/github.com/google/uuid/.travis.yml @@ -0,0 +1,9 @@ +language: go + +go: + - 1.4.3 + - 1.5.3 + - tip + +script: + - go test -v ./... diff --git a/vendor/github.com/google/uuid/CONTRIBUTING.md b/vendor/github.com/google/uuid/CONTRIBUTING.md new file mode 100644 index 00000000..04fdf09f --- /dev/null +++ b/vendor/github.com/google/uuid/CONTRIBUTING.md @@ -0,0 +1,10 @@ +# How to contribute + +We definitely welcome patches and contribution to this project! + +### Legal requirements + +In order to protect both you and ourselves, you will need to sign the +[Contributor License Agreement](https://cla.developers.google.com/clas). + +You may have already signed it for other Google projects. diff --git a/vendor/github.com/google/uuid/CONTRIBUTORS b/vendor/github.com/google/uuid/CONTRIBUTORS new file mode 100644 index 00000000..b4bb97f6 --- /dev/null +++ b/vendor/github.com/google/uuid/CONTRIBUTORS @@ -0,0 +1,9 @@ +Paul Borman +bmatsuo +shawnps +theory +jboverfelt +dsymonds +cd1 +wallclockbuilder +dansouza diff --git a/vendor/github.com/google/uuid/LICENSE b/vendor/github.com/google/uuid/LICENSE new file mode 100644 index 00000000..5dc68268 --- /dev/null +++ b/vendor/github.com/google/uuid/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009,2014 Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/google/uuid/README.md b/vendor/github.com/google/uuid/README.md new file mode 100644 index 00000000..9d92c11f --- /dev/null +++ b/vendor/github.com/google/uuid/README.md @@ -0,0 +1,19 @@ +# uuid ![build status](https://travis-ci.org/google/uuid.svg?branch=master) +The uuid package generates and inspects UUIDs based on +[RFC 4122](http://tools.ietf.org/html/rfc4122) +and DCE 1.1: Authentication and Security Services. + +This package is based on the github.com/pborman/uuid package (previously named +code.google.com/p/go-uuid). It differs from these earlier packages in that +a UUID is a 16 byte array rather than a byte slice. One loss due to this +change is the ability to represent an invalid UUID (vs a NIL UUID). + +###### Install +`go get github.com/google/uuid` + +###### Documentation +[![GoDoc](https://godoc.org/github.com/google/uuid?status.svg)](http://godoc.org/github.com/google/uuid) + +Full `go doc` style documentation for the package can be viewed online without +installing this package by using the GoDoc site here: +http://godoc.org/github.com/google/uuid diff --git a/vendor/github.com/google/uuid/dce.go b/vendor/github.com/google/uuid/dce.go new file mode 100644 index 00000000..fa820b9d --- /dev/null +++ b/vendor/github.com/google/uuid/dce.go @@ -0,0 +1,80 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "encoding/binary" + "fmt" + "os" +) + +// A Domain represents a Version 2 domain +type Domain byte + +// Domain constants for DCE Security (Version 2) UUIDs. +const ( + Person = Domain(0) + Group = Domain(1) + Org = Domain(2) +) + +// NewDCESecurity returns a DCE Security (Version 2) UUID. +// +// The domain should be one of Person, Group or Org. +// On a POSIX system the id should be the users UID for the Person +// domain and the users GID for the Group. The meaning of id for +// the domain Org or on non-POSIX systems is site defined. +// +// For a given domain/id pair the same token may be returned for up to +// 7 minutes and 10 seconds. +func NewDCESecurity(domain Domain, id uint32) (UUID, error) { + uuid, err := NewUUID() + if err == nil { + uuid[6] = (uuid[6] & 0x0f) | 0x20 // Version 2 + uuid[9] = byte(domain) + binary.BigEndian.PutUint32(uuid[0:], id) + } + return uuid, err +} + +// NewDCEPerson returns a DCE Security (Version 2) UUID in the person +// domain with the id returned by os.Getuid. +// +// NewDCESecurity(Person, uint32(os.Getuid())) +func NewDCEPerson() (UUID, error) { + return NewDCESecurity(Person, uint32(os.Getuid())) +} + +// NewDCEGroup returns a DCE Security (Version 2) UUID in the group +// domain with the id returned by os.Getgid. +// +// NewDCESecurity(Group, uint32(os.Getgid())) +func NewDCEGroup() (UUID, error) { + return NewDCESecurity(Group, uint32(os.Getgid())) +} + +// Domain returns the domain for a Version 2 UUID. Domains are only defined +// for Version 2 UUIDs. +func (uuid UUID) Domain() Domain { + return Domain(uuid[9]) +} + +// ID returns the id for a Version 2 UUID. IDs are only defined for Version 2 +// UUIDs. +func (uuid UUID) ID() uint32 { + return binary.BigEndian.Uint32(uuid[0:4]) +} + +func (d Domain) String() string { + switch d { + case Person: + return "Person" + case Group: + return "Group" + case Org: + return "Org" + } + return fmt.Sprintf("Domain%d", int(d)) +} diff --git a/vendor/github.com/google/uuid/doc.go b/vendor/github.com/google/uuid/doc.go new file mode 100644 index 00000000..5b8a4b9a --- /dev/null +++ b/vendor/github.com/google/uuid/doc.go @@ -0,0 +1,12 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package uuid generates and inspects UUIDs. +// +// UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security +// Services. +// +// A UUID is a 16 byte (128 bit) array. UUIDs may be used as keys to +// maps or compared directly. +package uuid diff --git a/vendor/github.com/google/uuid/go.mod b/vendor/github.com/google/uuid/go.mod new file mode 100644 index 00000000..fc84cd79 --- /dev/null +++ b/vendor/github.com/google/uuid/go.mod @@ -0,0 +1 @@ +module github.com/google/uuid diff --git a/vendor/github.com/google/uuid/hash.go b/vendor/github.com/google/uuid/hash.go new file mode 100644 index 00000000..b1746163 --- /dev/null +++ b/vendor/github.com/google/uuid/hash.go @@ -0,0 +1,53 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "crypto/md5" + "crypto/sha1" + "hash" +) + +// Well known namespace IDs and UUIDs +var ( + NameSpaceDNS = Must(Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8")) + NameSpaceURL = Must(Parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8")) + NameSpaceOID = Must(Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8")) + NameSpaceX500 = Must(Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8")) + Nil UUID // empty UUID, all zeros +) + +// NewHash returns a new UUID derived from the hash of space concatenated with +// data generated by h. The hash should be at least 16 byte in length. The +// first 16 bytes of the hash are used to form the UUID. The version of the +// UUID will be the lower 4 bits of version. NewHash is used to implement +// NewMD5 and NewSHA1. +func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID { + h.Reset() + h.Write(space[:]) + h.Write(data) + s := h.Sum(nil) + var uuid UUID + copy(uuid[:], s) + uuid[6] = (uuid[6] & 0x0f) | uint8((version&0xf)<<4) + uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 4122 variant + return uuid +} + +// NewMD5 returns a new MD5 (Version 3) UUID based on the +// supplied name space and data. It is the same as calling: +// +// NewHash(md5.New(), space, data, 3) +func NewMD5(space UUID, data []byte) UUID { + return NewHash(md5.New(), space, data, 3) +} + +// NewSHA1 returns a new SHA1 (Version 5) UUID based on the +// supplied name space and data. It is the same as calling: +// +// NewHash(sha1.New(), space, data, 5) +func NewSHA1(space UUID, data []byte) UUID { + return NewHash(sha1.New(), space, data, 5) +} diff --git a/vendor/github.com/google/uuid/marshal.go b/vendor/github.com/google/uuid/marshal.go new file mode 100644 index 00000000..7f9e0c6c --- /dev/null +++ b/vendor/github.com/google/uuid/marshal.go @@ -0,0 +1,37 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import "fmt" + +// MarshalText implements encoding.TextMarshaler. +func (uuid UUID) MarshalText() ([]byte, error) { + var js [36]byte + encodeHex(js[:], uuid) + return js[:], nil +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (uuid *UUID) UnmarshalText(data []byte) error { + id, err := ParseBytes(data) + if err == nil { + *uuid = id + } + return err +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (uuid UUID) MarshalBinary() ([]byte, error) { + return uuid[:], nil +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (uuid *UUID) UnmarshalBinary(data []byte) error { + if len(data) != 16 { + return fmt.Errorf("invalid UUID (got %d bytes)", len(data)) + } + copy(uuid[:], data) + return nil +} diff --git a/vendor/github.com/google/uuid/node.go b/vendor/github.com/google/uuid/node.go new file mode 100644 index 00000000..d651a2b0 --- /dev/null +++ b/vendor/github.com/google/uuid/node.go @@ -0,0 +1,90 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "sync" +) + +var ( + nodeMu sync.Mutex + ifname string // name of interface being used + nodeID [6]byte // hardware for version 1 UUIDs + zeroID [6]byte // nodeID with only 0's +) + +// NodeInterface returns the name of the interface from which the NodeID was +// derived. The interface "user" is returned if the NodeID was set by +// SetNodeID. +func NodeInterface() string { + defer nodeMu.Unlock() + nodeMu.Lock() + return ifname +} + +// SetNodeInterface selects the hardware address to be used for Version 1 UUIDs. +// If name is "" then the first usable interface found will be used or a random +// Node ID will be generated. If a named interface cannot be found then false +// is returned. +// +// SetNodeInterface never fails when name is "". +func SetNodeInterface(name string) bool { + defer nodeMu.Unlock() + nodeMu.Lock() + return setNodeInterface(name) +} + +func setNodeInterface(name string) bool { + iname, addr := getHardwareInterface(name) // null implementation for js + if iname != "" && addr != nil { + ifname = iname + copy(nodeID[:], addr) + return true + } + + // We found no interfaces with a valid hardware address. If name + // does not specify a specific interface generate a random Node ID + // (section 4.1.6) + if name == "" { + ifname = "random" + randomBits(nodeID[:]) + return true + } + return false +} + +// NodeID returns a slice of a copy of the current Node ID, setting the Node ID +// if not already set. +func NodeID() []byte { + defer nodeMu.Unlock() + nodeMu.Lock() + if nodeID == zeroID { + setNodeInterface("") + } + nid := nodeID + return nid[:] +} + +// SetNodeID sets the Node ID to be used for Version 1 UUIDs. The first 6 bytes +// of id are used. If id is less than 6 bytes then false is returned and the +// Node ID is not set. +func SetNodeID(id []byte) bool { + if len(id) < 6 { + return false + } + defer nodeMu.Unlock() + nodeMu.Lock() + copy(nodeID[:], id) + ifname = "user" + return true +} + +// NodeID returns the 6 byte node id encoded in uuid. It returns nil if uuid is +// not valid. The NodeID is only well defined for version 1 and 2 UUIDs. +func (uuid UUID) NodeID() []byte { + var node [6]byte + copy(node[:], uuid[10:]) + return node[:] +} diff --git a/vendor/github.com/google/uuid/node_js.go b/vendor/github.com/google/uuid/node_js.go new file mode 100644 index 00000000..24b78edc --- /dev/null +++ b/vendor/github.com/google/uuid/node_js.go @@ -0,0 +1,12 @@ +// Copyright 2017 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build js + +package uuid + +// getHardwareInterface returns nil values for the JS version of the code. +// This remvoves the "net" dependency, because it is not used in the browser. +// Using the "net" library inflates the size of the transpiled JS code by 673k bytes. +func getHardwareInterface(name string) (string, []byte) { return "", nil } diff --git a/vendor/github.com/google/uuid/node_net.go b/vendor/github.com/google/uuid/node_net.go new file mode 100644 index 00000000..0cbbcddb --- /dev/null +++ b/vendor/github.com/google/uuid/node_net.go @@ -0,0 +1,33 @@ +// Copyright 2017 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !js + +package uuid + +import "net" + +var interfaces []net.Interface // cached list of interfaces + +// getHardwareInterface returns the name and hardware address of interface name. +// If name is "" then the name and hardware address of one of the system's +// interfaces is returned. If no interfaces are found (name does not exist or +// there are no interfaces) then "", nil is returned. +// +// Only addresses of at least 6 bytes are returned. +func getHardwareInterface(name string) (string, []byte) { + if interfaces == nil { + var err error + interfaces, err = net.Interfaces() + if err != nil { + return "", nil + } + } + for _, ifs := range interfaces { + if len(ifs.HardwareAddr) >= 6 && (name == "" || name == ifs.Name) { + return ifs.Name, ifs.HardwareAddr + } + } + return "", nil +} diff --git a/vendor/github.com/google/uuid/sql.go b/vendor/github.com/google/uuid/sql.go new file mode 100644 index 00000000..f326b54d --- /dev/null +++ b/vendor/github.com/google/uuid/sql.go @@ -0,0 +1,59 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "database/sql/driver" + "fmt" +) + +// Scan implements sql.Scanner so UUIDs can be read from databases transparently +// Currently, database types that map to string and []byte are supported. Please +// consult database-specific driver documentation for matching types. +func (uuid *UUID) Scan(src interface{}) error { + switch src := src.(type) { + case nil: + return nil + + case string: + // if an empty UUID comes from a table, we return a null UUID + if src == "" { + return nil + } + + // see Parse for required string format + u, err := Parse(src) + if err != nil { + return fmt.Errorf("Scan: %v", err) + } + + *uuid = u + + case []byte: + // if an empty UUID comes from a table, we return a null UUID + if len(src) == 0 { + return nil + } + + // assumes a simple slice of bytes if 16 bytes + // otherwise attempts to parse + if len(src) != 16 { + return uuid.Scan(string(src)) + } + copy((*uuid)[:], src) + + default: + return fmt.Errorf("Scan: unable to scan type %T into UUID", src) + } + + return nil +} + +// Value implements sql.Valuer so that UUIDs can be written to databases +// transparently. Currently, UUIDs map to strings. Please consult +// database-specific driver documentation for matching types. +func (uuid UUID) Value() (driver.Value, error) { + return uuid.String(), nil +} diff --git a/vendor/github.com/google/uuid/time.go b/vendor/github.com/google/uuid/time.go new file mode 100644 index 00000000..e6ef06cd --- /dev/null +++ b/vendor/github.com/google/uuid/time.go @@ -0,0 +1,123 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "encoding/binary" + "sync" + "time" +) + +// A Time represents a time as the number of 100's of nanoseconds since 15 Oct +// 1582. +type Time int64 + +const ( + lillian = 2299160 // Julian day of 15 Oct 1582 + unix = 2440587 // Julian day of 1 Jan 1970 + epoch = unix - lillian // Days between epochs + g1582 = epoch * 86400 // seconds between epochs + g1582ns100 = g1582 * 10000000 // 100s of a nanoseconds between epochs +) + +var ( + timeMu sync.Mutex + lasttime uint64 // last time we returned + clockSeq uint16 // clock sequence for this run + + timeNow = time.Now // for testing +) + +// UnixTime converts t the number of seconds and nanoseconds using the Unix +// epoch of 1 Jan 1970. +func (t Time) UnixTime() (sec, nsec int64) { + sec = int64(t - g1582ns100) + nsec = (sec % 10000000) * 100 + sec /= 10000000 + return sec, nsec +} + +// GetTime returns the current Time (100s of nanoseconds since 15 Oct 1582) and +// clock sequence as well as adjusting the clock sequence as needed. An error +// is returned if the current time cannot be determined. +func GetTime() (Time, uint16, error) { + defer timeMu.Unlock() + timeMu.Lock() + return getTime() +} + +func getTime() (Time, uint16, error) { + t := timeNow() + + // If we don't have a clock sequence already, set one. + if clockSeq == 0 { + setClockSequence(-1) + } + now := uint64(t.UnixNano()/100) + g1582ns100 + + // If time has gone backwards with this clock sequence then we + // increment the clock sequence + if now <= lasttime { + clockSeq = ((clockSeq + 1) & 0x3fff) | 0x8000 + } + lasttime = now + return Time(now), clockSeq, nil +} + +// ClockSequence returns the current clock sequence, generating one if not +// already set. The clock sequence is only used for Version 1 UUIDs. +// +// The uuid package does not use global static storage for the clock sequence or +// the last time a UUID was generated. Unless SetClockSequence is used, a new +// random clock sequence is generated the first time a clock sequence is +// requested by ClockSequence, GetTime, or NewUUID. (section 4.2.1.1) +func ClockSequence() int { + defer timeMu.Unlock() + timeMu.Lock() + return clockSequence() +} + +func clockSequence() int { + if clockSeq == 0 { + setClockSequence(-1) + } + return int(clockSeq & 0x3fff) +} + +// SetClockSequence sets the clock sequence to the lower 14 bits of seq. Setting to +// -1 causes a new sequence to be generated. +func SetClockSequence(seq int) { + defer timeMu.Unlock() + timeMu.Lock() + setClockSequence(seq) +} + +func setClockSequence(seq int) { + if seq == -1 { + var b [2]byte + randomBits(b[:]) // clock sequence + seq = int(b[0])<<8 | int(b[1]) + } + oldSeq := clockSeq + clockSeq = uint16(seq&0x3fff) | 0x8000 // Set our variant + if oldSeq != clockSeq { + lasttime = 0 + } +} + +// Time returns the time in 100s of nanoseconds since 15 Oct 1582 encoded in +// uuid. The time is only defined for version 1 and 2 UUIDs. +func (uuid UUID) Time() Time { + time := int64(binary.BigEndian.Uint32(uuid[0:4])) + time |= int64(binary.BigEndian.Uint16(uuid[4:6])) << 32 + time |= int64(binary.BigEndian.Uint16(uuid[6:8])&0xfff) << 48 + return Time(time) +} + +// ClockSequence returns the clock sequence encoded in uuid. +// The clock sequence is only well defined for version 1 and 2 UUIDs. +func (uuid UUID) ClockSequence() int { + return int(binary.BigEndian.Uint16(uuid[8:10])) & 0x3fff +} diff --git a/vendor/github.com/google/uuid/util.go b/vendor/github.com/google/uuid/util.go new file mode 100644 index 00000000..5ea6c737 --- /dev/null +++ b/vendor/github.com/google/uuid/util.go @@ -0,0 +1,43 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "io" +) + +// randomBits completely fills slice b with random data. +func randomBits(b []byte) { + if _, err := io.ReadFull(rander, b); err != nil { + panic(err.Error()) // rand should never fail + } +} + +// xvalues returns the value of a byte as a hexadecimal digit or 255. +var xvalues = [256]byte{ + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255, + 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, +} + +// xtob converts hex characters x1 and x2 into a byte. +func xtob(x1, x2 byte) (byte, bool) { + b1 := xvalues[x1] + b2 := xvalues[x2] + return (b1 << 4) | b2, b1 != 255 && b2 != 255 +} diff --git a/vendor/github.com/google/uuid/uuid.go b/vendor/github.com/google/uuid/uuid.go new file mode 100644 index 00000000..524404cc --- /dev/null +++ b/vendor/github.com/google/uuid/uuid.go @@ -0,0 +1,245 @@ +// Copyright 2018 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "bytes" + "crypto/rand" + "encoding/hex" + "errors" + "fmt" + "io" + "strings" +) + +// A UUID is a 128 bit (16 byte) Universal Unique IDentifier as defined in RFC +// 4122. +type UUID [16]byte + +// A Version represents a UUID's version. +type Version byte + +// A Variant represents a UUID's variant. +type Variant byte + +// Constants returned by Variant. +const ( + Invalid = Variant(iota) // Invalid UUID + RFC4122 // The variant specified in RFC4122 + Reserved // Reserved, NCS backward compatibility. + Microsoft // Reserved, Microsoft Corporation backward compatibility. + Future // Reserved for future definition. +) + +var rander = rand.Reader // random function + +// Parse decodes s into a UUID or returns an error. Both the standard UUID +// forms of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and +// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx are decoded as well as the +// Microsoft encoding {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} and the raw hex +// encoding: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. +func Parse(s string) (UUID, error) { + var uuid UUID + switch len(s) { + // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + case 36: + + // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + case 36 + 9: + if strings.ToLower(s[:9]) != "urn:uuid:" { + return uuid, fmt.Errorf("invalid urn prefix: %q", s[:9]) + } + s = s[9:] + + // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} + case 36 + 2: + s = s[1:] + + // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + case 32: + var ok bool + for i := range uuid { + uuid[i], ok = xtob(s[i*2], s[i*2+1]) + if !ok { + return uuid, errors.New("invalid UUID format") + } + } + return uuid, nil + default: + return uuid, fmt.Errorf("invalid UUID length: %d", len(s)) + } + // s is now at least 36 bytes long + // it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { + return uuid, errors.New("invalid UUID format") + } + for i, x := range [16]int{ + 0, 2, 4, 6, + 9, 11, + 14, 16, + 19, 21, + 24, 26, 28, 30, 32, 34} { + v, ok := xtob(s[x], s[x+1]) + if !ok { + return uuid, errors.New("invalid UUID format") + } + uuid[i] = v + } + return uuid, nil +} + +// ParseBytes is like Parse, except it parses a byte slice instead of a string. +func ParseBytes(b []byte) (UUID, error) { + var uuid UUID + switch len(b) { + case 36: // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + case 36 + 9: // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + if !bytes.Equal(bytes.ToLower(b[:9]), []byte("urn:uuid:")) { + return uuid, fmt.Errorf("invalid urn prefix: %q", b[:9]) + } + b = b[9:] + case 36 + 2: // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} + b = b[1:] + case 32: // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + var ok bool + for i := 0; i < 32; i += 2 { + uuid[i/2], ok = xtob(b[i], b[i+1]) + if !ok { + return uuid, errors.New("invalid UUID format") + } + } + return uuid, nil + default: + return uuid, fmt.Errorf("invalid UUID length: %d", len(b)) + } + // s is now at least 36 bytes long + // it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + if b[8] != '-' || b[13] != '-' || b[18] != '-' || b[23] != '-' { + return uuid, errors.New("invalid UUID format") + } + for i, x := range [16]int{ + 0, 2, 4, 6, + 9, 11, + 14, 16, + 19, 21, + 24, 26, 28, 30, 32, 34} { + v, ok := xtob(b[x], b[x+1]) + if !ok { + return uuid, errors.New("invalid UUID format") + } + uuid[i] = v + } + return uuid, nil +} + +// MustParse is like Parse but panics if the string cannot be parsed. +// It simplifies safe initialization of global variables holding compiled UUIDs. +func MustParse(s string) UUID { + uuid, err := Parse(s) + if err != nil { + panic(`uuid: Parse(` + s + `): ` + err.Error()) + } + return uuid +} + +// FromBytes creates a new UUID from a byte slice. Returns an error if the slice +// does not have a length of 16. The bytes are copied from the slice. +func FromBytes(b []byte) (uuid UUID, err error) { + err = uuid.UnmarshalBinary(b) + return uuid, err +} + +// Must returns uuid if err is nil and panics otherwise. +func Must(uuid UUID, err error) UUID { + if err != nil { + panic(err) + } + return uuid +} + +// String returns the string form of uuid, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +// , or "" if uuid is invalid. +func (uuid UUID) String() string { + var buf [36]byte + encodeHex(buf[:], uuid) + return string(buf[:]) +} + +// URN returns the RFC 2141 URN form of uuid, +// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, or "" if uuid is invalid. +func (uuid UUID) URN() string { + var buf [36 + 9]byte + copy(buf[:], "urn:uuid:") + encodeHex(buf[9:], uuid) + return string(buf[:]) +} + +func encodeHex(dst []byte, uuid UUID) { + hex.Encode(dst, uuid[:4]) + dst[8] = '-' + hex.Encode(dst[9:13], uuid[4:6]) + dst[13] = '-' + hex.Encode(dst[14:18], uuid[6:8]) + dst[18] = '-' + hex.Encode(dst[19:23], uuid[8:10]) + dst[23] = '-' + hex.Encode(dst[24:], uuid[10:]) +} + +// Variant returns the variant encoded in uuid. +func (uuid UUID) Variant() Variant { + switch { + case (uuid[8] & 0xc0) == 0x80: + return RFC4122 + case (uuid[8] & 0xe0) == 0xc0: + return Microsoft + case (uuid[8] & 0xe0) == 0xe0: + return Future + default: + return Reserved + } +} + +// Version returns the version of uuid. +func (uuid UUID) Version() Version { + return Version(uuid[6] >> 4) +} + +func (v Version) String() string { + if v > 15 { + return fmt.Sprintf("BAD_VERSION_%d", v) + } + return fmt.Sprintf("VERSION_%d", v) +} + +func (v Variant) String() string { + switch v { + case RFC4122: + return "RFC4122" + case Reserved: + return "Reserved" + case Microsoft: + return "Microsoft" + case Future: + return "Future" + case Invalid: + return "Invalid" + } + return fmt.Sprintf("BadVariant%d", int(v)) +} + +// SetRand sets the random number generator to r, which implements io.Reader. +// If r.Read returns an error when the package requests random data then +// a panic will be issued. +// +// Calling SetRand with nil sets the random number generator to the default +// generator. +func SetRand(r io.Reader) { + if r == nil { + rander = rand.Reader + return + } + rander = r +} diff --git a/vendor/github.com/google/uuid/version1.go b/vendor/github.com/google/uuid/version1.go new file mode 100644 index 00000000..199a1ac6 --- /dev/null +++ b/vendor/github.com/google/uuid/version1.go @@ -0,0 +1,44 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "encoding/binary" +) + +// NewUUID returns a Version 1 UUID based on the current NodeID and clock +// sequence, and the current time. If the NodeID has not been set by SetNodeID +// or SetNodeInterface then it will be set automatically. If the NodeID cannot +// be set NewUUID returns nil. If clock sequence has not been set by +// SetClockSequence then it will be set automatically. If GetTime fails to +// return the current NewUUID returns nil and an error. +// +// In most cases, New should be used. +func NewUUID() (UUID, error) { + nodeMu.Lock() + if nodeID == zeroID { + setNodeInterface("") + } + nodeMu.Unlock() + + var uuid UUID + now, seq, err := GetTime() + if err != nil { + return uuid, err + } + + timeLow := uint32(now & 0xffffffff) + timeMid := uint16((now >> 32) & 0xffff) + timeHi := uint16((now >> 48) & 0x0fff) + timeHi |= 0x1000 // Version 1 + + binary.BigEndian.PutUint32(uuid[0:], timeLow) + binary.BigEndian.PutUint16(uuid[4:], timeMid) + binary.BigEndian.PutUint16(uuid[6:], timeHi) + binary.BigEndian.PutUint16(uuid[8:], seq) + copy(uuid[10:], nodeID[:]) + + return uuid, nil +} diff --git a/vendor/github.com/google/uuid/version4.go b/vendor/github.com/google/uuid/version4.go new file mode 100644 index 00000000..84af91c9 --- /dev/null +++ b/vendor/github.com/google/uuid/version4.go @@ -0,0 +1,38 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import "io" + +// New creates a new random UUID or panics. New is equivalent to +// the expression +// +// uuid.Must(uuid.NewRandom()) +func New() UUID { + return Must(NewRandom()) +} + +// NewRandom returns a Random (Version 4) UUID. +// +// The strength of the UUIDs is based on the strength of the crypto/rand +// package. +// +// A note about uniqueness derived from the UUID Wikipedia entry: +// +// Randomly generated UUIDs have 122 random bits. One's annual risk of being +// hit by a meteorite is estimated to be one chance in 17 billion, that +// means the probability is about 0.00000000006 (6 × 10−11), +// equivalent to the odds of creating a few tens of trillions of UUIDs in a +// year and having one duplicate. +func NewRandom() (UUID, error) { + var uuid UUID + _, err := io.ReadFull(rander, uuid[:]) + if err != nil { + return Nil, err + } + uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4 + uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10 + return uuid, nil +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 5cd7a11e..5ecd8f0e 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -170,6 +170,8 @@ github.com/google/go-github/v26/github github.com/google/go-querystring/query # github.com/google/gofuzz v1.0.0 github.com/google/gofuzz +# github.com/google/uuid v1.1.1 +github.com/google/uuid # github.com/googleapis/gax-go/v2 v2.0.5 github.com/googleapis/gax-go/v2 # github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d @@ -202,6 +204,19 @@ github.com/logrusorgru/aurora github.com/lucasb-eyer/go-colorful # github.com/mattn/go-runewidth v0.0.4 github.com/mattn/go-runewidth +# github.com/microsoft/azure-devops-go-api/azuredevops v0.0.0-20190912142452-3207b4a469d3 +github.com/microsoft/azure-devops-go-api/azuredevops +github.com/microsoft/azure-devops-go-api/azuredevops/build +github.com/microsoft/azure-devops-go-api/azuredevops/core +github.com/microsoft/azure-devops-go-api/azuredevops/distributedtaskcommon +github.com/microsoft/azure-devops-go-api/azuredevops/git +github.com/microsoft/azure-devops-go-api/azuredevops/test +github.com/microsoft/azure-devops-go-api/azuredevops/webapi +github.com/microsoft/azure-devops-go-api/azuredevops/identity +github.com/microsoft/azure-devops-go-api/azuredevops/operations +github.com/microsoft/azure-devops-go-api/azuredevops/policy +github.com/microsoft/azure-devops-go-api/azuredevops/system +github.com/microsoft/azure-devops-go-api/azuredevops/delegatedauthorization # github.com/mmcdole/gofeed v1.0.0-beta2.0.20190420154928-0e68beaf6fdf github.com/mmcdole/gofeed github.com/mmcdole/gofeed/atom