diff --git a/go.mod b/go.mod index 13ba2b54b..3c200a406 100644 --- a/go.mod +++ b/go.mod @@ -3,16 +3,16 @@ module github.com/dc-tec/openbao-operator go 1.26.4 require ( - cloud.google.com/go/storage v1.62.2 - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.1 + cloud.google.com/go/storage v1.62.3 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.22.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.7.0 github.com/Masterminds/semver/v3 v3.5.0 - github.com/aws/aws-sdk-go-v2 v1.41.11 - github.com/aws/aws-sdk-go-v2/config v1.32.22 - github.com/aws/aws-sdk-go-v2/credentials v1.19.21 - github.com/aws/aws-sdk-go-v2/service/s3 v1.103.1 - github.com/aws/smithy-go v1.27.0 + github.com/aws/aws-sdk-go-v2 v1.42.0 + github.com/aws/aws-sdk-go-v2/config v1.32.24 + github.com/aws/aws-sdk-go-v2/credentials v1.19.23 + github.com/aws/aws-sdk-go-v2/service/s3 v1.103.3 + github.com/aws/smithy-go v1.27.1 github.com/go-logr/logr v1.4.3 github.com/google/go-containerregistry v0.21.6 github.com/hashicorp/golang-lru/v2 v2.0.7 @@ -23,13 +23,13 @@ require ( github.com/prometheus/client_model v0.6.2 github.com/prometheus/common v0.68.1 github.com/robfig/cron/v3 v3.0.1 - github.com/sigstore/cosign/v3 v3.0.6 + github.com/sigstore/cosign/v3 v3.1.0 github.com/sigstore/sigstore-go v1.2.0 github.com/stretchr/testify v1.11.1 github.com/zclconf/go-cty v1.18.1 gocloud.dev v0.46.0 golang.org/x/oauth2 v0.36.0 - golang.org/x/sync v0.20.0 + golang.org/x/sync v0.21.0 golang.org/x/time v0.15.0 google.golang.org/api v0.283.0 gopkg.in/yaml.v3 v3.0.1 @@ -62,27 +62,27 @@ require ( github.com/antlr4-go/antlr/v4 v4.13.1 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect - github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.12 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.27 // indirect + github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.13 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.29 // indirect github.com/aws/aws-sdk-go-v2/feature/s3/transfermanager v0.2.3 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.27 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.27 // indirect - github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.28 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.11 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.20 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.27 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.27 // indirect - github.com/aws/aws-sdk-go-v2/service/signin v1.1.3 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.31.1 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.36.4 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.43.1 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.29 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.29 // indirect + github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.30 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.12 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.22 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.29 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.29 // indirect + github.com/aws/aws-sdk-go-v2/service/signin v1.1.5 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.31.3 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.36.6 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.43.3 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver v3.5.1+incompatible // indirect github.com/blang/semver/v4 v4.0.0 // indirect github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 // indirect - github.com/coreos/go-oidc/v3 v3.17.0 // indirect + github.com/coreos/go-oidc/v3 v3.18.0 // indirect github.com/cyberphone/json-canonicalization v0.0.0-20241213102144-19d51d7fe467 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/digitorus/pkcs7 v0.0.0-20230818184609-3a137a874352 // indirect @@ -95,7 +95,7 @@ require ( github.com/envoyproxy/protoc-gen-validate v1.3.3 // indirect github.com/evanphx/json-patch/v5 v5.9.11 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect - github.com/fsnotify/fsnotify v1.9.0 // indirect + github.com/fsnotify/fsnotify v1.10.1 // indirect github.com/fxamacker/cbor/v2 v2.9.0 // indirect github.com/go-chi/chi/v5 v5.3.0 // indirect github.com/go-jose/go-jose/v4 v4.1.4 // indirect @@ -131,7 +131,7 @@ require ( github.com/google/certificate-transparency-go v1.3.3 // indirect github.com/google/gnostic-models v0.7.0 // indirect github.com/google/go-cmp v0.7.0 // indirect - github.com/google/go-github/v73 v73.0.0 // indirect + github.com/google/go-github/v88 v88.0.0 // indirect github.com/google/go-querystring v1.2.0 // indirect github.com/google/pprof v0.0.0-20260402051712-545e8a4df936 // indirect github.com/google/s2a-go v0.1.9 // indirect @@ -189,8 +189,8 @@ require ( gitlab.com/gitlab-org/api/client-go v1.46.0 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.opentelemetry.io/contrib/detectors/gcp v1.42.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.68.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0 // indirect go.opentelemetry.io/otel v1.44.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0 // indirect @@ -213,7 +213,7 @@ require ( golang.org/x/tools v0.45.0 // indirect golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect - google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7 // indirect + google.golang.org/genproto v0.0.0-20260406210006-6f92a3bedf2d // indirect google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260523011958-0a33c5d7ca68 // indirect google.golang.org/grpc v1.81.1 // indirect diff --git a/go.sum b/go.sum index 31494d812..3a5712d74 100644 --- a/go.sum +++ b/go.sum @@ -14,16 +14,16 @@ cloud.google.com/go/iam v1.11.0 h1:KieQ9Pb+LLPak1O3Rv3GgCxhnmkYf7Xyh0P5HfF1jFM= cloud.google.com/go/iam v1.11.0/go.mod h1:KP+nKGugNJW4LcLx1uEZcq1ok5sQHFaQehQNl4QDgV4= cloud.google.com/go/kms v1.31.0 h1:LS8N92OxFDgOLg5NCo3OmbvjtQAIVT5gUHVLKIDHaFE= cloud.google.com/go/kms v1.31.0/go.mod h1:YIyXZym11R5uovJJt4oN5eUL3oPmirF3yKeIh6QAf4U= -cloud.google.com/go/logging v1.13.2 h1:qqlHCBvieJT9Cdq4QqYx1KPadCQ2noD4FK02eNqHAjA= -cloud.google.com/go/logging v1.13.2/go.mod h1:zaybliM3yun1J8mU2dVQ1/qDzjbOqEijZCn6hSBtKak= +cloud.google.com/go/logging v1.14.0 h1:xpPpY8cVT6n9DgIRgrWyE+YEsGlO/994pWnbc7o5Eh4= +cloud.google.com/go/logging v1.14.0/go.mod h1:jmI+Try/fZeOTOAer3wVYOuPf9WX9PyzhlSDoBAi4HM= cloud.google.com/go/longrunning v1.0.0 h1:lwzWEYD8+NkYV7dhexOz6kmlvajZA70+bW/xMhRVVdY= cloud.google.com/go/longrunning v1.0.0/go.mod h1:8nqFBPOO1U/XkhWl0I19AMZEphrHi73VNABIpKYaTwM= cloud.google.com/go/monitoring v1.25.0 h1:HnsTIOxTN6BCSkt1P/Im23r1m7MHTTpmSYCzPkW7NK4= cloud.google.com/go/monitoring v1.25.0/go.mod h1:wlj6rX+JGyusw/8+2duW4cJ6kmDHGmde3zMTJuG3Jpc= -cloud.google.com/go/storage v1.62.2 h1:WgR4U9n7bIzXkkVnwPKKE8bkaKUNsHG+0MAAlh9DGU4= -cloud.google.com/go/storage v1.62.2/go.mod h1:cpYz/kRVZ+UQAF1uHeea10/9ewcRbxGoGNKsS9daSXA= -cloud.google.com/go/trace v1.11.7 h1:kDNDX8JkaAG3R2nq1lIdkb7FCSi1rCmsEtKVsty7p+U= -cloud.google.com/go/trace v1.11.7/go.mod h1:TNn9d5V3fQVf6s4SCveVMIBS2LJUqo73GACmq/Tky0s= +cloud.google.com/go/storage v1.62.3 h1:SZq1t23NCI+e96dH77Dg3PEfsNNEjqO8zE5AnD8gVD0= +cloud.google.com/go/storage v1.62.3/go.mod h1:cpYz/kRVZ+UQAF1uHeea10/9ewcRbxGoGNKsS9daSXA= +cloud.google.com/go/trace v1.12.0 h1:XvWHYfr9q88cX4pZyou6qCcSagnuASyUq2ej1dB6NzQ= +cloud.google.com/go/trace v1.12.0/go.mod h1:TOYfyeoyCGsSH0ifXD6Aius24uQI9xV3RyvOdljFIyg= filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo= filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc= filippo.io/mldsa v0.0.0-20260215214346-43d0283efc3e h1:VsUbObBMxXlc23Eb9VeeJYE4jvTs87qa5RqSN2U5FJU= @@ -31,8 +31,8 @@ filippo.io/mldsa v0.0.0-20260215214346-43d0283efc3e/go.mod h1:32qQ5yj3R24Eu03iWF github.com/AdamKorcz/go-fuzz-headers-1 v0.0.0-20230919221257-8b5d3ce2d11d h1:zjqpY4C7H15HjRPEenkS4SAn3Jy2eRRjkjZbGR30TOg= github.com/AdamKorcz/go-fuzz-headers-1 v0.0.0-20230919221257-8b5d3ce2d11d/go.mod h1:XNqJ7hv2kY++g8XEHREpi+JqZo3+0l+CH2egBVN4yqM= github.com/Azure/azure-sdk-for-go v68.0.0+incompatible h1:fcYLmCpyNYRnvJbPerq7U0hS+6+I79yEDJBqVNcqUzU= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.1 h1:jHb/wfvRikGdxMXYV3QG/SzUOPYN9KEUUuC0Yd0/vC0= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.1/go.mod h1:pzBXCYn05zvYIrwLgtK8Ap8QcjRg+0i76tMQdWN6wOk= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.22.0 h1:aokoqcHvaGjiM3VpjKDfMMnF/8epJ+Q1HLJ7CudztqE= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.22.0/go.mod h1:/WYEx9pcM9Y+Dd/APJaNlSvVSvzl54rrMdZT5+Oi2LM= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 h1:Hk5QBxZQC1jb2Fwj6mpzme37xbCDdNTxU7O9eb5+LB4= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1/go.mod h1:IYus9qsFobWIc2YVwe/WPjcnyCkPKtnHAqUYeebc8z0= github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= @@ -73,46 +73,46 @@ github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= -github.com/aws/aws-sdk-go-v2 v1.41.11 h1:9PRf7jyTMEUM6fuNRAJa2mO/skJfrF50rENJwf2LXqw= -github.com/aws/aws-sdk-go-v2 v1.41.11/go.mod h1:iiUX27gOXRuYaoeUVXhUpPwjJHzISfPAjjcuhUbLSVs= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.12 h1:oRtsqWgxbpeXrOlxOoQStx2M9WNbIkPq4C4Xn1or6bc= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.12/go.mod h1:Zg0Oe9qT+9wcezlm1a64wGJp2qZdRElVxo/seJf7jYU= -github.com/aws/aws-sdk-go-v2/config v1.32.22 h1:Vfvp7+fYKsVCADcWOEllqEV47aIBXhNchvyDFu1B5fY= -github.com/aws/aws-sdk-go-v2/config v1.32.22/go.mod h1:0+H+0nPKbvWltf5vSIGkApv+hGbaQ4FfwTjGIYQREcw= -github.com/aws/aws-sdk-go-v2/credentials v1.19.21 h1:0+HscFXtNa4+3buV4IlG6v5lnOdzi5TrpicFGjKHgh4= -github.com/aws/aws-sdk-go-v2/credentials v1.19.21/go.mod h1:UE8+9t5zudFwu5k5ShC1PKArVEdOkQQdCXIHQAVNUcU= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.27 h1:BEfN1sjtiKEdikRDxYkjZNE4tyvw/YbGWCbl3xDZgRw= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.27/go.mod h1:ISGSFNbOHRS+JV/17yStzRTPBUHHqF92kCpRLLyH3Nk= +github.com/aws/aws-sdk-go-v2 v1.42.0 h1:XvXMJTkFQtpBKIWZnmr9ZEOc2InWM2yldjXEJ/bymhA= +github.com/aws/aws-sdk-go-v2 v1.42.0/go.mod h1:27+ACypSLljLAEKsCYOmrjKh83vuTRkuAe9Uv/3A4bg= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.13 h1:p1BBrg/Hhp6uK7zpejeI8QFXHJeC/mynzi04Sl03k9g= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.13/go.mod h1:8cIfkE9MDhkRZGpQ22aV6/lkYeYSozpz16Smrs5x4Ls= +github.com/aws/aws-sdk-go-v2/config v1.32.24 h1:aEDEj533yGdVvEHfkCY0D/1FbDrjnZr4pIulxRjqpHs= +github.com/aws/aws-sdk-go-v2/config v1.32.24/go.mod h1:yZtrGKJGlqfEW+/m2uTsJK+Jz7xF5R0eZfgcIG9m1ss= +github.com/aws/aws-sdk-go-v2/credentials v1.19.23 h1:Zhu3GOpRCkNjtE/gJpuPDsytSnaCCTQk8neAGsgzG5Y= +github.com/aws/aws-sdk-go-v2/credentials v1.19.23/go.mod h1:VsJF2ropPB37gDr7M2rLSpCE8IQWdpl62uae7qxZmqU= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.29 h1:r6qZHbT+wxgWO/e9vYNUEtg7lv5+UN3pRqKhLXvnArg= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.29/go.mod h1:QRnaRcTVGKPGRy8w78HMQtKUGRYcnMZAANATkeVA6Mo= github.com/aws/aws-sdk-go-v2/feature/s3/transfermanager v0.2.3 h1:w5OoDiMN6x53ROmiIImGzmVcxXv2q1GXY+aKV4WAJYM= github.com/aws/aws-sdk-go-v2/feature/s3/transfermanager v0.2.3/go.mod h1:dAhgYp776bX3LuWvnSCFwQEjNs6fuFg7YXIy5PXcP3Q= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.27 h1:8sPbKi1/KRHwl5oR3qN9mUXestCeHuaRutxylnr/eVY= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.27/go.mod h1:QV9IVIopJ1dpQUno0f9VYDUwOEjj8u0iEJ4JiZVre3Y= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.27 h1:9d8AoASQY9UwrOSmiJ7uSM0MGUPFhnenwSvpaFfat2c= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.27/go.mod h1:x0rldpsnUQaQIs4Rh+Vwm9Z/0vI6BxadGtsgJfZFb8s= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.28 h1:eaS9vwQ5ym4Y9S6+G/K3d3lgZhxs9Sldcn/YS7cmdKY= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.28/go.mod h1:oTdbDr+BMs7gAYrNpD0LDTyqQfv6yOYgTDv46+xbwFY= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.11 h1:rFSsqDfCMPAmG70JOsYqFZCHXkyatoGa1K4YEt/BggQ= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.11/go.mod h1:XG68qW+YLLFH0vnSDCou43Cgj5TeAG83O5NRSJgt04Y= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.20 h1:yt2fjgev3Hqm33zPw0ZWtki3sZ0SLcr+PkuvXDAAf/8= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.20/go.mod h1:wnPjCjPJ6x5GBhrER8f0QakaQ2LokfhCVYxmAZBpPjY= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.27 h1:2/pUo42hhVmQcM21ttZoBOLHQymyUH8qEnZGTIuGBT8= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.27/go.mod h1:p7hwgbwompjCRNTdB3ytlldddNt1rDBgVVMqWEVG1II= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.27 h1:JEXSW4wztrl1MoL5EMvJMO7lc/TRZloztrJKNl96SW8= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.27/go.mod h1:8eL+YgEqy6IYqjwW6PG0Ubn59a2xtCzbz7Pi18JBu04= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.29 h1:f3vKqSo13fhTYb+JEcXwXefZQE26I1FB5eTSniU67ko= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.29/go.mod h1:MzoLFUArKGpGD+ukmPiTPG1X5x4o6M2kq4v2dr1FiEc= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.29 h1:RdwIf/CuUsvJX3RgJagbOyotl/cxoLY4xviKuE7p2GY= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.29/go.mod h1:71wt8W2EgswdZy9Mf9KNnzxZ3TiZlv4caKghPktDOkA= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.30 h1:VTGy885W5DKBxWRUJbym9hytNaYzsyaPkCHGRRMAOhU= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.30/go.mod h1:AS0HycUvJRFvTt613AYDOgO2jzw+00cVSMny8XB3yMY= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.12 h1:ZD2+BSw9vFsNlKYIasSNt3uDbjqqXIBcM13UJv/Lx2k= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.12/go.mod h1:Ms4zlcVBbXbiP7EVLhl+lgjvA/a7YphqQ3Ih3174EmI= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.22 h1:V51LGlOq/1VsDsHUdoklAQi7rMmx4qQubvFYAlP2254= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.22/go.mod h1:4Pzhyz8hJOm2bepgl+NjvRx8vlUFAIIvJnZ/MkcNPpU= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.29 h1:DRebniUGZ2MqiiIVmQJ04vIXr918hubdHMnarSLEWyU= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.29/go.mod h1:LfRkPCD8YHDM2E5eTkos2UpwYeZnBcVarTa8L59bJHA= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.29 h1:hiME6pBzC7OTl9LMtlyTWBuEl1f4QBcUmFDKC7MLXtc= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.29/go.mod h1:G7RP+uhagpKtKhd1BM9N6JQqjCcGEU47K5lBVZQyRQw= github.com/aws/aws-sdk-go-v2/service/kms v1.52.0 h1:QNtg+Mtj1zmepk568+UKBD5DFfqh+ESTUUqQT27JkQc= github.com/aws/aws-sdk-go-v2/service/kms v1.52.0/go.mod h1:Y0+uxvxz6ib4KktRdK0V4X45Vcs/JyYoz8H71pO8xeI= -github.com/aws/aws-sdk-go-v2/service/s3 v1.103.1 h1:WkX5IXwcxgO/WPTvhEqoSW2L1GB1OyIxk0vuzzdTftc= -github.com/aws/aws-sdk-go-v2/service/s3 v1.103.1/go.mod h1:9Q9ZHyiTItraw8BXpO48pk398Mou0YCSI+xvFcaGgxU= -github.com/aws/aws-sdk-go-v2/service/signin v1.1.3 h1:t6U7sowMfOjTeZXtDOtgEJXsoJyX4MDag+sfWGwUM9M= -github.com/aws/aws-sdk-go-v2/service/signin v1.1.3/go.mod h1:WhO1EH3phjFWValQDsExaxncgEWJsHeoTvuyQAj3jwU= -github.com/aws/aws-sdk-go-v2/service/sso v1.31.1 h1:TUV8oytPCX1PfVgZn0N8/sPZx7T0YasaMCBHox1erlw= -github.com/aws/aws-sdk-go-v2/service/sso v1.31.1/go.mod h1:tEL1hqCrkgwrDVL04HuLxz1SLUXdh+4kKhWv1pXKeiY= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.36.4 h1:p9+Fizo2sUB6wI5Yb3K5lmykQAGs5JrKLBV/me6613Y= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.36.4/go.mod h1:0x10Wy0dVS4Gn552xhHY5th2QdYpfJf44EsfyYGV194= -github.com/aws/aws-sdk-go-v2/service/sts v1.43.1 h1:r/vUkpLilfCA3sxbRnkHbJejaoVHEdj4FEhv+Zva4DU= -github.com/aws/aws-sdk-go-v2/service/sts v1.43.1/go.mod h1:t01JURC8Fe5M+7R1K0vzIZ2NT04HqvZR+FjlHrHDT2A= -github.com/aws/smithy-go v1.27.0 h1:ZoFioDKJxkSIW2otF9T0aPtNlUwhdVCcuZh/rzH9Hus= -github.com/aws/smithy-go v1.27.0/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= +github.com/aws/aws-sdk-go-v2/service/s3 v1.103.3 h1:JRseEu/vIDMaWis4bSw0QbXL+cvIGc1XnX076H5ZXLE= +github.com/aws/aws-sdk-go-v2/service/s3 v1.103.3/go.mod h1:77ZAgynvx1txMvDG8gGWoWkO1augYDxkp9JElWFgjQU= +github.com/aws/aws-sdk-go-v2/service/signin v1.1.5 h1:6Xt6Ztjkwdia/7EtEaG7ki/qZUYlCcd7tGUotQed1QE= +github.com/aws/aws-sdk-go-v2/service/signin v1.1.5/go.mod h1:LxYujSTLPRlp2vTtcUO/+1ilrew8ytt6SvQyOgejzFQ= +github.com/aws/aws-sdk-go-v2/service/sso v1.31.3 h1:ey1XLTYXb9PcLt4535632o5kCGXNXEhNb620Dqwuylo= +github.com/aws/aws-sdk-go-v2/service/sso v1.31.3/go.mod h1:Lk7PlmoTYryQmyBG0EXqj5BcUbj3whXdU2s3yGI3EAc= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.36.6 h1:yLr03zQE/5Eu5l3QU0Si+xMbLMbSDF2YXsigqXngs6g= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.36.6/go.mod h1:Q5N6icH+KJZDLh+ESNwzdv6cZ6vLFF/egy3IOxWhmz4= +github.com/aws/aws-sdk-go-v2/service/sts v1.43.3 h1:VrIhKRCSK1umelSgB9RghvA9RTUYeQffyAS5ApXehNI= +github.com/aws/aws-sdk-go-v2/service/sts v1.43.3/go.mod h1:r8wkDOuLaaMFqFiYAb8dGY2A3gJCOujMc6CFOVC4Zhc= +github.com/aws/smithy-go v1.27.1 h1:4T340VFndXtADGF52gYa1POyL7s9E4Z1OeZ1hCscIw8= +github.com/aws/smithy-go v1.27.1/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= @@ -132,8 +132,8 @@ github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 h1:aBangftG7EVZoUb69Os github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2/go.mod h1:qwXFYgsP6T7XnJtbKlf1HP8AjxZZyzxMmc+Lq5GjlU4= github.com/codahale/rfc6979 v0.0.0-20141003034818-6a90f24967eb h1:EDmT6Q9Zs+SbUoc7Ik9EfrFqcylYqgPZ9ANSbTAntnE= github.com/codahale/rfc6979 v0.0.0-20141003034818-6a90f24967eb/go.mod h1:ZjrT6AXHbDs86ZSdt/osfBi5qfexBrKUdONk989Wnk4= -github.com/coreos/go-oidc/v3 v3.17.0 h1:hWBGaQfbi0iVviX4ibC7bk8OKT5qNr4klBaCHVNvehc= -github.com/coreos/go-oidc/v3 v3.17.0/go.mod h1:wqPbKFrVnE90vty060SB40FCJ8fTHTxSwyXJqZH+sI8= +github.com/coreos/go-oidc/v3 v3.18.0 h1:V9orjXynvu5wiC9SemFTWnG4F45v403aIcjWo0d41+A= +github.com/coreos/go-oidc/v3 v3.18.0/go.mod h1:DYCf24+ncYi+XkIH97GY1+dqoRlbaSI26KVTCI9SrY4= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= @@ -177,8 +177,8 @@ github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSw github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= -github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= -github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/fsnotify/fsnotify v1.10.1 h1:b0/UzAf9yR5rhf3RPm9gf3ehBPpf0oZKIjtpKrx59Ho= +github.com/fsnotify/fsnotify v1.10.1/go.mod h1:TLheqan6HD6GBK6PrDWyDPBaEV8LspOxvPSjC+bVfgo= github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM= github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= github.com/gkampitakis/ciinfo v0.3.2 h1:JcuOPk8ZU7nZQjdUhctuhQofk7BGHuIy0c9Ez8BNhXs= @@ -291,8 +291,8 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/go-containerregistry v0.21.6 h1:T+yqQIlJXKrM98Om4DlW3GoWQAmhZuLMwoDOvVrtiUM= github.com/google/go-containerregistry v0.21.6/go.mod h1:U7MMSBIJynke2MVQrQk19NP9k/uQsGz/h0amIFSHMbo= -github.com/google/go-github/v73 v73.0.0 h1:aR+Utnh+Y4mMkS+2qLQwcQ/cF9mOTpdwnzlaw//rG24= -github.com/google/go-github/v73 v73.0.0/go.mod h1:fa6w8+/V+edSU0muqdhCVY7Beh1M8F1IlQPZIANKIYw= +github.com/google/go-github/v88 v88.0.0 h1:dZA9IKkPK1eXZj4ypngnpRj5FwdpTv4whix2PrQMP7M= +github.com/google/go-github/v88 v88.0.0/go.mod h1:rufTDgn2N45wjhukLTyxmvc9nilSp3mr3Rgtt6b1MPw= github.com/google/go-querystring v1.2.0 h1:yhqkPbu2/OH+V9BfpCVPZkNmUXhb2gBxJArfhIxNtP0= github.com/google/go-querystring v1.2.0/go.mod h1:8IFJqpSRITyJ8QhQ13bmbeMBDfmeEJZD5A0egEOmkqU= github.com/google/go-replayers/grpcreplay v1.3.0 h1:1Keyy0m1sIpqstQmgz307zhiJ1pV4uIlFds5weTmxbo= @@ -474,8 +474,8 @@ github.com/sergi/go-diff v1.4.0 h1:n/SP9D5ad1fORl+llWyN+D6qoUETXNZARKjyY2/KVCw= github.com/sergi/go-diff v1.4.0/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/shibumi/go-pathspec v1.3.0 h1:QUyMZhFo0Md5B8zV8x2tesohbb5kfbpTi9rBnKh5dkI= github.com/shibumi/go-pathspec v1.3.0/go.mod h1:Xutfslp817l2I1cZvgcfeMQJG5QnU2lh5tVaaMCl3jE= -github.com/sigstore/cosign/v3 v3.0.6 h1:k8XaUd9pmLknHBst/v0rUGHVdB4D9cfaBmWUaMAOocE= -github.com/sigstore/cosign/v3 v3.0.6/go.mod h1:ckLRkVecfUCYxL8isHODY9lwyKmDaRCPn00p6yFxHg0= +github.com/sigstore/cosign/v3 v3.1.0 h1:5oBfEE//yIEd5qrDk/kq8uVUdd7rqDcIfniQ7pxzqGk= +github.com/sigstore/cosign/v3 v3.1.0/go.mod h1:0FFmJoSvF3Am0BqAA+UPB+4h9Wq3qVYEgE3X01nigE0= github.com/sigstore/protobuf-specs v0.5.1 h1:/5OPaNuolRJmQfeZLayJGFXMpsRJEdgC6ah1/+7Px7U= github.com/sigstore/protobuf-specs v0.5.1/go.mod h1:DRBzpFuE+LnvQMN10/dU6nBeKwVLGEQ6o2FovN2Rats= github.com/sigstore/rekor v1.5.2 h1:k6pX4o1zFAzAvDbXiVIp5IHj1b0wcDaxsbsbNpuRO8o= @@ -571,10 +571,10 @@ go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/contrib/detectors/gcp v1.42.0 h1:kpt2PEJuOuqYkPcktfJqWWDjTEd/FNgrxcniL7kQrXQ= go.opentelemetry.io/contrib/detectors/gcp v1.42.0/go.mod h1:W9zQ439utxymRrXsUOzZbFX4JhLxXU4+ZnCt8GG7yA8= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0 h1:yI1/OhfEPy7J9eoa6Sj051C7n5dvpj0QX8g4sRchg04= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0/go.mod h1:NoUCKYWK+3ecatC4HjkRktREheMeEtrXoQxrqYFeHSc= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0 h1:OyrsyzuttWTSur2qN/Lm0m2a8yqyIjUVBZcxFPuXq2o= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0/go.mod h1:C2NGBr+kAB4bk3xtMXfZ94gqFDtg/GkI7e9zqGh5Beg= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.68.0 h1:0Qx7VGBacMm9ZENQ7TnNObTYI4ShC+lHI16seduaxZo= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.68.0/go.mod h1:Sje3i3MjSPKTSPvVWCaL8ugBzJwik3u4smCjUeuupqg= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0 h1:CqXxU8VOmDefoh0+ztfGaymYbhdB/tT3zs79QaZTNGY= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0/go.mod h1:BuhAPThV8PBHBvg8ZzZ/Ok3idOdhWIodywz2xEcRbJo= go.opentelemetry.io/otel v1.44.0 h1:JjwHmHpA4iZ3wBxluu2fbbE7j4kqlE8jXyAyPXH7HqU= go.opentelemetry.io/otel v1.44.0/go.mod h1:BMgjTHL9WPRlRjL2oZCBTL4whCGtXch2H4BhOPIAyYc= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0 h1:THuZiwpQZuHPul65w4WcwEnkX2QIuMT+UFoOrygtoJw= @@ -634,8 +634,8 @@ golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7 golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/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-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= -golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/sync v0.21.0 h1:HLII4xRRTtCRkxYp4HNFF0Js/Og6q2i++KXbg0gHCwM= +golang.org/x/sync v0.21.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -688,8 +688,8 @@ gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= google.golang.org/api v0.283.0 h1:0lkp8u0MPwJVHqRL+nJlMAoZVVzbmiXmFHXMOTmSPik= google.golang.org/api v0.283.0/go.mod h1:6Wssta4c5n9qHq5CBhmlai5h/PUa1djdDAIhYEHyvcM= -google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7 h1:XzmzkmB14QhVhgnawEVsOn6OFsnpyxNPRY9QV01dNB0= -google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7/go.mod h1:L43LFes82YgSonw6iTXTxXUX1OlULt4AQtkik4ULL/I= +google.golang.org/genproto v0.0.0-20260406210006-6f92a3bedf2d h1:N1Ec54vZnIPd7MnxRiYLW+oY4fDR4BOS/LrssdD9+ek= +google.golang.org/genproto v0.0.0-20260406210006-6f92a3bedf2d/go.mod h1:c2hJ1grtnH0xUiEKGDGkjGNTJ1Hy2LrblyKOHF0sqRM= google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa h1:Kjn0N0tCrDgiAFW+lGO4JZ3ck44CehvJQMAwj9QF0G8= google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa/go.mod h1:q4lMZS6kskjT5HvCPrnnypcDPVJqT/f4nfxmkE7gryY= google.golang.org/genproto/googleapis/rpc v0.0.0-20260523011958-0a33c5d7ca68 h1:PvEgGJf9C/1u5CHkInMg7UFYYUoiaQmW2LbtH0pjB78= diff --git a/vendor/cloud.google.com/go/storage/CHANGES.md b/vendor/cloud.google.com/go/storage/CHANGES.md index fd5247f72..4fc006217 100644 --- a/vendor/cloud.google.com/go/storage/CHANGES.md +++ b/vendor/cloud.google.com/go/storage/CHANGES.md @@ -1,6 +1,13 @@ # Changes +## [1.62.3](https://github.com/googleapis/google-cloud-go/releases/tag/storage%2Fv1.62.3) (2026-06-03) + +### Bug Fixes + +* add server closed idle connection to retriable errors (#14594) ([20b37d6](https://github.com/googleapis/google-cloud-go/commit/20b37d65d56d4b5e7b8d43b1f6b2ddefcd8944be)) +* fix race condition during retries in gRPC writer (#14649) ([04b6c63](https://github.com/googleapis/google-cloud-go/commit/04b6c635c09de1772fcefd8a7fd5e4ffdd370b79)) + ## [1.62.2](https://github.com/googleapis/google-cloud-go/releases/tag/storage%2Fv1.62.2) (2026-05-18) ### Features @@ -35,6 +42,18 @@ * Update `EnableParallelUpload` documentation in `writer.go` (#14328) ([22d0749](http://github.com/googleapis/google-cloud-go/commit/22d0749f8fdbeaa34f2a836b63510bd0c3def990)) +## [1.61.5](https://github.com/googleapis/google-cloud-go/releases/tag/storage%2Fv1.61.5) (2026-06-01) + +### Bug Fixes + +* fix race condition during retries in gRPC writer (#14649) ([e87213b](https://github.com/googleapis/google-cloud-go/commit/e87213b78affff3aafb6ee0ecd542d65719e5c5c)) + +## [1.61.4](https://github.com/googleapis/google-cloud-go/releases/tag/storage%2Fv1.61.4) (2026-05-21) + +### Bug Fixes + +* add server closed idle connection to retriable errors (#14594) ([37580e7](https://github.com/googleapis/google-cloud-go/commit/37580e7eb530bbcf54951425947060c51cb0b30a)) + ## [1.61.3](https://github.com/googleapis/google-cloud-go/releases/tag/storage%2Fv1.61.3) (2026-03-13) ### Documentation diff --git a/vendor/cloud.google.com/go/storage/grpc_writer.go b/vendor/cloud.google.com/go/storage/grpc_writer.go index 000766a46..2f646732a 100644 --- a/vendor/cloud.google.com/go/storage/grpc_writer.go +++ b/vendor/cloud.google.com/go/storage/grpc_writer.go @@ -443,6 +443,31 @@ func (w *gRPCWriter) writeLoop(ctx context.Context) error { defer cancel() w.streamSender.connect(ctx, bscs, w.settings.gax...) + // Drain any initial completions (like QueryWriteStatus results). +Loop: + for { + select { + case c, ok := <-completions: + if !ok { + return w.streamSender.err() + } + w.handleCompletion(c) + default: + break Loop + } + } + + if w.bufFlushedIdx > 0 { + copy(w.buf, w.buf[w.bufFlushedIdx:]) + w.buf = w.buf[:len(w.buf)-w.bufFlushedIdx] + w.bufBaseOffset += int64(w.bufFlushedIdx) + w.bufUnsentIdx -= w.bufFlushedIdx + if w.bufUnsentIdx < 0 { + w.bufUnsentIdx = 0 + } + w.bufFlushedIdx = -1 + } + // Send any full quantum in w.buf, possibly including a flush if err := w.withCommandRetryDeadline(func() error { sentOffset, ok := w.sendBufferToTarget(chcs, w.buf, w.bufBaseOffset, cap(w.buf), @@ -591,6 +616,26 @@ func (c *gRPCWriterCommandWrite) handle(w *gRPCWriter, cs gRPCWriterCommandHandl return nil } + if !c.hasStarted { + c.initialOffset = w.bufBaseOffset + int64(len(w.buf)) + c.hasStarted = true + } else { + // Retrying this command; check if server has persisted some bytes of this command's payload. + bytesPersisted := w.bufBaseOffset - c.initialOffset + if bytesPersisted > 0 { + if int64(len(c.p)) < bytesPersisted { + bytesPersisted = int64(len(c.p)) + } + c.p = c.p[bytesPersisted:] + c.initialOffset = w.bufBaseOffset + + if len(c.p) == 0 { + c.markDone() + return nil + } + } + } + // Zero-Copy send. if w.forceOneShot { err := c.zeroCopyWrite(w, cs) @@ -650,6 +695,7 @@ func (c *gRPCWriterCommandWrite) handle(w *gRPCWriter, cs gRPCWriterCommandHandl w.buf = w.buf[:wblen+toNextWriteQuantum] copied := copy(w.buf[wblen:], c.p) c.p = c.p[copied:] + c.initialOffset += int64(copied) firstFullBufFromCmd := cap(w.buf) - len(w.buf) sending := w.buf[w.bufUnsentIdx:] @@ -674,6 +720,7 @@ func (c *gRPCWriterCommandWrite) handle(w *gRPCWriter, cs gRPCWriterCommandHandl trim = len(c.p) } c.p = c.p[trim:] + c.initialOffset += int64(trim) cmdBaseOffset = bufTail } offset := cmdBaseOffset diff --git a/vendor/cloud.google.com/go/storage/internal/version.go b/vendor/cloud.google.com/go/storage/internal/version.go index 27f817af9..39c02c07d 100644 --- a/vendor/cloud.google.com/go/storage/internal/version.go +++ b/vendor/cloud.google.com/go/storage/internal/version.go @@ -17,4 +17,4 @@ package internal // Version is the current tagged release of the library. -const Version = "1.62.2" +const Version = "1.62.3" diff --git a/vendor/cloud.google.com/go/storage/invoke.go b/vendor/cloud.google.com/go/storage/invoke.go index b0d27c4da..609d34e85 100644 --- a/vendor/cloud.google.com/go/storage/invoke.go +++ b/vendor/cloud.google.com/go/storage/invoke.go @@ -206,10 +206,11 @@ func ShouldRetry(err error) bool { // https://cloud.google.com/storage/docs/exponential-backoff. return e.Code == 408 || e.Code == 429 || (e.Code >= 500 && e.Code < 600) case *net.OpError, *url.Error: - // Retry socket-level errors ECONNREFUSED and ECONNRESET (from syscall). + // Retry socket-level errors ECONNREFUSED and ECONNRESET (from syscall) + // and transport-level errors like server closed idle connections. // Unfortunately the error type is unexported, so we resort to string // matching. - retriable := []string{"connection refused", "connection reset", "broken pipe", "client connection lost"} + retriable := []string{"connection refused", "connection reset", "broken pipe", "client connection lost", "server closed idle connection"} for _, s := range retriable { if strings.Contains(e.Error(), s) { return true diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md index d730a3bc3..ed56ac241 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.22.0 (2026-06-04) + +### Features Added + +* Added type `datetime.RFC7231` for date/time values in RFC 1123 format with a fixed GMT timezone. + +### Other Changes + +* Upgraded dependencies. + ## 1.21.1 (2026-04-16) ### Bugs Fixed diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go index 8ad391dd2..4f7aa6434 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go @@ -37,5 +37,5 @@ const ( Module = "azcore" // Version is the semantic version (see http://semver.org) of this module. - Version = "v1.21.1" + Version = "v1.22.0" ) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_bearer_token.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_bearer_token.go index 547e5a327..f204a19c4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_bearer_token.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_bearer_token.go @@ -182,7 +182,7 @@ func (b *BearerTokenPolicy) handleChallenge(req *policy.Request, res *http.Respo func checkHTTPSForAuth(req *policy.Request, allowHTTP bool) error { if strings.ToLower(req.Raw().URL.Scheme) != "https" && !allowHTTP { - return errorinfo.NonRetriableError(errors.New("authenticated requests are not permitted for non TLS protected (https) endpoints")) + return errorinfo.NonRetriableError(errors.New("authorized requests are not permitted for non-TLS protected (https) endpoints")) } return nil } diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/go_module_metadata.go index 866a617fa..46cb77c20 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/aws/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/go_module_metadata.go @@ -3,4 +3,4 @@ package aws // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.41.11" +const goModuleVersion = "1.42.0" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream/CHANGELOG.md index 72e2ba545..223ba3003 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream/CHANGELOG.md @@ -1,3 +1,7 @@ +# v1.7.13 (2026-06-04) + +* **Dependency Update**: Update to smithy-go v1.27.1 to fix several union-related deserialization bugs in schema-serde-enabled services. + # v1.7.12 (2026-06-03) * No change notes available for this release. diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream/go_module_metadata.go index b696f072d..f1e8adeac 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream/go_module_metadata.go @@ -3,4 +3,4 @@ package eventstream // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.7.12" +const goModuleVersion = "1.7.13" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/retry/jitter_backoff.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/retry/jitter_backoff.go index c266996de..14225a53a 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/aws/retry/jitter_backoff.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/retry/jitter_backoff.go @@ -4,6 +4,7 @@ import ( "math" "time" + "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/internal/rand" "github.com/aws/aws-sdk-go-v2/internal/timeconv" ) @@ -12,9 +13,20 @@ import ( // number of attempts. type ExponentialJitterBackoff struct { maxBackoff time.Duration - // precomputed number of attempts needed to reach max backoff. + // precomputed number of attempts needed to reach max backoff (legacy mode). maxBackoffAttempts float64 + // Base delay for non-throttle errors (x in the formula t_i = b * min(x * r^i, MAX_BACKOFF)). + baseDelay time.Duration + + // Throttle error checker. When set and the error is a throttle, the base + // delay is 1s regardless of the configured baseDelay. + throttle IsErrorThrottle + + // When true, applies MAX_BACKOFF before jitter and uses throttle-aware + // base delay. + retries2026 bool + randFloat64 func() (float64, error) } @@ -25,13 +37,53 @@ func NewExponentialJitterBackoff(maxBackoff time.Duration) *ExponentialJitterBac maxBackoff: maxBackoff, maxBackoffAttempts: math.Log2( float64(maxBackoff) / float64(time.Second)), + baseDelay: time.Second, randFloat64: rand.CryptoRandFloat64, } } +// exponentialJitterBackoffOption is a functional option for ExponentialJitterBackoff. +type exponentialJitterBackoffOption func(*ExponentialJitterBackoff) + +// withBaseDelay sets the base delay for non-throttle errors. +func withBaseDelay(d time.Duration) exponentialJitterBackoffOption { + return func(j *ExponentialJitterBackoff) { + j.baseDelay = d + } +} + +// withThrottleCheck sets the throttle error checker used to determine if the +// backoff should use the throttle base delay (1s) instead of the configured +// base delay. +func withThrottleCheck(t IsErrorThrottle) exponentialJitterBackoffOption { + return func(j *ExponentialJitterBackoff) { + j.throttle = t + } +} + +// newExponentialJitterBackoffWithOptions returns an ExponentialJitterBackoff +// with the given options applied. +func newExponentialJitterBackoffWithOptions(maxBackoff time.Duration, optFns ...exponentialJitterBackoffOption) *ExponentialJitterBackoff { + j := NewExponentialJitterBackoff(maxBackoff) + j.retries2026 = true + for _, fn := range optFns { + fn(j) + } + return j +} + // BackoffDelay returns the duration to wait before the next attempt should be // made. Returns an error if unable get a duration. func (j *ExponentialJitterBackoff) BackoffDelay(attempt int, err error) (time.Duration, error) { + if j.retries2026 { + return j.backoffDelay2026(attempt, err) + } + return j.backoffDelayLegacy(attempt, err) +} + +// backoffDelayLegacy preserves the original backoff formula: b * 2^i, capped +// at maxBackoff. +func (j *ExponentialJitterBackoff) backoffDelayLegacy(attempt int, err error) (time.Duration, error) { if attempt > int(j.maxBackoffAttempts) { return j.maxBackoff, nil } @@ -47,3 +99,26 @@ func (j *ExponentialJitterBackoff) BackoffDelay(attempt int, err error) (time.Du return timeconv.FloatSecondsDur(delaySeconds), nil } + +// backoffDelay2026 uses throttle-aware base delay and applies MAX_BACKOFF +// before jitter: t_i = b * min(x * 2^i, MAX_BACKOFF). +func (j *ExponentialJitterBackoff) backoffDelay2026(attempt int, err error) (time.Duration, error) { + x := j.baseDelay + if j.throttle != nil && j.throttle.IsErrorThrottle(err) == aws.TrueTernary { + x = time.Second + } + + b, randErr := j.randFloat64() + if randErr != nil { + return 0, randErr + } + + ri := math.Pow(2, float64(attempt)) + delaySeconds := float64(x) / float64(time.Second) * ri + maxBackoffSeconds := float64(j.maxBackoff) / float64(time.Second) + if delaySeconds > maxBackoffSeconds { + delaySeconds = maxBackoffSeconds + } + + return timeconv.FloatSecondsDur(b * delaySeconds), nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/retry/middleware.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/retry/middleware.go index 52acb62f9..ab024de04 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/aws/retry/middleware.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/retry/middleware.go @@ -233,9 +233,11 @@ func (r *Attempt) handleAttempt( "failed to release retry token after request error, %w", err) } // Release the attempt token based on the state of the attempt's error (if any). - if releaseError := releaseAttemptToken(err); releaseError != nil && err != nil { - return out, attemptResult, nopRelease, fmt.Errorf( - "failed to release initial token after request error, %w", err) + if !newRetries2026() || attemptNum == 1 { + if releaseError := releaseAttemptToken(err); releaseError != nil && err != nil { + return out, attemptResult, nopRelease, fmt.Errorf( + "failed to release initial token after request error, %w", err) + } } // If there was no error making the attempt, nothing further to do. There // will be nothing to retry. @@ -276,6 +278,13 @@ func (r *Attempt) handleAttempt( // Get a retry token that will be released after the releaseRetryToken, retryTokenErr := r.retryer.GetRetryToken(ctx, err) if retryTokenErr != nil { + // Long-polling operations must still back off when quota is exceeded. + if newRetries2026() && internalcontext.GetIsLongPolling(ctx) { + if retryDelay, delayErr := r.retryer.RetryDelay(attemptNum-1, err); delayErr == nil { + retryDelay = adjustForRetryAfterHeader(retryDelay, err, logger, r.LogAttempts) + _ = sdk.SleepWithContext(ctx, retryDelay) + } + } return out, attemptResult, nopRelease, errors.Join(err, retryTokenErr) } @@ -285,10 +294,17 @@ func (r *Attempt) handleAttempt( // Get the retry delay before another attempt can be made, and sleep for // that time. Potentially early exist if the sleep is canceled via the // context. - retryDelay, reqErr := r.retryer.RetryDelay(attemptNum, err) + attempt := attemptNum + if newRetries2026() { + attempt = attemptNum - 1 + } + retryDelay, reqErr := r.retryer.RetryDelay(attempt, err) if reqErr != nil { return out, attemptResult, releaseRetryToken, reqErr } + if newRetries2026() { + retryDelay = adjustForRetryAfterHeader(retryDelay, err, logger, r.LogAttempts) + } if reqErr = sdk.SleepWithContext(ctx, retryDelay); reqErr != nil { err = &aws.RequestCanceledError{Err: reqErr} return out, attemptResult, releaseRetryToken, err @@ -423,6 +439,43 @@ func AddRetryMiddlewares(stack *smithymiddle.Stack, options AddRetryMiddlewaresO return nil } +// adjustForRetryAfterHeader checks for the x-amz-retry-after response header +// and clamps the backoff duration accordingly. The header value is an integer +// representing milliseconds. The result is clamped to [t_i, 5s + t_i] where +// t_i is the jittered exponential backoff duration. Invalid header values are +// ignored. +func adjustForRetryAfterHeader(backoff time.Duration, err error, logger logging.Logger, logAttempts bool) time.Duration { + var re *http.ResponseError + if !errors.As(err, &re) || re.Response == nil || re.Response.Response == nil { + return backoff + } + + headerVal := re.Response.Header.Get("X-Amz-Retry-After") + if headerVal == "" { + return backoff + } + + ms, parseErr := strconv.ParseInt(headerVal, 10, 64) + if parseErr != nil || ms < 0 { + if logAttempts { + logger.Logf(logging.Debug, "ignoring invalid x-amz-retry-after header value %q", headerVal) + } + return backoff + } + + retryAfter := time.Duration(ms) * time.Millisecond + minDuration := backoff + maxDuration := 5*time.Second + backoff + + if retryAfter < minDuration { + return minDuration + } + if retryAfter > maxDuration { + return maxDuration + } + return retryAfter +} + // Determines the value of exception.type for metrics purposes. We prefer an // API-specific error code, otherwise it's just the Go type for the value. func errorType(err error) string { diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/retry/retry.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/retry/retry.go index af81635b3..c240fb09b 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/aws/retry/retry.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/retry/retry.go @@ -72,6 +72,19 @@ func (r *withMaxBackoffDelay) RetryDelay(attempt int, err error) (time.Duration, return r.backoff.BackoffDelay(attempt, err) } +// AddWithLongPolling returns a retryer that is marked as long-polling. +// Long-polling operations will back off even when the retry quota is +// exhausted. +func AddWithLongPolling(r aws.Retryer) aws.Retryer { + return &withLongPolling{RetryerV2: wrapAsRetryerV2(r)} +} + +type withLongPolling struct { + aws.RetryerV2 +} + +func (w *withLongPolling) IsLongPolling() bool { return true } + type wrappedAsRetryerV2 struct { aws.Retryer } diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/retry/standard.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/retry/standard.go index d5ea93222..f2f9660da 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/aws/retry/standard.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/retry/standard.go @@ -3,6 +3,7 @@ package retry import ( "context" "fmt" + "os" "time" "github.com/aws/aws-sdk-go-v2/aws/ratelimit" @@ -35,8 +36,16 @@ const ( const ( DefaultRetryRateTokens uint = 500 DefaultRetryCost uint = 5 - DefaultRetryTimeoutCost uint = 10 DefaultNoRetryIncrement uint = 1 + + // DefaultRetryTimeoutCost is the cost to deduct from the RateLimiter's + // token bucket per retry caused by timeout error. + // + // When AWS_NEW_RETRIES_2026 is set to "true", timeouts are no longer + // treated differently than other transient errors. The discounted cost + // is instead applied to throttling errors via DefaultThrottlingRetryCost. + DefaultRetryTimeoutCost uint = 10 + DefaultThrottlingRetryCost uint = 5 ) // DefaultRetryableHTTPStatusCodes is the default set of HTTP status codes the SDK @@ -121,6 +130,12 @@ type StandardOptions struct { // It is safe to append to this list in NewStandard's functional options. Timeouts []IsErrorTimeout + // Set of strategies to determine if the attempt failed due to a throttle + // error. Used to determine the retry token cost. + // + // It is safe to append to this list in NewStandard's functional options. + Throttles []IsErrorThrottle + // Provides the rate limiting strategy for rate limiting attempt retries // across all attempts the retryer is being used with. // @@ -129,10 +144,14 @@ type StandardOptions struct { // consume more tokens than what's available results in operation failure. // The default implementation is parameterized as follows: // - a capacity of 500 (DefaultRetryRateTokens) - // - a retry caused by a timeout costs 10 tokens (DefaultRetryCost) - // - a retry caused by other errors costs 5 tokens (DefaultRetryTimeoutCost) + // - a retry caused by a timeout costs 10 tokens (DefaultRetryTimeoutCost) + // - a retry caused by other errors costs 5 tokens (DefaultRetryCost) // - an operation that succeeds on the 1st attempt adds 1 token (DefaultNoRetryIncrement) // + // When AWS_NEW_RETRIES_2026 is set to "true", the costs change: + // - a retry costs 14 tokens + // - a retry caused by a throttling error costs 5 tokens (DefaultThrottlingRetryCost) + // // You can disable rate limiting by setting this field to ratelimit.None. RateLimiter RateLimiter @@ -141,11 +160,23 @@ type StandardOptions struct { // The cost to deduct from the RateLimiter's token bucket per retry caused // by timeout error. + // + // When AWS_NEW_RETRIES_2026 is set to "true", this field is unused. + // Throttling errors use ThrottlingRetryCost instead. RetryTimeoutCost uint + // The cost to deduct from the RateLimiter's token bucket per retry caused + // by a throttling error. Only used when AWS_NEW_RETRIES_2026 is "true". + ThrottlingRetryCost uint + // The cost to payback to the RateLimiter's token bucket for successful // attempts. NoRetryIncrement uint + + // BaseDelay is the base backoff delay for non-throttle retryable errors. + // Throttling errors always use 1s. Defaults to 50ms if zero. + // Only used when AWS_NEW_RETRIES_2026 is "true"; ignored in legacy mode. + BaseDelay time.Duration } // RateLimiter provides the interface for limiting the rate of attempt retries @@ -161,6 +192,7 @@ type RateLimiter interface { type Standard struct { options StandardOptions + throttle IsErrorThrottle timeout IsErrorTimeout retryable IsErrorRetryable backoff BackoffDelayer @@ -169,17 +201,7 @@ type Standard struct { // NewStandard initializes a standard retry behavior with defaults that can be // overridden via functional options. func NewStandard(fnOpts ...func(*StandardOptions)) *Standard { - o := StandardOptions{ - MaxAttempts: DefaultMaxAttempts, - MaxBackoff: DefaultMaxBackoff, - Retryables: append([]IsErrorRetryable{}, DefaultRetryables...), - Timeouts: append([]IsErrorTimeout{}, DefaultTimeouts...), - - RateLimiter: ratelimit.NewTokenRateLimit(DefaultRetryRateTokens), - RetryCost: DefaultRetryCost, - RetryTimeoutCost: DefaultRetryTimeoutCost, - NoRetryIncrement: DefaultNoRetryIncrement, - } + o := standardDefaults() for _, fn := range fnOpts { fn(&o) } @@ -189,13 +211,25 @@ func NewStandard(fnOpts ...func(*StandardOptions)) *Standard { backoff := o.Backoff if backoff == nil { - backoff = NewExponentialJitterBackoff(o.MaxBackoff) + if newRetries2026() { + baseDelay := o.BaseDelay + if baseDelay == 0 { + baseDelay = 50 * time.Millisecond + } + backoff = newExponentialJitterBackoffWithOptions(o.MaxBackoff, + withBaseDelay(baseDelay), + withThrottleCheck(IsErrorThrottles(o.Throttles)), + ) + } else { + backoff = NewExponentialJitterBackoff(o.MaxBackoff) + } } return &Standard{ options: o, backoff: backoff, retryable: IsErrorRetryables(o.Retryables), + throttle: IsErrorThrottles(o.Throttles), timeout: IsErrorTimeouts(o.Timeouts), } } @@ -244,8 +278,14 @@ func (s *Standard) noRetryIncrement() error { func (s *Standard) GetRetryToken(ctx context.Context, opErr error) (func(error) error, error) { cost := s.options.RetryCost - if s.timeout.IsErrorTimeout(opErr).Bool() { - cost = s.options.RetryTimeoutCost + if newRetries2026() { + if s.throttle.IsErrorThrottle(opErr).Bool() { + cost = s.options.ThrottlingRetryCost + } + } else { + if s.timeout.IsErrorTimeout(opErr).Bool() { + cost = s.options.RetryTimeoutCost + } } fn, err := s.options.RateLimiter.GetToken(ctx, cost) @@ -267,3 +307,37 @@ func (f releaseToken) release(err error) error { return f() } + +func newRetries2026() bool { + return os.Getenv("AWS_NEW_RETRIES_2026") == "true" +} + +func standardDefaults() StandardOptions { + if newRetries2026() { + return StandardOptions{ + MaxAttempts: DefaultMaxAttempts, + MaxBackoff: DefaultMaxBackoff, + Retryables: append([]IsErrorRetryable{}, DefaultRetryables...), + Timeouts: append([]IsErrorTimeout{}, DefaultTimeouts...), + Throttles: append([]IsErrorThrottle{}, DefaultThrottles...), + + RateLimiter: ratelimit.NewTokenRateLimit(DefaultRetryRateTokens), + RetryCost: 14, + RetryTimeoutCost: DefaultRetryTimeoutCost, + ThrottlingRetryCost: DefaultThrottlingRetryCost, + NoRetryIncrement: DefaultNoRetryIncrement, + } + } + return StandardOptions{ + MaxAttempts: DefaultMaxAttempts, + MaxBackoff: DefaultMaxBackoff, + Retryables: append([]IsErrorRetryable{}, DefaultRetryables...), + Timeouts: append([]IsErrorTimeout{}, DefaultTimeouts...), + Throttles: append([]IsErrorThrottle{}, DefaultThrottles...), + + RateLimiter: ratelimit.NewTokenRateLimit(DefaultRetryRateTokens), + RetryCost: DefaultRetryCost, + RetryTimeoutCost: DefaultRetryTimeoutCost, + NoRetryIncrement: DefaultNoRetryIncrement, + } +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/config/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/config/CHANGELOG.md index 1b3ead20e..bcab0a1a2 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/config/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/config/CHANGELOG.md @@ -1,3 +1,12 @@ +# v1.32.24 (2026-06-08) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.32.23 (2026-06-04) + +* **Dependency Update**: Update to smithy-go v1.27.1 to fix several union-related deserialization bugs in schema-serde-enabled services. +* **Dependency Update**: Updated to the latest SDK module versions + # v1.32.22 (2026-06-03) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/config/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/config/go_module_metadata.go index 9a551a2ca..693964ea9 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/config/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/config/go_module_metadata.go @@ -3,4 +3,4 @@ package config // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.32.22" +const goModuleVersion = "1.32.24" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/credentials/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/credentials/CHANGELOG.md index 6052f008b..d8c9224c2 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/credentials/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/credentials/CHANGELOG.md @@ -1,3 +1,12 @@ +# v1.19.23 (2026-06-08) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.19.22 (2026-06-04) + +* **Dependency Update**: Update to smithy-go v1.27.1 to fix several union-related deserialization bugs in schema-serde-enabled services. +* **Dependency Update**: Updated to the latest SDK module versions + # v1.19.21 (2026-06-03) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/credentials/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/credentials/go_module_metadata.go index 17fce79ce..9bd3d4cdf 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/credentials/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/credentials/go_module_metadata.go @@ -3,4 +3,4 @@ package credentials // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.19.21" +const goModuleVersion = "1.19.23" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/CHANGELOG.md index a28562110..a2f7103a9 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/CHANGELOG.md @@ -1,3 +1,12 @@ +# v1.18.29 (2026-06-08) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.18.28 (2026-06-04) + +* **Dependency Update**: Update to smithy-go v1.27.1 to fix several union-related deserialization bugs in schema-serde-enabled services. +* **Dependency Update**: Updated to the latest SDK module versions + # v1.18.27 (2026-06-03) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/go_module_metadata.go index 1c6023013..64d469b04 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/go_module_metadata.go @@ -3,4 +3,4 @@ package imds // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.18.27" +const goModuleVersion = "1.18.29" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/CHANGELOG.md index 582e04148..26f507f8b 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/CHANGELOG.md @@ -1,3 +1,12 @@ +# v1.4.29 (2026-06-08) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.4.28 (2026-06-04) + +* **Dependency Update**: Update to smithy-go v1.27.1 to fix several union-related deserialization bugs in schema-serde-enabled services. +* **Dependency Update**: Updated to the latest SDK module versions + # v1.4.27 (2026-06-03) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/go_module_metadata.go index 228438dbd..851fed2b3 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/go_module_metadata.go @@ -3,4 +3,4 @@ package configsources // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.4.27" +const goModuleVersion = "1.4.29" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/context/context.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/context/context.go index f0c283d39..52f4ebc25 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/internal/context/context.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/context/context.go @@ -50,3 +50,16 @@ func GetAttemptSkewContext(ctx context.Context) time.Duration { x, _ := middleware.GetStackValue(ctx, clockSkew{}).(time.Duration) return x } + +type longPollingKey struct{} + +// SetIsLongPolling marks the operation as long-polling on the context. +func SetIsLongPolling(ctx context.Context, v bool) context.Context { + return middleware.WithStackValue(ctx, longPollingKey{}, v) +} + +// GetIsLongPolling returns whether the operation is long-polling. +func GetIsLongPolling(ctx context.Context) bool { + v, _ := middleware.GetStackValue(ctx, longPollingKey{}).(bool) + return v +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/CHANGELOG.md index 6a8733ae1..508593b45 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/CHANGELOG.md @@ -1,3 +1,12 @@ +# v2.7.29 (2026-06-08) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v2.7.28 (2026-06-04) + +* **Dependency Update**: Update to smithy-go v1.27.1 to fix several union-related deserialization bugs in schema-serde-enabled services. +* **Dependency Update**: Updated to the latest SDK module versions + # v2.7.27 (2026-06-03) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/go_module_metadata.go index 01536c7c1..1c161a0a7 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/go_module_metadata.go @@ -3,4 +3,4 @@ package endpoints // goModuleVersion is the tagged release for this module -const goModuleVersion = "2.7.27" +const goModuleVersion = "2.7.29" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/v4a/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/internal/v4a/CHANGELOG.md index 57564f075..554f43b5e 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/internal/v4a/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/v4a/CHANGELOG.md @@ -1,3 +1,12 @@ +# v1.4.30 (2026-06-08) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.4.29 (2026-06-04) + +* **Dependency Update**: Update to smithy-go v1.27.1 to fix several union-related deserialization bugs in schema-serde-enabled services. +* **Dependency Update**: Updated to the latest SDK module versions + # v1.4.28 (2026-06-03) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/v4a/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/v4a/go_module_metadata.go index b2bf87cfb..2703ec797 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/internal/v4a/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/v4a/go_module_metadata.go @@ -3,4 +3,4 @@ package v4a // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.4.28" +const goModuleVersion = "1.4.30" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/CHANGELOG.md index 59ac111a6..2fb0269e7 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/CHANGELOG.md @@ -1,3 +1,7 @@ +# v1.13.12 (2026-06-04) + +* **Dependency Update**: Update to smithy-go v1.27.1 to fix several union-related deserialization bugs in schema-serde-enabled services. + # v1.13.11 (2026-06-03) * No change notes available for this release. diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/go_module_metadata.go index 66b30470a..b769e8427 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/go_module_metadata.go @@ -3,4 +3,4 @@ package acceptencoding // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.13.11" +const goModuleVersion = "1.13.12" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/checksum/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/checksum/CHANGELOG.md index 1d4449456..1b6e1fd07 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/checksum/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/checksum/CHANGELOG.md @@ -1,3 +1,12 @@ +# v1.9.22 (2026-06-08) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.9.21 (2026-06-04) + +* **Dependency Update**: Update to smithy-go v1.27.1 to fix several union-related deserialization bugs in schema-serde-enabled services. +* **Dependency Update**: Updated to the latest SDK module versions + # v1.9.20 (2026-06-03) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/checksum/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/checksum/go_module_metadata.go index 2dfeba273..f4054b7e8 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/checksum/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/checksum/go_module_metadata.go @@ -3,4 +3,4 @@ package checksum // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.9.20" +const goModuleVersion = "1.9.22" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/CHANGELOG.md index bec331162..2a082b44f 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/CHANGELOG.md @@ -1,3 +1,12 @@ +# v1.13.29 (2026-06-08) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.13.28 (2026-06-04) + +* **Dependency Update**: Update to smithy-go v1.27.1 to fix several union-related deserialization bugs in schema-serde-enabled services. +* **Dependency Update**: Updated to the latest SDK module versions + # v1.13.27 (2026-06-03) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/go_module_metadata.go index 380de5e03..84b406a78 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/go_module_metadata.go @@ -3,4 +3,4 @@ package presignedurl // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.13.27" +const goModuleVersion = "1.13.29" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/s3shared/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/s3shared/CHANGELOG.md index c62374427..2acbdd52e 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/s3shared/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/s3shared/CHANGELOG.md @@ -1,3 +1,12 @@ +# v1.19.29 (2026-06-08) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.19.28 (2026-06-04) + +* **Dependency Update**: Update to smithy-go v1.27.1 to fix several union-related deserialization bugs in schema-serde-enabled services. +* **Dependency Update**: Updated to the latest SDK module versions + # v1.19.27 (2026-06-03) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/s3shared/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/s3shared/go_module_metadata.go index a3c1b82a3..303c37c76 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/s3shared/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/s3shared/go_module_metadata.go @@ -3,4 +3,4 @@ package s3shared // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.19.27" +const goModuleVersion = "1.19.29" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/s3/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/CHANGELOG.md index 3898e31e5..546502d15 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/s3/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/CHANGELOG.md @@ -1,3 +1,12 @@ +# v1.103.3 (2026-06-08) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.103.2 (2026-06-04) + +* **Dependency Update**: Update to smithy-go v1.27.1 to fix several union-related deserialization bugs in schema-serde-enabled services. +* **Dependency Update**: Updated to the latest SDK module versions + # v1.103.1 (2026-06-03) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/s3/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/go_module_metadata.go index c59086013..8d07665fb 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/s3/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/go_module_metadata.go @@ -3,4 +3,4 @@ package s3 // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.103.1" +const goModuleVersion = "1.103.3" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/signin/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/CHANGELOG.md index dcfe08bf6..21ee73f0d 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/signin/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/CHANGELOG.md @@ -1,3 +1,12 @@ +# v1.1.5 (2026-06-08) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.1.4 (2026-06-04) + +* **Dependency Update**: Update to smithy-go v1.27.1 to fix several union-related deserialization bugs in schema-serde-enabled services. +* **Dependency Update**: Updated to the latest SDK module versions + # v1.1.3 (2026-06-03) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/signin/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/go_module_metadata.go index c8c148e64..88573c26d 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/signin/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/go_module_metadata.go @@ -3,4 +3,4 @@ package signin // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.1.3" +const goModuleVersion = "1.1.5" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/CHANGELOG.md index f78d440e9..f97ebb7f2 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/CHANGELOG.md @@ -1,3 +1,12 @@ +# v1.31.3 (2026-06-08) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.31.2 (2026-06-04) + +* **Dependency Update**: Update to smithy-go v1.27.1 to fix several union-related deserialization bugs in schema-serde-enabled services. +* **Dependency Update**: Updated to the latest SDK module versions + # v1.31.1 (2026-06-03) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/go_module_metadata.go index 238c41a95..f0408d2d8 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/go_module_metadata.go @@ -3,4 +3,4 @@ package sso // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.31.1" +const goModuleVersion = "1.31.3" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/CHANGELOG.md index b25df9eb5..34618bf03 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/CHANGELOG.md @@ -1,3 +1,12 @@ +# v1.36.6 (2026-06-08) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.36.5 (2026-06-04) + +* **Dependency Update**: Update to smithy-go v1.27.1 to fix several union-related deserialization bugs in schema-serde-enabled services. +* **Dependency Update**: Updated to the latest SDK module versions + # v1.36.4 (2026-06-03) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/go_module_metadata.go index 7041c6562..61a97713c 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/go_module_metadata.go @@ -3,4 +3,4 @@ package ssooidc // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.36.4" +const goModuleVersion = "1.36.6" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/CHANGELOG.md index eed7cba45..94f33a32d 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/CHANGELOG.md @@ -1,3 +1,12 @@ +# v1.43.3 (2026-06-08) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.43.2 (2026-06-04) + +* **Dependency Update**: Update to smithy-go v1.27.1 to fix several union-related deserialization bugs in schema-serde-enabled services. +* **Dependency Update**: Updated to the latest SDK module versions + # v1.43.1 (2026-06-03) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_client.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_client.go index 958c83c1a..1aa2c357e 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_client.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_client.go @@ -224,6 +224,8 @@ func New(options Options, optFns ...func(*Options)) *Client { ignoreAnonymousAuth(&options) + finalizeSTSRetryableErrors(&options) + wrapWithAnonymousAuth(&options) resolveAuthSchemes(&options) @@ -836,6 +838,10 @@ func addCredentialSource(stack *middleware.Stack, options Options) error { return stack.Build.Insert(&mw, "UserAgent", middleware.Before) } +func finalizeSTSRetryableErrors(o *Options) { + o.Retryer = retry.AddWithErrorCodes(o.Retryer, "IDPCommunicationError") +} + func resolveTracerProvider(options *Options) { if options.TracerProvider == nil { options.TracerProvider = &tracing.NopTracerProvider{} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/go_module_metadata.go index d05114ad0..ec43bec7c 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/go_module_metadata.go @@ -3,4 +3,4 @@ package sts // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.43.1" +const goModuleVersion = "1.43.3" diff --git a/vendor/github.com/aws/smithy-go/CHANGELOG.md b/vendor/github.com/aws/smithy-go/CHANGELOG.md index 5d8137320..6ff611a8d 100644 --- a/vendor/github.com/aws/smithy-go/CHANGELOG.md +++ b/vendor/github.com/aws/smithy-go/CHANGELOG.md @@ -1,3 +1,13 @@ +# Release (2026-06-04) + +## General Highlights +* **Dependency Update**: Updated to the latest SDK module versions + +## Module Highlights +* `github.com/aws/smithy-go`: v1.27.1 + * **Bug Fix**: Fixed a deserialization failure in all protocols when encountering a union with explicit null members. + * **Bug Fix**: Fixed a panic when deserializing nested unions in JSON- and CBOR-based protocols. + # Release (2026-06-02) ## General Highlights diff --git a/vendor/github.com/aws/smithy-go/go_module_metadata.go b/vendor/github.com/aws/smithy-go/go_module_metadata.go index 7534ba45a..ba81f7728 100644 --- a/vendor/github.com/aws/smithy-go/go_module_metadata.go +++ b/vendor/github.com/aws/smithy-go/go_module_metadata.go @@ -3,4 +3,4 @@ package smithy // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.27.0" +const goModuleVersion = "1.27.1" diff --git a/vendor/github.com/aws/smithy-go/serde.go b/vendor/github.com/aws/smithy-go/serde.go index dacc4390e..a9effc565 100644 --- a/vendor/github.com/aws/smithy-go/serde.go +++ b/vendor/github.com/aws/smithy-go/serde.go @@ -134,14 +134,12 @@ type DeserializableError interface { // ReadUnion is a utility API for generated clients. func ReadUnion(d ShapeDeserializer, schema *Schema, memberFn func(*Schema) error) error { ms, err := d.ReadUnion(schema) - if err != nil { + if ms == nil || err != nil { return err } - if ms != nil { - if err := memberFn(ms); err != nil { - return err - } + if err := memberFn(ms); err != nil { + return err } for { diff --git a/vendor/github.com/fsnotify/fsnotify/.cirrus.yml b/vendor/github.com/fsnotify/fsnotify/.cirrus.yml deleted file mode 100644 index 7f257e99a..000000000 --- a/vendor/github.com/fsnotify/fsnotify/.cirrus.yml +++ /dev/null @@ -1,14 +0,0 @@ -freebsd_task: - name: 'FreeBSD' - freebsd_instance: - image_family: freebsd-14-2 - install_script: - - pkg update -f - - pkg install -y go - test_script: - # run tests as user "cirrus" instead of root - - pw useradd cirrus -m - - chown -R cirrus:cirrus . - - FSNOTIFY_BUFFER=4096 sudo --preserve-env=FSNOTIFY_BUFFER -u cirrus go test -parallel 1 -race ./... - - sudo --preserve-env=FSNOTIFY_BUFFER -u cirrus go test -parallel 1 -race ./... - - FSNOTIFY_DEBUG=1 sudo --preserve-env=FSNOTIFY_BUFFER -u cirrus go test -parallel 1 -race -v ./... diff --git a/vendor/github.com/fsnotify/fsnotify/CHANGELOG.md b/vendor/github.com/fsnotify/fsnotify/CHANGELOG.md index 6468d2cf4..3027f3c67 100644 --- a/vendor/github.com/fsnotify/fsnotify/CHANGELOG.md +++ b/vendor/github.com/fsnotify/fsnotify/CHANGELOG.md @@ -1,5 +1,54 @@ # Changelog +1.10.1 2026-05-04 +----------------- + +### Changes and fixes + +- inotify: don't remove sibling watches sharing a path prefix ([#754]) + +- inotify, windows: don't rename sibling watches sharing a path prefix + ([#755]) + + +[#754]: https://github.com/fsnotify/fsnotify/pull/754 +[#755]: https://github.com/fsnotify/fsnotify/pull/755 + + +1.10.0 2026-04-30 +----------------- +This version of fsnotify needs Go 1.23. + +### Changes and fixes + +- inotify: improve initialization error message ([#731]) + +- inotify: send Rename event if recursive watch is renamed ([#696]) + +- inotify: avoid copying event buffers when reading names ([#741]) + +- kqueue: skip dangling symlinks (ENOENT) in watchDirectoryFiles, so a + bad entry no longer aborts Watcher.Add for the whole directory ([#748]) + +- kqueue: drop watches directly in Close() to fix a file descriptor leak + when recycling watchers ([#740]) + +- windows: fix nil pointer dereference in remWatch ([#736]) + +- windows: lock watch field updates against concurrent WatchList to fix + a race introduced in v1.9.0 ([#709], [#749]) + + +[#696]: https://github.com/fsnotify/fsnotify/pull/696 +[#709]: https://github.com/fsnotify/fsnotify/pull/709 +[#731]: https://github.com/fsnotify/fsnotify/pull/731 +[#736]: https://github.com/fsnotify/fsnotify/pull/736 +[#740]: https://github.com/fsnotify/fsnotify/pull/740 +[#741]: https://github.com/fsnotify/fsnotify/pull/741 +[#748]: https://github.com/fsnotify/fsnotify/pull/748 +[#749]: https://github.com/fsnotify/fsnotify/pull/749 + + 1.9.0 2024-04-04 ---------------- diff --git a/vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md b/vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md index 4cc40fa59..cd0ee612d 100644 --- a/vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md +++ b/vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md @@ -77,6 +77,8 @@ End-of-line escapes with `\` are not supported. debug [yes/no] # Enable/disable FSNOTIFY_DEBUG (tests are run in parallel by default, so -parallel=1 is probably a good idea). + state # Print internal state to stderr (exact output differs + # per backend). print [any strings] # Print text to stdout; for debugging. touch path diff --git a/vendor/github.com/fsnotify/fsnotify/README.md b/vendor/github.com/fsnotify/fsnotify/README.md index 1f4eb583d..2e56ef4c9 100644 --- a/vendor/github.com/fsnotify/fsnotify/README.md +++ b/vendor/github.com/fsnotify/fsnotify/README.md @@ -1,7 +1,7 @@ fsnotify is a Go library to provide cross-platform filesystem notifications on Windows, Linux, macOS, BSD, and illumos. -Go 1.17 or newer is required; the full documentation is at +Go 1.23 or newer is required; the full documentation is at https://pkg.go.dev/github.com/fsnotify/fsnotify --- @@ -12,7 +12,7 @@ Platform support: | :-------------------- | :--------- | :------------------------------------------------------------------------ | | inotify | Linux | Supported | | kqueue | BSD, macOS | Supported | -| ReadDirectoryChangesW | Windows | Supported | +| ReadDirectoryChangesW | Windows | Supported ([excluding `Chmod` operations][#487]) | | FEN | illumos | Supported | | fanotify | Linux 5.9+ | [Not yet](https://github.com/fsnotify/fsnotify/issues/114) | | FSEvents | macOS | [Needs support in x/sys/unix][fsevents] | @@ -22,6 +22,7 @@ Platform support: Linux and illumos should include Android and Solaris, but these are currently untested. +[#487]: https://github.com/fsnotify/fsnotify/issues/487 [fsevents]: https://github.com/fsnotify/fsnotify/issues/11#issuecomment-1279133120 [usn]: https://github.com/fsnotify/fsnotify/issues/53#issuecomment-1279829847 @@ -126,7 +127,7 @@ settings* until we have a native FSEvents implementation (see [#11]). ### Watching a file doesn't work well Watching individual files (rather than directories) is generally not recommended as many programs (especially editors) update files atomically: it will write to -a temporary file which is then moved to to destination, overwriting the original +a temporary file which is then moved to a destination, overwriting the original (or some variant thereof). The watcher on the original file is now lost, as that no longer exists. @@ -151,26 +152,57 @@ This is the event that inotify sends, so not much can be changed about this. The `fs.inotify.max_user_watches` sysctl variable specifies the upper limit for the number of watches per user, and `fs.inotify.max_user_instances` specifies the maximum number of inotify instances per user. Every Watcher you create is an -"instance", and every path you add is a "watch". +"instance", and every path you add is a "watch". Reaching the limit will result +in a "no space left on device" or "too many open files" error. These are also exposed in `/proc` as `/proc/sys/fs/inotify/max_user_watches` and -`/proc/sys/fs/inotify/max_user_instances` +`/proc/sys/fs/inotify/max_user_instances`. The default values differ per distro +and available memory. To increase them you can use `sysctl` or write the value to proc file: - # The default values on Linux 5.18 - sysctl fs.inotify.max_user_watches=124983 - sysctl fs.inotify.max_user_instances=128 + sysctl fs.inotify.max_user_watches=200000 + sysctl fs.inotify.max_user_instances=256 To make the changes persist on reboot edit `/etc/sysctl.conf` or `/usr/lib/sysctl.d/50-default.conf` (details differ per Linux distro; check your distro's documentation): - fs.inotify.max_user_watches=124983 - fs.inotify.max_user_instances=128 + fs.inotify.max_user_watches=200000 + fs.inotify.max_user_instances=256 + +### Windows +Recursive watching is not currently enabled through fsnotify's public API +(see the FAQ "Are subdirectories watched?" above). The notes below +describe Windows backend behavior observed when recursive watching is +enabled internally (for example, in fsnotify's own tests). They are kept +here as a reference for maintainers and contributors who encounter the +behavior, since the recursive code path still exists in the backend. + +When recursive watching is enabled and you watch a directory, you may +receive a `Write` event for an intermediate directory whenever a child +entry inside it is created, renamed, or removed. For example, with a +recursive watch on `/a` and a new file `/a/b/c`, you will receive +`Create /a/b/c` and may also receive `Write /a/b`. + +This happens because, on NTFS-backed volumes, modifying the entries of a +directory updates that directory's last-write time, and the Windows +backend requests `FILE_NOTIFY_CHANGE_LAST_WRITE` to support `Write` events +on files. The same `Write` filter therefore picks up the directory's +metadata update. + +kqueue has the same "directory `Write` = directory contents changed" +semantics, so portable code that treats `Write` on a directory as +"something inside it changed" works on Windows and BSD/macOS, but not on +Linux (inotify uses `Write` only for file-content changes). If you only +care about file content, filter out `Write` events whose path refers to a +directory. + +Whether the directory `Write` is actually delivered alongside the child +events is not guaranteed: it depends on `ReadDirectoryChangesW` buffering, +NTFS metadata update timing, and event coalescing, none of which fsnotify +controls. -Reaching the limit will result in a "no space left on device" or "too many open -files" error. ### kqueue (macOS, all BSD systems) kqueue requires opening a file descriptor for every file that's being watched; diff --git a/vendor/github.com/fsnotify/fsnotify/backend_fen.go b/vendor/github.com/fsnotify/fsnotify/backend_fen.go index 57fc69284..e43c6d088 100644 --- a/vendor/github.com/fsnotify/fsnotify/backend_fen.go +++ b/vendor/github.com/fsnotify/fsnotify/backend_fen.go @@ -158,7 +158,9 @@ func (w *fen) readEvents() { pevents := make([]unix.PortEvent, 8) for { - count, err := w.port.Get(pevents, 1, nil) + count, err := internal.IgnoringEINTR(func() (int, error) { + return w.port.Get(pevents, 1, nil) + }) if err != nil && err != unix.ETIME { // Interrupted system call (count should be 0) ignore and continue if errors.Is(err, unix.EINTR) && count == 0 { diff --git a/vendor/github.com/fsnotify/fsnotify/backend_inotify.go b/vendor/github.com/fsnotify/fsnotify/backend_inotify.go index a36cb89d7..4c3f6f7c2 100644 --- a/vendor/github.com/fsnotify/fsnotify/backend_inotify.go +++ b/vendor/github.com/fsnotify/fsnotify/backend_inotify.go @@ -55,10 +55,10 @@ type ( path map[string]uint32 // pathname → wd } watch struct { - wd uint32 // Watch descriptor (as returned by the inotify_add_watch() syscall) - flags uint32 // inotify flags of this watch (see inotify(7) for the list of valid flags) - path string // Watch path. - recurse bool // Recursion with ./...? + wd uint32 // Watch descriptor (as returned by the inotify_add_watch() syscall) + flags uint32 // inotify flags of this watch (see inotify(7) for the list of valid flags) + path string // Watch path. + watchFlags watchFlag } koekje struct { cookie uint32 @@ -66,6 +66,9 @@ type ( } ) +func (w watch) byUser() bool { return w.watchFlags&flagByUser != 0 } +func (w watch) recurse() bool { return w.watchFlags&flagRecurse != 0 } + func newWatches() *watches { return &watches{ wd: make(map[uint32]*watch), @@ -79,6 +82,13 @@ func (w *watches) len() int { return len(w.wd) } func (w *watches) add(ww *watch) { w.wd[ww.wd] = ww; w.path[ww.path] = ww.wd } func (w *watches) remove(watch *watch) { delete(w.path, watch.path); delete(w.wd, watch.wd) } +func isSameOrDescendantPath(path, root string) bool { + if path == root { + return true + } + return strings.HasPrefix(path, root+string(os.PathSeparator)) +} + func (w *watches) removePath(path string) ([]uint32, error) { path, recurse := recursivePath(path) wd, ok := w.path[path] @@ -87,20 +97,20 @@ func (w *watches) removePath(path string) ([]uint32, error) { } watch := w.wd[wd] - if recurse && !watch.recurse { + if recurse && !watch.recurse() { return nil, fmt.Errorf("can't use /... with non-recursive watch %q", path) } delete(w.path, path) delete(w.wd, wd) - if !watch.recurse { + if !watch.recurse() { return []uint32{wd}, nil } wds := make([]uint32, 0, 8) wds = append(wds, wd) for p, rwd := range w.path { - if strings.HasPrefix(p, path) { + if isSameOrDescendantPath(p, path) { delete(w.path, p) delete(w.wd, rwd) wds = append(wds, rwd) @@ -139,7 +149,7 @@ func newBackend(ev chan Event, errs chan error) (backend, error) { // I/O operations won't terminate on close. fd, errno := unix.InotifyInit1(unix.IN_CLOEXEC | unix.IN_NONBLOCK) if fd == -1 { - return nil, errno + return nil, fmt.Errorf("couldn't initialize inotify: %w", errno) } w := &inotify{ @@ -188,11 +198,8 @@ func (w *inotify) AddWith(path string, opts ...addOpt) error { return fmt.Errorf("%w: %s", xErrUnsupported, with.op) } - add := func(path string, with withOpts, recurse bool) error { + add := func(path string, with withOpts, wf watchFlag) error { var flags uint32 - if with.noFollow { - flags |= unix.IN_DONT_FOLLOW - } if with.op.Has(Create) { flags |= unix.IN_CREATE } @@ -220,7 +227,7 @@ func (w *inotify) AddWith(path string, opts ...addOpt) error { if with.op.Has(xUnportableCloseRead) { flags |= unix.IN_CLOSE_NOWRITE } - return w.register(path, flags, recurse) + return w.register(path, flags, wf) } w.mu.Lock() @@ -248,14 +255,18 @@ func (w *inotify) AddWith(path string, opts ...addOpt) error { w.sendEvent(Event{Name: root, Op: Create}) } - return add(root, with, true) + wf := flagRecurse + if root == path { + wf |= flagByUser + } + return add(root, with, wf) }) } - return add(path, with, false) + return add(path, with, 0) } -func (w *inotify) register(path string, flags uint32, recurse bool) error { +func (w *inotify) register(path string, flags uint32, wf watchFlag) error { return w.watches.updatePath(path, func(existing *watch) (*watch, error) { if existing != nil { flags |= existing.flags | unix.IN_MASK_ADD @@ -272,10 +283,10 @@ func (w *inotify) register(path string, flags uint32, recurse bool) error { if existing == nil { return &watch{ - wd: uint32(wd), - path: path, - flags: flags, - recurse: recurse, + wd: uint32(wd), + path: path, + flags: flags, + watchFlags: wf, }, nil } @@ -425,11 +436,7 @@ func (w *inotify) handleEvent(inEvent *unix.InotifyEvent, buf *[65536]byte, offs nameLen = uint32(inEvent.Len) ) if nameLen > 0 { - /// Point "bytes" at the first byte of the filename - bb := *buf - bytes := (*[unix.PathMax]byte)(unsafe.Pointer(&bb[offset+unix.SizeofInotifyEvent]))[:nameLen:nameLen] - /// The filename is padded with NULL bytes. TrimRight() gets rid of those. - name += "/" + strings.TrimRight(string(bytes[0:nameLen]), "\x00") + name += "/" + inotifyEventName(buf, offset, nameLen) } if debug { @@ -450,7 +457,9 @@ func (w *inotify) handleEvent(inEvent *unix.InotifyEvent, buf *[65536]byte, offs // We can't really update the state when a watched path is moved; only // IN_MOVE_SELF is sent and not IN_MOVED_{FROM,TO}. So remove the watch. if inEvent.Mask&unix.IN_MOVE_SELF == unix.IN_MOVE_SELF { - if watch.recurse { // Do nothing + // Watch is set up as part of recurse: do nothing as the move gets + // registered from the parent directory. + if watch.recurse() && !watch.byUser() { return Event{}, true } @@ -460,6 +469,10 @@ func (w *inotify) handleEvent(inEvent *unix.InotifyEvent, buf *[65536]byte, offs return Event{}, false } } + + if watch.recurse() { + return Event{Name: watch.path, Op: Rename}, true + } } /// Skip if we're watching both this path and the parent; the parent will @@ -473,11 +486,11 @@ func (w *inotify) handleEvent(inEvent *unix.InotifyEvent, buf *[65536]byte, offs ev := w.newEvent(name, inEvent.Mask, inEvent.Cookie) // Need to update watch path for recurse. - if watch.recurse { + if watch.recurse() { isDir := inEvent.Mask&unix.IN_ISDIR == unix.IN_ISDIR /// New directory created: set up watch on it. if isDir && ev.Has(Create) { - err := w.register(ev.Name, watch.flags, true) + err := w.register(ev.Name, watch.flags, flagRecurse) if !w.sendError(err) { return Event{}, false } @@ -495,7 +508,7 @@ func (w *inotify) handleEvent(inEvent *unix.InotifyEvent, buf *[65536]byte, offs if k == watch.wd || ww.path == ev.Name { continue } - if strings.HasPrefix(ww.path, ev.renamedFrom) { + if isSameOrDescendantPath(ww.path, ev.renamedFrom) { ww.path = strings.Replace(ww.path, ev.renamedFrom, ev.Name, 1) w.watches.wd[k] = ww } @@ -507,12 +520,13 @@ func (w *inotify) handleEvent(inEvent *unix.InotifyEvent, buf *[65536]byte, offs return ev, true } -func (w *inotify) isRecursive(path string) bool { - ww := w.watches.byPath(path) - if ww == nil { // path could be a file, so also check the Dir. - ww = w.watches.byPath(filepath.Dir(path)) +func inotifyEventName(buf *[65536]byte, offset, nameLen uint32) string { + start := int(offset + unix.SizeofInotifyEvent) + bytes := (*[unix.PathMax]byte)(unsafe.Pointer(&buf[start]))[:nameLen:nameLen] + for nameLen > 0 && bytes[nameLen-1] == 0 { + nameLen-- } - return ww != nil && ww.recurse + return string(bytes[:nameLen]) } func (w *inotify) newEvent(name string, mask, cookie uint32) Event { @@ -578,6 +592,6 @@ func (w *inotify) state() { w.mu.Lock() defer w.mu.Unlock() for wd, ww := range w.watches.wd { - fmt.Fprintf(os.Stderr, "%4d: recurse=%t %q\n", wd, ww.recurse, ww.path) + fmt.Fprintf(os.Stderr, "%4d: %q watchFlags=0x%x\n", wd, ww.path, ww.watchFlags) } } diff --git a/vendor/github.com/fsnotify/fsnotify/backend_kqueue.go b/vendor/github.com/fsnotify/fsnotify/backend_kqueue.go index 340aeec06..d2c8cfb6c 100644 --- a/vendor/github.com/fsnotify/fsnotify/backend_kqueue.go +++ b/vendor/github.com/fsnotify/fsnotify/backend_kqueue.go @@ -8,6 +8,7 @@ import ( "os" "path/filepath" "runtime" + "sort" "sync" "time" @@ -245,9 +246,26 @@ func (w *kqueue) Close() error { return nil } + // Snapshot and drop all watches directly. w.Remove -> w.remove + // short-circuits on isClosed() (which is already true after + // w.shared.close() above), so calling Remove here in the happy path + // leaked every watched directory + file descriptor. On macOS a + // single directory watch opens an fd for every file in the dir, so + // long-running processes that recreate watchers (hot-reload dev + // servers, etc.) ran out of fds with EMFILE (#732). pathsToRemove := w.watches.listPaths(false) for _, name := range pathsToRemove { - w.Remove(name) + info, ok := w.watches.byPath(name) + if !ok { + // w.path has an entry for name but w.wd doesn't -- + // drop the stale lookup entry so the map state is + // consistent after Close. + w.watches.remove(0, name) + continue + } + _ = w.register([]int{info.wd}, unix.EV_DELETE, 0) + unix.Close(info.wd) + w.watches.remove(info.wd, name) } unix.Close(w.closepipe[1]) // Send "quit" message to readEvents @@ -376,19 +394,12 @@ func (w *kqueue) addWatch(name string, flags uint32, listDir bool) (string, erro } } - // Retry on EINTR; open() can return EINTR in practice on macOS. - // See #354, and Go issues 11180 and 39237. - for { - info.wd, err = unix.Open(name, openMode, 0) - if err == nil { - break - } - if errors.Is(err, unix.EINTR) { - continue - } + info.wd, err = internal.IgnoringEINTR(func() (int, error) { + return unix.Open(name, openMode, 0) + }) + if err != nil { return "", err } - info.isDir = fi.IsDir() } @@ -436,9 +447,10 @@ func (w *kqueue) readEvents() { eventBuffer := make([]unix.Kevent_t, 10) for { - kevents, err := w.read(eventBuffer) - // EINTR is okay, the syscall was interrupted before timeout expired. - if err != nil && err != unix.EINTR { + kevents, err := internal.IgnoringEINTR(func() ([]unix.Kevent_t, error) { + return w.read(eventBuffer) + }) + if err != nil { if !w.sendError(fmt.Errorf("fsnotify.readEvents: %w", err)) { return } @@ -583,12 +595,14 @@ func (w *kqueue) watchDirectoryFiles(dirPath string) error { cleanPath, err := w.internalWatch(path, fi) if err != nil { - // No permission to read the file; that's not a problem: just skip. - // But do add it to w.fileExists to prevent it from being picked up - // as a "new" file later (it still shows up in the directory + // No permission, or the entry resolved to a missing target + // (e.g. a dangling symlink): not a problem, just skip. But + // do mark it as seen to prevent it from being picked up as + // a "new" file later (it still shows up in the directory // listing). switch { - case errors.Is(err, unix.EACCES) || errors.Is(err, unix.EPERM): + case errors.Is(err, unix.EACCES) || errors.Is(err, unix.EPERM) || + errors.Is(err, os.ErrNotExist): cleanPath = filepath.Clean(path) default: return fmt.Errorf("%q: %w", path, err) @@ -703,3 +717,19 @@ func (w *kqueue) xSupports(op Op) bool { } return true } + +func (w *kqueue) state() { + w.watches.mu.Lock() + defer w.watches.mu.Unlock() + + all := make([]int, 0, len(w.watches.wd)) + for wd := range w.watches.wd { + all = append(all, wd) + } + sort.Ints(all) + + for _, wd := range all { + ww := w.watches.wd[wd] + fmt.Fprintf(os.Stderr, "%4d %q linkname=%q\n", wd, ww.name, ww.linkName) + } +} diff --git a/vendor/github.com/fsnotify/fsnotify/backend_windows.go b/vendor/github.com/fsnotify/fsnotify/backend_windows.go index 3433642d6..fb9210f24 100644 --- a/vendor/github.com/fsnotify/fsnotify/backend_windows.go +++ b/vendor/github.com/fsnotify/fsnotify/backend_windows.go @@ -11,7 +11,6 @@ import ( "fmt" "os" "path/filepath" - "reflect" "runtime" "strings" "sync" @@ -37,6 +36,13 @@ type readDirChangesW struct { var defaultBufferSize = 50 +func isSameOrDescendantPath(path, root string) bool { + if path == root { + return true + } + return strings.HasPrefix(path, root+string(os.PathSeparator)) +} + func newBackend(ev chan Event, errs chan error) (backend, error) { port, err := windows.CreateIoCompletionPort(windows.InvalidHandle, 0, 0, 0) if err != nil { @@ -359,22 +365,26 @@ func (w *readDirChangesW) addWatch(pathname string, flags uint64, bufsize int) e } else { windows.CloseHandle(ino.handle) } + w.mu.Lock() if pathname == dir { watchEntry.mask |= flags } else { watchEntry.names[filepath.Base(pathname)] |= flags } + w.mu.Unlock() err = w.startRead(watchEntry) if err != nil { return err } + w.mu.Lock() if pathname == dir { watchEntry.mask &= ^provisional } else { watchEntry.names[filepath.Base(pathname)] &= ^provisional } + w.mu.Unlock() return nil } @@ -394,8 +404,13 @@ func (w *readDirChangesW) remWatch(pathname string) error { w.mu.Lock() watch := w.watches.get(ino) w.mu.Unlock() + if watch == nil { + windows.CloseHandle(ino.handle) + return fmt.Errorf("%w: %s", ErrNonExistentWatch, pathname) + } if recurse && !watch.recurse { + windows.CloseHandle(ino.handle) return fmt.Errorf("can't use \\... with non-recursive watch %q", pathname) } @@ -403,16 +418,19 @@ func (w *readDirChangesW) remWatch(pathname string) error { if err != nil { w.sendError(os.NewSyscallError("CloseHandle", err)) } - if watch == nil { - return fmt.Errorf("%w: %s", ErrNonExistentWatch, pathname) - } if pathname == dir { - w.sendEvent(watch.path, "", watch.mask&sysFSIGNORED) + w.mu.Lock() + mask := watch.mask watch.mask = 0 + w.mu.Unlock() + w.sendEvent(watch.path, "", mask&sysFSIGNORED) } else { name := filepath.Base(pathname) - w.sendEvent(filepath.Join(watch.path, name), "", watch.names[name]&sysFSIGNORED) + w.mu.Lock() + mask := watch.names[name] delete(watch.names, name) + w.mu.Unlock() + w.sendEvent(filepath.Join(watch.path, name), "", mask&sysFSIGNORED) } return w.startRead(watch) @@ -420,17 +438,23 @@ func (w *readDirChangesW) remWatch(pathname string) error { // Must run within the I/O thread. func (w *readDirChangesW) deleteWatch(watch *watch) { - for name, mask := range watch.names { - if mask&provisional == 0 { - w.sendEvent(filepath.Join(watch.path, name), "", mask&sysFSIGNORED) + // Snapshot+clear under the lock so concurrent WatchList() readers see a + // consistent state. sendEvent must run outside the lock since it can + // block on the user-facing Events channel. + w.mu.Lock() + names := watch.names + watch.names = make(map[string]uint64) + mask := watch.mask + watch.mask = 0 + w.mu.Unlock() + + for name, m := range names { + if m&provisional == 0 { + w.sendEvent(filepath.Join(watch.path, name), "", m&sysFSIGNORED) } - delete(watch.names, name) } - if watch.mask != 0 { - if watch.mask&provisional == 0 { - w.sendEvent(watch.path, "", watch.mask&sysFSIGNORED) - } - watch.mask = 0 + if mask != 0 && mask&provisional == 0 { + w.sendEvent(watch.path, "", mask&sysFSIGNORED) } } @@ -457,9 +481,8 @@ func (w *readDirChangesW) startRead(watch *watch) error { } // We need to pass the array, rather than the slice. - hdr := (*reflect.SliceHeader)(unsafe.Pointer(&watch.buf)) rdErr := windows.ReadDirectoryChanges(watch.ino.handle, - (*byte)(unsafe.Pointer(hdr.Data)), uint32(hdr.Len), + unsafe.SliceData(watch.buf), uint32(len(watch.buf)), watch.recurse, mask, nil, &watch.ov, 0) if rdErr != nil { err := os.NewSyscallError("ReadDirectoryChanges", rdErr) @@ -565,12 +588,7 @@ func (w *readDirChangesW) readEvents() { // Create a buf that is the size of the path name size := int(raw.FileNameLength / 2) - var buf []uint16 - // TODO: Use unsafe.Slice in Go 1.17; https://stackoverflow.com/questions/51187973 - sh := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) - sh.Data = uintptr(unsafe.Pointer(&raw.FileName)) - sh.Len = size - sh.Cap = size + buf := unsafe.Slice(&raw.FileName, size) name := windows.UTF16ToString(buf) fullname := filepath.Join(watch.path, name) @@ -587,31 +605,35 @@ func (w *readDirChangesW) readEvents() { case windows.FILE_ACTION_RENAMED_OLD_NAME: watch.rename = name case windows.FILE_ACTION_RENAMED_NEW_NAME: - // Update saved path of all sub-watches. + // Update saved path of all sub-watches and rename the + // names entry under the lock so WatchList() can't observe + // a torn state. old := filepath.Join(watch.path, watch.rename) w.mu.Lock() for _, watchMap := range w.watches { for _, ww := range watchMap { - if strings.HasPrefix(ww.path, old) { + if isSameOrDescendantPath(ww.path, old) { ww.path = filepath.Join(fullname, strings.TrimPrefix(ww.path, old)) } } } - w.mu.Unlock() - if watch.names[watch.rename] != 0 { watch.names[name] |= watch.names[watch.rename] delete(watch.names, watch.rename) mask = sysFSMOVESELF } + w.mu.Unlock() } if raw.Action != windows.FILE_ACTION_RENAMED_NEW_NAME { w.sendEvent(fullname, "", watch.names[name]&mask) } if raw.Action == windows.FILE_ACTION_REMOVED { - w.sendEvent(fullname, "", watch.names[name]&sysFSIGNORED) + w.mu.Lock() + ignored := watch.names[name] & sysFSIGNORED delete(watch.names, name) + w.mu.Unlock() + w.sendEvent(fullname, "", ignored) } if watch.rename != "" && raw.Action == windows.FILE_ACTION_RENAMED_NEW_NAME { diff --git a/vendor/github.com/fsnotify/fsnotify/fsnotify.go b/vendor/github.com/fsnotify/fsnotify/fsnotify.go index f64be4bf9..38cb4dd48 100644 --- a/vendor/github.com/fsnotify/fsnotify/fsnotify.go +++ b/vendor/github.com/fsnotify/fsnotify/fsnotify.go @@ -51,26 +51,25 @@ import ( // The fs.inotify.max_user_watches sysctl variable specifies the upper limit // for the number of watches per user, and fs.inotify.max_user_instances // specifies the maximum number of inotify instances per user. Every Watcher you -// create is an "instance", and every path you add is a "watch". +// create is an "instance", and every path you add is a "watch". Reaching the +// limit will result in a "no space left on device" or "too many open files" +// error. // // These are also exposed in /proc as /proc/sys/fs/inotify/max_user_watches and -// /proc/sys/fs/inotify/max_user_instances +// /proc/sys/fs/inotify/max_user_instances. The default values differ per distro +// and available memory. // // To increase them you can use sysctl or write the value to the /proc file: // -// # Default values on Linux 5.18 -// sysctl fs.inotify.max_user_watches=124983 -// sysctl fs.inotify.max_user_instances=128 +// sysctl fs.inotify.max_user_watches=200000 +// sysctl fs.inotify.max_user_instances=256 // // To make the changes persist on reboot edit /etc/sysctl.conf or // /usr/lib/sysctl.d/50-default.conf (details differ per Linux distro; check // your distro's documentation): // -// fs.inotify.max_user_watches=124983 -// fs.inotify.max_user_instances=128 -// -// Reaching the limit will result in a "no space left on device" or "too many open -// files" error. +// fs.inotify.max_user_watches=200000 +// fs.inotify.max_user_instances=256 // // # kqueue notes (macOS, BSD) // @@ -93,6 +92,28 @@ import ( // Sometimes it will send events for all files, sometimes it will send no // events, and often only for some files. // +// Recursive watching is not currently enabled through fsnotify's public +// API; the recursive code path is gated and only exercised by fsnotify's +// own tests. The note below describes backend behavior observed when +// recursive watching is enabled internally, and is kept here as a +// reference for maintainers and contributors who encounter it. +// +// When recursive watching is enabled and you watch a directory, you may +// receive a Write event for an intermediate directory whenever a child +// entry inside it is created, renamed, or removed. For example, with a +// recursive watch on /a and a new file /a/b/c, you will receive +// Create /a/b/c and may also receive Write /a/b. +// +// This happens because, on NTFS-backed volumes, modifying the entries of a +// directory updates that directory's last-write time, and the Windows +// backend requests FILE_NOTIFY_CHANGE_LAST_WRITE to support Write events +// on files. The same Write filter therefore picks up the directory's +// metadata update. +// +// Whether the directory Write is actually delivered alongside the child +// events is not guaranteed; it depends on ReadDirectoryChangesW buffering, +// NTFS metadata update timing, and event coalescing. +// // The default ReadDirectoryChangesW() buffer size is 64K, which is the largest // value that is guaranteed to work with SMB filesystems. If you have many // events in quick succession this may not be enough, and you will have to use @@ -129,8 +150,12 @@ type Watcher struct { // want to wait until you've stopped receiving them // (see the dedup example in cmd/fsnotify). // - // Some systems may send Write event for directories - // when the directory content changes. + // Some systems also send Write events for directories + // when the directory contents change. This is the + // case for kqueue, and on Windows for the directory + // that contains a created, renamed, or removed child + // entry. It does not happen on inotify. See the + // per-platform notes on [Watcher]. // // fsnotify.Chmod Attributes were changed. On Linux this is also sent // when a file is removed (or more accurately, when a @@ -179,7 +204,9 @@ const ( Create Op = 1 << iota // The pathname was written to; this does *not* mean the write has finished, - // and a write can be followed by more writes. + // and a write can be followed by more writes. On Windows and kqueue, a + // Write on a directory can also indicate that its contents changed; see + // the per-platform notes on [Watcher]. Write // The path was removed; any watches on it will be removed. Some "remove" @@ -220,7 +247,7 @@ const ( // File opened for reading was closed. // - // Only works on Linux and FreeBSD. + // Only works on Linux. xUnportableCloseRead ) @@ -410,7 +437,6 @@ type ( withOpts struct { bufsize int op Op - noFollow bool sendCreate bool } ) @@ -469,12 +495,6 @@ func withOps(op Op) addOpt { return func(opt *withOpts) { opt.op = op } } -// WithNoFollow disables following symlinks, so the symlinks themselves are -// watched. -func withNoFollow() addOpt { - return func(opt *withOpts) { opt.noFollow = true } -} - // "Internal" option for recursive watches on inotify. func withCreate() addOpt { return func(opt *withOpts) { opt.sendCreate = true } @@ -494,3 +514,13 @@ func recursivePath(path string) (string, bool) { } return path, false } + +type watchFlag uint8 + +const ( + // Added by user with Add(), rather than an internal watch. + flagByUser = watchFlag(0x01) + // Part of recursive watch; as the top-level path added by the user or an + // "internal" watch. + flagRecurse = watchFlag(0x02) +) diff --git a/vendor/github.com/fsnotify/fsnotify/internal/darwin.go b/vendor/github.com/fsnotify/fsnotify/internal/darwin.go index 0b01bc182..6721aa609 100644 --- a/vendor/github.com/fsnotify/fsnotify/internal/darwin.go +++ b/vendor/github.com/fsnotify/fsnotify/internal/darwin.go @@ -15,25 +15,6 @@ var ( var maxfiles uint64 -func SetRlimit() { - // Go 1.19 will do this automatically: https://go-review.googlesource.com/c/go/+/393354/ - var l syscall.Rlimit - err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &l) - if err == nil && l.Cur != l.Max { - l.Cur = l.Max - syscall.Setrlimit(syscall.RLIMIT_NOFILE, &l) - } - maxfiles = l.Cur - - if n, err := syscall.SysctlUint32("kern.maxfiles"); err == nil && uint64(n) < maxfiles { - maxfiles = uint64(n) - } - - if n, err := syscall.SysctlUint32("kern.maxfilesperproc"); err == nil && uint64(n) < maxfiles { - maxfiles = uint64(n) - } -} - func Maxfiles() uint64 { return maxfiles } func Mkfifo(path string, mode uint32) error { return unix.Mkfifo(path, mode) } func Mknod(path string, mode uint32, dev int) error { return unix.Mknod(path, mode, dev) } diff --git a/vendor/github.com/fsnotify/fsnotify/internal/debug_darwin.go b/vendor/github.com/fsnotify/fsnotify/internal/debug_darwin.go index 928319fb0..760018074 100644 --- a/vendor/github.com/fsnotify/fsnotify/internal/debug_darwin.go +++ b/vendor/github.com/fsnotify/fsnotify/internal/debug_darwin.go @@ -6,52 +6,10 @@ var names = []struct { n string m uint32 }{ - {"NOTE_ABSOLUTE", unix.NOTE_ABSOLUTE}, {"NOTE_ATTRIB", unix.NOTE_ATTRIB}, - {"NOTE_BACKGROUND", unix.NOTE_BACKGROUND}, - {"NOTE_CHILD", unix.NOTE_CHILD}, - {"NOTE_CRITICAL", unix.NOTE_CRITICAL}, {"NOTE_DELETE", unix.NOTE_DELETE}, - {"NOTE_EXEC", unix.NOTE_EXEC}, - {"NOTE_EXIT", unix.NOTE_EXIT}, - {"NOTE_EXITSTATUS", unix.NOTE_EXITSTATUS}, - {"NOTE_EXIT_CSERROR", unix.NOTE_EXIT_CSERROR}, - {"NOTE_EXIT_DECRYPTFAIL", unix.NOTE_EXIT_DECRYPTFAIL}, - {"NOTE_EXIT_DETAIL", unix.NOTE_EXIT_DETAIL}, - {"NOTE_EXIT_DETAIL_MASK", unix.NOTE_EXIT_DETAIL_MASK}, - {"NOTE_EXIT_MEMORY", unix.NOTE_EXIT_MEMORY}, - {"NOTE_EXIT_REPARENTED", unix.NOTE_EXIT_REPARENTED}, {"NOTE_EXTEND", unix.NOTE_EXTEND}, - {"NOTE_FFAND", unix.NOTE_FFAND}, - {"NOTE_FFCOPY", unix.NOTE_FFCOPY}, - {"NOTE_FFCTRLMASK", unix.NOTE_FFCTRLMASK}, - {"NOTE_FFLAGSMASK", unix.NOTE_FFLAGSMASK}, - {"NOTE_FFNOP", unix.NOTE_FFNOP}, - {"NOTE_FFOR", unix.NOTE_FFOR}, - {"NOTE_FORK", unix.NOTE_FORK}, - {"NOTE_FUNLOCK", unix.NOTE_FUNLOCK}, - {"NOTE_LEEWAY", unix.NOTE_LEEWAY}, {"NOTE_LINK", unix.NOTE_LINK}, - {"NOTE_LOWAT", unix.NOTE_LOWAT}, - {"NOTE_MACHTIME", unix.NOTE_MACHTIME}, - {"NOTE_MACH_CONTINUOUS_TIME", unix.NOTE_MACH_CONTINUOUS_TIME}, - {"NOTE_NONE", unix.NOTE_NONE}, - {"NOTE_NSECONDS", unix.NOTE_NSECONDS}, - {"NOTE_OOB", unix.NOTE_OOB}, - //{"NOTE_PCTRLMASK", unix.NOTE_PCTRLMASK}, -0x100000 (?!) - {"NOTE_PDATAMASK", unix.NOTE_PDATAMASK}, - {"NOTE_REAP", unix.NOTE_REAP}, {"NOTE_RENAME", unix.NOTE_RENAME}, - {"NOTE_REVOKE", unix.NOTE_REVOKE}, - {"NOTE_SECONDS", unix.NOTE_SECONDS}, - {"NOTE_SIGNAL", unix.NOTE_SIGNAL}, - {"NOTE_TRACK", unix.NOTE_TRACK}, - {"NOTE_TRACKERR", unix.NOTE_TRACKERR}, - {"NOTE_TRIGGER", unix.NOTE_TRIGGER}, - {"NOTE_USECONDS", unix.NOTE_USECONDS}, - {"NOTE_VM_ERROR", unix.NOTE_VM_ERROR}, - {"NOTE_VM_PRESSURE", unix.NOTE_VM_PRESSURE}, - {"NOTE_VM_PRESSURE_SUDDEN_TERMINATE", unix.NOTE_VM_PRESSURE_SUDDEN_TERMINATE}, - {"NOTE_VM_PRESSURE_TERMINATE", unix.NOTE_VM_PRESSURE_TERMINATE}, {"NOTE_WRITE", unix.NOTE_WRITE}, } diff --git a/vendor/github.com/fsnotify/fsnotify/internal/debug_dragonfly.go b/vendor/github.com/fsnotify/fsnotify/internal/debug_dragonfly.go index 3186b0c34..760018074 100644 --- a/vendor/github.com/fsnotify/fsnotify/internal/debug_dragonfly.go +++ b/vendor/github.com/fsnotify/fsnotify/internal/debug_dragonfly.go @@ -7,27 +7,9 @@ var names = []struct { m uint32 }{ {"NOTE_ATTRIB", unix.NOTE_ATTRIB}, - {"NOTE_CHILD", unix.NOTE_CHILD}, {"NOTE_DELETE", unix.NOTE_DELETE}, - {"NOTE_EXEC", unix.NOTE_EXEC}, - {"NOTE_EXIT", unix.NOTE_EXIT}, {"NOTE_EXTEND", unix.NOTE_EXTEND}, - {"NOTE_FFAND", unix.NOTE_FFAND}, - {"NOTE_FFCOPY", unix.NOTE_FFCOPY}, - {"NOTE_FFCTRLMASK", unix.NOTE_FFCTRLMASK}, - {"NOTE_FFLAGSMASK", unix.NOTE_FFLAGSMASK}, - {"NOTE_FFNOP", unix.NOTE_FFNOP}, - {"NOTE_FFOR", unix.NOTE_FFOR}, - {"NOTE_FORK", unix.NOTE_FORK}, {"NOTE_LINK", unix.NOTE_LINK}, - {"NOTE_LOWAT", unix.NOTE_LOWAT}, - {"NOTE_OOB", unix.NOTE_OOB}, - {"NOTE_PCTRLMASK", unix.NOTE_PCTRLMASK}, - {"NOTE_PDATAMASK", unix.NOTE_PDATAMASK}, {"NOTE_RENAME", unix.NOTE_RENAME}, - {"NOTE_REVOKE", unix.NOTE_REVOKE}, - {"NOTE_TRACK", unix.NOTE_TRACK}, - {"NOTE_TRACKERR", unix.NOTE_TRACKERR}, - {"NOTE_TRIGGER", unix.NOTE_TRIGGER}, {"NOTE_WRITE", unix.NOTE_WRITE}, } diff --git a/vendor/github.com/fsnotify/fsnotify/internal/debug_freebsd.go b/vendor/github.com/fsnotify/fsnotify/internal/debug_freebsd.go index f69fdb930..b9e45f555 100644 --- a/vendor/github.com/fsnotify/fsnotify/internal/debug_freebsd.go +++ b/vendor/github.com/fsnotify/fsnotify/internal/debug_freebsd.go @@ -6,37 +6,15 @@ var names = []struct { n string m uint32 }{ - {"NOTE_ABSTIME", unix.NOTE_ABSTIME}, - {"NOTE_ATTRIB", unix.NOTE_ATTRIB}, - {"NOTE_CHILD", unix.NOTE_CHILD}, - {"NOTE_CLOSE", unix.NOTE_CLOSE}, - {"NOTE_CLOSE_WRITE", unix.NOTE_CLOSE_WRITE}, {"NOTE_DELETE", unix.NOTE_DELETE}, - {"NOTE_EXEC", unix.NOTE_EXEC}, - {"NOTE_EXIT", unix.NOTE_EXIT}, + {"NOTE_WRITE", unix.NOTE_WRITE}, {"NOTE_EXTEND", unix.NOTE_EXTEND}, - {"NOTE_FFAND", unix.NOTE_FFAND}, - {"NOTE_FFCOPY", unix.NOTE_FFCOPY}, - {"NOTE_FFCTRLMASK", unix.NOTE_FFCTRLMASK}, - {"NOTE_FFLAGSMASK", unix.NOTE_FFLAGSMASK}, - {"NOTE_FFNOP", unix.NOTE_FFNOP}, - {"NOTE_FFOR", unix.NOTE_FFOR}, - {"NOTE_FILE_POLL", unix.NOTE_FILE_POLL}, - {"NOTE_FORK", unix.NOTE_FORK}, + {"NOTE_ATTRIB", unix.NOTE_ATTRIB}, {"NOTE_LINK", unix.NOTE_LINK}, - {"NOTE_LOWAT", unix.NOTE_LOWAT}, - {"NOTE_MSECONDS", unix.NOTE_MSECONDS}, - {"NOTE_NSECONDS", unix.NOTE_NSECONDS}, - {"NOTE_OPEN", unix.NOTE_OPEN}, - {"NOTE_PCTRLMASK", unix.NOTE_PCTRLMASK}, - {"NOTE_PDATAMASK", unix.NOTE_PDATAMASK}, - {"NOTE_READ", unix.NOTE_READ}, {"NOTE_RENAME", unix.NOTE_RENAME}, {"NOTE_REVOKE", unix.NOTE_REVOKE}, - {"NOTE_SECONDS", unix.NOTE_SECONDS}, - {"NOTE_TRACK", unix.NOTE_TRACK}, - {"NOTE_TRACKERR", unix.NOTE_TRACKERR}, - {"NOTE_TRIGGER", unix.NOTE_TRIGGER}, - {"NOTE_USECONDS", unix.NOTE_USECONDS}, - {"NOTE_WRITE", unix.NOTE_WRITE}, + {"NOTE_OPEN", unix.NOTE_OPEN}, + {"NOTE_CLOSE", unix.NOTE_CLOSE}, + {"NOTE_CLOSE_WRITE", unix.NOTE_CLOSE_WRITE}, + {"NOTE_READ", unix.NOTE_READ}, } diff --git a/vendor/github.com/fsnotify/fsnotify/internal/debug_kqueue.go b/vendor/github.com/fsnotify/fsnotify/internal/debug_kqueue.go index 607e683bd..5d8116436 100644 --- a/vendor/github.com/fsnotify/fsnotify/internal/debug_kqueue.go +++ b/vendor/github.com/fsnotify/fsnotify/internal/debug_kqueue.go @@ -27,6 +27,6 @@ func Debug(name string, kevent *unix.Kevent_t) { if unknown > 0 { l = append(l, fmt.Sprintf("0x%x", unknown)) } - fmt.Fprintf(os.Stderr, "FSNOTIFY_DEBUG: %s %10d:%-60s → %q\n", + fmt.Fprintf(os.Stderr, "FSNOTIFY_DEBUG: %s %10d:%-20s → %q\n", time.Now().Format("15:04:05.000000000"), mask, strings.Join(l, " | "), name) } diff --git a/vendor/github.com/fsnotify/fsnotify/internal/debug_netbsd.go b/vendor/github.com/fsnotify/fsnotify/internal/debug_netbsd.go index e5b3b6f69..760018074 100644 --- a/vendor/github.com/fsnotify/fsnotify/internal/debug_netbsd.go +++ b/vendor/github.com/fsnotify/fsnotify/internal/debug_netbsd.go @@ -7,19 +7,9 @@ var names = []struct { m uint32 }{ {"NOTE_ATTRIB", unix.NOTE_ATTRIB}, - {"NOTE_CHILD", unix.NOTE_CHILD}, {"NOTE_DELETE", unix.NOTE_DELETE}, - {"NOTE_EXEC", unix.NOTE_EXEC}, - {"NOTE_EXIT", unix.NOTE_EXIT}, {"NOTE_EXTEND", unix.NOTE_EXTEND}, - {"NOTE_FORK", unix.NOTE_FORK}, {"NOTE_LINK", unix.NOTE_LINK}, - {"NOTE_LOWAT", unix.NOTE_LOWAT}, - {"NOTE_PCTRLMASK", unix.NOTE_PCTRLMASK}, - {"NOTE_PDATAMASK", unix.NOTE_PDATAMASK}, {"NOTE_RENAME", unix.NOTE_RENAME}, - {"NOTE_REVOKE", unix.NOTE_REVOKE}, - {"NOTE_TRACK", unix.NOTE_TRACK}, - {"NOTE_TRACKERR", unix.NOTE_TRACKERR}, {"NOTE_WRITE", unix.NOTE_WRITE}, } diff --git a/vendor/github.com/fsnotify/fsnotify/internal/debug_openbsd.go b/vendor/github.com/fsnotify/fsnotify/internal/debug_openbsd.go index 1dd455bc5..871766d69 100644 --- a/vendor/github.com/fsnotify/fsnotify/internal/debug_openbsd.go +++ b/vendor/github.com/fsnotify/fsnotify/internal/debug_openbsd.go @@ -7,22 +7,10 @@ var names = []struct { m uint32 }{ {"NOTE_ATTRIB", unix.NOTE_ATTRIB}, - // {"NOTE_CHANGE", unix.NOTE_CHANGE}, // Not on 386? - {"NOTE_CHILD", unix.NOTE_CHILD}, {"NOTE_DELETE", unix.NOTE_DELETE}, - {"NOTE_EOF", unix.NOTE_EOF}, - {"NOTE_EXEC", unix.NOTE_EXEC}, - {"NOTE_EXIT", unix.NOTE_EXIT}, {"NOTE_EXTEND", unix.NOTE_EXTEND}, - {"NOTE_FORK", unix.NOTE_FORK}, {"NOTE_LINK", unix.NOTE_LINK}, - {"NOTE_LOWAT", unix.NOTE_LOWAT}, - {"NOTE_PCTRLMASK", unix.NOTE_PCTRLMASK}, - {"NOTE_PDATAMASK", unix.NOTE_PDATAMASK}, {"NOTE_RENAME", unix.NOTE_RENAME}, - {"NOTE_REVOKE", unix.NOTE_REVOKE}, - {"NOTE_TRACK", unix.NOTE_TRACK}, - {"NOTE_TRACKERR", unix.NOTE_TRACKERR}, {"NOTE_TRUNCATE", unix.NOTE_TRUNCATE}, {"NOTE_WRITE", unix.NOTE_WRITE}, } diff --git a/vendor/github.com/fsnotify/fsnotify/internal/freebsd.go b/vendor/github.com/fsnotify/fsnotify/internal/freebsd.go index 5ac8b5079..758a24905 100644 --- a/vendor/github.com/fsnotify/fsnotify/internal/freebsd.go +++ b/vendor/github.com/fsnotify/fsnotify/internal/freebsd.go @@ -15,17 +15,6 @@ var ( var maxfiles uint64 -func SetRlimit() { - // Go 1.19 will do this automatically: https://go-review.googlesource.com/c/go/+/393354/ - var l syscall.Rlimit - err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &l) - if err == nil && l.Cur != l.Max { - l.Cur = l.Max - syscall.Setrlimit(syscall.RLIMIT_NOFILE, &l) - } - maxfiles = uint64(l.Cur) -} - func Maxfiles() uint64 { return maxfiles } func Mkfifo(path string, mode uint32) error { return unix.Mkfifo(path, mode) } func Mknod(path string, mode uint32, dev int) error { return unix.Mknod(path, mode, uint64(dev)) } diff --git a/vendor/github.com/fsnotify/fsnotify/internal/unix.go b/vendor/github.com/fsnotify/fsnotify/internal/unix.go index b251fb803..9c66f5d30 100644 --- a/vendor/github.com/fsnotify/fsnotify/internal/unix.go +++ b/vendor/github.com/fsnotify/fsnotify/internal/unix.go @@ -15,17 +15,6 @@ var ( var maxfiles uint64 -func SetRlimit() { - // Go 1.19 will do this automatically: https://go-review.googlesource.com/c/go/+/393354/ - var l syscall.Rlimit - err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &l) - if err == nil && l.Cur != l.Max { - l.Cur = l.Max - syscall.Setrlimit(syscall.RLIMIT_NOFILE, &l) - } - maxfiles = uint64(l.Cur) -} - func Maxfiles() uint64 { return maxfiles } func Mkfifo(path string, mode uint32) error { return unix.Mkfifo(path, mode) } func Mknod(path string, mode uint32, dev int) error { return unix.Mknod(path, mode, dev) } diff --git a/vendor/github.com/fsnotify/fsnotify/internal/unix2.go b/vendor/github.com/fsnotify/fsnotify/internal/unix2.go index 37dfeddc2..b2d89592f 100644 --- a/vendor/github.com/fsnotify/fsnotify/internal/unix2.go +++ b/vendor/github.com/fsnotify/fsnotify/internal/unix2.go @@ -2,6 +2,24 @@ package internal +import "syscall" + func HasPrivilegesForSymlink() bool { return true } + +// IgnoringEINTR makes a function call and repeats it if it returns an +// EINTR error. This appears to be required even though we install all +// signal handlers with SA_RESTART: see #22838, #38033, #38836, #40846. +// Also #20400 and #36644 are issues in which a signal handler is +// installed without setting SA_RESTART. None of these are the common case, +// but there are enough of them that it seems that we can't avoid +// an EINTR loop. +func IgnoringEINTR[T any](fn func() (T, error)) (T, error) { + for { + v, err := fn() + if err != syscall.EINTR { + return v, err + } + } +} diff --git a/vendor/github.com/fsnotify/fsnotify/internal/windows.go b/vendor/github.com/fsnotify/fsnotify/internal/windows.go index 896bc2e5a..e24d56926 100644 --- a/vendor/github.com/fsnotify/fsnotify/internal/windows.go +++ b/vendor/github.com/fsnotify/fsnotify/internal/windows.go @@ -14,7 +14,6 @@ var ( ErrUnixEACCES = errors.New("dummy") ) -func SetRlimit() {} func Maxfiles() uint64 { return 1<<64 - 1 } func Mkfifo(path string, mode uint32) error { return errors.New("no FIFOs on Windows") } func Mknod(path string, mode uint32, dev int) error { return errors.New("no device nodes on Windows") } diff --git a/vendor/github.com/google/go-github/v73/github/actions_permissions_enterprise.go b/vendor/github.com/google/go-github/v73/github/actions_permissions_enterprise.go deleted file mode 100644 index a6a85aa32..000000000 --- a/vendor/github.com/google/go-github/v73/github/actions_permissions_enterprise.go +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright 2023 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package github - -import ( - "context" - "fmt" -) - -// ActionsEnabledOnEnterpriseRepos represents all the repositories in an enterprise for which Actions is enabled. -type ActionsEnabledOnEnterpriseRepos struct { - TotalCount int `json:"total_count"` - Organizations []*Organization `json:"organizations"` -} - -// ActionsPermissionsEnterprise represents a policy for allowed actions in an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions -type ActionsPermissionsEnterprise struct { - EnabledOrganizations *string `json:"enabled_organizations,omitempty"` - AllowedActions *string `json:"allowed_actions,omitempty"` - SelectedActionsURL *string `json:"selected_actions_url,omitempty"` -} - -func (a ActionsPermissionsEnterprise) String() string { - return Stringify(a) -} - -// DefaultWorkflowPermissionEnterprise represents the default permissions for GitHub Actions workflows for an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions -type DefaultWorkflowPermissionEnterprise struct { - DefaultWorkflowPermissions *string `json:"default_workflow_permissions,omitempty"` - CanApprovePullRequestReviews *bool `json:"can_approve_pull_request_reviews,omitempty"` -} - -// GetActionsPermissionsInEnterprise gets the GitHub Actions permissions policy for an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#get-github-actions-permissions-for-an-enterprise -// -//meta:operation GET /enterprises/{enterprise}/actions/permissions -func (s *ActionsService) GetActionsPermissionsInEnterprise(ctx context.Context, enterprise string) (*ActionsPermissionsEnterprise, *Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/permissions", enterprise) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - permissions := new(ActionsPermissionsEnterprise) - resp, err := s.client.Do(ctx, req, permissions) - if err != nil { - return nil, resp, err - } - - return permissions, resp, nil -} - -// EditActionsPermissionsInEnterprise sets the permissions policy in an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-github-actions-permissions-for-an-enterprise -// -//meta:operation PUT /enterprises/{enterprise}/actions/permissions -func (s *ActionsService) EditActionsPermissionsInEnterprise(ctx context.Context, enterprise string, actionsPermissionsEnterprise ActionsPermissionsEnterprise) (*ActionsPermissionsEnterprise, *Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/permissions", enterprise) - req, err := s.client.NewRequest("PUT", u, actionsPermissionsEnterprise) - if err != nil { - return nil, nil, err - } - - p := new(ActionsPermissionsEnterprise) - resp, err := s.client.Do(ctx, req, p) - if err != nil { - return nil, resp, err - } - - return p, resp, nil -} - -// ListEnabledOrgsInEnterprise lists the selected organizations that are enabled for GitHub Actions in an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#list-selected-organizations-enabled-for-github-actions-in-an-enterprise -// -//meta:operation GET /enterprises/{enterprise}/actions/permissions/organizations -func (s *ActionsService) ListEnabledOrgsInEnterprise(ctx context.Context, owner string, opts *ListOptions) (*ActionsEnabledOnEnterpriseRepos, *Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/permissions/organizations", owner) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - orgs := &ActionsEnabledOnEnterpriseRepos{} - resp, err := s.client.Do(ctx, req, orgs) - if err != nil { - return nil, resp, err - } - - return orgs, resp, nil -} - -// SetEnabledOrgsInEnterprise replaces the list of selected organizations that are enabled for GitHub Actions in an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-selected-organizations-enabled-for-github-actions-in-an-enterprise -// -//meta:operation PUT /enterprises/{enterprise}/actions/permissions/organizations -func (s *ActionsService) SetEnabledOrgsInEnterprise(ctx context.Context, owner string, organizationIDs []int64) (*Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/permissions/organizations", owner) - - req, err := s.client.NewRequest("PUT", u, struct { - IDs []int64 `json:"selected_organization_ids"` - }{IDs: organizationIDs}) - if err != nil { - return nil, err - } - - resp, err := s.client.Do(ctx, req, nil) - if err != nil { - return resp, err - } - - return resp, nil -} - -// AddEnabledOrgInEnterprise adds an organization to the list of selected organizations that are enabled for GitHub Actions in an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#enable-a-selected-organization-for-github-actions-in-an-enterprise -// -//meta:operation PUT /enterprises/{enterprise}/actions/permissions/organizations/{org_id} -func (s *ActionsService) AddEnabledOrgInEnterprise(ctx context.Context, owner string, organizationID int64) (*Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/permissions/organizations/%v", owner, organizationID) - - req, err := s.client.NewRequest("PUT", u, nil) - if err != nil { - return nil, err - } - - resp, err := s.client.Do(ctx, req, nil) - if err != nil { - return resp, err - } - - return resp, nil -} - -// RemoveEnabledOrgInEnterprise removes an organization from the list of selected organizations that are enabled for GitHub Actions in an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#disable-a-selected-organization-for-github-actions-in-an-enterprise -// -//meta:operation DELETE /enterprises/{enterprise}/actions/permissions/organizations/{org_id} -func (s *ActionsService) RemoveEnabledOrgInEnterprise(ctx context.Context, owner string, organizationID int64) (*Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/permissions/organizations/%v", owner, organizationID) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - resp, err := s.client.Do(ctx, req, nil) - if err != nil { - return resp, err - } - - return resp, nil -} - -// GetActionsAllowedInEnterprise gets the actions that are allowed in an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-enterprise -// -//meta:operation GET /enterprises/{enterprise}/actions/permissions/selected-actions -func (s *ActionsService) GetActionsAllowedInEnterprise(ctx context.Context, enterprise string) (*ActionsAllowed, *Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/permissions/selected-actions", enterprise) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - actionsAllowed := new(ActionsAllowed) - resp, err := s.client.Do(ctx, req, actionsAllowed) - if err != nil { - return nil, resp, err - } - - return actionsAllowed, resp, nil -} - -// EditActionsAllowedInEnterprise sets the actions that are allowed in an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-enterprise -// -//meta:operation PUT /enterprises/{enterprise}/actions/permissions/selected-actions -func (s *ActionsService) EditActionsAllowedInEnterprise(ctx context.Context, enterprise string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/permissions/selected-actions", enterprise) - req, err := s.client.NewRequest("PUT", u, actionsAllowed) - if err != nil { - return nil, nil, err - } - - p := new(ActionsAllowed) - resp, err := s.client.Do(ctx, req, p) - if err != nil { - return nil, resp, err - } - - return p, resp, nil -} - -// GetDefaultWorkflowPermissionsInEnterprise gets the GitHub Actions default workflow permissions for an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#get-default-workflow-permissions-for-an-enterprise -// -//meta:operation GET /enterprises/{enterprise}/actions/permissions/workflow -func (s *ActionsService) GetDefaultWorkflowPermissionsInEnterprise(ctx context.Context, enterprise string) (*DefaultWorkflowPermissionEnterprise, *Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/permissions/workflow", enterprise) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - permissions := new(DefaultWorkflowPermissionEnterprise) - resp, err := s.client.Do(ctx, req, permissions) - if err != nil { - return nil, resp, err - } - - return permissions, resp, nil -} - -// EditDefaultWorkflowPermissionsInEnterprise sets the GitHub Actions default workflow permissions for an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-default-workflow-permissions-for-an-enterprise -// -//meta:operation PUT /enterprises/{enterprise}/actions/permissions/workflow -func (s *ActionsService) EditDefaultWorkflowPermissionsInEnterprise(ctx context.Context, enterprise string, permissions DefaultWorkflowPermissionEnterprise) (*DefaultWorkflowPermissionEnterprise, *Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/permissions/workflow", enterprise) - req, err := s.client.NewRequest("PUT", u, permissions) - if err != nil { - return nil, nil, err - } - - p := new(DefaultWorkflowPermissionEnterprise) - resp, err := s.client.Do(ctx, req, p) - if err != nil { - return nil, resp, err - } - - return p, resp, nil -} diff --git a/vendor/github.com/google/go-github/v73/github/actions_permissions_orgs.go b/vendor/github.com/google/go-github/v73/github/actions_permissions_orgs.go deleted file mode 100644 index 2f555f249..000000000 --- a/vendor/github.com/google/go-github/v73/github/actions_permissions_orgs.go +++ /dev/null @@ -1,271 +0,0 @@ -// Copyright 2023 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package github - -import ( - "context" - "fmt" -) - -// ActionsPermissions represents a policy for repositories and allowed actions in an organization. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions -type ActionsPermissions struct { - EnabledRepositories *string `json:"enabled_repositories,omitempty"` - AllowedActions *string `json:"allowed_actions,omitempty"` - SelectedActionsURL *string `json:"selected_actions_url,omitempty"` -} - -func (a ActionsPermissions) String() string { - return Stringify(a) -} - -// ActionsEnabledOnOrgRepos represents all the repositories in an organization for which Actions is enabled. -type ActionsEnabledOnOrgRepos struct { - TotalCount int `json:"total_count"` - Repositories []*Repository `json:"repositories"` -} - -// ActionsAllowed represents selected actions that are allowed. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions -type ActionsAllowed struct { - GithubOwnedAllowed *bool `json:"github_owned_allowed,omitempty"` - VerifiedAllowed *bool `json:"verified_allowed,omitempty"` - PatternsAllowed []string `json:"patterns_allowed,omitempty"` -} - -func (a ActionsAllowed) String() string { - return Stringify(a) -} - -// DefaultWorkflowPermissionOrganization represents the default permissions for GitHub Actions workflows for an organization. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions -type DefaultWorkflowPermissionOrganization struct { - DefaultWorkflowPermissions *string `json:"default_workflow_permissions,omitempty"` - CanApprovePullRequestReviews *bool `json:"can_approve_pull_request_reviews,omitempty"` -} - -// GetActionsPermissions gets the GitHub Actions permissions policy for repositories and allowed actions in an organization. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-github-actions-permissions-for-an-organization -// -//meta:operation GET /orgs/{org}/actions/permissions -func (s *ActionsService) GetActionsPermissions(ctx context.Context, org string) (*ActionsPermissions, *Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions", org) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - permissions := new(ActionsPermissions) - resp, err := s.client.Do(ctx, req, permissions) - if err != nil { - return nil, resp, err - } - - return permissions, resp, nil -} - -// EditActionsPermissions sets the permissions policy for repositories and allowed actions in an organization. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-github-actions-permissions-for-an-organization -// -//meta:operation PUT /orgs/{org}/actions/permissions -func (s *ActionsService) EditActionsPermissions(ctx context.Context, org string, actionsPermissions ActionsPermissions) (*ActionsPermissions, *Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions", org) - req, err := s.client.NewRequest("PUT", u, actionsPermissions) - if err != nil { - return nil, nil, err - } - - p := new(ActionsPermissions) - resp, err := s.client.Do(ctx, req, p) - if err != nil { - return nil, resp, err - } - - return p, resp, nil -} - -// ListEnabledReposInOrg lists the selected repositories that are enabled for GitHub Actions in an organization. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions#list-selected-repositories-enabled-for-github-actions-in-an-organization -// -//meta:operation GET /orgs/{org}/actions/permissions/repositories -func (s *ActionsService) ListEnabledReposInOrg(ctx context.Context, owner string, opts *ListOptions) (*ActionsEnabledOnOrgRepos, *Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions/repositories", owner) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - repos := &ActionsEnabledOnOrgRepos{} - resp, err := s.client.Do(ctx, req, repos) - if err != nil { - return nil, resp, err - } - - return repos, resp, nil -} - -// SetEnabledReposInOrg replaces the list of selected repositories that are enabled for GitHub Actions in an organization.. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-selected-repositories-enabled-for-github-actions-in-an-organization -// -//meta:operation PUT /orgs/{org}/actions/permissions/repositories -func (s *ActionsService) SetEnabledReposInOrg(ctx context.Context, owner string, repositoryIDs []int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions/repositories", owner) - - req, err := s.client.NewRequest("PUT", u, struct { - IDs []int64 `json:"selected_repository_ids"` - }{IDs: repositoryIDs}) - if err != nil { - return nil, err - } - - resp, err := s.client.Do(ctx, req, nil) - if err != nil { - return resp, err - } - - return resp, nil -} - -// AddEnabledReposInOrg adds a repository to the list of selected repositories that are enabled for GitHub Actions in an organization. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions#enable-a-selected-repository-for-github-actions-in-an-organization -// -//meta:operation PUT /orgs/{org}/actions/permissions/repositories/{repository_id} -func (s *ActionsService) AddEnabledReposInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions/repositories/%v", owner, repositoryID) - - req, err := s.client.NewRequest("PUT", u, nil) - if err != nil { - return nil, err - } - - resp, err := s.client.Do(ctx, req, nil) - if err != nil { - return resp, err - } - - return resp, nil -} - -// RemoveEnabledReposInOrg removes a single repository from the list of enabled repos for GitHub Actions in an organization. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions#disable-a-selected-repository-for-github-actions-in-an-organization -// -//meta:operation DELETE /orgs/{org}/actions/permissions/repositories/{repository_id} -func (s *ActionsService) RemoveEnabledReposInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions/repositories/%v", owner, repositoryID) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - resp, err := s.client.Do(ctx, req, nil) - if err != nil { - return resp, err - } - - return resp, nil -} - -// GetActionsAllowed gets the actions that are allowed in an organization. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-organization -// -//meta:operation GET /orgs/{org}/actions/permissions/selected-actions -func (s *ActionsService) GetActionsAllowed(ctx context.Context, org string) (*ActionsAllowed, *Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions/selected-actions", org) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - actionsAllowed := new(ActionsAllowed) - resp, err := s.client.Do(ctx, req, actionsAllowed) - if err != nil { - return nil, resp, err - } - - return actionsAllowed, resp, nil -} - -// EditActionsAllowed sets the actions that are allowed in an organization. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-organization -// -//meta:operation PUT /orgs/{org}/actions/permissions/selected-actions -func (s *ActionsService) EditActionsAllowed(ctx context.Context, org string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions/selected-actions", org) - req, err := s.client.NewRequest("PUT", u, actionsAllowed) - if err != nil { - return nil, nil, err - } - - p := new(ActionsAllowed) - resp, err := s.client.Do(ctx, req, p) - if err != nil { - return nil, resp, err - } - - return p, resp, nil -} - -// GetDefaultWorkflowPermissionsInOrganization gets the GitHub Actions default workflow permissions for an organization. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-default-workflow-permissions-for-an-organization -// -//meta:operation GET /orgs/{org}/actions/permissions/workflow -func (s *ActionsService) GetDefaultWorkflowPermissionsInOrganization(ctx context.Context, org string) (*DefaultWorkflowPermissionOrganization, *Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions/workflow", org) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - permissions := new(DefaultWorkflowPermissionOrganization) - resp, err := s.client.Do(ctx, req, permissions) - if err != nil { - return nil, resp, err - } - - return permissions, resp, nil -} - -// EditDefaultWorkflowPermissionsInOrganization sets the GitHub Actions default workflow permissions for an organization. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-default-workflow-permissions-for-an-organization -// -//meta:operation PUT /orgs/{org}/actions/permissions/workflow -func (s *ActionsService) EditDefaultWorkflowPermissionsInOrganization(ctx context.Context, org string, permissions DefaultWorkflowPermissionOrganization) (*DefaultWorkflowPermissionOrganization, *Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions/workflow", org) - req, err := s.client.NewRequest("PUT", u, permissions) - if err != nil { - return nil, nil, err - } - - p := new(DefaultWorkflowPermissionOrganization) - resp, err := s.client.Do(ctx, req, p) - if err != nil { - return nil, resp, err - } - - return p, resp, nil -} diff --git a/vendor/github.com/google/go-github/v73/github/billing.go b/vendor/github.com/google/go-github/v73/github/billing.go deleted file mode 100644 index 09b1a5d01..000000000 --- a/vendor/github.com/google/go-github/v73/github/billing.go +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright 2021 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package github - -import ( - "context" - "fmt" -) - -// BillingService provides access to the billing related functions -// in the GitHub API. -// -// GitHub API docs: https://docs.github.com/rest/billing -type BillingService service - -// ActionBilling represents a GitHub Action billing. -type ActionBilling struct { - TotalMinutesUsed float64 `json:"total_minutes_used"` - TotalPaidMinutesUsed float64 `json:"total_paid_minutes_used"` - IncludedMinutes float64 `json:"included_minutes"` - MinutesUsedBreakdown MinutesUsedBreakdown `json:"minutes_used_breakdown"` -} - -// MinutesUsedBreakdown counts the actions minutes used by machine type (e.g. UBUNTU, WINDOWS, MACOS). -type MinutesUsedBreakdown = map[string]int - -// PackageBilling represents a GitHub Package billing. -type PackageBilling struct { - TotalGigabytesBandwidthUsed int `json:"total_gigabytes_bandwidth_used"` - TotalPaidGigabytesBandwidthUsed int `json:"total_paid_gigabytes_bandwidth_used"` - IncludedGigabytesBandwidth float64 `json:"included_gigabytes_bandwidth"` -} - -// StorageBilling represents a GitHub Storage billing. -type StorageBilling struct { - DaysLeftInBillingCycle int `json:"days_left_in_billing_cycle"` - EstimatedPaidStorageForMonth float64 `json:"estimated_paid_storage_for_month"` - EstimatedStorageForMonth float64 `json:"estimated_storage_for_month"` -} - -// ActiveCommitters represents the total active committers across all repositories in an Organization. -type ActiveCommitters struct { - TotalAdvancedSecurityCommitters int `json:"total_advanced_security_committers"` - TotalCount int `json:"total_count"` - MaximumAdvancedSecurityCommitters int `json:"maximum_advanced_security_committers"` - PurchasedAdvancedSecurityCommitters int `json:"purchased_advanced_security_committers"` - Repositories []*RepositoryActiveCommitters `json:"repositories,omitempty"` -} - -// RepositoryActiveCommitters represents active committers on each repository. -type RepositoryActiveCommitters struct { - Name *string `json:"name,omitempty"` - AdvancedSecurityCommitters *int `json:"advanced_security_committers,omitempty"` - AdvancedSecurityCommittersBreakdown []*AdvancedSecurityCommittersBreakdown `json:"advanced_security_committers_breakdown,omitempty"` -} - -// AdvancedSecurityCommittersBreakdown represents the user activity breakdown for ActiveCommitters. -type AdvancedSecurityCommittersBreakdown struct { - UserLogin *string `json:"user_login,omitempty"` - LastPushedDate *string `json:"last_pushed_date,omitempty"` -} - -// GetActionsBillingOrg returns the summary of the free and paid GitHub Actions minutes used for an Org. -// -// GitHub API docs: https://docs.github.com/rest/billing/billing#get-github-actions-billing-for-an-organization -// -//meta:operation GET /orgs/{org}/settings/billing/actions -func (s *BillingService) GetActionsBillingOrg(ctx context.Context, org string) (*ActionBilling, *Response, error) { - u := fmt.Sprintf("orgs/%v/settings/billing/actions", org) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - actionsOrgBilling := new(ActionBilling) - resp, err := s.client.Do(ctx, req, actionsOrgBilling) - if err != nil { - return nil, resp, err - } - - return actionsOrgBilling, resp, nil -} - -// GetPackagesBillingOrg returns the free and paid storage used for GitHub Packages in gigabytes for an Org. -// -// GitHub API docs: https://docs.github.com/rest/billing/billing#get-github-packages-billing-for-an-organization -// -//meta:operation GET /orgs/{org}/settings/billing/packages -func (s *BillingService) GetPackagesBillingOrg(ctx context.Context, org string) (*PackageBilling, *Response, error) { - u := fmt.Sprintf("orgs/%v/settings/billing/packages", org) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - packagesOrgBilling := new(PackageBilling) - resp, err := s.client.Do(ctx, req, packagesOrgBilling) - if err != nil { - return nil, resp, err - } - - return packagesOrgBilling, resp, nil -} - -// GetStorageBillingOrg returns the estimated paid and estimated total storage used for GitHub Actions -// and GitHub Packages in gigabytes for an Org. -// -// GitHub API docs: https://docs.github.com/rest/billing/billing#get-shared-storage-billing-for-an-organization -// -//meta:operation GET /orgs/{org}/settings/billing/shared-storage -func (s *BillingService) GetStorageBillingOrg(ctx context.Context, org string) (*StorageBilling, *Response, error) { - u := fmt.Sprintf("orgs/%v/settings/billing/shared-storage", org) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - storageOrgBilling := new(StorageBilling) - resp, err := s.client.Do(ctx, req, storageOrgBilling) - if err != nil { - return nil, resp, err - } - - return storageOrgBilling, resp, nil -} - -// GetAdvancedSecurityActiveCommittersOrg returns the GitHub Advanced Security active committers for an organization per repository. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/billing#get-github-advanced-security-active-committers-for-an-organization -// -//meta:operation GET /orgs/{org}/settings/billing/advanced-security -func (s *BillingService) GetAdvancedSecurityActiveCommittersOrg(ctx context.Context, org string, opts *ListOptions) (*ActiveCommitters, *Response, error) { - u := fmt.Sprintf("orgs/%v/settings/billing/advanced-security", org) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - activeOrgCommitters := new(ActiveCommitters) - resp, err := s.client.Do(ctx, req, activeOrgCommitters) - if err != nil { - return nil, resp, err - } - - return activeOrgCommitters, resp, nil -} - -// GetActionsBillingUser returns the summary of the free and paid GitHub Actions minutes used for a user. -// -// GitHub API docs: https://docs.github.com/rest/billing/billing#get-github-actions-billing-for-a-user -// -//meta:operation GET /users/{username}/settings/billing/actions -func (s *BillingService) GetActionsBillingUser(ctx context.Context, user string) (*ActionBilling, *Response, error) { - u := fmt.Sprintf("users/%v/settings/billing/actions", user) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - actionsUserBilling := new(ActionBilling) - resp, err := s.client.Do(ctx, req, actionsUserBilling) - if err != nil { - return nil, resp, err - } - - return actionsUserBilling, resp, nil -} - -// GetPackagesBillingUser returns the free and paid storage used for GitHub Packages in gigabytes for a user. -// -// GitHub API docs: https://docs.github.com/rest/billing/billing#get-github-packages-billing-for-a-user -// -//meta:operation GET /users/{username}/settings/billing/packages -func (s *BillingService) GetPackagesBillingUser(ctx context.Context, user string) (*PackageBilling, *Response, error) { - u := fmt.Sprintf("users/%v/settings/billing/packages", user) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - packagesUserBilling := new(PackageBilling) - resp, err := s.client.Do(ctx, req, packagesUserBilling) - if err != nil { - return nil, resp, err - } - - return packagesUserBilling, resp, nil -} - -// GetStorageBillingUser returns the estimated paid and estimated total storage used for GitHub Actions -// and GitHub Packages in gigabytes for a user. -// -// GitHub API docs: https://docs.github.com/rest/billing/billing#get-shared-storage-billing-for-a-user -// -//meta:operation GET /users/{username}/settings/billing/shared-storage -func (s *BillingService) GetStorageBillingUser(ctx context.Context, user string) (*StorageBilling, *Response, error) { - u := fmt.Sprintf("users/%v/settings/billing/shared-storage", user) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - storageUserBilling := new(StorageBilling) - resp, err := s.client.Do(ctx, req, storageUserBilling) - if err != nil { - return nil, resp, err - } - - return storageUserBilling, resp, nil -} diff --git a/vendor/github.com/google/go-github/v73/github/codespaces.go b/vendor/github.com/google/go-github/v73/github/codespaces.go deleted file mode 100644 index 608370503..000000000 --- a/vendor/github.com/google/go-github/v73/github/codespaces.go +++ /dev/null @@ -1,266 +0,0 @@ -// Copyright 2023 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package github - -import ( - "context" - "fmt" -) - -// CodespacesService handles communication with the Codespaces related -// methods of the GitHub API. -// -// GitHub API docs: https://docs.github.com/rest/codespaces/ -type CodespacesService service - -// Codespace represents a codespace. -// -// GitHub API docs: https://docs.github.com/rest/codespaces -type Codespace struct { - ID *int64 `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - DisplayName *string `json:"display_name,omitempty"` - EnvironmentID *string `json:"environment_id,omitempty"` - Owner *User `json:"owner,omitempty"` - BillableOwner *User `json:"billable_owner,omitempty"` - Repository *Repository `json:"repository,omitempty"` - Machine *CodespacesMachine `json:"machine,omitempty"` - DevcontainerPath *string `json:"devcontainer_path,omitempty"` - Prebuild *bool `json:"prebuild,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - LastUsedAt *Timestamp `json:"last_used_at,omitempty"` - State *string `json:"state,omitempty"` - URL *string `json:"url,omitempty"` - GitStatus *CodespacesGitStatus `json:"git_status,omitempty"` - Location *string `json:"location,omitempty"` - IdleTimeoutMinutes *int `json:"idle_timeout_minutes,omitempty"` - WebURL *string `json:"web_url,omitempty"` - MachinesURL *string `json:"machines_url,omitempty"` - StartURL *string `json:"start_url,omitempty"` - StopURL *string `json:"stop_url,omitempty"` - PullsURL *string `json:"pulls_url,omitempty"` - RecentFolders []string `json:"recent_folders,omitempty"` - RuntimeConstraints *CodespacesRuntimeConstraints `json:"runtime_constraints,omitempty"` - PendingOperation *bool `json:"pending_operation,omitempty"` - PendingOperationDisabledReason *string `json:"pending_operation_disabled_reason,omitempty"` - IdleTimeoutNotice *string `json:"idle_timeout_notice,omitempty"` - RetentionPeriodMinutes *int `json:"retention_period_minutes,omitempty"` - RetentionExpiresAt *Timestamp `json:"retention_expires_at,omitempty"` - LastKnownStopNotice *string `json:"last_known_stop_notice,omitempty"` -} - -// CodespacesGitStatus represents the git status of a codespace. -type CodespacesGitStatus struct { - Ahead *int `json:"ahead,omitempty"` - Behind *int `json:"behind,omitempty"` - HasUnpushedChanges *bool `json:"has_unpushed_changes,omitempty"` - HasUncommittedChanges *bool `json:"has_uncommitted_changes,omitempty"` - Ref *string `json:"ref,omitempty"` -} - -// CodespacesMachine represents the machine type of a codespace. -type CodespacesMachine struct { - Name *string `json:"name,omitempty"` - DisplayName *string `json:"display_name,omitempty"` - OperatingSystem *string `json:"operating_system,omitempty"` - StorageInBytes *int64 `json:"storage_in_bytes,omitempty"` - MemoryInBytes *int64 `json:"memory_in_bytes,omitempty"` - CPUs *int `json:"cpus,omitempty"` - PrebuildAvailability *string `json:"prebuild_availability,omitempty"` -} - -// CodespacesRuntimeConstraints represents the runtime constraints of a codespace. -type CodespacesRuntimeConstraints struct { - AllowedPortPrivacySettings []string `json:"allowed_port_privacy_settings,omitempty"` -} - -// ListCodespaces represents the response from the list codespaces endpoints. -type ListCodespaces struct { - TotalCount *int `json:"total_count,omitempty"` - Codespaces []*Codespace `json:"codespaces"` -} - -// ListInRepo lists codespaces for a user in a repository. -// -// Lists the codespaces associated with a specified repository and the authenticated user. -// You must authenticate using an access token with the codespace scope to use this endpoint. -// GitHub Apps must have read access to the codespaces repository permission to use this endpoint. -// -// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#list-codespaces-in-a-repository-for-the-authenticated-user -// -//meta:operation GET /repos/{owner}/{repo}/codespaces -func (s *CodespacesService) ListInRepo(ctx context.Context, owner, repo string, opts *ListOptions) (*ListCodespaces, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/codespaces", owner, repo) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var codespaces *ListCodespaces - resp, err := s.client.Do(ctx, req, &codespaces) - if err != nil { - return nil, resp, err - } - - return codespaces, resp, nil -} - -// ListCodespacesOptions represents the options for listing codespaces for a user. -type ListCodespacesOptions struct { - ListOptions - RepositoryID int64 `url:"repository_id,omitempty"` -} - -// List lists codespaces for an authenticated user. -// -// Lists the authenticated user's codespaces. -// You must authenticate using an access token with the codespace scope to use this endpoint. -// GitHub Apps must have read access to the codespaces repository permission to use this endpoint. -// -// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#list-codespaces-for-the-authenticated-user -// -//meta:operation GET /user/codespaces -func (s *CodespacesService) List(ctx context.Context, opts *ListCodespacesOptions) (*ListCodespaces, *Response, error) { - u := "user/codespaces" - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var codespaces *ListCodespaces - resp, err := s.client.Do(ctx, req, &codespaces) - if err != nil { - return nil, resp, err - } - - return codespaces, resp, nil -} - -// CreateCodespaceOptions represents options for the creation of a codespace in a repository. -type CreateCodespaceOptions struct { - Ref *string `json:"ref,omitempty"` - // Geo represents the geographic area for this codespace. - // If not specified, the value is assigned by IP. - // This property replaces location, which is being deprecated. - // Geo can be one of: `EuropeWest`, `SoutheastAsia`, `UsEast`, `UsWest`. - Geo *string `json:"geo,omitempty"` - ClientIP *string `json:"client_ip,omitempty"` - Machine *string `json:"machine,omitempty"` - DevcontainerPath *string `json:"devcontainer_path,omitempty"` - MultiRepoPermissionsOptOut *bool `json:"multi_repo_permissions_opt_out,omitempty"` - WorkingDirectory *string `json:"working_directory,omitempty"` - IdleTimeoutMinutes *int `json:"idle_timeout_minutes,omitempty"` - DisplayName *string `json:"display_name,omitempty"` - // RetentionPeriodMinutes represents the duration in minutes after codespace has gone idle in which it will be deleted. - // Must be integer minutes between 0 and 43200 (30 days). - RetentionPeriodMinutes *int `json:"retention_period_minutes,omitempty"` -} - -// CreateInRepo creates a codespace in a repository. -// -// Creates a codespace owned by the authenticated user in the specified repository. -// You must authenticate using an access token with the codespace scope to use this endpoint. -// GitHub Apps must have write access to the codespaces repository permission to use this endpoint. -// -// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#create-a-codespace-in-a-repository -// -//meta:operation POST /repos/{owner}/{repo}/codespaces -func (s *CodespacesService) CreateInRepo(ctx context.Context, owner, repo string, request *CreateCodespaceOptions) (*Codespace, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/codespaces", owner, repo) - - req, err := s.client.NewRequest("POST", u, request) - if err != nil { - return nil, nil, err - } - - var codespace *Codespace - resp, err := s.client.Do(ctx, req, &codespace) - if err != nil { - return nil, resp, err - } - - return codespace, resp, nil -} - -// Start starts a codespace. -// -// You must authenticate using an access token with the codespace scope to use this endpoint. -// GitHub Apps must have write access to the codespaces_lifecycle_admin repository permission to use this endpoint. -// -// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#start-a-codespace-for-the-authenticated-user -// -//meta:operation POST /user/codespaces/{codespace_name}/start -func (s *CodespacesService) Start(ctx context.Context, codespaceName string) (*Codespace, *Response, error) { - u := fmt.Sprintf("user/codespaces/%v/start", codespaceName) - - req, err := s.client.NewRequest("POST", u, nil) - if err != nil { - return nil, nil, err - } - - var codespace *Codespace - resp, err := s.client.Do(ctx, req, &codespace) - if err != nil { - return nil, resp, err - } - - return codespace, resp, nil -} - -// Stop stops a codespace. -// -// You must authenticate using an access token with the codespace scope to use this endpoint. -// GitHub Apps must have write access to the codespaces_lifecycle_admin repository permission to use this endpoint. -// -// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#stop-a-codespace-for-the-authenticated-user -// -//meta:operation POST /user/codespaces/{codespace_name}/stop -func (s *CodespacesService) Stop(ctx context.Context, codespaceName string) (*Codespace, *Response, error) { - u := fmt.Sprintf("user/codespaces/%v/stop", codespaceName) - - req, err := s.client.NewRequest("POST", u, nil) - if err != nil { - return nil, nil, err - } - - var codespace *Codespace - resp, err := s.client.Do(ctx, req, &codespace) - if err != nil { - return nil, resp, err - } - - return codespace, resp, nil -} - -// Delete deletes a codespace. -// -// You must authenticate using an access token with the codespace scope to use this endpoint. -// GitHub Apps must have write access to the codespaces repository permission to use this endpoint. -// -// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#delete-a-codespace-for-the-authenticated-user -// -//meta:operation DELETE /user/codespaces/{codespace_name} -func (s *CodespacesService) Delete(ctx context.Context, codespaceName string) (*Response, error) { - u := fmt.Sprintf("user/codespaces/%v", codespaceName) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v73/github/copilot.go b/vendor/github.com/google/go-github/v73/github/copilot.go deleted file mode 100644 index bed83536b..000000000 --- a/vendor/github.com/google/go-github/v73/github/copilot.go +++ /dev/null @@ -1,570 +0,0 @@ -// Copyright 2023 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package github - -import ( - "context" - "encoding/json" - "errors" - "fmt" - "time" -) - -// CopilotService provides access to the Copilot-related functions -// in the GitHub API. -// -// GitHub API docs: https://docs.github.com/en/rest/copilot/ -type CopilotService service - -// CopilotOrganizationDetails represents the details of an organization's Copilot for Business subscription. -type CopilotOrganizationDetails struct { - SeatBreakdown *CopilotSeatBreakdown `json:"seat_breakdown"` - PublicCodeSuggestions string `json:"public_code_suggestions"` - CopilotChat string `json:"copilot_chat"` - SeatManagementSetting string `json:"seat_management_setting"` -} - -// CopilotSeatBreakdown represents the breakdown of Copilot for Business seats for the organization. -type CopilotSeatBreakdown struct { - Total int `json:"total"` - AddedThisCycle int `json:"added_this_cycle"` - PendingCancellation int `json:"pending_cancellation"` - PendingInvitation int `json:"pending_invitation"` - ActiveThisCycle int `json:"active_this_cycle"` - InactiveThisCycle int `json:"inactive_this_cycle"` -} - -// ListCopilotSeatsResponse represents the Copilot for Business seat assignments for an organization. -type ListCopilotSeatsResponse struct { - TotalSeats int64 `json:"total_seats"` - Seats []*CopilotSeatDetails `json:"seats"` -} - -// CopilotSeatDetails represents the details of a Copilot for Business seat. -type CopilotSeatDetails struct { - // Assignee can either be a User, Team, or Organization. - Assignee any `json:"assignee"` - AssigningTeam *Team `json:"assigning_team,omitempty"` - PendingCancellationDate *string `json:"pending_cancellation_date,omitempty"` - LastActivityAt *Timestamp `json:"last_activity_at,omitempty"` - LastActivityEditor *string `json:"last_activity_editor,omitempty"` - CreatedAt *Timestamp `json:"created_at"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - PlanType *string `json:"plan_type,omitempty"` -} - -// SeatAssignments represents the number of seats assigned. -type SeatAssignments struct { - SeatsCreated int `json:"seats_created"` -} - -// SeatCancellations represents the number of seats cancelled. -type SeatCancellations struct { - SeatsCancelled int `json:"seats_cancelled"` -} - -// CopilotMetricsListOptions represents the optional parameters to the CopilotService get metrics methods. -type CopilotMetricsListOptions struct { - Since *time.Time `url:"since,omitempty"` - Until *time.Time `url:"until,omitempty"` - - ListOptions -} - -// CopilotIDECodeCompletionsLanguage represents Copilot usage metrics for completions in the IDE for a language. -type CopilotIDECodeCompletionsLanguage struct { - Name string `json:"name"` - TotalEngagedUsers int `json:"total_engaged_users"` -} - -// CopilotIDECodeCompletionsModelLanguage represents Copilot usage metrics for completions in the IDE for a model and language. -type CopilotIDECodeCompletionsModelLanguage struct { - Name string `json:"name"` - TotalEngagedUsers int `json:"total_engaged_users"` - TotalCodeSuggestions int `json:"total_code_suggestions"` - TotalCodeAcceptances int `json:"total_code_acceptances"` - TotalCodeLinesSuggested int `json:"total_code_lines_suggested"` - TotalCodeLinesAccepted int `json:"total_code_lines_accepted"` -} - -// CopilotIDECodeCompletionsModel represents Copilot usage metrics for completions in the IDE for a model. -type CopilotIDECodeCompletionsModel struct { - Name string `json:"name"` - IsCustomModel bool `json:"is_custom_model"` - CustomModelTrainingDate *string `json:"custom_model_training_date,omitempty"` - TotalEngagedUsers int `json:"total_engaged_users"` - Languages []*CopilotIDECodeCompletionsModelLanguage `json:"languages"` -} - -// CopilotIDECodeCompletionsEditor represents Copilot usage metrics for completions in the IDE for an editor. -type CopilotIDECodeCompletionsEditor struct { - Name string `json:"name"` - TotalEngagedUsers int `json:"total_engaged_users"` - Models []*CopilotIDECodeCompletionsModel `json:"models"` -} - -// CopilotIDECodeCompletions represents Copilot usage metrics for Copilot code completions in the IDE, categorized by editor, model and language. -type CopilotIDECodeCompletions struct { - TotalEngagedUsers int `json:"total_engaged_users"` - Languages []*CopilotIDECodeCompletionsLanguage `json:"languages"` - Editors []*CopilotIDECodeCompletionsEditor `json:"editors"` -} - -// CopilotIDEChatModel represents Copilot usage metrics for chatting with a model in the IDE. -type CopilotIDEChatModel struct { - Name string `json:"name"` - IsCustomModel bool `json:"is_custom_model"` - CustomModelTrainingDate *string `json:"custom_model_training_date,omitempty"` - TotalEngagedUsers int `json:"total_engaged_users"` - TotalChats int `json:"total_chats"` - TotalChatInsertionEvents int `json:"total_chat_insertion_events"` - TotalChatCopyEvents int `json:"total_chat_copy_events"` -} - -// CopilotIDEChatEditor represents Copilot usage metrics for chatting with a model in the IDE, categorized by editor and model. -type CopilotIDEChatEditor struct { - Name string `json:"name"` - TotalEngagedUsers int `json:"total_engaged_users"` - Models []*CopilotIDEChatModel `json:"models"` -} - -// CopilotIDEChat represents Copilot usage metrics for Copilot Chat in the IDE, categorized by editor and model. -type CopilotIDEChat struct { - TotalEngagedUsers int `json:"total_engaged_users"` - Editors []*CopilotIDEChatEditor `json:"editors"` -} - -// CopilotDotcomChatModel represents Copilot usage metrics for chatting with a model in the webbrowser. -type CopilotDotcomChatModel struct { - Name string `json:"name"` - IsCustomModel bool `json:"is_custom_model"` - CustomModelTrainingDate *string `json:"custom_model_training_date,omitempty"` - TotalEngagedUsers int `json:"total_engaged_users"` - TotalChats int `json:"total_chats"` -} - -// CopilotDotcomChat represents Copilot usage metrics for Copilot Chat in the webbrowser, categorized by model. -type CopilotDotcomChat struct { - TotalEngagedUsers int `json:"total_engaged_users"` - Models []*CopilotDotcomChatModel `json:"models"` -} - -// CopilotDotcomPullRequestsModel represents Copilot usage metrics for pull requests in the webbrowser, categorized by model. -type CopilotDotcomPullRequestsModel struct { - Name string `json:"name"` - IsCustomModel bool `json:"is_custom_model"` - CustomModelTrainingDate *string `json:"custom_model_training_date,omitempty"` - TotalPRSummariesCreated int `json:"total_pr_summaries_created"` - TotalEngagedUsers int `json:"total_engaged_users"` -} - -// CopilotDotcomPullRequestsRepository represents Copilot usage metrics for pull requests in the webbrowser, categorized by repository. -type CopilotDotcomPullRequestsRepository struct { - Name string `json:"name"` - TotalEngagedUsers int `json:"total_engaged_users"` - Models []*CopilotDotcomPullRequestsModel `json:"models"` -} - -// CopilotDotcomPullRequests represents Copilot usage metrics for pull requests in the webbrowser, categorized by repository and model. -type CopilotDotcomPullRequests struct { - TotalEngagedUsers int `json:"total_engaged_users"` - Repositories []*CopilotDotcomPullRequestsRepository `json:"repositories"` -} - -// CopilotMetrics represents Copilot usage metrics for a given day. -type CopilotMetrics struct { - Date string `json:"date"` - TotalActiveUsers *int `json:"total_active_users,omitempty"` - TotalEngagedUsers *int `json:"total_engaged_users,omitempty"` - CopilotIDECodeCompletions *CopilotIDECodeCompletions `json:"copilot_ide_code_completions,omitempty"` - CopilotIDEChat *CopilotIDEChat `json:"copilot_ide_chat,omitempty"` - CopilotDotcomChat *CopilotDotcomChat `json:"copilot_dotcom_chat,omitempty"` - CopilotDotcomPullRequests *CopilotDotcomPullRequests `json:"copilot_dotcom_pull_requests,omitempty"` -} - -func (cp *CopilotSeatDetails) UnmarshalJSON(data []byte) error { - // Using an alias to avoid infinite recursion when calling json.Unmarshal - type alias CopilotSeatDetails - var seatDetail alias - - if err := json.Unmarshal(data, &seatDetail); err != nil { - return err - } - - cp.AssigningTeam = seatDetail.AssigningTeam - cp.PendingCancellationDate = seatDetail.PendingCancellationDate - cp.LastActivityAt = seatDetail.LastActivityAt - cp.LastActivityEditor = seatDetail.LastActivityEditor - cp.CreatedAt = seatDetail.CreatedAt - cp.UpdatedAt = seatDetail.UpdatedAt - cp.PlanType = seatDetail.PlanType - - switch v := seatDetail.Assignee.(type) { - case map[string]any: - jsonData, err := json.Marshal(seatDetail.Assignee) - if err != nil { - return err - } - - if v["type"] == nil { - return errors.New("assignee type field is not set") - } - - if t, ok := v["type"].(string); ok && t == "User" { - user := &User{} - if err := json.Unmarshal(jsonData, user); err != nil { - return err - } - cp.Assignee = user - } else if t, ok := v["type"].(string); ok && t == "Team" { - team := &Team{} - if err := json.Unmarshal(jsonData, team); err != nil { - return err - } - cp.Assignee = team - } else if t, ok := v["type"].(string); ok && t == "Organization" { - organization := &Organization{} - if err := json.Unmarshal(jsonData, organization); err != nil { - return err - } - cp.Assignee = organization - } else { - return fmt.Errorf("unsupported assignee type %v", v["type"]) - } - default: - return fmt.Errorf("unsupported assignee type %T", v) - } - - return nil -} - -// GetUser gets the User from the CopilotSeatDetails if the assignee is a user. -func (cp *CopilotSeatDetails) GetUser() (*User, bool) { u, ok := cp.Assignee.(*User); return u, ok } - -// GetTeam gets the Team from the CopilotSeatDetails if the assignee is a team. -func (cp *CopilotSeatDetails) GetTeam() (*Team, bool) { t, ok := cp.Assignee.(*Team); return t, ok } - -// GetOrganization gets the Organization from the CopilotSeatDetails if the assignee is an organization. -func (cp *CopilotSeatDetails) GetOrganization() (*Organization, bool) { - o, ok := cp.Assignee.(*Organization) - return o, ok -} - -// GetCopilotBilling gets Copilot for Business billing information and settings for an organization. -// -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#get-copilot-seat-information-and-settings-for-an-organization -// -//meta:operation GET /orgs/{org}/copilot/billing -func (s *CopilotService) GetCopilotBilling(ctx context.Context, org string) (*CopilotOrganizationDetails, *Response, error) { - u := fmt.Sprintf("orgs/%v/copilot/billing", org) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var copilotDetails *CopilotOrganizationDetails - resp, err := s.client.Do(ctx, req, &copilotDetails) - if err != nil { - return nil, resp, err - } - - return copilotDetails, resp, nil -} - -// ListCopilotSeats lists Copilot for Business seat assignments for an organization. -// -// To paginate through all seats, populate 'Page' with the number of the last page. -// -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#list-all-copilot-seat-assignments-for-an-organization -// -//meta:operation GET /orgs/{org}/copilot/billing/seats -func (s *CopilotService) ListCopilotSeats(ctx context.Context, org string, opts *ListOptions) (*ListCopilotSeatsResponse, *Response, error) { - u := fmt.Sprintf("orgs/%v/copilot/billing/seats", org) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var copilotSeats *ListCopilotSeatsResponse - resp, err := s.client.Do(ctx, req, &copilotSeats) - if err != nil { - return nil, resp, err - } - - return copilotSeats, resp, nil -} - -// ListCopilotEnterpriseSeats lists Copilot for Business seat assignments for an enterprise. -// -// To paginate through all seats, populate 'Page' with the number of the last page. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-user-management#list-all-copilot-seat-assignments-for-an-enterprise -// -//meta:operation GET /enterprises/{enterprise}/copilot/billing/seats -func (s *CopilotService) ListCopilotEnterpriseSeats(ctx context.Context, enterprise string, opts *ListOptions) (*ListCopilotSeatsResponse, *Response, error) { - u := fmt.Sprintf("enterprises/%v/copilot/billing/seats", enterprise) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var copilotSeats *ListCopilotSeatsResponse - resp, err := s.client.Do(ctx, req, &copilotSeats) - if err != nil { - return nil, resp, err - } - - return copilotSeats, resp, nil -} - -// AddCopilotTeams adds teams to the Copilot for Business subscription for an organization. -// -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#add-teams-to-the-copilot-subscription-for-an-organization -// -//meta:operation POST /orgs/{org}/copilot/billing/selected_teams -func (s *CopilotService) AddCopilotTeams(ctx context.Context, org string, teamNames []string) (*SeatAssignments, *Response, error) { - u := fmt.Sprintf("orgs/%v/copilot/billing/selected_teams", org) - - body := struct { - SelectedTeams []string `json:"selected_teams"` - }{ - SelectedTeams: teamNames, - } - - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - var seatAssignments *SeatAssignments - resp, err := s.client.Do(ctx, req, &seatAssignments) - if err != nil { - return nil, resp, err - } - - return seatAssignments, resp, nil -} - -// RemoveCopilotTeams removes teams from the Copilot for Business subscription for an organization. -// -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#remove-teams-from-the-copilot-subscription-for-an-organization -// -//meta:operation DELETE /orgs/{org}/copilot/billing/selected_teams -func (s *CopilotService) RemoveCopilotTeams(ctx context.Context, org string, teamNames []string) (*SeatCancellations, *Response, error) { - u := fmt.Sprintf("orgs/%v/copilot/billing/selected_teams", org) - - body := struct { - SelectedTeams []string `json:"selected_teams"` - }{ - SelectedTeams: teamNames, - } - - req, err := s.client.NewRequest("DELETE", u, body) - if err != nil { - return nil, nil, err - } - - var seatCancellations *SeatCancellations - resp, err := s.client.Do(ctx, req, &seatCancellations) - if err != nil { - return nil, resp, err - } - - return seatCancellations, resp, nil -} - -// AddCopilotUsers adds users to the Copilot for Business subscription for an organization -// -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#add-users-to-the-copilot-subscription-for-an-organization -// -//meta:operation POST /orgs/{org}/copilot/billing/selected_users -func (s *CopilotService) AddCopilotUsers(ctx context.Context, org string, users []string) (*SeatAssignments, *Response, error) { - u := fmt.Sprintf("orgs/%v/copilot/billing/selected_users", org) - - body := struct { - SelectedUsernames []string `json:"selected_usernames"` - }{ - SelectedUsernames: users, - } - - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - var seatAssignments *SeatAssignments - resp, err := s.client.Do(ctx, req, &seatAssignments) - if err != nil { - return nil, resp, err - } - - return seatAssignments, resp, nil -} - -// RemoveCopilotUsers removes users from the Copilot for Business subscription for an organization. -// -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#remove-users-from-the-copilot-subscription-for-an-organization -// -//meta:operation DELETE /orgs/{org}/copilot/billing/selected_users -func (s *CopilotService) RemoveCopilotUsers(ctx context.Context, org string, users []string) (*SeatCancellations, *Response, error) { - u := fmt.Sprintf("orgs/%v/copilot/billing/selected_users", org) - - body := struct { - SelectedUsernames []string `json:"selected_usernames"` - }{ - SelectedUsernames: users, - } - - req, err := s.client.NewRequest("DELETE", u, body) - if err != nil { - return nil, nil, err - } - - var seatCancellations *SeatCancellations - resp, err := s.client.Do(ctx, req, &seatCancellations) - if err != nil { - return nil, resp, err - } - - return seatCancellations, resp, nil -} - -// GetSeatDetails gets Copilot for Business seat assignment details for a user. -// -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#get-copilot-seat-assignment-details-for-a-user -// -//meta:operation GET /orgs/{org}/members/{username}/copilot -func (s *CopilotService) GetSeatDetails(ctx context.Context, org, user string) (*CopilotSeatDetails, *Response, error) { - u := fmt.Sprintf("orgs/%v/members/%v/copilot", org, user) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var seatDetails *CopilotSeatDetails - resp, err := s.client.Do(ctx, req, &seatDetails) - if err != nil { - return nil, resp, err - } - - return seatDetails, resp, nil -} - -// GetEnterpriseMetrics gets Copilot usage metrics for an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-metrics#get-copilot-metrics-for-an-enterprise -// -//meta:operation GET /enterprises/{enterprise}/copilot/metrics -func (s *CopilotService) GetEnterpriseMetrics(ctx context.Context, enterprise string, opts *CopilotMetricsListOptions) ([]*CopilotMetrics, *Response, error) { - u := fmt.Sprintf("enterprises/%v/copilot/metrics", enterprise) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var metrics []*CopilotMetrics - resp, err := s.client.Do(ctx, req, &metrics) - if err != nil { - return nil, resp, err - } - - return metrics, resp, nil -} - -// GetEnterpriseTeamMetrics gets Copilot usage metrics for an enterprise team. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-metrics#get-copilot-metrics-for-an-enterprise-team -// -//meta:operation GET /enterprises/{enterprise}/team/{team_slug}/copilot/metrics -func (s *CopilotService) GetEnterpriseTeamMetrics(ctx context.Context, enterprise, team string, opts *CopilotMetricsListOptions) ([]*CopilotMetrics, *Response, error) { - u := fmt.Sprintf("enterprises/%v/team/%v/copilot/metrics", enterprise, team) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var metrics []*CopilotMetrics - resp, err := s.client.Do(ctx, req, &metrics) - if err != nil { - return nil, resp, err - } - - return metrics, resp, nil -} - -// GetOrganizationMetrics gets Copilot usage metrics for an organization. -// -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-metrics#get-copilot-metrics-for-an-organization -// -//meta:operation GET /orgs/{org}/copilot/metrics -func (s *CopilotService) GetOrganizationMetrics(ctx context.Context, org string, opts *CopilotMetricsListOptions) ([]*CopilotMetrics, *Response, error) { - u := fmt.Sprintf("orgs/%v/copilot/metrics", org) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var metrics []*CopilotMetrics - resp, err := s.client.Do(ctx, req, &metrics) - if err != nil { - return nil, resp, err - } - - return metrics, resp, nil -} - -// GetOrganizationTeamMetrics gets Copilot usage metrics for an organization team. -// -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-metrics#get-copilot-metrics-for-a-team -// -//meta:operation GET /orgs/{org}/team/{team_slug}/copilot/metrics -func (s *CopilotService) GetOrganizationTeamMetrics(ctx context.Context, org, team string, opts *CopilotMetricsListOptions) ([]*CopilotMetrics, *Response, error) { - u := fmt.Sprintf("orgs/%v/team/%v/copilot/metrics", org, team) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var metrics []*CopilotMetrics - resp, err := s.client.Do(ctx, req, &metrics) - if err != nil { - return nil, resp, err - } - - return metrics, resp, nil -} diff --git a/vendor/github.com/google/go-github/v73/github/enterprise_actions_hosted_runners.go b/vendor/github.com/google/go-github/v73/github/enterprise_actions_hosted_runners.go deleted file mode 100644 index e82ba9b80..000000000 --- a/vendor/github.com/google/go-github/v73/github/enterprise_actions_hosted_runners.go +++ /dev/null @@ -1,234 +0,0 @@ -// Copyright 2025 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package github - -import ( - "context" - "fmt" -) - -// ListHostedRunners lists all the GitHub-hosted runners for an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners#list-github-hosted-runners-for-an-enterprise -// -//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners -func (s *EnterpriseService) ListHostedRunners(ctx context.Context, enterprise string, opts *ListOptions) (*HostedRunners, *Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/hosted-runners", enterprise) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - runners := &HostedRunners{} - resp, err := s.client.Do(ctx, req, &runners) - if err != nil { - return nil, resp, err - } - - return runners, resp, nil -} - -// CreateHostedRunner creates a GitHub-hosted runner for an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners#create-a-github-hosted-runner-for-an-enterprise -// -//meta:operation POST /enterprises/{enterprise}/actions/hosted-runners -func (s *EnterpriseService) CreateHostedRunner(ctx context.Context, enterprise string, request *HostedRunnerRequest) (*HostedRunner, *Response, error) { - if err := validateCreateHostedRunnerRequest(request); err != nil { - return nil, nil, fmt.Errorf("validation failed: %w", err) - } - - u := fmt.Sprintf("enterprises/%v/actions/hosted-runners", enterprise) - req, err := s.client.NewRequest("POST", u, request) - if err != nil { - return nil, nil, err - } - - hostedRunner := new(HostedRunner) - resp, err := s.client.Do(ctx, req, hostedRunner) - if err != nil { - return nil, resp, err - } - - return hostedRunner, resp, nil -} - -// GetHostedRunnerGitHubOwnedImages gets the list of GitHub-owned images available for GitHub-hosted runners for an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners#get-github-owned-images-for-github-hosted-runners-in-an-enterprise -// -//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/images/github-owned -func (s *EnterpriseService) GetHostedRunnerGitHubOwnedImages(ctx context.Context, enterprise string) (*HostedRunnerImages, *Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/images/github-owned", enterprise) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - hostedRunnerImages := new(HostedRunnerImages) - resp, err := s.client.Do(ctx, req, hostedRunnerImages) - if err != nil { - return nil, resp, err - } - - return hostedRunnerImages, resp, nil -} - -// GetHostedRunnerPartnerImages gets the list of partner images available for GitHub-hosted runners for an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners#get-partner-images-for-github-hosted-runners-in-an-enterprise -// -//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/images/partner -func (s *EnterpriseService) GetHostedRunnerPartnerImages(ctx context.Context, enterprise string) (*HostedRunnerImages, *Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/images/partner", enterprise) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - hostedRunnerImages := new(HostedRunnerImages) - resp, err := s.client.Do(ctx, req, hostedRunnerImages) - if err != nil { - return nil, resp, err - } - - return hostedRunnerImages, resp, nil -} - -// GetHostedRunnerLimits gets the GitHub-hosted runners Static public IP Limits for an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners#get-limits-on-github-hosted-runners-for-an-enterprise -// -//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/limits -func (s *EnterpriseService) GetHostedRunnerLimits(ctx context.Context, enterprise string) (*HostedRunnerPublicIPLimits, *Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/limits", enterprise) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - publicIPLimits := new(HostedRunnerPublicIPLimits) - resp, err := s.client.Do(ctx, req, publicIPLimits) - if err != nil { - return nil, resp, err - } - - return publicIPLimits, resp, nil -} - -// GetHostedRunnerMachineSpecs gets the list of machine specs available for GitHub-hosted runners for an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners#get-github-hosted-runners-machine-specs-for-an-enterprise -// -//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/machine-sizes -func (s *EnterpriseService) GetHostedRunnerMachineSpecs(ctx context.Context, enterprise string) (*HostedRunnerMachineSpecs, *Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/machine-sizes", enterprise) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - machineSpecs := new(HostedRunnerMachineSpecs) - resp, err := s.client.Do(ctx, req, machineSpecs) - if err != nil { - return nil, resp, err - } - - return machineSpecs, resp, nil -} - -// GetHostedRunnerPlatforms gets list of platforms available for GitHub-hosted runners for an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners#get-platforms-for-github-hosted-runners-in-an-enterprise -// -//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/platforms -func (s *EnterpriseService) GetHostedRunnerPlatforms(ctx context.Context, enterprise string) (*HostedRunnerPlatforms, *Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/platforms", enterprise) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - platforms := new(HostedRunnerPlatforms) - resp, err := s.client.Do(ctx, req, platforms) - if err != nil { - return nil, resp, err - } - - return platforms, resp, nil -} - -// GetHostedRunner gets a GitHub-hosted runner in an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners#get-a-github-hosted-runner-for-an-enterprise -// -//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/{hosted_runner_id} -func (s *EnterpriseService) GetHostedRunner(ctx context.Context, enterprise string, runnerID int64) (*HostedRunner, *Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/%v", enterprise, runnerID) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - hostedRunner := new(HostedRunner) - resp, err := s.client.Do(ctx, req, hostedRunner) - if err != nil { - return nil, resp, err - } - - return hostedRunner, resp, nil -} - -// UpdateHostedRunner updates a GitHub-hosted runner for an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners#update-a-github-hosted-runner-for-an-enterprise -// -//meta:operation PATCH /enterprises/{enterprise}/actions/hosted-runners/{hosted_runner_id} -func (s *EnterpriseService) UpdateHostedRunner(ctx context.Context, enterprise string, runnerID int64, updateReq HostedRunnerRequest) (*HostedRunner, *Response, error) { - if err := validateUpdateHostedRunnerRequest(&updateReq); err != nil { - return nil, nil, fmt.Errorf("validation failed: %w", err) - } - - u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/%v", enterprise, runnerID) - req, err := s.client.NewRequest("PATCH", u, updateReq) - if err != nil { - return nil, nil, err - } - - hostedRunner := new(HostedRunner) - resp, err := s.client.Do(ctx, req, hostedRunner) - if err != nil { - return nil, resp, err - } - - return hostedRunner, resp, nil -} - -// DeleteHostedRunner deletes GitHub-hosted runner from an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners#delete-a-github-hosted-runner-for-an-enterprise -// -//meta:operation DELETE /enterprises/{enterprise}/actions/hosted-runners/{hosted_runner_id} -func (s *EnterpriseService) DeleteHostedRunner(ctx context.Context, enterprise string, runnerID int64) (*HostedRunner, *Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/%v", enterprise, runnerID) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, nil, err - } - - hostedRunner := new(HostedRunner) - resp, err := s.client.Do(ctx, req, hostedRunner) - if err != nil { - return nil, resp, err - } - - return hostedRunner, resp, nil -} diff --git a/vendor/github.com/google/go-github/v73/github/issues.go b/vendor/github.com/google/go-github/v73/github/issues.go deleted file mode 100644 index 395d64cf4..000000000 --- a/vendor/github.com/google/go-github/v73/github/issues.go +++ /dev/null @@ -1,405 +0,0 @@ -// Copyright 2013 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package github - -import ( - "context" - "fmt" - "time" -) - -// IssuesService handles communication with the issue related -// methods of the GitHub API. -// -// GitHub API docs: https://docs.github.com/rest/issues/ -type IssuesService service - -// Issue represents a GitHub issue on a repository. -// -// Note: As far as the GitHub API is concerned, every pull request is an issue, -// but not every issue is a pull request. Some endpoints, events, and webhooks -// may also return pull requests via this struct. If PullRequestLinks is nil, -// this is an issue, and if PullRequestLinks is not nil, this is a pull request. -// The IsPullRequest helper method can be used to check that. -type Issue struct { - ID *int64 `json:"id,omitempty"` - Number *int `json:"number,omitempty"` - State *string `json:"state,omitempty"` - // StateReason can be one of: "completed", "not_planned", "reopened". - StateReason *string `json:"state_reason,omitempty"` - Locked *bool `json:"locked,omitempty"` - Title *string `json:"title,omitempty"` - Body *string `json:"body,omitempty"` - AuthorAssociation *string `json:"author_association,omitempty"` - User *User `json:"user,omitempty"` - Labels []*Label `json:"labels,omitempty"` - Assignee *User `json:"assignee,omitempty"` - Comments *int `json:"comments,omitempty"` - ClosedAt *Timestamp `json:"closed_at,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - ClosedBy *User `json:"closed_by,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - CommentsURL *string `json:"comments_url,omitempty"` - EventsURL *string `json:"events_url,omitempty"` - LabelsURL *string `json:"labels_url,omitempty"` - RepositoryURL *string `json:"repository_url,omitempty"` - Milestone *Milestone `json:"milestone,omitempty"` - PullRequestLinks *PullRequestLinks `json:"pull_request,omitempty"` - Repository *Repository `json:"repository,omitempty"` - Reactions *Reactions `json:"reactions,omitempty"` - Assignees []*User `json:"assignees,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Draft *bool `json:"draft,omitempty"` - Type *IssueType `json:"type,omitempty"` - - // TextMatches is only populated from search results that request text matches - // See: search.go and https://docs.github.com/rest/search/#text-match-metadata - TextMatches []*TextMatch `json:"text_matches,omitempty"` - - // ActiveLockReason is populated only when LockReason is provided while locking the issue. - // Possible values are: "off-topic", "too heated", "resolved", and "spam". - ActiveLockReason *string `json:"active_lock_reason,omitempty"` -} - -func (i Issue) String() string { - return Stringify(i) -} - -// IsPullRequest reports whether the issue is also a pull request. It uses the -// method recommended by GitHub's API documentation, which is to check whether -// PullRequestLinks is non-nil. -func (i Issue) IsPullRequest() bool { - return i.PullRequestLinks != nil -} - -// IssueRequest represents a request to create/edit an issue. -// It is separate from Issue above because otherwise Labels -// and Assignee fail to serialize to the correct JSON. -type IssueRequest struct { - Title *string `json:"title,omitempty"` - Body *string `json:"body,omitempty"` - Labels *[]string `json:"labels,omitempty"` - Assignee *string `json:"assignee,omitempty"` - State *string `json:"state,omitempty"` - // StateReason can be 'completed' or 'not_planned'. - StateReason *string `json:"state_reason,omitempty"` - Milestone *int `json:"milestone,omitempty"` - Assignees *[]string `json:"assignees,omitempty"` - Type *string `json:"type,omitempty"` -} - -// IssueListOptions specifies the optional parameters to the IssuesService.List -// and IssuesService.ListByOrg methods. -type IssueListOptions struct { - // Filter specifies which issues to list. Possible values are: assigned, - // created, mentioned, subscribed, all. Default is "assigned". - Filter string `url:"filter,omitempty"` - - // State filters issues based on their state. Possible values are: open, - // closed, all. Default is "open". - State string `url:"state,omitempty"` - - // Labels filters issues based on their label. - Labels []string `url:"labels,comma,omitempty"` - - // Sort specifies how to sort issues. Possible values are: created, updated, - // and comments. Default value is "created". - Sort string `url:"sort,omitempty"` - - // Direction in which to sort issues. Possible values are: asc, desc. - // Default is "desc". - Direction string `url:"direction,omitempty"` - - // Since filters issues by time. - Since time.Time `url:"since,omitempty"` - - ListCursorOptions - - // Add ListOptions so offset pagination with integer type "page" query parameter is accepted - // since ListCursorOptions accepts "page" as string only. - ListOptions -} - -// PullRequestLinks object is added to the Issue object when it's an issue included -// in the IssueCommentEvent webhook payload, if the webhook is fired by a comment on a PR. -type PullRequestLinks struct { - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - DiffURL *string `json:"diff_url,omitempty"` - PatchURL *string `json:"patch_url,omitempty"` - MergedAt *Timestamp `json:"merged_at,omitempty"` -} - -// IssueType represents the type of issue. -// For now it shows up when receiveing an Issue event. -type IssueType struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Color *string `json:"color,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` -} - -// List the issues for the authenticated user. If all is true, list issues -// across all the user's visible repositories including owned, member, and -// organization repositories; if false, list only owned and member -// repositories. -// -// GitHub API docs: https://docs.github.com/rest/issues/issues#list-issues-assigned-to-the-authenticated-user -// GitHub API docs: https://docs.github.com/rest/issues/issues#list-user-account-issues-assigned-to-the-authenticated-user -// -//meta:operation GET /issues -//meta:operation GET /user/issues -func (s *IssuesService) List(ctx context.Context, all bool, opts *IssueListOptions) ([]*Issue, *Response, error) { - var u string - if all { - u = "issues" - } else { - u = "user/issues" - } - return s.listIssues(ctx, u, opts) -} - -// ListByOrg fetches the issues in the specified organization for the -// authenticated user. -// -// GitHub API docs: https://docs.github.com/rest/issues/issues#list-organization-issues-assigned-to-the-authenticated-user -// -//meta:operation GET /orgs/{org}/issues -func (s *IssuesService) ListByOrg(ctx context.Context, org string, opts *IssueListOptions) ([]*Issue, *Response, error) { - u := fmt.Sprintf("orgs/%v/issues", org) - return s.listIssues(ctx, u, opts) -} - -func (s *IssuesService) listIssues(ctx context.Context, u string, opts *IssueListOptions) ([]*Issue, *Response, error) { - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var issues []*Issue - resp, err := s.client.Do(ctx, req, &issues) - if err != nil { - return nil, resp, err - } - - return issues, resp, nil -} - -// IssueListByRepoOptions specifies the optional parameters to the -// IssuesService.ListByRepo method. -type IssueListByRepoOptions struct { - // Milestone limits issues for the specified milestone. Possible values are - // a milestone number, "none" for issues with no milestone, "*" for issues - // with any milestone. - Milestone string `url:"milestone,omitempty"` - - // State filters issues based on their state. Possible values are: open, - // closed, all. Default is "open". - State string `url:"state,omitempty"` - - // Assignee filters issues based on their assignee. Possible values are a - // user name, "none" for issues that are not assigned, "*" for issues with - // any assigned user. - Assignee string `url:"assignee,omitempty"` - - // Creator filters issues based on their creator. - Creator string `url:"creator,omitempty"` - - // Mentioned filters issues to those mentioned a specific user. - Mentioned string `url:"mentioned,omitempty"` - - // Labels filters issues based on their label. - Labels []string `url:"labels,omitempty,comma"` - - // Sort specifies how to sort issues. Possible values are: created, updated, - // and comments. Default value is "created". - Sort string `url:"sort,omitempty"` - - // Direction in which to sort issues. Possible values are: asc, desc. - // Default is "desc". - Direction string `url:"direction,omitempty"` - - // Since filters issues by time. - Since time.Time `url:"since,omitempty"` - - ListCursorOptions - - // Add ListOptions so offset pagination with integer type "page" query parameter is accepted - // since ListCursorOptions accepts "page" as string only. - ListOptions -} - -// ListByRepo lists the issues for the specified repository. -// -// GitHub API docs: https://docs.github.com/rest/issues/issues#list-repository-issues -// -//meta:operation GET /repos/{owner}/{repo}/issues -func (s *IssuesService) ListByRepo(ctx context.Context, owner string, repo string, opts *IssueListByRepoOptions) ([]*Issue, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues", owner, repo) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var issues []*Issue - resp, err := s.client.Do(ctx, req, &issues) - if err != nil { - return nil, resp, err - } - - return issues, resp, nil -} - -// Get a single issue. -// -// GitHub API docs: https://docs.github.com/rest/issues/issues#get-an-issue -// -//meta:operation GET /repos/{owner}/{repo}/issues/{issue_number} -func (s *IssuesService) Get(ctx context.Context, owner string, repo string, number int) (*Issue, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d", owner, repo, number) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - issue := new(Issue) - resp, err := s.client.Do(ctx, req, issue) - if err != nil { - return nil, resp, err - } - - return issue, resp, nil -} - -// Create a new issue on the specified repository. -// -// GitHub API docs: https://docs.github.com/rest/issues/issues#create-an-issue -// -//meta:operation POST /repos/{owner}/{repo}/issues -func (s *IssuesService) Create(ctx context.Context, owner string, repo string, issue *IssueRequest) (*Issue, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues", owner, repo) - req, err := s.client.NewRequest("POST", u, issue) - if err != nil { - return nil, nil, err - } - - i := new(Issue) - resp, err := s.client.Do(ctx, req, i) - if err != nil { - return nil, resp, err - } - - return i, resp, nil -} - -// Edit (update) an issue. -// -// GitHub API docs: https://docs.github.com/rest/issues/issues#update-an-issue -// -//meta:operation PATCH /repos/{owner}/{repo}/issues/{issue_number} -func (s *IssuesService) Edit(ctx context.Context, owner string, repo string, number int, issue *IssueRequest) (*Issue, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d", owner, repo, number) - req, err := s.client.NewRequest("PATCH", u, issue) - if err != nil { - return nil, nil, err - } - - i := new(Issue) - resp, err := s.client.Do(ctx, req, i) - if err != nil { - return nil, resp, err - } - - return i, resp, nil -} - -// RemoveMilestone removes a milestone from an issue. -// -// This is a helper method to explicitly update an issue with a `null` milestone, thereby removing it. -// -// GitHub API docs: https://docs.github.com/rest/issues/issues#update-an-issue -// -//meta:operation PATCH /repos/{owner}/{repo}/issues/{issue_number} -func (s *IssuesService) RemoveMilestone(ctx context.Context, owner, repo string, issueNumber int) (*Issue, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%v", owner, repo, issueNumber) - req, err := s.client.NewRequest("PATCH", u, &struct { - Milestone *Milestone `json:"milestone"` - }{}) - if err != nil { - return nil, nil, err - } - - i := new(Issue) - resp, err := s.client.Do(ctx, req, i) - if err != nil { - return nil, resp, err - } - - return i, resp, nil -} - -// LockIssueOptions specifies the optional parameters to the -// IssuesService.Lock method. -type LockIssueOptions struct { - // LockReason specifies the reason to lock this issue. - // Providing a lock reason can help make it clearer to contributors why an issue - // was locked. Possible values are: "off-topic", "too heated", "resolved", and "spam". - LockReason string `json:"lock_reason,omitempty"` -} - -// Lock an issue's conversation. -// -// GitHub API docs: https://docs.github.com/rest/issues/issues#lock-an-issue -// -//meta:operation PUT /repos/{owner}/{repo}/issues/{issue_number}/lock -func (s *IssuesService) Lock(ctx context.Context, owner string, repo string, number int, opts *LockIssueOptions) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/lock", owner, repo, number) - req, err := s.client.NewRequest("PUT", u, opts) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// Unlock an issue's conversation. -// -// GitHub API docs: https://docs.github.com/rest/issues/issues#unlock-an-issue -// -//meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/lock -func (s *IssuesService) Unlock(ctx context.Context, owner string, repo string, number int) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/lock", owner, repo, number) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v73/github/orgs_codesecurity_configurations.go b/vendor/github.com/google/go-github/v73/github/orgs_codesecurity_configurations.go deleted file mode 100644 index b25845a4e..000000000 --- a/vendor/github.com/google/go-github/v73/github/orgs_codesecurity_configurations.go +++ /dev/null @@ -1,284 +0,0 @@ -// Copyright 2024 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package github - -import ( - "context" - "fmt" - "net/http" -) - -// DependencyGraphAutosubmitActionOptions represents the options for the DependencyGraphAutosubmitAction. -type DependencyGraphAutosubmitActionOptions struct { - LabeledRunners *bool `json:"labeled_runners,omitempty"` -} - -// CodeSecurityConfiguration represents a code security configuration. -type CodeSecurityConfiguration struct { - ID *int64 `json:"id,omitempty"` - TargetType *string `json:"target_type,omitempty"` - Name *string `json:"name"` - Description *string `json:"description,omitempty"` - AdvancedSecurity *string `json:"advanced_security,omitempty"` - DependencyGraph *string `json:"dependency_graph,omitempty"` - DependencyGraphAutosubmitAction *string `json:"dependency_graph_autosubmit_action,omitempty"` - DependencyGraphAutosubmitActionOptions *DependencyGraphAutosubmitActionOptions `json:"dependency_graph_autosubmit_action_options,omitempty"` - DependabotAlerts *string `json:"dependabot_alerts,omitempty"` - DependabotSecurityUpdates *string `json:"dependabot_security_updates,omitempty"` - CodeScanningDefaultSetup *string `json:"code_scanning_default_setup,omitempty"` - SecretScanning *string `json:"secret_scanning,omitempty"` - SecretScanningPushProtection *string `json:"secret_scanning_push_protection,omitempty"` - SecretScanningValidityChecks *string `json:"secret_scanning_validity_checks,omitempty"` - SecretScanningNonProviderPatterns *string `json:"secret_scanning_non_provider_patterns,omitempty"` - PrivateVulnerabilityReporting *string `json:"private_vulnerability_reporting,omitempty"` - Enforcement *string `json:"enforcement,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` -} - -// CodeSecurityConfigurationWithDefaultForNewRepos represents a code security configuration with default for new repos param. -type CodeSecurityConfigurationWithDefaultForNewRepos struct { - Configuration *CodeSecurityConfiguration `json:"configuration"` - DefaultForNewRepos *string `json:"default_for_new_repos"` -} - -// RepositoryCodeSecurityConfiguration represents a code security configuration for a repository. -type RepositoryCodeSecurityConfiguration struct { - State *string `json:"state,omitempty"` - Configuration *CodeSecurityConfiguration `json:"configuration,omitempty"` -} - -// GetCodeSecurityConfigurations gets code security configurations for an organization. -// -// GitHub API docs: https://docs.github.com/rest/code-security/configurations#get-code-security-configurations-for-an-organization -// -//meta:operation GET /orgs/{org}/code-security/configurations -func (s *OrganizationsService) GetCodeSecurityConfigurations(ctx context.Context, org string) ([]*CodeSecurityConfiguration, *Response, error) { - u := fmt.Sprintf("orgs/%v/code-security/configurations", org) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var configurations []*CodeSecurityConfiguration - resp, err := s.client.Do(ctx, req, &configurations) - if err != nil { - return nil, resp, err - } - return configurations, resp, nil -} - -// CreateCodeSecurityConfiguration creates a code security configuration for an organization. -// -// GitHub API docs: https://docs.github.com/rest/code-security/configurations#create-a-code-security-configuration -// -//meta:operation POST /orgs/{org}/code-security/configurations -func (s *OrganizationsService) CreateCodeSecurityConfiguration(ctx context.Context, org string, c *CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { - u := fmt.Sprintf("orgs/%v/code-security/configurations", org) - - req, err := s.client.NewRequest("POST", u, c) - if err != nil { - return nil, nil, err - } - - var configuration *CodeSecurityConfiguration - resp, err := s.client.Do(ctx, req, &configuration) - if err != nil { - return nil, resp, err - } - return configuration, resp, nil -} - -// GetDefaultCodeSecurityConfigurations gets default code security configurations for an organization. -// -// GitHub API docs: https://docs.github.com/rest/code-security/configurations#get-default-code-security-configurations -// -//meta:operation GET /orgs/{org}/code-security/configurations/defaults -func (s *OrganizationsService) GetDefaultCodeSecurityConfigurations(ctx context.Context, org string) ([]*CodeSecurityConfiguration, *Response, error) { - u := fmt.Sprintf("orgs/%v/code-security/configurations/defaults", org) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var configurations []*CodeSecurityConfiguration - resp, err := s.client.Do(ctx, req, &configurations) - if err != nil { - return nil, resp, err - } - return configurations, resp, nil -} - -// DetachCodeSecurityConfigurationsFromRepositories detaches code security configuration from an organization's repositories. -// -// GitHub API docs: https://docs.github.com/rest/code-security/configurations#detach-configurations-from-repositories -// -//meta:operation DELETE /orgs/{org}/code-security/configurations/detach -func (s *OrganizationsService) DetachCodeSecurityConfigurationsFromRepositories(ctx context.Context, org string, repoIDs []int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/code-security/configurations/detach", org) - type selectedRepoIDs struct { - SelectedIDs []int64 `json:"selected_repository_ids"` - } - req, err := s.client.NewRequest("DELETE", u, selectedRepoIDs{SelectedIDs: repoIDs}) - if err != nil { - return nil, err - } - resp, err := s.client.Do(ctx, req, nil) - if err != nil { - return resp, err - } - return resp, nil -} - -// GetCodeSecurityConfiguration gets a code security configuration available in an organization. -// -// GitHub API docs: https://docs.github.com/rest/code-security/configurations#get-a-code-security-configuration -// -//meta:operation GET /orgs/{org}/code-security/configurations/{configuration_id} -func (s *OrganizationsService) GetCodeSecurityConfiguration(ctx context.Context, org string, id int64) (*CodeSecurityConfiguration, *Response, error) { - u := fmt.Sprintf("orgs/%v/code-security/configurations/%v", org, id) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var configuration *CodeSecurityConfiguration - resp, err := s.client.Do(ctx, req, &configuration) - if err != nil { - return nil, resp, err - } - return configuration, resp, nil -} - -// UpdateCodeSecurityConfiguration updates a code security configuration for an organization. -// -// GitHub API docs: https://docs.github.com/rest/code-security/configurations#update-a-code-security-configuration -// -//meta:operation PATCH /orgs/{org}/code-security/configurations/{configuration_id} -func (s *OrganizationsService) UpdateCodeSecurityConfiguration(ctx context.Context, org string, id int64, c *CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { - u := fmt.Sprintf("orgs/%v/code-security/configurations/%v", org, id) - - req, err := s.client.NewRequest("PATCH", u, c) - if err != nil { - return nil, nil, err - } - - var configuration *CodeSecurityConfiguration - resp, err := s.client.Do(ctx, req, &configuration) - if err != nil { - return nil, resp, err - } - return configuration, resp, nil -} - -// DeleteCodeSecurityConfiguration deletes a code security configuration for an organization. -// -// GitHub API docs: https://docs.github.com/rest/code-security/configurations#delete-a-code-security-configuration -// -//meta:operation DELETE /orgs/{org}/code-security/configurations/{configuration_id} -func (s *OrganizationsService) DeleteCodeSecurityConfiguration(ctx context.Context, org string, id int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/code-security/configurations/%v", org, id) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - resp, err := s.client.Do(ctx, req, nil) - if err != nil { - return resp, err - } - return resp, nil -} - -// AttachCodeSecurityConfigurationsToRepositories attaches code security configurations to repositories for an organization. -// -// GitHub API docs: https://docs.github.com/rest/code-security/configurations#attach-a-configuration-to-repositories -// -//meta:operation POST /orgs/{org}/code-security/configurations/{configuration_id}/attach -func (s *OrganizationsService) AttachCodeSecurityConfigurationsToRepositories(ctx context.Context, org string, id int64, scope string, repoIDs []int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/code-security/configurations/%v/attach", org, id) - type selectedRepoIDs struct { - Scope string `json:"scope"` - SelectedIDs []int64 `json:"selected_repository_ids,omitempty"` - } - req, err := s.client.NewRequest("POST", u, selectedRepoIDs{Scope: scope, SelectedIDs: repoIDs}) - if err != nil { - return nil, err - } - resp, err := s.client.Do(ctx, req, nil) - if err != nil && resp.StatusCode != http.StatusAccepted { // StatusAccepted(202) is the expected status code as job is queued for processing - return resp, err - } - return resp, nil -} - -// SetDefaultCodeSecurityConfiguration sets a code security configuration as the default for an organization. -// -// GitHub API docs: https://docs.github.com/rest/code-security/configurations#set-a-code-security-configuration-as-a-default-for-an-organization -// -//meta:operation PUT /orgs/{org}/code-security/configurations/{configuration_id}/defaults -func (s *OrganizationsService) SetDefaultCodeSecurityConfiguration(ctx context.Context, org string, id int64, newReposParam string) (*CodeSecurityConfigurationWithDefaultForNewRepos, *Response, error) { - u := fmt.Sprintf("orgs/%v/code-security/configurations/%v/defaults", org, id) - type configParam struct { - DefaultForNewRepos string `json:"default_for_new_repos"` - } - req, err := s.client.NewRequest("PUT", u, configParam{DefaultForNewRepos: newReposParam}) - if err != nil { - return nil, nil, err - } - var c *CodeSecurityConfigurationWithDefaultForNewRepos - resp, err := s.client.Do(ctx, req, &c) - if err != nil { - return nil, resp, err - } - return c, resp, nil -} - -// GetRepositoriesForCodeSecurityConfiguration gets repositories associated with a code security configuration. -// -// GitHub API docs: https://docs.github.com/rest/code-security/configurations#get-repositories-associated-with-a-code-security-configuration -// -//meta:operation GET /orgs/{org}/code-security/configurations/{configuration_id}/repositories -func (s *OrganizationsService) GetRepositoriesForCodeSecurityConfiguration(ctx context.Context, org string, id int64) ([]*Repository, *Response, error) { - u := fmt.Sprintf("orgs/%v/code-security/configurations/%v/repositories", org, id) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var repositories []*Repository - resp, err := s.client.Do(ctx, req, &repositories) - if err != nil { - return nil, resp, err - } - return repositories, resp, nil -} - -// GetCodeSecurityConfigurationForRepository gets code security configuration that manages a repository's code security settings. -// -// GitHub API docs: https://docs.github.com/rest/code-security/configurations#get-the-code-security-configuration-associated-with-a-repository -// -//meta:operation GET /repos/{owner}/{repo}/code-security-configuration -func (s *OrganizationsService) GetCodeSecurityConfigurationForRepository(ctx context.Context, org, repo string) (*RepositoryCodeSecurityConfiguration, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/code-security-configuration", org, repo) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - var repoConfig *RepositoryCodeSecurityConfiguration - resp, err := s.client.Do(ctx, req, &repoConfig) - if err != nil { - return nil, resp, err - } - return repoConfig, resp, nil -} diff --git a/vendor/github.com/google/go-github/v73/github/repos_actions_permissions.go b/vendor/github.com/google/go-github/v73/github/repos_actions_permissions.go deleted file mode 100644 index 9abd32a78..000000000 --- a/vendor/github.com/google/go-github/v73/github/repos_actions_permissions.go +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2022 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package github - -import ( - "context" - "fmt" -) - -// ActionsPermissionsRepository represents a policy for repositories and allowed actions in a repository. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions -type ActionsPermissionsRepository struct { - Enabled *bool `json:"enabled,omitempty"` - AllowedActions *string `json:"allowed_actions,omitempty"` - SelectedActionsURL *string `json:"selected_actions_url,omitempty"` -} - -func (a ActionsPermissionsRepository) String() string { - return Stringify(a) -} - -// DefaultWorkflowPermissionRepository represents the default permissions for GitHub Actions workflows for a repository. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions -type DefaultWorkflowPermissionRepository struct { - DefaultWorkflowPermissions *string `json:"default_workflow_permissions,omitempty"` - CanApprovePullRequestReviews *bool `json:"can_approve_pull_request_reviews,omitempty"` -} - -// GetActionsPermissions gets the GitHub Actions permissions policy for repositories and allowed actions in a repository. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-github-actions-permissions-for-a-repository -// -//meta:operation GET /repos/{owner}/{repo}/actions/permissions -func (s *RepositoriesService) GetActionsPermissions(ctx context.Context, owner, repo string) (*ActionsPermissionsRepository, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/actions/permissions", owner, repo) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - permissions := new(ActionsPermissionsRepository) - resp, err := s.client.Do(ctx, req, permissions) - if err != nil { - return nil, resp, err - } - - return permissions, resp, nil -} - -// EditActionsPermissions sets the permissions policy for repositories and allowed actions in a repository. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-github-actions-permissions-for-a-repository -// -//meta:operation PUT /repos/{owner}/{repo}/actions/permissions -func (s *RepositoriesService) EditActionsPermissions(ctx context.Context, owner, repo string, actionsPermissionsRepository ActionsPermissionsRepository) (*ActionsPermissionsRepository, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/actions/permissions", owner, repo) - req, err := s.client.NewRequest("PUT", u, actionsPermissionsRepository) - if err != nil { - return nil, nil, err - } - - permissions := new(ActionsPermissionsRepository) - resp, err := s.client.Do(ctx, req, permissions) - if err != nil { - return nil, resp, err - } - - return permissions, resp, nil -} - -// GetDefaultWorkflowPermissions gets the GitHub Actions default workflow permissions in a repository. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-default-workflow-permissions-for-a-repository -// -//meta:operation GET /repos/{owner}/{repo}/actions/permissions/workflow -func (s *RepositoriesService) GetDefaultWorkflowPermissions(ctx context.Context, owner, repo string) (*DefaultWorkflowPermissionRepository, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/actions/permissions/workflow", owner, repo) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - permissions := new(DefaultWorkflowPermissionRepository) - resp, err := s.client.Do(ctx, req, permissions) - if err != nil { - return nil, resp, err - } - - return permissions, resp, nil -} - -// EditDefaultWorkflowPermissions sets the GitHub Actions default workflow permissions in a repository. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-default-workflow-permissions-for-a-repository -// -//meta:operation PUT /repos/{owner}/{repo}/actions/permissions/workflow -func (s *RepositoriesService) EditDefaultWorkflowPermissions(ctx context.Context, owner, repo string, permissions DefaultWorkflowPermissionRepository) (*DefaultWorkflowPermissionRepository, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/actions/permissions/workflow", owner, repo) - req, err := s.client.NewRequest("PUT", u, permissions) - if err != nil { - return nil, nil, err - } - - p := new(DefaultWorkflowPermissionRepository) - resp, err := s.client.Do(ctx, req, p) - if err != nil { - return nil, resp, err - } - - return p, resp, nil -} diff --git a/vendor/github.com/google/go-github/v73/github/repos_rules.go b/vendor/github.com/google/go-github/v73/github/repos_rules.go deleted file mode 100644 index 038cefd71..000000000 --- a/vendor/github.com/google/go-github/v73/github/repos_rules.go +++ /dev/null @@ -1,246 +0,0 @@ -// Copyright 2023 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package github - -import ( - "context" - "fmt" -) - -// rulesetNoOmitBypassActors represents a GitHub ruleset object. The struct does not omit bypassActors if the field is nil or an empty array is passed. -type rulesetNoOmitBypassActors struct { - ID *int64 `json:"id,omitempty"` - Name string `json:"name"` - Target *RulesetTarget `json:"target,omitempty"` - SourceType *RulesetSourceType `json:"source_type,omitempty"` - Source string `json:"source"` - Enforcement RulesetEnforcement `json:"enforcement"` - BypassActors []*BypassActor `json:"bypass_actors"` - CurrentUserCanBypass *BypassMode `json:"current_user_can_bypass,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Links *RepositoryRulesetLinks `json:"_links,omitempty"` - Conditions *RepositoryRulesetConditions `json:"conditions,omitempty"` - Rules *RepositoryRulesetRules `json:"rules,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` -} - -// rulesetClearBypassActors is used to clear the bypass actors when modifying a GitHub ruleset object. -type rulesetClearBypassActors struct { - BypassActors []*BypassActor `json:"bypass_actors"` -} - -// GetRulesForBranch gets all the repository rules that apply to the specified branch. -// -// GitHub API docs: https://docs.github.com/rest/repos/rules#get-rules-for-a-branch -// -//meta:operation GET /repos/{owner}/{repo}/rules/branches/{branch} -func (s *RepositoriesService) GetRulesForBranch(ctx context.Context, owner, repo, branch string, opts *ListOptions) (*BranchRules, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/rules/branches/%v", owner, repo, branch) - - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var rules *BranchRules - resp, err := s.client.Do(ctx, req, &rules) - if err != nil { - return nil, resp, err - } - - return rules, resp, nil -} - -// RepositoryListRulesetsOptions specifies optional parameters to the -// RepositoriesService.GetAllRulesets method. -type RepositoryListRulesetsOptions struct { - // IncludesParents indicates whether to include rulesets configured at the organization or enterprise level that apply to the repository. - IncludesParents *bool `url:"includes_parents,omitempty"` - ListOptions -} - -// GetAllRulesets gets all the repository rulesets for the specified repository. -// By default, this endpoint will include rulesets configured at the organization or enterprise level that apply to the repository. -// To exclude those rulesets, set the `RepositoryListRulesetsOptions.IncludesParents` parameter to `false`. -// -// GitHub API docs: https://docs.github.com/rest/repos/rules#get-all-repository-rulesets -// -//meta:operation GET /repos/{owner}/{repo}/rulesets -func (s *RepositoriesService) GetAllRulesets(ctx context.Context, owner, repo string, opts *RepositoryListRulesetsOptions) ([]*RepositoryRuleset, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/rulesets", owner, repo) - - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var ruleset []*RepositoryRuleset - resp, err := s.client.Do(ctx, req, &ruleset) - if err != nil { - return nil, resp, err - } - - return ruleset, resp, nil -} - -// CreateRuleset creates a repository ruleset for the specified repository. -// -// GitHub API docs: https://docs.github.com/rest/repos/rules#create-a-repository-ruleset -// -//meta:operation POST /repos/{owner}/{repo}/rulesets -func (s *RepositoriesService) CreateRuleset(ctx context.Context, owner, repo string, ruleset RepositoryRuleset) (*RepositoryRuleset, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/rulesets", owner, repo) - - req, err := s.client.NewRequest("POST", u, ruleset) - if err != nil { - return nil, nil, err - } - - var rs *RepositoryRuleset - resp, err := s.client.Do(ctx, req, &rs) - if err != nil { - return nil, resp, err - } - - return rs, resp, nil -} - -// GetRuleset gets a repository ruleset for the specified repository. -// If includesParents is true, rulesets configured at the organization or enterprise level that apply to the repository will be returned. -// -// GitHub API docs: https://docs.github.com/rest/repos/rules#get-a-repository-ruleset -// -//meta:operation GET /repos/{owner}/{repo}/rulesets/{ruleset_id} -func (s *RepositoriesService) GetRuleset(ctx context.Context, owner, repo string, rulesetID int64, includesParents bool) (*RepositoryRuleset, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/rulesets/%v?includes_parents=%v", owner, repo, rulesetID, includesParents) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var ruleset *RepositoryRuleset - resp, err := s.client.Do(ctx, req, &ruleset) - if err != nil { - return nil, resp, err - } - - return ruleset, resp, nil -} - -// UpdateRuleset updates a repository ruleset for the specified repository. -// -// GitHub API docs: https://docs.github.com/rest/repos/rules#update-a-repository-ruleset -// -//meta:operation PUT /repos/{owner}/{repo}/rulesets/{ruleset_id} -func (s *RepositoriesService) UpdateRuleset(ctx context.Context, owner, repo string, rulesetID int64, ruleset RepositoryRuleset) (*RepositoryRuleset, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/rulesets/%v", owner, repo, rulesetID) - - req, err := s.client.NewRequest("PUT", u, ruleset) - if err != nil { - return nil, nil, err - } - - var rs *RepositoryRuleset - resp, err := s.client.Do(ctx, req, &rs) - if err != nil { - return nil, resp, err - } - - return rs, resp, nil -} - -// UpdateRulesetClearBypassActor clears the bypass actors for a repository ruleset for the specified repository. -// -// This function is necessary as the UpdateRuleset function does not marshal ByPassActor if passed as an empty array. -// -// GitHub API docs: https://docs.github.com/rest/repos/rules#update-a-repository-ruleset -// -//meta:operation PUT /repos/{owner}/{repo}/rulesets/{ruleset_id} -func (s *RepositoriesService) UpdateRulesetClearBypassActor(ctx context.Context, owner, repo string, rulesetID int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/rulesets/%v", owner, repo, rulesetID) - - rsClearBypassActor := rulesetClearBypassActors{} - - req, err := s.client.NewRequest("PUT", u, rsClearBypassActor) - if err != nil { - return nil, err - } - - resp, err := s.client.Do(ctx, req, nil) - if err != nil { - return resp, err - } - - return resp, nil -} - -// UpdateRulesetNoBypassActor updates a repository ruleset for the specified repository. -// -// This function is necessary as the UpdateRuleset function does not marshal ByPassActor if passed as an empty array. -// -// Deprecated: Use UpdateRulesetClearBypassActor instead. -// -// GitHub API docs: https://docs.github.com/rest/repos/rules#update-a-repository-ruleset -// -//meta:operation PUT /repos/{owner}/{repo}/rulesets/{ruleset_id} -func (s *RepositoriesService) UpdateRulesetNoBypassActor(ctx context.Context, owner, repo string, rulesetID int64, ruleset RepositoryRuleset) (*RepositoryRuleset, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/rulesets/%v", owner, repo, rulesetID) - - rsNoBypassActor := rulesetNoOmitBypassActors{ - ID: ruleset.ID, - Name: ruleset.Name, - Target: ruleset.Target, - SourceType: ruleset.SourceType, - Source: ruleset.Source, - Enforcement: ruleset.Enforcement, - BypassActors: ruleset.BypassActors, - NodeID: ruleset.NodeID, - Links: ruleset.Links, - Conditions: ruleset.Conditions, - Rules: ruleset.Rules, - } - - req, err := s.client.NewRequest("PUT", u, rsNoBypassActor) - if err != nil { - return nil, nil, err - } - - var rs *RepositoryRuleset - resp, err := s.client.Do(ctx, req, &rs) - if err != nil { - return nil, resp, err - } - - return rs, resp, nil -} - -// DeleteRuleset deletes a repository ruleset for the specified repository. -// -// GitHub API docs: https://docs.github.com/rest/repos/rules#delete-a-repository-ruleset -// -//meta:operation DELETE /repos/{owner}/{repo}/rulesets/{ruleset_id} -func (s *RepositoriesService) DeleteRuleset(ctx context.Context, owner, repo string, rulesetID int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/rulesets/%v", owner, repo, rulesetID) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v73/github/with_appengine.go b/vendor/github.com/google/go-github/v73/github/with_appengine.go deleted file mode 100644 index 9bb95b8c8..000000000 --- a/vendor/github.com/google/go-github/v73/github/with_appengine.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2017 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build appengine - -// This file provides glue for making github work on App Engine. - -package github - -import ( - "context" - "net/http" -) - -func withContext(ctx context.Context, req *http.Request) *http.Request { - // No-op because App Engine adds context to a request differently. - return req -} diff --git a/vendor/github.com/google/go-github/v73/github/without_appengine.go b/vendor/github.com/google/go-github/v73/github/without_appengine.go deleted file mode 100644 index bfdb18ecb..000000000 --- a/vendor/github.com/google/go-github/v73/github/without_appengine.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2017 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !appengine - -// This file provides glue for making github work without App Engine. - -package github - -import ( - "context" - "net/http" -) - -func withContext(ctx context.Context, req *http.Request) *http.Request { - return req.WithContext(ctx) -} diff --git a/vendor/github.com/google/go-github/v73/AUTHORS b/vendor/github.com/google/go-github/v88/AUTHORS similarity index 92% rename from vendor/github.com/google/go-github/v73/AUTHORS rename to vendor/github.com/google/go-github/v88/AUTHORS index a6104ffa9..2270852e5 100644 --- a/vendor/github.com/google/go-github/v73/AUTHORS +++ b/vendor/github.com/google/go-github/v88/AUTHORS @@ -12,13 +12,16 @@ 2BFL 413x 6543 <6543@obermui.de> +Aaron LaBrie Abed Kibbe Abhijit Hota Abhinav Gupta abhishek Abhishek Sharma Abhishek Veeramalla +Abinand P aboy +Adam Guthrie Adam Kohring Aditya Mahendrakar adrienzieba @@ -46,10 +49,12 @@ Ali Farooq Alin Balutoiu Allan Guwatudde Allen Sun +Aman Verma Amey Sakhadeo Anders Janmyr Andreas Deininger Andreas Garnæs +Andreas Jaggi Andrew Gillis Andrew Ryabchun Andrew Svoboda @@ -73,6 +78,7 @@ Arda Kuyumcu Ary Arıl Bozoluk Asier Marruedo +Austen Stone Austin Burdine Austin Dizzy Azuka Okuleye @@ -97,6 +103,7 @@ Bradley Falzon Bradley McAllister Brandon Butler Brandon Cook +Brandon Everett Brandon Stubbs Brett Kuhlman Brett Logan @@ -110,6 +117,7 @@ Carlos Tadeu Panato Junior Casey ChandanChainani chandresh-pancholi +Changyong Um Charles Fenwick Elliott Charlie Yan Chmouel Boudjnah @@ -125,7 +133,10 @@ Christian Muehlhaeuser Christoph Jerolimov Christoph Sassenberg CI Monk +Claus Näveke Clemens W +cointem +Colby Williams Colin Misare Craig Gumbley Craig Peterson @@ -151,6 +162,7 @@ Davide Zipeto Dennis Webb Derek Jobst DeviousLab +Dhananjay Mishra Dhi Aurrahman Diego Lapiduz Diogo Vilela @@ -178,6 +190,7 @@ Erwan Finot erwinvaneyk Evan Anderson Evan Elias +Eyal Kapon Fabian Holler Fabrice Fatema-Moaiyadi @@ -201,6 +214,7 @@ Glen Mailer Gnahz Google Inc. Grachev Mikhail +Gregor Jasny Gregory Oschwald griffin_stewie guangwu @@ -214,11 +228,13 @@ haya14busa haya14busa Henrik Lundström Hiroki Ito +hnkƶ Hubot Jr Huy Tr huydx i2bskn Iain Steers +Iehana Fu Ikko Ashimine Ilia Choly Ioannis Georgoulas @@ -231,6 +247,7 @@ Jake Krammer Jake Scaltreto Jake White Jameel Haffejee +James Alseth James Bowes James Cockbain James Loh @@ -239,7 +256,9 @@ James Turley Jamie West Jan Guth Jan Kosecki +Jan Niklas Dittmar Jan Švábík +Jason Brill Jason Field Javier Campanini Jef LeCompte @@ -251,6 +270,7 @@ Jesse Newland Jihoon Chung Jille Timmermans Jimmi Dyson +Jiří Žižkovský Joan Saum JoannaaKL Joe Tsai @@ -264,6 +284,7 @@ Jordan Sussman Jorge Ferrero Jorge Gómez Reus Joshua Bezaleel Abednego +Joshua French João Cerqueira JP Phillips jpbelanger-mtl @@ -301,6 +322,7 @@ kyokomi Lachlan Cooper Lars Lehtonen Laurent Verdoïa +Leonard Sheng Sheng Lee leopoldwang Liam Galvin Liam Stanley @@ -321,6 +343,9 @@ Léo Salé M. Ryan Rigdon Magnus Kulke Maksim Zhylinski +Manas Sivakumar +Manav Sharma +Manuel Bergler Marc Binder Marcelo Carlos Mark Tareshawty @@ -331,6 +356,8 @@ Marwan Sulaiman Masayuki Izumi Mat Geist Matheus Santos Araújo +MathewClegg +Mathieu Sévégny Matija Horvat Matin Rahmanian Matt @@ -344,14 +371,17 @@ Matt Simons Matthew Reidy Maxime Bury Michael Meng +Michael Recachinas Michael Spiegel Michael Tiller Michał Glapa Michelangelo Morrillo Miguel Elias dos Santos +Mike Ball Mike Chen Miles Crabill Mishin Nikolai +Mohamad Al-Zawahreh mohammad ali <2018cs92@student.uet.edu.pk> Mohammed AlDujaili Mohammed Nafees @@ -399,6 +429,8 @@ Patrick Marabeas Patrik Nordlén Pavel Dvoinos Pavel Shtanko +Pavlos Tzianos +Pedja Muatovic Pete Wagner Petr Shevtsov Pierce McEntagart @@ -415,6 +447,7 @@ Rackspace US, Inc. Radek Simko Radliński Ignacy Rafael Aramizu Gomes +Raisa Kabir Rajat Jindal Rajendra arora Rajkumar @@ -433,14 +466,17 @@ Riaje Ricco Førgaard Richard de Vries Rob Figueiredo +Roger Peppe Rohit Upadhyay Rojan Dinc +Roman Wu Roming22 Ronak Jain Ronan Pelliard Ross Gustafson Ruben Vereecken Rufina Talalaeva +Rupok Ghosh Russell Boley Ryan Leung Ryan Lower @@ -455,13 +491,16 @@ Sam Minnée Sandeep Sukhani Sander Knape Sander van Harmelen +sanjay s Sanket Payghan Sarah Funkhouser Sarasa Kisaragi Sasha Melentyev +Scott Dawson Sean Wang Sebastian Mandrean Sebastian Mæland Pedersen +sellskin Sergei Popinevskii Sergey Romanov Sergio Garcia @@ -474,6 +513,7 @@ Shawn Smith Shibasis Patel Sho Okada Shrikrishna Singh +Silas Alberti Simon Davis sona-tar soniachikh @@ -500,12 +540,14 @@ Theo Henson Theofilos Petsios Thomas Aidan Curran Thomas Bruyelle +Tim Tim Rogers Timothy O'Brien Timothée Peignier Tingluo Huang tkhandel Tobias Gesellchen +Tom Bamford Tom Payne Tomasz Adam Skrzypczak tomfeigin @@ -519,7 +561,9 @@ Victor Castell Victor Vrantchan Victory Osikwemhe vikkyomkar +Ville Skyttä Vivek +Vivek Kumar Sahu Vlad Ungureanu Wasim Thabraze Weslei Juan Moser Pereira @@ -540,9 +584,11 @@ Yumikiyo Osanai Yurii Soldak Yusef Mohamadi Yusuke Kuoka +Yuto Kimura Zach Latta Ze Peng zhouhaibing089 +zyfy29 六开箱 缘生 蒋航 diff --git a/vendor/github.com/google/go-github/v73/LICENSE b/vendor/github.com/google/go-github/v88/LICENSE similarity index 100% rename from vendor/github.com/google/go-github/v73/LICENSE rename to vendor/github.com/google/go-github/v88/LICENSE diff --git a/vendor/github.com/google/go-github/v73/github/actions.go b/vendor/github.com/google/go-github/v88/github/actions.go similarity index 79% rename from vendor/github.com/google/go-github/v73/github/actions.go rename to vendor/github.com/google/go-github/v88/github/actions.go index 4b88a1e11..575a637a2 100644 --- a/vendor/github.com/google/go-github/v73/github/actions.go +++ b/vendor/github.com/google/go-github/v88/github/actions.go @@ -8,5 +8,5 @@ package github // ActionsService handles communication with the actions related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/actions/ +// GitHub API docs: https://docs.github.com/rest/actions?apiVersion=2022-11-28 type ActionsService service diff --git a/vendor/github.com/google/go-github/v73/github/actions_artifacts.go b/vendor/github.com/google/go-github/v88/github/actions_artifacts.go similarity index 69% rename from vendor/github.com/google/go-github/v73/github/actions_artifacts.go rename to vendor/github.com/google/go-github/v88/github/actions_artifacts.go index 2b560fa05..2a345edbc 100644 --- a/vendor/github.com/google/go-github/v73/github/actions_artifacts.go +++ b/vendor/github.com/google/go-github/v88/github/actions_artifacts.go @@ -14,7 +14,7 @@ import ( // ArtifactWorkflowRun represents a GitHub artifact's workflow run. // -// GitHub API docs: https://docs.github.com/rest/actions/artifacts +// GitHub API docs: https://docs.github.com/rest/actions/artifacts?apiVersion=2022-11-28 type ArtifactWorkflowRun struct { ID *int64 `json:"id,omitempty"` RepositoryID *int64 `json:"repository_id,omitempty"` @@ -27,24 +27,28 @@ type ArtifactWorkflowRun struct { // data between jobs in a workflow and provide storage for data // once a workflow is complete. // -// GitHub API docs: https://docs.github.com/rest/actions/artifacts +// GitHub API docs: https://docs.github.com/rest/actions/artifacts?apiVersion=2022-11-28 type Artifact struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Name *string `json:"name,omitempty"` - SizeInBytes *int64 `json:"size_in_bytes,omitempty"` - URL *string `json:"url,omitempty"` - ArchiveDownloadURL *string `json:"archive_download_url,omitempty"` - Expired *bool `json:"expired,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - ExpiresAt *Timestamp `json:"expires_at,omitempty"` - WorkflowRun *ArtifactWorkflowRun `json:"workflow_run,omitempty"` + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Name *string `json:"name,omitempty"` + SizeInBytes *int64 `json:"size_in_bytes,omitempty"` + URL *string `json:"url,omitempty"` + ArchiveDownloadURL *string `json:"archive_download_url,omitempty"` + Expired *bool `json:"expired,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + ExpiresAt *Timestamp `json:"expires_at,omitempty"` + // Digest is the SHA256 digest of the artifact. + // This field will only be populated on artifacts uploaded with upload-artifact v4 or newer. + // For older versions, this field will be null. + Digest *string `json:"digest,omitempty"` + WorkflowRun *ArtifactWorkflowRun `json:"workflow_run,omitempty"` } // ArtifactList represents a list of GitHub artifacts. // -// GitHub API docs: https://docs.github.com/rest/actions/artifacts#artifacts +// GitHub API docs: https://docs.github.com/rest/actions/artifacts?apiVersion=2022-11-28#artifacts type ArtifactList struct { TotalCount *int64 `json:"total_count,omitempty"` Artifacts []*Artifact `json:"artifacts,omitempty"` @@ -60,9 +64,24 @@ type ListArtifactsOptions struct { ListOptions } +// ArtifactPeriod represents the period for which the artifact and +// log of a workflow run is retained. +type ArtifactPeriod struct { + Days *int `json:"days,omitempty"` + MaximumAllowedDays *int `json:"maximum_allowed_days,omitempty"` +} + +func (a ArtifactPeriod) String() string { return Stringify(a) } + +// ArtifactPeriodOpt is used to specify the retention period of +// artifacts and logs in a workflow run. +type ArtifactPeriodOpt struct { + Days *int `json:"days,omitempty"` +} + // ListArtifacts lists all artifacts that belong to a repository. // -// GitHub API docs: https://docs.github.com/rest/actions/artifacts#list-artifacts-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/artifacts?apiVersion=2022-11-28#list-artifacts-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/actions/artifacts func (s *ActionsService) ListArtifacts(ctx context.Context, owner, repo string, opts *ListArtifactsOptions) (*ArtifactList, *Response, error) { @@ -72,13 +91,13 @@ func (s *ActionsService) ListArtifacts(ctx context.Context, owner, repo string, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - artifactList := new(ArtifactList) - resp, err := s.client.Do(ctx, req, artifactList) + var artifactList *ArtifactList + resp, err := s.client.Do(req, &artifactList) if err != nil { return nil, resp, err } @@ -88,7 +107,7 @@ func (s *ActionsService) ListArtifacts(ctx context.Context, owner, repo string, // ListWorkflowRunArtifacts lists all artifacts that belong to a workflow run. // -// GitHub API docs: https://docs.github.com/rest/actions/artifacts#list-workflow-run-artifacts +// GitHub API docs: https://docs.github.com/rest/actions/artifacts?apiVersion=2022-11-28#list-workflow-run-artifacts // //meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts func (s *ActionsService) ListWorkflowRunArtifacts(ctx context.Context, owner, repo string, runID int64, opts *ListOptions) (*ArtifactList, *Response, error) { @@ -98,13 +117,13 @@ func (s *ActionsService) ListWorkflowRunArtifacts(ctx context.Context, owner, re return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - artifactList := new(ArtifactList) - resp, err := s.client.Do(ctx, req, artifactList) + var artifactList *ArtifactList + resp, err := s.client.Do(req, &artifactList) if err != nil { return nil, resp, err } @@ -114,19 +133,19 @@ func (s *ActionsService) ListWorkflowRunArtifacts(ctx context.Context, owner, re // GetArtifact gets a specific artifact for a workflow run. // -// GitHub API docs: https://docs.github.com/rest/actions/artifacts#get-an-artifact +// GitHub API docs: https://docs.github.com/rest/actions/artifacts?apiVersion=2022-11-28#get-an-artifact // //meta:operation GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id} func (s *ActionsService) GetArtifact(ctx context.Context, owner, repo string, artifactID int64) (*Artifact, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/artifacts/%v", owner, repo, artifactID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - artifact := new(Artifact) - resp, err := s.client.Do(ctx, req, artifact) + var artifact *Artifact + resp, err := s.client.Do(req, &artifact) if err != nil { return nil, resp, err } @@ -136,13 +155,13 @@ func (s *ActionsService) GetArtifact(ctx context.Context, owner, repo string, ar // DownloadArtifact gets a redirect URL to download an archive for a repository. // -// GitHub API docs: https://docs.github.com/rest/actions/artifacts#download-an-artifact +// GitHub API docs: https://docs.github.com/rest/actions/artifacts?apiVersion=2022-11-28#download-an-artifact // //meta:operation GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format} func (s *ActionsService) DownloadArtifact(ctx context.Context, owner, repo string, artifactID int64, maxRedirects int) (*url.URL, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/artifacts/%v/zip", owner, repo, artifactID) - if s.client.RateLimitRedirectionalEndpoints { + if s.client.rateLimitRedirectionalEndpoints { return s.downloadArtifactWithRateLimit(ctx, u, maxRedirects) } @@ -169,12 +188,12 @@ func (s *ActionsService) downloadArtifactWithoutRateLimit(ctx context.Context, u } func (s *ActionsService) downloadArtifactWithRateLimit(ctx context.Context, u string, maxRedirects int) (*url.URL, *Response, error) { - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - url, resp, err := s.client.bareDoUntilFound(ctx, req, maxRedirects) + url, resp, err := s.client.bareDoUntilFound(req, maxRedirects) if err != nil { return nil, resp, err } @@ -190,16 +209,16 @@ func (s *ActionsService) downloadArtifactWithRateLimit(ctx context.Context, u st // DeleteArtifact deletes a workflow run artifact. // -// GitHub API docs: https://docs.github.com/rest/actions/artifacts#delete-an-artifact +// GitHub API docs: https://docs.github.com/rest/actions/artifacts?apiVersion=2022-11-28#delete-an-artifact // //meta:operation DELETE /repos/{owner}/{repo}/actions/artifacts/{artifact_id} func (s *ActionsService) DeleteArtifact(ctx context.Context, owner, repo string, artifactID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/artifacts/%v", owner, repo, artifactID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/actions_cache.go b/vendor/github.com/google/go-github/v88/github/actions_cache.go similarity index 76% rename from vendor/github.com/google/go-github/v73/github/actions_cache.go rename to vendor/github.com/google/go-github/v88/github/actions_cache.go index 852e9860f..73e827008 100644 --- a/vendor/github.com/google/go-github/v73/github/actions_cache.go +++ b/vendor/github.com/google/go-github/v88/github/actions_cache.go @@ -12,7 +12,7 @@ import ( // ActionsCache represents a GitHub action cache. // -// GitHub API docs: https://docs.github.com/rest/actions/cache#about-the-cache-api +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#about-the-cache-api type ActionsCache struct { ID *int64 `json:"id,omitempty" url:"-"` Ref *string `json:"ref,omitempty" url:"ref"` @@ -25,7 +25,7 @@ type ActionsCache struct { // ActionsCacheList represents a list of GitHub actions Cache. // -// GitHub API docs: https://docs.github.com/rest/actions/cache#list-github-actions-caches-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#list-github-actions-caches-for-a-repository type ActionsCacheList struct { TotalCount int `json:"total_count"` ActionsCaches []*ActionsCache `json:"actions_caches,omitempty"` @@ -33,7 +33,7 @@ type ActionsCacheList struct { // ActionsCacheUsage represents a GitHub Actions Cache Usage object. // -// GitHub API docs: https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#get-github-actions-cache-usage-for-a-repository type ActionsCacheUsage struct { FullName string `json:"full_name"` ActiveCachesSizeInBytes int64 `json:"active_caches_size_in_bytes"` @@ -42,7 +42,7 @@ type ActionsCacheUsage struct { // ActionsCacheUsageList represents a list of repositories with GitHub Actions cache usage for an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#get-github-actions-cache-usage-for-a-repository type ActionsCacheUsageList struct { TotalCount int `json:"total_count"` RepoCacheUsage []*ActionsCacheUsage `json:"repository_cache_usages,omitempty"` @@ -50,7 +50,7 @@ type ActionsCacheUsageList struct { // TotalCacheUsage represents total GitHub actions cache usage of an organization or enterprise. // -// GitHub API docs: https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-an-enterprise +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#get-github-actions-cache-usage-for-an-enterprise type TotalCacheUsage struct { TotalActiveCachesUsageSizeInBytes int64 `json:"total_active_caches_size_in_bytes"` TotalActiveCachesCount int `json:"total_active_caches_count"` @@ -58,7 +58,7 @@ type TotalCacheUsage struct { // ActionsCacheListOptions represents a list of all possible optional Query parameters for ListCaches method. // -// GitHub API docs: https://docs.github.com/rest/actions/cache#list-github-actions-caches-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#list-github-actions-caches-for-a-repository type ActionsCacheListOptions struct { ListOptions // The Git reference for the results you want to list. @@ -77,7 +77,7 @@ type ActionsCacheListOptions struct { // // Permissions: must have the actions:read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/actions/cache#list-github-actions-caches-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#list-github-actions-caches-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/actions/caches func (s *ActionsService) ListCaches(ctx context.Context, owner, repo string, opts *ActionsCacheListOptions) (*ActionsCacheList, *Response, error) { @@ -87,13 +87,13 @@ func (s *ActionsService) ListCaches(ctx context.Context, owner, repo string, opt return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - actionCacheList := new(ActionsCacheList) - resp, err := s.client.Do(ctx, req, actionCacheList) + var actionCacheList *ActionsCacheList + resp, err := s.client.Do(req, &actionCacheList) if err != nil { return nil, resp, err } @@ -109,39 +109,39 @@ func (s *ActionsService) ListCaches(ctx context.Context, owner, repo string, opt // // Permissions: You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have the actions:write permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/actions/cache#delete-github-actions-caches-for-a-repository-using-a-cache-key +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#delete-github-actions-caches-for-a-repository-using-a-cache-key // //meta:operation DELETE /repos/{owner}/{repo}/actions/caches func (s *ActionsService) DeleteCachesByKey(ctx context.Context, owner, repo, key string, ref *string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/caches", owner, repo) - u, err := addOptions(u, ActionsCache{Key: &key, Ref: ref}) + u, err := addOptions(u, &ActionsCache{Key: &key, Ref: ref}) if err != nil { return nil, err } - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DeleteCachesByID deletes a GitHub Actions cache for a repository, using a cache ID. // // Permissions: You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have the actions:write permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/actions/cache#delete-a-github-actions-cache-for-a-repository-using-a-cache-id +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#delete-a-github-actions-cache-for-a-repository-using-a-cache-id // //meta:operation DELETE /repos/{owner}/{repo}/actions/caches/{cache_id} func (s *ActionsService) DeleteCachesByID(ctx context.Context, owner, repo string, cacheID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/caches/%v", owner, repo, cacheID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // GetCacheUsageForRepo gets GitHub Actions cache usage for a repository. The data fetched using this API is refreshed approximately every 5 minutes, @@ -150,18 +150,18 @@ func (s *ActionsService) DeleteCachesByID(ctx context.Context, owner, repo strin // Permissions: Anyone with read access to the repository can use this endpoint. If the repository is private, you must use an // access token with the repo scope. GitHub Apps must have the actions:read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#get-github-actions-cache-usage-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/actions/cache/usage func (s *ActionsService) GetCacheUsageForRepo(ctx context.Context, owner, repo string) (*ActionsCacheUsage, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/cache/usage", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - cacheUsage := new(ActionsCacheUsage) - res, err := s.client.Do(ctx, req, cacheUsage) + var cacheUsage *ActionsCacheUsage + res, err := s.client.Do(req, &cacheUsage) if err != nil { return nil, res, err } @@ -175,7 +175,7 @@ func (s *ActionsService) GetCacheUsageForRepo(ctx context.Context, owner, repo s // Permissions: You must authenticate using an access token with the read:org scope to use this endpoint. // GitHub Apps must have the organization_administration:read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/actions/cache#list-repositories-with-github-actions-cache-usage-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#list-repositories-with-github-actions-cache-usage-for-an-organization // //meta:operation GET /orgs/{org}/actions/cache/usage-by-repository func (s *ActionsService) ListCacheUsageByRepoForOrg(ctx context.Context, org string, opts *ListOptions) (*ActionsCacheUsageList, *Response, error) { @@ -185,13 +185,13 @@ func (s *ActionsService) ListCacheUsageByRepoForOrg(ctx context.Context, org str return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - cacheUsage := new(ActionsCacheUsageList) - res, err := s.client.Do(ctx, req, cacheUsage) + var cacheUsage *ActionsCacheUsageList + res, err := s.client.Do(req, &cacheUsage) if err != nil { return nil, res, err } @@ -205,18 +205,18 @@ func (s *ActionsService) ListCacheUsageByRepoForOrg(ctx context.Context, org str // Permissions: You must authenticate using an access token with the read:org scope to use this endpoint. // GitHub Apps must have the organization_administration:read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#get-github-actions-cache-usage-for-an-organization // //meta:operation GET /orgs/{org}/actions/cache/usage func (s *ActionsService) GetTotalCacheUsageForOrg(ctx context.Context, org string) (*TotalCacheUsage, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/cache/usage", org) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - cacheUsage := new(TotalCacheUsage) - res, err := s.client.Do(ctx, req, cacheUsage) + var cacheUsage *TotalCacheUsage + res, err := s.client.Do(req, &cacheUsage) if err != nil { return nil, res, err } @@ -229,18 +229,18 @@ func (s *ActionsService) GetTotalCacheUsageForOrg(ctx context.Context, org strin // // Permissions: You must authenticate using an access token with the "admin:enterprise" scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/cache#get-github-actions-cache-usage-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/cache?apiVersion=2022-11-28#get-github-actions-cache-usage-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/actions/cache/usage func (s *ActionsService) GetTotalCacheUsageForEnterprise(ctx context.Context, enterprise string) (*TotalCacheUsage, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/cache/usage", enterprise) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - cacheUsage := new(TotalCacheUsage) - res, err := s.client.Do(ctx, req, cacheUsage) + var cacheUsage *TotalCacheUsage + res, err := s.client.Do(req, &cacheUsage) if err != nil { return nil, res, err } diff --git a/vendor/github.com/google/go-github/v73/github/actions_hosted_runners.go b/vendor/github.com/google/go-github/v88/github/actions_hosted_runners.go similarity index 51% rename from vendor/github.com/google/go-github/v73/github/actions_hosted_runners.go rename to vendor/github.com/google/go-github/v88/github/actions_hosted_runners.go index dbe1f6b5b..6b46f3a3c 100644 --- a/vendor/github.com/google/go-github/v73/github/actions_hosted_runners.go +++ b/vendor/github.com/google/go-github/v88/github/actions_hosted_runners.go @@ -58,7 +58,7 @@ type HostedRunners struct { // ListHostedRunners lists all the GitHub-hosted runners for an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners#list-github-hosted-runners-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#list-github-hosted-runners-for-an-organization // //meta:operation GET /orgs/{org}/actions/hosted-runners func (s *ActionsService) ListHostedRunners(ctx context.Context, org string, opts *ListOptions) (*HostedRunners, *Response, error) { @@ -68,13 +68,13 @@ func (s *ActionsService) ListHostedRunners(ctx context.Context, org string, opts return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runners := &HostedRunners{} - resp, err := s.client.Do(ctx, req, &runners) + var runners *HostedRunners + resp, err := s.client.Do(req, &runners) if err != nil { return nil, resp, err } @@ -83,66 +83,76 @@ func (s *ActionsService) ListHostedRunners(ctx context.Context, org string, opts } // HostedRunnerImage represents the image of GitHub-hosted runners. -// To list all available images, use GET /actions/hosted-runners/images/github-owned or GET /actions/hosted-runners/images/partner. type HostedRunnerImage struct { - ID string `json:"id"` - Source string `json:"source"` - Version string `json:"version"` + // The unique identifier of the runner image. + ID string `json:"id"` + // The source of the runner image. Can be one of: github, partner, custom. + Source string `json:"source"` + // The version of the runner image to deploy. This is relevant only for runners using custom images. + Version *string `json:"version,omitempty"` } -// HostedRunnerRequest specifies body parameters to Hosted Runner configuration. -type HostedRunnerRequest struct { - Name string `json:"name,omitempty"` - Image HostedRunnerImage `json:"image,omitempty"` - RunnerGroupID int64 `json:"runner_group_id,omitempty"` - Size string `json:"size,omitempty"` - MaximumRunners int64 `json:"maximum_runners,omitempty"` - EnableStaticIP bool `json:"enable_static_ip,omitempty"` - ImageVersion string `json:"image_version,omitempty"` +// CreateHostedRunnerRequest specifies body parameters to create Hosted Runner configuration. +type CreateHostedRunnerRequest struct { + Name string `json:"name"` + Image HostedRunnerImage `json:"image"` + Size string `json:"size"` + RunnerGroupID int64 `json:"runner_group_id"` + MaximumRunners *int64 `json:"maximum_runners,omitempty"` + EnableStaticIP *bool `json:"enable_static_ip,omitempty"` + ImageGen *bool `json:"image_gen,omitempty"` } -// validateCreateHostedRunnerRequest validates the provided HostedRunnerRequest to ensure +// UpdateHostedRunnerRequest specifies body parameters to update Hosted Runner configuration. +type UpdateHostedRunnerRequest struct { + Name *string `json:"name,omitempty"` + RunnerGroupID *int64 `json:"runner_group_id,omitempty"` + MaximumRunners *int64 `json:"maximum_runners,omitempty"` + EnableStaticIP *bool `json:"enable_static_ip,omitempty"` + Size *string `json:"size,omitempty"` + ImageID *string `json:"image_id,omitempty"` + ImageVersion *string `json:"image_version,omitempty"` +} + +// validateCreateHostedRunnerRequest validates the provided CreateHostedRunnerRequest to ensure // that all required fields are properly set and that no invalid fields are present for hosted runner create request. // // If any of these conditions are violated, an appropriate error message is returned. // Otherwise, nil is returned, indicating the request is valid. -func validateCreateHostedRunnerRequest(request *HostedRunnerRequest) error { - if request.Size == "" { - return errors.New("size is required for creating a hosted runner") +func validateCreateHostedRunnerRequest(request *CreateHostedRunnerRequest) error { + if request.Name == "" { + return errors.New("name is required for creating a hosted runner") } if request.Image == (HostedRunnerImage{}) { return errors.New("image is required for creating a hosted runner") } - if request.Name == "" { - return errors.New("name is required for creating a hosted runner") + if request.Size == "" { + return errors.New("size is required for creating a hosted runner") } if request.RunnerGroupID == 0 { return errors.New("runner group ID is required for creating a hosted runner") } - if request.ImageVersion != "" { - return errors.New("imageVersion should not be set directly; use the Image struct to specify image details") - } return nil } // CreateHostedRunner creates a GitHub-hosted runner for an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners#create-a-github-hosted-runner-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#create-a-github-hosted-runner-for-an-organization // //meta:operation POST /orgs/{org}/actions/hosted-runners -func (s *ActionsService) CreateHostedRunner(ctx context.Context, org string, request *HostedRunnerRequest) (*HostedRunner, *Response, error) { - if err := validateCreateHostedRunnerRequest(request); err != nil { +func (s *ActionsService) CreateHostedRunner(ctx context.Context, org string, request CreateHostedRunnerRequest) (*HostedRunner, *Response, error) { + if err := validateCreateHostedRunnerRequest(&request); err != nil { return nil, nil, fmt.Errorf("validation failed: %w", err) } u := fmt.Sprintf("orgs/%v/actions/hosted-runners", org) - req, err := s.client.NewRequest("POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, request) if err != nil { return nil, nil, err } - hostedRunner := new(HostedRunner) - resp, err := s.client.Do(ctx, req, hostedRunner) + var hostedRunner *HostedRunner + resp, err := s.client.Do(req, &hostedRunner) if err != nil { return nil, resp, err } @@ -150,6 +160,39 @@ func (s *ActionsService) CreateHostedRunner(ctx context.Context, org string, req return hostedRunner, resp, nil } +// HostedRunnerCustomImage represents a custom image definition for GitHub-hosted runners. +type HostedRunnerCustomImage struct { + ID int64 `json:"id"` + Platform string `json:"platform"` + Name string `json:"name"` + Source string `json:"source"` + VersionsCount int `json:"versions_count"` + TotalVersionsSize int `json:"total_versions_size"` + LatestVersion string `json:"latest_version"` + State string `json:"state"` +} + +// HostedRunnerCustomImages represents a collection of custom images for GitHub-hosted runners. +type HostedRunnerCustomImages struct { + TotalCount int `json:"total_count"` + Images []*HostedRunnerCustomImage `json:"images"` +} + +// HostedRunnerCustomImageVersion represents a version of a custom image for GitHub-hosted runners. +type HostedRunnerCustomImageVersion struct { + Version string `json:"version"` + SizeGB int `json:"size_gb"` + State string `json:"state"` + StateDetails string `json:"state_details"` + CreatedOn Timestamp `json:"created_on"` +} + +// HostedRunnerCustomImageVersions represents a collection of versions of a custom image. +type HostedRunnerCustomImageVersions struct { + TotalCount int `json:"total_count"` + ImageVersions []*HostedRunnerCustomImageVersion `json:"image_versions"` +} + // HostedRunnerImageSpecs represents the details of a GitHub-hosted runner image. type HostedRunnerImageSpecs struct { ID string `json:"id"` @@ -167,18 +210,18 @@ type HostedRunnerImages struct { // GetHostedRunnerGitHubOwnedImages gets the list of GitHub-owned images available for GitHub-hosted runners for an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners#get-github-owned-images-for-github-hosted-runners-in-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#get-github-owned-images-for-github-hosted-runners-in-an-organization // //meta:operation GET /orgs/{org}/actions/hosted-runners/images/github-owned func (s *ActionsService) GetHostedRunnerGitHubOwnedImages(ctx context.Context, org string) (*HostedRunnerImages, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/hosted-runners/images/github-owned", org) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - hostedRunnerImages := new(HostedRunnerImages) - resp, err := s.client.Do(ctx, req, hostedRunnerImages) + var hostedRunnerImages *HostedRunnerImages + resp, err := s.client.Do(req, &hostedRunnerImages) if err != nil { return nil, resp, err } @@ -188,18 +231,18 @@ func (s *ActionsService) GetHostedRunnerGitHubOwnedImages(ctx context.Context, o // GetHostedRunnerPartnerImages gets the list of partner images available for GitHub-hosted runners for an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners#get-partner-images-for-github-hosted-runners-in-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#get-partner-images-for-github-hosted-runners-in-an-organization // //meta:operation GET /orgs/{org}/actions/hosted-runners/images/partner func (s *ActionsService) GetHostedRunnerPartnerImages(ctx context.Context, org string) (*HostedRunnerImages, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/hosted-runners/images/partner", org) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - hostedRunnerImages := new(HostedRunnerImages) - resp, err := s.client.Do(ctx, req, hostedRunnerImages) + var hostedRunnerImages *HostedRunnerImages + resp, err := s.client.Do(req, &hostedRunnerImages) if err != nil { return nil, resp, err } @@ -220,18 +263,18 @@ type PublicIPUsage struct { // GetHostedRunnerLimits gets the GitHub-hosted runners Static public IP Limits for an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners#get-limits-on-github-hosted-runners-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#get-limits-on-github-hosted-runners-for-an-organization // //meta:operation GET /orgs/{org}/actions/hosted-runners/limits func (s *ActionsService) GetHostedRunnerLimits(ctx context.Context, org string) (*HostedRunnerPublicIPLimits, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/hosted-runners/limits", org) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - publicIPLimits := new(HostedRunnerPublicIPLimits) - resp, err := s.client.Do(ctx, req, publicIPLimits) + var publicIPLimits *HostedRunnerPublicIPLimits + resp, err := s.client.Do(req, &publicIPLimits) if err != nil { return nil, resp, err } @@ -247,18 +290,18 @@ type HostedRunnerMachineSpecs struct { // GetHostedRunnerMachineSpecs gets the list of machine specs available for GitHub-hosted runners for an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners#get-github-hosted-runners-machine-specs-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#get-github-hosted-runners-machine-specs-for-an-organization // //meta:operation GET /orgs/{org}/actions/hosted-runners/machine-sizes func (s *ActionsService) GetHostedRunnerMachineSpecs(ctx context.Context, org string) (*HostedRunnerMachineSpecs, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/hosted-runners/machine-sizes", org) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - machineSpecs := new(HostedRunnerMachineSpecs) - resp, err := s.client.Do(ctx, req, machineSpecs) + var machineSpecs *HostedRunnerMachineSpecs + resp, err := s.client.Do(req, &machineSpecs) if err != nil { return nil, resp, err } @@ -274,18 +317,18 @@ type HostedRunnerPlatforms struct { // GetHostedRunnerPlatforms gets list of platforms available for GitHub-hosted runners for an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners#get-platforms-for-github-hosted-runners-in-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#get-platforms-for-github-hosted-runners-in-an-organization // //meta:operation GET /orgs/{org}/actions/hosted-runners/platforms func (s *ActionsService) GetHostedRunnerPlatforms(ctx context.Context, org string) (*HostedRunnerPlatforms, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/hosted-runners/platforms", org) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - platforms := new(HostedRunnerPlatforms) - resp, err := s.client.Do(ctx, req, platforms) + var platforms *HostedRunnerPlatforms + resp, err := s.client.Do(req, &platforms) if err != nil { return nil, resp, err } @@ -295,18 +338,18 @@ func (s *ActionsService) GetHostedRunnerPlatforms(ctx context.Context, org strin // GetHostedRunner gets a GitHub-hosted runner in an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners#get-a-github-hosted-runner-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#get-a-github-hosted-runner-for-an-organization // //meta:operation GET /orgs/{org}/actions/hosted-runners/{hosted_runner_id} func (s *ActionsService) GetHostedRunner(ctx context.Context, org string, runnerID int64) (*HostedRunner, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/hosted-runners/%v", org, runnerID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - hostedRunner := new(HostedRunner) - resp, err := s.client.Do(ctx, req, hostedRunner) + var hostedRunner *HostedRunner + resp, err := s.client.Do(req, &hostedRunner) if err != nil { return nil, resp, err } @@ -314,39 +357,20 @@ func (s *ActionsService) GetHostedRunner(ctx context.Context, org string, runner return hostedRunner, resp, nil } -// validateUpdateHostedRunnerRequest validates the provided HostedRunnerRequest to ensure -// that no disallowed updates are made for a hosted runner update request. -// -// If any of these conditions are violated, an appropriate error message is returned. -// Otherwise, nil is returned, indicating the request is valid for an update. -func validateUpdateHostedRunnerRequest(request *HostedRunnerRequest) error { - if request.Size != "" { - return errors.New("size cannot be updated, API does not support updating size") - } - if request.Image != (HostedRunnerImage{}) { - return errors.New("image struct should not be set directly; use the ImageVersion to specify version details") - } - return nil -} - // UpdateHostedRunner updates a GitHub-hosted runner for an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners#update-a-github-hosted-runner-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#update-a-github-hosted-runner-for-an-organization // //meta:operation PATCH /orgs/{org}/actions/hosted-runners/{hosted_runner_id} -func (s *ActionsService) UpdateHostedRunner(ctx context.Context, org string, runnerID int64, updateReq HostedRunnerRequest) (*HostedRunner, *Response, error) { - if err := validateUpdateHostedRunnerRequest(&updateReq); err != nil { - return nil, nil, fmt.Errorf("validation failed: %w", err) - } - +func (s *ActionsService) UpdateHostedRunner(ctx context.Context, org string, runnerID int64, request UpdateHostedRunnerRequest) (*HostedRunner, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/hosted-runners/%v", org, runnerID) - req, err := s.client.NewRequest("PATCH", u, updateReq) + req, err := s.client.NewRequest(ctx, "PATCH", u, request) if err != nil { return nil, nil, err } - hostedRunner := new(HostedRunner) - resp, err := s.client.Do(ctx, req, hostedRunner) + var hostedRunner *HostedRunner + resp, err := s.client.Do(req, &hostedRunner) if err != nil { return nil, resp, err } @@ -356,21 +380,135 @@ func (s *ActionsService) UpdateHostedRunner(ctx context.Context, org string, run // DeleteHostedRunner deletes GitHub-hosted runner from an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners#delete-a-github-hosted-runner-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#delete-a-github-hosted-runner-for-an-organization // //meta:operation DELETE /orgs/{org}/actions/hosted-runners/{hosted_runner_id} func (s *ActionsService) DeleteHostedRunner(ctx context.Context, org string, runnerID int64) (*HostedRunner, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/hosted-runners/%v", org, runnerID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, nil, err } - hostedRunner := new(HostedRunner) - resp, err := s.client.Do(ctx, req, hostedRunner) + var hostedRunner *HostedRunner + resp, err := s.client.Do(req, &hostedRunner) if err != nil { return nil, resp, err } return hostedRunner, resp, nil } + +// ListHostedRunnerCustomImages lists custom images for GitHub-hosted runners in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#list-custom-images-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/hosted-runners/images/custom +func (s *ActionsService) ListHostedRunnerCustomImages(ctx context.Context, org string) (*HostedRunnerCustomImages, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/hosted-runners/images/custom", org) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var images *HostedRunnerCustomImages + resp, err := s.client.Do(req, &images) + if err != nil { + return nil, resp, err + } + + return images, resp, nil +} + +// GetHostedRunnerCustomImage gets a custom image definition for GitHub-hosted runners in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#get-a-custom-image-definition-for-github-actions-hosted-runners +// +//meta:operation GET /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id} +func (s *ActionsService) GetHostedRunnerCustomImage(ctx context.Context, org string, imageDefinitionID int64) (*HostedRunnerCustomImage, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/hosted-runners/images/custom/%v", org, imageDefinitionID) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var image *HostedRunnerCustomImage + resp, err := s.client.Do(req, &image) + if err != nil { + return nil, resp, err + } + + return image, resp, nil +} + +// DeleteHostedRunnerCustomImage deletes a custom image from the organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#delete-a-custom-image-from-the-organization +// +//meta:operation DELETE /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id} +func (s *ActionsService) DeleteHostedRunnerCustomImage(ctx context.Context, org string, imageDefinitionID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/hosted-runners/images/custom/%v", org, imageDefinitionID) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// ListHostedRunnerCustomImageVersions lists image versions of a custom image for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#list-image-versions-of-a-custom-image-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id}/versions +func (s *ActionsService) ListHostedRunnerCustomImageVersions(ctx context.Context, org string, imageDefinitionID int64) (*HostedRunnerCustomImageVersions, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/hosted-runners/images/custom/%v/versions", org, imageDefinitionID) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var versions *HostedRunnerCustomImageVersions + resp, err := s.client.Do(req, &versions) + if err != nil { + return nil, resp, err + } + + return versions, resp, nil +} + +// GetHostedRunnerCustomImageVersion gets an image version of a custom image for GitHub-hosted runners in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#get-an-image-version-of-a-custom-image-for-github-actions-hosted-runners +// +//meta:operation GET /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id}/versions/{version} +func (s *ActionsService) GetHostedRunnerCustomImageVersion(ctx context.Context, org string, imageDefinitionID int64, version string) (*HostedRunnerCustomImageVersion, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/hosted-runners/images/custom/%v/versions/%v", org, imageDefinitionID, version) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var imageVersion *HostedRunnerCustomImageVersion + resp, err := s.client.Do(req, &imageVersion) + if err != nil { + return nil, resp, err + } + + return imageVersion, resp, nil +} + +// DeleteHostedRunnerCustomImageVersion deletes an image version of a custom image from the organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#delete-an-image-version-of-custom-image-from-the-organization +// +//meta:operation DELETE /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id}/versions/{version} +func (s *ActionsService) DeleteHostedRunnerCustomImageVersion(ctx context.Context, org string, imageDefinitionID int64, version string) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/hosted-runners/images/custom/%v/versions/%v", org, imageDefinitionID, version) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v73/github/actions_oidc.go b/vendor/github.com/google/go-github/v88/github/actions_oidc.go similarity index 76% rename from vendor/github.com/google/go-github/v73/github/actions_oidc.go rename to vendor/github.com/google/go-github/v88/github/actions_oidc.go index 596aa9d98..06ec8cec4 100644 --- a/vendor/github.com/google/go-github/v73/github/actions_oidc.go +++ b/vendor/github.com/google/go-github/v88/github/actions_oidc.go @@ -18,7 +18,7 @@ type OIDCSubjectClaimCustomTemplate struct { // GetOrgOIDCSubjectClaimCustomTemplate gets the subject claim customization template for an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/oidc#get-the-customization-template-for-an-oidc-subject-claim-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/oidc?apiVersion=2022-11-28#get-the-customization-template-for-an-oidc-subject-claim-for-an-organization // //meta:operation GET /orgs/{org}/actions/oidc/customization/sub func (s *ActionsService) GetOrgOIDCSubjectClaimCustomTemplate(ctx context.Context, org string) (*OIDCSubjectClaimCustomTemplate, *Response, error) { @@ -28,7 +28,7 @@ func (s *ActionsService) GetOrgOIDCSubjectClaimCustomTemplate(ctx context.Contex // GetRepoOIDCSubjectClaimCustomTemplate gets the subject claim customization template for a repository. // -// GitHub API docs: https://docs.github.com/rest/actions/oidc#get-the-customization-template-for-an-oidc-subject-claim-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/oidc?apiVersion=2022-11-28#get-the-customization-template-for-an-oidc-subject-claim-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/actions/oidc/customization/sub func (s *ActionsService) GetRepoOIDCSubjectClaimCustomTemplate(ctx context.Context, owner, repo string) (*OIDCSubjectClaimCustomTemplate, *Response, error) { @@ -37,13 +37,13 @@ func (s *ActionsService) GetRepoOIDCSubjectClaimCustomTemplate(ctx context.Conte } func (s *ActionsService) getOIDCSubjectClaimCustomTemplate(ctx context.Context, url string) (*OIDCSubjectClaimCustomTemplate, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } - tmpl := new(OIDCSubjectClaimCustomTemplate) - resp, err := s.client.Do(ctx, req, tmpl) + var tmpl *OIDCSubjectClaimCustomTemplate + resp, err := s.client.Do(req, &tmpl) if err != nil { return nil, resp, err } @@ -53,7 +53,7 @@ func (s *ActionsService) getOIDCSubjectClaimCustomTemplate(ctx context.Context, // SetOrgOIDCSubjectClaimCustomTemplate sets the subject claim customization for an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/oidc#set-the-customization-template-for-an-oidc-subject-claim-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/oidc?apiVersion=2022-11-28#set-the-customization-template-for-an-oidc-subject-claim-for-an-organization // //meta:operation PUT /orgs/{org}/actions/oidc/customization/sub func (s *ActionsService) SetOrgOIDCSubjectClaimCustomTemplate(ctx context.Context, org string, template *OIDCSubjectClaimCustomTemplate) (*Response, error) { @@ -63,7 +63,7 @@ func (s *ActionsService) SetOrgOIDCSubjectClaimCustomTemplate(ctx context.Contex // SetRepoOIDCSubjectClaimCustomTemplate sets the subject claim customization for a repository. // -// GitHub API docs: https://docs.github.com/rest/actions/oidc#set-the-customization-template-for-an-oidc-subject-claim-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/oidc?apiVersion=2022-11-28#set-the-customization-template-for-an-oidc-subject-claim-for-a-repository // //meta:operation PUT /repos/{owner}/{repo}/actions/oidc/customization/sub func (s *ActionsService) SetRepoOIDCSubjectClaimCustomTemplate(ctx context.Context, owner, repo string, template *OIDCSubjectClaimCustomTemplate) (*Response, error) { @@ -72,10 +72,10 @@ func (s *ActionsService) SetRepoOIDCSubjectClaimCustomTemplate(ctx context.Conte } func (s *ActionsService) setOIDCSubjectClaimCustomTemplate(ctx context.Context, url string, template *OIDCSubjectClaimCustomTemplate) (*Response, error) { - req, err := s.client.NewRequest("PUT", url, template) + req, err := s.client.NewRequest(ctx, "PUT", url, template) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v88/github/actions_permissions_enterprise.go b/vendor/github.com/google/go-github/v88/github/actions_permissions_enterprise.go new file mode 100644 index 000000000..4508c4309 --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/actions_permissions_enterprise.go @@ -0,0 +1,414 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// ActionsEnabledOnEnterpriseRepos represents all the repositories in an enterprise for which Actions is enabled. +type ActionsEnabledOnEnterpriseRepos struct { + TotalCount int `json:"total_count"` + Organizations []*Organization `json:"organizations"` +} + +// ActionsPermissionsEnterprise represents a policy for allowed actions in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28 +type ActionsPermissionsEnterprise struct { + EnabledOrganizations *string `json:"enabled_organizations,omitempty"` + AllowedActions *string `json:"allowed_actions,omitempty"` + SelectedActionsURL *string `json:"selected_actions_url,omitempty"` +} + +func (a ActionsPermissionsEnterprise) String() string { + return Stringify(a) +} + +// DefaultWorkflowPermissionEnterprise represents the default permissions for GitHub Actions workflows for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28 +type DefaultWorkflowPermissionEnterprise struct { + DefaultWorkflowPermissions *string `json:"default_workflow_permissions,omitempty"` + CanApprovePullRequestReviews *bool `json:"can_approve_pull_request_reviews,omitempty"` +} + +// SelfHostRunnerPermissionsEnterprise represents the settings for whether organizations in the enterprise are allowed to manage self-hosted runners at the repository level. +type SelfHostRunnerPermissionsEnterprise struct { + DisableSelfHostedRunnersForAllOrgs *bool `json:"disable_self_hosted_runners_for_all_orgs,omitempty"` +} + +func (a SelfHostRunnerPermissionsEnterprise) String() string { + return Stringify(a) +} + +// GetActionsPermissionsInEnterprise gets the GitHub Actions permissions policy for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#get-github-actions-permissions-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/permissions +func (s *ActionsService) GetActionsPermissionsInEnterprise(ctx context.Context, enterprise string) (*ActionsPermissionsEnterprise, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions", enterprise) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions *ActionsPermissionsEnterprise + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// UpdateActionsPermissionsInEnterprise sets the permissions policy in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-github-actions-permissions-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions +func (s *ActionsService) UpdateActionsPermissionsInEnterprise(ctx context.Context, enterprise string, actionsPermissionsEnterprise ActionsPermissionsEnterprise) (*ActionsPermissionsEnterprise, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions", enterprise) + req, err := s.client.NewRequest(ctx, "PUT", u, actionsPermissionsEnterprise) + if err != nil { + return nil, nil, err + } + + var p *ActionsPermissionsEnterprise + resp, err := s.client.Do(req, &p) + if err != nil { + return nil, resp, err + } + + return p, resp, nil +} + +// ListEnabledOrgsInEnterprise lists the selected organizations that are enabled for GitHub Actions in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#list-selected-organizations-enabled-for-github-actions-in-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/permissions/organizations +func (s *ActionsService) ListEnabledOrgsInEnterprise(ctx context.Context, owner string, opts *ListOptions) (*ActionsEnabledOnEnterpriseRepos, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/organizations", owner) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var orgs *ActionsEnabledOnEnterpriseRepos + resp, err := s.client.Do(req, &orgs) + if err != nil { + return nil, resp, err + } + + return orgs, resp, nil +} + +// SetEnabledOrgsInEnterprise replaces the list of selected organizations that are enabled for GitHub Actions in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-selected-organizations-enabled-for-github-actions-in-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions/organizations +func (s *ActionsService) SetEnabledOrgsInEnterprise(ctx context.Context, owner string, organizationIDs []int64) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/organizations", owner) + + req, err := s.client.NewRequest(ctx, "PUT", u, struct { + IDs []int64 `json:"selected_organization_ids"` + }{IDs: organizationIDs}) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// AddEnabledOrgInEnterprise adds an organization to the list of selected organizations that are enabled for GitHub Actions in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#enable-a-selected-organization-for-github-actions-in-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions/organizations/{org_id} +func (s *ActionsService) AddEnabledOrgInEnterprise(ctx context.Context, owner string, organizationID int64) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/organizations/%v", owner, organizationID) + + req, err := s.client.NewRequest(ctx, "PUT", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// RemoveEnabledOrgInEnterprise removes an organization from the list of selected organizations that are enabled for GitHub Actions in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#disable-a-selected-organization-for-github-actions-in-an-enterprise +// +//meta:operation DELETE /enterprises/{enterprise}/actions/permissions/organizations/{org_id} +func (s *ActionsService) RemoveEnabledOrgInEnterprise(ctx context.Context, owner string, organizationID int64) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/organizations/%v", owner, organizationID) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// GetActionsAllowedInEnterprise gets the actions that are allowed in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#get-allowed-actions-and-reusable-workflows-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/permissions/selected-actions +func (s *ActionsService) GetActionsAllowedInEnterprise(ctx context.Context, enterprise string) (*ActionsAllowed, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/selected-actions", enterprise) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var actionsAllowed *ActionsAllowed + resp, err := s.client.Do(req, &actionsAllowed) + if err != nil { + return nil, resp, err + } + + return actionsAllowed, resp, nil +} + +// UpdateActionsAllowedInEnterprise sets the actions that are allowed in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-allowed-actions-and-reusable-workflows-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions/selected-actions +func (s *ActionsService) UpdateActionsAllowedInEnterprise(ctx context.Context, enterprise string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/selected-actions", enterprise) + req, err := s.client.NewRequest(ctx, "PUT", u, actionsAllowed) + if err != nil { + return nil, nil, err + } + + var p *ActionsAllowed + resp, err := s.client.Do(req, &p) + if err != nil { + return nil, resp, err + } + + return p, resp, nil +} + +// GetDefaultWorkflowPermissionsInEnterprise gets the GitHub Actions default workflow permissions for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#get-default-workflow-permissions-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/permissions/workflow +func (s *ActionsService) GetDefaultWorkflowPermissionsInEnterprise(ctx context.Context, enterprise string) (*DefaultWorkflowPermissionEnterprise, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/workflow", enterprise) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions *DefaultWorkflowPermissionEnterprise + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// UpdateDefaultWorkflowPermissionsInEnterprise sets the GitHub Actions default workflow permissions for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-default-workflow-permissions-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions/workflow +func (s *ActionsService) UpdateDefaultWorkflowPermissionsInEnterprise(ctx context.Context, enterprise string, permissions DefaultWorkflowPermissionEnterprise) (*DefaultWorkflowPermissionEnterprise, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/workflow", enterprise) + req, err := s.client.NewRequest(ctx, "PUT", u, permissions) + if err != nil { + return nil, nil, err + } + + var p *DefaultWorkflowPermissionEnterprise + resp, err := s.client.Do(req, &p) + if err != nil { + return nil, resp, err + } + + return p, resp, nil +} + +// GetArtifactAndLogRetentionPeriodInEnterprise gets the artifact and log retention period for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#get-artifact-and-log-retention-settings-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/permissions/artifact-and-log-retention +func (s *ActionsService) GetArtifactAndLogRetentionPeriodInEnterprise(ctx context.Context, enterprise string) (*ArtifactPeriod, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/artifact-and-log-retention", enterprise) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var arp *ArtifactPeriod + resp, err := s.client.Do(req, &arp) + if err != nil { + return nil, resp, err + } + + return arp, resp, nil +} + +// UpdateArtifactAndLogRetentionPeriodInEnterprise sets the artifact and log retention period for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-artifact-and-log-retention-settings-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions/artifact-and-log-retention +func (s *ActionsService) UpdateArtifactAndLogRetentionPeriodInEnterprise(ctx context.Context, enterprise string, period ArtifactPeriodOpt) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/artifact-and-log-retention", enterprise) + req, err := s.client.NewRequest(ctx, "PUT", u, period) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// GetSelfHostedRunnerPermissionsInEnterprise gets the self-hosted runner permissions for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#get-self-hosted-runners-permissions-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/permissions/self-hosted-runners +func (s *ActionsService) GetSelfHostedRunnerPermissionsInEnterprise(ctx context.Context, enterprise string) (*SelfHostRunnerPermissionsEnterprise, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/self-hosted-runners", enterprise) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions *SelfHostRunnerPermissionsEnterprise + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// UpdateSelfHostedRunnerPermissionsInEnterprise sets the self-hosted runner permissions for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-self-hosted-runners-permissions-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions/self-hosted-runners +func (s *ActionsService) UpdateSelfHostedRunnerPermissionsInEnterprise(ctx context.Context, enterprise string, permissions SelfHostRunnerPermissionsEnterprise) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/self-hosted-runners", enterprise) + req, err := s.client.NewRequest(ctx, "PUT", u, permissions) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// GetPrivateRepoForkPRWorkflowSettingsInEnterprise gets the settings for whether workflows from fork pull requests can run on private repositories in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#get-private-repo-fork-pr-workflow-settings-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/permissions/fork-pr-workflows-private-repos +func (s *ActionsService) GetPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx context.Context, enterprise string) (*WorkflowsPermissions, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/fork-pr-workflows-private-repos", enterprise) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions *WorkflowsPermissions + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// UpdatePrivateRepoForkPRWorkflowSettingsInEnterprise sets the settings for whether workflows from fork pull requests can run on private repositories in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-private-repo-fork-pr-workflow-settings-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions/fork-pr-workflows-private-repos +func (s *ActionsService) UpdatePrivateRepoForkPRWorkflowSettingsInEnterprise(ctx context.Context, enterprise string, permissions *WorkflowsPermissionsOpt) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/fork-pr-workflows-private-repos", enterprise) + req, err := s.client.NewRequest(ctx, "PUT", u, permissions) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// GetEnterpriseForkPRContributorApprovalPermissions gets the fork PR contributor approval policy for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#get-fork-pr-contributor-approval-permissions-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/permissions/fork-pr-contributor-approval +func (s *ActionsService) GetEnterpriseForkPRContributorApprovalPermissions(ctx context.Context, enterprise string) (*ContributorApprovalPermissions, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/fork-pr-contributor-approval", enterprise) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var policy *ContributorApprovalPermissions + resp, err := s.client.Do(req, &policy) + if err != nil { + return nil, resp, err + } + + return policy, resp, nil +} + +// UpdateEnterpriseForkPRContributorApprovalPermissions sets the fork PR contributor approval policy for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-fork-pr-contributor-approval-permissions-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions/fork-pr-contributor-approval +func (s *ActionsService) UpdateEnterpriseForkPRContributorApprovalPermissions(ctx context.Context, enterprise string, policy ContributorApprovalPermissions) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/fork-pr-contributor-approval", enterprise) + req, err := s.client.NewRequest(ctx, "PUT", u, policy) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v88/github/actions_permissions_orgs.go b/vendor/github.com/google/go-github/v88/github/actions_permissions_orgs.go new file mode 100644 index 000000000..ecf93a779 --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/actions_permissions_orgs.go @@ -0,0 +1,523 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// ActionsPermissions represents a policy for repositories and allowed actions in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28 +type ActionsPermissions struct { + EnabledRepositories *string `json:"enabled_repositories,omitempty"` + AllowedActions *string `json:"allowed_actions,omitempty"` + SelectedActionsURL *string `json:"selected_actions_url,omitempty"` + SHAPinningRequired *bool `json:"sha_pinning_required,omitempty"` +} + +func (a ActionsPermissions) String() string { + return Stringify(a) +} + +// ActionsEnabledOnOrgRepos represents all the repositories in an organization for which Actions is enabled. +type ActionsEnabledOnOrgRepos struct { + TotalCount int `json:"total_count"` + Repositories []*Repository `json:"repositories"` +} + +// ActionsAllowed represents selected actions that are allowed. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28 +type ActionsAllowed struct { + GithubOwnedAllowed *bool `json:"github_owned_allowed,omitempty"` + VerifiedAllowed *bool `json:"verified_allowed,omitempty"` + PatternsAllowed []string `json:"patterns_allowed,omitempty"` +} + +func (a ActionsAllowed) String() string { + return Stringify(a) +} + +// DefaultWorkflowPermissionOrganization represents the default permissions for GitHub Actions workflows for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28 +type DefaultWorkflowPermissionOrganization struct { + DefaultWorkflowPermissions *string `json:"default_workflow_permissions,omitempty"` + CanApprovePullRequestReviews *bool `json:"can_approve_pull_request_reviews,omitempty"` +} + +// SelfHostedRunnersSettingsOrganization represents the self-hosted runners permissions settings for repositories in an organization. +type SelfHostedRunnersSettingsOrganization struct { + EnabledRepositories *string `json:"enabled_repositories,omitempty"` + SelectedRepositoriesURL *string `json:"selected_repositories_url,omitempty"` +} + +func (s SelfHostedRunnersSettingsOrganization) String() string { + return Stringify(s) +} + +// SelfHostedRunnersSettingsOrganizationOpt specifies the self-hosted runners permissions settings for repositories in an organization. +type SelfHostedRunnersSettingsOrganizationOpt struct { + EnabledRepositories *string `json:"enabled_repositories,omitempty"` +} + +// GetActionsPermissions gets the GitHub Actions permissions policy for repositories and allowed actions in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-github-actions-permissions-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions +func (s *ActionsService) GetActionsPermissions(ctx context.Context, org string) (*ActionsPermissions, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions *ActionsPermissions + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// UpdateActionsPermissions sets the permissions policy for repositories and allowed actions in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-github-actions-permissions-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions +func (s *ActionsService) UpdateActionsPermissions(ctx context.Context, org string, actionsPermissions ActionsPermissions) (*ActionsPermissions, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions", org) + req, err := s.client.NewRequest(ctx, "PUT", u, actionsPermissions) + if err != nil { + return nil, nil, err + } + + var p *ActionsPermissions + resp, err := s.client.Do(req, &p) + if err != nil { + return nil, resp, err + } + + return p, resp, nil +} + +// ListEnabledReposInOrg lists the selected repositories that are enabled for GitHub Actions in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#list-selected-repositories-enabled-for-github-actions-in-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions/repositories +func (s *ActionsService) ListEnabledReposInOrg(ctx context.Context, owner string, opts *ListOptions) (*ActionsEnabledOnOrgRepos, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/repositories", owner) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var repos *ActionsEnabledOnOrgRepos + resp, err := s.client.Do(req, &repos) + if err != nil { + return nil, resp, err + } + + return repos, resp, nil +} + +// SetEnabledReposInOrg replaces the list of selected repositories that are enabled for GitHub Actions in an organization.. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-selected-repositories-enabled-for-github-actions-in-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/repositories +func (s *ActionsService) SetEnabledReposInOrg(ctx context.Context, owner string, repositoryIDs []int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/repositories", owner) + + req, err := s.client.NewRequest(ctx, "PUT", u, struct { + IDs []int64 `json:"selected_repository_ids"` + }{IDs: repositoryIDs}) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// AddEnabledReposInOrg adds a repository to the list of selected repositories that are enabled for GitHub Actions in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#enable-a-selected-repository-for-github-actions-in-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/repositories/{repository_id} +func (s *ActionsService) AddEnabledReposInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/repositories/%v", owner, repositoryID) + + req, err := s.client.NewRequest(ctx, "PUT", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// RemoveEnabledReposInOrg removes a single repository from the list of enabled repos for GitHub Actions in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#disable-a-selected-repository-for-github-actions-in-an-organization +// +//meta:operation DELETE /orgs/{org}/actions/permissions/repositories/{repository_id} +func (s *ActionsService) RemoveEnabledReposInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/repositories/%v", owner, repositoryID) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// GetActionsAllowed gets the actions that are allowed in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-allowed-actions-and-reusable-workflows-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions/selected-actions +func (s *ActionsService) GetActionsAllowed(ctx context.Context, org string) (*ActionsAllowed, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/selected-actions", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var actionsAllowed *ActionsAllowed + resp, err := s.client.Do(req, &actionsAllowed) + if err != nil { + return nil, resp, err + } + + return actionsAllowed, resp, nil +} + +// UpdateActionsAllowed sets the actions that are allowed in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-allowed-actions-and-reusable-workflows-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/selected-actions +func (s *ActionsService) UpdateActionsAllowed(ctx context.Context, org string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/selected-actions", org) + req, err := s.client.NewRequest(ctx, "PUT", u, actionsAllowed) + if err != nil { + return nil, nil, err + } + + var p *ActionsAllowed + resp, err := s.client.Do(req, &p) + if err != nil { + return nil, resp, err + } + + return p, resp, nil +} + +// GetDefaultWorkflowPermissionsInOrganization gets the GitHub Actions default workflow permissions for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-default-workflow-permissions-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions/workflow +func (s *ActionsService) GetDefaultWorkflowPermissionsInOrganization(ctx context.Context, org string) (*DefaultWorkflowPermissionOrganization, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/workflow", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions *DefaultWorkflowPermissionOrganization + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// UpdateDefaultWorkflowPermissionsInOrganization sets the GitHub Actions default workflow permissions for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-default-workflow-permissions-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/workflow +func (s *ActionsService) UpdateDefaultWorkflowPermissionsInOrganization(ctx context.Context, org string, permissions DefaultWorkflowPermissionOrganization) (*DefaultWorkflowPermissionOrganization, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/workflow", org) + req, err := s.client.NewRequest(ctx, "PUT", u, permissions) + if err != nil { + return nil, nil, err + } + + var p *DefaultWorkflowPermissionOrganization + resp, err := s.client.Do(req, &p) + if err != nil { + return nil, resp, err + } + + return p, resp, nil +} + +// GetArtifactAndLogRetentionPeriodInOrganization gets the artifact and log retention period for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-artifact-and-log-retention-settings-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions/artifact-and-log-retention +func (s *ActionsService) GetArtifactAndLogRetentionPeriodInOrganization(ctx context.Context, org string) (*ArtifactPeriod, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/artifact-and-log-retention", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var arp *ArtifactPeriod + resp, err := s.client.Do(req, &arp) + if err != nil { + return nil, resp, err + } + + return arp, resp, nil +} + +// UpdateArtifactAndLogRetentionPeriodInOrganization sets the artifact and log retention period for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-artifact-and-log-retention-settings-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/artifact-and-log-retention +func (s *ActionsService) UpdateArtifactAndLogRetentionPeriodInOrganization(ctx context.Context, org string, period ArtifactPeriodOpt) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/artifact-and-log-retention", org) + req, err := s.client.NewRequest(ctx, "PUT", u, period) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// GetSelfHostedRunnersSettingsInOrganization gets the self-hosted runners permissions settings for repositories in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-self-hosted-runners-settings-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions/self-hosted-runners +func (s *ActionsService) GetSelfHostedRunnersSettingsInOrganization(ctx context.Context, org string) (*SelfHostedRunnersSettingsOrganization, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/self-hosted-runners", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var settings *SelfHostedRunnersSettingsOrganization + resp, err := s.client.Do(req, &settings) + if err != nil { + return nil, resp, err + } + + return settings, resp, nil +} + +// UpdateSelfHostedRunnersSettingsInOrganization sets the self-hosted runners permissions settings for repositories in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-self-hosted-runners-settings-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/self-hosted-runners +func (s *ActionsService) UpdateSelfHostedRunnersSettingsInOrganization(ctx context.Context, org string, opt SelfHostedRunnersSettingsOrganizationOpt) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/self-hosted-runners", org) + + req, err := s.client.NewRequest(ctx, "PUT", u, opt) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// SelfHostedRunnersAllowedRepos represents the repositories that are allowed to use self-hosted runners in an organization. +type SelfHostedRunnersAllowedRepos struct { + TotalCount int `json:"total_count"` + Repositories []*Repository `json:"repositories"` +} + +// ListRepositoriesSelfHostedRunnersAllowedInOrganization lists the repositories that are allowed to use self-hosted runners in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#list-repositories-allowed-to-use-self-hosted-runners-in-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions/self-hosted-runners/repositories +func (s *ActionsService) ListRepositoriesSelfHostedRunnersAllowedInOrganization(ctx context.Context, org string, opts *ListOptions) (*SelfHostedRunnersAllowedRepos, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/self-hosted-runners/repositories", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var settings *SelfHostedRunnersAllowedRepos + resp, err := s.client.Do(req, &settings) + if err != nil { + return nil, resp, err + } + + return settings, resp, nil +} + +// SetRepositoriesSelfHostedRunnersAllowedInOrganization allows the list of repositories to use self-hosted runners in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-repositories-allowed-to-use-self-hosted-runners-in-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/self-hosted-runners/repositories +func (s *ActionsService) SetRepositoriesSelfHostedRunnersAllowedInOrganization(ctx context.Context, org string, repositoryIDs []int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/self-hosted-runners/repositories", org) + + req, err := s.client.NewRequest(ctx, "PUT", u, struct { + IDs []int64 `json:"selected_repository_ids"` + }{IDs: repositoryIDs}) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// AddRepositorySelfHostedRunnersAllowedInOrganization adds a repository to the list of repositories that are allowed to use self-hosted runners in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#add-a-repository-to-the-list-of-repositories-allowed-to-use-self-hosted-runners-in-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/self-hosted-runners/repositories/{repository_id} +func (s *ActionsService) AddRepositorySelfHostedRunnersAllowedInOrganization(ctx context.Context, org string, repositoryID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/self-hosted-runners/repositories/%v", org, repositoryID) + + req, err := s.client.NewRequest(ctx, "PUT", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// RemoveRepositorySelfHostedRunnersAllowedInOrganization removes a repository from the list of repositories that are allowed to use self-hosted runners in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#remove-a-repository-from-the-list-of-repositories-allowed-to-use-self-hosted-runners-in-an-organization +// +//meta:operation DELETE /orgs/{org}/actions/permissions/self-hosted-runners/repositories/{repository_id} +func (s *ActionsService) RemoveRepositorySelfHostedRunnersAllowedInOrganization(ctx context.Context, org string, repositoryID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/self-hosted-runners/repositories/%v", org, repositoryID) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// GetPrivateRepoForkPRWorkflowSettingsInOrganization gets the settings for whether workflows from fork pull requests can run on private repositories in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-private-repo-fork-pr-workflow-settings-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions/fork-pr-workflows-private-repos +func (s *ActionsService) GetPrivateRepoForkPRWorkflowSettingsInOrganization(ctx context.Context, org string) (*WorkflowsPermissions, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/fork-pr-workflows-private-repos", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions *WorkflowsPermissions + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// UpdatePrivateRepoForkPRWorkflowSettingsInOrganization sets the settings for whether workflows from fork pull requests can run on private repositories in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-private-repo-fork-pr-workflow-settings-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/fork-pr-workflows-private-repos +func (s *ActionsService) UpdatePrivateRepoForkPRWorkflowSettingsInOrganization(ctx context.Context, org string, permissions *WorkflowsPermissionsOpt) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/fork-pr-workflows-private-repos", org) + req, err := s.client.NewRequest(ctx, "PUT", u, permissions) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// GetOrganizationForkPRContributorApprovalPermissions gets the fork PR contributor approval policy for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-fork-pr-contributor-approval-permissions-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions/fork-pr-contributor-approval +func (s *ActionsService) GetOrganizationForkPRContributorApprovalPermissions(ctx context.Context, org string) (*ContributorApprovalPermissions, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/fork-pr-contributor-approval", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var policy *ContributorApprovalPermissions + resp, err := s.client.Do(req, &policy) + if err != nil { + return nil, resp, err + } + + return policy, resp, nil +} + +// UpdateOrganizationForkPRContributorApprovalPermissions sets the fork PR contributor approval policy for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-fork-pr-contributor-approval-permissions-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/fork-pr-contributor-approval +func (s *ActionsService) UpdateOrganizationForkPRContributorApprovalPermissions(ctx context.Context, org string, policy ContributorApprovalPermissions) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/fork-pr-contributor-approval", org) + req, err := s.client.NewRequest(ctx, "PUT", u, policy) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v73/github/actions_runner_groups.go b/vendor/github.com/google/go-github/v88/github/actions_runner_groups.go similarity index 74% rename from vendor/github.com/google/go-github/v73/github/actions_runner_groups.go rename to vendor/github.com/google/go-github/v88/github/actions_runner_groups.go index b2ee32f61..fad13db6b 100644 --- a/vendor/github.com/google/go-github/v73/github/actions_runner_groups.go +++ b/vendor/github.com/google/go-github/v88/github/actions_runner_groups.go @@ -18,6 +18,8 @@ type RunnerGroup struct { Default *bool `json:"default,omitempty"` SelectedRepositoriesURL *string `json:"selected_repositories_url,omitempty"` RunnersURL *string `json:"runners_url,omitempty"` + HostedRunnersURL *string `json:"hosted_runners_url,omitempty"` + NetworkConfigurationID *string `json:"network_configuration_id,omitempty"` Inherited *bool `json:"inherited,omitempty"` AllowsPublicRepositories *bool `json:"allows_public_repositories,omitempty"` RestrictedToWorkflows *bool `json:"restricted_to_workflows,omitempty"` @@ -45,6 +47,8 @@ type CreateRunnerGroupRequest struct { RestrictedToWorkflows *bool `json:"restricted_to_workflows,omitempty"` // List of workflows the runner group should be allowed to run. This setting will be ignored unless RestrictedToWorkflows is set to true. SelectedWorkflows []string `json:"selected_workflows,omitempty"` + // The identifier of a hosted compute network configuration. + NetworkConfigurationID *string `json:"network_configuration_id,omitempty"` } // UpdateRunnerGroupRequest represents a request to update a Runner group for an organization. @@ -54,6 +58,7 @@ type UpdateRunnerGroupRequest struct { AllowsPublicRepositories *bool `json:"allows_public_repositories,omitempty"` RestrictedToWorkflows *bool `json:"restricted_to_workflows,omitempty"` SelectedWorkflows []string `json:"selected_workflows,omitempty"` + NetworkConfigurationID *string `json:"network_configuration_id,omitempty"` } // SetRepoAccessRunnerGroupRequest represents a request to replace the list of repositories @@ -80,7 +85,7 @@ type ListOrgRunnerGroupOptions struct { // ListOrganizationRunnerGroups lists all self-hosted runner groups configured in an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#list-self-hosted-runner-groups-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-self-hosted-runner-groups-for-an-organization // //meta:operation GET /orgs/{org}/actions/runner-groups func (s *ActionsService) ListOrganizationRunnerGroups(ctx context.Context, org string, opts *ListOrgRunnerGroupOptions) (*RunnerGroups, *Response, error) { @@ -90,13 +95,13 @@ func (s *ActionsService) ListOrganizationRunnerGroups(ctx context.Context, org s return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - groups := &RunnerGroups{} - resp, err := s.client.Do(ctx, req, &groups) + var groups *RunnerGroups + resp, err := s.client.Do(req, &groups) if err != nil { return nil, resp, err } @@ -106,18 +111,18 @@ func (s *ActionsService) ListOrganizationRunnerGroups(ctx context.Context, org s // GetOrganizationRunnerGroup gets a specific self-hosted runner group for an organization using its RunnerGroup ID. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#get-a-self-hosted-runner-group-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#get-a-self-hosted-runner-group-for-an-organization // //meta:operation GET /orgs/{org}/actions/runner-groups/{runner_group_id} func (s *ActionsService) GetOrganizationRunnerGroup(ctx context.Context, org string, groupID int64) (*RunnerGroup, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v", org, groupID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runnerGroup := new(RunnerGroup) - resp, err := s.client.Do(ctx, req, runnerGroup) + var runnerGroup *RunnerGroup + resp, err := s.client.Do(req, &runnerGroup) if err != nil { return nil, resp, err } @@ -127,34 +132,34 @@ func (s *ActionsService) GetOrganizationRunnerGroup(ctx context.Context, org str // DeleteOrganizationRunnerGroup deletes a self-hosted runner group from an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#delete-a-self-hosted-runner-group-from-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#delete-a-self-hosted-runner-group-from-an-organization // //meta:operation DELETE /orgs/{org}/actions/runner-groups/{runner_group_id} func (s *ActionsService) DeleteOrganizationRunnerGroup(ctx context.Context, org string, groupID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v", org, groupID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // CreateOrganizationRunnerGroup creates a new self-hosted runner group for an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#create-a-self-hosted-runner-group-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#create-a-self-hosted-runner-group-for-an-organization // //meta:operation POST /orgs/{org}/actions/runner-groups func (s *ActionsService) CreateOrganizationRunnerGroup(ctx context.Context, org string, createReq CreateRunnerGroupRequest) (*RunnerGroup, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups", org) - req, err := s.client.NewRequest("POST", u, createReq) + req, err := s.client.NewRequest(ctx, "POST", u, createReq) if err != nil { return nil, nil, err } - runnerGroup := new(RunnerGroup) - resp, err := s.client.Do(ctx, req, runnerGroup) + var runnerGroup *RunnerGroup + resp, err := s.client.Do(req, &runnerGroup) if err != nil { return nil, resp, err } @@ -164,18 +169,18 @@ func (s *ActionsService) CreateOrganizationRunnerGroup(ctx context.Context, org // UpdateOrganizationRunnerGroup updates a self-hosted runner group for an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#update-a-self-hosted-runner-group-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#update-a-self-hosted-runner-group-for-an-organization // //meta:operation PATCH /orgs/{org}/actions/runner-groups/{runner_group_id} func (s *ActionsService) UpdateOrganizationRunnerGroup(ctx context.Context, org string, groupID int64, updateReq UpdateRunnerGroupRequest) (*RunnerGroup, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v", org, groupID) - req, err := s.client.NewRequest("PATCH", u, updateReq) + req, err := s.client.NewRequest(ctx, "PATCH", u, updateReq) if err != nil { return nil, nil, err } - runnerGroup := new(RunnerGroup) - resp, err := s.client.Do(ctx, req, runnerGroup) + var runnerGroup *RunnerGroup + resp, err := s.client.Do(req, &runnerGroup) if err != nil { return nil, resp, err } @@ -185,7 +190,7 @@ func (s *ActionsService) UpdateOrganizationRunnerGroup(ctx context.Context, org // ListRepositoryAccessRunnerGroup lists the repositories with access to a self-hosted runner group configured in an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#list-repository-access-to-a-self-hosted-runner-group-in-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-repository-access-to-a-self-hosted-runner-group-in-an-organization // //meta:operation GET /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories func (s *ActionsService) ListRepositoryAccessRunnerGroup(ctx context.Context, org string, groupID int64, opts *ListOptions) (*ListRepositories, *Response, error) { @@ -195,13 +200,13 @@ func (s *ActionsService) ListRepositoryAccessRunnerGroup(ctx context.Context, or return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - repos := &ListRepositories{} - resp, err := s.client.Do(ctx, req, &repos) + var repos *ListRepositories + resp, err := s.client.Do(req, &repos) if err != nil { return nil, resp, err } @@ -212,57 +217,83 @@ func (s *ActionsService) ListRepositoryAccessRunnerGroup(ctx context.Context, or // SetRepositoryAccessRunnerGroup replaces the list of repositories that have access to a self-hosted runner group configured in an organization // with a new List of repositories. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#set-repository-access-for-a-self-hosted-runner-group-in-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#set-repository-access-for-a-self-hosted-runner-group-in-an-organization // //meta:operation PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories func (s *ActionsService) SetRepositoryAccessRunnerGroup(ctx context.Context, org string, groupID int64, ids SetRepoAccessRunnerGroupRequest) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/repositories", org, groupID) - req, err := s.client.NewRequest("PUT", u, ids) + req, err := s.client.NewRequest(ctx, "PUT", u, ids) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // AddRepositoryAccessRunnerGroup adds a repository to the list of selected repositories that can access a self-hosted runner group. // The runner group must have visibility set to 'selected'. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#add-repository-access-to-a-self-hosted-runner-group-in-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#add-repository-access-to-a-self-hosted-runner-group-in-an-organization // //meta:operation PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id} func (s *ActionsService) AddRepositoryAccessRunnerGroup(ctx context.Context, org string, groupID, repoID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/repositories/%v", org, groupID, repoID) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RemoveRepositoryAccessRunnerGroup removes a repository from the list of selected repositories that can access a self-hosted runner group. // The runner group must have visibility set to 'selected'. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#remove-repository-access-to-a-self-hosted-runner-group-in-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#remove-repository-access-to-a-self-hosted-runner-group-in-an-organization // //meta:operation DELETE /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id} func (s *ActionsService) RemoveRepositoryAccessRunnerGroup(ctx context.Context, org string, groupID, repoID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/repositories/%v", org, groupID, repoID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) +} + +// ListRunnerGroupHostedRunners lists the GitHub-hosted runners in an organization runner group. +// +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-github-hosted-runners-in-a-group-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/runner-groups/{runner_group_id}/hosted-runners +func (s *ActionsService) ListRunnerGroupHostedRunners(ctx context.Context, org string, groupID int64, opts *ListOptions) (*HostedRunners, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/hosted-runners", org, groupID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var runners *HostedRunners + resp, err := s.client.Do(req, &runners) + if err != nil { + return nil, resp, err + } + + return runners, resp, nil } // ListRunnerGroupRunners lists self-hosted runners that are in a specific organization group. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#list-self-hosted-runners-in-a-group-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-self-hosted-runners-in-a-group-for-an-organization // //meta:operation GET /orgs/{org}/actions/runner-groups/{runner_group_id}/runners func (s *ActionsService) ListRunnerGroupRunners(ctx context.Context, org string, groupID int64, opts *ListOptions) (*Runners, *Response, error) { @@ -272,13 +303,13 @@ func (s *ActionsService) ListRunnerGroupRunners(ctx context.Context, org string, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runners := &Runners{} - resp, err := s.client.Do(ctx, req, &runners) + var runners *Runners + resp, err := s.client.Do(req, &runners) if err != nil { return nil, resp, err } @@ -289,49 +320,49 @@ func (s *ActionsService) ListRunnerGroupRunners(ctx context.Context, org string, // SetRunnerGroupRunners replaces the list of self-hosted runners that are part of an organization runner group // with a new list of runners. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#set-self-hosted-runners-in-a-group-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#set-self-hosted-runners-in-a-group-for-an-organization // //meta:operation PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/runners func (s *ActionsService) SetRunnerGroupRunners(ctx context.Context, org string, groupID int64, ids SetRunnerGroupRunnersRequest) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/runners", org, groupID) - req, err := s.client.NewRequest("PUT", u, ids) + req, err := s.client.NewRequest(ctx, "PUT", u, ids) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // AddRunnerGroupRunners adds a self-hosted runner to a runner group configured in an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#add-a-self-hosted-runner-to-a-group-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#add-a-self-hosted-runner-to-a-group-for-an-organization // //meta:operation PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/runners/{runner_id} func (s *ActionsService) AddRunnerGroupRunners(ctx context.Context, org string, groupID, runnerID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/runners/%v", org, groupID, runnerID) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RemoveRunnerGroupRunners removes a self-hosted runner from a group configured in an organization. // The runner is then returned to the default group. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#remove-a-self-hosted-runner-from-a-group-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#remove-a-self-hosted-runner-from-a-group-for-an-organization // //meta:operation DELETE /orgs/{org}/actions/runner-groups/{runner_group_id}/runners/{runner_id} func (s *ActionsService) RemoveRunnerGroupRunners(ctx context.Context, org string, groupID, runnerID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/runners/%v", org, groupID, runnerID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/actions_runners.go b/vendor/github.com/google/go-github/v88/github/actions_runners.go similarity index 79% rename from vendor/github.com/google/go-github/v73/github/actions_runners.go rename to vendor/github.com/google/go-github/v88/github/actions_runners.go index c4ae48232..32b35c75f 100644 --- a/vendor/github.com/google/go-github/v73/github/actions_runners.go +++ b/vendor/github.com/google/go-github/v88/github/actions_runners.go @@ -22,18 +22,18 @@ type RunnerApplicationDownload struct { // ListRunnerApplicationDownloads lists self-hosted runner application binaries that can be downloaded and run. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#list-runner-applications-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-runner-applications-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/actions/runners/downloads func (s *ActionsService) ListRunnerApplicationDownloads(ctx context.Context, owner, repo string) ([]*RunnerApplicationDownload, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners/downloads", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var rads []*RunnerApplicationDownload - resp, err := s.client.Do(ctx, req, &rads) + resp, err := s.client.Do(req, &rads) if err != nil { return nil, resp, err } @@ -60,18 +60,18 @@ type JITRunnerConfig struct { // GenerateOrgJITConfig generate a just-in-time configuration for an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-configuration-for-a-just-in-time-runner-for-an-organization // //meta:operation POST /orgs/{org}/actions/runners/generate-jitconfig func (s *ActionsService) GenerateOrgJITConfig(ctx context.Context, org string, request *GenerateJITConfigRequest) (*JITRunnerConfig, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners/generate-jitconfig", org) - req, err := s.client.NewRequest("POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, request) if err != nil { return nil, nil, err } - jitConfig := new(JITRunnerConfig) - resp, err := s.client.Do(ctx, req, jitConfig) + var jitConfig *JITRunnerConfig + resp, err := s.client.Do(req, &jitConfig) if err != nil { return nil, resp, err } @@ -81,18 +81,18 @@ func (s *ActionsService) GenerateOrgJITConfig(ctx context.Context, org string, r // GenerateRepoJITConfig generates a just-in-time configuration for a repository. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-configuration-for-a-just-in-time-runner-for-a-repository // //meta:operation POST /repos/{owner}/{repo}/actions/runners/generate-jitconfig func (s *ActionsService) GenerateRepoJITConfig(ctx context.Context, owner, repo string, request *GenerateJITConfigRequest) (*JITRunnerConfig, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners/generate-jitconfig", owner, repo) - req, err := s.client.NewRequest("POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, request) if err != nil { return nil, nil, err } - jitConfig := new(JITRunnerConfig) - resp, err := s.client.Do(ctx, req, jitConfig) + var jitConfig *JITRunnerConfig + resp, err := s.client.Do(req, &jitConfig) if err != nil { return nil, resp, err } @@ -108,19 +108,19 @@ type RegistrationToken struct { // CreateRegistrationToken creates a token that can be used to add a self-hosted runner. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#create-a-registration-token-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-registration-token-for-a-repository // //meta:operation POST /repos/{owner}/{repo}/actions/runners/registration-token func (s *ActionsService) CreateRegistrationToken(ctx context.Context, owner, repo string) (*RegistrationToken, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners/registration-token", owner, repo) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - registrationToken := new(RegistrationToken) - resp, err := s.client.Do(ctx, req, registrationToken) + var registrationToken *RegistrationToken + resp, err := s.client.Do(req, ®istrationToken) if err != nil { return nil, resp, err } @@ -159,7 +159,7 @@ type ListRunnersOptions struct { // ListRunners lists all the self-hosted runners for a repository. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#list-self-hosted-runners-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-self-hosted-runners-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/actions/runners func (s *ActionsService) ListRunners(ctx context.Context, owner, repo string, opts *ListRunnersOptions) (*Runners, *Response, error) { @@ -169,13 +169,13 @@ func (s *ActionsService) ListRunners(ctx context.Context, owner, repo string, op return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runners := &Runners{} - resp, err := s.client.Do(ctx, req, &runners) + var runners *Runners + resp, err := s.client.Do(req, &runners) if err != nil { return nil, resp, err } @@ -185,18 +185,18 @@ func (s *ActionsService) ListRunners(ctx context.Context, owner, repo string, op // GetRunner gets a specific self-hosted runner for a repository using its runner ID. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#get-a-self-hosted-runner-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/actions/runners/{runner_id} func (s *ActionsService) GetRunner(ctx context.Context, owner, repo string, runnerID int64) (*Runner, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners/%v", owner, repo, runnerID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runner := new(Runner) - resp, err := s.client.Do(ctx, req, runner) + var runner *Runner + resp, err := s.client.Do(req, &runner) if err != nil { return nil, resp, err } @@ -212,19 +212,19 @@ type RemoveToken struct { // CreateRemoveToken creates a token that can be used to remove a self-hosted runner from a repository. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#create-a-remove-token-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-remove-token-for-a-repository // //meta:operation POST /repos/{owner}/{repo}/actions/runners/remove-token func (s *ActionsService) CreateRemoveToken(ctx context.Context, owner, repo string) (*RemoveToken, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners/remove-token", owner, repo) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - removeToken := new(RemoveToken) - resp, err := s.client.Do(ctx, req, removeToken) + var removeToken *RemoveToken + resp, err := s.client.Do(req, &removeToken) if err != nil { return nil, resp, err } @@ -234,34 +234,34 @@ func (s *ActionsService) CreateRemoveToken(ctx context.Context, owner, repo stri // RemoveRunner forces the removal of a self-hosted runner in a repository using the runner id. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#delete-a-self-hosted-runner-from-a-repository // //meta:operation DELETE /repos/{owner}/{repo}/actions/runners/{runner_id} func (s *ActionsService) RemoveRunner(ctx context.Context, owner, repo string, runnerID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners/%v", owner, repo, runnerID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListOrganizationRunnerApplicationDownloads lists self-hosted runner application binaries that can be downloaded and run. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#list-runner-applications-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-runner-applications-for-an-organization // //meta:operation GET /orgs/{org}/actions/runners/downloads func (s *ActionsService) ListOrganizationRunnerApplicationDownloads(ctx context.Context, org string) ([]*RunnerApplicationDownload, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners/downloads", org) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var rads []*RunnerApplicationDownload - resp, err := s.client.Do(ctx, req, &rads) + resp, err := s.client.Do(req, &rads) if err != nil { return nil, resp, err } @@ -271,19 +271,19 @@ func (s *ActionsService) ListOrganizationRunnerApplicationDownloads(ctx context. // CreateOrganizationRegistrationToken creates a token that can be used to add a self-hosted runner to an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#create-a-registration-token-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-registration-token-for-an-organization // //meta:operation POST /orgs/{org}/actions/runners/registration-token func (s *ActionsService) CreateOrganizationRegistrationToken(ctx context.Context, org string) (*RegistrationToken, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners/registration-token", org) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - registrationToken := new(RegistrationToken) - resp, err := s.client.Do(ctx, req, registrationToken) + var registrationToken *RegistrationToken + resp, err := s.client.Do(req, ®istrationToken) if err != nil { return nil, resp, err } @@ -293,7 +293,7 @@ func (s *ActionsService) CreateOrganizationRegistrationToken(ctx context.Context // ListOrganizationRunners lists all the self-hosted runners for an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-self-hosted-runners-for-an-organization // //meta:operation GET /orgs/{org}/actions/runners func (s *ActionsService) ListOrganizationRunners(ctx context.Context, org string, opts *ListRunnersOptions) (*Runners, *Response, error) { @@ -303,13 +303,13 @@ func (s *ActionsService) ListOrganizationRunners(ctx context.Context, org string return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runners := &Runners{} - resp, err := s.client.Do(ctx, req, &runners) + var runners *Runners + resp, err := s.client.Do(req, &runners) if err != nil { return nil, resp, err } @@ -319,18 +319,18 @@ func (s *ActionsService) ListOrganizationRunners(ctx context.Context, org string // GetOrganizationRunner gets a specific self-hosted runner for an organization using its runner ID. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#get-a-self-hosted-runner-for-an-organization // //meta:operation GET /orgs/{org}/actions/runners/{runner_id} func (s *ActionsService) GetOrganizationRunner(ctx context.Context, org string, runnerID int64) (*Runner, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners/%v", org, runnerID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runner := new(Runner) - resp, err := s.client.Do(ctx, req, runner) + var runner *Runner + resp, err := s.client.Do(req, &runner) if err != nil { return nil, resp, err } @@ -340,19 +340,19 @@ func (s *ActionsService) GetOrganizationRunner(ctx context.Context, org string, // CreateOrganizationRemoveToken creates a token that can be used to remove a self-hosted runner from an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#create-a-remove-token-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-remove-token-for-an-organization // //meta:operation POST /orgs/{org}/actions/runners/remove-token func (s *ActionsService) CreateOrganizationRemoveToken(ctx context.Context, org string) (*RemoveToken, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners/remove-token", org) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - removeToken := new(RemoveToken) - resp, err := s.client.Do(ctx, req, removeToken) + var removeToken *RemoveToken + resp, err := s.client.Do(req, &removeToken) if err != nil { return nil, resp, err } @@ -362,16 +362,16 @@ func (s *ActionsService) CreateOrganizationRemoveToken(ctx context.Context, org // RemoveOrganizationRunner forces the removal of a self-hosted runner from an organization using the runner id. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#delete-a-self-hosted-runner-from-an-organization // //meta:operation DELETE /orgs/{org}/actions/runners/{runner_id} func (s *ActionsService) RemoveOrganizationRunner(ctx context.Context, org string, runnerID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners/%v", org, runnerID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/actions_secrets.go b/vendor/github.com/google/go-github/v88/github/actions_secrets.go similarity index 86% rename from vendor/github.com/google/go-github/v73/github/actions_secrets.go rename to vendor/github.com/google/go-github/v88/github/actions_secrets.go index ff09b4ee5..1f5dae4e8 100644 --- a/vendor/github.com/google/go-github/v73/github/actions_secrets.go +++ b/vendor/github.com/google/go-github/v88/github/actions_secrets.go @@ -8,6 +8,7 @@ package github import ( "context" "encoding/json" + "errors" "fmt" "strconv" ) @@ -48,13 +49,13 @@ func (p *PublicKey) UnmarshalJSON(data []byte) error { } func (s *ActionsService) getPublicKey(ctx context.Context, url string) (*PublicKey, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } - pubKey := new(PublicKey) - resp, err := s.client.Do(ctx, req, pubKey) + var pubKey *PublicKey + resp, err := s.client.Do(req, &pubKey) if err != nil { return nil, resp, err } @@ -64,7 +65,7 @@ func (s *ActionsService) getPublicKey(ctx context.Context, url string) (*PublicK // GetRepoPublicKey gets a public key that should be used for secret encryption. // -// GitHub API docs: https://docs.github.com/rest/actions/secrets#get-a-repository-public-key +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#get-a-repository-public-key // //meta:operation GET /repos/{owner}/{repo}/actions/secrets/public-key func (s *ActionsService) GetRepoPublicKey(ctx context.Context, owner, repo string) (*PublicKey, *Response, error) { @@ -74,7 +75,7 @@ func (s *ActionsService) GetRepoPublicKey(ctx context.Context, owner, repo strin // GetOrgPublicKey gets a public key that should be used for secret encryption. // -// GitHub API docs: https://docs.github.com/rest/actions/secrets#get-an-organization-public-key +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#get-an-organization-public-key // //meta:operation GET /orgs/{org}/actions/secrets/public-key func (s *ActionsService) GetOrgPublicKey(ctx context.Context, org string) (*PublicKey, *Response, error) { @@ -113,13 +114,13 @@ func (s *ActionsService) listSecrets(ctx context.Context, url string, opts *List return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - secrets := new(Secrets) - resp, err := s.client.Do(ctx, req, &secrets) + var secrets *Secrets + resp, err := s.client.Do(req, &secrets) if err != nil { return nil, resp, err } @@ -130,7 +131,7 @@ func (s *ActionsService) listSecrets(ctx context.Context, url string, opts *List // ListRepoSecrets lists all secrets available in a repository // without revealing their encrypted values. // -// GitHub API docs: https://docs.github.com/rest/actions/secrets#list-repository-secrets +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#list-repository-secrets // //meta:operation GET /repos/{owner}/{repo}/actions/secrets func (s *ActionsService) ListRepoSecrets(ctx context.Context, owner, repo string, opts *ListOptions) (*Secrets, *Response, error) { @@ -141,7 +142,7 @@ func (s *ActionsService) ListRepoSecrets(ctx context.Context, owner, repo string // ListRepoOrgSecrets lists all organization secrets available in a repository // without revealing their encrypted values. // -// GitHub API docs: https://docs.github.com/rest/actions/secrets#list-repository-organization-secrets +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#list-repository-organization-secrets // //meta:operation GET /repos/{owner}/{repo}/actions/organization-secrets func (s *ActionsService) ListRepoOrgSecrets(ctx context.Context, owner, repo string, opts *ListOptions) (*Secrets, *Response, error) { @@ -152,7 +153,7 @@ func (s *ActionsService) ListRepoOrgSecrets(ctx context.Context, owner, repo str // ListOrgSecrets lists all secrets available in an organization // without revealing their encrypted values. // -// GitHub API docs: https://docs.github.com/rest/actions/secrets#list-organization-secrets +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#list-organization-secrets // //meta:operation GET /orgs/{org}/actions/secrets func (s *ActionsService) ListOrgSecrets(ctx context.Context, org string, opts *ListOptions) (*Secrets, *Response, error) { @@ -171,13 +172,13 @@ func (s *ActionsService) ListEnvSecrets(ctx context.Context, repoID int, env str } func (s *ActionsService) getSecret(ctx context.Context, url string) (*Secret, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } - secret := new(Secret) - resp, err := s.client.Do(ctx, req, secret) + var secret *Secret + resp, err := s.client.Do(req, &secret) if err != nil { return nil, resp, err } @@ -187,7 +188,7 @@ func (s *ActionsService) getSecret(ctx context.Context, url string) (*Secret, *R // GetRepoSecret gets a single repository secret without revealing its encrypted value. // -// GitHub API docs: https://docs.github.com/rest/actions/secrets#get-a-repository-secret +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#get-a-repository-secret // //meta:operation GET /repos/{owner}/{repo}/actions/secrets/{secret_name} func (s *ActionsService) GetRepoSecret(ctx context.Context, owner, repo, name string) (*Secret, *Response, error) { @@ -197,7 +198,7 @@ func (s *ActionsService) GetRepoSecret(ctx context.Context, owner, repo, name st // GetOrgSecret gets a single organization secret without revealing its encrypted value. // -// GitHub API docs: https://docs.github.com/rest/actions/secrets#get-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#get-an-organization-secret // //meta:operation GET /orgs/{org}/actions/secrets/{secret_name} func (s *ActionsService) GetOrgSecret(ctx context.Context, org, name string) (*Secret, *Response, error) { @@ -232,30 +233,38 @@ type EncryptedSecret struct { } func (s *ActionsService) putSecret(ctx context.Context, url string, eSecret *EncryptedSecret) (*Response, error) { - req, err := s.client.NewRequest("PUT", url, eSecret) + req, err := s.client.NewRequest(ctx, "PUT", url, eSecret) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // CreateOrUpdateRepoSecret creates or updates a repository secret with an encrypted value. // -// GitHub API docs: https://docs.github.com/rest/actions/secrets#create-or-update-a-repository-secret +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#create-or-update-a-repository-secret // //meta:operation PUT /repos/{owner}/{repo}/actions/secrets/{secret_name} func (s *ActionsService) CreateOrUpdateRepoSecret(ctx context.Context, owner, repo string, eSecret *EncryptedSecret) (*Response, error) { + if eSecret == nil { + return nil, errors.New("encrypted secret must be provided") + } + url := fmt.Sprintf("repos/%v/%v/actions/secrets/%v", owner, repo, eSecret.Name) return s.putSecret(ctx, url, eSecret) } // CreateOrUpdateOrgSecret creates or updates an organization secret with an encrypted value. // -// GitHub API docs: https://docs.github.com/rest/actions/secrets#create-or-update-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#create-or-update-an-organization-secret // //meta:operation PUT /orgs/{org}/actions/secrets/{secret_name} func (s *ActionsService) CreateOrUpdateOrgSecret(ctx context.Context, org string, eSecret *EncryptedSecret) (*Response, error) { + if eSecret == nil { + return nil, errors.New("encrypted secret must be provided") + } + url := fmt.Sprintf("orgs/%v/actions/secrets/%v", org, eSecret.Name) return s.putSecret(ctx, url, eSecret) } @@ -266,22 +275,26 @@ func (s *ActionsService) CreateOrUpdateOrgSecret(ctx context.Context, org string // //meta:operation PUT /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name} func (s *ActionsService) CreateOrUpdateEnvSecret(ctx context.Context, repoID int, env string, eSecret *EncryptedSecret) (*Response, error) { + if eSecret == nil { + return nil, errors.New("encrypted secret must be provided") + } + url := fmt.Sprintf("repositories/%v/environments/%v/secrets/%v", repoID, env, eSecret.Name) return s.putSecret(ctx, url, eSecret) } func (s *ActionsService) deleteSecret(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest("DELETE", url, nil) + req, err := s.client.NewRequest(ctx, "DELETE", url, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DeleteRepoSecret deletes a secret in a repository using the secret name. // -// GitHub API docs: https://docs.github.com/rest/actions/secrets#delete-a-repository-secret +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#delete-a-repository-secret // //meta:operation DELETE /repos/{owner}/{repo}/actions/secrets/{secret_name} func (s *ActionsService) DeleteRepoSecret(ctx context.Context, owner, repo, name string) (*Response, error) { @@ -291,7 +304,7 @@ func (s *ActionsService) DeleteRepoSecret(ctx context.Context, owner, repo, name // DeleteOrgSecret deletes a secret in an organization using the secret name. // -// GitHub API docs: https://docs.github.com/rest/actions/secrets#delete-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#delete-an-organization-secret // //meta:operation DELETE /orgs/{org}/actions/secrets/{secret_name} func (s *ActionsService) DeleteOrgSecret(ctx context.Context, org, name string) (*Response, error) { @@ -321,13 +334,13 @@ func (s *ActionsService) listSelectedReposForSecret(ctx context.Context, url str return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - result := new(SelectedReposList) - resp, err := s.client.Do(ctx, req, result) + var result *SelectedReposList + resp, err := s.client.Do(req, &result) if err != nil { return nil, resp, err } @@ -337,7 +350,7 @@ func (s *ActionsService) listSelectedReposForSecret(ctx context.Context, url str // ListSelectedReposForOrgSecret lists all repositories that have access to a secret. // -// GitHub API docs: https://docs.github.com/rest/actions/secrets#list-selected-repositories-for-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#list-selected-repositories-for-an-organization-secret // //meta:operation GET /orgs/{org}/actions/secrets/{secret_name}/repositories func (s *ActionsService) ListSelectedReposForOrgSecret(ctx context.Context, org, name string, opts *ListOptions) (*SelectedReposList, *Response, error) { @@ -350,17 +363,17 @@ func (s *ActionsService) setSelectedReposForSecret(ctx context.Context, url stri SelectedIDs SelectedRepoIDs `json:"selected_repository_ids"` } - req, err := s.client.NewRequest("PUT", url, repoIDs{SelectedIDs: ids}) + req, err := s.client.NewRequest(ctx, "PUT", url, repoIDs{SelectedIDs: ids}) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // SetSelectedReposForOrgSecret sets the repositories that have access to a secret. // -// GitHub API docs: https://docs.github.com/rest/actions/secrets#set-selected-repositories-for-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#set-selected-repositories-for-an-organization-secret // //meta:operation PUT /orgs/{org}/actions/secrets/{secret_name}/repositories func (s *ActionsService) SetSelectedReposForOrgSecret(ctx context.Context, org, name string, ids SelectedRepoIDs) (*Response, error) { @@ -369,39 +382,47 @@ func (s *ActionsService) SetSelectedReposForOrgSecret(ctx context.Context, org, } func (s *ActionsService) addSelectedRepoToSecret(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest("PUT", url, nil) + req, err := s.client.NewRequest(ctx, "PUT", url, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // AddSelectedRepoToOrgSecret adds a repository to an organization secret. // -// GitHub API docs: https://docs.github.com/rest/actions/secrets#add-selected-repository-to-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#add-selected-repository-to-an-organization-secret // //meta:operation PUT /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id} func (s *ActionsService) AddSelectedRepoToOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) { + if repo == nil { + return nil, errors.New("repository must be provided") + } + url := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories/%v", org, name, *repo.ID) return s.addSelectedRepoToSecret(ctx, url) } func (s *ActionsService) removeSelectedRepoFromSecret(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest("DELETE", url, nil) + req, err := s.client.NewRequest(ctx, "DELETE", url, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RemoveSelectedRepoFromOrgSecret removes a repository from an organization secret. // -// GitHub API docs: https://docs.github.com/rest/actions/secrets#remove-selected-repository-from-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#remove-selected-repository-from-an-organization-secret // //meta:operation DELETE /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id} func (s *ActionsService) RemoveSelectedRepoFromOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) { + if repo == nil { + return nil, errors.New("repository must be provided") + } + url := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories/%v", org, name, *repo.ID) return s.removeSelectedRepoFromSecret(ctx, url) } diff --git a/vendor/github.com/google/go-github/v73/github/actions_variables.go b/vendor/github.com/google/go-github/v88/github/actions_variables.go similarity index 81% rename from vendor/github.com/google/go-github/v73/github/actions_variables.go rename to vendor/github.com/google/go-github/v88/github/actions_variables.go index bca46b6df..f41384e37 100644 --- a/vendor/github.com/google/go-github/v73/github/actions_variables.go +++ b/vendor/github.com/google/go-github/v88/github/actions_variables.go @@ -7,6 +7,7 @@ package github import ( "context" + "errors" "fmt" ) @@ -35,13 +36,13 @@ func (s *ActionsService) listVariables(ctx context.Context, url string, opts *Li return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - variables := new(ActionsVariables) - resp, err := s.client.Do(ctx, req, &variables) + var variables *ActionsVariables + resp, err := s.client.Do(req, &variables) if err != nil { return nil, resp, err } @@ -51,7 +52,7 @@ func (s *ActionsService) listVariables(ctx context.Context, url string, opts *Li // ListRepoVariables lists all variables available in a repository. // -// GitHub API docs: https://docs.github.com/rest/actions/variables#list-repository-variables +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#list-repository-variables // //meta:operation GET /repos/{owner}/{repo}/actions/variables func (s *ActionsService) ListRepoVariables(ctx context.Context, owner, repo string, opts *ListOptions) (*ActionsVariables, *Response, error) { @@ -61,7 +62,7 @@ func (s *ActionsService) ListRepoVariables(ctx context.Context, owner, repo stri // ListRepoOrgVariables lists all organization variables available in a repository. // -// GitHub API docs: https://docs.github.com/rest/actions/variables#list-repository-organization-variables +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#list-repository-organization-variables // //meta:operation GET /repos/{owner}/{repo}/actions/organization-variables func (s *ActionsService) ListRepoOrgVariables(ctx context.Context, owner, repo string, opts *ListOptions) (*ActionsVariables, *Response, error) { @@ -71,7 +72,7 @@ func (s *ActionsService) ListRepoOrgVariables(ctx context.Context, owner, repo s // ListOrgVariables lists all variables available in an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/variables#list-organization-variables +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#list-organization-variables // //meta:operation GET /orgs/{org}/actions/variables func (s *ActionsService) ListOrgVariables(ctx context.Context, org string, opts *ListOptions) (*ActionsVariables, *Response, error) { @@ -81,7 +82,7 @@ func (s *ActionsService) ListOrgVariables(ctx context.Context, org string, opts // ListEnvVariables lists all variables available in an environment. // -// GitHub API docs: https://docs.github.com/rest/actions/variables#list-environment-variables +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#list-environment-variables // //meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/variables func (s *ActionsService) ListEnvVariables(ctx context.Context, owner, repo, env string, opts *ListOptions) (*ActionsVariables, *Response, error) { @@ -90,13 +91,13 @@ func (s *ActionsService) ListEnvVariables(ctx context.Context, owner, repo, env } func (s *ActionsService) getVariable(ctx context.Context, url string) (*ActionsVariable, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } - variable := new(ActionsVariable) - resp, err := s.client.Do(ctx, req, variable) + var variable *ActionsVariable + resp, err := s.client.Do(req, &variable) if err != nil { return nil, resp, err } @@ -106,7 +107,7 @@ func (s *ActionsService) getVariable(ctx context.Context, url string) (*ActionsV // GetRepoVariable gets a single repository variable. // -// GitHub API docs: https://docs.github.com/rest/actions/variables#get-a-repository-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#get-a-repository-variable // //meta:operation GET /repos/{owner}/{repo}/actions/variables/{name} func (s *ActionsService) GetRepoVariable(ctx context.Context, owner, repo, name string) (*ActionsVariable, *Response, error) { @@ -116,7 +117,7 @@ func (s *ActionsService) GetRepoVariable(ctx context.Context, owner, repo, name // GetOrgVariable gets a single organization variable. // -// GitHub API docs: https://docs.github.com/rest/actions/variables#get-an-organization-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#get-an-organization-variable // //meta:operation GET /orgs/{org}/actions/variables/{name} func (s *ActionsService) GetOrgVariable(ctx context.Context, org, name string) (*ActionsVariable, *Response, error) { @@ -126,7 +127,7 @@ func (s *ActionsService) GetOrgVariable(ctx context.Context, org, name string) ( // GetEnvVariable gets a single environment variable. // -// GitHub API docs: https://docs.github.com/rest/actions/variables#get-an-environment-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#get-an-environment-variable // //meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/variables/{name} func (s *ActionsService) GetEnvVariable(ctx context.Context, owner, repo, env, variableName string) (*ActionsVariable, *Response, error) { @@ -135,16 +136,16 @@ func (s *ActionsService) GetEnvVariable(ctx context.Context, owner, repo, env, v } func (s *ActionsService) postVariable(ctx context.Context, url string, variable *ActionsVariable) (*Response, error) { - req, err := s.client.NewRequest("POST", url, variable) + req, err := s.client.NewRequest(ctx, "POST", url, variable) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // CreateRepoVariable creates a repository variable. // -// GitHub API docs: https://docs.github.com/rest/actions/variables#create-a-repository-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#create-a-repository-variable // //meta:operation POST /repos/{owner}/{repo}/actions/variables func (s *ActionsService) CreateRepoVariable(ctx context.Context, owner, repo string, variable *ActionsVariable) (*Response, error) { @@ -154,7 +155,7 @@ func (s *ActionsService) CreateRepoVariable(ctx context.Context, owner, repo str // CreateOrgVariable creates an organization variable. // -// GitHub API docs: https://docs.github.com/rest/actions/variables#create-an-organization-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#create-an-organization-variable // //meta:operation POST /orgs/{org}/actions/variables func (s *ActionsService) CreateOrgVariable(ctx context.Context, org string, variable *ActionsVariable) (*Response, error) { @@ -164,7 +165,7 @@ func (s *ActionsService) CreateOrgVariable(ctx context.Context, org string, vari // CreateEnvVariable creates an environment variable. // -// GitHub API docs: https://docs.github.com/rest/actions/variables#create-an-environment-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#create-an-environment-variable // //meta:operation POST /repos/{owner}/{repo}/environments/{environment_name}/variables func (s *ActionsService) CreateEnvVariable(ctx context.Context, owner, repo, env string, variable *ActionsVariable) (*Response, error) { @@ -173,55 +174,67 @@ func (s *ActionsService) CreateEnvVariable(ctx context.Context, owner, repo, env } func (s *ActionsService) patchVariable(ctx context.Context, url string, variable *ActionsVariable) (*Response, error) { - req, err := s.client.NewRequest("PATCH", url, variable) + req, err := s.client.NewRequest(ctx, "PATCH", url, variable) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // UpdateRepoVariable updates a repository variable. // -// GitHub API docs: https://docs.github.com/rest/actions/variables#update-a-repository-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#update-a-repository-variable // //meta:operation PATCH /repos/{owner}/{repo}/actions/variables/{name} func (s *ActionsService) UpdateRepoVariable(ctx context.Context, owner, repo string, variable *ActionsVariable) (*Response, error) { + if variable == nil { + return nil, errors.New("variable must be provided") + } + url := fmt.Sprintf("repos/%v/%v/actions/variables/%v", owner, repo, variable.Name) return s.patchVariable(ctx, url, variable) } // UpdateOrgVariable updates an organization variable. // -// GitHub API docs: https://docs.github.com/rest/actions/variables#update-an-organization-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#update-an-organization-variable // //meta:operation PATCH /orgs/{org}/actions/variables/{name} func (s *ActionsService) UpdateOrgVariable(ctx context.Context, org string, variable *ActionsVariable) (*Response, error) { + if variable == nil { + return nil, errors.New("variable must be provided") + } + url := fmt.Sprintf("orgs/%v/actions/variables/%v", org, variable.Name) return s.patchVariable(ctx, url, variable) } // UpdateEnvVariable updates an environment variable. // -// GitHub API docs: https://docs.github.com/rest/actions/variables#update-an-environment-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#update-an-environment-variable // //meta:operation PATCH /repos/{owner}/{repo}/environments/{environment_name}/variables/{name} func (s *ActionsService) UpdateEnvVariable(ctx context.Context, owner, repo, env string, variable *ActionsVariable) (*Response, error) { + if variable == nil { + return nil, errors.New("variable must be provided") + } + url := fmt.Sprintf("repos/%v/%v/environments/%v/variables/%v", owner, repo, env, variable.Name) return s.patchVariable(ctx, url, variable) } func (s *ActionsService) deleteVariable(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest("DELETE", url, nil) + req, err := s.client.NewRequest(ctx, "DELETE", url, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DeleteRepoVariable deletes a variable in a repository. // -// GitHub API docs: https://docs.github.com/rest/actions/variables#delete-a-repository-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#delete-a-repository-variable // //meta:operation DELETE /repos/{owner}/{repo}/actions/variables/{name} func (s *ActionsService) DeleteRepoVariable(ctx context.Context, owner, repo, name string) (*Response, error) { @@ -231,7 +244,7 @@ func (s *ActionsService) DeleteRepoVariable(ctx context.Context, owner, repo, na // DeleteOrgVariable deletes a variable in an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/variables#delete-an-organization-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#delete-an-organization-variable // //meta:operation DELETE /orgs/{org}/actions/variables/{name} func (s *ActionsService) DeleteOrgVariable(ctx context.Context, org, name string) (*Response, error) { @@ -241,7 +254,7 @@ func (s *ActionsService) DeleteOrgVariable(ctx context.Context, org, name string // DeleteEnvVariable deletes a variable in an environment. // -// GitHub API docs: https://docs.github.com/rest/actions/variables#delete-an-environment-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#delete-an-environment-variable // //meta:operation DELETE /repos/{owner}/{repo}/environments/{environment_name}/variables/{name} func (s *ActionsService) DeleteEnvVariable(ctx context.Context, owner, repo, env, variableName string) (*Response, error) { @@ -255,13 +268,13 @@ func (s *ActionsService) listSelectedReposForVariable(ctx context.Context, url s return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - result := new(SelectedReposList) - resp, err := s.client.Do(ctx, req, result) + var result *SelectedReposList + resp, err := s.client.Do(req, &result) if err != nil { return nil, resp, err } @@ -271,7 +284,7 @@ func (s *ActionsService) listSelectedReposForVariable(ctx context.Context, url s // ListSelectedReposForOrgVariable lists all repositories that have access to a variable. // -// GitHub API docs: https://docs.github.com/rest/actions/variables#list-selected-repositories-for-an-organization-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#list-selected-repositories-for-an-organization-variable // //meta:operation GET /orgs/{org}/actions/variables/{name}/repositories func (s *ActionsService) ListSelectedReposForOrgVariable(ctx context.Context, org, name string, opts *ListOptions) (*SelectedReposList, *Response, error) { @@ -284,17 +297,17 @@ func (s *ActionsService) setSelectedReposForVariable(ctx context.Context, url st SelectedIDs SelectedRepoIDs `json:"selected_repository_ids"` } - req, err := s.client.NewRequest("PUT", url, repoIDs{SelectedIDs: ids}) + req, err := s.client.NewRequest(ctx, "PUT", url, repoIDs{SelectedIDs: ids}) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // SetSelectedReposForOrgVariable sets the repositories that have access to a variable. // -// GitHub API docs: https://docs.github.com/rest/actions/variables#set-selected-repositories-for-an-organization-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#set-selected-repositories-for-an-organization-variable // //meta:operation PUT /orgs/{org}/actions/variables/{name}/repositories func (s *ActionsService) SetSelectedReposForOrgVariable(ctx context.Context, org, name string, ids SelectedRepoIDs) (*Response, error) { @@ -303,39 +316,53 @@ func (s *ActionsService) SetSelectedReposForOrgVariable(ctx context.Context, org } func (s *ActionsService) addSelectedRepoToVariable(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest("PUT", url, nil) + req, err := s.client.NewRequest(ctx, "PUT", url, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // AddSelectedRepoToOrgVariable adds a repository to an organization variable. // -// GitHub API docs: https://docs.github.com/rest/actions/variables#add-selected-repository-to-an-organization-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#add-selected-repository-to-an-organization-variable // //meta:operation PUT /orgs/{org}/actions/variables/{name}/repositories/{repository_id} func (s *ActionsService) AddSelectedRepoToOrgVariable(ctx context.Context, org, name string, repo *Repository) (*Response, error) { + if repo == nil { + return nil, errors.New("repository must be provided") + } + if repo.ID == nil { + return nil, errors.New("id must be provided") + } + url := fmt.Sprintf("orgs/%v/actions/variables/%v/repositories/%v", org, name, *repo.ID) return s.addSelectedRepoToVariable(ctx, url) } func (s *ActionsService) removeSelectedRepoFromVariable(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest("DELETE", url, nil) + req, err := s.client.NewRequest(ctx, "DELETE", url, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RemoveSelectedRepoFromOrgVariable removes a repository from an organization variable. // -// GitHub API docs: https://docs.github.com/rest/actions/variables#remove-selected-repository-from-an-organization-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#remove-selected-repository-from-an-organization-variable // //meta:operation DELETE /orgs/{org}/actions/variables/{name}/repositories/{repository_id} func (s *ActionsService) RemoveSelectedRepoFromOrgVariable(ctx context.Context, org, name string, repo *Repository) (*Response, error) { + if repo == nil { + return nil, errors.New("repository must be provided") + } + if repo.ID == nil { + return nil, errors.New("id must be provided") + } + url := fmt.Sprintf("orgs/%v/actions/variables/%v/repositories/%v", org, name, *repo.ID) return s.removeSelectedRepoFromVariable(ctx, url) } diff --git a/vendor/github.com/google/go-github/v73/github/actions_workflow_jobs.go b/vendor/github.com/google/go-github/v88/github/actions_workflow_jobs.go similarity index 87% rename from vendor/github.com/google/go-github/v73/github/actions_workflow_jobs.go rename to vendor/github.com/google/go-github/v88/github/actions_workflow_jobs.go index 10067c8b2..9419cf897 100644 --- a/vendor/github.com/google/go-github/v73/github/actions_workflow_jobs.go +++ b/vendor/github.com/google/go-github/v88/github/actions_workflow_jobs.go @@ -70,23 +70,23 @@ type ListWorkflowJobsOptions struct { // ListWorkflowJobs lists all jobs for a workflow run. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-jobs?apiVersion=2022-11-28#list-jobs-for-a-workflow-run // //meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs func (s *ActionsService) ListWorkflowJobs(ctx context.Context, owner, repo string, runID int64, opts *ListWorkflowJobsOptions) (*Jobs, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/actions/runs/%v/jobs", owner, repo, runID) + u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/jobs", owner, repo, runID) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - jobs := new(Jobs) - resp, err := s.client.Do(ctx, req, &jobs) + var jobs *Jobs + resp, err := s.client.Do(req, &jobs) if err != nil { return nil, resp, err } @@ -96,23 +96,23 @@ func (s *ActionsService) ListWorkflowJobs(ctx context.Context, owner, repo strin // ListWorkflowJobsAttempt lists jobs for a workflow run Attempt. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run-attempt +// GitHub API docs: https://docs.github.com/rest/actions/workflow-jobs?apiVersion=2022-11-28#list-jobs-for-a-workflow-run-attempt // //meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs func (s *ActionsService) ListWorkflowJobsAttempt(ctx context.Context, owner, repo string, runID, attemptNumber int64, opts *ListOptions) (*Jobs, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/actions/runs/%v/attempts/%v/jobs", owner, repo, runID, attemptNumber) + u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/attempts/%v/jobs", owner, repo, runID, attemptNumber) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - jobs := new(Jobs) - resp, err := s.client.Do(ctx, req, &jobs) + var jobs *Jobs + resp, err := s.client.Do(req, &jobs) if err != nil { return nil, resp, err } @@ -122,19 +122,19 @@ func (s *ActionsService) ListWorkflowJobsAttempt(ctx context.Context, owner, rep // GetWorkflowJobByID gets a specific job in a workflow run by ID. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-jobs#get-a-job-for-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-jobs?apiVersion=2022-11-28#get-a-job-for-a-workflow-run // //meta:operation GET /repos/{owner}/{repo}/actions/jobs/{job_id} func (s *ActionsService) GetWorkflowJobByID(ctx context.Context, owner, repo string, jobID int64) (*WorkflowJob, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/jobs/%v", owner, repo, jobID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - job := new(WorkflowJob) - resp, err := s.client.Do(ctx, req, job) + var job *WorkflowJob + resp, err := s.client.Do(req, &job) if err != nil { return nil, resp, err } @@ -144,13 +144,13 @@ func (s *ActionsService) GetWorkflowJobByID(ctx context.Context, owner, repo str // GetWorkflowJobLogs gets a redirect URL to download a plain text file of logs for a workflow job. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-jobs#download-job-logs-for-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-jobs?apiVersion=2022-11-28#download-job-logs-for-a-workflow-run // //meta:operation GET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs func (s *ActionsService) GetWorkflowJobLogs(ctx context.Context, owner, repo string, jobID int64, maxRedirects int) (*url.URL, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/jobs/%v/logs", owner, repo, jobID) - if s.client.RateLimitRedirectionalEndpoints { + if s.client.rateLimitRedirectionalEndpoints { return s.getWorkflowJobLogsWithRateLimit(ctx, u, maxRedirects) } @@ -173,12 +173,12 @@ func (s *ActionsService) getWorkflowJobLogsWithoutRateLimit(ctx context.Context, } func (s *ActionsService) getWorkflowJobLogsWithRateLimit(ctx context.Context, u string, maxRedirects int) (*url.URL, *Response, error) { - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - url, resp, err := s.client.bareDoUntilFound(ctx, req, maxRedirects) + url, resp, err := s.client.bareDoUntilFound(req, maxRedirects) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/actions_workflow_runs.go b/vendor/github.com/google/go-github/v88/github/actions_workflow_runs.go similarity index 86% rename from vendor/github.com/google/go-github/v73/github/actions_workflow_runs.go rename to vendor/github.com/google/go-github/v88/github/actions_workflow_runs.go index 20b9cfcd5..6e46328df 100644 --- a/vendor/github.com/google/go-github/v73/github/actions_workflow_runs.go +++ b/vendor/github.com/google/go-github/v88/github/actions_workflow_runs.go @@ -106,6 +106,7 @@ type PendingDeploymentsRequest struct { Comment string `json:"comment"` } +// ReferencedWorkflow represents a referenced workflow in a workflow run. type ReferencedWorkflow struct { Path *string `json:"path,omitempty"` SHA *string `json:"sha,omitempty"` @@ -143,13 +144,13 @@ func (s *ActionsService) listWorkflowRuns(ctx context.Context, endpoint string, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runs := new(WorkflowRuns) - resp, err := s.client.Do(ctx, req, &runs) + var runs *WorkflowRuns + resp, err := s.client.Do(req, &runs) if err != nil { return nil, resp, err } @@ -159,43 +160,43 @@ func (s *ActionsService) listWorkflowRuns(ctx context.Context, endpoint string, // ListWorkflowRunsByID lists all workflow runs by workflow ID. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-workflow +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-workflow // //meta:operation GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs func (s *ActionsService) ListWorkflowRunsByID(ctx context.Context, owner, repo string, workflowID int64, opts *ListWorkflowRunsOptions) (*WorkflowRuns, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/actions/workflows/%v/runs", owner, repo, workflowID) + u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/runs", owner, repo, workflowID) return s.listWorkflowRuns(ctx, u, opts) } // ListWorkflowRunsByFileName lists all workflow runs by workflow file name. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-workflow +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-workflow // //meta:operation GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs func (s *ActionsService) ListWorkflowRunsByFileName(ctx context.Context, owner, repo, workflowFileName string, opts *ListWorkflowRunsOptions) (*WorkflowRuns, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/actions/workflows/%v/runs", owner, repo, workflowFileName) + u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/runs", owner, repo, workflowFileName) return s.listWorkflowRuns(ctx, u, opts) } // ListRepositoryWorkflowRuns lists all workflow runs for a repository. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/actions/runs func (s *ActionsService) ListRepositoryWorkflowRuns(ctx context.Context, owner, repo string, opts *ListWorkflowRunsOptions) (*WorkflowRuns, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/actions/runs", owner, repo) + u := fmt.Sprintf("repos/%v/%v/actions/runs", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runs := new(WorkflowRuns) - resp, err := s.client.Do(ctx, req, &runs) + var runs *WorkflowRuns + resp, err := s.client.Do(req, &runs) if err != nil { return nil, resp, err } @@ -206,19 +207,19 @@ func (s *ActionsService) ListRepositoryWorkflowRuns(ctx context.Context, owner, // GetWorkflowRunByID gets a specific workflow run by ID. // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID from a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#get-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#get-a-workflow-run // //meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id} func (s *ActionsService) GetWorkflowRunByID(ctx context.Context, owner, repo string, runID int64) (*WorkflowRun, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v", owner, repo, runID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - run := new(WorkflowRun) - resp, err := s.client.Do(ctx, req, run) + var run *WorkflowRun + resp, err := s.client.Do(req, &run) if err != nil { return nil, resp, err } @@ -229,7 +230,7 @@ func (s *ActionsService) GetWorkflowRunByID(ctx context.Context, owner, repo str // GetWorkflowRunAttempt gets a specific workflow run attempt. // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID from a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#get-a-workflow-run-attempt +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#get-a-workflow-run-attempt // //meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number} func (s *ActionsService) GetWorkflowRunAttempt(ctx context.Context, owner, repo string, runID int64, attemptNumber int, opts *WorkflowRunAttemptOptions) (*WorkflowRun, *Response, error) { @@ -239,13 +240,13 @@ func (s *ActionsService) GetWorkflowRunAttempt(ctx context.Context, owner, repo return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - run := new(WorkflowRun) - resp, err := s.client.Do(ctx, req, run) + var run *WorkflowRun + resp, err := s.client.Do(req, &run) if err != nil { return nil, resp, err } @@ -256,13 +257,13 @@ func (s *ActionsService) GetWorkflowRunAttempt(ctx context.Context, owner, repo // GetWorkflowRunAttemptLogs gets a redirect URL to download a plain text file of logs for a workflow run for attempt number. // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve a workflow run ID from the DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#download-workflow-run-attempt-logs +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#download-workflow-run-attempt-logs // //meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/logs -func (s *ActionsService) GetWorkflowRunAttemptLogs(ctx context.Context, owner, repo string, runID int64, attemptNumber int, maxRedirects int) (*url.URL, *Response, error) { +func (s *ActionsService) GetWorkflowRunAttemptLogs(ctx context.Context, owner, repo string, runID int64, attemptNumber, maxRedirects int) (*url.URL, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/attempts/%v/logs", owner, repo, runID, attemptNumber) - if s.client.RateLimitRedirectionalEndpoints { + if s.client.rateLimitRedirectionalEndpoints { return s.getWorkflowRunAttemptLogsWithRateLimit(ctx, u, maxRedirects) } @@ -285,12 +286,12 @@ func (s *ActionsService) getWorkflowRunAttemptLogsWithoutRateLimit(ctx context.C } func (s *ActionsService) getWorkflowRunAttemptLogsWithRateLimit(ctx context.Context, u string, maxRedirects int) (*url.URL, *Response, error) { - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - url, resp, err := s.client.bareDoUntilFound(ctx, req, maxRedirects) + url, resp, err := s.client.bareDoUntilFound(req, maxRedirects) if err != nil { return nil, resp, err } @@ -305,84 +306,84 @@ func (s *ActionsService) getWorkflowRunAttemptLogsWithRateLimit(ctx context.Cont } // RerunWorkflowByID re-runs a workflow by ID. -// You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID a the DeploymentProtectionRuleEvent. +// You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID of a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#re-run-a-workflow +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#re-run-a-workflow // //meta:operation POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun func (s *ActionsService) RerunWorkflowByID(ctx context.Context, owner, repo string, runID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/rerun", owner, repo, runID) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RerunFailedJobsByID re-runs all of the failed jobs and their dependent jobs in a workflow run by ID. // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID from a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#re-run-failed-jobs-from-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#re-run-failed-jobs-from-a-workflow-run // //meta:operation POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun-failed-jobs func (s *ActionsService) RerunFailedJobsByID(ctx context.Context, owner, repo string, runID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/rerun-failed-jobs", owner, repo, runID) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RerunJobByID re-runs a job and its dependent jobs in a workflow run by ID. // // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID from a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#re-run-a-job-from-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#re-run-a-job-from-a-workflow-run // //meta:operation POST /repos/{owner}/{repo}/actions/jobs/{job_id}/rerun func (s *ActionsService) RerunJobByID(ctx context.Context, owner, repo string, jobID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/jobs/%v/rerun", owner, repo, jobID) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // CancelWorkflowRunByID cancels a workflow run by ID. // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID from a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#cancel-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#cancel-a-workflow-run // //meta:operation POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel func (s *ActionsService) CancelWorkflowRunByID(ctx context.Context, owner, repo string, runID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/cancel", owner, repo, runID) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // GetWorkflowRunLogs gets a redirect URL to download a plain text file of logs for a workflow run. // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID from a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#download-workflow-run-logs +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#download-workflow-run-logs // //meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/logs func (s *ActionsService) GetWorkflowRunLogs(ctx context.Context, owner, repo string, runID int64, maxRedirects int) (*url.URL, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/logs", owner, repo, runID) - if s.client.RateLimitRedirectionalEndpoints { + if s.client.rateLimitRedirectionalEndpoints { return s.getWorkflowRunLogsWithRateLimit(ctx, u, maxRedirects) } @@ -397,7 +398,7 @@ func (s *ActionsService) getWorkflowRunLogsWithoutRateLimit(ctx context.Context, defer resp.Body.Close() if resp.StatusCode != http.StatusFound { - return nil, newResponse(resp), fmt.Errorf("unexpected status code: %s", resp.Status) + return nil, newResponse(resp), fmt.Errorf("unexpected status code: %v", resp.Status) } parsedURL, err := url.Parse(resp.Header.Get("Location")) @@ -405,12 +406,12 @@ func (s *ActionsService) getWorkflowRunLogsWithoutRateLimit(ctx context.Context, } func (s *ActionsService) getWorkflowRunLogsWithRateLimit(ctx context.Context, u string, maxRedirects int) (*url.URL, *Response, error) { - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - url, resp, err := s.client.bareDoUntilFound(ctx, req, maxRedirects) + url, resp, err := s.client.bareDoUntilFound(req, maxRedirects) if err != nil { return nil, resp, err } @@ -427,53 +428,53 @@ func (s *ActionsService) getWorkflowRunLogsWithRateLimit(ctx context.Context, u // DeleteWorkflowRun deletes a workflow run by ID. // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID from a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#delete-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#delete-a-workflow-run // //meta:operation DELETE /repos/{owner}/{repo}/actions/runs/{run_id} func (s *ActionsService) DeleteWorkflowRun(ctx context.Context, owner, repo string, runID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v", owner, repo, runID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DeleteWorkflowRunLogs deletes all logs for a workflow run. // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID from a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#delete-workflow-run-logs +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#delete-workflow-run-logs // //meta:operation DELETE /repos/{owner}/{repo}/actions/runs/{run_id}/logs func (s *ActionsService) DeleteWorkflowRunLogs(ctx context.Context, owner, repo string, runID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/logs", owner, repo, runID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // GetWorkflowRunUsageByID gets a specific workflow usage run by run ID in the unit of billable milliseconds. // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID from a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#get-workflow-run-usage +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#get-workflow-run-usage // //meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/timing func (s *ActionsService) GetWorkflowRunUsageByID(ctx context.Context, owner, repo string, runID int64) (*WorkflowRunUsage, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/timing", owner, repo, runID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - workflowRunUsage := new(WorkflowRunUsage) - resp, err := s.client.Do(ctx, req, workflowRunUsage) + var workflowRunUsage *WorkflowRunUsage + resp, err := s.client.Do(req, &workflowRunUsage) if err != nil { return nil, resp, err } @@ -484,19 +485,19 @@ func (s *ActionsService) GetWorkflowRunUsageByID(ctx context.Context, owner, rep // GetPendingDeployments get all deployment environments for a workflow run that are waiting for protection rules to pass. // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID from a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#get-pending-deployments-for-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#get-pending-deployments-for-a-workflow-run // //meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments func (s *ActionsService) GetPendingDeployments(ctx context.Context, owner, repo string, runID int64) ([]*PendingDeployment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/pending_deployments", owner, repo, runID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var deployments []*PendingDeployment - resp, err := s.client.Do(ctx, req, &deployments) + resp, err := s.client.Do(req, &deployments) if err != nil { return nil, resp, err } @@ -507,19 +508,19 @@ func (s *ActionsService) GetPendingDeployments(ctx context.Context, owner, repo // PendingDeployments approve or reject pending deployments that are waiting on approval by a required reviewer. // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID from a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#review-pending-deployments-for-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#review-pending-deployments-for-a-workflow-run // //meta:operation POST /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments func (s *ActionsService) PendingDeployments(ctx context.Context, owner, repo string, runID int64, request *PendingDeploymentsRequest) ([]*Deployment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/pending_deployments", owner, repo, runID) - req, err := s.client.NewRequest("POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, request) if err != nil { return nil, nil, err } var deployments []*Deployment - resp, err := s.client.Do(ctx, req, &deployments) + resp, err := s.client.Do(req, &deployments) if err != nil { return nil, resp, err } @@ -530,17 +531,17 @@ func (s *ActionsService) PendingDeployments(ctx context.Context, owner, repo str // ReviewCustomDeploymentProtectionRule approves or rejects custom deployment protection rules provided by a GitHub App for a workflow run. // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID from a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#review-custom-deployment-protection-rules-for-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#review-custom-deployment-protection-rules-for-a-workflow-run // //meta:operation POST /repos/{owner}/{repo}/actions/runs/{run_id}/deployment_protection_rule func (s *ActionsService) ReviewCustomDeploymentProtectionRule(ctx context.Context, owner, repo string, runID int64, request *ReviewCustomDeploymentProtectionRuleRequest) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/deployment_protection_rule", owner, repo, runID) - req, err := s.client.NewRequest("POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, request) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) return resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/actions_workflows.go b/vendor/github.com/google/go-github/v88/github/actions_workflows.go similarity index 70% rename from vendor/github.com/google/go-github/v73/github/actions_workflows.go rename to vendor/github.com/google/go-github/v88/github/actions_workflows.go index 4d9df69eb..bcd79c5e2 100644 --- a/vendor/github.com/google/go-github/v73/github/actions_workflows.go +++ b/vendor/github.com/google/go-github/v88/github/actions_workflows.go @@ -51,30 +51,71 @@ type CreateWorkflowDispatchEventRequest struct { // Ref is required when creating a workflow dispatch event. Ref string `json:"ref"` // Inputs represents input keys and values configured in the workflow file. - // The maximum number of properties is 10. + // The maximum number of properties is 25. // Default: Any default properties configured in the workflow file will be used when `inputs` are omitted. Inputs map[string]any `json:"inputs,omitempty"` + // ReturnRunDetails specifies whether the response should include + // the workflow run ID and URLs. + ReturnRunDetails *bool `json:"return_run_details,omitempty"` +} + +// WorkflowDispatchRunDetails represents the response from creating +// a workflow dispatch event when ReturnRunDetails is set to true. +type WorkflowDispatchRunDetails struct { + WorkflowRunID *int64 `json:"workflow_run_id,omitempty"` + RunURL *string `json:"run_url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` +} + +// WorkflowsPermissions represents the permissions for workflows in a repository. +type WorkflowsPermissions struct { + RunWorkflowsFromForkPullRequests *bool `json:"run_workflows_from_fork_pull_requests,omitempty"` + SendWriteTokensToWorkflows *bool `json:"send_write_tokens_to_workflows,omitempty"` + SendSecretsAndVariables *bool `json:"send_secrets_and_variables,omitempty"` + RequireApprovalForForkPRWorkflows *bool `json:"require_approval_for_fork_pr_workflows,omitempty"` +} + +func (w WorkflowsPermissions) String() string { + return Stringify(w) +} + +// WorkflowsPermissionsOpt specifies options for editing workflows permissions in a repository. +type WorkflowsPermissionsOpt struct { + RunWorkflowsFromForkPullRequests bool `json:"run_workflows_from_fork_pull_requests"` + SendWriteTokensToWorkflows *bool `json:"send_write_tokens_to_workflows,omitempty"` + SendSecretsAndVariables *bool `json:"send_secrets_and_variables,omitempty"` + RequireApprovalForForkPRWorkflows *bool `json:"require_approval_for_fork_pr_workflows,omitempty"` +} + +// ContributorApprovalPermissions represents the policy that controls +// when fork PR workflows require approval from a maintainer. +type ContributorApprovalPermissions struct { + ApprovalPolicy string `json:"approval_policy"` +} + +func (p ContributorApprovalPermissions) String() string { + return Stringify(p) } // ListWorkflows lists all workflows in a repository. // -// GitHub API docs: https://docs.github.com/rest/actions/workflows#list-repository-workflows +// GitHub API docs: https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#list-repository-workflows // //meta:operation GET /repos/{owner}/{repo}/actions/workflows func (s *ActionsService) ListWorkflows(ctx context.Context, owner, repo string, opts *ListOptions) (*Workflows, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/actions/workflows", owner, repo) + u := fmt.Sprintf("repos/%v/%v/actions/workflows", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - workflows := new(Workflows) - resp, err := s.client.Do(ctx, req, &workflows) + var workflows *Workflows + resp, err := s.client.Do(req, &workflows) if err != nil { return nil, resp, err } @@ -84,7 +125,7 @@ func (s *ActionsService) ListWorkflows(ctx context.Context, owner, repo string, // GetWorkflowByID gets a specific workflow by ID. // -// GitHub API docs: https://docs.github.com/rest/actions/workflows#get-a-workflow +// GitHub API docs: https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#get-a-workflow // //meta:operation GET /repos/{owner}/{repo}/actions/workflows/{workflow_id} func (s *ActionsService) GetWorkflowByID(ctx context.Context, owner, repo string, workflowID int64) (*Workflow, *Response, error) { @@ -95,7 +136,7 @@ func (s *ActionsService) GetWorkflowByID(ctx context.Context, owner, repo string // GetWorkflowByFileName gets a specific workflow by file name. // -// GitHub API docs: https://docs.github.com/rest/actions/workflows#get-a-workflow +// GitHub API docs: https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#get-a-workflow // //meta:operation GET /repos/{owner}/{repo}/actions/workflows/{workflow_id} func (s *ActionsService) GetWorkflowByFileName(ctx context.Context, owner, repo, workflowFileName string) (*Workflow, *Response, error) { @@ -105,13 +146,13 @@ func (s *ActionsService) GetWorkflowByFileName(ctx context.Context, owner, repo, } func (s *ActionsService) getWorkflow(ctx context.Context, url string) (*Workflow, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } - workflow := new(Workflow) - resp, err := s.client.Do(ctx, req, workflow) + var workflow *Workflow + resp, err := s.client.Do(req, &workflow) if err != nil { return nil, resp, err } @@ -121,7 +162,7 @@ func (s *ActionsService) getWorkflow(ctx context.Context, url string) (*Workflow // GetWorkflowUsageByID gets a specific workflow usage by ID in the unit of billable milliseconds. // -// GitHub API docs: https://docs.github.com/rest/actions/workflows#get-workflow-usage +// GitHub API docs: https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#get-workflow-usage // //meta:operation GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/timing func (s *ActionsService) GetWorkflowUsageByID(ctx context.Context, owner, repo string, workflowID int64) (*WorkflowUsage, *Response, error) { @@ -132,7 +173,7 @@ func (s *ActionsService) GetWorkflowUsageByID(ctx context.Context, owner, repo s // GetWorkflowUsageByFileName gets a specific workflow usage by file name in the unit of billable milliseconds. // -// GitHub API docs: https://docs.github.com/rest/actions/workflows#get-workflow-usage +// GitHub API docs: https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#get-workflow-usage // //meta:operation GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/timing func (s *ActionsService) GetWorkflowUsageByFileName(ctx context.Context, owner, repo, workflowFileName string) (*WorkflowUsage, *Response, error) { @@ -142,13 +183,13 @@ func (s *ActionsService) GetWorkflowUsageByFileName(ctx context.Context, owner, } func (s *ActionsService) getWorkflowUsage(ctx context.Context, url string) (*WorkflowUsage, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } - workflowUsage := new(WorkflowUsage) - resp, err := s.client.Do(ctx, req, workflowUsage) + var workflowUsage *WorkflowUsage + resp, err := s.client.Do(req, &workflowUsage) if err != nil { return nil, resp, err } @@ -158,10 +199,10 @@ func (s *ActionsService) getWorkflowUsage(ctx context.Context, url string) (*Wor // CreateWorkflowDispatchEventByID manually triggers a GitHub Actions workflow run. // -// GitHub API docs: https://docs.github.com/rest/actions/workflows#create-a-workflow-dispatch-event +// GitHub API docs: https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event // //meta:operation POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches -func (s *ActionsService) CreateWorkflowDispatchEventByID(ctx context.Context, owner, repo string, workflowID int64, event CreateWorkflowDispatchEventRequest) (*Response, error) { +func (s *ActionsService) CreateWorkflowDispatchEventByID(ctx context.Context, owner, repo string, workflowID int64, event CreateWorkflowDispatchEventRequest) (*WorkflowDispatchRunDetails, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/dispatches", owner, repo, workflowID) return s.createWorkflowDispatchEvent(ctx, u, &event) @@ -169,27 +210,33 @@ func (s *ActionsService) CreateWorkflowDispatchEventByID(ctx context.Context, ow // CreateWorkflowDispatchEventByFileName manually triggers a GitHub Actions workflow run. // -// GitHub API docs: https://docs.github.com/rest/actions/workflows#create-a-workflow-dispatch-event +// GitHub API docs: https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event // //meta:operation POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches -func (s *ActionsService) CreateWorkflowDispatchEventByFileName(ctx context.Context, owner, repo, workflowFileName string, event CreateWorkflowDispatchEventRequest) (*Response, error) { +func (s *ActionsService) CreateWorkflowDispatchEventByFileName(ctx context.Context, owner, repo, workflowFileName string, event CreateWorkflowDispatchEventRequest) (*WorkflowDispatchRunDetails, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/dispatches", owner, repo, workflowFileName) return s.createWorkflowDispatchEvent(ctx, u, &event) } -func (s *ActionsService) createWorkflowDispatchEvent(ctx context.Context, url string, event *CreateWorkflowDispatchEventRequest) (*Response, error) { - req, err := s.client.NewRequest("POST", url, event) +func (s *ActionsService) createWorkflowDispatchEvent(ctx context.Context, url string, event *CreateWorkflowDispatchEventRequest) (*WorkflowDispatchRunDetails, *Response, error) { + req, err := s.client.NewRequest(ctx, "POST", url, event) if err != nil { - return nil, err + return nil, nil, err + } + + var dispatchRunDetails *WorkflowDispatchRunDetails + resp, err := s.client.Do(req, &dispatchRunDetails) + if err != nil { + return nil, resp, err } - return s.client.Do(ctx, req, nil) + return dispatchRunDetails, resp, nil } // EnableWorkflowByID enables a workflow and sets the state of the workflow to "active". // -// GitHub API docs: https://docs.github.com/rest/actions/workflows#enable-a-workflow +// GitHub API docs: https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#enable-a-workflow // //meta:operation PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable func (s *ActionsService) EnableWorkflowByID(ctx context.Context, owner, repo string, workflowID int64) (*Response, error) { @@ -199,7 +246,7 @@ func (s *ActionsService) EnableWorkflowByID(ctx context.Context, owner, repo str // EnableWorkflowByFileName enables a workflow and sets the state of the workflow to "active". // -// GitHub API docs: https://docs.github.com/rest/actions/workflows#enable-a-workflow +// GitHub API docs: https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#enable-a-workflow // //meta:operation PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable func (s *ActionsService) EnableWorkflowByFileName(ctx context.Context, owner, repo, workflowFileName string) (*Response, error) { @@ -209,7 +256,7 @@ func (s *ActionsService) EnableWorkflowByFileName(ctx context.Context, owner, re // DisableWorkflowByID disables a workflow and sets the state of the workflow to "disabled_manually". // -// GitHub API docs: https://docs.github.com/rest/actions/workflows#disable-a-workflow +// GitHub API docs: https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#disable-a-workflow // //meta:operation PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable func (s *ActionsService) DisableWorkflowByID(ctx context.Context, owner, repo string, workflowID int64) (*Response, error) { @@ -219,7 +266,7 @@ func (s *ActionsService) DisableWorkflowByID(ctx context.Context, owner, repo st // DisableWorkflowByFileName disables a workflow and sets the state of the workflow to "disabled_manually". // -// GitHub API docs: https://docs.github.com/rest/actions/workflows#disable-a-workflow +// GitHub API docs: https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#disable-a-workflow // //meta:operation PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable func (s *ActionsService) DisableWorkflowByFileName(ctx context.Context, owner, repo, workflowFileName string) (*Response, error) { @@ -228,10 +275,10 @@ func (s *ActionsService) DisableWorkflowByFileName(ctx context.Context, owner, r } func (s *ActionsService) doNewPutRequest(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest("PUT", url, nil) + req, err := s.client.NewRequest(ctx, "PUT", url, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/activity.go b/vendor/github.com/google/go-github/v88/github/activity.go similarity index 90% rename from vendor/github.com/google/go-github/v73/github/activity.go rename to vendor/github.com/google/go-github/v88/github/activity.go index edf8cc439..f69bd3826 100644 --- a/vendor/github.com/google/go-github/v73/github/activity.go +++ b/vendor/github.com/google/go-github/v88/github/activity.go @@ -10,7 +10,7 @@ import "context" // ActivityService handles communication with the activity related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/activity/ +// GitHub API docs: https://docs.github.com/rest/activity?apiVersion=2022-11-28 type ActivityService service // FeedLink represents a link to a related resource. @@ -58,17 +58,17 @@ type FeedLinks struct { // Note: Private feeds are only returned when authenticating via Basic Auth // since current feed URIs use the older, non revocable auth tokens. // -// GitHub API docs: https://docs.github.com/rest/activity/feeds#get-feeds +// GitHub API docs: https://docs.github.com/rest/activity/feeds?apiVersion=2022-11-28#get-feeds // //meta:operation GET /feeds func (s *ActivityService) ListFeeds(ctx context.Context) (*Feeds, *Response, error) { - req, err := s.client.NewRequest("GET", "feeds", nil) + req, err := s.client.NewRequest(ctx, "GET", "feeds", nil) if err != nil { return nil, nil, err } - f := &Feeds{} - resp, err := s.client.Do(ctx, req, f) + var f *Feeds + resp, err := s.client.Do(req, &f) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/activity_events.go b/vendor/github.com/google/go-github/v88/github/activity_events.go similarity index 79% rename from vendor/github.com/google/go-github/v73/github/activity_events.go rename to vendor/github.com/google/go-github/v88/github/activity_events.go index b12baa99e..83635fbb7 100644 --- a/vendor/github.com/google/go-github/v73/github/activity_events.go +++ b/vendor/github.com/google/go-github/v88/github/activity_events.go @@ -12,7 +12,7 @@ import ( // ListEvents drinks from the firehose of all public events across GitHub. // -// GitHub API docs: https://docs.github.com/rest/activity/events#list-public-events +// GitHub API docs: https://docs.github.com/rest/activity/events?apiVersion=2022-11-28#list-public-events // //meta:operation GET /events func (s *ActivityService) ListEvents(ctx context.Context, opts *ListOptions) ([]*Event, *Response, error) { @@ -21,13 +21,13 @@ func (s *ActivityService) ListEvents(ctx context.Context, opts *ListOptions) ([] return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var events []*Event - resp, err := s.client.Do(ctx, req, &events) + resp, err := s.client.Do(req, &events) if err != nil { return nil, resp, err } @@ -37,7 +37,7 @@ func (s *ActivityService) ListEvents(ctx context.Context, opts *ListOptions) ([] // ListRepositoryEvents lists events for a repository. // -// GitHub API docs: https://docs.github.com/rest/activity/events#list-repository-events +// GitHub API docs: https://docs.github.com/rest/activity/events?apiVersion=2022-11-28#list-repository-events // //meta:operation GET /repos/{owner}/{repo}/events func (s *ActivityService) ListRepositoryEvents(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Event, *Response, error) { @@ -47,13 +47,13 @@ func (s *ActivityService) ListRepositoryEvents(ctx context.Context, owner, repo return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var events []*Event - resp, err := s.client.Do(ctx, req, &events) + resp, err := s.client.Do(req, &events) if err != nil { return nil, resp, err } @@ -63,7 +63,7 @@ func (s *ActivityService) ListRepositoryEvents(ctx context.Context, owner, repo // ListIssueEventsForRepository lists issue events for a repository. // -// GitHub API docs: https://docs.github.com/rest/issues/events#list-issue-events-for-a-repository +// GitHub API docs: https://docs.github.com/rest/issues/events?apiVersion=2022-11-28#list-issue-events-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/issues/events func (s *ActivityService) ListIssueEventsForRepository(ctx context.Context, owner, repo string, opts *ListOptions) ([]*IssueEvent, *Response, error) { @@ -73,13 +73,13 @@ func (s *ActivityService) ListIssueEventsForRepository(ctx context.Context, owne return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var events []*IssueEvent - resp, err := s.client.Do(ctx, req, &events) + resp, err := s.client.Do(req, &events) if err != nil { return nil, resp, err } @@ -89,7 +89,7 @@ func (s *ActivityService) ListIssueEventsForRepository(ctx context.Context, owne // ListEventsForRepoNetwork lists public events for a network of repositories. // -// GitHub API docs: https://docs.github.com/rest/activity/events#list-public-events-for-a-network-of-repositories +// GitHub API docs: https://docs.github.com/rest/activity/events?apiVersion=2022-11-28#list-public-events-for-a-network-of-repositories // //meta:operation GET /networks/{owner}/{repo}/events func (s *ActivityService) ListEventsForRepoNetwork(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Event, *Response, error) { @@ -99,13 +99,13 @@ func (s *ActivityService) ListEventsForRepoNetwork(ctx context.Context, owner, r return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var events []*Event - resp, err := s.client.Do(ctx, req, &events) + resp, err := s.client.Do(req, &events) if err != nil { return nil, resp, err } @@ -115,7 +115,7 @@ func (s *ActivityService) ListEventsForRepoNetwork(ctx context.Context, owner, r // ListEventsForOrganization lists public events for an organization. // -// GitHub API docs: https://docs.github.com/rest/activity/events#list-public-organization-events +// GitHub API docs: https://docs.github.com/rest/activity/events?apiVersion=2022-11-28#list-public-organization-events // //meta:operation GET /orgs/{org}/events func (s *ActivityService) ListEventsForOrganization(ctx context.Context, org string, opts *ListOptions) ([]*Event, *Response, error) { @@ -125,13 +125,13 @@ func (s *ActivityService) ListEventsForOrganization(ctx context.Context, org str return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var events []*Event - resp, err := s.client.Do(ctx, req, &events) + resp, err := s.client.Do(req, &events) if err != nil { return nil, resp, err } @@ -142,8 +142,9 @@ func (s *ActivityService) ListEventsForOrganization(ctx context.Context, org str // ListEventsPerformedByUser lists the events performed by a user. If publicOnly is // true, only public events will be returned. // -// GitHub API docs: https://docs.github.com/rest/activity/events#list-events-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/rest/activity/events#list-public-events-for-a-user +// GitHub API docs: https://docs.github.com/rest/activity/events?apiVersion=2022-11-28#list-events-for-the-authenticated-user +// +// GitHub API docs: https://docs.github.com/rest/activity/events?apiVersion=2022-11-28#list-public-events-for-a-user // //meta:operation GET /users/{username}/events //meta:operation GET /users/{username}/events/public @@ -159,13 +160,13 @@ func (s *ActivityService) ListEventsPerformedByUser(ctx context.Context, user st return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var events []*Event - resp, err := s.client.Do(ctx, req, &events) + resp, err := s.client.Do(req, &events) if err != nil { return nil, resp, err } @@ -176,8 +177,9 @@ func (s *ActivityService) ListEventsPerformedByUser(ctx context.Context, user st // ListEventsReceivedByUser lists the events received by a user. If publicOnly is // true, only public events will be returned. // -// GitHub API docs: https://docs.github.com/rest/activity/events#list-events-received-by-the-authenticated-user -// GitHub API docs: https://docs.github.com/rest/activity/events#list-public-events-received-by-a-user +// GitHub API docs: https://docs.github.com/rest/activity/events?apiVersion=2022-11-28#list-events-received-by-the-authenticated-user +// +// GitHub API docs: https://docs.github.com/rest/activity/events?apiVersion=2022-11-28#list-public-events-received-by-a-user // //meta:operation GET /users/{username}/received_events //meta:operation GET /users/{username}/received_events/public @@ -193,13 +195,13 @@ func (s *ActivityService) ListEventsReceivedByUser(ctx context.Context, user str return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var events []*Event - resp, err := s.client.Do(ctx, req, &events) + resp, err := s.client.Do(req, &events) if err != nil { return nil, resp, err } @@ -210,7 +212,7 @@ func (s *ActivityService) ListEventsReceivedByUser(ctx context.Context, user str // ListUserEventsForOrganization provides the user’s organization dashboard. You // must be authenticated as the user to view this. // -// GitHub API docs: https://docs.github.com/rest/activity/events#list-organization-events-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/events?apiVersion=2022-11-28#list-organization-events-for-the-authenticated-user // //meta:operation GET /users/{username}/events/orgs/{org} func (s *ActivityService) ListUserEventsForOrganization(ctx context.Context, org, user string, opts *ListOptions) ([]*Event, *Response, error) { @@ -220,13 +222,13 @@ func (s *ActivityService) ListUserEventsForOrganization(ctx context.Context, org return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var events []*Event - resp, err := s.client.Do(ctx, req, &events) + resp, err := s.client.Do(req, &events) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/activity_notifications.go b/vendor/github.com/google/go-github/v88/github/activity_notifications.go similarity index 76% rename from vendor/github.com/google/go-github/v73/github/activity_notifications.go rename to vendor/github.com/google/go-github/v88/github/activity_notifications.go index e712323ed..95e6cf3d8 100644 --- a/vendor/github.com/google/go-github/v73/github/activity_notifications.go +++ b/vendor/github.com/google/go-github/v88/github/activity_notifications.go @@ -19,7 +19,7 @@ type Notification struct { // Reason identifies the event that triggered the notification. // - // GitHub API docs: https://docs.github.com/rest/activity#notification-reasons + // GitHub API docs: https://docs.github.com/rest/activity/notifications?apiVersion=2022-11-28#notification-reasons Reason *string `json:"reason,omitempty"` Unread *bool `json:"unread,omitempty"` @@ -49,7 +49,7 @@ type NotificationListOptions struct { // ListNotifications lists all notifications for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/activity/notifications#list-notifications-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/notifications?apiVersion=2022-11-28#list-notifications-for-the-authenticated-user // //meta:operation GET /notifications func (s *ActivityService) ListNotifications(ctx context.Context, opts *NotificationListOptions) ([]*Notification, *Response, error) { @@ -59,13 +59,13 @@ func (s *ActivityService) ListNotifications(ctx context.Context, opts *Notificat return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var notifications []*Notification - resp, err := s.client.Do(ctx, req, ¬ifications) + resp, err := s.client.Do(req, ¬ifications) if err != nil { return nil, resp, err } @@ -76,7 +76,7 @@ func (s *ActivityService) ListNotifications(ctx context.Context, opts *Notificat // ListRepositoryNotifications lists all notifications in a given repository // for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/activity/notifications#list-repository-notifications-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/notifications?apiVersion=2022-11-28#list-repository-notifications-for-the-authenticated-user // //meta:operation GET /repos/{owner}/{repo}/notifications func (s *ActivityService) ListRepositoryNotifications(ctx context.Context, owner, repo string, opts *NotificationListOptions) ([]*Notification, *Response, error) { @@ -86,13 +86,13 @@ func (s *ActivityService) ListRepositoryNotifications(ctx context.Context, owner return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var notifications []*Notification - resp, err := s.client.Do(ctx, req, ¬ifications) + resp, err := s.client.Do(req, ¬ifications) if err != nil { return nil, resp, err } @@ -101,30 +101,32 @@ func (s *ActivityService) ListRepositoryNotifications(ctx context.Context, owner } type markReadOptions struct { - LastReadAt Timestamp `json:"last_read_at,omitempty"` + LastReadAt Timestamp `json:"last_read_at,omitzero"` } // MarkNotificationsRead marks all notifications up to lastRead as read. +// If lastRead is the zero value, all notifications in the repository are marked as read. // -// GitHub API docs: https://docs.github.com/rest/activity/notifications#mark-notifications-as-read +// GitHub API docs: https://docs.github.com/rest/activity/notifications?apiVersion=2022-11-28#mark-notifications-as-read // //meta:operation PUT /notifications func (s *ActivityService) MarkNotificationsRead(ctx context.Context, lastRead Timestamp) (*Response, error) { opts := &markReadOptions{ LastReadAt: lastRead, } - req, err := s.client.NewRequest("PUT", "notifications", opts) + req, err := s.client.NewRequest(ctx, "PUT", "notifications", opts) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // MarkRepositoryNotificationsRead marks all notifications up to lastRead in // the specified repository as read. +// If lastRead is the zero value, all notifications in the repository are marked as read. // -// GitHub API docs: https://docs.github.com/rest/activity/notifications#mark-repository-notifications-as-read +// GitHub API docs: https://docs.github.com/rest/activity/notifications?apiVersion=2022-11-28#mark-repository-notifications-as-read // //meta:operation PUT /repos/{owner}/{repo}/notifications func (s *ActivityService) MarkRepositoryNotificationsRead(ctx context.Context, owner, repo string, lastRead Timestamp) (*Response, error) { @@ -132,29 +134,29 @@ func (s *ActivityService) MarkRepositoryNotificationsRead(ctx context.Context, o LastReadAt: lastRead, } u := fmt.Sprintf("repos/%v/%v/notifications", owner, repo) - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, opts) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // GetThread gets the specified notification thread. // -// GitHub API docs: https://docs.github.com/rest/activity/notifications#get-a-thread +// GitHub API docs: https://docs.github.com/rest/activity/notifications?apiVersion=2022-11-28#get-a-thread // //meta:operation GET /notifications/threads/{thread_id} func (s *ActivityService) GetThread(ctx context.Context, id string) (*Notification, *Response, error) { u := fmt.Sprintf("notifications/threads/%v", id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - notification := new(Notification) - resp, err := s.client.Do(ctx, req, notification) + var notification *Notification + resp, err := s.client.Do(req, ¬ification) if err != nil { return nil, resp, err } @@ -164,53 +166,53 @@ func (s *ActivityService) GetThread(ctx context.Context, id string) (*Notificati // MarkThreadRead marks the specified thread as read. // -// GitHub API docs: https://docs.github.com/rest/activity/notifications#mark-a-thread-as-read +// GitHub API docs: https://docs.github.com/rest/activity/notifications?apiVersion=2022-11-28#mark-a-thread-as-read // //meta:operation PATCH /notifications/threads/{thread_id} func (s *ActivityService) MarkThreadRead(ctx context.Context, id string) (*Response, error) { u := fmt.Sprintf("notifications/threads/%v", id) - req, err := s.client.NewRequest("PATCH", u, nil) + req, err := s.client.NewRequest(ctx, "PATCH", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // MarkThreadDone marks the specified thread as done. // Marking a thread as "done" is equivalent to marking a notification in your notification inbox on GitHub as done. // -// GitHub API docs: https://docs.github.com/rest/activity/notifications#mark-a-thread-as-done +// GitHub API docs: https://docs.github.com/rest/activity/notifications?apiVersion=2022-11-28#mark-a-thread-as-done // //meta:operation DELETE /notifications/threads/{thread_id} -func (s *ActivityService) MarkThreadDone(ctx context.Context, id int64) (*Response, error) { +func (s *ActivityService) MarkThreadDone(ctx context.Context, id string) (*Response, error) { u := fmt.Sprintf("notifications/threads/%v", id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // GetThreadSubscription checks to see if the authenticated user is subscribed // to a thread. // -// GitHub API docs: https://docs.github.com/rest/activity/notifications#get-a-thread-subscription-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/notifications?apiVersion=2022-11-28#get-a-thread-subscription-for-the-authenticated-user // //meta:operation GET /notifications/threads/{thread_id}/subscription func (s *ActivityService) GetThreadSubscription(ctx context.Context, id string) (*Subscription, *Response, error) { u := fmt.Sprintf("notifications/threads/%v/subscription", id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - sub := new(Subscription) - resp, err := s.client.Do(ctx, req, sub) + var sub *Subscription + resp, err := s.client.Do(req, &sub) if err != nil { return nil, resp, err } @@ -221,19 +223,19 @@ func (s *ActivityService) GetThreadSubscription(ctx context.Context, id string) // SetThreadSubscription sets the subscription for the specified thread for the // authenticated user. // -// GitHub API docs: https://docs.github.com/rest/activity/notifications#set-a-thread-subscription +// GitHub API docs: https://docs.github.com/rest/activity/notifications?apiVersion=2022-11-28#set-a-thread-subscription // //meta:operation PUT /notifications/threads/{thread_id}/subscription func (s *ActivityService) SetThreadSubscription(ctx context.Context, id string, subscription *Subscription) (*Subscription, *Response, error) { u := fmt.Sprintf("notifications/threads/%v/subscription", id) - req, err := s.client.NewRequest("PUT", u, subscription) + req, err := s.client.NewRequest(ctx, "PUT", u, subscription) if err != nil { return nil, nil, err } - sub := new(Subscription) - resp, err := s.client.Do(ctx, req, sub) + var sub *Subscription + resp, err := s.client.Do(req, &sub) if err != nil { return nil, resp, err } @@ -244,15 +246,15 @@ func (s *ActivityService) SetThreadSubscription(ctx context.Context, id string, // DeleteThreadSubscription deletes the subscription for the specified thread // for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/activity/notifications#delete-a-thread-subscription +// GitHub API docs: https://docs.github.com/rest/activity/notifications?apiVersion=2022-11-28#delete-a-thread-subscription // //meta:operation DELETE /notifications/threads/{thread_id}/subscription func (s *ActivityService) DeleteThreadSubscription(ctx context.Context, id string) (*Response, error) { u := fmt.Sprintf("notifications/threads/%v/subscription", id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/activity_star.go b/vendor/github.com/google/go-github/v88/github/activity_star.go similarity index 79% rename from vendor/github.com/google/go-github/v73/github/activity_star.go rename to vendor/github.com/google/go-github/v88/github/activity_star.go index 782c09884..d405d85a2 100644 --- a/vendor/github.com/google/go-github/v73/github/activity_star.go +++ b/vendor/github.com/google/go-github/v88/github/activity_star.go @@ -25,17 +25,17 @@ type Stargazer struct { // ListStargazers lists people who have starred the specified repo. // -// GitHub API docs: https://docs.github.com/rest/activity/starring#list-stargazers +// GitHub API docs: https://docs.github.com/rest/activity/starring?apiVersion=2022-11-28#list-stargazers // //meta:operation GET /repos/{owner}/{repo}/stargazers func (s *ActivityService) ListStargazers(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Stargazer, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/stargazers", owner, repo) + u := fmt.Sprintf("repos/%v/%v/stargazers", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } @@ -43,7 +43,7 @@ func (s *ActivityService) ListStargazers(ctx context.Context, owner, repo string req.Header.Set("Accept", mediaTypeStarring) var stargazers []*Stargazer - resp, err := s.client.Do(ctx, req, &stargazers) + resp, err := s.client.Do(req, &stargazers) if err != nil { return nil, resp, err } @@ -59,7 +59,7 @@ type ActivityListStarredOptions struct { Sort string `url:"sort,omitempty"` // Direction in which to sort repositories. Possible values are: asc, desc. - // Default is "asc" when sort is "full_name", otherwise default is "desc". + // Default is "asc" when sort is "full_name"; otherwise, default is "desc". Direction string `url:"direction,omitempty"` ListOptions @@ -68,8 +68,9 @@ type ActivityListStarredOptions struct { // ListStarred lists all the repos starred by a user. Passing the empty string // will list the starred repositories for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/activity/starring#list-repositories-starred-by-a-user -// GitHub API docs: https://docs.github.com/rest/activity/starring#list-repositories-starred-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/starring?apiVersion=2022-11-28#list-repositories-starred-by-a-user +// +// GitHub API docs: https://docs.github.com/rest/activity/starring?apiVersion=2022-11-28#list-repositories-starred-by-the-authenticated-user // //meta:operation GET /user/starred //meta:operation GET /users/{username}/starred @@ -85,7 +86,7 @@ func (s *ActivityService) ListStarred(ctx context.Context, user string, opts *Ac return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } @@ -94,7 +95,7 @@ func (s *ActivityService) ListStarred(ctx context.Context, user string, opts *Ac req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) var repos []*StarredRepository - resp, err := s.client.Do(ctx, req, &repos) + resp, err := s.client.Do(req, &repos) if err != nil { return nil, resp, err } @@ -104,47 +105,47 @@ func (s *ActivityService) ListStarred(ctx context.Context, user string, opts *Ac // IsStarred checks if a repository is starred by authenticated user. // -// GitHub API docs: https://docs.github.com/rest/activity/starring#check-if-a-repository-is-starred-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/starring?apiVersion=2022-11-28#check-if-a-repository-is-starred-by-the-authenticated-user // //meta:operation GET /user/starred/{owner}/{repo} func (s *ActivityService) IsStarred(ctx context.Context, owner, repo string) (bool, *Response, error) { u := fmt.Sprintf("user/starred/%v/%v", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return false, nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) starred, err := parseBoolResponse(err) return starred, resp, err } // Star a repository as the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/activity/starring#star-a-repository-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/starring?apiVersion=2022-11-28#star-a-repository-for-the-authenticated-user // //meta:operation PUT /user/starred/{owner}/{repo} func (s *ActivityService) Star(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("user/starred/%v/%v", owner, repo) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // Unstar a repository as the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/activity/starring#unstar-a-repository-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/starring?apiVersion=2022-11-28#unstar-a-repository-for-the-authenticated-user // //meta:operation DELETE /user/starred/{owner}/{repo} func (s *ActivityService) Unstar(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("user/starred/%v/%v", owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/activity_watching.go b/vendor/github.com/google/go-github/v88/github/activity_watching.go similarity index 78% rename from vendor/github.com/google/go-github/v73/github/activity_watching.go rename to vendor/github.com/google/go-github/v88/github/activity_watching.go index 348590057..04b64f99c 100644 --- a/vendor/github.com/google/go-github/v73/github/activity_watching.go +++ b/vendor/github.com/google/go-github/v88/github/activity_watching.go @@ -27,23 +27,23 @@ type Subscription struct { // ListWatchers lists watchers of a particular repo. // -// GitHub API docs: https://docs.github.com/rest/activity/watching#list-watchers +// GitHub API docs: https://docs.github.com/rest/activity/watching?apiVersion=2022-11-28#list-watchers // //meta:operation GET /repos/{owner}/{repo}/subscribers func (s *ActivityService) ListWatchers(ctx context.Context, owner, repo string, opts *ListOptions) ([]*User, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/subscribers", owner, repo) + u := fmt.Sprintf("repos/%v/%v/subscribers", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var watchers []*User - resp, err := s.client.Do(ctx, req, &watchers) + resp, err := s.client.Do(req, &watchers) if err != nil { return nil, resp, err } @@ -54,8 +54,9 @@ func (s *ActivityService) ListWatchers(ctx context.Context, owner, repo string, // ListWatched lists the repositories the specified user is watching. Passing // the empty string will fetch watched repos for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/activity/watching#list-repositories-watched-by-a-user -// GitHub API docs: https://docs.github.com/rest/activity/watching#list-repositories-watched-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/watching?apiVersion=2022-11-28#list-repositories-watched-by-a-user +// +// GitHub API docs: https://docs.github.com/rest/activity/watching?apiVersion=2022-11-28#list-repositories-watched-by-the-authenticated-user // //meta:operation GET /user/subscriptions //meta:operation GET /users/{username}/subscriptions @@ -71,13 +72,13 @@ func (s *ActivityService) ListWatched(ctx context.Context, user string, opts *Li return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var watched []*Repository - resp, err := s.client.Do(ctx, req, &watched) + resp, err := s.client.Do(req, &watched) if err != nil { return nil, resp, err } @@ -89,19 +90,19 @@ func (s *ActivityService) ListWatched(ctx context.Context, user string, opts *Li // repository for the authenticated user. If the authenticated user is not // watching the repository, a nil Subscription is returned. // -// GitHub API docs: https://docs.github.com/rest/activity/watching#get-a-repository-subscription +// GitHub API docs: https://docs.github.com/rest/activity/watching?apiVersion=2022-11-28#get-a-repository-subscription // //meta:operation GET /repos/{owner}/{repo}/subscription func (s *ActivityService) GetRepositorySubscription(ctx context.Context, owner, repo string) (*Subscription, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo) + u := fmt.Sprintf("repos/%v/%v/subscription", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - sub := new(Subscription) - resp, err := s.client.Do(ctx, req, sub) + var sub *Subscription + resp, err := s.client.Do(req, &sub) if err != nil { // if it's just a 404, don't return that as an error _, err = parseBoolResponse(err) @@ -118,19 +119,19 @@ func (s *ActivityService) GetRepositorySubscription(ctx context.Context, owner, // To ignore notifications made within a repository, set subscription.Ignored to true. // To stop watching a repository, use DeleteRepositorySubscription. // -// GitHub API docs: https://docs.github.com/rest/activity/watching#set-a-repository-subscription +// GitHub API docs: https://docs.github.com/rest/activity/watching?apiVersion=2022-11-28#set-a-repository-subscription // //meta:operation PUT /repos/{owner}/{repo}/subscription func (s *ActivityService) SetRepositorySubscription(ctx context.Context, owner, repo string, subscription *Subscription) (*Subscription, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo) + u := fmt.Sprintf("repos/%v/%v/subscription", owner, repo) - req, err := s.client.NewRequest("PUT", u, subscription) + req, err := s.client.NewRequest(ctx, "PUT", u, subscription) if err != nil { return nil, nil, err } - sub := new(Subscription) - resp, err := s.client.Do(ctx, req, sub) + var sub *Subscription + resp, err := s.client.Do(req, &sub) if err != nil { return nil, resp, err } @@ -144,15 +145,15 @@ func (s *ActivityService) SetRepositorySubscription(ctx context.Context, owner, // This is used to stop watching a repository. To control whether or not to // receive notifications from a repository, use SetRepositorySubscription. // -// GitHub API docs: https://docs.github.com/rest/activity/watching#delete-a-repository-subscription +// GitHub API docs: https://docs.github.com/rest/activity/watching?apiVersion=2022-11-28#delete-a-repository-subscription // //meta:operation DELETE /repos/{owner}/{repo}/subscription func (s *ActivityService) DeleteRepositorySubscription(ctx context.Context, owner, repo string) (*Response, error) { - u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) + u := fmt.Sprintf("repos/%v/%v/subscription", owner, repo) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/admin.go b/vendor/github.com/google/go-github/v88/github/admin.go similarity index 91% rename from vendor/github.com/google/go-github/v73/github/admin.go rename to vendor/github.com/google/go-github/v88/github/admin.go index 021a12ad8..b1713d5b9 100644 --- a/vendor/github.com/google/go-github/v73/github/admin.go +++ b/vendor/github.com/google/go-github/v88/github/admin.go @@ -14,7 +14,7 @@ import ( // GitHub API. These API routes are normally only accessible for GitHub // Enterprise installations. // -// GitHub API docs: https://docs.github.com/rest/enterprise-admin +// GitHub API docs: https://docs.github.com/rest/enterprise-admin?apiVersion=2022-11-28 type AdminService service // TeamLDAPMapping represents the mapping between a GitHub team and an LDAP group. @@ -82,18 +82,18 @@ func (m Enterprise) String() string { // UpdateUserLDAPMapping updates the mapping between a GitHub user and an LDAP user. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-user // //meta:operation PATCH /admin/ldap/users/{username}/mapping func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, mapping *UserLDAPMapping) (*UserLDAPMapping, *Response, error) { u := fmt.Sprintf("admin/ldap/users/%v/mapping", user) - req, err := s.client.NewRequest("PATCH", u, mapping) + req, err := s.client.NewRequest(ctx, "PATCH", u, mapping) if err != nil { return nil, nil, err } - m := new(UserLDAPMapping) - resp, err := s.client.Do(ctx, req, m) + var m *UserLDAPMapping + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -103,18 +103,18 @@ func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, m // UpdateTeamLDAPMapping updates the mapping between a GitHub team and an LDAP group. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-team +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-team // //meta:operation PATCH /admin/ldap/teams/{team_id}/mapping func (s *AdminService) UpdateTeamLDAPMapping(ctx context.Context, team int64, mapping *TeamLDAPMapping) (*TeamLDAPMapping, *Response, error) { u := fmt.Sprintf("admin/ldap/teams/%v/mapping", team) - req, err := s.client.NewRequest("PATCH", u, mapping) + req, err := s.client.NewRequest(ctx, "PATCH", u, mapping) if err != nil { return nil, nil, err } - m := new(TeamLDAPMapping) - resp, err := s.client.Do(ctx, req, m) + var m *TeamLDAPMapping + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/admin_orgs.go b/vendor/github.com/google/go-github/v88/github/admin_orgs.go similarity index 80% rename from vendor/github.com/google/go-github/v73/github/admin_orgs.go rename to vendor/github.com/google/go-github/v88/github/admin_orgs.go index f111d36ce..b9b19f893 100644 --- a/vendor/github.com/google/go-github/v73/github/admin_orgs.go +++ b/vendor/github.com/google/go-github/v88/github/admin_orgs.go @@ -7,6 +7,7 @@ package github import ( "context" + "errors" "fmt" ) @@ -22,7 +23,7 @@ type createOrgRequest struct { // Note that only a subset of the org fields are used and org must // not be nil. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/orgs#create-an-organization +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/orgs#create-an-organization // //meta:operation POST /admin/organizations func (s *AdminService) CreateOrg(ctx context.Context, org *Organization, admin string) (*Organization, *Response, error) { @@ -33,13 +34,13 @@ func (s *AdminService) CreateOrg(ctx context.Context, org *Organization, admin s Admin: &admin, } - req, err := s.client.NewRequest("POST", u, orgReq) + req, err := s.client.NewRequest(ctx, "POST", u, orgReq) if err != nil { return nil, nil, err } - o := new(Organization) - resp, err := s.client.Do(ctx, req, o) + var o *Organization + resp, err := s.client.Do(req, &o) if err != nil { return nil, resp, err } @@ -61,16 +62,23 @@ type RenameOrgResponse struct { // RenameOrg renames an organization in GitHub Enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/orgs#update-an-organization-name +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/orgs#update-an-organization-name // //meta:operation PATCH /admin/organizations/{org} func (s *AdminService) RenameOrg(ctx context.Context, org *Organization, newName string) (*RenameOrgResponse, *Response, error) { + if org == nil { + return nil, nil, errors.New("organization must be provided") + } + if org.Login == nil { + return nil, nil, errors.New("login must be provided") + } + return s.RenameOrgByName(ctx, *org.Login, newName) } // RenameOrgByName renames an organization in GitHub Enterprise using its current name. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/orgs#update-an-organization-name +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/orgs#update-an-organization-name // //meta:operation PATCH /admin/organizations/{org} func (s *AdminService) RenameOrgByName(ctx context.Context, org, newName string) (*RenameOrgResponse, *Response, error) { @@ -80,13 +88,13 @@ func (s *AdminService) RenameOrgByName(ctx context.Context, org, newName string) Login: &newName, } - req, err := s.client.NewRequest("PATCH", u, orgReq) + req, err := s.client.NewRequest(ctx, "PATCH", u, orgReq) if err != nil { return nil, nil, err } - o := new(RenameOrgResponse) - resp, err := s.client.Do(ctx, req, o) + var o *RenameOrgResponse + resp, err := s.client.Do(req, &o) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/admin_stats.go b/vendor/github.com/google/go-github/v88/github/admin_stats.go similarity index 96% rename from vendor/github.com/google/go-github/v73/github/admin_stats.go rename to vendor/github.com/google/go-github/v88/github/admin_stats.go index 07465b8d6..17816c500 100644 --- a/vendor/github.com/google/go-github/v73/github/admin_stats.go +++ b/vendor/github.com/google/go-github/v88/github/admin_stats.go @@ -152,18 +152,18 @@ func (s RepoStats) String() string { // Please note that this is only available to site administrators, // otherwise it will error with a 404 not found (instead of 401 or 403). // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/admin-stats#get-all-statistics +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/admin-stats#get-all-statistics // //meta:operation GET /enterprise/stats/all func (s *AdminService) GetAdminStats(ctx context.Context) (*AdminStats, *Response, error) { u := "enterprise/stats/all" - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - m := new(AdminStats) - resp, err := s.client.Do(ctx, req, m) + var m *AdminStats + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/admin_users.go b/vendor/github.com/google/go-github/v88/github/admin_users.go similarity index 82% rename from vendor/github.com/google/go-github/v73/github/admin_users.go rename to vendor/github.com/google/go-github/v88/github/admin_users.go index 843a177be..c2f331dee 100644 --- a/vendor/github.com/google/go-github/v73/github/admin_users.go +++ b/vendor/github.com/google/go-github/v88/github/admin_users.go @@ -20,19 +20,19 @@ type CreateUserRequest struct { // CreateUser creates a new user in GitHub Enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/users#create-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/users#create-a-user // //meta:operation POST /admin/users func (s *AdminService) CreateUser(ctx context.Context, userReq CreateUserRequest) (*User, *Response, error) { u := "admin/users" - req, err := s.client.NewRequest("POST", u, userReq) + req, err := s.client.NewRequest(ctx, "POST", u, userReq) if err != nil { return nil, nil, err } var user User - resp, err := s.client.Do(ctx, req, &user) + resp, err := s.client.Do(req, &user) if err != nil { return nil, resp, err } @@ -42,18 +42,18 @@ func (s *AdminService) CreateUser(ctx context.Context, userReq CreateUserRequest // DeleteUser deletes a user in GitHub Enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/users#delete-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/users#delete-a-user // //meta:operation DELETE /admin/users/{username} func (s *AdminService) DeleteUser(ctx context.Context, username string) (*Response, error) { u := "admin/users/" + username - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -95,19 +95,19 @@ type UserAuthorization struct { // CreateUserImpersonation creates an impersonation OAuth token. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/users#create-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/users#create-an-impersonation-oauth-token // //meta:operation POST /admin/users/{username}/authorizations func (s *AdminService) CreateUserImpersonation(ctx context.Context, username string, opts *ImpersonateUserOptions) (*UserAuthorization, *Response, error) { - u := fmt.Sprintf("admin/users/%s/authorizations", username) + u := fmt.Sprintf("admin/users/%v/authorizations", username) - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, opts) if err != nil { return nil, nil, err } - a := new(UserAuthorization) - resp, err := s.client.Do(ctx, req, a) + var a *UserAuthorization + resp, err := s.client.Do(req, &a) if err != nil { return nil, resp, err } @@ -117,18 +117,18 @@ func (s *AdminService) CreateUserImpersonation(ctx context.Context, username str // DeleteUserImpersonation deletes an impersonation OAuth token. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/users#delete-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/users#delete-an-impersonation-oauth-token // //meta:operation DELETE /admin/users/{username}/authorizations func (s *AdminService) DeleteUserImpersonation(ctx context.Context, username string) (*Response, error) { - u := fmt.Sprintf("admin/users/%s/authorizations", username) + u := fmt.Sprintf("admin/users/%v/authorizations", username) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/apps.go b/vendor/github.com/google/go-github/v88/github/apps.go similarity index 79% rename from vendor/github.com/google/go-github/v73/github/apps.go rename to vendor/github.com/google/go-github/v88/github/apps.go index 3dd392d08..75844a29c 100644 --- a/vendor/github.com/google/go-github/v73/github/apps.go +++ b/vendor/github.com/google/go-github/v88/github/apps.go @@ -13,13 +13,14 @@ import ( // AppsService provides access to the installation related functions // in the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/apps/ +// GitHub API docs: https://docs.github.com/rest/apps?apiVersion=2022-11-28 type AppsService service // App represents a GitHub App. type App struct { ID *int64 `json:"id,omitempty"` Slug *string `json:"slug,omitempty"` + ClientID *string `json:"client_id,omitempty"` NodeID *string `json:"node_id,omitempty"` Owner *User `json:"owner,omitempty"` Name *string `json:"name,omitempty"` @@ -56,6 +57,8 @@ type InstallationTokenOptions struct { Permissions *InstallationPermissions `json:"permissions,omitempty"` } +// InstallationTokenListRepoOptions allow restricting a token's access to a list of all repositories in an installation. +// It differs from InstallationTokenOptions as a parameter which does not omit RepositoryIDs if that field is nil or an empty array. type InstallationTokenListRepoOptions struct { // The IDs of the repositories that the installation token can access. // Providing repository IDs restricts the access of an installation token to specific repositories. @@ -75,7 +78,7 @@ type InstallationTokenListRepoOptions struct { // Permission names taken from: // // https://docs.github.com/enterprise-server@3.0/rest/apps#create-an-installation-access-token-for-an-app -// https://docs.github.com/rest/apps#create-an-installation-access-token-for-an-app +// https://docs.github.com/rest/apps?apiVersion=2022-11-28#create-an-installation-access-token-for-an-app type InstallationPermissions struct { Actions *string `json:"actions,omitempty"` ActionsVariables *string `json:"actions_variables,omitempty"` @@ -113,6 +116,7 @@ type InstallationPermissions struct { OrganizationCodespaces *string `json:"organization_codespaces,omitempty"` OrganizationCodespacesSecrets *string `json:"organization_codespaces_secrets,omitempty"` OrganizationCodespacesSettings *string `json:"organization_codespaces_settings,omitempty"` + OrganizationCopilotMetrics *string `json:"organization_copilot_metrics,omitempty"` OrganizationCopilotSeatManagement *string `json:"organization_copilot_seat_management,omitempty"` OrganizationCustomProperties *string `json:"organization_custom_properties,omitempty"` OrganizationCustomRoles *string `json:"organization_custom_roles,omitempty"` @@ -166,6 +170,7 @@ type InstallationRequest struct { type Installation struct { ID *int64 `json:"id,omitempty"` NodeID *string `json:"node_id,omitempty"` + ClientID *string `json:"client_id,omitempty"` AppID *int64 `json:"app_id,omitempty"` AppSlug *string `json:"app_slug,omitempty"` TargetID *int64 `json:"target_id,omitempty"` @@ -211,8 +216,9 @@ func (i Installation) String() string { // You can find this on the settings page for your GitHub App // (e.g., https://github.com/settings/apps/:app_slug). // -// GitHub API docs: https://docs.github.com/rest/apps/apps#get-an-app -// GitHub API docs: https://docs.github.com/rest/apps/apps#get-the-authenticated-app +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#get-an-app +// +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#get-the-authenticated-app // //meta:operation GET /app //meta:operation GET /apps/{app_slug} @@ -224,13 +230,13 @@ func (s *AppsService) Get(ctx context.Context, appSlug string) (*App, *Response, u = "app" } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - app := new(App) - resp, err := s.client.Do(ctx, req, app) + var app *App + resp, err := s.client.Do(req, &app) if err != nil { return nil, resp, err } @@ -240,7 +246,7 @@ func (s *AppsService) Get(ctx context.Context, appSlug string) (*App, *Response, // ListInstallationRequests lists the pending installation requests that the current GitHub App has. // -// GitHub API docs: https://docs.github.com/rest/apps/apps#list-installation-requests-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#list-installation-requests-for-the-authenticated-app // //meta:operation GET /app/installation-requests func (s *AppsService) ListInstallationRequests(ctx context.Context, opts *ListOptions) ([]*InstallationRequest, *Response, error) { @@ -249,13 +255,13 @@ func (s *AppsService) ListInstallationRequests(ctx context.Context, opts *ListOp return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var i []*InstallationRequest - resp, err := s.client.Do(ctx, req, &i) + resp, err := s.client.Do(req, &i) if err != nil { return nil, resp, err } @@ -265,7 +271,7 @@ func (s *AppsService) ListInstallationRequests(ctx context.Context, opts *ListOp // ListInstallations lists the installations that the current GitHub App has. // -// GitHub API docs: https://docs.github.com/rest/apps/apps#list-installations-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#list-installations-for-the-authenticated-app // //meta:operation GET /app/installations func (s *AppsService) ListInstallations(ctx context.Context, opts *ListOptions) ([]*Installation, *Response, error) { @@ -274,13 +280,13 @@ func (s *AppsService) ListInstallations(ctx context.Context, opts *ListOptions) return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var i []*Installation - resp, err := s.client.Do(ctx, req, &i) + resp, err := s.client.Do(req, &i) if err != nil { return nil, resp, err } @@ -290,7 +296,7 @@ func (s *AppsService) ListInstallations(ctx context.Context, opts *ListOptions) // GetInstallation returns the specified installation. // -// GitHub API docs: https://docs.github.com/rest/apps/apps#get-an-installation-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#get-an-installation-for-the-authenticated-app // //meta:operation GET /app/installations/{installation_id} func (s *AppsService) GetInstallation(ctx context.Context, id int64) (*Installation, *Response, error) { @@ -299,7 +305,7 @@ func (s *AppsService) GetInstallation(ctx context.Context, id int64) (*Installat // ListUserInstallations lists installations that are accessible to the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/apps/installations#list-app-installations-accessible-to-the-user-access-token +// GitHub API docs: https://docs.github.com/rest/apps/installations?apiVersion=2022-11-28#list-app-installations-accessible-to-the-user-access-token // //meta:operation GET /user/installations func (s *AppsService) ListUserInstallations(ctx context.Context, opts *ListOptions) ([]*Installation, *Response, error) { @@ -308,7 +314,7 @@ func (s *AppsService) ListUserInstallations(ctx context.Context, opts *ListOptio return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } @@ -316,7 +322,7 @@ func (s *AppsService) ListUserInstallations(ctx context.Context, opts *ListOptio var i struct { Installations []*Installation `json:"installations"` } - resp, err := s.client.Do(ctx, req, &i) + resp, err := s.client.Do(req, &i) if err != nil { return nil, resp, err } @@ -326,67 +332,67 @@ func (s *AppsService) ListUserInstallations(ctx context.Context, opts *ListOptio // SuspendInstallation suspends the specified installation. // -// GitHub API docs: https://docs.github.com/rest/apps/apps#suspend-an-app-installation +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#suspend-an-app-installation // //meta:operation PUT /app/installations/{installation_id}/suspended func (s *AppsService) SuspendInstallation(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("app/installations/%v/suspended", id) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // UnsuspendInstallation unsuspends the specified installation. // -// GitHub API docs: https://docs.github.com/rest/apps/apps#unsuspend-an-app-installation +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#unsuspend-an-app-installation // //meta:operation DELETE /app/installations/{installation_id}/suspended func (s *AppsService) UnsuspendInstallation(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("app/installations/%v/suspended", id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DeleteInstallation deletes the specified installation. // -// GitHub API docs: https://docs.github.com/rest/apps/apps#delete-an-installation-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#delete-an-installation-for-the-authenticated-app // //meta:operation DELETE /app/installations/{installation_id} func (s *AppsService) DeleteInstallation(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("app/installations/%v", id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // CreateInstallationToken creates a new installation token. // -// GitHub API docs: https://docs.github.com/rest/apps/apps#create-an-installation-access-token-for-an-app +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#create-an-installation-access-token-for-an-app // //meta:operation POST /app/installations/{installation_id}/access_tokens func (s *AppsService) CreateInstallationToken(ctx context.Context, id int64, opts *InstallationTokenOptions) (*InstallationToken, *Response, error) { u := fmt.Sprintf("app/installations/%v/access_tokens", id) - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, opts) if err != nil { return nil, nil, err } - t := new(InstallationToken) - resp, err := s.client.Do(ctx, req, t) + var t *InstallationToken + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } @@ -398,19 +404,19 @@ func (s *AppsService) CreateInstallationToken(ctx context.Context, id int64, opt // // It differs from CreateInstallationToken by taking InstallationTokenListRepoOptions as a parameter which does not omit RepositoryIDs if that field is nil or an empty array. // -// GitHub API docs: https://docs.github.com/rest/apps/apps#create-an-installation-access-token-for-an-app +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#create-an-installation-access-token-for-an-app // //meta:operation POST /app/installations/{installation_id}/access_tokens func (s *AppsService) CreateInstallationTokenListRepos(ctx context.Context, id int64, opts *InstallationTokenListRepoOptions) (*InstallationToken, *Response, error) { u := fmt.Sprintf("app/installations/%v/access_tokens", id) - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, opts) if err != nil { return nil, nil, err } - t := new(InstallationToken) - resp, err := s.client.Do(ctx, req, t) + var t *InstallationToken + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } @@ -425,17 +431,16 @@ func (s *AppsService) CreateInstallationTokenListRepos(ctx context.Context, id i //meta:operation POST /repos/{owner}/{repo}/content_references/{content_reference_id}/attachments func (s *AppsService) CreateAttachment(ctx context.Context, contentReferenceID int64, title, body string) (*Attachment, *Response, error) { u := fmt.Sprintf("content_references/%v/attachments", contentReferenceID) - payload := &Attachment{Title: Ptr(title), Body: Ptr(body)} - req, err := s.client.NewRequest("POST", u, payload) + payload := &Attachment{Title: &title, Body: &body} + req, err := s.client.NewRequest(ctx, "POST", u, payload) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeContentAttachmentsPreview) - m := &Attachment{} - resp, err := s.client.Do(ctx, req, m) + var m *Attachment + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -443,50 +448,59 @@ func (s *AppsService) CreateAttachment(ctx context.Context, contentReferenceID i return m, resp, nil } -// FindOrganizationInstallation finds the organization's installation information. +// GetOrganizationInstallation finds the organization's installation information. // -// GitHub API docs: https://docs.github.com/rest/apps/apps#get-an-organization-installation-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#get-an-organization-installation-for-the-authenticated-app // //meta:operation GET /orgs/{org}/installation -func (s *AppsService) FindOrganizationInstallation(ctx context.Context, org string) (*Installation, *Response, error) { +func (s *AppsService) GetOrganizationInstallation(ctx context.Context, org string) (*Installation, *Response, error) { return s.getInstallation(ctx, fmt.Sprintf("orgs/%v/installation", org)) } -// FindRepositoryInstallation finds the repository's installation information. +// GetEnterpriseInstallation finds the enterprise's installation information. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/apps/apps?apiVersion=2022-11-28#get-an-enterprise-installation-for-the-authenticated-app +// +//meta:operation GET /enterprises/{enterprise}/installation +func (s *AppsService) GetEnterpriseInstallation(ctx context.Context, enterprise string) (*Installation, *Response, error) { + return s.getInstallation(ctx, fmt.Sprintf("enterprises/%v/installation", enterprise)) +} + +// GetRepositoryInstallation finds the repository's installation information. // -// GitHub API docs: https://docs.github.com/rest/apps/apps#get-a-repository-installation-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#get-a-repository-installation-for-the-authenticated-app // //meta:operation GET /repos/{owner}/{repo}/installation -func (s *AppsService) FindRepositoryInstallation(ctx context.Context, owner, repo string) (*Installation, *Response, error) { +func (s *AppsService) GetRepositoryInstallation(ctx context.Context, owner, repo string) (*Installation, *Response, error) { return s.getInstallation(ctx, fmt.Sprintf("repos/%v/%v/installation", owner, repo)) } -// FindRepositoryInstallationByID finds the repository's installation information. +// GetRepositoryInstallationByID finds the repository's installation information. // -// Note: FindRepositoryInstallationByID uses the undocumented GitHub API endpoint "GET /repositories/{repository_id}/installation". +// Note: GetRepositoryInstallationByID uses the undocumented GitHub API endpoint "GET /repositories/{repository_id}/installation". // //meta:operation GET /repositories/{repository_id}/installation -func (s *AppsService) FindRepositoryInstallationByID(ctx context.Context, id int64) (*Installation, *Response, error) { - return s.getInstallation(ctx, fmt.Sprintf("repositories/%d/installation", id)) +func (s *AppsService) GetRepositoryInstallationByID(ctx context.Context, id int64) (*Installation, *Response, error) { + return s.getInstallation(ctx, fmt.Sprintf("repositories/%v/installation", id)) } -// FindUserInstallation finds the user's installation information. +// GetUserInstallation finds the user's installation information. // -// GitHub API docs: https://docs.github.com/rest/apps/apps#get-a-user-installation-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#get-a-user-installation-for-the-authenticated-app // //meta:operation GET /users/{username}/installation -func (s *AppsService) FindUserInstallation(ctx context.Context, user string) (*Installation, *Response, error) { +func (s *AppsService) GetUserInstallation(ctx context.Context, user string) (*Installation, *Response, error) { return s.getInstallation(ctx, fmt.Sprintf("users/%v/installation", user)) } func (s *AppsService) getInstallation(ctx context.Context, url string) (*Installation, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } - i := new(Installation) - resp, err := s.client.Do(ctx, req, i) + var i *Installation + resp, err := s.client.Do(req, &i) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/apps_hooks.go b/vendor/github.com/google/go-github/v88/github/apps_hooks.go similarity index 66% rename from vendor/github.com/google/go-github/v73/github/apps_hooks.go rename to vendor/github.com/google/go-github/v88/github/apps_hooks.go index 6046827ef..fb9e31134 100644 --- a/vendor/github.com/google/go-github/v73/github/apps_hooks.go +++ b/vendor/github.com/google/go-github/v88/github/apps_hooks.go @@ -12,17 +12,17 @@ import ( // GetHookConfig returns the webhook configuration for a GitHub App. // The underlying transport must be authenticated as an app. // -// GitHub API docs: https://docs.github.com/rest/apps/webhooks#get-a-webhook-configuration-for-an-app +// GitHub API docs: https://docs.github.com/rest/apps/webhooks?apiVersion=2022-11-28#get-a-webhook-configuration-for-an-app // //meta:operation GET /app/hook/config func (s *AppsService) GetHookConfig(ctx context.Context) (*HookConfig, *Response, error) { - req, err := s.client.NewRequest("GET", "app/hook/config", nil) + req, err := s.client.NewRequest(ctx, "GET", "app/hook/config", nil) if err != nil { return nil, nil, err } - config := new(HookConfig) - resp, err := s.client.Do(ctx, req, &config) + var config *HookConfig + resp, err := s.client.Do(req, &config) if err != nil { return nil, resp, err } @@ -33,17 +33,17 @@ func (s *AppsService) GetHookConfig(ctx context.Context) (*HookConfig, *Response // UpdateHookConfig updates the webhook configuration for a GitHub App. // The underlying transport must be authenticated as an app. // -// GitHub API docs: https://docs.github.com/rest/apps/webhooks#update-a-webhook-configuration-for-an-app +// GitHub API docs: https://docs.github.com/rest/apps/webhooks?apiVersion=2022-11-28#update-a-webhook-configuration-for-an-app // //meta:operation PATCH /app/hook/config func (s *AppsService) UpdateHookConfig(ctx context.Context, config *HookConfig) (*HookConfig, *Response, error) { - req, err := s.client.NewRequest("PATCH", "app/hook/config", config) + req, err := s.client.NewRequest(ctx, "PATCH", "app/hook/config", config) if err != nil { return nil, nil, err } - c := new(HookConfig) - resp, err := s.client.Do(ctx, req, c) + var c *HookConfig + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/apps_hooks_deliveries.go b/vendor/github.com/google/go-github/v88/github/apps_hooks_deliveries.go similarity index 69% rename from vendor/github.com/google/go-github/v73/github/apps_hooks_deliveries.go rename to vendor/github.com/google/go-github/v88/github/apps_hooks_deliveries.go index 59800a0ae..e737bbae0 100644 --- a/vendor/github.com/google/go-github/v73/github/apps_hooks_deliveries.go +++ b/vendor/github.com/google/go-github/v88/github/apps_hooks_deliveries.go @@ -12,7 +12,7 @@ import ( // ListHookDeliveries lists deliveries of an App webhook. // -// GitHub API docs: https://docs.github.com/rest/apps/webhooks#list-deliveries-for-an-app-webhook +// GitHub API docs: https://docs.github.com/rest/apps/webhooks?apiVersion=2022-11-28#list-deliveries-for-an-app-webhook // //meta:operation GET /app/hook/deliveries func (s *AppsService) ListHookDeliveries(ctx context.Context, opts *ListCursorOptions) ([]*HookDelivery, *Response, error) { @@ -21,13 +21,13 @@ func (s *AppsService) ListHookDeliveries(ctx context.Context, opts *ListCursorOp return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } deliveries := []*HookDelivery{} - resp, err := s.client.Do(ctx, req, &deliveries) + resp, err := s.client.Do(req, &deliveries) if err != nil { return nil, resp, err } @@ -37,18 +37,18 @@ func (s *AppsService) ListHookDeliveries(ctx context.Context, opts *ListCursorOp // GetHookDelivery returns the App webhook delivery with the specified ID. // -// GitHub API docs: https://docs.github.com/rest/apps/webhooks#get-a-delivery-for-an-app-webhook +// GitHub API docs: https://docs.github.com/rest/apps/webhooks?apiVersion=2022-11-28#get-a-delivery-for-an-app-webhook // //meta:operation GET /app/hook/deliveries/{delivery_id} func (s *AppsService) GetHookDelivery(ctx context.Context, deliveryID int64) (*HookDelivery, *Response, error) { u := fmt.Sprintf("app/hook/deliveries/%v", deliveryID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - h := new(HookDelivery) - resp, err := s.client.Do(ctx, req, h) + var h *HookDelivery + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } @@ -58,18 +58,18 @@ func (s *AppsService) GetHookDelivery(ctx context.Context, deliveryID int64) (*H // RedeliverHookDelivery redelivers a delivery for an App webhook. // -// GitHub API docs: https://docs.github.com/rest/apps/webhooks#redeliver-a-delivery-for-an-app-webhook +// GitHub API docs: https://docs.github.com/rest/apps/webhooks?apiVersion=2022-11-28#redeliver-a-delivery-for-an-app-webhook // //meta:operation POST /app/hook/deliveries/{delivery_id}/attempts func (s *AppsService) RedeliverHookDelivery(ctx context.Context, deliveryID int64) (*HookDelivery, *Response, error) { u := fmt.Sprintf("app/hook/deliveries/%v/attempts", deliveryID) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - h := new(HookDelivery) - resp, err := s.client.Do(ctx, req, h) + var h *HookDelivery + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/apps_installation.go b/vendor/github.com/google/go-github/v88/github/apps_installation.go similarity index 70% rename from vendor/github.com/google/go-github/v73/github/apps_installation.go rename to vendor/github.com/google/go-github/v88/github/apps_installation.go index d430511d0..7fbcc260d 100644 --- a/vendor/github.com/google/go-github/v73/github/apps_installation.go +++ b/vendor/github.com/google/go-github/v88/github/apps_installation.go @@ -8,7 +8,6 @@ package github import ( "context" "fmt" - "strings" ) // ListRepositories represents the response from the list repos endpoints. @@ -19,7 +18,7 @@ type ListRepositories struct { // ListRepos lists the repositories that are accessible to the authenticated installation. // -// GitHub API docs: https://docs.github.com/rest/apps/installations#list-repositories-accessible-to-the-app-installation +// GitHub API docs: https://docs.github.com/rest/apps/installations?apiVersion=2022-11-28#list-repositories-accessible-to-the-app-installation // //meta:operation GET /installation/repositories func (s *AppsService) ListRepos(ctx context.Context, opts *ListOptions) (*ListRepositories, *Response, error) { @@ -28,22 +27,13 @@ func (s *AppsService) ListRepos(ctx context.Context, opts *ListOptions) (*ListRe return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - acceptHeaders := []string{ - mediaTypeTopicsPreview, - mediaTypeRepositoryVisibilityPreview, - mediaTypeRepositoryTemplatePreview, - } - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - var r *ListRepositories - - resp, err := s.client.Do(ctx, req, &r) + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -54,7 +44,7 @@ func (s *AppsService) ListRepos(ctx context.Context, opts *ListOptions) (*ListRe // ListUserRepos lists repositories that are accessible // to the authenticated user for an installation. // -// GitHub API docs: https://docs.github.com/rest/apps/installations#list-repositories-accessible-to-the-user-access-token +// GitHub API docs: https://docs.github.com/rest/apps/installations?apiVersion=2022-11-28#list-repositories-accessible-to-the-user-access-token // //meta:operation GET /user/installations/{installation_id}/repositories func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opts *ListOptions) (*ListRepositories, *Response, error) { @@ -64,21 +54,13 @@ func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opts *ListOpt return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - acceptHeaders := []string{ - mediaTypeTopicsPreview, - mediaTypeRepositoryVisibilityPreview, - mediaTypeRepositoryTemplatePreview, - } - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - var r *ListRepositories - resp, err := s.client.Do(ctx, req, &r) + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -88,18 +70,18 @@ func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opts *ListOpt // AddRepository adds a single repository to an installation. // -// GitHub API docs: https://docs.github.com/rest/apps/installations#add-a-repository-to-an-app-installation +// GitHub API docs: https://docs.github.com/rest/apps/installations?apiVersion=2022-11-28#add-a-repository-to-an-app-installation // //meta:operation PUT /user/installations/{installation_id}/repositories/{repository_id} func (s *AppsService) AddRepository(ctx context.Context, instID, repoID int64) (*Repository, *Response, error) { u := fmt.Sprintf("user/installations/%v/repositories/%v", instID, repoID) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, nil, err } - r := new(Repository) - resp, err := s.client.Do(ctx, req, r) + var r *Repository + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -109,30 +91,30 @@ func (s *AppsService) AddRepository(ctx context.Context, instID, repoID int64) ( // RemoveRepository removes a single repository from an installation. // -// GitHub API docs: https://docs.github.com/rest/apps/installations#remove-a-repository-from-an-app-installation +// GitHub API docs: https://docs.github.com/rest/apps/installations?apiVersion=2022-11-28#remove-a-repository-from-an-app-installation // //meta:operation DELETE /user/installations/{installation_id}/repositories/{repository_id} func (s *AppsService) RemoveRepository(ctx context.Context, instID, repoID int64) (*Response, error) { u := fmt.Sprintf("user/installations/%v/repositories/%v", instID, repoID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RevokeInstallationToken revokes an installation token. // -// GitHub API docs: https://docs.github.com/rest/apps/installations#revoke-an-installation-access-token +// GitHub API docs: https://docs.github.com/rest/apps/installations?apiVersion=2022-11-28#revoke-an-installation-access-token // //meta:operation DELETE /installation/token func (s *AppsService) RevokeInstallationToken(ctx context.Context) (*Response, error) { u := "installation/token" - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/apps_manifest.go b/vendor/github.com/google/go-github/v88/github/apps_manifest.go similarity index 83% rename from vendor/github.com/google/go-github/v73/github/apps_manifest.go rename to vendor/github.com/google/go-github/v88/github/apps_manifest.go index 5b6ff9af4..af6c9a5a5 100644 --- a/vendor/github.com/google/go-github/v73/github/apps_manifest.go +++ b/vendor/github.com/google/go-github/v88/github/apps_manifest.go @@ -31,18 +31,18 @@ type AppConfig struct { // CompleteAppManifest completes the App manifest handshake flow for the given // code. // -// GitHub API docs: https://docs.github.com/rest/apps/apps#create-a-github-app-from-a-manifest +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#create-a-github-app-from-a-manifest // //meta:operation POST /app-manifests/{code}/conversions func (s *AppsService) CompleteAppManifest(ctx context.Context, code string) (*AppConfig, *Response, error) { - u := fmt.Sprintf("app-manifests/%s/conversions", code) - req, err := s.client.NewRequest("POST", u, nil) + u := fmt.Sprintf("app-manifests/%v/conversions", code) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - cfg := new(AppConfig) - resp, err := s.client.Do(ctx, req, cfg) + var cfg *AppConfig + resp, err := s.client.Do(req, &cfg) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/apps_marketplace.go b/vendor/github.com/google/go-github/v88/github/apps_marketplace.go similarity index 87% rename from vendor/github.com/google/go-github/v73/github/apps_marketplace.go rename to vendor/github.com/google/go-github/v88/github/apps_marketplace.go index 976775a79..ed545df09 100644 --- a/vendor/github.com/google/go-github/v73/github/apps_marketplace.go +++ b/vendor/github.com/google/go-github/v88/github/apps_marketplace.go @@ -13,7 +13,7 @@ import ( // MarketplaceService handles communication with the marketplace related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/apps#marketplace +// GitHub API docs: https://docs.github.com/rest/apps/marketplace?apiVersion=2022-11-28 type MarketplaceService struct { client *Client // Stubbed controls whether endpoints that return stubbed data are used @@ -21,7 +21,7 @@ type MarketplaceService struct { // for testing your GitHub Apps. Stubbed data is hard-coded and will not // change based on actual subscriptions. // - // GitHub API docs: https://docs.github.com/rest/apps#testing-with-stubbed-endpoints + // GitHub API docs: https://docs.github.com/rest/apps?apiVersion=2022-11-28#testing-with-stubbed-endpoints Stubbed bool } @@ -89,8 +89,9 @@ type MarketplacePurchaseAccount struct { // ListPlans lists all plans for your Marketplace listing. // -// GitHub API docs: https://docs.github.com/rest/apps/marketplace#list-plans -// GitHub API docs: https://docs.github.com/rest/apps/marketplace#list-plans-stubbed +// GitHub API docs: https://docs.github.com/rest/apps/marketplace?apiVersion=2022-11-28#list-plans +// +// GitHub API docs: https://docs.github.com/rest/apps/marketplace?apiVersion=2022-11-28#list-plans-stubbed // //meta:operation GET /marketplace_listing/plans //meta:operation GET /marketplace_listing/stubbed/plans @@ -101,13 +102,13 @@ func (s *MarketplaceService) ListPlans(ctx context.Context, opts *ListOptions) ( return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var plans []*MarketplacePlan - resp, err := s.client.Do(ctx, req, &plans) + resp, err := s.client.Do(req, &plans) if err != nil { return nil, resp, err } @@ -117,8 +118,9 @@ func (s *MarketplaceService) ListPlans(ctx context.Context, opts *ListOptions) ( // ListPlanAccountsForPlan lists all GitHub accounts (user or organization) on a specific plan. // -// GitHub API docs: https://docs.github.com/rest/apps/marketplace#list-accounts-for-a-plan -// GitHub API docs: https://docs.github.com/rest/apps/marketplace#list-accounts-for-a-plan-stubbed +// GitHub API docs: https://docs.github.com/rest/apps/marketplace?apiVersion=2022-11-28#list-accounts-for-a-plan +// +// GitHub API docs: https://docs.github.com/rest/apps/marketplace?apiVersion=2022-11-28#list-accounts-for-a-plan-stubbed // //meta:operation GET /marketplace_listing/plans/{plan_id}/accounts //meta:operation GET /marketplace_listing/stubbed/plans/{plan_id}/accounts @@ -129,13 +131,13 @@ func (s *MarketplaceService) ListPlanAccountsForPlan(ctx context.Context, planID return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var accounts []*MarketplacePlanAccount - resp, err := s.client.Do(ctx, req, &accounts) + resp, err := s.client.Do(req, &accounts) if err != nil { return nil, resp, err } @@ -145,21 +147,22 @@ func (s *MarketplaceService) ListPlanAccountsForPlan(ctx context.Context, planID // GetPlanAccountForAccount get GitHub account (user or organization) associated with an account. // -// GitHub API docs: https://docs.github.com/rest/apps/marketplace#get-a-subscription-plan-for-an-account -// GitHub API docs: https://docs.github.com/rest/apps/marketplace#get-a-subscription-plan-for-an-account-stubbed +// GitHub API docs: https://docs.github.com/rest/apps/marketplace?apiVersion=2022-11-28#get-a-subscription-plan-for-an-account +// +// GitHub API docs: https://docs.github.com/rest/apps/marketplace?apiVersion=2022-11-28#get-a-subscription-plan-for-an-account-stubbed // //meta:operation GET /marketplace_listing/accounts/{account_id} //meta:operation GET /marketplace_listing/stubbed/accounts/{account_id} func (s *MarketplaceService) GetPlanAccountForAccount(ctx context.Context, accountID int64) (*MarketplacePlanAccount, *Response, error) { uri := s.marketplaceURI(fmt.Sprintf("accounts/%v", accountID)) - req, err := s.client.NewRequest("GET", uri, nil) + req, err := s.client.NewRequest(ctx, "GET", uri, nil) if err != nil { return nil, nil, err } var account *MarketplacePlanAccount - resp, err := s.client.Do(ctx, req, &account) + resp, err := s.client.Do(req, &account) if err != nil { return nil, resp, err } @@ -169,8 +172,9 @@ func (s *MarketplaceService) GetPlanAccountForAccount(ctx context.Context, accou // ListMarketplacePurchasesForUser lists all GitHub marketplace purchases made by a user. // -// GitHub API docs: https://docs.github.com/rest/apps/marketplace#list-subscriptions-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/rest/apps/marketplace#list-subscriptions-for-the-authenticated-user-stubbed +// GitHub API docs: https://docs.github.com/rest/apps/marketplace?apiVersion=2022-11-28#list-subscriptions-for-the-authenticated-user +// +// GitHub API docs: https://docs.github.com/rest/apps/marketplace?apiVersion=2022-11-28#list-subscriptions-for-the-authenticated-user-stubbed // //meta:operation GET /user/marketplace_purchases //meta:operation GET /user/marketplace_purchases/stubbed @@ -185,13 +189,13 @@ func (s *MarketplaceService) ListMarketplacePurchasesForUser(ctx context.Context return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var purchases []*MarketplacePurchase - resp, err := s.client.Do(ctx, req, &purchases) + resp, err := s.client.Do(req, &purchases) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/attestations.go b/vendor/github.com/google/go-github/v88/github/attestations.go similarity index 100% rename from vendor/github.com/google/go-github/v73/github/attestations.go rename to vendor/github.com/google/go-github/v88/github/attestations.go diff --git a/vendor/github.com/google/go-github/v73/github/authorizations.go b/vendor/github.com/google/go-github/v88/github/authorizations.go similarity index 90% rename from vendor/github.com/google/go-github/v73/github/authorizations.go rename to vendor/github.com/google/go-github/v88/github/authorizations.go index 6f22e40a1..1511687aa 100644 --- a/vendor/github.com/google/go-github/v73/github/authorizations.go +++ b/vendor/github.com/google/go-github/v88/github/authorizations.go @@ -50,7 +50,7 @@ const ( // This service requires HTTP Basic Authentication; it cannot be accessed using // an OAuth token. // -// GitHub API docs: https://docs.github.com/rest/oauth-authorizations +// GitHub API docs: https://docs.github.com/rest/oauth-authorizations?apiVersion=2022-11-28 type AuthorizationsService service // Authorization represents an individual GitHub authorization. @@ -121,7 +121,7 @@ func (a AuthorizationRequest) String() string { // fields. That is, you may provide only one of "Scopes", or "AddScopes", or // "RemoveScopes". // -// GitHub API docs: https://docs.github.com/rest/oauth-authorizations#update-an-existing-authorization +// GitHub API docs: https://docs.github.com/rest/oauth-authorizations?apiVersion=2022-11-28#update-an-existing-authorization type AuthorizationUpdateRequest struct { Scopes []string `json:"scopes,omitempty"` AddScopes []string `json:"add_scopes,omitempty"` @@ -143,7 +143,7 @@ func (a AuthorizationUpdateRequest) String() string { // // The returned Authorization.User field will be populated. // -// GitHub API docs: https://docs.github.com/rest/apps/oauth-applications#check-a-token +// GitHub API docs: https://docs.github.com/rest/apps/oauth-applications?apiVersion=2022-11-28#check-a-token // //meta:operation POST /applications/{client_id}/token func (s *AuthorizationsService) Check(ctx context.Context, clientID, accessToken string) (*Authorization, *Response, error) { @@ -153,14 +153,14 @@ func (s *AuthorizationsService) Check(ctx context.Context, clientID, accessToken AccessToken string `json:"access_token"` }{AccessToken: accessToken} - req, err := s.client.NewRequest("POST", u, reqBody) + req, err := s.client.NewRequest(ctx, "POST", u, reqBody) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeOAuthAppPreview) - a := new(Authorization) - resp, err := s.client.Do(ctx, req, a) + var a *Authorization + resp, err := s.client.Do(req, &a) if err != nil { return nil, resp, err } @@ -178,7 +178,7 @@ func (s *AuthorizationsService) Check(ctx context.Context, clientID, accessToken // // The returned Authorization.User field will be populated. // -// GitHub API docs: https://docs.github.com/rest/apps/oauth-applications#reset-a-token +// GitHub API docs: https://docs.github.com/rest/apps/oauth-applications?apiVersion=2022-11-28#reset-a-token // //meta:operation PATCH /applications/{client_id}/token func (s *AuthorizationsService) Reset(ctx context.Context, clientID, accessToken string) (*Authorization, *Response, error) { @@ -188,14 +188,14 @@ func (s *AuthorizationsService) Reset(ctx context.Context, clientID, accessToken AccessToken string `json:"access_token"` }{AccessToken: accessToken} - req, err := s.client.NewRequest("PATCH", u, reqBody) + req, err := s.client.NewRequest(ctx, "PATCH", u, reqBody) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeOAuthAppPreview) - a := new(Authorization) - resp, err := s.client.Do(ctx, req, a) + var a *Authorization + resp, err := s.client.Do(req, &a) if err != nil { return nil, resp, err } @@ -209,7 +209,7 @@ func (s *AuthorizationsService) Reset(ctx context.Context, clientID, accessToken // username is the OAuth application clientID, and the password is its // clientSecret. Invalid tokens will return a 404 Not Found. // -// GitHub API docs: https://docs.github.com/rest/apps/oauth-applications#delete-an-app-token +// GitHub API docs: https://docs.github.com/rest/apps/oauth-applications?apiVersion=2022-11-28#delete-an-app-token // //meta:operation DELETE /applications/{client_id}/token func (s *AuthorizationsService) Revoke(ctx context.Context, clientID, accessToken string) (*Response, error) { @@ -219,20 +219,20 @@ func (s *AuthorizationsService) Revoke(ctx context.Context, clientID, accessToke AccessToken string `json:"access_token"` }{AccessToken: accessToken} - req, err := s.client.NewRequest("DELETE", u, reqBody) + req, err := s.client.NewRequest(ctx, "DELETE", u, reqBody) if err != nil { return nil, err } req.Header.Set("Accept", mediaTypeOAuthAppPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DeleteGrant deletes an OAuth application grant. Deleting an application's // grant will also delete all OAuth tokens associated with the application for // the user. // -// GitHub API docs: https://docs.github.com/rest/apps/oauth-applications#delete-an-app-authorization +// GitHub API docs: https://docs.github.com/rest/apps/oauth-applications?apiVersion=2022-11-28#delete-an-app-authorization // //meta:operation DELETE /applications/{client_id}/grant func (s *AuthorizationsService) DeleteGrant(ctx context.Context, clientID, accessToken string) (*Response, error) { @@ -242,13 +242,13 @@ func (s *AuthorizationsService) DeleteGrant(ctx context.Context, clientID, acces AccessToken string `json:"access_token"` }{AccessToken: accessToken} - req, err := s.client.NewRequest("DELETE", u, reqBody) + req, err := s.client.NewRequest(ctx, "DELETE", u, reqBody) if err != nil { return nil, err } req.Header.Set("Accept", mediaTypeOAuthAppPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // CreateImpersonation creates an impersonation OAuth token. @@ -257,18 +257,18 @@ func (s *AuthorizationsService) DeleteGrant(ctx context.Context, clientID, acces // you can e.g. create or delete a user's public SSH key. NOTE: creating a // new token automatically revokes an existing one. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/users#create-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/users#create-an-impersonation-oauth-token // //meta:operation POST /admin/users/{username}/authorizations func (s *AuthorizationsService) CreateImpersonation(ctx context.Context, username string, authReq *AuthorizationRequest) (*Authorization, *Response, error) { u := fmt.Sprintf("admin/users/%v/authorizations", username) - req, err := s.client.NewRequest("POST", u, authReq) + req, err := s.client.NewRequest(ctx, "POST", u, authReq) if err != nil { return nil, nil, err } - a := new(Authorization) - resp, err := s.client.Do(ctx, req, a) + var a *Authorization + resp, err := s.client.Do(req, &a) if err != nil { return nil, resp, err } @@ -279,15 +279,15 @@ func (s *AuthorizationsService) CreateImpersonation(ctx context.Context, usernam // // NOTE: there can be only one at a time. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/users#delete-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/users#delete-an-impersonation-oauth-token // //meta:operation DELETE /admin/users/{username}/authorizations func (s *AuthorizationsService) DeleteImpersonation(ctx context.Context, username string) (*Response, error) { u := fmt.Sprintf("admin/users/%v/authorizations", username) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v88/github/billing.go b/vendor/github.com/google/go-github/v88/github/billing.go new file mode 100644 index 000000000..9e9d812a0 --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/billing.go @@ -0,0 +1,394 @@ +// Copyright 2021 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// BillingService provides access to the billing related functions +// in the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/billing?apiVersion=2022-11-28 +type BillingService service + +// MinutesUsedBreakdown counts the actions minutes used by machine type (e.g. UBUNTU, WINDOWS, MACOS). +type MinutesUsedBreakdown = map[string]int + +// PackagesBilling represents billing of GitHub Packages . +type PackagesBilling struct { + TotalGigabytesBandwidthUsed int `json:"total_gigabytes_bandwidth_used"` + TotalPaidGigabytesBandwidthUsed int `json:"total_paid_gigabytes_bandwidth_used"` + IncludedGigabytesBandwidth int `json:"included_gigabytes_bandwidth"` +} + +// StorageBilling represents a GitHub Storage billing. +type StorageBilling struct { + DaysLeftInBillingCycle int `json:"days_left_in_billing_cycle"` + EstimatedPaidStorageForMonth int `json:"estimated_paid_storage_for_month"` + EstimatedStorageForMonth int `json:"estimated_storage_for_month"` +} + +// ActiveCommittersListOptions specifies optional parameters to the +// BillingService.GetAdvancedSecurityActiveCommittersOrg method. +type ActiveCommittersListOptions struct { + // The security product to get GitHub Advanced Security active committers for. For standalone + // Code Scanning or Secret Protection products, this parameter is required to specify which + // product you want committer information for. For other plans this parameter cannot be used. + // + // Can be one of: "code_security", "secret_protection". + AdvancedSecurityProduct *string `url:"advanced_security_product,omitempty"` + + ListOptions +} + +// ActiveCommitters represents the total active committers across all repositories in an Organization. +type ActiveCommitters struct { + TotalAdvancedSecurityCommitters *int `json:"total_advanced_security_committers,omitempty"` + TotalCount *int `json:"total_count,omitempty"` + MaximumAdvancedSecurityCommitters *int `json:"maximum_advanced_security_committers,omitempty"` + PurchasedAdvancedSecurityCommitters *int `json:"purchased_advanced_security_committers,omitempty"` + Repositories []*RepositoryActiveCommitters `json:"repositories"` +} + +// RepositoryActiveCommitters represents active committers on each repository. +type RepositoryActiveCommitters struct { + Name string `json:"name"` + AdvancedSecurityCommitters int `json:"advanced_security_committers"` + AdvancedSecurityCommittersBreakdown []*AdvancedSecurityCommittersBreakdown `json:"advanced_security_committers_breakdown"` +} + +// AdvancedSecurityCommittersBreakdown represents the user activity breakdown for ActiveCommitters. +type AdvancedSecurityCommittersBreakdown struct { + UserLogin string `json:"user_login"` + LastPushedDate string `json:"last_pushed_date"` + LastPushedEmail string `json:"last_pushed_email"` +} + +// UsageReportOptions specifies optional parameters for the enhanced billing platform usage report. +type UsageReportOptions struct { + // If specified, only return results for a single year. The value of year is an integer with four digits representing a year. For example, 2025. + // Default value is the current year. + Year *int `url:"year,omitempty"` + + // If specified, only return results for a single month. The value of month is an integer between 1 and 12. + // If no year is specified the default year is used. + Month *int `url:"month,omitempty"` + + // If specified, only return results for a single day. The value of day is an integer between 1 and 31. + // If no year or month is specified, the default year and month are used. + Day *int `url:"day,omitempty"` + + // If specified, only return results for a single hour. The value of hour is an integer between 0 and 23. + // If no year, month, or day is specified, the default year, month, and day are used. + Hour *int `url:"hour,omitempty"` +} + +// PremiumRequestUsageReportOptions specifies optional parameters +// for the enhanced billing platform premium request usage report. +type PremiumRequestUsageReportOptions struct { + // If specified, only return results for a single year. + // The value of year is an integer with four digits representing a year. For example, 2025. + // Default value is the current year. + Year *int `url:"year,omitempty"` + + // If specified, only return results for a single month. + // The value of month is an integer between 1 and 12. Default value is the current month. + // If no year is specified the default year is used. + Month *int `url:"month,omitempty"` + + // If specified, only return results for a single day. + // The value of day is an integer between 1 and 31. + // If no year or month is specified, the default year and month are used. + Day *int `url:"day,omitempty"` + + // The user name to query usage for. The name is not case-sensitive. + User *string `url:"user,omitempty"` + + // The model name to query usage for. The name is not case-sensitive. + Model *string `url:"model,omitempty"` + + // The product name to query usage for. The name is not case-sensitive. + Product *string `url:"product,omitempty"` +} + +// UsageItem represents a single usage item in the enhanced billing platform report. +type UsageItem struct { + Date string `json:"date"` + Product string `json:"product"` + SKU string `json:"sku"` + Quantity float64 `json:"quantity"` + UnitType string `json:"unitType"` + PricePerUnit float64 `json:"pricePerUnit"` + GrossAmount float64 `json:"grossAmount"` + DiscountAmount float64 `json:"discountAmount"` + NetAmount float64 `json:"netAmount"` + RepositoryName *string `json:"repositoryName,omitempty"` + // Organization name is only used for organization-level reports. + OrganizationName *string `json:"organizationName,omitempty"` +} + +// UsageReport represents the enhanced billing platform usage report response. +type UsageReport struct { + UsageItems []*UsageItem `json:"usageItems,omitempty"` +} + +// PremiumRequestUsageItem represents a single usage line item in premium request usage reports. +type PremiumRequestUsageItem struct { + Product string `json:"product"` + SKU string `json:"sku"` + Model string `json:"model"` + UnitType string `json:"unitType"` + PricePerUnit float64 `json:"pricePerUnit"` + GrossQuantity float64 `json:"grossQuantity"` + GrossAmount float64 `json:"grossAmount"` + DiscountQuantity float64 `json:"discountQuantity"` + DiscountAmount float64 `json:"discountAmount"` + NetQuantity float64 `json:"netQuantity"` + NetAmount float64 `json:"netAmount"` +} + +// PremiumRequestUsageTimePeriod represents a time period for premium request usage reports. +type PremiumRequestUsageTimePeriod struct { + Year int `json:"year"` + Month *int `json:"month,omitempty"` + Day *int `json:"day,omitempty"` +} + +// PremiumRequestUsageReport represents the premium request usage report response. +type PremiumRequestUsageReport struct { + TimePeriod PremiumRequestUsageTimePeriod `json:"timePeriod"` + // Organization is only set for organization-level reports. + Organization *string `json:"organization,omitempty"` + // User is only set for user-level reports. + User *string `json:"user,omitempty"` + Product *string `json:"product,omitempty"` + Model *string `json:"model,omitempty"` + UsageItems []*PremiumRequestUsageItem `json:"usageItems"` +} + +// GetOrganizationPackagesBilling returns the free and paid storage used for GitHub Packages in gigabytes for an Org. +// +// This endpoint appears to have disappeared from the official GitHub v3 API documentation website. +// See https://github.com/google/go-github/issues/3894 for details. +func (s *BillingService) GetOrganizationPackagesBilling(ctx context.Context, org string) (*PackagesBilling, *Response, error) { + u := fmt.Sprintf("orgs/%v/settings/billing/packages", org) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var result *PackagesBilling + resp, err := s.client.Do(req, &result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// GetOrganizationStorageBilling returns the estimated paid and estimated total storage used for GitHub Actions +// and GitHub Packages in gigabytes for an Org. +// +// This endpoint appears to have disappeared from the official GitHub v3 API documentation website. +// See https://github.com/google/go-github/issues/3894 for details. +func (s *BillingService) GetOrganizationStorageBilling(ctx context.Context, org string) (*StorageBilling, *Response, error) { + u := fmt.Sprintf("orgs/%v/settings/billing/shared-storage", org) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var result *StorageBilling + resp, err := s.client.Do(req, &result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// GetOrganizationAdvancedSecurityActiveCommitters returns the GitHub Advanced Security active committers for an organization per repository. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/billing?apiVersion=2022-11-28#get-github-advanced-security-active-committers-for-an-organization +// +//meta:operation GET /orgs/{org}/settings/billing/advanced-security +func (s *BillingService) GetOrganizationAdvancedSecurityActiveCommitters(ctx context.Context, org string, opts *ActiveCommittersListOptions) (*ActiveCommitters, *Response, error) { + u := fmt.Sprintf("orgs/%v/settings/billing/advanced-security", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var result *ActiveCommitters + resp, err := s.client.Do(req, &result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// GetPackagesBilling returns the free and paid storage used for GitHub Packages in gigabytes for a user. +// +// This endpoint appears to have disappeared from the official GitHub v3 API documentation website. +// See https://github.com/google/go-github/issues/3894 for details. +func (s *BillingService) GetPackagesBilling(ctx context.Context, user string) (*PackagesBilling, *Response, error) { + u := fmt.Sprintf("users/%v/settings/billing/packages", user) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var packagesUserBilling *PackagesBilling + resp, err := s.client.Do(req, &packagesUserBilling) + if err != nil { + return nil, resp, err + } + + return packagesUserBilling, resp, nil +} + +// GetStorageBilling returns the estimated paid and estimated total storage used for GitHub Actions +// and GitHub Packages in gigabytes for a user. +// +// This endpoint appears to have disappeared from the official GitHub v3 API documentation website. +// See https://github.com/google/go-github/issues/3894 for details. +func (s *BillingService) GetStorageBilling(ctx context.Context, user string) (*StorageBilling, *Response, error) { + u := fmt.Sprintf("users/%v/settings/billing/shared-storage", user) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var storageUserBilling *StorageBilling + resp, err := s.client.Do(req, &storageUserBilling) + if err != nil { + return nil, resp, err + } + + return storageUserBilling, resp, nil +} + +// GetOrganizationUsageReport returns a report of the total usage for an organization using the enhanced billing platform. +// +// Note: This endpoint is only available to organizations with access to the enhanced billing platform. +// +// GitHub API docs: https://docs.github.com/rest/billing/usage?apiVersion=2022-11-28#get-billing-usage-report-for-an-organization +// +//meta:operation GET /organizations/{org}/settings/billing/usage +func (s *BillingService) GetOrganizationUsageReport(ctx context.Context, org string, opts *UsageReportOptions) (*UsageReport, *Response, error) { + u := fmt.Sprintf("organizations/%v/settings/billing/usage", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var usageReport *UsageReport + resp, err := s.client.Do(req, &usageReport) + if err != nil { + return nil, resp, err + } + + return usageReport, resp, nil +} + +// GetUsageReport returns a report of the total usage for a user using the enhanced billing platform. +// +// Note: This endpoint is only available to users with access to the enhanced billing platform. +// +// GitHub API docs: https://docs.github.com/rest/billing/usage?apiVersion=2022-11-28#get-billing-usage-report-for-a-user +// +//meta:operation GET /users/{username}/settings/billing/usage +func (s *BillingService) GetUsageReport(ctx context.Context, user string, opts *UsageReportOptions) (*UsageReport, *Response, error) { + u := fmt.Sprintf("users/%v/settings/billing/usage", user) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var usageReport *UsageReport + resp, err := s.client.Do(req, &usageReport) + if err != nil { + return nil, resp, err + } + + return usageReport, resp, nil +} + +// GetOrganizationPremiumRequestUsageReport returns a report of the premium request +// usage for an organization using the enhanced billing platform. +// +// Note: This endpoint is only available to organizations with access to the enhanced billing platform. +// +// GitHub API docs: https://docs.github.com/rest/billing/usage?apiVersion=2022-11-28#get-billing-premium-request-usage-report-for-an-organization +// +//meta:operation GET /organizations/{org}/settings/billing/premium_request/usage +func (s *BillingService) GetOrganizationPremiumRequestUsageReport(ctx context.Context, org string, opts *PremiumRequestUsageReportOptions) (*PremiumRequestUsageReport, *Response, error) { + u := fmt.Sprintf("organizations/%v/settings/billing/premium_request/usage", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var premiumRequestUsageReport *PremiumRequestUsageReport + resp, err := s.client.Do(req, &premiumRequestUsageReport) + if err != nil { + return nil, resp, err + } + + return premiumRequestUsageReport, resp, nil +} + +// GetPremiumRequestUsageReport returns a report of the premium request +// usage for a user using the enhanced billing platform. +// +// Note: This endpoint is only available to users with access to the enhanced billing platform. +// +// GitHub API docs: https://docs.github.com/rest/billing/usage?apiVersion=2022-11-28#get-billing-premium-request-usage-report-for-a-user +// +//meta:operation GET /users/{username}/settings/billing/premium_request/usage +func (s *BillingService) GetPremiumRequestUsageReport(ctx context.Context, user string, opts *PremiumRequestUsageReportOptions) (*PremiumRequestUsageReport, *Response, error) { + u := fmt.Sprintf("users/%v/settings/billing/premium_request/usage", user) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var premiumRequestUsageReport *PremiumRequestUsageReport + resp, err := s.client.Do(req, &premiumRequestUsageReport) + if err != nil { + return nil, resp, err + } + + return premiumRequestUsageReport, resp, nil +} diff --git a/vendor/github.com/google/go-github/v73/github/checks.go b/vendor/github.com/google/go-github/v88/github/checks.go similarity index 84% rename from vendor/github.com/google/go-github/v73/github/checks.go rename to vendor/github.com/google/go-github/v88/github/checks.go index 2f0f65bf9..aef9d8033 100644 --- a/vendor/github.com/google/go-github/v73/github/checks.go +++ b/vendor/github.com/google/go-github/v88/github/checks.go @@ -13,7 +13,7 @@ import ( // ChecksService provides access to the Checks API in the // GitHub API. // -// GitHub API docs: https://docs.github.com/rest/checks/ +// GitHub API docs: https://docs.github.com/rest/checks?apiVersion=2022-11-28 type ChecksService service // CheckRun represents a GitHub check run on a repository associated with a GitHub app. @@ -101,20 +101,20 @@ func (c CheckSuite) String() string { // GetCheckRun gets a check-run for a repository. // -// GitHub API docs: https://docs.github.com/rest/checks/runs#get-a-check-run +// GitHub API docs: https://docs.github.com/rest/checks/runs?apiVersion=2022-11-28#get-a-check-run // //meta:operation GET /repos/{owner}/{repo}/check-runs/{check_run_id} func (s *ChecksService) GetCheckRun(ctx context.Context, owner, repo string, checkRunID int64) (*CheckRun, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-runs/%v", owner, repo, checkRunID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeCheckRunsPreview) - checkRun := new(CheckRun) - resp, err := s.client.Do(ctx, req, checkRun) + var checkRun *CheckRun + resp, err := s.client.Do(req, &checkRun) if err != nil { return nil, resp, err } @@ -124,20 +124,20 @@ func (s *ChecksService) GetCheckRun(ctx context.Context, owner, repo string, che // GetCheckSuite gets a single check suite. // -// GitHub API docs: https://docs.github.com/rest/checks/suites#get-a-check-suite +// GitHub API docs: https://docs.github.com/rest/checks/suites?apiVersion=2022-11-28#get-a-check-suite // //meta:operation GET /repos/{owner}/{repo}/check-suites/{check_suite_id} func (s *ChecksService) GetCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64) (*CheckSuite, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-suites/%v", owner, repo, checkSuiteID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeCheckRunsPreview) - checkSuite := new(CheckSuite) - resp, err := s.client.Do(ctx, req, checkSuite) + var checkSuite *CheckSuite + resp, err := s.client.Do(req, &checkSuite) if err != nil { return nil, resp, err } @@ -168,20 +168,20 @@ type CheckRunAction struct { // CreateCheckRun creates a check run for repository. // -// GitHub API docs: https://docs.github.com/rest/checks/runs#create-a-check-run +// GitHub API docs: https://docs.github.com/rest/checks/runs?apiVersion=2022-11-28#create-a-check-run // //meta:operation POST /repos/{owner}/{repo}/check-runs func (s *ChecksService) CreateCheckRun(ctx context.Context, owner, repo string, opts CreateCheckRunOptions) (*CheckRun, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-runs", owner, repo) - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, opts) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeCheckRunsPreview) - checkRun := new(CheckRun) - resp, err := s.client.Do(ctx, req, checkRun) + var checkRun *CheckRun + resp, err := s.client.Do(req, &checkRun) if err != nil { return nil, resp, err } @@ -203,20 +203,20 @@ type UpdateCheckRunOptions struct { // UpdateCheckRun updates a check run for a specific commit in a repository. // -// GitHub API docs: https://docs.github.com/rest/checks/runs#update-a-check-run +// GitHub API docs: https://docs.github.com/rest/checks/runs?apiVersion=2022-11-28#update-a-check-run // //meta:operation PATCH /repos/{owner}/{repo}/check-runs/{check_run_id} func (s *ChecksService) UpdateCheckRun(ctx context.Context, owner, repo string, checkRunID int64, opts UpdateCheckRunOptions) (*CheckRun, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-runs/%v", owner, repo, checkRunID) - req, err := s.client.NewRequest("PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, opts) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeCheckRunsPreview) - checkRun := new(CheckRun) - resp, err := s.client.Do(ctx, req, checkRun) + var checkRun *CheckRun + resp, err := s.client.Do(req, &checkRun) if err != nil { return nil, resp, err } @@ -226,7 +226,7 @@ func (s *ChecksService) UpdateCheckRun(ctx context.Context, owner, repo string, // ListCheckRunAnnotations lists the annotations for a check run. // -// GitHub API docs: https://docs.github.com/rest/checks/runs#list-check-run-annotations +// GitHub API docs: https://docs.github.com/rest/checks/runs?apiVersion=2022-11-28#list-check-run-annotations // //meta:operation GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations func (s *ChecksService) ListCheckRunAnnotations(ctx context.Context, owner, repo string, checkRunID int64, opts *ListOptions) ([]*CheckRunAnnotation, *Response, error) { @@ -236,7 +236,7 @@ func (s *ChecksService) ListCheckRunAnnotations(ctx context.Context, owner, repo return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } @@ -244,7 +244,7 @@ func (s *ChecksService) ListCheckRunAnnotations(ctx context.Context, owner, repo req.Header.Set("Accept", mediaTypeCheckRunsPreview) var checkRunAnnotations []*CheckRunAnnotation - resp, err := s.client.Do(ctx, req, &checkRunAnnotations) + resp, err := s.client.Do(req, &checkRunAnnotations) if err != nil { return nil, resp, err } @@ -269,8 +269,10 @@ type ListCheckRunsResults struct { } // ListCheckRunsForRef lists check runs for a specific ref. +// The ref can be a commit SHA, branch name `heads/`, or tag name `tags/`. +// For more information, see "Git References" in the Git documentation https://git-scm.com/book/en/v2/Git-Internals-Git-References. // -// GitHub API docs: https://docs.github.com/rest/checks/runs#list-check-runs-for-a-git-reference +// GitHub API docs: https://docs.github.com/rest/checks/runs?apiVersion=2022-11-28#list-check-runs-for-a-git-reference // //meta:operation GET /repos/{owner}/{repo}/commits/{ref}/check-runs func (s *ChecksService) ListCheckRunsForRef(ctx context.Context, owner, repo, ref string, opts *ListCheckRunsOptions) (*ListCheckRunsResults, *Response, error) { @@ -280,7 +282,7 @@ func (s *ChecksService) ListCheckRunsForRef(ctx context.Context, owner, repo, re return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } @@ -288,7 +290,7 @@ func (s *ChecksService) ListCheckRunsForRef(ctx context.Context, owner, repo, re req.Header.Set("Accept", mediaTypeCheckRunsPreview) var checkRunResults *ListCheckRunsResults - resp, err := s.client.Do(ctx, req, &checkRunResults) + resp, err := s.client.Do(req, &checkRunResults) if err != nil { return nil, resp, err } @@ -298,7 +300,7 @@ func (s *ChecksService) ListCheckRunsForRef(ctx context.Context, owner, repo, re // ListCheckRunsCheckSuite lists check runs for a check suite. // -// GitHub API docs: https://docs.github.com/rest/checks/runs#list-check-runs-in-a-check-suite +// GitHub API docs: https://docs.github.com/rest/checks/runs?apiVersion=2022-11-28#list-check-runs-in-a-check-suite // //meta:operation GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs func (s *ChecksService) ListCheckRunsCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64, opts *ListCheckRunsOptions) (*ListCheckRunsResults, *Response, error) { @@ -308,7 +310,7 @@ func (s *ChecksService) ListCheckRunsCheckSuite(ctx context.Context, owner, repo return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } @@ -316,7 +318,7 @@ func (s *ChecksService) ListCheckRunsCheckSuite(ctx context.Context, owner, repo req.Header.Set("Accept", mediaTypeCheckRunsPreview) var checkRunResults *ListCheckRunsResults - resp, err := s.client.Do(ctx, req, &checkRunResults) + resp, err := s.client.Do(req, &checkRunResults) if err != nil { return nil, resp, err } @@ -326,26 +328,26 @@ func (s *ChecksService) ListCheckRunsCheckSuite(ctx context.Context, owner, repo // ReRequestCheckRun triggers GitHub to rerequest an existing check run. // -// GitHub API docs: https://docs.github.com/rest/checks/runs#rerequest-a-check-run +// GitHub API docs: https://docs.github.com/rest/checks/runs?apiVersion=2022-11-28#rerequest-a-check-run // //meta:operation POST /repos/{owner}/{repo}/check-runs/{check_run_id}/rerequest func (s *ChecksService) ReRequestCheckRun(ctx context.Context, owner, repo string, checkRunID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/check-runs/%v/rerequest", owner, repo, checkRunID) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } req.Header.Set("Accept", mediaTypeCheckRunsPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListCheckSuiteOptions represents parameters to list check suites. type ListCheckSuiteOptions struct { CheckName *string `url:"check_name,omitempty"` // Filters checks suites by the name of the check run. - AppID *int `url:"app_id,omitempty"` // Filters check suites by GitHub App id. + AppID *int64 `url:"app_id,omitempty"` // Filters check suites by GitHub App id. ListOptions } @@ -357,8 +359,10 @@ type ListCheckSuiteResults struct { } // ListCheckSuitesForRef lists check suite for a specific ref. +// The ref can be a commit SHA, branch name `heads/`, or tag name `tags/`. +// For more information, see "Git References" in the Git documentation https://git-scm.com/book/en/v2/Git-Internals-Git-References. // -// GitHub API docs: https://docs.github.com/rest/checks/suites#list-check-suites-for-a-git-reference +// GitHub API docs: https://docs.github.com/rest/checks/suites?apiVersion=2022-11-28#list-check-suites-for-a-git-reference // //meta:operation GET /repos/{owner}/{repo}/commits/{ref}/check-suites func (s *ChecksService) ListCheckSuitesForRef(ctx context.Context, owner, repo, ref string, opts *ListCheckSuiteOptions) (*ListCheckSuiteResults, *Response, error) { @@ -368,7 +372,7 @@ func (s *ChecksService) ListCheckSuitesForRef(ctx context.Context, owner, repo, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } @@ -376,7 +380,7 @@ func (s *ChecksService) ListCheckSuitesForRef(ctx context.Context, owner, repo, req.Header.Set("Accept", mediaTypeCheckRunsPreview) var checkSuiteResults *ListCheckSuiteResults - resp, err := s.client.Do(ctx, req, &checkSuiteResults) + resp, err := s.client.Do(req, &checkSuiteResults) if err != nil { return nil, resp, err } @@ -408,12 +412,12 @@ type PreferenceList struct { // SetCheckSuitePreferences changes the default automatic flow when creating check suites. // -// GitHub API docs: https://docs.github.com/rest/checks/suites#update-repository-preferences-for-check-suites +// GitHub API docs: https://docs.github.com/rest/checks/suites?apiVersion=2022-11-28#update-repository-preferences-for-check-suites // //meta:operation PATCH /repos/{owner}/{repo}/check-suites/preferences func (s *ChecksService) SetCheckSuitePreferences(ctx context.Context, owner, repo string, opts CheckSuitePreferenceOptions) (*CheckSuitePreferenceResults, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-suites/preferences", owner, repo) - req, err := s.client.NewRequest("PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, opts) if err != nil { return nil, nil, err } @@ -421,7 +425,7 @@ func (s *ChecksService) SetCheckSuitePreferences(ctx context.Context, owner, rep req.Header.Set("Accept", mediaTypeCheckRunsPreview) var checkSuitePrefResults *CheckSuitePreferenceResults - resp, err := s.client.Do(ctx, req, &checkSuitePrefResults) + resp, err := s.client.Do(req, &checkSuitePrefResults) if err != nil { return nil, resp, err } @@ -429,7 +433,7 @@ func (s *ChecksService) SetCheckSuitePreferences(ctx context.Context, owner, rep return checkSuitePrefResults, resp, nil } -// CreateCheckSuiteOptions sets up parameters to manually create a check suites. +// CreateCheckSuiteOptions sets up parameters to manually create a check suite. type CreateCheckSuiteOptions struct { HeadSHA string `json:"head_sha"` // The sha of the head commit. (Required.) HeadBranch *string `json:"head_branch,omitempty"` // The name of the head branch where the code changes are implemented. @@ -437,20 +441,20 @@ type CreateCheckSuiteOptions struct { // CreateCheckSuite manually creates a check suite for a repository. // -// GitHub API docs: https://docs.github.com/rest/checks/suites#create-a-check-suite +// GitHub API docs: https://docs.github.com/rest/checks/suites?apiVersion=2022-11-28#create-a-check-suite // //meta:operation POST /repos/{owner}/{repo}/check-suites func (s *ChecksService) CreateCheckSuite(ctx context.Context, owner, repo string, opts CreateCheckSuiteOptions) (*CheckSuite, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-suites", owner, repo) - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, opts) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeCheckRunsPreview) - checkSuite := new(CheckSuite) - resp, err := s.client.Do(ctx, req, checkSuite) + var checkSuite *CheckSuite + resp, err := s.client.Do(req, &checkSuite) if err != nil { return nil, resp, err } @@ -460,19 +464,19 @@ func (s *ChecksService) CreateCheckSuite(ctx context.Context, owner, repo string // ReRequestCheckSuite triggers GitHub to rerequest an existing check suite, without pushing new code to a repository. // -// GitHub API docs: https://docs.github.com/rest/checks/suites#rerequest-a-check-suite +// GitHub API docs: https://docs.github.com/rest/checks/suites?apiVersion=2022-11-28#rerequest-a-check-suite // //meta:operation POST /repos/{owner}/{repo}/check-suites/{check_suite_id}/rerequest func (s *ChecksService) ReRequestCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/check-suites/%v/rerequest", owner, repo, checkSuiteID) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } req.Header.Set("Accept", mediaTypeCheckRunsPreview) - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) return resp, err } diff --git a/vendor/github.com/google/go-github/v88/github/classroom.go b/vendor/github.com/google/go-github/v88/github/classroom.go new file mode 100644 index 000000000..ddc9372ab --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/classroom.go @@ -0,0 +1,256 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// ClassroomService handles communication with the GitHub Classroom related +// methods of the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom?apiVersion=2022-11-28 +type ClassroomService service + +// ClassroomUser represents a GitHub user simplified for Classroom. +type ClassroomUser struct { + ID *int64 `json:"id,omitempty"` + Login *string `json:"login,omitempty"` + AvatarURL *string `json:"avatar_url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` +} + +func (u ClassroomUser) String() string { + return Stringify(u) +} + +// Classroom represents a GitHub Classroom. +type Classroom struct { + ID *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Archived *bool `json:"archived,omitempty"` + Organization *Organization `json:"organization,omitempty"` + URL *string `json:"url,omitempty"` +} + +func (c Classroom) String() string { + return Stringify(c) +} + +// ClassroomAssignment represents a GitHub Classroom assignment. +type ClassroomAssignment struct { + ID *int64 `json:"id,omitempty"` + PublicRepo *bool `json:"public_repo,omitempty"` + Title *string `json:"title,omitempty"` + Type *string `json:"type,omitempty"` + InviteLink *string `json:"invite_link,omitempty"` + InvitationsEnabled *bool `json:"invitations_enabled,omitempty"` + Slug *string `json:"slug,omitempty"` + StudentsAreRepoAdmins *bool `json:"students_are_repo_admins,omitempty"` + FeedbackPullRequestsEnabled *bool `json:"feedback_pull_requests_enabled,omitempty"` + MaxTeams *int `json:"max_teams,omitempty"` + MaxMembers *int `json:"max_members,omitempty"` + Editor *string `json:"editor,omitempty"` + Accepted *int `json:"accepted,omitempty"` + Submitted *int `json:"submitted,omitempty"` + Passing *int `json:"passing,omitempty"` + Language *string `json:"language,omitempty"` + Deadline *Timestamp `json:"deadline,omitempty"` + StarterCodeRepository *Repository `json:"starter_code_repository,omitempty"` + Classroom *Classroom `json:"classroom,omitempty"` +} + +func (a ClassroomAssignment) String() string { + return Stringify(a) +} + +// AcceptedAssignment represents a GitHub Classroom accepted assignment. +type AcceptedAssignment struct { + ID *int64 `json:"id,omitempty"` + Submitted *bool `json:"submitted,omitempty"` + Passing *bool `json:"passing,omitempty"` + CommitCount *int `json:"commit_count,omitempty"` + Grade *string `json:"grade,omitempty"` + Students []*ClassroomUser `json:"students,omitempty"` + Repository *Repository `json:"repository,omitempty"` + Assignment *ClassroomAssignment `json:"assignment,omitempty"` +} + +func (a AcceptedAssignment) String() string { + return Stringify(a) +} + +// AssignmentGrade represents a GitHub Classroom assignment grade. +type AssignmentGrade struct { + AssignmentName *string `json:"assignment_name,omitempty"` + AssignmentURL *string `json:"assignment_url,omitempty"` + StarterCodeURL *string `json:"starter_code_url,omitempty"` + GithubUsername *string `json:"github_username,omitempty"` + RosterIdentifier *string `json:"roster_identifier,omitempty"` + StudentRepositoryName *string `json:"student_repository_name,omitempty"` + StudentRepositoryURL *string `json:"student_repository_url,omitempty"` + SubmissionTimestamp *Timestamp `json:"submission_timestamp,omitempty"` + PointsAwarded *int `json:"points_awarded,omitempty"` + PointsAvailable *int `json:"points_available,omitempty"` + GroupName *string `json:"group_name,omitempty"` +} + +func (g AssignmentGrade) String() string { + return Stringify(g) +} + +// GetAssignment gets a GitHub Classroom assignment. Assignment will only be +// returned if the current user is an administrator of the GitHub Classroom +// for the assignment. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom?apiVersion=2022-11-28#get-an-assignment +// +//meta:operation GET /assignments/{assignment_id} +func (s *ClassroomService) GetAssignment(ctx context.Context, assignmentID int64) (*ClassroomAssignment, *Response, error) { + u := fmt.Sprintf("assignments/%v", assignmentID) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var assignment *ClassroomAssignment + resp, err := s.client.Do(req, &assignment) + if err != nil { + return nil, resp, err + } + + return assignment, resp, nil +} + +// GetClassroom gets a GitHub Classroom for the current user. Classroom will only be +// returned if the current user is an administrator of the GitHub Classroom. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom?apiVersion=2022-11-28#get-a-classroom +// +//meta:operation GET /classrooms/{classroom_id} +func (s *ClassroomService) GetClassroom(ctx context.Context, classroomID int64) (*Classroom, *Response, error) { + u := fmt.Sprintf("classrooms/%v", classroomID) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var classroom *Classroom + resp, err := s.client.Do(req, &classroom) + if err != nil { + return nil, resp, err + } + + return classroom, resp, nil +} + +// ListClassrooms lists GitHub Classrooms for the current user. Classrooms will only be +// returned if the current user is an administrator of one or more GitHub Classrooms. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom?apiVersion=2022-11-28#list-classrooms +// +//meta:operation GET /classrooms +func (s *ClassroomService) ListClassrooms(ctx context.Context, opts *ListOptions) ([]*Classroom, *Response, error) { + u, err := addOptions("classrooms", opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var classrooms []*Classroom + resp, err := s.client.Do(req, &classrooms) + if err != nil { + return nil, resp, err + } + + return classrooms, resp, nil +} + +// ListClassroomAssignments lists GitHub Classroom assignments for a classroom. Assignments will only be +// returned if the current user is an administrator of the GitHub Classroom. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom?apiVersion=2022-11-28#list-assignments-for-a-classroom +// +//meta:operation GET /classrooms/{classroom_id}/assignments +func (s *ClassroomService) ListClassroomAssignments(ctx context.Context, classroomID int64, opts *ListOptions) ([]*ClassroomAssignment, *Response, error) { + u := fmt.Sprintf("classrooms/%v/assignments", classroomID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var assignments []*ClassroomAssignment + resp, err := s.client.Do(req, &assignments) + if err != nil { + return nil, resp, err + } + + return assignments, resp, nil +} + +// ListAcceptedAssignments lists accepted assignments for a GitHub Classroom assignment. +// Accepted assignments will only be returned if the current user is an administrator +// of the GitHub Classroom for the assignment. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom?apiVersion=2022-11-28#list-accepted-assignments-for-an-assignment +// +//meta:operation GET /assignments/{assignment_id}/accepted_assignments +func (s *ClassroomService) ListAcceptedAssignments(ctx context.Context, assignmentID int64, opts *ListOptions) ([]*AcceptedAssignment, *Response, error) { + u := fmt.Sprintf("assignments/%v/accepted_assignments", assignmentID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var acceptedAssignments []*AcceptedAssignment + resp, err := s.client.Do(req, &acceptedAssignments) + if err != nil { + return nil, resp, err + } + + return acceptedAssignments, resp, nil +} + +// GetAssignmentGrades gets assignment grades for a GitHub Classroom assignment. +// Grades will only be returned if the current user is an administrator +// of the GitHub Classroom for the assignment. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom?apiVersion=2022-11-28#get-assignment-grades +// +//meta:operation GET /assignments/{assignment_id}/grades +func (s *ClassroomService) GetAssignmentGrades(ctx context.Context, assignmentID int64) ([]*AssignmentGrade, *Response, error) { + u := fmt.Sprintf("assignments/%v/grades", assignmentID) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var grades []*AssignmentGrade + resp, err := s.client.Do(req, &grades) + if err != nil { + return nil, resp, err + } + + return grades, resp, nil +} diff --git a/vendor/github.com/google/go-github/v73/github/code_scanning.go b/vendor/github.com/google/go-github/v88/github/code_scanning.go similarity index 87% rename from vendor/github.com/google/go-github/v73/github/code_scanning.go rename to vendor/github.com/google/go-github/v88/github/code_scanning.go index 19a88241d..3aeaa8b70 100644 --- a/vendor/github.com/google/go-github/v73/github/code_scanning.go +++ b/vendor/github.com/google/go-github/v88/github/code_scanning.go @@ -17,7 +17,7 @@ import ( // CodeScanningService handles communication with the code scanning related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/code-scanning +// GitHub API docs: https://docs.github.com/rest/code-scanning?apiVersion=2022-11-28 type CodeScanningService service // Rule represents the complete details of GitHub Code Scanning alert type. @@ -69,7 +69,7 @@ type Tool struct { // Alert represents an individual GitHub Code Scanning Alert on a single repository. // -// GitHub API docs: https://docs.github.com/rest/code-scanning +// GitHub API docs: https://docs.github.com/rest/code-scanning?apiVersion=2022-11-28 type Alert struct { Number *int `json:"number,omitempty"` Repository *Repository `json:"repository,omitempty"` @@ -171,7 +171,7 @@ type AnalysesListOptions struct { // CodeQLDatabase represents a metadata about the CodeQL database. // -// GitHub API docs: https://docs.github.com/rest/code-scanning +// GitHub API docs: https://docs.github.com/rest/code-scanning?apiVersion=2022-11-28 type CodeQLDatabase struct { ID *int64 `json:"id,omitempty"` Name *string `json:"name,omitempty"` @@ -186,7 +186,7 @@ type CodeQLDatabase struct { // ScanningAnalysis represents an individual GitHub Code Scanning ScanningAnalysis on a single repository. // -// GitHub API docs: https://docs.github.com/rest/code-scanning +// GitHub API docs: https://docs.github.com/rest/code-scanning?apiVersion=2022-11-28 type ScanningAnalysis struct { ID *int64 `json:"id,omitempty"` Ref *string `json:"ref,omitempty"` @@ -207,7 +207,7 @@ type ScanningAnalysis struct { // SarifAnalysis specifies the results of a code scanning job. // -// GitHub API docs: https://docs.github.com/rest/code-scanning +// GitHub API docs: https://docs.github.com/rest/code-scanning?apiVersion=2022-11-28 type SarifAnalysis struct { CommitSHA *string `json:"commit_sha,omitempty"` Ref *string `json:"ref,omitempty"` @@ -219,7 +219,7 @@ type SarifAnalysis struct { // CodeScanningAlertState specifies the state of a code scanning alert. // -// GitHub API docs: https://docs.github.com/rest/code-scanning +// GitHub API docs: https://docs.github.com/rest/code-scanning?apiVersion=2022-11-28 type CodeScanningAlertState struct { // State sets the state of the code scanning alert and is a required field. // You must also provide DismissedReason when you set the state to "dismissed". @@ -235,7 +235,7 @@ type CodeScanningAlertState struct { // SarifID identifies a sarif analysis upload. // -// GitHub API docs: https://docs.github.com/rest/code-scanning +// GitHub API docs: https://docs.github.com/rest/code-scanning?apiVersion=2022-11-28 type SarifID struct { ID *string `json:"id,omitempty"` URL *string `json:"url,omitempty"` @@ -246,7 +246,7 @@ type SarifID struct { // You must use an access token with the security_events scope to use this endpoint. GitHub Apps must have the security_events // read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#list-code-scanning-alerts-for-an-organization +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#list-code-scanning-alerts-for-an-organization // //meta:operation GET /orgs/{org}/code-scanning/alerts func (s *CodeScanningService) ListAlertsForOrg(ctx context.Context, org string, opts *AlertListOptions) ([]*Alert, *Response, error) { @@ -256,13 +256,13 @@ func (s *CodeScanningService) ListAlertsForOrg(ctx context.Context, org string, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var alerts []*Alert - resp, err := s.client.Do(ctx, req, &alerts) + resp, err := s.client.Do(req, &alerts) if err != nil { return nil, resp, err } @@ -276,7 +276,7 @@ func (s *CodeScanningService) ListAlertsForOrg(ctx context.Context, org string, // You must use an access token with the security_events scope to use this endpoint. GitHub Apps must have the security_events // read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#list-code-scanning-alerts-for-a-repository +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#list-code-scanning-alerts-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/code-scanning/alerts func (s *CodeScanningService) ListAlertsForRepo(ctx context.Context, owner, repo string, opts *AlertListOptions) ([]*Alert, *Response, error) { @@ -286,13 +286,13 @@ func (s *CodeScanningService) ListAlertsForRepo(ctx context.Context, owner, repo return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var alerts []*Alert - resp, err := s.client.Do(ctx, req, &alerts) + resp, err := s.client.Do(req, &alerts) if err != nil { return nil, resp, err } @@ -307,19 +307,19 @@ func (s *CodeScanningService) ListAlertsForRepo(ctx context.Context, owner, repo // // The security alert_id is the number at the end of the security alert's URL. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#get-a-code-scanning-alert +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#get-a-code-scanning-alert // //meta:operation GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number} func (s *CodeScanningService) GetAlert(ctx context.Context, owner, repo string, id int64) (*Alert, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/alerts/%v", owner, repo, id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - a := new(Alert) - resp, err := s.client.Do(ctx, req, a) + var a *Alert + resp, err := s.client.Do(req, &a) if err != nil { return nil, resp, err } @@ -334,19 +334,19 @@ func (s *CodeScanningService) GetAlert(ctx context.Context, owner, repo string, // // The security alert_id is the number at the end of the security alert's URL. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#update-a-code-scanning-alert +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#update-a-code-scanning-alert // //meta:operation PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number} func (s *CodeScanningService) UpdateAlert(ctx context.Context, owner, repo string, id int64, stateInfo *CodeScanningAlertState) (*Alert, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/alerts/%v", owner, repo, id) - req, err := s.client.NewRequest("PATCH", u, stateInfo) + req, err := s.client.NewRequest(ctx, "PATCH", u, stateInfo) if err != nil { return nil, nil, err } - a := new(Alert) - resp, err := s.client.Do(ctx, req, a) + var a *Alert + resp, err := s.client.Do(req, &a) if err != nil { return nil, resp, err } @@ -359,7 +359,7 @@ func (s *CodeScanningService) UpdateAlert(ctx context.Context, owner, repo strin // You must use an access token with the security_events scope to use this endpoint. // GitHub Apps must have the security_events read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#list-instances-of-a-code-scanning-alert +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#list-instances-of-a-code-scanning-alert // //meta:operation GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances func (s *CodeScanningService) ListAlertInstances(ctx context.Context, owner, repo string, id int64, opts *AlertInstancesListOptions) ([]*MostRecentInstance, *Response, error) { @@ -369,13 +369,13 @@ func (s *CodeScanningService) ListAlertInstances(ctx context.Context, owner, rep return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var alertInstances []*MostRecentInstance - resp, err := s.client.Do(ctx, req, &alertInstances) + resp, err := s.client.Do(req, &alertInstances) if err != nil { return nil, resp, err } @@ -389,19 +389,19 @@ func (s *CodeScanningService) ListAlertInstances(ctx context.Context, owner, rep // You must use an access token with the security_events scope to use this endpoint. GitHub Apps must have the security_events // write permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#upload-an-analysis-as-sarif-data +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#upload-an-analysis-as-sarif-data // //meta:operation POST /repos/{owner}/{repo}/code-scanning/sarifs func (s *CodeScanningService) UploadSarif(ctx context.Context, owner, repo string, sarif *SarifAnalysis) (*SarifID, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/sarifs", owner, repo) - req, err := s.client.NewRequest("POST", u, sarif) + req, err := s.client.NewRequest(ctx, "POST", u, sarif) if err != nil { return nil, nil, err } // This will always return an error without unmarshaling the data - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) // Even though there was an error, we still return the response // in case the caller wants to inspect it further. // However, if the error is AcceptedError, decode it below before @@ -410,8 +410,8 @@ func (s *CodeScanningService) UploadSarif(ctx context.Context, owner, repo strin if !errors.As(err, &acceptedError) { return nil, resp, err } - sarifID := new(SarifID) - decErr := json.Unmarshal(acceptedError.Raw, sarifID) + var sarifID *SarifID + decErr := json.Unmarshal(acceptedError.Raw, &sarifID) if decErr != nil { return nil, resp, decErr } @@ -433,19 +433,19 @@ type SARIFUpload struct { // You must use an access token with the security_events scope to use this endpoint. // GitHub Apps must have the security_events read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#get-information-about-a-sarif-upload +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#get-information-about-a-sarif-upload // //meta:operation GET /repos/{owner}/{repo}/code-scanning/sarifs/{sarif_id} func (s *CodeScanningService) GetSARIF(ctx context.Context, owner, repo, sarifID string) (*SARIFUpload, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/sarifs/%v", owner, repo, sarifID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - sarifUpload := new(SARIFUpload) - resp, err := s.client.Do(ctx, req, sarifUpload) + var sarifUpload *SARIFUpload + resp, err := s.client.Do(req, &sarifUpload) if err != nil { return nil, resp, err } @@ -459,7 +459,7 @@ func (s *CodeScanningService) GetSARIF(ctx context.Context, owner, repo, sarifID // You must use an access token with the security_events scope to use this endpoint. // GitHub Apps must have the security_events read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#list-code-scanning-analyses-for-a-repository +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#list-code-scanning-analyses-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/code-scanning/analyses func (s *CodeScanningService) ListAnalysesForRepo(ctx context.Context, owner, repo string, opts *AnalysesListOptions) ([]*ScanningAnalysis, *Response, error) { @@ -469,13 +469,13 @@ func (s *CodeScanningService) ListAnalysesForRepo(ctx context.Context, owner, re return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var analyses []*ScanningAnalysis - resp, err := s.client.Do(ctx, req, &analyses) + resp, err := s.client.Do(req, &analyses) if err != nil { return nil, resp, err } @@ -490,19 +490,19 @@ func (s *CodeScanningService) ListAnalysesForRepo(ctx context.Context, owner, re // // The security analysis_id is the ID of the analysis, as returned from the ListAnalysesForRepo operation. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#get-a-code-scanning-analysis-for-a-repository +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#get-a-code-scanning-analysis-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id} func (s *CodeScanningService) GetAnalysis(ctx context.Context, owner, repo string, id int64) (*ScanningAnalysis, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/analyses/%v", owner, repo, id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - analysis := new(ScanningAnalysis) - resp, err := s.client.Do(ctx, req, analysis) + var analysis *ScanningAnalysis + resp, err := s.client.Do(req, &analysis) if err != nil { return nil, resp, err } @@ -525,19 +525,19 @@ type DeleteAnalysis struct { // // The security analysis_id is the ID of the analysis, as returned from the ListAnalysesForRepo operation. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#delete-a-code-scanning-analysis-from-a-repository +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#delete-a-code-scanning-analysis-from-a-repository // //meta:operation DELETE /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id} func (s *CodeScanningService) DeleteAnalysis(ctx context.Context, owner, repo string, id int64) (*DeleteAnalysis, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/analyses/%v", owner, repo, id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, nil, err } - deleteAnalysis := new(DeleteAnalysis) - resp, err := s.client.Do(ctx, req, deleteAnalysis) + var deleteAnalysis *DeleteAnalysis + resp, err := s.client.Do(req, &deleteAnalysis) if err != nil { return nil, resp, err } @@ -550,19 +550,19 @@ func (s *CodeScanningService) DeleteAnalysis(ctx context.Context, owner, repo st // You must use an access token with the security_events scope to use this endpoint. // GitHub Apps must have the contents read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#list-codeql-databases-for-a-repository +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#list-codeql-databases-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/code-scanning/codeql/databases func (s *CodeScanningService) ListCodeQLDatabases(ctx context.Context, owner, repo string) ([]*CodeQLDatabase, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/codeql/databases", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var codeqlDatabases []*CodeQLDatabase - resp, err := s.client.Do(ctx, req, &codeqlDatabases) + resp, err := s.client.Do(req, &codeqlDatabases) if err != nil { return nil, resp, err } @@ -575,19 +575,19 @@ func (s *CodeScanningService) ListCodeQLDatabases(ctx context.Context, owner, re // You must use an access token with the security_events scope to use this endpoint. // GitHub Apps must have the contents read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#get-a-codeql-database-for-a-repository +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#get-a-codeql-database-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/code-scanning/codeql/databases/{language} func (s *CodeScanningService) GetCodeQLDatabase(ctx context.Context, owner, repo, language string) (*CodeQLDatabase, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/codeql/databases/%v", owner, repo, language) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - codeqlDatabase := new(CodeQLDatabase) - resp, err := s.client.Do(ctx, req, codeqlDatabase) + var codeqlDatabase *CodeQLDatabase + resp, err := s.client.Do(req, &codeqlDatabase) if err != nil { return nil, resp, err } @@ -609,19 +609,19 @@ type DefaultSetupConfiguration struct { // endpoint with private repos or the public_repo scope for public repos. GitHub Apps must have the repo write // permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#get-a-code-scanning-default-setup-configuration +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#get-a-code-scanning-default-setup-configuration // //meta:operation GET /repos/{owner}/{repo}/code-scanning/default-setup func (s *CodeScanningService) GetDefaultSetupConfiguration(ctx context.Context, owner, repo string) (*DefaultSetupConfiguration, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/code-scanning/default-setup", owner, repo) + u := fmt.Sprintf("repos/%v/%v/code-scanning/default-setup", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - cfg := new(DefaultSetupConfiguration) - resp, err := s.client.Do(ctx, req, cfg) + var cfg *DefaultSetupConfiguration + resp, err := s.client.Do(req, &cfg) if err != nil { return nil, resp, err } @@ -652,19 +652,19 @@ type UpdateDefaultSetupConfigurationResponse struct { // This method might return an AcceptedError and a status code of 202. This is because this is the status that GitHub // returns to signify that it has now scheduled the update of the pull request branch in a background task. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#update-a-code-scanning-default-setup-configuration +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#update-a-code-scanning-default-setup-configuration // //meta:operation PATCH /repos/{owner}/{repo}/code-scanning/default-setup func (s *CodeScanningService) UpdateDefaultSetupConfiguration(ctx context.Context, owner, repo string, options *UpdateDefaultSetupConfigurationOptions) (*UpdateDefaultSetupConfigurationResponse, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/code-scanning/default-setup", owner, repo) + u := fmt.Sprintf("repos/%v/%v/code-scanning/default-setup", owner, repo) - req, err := s.client.NewRequest("PATCH", u, options) + req, err := s.client.NewRequest(ctx, "PATCH", u, options) if err != nil { return nil, nil, err } - a := new(UpdateDefaultSetupConfigurationResponse) - resp, err := s.client.Do(ctx, req, a) + var a *UpdateDefaultSetupConfigurationResponse + resp, err := s.client.Do(req, &a) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/codesofconduct.go b/vendor/github.com/google/go-github/v88/github/codesofconduct.go similarity index 80% rename from vendor/github.com/google/go-github/v73/github/codesofconduct.go rename to vendor/github.com/google/go-github/v88/github/codesofconduct.go index aba057417..882e732c3 100644 --- a/vendor/github.com/google/go-github/v73/github/codesofconduct.go +++ b/vendor/github.com/google/go-github/v88/github/codesofconduct.go @@ -27,20 +27,19 @@ func (c *CodeOfConduct) String() string { // List returns all codes of conduct. // -// GitHub API docs: https://docs.github.com/rest/codes-of-conduct/codes-of-conduct#get-all-codes-of-conduct +// GitHub API docs: https://docs.github.com/rest/codes-of-conduct/codes-of-conduct?apiVersion=2022-11-28#get-all-codes-of-conduct // //meta:operation GET /codes_of_conduct func (s *CodesOfConductService) List(ctx context.Context) ([]*CodeOfConduct, *Response, error) { - req, err := s.client.NewRequest("GET", "codes_of_conduct", nil) + req, err := s.client.NewRequest(ctx, "GET", "codes_of_conduct", nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeCodesOfConductPreview) var cs []*CodeOfConduct - resp, err := s.client.Do(ctx, req, &cs) + resp, err := s.client.Do(req, &cs) if err != nil { return nil, resp, err } @@ -57,21 +56,20 @@ func (c *Client) ListCodesOfConduct(ctx context.Context) ([]*CodeOfConduct, *Res // Get returns an individual code of conduct. // -// GitHub API docs: https://docs.github.com/rest/codes-of-conduct/codes-of-conduct#get-a-code-of-conduct +// GitHub API docs: https://docs.github.com/rest/codes-of-conduct/codes-of-conduct?apiVersion=2022-11-28#get-a-code-of-conduct // //meta:operation GET /codes_of_conduct/{key} func (s *CodesOfConductService) Get(ctx context.Context, key string) (*CodeOfConduct, *Response, error) { - u := fmt.Sprintf("codes_of_conduct/%s", key) - req, err := s.client.NewRequest("GET", u, nil) + u := fmt.Sprintf("codes_of_conduct/%v", key) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeCodesOfConductPreview) - coc := new(CodeOfConduct) - resp, err := s.client.Do(ctx, req, coc) + var coc *CodeOfConduct + resp, err := s.client.Do(req, &coc) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v88/github/codespaces.go b/vendor/github.com/google/go-github/v88/github/codespaces.go new file mode 100644 index 000000000..8a8ad888d --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/codespaces.go @@ -0,0 +1,591 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// CodespacesService handles communication with the Codespaces related +// methods of the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/codespaces?apiVersion=2022-11-28 +type CodespacesService service + +// Codespace represents a codespace. +// +// GitHub API docs: https://docs.github.com/rest/codespaces?apiVersion=2022-11-28 +type Codespace struct { + ID *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + DisplayName *string `json:"display_name,omitempty"` + EnvironmentID *string `json:"environment_id,omitempty"` + Owner *User `json:"owner,omitempty"` + BillableOwner *User `json:"billable_owner,omitempty"` + Repository *Repository `json:"repository,omitempty"` + Machine *CodespacesMachine `json:"machine,omitempty"` + DevcontainerPath *string `json:"devcontainer_path,omitempty"` + Prebuild *bool `json:"prebuild,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + LastUsedAt *Timestamp `json:"last_used_at,omitempty"` + State *string `json:"state,omitempty"` + URL *string `json:"url,omitempty"` + GitStatus *CodespacesGitStatus `json:"git_status,omitempty"` + Location *string `json:"location,omitempty"` + IdleTimeoutMinutes *int `json:"idle_timeout_minutes,omitempty"` + WebURL *string `json:"web_url,omitempty"` + MachinesURL *string `json:"machines_url,omitempty"` + StartURL *string `json:"start_url,omitempty"` + StopURL *string `json:"stop_url,omitempty"` + PullsURL *string `json:"pulls_url,omitempty"` + RecentFolders []string `json:"recent_folders,omitempty"` + RuntimeConstraints *CodespacesRuntimeConstraints `json:"runtime_constraints,omitempty"` + PendingOperation *bool `json:"pending_operation,omitempty"` + PendingOperationDisabledReason *string `json:"pending_operation_disabled_reason,omitempty"` + IdleTimeoutNotice *string `json:"idle_timeout_notice,omitempty"` + RetentionPeriodMinutes *int `json:"retention_period_minutes,omitempty"` + RetentionExpiresAt *Timestamp `json:"retention_expires_at,omitempty"` + LastKnownStopNotice *string `json:"last_known_stop_notice,omitempty"` +} + +// CodespacesGitStatus represents the git status of a codespace. +type CodespacesGitStatus struct { + Ahead *int `json:"ahead,omitempty"` + Behind *int `json:"behind,omitempty"` + HasUnpushedChanges *bool `json:"has_unpushed_changes,omitempty"` + HasUncommittedChanges *bool `json:"has_uncommitted_changes,omitempty"` + Ref *string `json:"ref,omitempty"` +} + +// CodespacesMachine represents the machine type of a codespace. +type CodespacesMachine struct { + Name *string `json:"name,omitempty"` + DisplayName *string `json:"display_name,omitempty"` + OperatingSystem *string `json:"operating_system,omitempty"` + StorageInBytes *int64 `json:"storage_in_bytes,omitempty"` + MemoryInBytes *int64 `json:"memory_in_bytes,omitempty"` + CPUs *int `json:"cpus,omitempty"` + PrebuildAvailability *string `json:"prebuild_availability,omitempty"` +} + +// CodespacesRuntimeConstraints represents the runtime constraints of a codespace. +type CodespacesRuntimeConstraints struct { + AllowedPortPrivacySettings []string `json:"allowed_port_privacy_settings,omitempty"` +} + +// ListCodespaces represents the response from the list codespaces endpoints. +type ListCodespaces struct { + TotalCount *int `json:"total_count,omitempty"` + Codespaces []*Codespace `json:"codespaces"` +} + +// ListInRepo lists codespaces for a user in a repository. +// +// Lists the codespaces associated with a specified repository and the authenticated user. +// You must authenticate using an access token with the codespace scope to use this endpoint. +// GitHub Apps must have read access to the codespaces repository permission to use this endpoint. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#list-codespaces-in-a-repository-for-the-authenticated-user +// +//meta:operation GET /repos/{owner}/{repo}/codespaces +func (s *CodespacesService) ListInRepo(ctx context.Context, owner, repo string, opts *ListOptions) (*ListCodespaces, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/codespaces", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var codespaces *ListCodespaces + resp, err := s.client.Do(req, &codespaces) + if err != nil { + return nil, resp, err + } + + return codespaces, resp, nil +} + +// ListCodespacesOptions represents the options for listing codespaces for a user. +type ListCodespacesOptions struct { + ListOptions + RepositoryID int64 `url:"repository_id,omitempty"` +} + +// List lists codespaces for an authenticated user. +// +// Lists the authenticated user's codespaces. +// You must authenticate using an access token with the codespace scope to use this endpoint. +// GitHub Apps must have read access to the codespaces repository permission to use this endpoint. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#list-codespaces-for-the-authenticated-user +// +//meta:operation GET /user/codespaces +func (s *CodespacesService) List(ctx context.Context, opts *ListCodespacesOptions) (*ListCodespaces, *Response, error) { + u := "user/codespaces" + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var codespaces *ListCodespaces + resp, err := s.client.Do(req, &codespaces) + if err != nil { + return nil, resp, err + } + + return codespaces, resp, nil +} + +// CreateCodespaceOptions represents options for the creation of a codespace in a repository. +type CreateCodespaceOptions struct { + Ref *string `json:"ref,omitempty"` + // Geo represents the geographic area for this codespace. + // If not specified, the value is assigned by IP. + // This property replaces location, which is being deprecated. + // Geo can be one of: `EuropeWest`, `SoutheastAsia`, `UsEast`, `UsWest`. + Geo *string `json:"geo,omitempty"` + ClientIP *string `json:"client_ip,omitempty"` + Machine *string `json:"machine,omitempty"` + DevcontainerPath *string `json:"devcontainer_path,omitempty"` + MultiRepoPermissionsOptOut *bool `json:"multi_repo_permissions_opt_out,omitempty"` + WorkingDirectory *string `json:"working_directory,omitempty"` + IdleTimeoutMinutes *int `json:"idle_timeout_minutes,omitempty"` + DisplayName *string `json:"display_name,omitempty"` + // RetentionPeriodMinutes represents the duration in minutes after codespace has gone idle in which it will be deleted. + // Must be integer minutes between 0 and 43200 (30 days). + RetentionPeriodMinutes *int `json:"retention_period_minutes,omitempty"` + Location *string `json:"location,omitempty"` +} + +// DevContainer represents a devcontainer configuration in a repository. +type DevContainer struct { + Path string `json:"path"` + Name *string `json:"name,omitempty"` + DisplayName *string `json:"display_name,omitempty"` +} + +// DevContainerConfigurations represents a list of devcontainer configurations in a repository. +type DevContainerConfigurations struct { + Devcontainers []*DevContainer `json:"devcontainers"` + TotalCount int64 `json:"total_count"` +} + +// CodespaceDefaults represents default settings for a Codespace. +type CodespaceDefaults struct { + Location string `json:"location"` + DevcontainerPath *string `json:"devcontainer_path,omitempty"` +} + +// CodespaceDefaultAttributes represents the default attributes for codespaces created by the user with the repository. +type CodespaceDefaultAttributes struct { + BillableOwner *User `json:"billable_owner"` + Defaults *CodespaceDefaults `json:"defaults"` +} + +// CodespaceGetDefaultAttributesOptions represents options for getting default attributes for a codespace. +type CodespaceGetDefaultAttributesOptions struct { + // Ref represents the branch or commit to check for a default devcontainer path. If not specified, the default branch will be checked. + Ref *string `url:"ref,omitempty"` + // ClientIP represents an alternative IP for default location auto-detection, such as when proxying a request. + ClientIP *string `url:"client_ip,omitempty"` +} + +// CodespacePullRequestOptions represents options for a CodespacePullRequest. +type CodespacePullRequestOptions struct { + // PullRequestNumber represents the pull request number. + PullRequestNumber int64 `json:"pull_request_number"` + // RepositoryID represents the repository ID for this codespace. + RepositoryID int64 `json:"repository_id"` +} + +// CodespaceCreateForUserOptions represents options for creating a codespace for the authenticated user. +type CodespaceCreateForUserOptions struct { + PullRequest *CodespacePullRequestOptions `json:"pull_request"` + // RepositoryID represents the repository ID for this codespace. + RepositoryID int64 `json:"repository_id"` + Ref *string `json:"ref,omitempty"` + Geo *string `json:"geo,omitempty"` + ClientIP *string `json:"client_ip,omitempty"` + RetentionPeriodMinutes *int `json:"retention_period_minutes,omitempty"` + Location *string `json:"location,omitempty"` + Machine *string `json:"machine,omitempty"` + DevcontainerPath *string `json:"devcontainer_path,omitempty"` + MultiRepoPermissionsOptOut *bool `json:"multi_repo_permissions_opt_out,omitempty"` + WorkingDirectory *string `json:"working_directory,omitempty"` + IdleTimeoutMinutes *int `json:"idle_timeout_minutes,omitempty"` + DisplayName *string `json:"display_name,omitempty"` +} + +// UpdateCodespaceOptions represents options for updating a codespace. +type UpdateCodespaceOptions struct { + // Machine represents a valid machine to transition this codespace to. + Machine *string `json:"machine,omitempty"` + // RecentFolders represents the recently opened folders inside the codespace. + // It is currently used by the clients to determine the folder path to load the codespace in. + RecentFolders []string `json:"recent_folders,omitempty"` +} + +// CodespaceExport represents an export of a codespace. +type CodespaceExport struct { + // Can be one of: `succeeded`, `failed`, `in_progress`. + State *string `json:"state,omitempty"` + CompletedAt *Timestamp `json:"completed_at,omitempty"` + Branch *string `json:"branch,omitempty"` + SHA *string `json:"sha,omitempty"` + ID *string `json:"id,omitempty"` + ExportURL *string `json:"export_url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` +} + +// PublishCodespaceOptions represents options for creating a repository from an unpublished codespace. +type PublishCodespaceOptions struct { + // Name represents the name of the new repository. + Name *string `json:"name,omitempty"` + // Private represents whether the new repository is private. Defaults to false. + Private *bool `json:"private,omitempty"` +} + +// CodespacePermissions represents a response indicating whether the permissions defined by a devcontainer have been accepted. +type CodespacePermissions struct { + Accepted bool `json:"accepted"` +} + +// CreateInRepo creates a codespace in a repository. +// +// Creates a codespace owned by the authenticated user in the specified repository. +// You must authenticate using an access token with the codespace scope to use this endpoint. +// GitHub Apps must have write access to the codespaces repository permission to use this endpoint. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#create-a-codespace-in-a-repository +// +//meta:operation POST /repos/{owner}/{repo}/codespaces +func (s *CodespacesService) CreateInRepo(ctx context.Context, owner, repo string, request *CreateCodespaceOptions) (*Codespace, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/codespaces", owner, repo) + req, err := s.client.NewRequest(ctx, "POST", u, request) + if err != nil { + return nil, nil, err + } + + var codespace *Codespace + resp, err := s.client.Do(req, &codespace) + if err != nil { + return nil, resp, err + } + + return codespace, resp, nil +} + +// Start starts a codespace. +// +// You must authenticate using an access token with the codespace scope to use this endpoint. +// GitHub Apps must have write access to the codespaces_lifecycle_admin repository permission to use this endpoint. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#start-a-codespace-for-the-authenticated-user +// +//meta:operation POST /user/codespaces/{codespace_name}/start +func (s *CodespacesService) Start(ctx context.Context, codespaceName string) (*Codespace, *Response, error) { + u := fmt.Sprintf("user/codespaces/%v/start", codespaceName) + req, err := s.client.NewRequest(ctx, "POST", u, nil) + if err != nil { + return nil, nil, err + } + + var codespace *Codespace + resp, err := s.client.Do(req, &codespace) + if err != nil { + return nil, resp, err + } + + return codespace, resp, nil +} + +// Stop stops a codespace. +// +// You must authenticate using an access token with the codespace scope to use this endpoint. +// GitHub Apps must have write access to the codespaces_lifecycle_admin repository permission to use this endpoint. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#stop-a-codespace-for-the-authenticated-user +// +//meta:operation POST /user/codespaces/{codespace_name}/stop +func (s *CodespacesService) Stop(ctx context.Context, codespaceName string) (*Codespace, *Response, error) { + u := fmt.Sprintf("user/codespaces/%v/stop", codespaceName) + req, err := s.client.NewRequest(ctx, "POST", u, nil) + if err != nil { + return nil, nil, err + } + + var codespace *Codespace + resp, err := s.client.Do(req, &codespace) + if err != nil { + return nil, resp, err + } + + return codespace, resp, nil +} + +// Delete deletes a codespace. +// +// You must authenticate using an access token with the codespace scope to use this endpoint. +// GitHub Apps must have write access to the codespaces repository permission to use this endpoint. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#delete-a-codespace-for-the-authenticated-user +// +//meta:operation DELETE /user/codespaces/{codespace_name} +func (s *CodespacesService) Delete(ctx context.Context, codespaceName string) (*Response, error) { + u := fmt.Sprintf("user/codespaces/%v", codespaceName) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// ListDevContainerConfigurations lists devcontainer configurations in a repository for the authenticated user. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#list-devcontainer-configurations-in-a-repository-for-the-authenticated-user +// +//meta:operation GET /repos/{owner}/{repo}/codespaces/devcontainers +func (s *CodespacesService) ListDevContainerConfigurations(ctx context.Context, owner, repo string, opts *ListOptions) (*DevContainerConfigurations, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/codespaces/devcontainers", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var devcontainers *DevContainerConfigurations + resp, err := s.client.Do(req, &devcontainers) + if err != nil { + return nil, resp, err + } + + return devcontainers, resp, nil +} + +// GetDefaultAttributes gets the default attributes for codespaces created by the user with the repository. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#get-default-attributes-for-a-codespace +// +//meta:operation GET /repos/{owner}/{repo}/codespaces/new +func (s *CodespacesService) GetDefaultAttributes(ctx context.Context, owner, repo string, opts *CodespaceGetDefaultAttributesOptions) (*CodespaceDefaultAttributes, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/codespaces/new", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var attributes *CodespaceDefaultAttributes + resp, err := s.client.Do(req, &attributes) + if err != nil { + return nil, resp, err + } + + return attributes, resp, nil +} + +// CheckPermissions checks whether the permissions defined by a given devcontainer configuration have been accepted by the authenticated user. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#check-if-permissions-defined-by-a-devcontainer-have-been-accepted-by-the-authenticated-user +// +//meta:operation GET /repos/{owner}/{repo}/codespaces/permissions_check +func (s *CodespacesService) CheckPermissions(ctx context.Context, owner, repo, ref, devcontainerPath string) (*CodespacePermissions, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/codespaces/permissions_check", owner, repo) + u, err := addOptions(u, &struct { + Ref string `url:"ref"` + DevcontainerPath string `url:"devcontainer_path"` + }{ + Ref: ref, + DevcontainerPath: devcontainerPath, + }) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions *CodespacePermissions + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// CreateFromPullRequest creates a codespace owned by the authenticated user for the specified pull request. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#create-a-codespace-from-a-pull-request +// +//meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/codespaces +func (s *CodespacesService) CreateFromPullRequest(ctx context.Context, owner, repo string, pullNumber int, request *CreateCodespaceOptions) (*Codespace, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/%v/codespaces", owner, repo, pullNumber) + req, err := s.client.NewRequest(ctx, "POST", u, request) + if err != nil { + return nil, nil, err + } + + var codespace *Codespace + resp, err := s.client.Do(req, &codespace) + if err != nil { + return nil, resp, err + } + + return codespace, resp, nil +} + +// Create creates a new codespace, owned by the authenticated user. +// +// This method requires either RepositoryId OR a PullRequest but not both. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#create-a-codespace-for-the-authenticated-user +// +//meta:operation POST /user/codespaces +func (s *CodespacesService) Create(ctx context.Context, opts *CodespaceCreateForUserOptions) (*Codespace, *Response, error) { + u := "user/codespaces" + req, err := s.client.NewRequest(ctx, "POST", u, opts) + if err != nil { + return nil, nil, err + } + + var codespace *Codespace + resp, err := s.client.Do(req, &codespace) + if err != nil { + return nil, resp, err + } + + return codespace, resp, nil +} + +// Get gets information about a user's codespace. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#get-a-codespace-for-the-authenticated-user +// +//meta:operation GET /user/codespaces/{codespace_name} +func (s *CodespacesService) Get(ctx context.Context, codespaceName string) (*Codespace, *Response, error) { + u := fmt.Sprintf("user/codespaces/%v", codespaceName) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var codespace *Codespace + resp, err := s.client.Do(req, &codespace) + if err != nil { + return nil, resp, err + } + + return codespace, resp, nil +} + +// Update updates a codespace owned by the authenticated user. +// +// Only the codespace's machine type and recent folders can be modified using this endpoint. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#update-a-codespace-for-the-authenticated-user +// +//meta:operation PATCH /user/codespaces/{codespace_name} +func (s *CodespacesService) Update(ctx context.Context, codespaceName string, opts *UpdateCodespaceOptions) (*Codespace, *Response, error) { + u := fmt.Sprintf("user/codespaces/%v", codespaceName) + req, err := s.client.NewRequest(ctx, "PATCH", u, opts) + if err != nil { + return nil, nil, err + } + + var codespace *Codespace + resp, err := s.client.Do(req, &codespace) + if err != nil { + return nil, resp, err + } + + return codespace, resp, nil +} + +// ExportCodespace triggers an export of the specified codespace and returns a URL and ID where the status of the export can be monitored. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#export-a-codespace-for-the-authenticated-user +// +//meta:operation POST /user/codespaces/{codespace_name}/exports +func (s *CodespacesService) ExportCodespace(ctx context.Context, codespaceName string) (*CodespaceExport, *Response, error) { + u := fmt.Sprintf("user/codespaces/%v/exports", codespaceName) + req, err := s.client.NewRequest(ctx, "POST", u, nil) + if err != nil { + return nil, nil, err + } + + var codespace *CodespaceExport + resp, err := s.client.Do(req, &codespace) + if err != nil { + return nil, resp, err + } + + return codespace, resp, nil +} + +// GetLatestCodespaceExport gets information about an export of a codespace. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#get-details-about-a-codespace-export +// +//meta:operation GET /user/codespaces/{codespace_name}/exports/{export_id} +func (s *CodespacesService) GetLatestCodespaceExport(ctx context.Context, codespaceName string) (*CodespaceExport, *Response, error) { + u := fmt.Sprintf("user/codespaces/%v/exports/latest", codespaceName) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var codespace *CodespaceExport + resp, err := s.client.Do(req, &codespace) + if err != nil { + return nil, resp, err + } + + return codespace, resp, nil +} + +// Publish publishes an unpublished codespace, creating a new repository and assigning it to the codespace. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#create-a-repository-from-an-unpublished-codespace +// +//meta:operation POST /user/codespaces/{codespace_name}/publish +func (s *CodespacesService) Publish(ctx context.Context, codespaceName string, opts *PublishCodespaceOptions) (*Codespace, *Response, error) { + u := fmt.Sprintf("user/codespaces/%v/publish", codespaceName) + req, err := s.client.NewRequest(ctx, "POST", u, opts) + if err != nil { + return nil, nil, err + } + + var codespace *Codespace + resp, err := s.client.Do(req, &codespace) + if err != nil { + return nil, resp, err + } + + return codespace, resp, nil +} diff --git a/vendor/github.com/google/go-github/v88/github/codespaces_machines.go b/vendor/github.com/google/go-github/v88/github/codespaces_machines.go new file mode 100644 index 000000000..155beadd7 --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/codespaces_machines.go @@ -0,0 +1,74 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// CodespacesMachines represent a list of machines. +type CodespacesMachines struct { + TotalCount int64 `json:"total_count"` + Machines []*CodespacesMachine `json:"machines"` +} + +// ListRepoMachineTypesOptions represent options for ListMachineTypesForRepository. +type ListRepoMachineTypesOptions struct { + // Ref represent the branch or commit to check for prebuild availability and devcontainer restrictions. + Ref *string `url:"ref,omitempty"` + // Location represent the location to check for available machines. Assigned by IP if not provided. + Location *string `url:"location,omitempty"` + // ClientIP represent the IP for location auto-detection when proxying a request + ClientIP *string `url:"client_ip,omitempty"` +} + +// ListRepositoryMachineTypes lists the machine types available for a given repository based on its configuration. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/machines?apiVersion=2022-11-28#list-available-machine-types-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/codespaces/machines +func (s *CodespacesService) ListRepositoryMachineTypes(ctx context.Context, owner, repo string, opts *ListRepoMachineTypesOptions) (*CodespacesMachines, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/codespaces/machines", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var machines *CodespacesMachines + resp, err := s.client.Do(req, &machines) + if err != nil { + return nil, resp, err + } + + return machines, resp, nil +} + +// ListCodespaceMachineTypes lists the machine types a codespace can transition to use. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/machines?apiVersion=2022-11-28#list-machine-types-for-a-codespace +// +//meta:operation GET /user/codespaces/{codespace_name}/machines +func (s *CodespacesService) ListCodespaceMachineTypes(ctx context.Context, codespaceName string) (*CodespacesMachines, *Response, error) { + u := fmt.Sprintf("user/codespaces/%v/machines", codespaceName) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var machines *CodespacesMachines + resp, err := s.client.Do(req, &machines) + if err != nil { + return nil, resp, err + } + + return machines, resp, nil +} diff --git a/vendor/github.com/google/go-github/v88/github/codespaces_orgs.go b/vendor/github.com/google/go-github/v88/github/codespaces_orgs.go new file mode 100644 index 000000000..4bd28747e --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/codespaces_orgs.go @@ -0,0 +1,173 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// CodespacesOrgAccessControlRequest represent request for SetOrgAccessControl. +type CodespacesOrgAccessControlRequest struct { + // Visibility represent which users can access codespaces in the organization. + // Can be one of: disabled, selected_members, all_members, all_members_and_outside_collaborators. + Visibility string `json:"visibility"` + // SelectedUsernames represent the usernames of the organization members who should have access to codespaces in the organization. + // Required when visibility is selected_members. + SelectedUsernames []string `json:"selected_usernames,omitzero"` +} + +// ListInOrg lists the codespaces associated to a specified organization. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/organizations?apiVersion=2022-11-28#list-codespaces-for-the-organization +// +//meta:operation GET /orgs/{org}/codespaces +func (s *CodespacesService) ListInOrg(ctx context.Context, org string, opts *ListOptions) (*ListCodespaces, *Response, error) { + u := fmt.Sprintf("orgs/%v/codespaces", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var codespaces *ListCodespaces + resp, err := s.client.Do(req, &codespaces) + if err != nil { + return nil, resp, err + } + + return codespaces, resp, nil +} + +// SetOrgAccessControl sets which users can access codespaces in an organization. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/organizations?apiVersion=2022-11-28#manage-access-control-for-organization-codespaces +// +//meta:operation PUT /orgs/{org}/codespaces/access +func (s *CodespacesService) SetOrgAccessControl(ctx context.Context, org string, request CodespacesOrgAccessControlRequest) (*Response, error) { + u := fmt.Sprintf("orgs/%v/codespaces/access", org) + req, err := s.client.NewRequest(ctx, "PUT", u, request) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// AddUsersToOrgAccess adds users to Codespaces access for an organization. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/organizations?apiVersion=2022-11-28#add-users-to-codespaces-access-for-an-organization +// +//meta:operation POST /orgs/{org}/codespaces/access/selected_users +func (s *CodespacesService) AddUsersToOrgAccess(ctx context.Context, org string, usernames []string) (*Response, error) { + u := fmt.Sprintf("orgs/%v/codespaces/access/selected_users", org) + req, err := s.client.NewRequest(ctx, "POST", u, map[string][]string{"selected_usernames": usernames}) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// RemoveUsersFromOrgAccess removes users from Codespaces access for an organization. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/organizations?apiVersion=2022-11-28#remove-users-from-codespaces-access-for-an-organization +// +//meta:operation DELETE /orgs/{org}/codespaces/access/selected_users +func (s *CodespacesService) RemoveUsersFromOrgAccess(ctx context.Context, org string, usernames []string) (*Response, error) { + u := fmt.Sprintf("orgs/%v/codespaces/access/selected_users", org) + req, err := s.client.NewRequest(ctx, "DELETE", u, map[string][]string{"selected_usernames": usernames}) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// ListUserCodespacesInOrg lists the codespaces that a member of an organization has for repositories in that organization. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/organizations?apiVersion=2022-11-28#list-codespaces-for-a-user-in-organization +// +//meta:operation GET /orgs/{org}/members/{username}/codespaces +func (s *CodespacesService) ListUserCodespacesInOrg(ctx context.Context, org, username string, opts *ListOptions) (*ListCodespaces, *Response, error) { + u := fmt.Sprintf("orgs/%v/members/%v/codespaces", org, username) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var codespaces *ListCodespaces + resp, err := s.client.Do(req, &codespaces) + if err != nil { + return nil, resp, err + } + + return codespaces, resp, nil +} + +// DeleteUserCodespaceInOrg deletes a user's codespace from the organization. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/organizations?apiVersion=2022-11-28#delete-a-codespace-from-the-organization +// +//meta:operation DELETE /orgs/{org}/members/{username}/codespaces/{codespace_name} +func (s *CodespacesService) DeleteUserCodespaceInOrg(ctx context.Context, org, username, codespaceName string) (*Response, error) { + u := fmt.Sprintf("orgs/%v/members/%v/codespaces/%v", org, username, codespaceName) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// StopUserCodespaceInOrg stops a codespace for an organization user. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/organizations?apiVersion=2022-11-28#stop-a-codespace-for-an-organization-user +// +//meta:operation POST /orgs/{org}/members/{username}/codespaces/{codespace_name}/stop +func (s *CodespacesService) StopUserCodespaceInOrg(ctx context.Context, org, username, codespaceName string) (*Response, error) { + u := fmt.Sprintf("orgs/%v/members/%v/codespaces/%v/stop", org, username, codespaceName) + req, err := s.client.NewRequest(ctx, "POST", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/vendor/github.com/google/go-github/v73/github/codespaces_secrets.go b/vendor/github.com/google/go-github/v88/github/codespaces_secrets.go similarity index 85% rename from vendor/github.com/google/go-github/v73/github/codespaces_secrets.go rename to vendor/github.com/google/go-github/v88/github/codespaces_secrets.go index 438c27f8f..5ac7848c7 100644 --- a/vendor/github.com/google/go-github/v73/github/codespaces_secrets.go +++ b/vendor/github.com/google/go-github/v88/github/codespaces_secrets.go @@ -7,6 +7,7 @@ package github import ( "context" + "errors" "fmt" ) @@ -16,7 +17,7 @@ import ( // You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint // GitHub Apps must have read access to the codespaces_user_secrets user permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#list-secrets-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets?apiVersion=2022-11-28#list-secrets-for-the-authenticated-user // //meta:operation GET /user/codespaces/secrets func (s *CodespacesService) ListUserSecrets(ctx context.Context, opts *ListOptions) (*Secrets, *Response, error) { @@ -31,7 +32,7 @@ func (s *CodespacesService) ListUserSecrets(ctx context.Context, opts *ListOptio // // Lists all Codespaces secrets available at the organization-level without revealing their encrypted values. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#list-organization-secrets +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets?apiVersion=2022-11-28#list-organization-secrets // //meta:operation GET /orgs/{org}/codespaces/secrets func (s *CodespacesService) ListOrgSecrets(ctx context.Context, org string, opts *ListOptions) (*Secrets, *Response, error) { @@ -47,7 +48,7 @@ func (s *CodespacesService) ListOrgSecrets(ctx context.Context, org string, opts // // Lists all secrets available in a repository without revealing their encrypted values. You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have write access to the codespaces_secrets repository permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets#list-repository-secrets +// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets?apiVersion=2022-11-28#list-repository-secrets // //meta:operation GET /repos/{owner}/{repo}/codespaces/secrets func (s *CodespacesService) ListRepoSecrets(ctx context.Context, owner, repo string, opts *ListOptions) (*Secrets, *Response, error) { @@ -60,13 +61,13 @@ func (s *CodespacesService) ListRepoSecrets(ctx context.Context, owner, repo str } func (s *CodespacesService) listSecrets(ctx context.Context, url string) (*Secrets, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } var secrets *Secrets - resp, err := s.client.Do(ctx, req, &secrets) + resp, err := s.client.Do(req, &secrets) if err != nil { return nil, resp, err } @@ -80,7 +81,7 @@ func (s *CodespacesService) listSecrets(ctx context.Context, url string) (*Secre // You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint. // GitHub Apps must have read access to the codespaces_user_secrets user permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#get-public-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets?apiVersion=2022-11-28#get-public-key-for-the-authenticated-user // //meta:operation GET /user/codespaces/secrets/public-key func (s *CodespacesService) GetUserPublicKey(ctx context.Context) (*PublicKey, *Response, error) { @@ -91,7 +92,7 @@ func (s *CodespacesService) GetUserPublicKey(ctx context.Context) (*PublicKey, * // // Gets a public key for an organization, which is required in order to encrypt secrets. You need to encrypt the value of a secret before you can create or update secrets. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#get-an-organization-public-key +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets?apiVersion=2022-11-28#get-an-organization-public-key // //meta:operation GET /orgs/{org}/codespaces/secrets/public-key func (s *CodespacesService) GetOrgPublicKey(ctx context.Context, org string) (*PublicKey, *Response, error) { @@ -102,7 +103,7 @@ func (s *CodespacesService) GetOrgPublicKey(ctx context.Context, org string) (*P // // Gets your public key, which you need to encrypt secrets. You need to encrypt a secret before you can create or update secrets. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the repo scope. GitHub Apps must have write access to the codespaces_secrets repository permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets#get-a-repository-public-key +// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets?apiVersion=2022-11-28#get-a-repository-public-key // //meta:operation GET /repos/{owner}/{repo}/codespaces/secrets/public-key func (s *CodespacesService) GetRepoPublicKey(ctx context.Context, owner, repo string) (*PublicKey, *Response, error) { @@ -110,13 +111,13 @@ func (s *CodespacesService) GetRepoPublicKey(ctx context.Context, owner, repo st } func (s *CodespacesService) getPublicKey(ctx context.Context, url string) (*PublicKey, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } var publicKey *PublicKey - resp, err := s.client.Do(ctx, req, &publicKey) + resp, err := s.client.Do(req, &publicKey) if err != nil { return nil, resp, err } @@ -130,7 +131,7 @@ func (s *CodespacesService) getPublicKey(ctx context.Context, url string) (*Publ // You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint. // GitHub Apps must have read access to the codespaces_user_secrets user permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#get-a-secret-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets?apiVersion=2022-11-28#get-a-secret-for-the-authenticated-user // //meta:operation GET /user/codespaces/secrets/{secret_name} func (s *CodespacesService) GetUserSecret(ctx context.Context, name string) (*Secret, *Response, error) { @@ -142,7 +143,7 @@ func (s *CodespacesService) GetUserSecret(ctx context.Context, name string) (*Se // // Gets an organization secret without revealing its encrypted value. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#get-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets?apiVersion=2022-11-28#get-an-organization-secret // //meta:operation GET /orgs/{org}/codespaces/secrets/{secret_name} func (s *CodespacesService) GetOrgSecret(ctx context.Context, org, name string) (*Secret, *Response, error) { @@ -154,7 +155,7 @@ func (s *CodespacesService) GetOrgSecret(ctx context.Context, org, name string) // // Gets a single repository secret without revealing its encrypted value. You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have write access to the codespaces_secrets repository permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets#get-a-repository-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets?apiVersion=2022-11-28#get-a-repository-secret // //meta:operation GET /repos/{owner}/{repo}/codespaces/secrets/{secret_name} func (s *CodespacesService) GetRepoSecret(ctx context.Context, owner, repo, name string) (*Secret, *Response, error) { @@ -163,13 +164,13 @@ func (s *CodespacesService) GetRepoSecret(ctx context.Context, owner, repo, name } func (s *CodespacesService) getSecret(ctx context.Context, url string) (*Secret, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } var secret *Secret - resp, err := s.client.Do(ctx, req, &secret) + resp, err := s.client.Do(req, &secret) if err != nil { return nil, resp, err } @@ -183,10 +184,14 @@ func (s *CodespacesService) getSecret(ctx context.Context, url string) (*Secret, // You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must also have Codespaces access to use this endpoint. // GitHub Apps must have write access to the codespaces_user_secrets user permission and codespaces_secrets repository permission on all referenced repositories to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#create-or-update-a-secret-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets?apiVersion=2022-11-28#create-or-update-a-secret-for-the-authenticated-user // //meta:operation PUT /user/codespaces/secrets/{secret_name} func (s *CodespacesService) CreateOrUpdateUserSecret(ctx context.Context, eSecret *EncryptedSecret) (*Response, error) { + if eSecret == nil { + return nil, errors.New("encrypted secret must be provided") + } + u := fmt.Sprintf("user/codespaces/secrets/%v", eSecret.Name) return s.createOrUpdateSecret(ctx, u, eSecret) } @@ -195,10 +200,14 @@ func (s *CodespacesService) CreateOrUpdateUserSecret(ctx context.Context, eSecre // // Creates or updates an organization secret with an encrypted value. Encrypt your secret using LibSodium. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#create-or-update-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets?apiVersion=2022-11-28#create-or-update-an-organization-secret // //meta:operation PUT /orgs/{org}/codespaces/secrets/{secret_name} func (s *CodespacesService) CreateOrUpdateOrgSecret(ctx context.Context, org string, eSecret *EncryptedSecret) (*Response, error) { + if eSecret == nil { + return nil, errors.New("encrypted secret must be provided") + } + u := fmt.Sprintf("orgs/%v/codespaces/secrets/%v", org, eSecret.Name) return s.createOrUpdateSecret(ctx, u, eSecret) } @@ -207,21 +216,25 @@ func (s *CodespacesService) CreateOrUpdateOrgSecret(ctx context.Context, org str // // Creates or updates a repository secret with an encrypted value. Encrypt your secret using LibSodium. You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have write access to the codespaces_secrets repository permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets#create-or-update-a-repository-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets?apiVersion=2022-11-28#create-or-update-a-repository-secret // //meta:operation PUT /repos/{owner}/{repo}/codespaces/secrets/{secret_name} func (s *CodespacesService) CreateOrUpdateRepoSecret(ctx context.Context, owner, repo string, eSecret *EncryptedSecret) (*Response, error) { + if eSecret == nil { + return nil, errors.New("encrypted secret must be provided") + } + u := fmt.Sprintf("repos/%v/%v/codespaces/secrets/%v", owner, repo, eSecret.Name) return s.createOrUpdateSecret(ctx, u, eSecret) } func (s *CodespacesService) createOrUpdateSecret(ctx context.Context, url string, eSecret *EncryptedSecret) (*Response, error) { - req, err := s.client.NewRequest("PUT", url, eSecret) + req, err := s.client.NewRequest(ctx, "PUT", url, eSecret) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -235,7 +248,7 @@ func (s *CodespacesService) createOrUpdateSecret(ctx context.Context, url string // You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint. // GitHub Apps must have write access to the codespaces_user_secrets user permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#delete-a-secret-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets?apiVersion=2022-11-28#delete-a-secret-for-the-authenticated-user // //meta:operation DELETE /user/codespaces/secrets/{secret_name} func (s *CodespacesService) DeleteUserSecret(ctx context.Context, name string) (*Response, error) { @@ -247,7 +260,7 @@ func (s *CodespacesService) DeleteUserSecret(ctx context.Context, name string) ( // // Deletes an organization secret using the secret name. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#delete-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets?apiVersion=2022-11-28#delete-an-organization-secret // //meta:operation DELETE /orgs/{org}/codespaces/secrets/{secret_name} func (s *CodespacesService) DeleteOrgSecret(ctx context.Context, org, name string) (*Response, error) { @@ -259,7 +272,7 @@ func (s *CodespacesService) DeleteOrgSecret(ctx context.Context, org, name strin // // Deletes a secret in a repository using the secret name. You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have write access to the codespaces_secrets repository permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets#delete-a-repository-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets?apiVersion=2022-11-28#delete-a-repository-secret // //meta:operation DELETE /repos/{owner}/{repo}/codespaces/secrets/{secret_name} func (s *CodespacesService) DeleteRepoSecret(ctx context.Context, owner, repo, name string) (*Response, error) { @@ -268,12 +281,12 @@ func (s *CodespacesService) DeleteRepoSecret(ctx context.Context, owner, repo, n } func (s *CodespacesService) deleteSecret(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest("DELETE", url, nil) + req, err := s.client.NewRequest(ctx, "DELETE", url, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -286,7 +299,7 @@ func (s *CodespacesService) deleteSecret(ctx context.Context, url string) (*Resp // You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint. // GitHub Apps must have read access to the codespaces_user_secrets user permission and write access to the codespaces_secrets repository permission on all referenced repositories to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#list-selected-repositories-for-a-user-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets?apiVersion=2022-11-28#list-selected-repositories-for-a-user-secret // //meta:operation GET /user/codespaces/secrets/{secret_name}/repositories func (s *CodespacesService) ListSelectedReposForUserSecret(ctx context.Context, name string, opts *ListOptions) (*SelectedReposList, *Response, error) { @@ -303,7 +316,7 @@ func (s *CodespacesService) ListSelectedReposForUserSecret(ctx context.Context, // // Lists all repositories that have been selected when the visibility for repository access to a secret is set to selected. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#list-selected-repositories-for-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets?apiVersion=2022-11-28#list-selected-repositories-for-an-organization-secret // //meta:operation GET /orgs/{org}/codespaces/secrets/{secret_name}/repositories func (s *CodespacesService) ListSelectedReposForOrgSecret(ctx context.Context, org, name string, opts *ListOptions) (*SelectedReposList, *Response, error) { @@ -317,13 +330,13 @@ func (s *CodespacesService) ListSelectedReposForOrgSecret(ctx context.Context, o } func (s *CodespacesService) listSelectedReposForSecret(ctx context.Context, url string) (*SelectedReposList, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } var repositories *SelectedReposList - resp, err := s.client.Do(ctx, req, &repositories) + resp, err := s.client.Do(req, &repositories) if err != nil { return nil, resp, err } @@ -336,7 +349,7 @@ func (s *CodespacesService) listSelectedReposForSecret(ctx context.Context, url // You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint. // GitHub Apps must have write access to the codespaces_user_secrets user permission and write access to the codespaces_secrets repository permission on all referenced repositories to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#set-selected-repositories-for-a-user-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets?apiVersion=2022-11-28#set-selected-repositories-for-a-user-secret // //meta:operation PUT /user/codespaces/secrets/{secret_name}/repositories func (s *CodespacesService) SetSelectedReposForUserSecret(ctx context.Context, name string, ids SelectedRepoIDs) (*Response, error) { @@ -348,7 +361,7 @@ func (s *CodespacesService) SetSelectedReposForUserSecret(ctx context.Context, n // // Replaces all repositories for an organization secret when the visibility for repository access is set to selected. The visibility is set when you Create or update an organization secret. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#set-selected-repositories-for-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets?apiVersion=2022-11-28#set-selected-repositories-for-an-organization-secret // //meta:operation PUT /orgs/{org}/codespaces/secrets/{secret_name}/repositories func (s *CodespacesService) SetSelectedReposForOrgSecret(ctx context.Context, org, name string, ids SelectedRepoIDs) (*Response, error) { @@ -361,12 +374,12 @@ func (s *CodespacesService) setSelectedRepoForSecret(ctx context.Context, url st SelectedIDs SelectedRepoIDs `json:"selected_repository_ids"` } - req, err := s.client.NewRequest("PUT", url, repoIDs{SelectedIDs: ids}) + req, err := s.client.NewRequest(ctx, "PUT", url, repoIDs{SelectedIDs: ids}) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -378,10 +391,17 @@ func (s *CodespacesService) setSelectedRepoForSecret(ctx context.Context, url st // // Adds a repository to the selected repositories for a user's codespace secret. You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint. GitHub Apps must have write access to the codespaces_user_secrets user permission and write access to the codespaces_secrets repository permission on the referenced repository to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#add-a-selected-repository-to-a-user-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets?apiVersion=2022-11-28#add-a-selected-repository-to-a-user-secret // //meta:operation PUT /user/codespaces/secrets/{secret_name}/repositories/{repository_id} func (s *CodespacesService) AddSelectedRepoToUserSecret(ctx context.Context, name string, repo *Repository) (*Response, error) { + if repo == nil { + return nil, errors.New("repository must be provided") + } + if repo.ID == nil { + return nil, errors.New("id must be provided") + } + u := fmt.Sprintf("user/codespaces/secrets/%v/repositories/%v", name, *repo.ID) return s.addSelectedRepoToSecret(ctx, u) } @@ -390,21 +410,28 @@ func (s *CodespacesService) AddSelectedRepoToUserSecret(ctx context.Context, nam // // Adds a repository to an organization secret when the visibility for repository access is set to selected. The visibility is set when you Create or update an organization secret. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#add-selected-repository-to-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets?apiVersion=2022-11-28#add-selected-repository-to-an-organization-secret // //meta:operation PUT /orgs/{org}/codespaces/secrets/{secret_name}/repositories/{repository_id} func (s *CodespacesService) AddSelectedRepoToOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) { + if repo == nil { + return nil, errors.New("repository must be provided") + } + if repo.ID == nil { + return nil, errors.New("id must be provided") + } + u := fmt.Sprintf("orgs/%v/codespaces/secrets/%v/repositories/%v", org, name, *repo.ID) return s.addSelectedRepoToSecret(ctx, u) } func (s *CodespacesService) addSelectedRepoToSecret(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest("PUT", url, nil) + req, err := s.client.NewRequest(ctx, "PUT", url, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -416,10 +443,17 @@ func (s *CodespacesService) addSelectedRepoToSecret(ctx context.Context, url str // // Removes a repository from the selected repositories for a user's codespace secret. You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint. GitHub Apps must have write access to the codespaces_user_secrets user permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#remove-a-selected-repository-from-a-user-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets?apiVersion=2022-11-28#remove-a-selected-repository-from-a-user-secret // //meta:operation DELETE /user/codespaces/secrets/{secret_name}/repositories/{repository_id} func (s *CodespacesService) RemoveSelectedRepoFromUserSecret(ctx context.Context, name string, repo *Repository) (*Response, error) { + if repo == nil { + return nil, errors.New("repository must be provided") + } + if repo.ID == nil { + return nil, errors.New("id must be provided") + } + u := fmt.Sprintf("user/codespaces/secrets/%v/repositories/%v", name, *repo.ID) return s.removeSelectedRepoFromSecret(ctx, u) } @@ -428,21 +462,28 @@ func (s *CodespacesService) RemoveSelectedRepoFromUserSecret(ctx context.Context // // Removes a repository from an organization secret when the visibility for repository access is set to selected. The visibility is set when you Create or update an organization secret. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#remove-selected-repository-from-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets?apiVersion=2022-11-28#remove-selected-repository-from-an-organization-secret // //meta:operation DELETE /orgs/{org}/codespaces/secrets/{secret_name}/repositories/{repository_id} func (s *CodespacesService) RemoveSelectedRepoFromOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) { + if repo == nil { + return nil, errors.New("repository must be provided") + } + if repo.ID == nil { + return nil, errors.New("id must be provided") + } + u := fmt.Sprintf("orgs/%v/codespaces/secrets/%v/repositories/%v", org, name, *repo.ID) return s.removeSelectedRepoFromSecret(ctx, u) } func (s *CodespacesService) removeSelectedRepoFromSecret(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest("DELETE", url, nil) + req, err := s.client.NewRequest(ctx, "DELETE", url, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } diff --git a/vendor/github.com/google/go-github/v88/github/copilot.go b/vendor/github.com/google/go-github/v88/github/copilot.go new file mode 100644 index 000000000..d5f0f085b --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/copilot.go @@ -0,0 +1,1251 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "time" +) + +// CopilotService provides access to the Copilot-related functions +// in the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/copilot?apiVersion=2022-11-28 +type CopilotService service + +// CopilotOrganizationDetails represents the details of an organization's Copilot for Business subscription. +type CopilotOrganizationDetails struct { + SeatBreakdown *CopilotSeatBreakdown `json:"seat_breakdown"` + PublicCodeSuggestions string `json:"public_code_suggestions"` + CopilotChat string `json:"copilot_chat"` + SeatManagementSetting string `json:"seat_management_setting"` +} + +// CopilotSeatBreakdown represents the breakdown of Copilot for Business seats for the organization. +type CopilotSeatBreakdown struct { + Total int `json:"total"` + AddedThisCycle int `json:"added_this_cycle"` + PendingCancellation int `json:"pending_cancellation"` + PendingInvitation int `json:"pending_invitation"` + ActiveThisCycle int `json:"active_this_cycle"` + InactiveThisCycle int `json:"inactive_this_cycle"` +} + +// ListCopilotSeatsResponse represents the Copilot for Business seat assignments for an organization. +type ListCopilotSeatsResponse struct { + TotalSeats int64 `json:"total_seats"` + Seats []*CopilotSeatDetails `json:"seats"` +} + +// CopilotSeatDetails represents the details of a Copilot for Business seat. +type CopilotSeatDetails struct { + // Assignee can either be a User, Team, or Organization. + Assignee any `json:"assignee"` + AssigningTeam *Team `json:"assigning_team,omitempty"` + PendingCancellationDate *string `json:"pending_cancellation_date,omitempty"` + LastActivityAt *Timestamp `json:"last_activity_at,omitempty"` + LastActivityEditor *string `json:"last_activity_editor,omitempty"` + CreatedAt *Timestamp `json:"created_at"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + PlanType *string `json:"plan_type,omitempty"` +} + +// SeatAssignments represents the number of seats assigned. +type SeatAssignments struct { + SeatsCreated int `json:"seats_created"` +} + +// SeatCancellations represents the number of seats cancelled. +type SeatCancellations struct { + SeatsCancelled int `json:"seats_cancelled"` +} + +// CopilotMetricsListOptions represents the optional parameters to the CopilotService get metrics methods. +type CopilotMetricsListOptions struct { + Since *time.Time `url:"since,omitempty"` + Until *time.Time `url:"until,omitempty"` + + ListOptions +} + +// CopilotIDECodeCompletionsLanguage represents Copilot usage metrics for completions in the IDE for a language. +type CopilotIDECodeCompletionsLanguage struct { + Name string `json:"name"` + TotalEngagedUsers int `json:"total_engaged_users"` +} + +// CopilotIDECodeCompletionsModelLanguage represents Copilot usage metrics for completions in the IDE for a model and language. +type CopilotIDECodeCompletionsModelLanguage struct { + Name string `json:"name"` + TotalEngagedUsers int `json:"total_engaged_users"` + TotalCodeSuggestions int `json:"total_code_suggestions"` + TotalCodeAcceptances int `json:"total_code_acceptances"` + TotalCodeLinesSuggested int `json:"total_code_lines_suggested"` + TotalCodeLinesAccepted int `json:"total_code_lines_accepted"` +} + +// CopilotIDECodeCompletionsModel represents Copilot usage metrics for completions in the IDE for a model. +type CopilotIDECodeCompletionsModel struct { + Name string `json:"name"` + IsCustomModel bool `json:"is_custom_model"` + CustomModelTrainingDate *string `json:"custom_model_training_date,omitempty"` + TotalEngagedUsers int `json:"total_engaged_users"` + Languages []*CopilotIDECodeCompletionsModelLanguage `json:"languages"` +} + +// CopilotIDECodeCompletionsEditor represents Copilot usage metrics for completions in the IDE for an editor. +type CopilotIDECodeCompletionsEditor struct { + Name string `json:"name"` + TotalEngagedUsers int `json:"total_engaged_users"` + Models []*CopilotIDECodeCompletionsModel `json:"models"` +} + +// CopilotIDECodeCompletions represents Copilot usage metrics for Copilot code completions in the IDE, categorized by editor, model and language. +type CopilotIDECodeCompletions struct { + TotalEngagedUsers int `json:"total_engaged_users"` + Languages []*CopilotIDECodeCompletionsLanguage `json:"languages"` + Editors []*CopilotIDECodeCompletionsEditor `json:"editors"` +} + +// CopilotIDEChatModel represents Copilot usage metrics for chatting with a model in the IDE. +type CopilotIDEChatModel struct { + Name string `json:"name"` + IsCustomModel bool `json:"is_custom_model"` + CustomModelTrainingDate *string `json:"custom_model_training_date,omitempty"` + TotalEngagedUsers int `json:"total_engaged_users"` + TotalChats int `json:"total_chats"` + TotalChatInsertionEvents int `json:"total_chat_insertion_events"` + TotalChatCopyEvents int `json:"total_chat_copy_events"` +} + +// CopilotIDEChatEditor represents Copilot usage metrics for chatting with a model in the IDE, categorized by editor and model. +type CopilotIDEChatEditor struct { + Name string `json:"name"` + TotalEngagedUsers int `json:"total_engaged_users"` + Models []*CopilotIDEChatModel `json:"models"` +} + +// CopilotIDEChat represents Copilot usage metrics for Copilot Chat in the IDE, categorized by editor and model. +type CopilotIDEChat struct { + TotalEngagedUsers int `json:"total_engaged_users"` + Editors []*CopilotIDEChatEditor `json:"editors"` +} + +// CopilotDotcomChatModel represents Copilot usage metrics for chatting with a model in the webbrowser. +type CopilotDotcomChatModel struct { + Name string `json:"name"` + IsCustomModel bool `json:"is_custom_model"` + CustomModelTrainingDate *string `json:"custom_model_training_date,omitempty"` + TotalEngagedUsers int `json:"total_engaged_users"` + TotalChats int `json:"total_chats"` +} + +// CopilotDotcomChat represents Copilot usage metrics for Copilot Chat in the webbrowser, categorized by model. +type CopilotDotcomChat struct { + TotalEngagedUsers int `json:"total_engaged_users"` + Models []*CopilotDotcomChatModel `json:"models"` +} + +// CopilotDotcomPullRequestsModel represents Copilot usage metrics for pull requests in the webbrowser, categorized by model. +type CopilotDotcomPullRequestsModel struct { + Name string `json:"name"` + IsCustomModel bool `json:"is_custom_model"` + CustomModelTrainingDate *string `json:"custom_model_training_date,omitempty"` + TotalPRSummariesCreated int `json:"total_pr_summaries_created"` + TotalEngagedUsers int `json:"total_engaged_users"` +} + +// CopilotDotcomPullRequestsRepository represents Copilot usage metrics for pull requests in the webbrowser, categorized by repository. +type CopilotDotcomPullRequestsRepository struct { + Name string `json:"name"` + TotalEngagedUsers int `json:"total_engaged_users"` + Models []*CopilotDotcomPullRequestsModel `json:"models"` +} + +// CopilotDotcomPullRequests represents Copilot usage metrics for pull requests in the webbrowser, categorized by repository and model. +type CopilotDotcomPullRequests struct { + TotalEngagedUsers int `json:"total_engaged_users"` + Repositories []*CopilotDotcomPullRequestsRepository `json:"repositories"` +} + +// CopilotMetrics represents Copilot usage metrics for a given day. +type CopilotMetrics struct { + Date string `json:"date"` + TotalActiveUsers *int `json:"total_active_users,omitempty"` + TotalEngagedUsers *int `json:"total_engaged_users,omitempty"` + CopilotIDECodeCompletions *CopilotIDECodeCompletions `json:"copilot_ide_code_completions,omitempty"` + CopilotIDEChat *CopilotIDEChat `json:"copilot_ide_chat,omitempty"` + CopilotDotcomChat *CopilotDotcomChat `json:"copilot_dotcom_chat,omitempty"` + CopilotDotcomPullRequests *CopilotDotcomPullRequests `json:"copilot_dotcom_pull_requests,omitempty"` +} + +// CopilotMetricsReportOptions specifies the optional parameters for single-day metrics report endpoints. +type CopilotMetricsReportOptions struct { + Day string `url:"day"` // Required, format: YYYY-MM-DD +} + +// CopilotDailyMetricsReport represents the response from 1-day Copilot metrics report endpoints. +type CopilotDailyMetricsReport struct { + DownloadLinks []string `json:"download_links"` + ReportDay string `json:"report_day"` +} + +// CopilotMetricsReport represents the response from 28-day Copilot metrics report endpoints. +type CopilotMetricsReport struct { + DownloadLinks []string `json:"download_links"` + ReportStartDay string `json:"report_start_day"` + ReportEndDay string `json:"report_end_day"` +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (cp *CopilotSeatDetails) UnmarshalJSON(data []byte) error { + // Using an alias to avoid infinite recursion when calling json.Unmarshal + type alias CopilotSeatDetails + var seatDetail alias + + if err := json.Unmarshal(data, &seatDetail); err != nil { + return err + } + + cp.AssigningTeam = seatDetail.AssigningTeam + cp.PendingCancellationDate = seatDetail.PendingCancellationDate + cp.LastActivityAt = seatDetail.LastActivityAt + cp.LastActivityEditor = seatDetail.LastActivityEditor + cp.CreatedAt = seatDetail.CreatedAt + cp.UpdatedAt = seatDetail.UpdatedAt + cp.PlanType = seatDetail.PlanType + + switch v := seatDetail.Assignee.(type) { + case nil: + // Assignee can be null according to GitHub API specification. + // See: https://docs.github.com/rest/copilot/copilot-user-management?apiVersion=2022-11-28#list-all-copilot-seat-assignments-for-an-organization + // Note: Copilot API is in public preview and subject to change. + cp.Assignee = nil + case map[string]any: + jsonData, err := json.Marshal(seatDetail.Assignee) + if err != nil { + return err + } + + if v["type"] == nil { + return errors.New("assignee type field is not set") + } + + if t, ok := v["type"].(string); ok && t == "User" { + var user *User + if err := json.Unmarshal(jsonData, &user); err != nil { + return err + } + cp.Assignee = user + } else if t, ok := v["type"].(string); ok && t == "Team" { + var team *Team + if err := json.Unmarshal(jsonData, &team); err != nil { + return err + } + cp.Assignee = team + } else if t, ok := v["type"].(string); ok && t == "Organization" { + var organization *Organization + if err := json.Unmarshal(jsonData, &organization); err != nil { + return err + } + cp.Assignee = organization + } else { + return fmt.Errorf("unsupported assignee type %v", v["type"]) + } + default: + return fmt.Errorf("unsupported assignee type %T", v) + } + + return nil +} + +// GetUser gets the User from the CopilotSeatDetails if the assignee is a user. +func (cp *CopilotSeatDetails) GetUser() (*User, bool) { u, ok := cp.Assignee.(*User); return u, ok } + +// GetTeam gets the Team from the CopilotSeatDetails if the assignee is a team. +func (cp *CopilotSeatDetails) GetTeam() (*Team, bool) { t, ok := cp.Assignee.(*Team); return t, ok } + +// GetOrganization gets the Organization from the CopilotSeatDetails if the assignee is an organization. +func (cp *CopilotSeatDetails) GetOrganization() (*Organization, bool) { + o, ok := cp.Assignee.(*Organization) + return o, ok +} + +// GetCopilotBilling gets Copilot for Business billing information and settings for an organization. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management?apiVersion=2022-11-28#get-copilot-seat-information-and-settings-for-an-organization +// +//meta:operation GET /orgs/{org}/copilot/billing +func (s *CopilotService) GetCopilotBilling(ctx context.Context, org string) (*CopilotOrganizationDetails, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/billing", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var copilotDetails *CopilotOrganizationDetails + resp, err := s.client.Do(req, &copilotDetails) + if err != nil { + return nil, resp, err + } + + return copilotDetails, resp, nil +} + +// ListCopilotSeats lists Copilot for Business seat assignments for an organization. +// +// To paginate through all seats, populate 'Page' with the number of the last page. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management?apiVersion=2022-11-28#list-all-copilot-seat-assignments-for-an-organization +// +//meta:operation GET /orgs/{org}/copilot/billing/seats +func (s *CopilotService) ListCopilotSeats(ctx context.Context, org string, opts *ListOptions) (*ListCopilotSeatsResponse, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/billing/seats", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var copilotSeats *ListCopilotSeatsResponse + resp, err := s.client.Do(req, &copilotSeats) + if err != nil { + return nil, resp, err + } + + return copilotSeats, resp, nil +} + +// ListCopilotEnterpriseSeats lists Copilot for Business seat assignments for an enterprise. +// +// To paginate through all seats, populate 'Page' with the number of the last page. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-user-management?apiVersion=2022-11-28#list-all-copilot-seat-assignments-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/copilot/billing/seats +func (s *CopilotService) ListCopilotEnterpriseSeats(ctx context.Context, enterprise string, opts *ListOptions) (*ListCopilotSeatsResponse, *Response, error) { + u := fmt.Sprintf("enterprises/%v/copilot/billing/seats", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var copilotSeats *ListCopilotSeatsResponse + resp, err := s.client.Do(req, &copilotSeats) + if err != nil { + return nil, resp, err + } + + return copilotSeats, resp, nil +} + +// ListOrganizationCopilotCodingAgentRepositoriesResponse represents the response from listing +// repositories enabled for the Copilot coding agent in an organization. +type ListOrganizationCopilotCodingAgentRepositoriesResponse struct { + TotalCount int `json:"total_count"` + Repositories []*Repository `json:"repositories"` +} + +// ListOrganizationCodingAgentRepositories lists repositories enabled for the Copilot coding agent in an organization. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-coding-agent-management?apiVersion=2022-11-28#list-repositories-enabled-for-copilot-cloud-agent-in-an-organization +// +//meta:operation GET /orgs/{org}/copilot/coding-agent/permissions/repositories +func (s *CopilotService) ListOrganizationCodingAgentRepositories(ctx context.Context, org string, opts *ListOptions) (*ListOrganizationCopilotCodingAgentRepositoriesResponse, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/coding-agent/permissions/repositories", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var result *ListOrganizationCopilotCodingAgentRepositoriesResponse + resp, err := s.client.Do(req, &result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// CopilotOrganizationContentExclusionDetails lists all Copilot content exclusion +// rules for an organization, keyed by repository full name. Each value is the +// list of file paths excluded from Copilot for that repository. +type CopilotOrganizationContentExclusionDetails map[string][]string + +// GetOrganizationContentExclusionDetails gets the Copilot content exclusion rules for an organization. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-content-exclusion-management?apiVersion=2022-11-28#get-copilot-content-exclusion-rules-for-an-organization +// +//meta:operation GET /orgs/{org}/copilot/content_exclusion +func (s *CopilotService) GetOrganizationContentExclusionDetails(ctx context.Context, org string) (CopilotOrganizationContentExclusionDetails, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/content_exclusion", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + details := CopilotOrganizationContentExclusionDetails{} + resp, err := s.client.Do(req, &details) + if err != nil { + return nil, resp, err + } + + return details, resp, nil +} + +// AddCopilotTeams adds teams to the Copilot for Business subscription for an organization. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management?apiVersion=2022-11-28#add-teams-to-the-copilot-subscription-for-an-organization +// +//meta:operation POST /orgs/{org}/copilot/billing/selected_teams +func (s *CopilotService) AddCopilotTeams(ctx context.Context, org string, teamNames []string) (*SeatAssignments, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/billing/selected_teams", org) + + body := struct { + SelectedTeams []string `json:"selected_teams"` + }{ + SelectedTeams: teamNames, + } + + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var seatAssignments *SeatAssignments + resp, err := s.client.Do(req, &seatAssignments) + if err != nil { + return nil, resp, err + } + + return seatAssignments, resp, nil +} + +// RemoveCopilotTeams removes teams from the Copilot for Business subscription for an organization. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management?apiVersion=2022-11-28#remove-teams-from-the-copilot-subscription-for-an-organization +// +//meta:operation DELETE /orgs/{org}/copilot/billing/selected_teams +func (s *CopilotService) RemoveCopilotTeams(ctx context.Context, org string, teamNames []string) (*SeatCancellations, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/billing/selected_teams", org) + + body := struct { + SelectedTeams []string `json:"selected_teams"` + }{ + SelectedTeams: teamNames, + } + + req, err := s.client.NewRequest(ctx, "DELETE", u, body) + if err != nil { + return nil, nil, err + } + + var seatCancellations *SeatCancellations + resp, err := s.client.Do(req, &seatCancellations) + if err != nil { + return nil, resp, err + } + + return seatCancellations, resp, nil +} + +// AddCopilotUsers adds users to the Copilot for Business subscription for an organization +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management?apiVersion=2022-11-28#add-users-to-the-copilot-subscription-for-an-organization +// +//meta:operation POST /orgs/{org}/copilot/billing/selected_users +func (s *CopilotService) AddCopilotUsers(ctx context.Context, org string, users []string) (*SeatAssignments, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/billing/selected_users", org) + + body := struct { + SelectedUsernames []string `json:"selected_usernames"` + }{ + SelectedUsernames: users, + } + + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var seatAssignments *SeatAssignments + resp, err := s.client.Do(req, &seatAssignments) + if err != nil { + return nil, resp, err + } + + return seatAssignments, resp, nil +} + +// RemoveCopilotUsers removes users from the Copilot for Business subscription for an organization. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management?apiVersion=2022-11-28#remove-users-from-the-copilot-subscription-for-an-organization +// +//meta:operation DELETE /orgs/{org}/copilot/billing/selected_users +func (s *CopilotService) RemoveCopilotUsers(ctx context.Context, org string, users []string) (*SeatCancellations, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/billing/selected_users", org) + + body := struct { + SelectedUsernames []string `json:"selected_usernames"` + }{ + SelectedUsernames: users, + } + + req, err := s.client.NewRequest(ctx, "DELETE", u, body) + if err != nil { + return nil, nil, err + } + + var seatCancellations *SeatCancellations + resp, err := s.client.Do(req, &seatCancellations) + if err != nil { + return nil, resp, err + } + + return seatCancellations, resp, nil +} + +// GetSeatDetails gets Copilot for Business seat assignment details for a user. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management?apiVersion=2022-11-28#get-copilot-seat-assignment-details-for-a-user +// +//meta:operation GET /orgs/{org}/members/{username}/copilot +func (s *CopilotService) GetSeatDetails(ctx context.Context, org, user string) (*CopilotSeatDetails, *Response, error) { + u := fmt.Sprintf("orgs/%v/members/%v/copilot", org, user) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var seatDetails *CopilotSeatDetails + resp, err := s.client.Do(req, &seatDetails) + if err != nil { + return nil, resp, err + } + + return seatDetails, resp, nil +} + +// GetEnterpriseMetrics gets Copilot usage metrics for an enterprise. +// +// Deprecated: This endpoint was closed down on April 2, 2026 for github.com. +// It may still be available for GitHub Enterprise Server. Use GetEnterpriseDailyMetricsReport +// or GetEnterpriseMetricsReport instead. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-metrics?apiVersion=2022-11-28#get-copilot-metrics-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/copilot/metrics +func (s *CopilotService) GetEnterpriseMetrics(ctx context.Context, enterprise string, opts *CopilotMetricsListOptions) ([]*CopilotMetrics, *Response, error) { + u := fmt.Sprintf("enterprises/%v/copilot/metrics", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var metrics []*CopilotMetrics + resp, err := s.client.Do(req, &metrics) + if err != nil { + return nil, resp, err + } + + return metrics, resp, nil +} + +// GetEnterpriseTeamMetrics gets Copilot usage metrics for an enterprise team. +// +// Deprecated: This endpoint was closed down on April 2, 2026 for github.com. +// It may still be available for GitHub Enterprise Server. Use GetEnterpriseDailyMetricsReport +// or GetEnterpriseMetricsReport instead. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-metrics?apiVersion=2022-11-28#get-copilot-metrics-for-an-enterprise-team +// +//meta:operation GET /enterprises/{enterprise}/team/{team_slug}/copilot/metrics +func (s *CopilotService) GetEnterpriseTeamMetrics(ctx context.Context, enterprise, team string, opts *CopilotMetricsListOptions) ([]*CopilotMetrics, *Response, error) { + u := fmt.Sprintf("enterprises/%v/team/%v/copilot/metrics", enterprise, team) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var metrics []*CopilotMetrics + resp, err := s.client.Do(req, &metrics) + if err != nil { + return nil, resp, err + } + + return metrics, resp, nil +} + +// GetOrganizationMetrics gets Copilot usage metrics for an organization. +// +// Deprecated: This endpoint was closed down on April 2, 2026 for github.com. +// It may still be available for GitHub Enterprise Server. Use GetOrganizationDailyMetricsReport +// or GetOrganizationMetricsReport instead. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-metrics?apiVersion=2022-11-28#get-copilot-metrics-for-an-organization +// +//meta:operation GET /orgs/{org}/copilot/metrics +func (s *CopilotService) GetOrganizationMetrics(ctx context.Context, org string, opts *CopilotMetricsListOptions) ([]*CopilotMetrics, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/metrics", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var metrics []*CopilotMetrics + resp, err := s.client.Do(req, &metrics) + if err != nil { + return nil, resp, err + } + + return metrics, resp, nil +} + +// GetOrganizationTeamMetrics gets Copilot usage metrics for an organization team. +// +// Deprecated: This endpoint was closed down on April 2, 2026 for github.com. +// It may still be available for GitHub Enterprise Server. Use GetOrganizationDailyMetricsReport +// or GetOrganizationMetricsReport instead. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-metrics?apiVersion=2022-11-28#get-copilot-metrics-for-a-team +// +//meta:operation GET /orgs/{org}/team/{team_slug}/copilot/metrics +func (s *CopilotService) GetOrganizationTeamMetrics(ctx context.Context, org, team string, opts *CopilotMetricsListOptions) ([]*CopilotMetrics, *Response, error) { + u := fmt.Sprintf("orgs/%v/team/%v/copilot/metrics", org, team) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var metrics []*CopilotMetrics + resp, err := s.client.Do(req, &metrics) + if err != nil { + return nil, resp, err + } + + return metrics, resp, nil +} + +// GetEnterpriseDailyMetricsReport gets a report containing Copilot metrics for a single day for an enterprise. +// +// Use DownloadDailyMetrics to decode the payloads served at the returned download links. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-usage-metrics?apiVersion=2022-11-28#get-copilot-enterprise-usage-metrics-for-a-specific-day +// +//meta:operation GET /enterprises/{enterprise}/copilot/metrics/reports/enterprise-1-day +func (s *CopilotService) GetEnterpriseDailyMetricsReport(ctx context.Context, enterprise string, opts *CopilotMetricsReportOptions) (*CopilotDailyMetricsReport, *Response, error) { + u := fmt.Sprintf("enterprises/%v/copilot/metrics/reports/enterprise-1-day", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotDailyMetricsReport + resp, err := s.client.Do(req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} + +// GetEnterpriseMetricsReport gets a report containing Copilot metrics for a 28-day rolling window for an enterprise. +// +// Use DownloadPeriodicMetrics to decode the payloads served at the returned download links. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-usage-metrics?apiVersion=2022-11-28#get-copilot-enterprise-usage-metrics +// +//meta:operation GET /enterprises/{enterprise}/copilot/metrics/reports/enterprise-28-day/latest +func (s *CopilotService) GetEnterpriseMetricsReport(ctx context.Context, enterprise string) (*CopilotMetricsReport, *Response, error) { + u := fmt.Sprintf("enterprises/%v/copilot/metrics/reports/enterprise-28-day/latest", enterprise) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotMetricsReport + resp, err := s.client.Do(req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} + +// GetEnterpriseUsersDailyMetricsReport gets a report containing Copilot user metrics for a single day for an enterprise. +// +// Use DownloadUserDailyMetrics to decode the payloads served at the returned download links. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-usage-metrics?apiVersion=2022-11-28#get-copilot-users-usage-metrics-for-a-specific-day +// +//meta:operation GET /enterprises/{enterprise}/copilot/metrics/reports/users-1-day +func (s *CopilotService) GetEnterpriseUsersDailyMetricsReport(ctx context.Context, enterprise string, opts *CopilotMetricsReportOptions) (*CopilotDailyMetricsReport, *Response, error) { + u := fmt.Sprintf("enterprises/%v/copilot/metrics/reports/users-1-day", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotDailyMetricsReport + resp, err := s.client.Do(req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} + +// GetEnterpriseUsersMetricsReport gets a report containing Copilot user metrics for a 28-day rolling window for an enterprise. +// +// Use DownloadUserPeriodicMetrics to decode the payloads served at the returned download links. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-usage-metrics?apiVersion=2022-11-28#get-copilot-users-usage-metrics +// +//meta:operation GET /enterprises/{enterprise}/copilot/metrics/reports/users-28-day/latest +func (s *CopilotService) GetEnterpriseUsersMetricsReport(ctx context.Context, enterprise string) (*CopilotMetricsReport, *Response, error) { + u := fmt.Sprintf("enterprises/%v/copilot/metrics/reports/users-28-day/latest", enterprise) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotMetricsReport + resp, err := s.client.Do(req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} + +// GetOrganizationDailyMetricsReport gets a report containing Copilot metrics for a single day for an organization. +// +// Use DownloadDailyMetrics to decode the payloads served at the returned download links. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-usage-metrics?apiVersion=2022-11-28#get-copilot-organization-usage-metrics-for-a-specific-day +// +//meta:operation GET /orgs/{org}/copilot/metrics/reports/organization-1-day +func (s *CopilotService) GetOrganizationDailyMetricsReport(ctx context.Context, org string, opts *CopilotMetricsReportOptions) (*CopilotDailyMetricsReport, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/metrics/reports/organization-1-day", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotDailyMetricsReport + resp, err := s.client.Do(req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} + +// GetOrganizationMetricsReport gets a report containing Copilot metrics for a 28-day rolling window for an organization. +// +// Use DownloadPeriodicMetrics to decode the payloads served at the returned download links. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-usage-metrics?apiVersion=2022-11-28#get-copilot-organization-usage-metrics +// +//meta:operation GET /orgs/{org}/copilot/metrics/reports/organization-28-day/latest +func (s *CopilotService) GetOrganizationMetricsReport(ctx context.Context, org string) (*CopilotMetricsReport, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/metrics/reports/organization-28-day/latest", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotMetricsReport + resp, err := s.client.Do(req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} + +// GetOrganizationUsersDailyMetricsReport gets a report containing Copilot user metrics for a single day for an organization. +// +// Use DownloadUserDailyMetrics to decode the payloads served at the returned download links. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-usage-metrics?apiVersion=2022-11-28#get-copilot-organization-users-usage-metrics-for-a-specific-day +// +//meta:operation GET /orgs/{org}/copilot/metrics/reports/users-1-day +func (s *CopilotService) GetOrganizationUsersDailyMetricsReport(ctx context.Context, org string, opts *CopilotMetricsReportOptions) (*CopilotDailyMetricsReport, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/metrics/reports/users-1-day", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotDailyMetricsReport + resp, err := s.client.Do(req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} + +// GetOrganizationUsersMetricsReport gets a report containing Copilot user metrics for a 28-day rolling window for an organization. +// +// Use DownloadUserPeriodicMetrics to decode the payloads served at the returned download links. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-usage-metrics?apiVersion=2022-11-28#get-copilot-organization-users-usage-metrics +// +//meta:operation GET /orgs/{org}/copilot/metrics/reports/users-28-day/latest +func (s *CopilotService) GetOrganizationUsersMetricsReport(ctx context.Context, org string) (*CopilotMetricsReport, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/metrics/reports/users-28-day/latest", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotMetricsReport + resp, err := s.client.Do(req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} + +// DownloadCopilotMetrics downloads a Copilot metrics report from the provided download link +// and decodes it as a []*CopilotMetrics. +// +// Deprecated: Use DownloadDailyMetrics, +// DownloadPeriodicMetrics, DownloadUserDailyMetrics, DownloadUserPeriodicMetrics instead. +// The payloads served at the download links returned by the new +// Get*MetricsReport endpoints on GitHub.com do not match the CopilotMetrics shape +// (see https://github.com/google/go-github/issues/4136). +// This method is retained +// for GitHub Enterprise Server installations that may still serve the legacy shape. +func (s *CopilotService) DownloadCopilotMetrics(ctx context.Context, url string) ([]*CopilotMetrics, *Response, error) { + req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + if err != nil { + return nil, nil, err + } + + resp, err := s.client.BareDo(req) + if err != nil { + return nil, nil, err + } + defer resp.Body.Close() + + var metrics []*CopilotMetrics + if err := json.NewDecoder(resp.Body).Decode(&metrics); err != nil { + return nil, resp, err + } + + return metrics, resp, nil +} + +// CopilotMetricsPullRequests represents pull request totals in a Copilot metrics report. +type CopilotMetricsPullRequests struct { + TotalReviewed *int `json:"total_reviewed,omitempty"` + TotalCreated *int `json:"total_created,omitempty"` + TotalCreatedByCopilot *int `json:"total_created_by_copilot,omitempty"` + TotalReviewedByCopilot *int `json:"total_reviewed_by_copilot,omitempty"` + TotalMerged *int `json:"total_merged,omitempty"` + MedianMinutesToMerge *float64 `json:"median_minutes_to_merge,omitempty"` + TotalSuggestions *int `json:"total_suggestions,omitempty"` + TotalAppliedSuggestions *int `json:"total_applied_suggestions,omitempty"` + TotalMergedCreatedByCopilot *int `json:"total_merged_created_by_copilot,omitempty"` + MedianMinutesToMergeCopilotAuthored *float64 `json:"median_minutes_to_merge_copilot_authored,omitempty"` + TotalCopilotSuggestions *int `json:"total_copilot_suggestions,omitempty"` + TotalCopilotAppliedSuggestions *int `json:"total_copilot_applied_suggestions,omitempty"` + MedianMinutesToMergeCopilotReviewed *float64 `json:"median_minutes_to_merge_copilot_reviewed,omitempty"` + TotalMergedReviewedByCopilot *int `json:"total_merged_reviewed_by_copilot,omitempty"` +} + +// CopilotMetricsCodeActivity captures the code-generation activity counts and lines-of-code (LOC) +// suggestion totals shared across the per-IDE, per-feature, per-language, and per-model breakdowns +// in a Copilot metrics report. +type CopilotMetricsCodeActivity struct { + CodeGenerationActivityCount *int `json:"code_generation_activity_count,omitempty"` + CodeAcceptanceActivityCount *int `json:"code_acceptance_activity_count,omitempty"` + LOCSuggestedToAddSum *int `json:"loc_suggested_to_add_sum,omitempty"` + LOCSuggestedToDeleteSum *int `json:"loc_suggested_to_delete_sum,omitempty"` + LOCAddedSum *int `json:"loc_added_sum,omitempty"` + LOCDeletedSum *int `json:"loc_deleted_sum,omitempty"` +} + +// CopilotMetricsChatPanel captures per-mode chat panel interaction counts shared across daily, +// periodic, and user metrics reports. Each field is a subset of user_initiated_interaction_count +// attributed to that chat panel mode. +type CopilotMetricsChatPanel struct { + ChatPanelAgentMode *int `json:"chat_panel_agent_mode,omitempty"` + ChatPanelAskMode *int `json:"chat_panel_ask_mode,omitempty"` + ChatPanelCustomMode *int `json:"chat_panel_custom_mode,omitempty"` + ChatPanelEditMode *int `json:"chat_panel_edit_mode,omitempty"` + ChatPanelUnknownMode *int `json:"chat_panel_unknown_mode,omitempty"` +} + +// CopilotMetricsIDE represents per-IDE aggregate totals in a Copilot metrics report. +type CopilotMetricsIDE struct { + IDE string `json:"ide"` + UserInitiatedInteractionCount *int `json:"user_initiated_interaction_count,omitempty"` + CopilotMetricsCodeActivity +} + +// CopilotMetricsFeature represents per-feature aggregate totals in a Copilot metrics report. +type CopilotMetricsFeature struct { + Feature string `json:"feature"` + UserInitiatedInteractionCount *int `json:"user_initiated_interaction_count,omitempty"` + CopilotMetricsCodeActivity +} + +// CopilotMetricsLanguageFeature represents per-language-feature totals in a Copilot metrics report. +type CopilotMetricsLanguageFeature struct { + Language string `json:"language"` + Feature string `json:"feature"` + CopilotMetricsCodeActivity +} + +// CopilotMetricsLanguageModel represents per-language-model totals in a Copilot metrics report. +type CopilotMetricsLanguageModel struct { + Language string `json:"language"` + Model string `json:"model"` + CopilotMetricsCodeActivity +} + +// CopilotMetricsModelFeature represents per-model-feature totals in a Copilot metrics report. +type CopilotMetricsModelFeature struct { + Model string `json:"model"` + Feature string `json:"feature"` + UserInitiatedInteractionCount *int `json:"user_initiated_interaction_count,omitempty"` + CopilotMetricsCodeActivity +} + +// CopilotMetricsCLIVersion represents the last known Copilot CLI version seen in a metrics report. +type CopilotMetricsCLIVersion struct { + SampledAt *Timestamp `json:"sampled_at,omitempty"` + CLIVersion string `json:"cli_version"` +} + +// CopilotMetricsCLITokenUsage represents Copilot CLI token totals in a metrics report. +type CopilotMetricsCLITokenUsage struct { + AvgTokensPerRequest *float64 `json:"avg_tokens_per_request,omitempty"` + OutputTokensSum *int `json:"output_tokens_sum,omitempty"` + PromptTokensSum *int `json:"prompt_tokens_sum,omitempty"` +} + +// CopilotMetricsCLI represents Copilot CLI totals in a metrics report. +type CopilotMetricsCLI struct { + SessionCount *int `json:"session_count,omitempty"` + RequestCount *int `json:"request_count,omitempty"` + PromptCount *int `json:"prompt_count,omitempty"` + TokenUsage *CopilotMetricsCLITokenUsage `json:"token_usage,omitempty"` + LastKnownCLIVersion *CopilotMetricsCLIVersion `json:"last_known_cli_version,omitempty"` +} + +// CopilotDailyMetrics represents the payload downloaded from a 1-day Copilot usage metrics report. +type CopilotDailyMetrics struct { + Day string `json:"day"` + OrganizationID *string `json:"organization_id,omitempty"` + EnterpriseID *string `json:"enterprise_id,omitempty"` + DailyActiveCLIUsers *int `json:"daily_active_cli_users,omitempty"` + DailyActiveUsers *int `json:"daily_active_users,omitempty"` + DailyActiveCopilotCloudAgentUsers *int `json:"daily_active_copilot_cloud_agent_users,omitempty"` + WeeklyActiveUsers *int `json:"weekly_active_users,omitempty"` + WeeklyActiveCopilotCloudAgentUsers *int `json:"weekly_active_copilot_cloud_agent_users,omitempty"` + MonthlyActiveUsers *int `json:"monthly_active_users,omitempty"` + MonthlyActiveChatUsers *int `json:"monthly_active_chat_users,omitempty"` + MonthlyActiveAgentUsers *int `json:"monthly_active_agent_users,omitempty"` + MonthlyActiveCopilotCloudAgentUsers *int `json:"monthly_active_copilot_cloud_agent_users,omitempty"` + UserInitiatedInteractionCount *int `json:"user_initiated_interaction_count,omitempty"` + CopilotMetricsChatPanel + CodeGenerationActivityCount *int `json:"code_generation_activity_count,omitempty"` + CodeAcceptanceActivityCount *int `json:"code_acceptance_activity_count,omitempty"` + TotalsByIDE []*CopilotMetricsIDE `json:"totals_by_ide,omitempty"` + TotalsByFeature []*CopilotMetricsFeature `json:"totals_by_feature,omitempty"` + TotalsByLanguageFeature []*CopilotMetricsLanguageFeature `json:"totals_by_language_feature,omitempty"` + TotalsByLanguageModel []*CopilotMetricsLanguageModel `json:"totals_by_language_model,omitempty"` + TotalsByModelFeature []*CopilotMetricsModelFeature `json:"totals_by_model_feature,omitempty"` + TotalsByCLI *CopilotMetricsCLI `json:"totals_by_cli,omitempty"` + LOCSuggestedToAddSum *int `json:"loc_suggested_to_add_sum,omitempty"` + LOCSuggestedToDeleteSum *int `json:"loc_suggested_to_delete_sum,omitempty"` + LOCAddedSum *int `json:"loc_added_sum,omitempty"` + LOCDeletedSum *int `json:"loc_deleted_sum,omitempty"` + PullRequests *CopilotMetricsPullRequests `json:"pull_requests,omitempty"` +} + +// CopilotPeriodicMetrics represents the payload downloaded from a multi-day (e.g. 28-day rolling) +// Copilot usage metrics report. The DayTotals field contains one CopilotDailyMetrics entry per day +// in the reporting window. Window-level metadata (ReportStartDay, ReportEndDay, CreatedAt) lives on +// this parent struct; each DayTotals entry only populates fields scoped to that day. +type CopilotPeriodicMetrics struct { + ReportStartDay string `json:"report_start_day"` + ReportEndDay string `json:"report_end_day"` + OrganizationID *string `json:"organization_id,omitempty"` + EnterpriseID *string `json:"enterprise_id,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + DayTotals []*CopilotDailyMetrics `json:"day_totals,omitempty"` +} + +// CopilotUserMetricsPluginVersion represents the last known plugin version used in an IDE by a Copilot user. +type CopilotUserMetricsPluginVersion struct { + SampledAt *Timestamp `json:"sampled_at,omitempty"` + Plugin string `json:"plugin"` + PluginVersion string `json:"plugin_version"` +} + +// CopilotUserMetricsIDEVersion represents the last known IDE version used by a Copilot user. +type CopilotUserMetricsIDEVersion struct { + SampledAt *Timestamp `json:"sampled_at,omitempty"` + IDEVersion string `json:"ide_version"` +} + +// CopilotUserMetricsIDE represents per-IDE totals for a single Copilot user in a user metrics report. +type CopilotUserMetricsIDE struct { + IDE string `json:"ide"` + UserInitiatedInteractionCount *int `json:"user_initiated_interaction_count,omitempty"` + CopilotMetricsCodeActivity + LastKnownPluginVersion *CopilotUserMetricsPluginVersion `json:"last_known_plugin_version,omitempty"` + LastKnownIDEVersion *CopilotUserMetricsIDEVersion `json:"last_known_ide_version,omitempty"` +} + +// CopilotUserDailyMetrics represents a single user's per-day Copilot usage metrics record from a +// 1-day user metrics report. User metrics reports are served as newline-delimited JSON. +type CopilotUserDailyMetrics struct { + UserID int `json:"user_id"` + UserLogin string `json:"user_login"` + Day string `json:"day"` + OrganizationID *string `json:"organization_id,omitempty"` + EnterpriseID *string `json:"enterprise_id,omitempty"` + UserInitiatedInteractionCount *int `json:"user_initiated_interaction_count,omitempty"` + CopilotMetricsChatPanel + CodeGenerationActivityCount *int `json:"code_generation_activity_count,omitempty"` + CodeAcceptanceActivityCount *int `json:"code_acceptance_activity_count,omitempty"` + TotalsByIDE []*CopilotUserMetricsIDE `json:"totals_by_ide,omitempty"` + TotalsByFeature []*CopilotMetricsFeature `json:"totals_by_feature,omitempty"` + TotalsByLanguageFeature []*CopilotMetricsLanguageFeature `json:"totals_by_language_feature,omitempty"` + TotalsByLanguageModel []*CopilotMetricsLanguageModel `json:"totals_by_language_model,omitempty"` + TotalsByModelFeature []*CopilotMetricsModelFeature `json:"totals_by_model_feature,omitempty"` + TotalsByCLI *CopilotMetricsCLI `json:"totals_by_cli,omitempty"` + UsedAgent *bool `json:"used_agent,omitempty"` + UsedChat *bool `json:"used_chat,omitempty"` + UsedCLI *bool `json:"used_cli,omitempty"` + UsedCopilotCodeReviewActive *bool `json:"used_copilot_code_review_active,omitempty"` + UsedCopilotCodeReviewPassive *bool `json:"used_copilot_code_review_passive,omitempty"` + UsedCopilotCodingAgent *bool `json:"used_copilot_coding_agent,omitempty"` + LOCSuggestedToAddSum *int `json:"loc_suggested_to_add_sum,omitempty"` + LOCSuggestedToDeleteSum *int `json:"loc_suggested_to_delete_sum,omitempty"` + LOCAddedSum *int `json:"loc_added_sum,omitempty"` + LOCDeletedSum *int `json:"loc_deleted_sum,omitempty"` +} + +// CopilotUserPeriodicMetrics represents a single user's per-day Copilot usage metrics record from a +// multi-day (e.g. 28-day rolling) user metrics report. User metrics reports are served as +// newline-delimited JSON. +type CopilotUserPeriodicMetrics struct { + ReportStartDay string `json:"report_start_day"` + ReportEndDay string `json:"report_end_day"` + Day string `json:"day"` + OrganizationID *string `json:"organization_id,omitempty"` + EnterpriseID *string `json:"enterprise_id,omitempty"` + UserID int `json:"user_id"` + UserLogin string `json:"user_login"` + UserInitiatedInteractionCount *int `json:"user_initiated_interaction_count,omitempty"` + CopilotMetricsChatPanel + CodeGenerationActivityCount *int `json:"code_generation_activity_count,omitempty"` + CodeAcceptanceActivityCount *int `json:"code_acceptance_activity_count,omitempty"` + TotalsByIDE []*CopilotUserMetricsIDE `json:"totals_by_ide,omitempty"` + TotalsByFeature []*CopilotMetricsFeature `json:"totals_by_feature,omitempty"` + TotalsByLanguageFeature []*CopilotMetricsLanguageFeature `json:"totals_by_language_feature,omitempty"` + TotalsByLanguageModel []*CopilotMetricsLanguageModel `json:"totals_by_language_model,omitempty"` + TotalsByModelFeature []*CopilotMetricsModelFeature `json:"totals_by_model_feature,omitempty"` + TotalsByCLI *CopilotMetricsCLI `json:"totals_by_cli,omitempty"` + UsedAgent *bool `json:"used_agent,omitempty"` + UsedChat *bool `json:"used_chat,omitempty"` + UsedCLI *bool `json:"used_cli,omitempty"` + UsedCopilotCodeReviewActive *bool `json:"used_copilot_code_review_active,omitempty"` + UsedCopilotCodeReviewPassive *bool `json:"used_copilot_code_review_passive,omitempty"` + UsedCopilotCodingAgent *bool `json:"used_copilot_coding_agent,omitempty"` + LOCSuggestedToAddSum *int `json:"loc_suggested_to_add_sum,omitempty"` + LOCSuggestedToDeleteSum *int `json:"loc_suggested_to_delete_sum,omitempty"` + LOCAddedSum *int `json:"loc_added_sum,omitempty"` + LOCDeletedSum *int `json:"loc_deleted_sum,omitempty"` +} + +// fetchMetricsReport performs a GET against the provided download URL and returns the raw +// http.Response. The caller is responsible for closing the body. +func (s *CopilotService) fetchMetricsReport(ctx context.Context, url string) (*http.Response, *Response, error) { + req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + if err != nil { + return nil, nil, err + } + + resp, err := s.client.client.Do(req) + if err != nil { + return nil, nil, err + } + + if err := CheckResponse(resp); err != nil { + resp.Body.Close() + return nil, newResponse(resp), err + } + + return resp, newResponse(resp), nil +} + +// decodeNDJSONMetrics streams a newline-delimited JSON response body into a slice of *T, +// returning a nil slice when the body is empty. +func decodeNDJSONMetrics[T any](r io.Reader) ([]*T, error) { + var records []*T + dec := json.NewDecoder(r) + for { + var rec *T + if err := dec.Decode(&rec); err != nil { + if errors.Is(err, io.EOF) { + break + } + return nil, err + } + records = append(records, rec) + } + return records, nil +} + +// DownloadDailyMetrics downloads the payload of a 1-day Copilot usage metrics report from a +// download link returned by GetEnterpriseDailyMetricsReport or GetOrganizationDailyMetricsReport. +func (s *CopilotService) DownloadDailyMetrics(ctx context.Context, url string) (*CopilotDailyMetrics, *Response, error) { + resp, r, err := s.fetchMetricsReport(ctx, url) + if err != nil { + return nil, r, err + } + defer resp.Body.Close() + + var metrics *CopilotDailyMetrics + if err := json.NewDecoder(resp.Body).Decode(&metrics); err != nil { + return nil, r, err + } + + return metrics, r, nil +} + +// DownloadPeriodicMetrics downloads the payload of a multi-day (e.g. 28-day rolling) Copilot +// usage metrics report from a download link returned by GetEnterpriseMetricsReport or +// GetOrganizationMetricsReport. +func (s *CopilotService) DownloadPeriodicMetrics(ctx context.Context, url string) (*CopilotPeriodicMetrics, *Response, error) { + resp, r, err := s.fetchMetricsReport(ctx, url) + if err != nil { + return nil, r, err + } + defer resp.Body.Close() + + var metrics *CopilotPeriodicMetrics + if err := json.NewDecoder(resp.Body).Decode(&metrics); err != nil { + return nil, r, err + } + + return metrics, r, nil +} + +// DownloadUserDailyMetrics downloads the payload of a 1-day Copilot user metrics report from a +// download link returned by GetEnterpriseUsersDailyMetricsReport or +// GetOrganizationUsersDailyMetricsReport. +// +// The response is newline-delimited JSON, with one CopilotUserDailyMetrics record per line. +func (s *CopilotService) DownloadUserDailyMetrics(ctx context.Context, url string) ([]*CopilotUserDailyMetrics, *Response, error) { + resp, r, err := s.fetchMetricsReport(ctx, url) + if err != nil { + return nil, r, err + } + defer resp.Body.Close() + + records, err := decodeNDJSONMetrics[CopilotUserDailyMetrics](resp.Body) + if err != nil { + return nil, r, err + } + return records, r, nil +} + +// DownloadUserPeriodicMetrics downloads the payload of a multi-day (e.g. 28-day rolling) Copilot +// user metrics report from a download link returned by GetEnterpriseUsersMetricsReport or +// GetOrganizationUsersMetricsReport. +// +// The response is newline-delimited JSON, with one CopilotUserPeriodicMetrics record per +// user-day in the reporting window. +func (s *CopilotService) DownloadUserPeriodicMetrics(ctx context.Context, url string) ([]*CopilotUserPeriodicMetrics, *Response, error) { + resp, r, err := s.fetchMetricsReport(ctx, url) + if err != nil { + return nil, r, err + } + defer resp.Body.Close() + + records, err := decodeNDJSONMetrics[CopilotUserPeriodicMetrics](resp.Body) + if err != nil { + return nil, r, err + } + return records, r, nil +} diff --git a/vendor/github.com/google/go-github/v88/github/credentials.go b/vendor/github.com/google/go-github/v88/github/credentials.go new file mode 100644 index 000000000..d785edc0d --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/credentials.go @@ -0,0 +1,37 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" +) + +// CredentialsService handles credentials related methods of the GitHub API. +type CredentialsService service + +// revokeCredentialsRequest represents the request body for revoking credentials. +type revokeCredentialsRequest struct { + // The list of credential strings (tokens) to revoke. + Credentials []string `json:"credentials"` +} + +// Revoke revokes a list of credentials. +// +// GitHub API docs: https://docs.github.com/rest/credentials/revoke?apiVersion=2022-11-28#revoke-a-list-of-credentials +// +//meta:operation POST /credentials/revoke +func (s *CredentialsService) Revoke(ctx context.Context, credentials []string) (*Response, error) { + u := "credentials/revoke" + + reqBody := &revokeCredentialsRequest{Credentials: credentials} + + req, err := s.client.NewRequest(ctx, "POST", u, reqBody) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v73/github/dependabot.go b/vendor/github.com/google/go-github/v88/github/dependabot.go similarity index 79% rename from vendor/github.com/google/go-github/v73/github/dependabot.go rename to vendor/github.com/google/go-github/v88/github/dependabot.go index 2a11a9c95..5e4f73544 100644 --- a/vendor/github.com/google/go-github/v73/github/dependabot.go +++ b/vendor/github.com/google/go-github/v88/github/dependabot.go @@ -8,5 +8,5 @@ package github // DependabotService handles communication with the Dependabot related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/dependabot/ +// GitHub API docs: https://docs.github.com/rest/dependabot?apiVersion=2022-11-28 type DependabotService service diff --git a/vendor/github.com/google/go-github/v73/github/dependabot_alerts.go b/vendor/github.com/google/go-github/v88/github/dependabot_alerts.go similarity index 92% rename from vendor/github.com/google/go-github/v73/github/dependabot_alerts.go rename to vendor/github.com/google/go-github/v88/github/dependabot_alerts.go index 67e624c9e..dc4445dce 100644 --- a/vendor/github.com/google/go-github/v73/github/dependabot_alerts.go +++ b/vendor/github.com/google/go-github/v88/github/dependabot_alerts.go @@ -109,13 +109,13 @@ func (s *DependabotService) listAlerts(ctx context.Context, url string, opts *Li return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var alerts []*DependabotAlert - resp, err := s.client.Do(ctx, req, &alerts) + resp, err := s.client.Do(req, &alerts) if err != nil { return nil, resp, err } @@ -125,7 +125,7 @@ func (s *DependabotService) listAlerts(ctx context.Context, url string, opts *Li // ListRepoAlerts lists all Dependabot alerts of a repository. // -// GitHub API docs: https://docs.github.com/rest/dependabot/alerts#list-dependabot-alerts-for-a-repository +// GitHub API docs: https://docs.github.com/rest/dependabot/alerts?apiVersion=2022-11-28#list-dependabot-alerts-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/dependabot/alerts func (s *DependabotService) ListRepoAlerts(ctx context.Context, owner, repo string, opts *ListAlertsOptions) ([]*DependabotAlert, *Response, error) { @@ -135,7 +135,7 @@ func (s *DependabotService) ListRepoAlerts(ctx context.Context, owner, repo stri // ListOrgAlerts lists all Dependabot alerts of an organization. // -// GitHub API docs: https://docs.github.com/rest/dependabot/alerts#list-dependabot-alerts-for-an-organization +// GitHub API docs: https://docs.github.com/rest/dependabot/alerts?apiVersion=2022-11-28#list-dependabot-alerts-for-an-organization // //meta:operation GET /orgs/{org}/dependabot/alerts func (s *DependabotService) ListOrgAlerts(ctx context.Context, org string, opts *ListAlertsOptions) ([]*DependabotAlert, *Response, error) { @@ -145,18 +145,18 @@ func (s *DependabotService) ListOrgAlerts(ctx context.Context, org string, opts // GetRepoAlert gets a single repository Dependabot alert. // -// GitHub API docs: https://docs.github.com/rest/dependabot/alerts#get-a-dependabot-alert +// GitHub API docs: https://docs.github.com/rest/dependabot/alerts?apiVersion=2022-11-28#get-a-dependabot-alert // //meta:operation GET /repos/{owner}/{repo}/dependabot/alerts/{alert_number} func (s *DependabotService) GetRepoAlert(ctx context.Context, owner, repo string, number int) (*DependabotAlert, *Response, error) { url := fmt.Sprintf("repos/%v/%v/dependabot/alerts/%v", owner, repo, number) - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } - alert := new(DependabotAlert) - resp, err := s.client.Do(ctx, req, alert) + var alert *DependabotAlert + resp, err := s.client.Do(req, &alert) if err != nil { return nil, resp, err } @@ -166,18 +166,18 @@ func (s *DependabotService) GetRepoAlert(ctx context.Context, owner, repo string // UpdateAlert updates a Dependabot alert. // -// GitHub API docs: https://docs.github.com/rest/dependabot/alerts#update-a-dependabot-alert +// GitHub API docs: https://docs.github.com/rest/dependabot/alerts?apiVersion=2022-11-28#update-a-dependabot-alert // //meta:operation PATCH /repos/{owner}/{repo}/dependabot/alerts/{alert_number} func (s *DependabotService) UpdateAlert(ctx context.Context, owner, repo string, number int, stateInfo *DependabotAlertState) (*DependabotAlert, *Response, error) { url := fmt.Sprintf("repos/%v/%v/dependabot/alerts/%v", owner, repo, number) - req, err := s.client.NewRequest("PATCH", url, stateInfo) + req, err := s.client.NewRequest(ctx, "PATCH", url, stateInfo) if err != nil { return nil, nil, err } - alert := new(DependabotAlert) - resp, err := s.client.Do(ctx, req, alert) + var alert *DependabotAlert + resp, err := s.client.Do(req, &alert) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/dependabot_secrets.go b/vendor/github.com/google/go-github/v88/github/dependabot_secrets.go similarity index 80% rename from vendor/github.com/google/go-github/v73/github/dependabot_secrets.go rename to vendor/github.com/google/go-github/v88/github/dependabot_secrets.go index e85c805a6..75e23ba5b 100644 --- a/vendor/github.com/google/go-github/v73/github/dependabot_secrets.go +++ b/vendor/github.com/google/go-github/v88/github/dependabot_secrets.go @@ -7,17 +7,18 @@ package github import ( "context" + "errors" "fmt" ) func (s *DependabotService) getPublicKey(ctx context.Context, url string) (*PublicKey, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } - pubKey := new(PublicKey) - resp, err := s.client.Do(ctx, req, pubKey) + var pubKey *PublicKey + resp, err := s.client.Do(req, &pubKey) if err != nil { return nil, resp, err } @@ -27,7 +28,7 @@ func (s *DependabotService) getPublicKey(ctx context.Context, url string) (*Publ // GetRepoPublicKey gets a public key that should be used for Dependabot secret encryption. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#get-a-repository-public-key +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#get-a-repository-public-key // //meta:operation GET /repos/{owner}/{repo}/dependabot/secrets/public-key func (s *DependabotService) GetRepoPublicKey(ctx context.Context, owner, repo string) (*PublicKey, *Response, error) { @@ -37,7 +38,7 @@ func (s *DependabotService) GetRepoPublicKey(ctx context.Context, owner, repo st // GetOrgPublicKey gets a public key that should be used for Dependabot secret encryption. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#get-an-organization-public-key +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#get-an-organization-public-key // //meta:operation GET /orgs/{org}/dependabot/secrets/public-key func (s *DependabotService) GetOrgPublicKey(ctx context.Context, org string) (*PublicKey, *Response, error) { @@ -51,13 +52,13 @@ func (s *DependabotService) listSecrets(ctx context.Context, url string, opts *L return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - secrets := new(Secrets) - resp, err := s.client.Do(ctx, req, &secrets) + var secrets *Secrets + resp, err := s.client.Do(req, &secrets) if err != nil { return nil, resp, err } @@ -68,7 +69,7 @@ func (s *DependabotService) listSecrets(ctx context.Context, url string, opts *L // ListRepoSecrets lists all Dependabot secrets available in a repository // without revealing their encrypted values. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#list-repository-secrets +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#list-repository-secrets // //meta:operation GET /repos/{owner}/{repo}/dependabot/secrets func (s *DependabotService) ListRepoSecrets(ctx context.Context, owner, repo string, opts *ListOptions) (*Secrets, *Response, error) { @@ -79,7 +80,7 @@ func (s *DependabotService) ListRepoSecrets(ctx context.Context, owner, repo str // ListOrgSecrets lists all Dependabot secrets available in an organization // without revealing their encrypted values. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#list-organization-secrets +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#list-organization-secrets // //meta:operation GET /orgs/{org}/dependabot/secrets func (s *DependabotService) ListOrgSecrets(ctx context.Context, org string, opts *ListOptions) (*Secrets, *Response, error) { @@ -88,13 +89,13 @@ func (s *DependabotService) ListOrgSecrets(ctx context.Context, org string, opts } func (s *DependabotService) getSecret(ctx context.Context, url string) (*Secret, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } - secret := new(Secret) - resp, err := s.client.Do(ctx, req, secret) + var secret *Secret + resp, err := s.client.Do(req, &secret) if err != nil { return nil, resp, err } @@ -104,7 +105,7 @@ func (s *DependabotService) getSecret(ctx context.Context, url string) (*Secret, // GetRepoSecret gets a single repository Dependabot secret without revealing its encrypted value. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#get-a-repository-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#get-a-repository-secret // //meta:operation GET /repos/{owner}/{repo}/dependabot/secrets/{secret_name} func (s *DependabotService) GetRepoSecret(ctx context.Context, owner, repo, name string) (*Secret, *Response, error) { @@ -114,7 +115,7 @@ func (s *DependabotService) GetRepoSecret(ctx context.Context, owner, repo, name // GetOrgSecret gets a single organization Dependabot secret without revealing its encrypted value. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#get-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#get-an-organization-secret // //meta:operation GET /orgs/{org}/dependabot/secrets/{secret_name} func (s *DependabotService) GetOrgSecret(ctx context.Context, org, name string) (*Secret, *Response, error) { @@ -136,30 +137,38 @@ type DependabotEncryptedSecret struct { } func (s *DependabotService) putSecret(ctx context.Context, url string, eSecret *DependabotEncryptedSecret) (*Response, error) { - req, err := s.client.NewRequest("PUT", url, eSecret) + req, err := s.client.NewRequest(ctx, "PUT", url, eSecret) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // CreateOrUpdateRepoSecret creates or updates a repository Dependabot secret with an encrypted value. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#create-or-update-a-repository-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#create-or-update-a-repository-secret // //meta:operation PUT /repos/{owner}/{repo}/dependabot/secrets/{secret_name} func (s *DependabotService) CreateOrUpdateRepoSecret(ctx context.Context, owner, repo string, eSecret *DependabotEncryptedSecret) (*Response, error) { + if eSecret == nil { + return nil, errors.New("dependabot encrypted secret must be provided") + } + url := fmt.Sprintf("repos/%v/%v/dependabot/secrets/%v", owner, repo, eSecret.Name) return s.putSecret(ctx, url, eSecret) } // CreateOrUpdateOrgSecret creates or updates an organization Dependabot secret with an encrypted value. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#create-or-update-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#create-or-update-an-organization-secret // //meta:operation PUT /orgs/{org}/dependabot/secrets/{secret_name} func (s *DependabotService) CreateOrUpdateOrgSecret(ctx context.Context, org string, eSecret *DependabotEncryptedSecret) (*Response, error) { + if eSecret == nil { + return nil, errors.New("dependabot encrypted secret must be provided") + } + repoIDs := make([]string, len(eSecret.SelectedRepositoryIDs)) for i, secret := range eSecret.SelectedRepositoryIDs { repoIDs[i] = fmt.Sprintf("%v", secret) @@ -173,26 +182,26 @@ func (s *DependabotService) CreateOrUpdateOrgSecret(ctx context.Context, org str } url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v", org, eSecret.Name) - req, err := s.client.NewRequest("PUT", url, params) + req, err := s.client.NewRequest(ctx, "PUT", url, params) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } func (s *DependabotService) deleteSecret(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest("DELETE", url, nil) + req, err := s.client.NewRequest(ctx, "DELETE", url, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DeleteRepoSecret deletes a Dependabot secret in a repository using the secret name. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#delete-a-repository-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#delete-a-repository-secret // //meta:operation DELETE /repos/{owner}/{repo}/dependabot/secrets/{secret_name} func (s *DependabotService) DeleteRepoSecret(ctx context.Context, owner, repo, name string) (*Response, error) { @@ -202,7 +211,7 @@ func (s *DependabotService) DeleteRepoSecret(ctx context.Context, owner, repo, n // DeleteOrgSecret deletes a Dependabot secret in an organization using the secret name. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#delete-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#delete-an-organization-secret // //meta:operation DELETE /orgs/{org}/dependabot/secrets/{secret_name} func (s *DependabotService) DeleteOrgSecret(ctx context.Context, org, name string) (*Response, error) { @@ -212,7 +221,7 @@ func (s *DependabotService) DeleteOrgSecret(ctx context.Context, org, name strin // ListSelectedReposForOrgSecret lists all repositories that have access to a Dependabot secret. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#list-selected-repositories-for-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#list-selected-repositories-for-an-organization-secret // //meta:operation GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories func (s *DependabotService) ListSelectedReposForOrgSecret(ctx context.Context, org, name string, opts *ListOptions) (*SelectedReposList, *Response, error) { @@ -222,13 +231,13 @@ func (s *DependabotService) ListSelectedReposForOrgSecret(ctx context.Context, o return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - result := new(SelectedReposList) - resp, err := s.client.Do(ctx, req, result) + var result *SelectedReposList + resp, err := s.client.Do(req, &result) if err != nil { return nil, resp, err } @@ -241,7 +250,7 @@ type DependabotSecretsSelectedRepoIDs []int64 // SetSelectedReposForOrgSecret sets the repositories that have access to a Dependabot secret. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#set-selected-repositories-for-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#set-selected-repositories-for-an-organization-secret // //meta:operation PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories func (s *DependabotService) SetSelectedReposForOrgSecret(ctx context.Context, org, name string, ids DependabotSecretsSelectedRepoIDs) (*Response, error) { @@ -250,40 +259,54 @@ func (s *DependabotService) SetSelectedReposForOrgSecret(ctx context.Context, or SelectedIDs DependabotSecretsSelectedRepoIDs `json:"selected_repository_ids"` } - req, err := s.client.NewRequest("PUT", url, repoIDs{SelectedIDs: ids}) + req, err := s.client.NewRequest(ctx, "PUT", url, repoIDs{SelectedIDs: ids}) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // AddSelectedRepoToOrgSecret adds a repository to an organization Dependabot secret. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#add-selected-repository-to-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#add-selected-repository-to-an-organization-secret // //meta:operation PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id} func (s *DependabotService) AddSelectedRepoToOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) { + if repo == nil { + return nil, errors.New("repository must be provided") + } + if repo.ID == nil { + return nil, errors.New("id must be provided") + } + url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v/repositories/%v", org, name, *repo.ID) - req, err := s.client.NewRequest("PUT", url, nil) + req, err := s.client.NewRequest(ctx, "PUT", url, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RemoveSelectedRepoFromOrgSecret removes a repository from an organization Dependabot secret. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#remove-selected-repository-from-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#remove-selected-repository-from-an-organization-secret // //meta:operation DELETE /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id} func (s *DependabotService) RemoveSelectedRepoFromOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) { + if repo == nil { + return nil, errors.New("repository must be provided") + } + if repo.ID == nil { + return nil, errors.New("id must be provided") + } + url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v/repositories/%v", org, name, *repo.ID) - req, err := s.client.NewRequest("DELETE", url, nil) + req, err := s.client.NewRequest(ctx, "DELETE", url, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/dependency_graph.go b/vendor/github.com/google/go-github/v88/github/dependency_graph.go similarity index 91% rename from vendor/github.com/google/go-github/v73/github/dependency_graph.go rename to vendor/github.com/google/go-github/v88/github/dependency_graph.go index b202aafff..f145799a1 100644 --- a/vendor/github.com/google/go-github/v73/github/dependency_graph.go +++ b/vendor/github.com/google/go-github/v88/github/dependency_graph.go @@ -10,6 +10,10 @@ import ( "fmt" ) +// DependencyGraphService handles communication with the dependency graph +// related methods of the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/dependency-graph?apiVersion=2022-11-28 type DependencyGraphService service // SBOM represents a software bill of materials, which describes the @@ -66,7 +70,7 @@ type SBOMRelationship struct { // Example: "SPDXRef-github-interlynk-io-sbomqs-main-f43c98" SPDXElementID string `json:"spdxElementId"` - // RelatedSpdxElement is the identifier of the related SPDX element. + // RelatedSPDXElement is the identifier of the related SPDX element. // Example: "SPDXRef-golang-github.comspf13-cobra-1.8.1-75c946" RelatedSPDXElement string `json:"relatedSpdxElement"` @@ -104,19 +108,19 @@ func (s SBOM) String() string { // GetSBOM fetches the software bill of materials for a repository. // -// GitHub API docs: https://docs.github.com/rest/dependency-graph/sboms#export-a-software-bill-of-materials-sbom-for-a-repository +// GitHub API docs: https://docs.github.com/rest/dependency-graph/sboms?apiVersion=2022-11-28#export-a-software-bill-of-materials-sbom-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/dependency-graph/sbom func (s *DependencyGraphService) GetSBOM(ctx context.Context, owner, repo string) (*SBOM, *Response, error) { u := fmt.Sprintf("repos/%v/%v/dependency-graph/sbom", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var sbom *SBOM - resp, err := s.client.Do(ctx, req, &sbom) + resp, err := s.client.Do(req, &sbom) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/dependency_graph_snapshots.go b/vendor/github.com/google/go-github/v88/github/dependency_graph_snapshots.go similarity index 75% rename from vendor/github.com/google/go-github/v73/github/dependency_graph_snapshots.go rename to vendor/github.com/google/go-github/v88/github/dependency_graph_snapshots.go index 0606b9815..9bf920acb 100644 --- a/vendor/github.com/google/go-github/v73/github/dependency_graph_snapshots.go +++ b/vendor/github.com/google/go-github/v88/github/dependency_graph_snapshots.go @@ -12,9 +12,18 @@ import ( // DependencyGraphSnapshotResolvedDependency represents a resolved dependency in a dependency graph snapshot. // -// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository +// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission?apiVersion=2022-11-28#create-a-snapshot-of-dependencies-for-a-repository type DependencyGraphSnapshotResolvedDependency struct { PackageURL *string `json:"package_url,omitempty"` + // User-defined metadata to store domain-specific information limited to 8 keys with scalar values. + // This metadata overrides auto-detected values from the package URL and GitHub's database. + // Common fields include: + // - "licenses": license information (e.g., "MIT", "Apache-2.0") + // - "name": package name + // - "version": package version + // - "manager": package manager (e.g., "npm", "pip", "maven") + // - "description": package description + Metadata map[string]any `json:"metadata,omitempty"` // Represents whether the dependency is requested directly by the manifest or is a dependency of another dependency. // Can have the following values: // - "direct": indicates that the dependency is requested directly by the manifest. @@ -30,7 +39,7 @@ type DependencyGraphSnapshotResolvedDependency struct { // DependencyGraphSnapshotJob represents the job that created the snapshot. // -// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository +// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission?apiVersion=2022-11-28#create-a-snapshot-of-dependencies-for-a-repository type DependencyGraphSnapshotJob struct { Correlator *string `json:"correlator,omitempty"` ID *string `json:"id,omitempty"` @@ -39,7 +48,7 @@ type DependencyGraphSnapshotJob struct { // DependencyGraphSnapshotDetector represents a description of the detector used. // -// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository +// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission?apiVersion=2022-11-28#create-a-snapshot-of-dependencies-for-a-repository type DependencyGraphSnapshotDetector struct { Name *string `json:"name,omitempty"` Version *string `json:"version,omitempty"` @@ -48,23 +57,24 @@ type DependencyGraphSnapshotDetector struct { // DependencyGraphSnapshotManifestFile represents the file declaring the repository's dependencies. // -// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository +// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission?apiVersion=2022-11-28#create-a-snapshot-of-dependencies-for-a-repository type DependencyGraphSnapshotManifestFile struct { SourceLocation *string `json:"source_location,omitempty"` } // DependencyGraphSnapshotManifest represents a collection of related dependencies declared in a file or representing a logical group of dependencies. // -// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository +// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission?apiVersion=2022-11-28#create-a-snapshot-of-dependencies-for-a-repository type DependencyGraphSnapshotManifest struct { Name *string `json:"name,omitempty"` File *DependencyGraphSnapshotManifestFile `json:"file,omitempty"` + Metadata map[string]any `json:"metadata,omitempty"` Resolved map[string]*DependencyGraphSnapshotResolvedDependency `json:"resolved,omitempty"` } // DependencyGraphSnapshot represent a snapshot of a repository's dependencies. // -// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository +// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission?apiVersion=2022-11-28#create-a-snapshot-of-dependencies-for-a-repository type DependencyGraphSnapshot struct { Version int `json:"version"` Sha *string `json:"sha,omitempty"` @@ -72,12 +82,13 @@ type DependencyGraphSnapshot struct { Job *DependencyGraphSnapshotJob `json:"job,omitempty"` Detector *DependencyGraphSnapshotDetector `json:"detector,omitempty"` Scanned *Timestamp `json:"scanned,omitempty"` + Metadata map[string]any `json:"metadata,omitempty"` Manifests map[string]*DependencyGraphSnapshotManifest `json:"manifests,omitempty"` } // DependencyGraphSnapshotCreationData represents the dependency snapshot's creation result. // -// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository +// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission?apiVersion=2022-11-28#create-a-snapshot-of-dependencies-for-a-repository type DependencyGraphSnapshotCreationData struct { ID int64 `json:"id"` CreatedAt *Timestamp `json:"created_at,omitempty"` @@ -92,19 +103,19 @@ type DependencyGraphSnapshotCreationData struct { // CreateSnapshot creates a new snapshot of a repository's dependencies. // -// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository +// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission?apiVersion=2022-11-28#create-a-snapshot-of-dependencies-for-a-repository // //meta:operation POST /repos/{owner}/{repo}/dependency-graph/snapshots func (s *DependencyGraphService) CreateSnapshot(ctx context.Context, owner, repo string, dependencyGraphSnapshot *DependencyGraphSnapshot) (*DependencyGraphSnapshotCreationData, *Response, error) { url := fmt.Sprintf("repos/%v/%v/dependency-graph/snapshots", owner, repo) - req, err := s.client.NewRequest("POST", url, dependencyGraphSnapshot) + req, err := s.client.NewRequest(ctx, "POST", url, dependencyGraphSnapshot) if err != nil { return nil, nil, err } var snapshotCreationData *DependencyGraphSnapshotCreationData - resp, err := s.client.Do(ctx, req, &snapshotCreationData) + resp, err := s.client.Do(req, &snapshotCreationData) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/doc.go b/vendor/github.com/google/go-github/v88/github/doc.go similarity index 80% rename from vendor/github.com/google/go-github/v73/github/doc.go rename to vendor/github.com/google/go-github/v88/github/doc.go index f85faed83..783917d80 100644 --- a/vendor/github.com/google/go-github/v73/github/doc.go +++ b/vendor/github.com/google/go-github/v88/github/doc.go @@ -8,20 +8,25 @@ Package github provides a client for using the GitHub API. Usage: - import "github.com/google/go-github/v73/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) - import "github.com/google/go-github/github" // with go modules disabled + import "github.com/google/go-github/v88/github" -Construct a new GitHub client, then use the various services on the client to +Construct a new GitHub client using [NewClient], then use the various services on the client to access different parts of the GitHub API. For example: - client := github.NewClient(nil) + client, err := github.NewClient() + if err != nil { + // Handle error. + } // list all organizations for user "willnorris" orgs, _, err := client.Organizations.List(ctx, "willnorris", nil) Some API methods have optional parameters that can be passed. For example: - client := github.NewClient(nil) + client, err := github.NewClient() + if err != nil { + // Handle error. + } // list public repositories for org "github" opt := &github.RepositoryListByOrgOptions{Type: "public"} @@ -29,10 +34,10 @@ Some API methods have optional parameters that can be passed. For example: The services of a client divide the API into logical chunks and correspond to the structure of the GitHub API documentation at -https://docs.github.com/rest . +https://docs.github.com/rest?apiVersion=2022-11-28. NOTE: Using the [context] package, one can easily -pass cancelation signals and deadlines to various services of the client for +pass cancellation signals and deadlines to various services of the client for handling a request. In case there is no context available, then [context.Background] can be used as a starting point. @@ -40,11 +45,14 @@ For more sample code snippets, head over to the https://github.com/google/go-git # Authentication -Use [Client.WithAuthToken] to configure your client to authenticate using an Oauth token +Use [WithAuthToken] to configure your client to authenticate using an OAuth token (for example, a personal access token). This is what is needed for a majority of use cases aside from GitHub Apps. - client := github.NewClient(nil).WithAuthToken("... your access token ...") + client, err := github.NewClient(github.WithAuthToken("... your access token ...")) + if err != nil { + // Handle error. + } Note that when using an authenticated [Client], all calls made by the client will include the specified OAuth token. Therefore, authenticated clients should @@ -56,7 +64,7 @@ For API methods that require HTTP Basic Authentication, use the GitHub Apps authentication can be provided by the https://github.com/bradleyfalzon/ghinstallation package. It supports both authentication as an installation, using an installation access token, -and as an app, using a JWT. +and as an app, using a JWT. Use the [WithTransport] option to configure your client to use the appropriate transport. To authenticate as an installation: @@ -70,7 +78,10 @@ To authenticate as an installation: } // Use installation transport with client - client := github.NewClient(&http.Client{Transport: itr}) + client, err := github.NewClient(github.WithTransport(itr)) + if err != nil { + // Handle error. + } // Use client... } @@ -87,7 +98,10 @@ To authenticate as an app, using a JWT: } // Use app transport with client - client := github.NewClient(&http.Client{Transport: atr}) + client, err := github.NewClient(github.WithTransport(atr)) + if err != nil { + // Handle error. + } // Use client... } @@ -111,15 +125,15 @@ To detect an API rate limit error, you can check if its type is *[RateLimitError For secondary rate limits, you can check if its type is *[AbuseRateLimitError]: repos, _, err := client.Repositories.List(ctx, "", nil) - if _, ok := err.(*github.RateLimitError); ok { + if errors.As(err, new(*github.RateLimitError)) { log.Println("hit rate limit") } - if _, ok := err.(*github.AbuseRateLimitError); ok { + if errors.As(err, new(*github.AbuseRateLimitError)) { log.Println("hit secondary rate limit") } Learn more about GitHub rate limiting at -https://docs.github.com/rest/rate-limit . +https://docs.github.com/rest/rate-limit?apiVersion=2022-11-28. # Accepted Status @@ -132,7 +146,7 @@ To detect this condition of error, you can check if its type is *[AcceptedError]: stats, _, err := client.Repositories.ListContributorsStats(ctx, org, repo) - if _, ok := err.(*github.AcceptedError); ok { + if errors.As(err, new(*github.AcceptedError)) { log.Println("scheduled on GitHub side") } @@ -144,14 +158,14 @@ rate limit, as well as help speed up your application. go-github does not handle conditional requests directly, but is instead designed to work with a caching [http.Transport]. -Typically, an RFC 7234 compliant HTTP cache such as https://github.com/gregjones/httpcache +Typically, an RFC 9111 compliant HTTP cache such as https://github.com/bartventer/httpcache is recommended. Alternatively, the https://github.com/bored-engineer/github-conditional-http-transport package relies on (undocumented) GitHub specific cache logic and is recommended when making requests using short-lived credentials such as a GitHub App installation token. Learn more about GitHub conditional requests at -https://docs.github.com/rest/overview/resources-in-the-rest-api#conditional-requests. +https://docs.github.com/rest/using-the-rest-api/best-practices-for-using-the-rest-api?apiVersion=2022-11-28#use-conditional-requests-if-appropriate. # Creating and Updating Resources @@ -178,7 +192,10 @@ embedded type of a more specific list options struct (for example [PullRequestListOptions]). Pages information is available via the [Response] struct. - client := github.NewClient(nil) + client, err := github.NewClient() + if err != nil { + // Handle error. + } opt := &github.RepositoryListByOrgOptions{ ListOptions: github.ListOptions{PerPage: 10}, diff --git a/vendor/github.com/google/go-github/v73/github/emojis.go b/vendor/github.com/google/go-github/v88/github/emojis.go similarity index 81% rename from vendor/github.com/google/go-github/v73/github/emojis.go rename to vendor/github.com/google/go-github/v88/github/emojis.go index b7a03dd98..0bf9ed143 100644 --- a/vendor/github.com/google/go-github/v73/github/emojis.go +++ b/vendor/github.com/google/go-github/v88/github/emojis.go @@ -14,17 +14,17 @@ type EmojisService service // List returns the emojis available to use on GitHub. // -// GitHub API docs: https://docs.github.com/rest/emojis/emojis#get-emojis +// GitHub API docs: https://docs.github.com/rest/emojis/emojis?apiVersion=2022-11-28#get-emojis // //meta:operation GET /emojis func (s *EmojisService) List(ctx context.Context) (map[string]string, *Response, error) { - req, err := s.client.NewRequest("GET", "emojis", nil) + req, err := s.client.NewRequest(ctx, "GET", "emojis", nil) if err != nil { return nil, nil, err } var emoji map[string]string - resp, err := s.client.Do(ctx, req, &emoji) + resp, err := s.client.Do(req, &emoji) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/enterprise.go b/vendor/github.com/google/go-github/v88/github/enterprise.go similarity index 94% rename from vendor/github.com/google/go-github/v73/github/enterprise.go rename to vendor/github.com/google/go-github/v88/github/enterprise.go index 2036f8bc7..f808a2926 100644 --- a/vendor/github.com/google/go-github/v73/github/enterprise.go +++ b/vendor/github.com/google/go-github/v88/github/enterprise.go @@ -8,5 +8,5 @@ package github // EnterpriseService provides access to the enterprise related functions // in the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/enterprise-admin/ +// GitHub API docs: https://docs.github.com/rest/enterprise-admin?apiVersion=2022-11-28 type EnterpriseService service diff --git a/vendor/github.com/google/go-github/v88/github/enterprise_actions_hosted_runners.go b/vendor/github.com/google/go-github/v88/github/enterprise_actions_hosted_runners.go new file mode 100644 index 000000000..08b470b31 --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/enterprise_actions_hosted_runners.go @@ -0,0 +1,344 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// ListHostedRunners lists all the GitHub-hosted runners for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#list-github-hosted-runners-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners +func (s *EnterpriseService) ListHostedRunners(ctx context.Context, enterprise string, opts *ListOptions) (*HostedRunners, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var runners *HostedRunners + resp, err := s.client.Do(req, &runners) + if err != nil { + return nil, resp, err + } + + return runners, resp, nil +} + +// CreateHostedRunner creates a GitHub-hosted runner for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#create-a-github-hosted-runner-for-an-enterprise +// +//meta:operation POST /enterprises/{enterprise}/actions/hosted-runners +func (s *EnterpriseService) CreateHostedRunner(ctx context.Context, enterprise string, request CreateHostedRunnerRequest) (*HostedRunner, *Response, error) { + if err := validateCreateHostedRunnerRequest(&request); err != nil { + return nil, nil, fmt.Errorf("validation failed: %w", err) + } + + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners", enterprise) + req, err := s.client.NewRequest(ctx, "POST", u, request) + if err != nil { + return nil, nil, err + } + + var hostedRunner *HostedRunner + resp, err := s.client.Do(req, &hostedRunner) + if err != nil { + return nil, resp, err + } + + return hostedRunner, resp, nil +} + +// GetHostedRunnerGitHubOwnedImages gets the list of GitHub-owned images available for GitHub-hosted runners for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#get-github-owned-images-for-github-hosted-runners-in-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/images/github-owned +func (s *EnterpriseService) GetHostedRunnerGitHubOwnedImages(ctx context.Context, enterprise string) (*HostedRunnerImages, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/images/github-owned", enterprise) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var hostedRunnerImages *HostedRunnerImages + resp, err := s.client.Do(req, &hostedRunnerImages) + if err != nil { + return nil, resp, err + } + + return hostedRunnerImages, resp, nil +} + +// GetHostedRunnerPartnerImages gets the list of partner images available for GitHub-hosted runners for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#get-partner-images-for-github-hosted-runners-in-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/images/partner +func (s *EnterpriseService) GetHostedRunnerPartnerImages(ctx context.Context, enterprise string) (*HostedRunnerImages, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/images/partner", enterprise) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var hostedRunnerImages *HostedRunnerImages + resp, err := s.client.Do(req, &hostedRunnerImages) + if err != nil { + return nil, resp, err + } + + return hostedRunnerImages, resp, nil +} + +// GetHostedRunnerLimits gets the GitHub-hosted runners Static public IP Limits for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#get-limits-on-github-hosted-runners-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/limits +func (s *EnterpriseService) GetHostedRunnerLimits(ctx context.Context, enterprise string) (*HostedRunnerPublicIPLimits, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/limits", enterprise) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var publicIPLimits *HostedRunnerPublicIPLimits + resp, err := s.client.Do(req, &publicIPLimits) + if err != nil { + return nil, resp, err + } + + return publicIPLimits, resp, nil +} + +// GetHostedRunnerMachineSpecs gets the list of machine specs available for GitHub-hosted runners for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#get-github-hosted-runners-machine-specs-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/machine-sizes +func (s *EnterpriseService) GetHostedRunnerMachineSpecs(ctx context.Context, enterprise string) (*HostedRunnerMachineSpecs, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/machine-sizes", enterprise) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var machineSpecs *HostedRunnerMachineSpecs + resp, err := s.client.Do(req, &machineSpecs) + if err != nil { + return nil, resp, err + } + + return machineSpecs, resp, nil +} + +// GetHostedRunnerPlatforms gets list of platforms available for GitHub-hosted runners for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#get-platforms-for-github-hosted-runners-in-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/platforms +func (s *EnterpriseService) GetHostedRunnerPlatforms(ctx context.Context, enterprise string) (*HostedRunnerPlatforms, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/platforms", enterprise) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var platforms *HostedRunnerPlatforms + resp, err := s.client.Do(req, &platforms) + if err != nil { + return nil, resp, err + } + + return platforms, resp, nil +} + +// GetHostedRunner gets a GitHub-hosted runner in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#get-a-github-hosted-runner-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/{hosted_runner_id} +func (s *EnterpriseService) GetHostedRunner(ctx context.Context, enterprise string, runnerID int64) (*HostedRunner, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/%v", enterprise, runnerID) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var hostedRunner *HostedRunner + resp, err := s.client.Do(req, &hostedRunner) + if err != nil { + return nil, resp, err + } + + return hostedRunner, resp, nil +} + +// UpdateHostedRunner updates a GitHub-hosted runner for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#update-a-github-hosted-runner-for-an-enterprise +// +//meta:operation PATCH /enterprises/{enterprise}/actions/hosted-runners/{hosted_runner_id} +func (s *EnterpriseService) UpdateHostedRunner(ctx context.Context, enterprise string, runnerID int64, request UpdateHostedRunnerRequest) (*HostedRunner, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/%v", enterprise, runnerID) + req, err := s.client.NewRequest(ctx, "PATCH", u, request) + if err != nil { + return nil, nil, err + } + + var hostedRunner *HostedRunner + resp, err := s.client.Do(req, &hostedRunner) + if err != nil { + return nil, resp, err + } + + return hostedRunner, resp, nil +} + +// DeleteHostedRunner deletes GitHub-hosted runner from an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#delete-a-github-hosted-runner-for-an-enterprise +// +//meta:operation DELETE /enterprises/{enterprise}/actions/hosted-runners/{hosted_runner_id} +func (s *EnterpriseService) DeleteHostedRunner(ctx context.Context, enterprise string, runnerID int64) (*HostedRunner, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/%v", enterprise, runnerID) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, nil, err + } + + var hostedRunner *HostedRunner + resp, err := s.client.Do(req, &hostedRunner) + if err != nil { + return nil, resp, err + } + + return hostedRunner, resp, nil +} + +// ListHostedRunnerCustomImages lists custom images for GitHub-hosted runners in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#list-custom-images-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/images/custom +func (s *EnterpriseService) ListHostedRunnerCustomImages(ctx context.Context, enterprise string) (*HostedRunnerCustomImages, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/images/custom", enterprise) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var images *HostedRunnerCustomImages + resp, err := s.client.Do(req, &images) + if err != nil { + return nil, resp, err + } + + return images, resp, nil +} + +// GetHostedRunnerCustomImage gets a custom image definition for GitHub-hosted runners in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#get-an-enterprise-custom-image-definition-for-github-actions-hosted-runners +// +//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/images/custom/{image_definition_id} +func (s *EnterpriseService) GetHostedRunnerCustomImage(ctx context.Context, enterprise string, imageDefinitionID int64) (*HostedRunnerCustomImage, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/images/custom/%v", enterprise, imageDefinitionID) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var image *HostedRunnerCustomImage + resp, err := s.client.Do(req, &image) + if err != nil { + return nil, resp, err + } + + return image, resp, nil +} + +// DeleteHostedRunnerCustomImage deletes a custom image from the enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#delete-a-custom-image-from-the-enterprise +// +//meta:operation DELETE /enterprises/{enterprise}/actions/hosted-runners/images/custom/{image_definition_id} +func (s *EnterpriseService) DeleteHostedRunnerCustomImage(ctx context.Context, enterprise string, imageDefinitionID int64) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/images/custom/%v", enterprise, imageDefinitionID) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// ListHostedRunnerCustomImageVersions lists image versions of a custom image for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#list-image-versions-of-a-custom-image-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/images/custom/{image_definition_id}/versions +func (s *EnterpriseService) ListHostedRunnerCustomImageVersions(ctx context.Context, enterprise string, imageDefinitionID int64) (*HostedRunnerCustomImageVersions, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/images/custom/%v/versions", enterprise, imageDefinitionID) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var versions *HostedRunnerCustomImageVersions + resp, err := s.client.Do(req, &versions) + if err != nil { + return nil, resp, err + } + + return versions, resp, nil +} + +// GetHostedRunnerCustomImageVersion gets an image version of a custom image for GitHub-hosted runners in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#get-an-image-version-of-an-enterprise-custom-image-for-github-actions-hosted-runners +// +//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/images/custom/{image_definition_id}/versions/{version} +func (s *EnterpriseService) GetHostedRunnerCustomImageVersion(ctx context.Context, enterprise string, imageDefinitionID int64, version string) (*HostedRunnerCustomImageVersion, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/images/custom/%v/versions/%v", enterprise, imageDefinitionID, version) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var imageVersion *HostedRunnerCustomImageVersion + resp, err := s.client.Do(req, &imageVersion) + if err != nil { + return nil, resp, err + } + + return imageVersion, resp, nil +} + +// DeleteHostedRunnerCustomImageVersion deletes an image version of a custom image from the enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#delete-an-image-version-of-custom-image-from-the-enterprise +// +//meta:operation DELETE /enterprises/{enterprise}/actions/hosted-runners/images/custom/{image_definition_id}/versions/{version} +func (s *EnterpriseService) DeleteHostedRunnerCustomImageVersion(ctx context.Context, enterprise string, imageDefinitionID int64, version string) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/images/custom/%v/versions/%v", enterprise, imageDefinitionID, version) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v73/github/enterprise_actions_runner_groups.go b/vendor/github.com/google/go-github/v88/github/enterprise_actions_runner_groups.go similarity index 78% rename from vendor/github.com/google/go-github/v73/github/enterprise_actions_runner_groups.go rename to vendor/github.com/google/go-github/v88/github/enterprise_actions_runner_groups.go index f171df757..b99481405 100644 --- a/vendor/github.com/google/go-github/v73/github/enterprise_actions_runner_groups.go +++ b/vendor/github.com/google/go-github/v88/github/enterprise_actions_runner_groups.go @@ -24,6 +24,8 @@ type EnterpriseRunnerGroup struct { Default *bool `json:"default,omitempty"` SelectedOrganizationsURL *string `json:"selected_organizations_url,omitempty"` RunnersURL *string `json:"runners_url,omitempty"` + HostedRunnersURL *string `json:"hosted_runners_url,omitempty"` + NetworkConfigurationID *string `json:"network_configuration_id,omitempty"` Inherited *bool `json:"inherited,omitempty"` AllowsPublicRepositories *bool `json:"allows_public_repositories,omitempty"` RestrictedToWorkflows *bool `json:"restricted_to_workflows,omitempty"` @@ -51,6 +53,8 @@ type CreateEnterpriseRunnerGroupRequest struct { RestrictedToWorkflows *bool `json:"restricted_to_workflows,omitempty"` // List of workflows the runner group should be allowed to run. This setting will be ignored unless RestrictedToWorkflows is set to true. SelectedWorkflows []string `json:"selected_workflows,omitempty"` + // The identifier of a hosted compute network configuration. + NetworkConfigurationID *string `json:"network_configuration_id,omitempty"` } // UpdateEnterpriseRunnerGroupRequest represents a request to update a Runner group for an enterprise. @@ -60,6 +64,7 @@ type UpdateEnterpriseRunnerGroupRequest struct { AllowsPublicRepositories *bool `json:"allows_public_repositories,omitempty"` RestrictedToWorkflows *bool `json:"restricted_to_workflows,omitempty"` SelectedWorkflows []string `json:"selected_workflows,omitempty"` + NetworkConfigurationID *string `json:"network_configuration_id,omitempty"` } // SetOrgAccessRunnerGroupRequest represents a request to replace the list of organizations @@ -79,7 +84,7 @@ type ListEnterpriseRunnerGroupOptions struct { // ListRunnerGroups lists all self-hosted runner groups configured in an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#list-self-hosted-runner-groups-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-self-hosted-runner-groups-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/actions/runner-groups func (s *EnterpriseService) ListRunnerGroups(ctx context.Context, enterprise string, opts *ListEnterpriseRunnerGroupOptions) (*EnterpriseRunnerGroups, *Response, error) { @@ -89,13 +94,13 @@ func (s *EnterpriseService) ListRunnerGroups(ctx context.Context, enterprise str return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - groups := &EnterpriseRunnerGroups{} - resp, err := s.client.Do(ctx, req, &groups) + var groups *EnterpriseRunnerGroups + resp, err := s.client.Do(req, &groups) if err != nil { return nil, resp, err } @@ -105,18 +110,18 @@ func (s *EnterpriseService) ListRunnerGroups(ctx context.Context, enterprise str // GetEnterpriseRunnerGroup gets a specific self-hosted runner group for an enterprise using its RunnerGroup ID. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#get-a-self-hosted-runner-group-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#get-a-self-hosted-runner-group-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id} func (s *EnterpriseService) GetEnterpriseRunnerGroup(ctx context.Context, enterprise string, groupID int64) (*EnterpriseRunnerGroup, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v", enterprise, groupID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runnerGroup := new(EnterpriseRunnerGroup) - resp, err := s.client.Do(ctx, req, runnerGroup) + var runnerGroup *EnterpriseRunnerGroup + resp, err := s.client.Do(req, &runnerGroup) if err != nil { return nil, resp, err } @@ -126,34 +131,34 @@ func (s *EnterpriseService) GetEnterpriseRunnerGroup(ctx context.Context, enterp // DeleteEnterpriseRunnerGroup deletes a self-hosted runner group from an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#delete-a-self-hosted-runner-group-from-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#delete-a-self-hosted-runner-group-from-an-enterprise // //meta:operation DELETE /enterprises/{enterprise}/actions/runner-groups/{runner_group_id} func (s *EnterpriseService) DeleteEnterpriseRunnerGroup(ctx context.Context, enterprise string, groupID int64) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v", enterprise, groupID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // CreateEnterpriseRunnerGroup creates a new self-hosted runner group for an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#create-a-self-hosted-runner-group-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#create-a-self-hosted-runner-group-for-an-enterprise // //meta:operation POST /enterprises/{enterprise}/actions/runner-groups func (s *EnterpriseService) CreateEnterpriseRunnerGroup(ctx context.Context, enterprise string, createReq CreateEnterpriseRunnerGroupRequest) (*EnterpriseRunnerGroup, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups", enterprise) - req, err := s.client.NewRequest("POST", u, createReq) + req, err := s.client.NewRequest(ctx, "POST", u, createReq) if err != nil { return nil, nil, err } - runnerGroup := new(EnterpriseRunnerGroup) - resp, err := s.client.Do(ctx, req, runnerGroup) + var runnerGroup *EnterpriseRunnerGroup + resp, err := s.client.Do(req, &runnerGroup) if err != nil { return nil, resp, err } @@ -163,18 +168,18 @@ func (s *EnterpriseService) CreateEnterpriseRunnerGroup(ctx context.Context, ent // UpdateEnterpriseRunnerGroup updates a self-hosted runner group for an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#update-a-self-hosted-runner-group-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#update-a-self-hosted-runner-group-for-an-enterprise // //meta:operation PATCH /enterprises/{enterprise}/actions/runner-groups/{runner_group_id} func (s *EnterpriseService) UpdateEnterpriseRunnerGroup(ctx context.Context, enterprise string, groupID int64, updateReq UpdateEnterpriseRunnerGroupRequest) (*EnterpriseRunnerGroup, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v", enterprise, groupID) - req, err := s.client.NewRequest("PATCH", u, updateReq) + req, err := s.client.NewRequest(ctx, "PATCH", u, updateReq) if err != nil { return nil, nil, err } - runnerGroup := new(EnterpriseRunnerGroup) - resp, err := s.client.Do(ctx, req, runnerGroup) + var runnerGroup *EnterpriseRunnerGroup + resp, err := s.client.Do(req, &runnerGroup) if err != nil { return nil, resp, err } @@ -184,7 +189,7 @@ func (s *EnterpriseService) UpdateEnterpriseRunnerGroup(ctx context.Context, ent // ListOrganizationAccessRunnerGroup lists the organizations with access to a self-hosted runner group configured in an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#list-organization-access-to-a-self-hosted-runner-group-in-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-organization-access-to-a-self-hosted-runner-group-in-an-enterprise // //meta:operation GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations func (s *EnterpriseService) ListOrganizationAccessRunnerGroup(ctx context.Context, enterprise string, groupID int64, opts *ListOptions) (*ListOrganizations, *Response, error) { @@ -194,13 +199,13 @@ func (s *EnterpriseService) ListOrganizationAccessRunnerGroup(ctx context.Contex return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - orgs := &ListOrganizations{} - resp, err := s.client.Do(ctx, req, &orgs) + var orgs *ListOrganizations + resp, err := s.client.Do(req, &orgs) if err != nil { return nil, resp, err } @@ -211,57 +216,57 @@ func (s *EnterpriseService) ListOrganizationAccessRunnerGroup(ctx context.Contex // SetOrganizationAccessRunnerGroup replaces the list of organizations that have access to a self-hosted runner group configured in an enterprise // with a new List of organizations. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#set-organization-access-for-a-self-hosted-runner-group-in-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#set-organization-access-for-a-self-hosted-runner-group-in-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations func (s *EnterpriseService) SetOrganizationAccessRunnerGroup(ctx context.Context, enterprise string, groupID int64, ids SetOrgAccessRunnerGroupRequest) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/organizations", enterprise, groupID) - req, err := s.client.NewRequest("PUT", u, ids) + req, err := s.client.NewRequest(ctx, "PUT", u, ids) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // AddOrganizationAccessRunnerGroup adds an organization to the list of selected organizations that can access a self-hosted runner group. // The runner group must have visibility set to 'selected'. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#add-organization-access-to-a-self-hosted-runner-group-in-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#add-organization-access-to-a-self-hosted-runner-group-in-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations/{org_id} func (s *EnterpriseService) AddOrganizationAccessRunnerGroup(ctx context.Context, enterprise string, groupID, orgID int64) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/organizations/%v", enterprise, groupID, orgID) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RemoveOrganizationAccessRunnerGroup removes an organization from the list of selected organizations that can access a self-hosted runner group. // The runner group must have visibility set to 'selected'. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#remove-organization-access-to-a-self-hosted-runner-group-in-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#remove-organization-access-to-a-self-hosted-runner-group-in-an-enterprise // //meta:operation DELETE /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations/{org_id} func (s *EnterpriseService) RemoveOrganizationAccessRunnerGroup(ctx context.Context, enterprise string, groupID, orgID int64) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/organizations/%v", enterprise, groupID, orgID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListRunnerGroupRunners lists self-hosted runners that are in a specific enterprise group. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#list-self-hosted-runners-in-a-group-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-self-hosted-runners-in-a-group-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners func (s *EnterpriseService) ListRunnerGroupRunners(ctx context.Context, enterprise string, groupID int64, opts *ListOptions) (*Runners, *Response, error) { @@ -271,13 +276,13 @@ func (s *EnterpriseService) ListRunnerGroupRunners(ctx context.Context, enterpri return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runners := &Runners{} - resp, err := s.client.Do(ctx, req, &runners) + var runners *Runners + resp, err := s.client.Do(req, &runners) if err != nil { return nil, resp, err } @@ -288,49 +293,49 @@ func (s *EnterpriseService) ListRunnerGroupRunners(ctx context.Context, enterpri // SetRunnerGroupRunners replaces the list of self-hosted runners that are part of an enterprise runner group // with a new list of runners. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#set-self-hosted-runners-in-a-group-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#set-self-hosted-runners-in-a-group-for-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners func (s *EnterpriseService) SetRunnerGroupRunners(ctx context.Context, enterprise string, groupID int64, ids SetRunnerGroupRunnersRequest) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/runners", enterprise, groupID) - req, err := s.client.NewRequest("PUT", u, ids) + req, err := s.client.NewRequest(ctx, "PUT", u, ids) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // AddRunnerGroupRunners adds a self-hosted runner to a runner group configured in an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#add-a-self-hosted-runner-to-a-group-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#add-a-self-hosted-runner-to-a-group-for-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id} func (s *EnterpriseService) AddRunnerGroupRunners(ctx context.Context, enterprise string, groupID, runnerID int64) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/runners/%v", enterprise, groupID, runnerID) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RemoveRunnerGroupRunners removes a self-hosted runner from a group configured in an enterprise. // The runner is then returned to the default group. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#remove-a-self-hosted-runner-from-a-group-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#remove-a-self-hosted-runner-from-a-group-for-an-enterprise // //meta:operation DELETE /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id} func (s *EnterpriseService) RemoveRunnerGroupRunners(ctx context.Context, enterprise string, groupID, runnerID int64) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/runners/%v", enterprise, groupID, runnerID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/enterprise_actions_runners.go b/vendor/github.com/google/go-github/v88/github/enterprise_actions_runners.go similarity index 72% rename from vendor/github.com/google/go-github/v73/github/enterprise_actions_runners.go rename to vendor/github.com/google/go-github/v88/github/enterprise_actions_runners.go index fa345aea8..c98ba62fa 100644 --- a/vendor/github.com/google/go-github/v73/github/enterprise_actions_runners.go +++ b/vendor/github.com/google/go-github/v88/github/enterprise_actions_runners.go @@ -12,18 +12,18 @@ import ( // ListRunnerApplicationDownloads lists self-hosted runner application binaries that can be downloaded and run. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners#list-runner-applications-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-runner-applications-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/actions/runners/downloads func (s *EnterpriseService) ListRunnerApplicationDownloads(ctx context.Context, enterprise string) ([]*RunnerApplicationDownload, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runners/downloads", enterprise) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var rads []*RunnerApplicationDownload - resp, err := s.client.Do(ctx, req, &rads) + resp, err := s.client.Do(req, &rads) if err != nil { return nil, resp, err } @@ -33,19 +33,19 @@ func (s *EnterpriseService) ListRunnerApplicationDownloads(ctx context.Context, // GenerateEnterpriseJITConfig generates a just-in-time configuration for an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-configuration-for-a-just-in-time-runner-for-an-enterprise // //meta:operation POST /enterprises/{enterprise}/actions/runners/generate-jitconfig func (s *EnterpriseService) GenerateEnterpriseJITConfig(ctx context.Context, enterprise string, request *GenerateJITConfigRequest) (*JITRunnerConfig, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runners/generate-jitconfig", enterprise) - req, err := s.client.NewRequest("POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, request) if err != nil { return nil, nil, err } - jitConfig := new(JITRunnerConfig) - resp, err := s.client.Do(ctx, req, jitConfig) + var jitConfig *JITRunnerConfig + resp, err := s.client.Do(req, &jitConfig) if err != nil { return nil, resp, err } @@ -55,19 +55,19 @@ func (s *EnterpriseService) GenerateEnterpriseJITConfig(ctx context.Context, ent // CreateRegistrationToken creates a token that can be used to add a self-hosted runner. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners#create-a-registration-token-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-registration-token-for-an-enterprise // //meta:operation POST /enterprises/{enterprise}/actions/runners/registration-token func (s *EnterpriseService) CreateRegistrationToken(ctx context.Context, enterprise string) (*RegistrationToken, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runners/registration-token", enterprise) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - registrationToken := new(RegistrationToken) - resp, err := s.client.Do(ctx, req, registrationToken) + var registrationToken *RegistrationToken + resp, err := s.client.Do(req, ®istrationToken) if err != nil { return nil, resp, err } @@ -75,9 +75,9 @@ func (s *EnterpriseService) CreateRegistrationToken(ctx context.Context, enterpr return registrationToken, resp, nil } -// ListRunners lists all the self-hosted runners for a enterprise. +// ListRunners lists all the self-hosted runners for an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-self-hosted-runners-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/actions/runners func (s *EnterpriseService) ListRunners(ctx context.Context, enterprise string, opts *ListRunnersOptions) (*Runners, *Response, error) { @@ -87,13 +87,13 @@ func (s *EnterpriseService) ListRunners(ctx context.Context, enterprise string, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runners := &Runners{} - resp, err := s.client.Do(ctx, req, &runners) + var runners *Runners + resp, err := s.client.Do(req, &runners) if err != nil { return nil, resp, err } @@ -103,18 +103,18 @@ func (s *EnterpriseService) ListRunners(ctx context.Context, enterprise string, // GetRunner gets a specific self-hosted runner configured in an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners?apiVersion=2022-11-28#get-a-self-hosted-runner-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/actions/runners/{runner_id} func (s *EnterpriseService) GetRunner(ctx context.Context, enterprise string, runnerID int64) (*Runner, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runners/%v", enterprise, runnerID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runner := new(Runner) - resp, err := s.client.Do(ctx, req, runner) + var runner *Runner + resp, err := s.client.Do(req, &runner) if err != nil { return nil, resp, err } @@ -124,16 +124,16 @@ func (s *EnterpriseService) GetRunner(ctx context.Context, enterprise string, ru // RemoveRunner forces the removal of a self-hosted runner from an enterprise using the runner id. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners?apiVersion=2022-11-28#delete-a-self-hosted-runner-from-an-enterprise // //meta:operation DELETE /enterprises/{enterprise}/actions/runners/{runner_id} func (s *EnterpriseService) RemoveRunner(ctx context.Context, enterprise string, runnerID int64) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runners/%v", enterprise, runnerID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v88/github/enterprise_app_installation.go b/vendor/github.com/google/go-github/v88/github/enterprise_app_installation.go new file mode 100644 index 000000000..495b6d839 --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/enterprise_app_installation.go @@ -0,0 +1,159 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// InstallableOrganization represents an organization in an enterprise in which a GitHub app can be installed. +type InstallableOrganization struct { + ID int64 `json:"id"` + Login string `json:"login"` + AccessibleRepositoriesURL *string `json:"accessible_repositories_url,omitempty"` +} + +// AccessibleRepository represents a repository that can be made accessible to a GitHub app. +type AccessibleRepository struct { + ID int64 `json:"id"` + Name string `json:"name"` + FullName string `json:"full_name"` +} + +// InstallAppRequest represents the request to install a GitHub app on an enterprise-owned organization. +type InstallAppRequest struct { + // The Client ID of the GitHub App to install. + ClientID string `json:"client_id"` + // The selection of repositories that the GitHub app can access. + // Can be one of: all, selected, none + RepositorySelection string `json:"repository_selection"` + // A list of repository names that the GitHub App can access, if the repository_selection is set to selected. + Repositories []string `json:"repositories,omitempty"` +} + +// ListAppInstallableOrganizations lists the organizations in an enterprise that are installable for an app. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/organization-installations?apiVersion=2022-11-28#get-enterprise-owned-organizations-that-can-have-github-apps-installed +// +//meta:operation GET /enterprises/{enterprise}/apps/installable_organizations +func (s *EnterpriseService) ListAppInstallableOrganizations(ctx context.Context, enterprise string, opts *ListOptions) ([]*InstallableOrganization, *Response, error) { + u := fmt.Sprintf("enterprises/%v/apps/installable_organizations", enterprise) + + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var orgs []*InstallableOrganization + resp, err := s.client.Do(req, &orgs) + if err != nil { + return nil, resp, err + } + + return orgs, resp, nil +} + +// ListAppAccessibleOrganizationRepositories lists the repositories accessible to an app in an enterprise-owned organization. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/organization-installations?apiVersion=2022-11-28#get-repositories-belonging-to-an-enterprise-owned-organization +// +//meta:operation GET /enterprises/{enterprise}/apps/installable_organizations/{org}/accessible_repositories +func (s *EnterpriseService) ListAppAccessibleOrganizationRepositories(ctx context.Context, enterprise, org string, opts *ListOptions) ([]*AccessibleRepository, *Response, error) { + u := fmt.Sprintf("enterprises/%v/apps/installable_organizations/%v/accessible_repositories", enterprise, org) + + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var repos []*AccessibleRepository + resp, err := s.client.Do(req, &repos) + if err != nil { + return nil, resp, err + } + + return repos, resp, nil +} + +// ListAppInstallations lists the GitHub app installations associated with the given enterprise-owned organization. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/organization-installations?apiVersion=2022-11-28#list-github-apps-installed-on-an-enterprise-owned-organization +// +//meta:operation GET /enterprises/{enterprise}/apps/organizations/{org}/installations +func (s *EnterpriseService) ListAppInstallations(ctx context.Context, enterprise, org string, opts *ListOptions) ([]*Installation, *Response, error) { + u := fmt.Sprintf("enterprises/%v/apps/organizations/%v/installations", enterprise, org) + + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var installation []*Installation + resp, err := s.client.Do(req, &installation) + if err != nil { + return nil, resp, err + } + + return installation, resp, nil +} + +// InstallApp installs any valid GitHub app on the specified organization owned by the enterprise. +// If the app is already installed on the organization, and is suspended, it will be unsuspended. If the app has a pending installation request, they will all be approved. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/organization-installations?apiVersion=2022-11-28#install-a-github-app-on-an-enterprise-owned-organization +// +//meta:operation POST /enterprises/{enterprise}/apps/organizations/{org}/installations +func (s *EnterpriseService) InstallApp(ctx context.Context, enterprise, org string, request InstallAppRequest) (*Installation, *Response, error) { + u := fmt.Sprintf("enterprises/%v/apps/organizations/%v/installations", enterprise, org) + req, err := s.client.NewRequest(ctx, "POST", u, request) + if err != nil { + return nil, nil, err + } + + var installation *Installation + resp, err := s.client.Do(req, &installation) + if err != nil { + return nil, resp, err + } + + return installation, resp, nil +} + +// UninstallApp uninstalls a GitHub app from an organization. Any app installed on the organization can be removed. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/organization-installations?apiVersion=2022-11-28#uninstall-a-github-app-from-an-enterprise-owned-organization +// +//meta:operation DELETE /enterprises/{enterprise}/apps/organizations/{org}/installations/{installation_id} +func (s *EnterpriseService) UninstallApp(ctx context.Context, enterprise, org string, installationID int64) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/apps/organizations/%v/installations/%v", enterprise, org, installationID) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/vendor/github.com/google/go-github/v88/github/enterprise_apps.go b/vendor/github.com/google/go-github/v88/github/enterprise_apps.go new file mode 100644 index 000000000..bd1e65734 --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/enterprise_apps.go @@ -0,0 +1,116 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// AppInstallationRepositoriesOptions specifies the parameters for +// EnterpriseService.AddRepositoriesToAppInstallation and +// EnterpriseService.RemoveRepositoriesFromAppInstallation. +type AppInstallationRepositoriesOptions struct { + SelectedRepositoryIDs []int64 `json:"selected_repository_ids"` +} + +// UpdateAppInstallationRepositoriesOptions specifies the parameters for +// EnterpriseService.UpdateAppInstallationRepositories. +type UpdateAppInstallationRepositoriesOptions struct { + RepositorySelection *string `json:"repository_selection,omitempty"` // Can be "all" or "selected" + SelectedRepositoryIDs []int64 `json:"selected_repository_ids,omitempty"` +} + +// ListRepositoriesForOrgAppInstallation lists the repositories that an enterprise app installation +// has access to on an organization. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/organization-installations?apiVersion=2022-11-28#get-the-repositories-accessible-to-a-given-github-app-installation +// +//meta:operation GET /enterprises/{enterprise}/apps/organizations/{org}/installations/{installation_id}/repositories +func (s *EnterpriseService) ListRepositoriesForOrgAppInstallation(ctx context.Context, enterprise, org string, installationID int64, opts *ListOptions) ([]*AccessibleRepository, *Response, error) { + u := fmt.Sprintf("enterprises/%v/apps/organizations/%v/installations/%v/repositories", enterprise, org, installationID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var r []*AccessibleRepository + resp, err := s.client.Do(req, &r) + if err != nil { + return nil, resp, err + } + + return r, resp, nil +} + +// UpdateAppInstallationRepositories changes a GitHub App installation's repository access +// between all repositories and a selected set. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/organization-installations?apiVersion=2022-11-28#toggle-installation-repository-access-between-selected-and-all-repositories +// +//meta:operation PATCH /enterprises/{enterprise}/apps/organizations/{org}/installations/{installation_id}/repositories +func (s *EnterpriseService) UpdateAppInstallationRepositories(ctx context.Context, enterprise, org string, installationID int64, opts UpdateAppInstallationRepositoriesOptions) (*Installation, *Response, error) { + u := fmt.Sprintf("enterprises/%v/apps/organizations/%v/installations/%v/repositories", enterprise, org, installationID) + req, err := s.client.NewRequest(ctx, "PATCH", u, opts) + if err != nil { + return nil, nil, err + } + + var r *Installation + resp, err := s.client.Do(req, &r) + if err != nil { + return nil, resp, err + } + + return r, resp, nil +} + +// AddRepositoriesToAppInstallation grants repository access for a GitHub App installation. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/organization-installations?apiVersion=2022-11-28#grant-repository-access-to-an-organization-installation +// +//meta:operation PATCH /enterprises/{enterprise}/apps/organizations/{org}/installations/{installation_id}/repositories/add +func (s *EnterpriseService) AddRepositoriesToAppInstallation(ctx context.Context, enterprise, org string, installationID int64, opts AppInstallationRepositoriesOptions) ([]*AccessibleRepository, *Response, error) { + u := fmt.Sprintf("enterprises/%v/apps/organizations/%v/installations/%v/repositories/add", enterprise, org, installationID) + req, err := s.client.NewRequest(ctx, "PATCH", u, opts) + if err != nil { + return nil, nil, err + } + + var r []*AccessibleRepository + resp, err := s.client.Do(req, &r) + if err != nil { + return nil, resp, err + } + + return r, resp, nil +} + +// RemoveRepositoriesFromAppInstallation revokes repository access from a GitHub App installation. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/organization-installations?apiVersion=2022-11-28#remove-repository-access-from-an-organization-installation +// +//meta:operation PATCH /enterprises/{enterprise}/apps/organizations/{org}/installations/{installation_id}/repositories/remove +func (s *EnterpriseService) RemoveRepositoriesFromAppInstallation(ctx context.Context, enterprise, org string, installationID int64, opts AppInstallationRepositoriesOptions) ([]*AccessibleRepository, *Response, error) { + u := fmt.Sprintf("enterprises/%v/apps/organizations/%v/installations/%v/repositories/remove", enterprise, org, installationID) + req, err := s.client.NewRequest(ctx, "PATCH", u, opts) + if err != nil { + return nil, nil, err + } + + var r []*AccessibleRepository + resp, err := s.client.Do(req, &r) + if err != nil { + return nil, resp, err + } + + return r, resp, nil +} diff --git a/vendor/github.com/google/go-github/v73/github/enterprise_audit_log.go b/vendor/github.com/google/go-github/v88/github/enterprise_audit_log.go similarity index 81% rename from vendor/github.com/google/go-github/v73/github/enterprise_audit_log.go rename to vendor/github.com/google/go-github/v88/github/enterprise_audit_log.go index 058a7d177..afac46235 100644 --- a/vendor/github.com/google/go-github/v73/github/enterprise_audit_log.go +++ b/vendor/github.com/google/go-github/v88/github/enterprise_audit_log.go @@ -12,7 +12,7 @@ import ( // GetAuditLog gets the audit-log entries for an organization. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/audit-log#get-the-audit-log-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/audit-log?apiVersion=2022-11-28#get-the-audit-log-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/audit-log func (s *EnterpriseService) GetAuditLog(ctx context.Context, enterprise string, opts *GetAuditLogOptions) ([]*AuditEntry, *Response, error) { @@ -22,13 +22,13 @@ func (s *EnterpriseService) GetAuditLog(ctx context.Context, enterprise string, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var auditEntries []*AuditEntry - resp, err := s.client.Do(ctx, req, &auditEntries) + resp, err := s.client.Do(req, &auditEntries) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v88/github/enterprise_audit_log_stream.go b/vendor/github.com/google/go-github/v88/github/enterprise_audit_log_stream.go new file mode 100644 index 000000000..012d29754 --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/enterprise_audit_log_stream.go @@ -0,0 +1,287 @@ +// Copyright 2026 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// AuditLogStream represents an audit log stream configuration for an enterprise. +type AuditLogStream struct { + ID int64 `json:"id"` + StreamType string `json:"stream_type"` + StreamDetails string `json:"stream_details"` + Enabled bool `json:"enabled"` + CreatedAt Timestamp `json:"created_at"` + UpdatedAt Timestamp `json:"updated_at"` + PausedAt *Timestamp `json:"paused_at,omitempty"` +} + +// AuditLogStreamConfig represents a configuration for creating or updating an audit log stream. +type AuditLogStreamConfig struct { + Enabled bool `json:"enabled"` + StreamType string `json:"stream_type"` + VendorSpecific AuditLogStreamVendorConfig `json:"vendor_specific"` +} + +// AuditLogStreamVendorConfig is a sealed marker interface for vendor-specific audit log +// stream configurations. Only this package can define implementations. +type AuditLogStreamVendorConfig interface { + isAuditLogStreamVendorConfig() +} + +// AuditLogStreamKey represents the public key used to encrypt secrets for audit log streaming. +type AuditLogStreamKey struct { + KeyID string `json:"key_id"` + Key string `json:"key"` +} + +// AzureBlobConfig represents vendor-specific config for Azure Blob Storage. +type AzureBlobConfig struct { + KeyID string `json:"key_id"` + EncryptedSASURL string `json:"encrypted_sas_url"` + Container string `json:"container"` +} + +// AzureHubConfig represents vendor-specific config for Azure Event Hubs. +type AzureHubConfig struct { + Name string `json:"name"` + EncryptedConnstring string `json:"encrypted_connstring"` + KeyID string `json:"key_id"` +} + +// AmazonS3OIDCConfig represents vendor-specific config for Amazon S3 with OIDC authentication. +type AmazonS3OIDCConfig struct { + Bucket string `json:"bucket"` + Region string `json:"region"` + KeyID string `json:"key_id"` + AuthenticationType string `json:"authentication_type"` // Value: "oidc" + ArnRole string `json:"arn_role"` +} + +// AmazonS3AccessKeysConfig represents vendor-specific config for Amazon S3 with access key authentication. +type AmazonS3AccessKeysConfig struct { + Bucket string `json:"bucket"` + Region string `json:"region"` + KeyID string `json:"key_id"` + AuthenticationType string `json:"authentication_type"` // Value: "access_keys" + EncryptedSecretKey string `json:"encrypted_secret_key"` + EncryptedAccessKeyID string `json:"encrypted_access_key_id"` +} + +// SplunkConfig represents vendor-specific config for Splunk. +type SplunkConfig struct { + Domain string `json:"domain"` + Port uint16 `json:"port"` + KeyID string `json:"key_id"` + EncryptedToken string `json:"encrypted_token"` + SSLVerify bool `json:"ssl_verify"` +} + +// HecConfig represents vendor-specific config for an HTTPS Event Collector (HEC) endpoint. +type HecConfig struct { + Domain string `json:"domain"` + Port uint16 `json:"port"` + KeyID string `json:"key_id"` + EncryptedToken string `json:"encrypted_token"` + Path string `json:"path"` + SSLVerify bool `json:"ssl_verify"` +} + +// GoogleCloudConfig represents vendor-specific config for Google Cloud Storage. +type GoogleCloudConfig struct { + Bucket string `json:"bucket"` + KeyID string `json:"key_id"` + EncryptedJSONCredentials string `json:"encrypted_json_credentials"` +} + +// DatadogConfig represents vendor-specific config for Datadog. +type DatadogConfig struct { + EncryptedToken string `json:"encrypted_token"` + Site string `json:"site"` // One of: US, US3, US5, EU1, US1-FED, AP1 + KeyID string `json:"key_id"` +} + +// Implement the sealed marker interface for all vendor config types. +func (*AzureBlobConfig) isAuditLogStreamVendorConfig() {} +func (*AzureHubConfig) isAuditLogStreamVendorConfig() {} +func (*AmazonS3OIDCConfig) isAuditLogStreamVendorConfig() {} +func (*AmazonS3AccessKeysConfig) isAuditLogStreamVendorConfig() {} +func (*SplunkConfig) isAuditLogStreamVendorConfig() {} +func (*HecConfig) isAuditLogStreamVendorConfig() {} +func (*GoogleCloudConfig) isAuditLogStreamVendorConfig() {} +func (*DatadogConfig) isAuditLogStreamVendorConfig() {} + +// NewAzureBlobStreamConfig returns an AuditLogStreamConfig for Azure Blob Storage. +func NewAzureBlobStreamConfig(enabled bool, cfg *AzureBlobConfig) *AuditLogStreamConfig { + return &AuditLogStreamConfig{Enabled: enabled, StreamType: "Azure Blob Storage", VendorSpecific: cfg} +} + +// NewAzureHubStreamConfig returns an AuditLogStreamConfig for Azure Event Hubs. +func NewAzureHubStreamConfig(enabled bool, cfg *AzureHubConfig) *AuditLogStreamConfig { + return &AuditLogStreamConfig{Enabled: enabled, StreamType: "Azure Event Hubs", VendorSpecific: cfg} +} + +// NewAmazonS3OIDCStreamConfig returns an AuditLogStreamConfig for Amazon S3 with OIDC auth. +func NewAmazonS3OIDCStreamConfig(enabled bool, cfg *AmazonS3OIDCConfig) *AuditLogStreamConfig { + return &AuditLogStreamConfig{Enabled: enabled, StreamType: "Amazon S3", VendorSpecific: cfg} +} + +// NewAmazonS3AccessKeysStreamConfig returns an AuditLogStreamConfig for Amazon S3 with access key auth. +func NewAmazonS3AccessKeysStreamConfig(enabled bool, cfg *AmazonS3AccessKeysConfig) *AuditLogStreamConfig { + return &AuditLogStreamConfig{Enabled: enabled, StreamType: "Amazon S3", VendorSpecific: cfg} +} + +// NewSplunkStreamConfig returns an AuditLogStreamConfig for Splunk. +func NewSplunkStreamConfig(enabled bool, cfg *SplunkConfig) *AuditLogStreamConfig { + return &AuditLogStreamConfig{Enabled: enabled, StreamType: "Splunk", VendorSpecific: cfg} +} + +// NewHecStreamConfig returns an AuditLogStreamConfig for an HTTPS Event Collector endpoint. +func NewHecStreamConfig(enabled bool, cfg *HecConfig) *AuditLogStreamConfig { + return &AuditLogStreamConfig{Enabled: enabled, StreamType: "HTTPS Event Collector", VendorSpecific: cfg} +} + +// NewGoogleCloudStreamConfig returns an AuditLogStreamConfig for Google Cloud Storage. +func NewGoogleCloudStreamConfig(enabled bool, cfg *GoogleCloudConfig) *AuditLogStreamConfig { + return &AuditLogStreamConfig{Enabled: enabled, StreamType: "Google Cloud Storage", VendorSpecific: cfg} +} + +// NewDatadogStreamConfig returns an AuditLogStreamConfig for Datadog. +func NewDatadogStreamConfig(enabled bool, cfg *DatadogConfig) *AuditLogStreamConfig { + return &AuditLogStreamConfig{Enabled: enabled, StreamType: "Datadog", VendorSpecific: cfg} +} + +// GetAuditLogStreamKey retrieves the public key used to encrypt secrets for audit log streaming. +// Credentials must be encrypted with this key before being submitted via CreateAuditLogStream +// or UpdateAuditLogStream. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/audit-log?apiVersion=2022-11-28#get-the-audit-log-stream-key-for-encrypting-secrets +// +//meta:operation GET /enterprises/{enterprise}/audit-log/stream-key +func (s *EnterpriseService) GetAuditLogStreamKey(ctx context.Context, enterprise string) (*AuditLogStreamKey, *Response, error) { + u := fmt.Sprintf("enterprises/%v/audit-log/stream-key", enterprise) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var key *AuditLogStreamKey + resp, err := s.client.Do(req, &key) + if err != nil { + return nil, resp, err + } + + return key, resp, nil +} + +// ListAuditLogStreams lists the audit log stream configurations for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/audit-log?apiVersion=2022-11-28#list-audit-log-stream-configurations-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/audit-log/streams +func (s *EnterpriseService) ListAuditLogStreams(ctx context.Context, enterprise string) ([]*AuditLogStream, *Response, error) { + u := fmt.Sprintf("enterprises/%v/audit-log/streams", enterprise) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var streams []*AuditLogStream + resp, err := s.client.Do(req, &streams) + if err != nil { + return nil, resp, err + } + + return streams, resp, nil +} + +// GetAuditLogStream gets a single audit log stream configuration for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/audit-log?apiVersion=2022-11-28#list-one-audit-log-streaming-configuration-via-a-stream-id +// +//meta:operation GET /enterprises/{enterprise}/audit-log/streams/{stream_id} +func (s *EnterpriseService) GetAuditLogStream(ctx context.Context, enterprise string, streamID int64) (*AuditLogStream, *Response, error) { + u := fmt.Sprintf("enterprises/%v/audit-log/streams/%v", enterprise, streamID) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var stream *AuditLogStream + resp, err := s.client.Do(req, &stream) + if err != nil { + return nil, resp, err + } + + return stream, resp, nil +} + +// CreateAuditLogStream creates an audit log streaming configuration for an enterprise. +// Credentials in the config must be encrypted using the key returned by GetAuditLogStreamKey. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/audit-log?apiVersion=2022-11-28#create-an-audit-log-streaming-configuration-for-an-enterprise +// +//meta:operation POST /enterprises/{enterprise}/audit-log/streams +func (s *EnterpriseService) CreateAuditLogStream(ctx context.Context, enterprise string, config AuditLogStreamConfig) (*AuditLogStream, *Response, error) { + u := fmt.Sprintf("enterprises/%v/audit-log/streams", enterprise) + + req, err := s.client.NewRequest(ctx, "POST", u, config) + if err != nil { + return nil, nil, err + } + + var stream *AuditLogStream + resp, err := s.client.Do(req, &stream) + if err != nil { + return nil, resp, err + } + + return stream, resp, nil +} + +// UpdateAuditLogStream updates an existing audit log stream configuration for an enterprise. +// Credentials in the config must be encrypted using the key returned by GetAuditLogStreamKey. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/audit-log?apiVersion=2022-11-28#update-an-existing-audit-log-stream-configuration +// +//meta:operation PUT /enterprises/{enterprise}/audit-log/streams/{stream_id} +func (s *EnterpriseService) UpdateAuditLogStream(ctx context.Context, enterprise string, streamID int64, config AuditLogStreamConfig) (*AuditLogStream, *Response, error) { + u := fmt.Sprintf("enterprises/%v/audit-log/streams/%v", enterprise, streamID) + + req, err := s.client.NewRequest(ctx, "PUT", u, config) + if err != nil { + return nil, nil, err + } + + var stream *AuditLogStream + resp, err := s.client.Do(req, &stream) + if err != nil { + return nil, resp, err + } + + return stream, resp, nil +} + +// DeleteAuditLogStream deletes an audit log stream configuration for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/audit-log?apiVersion=2022-11-28#delete-an-audit-log-streaming-configuration-for-an-enterprise +// +//meta:operation DELETE /enterprises/{enterprise}/audit-log/streams/{stream_id} +func (s *EnterpriseService) DeleteAuditLogStream(ctx context.Context, enterprise string, streamID int64) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/audit-log/streams/%v", enterprise, streamID) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v88/github/enterprise_billing_cost_centers.go b/vendor/github.com/google/go-github/v88/github/enterprise_billing_cost_centers.go new file mode 100644 index 000000000..da232c3c2 --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/enterprise_billing_cost_centers.go @@ -0,0 +1,233 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// CostCenter represents an enterprise cost center. +type CostCenter struct { + ID string `json:"id"` + Name string `json:"name"` + Resources []*CostCenterResource `json:"resources"` + State *string `json:"state,omitempty"` + AzureSubscription *string `json:"azure_subscription,omitempty"` +} + +// CostCenterResource represents a resource assigned to a cost center. +type CostCenterResource struct { + Type string `json:"type"` + Name string `json:"name"` +} + +// CostCenters represents a list of cost centers. +type CostCenters struct { + CostCenters []*CostCenter `json:"costCenters,omitempty"` +} + +// ListCostCenterOptions specifies optional parameters to the EnterpriseService.ListCostCenters method. +type ListCostCenterOptions struct { + // Set to `active` or `deleted` to only list cost centers in a specific state. + State *string `url:"state,omitempty"` +} + +// CostCenterRequest represents a request to create or update a cost center. +type CostCenterRequest struct { + Name string `json:"name"` +} + +// CostCenterResourceRequest represents a request to add or remove resources from a cost center. +type CostCenterResourceRequest struct { + Users []string `json:"users,omitempty"` + Organizations []string `json:"organizations,omitempty"` + Repositories []string `json:"repositories,omitempty"` +} + +// AddResourcesToCostCenterResponse represents a response from adding resources to a cost center. +type AddResourcesToCostCenterResponse struct { + Message *string `json:"message,omitempty"` + ReassignedResources []*ReassignedResource `json:"reassigned_resources,omitempty"` +} + +// ReassignedResource represents a resource that was reassigned from another cost center. +type ReassignedResource struct { + ResourceType *string `json:"resource_type,omitempty"` + Name *string `json:"name,omitempty"` + PreviousCostCenter *string `json:"previous_cost_center,omitempty"` +} + +// RemoveResourcesFromCostCenterResponse represents a response from removing resources from a cost center. +type RemoveResourcesFromCostCenterResponse struct { + Message *string `json:"message,omitempty"` +} + +// DeleteCostCenterResponse represents a response from deleting a cost center. +type DeleteCostCenterResponse struct { + Message string `json:"message"` + ID string `json:"id"` + Name string `json:"name"` + CostCenterState string `json:"costCenterState"` +} + +// ListCostCenters lists all cost centers for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/cost-centers?apiVersion=2022-11-28#get-all-cost-centers-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/settings/billing/cost-centers +func (s *EnterpriseService) ListCostCenters(ctx context.Context, enterprise string, opts *ListCostCenterOptions) (*CostCenters, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var costCenters *CostCenters + resp, err := s.client.Do(req, &costCenters) + if err != nil { + return nil, resp, err + } + + return costCenters, resp, nil +} + +// CreateCostCenter creates a new cost center for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/cost-centers?apiVersion=2022-11-28#create-a-new-cost-center +// +//meta:operation POST /enterprises/{enterprise}/settings/billing/cost-centers +func (s *EnterpriseService) CreateCostCenter(ctx context.Context, enterprise string, costCenter CostCenterRequest) (*CostCenter, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers", enterprise) + + req, err := s.client.NewRequest(ctx, "POST", u, costCenter) + if err != nil { + return nil, nil, err + } + + var result *CostCenter + resp, err := s.client.Do(req, &result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// GetCostCenter gets a cost center by ID for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/cost-centers?apiVersion=2022-11-28#get-a-cost-center-by-id +// +//meta:operation GET /enterprises/{enterprise}/settings/billing/cost-centers/{cost_center_id} +func (s *EnterpriseService) GetCostCenter(ctx context.Context, enterprise, costCenterID string) (*CostCenter, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers/%v", enterprise, costCenterID) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var costCenter *CostCenter + resp, err := s.client.Do(req, &costCenter) + if err != nil { + return nil, resp, err + } + + return costCenter, resp, nil +} + +// UpdateCostCenter updates the name of a cost center. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/cost-centers?apiVersion=2022-11-28#update-a-cost-center-name +// +//meta:operation PATCH /enterprises/{enterprise}/settings/billing/cost-centers/{cost_center_id} +func (s *EnterpriseService) UpdateCostCenter(ctx context.Context, enterprise, costCenterID string, costCenter CostCenterRequest) (*CostCenter, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers/%v", enterprise, costCenterID) + + req, err := s.client.NewRequest(ctx, "PATCH", u, costCenter) + if err != nil { + return nil, nil, err + } + + var result *CostCenter + resp, err := s.client.Do(req, &result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// DeleteCostCenter deletes a cost center. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/cost-centers?apiVersion=2022-11-28#delete-a-cost-center +// +//meta:operation DELETE /enterprises/{enterprise}/settings/billing/cost-centers/{cost_center_id} +func (s *EnterpriseService) DeleteCostCenter(ctx context.Context, enterprise, costCenterID string) (*DeleteCostCenterResponse, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers/%v", enterprise, costCenterID) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, nil, err + } + + var result *DeleteCostCenterResponse + resp, err := s.client.Do(req, &result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// AddResourcesToCostCenter adds resources to a cost center. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/cost-centers?apiVersion=2022-11-28#add-resources-to-a-cost-center +// +//meta:operation POST /enterprises/{enterprise}/settings/billing/cost-centers/{cost_center_id}/resource +func (s *EnterpriseService) AddResourcesToCostCenter(ctx context.Context, enterprise, costCenterID string, resources CostCenterResourceRequest) (*AddResourcesToCostCenterResponse, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers/%v/resource", enterprise, costCenterID) + + req, err := s.client.NewRequest(ctx, "POST", u, resources) + if err != nil { + return nil, nil, err + } + + var result *AddResourcesToCostCenterResponse + resp, err := s.client.Do(req, &result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// RemoveResourcesFromCostCenter removes resources from a cost center. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/cost-centers?apiVersion=2022-11-28#remove-resources-from-a-cost-center +// +//meta:operation DELETE /enterprises/{enterprise}/settings/billing/cost-centers/{cost_center_id}/resource +func (s *EnterpriseService) RemoveResourcesFromCostCenter(ctx context.Context, enterprise, costCenterID string, resources CostCenterResourceRequest) (*RemoveResourcesFromCostCenterResponse, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers/%v/resource", enterprise, costCenterID) + + req, err := s.client.NewRequest(ctx, "DELETE", u, resources) + if err != nil { + return nil, nil, err + } + + var result *RemoveResourcesFromCostCenterResponse + resp, err := s.client.Do(req, &result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} diff --git a/vendor/github.com/google/go-github/v88/github/enterprise_budgets.go b/vendor/github.com/google/go-github/v88/github/enterprise_budgets.go new file mode 100644 index 000000000..d402671c4 --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/enterprise_budgets.go @@ -0,0 +1,198 @@ +// Copyright 2026 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// BudgetScope constants represent the scope of the budget. +const ( + BudgetScopeEnterprise = "enterprise" + BudgetScopeOrganization = "organization" + BudgetScopeRepository = "repository" + BudgetScopeCostCenter = "cost_center" +) + +// BudgetType constants represent the type of pricing for the budget. +const ( + BudgetTypeProductPricing = "ProductPricing" + BudgetTypeSkuPricing = "SkuPricing" +) + +// EnterpriseBudgetAlerting represents alerting settings for a GitHub enterprise budget. +type EnterpriseBudgetAlerting struct { + WillAlert *bool `json:"will_alert,omitempty"` + AlertRecipients []string `json:"alert_recipients,omitempty"` +} + +// EnterpriseBudget represents a GitHub enterprise budget. +type EnterpriseBudget struct { + ID *string `json:"id,omitempty"` + BudgetType *string `json:"budget_type,omitempty"` + BudgetProductSKU *string `json:"budget_product_sku,omitempty"` + BudgetScope *string `json:"budget_scope,omitempty"` + BudgetEntityName *string `json:"budget_entity_name,omitempty"` + BudgetAmount *int `json:"budget_amount,omitempty"` + PreventFurtherUsage *bool `json:"prevent_further_usage,omitempty"` + BudgetAlerting *EnterpriseBudgetAlerting `json:"budget_alerting,omitempty"` +} + +func (b EnterpriseBudget) String() string { + return Stringify(b) +} + +// EnterpriseListBudgets represents a collection of GitHub enterprise budgets. +type EnterpriseListBudgets struct { + Budgets []*EnterpriseBudget `json:"budgets"` + HasNextPage *bool `json:"has_next_page,omitempty"` + TotalCount *int `json:"total_count,omitempty"` +} + +// EnterpriseCreateBudget represents the payload to create a GitHub enterprise budget. +type EnterpriseCreateBudget struct { + BudgetAmount int `json:"budget_amount"` + PreventFurtherUsage bool `json:"prevent_further_usage"` + BudgetAlerting *EnterpriseBudgetAlerting `json:"budget_alerting"` + BudgetScope string `json:"budget_scope"` + BudgetEntityName *string `json:"budget_entity_name,omitempty"` + BudgetType string `json:"budget_type"` + BudgetProductSKU *string `json:"budget_product_sku,omitempty"` +} + +// EnterpriseUpdateBudget represents the payload to update a GitHub enterprise budget. +type EnterpriseUpdateBudget struct { + BudgetAmount *int `json:"budget_amount,omitempty"` + PreventFurtherUsage *bool `json:"prevent_further_usage,omitempty"` + BudgetAlerting *EnterpriseBudgetAlerting `json:"budget_alerting,omitempty"` + BudgetScope *string `json:"budget_scope,omitempty"` + BudgetEntityName *string `json:"budget_entity_name,omitempty"` + BudgetType *string `json:"budget_type,omitempty"` + BudgetProductSKU *string `json:"budget_product_sku,omitempty"` +} + +// EnterpriseCreateOrUpdateBudgetResponse represents the response when creating or updating a budget. +type EnterpriseCreateOrUpdateBudgetResponse struct { + Message string `json:"message"` + Budget *EnterpriseBudget `json:"budget"` +} + +// EnterpriseDeleteBudgetResponse represents the response when deleting a budget. +type EnterpriseDeleteBudgetResponse struct { + Message string `json:"message"` + ID string `json:"id"` +} + +// ListBudgets gets all budgets for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/budgets?apiVersion=2022-11-28#get-all-budgets +// +//meta:operation GET /enterprises/{enterprise}/settings/billing/budgets +func (s *EnterpriseService) ListBudgets(ctx context.Context, enterprise string) (*EnterpriseListBudgets, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/budgets", enterprise) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var budgets *EnterpriseListBudgets + resp, err := s.client.Do(req, &budgets) + if err != nil { + return nil, resp, err + } + + return budgets, resp, nil +} + +// CreateBudget creates a new budget for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/budgets?apiVersion=2022-11-28#create-a-budget +// +//meta:operation POST /enterprises/{enterprise}/settings/billing/budgets +func (s *EnterpriseService) CreateBudget(ctx context.Context, enterprise string, budget EnterpriseCreateBudget) (*EnterpriseCreateOrUpdateBudgetResponse, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/budgets", enterprise) + + req, err := s.client.NewRequest(ctx, "POST", u, budget) + if err != nil { + return nil, nil, err + } + + var createBudgetResponse *EnterpriseCreateOrUpdateBudgetResponse + resp, err := s.client.Do(req, &createBudgetResponse) + if err != nil { + return nil, resp, err + } + + return createBudgetResponse, resp, nil +} + +// GetBudget gets a budget by ID for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/budgets?apiVersion=2022-11-28#get-a-budget-by-id +// +//meta:operation GET /enterprises/{enterprise}/settings/billing/budgets/{budget_id} +func (s *EnterpriseService) GetBudget(ctx context.Context, enterprise, budgetID string) (*EnterpriseBudget, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/budgets/%v", enterprise, budgetID) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var budget *EnterpriseBudget + resp, err := s.client.Do(req, &budget) + if err != nil { + return nil, resp, err + } + + return budget, resp, nil +} + +// UpdateBudget updates an existing budget for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/budgets?apiVersion=2022-11-28#update-a-budget +// +//meta:operation PATCH /enterprises/{enterprise}/settings/billing/budgets/{budget_id} +func (s *EnterpriseService) UpdateBudget(ctx context.Context, enterprise, budgetID string, budget EnterpriseUpdateBudget) (*EnterpriseCreateOrUpdateBudgetResponse, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/budgets/%v", enterprise, budgetID) + + req, err := s.client.NewRequest(ctx, "PATCH", u, budget) + if err != nil { + return nil, nil, err + } + + var updateBudgetResponse *EnterpriseCreateOrUpdateBudgetResponse + resp, err := s.client.Do(req, &updateBudgetResponse) + if err != nil { + return nil, resp, err + } + + return updateBudgetResponse, resp, nil +} + +// DeleteBudget deletes a budget by ID for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/budgets?apiVersion=2022-11-28#delete-a-budget +// +//meta:operation DELETE /enterprises/{enterprise}/settings/billing/budgets/{budget_id} +func (s *EnterpriseService) DeleteBudget(ctx context.Context, enterprise, budgetID string) (*EnterpriseDeleteBudgetResponse, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/budgets/%v", enterprise, budgetID) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, nil, err + } + + var deleteBudgetResponse *EnterpriseDeleteBudgetResponse + resp, err := s.client.Do(req, &deleteBudgetResponse) + if err != nil { + return nil, resp, err + } + + return deleteBudgetResponse, resp, nil +} diff --git a/vendor/github.com/google/go-github/v73/github/enterprise_code_security_and_analysis.go b/vendor/github.com/google/go-github/v88/github/enterprise_code_security_and_analysis.go similarity index 80% rename from vendor/github.com/google/go-github/v73/github/enterprise_code_security_and_analysis.go rename to vendor/github.com/google/go-github/v88/github/enterprise_code_security_and_analysis.go index 159aeae4d..6b9ca1c5a 100644 --- a/vendor/github.com/google/go-github/v73/github/enterprise_code_security_and_analysis.go +++ b/vendor/github.com/google/go-github/v88/github/enterprise_code_security_and_analysis.go @@ -21,19 +21,19 @@ type EnterpriseSecurityAnalysisSettings struct { // GetCodeSecurityAndAnalysis gets code security and analysis features for an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/code-security-and-analysis#get-code-security-and-analysis-features-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/code-security-and-analysis?apiVersion=2022-11-28#get-code-security-and-analysis-features-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/code_security_and_analysis func (s *EnterpriseService) GetCodeSecurityAndAnalysis(ctx context.Context, enterprise string) (*EnterpriseSecurityAnalysisSettings, *Response, error) { u := fmt.Sprintf("enterprises/%v/code_security_and_analysis", enterprise) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - settings := new(EnterpriseSecurityAnalysisSettings) - resp, err := s.client.Do(ctx, req, settings) + var settings *EnterpriseSecurityAnalysisSettings + resp, err := s.client.Do(req, &settings) if err != nil { return nil, resp, err } @@ -43,17 +43,17 @@ func (s *EnterpriseService) GetCodeSecurityAndAnalysis(ctx context.Context, ente // UpdateCodeSecurityAndAnalysis updates code security and analysis features for new repositories in an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/code-security-and-analysis#update-code-security-and-analysis-features-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/code-security-and-analysis?apiVersion=2022-11-28#update-code-security-and-analysis-features-for-an-enterprise // //meta:operation PATCH /enterprises/{enterprise}/code_security_and_analysis func (s *EnterpriseService) UpdateCodeSecurityAndAnalysis(ctx context.Context, enterprise string, settings *EnterpriseSecurityAnalysisSettings) (*Response, error) { u := fmt.Sprintf("enterprises/%v/code_security_and_analysis", enterprise) - req, err := s.client.NewRequest("PATCH", u, settings) + req, err := s.client.NewRequest(ctx, "PATCH", u, settings) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -66,17 +66,17 @@ func (s *EnterpriseService) UpdateCodeSecurityAndAnalysis(ctx context.Context, e // Valid values for securityProduct: "advanced_security", "secret_scanning", "secret_scanning_push_protection". // Valid values for enablement: "enable_all", "disable_all". // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/code-security-and-analysis#enable-or-disable-a-security-feature +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/code-security-and-analysis?apiVersion=2022-11-28#enable-or-disable-a-security-feature // //meta:operation POST /enterprises/{enterprise}/{security_product}/{enablement} func (s *EnterpriseService) EnableDisableSecurityFeature(ctx context.Context, enterprise, securityProduct, enablement string) (*Response, error) { u := fmt.Sprintf("enterprises/%v/%v/%v", enterprise, securityProduct, enablement) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } diff --git a/vendor/github.com/google/go-github/v88/github/enterprise_codesecurity_configurations.go b/vendor/github.com/google/go-github/v88/github/enterprise_codesecurity_configurations.go new file mode 100644 index 000000000..3036cdf66 --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/enterprise_codesecurity_configurations.go @@ -0,0 +1,232 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" + "net/http" +) + +// ListEnterpriseCodeSecurityConfigurationOptions specifies optional parameters to get security configurations for enterprises. +// +// Note: Pagination is powered by before/after cursor-style pagination. After the initial call, +// inspect the returned *Response. Use resp.After as the opts.After value to request +// the next page, and resp.Before as the opts.Before value to request the previous +// page. Set either Before or After for a request; if both are +// supplied GitHub API will return an error. PerPage controls the number of items +// per page (max 100 per GitHub API docs). +type ListEnterpriseCodeSecurityConfigurationOptions struct { + // A cursor, as given in the Link header. If specified, the query only searches for security configurations before this cursor. + Before string `url:"before,omitempty"` + + // A cursor, as given in the Link header. If specified, the query only searches for security configurations after this cursor. + After string `url:"after,omitempty"` + + // For paginated result sets, the number of results to include per page. + PerPage int `url:"per_page,omitempty"` +} + +// ListCodeSecurityConfigurations lists all code security configurations available in an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#get-code-security-configurations-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/code-security/configurations +func (s *EnterpriseService) ListCodeSecurityConfigurations(ctx context.Context, enterprise string, opts *ListEnterpriseCodeSecurityConfigurationOptions) ([]*CodeSecurityConfiguration, *Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var configurations []*CodeSecurityConfiguration + resp, err := s.client.Do(req, &configurations) + if err != nil { + return nil, resp, err + } + return configurations, resp, nil +} + +// CreateCodeSecurityConfiguration creates a code security configuration in an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#create-a-code-security-configuration-for-an-enterprise +// +//meta:operation POST /enterprises/{enterprise}/code-security/configurations +func (s *EnterpriseService) CreateCodeSecurityConfiguration(ctx context.Context, enterprise string, config CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations", enterprise) + + req, err := s.client.NewRequest(ctx, "POST", u, config) + if err != nil { + return nil, nil, err + } + + var configuration *CodeSecurityConfiguration + resp, err := s.client.Do(req, &configuration) + if err != nil { + return nil, resp, err + } + return configuration, resp, nil +} + +// ListDefaultCodeSecurityConfigurations lists the default code security configurations for an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#get-default-code-security-configurations-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/code-security/configurations/defaults +func (s *EnterpriseService) ListDefaultCodeSecurityConfigurations(ctx context.Context, enterprise string) ([]*CodeSecurityConfigurationWithDefaultForNewRepos, *Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations/defaults", enterprise) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var configurations []*CodeSecurityConfigurationWithDefaultForNewRepos + resp, err := s.client.Do(req, &configurations) + if err != nil { + return nil, resp, err + } + return configurations, resp, nil +} + +// GetCodeSecurityConfiguration gets a code security configuration available in an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#retrieve-a-code-security-configuration-of-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/code-security/configurations/{configuration_id} +func (s *EnterpriseService) GetCodeSecurityConfiguration(ctx context.Context, enterprise string, configurationID int64) (*CodeSecurityConfiguration, *Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations/%v", enterprise, configurationID) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var configuration *CodeSecurityConfiguration + resp, err := s.client.Do(req, &configuration) + if err != nil { + return nil, resp, err + } + return configuration, resp, nil +} + +// UpdateCodeSecurityConfiguration updates a code security configuration in an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#update-a-custom-code-security-configuration-for-an-enterprise +// +//meta:operation PATCH /enterprises/{enterprise}/code-security/configurations/{configuration_id} +func (s *EnterpriseService) UpdateCodeSecurityConfiguration(ctx context.Context, enterprise string, configurationID int64, config CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations/%v", enterprise, configurationID) + + req, err := s.client.NewRequest(ctx, "PATCH", u, config) + if err != nil { + return nil, nil, err + } + + var configuration *CodeSecurityConfiguration + resp, err := s.client.Do(req, &configuration) + if err != nil { + return nil, resp, err + } + return configuration, resp, nil +} + +// DeleteCodeSecurityConfiguration deletes a code security configuration from an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#delete-a-code-security-configuration-for-an-enterprise +// +//meta:operation DELETE /enterprises/{enterprise}/code-security/configurations/{configuration_id} +func (s *EnterpriseService) DeleteCodeSecurityConfiguration(ctx context.Context, enterprise string, configurationID int64) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations/%v", enterprise, configurationID) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + return resp, nil +} + +// AttachCodeSecurityConfigurationToRepositories attaches an enterprise code security configuration to repositories. +// `scope` is the type of repositories to attach the configuration to. +// Can be one of: `all`, `all_without_configurations`. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#attach-an-enterprise-configuration-to-repositories +// +//meta:operation POST /enterprises/{enterprise}/code-security/configurations/{configuration_id}/attach +func (s *EnterpriseService) AttachCodeSecurityConfigurationToRepositories(ctx context.Context, enterprise string, configurationID int64, scope string) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations/%v/attach", enterprise, configurationID) + type scopeType struct { + Scope string `json:"scope"` + } + + req, err := s.client.NewRequest(ctx, "POST", u, scopeType{Scope: scope}) + if err != nil { + return nil, err + } + resp, err := s.client.Do(req, nil) + if err != nil && resp.StatusCode != http.StatusAccepted { // StatusAccepted(202) is the expected status code as job is queued for processing + return resp, err + } + return resp, nil +} + +// SetDefaultCodeSecurityConfiguration sets a code security configuration as a default for an enterprise. +// `defaultForNewRepos` specifies which types of repository this security configuration should be applied to by default. +// Can be one of: `all`, `none`, `private_and_internal`, `public`. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#set-a-code-security-configuration-as-a-default-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/code-security/configurations/{configuration_id}/defaults +func (s *EnterpriseService) SetDefaultCodeSecurityConfiguration(ctx context.Context, enterprise string, configurationID int64, defaultForNewRepos string) (*CodeSecurityConfigurationWithDefaultForNewRepos, *Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations/%v/defaults", enterprise, configurationID) + type configParam struct { + DefaultForNewRepos string `json:"default_for_new_repos"` + } + + req, err := s.client.NewRequest(ctx, "PUT", u, configParam{DefaultForNewRepos: defaultForNewRepos}) + if err != nil { + return nil, nil, err + } + var config *CodeSecurityConfigurationWithDefaultForNewRepos + resp, err := s.client.Do(req, &config) + if err != nil { + return nil, resp, err + } + return config, resp, nil +} + +// ListCodeSecurityConfigurationRepositories lists the repositories associated with an enterprise code security configuration. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#get-repositories-associated-with-an-enterprise-code-security-configuration +// +//meta:operation GET /enterprises/{enterprise}/code-security/configurations/{configuration_id}/repositories +func (s *EnterpriseService) ListCodeSecurityConfigurationRepositories(ctx context.Context, enterprise string, configurationID int64, opts *ListCodeSecurityConfigurationRepositoriesOptions) ([]*RepositoryAttachment, *Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations/%v/repositories", enterprise, configurationID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + var attachments []*RepositoryAttachment + resp, err := s.client.Do(req, &attachments) + if err != nil { + return nil, resp, err + } + return attachments, resp, nil +} diff --git a/vendor/github.com/google/go-github/v88/github/enterprise_licenses.go b/vendor/github.com/google/go-github/v88/github/enterprise_licenses.go new file mode 100644 index 000000000..73da6c5e6 --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/enterprise_licenses.go @@ -0,0 +1,138 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// EnterpriseConsumedLicenses represents information about users with consumed enterprise licenses. +type EnterpriseConsumedLicenses struct { + TotalSeatsConsumed int `json:"total_seats_consumed"` + TotalSeatsPurchased int `json:"total_seats_purchased"` + Users []*EnterpriseLicensedUsers `json:"users,omitempty"` +} + +// EnterpriseLicensedUsers represents a user with license information in an enterprise. +type EnterpriseLicensedUsers struct { + GithubComLogin string `json:"github_com_login"` + GithubComName *string `json:"github_com_name"` + EnterpriseServerUserIDs []string `json:"enterprise_server_user_ids,omitempty"` + GithubComUser bool `json:"github_com_user"` + EnterpriseServerUser *bool `json:"enterprise_server_user"` + VisualStudioSubscriptionUser bool `json:"visual_studio_subscription_user"` + LicenseType string `json:"license_type"` + GithubComProfile *string `json:"github_com_profile"` + GithubComMemberRoles []string `json:"github_com_member_roles,omitempty"` + GithubComEnterpriseRoles []string `json:"github_com_enterprise_roles,omitempty"` + GithubComVerifiedDomainEmails []string `json:"github_com_verified_domain_emails,omitempty"` + GithubComSamlNameID *string `json:"github_com_saml_name_id"` + GithubComOrgsWithPendingInvites []string `json:"github_com_orgs_with_pending_invites,omitempty"` + GithubComTwoFactorAuth *bool `json:"github_com_two_factor_auth"` + EnterpriseServerEmails []string `json:"enterprise_server_emails,omitempty"` + VisualStudioLicenseStatus *string `json:"visual_studio_license_status"` + VisualStudioSubscriptionEmail *string `json:"visual_studio_subscription_email"` + TotalUserAccounts int `json:"total_user_accounts"` +} + +// EnterpriseLicenseSyncStatus represents the synchronization status of +// GitHub Enterprise Server instances with an enterprise account. +type EnterpriseLicenseSyncStatus struct { + Title string `json:"title"` + Description string `json:"description"` + Properties *ServerInstanceProperties `json:"properties,omitempty"` +} + +// ServerInstanceProperties contains the collection of server instances. +type ServerInstanceProperties struct { + ServerInstances *ServerInstances `json:"server_instances,omitempty"` +} + +// ServerInstances represents a collection of GitHub Enterprise Server instances +// and their synchronization status. +type ServerInstances struct { + Type string `json:"type"` + Items *ServiceInstanceItems `json:"items,omitempty"` +} + +// ServiceInstanceItems defines the structure and properties of individual server instances +// in the collection. +type ServiceInstanceItems struct { + Type string `json:"type"` + Properties *ServerItemProperties `json:"properties,omitempty"` +} + +// ServerItemProperties represents the properties of a GitHub Enterprise Server instance, +// including its identifier, hostname, and last synchronization status. +type ServerItemProperties struct { + ServerID string `json:"server_id"` + Hostname string `json:"hostname"` + LastSync *LastLicenseSync `json:"last_sync,omitempty"` +} + +// LastLicenseSync contains information about the most recent license synchronization +// attempt for a server instance. +type LastLicenseSync struct { + Type string `json:"type"` + Properties *LastLicenseSyncProperties `json:"properties,omitempty"` +} + +// LastLicenseSyncProperties represents the details of the last synchronization attempt, +// including the date, status, and any error that occurred. +type LastLicenseSyncProperties struct { + Date *Timestamp `json:"date,omitempty"` + Status string `json:"status"` + Error string `json:"error"` +} + +// ListConsumedLicenses collect information about the number of consumed licenses and a collection with all the users with consumed enterprise licenses. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/licensing?apiVersion=2022-11-28#list-enterprise-consumed-licenses +// +//meta:operation GET /enterprises/{enterprise}/consumed-licenses +func (s *EnterpriseService) ListConsumedLicenses(ctx context.Context, enterprise string, opts *ListOptions) (*EnterpriseConsumedLicenses, *Response, error) { + u := fmt.Sprintf("enterprises/%v/consumed-licenses", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var consumedLicenses *EnterpriseConsumedLicenses + resp, err := s.client.Do(req, &consumedLicenses) + if err != nil { + return nil, resp, err + } + + return consumedLicenses, resp, nil +} + +// GetLicenseSyncStatus collects information about the status of a license sync job for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/licensing?apiVersion=2022-11-28#get-a-license-sync-status +// +//meta:operation GET /enterprises/{enterprise}/license-sync-status +func (s *EnterpriseService) GetLicenseSyncStatus(ctx context.Context, enterprise string) (*EnterpriseLicenseSyncStatus, *Response, error) { + u := fmt.Sprintf("enterprises/%v/license-sync-status", enterprise) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var syncStatus *EnterpriseLicenseSyncStatus + resp, err := s.client.Do(req, &syncStatus) + if err != nil { + return nil, resp, err + } + + return syncStatus, resp, nil +} diff --git a/vendor/github.com/google/go-github/v73/github/enterprise_manage_ghes.go b/vendor/github.com/google/go-github/v88/github/enterprise_manage_ghes.go similarity index 86% rename from vendor/github.com/google/go-github/v73/github/enterprise_manage_ghes.go rename to vendor/github.com/google/go-github/v88/github/enterprise_manage_ghes.go index c5e38386a..ad10ad8c5 100644 --- a/vendor/github.com/google/go-github/v73/github/enterprise_manage_ghes.go +++ b/vendor/github.com/google/go-github/v88/github/enterprise_manage_ghes.go @@ -74,18 +74,18 @@ type ReleaseVersion struct { // CheckSystemRequirements checks if GHES system nodes meet the system requirements. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#get-the-system-requirement-check-results-for-configured-cluster-nodes +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#get-the-system-requirement-check-results-for-configured-cluster-nodes // //meta:operation GET /manage/v1/checks/system-requirements func (s *EnterpriseService) CheckSystemRequirements(ctx context.Context) (*SystemRequirements, *Response, error) { u := "manage/v1/checks/system-requirements" - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - systemRequirements := new(SystemRequirements) - resp, err := s.client.Do(ctx, req, systemRequirements) + var systemRequirements *SystemRequirements + resp, err := s.client.Do(req, &systemRequirements) if err != nil { return nil, resp, err } @@ -95,18 +95,18 @@ func (s *EnterpriseService) CheckSystemRequirements(ctx context.Context) (*Syste // ClusterStatus gets the status of all services running on each cluster node. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#get-the-status-of-services-running-on-all-cluster-nodes +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#get-the-status-of-services-running-on-all-cluster-nodes // //meta:operation GET /manage/v1/cluster/status func (s *EnterpriseService) ClusterStatus(ctx context.Context) (*ClusterStatus, *Response, error) { u := "manage/v1/cluster/status" - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - clusterStatus := new(ClusterStatus) - resp, err := s.client.Do(ctx, req, clusterStatus) + var clusterStatus *ClusterStatus + resp, err := s.client.Do(req, &clusterStatus) if err != nil { return nil, resp, err } @@ -116,7 +116,7 @@ func (s *EnterpriseService) ClusterStatus(ctx context.Context) (*ClusterStatus, // ReplicationStatus gets the status of all services running on each replica node. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#get-the-status-of-services-running-on-all-replica-nodes +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#get-the-status-of-services-running-on-all-replica-nodes // //meta:operation GET /manage/v1/replication/status func (s *EnterpriseService) ReplicationStatus(ctx context.Context, opts *NodeQueryOptions) (*ClusterStatus, *Response, error) { @@ -124,13 +124,13 @@ func (s *EnterpriseService) ReplicationStatus(ctx context.Context, opts *NodeQue if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - status := new(ClusterStatus) - resp, err := s.client.Do(ctx, req, status) + var status *ClusterStatus + resp, err := s.client.Do(req, &status) if err != nil { return nil, resp, err } @@ -140,7 +140,7 @@ func (s *EnterpriseService) ReplicationStatus(ctx context.Context, opts *NodeQue // GetNodeReleaseVersions gets the version information deployed to each node. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#get-all-ghes-release-versions-for-all-nodes +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#get-all-ghes-release-versions-for-all-nodes // //meta:operation GET /manage/v1/version func (s *EnterpriseService) GetNodeReleaseVersions(ctx context.Context, opts *NodeQueryOptions) ([]*NodeReleaseVersion, *Response, error) { @@ -148,13 +148,13 @@ func (s *EnterpriseService) GetNodeReleaseVersions(ctx context.Context, opts *No if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var releaseVersions []*NodeReleaseVersion - resp, err := s.client.Do(ctx, req, &releaseVersions) + resp, err := s.client.Do(req, &releaseVersions) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/enterprise_manage_ghes_config.go b/vendor/github.com/google/go-github/v88/github/enterprise_manage_ghes_config.go similarity index 91% rename from vendor/github.com/google/go-github/v73/github/enterprise_manage_ghes_config.go rename to vendor/github.com/google/go-github/v88/github/enterprise_manage_ghes_config.go index ded48ddc7..9770d044a 100644 --- a/vendor/github.com/google/go-github/v73/github/enterprise_manage_ghes_config.go +++ b/vendor/github.com/google/go-github/v88/github/enterprise_manage_ghes_config.go @@ -63,10 +63,10 @@ type ConfigApplyEventsNodeEvent struct { SpanDepth *int `json:"span_depth,omitempty"` } -// InitialConfigOptions is a struct to hold the options for the InitialConfig API. +// InitialConfigOptions represents the payload for initializing instance configuration. type InitialConfigOptions struct { - License string `url:"license"` - Password string `url:"password"` + License string `json:"license"` + Password string `json:"password"` } // LicenseStatus is a struct to hold the response from the License API. @@ -305,7 +305,7 @@ type NodeDetails struct { // ConfigApplyEvents gets events from the command ghe-config-apply. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#list-events-from-ghe-config-apply +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#list-events-from-ghe-config-apply // //meta:operation GET /manage/v1/config/apply/events func (s *EnterpriseService) ConfigApplyEvents(ctx context.Context, opts *ConfigApplyEventsOptions) (*ConfigApplyEvents, *Response, error) { @@ -313,13 +313,13 @@ func (s *EnterpriseService) ConfigApplyEvents(ctx context.Context, opts *ConfigA if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - configApplyEvents := new(ConfigApplyEvents) - resp, err := s.client.Do(ctx, req, configApplyEvents) + var configApplyEvents *ConfigApplyEvents + resp, err := s.client.Do(req, &configApplyEvents) if err != nil { return nil, resp, err } @@ -330,39 +330,39 @@ func (s *EnterpriseService) ConfigApplyEvents(ctx context.Context, opts *ConfigA // InitialConfig initializes the GitHub Enterprise instance with a license and password. // After initializing the instance, you need to run an apply to apply the configuration. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#initialize-instance-configuration-with-license-and-password +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#initialize-instance-configuration-with-license-and-password // //meta:operation POST /manage/v1/config/init func (s *EnterpriseService) InitialConfig(ctx context.Context, license, password string) (*Response, error) { u := "manage/v1/config/init" - opts := &InitialConfigOptions{ + payload := &InitialConfigOptions{ License: license, Password: password, } - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, payload) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // License gets the current license information for the GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#get-the-enterprise-license-information +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#get-the-enterprise-license-information // //meta:operation GET /manage/v1/config/license func (s *EnterpriseService) License(ctx context.Context) ([]*LicenseStatus, *Response, error) { u := "manage/v1/config/license" - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var licenseStatus []*LicenseStatus - resp, err := s.client.Do(ctx, req, &licenseStatus) + resp, err := s.client.Do(req, &licenseStatus) if err != nil { return nil, resp, err } @@ -372,7 +372,7 @@ func (s *EnterpriseService) License(ctx context.Context) ([]*LicenseStatus, *Res // UploadLicense uploads a new license to the GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#upload-an-enterprise-license +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#upload-an-enterprise-license // //meta:operation PUT /manage/v1/config/license func (s *EnterpriseService) UploadLicense(ctx context.Context, license string) (*Response, error) { @@ -380,28 +380,28 @@ func (s *EnterpriseService) UploadLicense(ctx context.Context, license string) ( opts := &UploadLicenseOptions{ License: license, } - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, opts) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // LicenseStatus gets the current license status for the GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#check-a-license +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#check-a-license // //meta:operation GET /manage/v1/config/license/check func (s *EnterpriseService) LicenseStatus(ctx context.Context) ([]*LicenseCheck, *Response, error) { u := "manage/v1/config/license/check" - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var checks []*LicenseCheck - resp, err := s.client.Do(ctx, req, &checks) + resp, err := s.client.Do(req, &checks) if err != nil { return nil, resp, err } @@ -412,7 +412,7 @@ func (s *EnterpriseService) LicenseStatus(ctx context.Context) ([]*LicenseCheck, // NodeMetadata gets the metadata for all nodes in the GitHub Enterprise instance. // This is required for clustered setups. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#get-ghes-node-metadata-for-all-nodes +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#get-ghes-node-metadata-for-all-nodes // //meta:operation GET /manage/v1/config/nodes func (s *EnterpriseService) NodeMetadata(ctx context.Context, opts *NodeQueryOptions) (*NodeMetadataStatus, *Response, error) { @@ -420,13 +420,13 @@ func (s *EnterpriseService) NodeMetadata(ctx context.Context, opts *NodeQueryOpt if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - status := new(NodeMetadataStatus) - resp, err := s.client.Do(ctx, req, status) + var status *NodeMetadataStatus + resp, err := s.client.Do(req, &status) if err != nil { return nil, resp, err } @@ -436,18 +436,18 @@ func (s *EnterpriseService) NodeMetadata(ctx context.Context, opts *NodeQueryOpt // Settings gets the current configuration settings for the GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#get-the-ghes-settings +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#get-the-ghes-settings // //meta:operation GET /manage/v1/config/settings func (s *EnterpriseService) Settings(ctx context.Context) (*ConfigSettings, *Response, error) { u := "manage/v1/config/settings" - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - configSettings := new(ConfigSettings) - resp, err := s.client.Do(ctx, req, configSettings) + var configSettings *ConfigSettings + resp, err := s.client.Do(req, &configSettings) if err != nil { return nil, resp, err } @@ -457,7 +457,7 @@ func (s *EnterpriseService) Settings(ctx context.Context) (*ConfigSettings, *Res // UpdateSettings updates the configuration settings for the GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#set-settings +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#set-settings // //meta:operation PUT /manage/v1/config/settings func (s *EnterpriseService) UpdateSettings(ctx context.Context, opts *ConfigSettings) (*Response, error) { @@ -466,28 +466,28 @@ func (s *EnterpriseService) UpdateSettings(ctx context.Context, opts *ConfigSett if opts == nil { return nil, errors.New("opts should not be nil") } - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, opts) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ConfigApply triggers a configuration apply run on the GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#trigger-a-ghe-config-apply-run +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#trigger-a-ghe-config-apply-run // //meta:operation POST /manage/v1/config/apply func (s *EnterpriseService) ConfigApply(ctx context.Context, opts *ConfigApplyOptions) (*ConfigApplyOptions, *Response, error) { u := "manage/v1/config/apply" - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, opts) if err != nil { return nil, nil, err } - configApplyOptions := new(ConfigApplyOptions) - resp, err := s.client.Do(ctx, req, configApplyOptions) + var configApplyOptions *ConfigApplyOptions + resp, err := s.client.Do(req, &configApplyOptions) if err != nil { return nil, resp, err } @@ -497,18 +497,18 @@ func (s *EnterpriseService) ConfigApply(ctx context.Context, opts *ConfigApplyOp // ConfigApplyStatus gets the status of a ghe-config-apply run on the GitHub Enterprise instance. // You can request lat one or specific id one. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#get-the-status-of-a-ghe-config-apply-run +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#get-the-status-of-a-ghe-config-apply-run // //meta:operation GET /manage/v1/config/apply func (s *EnterpriseService) ConfigApplyStatus(ctx context.Context, opts *ConfigApplyOptions) (*ConfigApplyStatus, *Response, error) { u := "manage/v1/config/apply" - req, err := s.client.NewRequest("GET", u, opts) + req, err := s.client.NewRequest(ctx, "GET", u, opts) if err != nil { return nil, nil, err } - status := new(ConfigApplyStatus) - resp, err := s.client.Do(ctx, req, status) + var status *ConfigApplyStatus + resp, err := s.client.Do(req, &status) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/enterprise_manage_ghes_maintenance.go b/vendor/github.com/google/go-github/v88/github/enterprise_manage_ghes_maintenance.go similarity index 91% rename from vendor/github.com/google/go-github/v73/github/enterprise_manage_ghes_maintenance.go rename to vendor/github.com/google/go-github/v88/github/enterprise_manage_ghes_maintenance.go index 8b27b32a4..3ee9369b0 100644 --- a/vendor/github.com/google/go-github/v73/github/enterprise_manage_ghes_maintenance.go +++ b/vendor/github.com/google/go-github/v88/github/enterprise_manage_ghes_maintenance.go @@ -46,7 +46,7 @@ type MaintenanceOptions struct { // GetMaintenanceStatus gets the status of maintenance mode for all nodes. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#get-the-status-of-maintenance-mode +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#get-the-status-of-maintenance-mode // //meta:operation GET /manage/v1/maintenance func (s *EnterpriseService) GetMaintenanceStatus(ctx context.Context, opts *NodeQueryOptions) ([]*MaintenanceStatus, *Response, error) { @@ -54,13 +54,13 @@ func (s *EnterpriseService) GetMaintenanceStatus(ctx context.Context, opts *Node if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var status []*MaintenanceStatus - resp, err := s.client.Do(ctx, req, &status) + resp, err := s.client.Do(req, &status) if err != nil { return nil, resp, err } @@ -71,7 +71,7 @@ func (s *EnterpriseService) GetMaintenanceStatus(ctx context.Context, opts *Node // CreateMaintenance sets the maintenance mode for the instance. // With the enable parameter we can control to put instance into maintenance mode or not. With false we can disable the maintenance mode. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#set-the-status-of-maintenance-mode +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#set-the-status-of-maintenance-mode // //meta:operation POST /manage/v1/maintenance func (s *EnterpriseService) CreateMaintenance(ctx context.Context, enable bool, opts *MaintenanceOptions) ([]*MaintenanceOperationStatus, *Response, error) { @@ -79,13 +79,13 @@ func (s *EnterpriseService) CreateMaintenance(ctx context.Context, enable bool, opts.Enabled = enable - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, opts) if err != nil { return nil, nil, err } var i []*MaintenanceOperationStatus - resp, err := s.client.Do(ctx, req, &i) + resp, err := s.client.Do(req, &i) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/enterprise_manage_ghes_ssh.go b/vendor/github.com/google/go-github/v88/github/enterprise_manage_ghes_ssh.go similarity index 83% rename from vendor/github.com/google/go-github/v73/github/enterprise_manage_ghes_ssh.go rename to vendor/github.com/google/go-github/v88/github/enterprise_manage_ghes_ssh.go index d60f89779..37c8089f3 100644 --- a/vendor/github.com/google/go-github/v73/github/enterprise_manage_ghes_ssh.go +++ b/vendor/github.com/google/go-github/v88/github/enterprise_manage_ghes_ssh.go @@ -31,7 +31,7 @@ type ClusterSSHKey struct { // DeleteSSHKey deletes the SSH key from the instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#delete-a-ssh-key +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#delete-a-ssh-key // //meta:operation DELETE /manage/v1/access/ssh func (s *EnterpriseService) DeleteSSHKey(ctx context.Context, key string) ([]*SSHKeyStatus, *Response, error) { @@ -39,13 +39,13 @@ func (s *EnterpriseService) DeleteSSHKey(ctx context.Context, key string) ([]*SS opts := &SSHKeyOptions{ Key: key, } - req, err := s.client.NewRequest("DELETE", u, opts) + req, err := s.client.NewRequest(ctx, "DELETE", u, opts) if err != nil { return nil, nil, err } var sshStatus []*SSHKeyStatus - resp, err := s.client.Do(ctx, req, &sshStatus) + resp, err := s.client.Do(req, &sshStatus) if err != nil { return nil, resp, err } @@ -55,18 +55,18 @@ func (s *EnterpriseService) DeleteSSHKey(ctx context.Context, key string) ([]*SS // GetSSHKey gets the SSH keys configured for the instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#get-the-configured-ssh-keys +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#get-the-configured-ssh-keys // //meta:operation GET /manage/v1/access/ssh func (s *EnterpriseService) GetSSHKey(ctx context.Context) ([]*ClusterSSHKey, *Response, error) { u := "manage/v1/access/ssh" - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var sshKeys []*ClusterSSHKey - resp, err := s.client.Do(ctx, req, &sshKeys) + resp, err := s.client.Do(req, &sshKeys) if err != nil { return nil, resp, err } @@ -76,7 +76,7 @@ func (s *EnterpriseService) GetSSHKey(ctx context.Context) ([]*ClusterSSHKey, *R // CreateSSHKey adds a new SSH key to the instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#set-a-new-ssh-key +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#set-a-new-ssh-key // //meta:operation POST /manage/v1/access/ssh func (s *EnterpriseService) CreateSSHKey(ctx context.Context, key string) ([]*SSHKeyStatus, *Response, error) { @@ -84,13 +84,13 @@ func (s *EnterpriseService) CreateSSHKey(ctx context.Context, key string) ([]*SS opts := &SSHKeyOptions{ Key: key, } - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, opts) if err != nil { return nil, nil, err } var sshKeyResponse []*SSHKeyStatus - resp, err := s.client.Do(ctx, req, &sshKeyResponse) + resp, err := s.client.Do(req, &sshKeyResponse) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/enterprise_network_configurations.go b/vendor/github.com/google/go-github/v88/github/enterprise_network_configurations.go similarity index 73% rename from vendor/github.com/google/go-github/v73/github/enterprise_network_configurations.go rename to vendor/github.com/google/go-github/v88/github/enterprise_network_configurations.go index a6a690d78..eaf3f05b2 100644 --- a/vendor/github.com/google/go-github/v73/github/enterprise_network_configurations.go +++ b/vendor/github.com/google/go-github/v88/github/enterprise_network_configurations.go @@ -12,7 +12,7 @@ import ( // ListEnterpriseNetworkConfigurations lists all hosted compute network configurations configured in an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations#list-hosted-compute-network-configurations-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations?apiVersion=2022-11-28#list-hosted-compute-network-configurations-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/network-configurations func (s *EnterpriseService) ListEnterpriseNetworkConfigurations(ctx context.Context, enterprise string, opts *ListOptions) (*NetworkConfigurations, *Response, error) { @@ -22,22 +22,23 @@ func (s *EnterpriseService) ListEnterpriseNetworkConfigurations(ctx context.Cont return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - networks := &NetworkConfigurations{} - resp, err := s.client.Do(ctx, req, networks) + var networks *NetworkConfigurations + resp, err := s.client.Do(req, &networks) if err != nil { return nil, resp, err } + return networks, resp, nil } // CreateEnterpriseNetworkConfiguration creates a hosted compute network configuration for an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations#create-a-hosted-compute-network-configuration-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations?apiVersion=2022-11-28#create-a-hosted-compute-network-configuration-for-an-enterprise // //meta:operation POST /enterprises/{enterprise}/network-configurations func (s *EnterpriseService) CreateEnterpriseNetworkConfiguration(ctx context.Context, enterprise string, createReq NetworkConfigurationRequest) (*NetworkConfiguration, *Response, error) { @@ -46,13 +47,13 @@ func (s *EnterpriseService) CreateEnterpriseNetworkConfiguration(ctx context.Con } u := fmt.Sprintf("enterprises/%v/network-configurations", enterprise) - req, err := s.client.NewRequest("POST", u, createReq) + req, err := s.client.NewRequest(ctx, "POST", u, createReq) if err != nil { return nil, nil, err } - network := &NetworkConfiguration{} - resp, err := s.client.Do(ctx, req, network) + var network *NetworkConfiguration + resp, err := s.client.Do(req, &network) if err != nil { return nil, resp, err } @@ -62,27 +63,28 @@ func (s *EnterpriseService) CreateEnterpriseNetworkConfiguration(ctx context.Con // GetEnterpriseNetworkConfiguration gets a hosted compute network configuration configured in an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations#get-a-hosted-compute-network-configuration-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations?apiVersion=2022-11-28#get-a-hosted-compute-network-configuration-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/network-configurations/{network_configuration_id} func (s *EnterpriseService) GetEnterpriseNetworkConfiguration(ctx context.Context, enterprise, networkID string) (*NetworkConfiguration, *Response, error) { u := fmt.Sprintf("enterprises/%v/network-configurations/%v", enterprise, networkID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - network := &NetworkConfiguration{} - resp, err := s.client.Do(ctx, req, network) + var network *NetworkConfiguration + resp, err := s.client.Do(req, &network) if err != nil { return nil, resp, err } + return network, resp, nil } // UpdateEnterpriseNetworkConfiguration updates a hosted compute network configuration for an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations#update-a-hosted-compute-network-configuration-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations?apiVersion=2022-11-28#update-a-hosted-compute-network-configuration-for-an-enterprise // //meta:operation PATCH /enterprises/{enterprise}/network-configurations/{network_configuration_id} func (s *EnterpriseService) UpdateEnterpriseNetworkConfiguration(ctx context.Context, enterprise, networkID string, updateReq NetworkConfigurationRequest) (*NetworkConfiguration, *Response, error) { @@ -91,49 +93,52 @@ func (s *EnterpriseService) UpdateEnterpriseNetworkConfiguration(ctx context.Con } u := fmt.Sprintf("enterprises/%v/network-configurations/%v", enterprise, networkID) - req, err := s.client.NewRequest("PATCH", u, updateReq) + req, err := s.client.NewRequest(ctx, "PATCH", u, updateReq) if err != nil { return nil, nil, err } - network := &NetworkConfiguration{} - resp, err := s.client.Do(ctx, req, network) + var network *NetworkConfiguration + resp, err := s.client.Do(req, &network) if err != nil { return nil, resp, err } + return network, resp, nil } // DeleteEnterpriseNetworkConfiguration deletes a hosted compute network configuration from an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations#delete-a-hosted-compute-network-configuration-from-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations?apiVersion=2022-11-28#delete-a-hosted-compute-network-configuration-from-an-enterprise // //meta:operation DELETE /enterprises/{enterprise}/network-configurations/{network_configuration_id} func (s *EnterpriseService) DeleteEnterpriseNetworkConfiguration(ctx context.Context, enterprise, networkID string) (*Response, error) { u := fmt.Sprintf("enterprises/%v/network-configurations/%v", enterprise, networkID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + + return s.client.Do(req, nil) } // GetEnterpriseNetworkSettingsResource gets a hosted compute network settings resource configured for an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations#get-a-hosted-compute-network-settings-resource-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations?apiVersion=2022-11-28#get-a-hosted-compute-network-settings-resource-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/network-settings/{network_settings_id} func (s *EnterpriseService) GetEnterpriseNetworkSettingsResource(ctx context.Context, enterprise, networkID string) (*NetworkSettingsResource, *Response, error) { u := fmt.Sprintf("enterprises/%v/network-settings/%v", enterprise, networkID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - resource := &NetworkSettingsResource{} - resp, err := s.client.Do(ctx, req, resource) + var resource *NetworkSettingsResource + resp, err := s.client.Do(req, &resource) if err != nil { return nil, resp, err } + return resource, resp, err } diff --git a/vendor/github.com/google/go-github/v88/github/enterprise_organization_properties.go b/vendor/github.com/google/go-github/v88/github/enterprise_organization_properties.go new file mode 100644 index 000000000..fcd782094 --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/enterprise_organization_properties.go @@ -0,0 +1,189 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// EnterpriseCustomPropertySchema represents the schema response for GetEnterpriseCustomPropertiesSchema. +type EnterpriseCustomPropertySchema struct { + // An ordered list of the custom property defined in the enterprise. + Properties []*CustomProperty `json:"properties,omitempty"` +} + +// EnterpriseCustomPropertiesValues represents the custom properties values for an organization within an enterprise. +type EnterpriseCustomPropertiesValues struct { + // The Organization ID that the custom property values will be applied to. + OrganizationID *int64 `json:"organization_id,omitempty"` + // The names of organizations that the custom property values will be applied to. + OrganizationLogin *string `json:"organization_login,omitempty"` + // List of custom property names and associated values to apply to the organizations. + Properties []*CustomPropertyValue `json:"properties,omitempty"` +} + +// EnterpriseCustomPropertyValuesRequest represents the request to update custom property values for organizations within an enterprise. +type EnterpriseCustomPropertyValuesRequest struct { + // The names of organizations that the custom property values will be applied to. + // OrganizationLogin specifies the organization name when updating multiple organizations. + OrganizationLogin []string `json:"organization_login"` + // List of custom property names and associated values to apply to the organizations. + Properties []*CustomPropertyValue `json:"properties"` +} + +// GetOrganizationCustomPropertySchema gets all organization custom property definitions that are defined on an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties-for-orgs?apiVersion=2022-11-28#get-organization-custom-properties-schema-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/org-properties/schema +func (s *EnterpriseService) GetOrganizationCustomPropertySchema(ctx context.Context, enterprise string) (*EnterpriseCustomPropertySchema, *Response, error) { + u := fmt.Sprintf("enterprises/%v/org-properties/schema", enterprise) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var schema *EnterpriseCustomPropertySchema + resp, err := s.client.Do(req, &schema) + if err != nil { + return nil, resp, err + } + + return schema, resp, nil +} + +// CreateOrUpdateOrganizationCustomPropertySchema creates new or updates existing organization custom properties defined on an enterprise in a batch. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties-for-orgs?apiVersion=2022-11-28#create-or-update-organization-custom-property-definitions-on-an-enterprise +// +//meta:operation PATCH /enterprises/{enterprise}/org-properties/schema +func (s *EnterpriseService) CreateOrUpdateOrganizationCustomPropertySchema(ctx context.Context, enterprise string, schema EnterpriseCustomPropertySchema) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/org-properties/schema", enterprise) + req, err := s.client.NewRequest(ctx, "PATCH", u, schema) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// GetOrganizationCustomProperty retrieves a specific organization custom property definition from an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties-for-orgs?apiVersion=2022-11-28#get-an-organization-custom-property-definition-from-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/org-properties/schema/{custom_property_name} +func (s *EnterpriseService) GetOrganizationCustomProperty(ctx context.Context, enterprise, customPropertyName string) (*CustomProperty, *Response, error) { + u := fmt.Sprintf("enterprises/%v/org-properties/schema/%v", enterprise, customPropertyName) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var property *CustomProperty + resp, err := s.client.Do(req, &property) + if err != nil { + return nil, resp, err + } + + return property, resp, nil +} + +// CreateOrUpdateOrganizationCustomProperty creates a new or updates an existing organization custom property definition that is defined on an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties-for-orgs?apiVersion=2022-11-28#create-or-update-an-organization-custom-property-definition-on-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/org-properties/schema/{custom_property_name} +func (s *EnterpriseService) CreateOrUpdateOrganizationCustomProperty(ctx context.Context, enterprise, customPropertyName string, property CustomProperty) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/org-properties/schema/%v", enterprise, customPropertyName) + req, err := s.client.NewRequest(ctx, "PUT", u, property) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// DeleteOrganizationCustomProperty removes an organization custom property definition that is defined on an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties-for-orgs?apiVersion=2022-11-28#remove-an-organization-custom-property-definition-from-an-enterprise +// +//meta:operation DELETE /enterprises/{enterprise}/org-properties/schema/{custom_property_name} +func (s *EnterpriseService) DeleteOrganizationCustomProperty(ctx context.Context, enterprise, customPropertyName string) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/org-properties/schema/%v", enterprise, customPropertyName) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// ListOrganizationCustomPropertyValues lists enterprise organizations with all of their custom property values. +// Returns a list of organizations and their custom property values defined in the enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties-for-orgs?apiVersion=2022-11-28#list-custom-property-values-for-organizations-in-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/org-properties/values +func (s *EnterpriseService) ListOrganizationCustomPropertyValues(ctx context.Context, enterprise string, opts *ListOptions) ([]*EnterpriseCustomPropertiesValues, *Response, error) { + u := fmt.Sprintf("enterprises/%v/org-properties/values", enterprise) + + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var values []*EnterpriseCustomPropertiesValues + resp, err := s.client.Do(req, &values) + if err != nil { + return nil, resp, err + } + + return values, resp, nil +} + +// CreateOrUpdateOrganizationCustomPropertyValues creates or updates custom property values for organizations in an enterprise. +// To remove a custom property value from an organization, set the property value to null. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties-for-orgs?apiVersion=2022-11-28#create-or-update-custom-property-values-for-organizations-in-an-enterprise +// +//meta:operation PATCH /enterprises/{enterprise}/org-properties/values +func (s *EnterpriseService) CreateOrUpdateOrganizationCustomPropertyValues(ctx context.Context, enterprise string, values EnterpriseCustomPropertyValuesRequest) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/org-properties/values", enterprise) + req, err := s.client.NewRequest(ctx, "PATCH", u, values) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/vendor/github.com/google/go-github/v73/github/enterprise_properties.go b/vendor/github.com/google/go-github/v88/github/enterprise_properties.go similarity index 76% rename from vendor/github.com/google/go-github/v73/github/enterprise_properties.go rename to vendor/github.com/google/go-github/v88/github/enterprise_properties.go index bc5ab55a3..926cb6e2f 100644 --- a/vendor/github.com/google/go-github/v73/github/enterprise_properties.go +++ b/vendor/github.com/google/go-github/v88/github/enterprise_properties.go @@ -12,19 +12,19 @@ import ( // GetAllCustomProperties gets all custom properties that are defined for the specified enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties#get-custom-properties-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties?apiVersion=2022-11-28#get-custom-properties-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/properties/schema func (s *EnterpriseService) GetAllCustomProperties(ctx context.Context, enterprise string) ([]*CustomProperty, *Response, error) { u := fmt.Sprintf("enterprises/%v/properties/schema", enterprise) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var customProperties []*CustomProperty - resp, err := s.client.Do(ctx, req, &customProperties) + resp, err := s.client.Do(req, &customProperties) if err != nil { return nil, resp, err } @@ -34,7 +34,7 @@ func (s *EnterpriseService) GetAllCustomProperties(ctx context.Context, enterpri // CreateOrUpdateCustomProperties creates new or updates existing custom properties that are defined for the specified enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties#create-or-update-custom-properties-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties?apiVersion=2022-11-28#create-or-update-custom-properties-for-an-enterprise // //meta:operation PATCH /enterprises/{enterprise}/properties/schema func (s *EnterpriseService) CreateOrUpdateCustomProperties(ctx context.Context, enterprise string, properties []*CustomProperty) ([]*CustomProperty, *Response, error) { @@ -46,13 +46,13 @@ func (s *EnterpriseService) CreateOrUpdateCustomProperties(ctx context.Context, Properties: properties, } - req, err := s.client.NewRequest("PATCH", u, params) + req, err := s.client.NewRequest(ctx, "PATCH", u, params) if err != nil { return nil, nil, err } var customProperties []*CustomProperty - resp, err := s.client.Do(ctx, req, &customProperties) + resp, err := s.client.Do(req, &customProperties) if err != nil { return nil, resp, err } @@ -62,19 +62,19 @@ func (s *EnterpriseService) CreateOrUpdateCustomProperties(ctx context.Context, // GetCustomProperty gets a custom property that is defined for the specified enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties#get-a-custom-property-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties?apiVersion=2022-11-28#get-a-custom-property-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/properties/schema/{custom_property_name} func (s *EnterpriseService) GetCustomProperty(ctx context.Context, enterprise, customPropertyName string) (*CustomProperty, *Response, error) { u := fmt.Sprintf("enterprises/%v/properties/schema/%v", enterprise, customPropertyName) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var customProperty *CustomProperty - resp, err := s.client.Do(ctx, req, &customProperty) + resp, err := s.client.Do(req, &customProperty) if err != nil { return nil, resp, err } @@ -84,19 +84,19 @@ func (s *EnterpriseService) GetCustomProperty(ctx context.Context, enterprise, c // CreateOrUpdateCustomProperty creates a new or updates an existing custom property that is defined for the specified enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties#create-or-update-a-custom-property-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties?apiVersion=2022-11-28#create-or-update-a-custom-property-for-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/properties/schema/{custom_property_name} func (s *EnterpriseService) CreateOrUpdateCustomProperty(ctx context.Context, enterprise, customPropertyName string, property *CustomProperty) (*CustomProperty, *Response, error) { u := fmt.Sprintf("enterprises/%v/properties/schema/%v", enterprise, customPropertyName) - req, err := s.client.NewRequest("PUT", u, property) + req, err := s.client.NewRequest(ctx, "PUT", u, property) if err != nil { return nil, nil, err } var customProperty *CustomProperty - resp, err := s.client.Do(ctx, req, &customProperty) + resp, err := s.client.Do(req, &customProperty) if err != nil { return nil, resp, err } @@ -106,16 +106,16 @@ func (s *EnterpriseService) CreateOrUpdateCustomProperty(ctx context.Context, en // RemoveCustomProperty removes a custom property that is defined for the specified enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties#remove-a-custom-property-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties?apiVersion=2022-11-28#remove-a-custom-property-for-an-enterprise // //meta:operation DELETE /enterprises/{enterprise}/properties/schema/{custom_property_name} func (s *EnterpriseService) RemoveCustomProperty(ctx context.Context, enterprise, customPropertyName string) (*Response, error) { u := fmt.Sprintf("enterprises/%v/properties/schema/%v", enterprise, customPropertyName) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/enterprise_rules.go b/vendor/github.com/google/go-github/v88/github/enterprise_rules.go similarity index 60% rename from vendor/github.com/google/go-github/v73/github/enterprise_rules.go rename to vendor/github.com/google/go-github/v88/github/enterprise_rules.go index f43822337..401ad94e7 100644 --- a/vendor/github.com/google/go-github/v73/github/enterprise_rules.go +++ b/vendor/github.com/google/go-github/v88/github/enterprise_rules.go @@ -12,19 +12,19 @@ import ( // CreateRepositoryRuleset creates a repository ruleset for the specified enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/rules#create-an-enterprise-repository-ruleset +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/rules?apiVersion=2022-11-28#create-an-enterprise-repository-ruleset // //meta:operation POST /enterprises/{enterprise}/rulesets func (s *EnterpriseService) CreateRepositoryRuleset(ctx context.Context, enterprise string, ruleset RepositoryRuleset) (*RepositoryRuleset, *Response, error) { u := fmt.Sprintf("enterprises/%v/rulesets", enterprise) - req, err := s.client.NewRequest("POST", u, ruleset) + req, err := s.client.NewRequest(ctx, "POST", u, ruleset) if err != nil { return nil, nil, err } var rs *RepositoryRuleset - resp, err := s.client.Do(ctx, req, &rs) + resp, err := s.client.Do(req, &rs) if err != nil { return nil, resp, err } @@ -34,19 +34,19 @@ func (s *EnterpriseService) CreateRepositoryRuleset(ctx context.Context, enterpr // GetRepositoryRuleset gets a repository ruleset for the specified enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/rules#get-an-enterprise-repository-ruleset +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/rules?apiVersion=2022-11-28#get-an-enterprise-repository-ruleset // //meta:operation GET /enterprises/{enterprise}/rulesets/{ruleset_id} func (s *EnterpriseService) GetRepositoryRuleset(ctx context.Context, enterprise string, rulesetID int64) (*RepositoryRuleset, *Response, error) { u := fmt.Sprintf("enterprises/%v/rulesets/%v", enterprise, rulesetID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var ruleset *RepositoryRuleset - resp, err := s.client.Do(ctx, req, &ruleset) + resp, err := s.client.Do(req, &ruleset) if err != nil { return nil, resp, err } @@ -56,19 +56,19 @@ func (s *EnterpriseService) GetRepositoryRuleset(ctx context.Context, enterprise // UpdateRepositoryRuleset updates a repository ruleset for the specified enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/rules#update-an-enterprise-repository-ruleset +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/rules?apiVersion=2022-11-28#update-an-enterprise-repository-ruleset // //meta:operation PUT /enterprises/{enterprise}/rulesets/{ruleset_id} func (s *EnterpriseService) UpdateRepositoryRuleset(ctx context.Context, enterprise string, rulesetID int64, ruleset RepositoryRuleset) (*RepositoryRuleset, *Response, error) { u := fmt.Sprintf("enterprises/%v/rulesets/%v", enterprise, rulesetID) - req, err := s.client.NewRequest("PUT", u, ruleset) + req, err := s.client.NewRequest(ctx, "PUT", u, ruleset) if err != nil { return nil, nil, err } var rs *RepositoryRuleset - resp, err := s.client.Do(ctx, req, &rs) + resp, err := s.client.Do(req, &rs) if err != nil { return nil, resp, err } @@ -76,43 +76,18 @@ func (s *EnterpriseService) UpdateRepositoryRuleset(ctx context.Context, enterpr return rs, resp, nil } -// UpdateRepositoryRulesetClearBypassActor clears the bypass actors for a repository ruleset for the specified enterprise. -// -// This function is necessary as the UpdateRepositoryRuleset function does not marshal ByPassActor if passed as an empty array. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/rules#update-an-enterprise-repository-ruleset -// -//meta:operation PUT /enterprises/{enterprise}/rulesets/{ruleset_id} -func (s *EnterpriseService) UpdateRepositoryRulesetClearBypassActor(ctx context.Context, enterprise string, rulesetID int64) (*Response, error) { - u := fmt.Sprintf("enterprises/%v/rulesets/%v", enterprise, rulesetID) - - rsClearBypassActor := rulesetClearBypassActors{} - - req, err := s.client.NewRequest("PUT", u, rsClearBypassActor) - if err != nil { - return nil, err - } - - resp, err := s.client.Do(ctx, req, nil) - if err != nil { - return resp, err - } - - return resp, nil -} - // DeleteRepositoryRuleset deletes a repository ruleset from the specified enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/rules#delete-an-enterprise-repository-ruleset +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/rules?apiVersion=2022-11-28#delete-an-enterprise-repository-ruleset // //meta:operation DELETE /enterprises/{enterprise}/rulesets/{ruleset_id} func (s *EnterpriseService) DeleteRepositoryRuleset(ctx context.Context, enterprise string, rulesetID int64) (*Response, error) { u := fmt.Sprintf("enterprises/%v/rulesets/%v", enterprise, rulesetID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v88/github/enterprise_scim.go b/vendor/github.com/google/go-github/v88/github/enterprise_scim.go new file mode 100644 index 000000000..acc5d2e4f --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/enterprise_scim.go @@ -0,0 +1,481 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// SCIMSchemasURINamespacesGroups is the SCIM schema URI namespace for group resources. +// This constant represents the standard SCIM core schema for group objects as defined by RFC 7643. +const SCIMSchemasURINamespacesGroups = "urn:ietf:params:scim:schemas:core:2.0:Group" + +// SCIMSchemasURINamespacesUser is the SCIM schema URI namespace for user resources. +// This constant represents the standard SCIM core schema for user objects as defined by RFC 7643. +const SCIMSchemasURINamespacesUser = "urn:ietf:params:scim:schemas:core:2.0:User" + +// SCIMSchemasURINamespacesListResponse is the SCIM schema URI namespace for list response resources. +// This constant represents the standard SCIM namespace for list responses used in paginated queries, as defined by RFC 7644. +const SCIMSchemasURINamespacesListResponse = "urn:ietf:params:scim:api:messages:2.0:ListResponse" + +// SCIMSchemasURINamespacesPatchOp is the SCIM schema URI namespace for patch operations. +// This constant represents the standard SCIM namespace for patch operations as defined by RFC 7644. +const SCIMSchemasURINamespacesPatchOp = "urn:ietf:params:scim:api:messages:2.0:PatchOp" + +// SCIMEnterpriseGroupAttributes represents supported SCIM Enterprise group attributes, and represents the result of calling UpdateSCIMGroupAttribute. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#supported-scim-group-attributes +type SCIMEnterpriseGroupAttributes struct { + DisplayName *string `json:"displayName,omitempty"` // Human-readable name for a group. + Members []*SCIMEnterpriseDisplayReference `json:"members,omitempty"` // List of members who are assigned to the group in SCIM provider + ExternalID *string `json:"externalId,omitempty"` // This identifier is generated by a SCIM provider. Must be unique per group. + Schemas []string `json:"schemas,omitempty"` // The URIs that are used to indicate the namespaces of the SCIM schemas. + // Bellow: Only populated as a result of calling UpdateSCIMGroupAttribute: + ID *string `json:"id,omitempty"` // The internally generated id for the group object. + Meta *SCIMEnterpriseMeta `json:"meta,omitempty"` // The metadata associated with the creation/updates to the group. +} + +// SCIMEnterpriseDisplayReference represents a JSON SCIM (System for Cross-domain Identity Management) resource reference. +type SCIMEnterpriseDisplayReference struct { + Value string `json:"value"` // The local unique identifier for the member (e.g., user ID or group ID). + Ref *string `json:"$ref,omitempty"` // The URI reference to the Members or Groups resource (e.g., /scim/v2/enterprises/{enterprise}/Users/{scim_user_id}). + Display *string `json:"display,omitempty"` // The display name associated with the member (e.g., user name or group name). +} + +// SCIMEnterpriseMeta represents metadata about the SCIM resource. +type SCIMEnterpriseMeta struct { + ResourceType string `json:"resourceType"` // A type of a resource (`User` or `Group`). + Created *Timestamp `json:"created,omitempty"` // A date and time when the user was created. + LastModified *Timestamp `json:"lastModified,omitempty"` // A date and time when the user was last modified. + Location *string `json:"location,omitempty"` // A URL location of an object +} + +// SCIMEnterpriseGroups represents the result of calling ListProvisionedSCIMGroups. +type SCIMEnterpriseGroups struct { + Schemas []string `json:"schemas,omitempty"` + TotalResults *int `json:"totalResults,omitempty"` + Resources []*SCIMEnterpriseGroupAttributes `json:"Resources,omitempty"` + StartIndex *int `json:"startIndex,omitempty"` + ItemsPerPage *int `json:"itemsPerPage,omitempty"` +} + +// ListProvisionedSCIMGroupsEnterpriseOptions represents query parameters for ListProvisionedSCIMGroups. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#list-provisioned-scim-groups-for-an-enterprise--parameters +type ListProvisionedSCIMGroupsEnterpriseOptions struct { + // If specified, only results that match the specified filter will be returned. + // Possible filters are `externalId`, `id`, and `displayName`. For example, `externalId eq "a123"`. + Filter *string `url:"filter,omitempty"` + // Excludes the specified attributes from being returned in the results. + ExcludedAttributes *string `url:"excludedAttributes,omitempty"` + // Used for pagination: the starting index of the first result to return when paginating through values. + // Default: 1. + StartIndex *int `url:"startIndex,omitempty"` + // Used for pagination: the number of results to return per page. + // Default: 30. + Count *int `url:"count,omitempty"` +} + +// GetProvisionedSCIMGroupEnterpriseOptions represents query parameters for GetProvisionedSCIMGroup. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#get-scim-provisioning-information-for-an-enterprise-group +type GetProvisionedSCIMGroupEnterpriseOptions struct { + // Excludes the specified attributes from being returned in the results. + ExcludedAttributes *string `url:"excludedAttributes,omitempty"` +} + +// SCIMEnterpriseUserAttributes represents supported SCIM enterprise user attributes, and represents the result of calling UpdateSCIMUserAttribute. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#supported-scim-user-attributes +type SCIMEnterpriseUserAttributes struct { + DisplayName string `json:"displayName"` // Human-readable name for a user + Name *SCIMEnterpriseUserName `json:"name,omitempty"` // The user's full name + UserName string `json:"userName"` // The username for the user (GitHub Account after normalized), generated by the SCIM provider. Must be unique per user. + Emails []*SCIMEnterpriseUserEmail `json:"emails"` // List of the user's emails. They all must be unique per user. + Roles []*SCIMEnterpriseUserRole `json:"roles,omitempty"` // List of the user's roles. + ExternalID string `json:"externalId"` // This identifier is generated by a SCIM provider. Must be unique per user. + Active bool `json:"active"` // Indicates whether the identity is active (true) or should be suspended (false). + Schemas []string `json:"schemas"` // The URIs that are used to indicate the namespaces of the SCIM schemas. + // Bellow: Only populated as a result of calling UpdateSCIMUserAttribute: + ID *string `json:"id,omitempty"` // Identifier generated by the GitHub's SCIM endpoint. + Groups []*SCIMEnterpriseDisplayReference `json:"groups,omitempty"` // List of groups who are assigned to the user in SCIM provider + Meta *SCIMEnterpriseMeta `json:"meta,omitempty"` // The metadata associated with the creation/updates to the user. +} + +// SCIMEnterpriseUserName represents SCIM enterprise user's name information. +type SCIMEnterpriseUserName struct { + GivenName string `json:"givenName"` // The first name of the user. + FamilyName string `json:"familyName"` // The last name of the user. + Formatted *string `json:"formatted,omitempty"` // The user's full name, including all middle names, titles, and suffixes, formatted for display. + MiddleName *string `json:"middleName,omitempty"` // The middle name(s) of the user. +} + +// SCIMEnterpriseUserEmail represents SCIM enterprise user's emails. +type SCIMEnterpriseUserEmail struct { + Value string `json:"value"` // The email address. + Primary bool `json:"primary"` // Whether this email address is the primary address. + Type string `json:"type"` // The type of email address +} + +// SCIMEnterpriseUserRole is an enterprise-wide role granted to the user. +type SCIMEnterpriseUserRole struct { + Value string `json:"value"` // The role value representing a user role in GitHub. + Display *string `json:"display,omitempty"` + Type *string `json:"type,omitempty"` + Primary *bool `json:"primary,omitempty"` // Is the role a primary role for the user? +} + +// SCIMEnterpriseUsers represents the result of calling ListProvisionedSCIMUsers. +type SCIMEnterpriseUsers struct { + Schemas []string `json:"schemas,omitempty"` + TotalResults *int `json:"totalResults,omitempty"` + ItemsPerPage *int `json:"itemsPerPage,omitempty"` + StartIndex *int `json:"startIndex,omitempty"` + Resources []*SCIMEnterpriseUserAttributes `json:"Resources,omitempty"` +} + +// ListProvisionedSCIMUsersEnterpriseOptions represents query parameters for ListProvisionedSCIMUsers. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#list-scim-provisioned-identities-for-an-enterprise +type ListProvisionedSCIMUsersEnterpriseOptions struct { + // If specified, only results that match the specified filter will be returned. + // Possible filters are `userName`, `externalId`, `id`, and `displayName`. For example, `externalId eq "a123"`. + Filter *string `url:"filter,omitempty"` + // Used for pagination: the starting index of the first result to return when paginating through values. + // Default: 1. + StartIndex *int `url:"startIndex,omitempty"` + // Used for pagination: the number of results to return per page. + // Default: 30. + Count *int `url:"count,omitempty"` +} + +// SCIMEnterpriseAttribute represents attribute operations for UpdateSCIMGroupAttribute or UpdateSCIMUserAttribute. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#update-an-attribute-for-a-scim-enterprise-group +type SCIMEnterpriseAttribute struct { + Schemas []string `json:"schemas"` // The URIs that are used to indicate the namespaces for a SCIM patch operation. + Operations []*SCIMEnterpriseAttributeOperation `json:"Operations"` // Set of operations to be performed. +} + +// SCIMEnterpriseAttributeOperation represents an operation for UpdateSCIMGroupAttribute or UpdateSCIMUserAttribute. +type SCIMEnterpriseAttributeOperation struct { + Op string `json:"op"` // Can be one of: `add`, `replace`, `remove`. + Path *string `json:"path,omitempty"` // Path to the attribute being modified (Filters are not supported). + Value any `json:"value,omitempty"` // New value for the attribute being modified. +} + +// ListProvisionedSCIMGroups lists provisioned SCIM groups in an enterprise. +// +// You can improve query search time by using the `excludedAttributes` and +// exclude the specified attributes, e.g. `members` to exclude members from the +// response. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#list-provisioned-scim-groups-for-an-enterprise +// +//meta:operation GET /scim/v2/enterprises/{enterprise}/Groups +func (s *EnterpriseService) ListProvisionedSCIMGroups(ctx context.Context, enterprise string, opts *ListProvisionedSCIMGroupsEnterpriseOptions) (*SCIMEnterpriseGroups, *Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Groups", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + var groups *SCIMEnterpriseGroups + resp, err := s.client.Do(req, &groups) + if err != nil { + return nil, resp, err + } + + return groups, resp, nil +} + +// ListProvisionedSCIMUsers lists provisioned SCIM enterprise users. +// +// When members are part of the group provisioning payload, they're designated +// as external group members. Providers are responsible for maintaining a +// mapping between the `externalId` and `id` for each user. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#list-scim-provisioned-identities-for-an-enterprise +// +//meta:operation GET /scim/v2/enterprises/{enterprise}/Users +func (s *EnterpriseService) ListProvisionedSCIMUsers(ctx context.Context, enterprise string, opts *ListProvisionedSCIMUsersEnterpriseOptions) (*SCIMEnterpriseUsers, *Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Users", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + var users *SCIMEnterpriseUsers + resp, err := s.client.Do(req, &users) + if err != nil { + return nil, resp, err + } + + return users, resp, nil +} + +// SetProvisionedSCIMGroup replaces an existing provisioned group’s information. +// +// You must provide all the information required for the group as if you were provisioning it for the first time. Any +// existing group information that you don't provide will be removed, including group membership. To update only +// specific attributes, refer to the `Enterprise.UpdateSCIMGroupAttribute()` method. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#set-scim-information-for-a-provisioned-enterprise-group +// +//meta:operation PUT /scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} +func (s *EnterpriseService) SetProvisionedSCIMGroup(ctx context.Context, enterprise, scimGroupID string, group SCIMEnterpriseGroupAttributes) (*SCIMEnterpriseGroupAttributes, *Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Groups/%v", enterprise, scimGroupID) + req, err := s.client.NewRequest(ctx, "PUT", u, group) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + var groupNew *SCIMEnterpriseGroupAttributes + resp, err := s.client.Do(req, &groupNew) + if err != nil { + return nil, resp, err + } + + return groupNew, resp, nil +} + +// SetProvisionedSCIMUser replaces an existing provisioned user's information. +// +// You must supply complete user information, just as you would when provisioning them initially. Any previously +// existing data not provided will be deleted. To update specific attributes only, refer to the +// `Enterprise.UpdateSCIMUserAttribute()` method. +// +// **Warning**: Setting `active: false` will suspend a user, and their handle and email will be obfuscated. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#set-scim-information-for-a-provisioned-enterprise-user +// +//meta:operation PUT /scim/v2/enterprises/{enterprise}/Users/{scim_user_id} +func (s *EnterpriseService) SetProvisionedSCIMUser(ctx context.Context, enterprise, scimUserID string, user SCIMEnterpriseUserAttributes) (*SCIMEnterpriseUserAttributes, *Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Users/%v", enterprise, scimUserID) + req, err := s.client.NewRequest(ctx, "PUT", u, user) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + var userNew *SCIMEnterpriseUserAttributes + resp, err := s.client.Do(req, &userNew) + if err != nil { + return nil, resp, err + } + + return userNew, resp, nil +} + +// UpdateSCIMGroupAttribute updates a provisioned group’s individual attributes. +// +// The `attribute` parameter must include at least one of the following +// Operations: `add`, `remove`, or `replace`. +// +// The update function can also be used to add group memberships. +// +// You can submit group memberships individually or in batches for improved +// efficiency. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#update-an-attribute-for-a-scim-enterprise-group +// +//meta:operation PATCH /scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} +func (s *EnterpriseService) UpdateSCIMGroupAttribute(ctx context.Context, enterprise, scimGroupID string, attribute SCIMEnterpriseAttribute) (*SCIMEnterpriseGroupAttributes, *Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Groups/%v", enterprise, scimGroupID) + req, err := s.client.NewRequest(ctx, "PATCH", u, attribute) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + var group *SCIMEnterpriseGroupAttributes + resp, err := s.client.Do(req, &group) + if err != nil { + return nil, resp, err + } + + return group, resp, nil +} + +// UpdateSCIMUserAttribute updates a provisioned user's individual attributes. +// +// The `attribute` parameter must include at least one of the following +// Operations: `add`, `remove`, or `replace`. +// +// Note: Complex SCIM path selectors that include filters are not supported. +// For example, a path selector defined as `"path": "emails[type eq \"work\"]"` +// will be ineffective. +// +// Warning: Setting `active: false` will suspend a user, and their handle and +// email will be obfuscated. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#update-an-attribute-for-a-scim-enterprise-user +// +//meta:operation PATCH /scim/v2/enterprises/{enterprise}/Users/{scim_user_id} +func (s *EnterpriseService) UpdateSCIMUserAttribute(ctx context.Context, enterprise, scimUserID string, attribute SCIMEnterpriseAttribute) (*SCIMEnterpriseUserAttributes, *Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Users/%v", enterprise, scimUserID) + req, err := s.client.NewRequest(ctx, "PATCH", u, attribute) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + var user *SCIMEnterpriseUserAttributes + resp, err := s.client.Do(req, &user) + if err != nil { + return nil, resp, err + } + + return user, resp, nil +} + +// ProvisionSCIMGroup creates a SCIM group for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#provision-a-scim-enterprise-group +// +//meta:operation POST /scim/v2/enterprises/{enterprise}/Groups +func (s *EnterpriseService) ProvisionSCIMGroup(ctx context.Context, enterprise string, group SCIMEnterpriseGroupAttributes) (*SCIMEnterpriseGroupAttributes, *Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Groups", enterprise) + req, err := s.client.NewRequest(ctx, "POST", u, group) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + var groupProvisioned *SCIMEnterpriseGroupAttributes + resp, err := s.client.Do(req, &groupProvisioned) + if err != nil { + return nil, resp, err + } + + return groupProvisioned, resp, nil +} + +// ProvisionSCIMUser creates an external identity for a new SCIM enterprise user. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#provision-a-scim-enterprise-user +// +//meta:operation POST /scim/v2/enterprises/{enterprise}/Users +func (s *EnterpriseService) ProvisionSCIMUser(ctx context.Context, enterprise string, user SCIMEnterpriseUserAttributes) (*SCIMEnterpriseUserAttributes, *Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Users", enterprise) + req, err := s.client.NewRequest(ctx, "POST", u, user) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + var userProvisioned *SCIMEnterpriseUserAttributes + resp, err := s.client.Do(req, &userProvisioned) + if err != nil { + return nil, resp, err + } + + return userProvisioned, resp, nil +} + +// GetProvisionedSCIMGroup gets information about a SCIM group. +// +// You can use the `excludedAttributes` from `opts` and exclude the specified +// attributes from being returned in the results. Using this parameter can +// speed up response time. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#get-scim-provisioning-information-for-an-enterprise-group +// +//meta:operation GET /scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} +func (s *EnterpriseService) GetProvisionedSCIMGroup(ctx context.Context, enterprise, scimGroupID string, opts *GetProvisionedSCIMGroupEnterpriseOptions) (*SCIMEnterpriseGroupAttributes, *Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Groups/%v", enterprise, scimGroupID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + var group *SCIMEnterpriseGroupAttributes + resp, err := s.client.Do(req, &group) + if err != nil { + return nil, resp, err + } + + return group, resp, nil +} + +// GetProvisionedSCIMUser gets information about a SCIM user. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#get-scim-provisioning-information-for-an-enterprise-user +// +//meta:operation GET /scim/v2/enterprises/{enterprise}/Users/{scim_user_id} +func (s *EnterpriseService) GetProvisionedSCIMUser(ctx context.Context, enterprise, scimUserID string) (*SCIMEnterpriseUserAttributes, *Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Users/%v", enterprise, scimUserID) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + var user *SCIMEnterpriseUserAttributes + resp, err := s.client.Do(req, &user) + if err != nil { + return nil, resp, err + } + + return user, resp, nil +} + +// DeleteSCIMGroup deletes a SCIM group from an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#delete-a-scim-group-from-an-enterprise +// +//meta:operation DELETE /scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} +func (s *EnterpriseService) DeleteSCIMGroup(ctx context.Context, enterprise, scimGroupID string) (*Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Groups/%v", enterprise, scimGroupID) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// DeleteSCIMUser deletes a SCIM user from an enterprise. +// +// Suspends a SCIM user permanently from an enterprise. This action will: +// remove all the user's data, anonymize their login, email, and display name, +// erase all external identity SCIM attributes, delete the user's emails, +// avatar, PATs, SSH keys, OAuth authorizations, GPG keys, and SAML mappings. +// This action is irreversible. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#delete-a-scim-user-from-an-enterprise +// +//meta:operation DELETE /scim/v2/enterprises/{enterprise}/Users/{scim_user_id} +func (s *EnterpriseService) DeleteSCIMUser(ctx context.Context, enterprise, scimUserID string) (*Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Users/%v", enterprise, scimUserID) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v88/github/enterprise_team.go b/vendor/github.com/google/go-github/v88/github/enterprise_team.go new file mode 100644 index 000000000..4f267b61a --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/enterprise_team.go @@ -0,0 +1,420 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// EnterpriseTeam represent a team in a GitHub Enterprise. +type EnterpriseTeam struct { + ID int64 `json:"id"` + URL string `json:"url"` + MemberURL string `json:"member_url"` + Name string `json:"name"` + Description *string `json:"description,omitempty"` + HTMLURL string `json:"html_url"` + Slug string `json:"slug"` + CreatedAt Timestamp `json:"created_at"` + UpdatedAt Timestamp `json:"updated_at"` + GroupID string `json:"group_id"` + OrganizationSelectionType *string `json:"organization_selection_type,omitempty"` +} + +// EnterpriseTeamCreateOrUpdateRequest is used to create or update an enterprise team. +type EnterpriseTeamCreateOrUpdateRequest struct { + // The name of the team. + Name string `json:"name"` + // A description of the team. + Description *string `json:"description,omitempty"` + // Specifies which organizations in the enterprise should have access to this team. + // Possible values are "disabled" , "all" and "selected". If not specified, the default is "disabled". + OrganizationSelectionType *string `json:"organization_selection_type,omitempty"` + // The ID of the IdP group to assign team membership with. + GroupID *string `json:"group_id,omitempty"` +} + +// ListTeams lists all teams in an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-teams?apiVersion=2022-11-28#list-enterprise-teams +// +//meta:operation GET /enterprises/{enterprise}/teams +func (s *EnterpriseService) ListTeams(ctx context.Context, enterprise string, opts *ListOptions) ([]*EnterpriseTeam, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var teams []*EnterpriseTeam + resp, err := s.client.Do(req, &teams) + if err != nil { + return nil, resp, err + } + + return teams, resp, nil +} + +// CreateTeam creates a new team in an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-teams?apiVersion=2022-11-28#create-an-enterprise-team +// +//meta:operation POST /enterprises/{enterprise}/teams +func (s *EnterpriseService) CreateTeam(ctx context.Context, enterprise string, team EnterpriseTeamCreateOrUpdateRequest) (*EnterpriseTeam, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams", enterprise) + + req, err := s.client.NewRequest(ctx, "POST", u, team) + if err != nil { + return nil, nil, err + } + + var createdTeam *EnterpriseTeam + resp, err := s.client.Do(req, &createdTeam) + if err != nil { + return nil, resp, err + } + + return createdTeam, resp, nil +} + +// GetTeam retrieves a team in an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-teams?apiVersion=2022-11-28#get-an-enterprise-team +// +//meta:operation GET /enterprises/{enterprise}/teams/{team_slug} +func (s *EnterpriseService) GetTeam(ctx context.Context, enterprise, teamSlug string) (*EnterpriseTeam, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v", enterprise, teamSlug) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var team *EnterpriseTeam + resp, err := s.client.Do(req, &team) + if err != nil { + return nil, resp, err + } + + return team, resp, nil +} + +// UpdateTeam updates a team in an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-teams?apiVersion=2022-11-28#update-an-enterprise-team +// +//meta:operation PATCH /enterprises/{enterprise}/teams/{team_slug} +func (s *EnterpriseService) UpdateTeam(ctx context.Context, enterprise, teamSlug string, team EnterpriseTeamCreateOrUpdateRequest) (*EnterpriseTeam, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v", enterprise, teamSlug) + + req, err := s.client.NewRequest(ctx, "PATCH", u, team) + if err != nil { + return nil, nil, err + } + + var updatedTeam *EnterpriseTeam + resp, err := s.client.Do(req, &updatedTeam) + if err != nil { + return nil, resp, err + } + + return updatedTeam, resp, nil +} + +// DeleteTeam deletes a team in an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-teams?apiVersion=2022-11-28#delete-an-enterprise-team +// +//meta:operation DELETE /enterprises/{enterprise}/teams/{team_slug} +func (s *EnterpriseService) DeleteTeam(ctx context.Context, enterprise, teamSlug string) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v", enterprise, teamSlug) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// ListTeamMembers lists all members of an enterprise team. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-members?apiVersion=2022-11-28#list-members-in-an-enterprise-team +// +//meta:operation GET /enterprises/{enterprise}/teams/{enterprise-team}/memberships +func (s *EnterpriseService) ListTeamMembers(ctx context.Context, enterprise, enterpriseTeam string, opts *ListOptions) ([]*User, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v/memberships", enterprise, enterpriseTeam) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var members []*User + resp, err := s.client.Do(req, &members) + if err != nil { + return nil, resp, err + } + + return members, resp, nil +} + +// BulkAddTeamMembers adds multiple members to an enterprise team. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-members?apiVersion=2022-11-28#bulk-add-team-members +// +//meta:operation POST /enterprises/{enterprise}/teams/{enterprise-team}/memberships/add +func (s *EnterpriseService) BulkAddTeamMembers(ctx context.Context, enterprise, enterpriseTeam string, username []string) ([]*User, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v/memberships/add", enterprise, enterpriseTeam) + req, err := s.client.NewRequest(ctx, "POST", u, map[string][]string{"usernames": username}) + if err != nil { + return nil, nil, err + } + + var members []*User + resp, err := s.client.Do(req, &members) + if err != nil { + return nil, resp, err + } + + return members, resp, nil +} + +// BulkRemoveTeamMembers removes multiple members from an enterprise team. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-members?apiVersion=2022-11-28#bulk-remove-team-members +// +//meta:operation POST /enterprises/{enterprise}/teams/{enterprise-team}/memberships/remove +func (s *EnterpriseService) BulkRemoveTeamMembers(ctx context.Context, enterprise, enterpriseTeam string, username []string) ([]*User, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v/memberships/remove", enterprise, enterpriseTeam) + req, err := s.client.NewRequest(ctx, "POST", u, map[string][]string{"usernames": username}) + if err != nil { + return nil, nil, err + } + + var members []*User + resp, err := s.client.Do(req, &members) + if err != nil { + return nil, resp, err + } + + return members, resp, nil +} + +// GetTeamMembership retrieves a team membership for a user in an enterprise team. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-members?apiVersion=2022-11-28#get-enterprise-team-membership +// +//meta:operation GET /enterprises/{enterprise}/teams/{enterprise-team}/memberships/{username} +func (s *EnterpriseService) GetTeamMembership(ctx context.Context, enterprise, enterpriseTeam, username string) (*User, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v/memberships/%v", enterprise, enterpriseTeam, username) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var membership *User + resp, err := s.client.Do(req, &membership) + if err != nil { + return nil, resp, err + } + + return membership, resp, nil +} + +// AddTeamMember adds a member to an enterprise team. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-members?apiVersion=2022-11-28#add-team-member +// +//meta:operation PUT /enterprises/{enterprise}/teams/{enterprise-team}/memberships/{username} +func (s *EnterpriseService) AddTeamMember(ctx context.Context, enterprise, enterpriseTeam, username string) (*User, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v/memberships/%v", enterprise, enterpriseTeam, username) + + req, err := s.client.NewRequest(ctx, "PUT", u, nil) + if err != nil { + return nil, nil, err + } + + var member *User + resp, err := s.client.Do(req, &member) + if err != nil { + return nil, resp, err + } + + return member, resp, nil +} + +// RemoveTeamMember removes a member from an enterprise team. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-members?apiVersion=2022-11-28#remove-team-membership +// +//meta:operation DELETE /enterprises/{enterprise}/teams/{enterprise-team}/memberships/{username} +func (s *EnterpriseService) RemoveTeamMember(ctx context.Context, enterprise, enterpriseTeam, username string) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v/memberships/%v", enterprise, enterpriseTeam, username) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// ListAssignments gets all organizations assigned to an enterprise team. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-organizations?apiVersion=2022-11-28#get-organization-assignments +// +//meta:operation GET /enterprises/{enterprise}/teams/{enterprise-team}/organizations +func (s *EnterpriseService) ListAssignments(ctx context.Context, enterprise, enterpriseTeam string, opts *ListOptions) ([]*Organization, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v/organizations", enterprise, enterpriseTeam) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var orgs []*Organization + resp, err := s.client.Do(req, &orgs) + if err != nil { + return nil, resp, err + } + + return orgs, resp, nil +} + +// AddMultipleAssignments assigns an enterprise team to multiple organizations. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-organizations?apiVersion=2022-11-28#add-organization-assignments +// +//meta:operation POST /enterprises/{enterprise}/teams/{enterprise-team}/organizations/add +func (s *EnterpriseService) AddMultipleAssignments(ctx context.Context, enterprise, enterpriseTeam string, organizationSlugs []string) ([]*Organization, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v/organizations/add", enterprise, enterpriseTeam) + + req, err := s.client.NewRequest(ctx, "POST", u, map[string][]string{"organization_slugs": organizationSlugs}) + if err != nil { + return nil, nil, err + } + + var orgs []*Organization + resp, err := s.client.Do(req, &orgs) + if err != nil { + return nil, resp, err + } + + return orgs, resp, nil +} + +// RemoveMultipleAssignments unassigns an enterprise team from multiple organizations. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-organizations?apiVersion=2022-11-28#remove-organization-assignments +// +//meta:operation POST /enterprises/{enterprise}/teams/{enterprise-team}/organizations/remove +func (s *EnterpriseService) RemoveMultipleAssignments(ctx context.Context, enterprise, enterpriseTeam string, organizationSlugs []string) ([]*Organization, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v/organizations/remove", enterprise, enterpriseTeam) + + req, err := s.client.NewRequest(ctx, "POST", u, map[string][]string{"organization_slugs": organizationSlugs}) + if err != nil { + return nil, nil, err + } + + var orgs []*Organization + resp, err := s.client.Do(req, &orgs) + if err != nil { + return nil, resp, err + } + + return orgs, resp, nil +} + +// GetAssignment checks if an enterprise team is assigned to an organization. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-organizations?apiVersion=2022-11-28#get-organization-assignment +// +//meta:operation GET /enterprises/{enterprise}/teams/{enterprise-team}/organizations/{org} +func (s *EnterpriseService) GetAssignment(ctx context.Context, enterprise, enterpriseTeam, org string) (*Organization, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v/organizations/%v", enterprise, enterpriseTeam, org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var organization *Organization + resp, err := s.client.Do(req, &organization) + if err != nil { + return nil, resp, err + } + + return organization, resp, nil +} + +// AddAssignment assigns an enterprise team to an organizations. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-organizations?apiVersion=2022-11-28#add-an-organization-assignment +// +//meta:operation PUT /enterprises/{enterprise}/teams/{enterprise-team}/organizations/{org} +func (s *EnterpriseService) AddAssignment(ctx context.Context, enterprise, enterpriseTeam, org string) (*Organization, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v/organizations/%v", enterprise, enterpriseTeam, org) + + req, err := s.client.NewRequest(ctx, "PUT", u, nil) + if err != nil { + return nil, nil, err + } + + var organization *Organization + resp, err := s.client.Do(req, &organization) + if err != nil { + return nil, resp, err + } + + return organization, resp, nil +} + +// RemoveAssignment unassigns an enterprise team from an organizations. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-organizations?apiVersion=2022-11-28#delete-an-organization-assignment +// +//meta:operation DELETE /enterprises/{enterprise}/teams/{enterprise-team}/organizations/{org} +func (s *EnterpriseService) RemoveAssignment(ctx context.Context, enterprise, enterpriseTeam, org string) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v/organizations/%v", enterprise, enterpriseTeam, org) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/vendor/github.com/google/go-github/v73/github/event.go b/vendor/github.com/google/go-github/v88/github/event.go similarity index 100% rename from vendor/github.com/google/go-github/v73/github/event.go rename to vendor/github.com/google/go-github/v88/github/event.go diff --git a/vendor/github.com/google/go-github/v73/github/event_types.go b/vendor/github.com/google/go-github/v88/github/event_types.go similarity index 96% rename from vendor/github.com/google/go-github/v73/github/event_types.go rename to vendor/github.com/google/go-github/v88/github/event_types.go index 3aa151e5c..de4223cdd 100644 --- a/vendor/github.com/google/go-github/v73/github/event_types.go +++ b/vendor/github.com/google/go-github/v88/github/event_types.go @@ -265,7 +265,7 @@ type DeploymentProtectionRuleEvent struct { Environment *string `json:"environment,omitempty"` Event *string `json:"event,omitempty"` - // The URL Github provides for a third-party to use in order to pass/fail a deployment gate + // The URL GitHub provides for a third-party to use in order to pass/fail a deployment gate DeploymentCallbackURL *string `json:"deployment_callback_url,omitempty"` Deployment *Deployment `json:"deployment,omitempty"` Repo *Repository `json:"repository,omitempty"` @@ -354,6 +354,12 @@ type DiscussionCommentEvent struct { // CommentDiscussion represents a comment in a GitHub DiscussionCommentEvent. type CommentDiscussion struct { + // AuthorAssociation is the comment author's relationship to the repository. + // Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE". + // + // Deprecated: GitHub will remove this field from Events API payloads on October 7, 2025. + // Use the Discussions REST API endpoint to retrieve this information. + // See: https://docs.github.com/rest/discussions/comments?apiVersion=2022-11-28#get-a-discussion-comment AuthorAssociation *string `json:"author_association,omitempty"` Body *string `json:"body,omitempty"` ChildCommentCount *int `json:"child_comment_count,omitempty"` @@ -403,9 +409,15 @@ type Discussion struct { Comments *int `json:"comments,omitempty"` CreatedAt *Timestamp `json:"created_at,omitempty"` UpdatedAt *Timestamp `json:"updated_at,omitempty"` - AuthorAssociation *string `json:"author_association,omitempty"` - ActiveLockReason *string `json:"active_lock_reason,omitempty"` - Body *string `json:"body,omitempty"` + // AuthorAssociation is the discussion author's relationship to the repository. + // Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE". + // + // Deprecated: GitHub will remove this field from Events API payloads on October 7, 2025. + // Use the Discussions REST API endpoint to retrieve this information. + // See: https://docs.github.com/rest/discussions/discussions?apiVersion=2022-11-28#get-a-discussion + AuthorAssociation *string `json:"author_association,omitempty"` + ActiveLockReason *string `json:"active_lock_reason,omitempty"` + Body *string `json:"body,omitempty"` } // DiscussionCategory represents a discussion category in a GitHub DiscussionEvent. @@ -847,7 +859,7 @@ type MergeGroup struct { HeadRef *string `json:"head_ref,omitempty"` // The SHA of the merge group's parent commit. BaseSHA *string `json:"base_sha,omitempty"` - // The full ref of the branch the merge group will be merged into. + // The full ref of the branch into which the merge group will be merged. BaseRef *string `json:"base_ref,omitempty"` // An expanded representation of the head_sha commit. HeadCommit *Commit `json:"head_commit,omitempty"` @@ -1099,35 +1111,6 @@ type ProjectV2Event struct { Sender *User `json:"sender,omitempty"` } -// ProjectV2 represents a v2 project. -type ProjectV2 struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Owner *User `json:"owner,omitempty"` - Creator *User `json:"creator,omitempty"` - Title *string `json:"title,omitempty"` - Description *string `json:"description,omitempty"` - Public *bool `json:"public,omitempty"` - ClosedAt *Timestamp `json:"closed_at,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - DeletedAt *Timestamp `json:"deleted_at,omitempty"` - Number *int `json:"number,omitempty"` - ShortDescription *string `json:"short_description,omitempty"` - DeletedBy *User `json:"deleted_by,omitempty"` - - // Fields migrated from the Project (classic) struct: - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - ColumnsURL *string `json:"columns_url,omitempty"` - OwnerURL *string `json:"owner_url,omitempty"` - Name *string `json:"name,omitempty"` - Body *string `json:"body,omitempty"` - State *string `json:"state,omitempty"` - OrganizationPermission *string `json:"organization_permission,omitempty"` - Private *bool `json:"private,omitempty"` -} - // ProjectV2ItemEvent is triggered when there is activity relating to an item on an organization-level project. // The Webhook event name is "projects_v2_item". // @@ -1146,6 +1129,7 @@ type ProjectV2ItemEvent struct { // ProjectV2ItemChange represents a project v2 item change. type ProjectV2ItemChange struct { ArchivedAt *ArchivedAt `json:"archived_at,omitempty"` + FieldValue *FieldValue `json:"field_value,omitempty"` } // ArchivedAt represents an archiving date change. @@ -1154,17 +1138,14 @@ type ArchivedAt struct { To *Timestamp `json:"to,omitempty"` } -// ProjectV2Item represents an item belonging to a project. -type ProjectV2Item struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - ProjectNodeID *string `json:"project_node_id,omitempty"` - ContentNodeID *string `json:"content_node_id,omitempty"` - ContentType *string `json:"content_type,omitempty"` - Creator *User `json:"creator,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - ArchivedAt *Timestamp `json:"archived_at,omitempty"` +// FieldValue represents an editing field value change. +type FieldValue struct { + FieldNodeID *string `json:"field_node_id,omitempty"` + FieldType *string `json:"field_type,omitempty"` + FieldName *string `json:"field_name,omitempty"` + ProjectNumber *int64 `json:"project_number,omitempty"` + From json.RawMessage `json:"from,omitempty"` + To json.RawMessage `json:"to,omitempty"` } // PublicEvent is triggered when a private repository is open sourced. @@ -1214,7 +1195,8 @@ type PullRequestEvent struct { Repo *Repository `json:"repository,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` - Label *Label `json:"label,omitempty"` // Populated in "labeled" event deliveries. + Label *Label `json:"label,omitempty"` // Populated in "labeled" event deliveries. + Reason *string `json:"reason,omitempty"` // Populated in "dequeued" event deliveries. // The following field is only present when the webhook is triggered on // a repository belonging to an organization. @@ -1343,13 +1325,29 @@ type PullRequestTargetEvent struct { // // GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#push type PushEvent struct { - PushID *int64 `json:"push_id,omitempty"` - Head *string `json:"head,omitempty"` - Ref *string `json:"ref,omitempty"` - Size *int `json:"size,omitempty"` - Commits []*HeadCommit `json:"commits,omitempty"` - Before *string `json:"before,omitempty"` - DistinctSize *int `json:"distinct_size,omitempty"` + PushID *int64 `json:"push_id,omitempty"` + Head *string `json:"head,omitempty"` + Ref *string `json:"ref,omitempty"` + // Size is the number of commits in the push. + // + // Deprecated: GitHub will remove commit counts from Events API payloads on October 7, 2025. + // Use the Commits REST API endpoint to get commit information. + // See: https://docs.github.com/rest/commits/commits?apiVersion=2022-11-28#list-commits + Size *int `json:"size,omitempty"` + // Commits is the list of commits in the push event. + // + // This field is only populated for webhook events. + // It has been removed from Events API payloads on October 7, 2025. + // Use the Commits REST API endpoint to get detailed commit information. + // See: https://docs.github.com/rest/commits/commits?apiVersion=2022-11-28#list-commits + Commits []*HeadCommit `json:"commits,omitempty"` + Before *string `json:"before,omitempty"` + // DistinctSize is the number of distinct commits in the push. + // + // Deprecated: GitHub will remove commit counts from Events API payloads on October 7, 2025. + // Use the Compare REST API endpoint to get detailed comparison information. + // See: https://docs.github.com/rest/commits/commits?apiVersion=2022-11-28#compare-two-commits + DistinctSize *int `json:"distinct_size,omitempty"` // The following fields are only populated by Webhook events. Action *string `json:"action,omitempty"` @@ -1835,7 +1833,7 @@ type WatchEvent struct { } // WorkflowDispatchEvent is triggered when someone triggers a workflow run on GitHub or -// sends a POST request to the create a workflow dispatch event endpoint. +// sends a POST request to the endpoint to create a workflow dispatch event. // // GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#workflow_dispatch type WorkflowDispatchEvent struct { @@ -1936,8 +1934,8 @@ type AdvisoryVulnerability struct { FirstPatchedVersion *FirstPatchedVersion `json:"first_patched_version,omitempty"` // PatchedVersions and VulnerableFunctions are used in the following APIs: - // - https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories-for-an-organization - // - https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories + // - https://docs.github.com/rest/security-advisories/repository-advisories?apiVersion=2022-11-28#list-repository-security-advisories-for-an-organization + // - https://docs.github.com/rest/security-advisories/repository-advisories?apiVersion=2022-11-28#list-repository-security-advisories PatchedVersions *string `json:"patched_versions,omitempty"` VulnerableFunctions []string `json:"vulnerable_functions,omitempty"` } @@ -1986,7 +1984,7 @@ type CodeScanningAlertEvent struct { // SponsorshipEvent represents a sponsorship event in GitHub. // -// GitHub API docs: https://docs.github.com/en/rest/overview/github-event-types?apiVersion=2022-11-28#sponsorshipevent +// GitHub API docs: https://docs.github.com/rest/overview/github-event-types?apiVersion=2022-11-28#sponsorshipevent type SponsorshipEvent struct { Action *string `json:"action,omitempty"` EffectiveDate *string `json:"effective_date,omitempty"` diff --git a/vendor/github.com/google/go-github/v73/github/gists.go b/vendor/github.com/google/go-github/v88/github/gists.go similarity index 73% rename from vendor/github.com/google/go-github/v73/github/gists.go rename to vendor/github.com/google/go-github/v88/github/gists.go index ee4314b98..3994ea182 100644 --- a/vendor/github.com/google/go-github/v73/github/gists.go +++ b/vendor/github.com/google/go-github/v88/github/gists.go @@ -14,7 +14,7 @@ import ( // GistsService handles communication with the Gist related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/gists +// GitHub API docs: https://docs.github.com/rest/gists?apiVersion=2022-11-28 type GistsService service // Gist represents a GitHub's gist. @@ -96,8 +96,9 @@ type GistListOptions struct { // is authenticated, it will returns all gists for the authenticated // user. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#list-gists-for-a-user -// GitHub API docs: https://docs.github.com/rest/gists/gists#list-gists-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#list-gists-for-a-user +// +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#list-gists-for-the-authenticated-user // //meta:operation GET /gists //meta:operation GET /users/{username}/gists @@ -113,13 +114,13 @@ func (s *GistsService) List(ctx context.Context, user string, opts *GistListOpti return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var gists []*Gist - resp, err := s.client.Do(ctx, req, &gists) + resp, err := s.client.Do(req, &gists) if err != nil { return nil, resp, err } @@ -129,7 +130,7 @@ func (s *GistsService) List(ctx context.Context, user string, opts *GistListOpti // ListAll lists all public gists. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#list-public-gists +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#list-public-gists // //meta:operation GET /gists/public func (s *GistsService) ListAll(ctx context.Context, opts *GistListOptions) ([]*Gist, *Response, error) { @@ -138,13 +139,13 @@ func (s *GistsService) ListAll(ctx context.Context, opts *GistListOptions) ([]*G return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var gists []*Gist - resp, err := s.client.Do(ctx, req, &gists) + resp, err := s.client.Do(req, &gists) if err != nil { return nil, resp, err } @@ -154,7 +155,7 @@ func (s *GistsService) ListAll(ctx context.Context, opts *GistListOptions) ([]*G // ListStarred lists starred gists of authenticated user. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#list-starred-gists +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#list-starred-gists // //meta:operation GET /gists/starred func (s *GistsService) ListStarred(ctx context.Context, opts *GistListOptions) ([]*Gist, *Response, error) { @@ -163,13 +164,13 @@ func (s *GistsService) ListStarred(ctx context.Context, opts *GistListOptions) ( return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var gists []*Gist - resp, err := s.client.Do(ctx, req, &gists) + resp, err := s.client.Do(req, &gists) if err != nil { return nil, resp, err } @@ -179,18 +180,18 @@ func (s *GistsService) ListStarred(ctx context.Context, opts *GistListOptions) ( // Get a single gist. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#get-a-gist +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#get-a-gist // //meta:operation GET /gists/{gist_id} func (s *GistsService) Get(ctx context.Context, id string) (*Gist, *Response, error) { u := fmt.Sprintf("gists/%v", id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - gist := new(Gist) - resp, err := s.client.Do(ctx, req, gist) + var gist *Gist + resp, err := s.client.Do(req, &gist) if err != nil { return nil, resp, err } @@ -200,18 +201,18 @@ func (s *GistsService) Get(ctx context.Context, id string) (*Gist, *Response, er // GetRevision gets a specific revision of a gist. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#get-a-gist-revision +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#get-a-gist-revision // //meta:operation GET /gists/{gist_id}/{sha} func (s *GistsService) GetRevision(ctx context.Context, id, sha string) (*Gist, *Response, error) { u := fmt.Sprintf("gists/%v/%v", id, sha) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - gist := new(Gist) - resp, err := s.client.Do(ctx, req, gist) + var gist *Gist + resp, err := s.client.Do(req, &gist) if err != nil { return nil, resp, err } @@ -221,18 +222,18 @@ func (s *GistsService) GetRevision(ctx context.Context, id, sha string) (*Gist, // Create a gist for authenticated user. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#create-a-gist +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#create-a-gist // //meta:operation POST /gists func (s *GistsService) Create(ctx context.Context, gist *Gist) (*Gist, *Response, error) { u := "gists" - req, err := s.client.NewRequest("POST", u, gist) + req, err := s.client.NewRequest(ctx, "POST", u, gist) if err != nil { return nil, nil, err } - g := new(Gist) - resp, err := s.client.Do(ctx, req, g) + var g *Gist + resp, err := s.client.Do(req, &g) if err != nil { return nil, resp, err } @@ -242,18 +243,18 @@ func (s *GistsService) Create(ctx context.Context, gist *Gist) (*Gist, *Response // Edit a gist. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#update-a-gist +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#update-a-gist // //meta:operation PATCH /gists/{gist_id} func (s *GistsService) Edit(ctx context.Context, id string, gist *Gist) (*Gist, *Response, error) { u := fmt.Sprintf("gists/%v", id) - req, err := s.client.NewRequest("PATCH", u, gist) + req, err := s.client.NewRequest(ctx, "PATCH", u, gist) if err != nil { return nil, nil, err } - g := new(Gist) - resp, err := s.client.Do(ctx, req, g) + var g *Gist + resp, err := s.client.Do(req, &g) if err != nil { return nil, resp, err } @@ -263,7 +264,7 @@ func (s *GistsService) Edit(ctx context.Context, id string, gist *Gist) (*Gist, // ListCommits lists commits of a gist. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#list-gist-commits +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#list-gist-commits // //meta:operation GET /gists/{gist_id}/commits func (s *GistsService) ListCommits(ctx context.Context, id string, opts *ListOptions) ([]*GistCommit, *Response, error) { @@ -273,13 +274,13 @@ func (s *GistsService) ListCommits(ctx context.Context, id string, opts *ListOpt return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var gistCommits []*GistCommit - resp, err := s.client.Do(ctx, req, &gistCommits) + resp, err := s.client.Do(req, &gistCommits) if err != nil { return nil, resp, err } @@ -289,80 +290,80 @@ func (s *GistsService) ListCommits(ctx context.Context, id string, opts *ListOpt // Delete a gist. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#delete-a-gist +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#delete-a-gist // //meta:operation DELETE /gists/{gist_id} func (s *GistsService) Delete(ctx context.Context, id string) (*Response, error) { u := fmt.Sprintf("gists/%v", id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // Star a gist on behalf of authenticated user. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#star-a-gist +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#star-a-gist // //meta:operation PUT /gists/{gist_id}/star func (s *GistsService) Star(ctx context.Context, id string) (*Response, error) { u := fmt.Sprintf("gists/%v/star", id) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // Unstar a gist on a behalf of authenticated user. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#unstar-a-gist +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#unstar-a-gist // //meta:operation DELETE /gists/{gist_id}/star func (s *GistsService) Unstar(ctx context.Context, id string) (*Response, error) { u := fmt.Sprintf("gists/%v/star", id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // IsStarred checks if a gist is starred by authenticated user. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#check-if-a-gist-is-starred +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#check-if-a-gist-is-starred // //meta:operation GET /gists/{gist_id}/star func (s *GistsService) IsStarred(ctx context.Context, id string) (bool, *Response, error) { u := fmt.Sprintf("gists/%v/star", id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return false, nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) starred, err := parseBoolResponse(err) return starred, resp, err } // Fork a gist. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#fork-a-gist +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#fork-a-gist // //meta:operation POST /gists/{gist_id}/forks func (s *GistsService) Fork(ctx context.Context, id string) (*Gist, *Response, error) { u := fmt.Sprintf("gists/%v/forks", id) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - g := new(Gist) - resp, err := s.client.Do(ctx, req, g) + var g *Gist + resp, err := s.client.Do(req, &g) if err != nil { return nil, resp, err } @@ -372,7 +373,7 @@ func (s *GistsService) Fork(ctx context.Context, id string) (*Gist, *Response, e // ListForks lists forks of a gist. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#list-gist-forks +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#list-gist-forks // //meta:operation GET /gists/{gist_id}/forks func (s *GistsService) ListForks(ctx context.Context, id string, opts *ListOptions) ([]*GistFork, *Response, error) { @@ -382,13 +383,13 @@ func (s *GistsService) ListForks(ctx context.Context, id string, opts *ListOptio return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var gistForks []*GistFork - resp, err := s.client.Do(ctx, req, &gistForks) + resp, err := s.client.Do(req, &gistForks) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/gists_comments.go b/vendor/github.com/google/go-github/v88/github/gists_comments.go similarity index 71% rename from vendor/github.com/google/go-github/v73/github/gists_comments.go rename to vendor/github.com/google/go-github/v88/github/gists_comments.go index 5e0614231..dc3082cf0 100644 --- a/vendor/github.com/google/go-github/v73/github/gists_comments.go +++ b/vendor/github.com/google/go-github/v88/github/gists_comments.go @@ -25,7 +25,7 @@ func (g GistComment) String() string { // ListComments lists all comments for a gist. // -// GitHub API docs: https://docs.github.com/rest/gists/comments#list-gist-comments +// GitHub API docs: https://docs.github.com/rest/gists/comments?apiVersion=2022-11-28#list-gist-comments // //meta:operation GET /gists/{gist_id}/comments func (s *GistsService) ListComments(ctx context.Context, gistID string, opts *ListOptions) ([]*GistComment, *Response, error) { @@ -35,13 +35,13 @@ func (s *GistsService) ListComments(ctx context.Context, gistID string, opts *Li return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var comments []*GistComment - resp, err := s.client.Do(ctx, req, &comments) + resp, err := s.client.Do(req, &comments) if err != nil { return nil, resp, err } @@ -51,18 +51,18 @@ func (s *GistsService) ListComments(ctx context.Context, gistID string, opts *Li // GetComment retrieves a single comment from a gist. // -// GitHub API docs: https://docs.github.com/rest/gists/comments#get-a-gist-comment +// GitHub API docs: https://docs.github.com/rest/gists/comments?apiVersion=2022-11-28#get-a-gist-comment // //meta:operation GET /gists/{gist_id}/comments/{comment_id} func (s *GistsService) GetComment(ctx context.Context, gistID string, commentID int64) (*GistComment, *Response, error) { u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - c := new(GistComment) - resp, err := s.client.Do(ctx, req, c) + var c *GistComment + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -72,18 +72,18 @@ func (s *GistsService) GetComment(ctx context.Context, gistID string, commentID // CreateComment creates a comment for a gist. // -// GitHub API docs: https://docs.github.com/rest/gists/comments#create-a-gist-comment +// GitHub API docs: https://docs.github.com/rest/gists/comments?apiVersion=2022-11-28#create-a-gist-comment // //meta:operation POST /gists/{gist_id}/comments func (s *GistsService) CreateComment(ctx context.Context, gistID string, comment *GistComment) (*GistComment, *Response, error) { u := fmt.Sprintf("gists/%v/comments", gistID) - req, err := s.client.NewRequest("POST", u, comment) + req, err := s.client.NewRequest(ctx, "POST", u, comment) if err != nil { return nil, nil, err } - c := new(GistComment) - resp, err := s.client.Do(ctx, req, c) + var c *GistComment + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -93,18 +93,18 @@ func (s *GistsService) CreateComment(ctx context.Context, gistID string, comment // EditComment edits an existing gist comment. // -// GitHub API docs: https://docs.github.com/rest/gists/comments#update-a-gist-comment +// GitHub API docs: https://docs.github.com/rest/gists/comments?apiVersion=2022-11-28#update-a-gist-comment // //meta:operation PATCH /gists/{gist_id}/comments/{comment_id} func (s *GistsService) EditComment(ctx context.Context, gistID string, commentID int64, comment *GistComment) (*GistComment, *Response, error) { u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID) - req, err := s.client.NewRequest("PATCH", u, comment) + req, err := s.client.NewRequest(ctx, "PATCH", u, comment) if err != nil { return nil, nil, err } - c := new(GistComment) - resp, err := s.client.Do(ctx, req, c) + var c *GistComment + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -114,15 +114,15 @@ func (s *GistsService) EditComment(ctx context.Context, gistID string, commentID // DeleteComment deletes a gist comment. // -// GitHub API docs: https://docs.github.com/rest/gists/comments#delete-a-gist-comment +// GitHub API docs: https://docs.github.com/rest/gists/comments?apiVersion=2022-11-28#delete-a-gist-comment // //meta:operation DELETE /gists/{gist_id}/comments/{comment_id} func (s *GistsService) DeleteComment(ctx context.Context, gistID string, commentID int64) (*Response, error) { u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/git.go b/vendor/github.com/google/go-github/v88/github/git.go similarity index 80% rename from vendor/github.com/google/go-github/v73/github/git.go rename to vendor/github.com/google/go-github/v88/github/git.go index 2ca835e1b..ce172cd06 100644 --- a/vendor/github.com/google/go-github/v73/github/git.go +++ b/vendor/github.com/google/go-github/v88/github/git.go @@ -8,5 +8,5 @@ package github // GitService handles communication with the git data related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/git/ +// GitHub API docs: https://docs.github.com/rest/git?apiVersion=2022-11-28 type GitService service diff --git a/vendor/github.com/google/go-github/v73/github/git_blobs.go b/vendor/github.com/google/go-github/v88/github/git_blobs.go similarity index 67% rename from vendor/github.com/google/go-github/v73/github/git_blobs.go rename to vendor/github.com/google/go-github/v88/github/git_blobs.go index d89042888..cbba9bd79 100644 --- a/vendor/github.com/google/go-github/v73/github/git_blobs.go +++ b/vendor/github.com/google/go-github/v88/github/git_blobs.go @@ -23,18 +23,18 @@ type Blob struct { // GetBlob fetches a blob from a repo given a SHA. // -// GitHub API docs: https://docs.github.com/rest/git/blobs#get-a-blob +// GitHub API docs: https://docs.github.com/rest/git/blobs?apiVersion=2022-11-28#get-a-blob // //meta:operation GET /repos/{owner}/{repo}/git/blobs/{file_sha} -func (s *GitService) GetBlob(ctx context.Context, owner string, repo string, sha string) (*Blob, *Response, error) { +func (s *GitService) GetBlob(ctx context.Context, owner, repo, sha string) (*Blob, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/blobs/%v", owner, repo, sha) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - blob := new(Blob) - resp, err := s.client.Do(ctx, req, blob) + var blob *Blob + resp, err := s.client.Do(req, &blob) if err != nil { return nil, resp, err } @@ -45,12 +45,12 @@ func (s *GitService) GetBlob(ctx context.Context, owner string, repo string, sha // GetBlobRaw fetches a blob's contents from a repo. // Unlike GetBlob, it returns the raw bytes rather than the base64-encoded data. // -// GitHub API docs: https://docs.github.com/rest/git/blobs#get-a-blob +// GitHub API docs: https://docs.github.com/rest/git/blobs?apiVersion=2022-11-28#get-a-blob // //meta:operation GET /repos/{owner}/{repo}/git/blobs/{file_sha} func (s *GitService) GetBlobRaw(ctx context.Context, owner, repo, sha string) ([]byte, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/blobs/%v", owner, repo, sha) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } @@ -58,7 +58,7 @@ func (s *GitService) GetBlobRaw(ctx context.Context, owner, repo, sha string) ([ req.Header.Set("Accept", "application/vnd.github.v3.raw") var buf bytes.Buffer - resp, err := s.client.Do(ctx, req, &buf) + resp, err := s.client.Do(req, &buf) if err != nil { return nil, resp, err } @@ -68,21 +68,21 @@ func (s *GitService) GetBlobRaw(ctx context.Context, owner, repo, sha string) ([ // CreateBlob creates a blob object. // -// GitHub API docs: https://docs.github.com/rest/git/blobs#create-a-blob +// GitHub API docs: https://docs.github.com/rest/git/blobs?apiVersion=2022-11-28#create-a-blob // //meta:operation POST /repos/{owner}/{repo}/git/blobs -func (s *GitService) CreateBlob(ctx context.Context, owner string, repo string, blob *Blob) (*Blob, *Response, error) { +func (s *GitService) CreateBlob(ctx context.Context, owner, repo string, blob Blob) (*Blob, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/blobs", owner, repo) - req, err := s.client.NewRequest("POST", u, blob) + req, err := s.client.NewRequest(ctx, "POST", u, blob) if err != nil { return nil, nil, err } - t := new(Blob) - resp, err := s.client.Do(ctx, req, t) + var v *Blob + resp, err := s.client.Do(req, &v) if err != nil { return nil, resp, err } - return t, resp, nil + return v, resp, nil } diff --git a/vendor/github.com/google/go-github/v73/github/git_commits.go b/vendor/github.com/google/go-github/v88/github/git_commits.go similarity index 84% rename from vendor/github.com/google/go-github/v73/github/git_commits.go rename to vendor/github.com/google/go-github/v88/github/git_commits.go index d7ed3ecbe..0efad197c 100644 --- a/vendor/github.com/google/go-github/v73/github/git_commits.go +++ b/vendor/github.com/google/go-github/v88/github/git_commits.go @@ -37,6 +37,7 @@ type MessageSigner interface { // MessageSignerFunc is a single function implementation of MessageSigner. type MessageSignerFunc func(w io.Writer, r io.Reader) error +// Sign implements the MessageSigner interface for MessageSignerFunc. func (f MessageSignerFunc) Sign(w io.Writer, r io.Reader) error { return f(w, r) } @@ -81,18 +82,18 @@ func (c CommitAuthor) String() string { // GetCommit fetches the Commit object for a given SHA. // -// GitHub API docs: https://docs.github.com/rest/git/commits#get-a-commit-object +// GitHub API docs: https://docs.github.com/rest/git/commits?apiVersion=2022-11-28#get-a-commit-object // //meta:operation GET /repos/{owner}/{repo}/git/commits/{commit_sha} -func (s *GitService) GetCommit(ctx context.Context, owner string, repo string, sha string) (*Commit, *Response, error) { +func (s *GitService) GetCommit(ctx context.Context, owner, repo, sha string) (*Commit, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/commits/%v", owner, repo, sha) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - c := new(Commit) - resp, err := s.client.Do(ctx, req, c) + var c *Commit + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -110,6 +111,8 @@ type createCommit struct { Signature *string `json:"signature,omitempty"` } +// CreateCommitOptions specifies optional parameters to creates +// a new commit in a repository. type CreateCommitOptions struct { // CreateCommit will sign the commit with this signer. See MessageSigner doc for more details. // Ignored on commits where Verification.Signature is defined. @@ -123,13 +126,10 @@ type CreateCommitOptions struct { // data if omitted. If the commit.Author is omitted, it will be filled in with // the authenticated user’s information and the current date. // -// GitHub API docs: https://docs.github.com/rest/git/commits#create-a-commit +// GitHub API docs: https://docs.github.com/rest/git/commits?apiVersion=2022-11-28#create-a-commit // //meta:operation POST /repos/{owner}/{repo}/git/commits -func (s *GitService) CreateCommit(ctx context.Context, owner string, repo string, commit *Commit, opts *CreateCommitOptions) (*Commit, *Response, error) { - if commit == nil { - return nil, nil, errors.New("commit must be provided") - } +func (s *GitService) CreateCommit(ctx context.Context, owner, repo string, commit Commit, opts *CreateCommitOptions) (*Commit, *Response, error) { if opts == nil { opts = &CreateCommitOptions{} } @@ -161,13 +161,13 @@ func (s *GitService) CreateCommit(ctx context.Context, owner string, repo string body.Signature = &signature } - req, err := s.client.NewRequest("POST", u, body) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - c := new(Commit) - resp, err := s.client.Do(ctx, req, c) + var c *Commit + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -202,14 +202,14 @@ func createSignatureMessage(commit *createCommit) (string, error) { var message []string if commit.Tree != nil { - message = append(message, fmt.Sprintf("tree %s", *commit.Tree)) + message = append(message, fmt.Sprintf("tree %v", *commit.Tree)) } for _, parent := range commit.Parents { - message = append(message, fmt.Sprintf("parent %s", parent)) + message = append(message, fmt.Sprintf("parent %v", parent)) } - message = append(message, fmt.Sprintf("author %s <%s> %d %s", commit.Author.GetName(), commit.Author.GetEmail(), commit.Author.GetDate().Unix(), commit.Author.GetDate().Format("-0700"))) + message = append(message, fmt.Sprintf("author %v <%v> %v %v", commit.Author.GetName(), commit.Author.GetEmail(), commit.Author.GetDate().Unix(), commit.Author.GetDate().Format("-0700"))) committer := commit.Committer if committer == nil { @@ -217,7 +217,7 @@ func createSignatureMessage(commit *createCommit) (string, error) { } // There needs to be a double newline after committer - message = append(message, fmt.Sprintf("committer %s <%s> %d %s\n", committer.GetName(), committer.GetEmail(), committer.GetDate().Unix(), committer.GetDate().Format("-0700"))) + message = append(message, fmt.Sprintf("committer %v <%v> %v %v\n", committer.GetName(), committer.GetEmail(), committer.GetDate().Unix(), committer.GetDate().Format("-0700"))) message = append(message, *commit.Message) return strings.Join(message, "\n"), nil diff --git a/vendor/github.com/google/go-github/v73/github/git_refs.go b/vendor/github.com/google/go-github/v88/github/git_refs.go similarity index 50% rename from vendor/github.com/google/go-github/v73/github/git_refs.go rename to vendor/github.com/google/go-github/v88/github/git_refs.go index 91eb6dd43..36dc52937 100644 --- a/vendor/github.com/google/go-github/v73/github/git_refs.go +++ b/vendor/github.com/google/go-github/v88/github/git_refs.go @@ -7,6 +7,7 @@ package github import ( "context" + "errors" "fmt" "net/url" "strings" @@ -14,6 +15,7 @@ import ( // Reference represents a GitHub reference. type Reference struct { + // The name of the fully qualified reference, i.e.: `refs/heads/master`. Ref *string `json:"ref"` URL *string `json:"url"` Object *GitObject `json:"object"` @@ -35,33 +37,34 @@ func (o GitObject) String() string { return Stringify(o) } -// createRefRequest represents the payload for creating a reference. -type createRefRequest struct { - Ref *string `json:"ref"` - SHA *string `json:"sha"` +// CreateRef represents the payload for creating a reference. +type CreateRef struct { + Ref string `json:"ref"` + SHA string `json:"sha"` } -// updateRefRequest represents the payload for updating a reference. -type updateRefRequest struct { - SHA *string `json:"sha"` - Force *bool `json:"force"` +// UpdateRef represents the payload for updating a reference. +type UpdateRef struct { + SHA string `json:"sha"` + Force *bool `json:"force,omitempty"` } // GetRef fetches a single reference in a repository. +// The ref must be formatted as `heads/` for branches and `tags/` for tags. // -// GitHub API docs: https://docs.github.com/rest/git/refs#get-a-reference +// GitHub API docs: https://docs.github.com/rest/git/refs?apiVersion=2022-11-28#get-a-reference // //meta:operation GET /repos/{owner}/{repo}/git/ref/{ref} -func (s *GitService) GetRef(ctx context.Context, owner string, repo string, ref string) (*Reference, *Response, error) { +func (s *GitService) GetRef(ctx context.Context, owner, repo, ref string) (*Reference, *Response, error) { ref = strings.TrimPrefix(ref, "refs/") u := fmt.Sprintf("repos/%v/%v/git/ref/%v", owner, repo, refURLEscape(ref)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - r := new(Reference) - resp, err := s.client.Do(ctx, req, r) + var r *Reference + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -79,38 +82,25 @@ func refURLEscape(ref string) string { return strings.Join(parts, "/") } -// ReferenceListOptions specifies optional parameters to the -// GitService.ListMatchingRefs method. -type ReferenceListOptions struct { - Ref string `url:"-"` - - ListOptions -} - // ListMatchingRefs lists references in a repository that match a supplied ref. +// The ref in the URL must be formatted as `heads/` for branches and `tags/` for tags. +// If the ref doesn't exist in the repository, but existing refs start with ref, they will be returned as an array. // Use an empty ref to list all references. // -// GitHub API docs: https://docs.github.com/rest/git/refs#list-matching-references +// GitHub API docs: https://docs.github.com/rest/git/refs?apiVersion=2022-11-28#list-matching-references // //meta:operation GET /repos/{owner}/{repo}/git/matching-refs/{ref} -func (s *GitService) ListMatchingRefs(ctx context.Context, owner, repo string, opts *ReferenceListOptions) ([]*Reference, *Response, error) { - var ref string - if opts != nil { - ref = strings.TrimPrefix(opts.Ref, "refs/") - } +func (s *GitService) ListMatchingRefs(ctx context.Context, owner, repo, ref string) ([]*Reference, *Response, error) { + ref = strings.TrimPrefix(ref, "refs/") // API expects no "refs/" prefix u := fmt.Sprintf("repos/%v/%v/git/matching-refs/%v", owner, repo, refURLEscape(ref)) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var rs []*Reference - resp, err := s.client.Do(ctx, req, &rs) + resp, err := s.client.Do(req, &rs) if err != nil { return nil, resp, err } @@ -120,22 +110,29 @@ func (s *GitService) ListMatchingRefs(ctx context.Context, owner, repo string, o // CreateRef creates a new ref in a repository. // -// GitHub API docs: https://docs.github.com/rest/git/refs#create-a-reference +// GitHub API docs: https://docs.github.com/rest/git/refs?apiVersion=2022-11-28#create-a-reference // //meta:operation POST /repos/{owner}/{repo}/git/refs -func (s *GitService) CreateRef(ctx context.Context, owner string, repo string, ref *Reference) (*Reference, *Response, error) { +func (s *GitService) CreateRef(ctx context.Context, owner, repo string, ref CreateRef) (*Reference, *Response, error) { + if ref.Ref == "" { + return nil, nil, errors.New("ref must be provided") + } + + if ref.SHA == "" { + return nil, nil, errors.New("sha must be provided") + } + + // ensure the 'refs/' prefix is present + ref.Ref = "refs/" + strings.TrimPrefix(ref.Ref, "refs/") + u := fmt.Sprintf("repos/%v/%v/git/refs", owner, repo) - req, err := s.client.NewRequest("POST", u, &createRefRequest{ - // back-compat with previous behavior that didn't require 'refs/' prefix - Ref: Ptr("refs/" + strings.TrimPrefix(*ref.Ref, "refs/")), - SHA: ref.Object.SHA, - }) + req, err := s.client.NewRequest(ctx, "POST", u, ref) if err != nil { return nil, nil, err } - r := new(Reference) - resp, err := s.client.Do(ctx, req, r) + var r *Reference + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -145,22 +142,27 @@ func (s *GitService) CreateRef(ctx context.Context, owner string, repo string, r // UpdateRef updates an existing ref in a repository. // -// GitHub API docs: https://docs.github.com/rest/git/refs#update-a-reference +// GitHub API docs: https://docs.github.com/rest/git/refs?apiVersion=2022-11-28#update-a-reference // //meta:operation PATCH /repos/{owner}/{repo}/git/refs/{ref} -func (s *GitService) UpdateRef(ctx context.Context, owner string, repo string, ref *Reference, force bool) (*Reference, *Response, error) { - refPath := strings.TrimPrefix(*ref.Ref, "refs/") +func (s *GitService) UpdateRef(ctx context.Context, owner, repo, ref string, updateRef UpdateRef) (*Reference, *Response, error) { + if ref == "" { + return nil, nil, errors.New("ref must be provided") + } + + if updateRef.SHA == "" { + return nil, nil, errors.New("sha must be provided") + } + + refPath := strings.TrimPrefix(ref, "refs/") u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, refURLEscape(refPath)) - req, err := s.client.NewRequest("PATCH", u, &updateRefRequest{ - SHA: ref.Object.SHA, - Force: &force, - }) + req, err := s.client.NewRequest(ctx, "PATCH", u, updateRef) if err != nil { return nil, nil, err } - r := new(Reference) - resp, err := s.client.Do(ctx, req, r) + var r *Reference + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -170,16 +172,16 @@ func (s *GitService) UpdateRef(ctx context.Context, owner string, repo string, r // DeleteRef deletes a ref from a repository. // -// GitHub API docs: https://docs.github.com/rest/git/refs#delete-a-reference +// GitHub API docs: https://docs.github.com/rest/git/refs?apiVersion=2022-11-28#delete-a-reference // //meta:operation DELETE /repos/{owner}/{repo}/git/refs/{ref} -func (s *GitService) DeleteRef(ctx context.Context, owner string, repo string, ref string) (*Response, error) { +func (s *GitService) DeleteRef(ctx context.Context, owner, repo, ref string) (*Response, error) { ref = strings.TrimPrefix(ref, "refs/") u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, refURLEscape(ref)) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/git_tags.go b/vendor/github.com/google/go-github/v88/github/git_tags.go similarity index 51% rename from vendor/github.com/google/go-github/v73/github/git_tags.go rename to vendor/github.com/google/go-github/v88/github/git_tags.go index 67321566f..13a86a369 100644 --- a/vendor/github.com/google/go-github/v73/github/git_tags.go +++ b/vendor/github.com/google/go-github/v88/github/git_tags.go @@ -22,31 +22,29 @@ type Tag struct { NodeID *string `json:"node_id,omitempty"` } -// createTagRequest represents the body of a CreateTag request. This is mostly -// identical to Tag with the exception that the object SHA and Type are -// top-level fields, rather than being nested inside a JSON object. -type createTagRequest struct { - Tag *string `json:"tag,omitempty"` - Message *string `json:"message,omitempty"` - Object *string `json:"object,omitempty"` - Type *string `json:"type,omitempty"` +// CreateTag represents the payload for creating a tag. +type CreateTag struct { + Tag string `json:"tag,omitempty"` + Message string `json:"message,omitempty"` + Object string `json:"object,omitempty"` + Type string `json:"type,omitempty"` Tagger *CommitAuthor `json:"tagger,omitempty"` } // GetTag fetches a tag from a repo given a SHA. // -// GitHub API docs: https://docs.github.com/rest/git/tags#get-a-tag +// GitHub API docs: https://docs.github.com/rest/git/tags?apiVersion=2022-11-28#get-a-tag // //meta:operation GET /repos/{owner}/{repo}/git/tags/{tag_sha} -func (s *GitService) GetTag(ctx context.Context, owner string, repo string, sha string) (*Tag, *Response, error) { +func (s *GitService) GetTag(ctx context.Context, owner, repo, sha string) (*Tag, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/tags/%v", owner, repo, sha) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - tag := new(Tag) - resp, err := s.client.Do(ctx, req, tag) + var tag *Tag + resp, err := s.client.Do(req, &tag) if err != nil { return nil, resp, err } @@ -56,30 +54,19 @@ func (s *GitService) GetTag(ctx context.Context, owner string, repo string, sha // CreateTag creates a tag object. // -// GitHub API docs: https://docs.github.com/rest/git/tags#create-a-tag-object +// GitHub API docs: https://docs.github.com/rest/git/tags?apiVersion=2022-11-28#create-a-tag-object // //meta:operation POST /repos/{owner}/{repo}/git/tags -func (s *GitService) CreateTag(ctx context.Context, owner string, repo string, tag *Tag) (*Tag, *Response, error) { +func (s *GitService) CreateTag(ctx context.Context, owner, repo string, tag CreateTag) (*Tag, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/tags", owner, repo) - // convert Tag into a createTagRequest - tagRequest := &createTagRequest{ - Tag: tag.Tag, - Message: tag.Message, - Tagger: tag.Tagger, - } - if tag.Object != nil { - tagRequest.Object = tag.Object.SHA - tagRequest.Type = tag.Object.Type - } - - req, err := s.client.NewRequest("POST", u, tagRequest) + req, err := s.client.NewRequest(ctx, "POST", u, tag) if err != nil { return nil, nil, err } - t := new(Tag) - resp, err := s.client.Do(ctx, req, t) + var t *Tag + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/git_trees.go b/vendor/github.com/google/go-github/v88/github/git_trees.go similarity index 72% rename from vendor/github.com/google/go-github/v73/github/git_trees.go rename to vendor/github.com/google/go-github/v88/github/git_trees.go index 4396dd016..2e4b9dc21 100644 --- a/vendor/github.com/google/go-github/v73/github/git_trees.go +++ b/vendor/github.com/google/go-github/v88/github/git_trees.go @@ -30,6 +30,13 @@ func (t Tree) String() string { // TreeEntry represents the contents of a tree structure. TreeEntry can // represent either a blob, a commit (in the case of a submodule), or another // tree. +// +// When used with [GitService.CreateTree], set Content for small text files, +// or set SHA to reference an existing blob (use [GitService.CreateBlob] for +// binary files or large content). To delete an entry, set both Content and SHA +// to nil; the entry will be serialized with `"sha": null` which the API interprets +// as a deletion. When deleting, the Type and Mode fields are ignored; only Path +// is required. type TreeEntry struct { SHA *string `json:"sha,omitempty"` Path *string `json:"path,omitempty"` @@ -58,7 +65,8 @@ type treeEntryWithFileDelete struct { URL *string `json:"url,omitempty"` } -func (t *TreeEntry) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaler interface. +func (t TreeEntry) MarshalJSON() ([]byte, error) { if t.SHA == nil && t.Content == nil { return json.Marshal(struct { SHA *string `json:"sha"` @@ -93,22 +101,22 @@ func (t *TreeEntry) MarshalJSON() ([]byte, error) { // GetTree fetches the Tree object for a given sha hash from a repository. // -// GitHub API docs: https://docs.github.com/rest/git/trees#get-a-tree +// GitHub API docs: https://docs.github.com/rest/git/trees?apiVersion=2022-11-28#get-a-tree // //meta:operation GET /repos/{owner}/{repo}/git/trees/{tree_sha} -func (s *GitService) GetTree(ctx context.Context, owner string, repo string, sha string, recursive bool) (*Tree, *Response, error) { +func (s *GitService) GetTree(ctx context.Context, owner, repo, sha string, recursive bool) (*Tree, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/trees/%v", owner, repo, sha) if recursive { u += "?recursive=1" } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - t := new(Tree) - resp, err := s.client.Do(ctx, req, t) + var t *Tree + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } @@ -126,10 +134,16 @@ type createTree struct { // path modifying that tree are specified, it will overwrite the contents of // that tree with the new path contents and write a new tree out. // -// GitHub API docs: https://docs.github.com/rest/git/trees#create-a-tree +// When baseTree is provided, entries are merged with that tree: paths not +// mentioned in entries are preserved from the base tree. If the same path +// appears multiple times in entries, the last entry wins. To delete an entry, +// include a [TreeEntry] with the path and both SHA and Content set to nil. +// Entire directories can be deleted this way. +// +// GitHub API docs: https://docs.github.com/rest/git/trees?apiVersion=2022-11-28#create-a-tree // //meta:operation POST /repos/{owner}/{repo}/git/trees -func (s *GitService) CreateTree(ctx context.Context, owner string, repo string, baseTree string, entries []*TreeEntry) (*Tree, *Response, error) { +func (s *GitService) CreateTree(ctx context.Context, owner, repo, baseTree string, entries []*TreeEntry) (*Tree, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/trees", owner, repo) newEntries := make([]any, 0, len(entries)) @@ -151,13 +165,13 @@ func (s *GitService) CreateTree(ctx context.Context, owner string, repo string, BaseTree: baseTree, Entries: newEntries, } - req, err := s.client.NewRequest("POST", u, body) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - t := new(Tree) - resp, err := s.client.Do(ctx, req, t) + var t *Tree + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/github-accessors.go b/vendor/github.com/google/go-github/v88/github/github-accessors.go similarity index 67% rename from vendor/github.com/google/go-github/v73/github/github-accessors.go rename to vendor/github.com/google/go-github/v88/github/github-accessors.go index 3193aa994..5636e7d3f 100644 --- a/vendor/github.com/google/go-github/v73/github/github-accessors.go +++ b/vendor/github.com/google/go-github/v88/github/github-accessors.go @@ -1,12 +1,12 @@ +// Code generated by gen-accessors; DO NOT EDIT. +// Instead, please run "go generate ./..." as described here: +// https://github.com/google/go-github/blob/master/CONTRIBUTING.md#submitting-a-patch + // Copyright 2017 The go-github AUTHORS. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Code generated by gen-accessors; DO NOT EDIT. -// Instead, please run "go generate ./..." as described here: -// https://github.com/google/go-github/blob/master/CONTRIBUTING.md#submitting-a-patch - package github import ( @@ -14,6 +14,14 @@ import ( "time" ) +// GetMessage returns the Message field. +func (a *AbuseRateLimitError) GetMessage() string { + if a == nil { + return "" + } + return a.Message +} + // GetRetryAfter returns the RetryAfter field if it's non-nil, zero value otherwise. func (a *AbuseRateLimitError) GetRetryAfter() time.Duration { if a == nil || a.RetryAfter == nil { @@ -22,6 +30,102 @@ func (a *AbuseRateLimitError) GetRetryAfter() time.Duration { return *a.RetryAfter } +// GetAssignment returns the Assignment field. +func (a *AcceptedAssignment) GetAssignment() *ClassroomAssignment { + if a == nil { + return nil + } + return a.Assignment +} + +// GetCommitCount returns the CommitCount field if it's non-nil, zero value otherwise. +func (a *AcceptedAssignment) GetCommitCount() int { + if a == nil || a.CommitCount == nil { + return 0 + } + return *a.CommitCount +} + +// GetGrade returns the Grade field if it's non-nil, zero value otherwise. +func (a *AcceptedAssignment) GetGrade() string { + if a == nil || a.Grade == nil { + return "" + } + return *a.Grade +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (a *AcceptedAssignment) GetID() int64 { + if a == nil || a.ID == nil { + return 0 + } + return *a.ID +} + +// GetPassing returns the Passing field if it's non-nil, zero value otherwise. +func (a *AcceptedAssignment) GetPassing() bool { + if a == nil || a.Passing == nil { + return false + } + return *a.Passing +} + +// GetRepository returns the Repository field. +func (a *AcceptedAssignment) GetRepository() *Repository { + if a == nil { + return nil + } + return a.Repository +} + +// GetStudents returns the Students slice if it's non-nil, nil otherwise. +func (a *AcceptedAssignment) GetStudents() []*ClassroomUser { + if a == nil || a.Students == nil { + return nil + } + return a.Students +} + +// GetSubmitted returns the Submitted field if it's non-nil, zero value otherwise. +func (a *AcceptedAssignment) GetSubmitted() bool { + if a == nil || a.Submitted == nil { + return false + } + return *a.Submitted +} + +// GetRaw returns the Raw slice if it's non-nil, nil otherwise. +func (a *AcceptedError) GetRaw() []byte { + if a == nil || a.Raw == nil { + return nil + } + return a.Raw +} + +// GetFullName returns the FullName field. +func (a *AccessibleRepository) GetFullName() string { + if a == nil { + return "" + } + return a.FullName +} + +// GetID returns the ID field. +func (a *AccessibleRepository) GetID() int64 { + if a == nil { + return 0 + } + return a.ID +} + +// GetName returns the Name field. +func (a *AccessibleRepository) GetName() string { + if a == nil { + return "" + } + return a.Name +} + // GetGithubOwnedAllowed returns the GithubOwnedAllowed field if it's non-nil, zero value otherwise. func (a *ActionsAllowed) GetGithubOwnedAllowed() bool { if a == nil || a.GithubOwnedAllowed == nil { @@ -30,6 +134,14 @@ func (a *ActionsAllowed) GetGithubOwnedAllowed() bool { return *a.GithubOwnedAllowed } +// GetPatternsAllowed returns the PatternsAllowed slice if it's non-nil, nil otherwise. +func (a *ActionsAllowed) GetPatternsAllowed() []string { + if a == nil || a.PatternsAllowed == nil { + return nil + } + return a.PatternsAllowed +} + // GetVerifiedAllowed returns the VerifiedAllowed field if it's non-nil, zero value otherwise. func (a *ActionsAllowed) GetVerifiedAllowed() bool { if a == nil || a.VerifiedAllowed == nil { @@ -94,6 +206,22 @@ func (a *ActionsCache) GetVersion() string { return *a.Version } +// GetActionsCaches returns the ActionsCaches slice if it's non-nil, nil otherwise. +func (a *ActionsCacheList) GetActionsCaches() []*ActionsCache { + if a == nil || a.ActionsCaches == nil { + return nil + } + return a.ActionsCaches +} + +// GetTotalCount returns the TotalCount field. +func (a *ActionsCacheList) GetTotalCount() int { + if a == nil { + return 0 + } + return a.TotalCount +} + // GetDirection returns the Direction field if it's non-nil, zero value otherwise. func (a *ActionsCacheListOptions) GetDirection() string { if a == nil || a.Direction == nil { @@ -126,6 +254,94 @@ func (a *ActionsCacheListOptions) GetSort() string { return *a.Sort } +// GetActiveCachesCount returns the ActiveCachesCount field. +func (a *ActionsCacheUsage) GetActiveCachesCount() int { + if a == nil { + return 0 + } + return a.ActiveCachesCount +} + +// GetActiveCachesSizeInBytes returns the ActiveCachesSizeInBytes field. +func (a *ActionsCacheUsage) GetActiveCachesSizeInBytes() int64 { + if a == nil { + return 0 + } + return a.ActiveCachesSizeInBytes +} + +// GetFullName returns the FullName field. +func (a *ActionsCacheUsage) GetFullName() string { + if a == nil { + return "" + } + return a.FullName +} + +// GetRepoCacheUsage returns the RepoCacheUsage slice if it's non-nil, nil otherwise. +func (a *ActionsCacheUsageList) GetRepoCacheUsage() []*ActionsCacheUsage { + if a == nil || a.RepoCacheUsage == nil { + return nil + } + return a.RepoCacheUsage +} + +// GetTotalCount returns the TotalCount field. +func (a *ActionsCacheUsageList) GetTotalCount() int { + if a == nil { + return 0 + } + return a.TotalCount +} + +// GetOrganizations returns the Organizations slice if it's non-nil, nil otherwise. +func (a *ActionsEnabledOnEnterpriseRepos) GetOrganizations() []*Organization { + if a == nil || a.Organizations == nil { + return nil + } + return a.Organizations +} + +// GetTotalCount returns the TotalCount field. +func (a *ActionsEnabledOnEnterpriseRepos) GetTotalCount() int { + if a == nil { + return 0 + } + return a.TotalCount +} + +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (a *ActionsEnabledOnOrgRepos) GetRepositories() []*Repository { + if a == nil || a.Repositories == nil { + return nil + } + return a.Repositories +} + +// GetTotalCount returns the TotalCount field. +func (a *ActionsEnabledOnOrgRepos) GetTotalCount() int { + if a == nil { + return 0 + } + return a.TotalCount +} + +// GetFullDomains returns the FullDomains slice if it's non-nil, nil otherwise. +func (a *ActionsInboundDomains) GetFullDomains() []string { + if a == nil || a.FullDomains == nil { + return nil + } + return a.FullDomains +} + +// GetWildcardDomains returns the WildcardDomains slice if it's non-nil, nil otherwise. +func (a *ActionsInboundDomains) GetWildcardDomains() []string { + if a == nil || a.WildcardDomains == nil { + return nil + } + return a.WildcardDomains +} + // GetAllowedActions returns the AllowedActions field if it's non-nil, zero value otherwise. func (a *ActionsPermissions) GetAllowedActions() string { if a == nil || a.AllowedActions == nil { @@ -150,6 +366,14 @@ func (a *ActionsPermissions) GetSelectedActionsURL() string { return *a.SelectedActionsURL } +// GetSHAPinningRequired returns the SHAPinningRequired field if it's non-nil, zero value otherwise. +func (a *ActionsPermissions) GetSHAPinningRequired() bool { + if a == nil || a.SHAPinningRequired == nil { + return false + } + return *a.SHAPinningRequired +} + // GetAllowedActions returns the AllowedActions field if it's non-nil, zero value otherwise. func (a *ActionsPermissionsEnterprise) GetAllowedActions() string { if a == nil || a.AllowedActions == nil { @@ -198,6 +422,14 @@ func (a *ActionsPermissionsRepository) GetSelectedActionsURL() string { return *a.SelectedActionsURL } +// GetSHAPinningRequired returns the SHAPinningRequired field if it's non-nil, zero value otherwise. +func (a *ActionsPermissionsRepository) GetSHAPinningRequired() bool { + if a == nil || a.SHAPinningRequired == nil { + return false + } + return *a.SHAPinningRequired +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (a *ActionsVariable) GetCreatedAt() Timestamp { if a == nil || a.CreatedAt == nil { @@ -206,6 +438,14 @@ func (a *ActionsVariable) GetCreatedAt() Timestamp { return *a.CreatedAt } +// GetName returns the Name field. +func (a *ActionsVariable) GetName() string { + if a == nil { + return "" + } + return a.Name +} + // GetSelectedRepositoriesURL returns the SelectedRepositoriesURL field if it's non-nil, zero value otherwise. func (a *ActionsVariable) GetSelectedRepositoriesURL() string { if a == nil || a.SelectedRepositoriesURL == nil { @@ -230,6 +470,14 @@ func (a *ActionsVariable) GetUpdatedAt() Timestamp { return *a.UpdatedAt } +// GetValue returns the Value field. +func (a *ActionsVariable) GetValue() string { + if a == nil { + return "" + } + return a.Value +} + // GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. func (a *ActionsVariable) GetVisibility() string { if a == nil || a.Visibility == nil { @@ -238,6 +486,86 @@ func (a *ActionsVariable) GetVisibility() string { return *a.Visibility } +// GetTotalCount returns the TotalCount field. +func (a *ActionsVariables) GetTotalCount() int { + if a == nil { + return 0 + } + return a.TotalCount +} + +// GetVariables returns the Variables slice if it's non-nil, nil otherwise. +func (a *ActionsVariables) GetVariables() []*ActionsVariable { + if a == nil || a.Variables == nil { + return nil + } + return a.Variables +} + +// GetMaximumAdvancedSecurityCommitters returns the MaximumAdvancedSecurityCommitters field if it's non-nil, zero value otherwise. +func (a *ActiveCommitters) GetMaximumAdvancedSecurityCommitters() int { + if a == nil || a.MaximumAdvancedSecurityCommitters == nil { + return 0 + } + return *a.MaximumAdvancedSecurityCommitters +} + +// GetPurchasedAdvancedSecurityCommitters returns the PurchasedAdvancedSecurityCommitters field if it's non-nil, zero value otherwise. +func (a *ActiveCommitters) GetPurchasedAdvancedSecurityCommitters() int { + if a == nil || a.PurchasedAdvancedSecurityCommitters == nil { + return 0 + } + return *a.PurchasedAdvancedSecurityCommitters +} + +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (a *ActiveCommitters) GetRepositories() []*RepositoryActiveCommitters { + if a == nil || a.Repositories == nil { + return nil + } + return a.Repositories +} + +// GetTotalAdvancedSecurityCommitters returns the TotalAdvancedSecurityCommitters field if it's non-nil, zero value otherwise. +func (a *ActiveCommitters) GetTotalAdvancedSecurityCommitters() int { + if a == nil || a.TotalAdvancedSecurityCommitters == nil { + return 0 + } + return *a.TotalAdvancedSecurityCommitters +} + +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (a *ActiveCommitters) GetTotalCount() int { + if a == nil || a.TotalCount == nil { + return 0 + } + return *a.TotalCount +} + +// GetAdvancedSecurityProduct returns the AdvancedSecurityProduct field if it's non-nil, zero value otherwise. +func (a *ActiveCommittersListOptions) GetAdvancedSecurityProduct() string { + if a == nil || a.AdvancedSecurityProduct == nil { + return "" + } + return *a.AdvancedSecurityProduct +} + +// GetDirection returns the Direction field. +func (a *ActivityListStarredOptions) GetDirection() string { + if a == nil { + return "" + } + return a.Direction +} + +// GetSort returns the Sort field. +func (a *ActivityListStarredOptions) GetSort() string { + if a == nil { + return "" + } + return a.Sort +} + // GetCountryCode returns the CountryCode field if it's non-nil, zero value otherwise. func (a *ActorLocation) GetCountryCode() string { if a == nil || a.CountryCode == nil { @@ -246,6 +574,38 @@ func (a *ActorLocation) GetCountryCode() string { return *a.CountryCode } +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (a *AddProjectItemOptions) GetID() int64 { + if a == nil || a.ID == nil { + return 0 + } + return *a.ID +} + +// GetType returns the Type field. +func (a *AddProjectItemOptions) GetType() *ProjectV2ItemContentType { + if a == nil { + return nil + } + return a.Type +} + +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (a *AddResourcesToCostCenterResponse) GetMessage() string { + if a == nil || a.Message == nil { + return "" + } + return *a.Message +} + +// GetReassignedResources returns the ReassignedResources slice if it's non-nil, nil otherwise. +func (a *AddResourcesToCostCenterResponse) GetReassignedResources() []*ReassignedResource { + if a == nil || a.ReassignedResources == nil { + return nil + } + return a.ReassignedResources +} + // GetFrom returns the From field if it's non-nil, zero value otherwise. func (a *AdminEnforcedChanges) GetFrom() bool { if a == nil || a.From == nil { @@ -254,6 +614,14 @@ func (a *AdminEnforcedChanges) GetFrom() bool { return *a.From } +// GetEnabled returns the Enabled field. +func (a *AdminEnforcement) GetEnabled() bool { + if a == nil { + return false + } + return a.Enabled +} + // GetURL returns the URL field if it's non-nil, zero value otherwise. func (a *AdminEnforcement) GetURL() string { if a == nil || a.URL == nil { @@ -350,28 +718,36 @@ func (a *AdvancedSecurity) GetStatus() string { return *a.Status } -// GetLastPushedDate returns the LastPushedDate field if it's non-nil, zero value otherwise. +// GetLastPushedDate returns the LastPushedDate field. func (a *AdvancedSecurityCommittersBreakdown) GetLastPushedDate() string { - if a == nil || a.LastPushedDate == nil { + if a == nil { return "" } - return *a.LastPushedDate + return a.LastPushedDate } -// GetUserLogin returns the UserLogin field if it's non-nil, zero value otherwise. -func (a *AdvancedSecurityCommittersBreakdown) GetUserLogin() string { - if a == nil || a.UserLogin == nil { +// GetLastPushedEmail returns the LastPushedEmail field. +func (a *AdvancedSecurityCommittersBreakdown) GetLastPushedEmail() string { + if a == nil { return "" } - return *a.UserLogin + return a.LastPushedEmail } -// GetScore returns the Score field. -func (a *AdvisoryCVSS) GetScore() *float64 { +// GetUserLogin returns the UserLogin field. +func (a *AdvancedSecurityCommittersBreakdown) GetUserLogin() string { if a == nil { - return nil + return "" + } + return a.UserLogin +} + +// GetScore returns the Score field if it's non-nil, zero value otherwise. +func (a *AdvisoryCVSS) GetScore() float64 { + if a == nil || a.Score == nil { + return 0 } - return a.Score + return *a.Score } // GetVectorString returns the VectorString field if it's non-nil, zero value otherwise. @@ -398,6 +774,22 @@ func (a *AdvisoryCWEs) GetName() string { return *a.Name } +// GetPercentage returns the Percentage field. +func (a *AdvisoryEPSS) GetPercentage() float64 { + if a == nil { + return 0 + } + return a.Percentage +} + +// GetPercentile returns the Percentile field. +func (a *AdvisoryEPSS) GetPercentile() float64 { + if a == nil { + return 0 + } + return a.Percentile +} + // GetType returns the Type field if it's non-nil, zero value otherwise. func (a *AdvisoryIdentifier) GetType() string { if a == nil || a.Type == nil { @@ -454,6 +846,14 @@ func (a *AdvisoryVulnerability) GetSeverity() string { return *a.Severity } +// GetVulnerableFunctions returns the VulnerableFunctions slice if it's non-nil, nil otherwise. +func (a *AdvisoryVulnerability) GetVulnerableFunctions() []string { + if a == nil || a.VulnerableFunctions == nil { + return nil + } + return a.VulnerableFunctions +} + // GetVulnerableVersionRange returns the VulnerableVersionRange field if it's non-nil, zero value otherwise. func (a *AdvisoryVulnerability) GetVulnerableVersionRange() string { if a == nil || a.VulnerableVersionRange == nil { @@ -534,6 +934,14 @@ func (a *Alert) GetHTMLURL() string { return *a.HTMLURL } +// GetInstances returns the Instances slice if it's non-nil, nil otherwise. +func (a *Alert) GetInstances() []*MostRecentInstance { + if a == nil || a.Instances == nil { + return nil + } + return a.Instances +} + // GetInstancesURL returns the InstancesURL field if it's non-nil, zero value otherwise. func (a *Alert) GetInstancesURL() string { if a == nil || a.InstancesURL == nil { @@ -630,6 +1038,78 @@ func (a *Alert) GetURL() string { return *a.URL } +// GetRef returns the Ref field. +func (a *AlertInstancesListOptions) GetRef() string { + if a == nil { + return "" + } + return a.Ref +} + +// GetDirection returns the Direction field. +func (a *AlertListOptions) GetDirection() string { + if a == nil { + return "" + } + return a.Direction +} + +// GetRef returns the Ref field. +func (a *AlertListOptions) GetRef() string { + if a == nil { + return "" + } + return a.Ref +} + +// GetSeverity returns the Severity field. +func (a *AlertListOptions) GetSeverity() string { + if a == nil { + return "" + } + return a.Severity +} + +// GetSort returns the Sort field. +func (a *AlertListOptions) GetSort() string { + if a == nil { + return "" + } + return a.Sort +} + +// GetState returns the State field. +func (a *AlertListOptions) GetState() string { + if a == nil { + return "" + } + return a.State +} + +// GetToolGUID returns the ToolGUID field. +func (a *AlertListOptions) GetToolGUID() string { + if a == nil { + return "" + } + return a.ToolGUID +} + +// GetToolName returns the ToolName field. +func (a *AlertListOptions) GetToolName() string { + if a == nil { + return "" + } + return a.ToolName +} + +// GetEnabled returns the Enabled field. +func (a *AllowDeletions) GetEnabled() bool { + if a == nil { + return false + } + return a.Enabled +} + // GetFrom returns the From field if it's non-nil, zero value otherwise. func (a *AllowDeletionsEnforcementLevelChanges) GetFrom() string { if a == nil || a.From == nil { @@ -638,6 +1118,14 @@ func (a *AllowDeletionsEnforcementLevelChanges) GetFrom() string { return *a.From } +// GetEnabled returns the Enabled field. +func (a *AllowForcePushes) GetEnabled() bool { + if a == nil { + return false + } + return a.Enabled +} + // GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. func (a *AllowForkSyncing) GetEnabled() bool { if a == nil || a.Enabled == nil { @@ -646,6 +1134,94 @@ func (a *AllowForkSyncing) GetEnabled() bool { return *a.Enabled } +// GetAuthenticationType returns the AuthenticationType field. +func (a *AmazonS3AccessKeysConfig) GetAuthenticationType() string { + if a == nil { + return "" + } + return a.AuthenticationType +} + +// GetBucket returns the Bucket field. +func (a *AmazonS3AccessKeysConfig) GetBucket() string { + if a == nil { + return "" + } + return a.Bucket +} + +// GetEncryptedAccessKeyID returns the EncryptedAccessKeyID field. +func (a *AmazonS3AccessKeysConfig) GetEncryptedAccessKeyID() string { + if a == nil { + return "" + } + return a.EncryptedAccessKeyID +} + +// GetEncryptedSecretKey returns the EncryptedSecretKey field. +func (a *AmazonS3AccessKeysConfig) GetEncryptedSecretKey() string { + if a == nil { + return "" + } + return a.EncryptedSecretKey +} + +// GetKeyID returns the KeyID field. +func (a *AmazonS3AccessKeysConfig) GetKeyID() string { + if a == nil { + return "" + } + return a.KeyID +} + +// GetRegion returns the Region field. +func (a *AmazonS3AccessKeysConfig) GetRegion() string { + if a == nil { + return "" + } + return a.Region +} + +// GetArnRole returns the ArnRole field. +func (a *AmazonS3OIDCConfig) GetArnRole() string { + if a == nil { + return "" + } + return a.ArnRole +} + +// GetAuthenticationType returns the AuthenticationType field. +func (a *AmazonS3OIDCConfig) GetAuthenticationType() string { + if a == nil { + return "" + } + return a.AuthenticationType +} + +// GetBucket returns the Bucket field. +func (a *AmazonS3OIDCConfig) GetBucket() string { + if a == nil { + return "" + } + return a.Bucket +} + +// GetKeyID returns the KeyID field. +func (a *AmazonS3OIDCConfig) GetKeyID() string { + if a == nil { + return "" + } + return a.KeyID +} + +// GetRegion returns the Region field. +func (a *AmazonS3OIDCConfig) GetRegion() string { + if a == nil { + return "" + } + return a.Region +} + // GetRef returns the Ref field if it's non-nil, zero value otherwise. func (a *AnalysesListOptions) GetRef() string { if a == nil || a.Ref == nil { @@ -662,6 +1238,54 @@ func (a *AnalysesListOptions) GetSarifID() string { return *a.SarifID } +// GetActions returns the Actions slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetActions() []string { + if a == nil || a.Actions == nil { + return nil + } + return a.Actions +} + +// GetActionsMacos returns the ActionsMacos slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetActionsMacos() []string { + if a == nil || a.ActionsMacos == nil { + return nil + } + return a.ActionsMacos +} + +// GetAPI returns the API slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetAPI() []string { + if a == nil || a.API == nil { + return nil + } + return a.API +} + +// GetCodespaces returns the Codespaces slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetCodespaces() []string { + if a == nil || a.Codespaces == nil { + return nil + } + return a.Codespaces +} + +// GetCopilot returns the Copilot slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetCopilot() []string { + if a == nil || a.Copilot == nil { + return nil + } + return a.Copilot +} + +// GetDependabot returns the Dependabot slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetDependabot() []string { + if a == nil || a.Dependabot == nil { + return nil + } + return a.Dependabot +} + // GetDomains returns the Domains field. func (a *APIMeta) GetDomains() *APIMetaDomains { if a == nil { @@ -670,6 +1294,54 @@ func (a *APIMeta) GetDomains() *APIMetaDomains { return a.Domains } +// GetGit returns the Git slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetGit() []string { + if a == nil || a.Git == nil { + return nil + } + return a.Git +} + +// GetGithubEnterpriseImporter returns the GithubEnterpriseImporter slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetGithubEnterpriseImporter() []string { + if a == nil || a.GithubEnterpriseImporter == nil { + return nil + } + return a.GithubEnterpriseImporter +} + +// GetHooks returns the Hooks slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetHooks() []string { + if a == nil || a.Hooks == nil { + return nil + } + return a.Hooks +} + +// GetImporter returns the Importer slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetImporter() []string { + if a == nil || a.Importer == nil { + return nil + } + return a.Importer +} + +// GetPackages returns the Packages slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetPackages() []string { + if a == nil || a.Packages == nil { + return nil + } + return a.Packages +} + +// GetPages returns the Pages slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetPages() []string { + if a == nil || a.Pages == nil { + return nil + } + return a.Pages +} + // GetSSHKeyFingerprints returns the SSHKeyFingerprints map if it's non-nil, an empty map otherwise. func (a *APIMeta) GetSSHKeyFingerprints() map[string]string { if a == nil || a.SSHKeyFingerprints == nil { @@ -678,6 +1350,14 @@ func (a *APIMeta) GetSSHKeyFingerprints() map[string]string { return a.SSHKeyFingerprints } +// GetSSHKeys returns the SSHKeys slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetSSHKeys() []string { + if a == nil || a.SSHKeys == nil { + return nil + } + return a.SSHKeys +} + // GetVerifiablePasswordAuthentication returns the VerifiablePasswordAuthentication field if it's non-nil, zero value otherwise. func (a *APIMeta) GetVerifiablePasswordAuthentication() bool { if a == nil || a.VerifiablePasswordAuthentication == nil { @@ -686,6 +1366,46 @@ func (a *APIMeta) GetVerifiablePasswordAuthentication() bool { return *a.VerifiablePasswordAuthentication } +// GetWeb returns the Web slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetWeb() []string { + if a == nil || a.Web == nil { + return nil + } + return a.Web +} + +// GetServices returns the Services slice if it's non-nil, nil otherwise. +func (a *APIMetaArtifactAttestations) GetServices() []string { + if a == nil || a.Services == nil { + return nil + } + return a.Services +} + +// GetTrustDomain returns the TrustDomain field. +func (a *APIMetaArtifactAttestations) GetTrustDomain() string { + if a == nil { + return "" + } + return a.TrustDomain +} + +// GetActions returns the Actions slice if it's non-nil, nil otherwise. +func (a *APIMetaDomains) GetActions() []string { + if a == nil || a.Actions == nil { + return nil + } + return a.Actions +} + +// GetActionsInbound returns the ActionsInbound field. +func (a *APIMetaDomains) GetActionsInbound() *ActionsInboundDomains { + if a == nil { + return nil + } + return a.ActionsInbound +} + // GetArtifactAttestations returns the ArtifactAttestations field. func (a *APIMetaDomains) GetArtifactAttestations() *APIMetaArtifactAttestations { if a == nil { @@ -694,6 +1414,46 @@ func (a *APIMetaDomains) GetArtifactAttestations() *APIMetaArtifactAttestations return a.ArtifactAttestations } +// GetCodespaces returns the Codespaces slice if it's non-nil, nil otherwise. +func (a *APIMetaDomains) GetCodespaces() []string { + if a == nil || a.Codespaces == nil { + return nil + } + return a.Codespaces +} + +// GetCopilot returns the Copilot slice if it's non-nil, nil otherwise. +func (a *APIMetaDomains) GetCopilot() []string { + if a == nil || a.Copilot == nil { + return nil + } + return a.Copilot +} + +// GetPackages returns the Packages slice if it's non-nil, nil otherwise. +func (a *APIMetaDomains) GetPackages() []string { + if a == nil || a.Packages == nil { + return nil + } + return a.Packages +} + +// GetWebsite returns the Website slice if it's non-nil, nil otherwise. +func (a *APIMetaDomains) GetWebsite() []string { + if a == nil || a.Website == nil { + return nil + } + return a.Website +} + +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (a *App) GetClientID() string { + if a == nil || a.ClientID == nil { + return "" + } + return *a.ClientID +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (a *App) GetCreatedAt() Timestamp { if a == nil || a.CreatedAt == nil { @@ -710,6 +1470,14 @@ func (a *App) GetDescription() string { return *a.Description } +// GetEvents returns the Events slice if it's non-nil, nil otherwise. +func (a *App) GetEvents() []string { + if a == nil || a.Events == nil { + return nil + } + return a.Events +} + // GetExternalURL returns the ExternalURL field if it's non-nil, zero value otherwise. func (a *App) GetExternalURL() string { if a == nil || a.ExternalURL == nil { @@ -902,6 +1670,14 @@ func (a *AppConfig) GetWebhookSecret() string { return *a.WebhookSecret } +// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs slice if it's non-nil, nil otherwise. +func (a *AppInstallationRepositoriesOptions) GetSelectedRepositoryIDs() []int64 { + if a == nil || a.SelectedRepositoryIDs == nil { + return nil + } + return a.SelectedRepositoryIDs +} + // GetFrom returns the From field if it's non-nil, zero value otherwise. func (a *ArchivedAt) GetFrom() Timestamp { if a == nil || a.From == nil { @@ -934,6 +1710,14 @@ func (a *Artifact) GetCreatedAt() Timestamp { return *a.CreatedAt } +// GetDigest returns the Digest field if it's non-nil, zero value otherwise. +func (a *Artifact) GetDigest() string { + if a == nil || a.Digest == nil { + return "" + } + return *a.Digest +} + // GetExpired returns the Expired field if it's non-nil, zero value otherwise. func (a *Artifact) GetExpired() bool { if a == nil || a.Expired == nil { @@ -1006,6 +1790,118 @@ func (a *Artifact) GetWorkflowRun() *ArtifactWorkflowRun { return a.WorkflowRun } +// GetAttestationID returns the AttestationID field if it's non-nil, zero value otherwise. +func (a *ArtifactDeploymentRecord) GetAttestationID() int64 { + if a == nil || a.AttestationID == nil { + return 0 + } + return *a.AttestationID +} + +// GetCluster returns the Cluster field if it's non-nil, zero value otherwise. +func (a *ArtifactDeploymentRecord) GetCluster() string { + if a == nil || a.Cluster == nil { + return "" + } + return *a.Cluster +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (a *ArtifactDeploymentRecord) GetCreatedAt() Timestamp { + if a == nil || a.CreatedAt == nil { + return Timestamp{} + } + return *a.CreatedAt +} + +// GetDeploymentName returns the DeploymentName field if it's non-nil, zero value otherwise. +func (a *ArtifactDeploymentRecord) GetDeploymentName() string { + if a == nil || a.DeploymentName == nil { + return "" + } + return *a.DeploymentName +} + +// GetDigest returns the Digest field if it's non-nil, zero value otherwise. +func (a *ArtifactDeploymentRecord) GetDigest() string { + if a == nil || a.Digest == nil { + return "" + } + return *a.Digest +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (a *ArtifactDeploymentRecord) GetID() int64 { + if a == nil || a.ID == nil { + return 0 + } + return *a.ID +} + +// GetLogicalEnvironment returns the LogicalEnvironment field if it's non-nil, zero value otherwise. +func (a *ArtifactDeploymentRecord) GetLogicalEnvironment() string { + if a == nil || a.LogicalEnvironment == nil { + return "" + } + return *a.LogicalEnvironment +} + +// GetPhysicalEnvironment returns the PhysicalEnvironment field if it's non-nil, zero value otherwise. +func (a *ArtifactDeploymentRecord) GetPhysicalEnvironment() string { + if a == nil || a.PhysicalEnvironment == nil { + return "" + } + return *a.PhysicalEnvironment +} + +// GetRuntimeRisks returns the RuntimeRisks slice if it's non-nil, nil otherwise. +func (a *ArtifactDeploymentRecord) GetRuntimeRisks() []DeploymentRuntimeRisk { + if a == nil || a.RuntimeRisks == nil { + return nil + } + return a.RuntimeRisks +} + +// GetTags returns the Tags map if it's non-nil, an empty map otherwise. +func (a *ArtifactDeploymentRecord) GetTags() map[string]string { + if a == nil || a.Tags == nil { + return map[string]string{} + } + return a.Tags +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (a *ArtifactDeploymentRecord) GetUpdatedAt() Timestamp { + if a == nil || a.UpdatedAt == nil { + return Timestamp{} + } + return *a.UpdatedAt +} + +// GetDeploymentRecords returns the DeploymentRecords slice if it's non-nil, nil otherwise. +func (a *ArtifactDeploymentResponse) GetDeploymentRecords() []*ArtifactDeploymentRecord { + if a == nil || a.DeploymentRecords == nil { + return nil + } + return a.DeploymentRecords +} + +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (a *ArtifactDeploymentResponse) GetTotalCount() int { + if a == nil || a.TotalCount == nil { + return 0 + } + return *a.TotalCount +} + +// GetArtifacts returns the Artifacts slice if it's non-nil, nil otherwise. +func (a *ArtifactList) GetArtifacts() []*Artifact { + if a == nil || a.Artifacts == nil { + return nil + } + return a.Artifacts +} + // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. func (a *ArtifactList) GetTotalCount() int64 { if a == nil || a.TotalCount == nil { @@ -1014,6 +1910,118 @@ func (a *ArtifactList) GetTotalCount() int64 { return *a.TotalCount } +// GetDays returns the Days field if it's non-nil, zero value otherwise. +func (a *ArtifactPeriod) GetDays() int { + if a == nil || a.Days == nil { + return 0 + } + return *a.Days +} + +// GetMaximumAllowedDays returns the MaximumAllowedDays field if it's non-nil, zero value otherwise. +func (a *ArtifactPeriod) GetMaximumAllowedDays() int { + if a == nil || a.MaximumAllowedDays == nil { + return 0 + } + return *a.MaximumAllowedDays +} + +// GetDays returns the Days field if it's non-nil, zero value otherwise. +func (a *ArtifactPeriodOpt) GetDays() int { + if a == nil || a.Days == nil { + return 0 + } + return *a.Days +} + +// GetArtifactURL returns the ArtifactURL field if it's non-nil, zero value otherwise. +func (a *ArtifactStorageRecord) GetArtifactURL() string { + if a == nil || a.ArtifactURL == nil { + return "" + } + return *a.ArtifactURL +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (a *ArtifactStorageRecord) GetCreatedAt() Timestamp { + if a == nil || a.CreatedAt == nil { + return Timestamp{} + } + return *a.CreatedAt +} + +// GetDigest returns the Digest field if it's non-nil, zero value otherwise. +func (a *ArtifactStorageRecord) GetDigest() string { + if a == nil || a.Digest == nil { + return "" + } + return *a.Digest +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (a *ArtifactStorageRecord) GetID() int64 { + if a == nil || a.ID == nil { + return 0 + } + return *a.ID +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (a *ArtifactStorageRecord) GetName() string { + if a == nil || a.Name == nil { + return "" + } + return *a.Name +} + +// GetRegistryURL returns the RegistryURL field if it's non-nil, zero value otherwise. +func (a *ArtifactStorageRecord) GetRegistryURL() string { + if a == nil || a.RegistryURL == nil { + return "" + } + return *a.RegistryURL +} + +// GetRepository returns the Repository field if it's non-nil, zero value otherwise. +func (a *ArtifactStorageRecord) GetRepository() string { + if a == nil || a.Repository == nil { + return "" + } + return *a.Repository +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (a *ArtifactStorageRecord) GetStatus() string { + if a == nil || a.Status == nil { + return "" + } + return *a.Status +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (a *ArtifactStorageRecord) GetUpdatedAt() Timestamp { + if a == nil || a.UpdatedAt == nil { + return Timestamp{} + } + return *a.UpdatedAt +} + +// GetStorageRecords returns the StorageRecords slice if it's non-nil, nil otherwise. +func (a *ArtifactStorageResponse) GetStorageRecords() []*ArtifactStorageRecord { + if a == nil || a.StorageRecords == nil { + return nil + } + return a.StorageRecords +} + +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (a *ArtifactStorageResponse) GetTotalCount() int { + if a == nil || a.TotalCount == nil { + return 0 + } + return *a.TotalCount +} + // GetHeadBranch returns the HeadBranch field if it's non-nil, zero value otherwise. func (a *ArtifactWorkflowRun) GetHeadBranch() string { if a == nil || a.HeadBranch == nil { @@ -1054,6 +2062,94 @@ func (a *ArtifactWorkflowRun) GetRepositoryID() int64 { return *a.RepositoryID } +// GetAssignmentName returns the AssignmentName field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetAssignmentName() string { + if a == nil || a.AssignmentName == nil { + return "" + } + return *a.AssignmentName +} + +// GetAssignmentURL returns the AssignmentURL field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetAssignmentURL() string { + if a == nil || a.AssignmentURL == nil { + return "" + } + return *a.AssignmentURL +} + +// GetGithubUsername returns the GithubUsername field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetGithubUsername() string { + if a == nil || a.GithubUsername == nil { + return "" + } + return *a.GithubUsername +} + +// GetGroupName returns the GroupName field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetGroupName() string { + if a == nil || a.GroupName == nil { + return "" + } + return *a.GroupName +} + +// GetPointsAvailable returns the PointsAvailable field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetPointsAvailable() int { + if a == nil || a.PointsAvailable == nil { + return 0 + } + return *a.PointsAvailable +} + +// GetPointsAwarded returns the PointsAwarded field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetPointsAwarded() int { + if a == nil || a.PointsAwarded == nil { + return 0 + } + return *a.PointsAwarded +} + +// GetRosterIdentifier returns the RosterIdentifier field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetRosterIdentifier() string { + if a == nil || a.RosterIdentifier == nil { + return "" + } + return *a.RosterIdentifier +} + +// GetStarterCodeURL returns the StarterCodeURL field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetStarterCodeURL() string { + if a == nil || a.StarterCodeURL == nil { + return "" + } + return *a.StarterCodeURL +} + +// GetStudentRepositoryName returns the StudentRepositoryName field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetStudentRepositoryName() string { + if a == nil || a.StudentRepositoryName == nil { + return "" + } + return *a.StudentRepositoryName +} + +// GetStudentRepositoryURL returns the StudentRepositoryURL field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetStudentRepositoryURL() string { + if a == nil || a.StudentRepositoryURL == nil { + return "" + } + return *a.StudentRepositoryURL +} + +// GetSubmissionTimestamp returns the SubmissionTimestamp field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetSubmissionTimestamp() Timestamp { + if a == nil || a.SubmissionTimestamp == nil { + return Timestamp{} + } + return *a.SubmissionTimestamp +} + // GetBody returns the Body field if it's non-nil, zero value otherwise. func (a *Attachment) GetBody() string { if a == nil || a.Body == nil { @@ -1078,6 +2174,30 @@ func (a *Attachment) GetTitle() string { return *a.Title } +// GetBundle returns the Bundle field. +func (a *Attestation) GetBundle() json.RawMessage { + if a == nil { + return json.RawMessage{} + } + return a.Bundle +} + +// GetRepositoryID returns the RepositoryID field. +func (a *Attestation) GetRepositoryID() int64 { + if a == nil { + return 0 + } + return a.RepositoryID +} + +// GetAttestations returns the Attestations slice if it's non-nil, nil otherwise. +func (a *AttestationsResponse) GetAttestations() []*Attestation { + if a == nil || a.Attestations == nil { + return nil + } + return a.Attestations +} + // GetAction returns the Action field if it's non-nil, zero value otherwise. func (a *AuditEntry) GetAction() string { if a == nil || a.Action == nil { @@ -1238,6 +2358,102 @@ func (a *AuditEntry) GetUserID() int64 { return *a.UserID } +// GetCreatedAt returns the CreatedAt field. +func (a *AuditLogStream) GetCreatedAt() Timestamp { + if a == nil { + return Timestamp{} + } + return a.CreatedAt +} + +// GetEnabled returns the Enabled field. +func (a *AuditLogStream) GetEnabled() bool { + if a == nil { + return false + } + return a.Enabled +} + +// GetID returns the ID field. +func (a *AuditLogStream) GetID() int64 { + if a == nil { + return 0 + } + return a.ID +} + +// GetPausedAt returns the PausedAt field if it's non-nil, zero value otherwise. +func (a *AuditLogStream) GetPausedAt() Timestamp { + if a == nil || a.PausedAt == nil { + return Timestamp{} + } + return *a.PausedAt +} + +// GetStreamDetails returns the StreamDetails field. +func (a *AuditLogStream) GetStreamDetails() string { + if a == nil { + return "" + } + return a.StreamDetails +} + +// GetStreamType returns the StreamType field. +func (a *AuditLogStream) GetStreamType() string { + if a == nil { + return "" + } + return a.StreamType +} + +// GetUpdatedAt returns the UpdatedAt field. +func (a *AuditLogStream) GetUpdatedAt() Timestamp { + if a == nil { + return Timestamp{} + } + return a.UpdatedAt +} + +// GetEnabled returns the Enabled field. +func (a *AuditLogStreamConfig) GetEnabled() bool { + if a == nil { + return false + } + return a.Enabled +} + +// GetStreamType returns the StreamType field. +func (a *AuditLogStreamConfig) GetStreamType() string { + if a == nil { + return "" + } + return a.StreamType +} + +// GetVendorSpecific returns the VendorSpecific field. +func (a *AuditLogStreamConfig) GetVendorSpecific() AuditLogStreamVendorConfig { + if a == nil { + return nil + } + return a.VendorSpecific +} + +// GetKey returns the Key field. +func (a *AuditLogStreamKey) GetKey() string { + if a == nil { + return "" + } + return a.Key +} + +// GetKeyID returns the KeyID field. +func (a *AuditLogStreamKey) GetKeyID() string { + if a == nil { + return "" + } + return a.KeyID +} + // GetApp returns the App field. func (a *Authorization) GetApp() *AuthorizationApp { if a == nil { @@ -1294,6 +2510,14 @@ func (a *Authorization) GetNoteURL() string { return *a.NoteURL } +// GetScopes returns the Scopes slice if it's non-nil, nil otherwise. +func (a *Authorization) GetScopes() []Scope { + if a == nil || a.Scopes == nil { + return nil + } + return a.Scopes +} + // GetToken returns the Token field if it's non-nil, zero value otherwise. func (a *Authorization) GetToken() string { if a == nil || a.Token == nil { @@ -1398,6 +2622,22 @@ func (a *AuthorizationRequest) GetNoteURL() string { return *a.NoteURL } +// GetScopes returns the Scopes slice if it's non-nil, nil otherwise. +func (a *AuthorizationRequest) GetScopes() []Scope { + if a == nil || a.Scopes == nil { + return nil + } + return a.Scopes +} + +// GetAddScopes returns the AddScopes slice if it's non-nil, nil otherwise. +func (a *AuthorizationUpdateRequest) GetAddScopes() []string { + if a == nil || a.AddScopes == nil { + return nil + } + return a.AddScopes +} + // GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise. func (a *AuthorizationUpdateRequest) GetFingerprint() string { if a == nil || a.Fingerprint == nil { @@ -1422,6 +2662,30 @@ func (a *AuthorizationUpdateRequest) GetNoteURL() string { return *a.NoteURL } +// GetRemoveScopes returns the RemoveScopes slice if it's non-nil, nil otherwise. +func (a *AuthorizationUpdateRequest) GetRemoveScopes() []string { + if a == nil || a.RemoveScopes == nil { + return nil + } + return a.RemoveScopes +} + +// GetScopes returns the Scopes slice if it's non-nil, nil otherwise. +func (a *AuthorizationUpdateRequest) GetScopes() []string { + if a == nil || a.Scopes == nil { + return nil + } + return a.Scopes +} + +// GetFrom returns the From slice if it's non-nil, nil otherwise. +func (a *AuthorizedActorNames) GetFrom() []string { + if a == nil || a.From == nil { + return nil + } + return a.From +} + // GetFrom returns the From field if it's non-nil, zero value otherwise. func (a *AuthorizedActorsOnly) GetFrom() bool { if a == nil || a.From == nil { @@ -1526,9 +2790,81 @@ func (a *AutoTriggerCheck) GetSetting() bool { return *a.Setting } -// GetContent returns the Content field if it's non-nil, zero value otherwise. -func (b *Blob) GetContent() string { - if b == nil || b.Content == nil { +// GetContainer returns the Container field. +func (a *AzureBlobConfig) GetContainer() string { + if a == nil { + return "" + } + return a.Container +} + +// GetEncryptedSASURL returns the EncryptedSASURL field. +func (a *AzureBlobConfig) GetEncryptedSASURL() string { + if a == nil { + return "" + } + return a.EncryptedSASURL +} + +// GetKeyID returns the KeyID field. +func (a *AzureBlobConfig) GetKeyID() string { + if a == nil { + return "" + } + return a.KeyID +} + +// GetEncryptedConnstring returns the EncryptedConnstring field. +func (a *AzureHubConfig) GetEncryptedConnstring() string { + if a == nil { + return "" + } + return a.EncryptedConnstring +} + +// GetKeyID returns the KeyID field. +func (a *AzureHubConfig) GetKeyID() string { + if a == nil { + return "" + } + return a.KeyID +} + +// GetName returns the Name field. +func (a *AzureHubConfig) GetName() string { + if a == nil { + return "" + } + return a.Name +} + +// GetOTP returns the OTP field. +func (b *BasicAuthTransport) GetOTP() string { + if b == nil { + return "" + } + return b.OTP +} + +// GetPassword returns the Password field. +func (b *BasicAuthTransport) GetPassword() string { + if b == nil { + return "" + } + return b.Password +} + +// GetUsername returns the Username field. +func (b *BasicAuthTransport) GetUsername() string { + if b == nil { + return "" + } + return b.Username +} + +// GetContent returns the Content field if it's non-nil, zero value otherwise. +func (b *Blob) GetContent() string { + if b == nil || b.Content == nil { return "" } return *b.Content @@ -1614,6 +2950,14 @@ func (b *Branch) GetProtection() *Protection { return b.Protection } +// GetProtectionURL returns the ProtectionURL field if it's non-nil, zero value otherwise. +func (b *Branch) GetProtectionURL() string { + if b == nil || b.ProtectionURL == nil { + return "" + } + return *b.ProtectionURL +} + // GetCommit returns the Commit field. func (b *BranchCommit) GetCommit() *Commit { if b == nil { @@ -1734,6 +3078,14 @@ func (b *BranchProtectionRule) GetAllowForcePushesEnforcementLevel() string { return *b.AllowForcePushesEnforcementLevel } +// GetAuthorizedActorNames returns the AuthorizedActorNames slice if it's non-nil, nil otherwise. +func (b *BranchProtectionRule) GetAuthorizedActorNames() []string { + if b == nil || b.AuthorizedActorNames == nil { + return nil + } + return b.AuthorizedActorNames +} + // GetAuthorizedActorsOnly returns the AuthorizedActorsOnly field if it's non-nil, zero value otherwise. func (b *BranchProtectionRule) GetAuthorizedActorsOnly() bool { if b == nil || b.AuthorizedActorsOnly == nil { @@ -1854,6 +3206,14 @@ func (b *BranchProtectionRule) GetRequiredDeploymentsEnforcementLevel() string { return *b.RequiredDeploymentsEnforcementLevel } +// GetRequiredStatusChecks returns the RequiredStatusChecks slice if it's non-nil, nil otherwise. +func (b *BranchProtectionRule) GetRequiredStatusChecks() []string { + if b == nil || b.RequiredStatusChecks == nil { + return nil + } + return b.RequiredStatusChecks +} + // GetRequiredStatusChecksEnforcementLevel returns the RequiredStatusChecksEnforcementLevel field if it's non-nil, zero value otherwise. func (b *BranchProtectionRule) GetRequiredStatusChecksEnforcementLevel() string { if b == nil || b.RequiredStatusChecksEnforcementLevel == nil { @@ -1862,6 +3222,14 @@ func (b *BranchProtectionRule) GetRequiredStatusChecksEnforcementLevel() string return *b.RequiredStatusChecksEnforcementLevel } +// GetRequireLastPushApproval returns the RequireLastPushApproval field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetRequireLastPushApproval() bool { + if b == nil || b.RequireLastPushApproval == nil { + return false + } + return *b.RequireLastPushApproval +} + // GetSignatureRequirementEnforcementLevel returns the SignatureRequirementEnforcementLevel field if it's non-nil, zero value otherwise. func (b *BranchProtectionRule) GetSignatureRequirementEnforcementLevel() string { if b == nil || b.SignatureRequirementEnforcementLevel == nil { @@ -1942,6 +3310,254 @@ func (b *BranchProtectionRuleEvent) GetSender() *User { return b.Sender } +// GetApps returns the Apps slice if it's non-nil, nil otherwise. +func (b *BranchRestrictions) GetApps() []*App { + if b == nil || b.Apps == nil { + return nil + } + return b.Apps +} + +// GetTeams returns the Teams slice if it's non-nil, nil otherwise. +func (b *BranchRestrictions) GetTeams() []*Team { + if b == nil || b.Teams == nil { + return nil + } + return b.Teams +} + +// GetUsers returns the Users slice if it's non-nil, nil otherwise. +func (b *BranchRestrictions) GetUsers() []*User { + if b == nil || b.Users == nil { + return nil + } + return b.Users +} + +// GetApps returns the Apps slice if it's non-nil, nil otherwise. +func (b *BranchRestrictionsRequest) GetApps() []string { + if b == nil || b.Apps == nil { + return nil + } + return b.Apps +} + +// GetTeams returns the Teams slice if it's non-nil, nil otherwise. +func (b *BranchRestrictionsRequest) GetTeams() []string { + if b == nil || b.Teams == nil { + return nil + } + return b.Teams +} + +// GetUsers returns the Users slice if it's non-nil, nil otherwise. +func (b *BranchRestrictionsRequest) GetUsers() []string { + if b == nil || b.Users == nil { + return nil + } + return b.Users +} + +// GetRulesetID returns the RulesetID field. +func (b *BranchRuleMetadata) GetRulesetID() int64 { + if b == nil { + return 0 + } + return b.RulesetID +} + +// GetRulesetSource returns the RulesetSource field. +func (b *BranchRuleMetadata) GetRulesetSource() string { + if b == nil { + return "" + } + return b.RulesetSource +} + +// GetRulesetSourceType returns the RulesetSourceType field. +func (b *BranchRuleMetadata) GetRulesetSourceType() RulesetSourceType { + if b == nil { + return "" + } + return b.RulesetSourceType +} + +// GetBranchNamePattern returns the BranchNamePattern slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetBranchNamePattern() []*PatternBranchRule { + if b == nil || b.BranchNamePattern == nil { + return nil + } + return b.BranchNamePattern +} + +// GetCodeScanning returns the CodeScanning slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetCodeScanning() []*CodeScanningBranchRule { + if b == nil || b.CodeScanning == nil { + return nil + } + return b.CodeScanning +} + +// GetCommitAuthorEmailPattern returns the CommitAuthorEmailPattern slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetCommitAuthorEmailPattern() []*PatternBranchRule { + if b == nil || b.CommitAuthorEmailPattern == nil { + return nil + } + return b.CommitAuthorEmailPattern +} + +// GetCommitMessagePattern returns the CommitMessagePattern slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetCommitMessagePattern() []*PatternBranchRule { + if b == nil || b.CommitMessagePattern == nil { + return nil + } + return b.CommitMessagePattern +} + +// GetCommitterEmailPattern returns the CommitterEmailPattern slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetCommitterEmailPattern() []*PatternBranchRule { + if b == nil || b.CommitterEmailPattern == nil { + return nil + } + return b.CommitterEmailPattern +} + +// GetCopilotCodeReview returns the CopilotCodeReview slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetCopilotCodeReview() []*CopilotCodeReviewBranchRule { + if b == nil || b.CopilotCodeReview == nil { + return nil + } + return b.CopilotCodeReview +} + +// GetCreation returns the Creation slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetCreation() []*BranchRuleMetadata { + if b == nil || b.Creation == nil { + return nil + } + return b.Creation +} + +// GetDeletion returns the Deletion slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetDeletion() []*BranchRuleMetadata { + if b == nil || b.Deletion == nil { + return nil + } + return b.Deletion +} + +// GetFileExtensionRestriction returns the FileExtensionRestriction slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetFileExtensionRestriction() []*FileExtensionRestrictionBranchRule { + if b == nil || b.FileExtensionRestriction == nil { + return nil + } + return b.FileExtensionRestriction +} + +// GetFilePathRestriction returns the FilePathRestriction slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetFilePathRestriction() []*FilePathRestrictionBranchRule { + if b == nil || b.FilePathRestriction == nil { + return nil + } + return b.FilePathRestriction +} + +// GetMaxFilePathLength returns the MaxFilePathLength slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetMaxFilePathLength() []*MaxFilePathLengthBranchRule { + if b == nil || b.MaxFilePathLength == nil { + return nil + } + return b.MaxFilePathLength +} + +// GetMaxFileSize returns the MaxFileSize slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetMaxFileSize() []*MaxFileSizeBranchRule { + if b == nil || b.MaxFileSize == nil { + return nil + } + return b.MaxFileSize +} + +// GetMergeQueue returns the MergeQueue slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetMergeQueue() []*MergeQueueBranchRule { + if b == nil || b.MergeQueue == nil { + return nil + } + return b.MergeQueue +} + +// GetNonFastForward returns the NonFastForward slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetNonFastForward() []*BranchRuleMetadata { + if b == nil || b.NonFastForward == nil { + return nil + } + return b.NonFastForward +} + +// GetPullRequest returns the PullRequest slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetPullRequest() []*PullRequestBranchRule { + if b == nil || b.PullRequest == nil { + return nil + } + return b.PullRequest +} + +// GetRequiredDeployments returns the RequiredDeployments slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetRequiredDeployments() []*RequiredDeploymentsBranchRule { + if b == nil || b.RequiredDeployments == nil { + return nil + } + return b.RequiredDeployments +} + +// GetRequiredLinearHistory returns the RequiredLinearHistory slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetRequiredLinearHistory() []*BranchRuleMetadata { + if b == nil || b.RequiredLinearHistory == nil { + return nil + } + return b.RequiredLinearHistory +} + +// GetRequiredSignatures returns the RequiredSignatures slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetRequiredSignatures() []*BranchRuleMetadata { + if b == nil || b.RequiredSignatures == nil { + return nil + } + return b.RequiredSignatures +} + +// GetRequiredStatusChecks returns the RequiredStatusChecks slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetRequiredStatusChecks() []*RequiredStatusChecksBranchRule { + if b == nil || b.RequiredStatusChecks == nil { + return nil + } + return b.RequiredStatusChecks +} + +// GetTagNamePattern returns the TagNamePattern slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetTagNamePattern() []*PatternBranchRule { + if b == nil || b.TagNamePattern == nil { + return nil + } + return b.TagNamePattern +} + +// GetUpdate returns the Update slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetUpdate() []*UpdateBranchRule { + if b == nil || b.Update == nil { + return nil + } + return b.Update +} + +// GetWorkflows returns the Workflows slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetWorkflows() []*WorkflowsBranchRule { + if b == nil || b.Workflows == nil { + return nil + } + return b.Workflows +} + // GetActorID returns the ActorID field if it's non-nil, zero value otherwise. func (b *BypassActor) GetActorID() int64 { if b == nil || b.ActorID == nil { @@ -1966,6 +3582,78 @@ func (b *BypassActor) GetBypassMode() *BypassMode { return b.BypassMode } +// GetApps returns the Apps slice if it's non-nil, nil otherwise. +func (b *BypassPullRequestAllowances) GetApps() []*App { + if b == nil || b.Apps == nil { + return nil + } + return b.Apps +} + +// GetTeams returns the Teams slice if it's non-nil, nil otherwise. +func (b *BypassPullRequestAllowances) GetTeams() []*Team { + if b == nil || b.Teams == nil { + return nil + } + return b.Teams +} + +// GetUsers returns the Users slice if it's non-nil, nil otherwise. +func (b *BypassPullRequestAllowances) GetUsers() []*User { + if b == nil || b.Users == nil { + return nil + } + return b.Users +} + +// GetApps returns the Apps slice if it's non-nil, nil otherwise. +func (b *BypassPullRequestAllowancesRequest) GetApps() []string { + if b == nil || b.Apps == nil { + return nil + } + return b.Apps +} + +// GetTeams returns the Teams slice if it's non-nil, nil otherwise. +func (b *BypassPullRequestAllowancesRequest) GetTeams() []string { + if b == nil || b.Teams == nil { + return nil + } + return b.Teams +} + +// GetUsers returns the Users slice if it's non-nil, nil otherwise. +func (b *BypassPullRequestAllowancesRequest) GetUsers() []string { + if b == nil || b.Users == nil { + return nil + } + return b.Users +} + +// GetReviewerID returns the ReviewerID field. +func (b *BypassReviewer) GetReviewerID() int64 { + if b == nil { + return 0 + } + return b.ReviewerID +} + +// GetReviewerType returns the ReviewerType field. +func (b *BypassReviewer) GetReviewerType() string { + if b == nil { + return "" + } + return b.ReviewerType +} + +// GetSecurityConfigurationID returns the SecurityConfigurationID field if it's non-nil, zero value otherwise. +func (b *BypassReviewer) GetSecurityConfigurationID() int64 { + if b == nil || b.SecurityConfigurationID == nil { + return 0 + } + return *b.SecurityConfigurationID +} + // GetApp returns the App field. func (c *CheckRun) GetApp() *App { if c == nil { @@ -2062,6 +3750,14 @@ func (c *CheckRun) GetOutput() *CheckRunOutput { return c.Output } +// GetPullRequests returns the PullRequests slice if it's non-nil, nil otherwise. +func (c *CheckRun) GetPullRequests() []*PullRequest { + if c == nil || c.PullRequests == nil { + return nil + } + return c.PullRequests +} + // GetStartedAt returns the StartedAt field if it's non-nil, zero value otherwise. func (c *CheckRun) GetStartedAt() Timestamp { if c == nil || c.StartedAt == nil { @@ -2086,6 +3782,30 @@ func (c *CheckRun) GetURL() string { return *c.URL } +// GetDescription returns the Description field. +func (c *CheckRunAction) GetDescription() string { + if c == nil { + return "" + } + return c.Description +} + +// GetIdentifier returns the Identifier field. +func (c *CheckRunAction) GetIdentifier() string { + if c == nil { + return "" + } + return c.Identifier +} + +// GetLabel returns the Label field. +func (c *CheckRunAction) GetLabel() string { + if c == nil { + return "" + } + return c.Label +} + // GetAnnotationLevel returns the AnnotationLevel field if it's non-nil, zero value otherwise. func (c *CheckRunAnnotation) GetAnnotationLevel() string { if c == nil || c.AnnotationLevel == nil { @@ -2238,6 +3958,14 @@ func (c *CheckRunImage) GetImageURL() string { return *c.ImageURL } +// GetAnnotations returns the Annotations slice if it's non-nil, nil otherwise. +func (c *CheckRunOutput) GetAnnotations() []*CheckRunAnnotation { + if c == nil || c.Annotations == nil { + return nil + } + return c.Annotations +} + // GetAnnotationsCount returns the AnnotationsCount field if it's non-nil, zero value otherwise. func (c *CheckRunOutput) GetAnnotationsCount() int { if c == nil || c.AnnotationsCount == nil { @@ -2254,6 +3982,14 @@ func (c *CheckRunOutput) GetAnnotationsURL() string { return *c.AnnotationsURL } +// GetImages returns the Images slice if it's non-nil, nil otherwise. +func (c *CheckRunOutput) GetImages() []*CheckRunImage { + if c == nil || c.Images == nil { + return nil + } + return c.Images +} + // GetSummary returns the Summary field if it's non-nil, zero value otherwise. func (c *CheckRunOutput) GetSummary() string { if c == nil || c.Summary == nil { @@ -2366,6 +4102,14 @@ func (c *CheckSuite) GetNodeID() string { return *c.NodeID } +// GetPullRequests returns the PullRequests slice if it's non-nil, nil otherwise. +func (c *CheckSuite) GetPullRequests() []*PullRequest { + if c == nil || c.PullRequests == nil { + return nil + } + return c.PullRequests +} + // GetRepository returns the Repository field. func (c *CheckSuite) GetRepository() *Repository { if c == nil { @@ -2462,6 +4206,14 @@ func (c *CheckSuiteEvent) GetSender() *User { return c.Sender } +// GetAutoTriggerChecks returns the AutoTriggerChecks slice if it's non-nil, nil otherwise. +func (c *CheckSuitePreferenceOptions) GetAutoTriggerChecks() []*AutoTriggerCheck { + if c == nil || c.AutoTriggerChecks == nil { + return nil + } + return c.AutoTriggerChecks +} + // GetPreferences returns the Preferences field. func (c *CheckSuitePreferenceResults) GetPreferences() *PreferenceList { if c == nil { @@ -2478,6 +4230,318 @@ func (c *CheckSuitePreferenceResults) GetRepository() *Repository { return c.Repository } +// GetArchived returns the Archived field if it's non-nil, zero value otherwise. +func (c *Classroom) GetArchived() bool { + if c == nil || c.Archived == nil { + return false + } + return *c.Archived +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *Classroom) GetID() int64 { + if c == nil || c.ID == nil { + return 0 + } + return *c.ID +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *Classroom) GetName() string { + if c == nil || c.Name == nil { + return "" + } + return *c.Name +} + +// GetOrganization returns the Organization field. +func (c *Classroom) GetOrganization() *Organization { + if c == nil { + return nil + } + return c.Organization +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (c *Classroom) GetURL() string { + if c == nil || c.URL == nil { + return "" + } + return *c.URL +} + +// GetAccepted returns the Accepted field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetAccepted() int { + if c == nil || c.Accepted == nil { + return 0 + } + return *c.Accepted +} + +// GetClassroom returns the Classroom field. +func (c *ClassroomAssignment) GetClassroom() *Classroom { + if c == nil { + return nil + } + return c.Classroom +} + +// GetDeadline returns the Deadline field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetDeadline() Timestamp { + if c == nil || c.Deadline == nil { + return Timestamp{} + } + return *c.Deadline +} + +// GetEditor returns the Editor field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetEditor() string { + if c == nil || c.Editor == nil { + return "" + } + return *c.Editor +} + +// GetFeedbackPullRequestsEnabled returns the FeedbackPullRequestsEnabled field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetFeedbackPullRequestsEnabled() bool { + if c == nil || c.FeedbackPullRequestsEnabled == nil { + return false + } + return *c.FeedbackPullRequestsEnabled +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetID() int64 { + if c == nil || c.ID == nil { + return 0 + } + return *c.ID +} + +// GetInvitationsEnabled returns the InvitationsEnabled field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetInvitationsEnabled() bool { + if c == nil || c.InvitationsEnabled == nil { + return false + } + return *c.InvitationsEnabled +} + +// GetInviteLink returns the InviteLink field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetInviteLink() string { + if c == nil || c.InviteLink == nil { + return "" + } + return *c.InviteLink +} + +// GetLanguage returns the Language field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetLanguage() string { + if c == nil || c.Language == nil { + return "" + } + return *c.Language +} + +// GetMaxMembers returns the MaxMembers field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetMaxMembers() int { + if c == nil || c.MaxMembers == nil { + return 0 + } + return *c.MaxMembers +} + +// GetMaxTeams returns the MaxTeams field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetMaxTeams() int { + if c == nil || c.MaxTeams == nil { + return 0 + } + return *c.MaxTeams +} + +// GetPassing returns the Passing field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetPassing() int { + if c == nil || c.Passing == nil { + return 0 + } + return *c.Passing +} + +// GetPublicRepo returns the PublicRepo field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetPublicRepo() bool { + if c == nil || c.PublicRepo == nil { + return false + } + return *c.PublicRepo +} + +// GetSlug returns the Slug field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetSlug() string { + if c == nil || c.Slug == nil { + return "" + } + return *c.Slug +} + +// GetStarterCodeRepository returns the StarterCodeRepository field. +func (c *ClassroomAssignment) GetStarterCodeRepository() *Repository { + if c == nil { + return nil + } + return c.StarterCodeRepository +} + +// GetStudentsAreRepoAdmins returns the StudentsAreRepoAdmins field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetStudentsAreRepoAdmins() bool { + if c == nil || c.StudentsAreRepoAdmins == nil { + return false + } + return *c.StudentsAreRepoAdmins +} + +// GetSubmitted returns the Submitted field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetSubmitted() int { + if c == nil || c.Submitted == nil { + return 0 + } + return *c.Submitted +} + +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetTitle() string { + if c == nil || c.Title == nil { + return "" + } + return *c.Title +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetType() string { + if c == nil || c.Type == nil { + return "" + } + return *c.Type +} + +// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. +func (c *ClassroomUser) GetAvatarURL() string { + if c == nil || c.AvatarURL == nil { + return "" + } + return *c.AvatarURL +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (c *ClassroomUser) GetHTMLURL() string { + if c == nil || c.HTMLURL == nil { + return "" + } + return *c.HTMLURL +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *ClassroomUser) GetID() int64 { + if c == nil || c.ID == nil { + return 0 + } + return *c.ID +} + +// GetLogin returns the Login field if it's non-nil, zero value otherwise. +func (c *ClassroomUser) GetLogin() string { + if c == nil || c.Login == nil { + return "" + } + return *c.Login +} + +// GetDeploymentName returns the DeploymentName field. +func (c *ClusterArtifactDeployment) GetDeploymentName() string { + if c == nil { + return "" + } + return c.DeploymentName +} + +// GetDigest returns the Digest field. +func (c *ClusterArtifactDeployment) GetDigest() string { + if c == nil { + return "" + } + return c.Digest +} + +// GetGithubRepository returns the GithubRepository field if it's non-nil, zero value otherwise. +func (c *ClusterArtifactDeployment) GetGithubRepository() string { + if c == nil || c.GithubRepository == nil { + return "" + } + return *c.GithubRepository +} + +// GetName returns the Name field. +func (c *ClusterArtifactDeployment) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetRuntimeRisks returns the RuntimeRisks slice if it's non-nil, nil otherwise. +func (c *ClusterArtifactDeployment) GetRuntimeRisks() []DeploymentRuntimeRisk { + if c == nil || c.RuntimeRisks == nil { + return nil + } + return c.RuntimeRisks +} + +// GetStatus returns the Status field. +func (c *ClusterArtifactDeployment) GetStatus() string { + if c == nil { + return "" + } + return c.Status +} + +// GetTags returns the Tags map if it's non-nil, an empty map otherwise. +func (c *ClusterArtifactDeployment) GetTags() map[string]string { + if c == nil || c.Tags == nil { + return map[string]string{} + } + return c.Tags +} + +// GetVersion returns the Version field if it's non-nil, zero value otherwise. +func (c *ClusterArtifactDeployment) GetVersion() string { + if c == nil || c.Version == nil { + return "" + } + return *c.Version +} + +// GetDeployments returns the Deployments slice if it's non-nil, nil otherwise. +func (c *ClusterDeploymentRecordsRequest) GetDeployments() []*ClusterArtifactDeployment { + if c == nil || c.Deployments == nil { + return nil + } + return c.Deployments +} + +// GetLogicalEnvironment returns the LogicalEnvironment field. +func (c *ClusterDeploymentRecordsRequest) GetLogicalEnvironment() string { + if c == nil { + return "" + } + return c.LogicalEnvironment +} + +// GetPhysicalEnvironment returns the PhysicalEnvironment field if it's non-nil, zero value otherwise. +func (c *ClusterDeploymentRecordsRequest) GetPhysicalEnvironment() string { + if c == nil || c.PhysicalEnvironment == nil { + return "" + } + return *c.PhysicalEnvironment +} + // GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise. func (c *ClusterSSHKey) GetFingerprint() string { if c == nil || c.Fingerprint == nil { @@ -2494,6 +4558,14 @@ func (c *ClusterSSHKey) GetKey() string { return *c.Key } +// GetNodes returns the Nodes slice if it's non-nil, nil otherwise. +func (c *ClusterStatus) GetNodes() []*ClusterStatusNode { + if c == nil || c.Nodes == nil { + return nil + } + return c.Nodes +} + // GetStatus returns the Status field if it's non-nil, zero value otherwise. func (c *ClusterStatus) GetStatus() string { if c == nil || c.Status == nil { @@ -2510,6 +4582,14 @@ func (c *ClusterStatusNode) GetHostname() string { return *c.Hostname } +// GetServices returns the Services slice if it's non-nil, nil otherwise. +func (c *ClusterStatusNode) GetServices() []*ClusterStatusNodeServiceItem { + if c == nil || c.Services == nil { + return nil + } + return c.Services +} + // GetStatus returns the Status field if it's non-nil, zero value otherwise. func (c *ClusterStatusNode) GetStatus() string { if c == nil || c.Status == nil { @@ -2574,6 +4654,54 @@ func (c *CodeOfConduct) GetURL() string { return *c.URL } +// GetColumn returns the Column field. +func (c *CodeownersError) GetColumn() int { + if c == nil { + return 0 + } + return c.Column +} + +// GetKind returns the Kind field. +func (c *CodeownersError) GetKind() string { + if c == nil { + return "" + } + return c.Kind +} + +// GetLine returns the Line field. +func (c *CodeownersError) GetLine() int { + if c == nil { + return 0 + } + return c.Line +} + +// GetMessage returns the Message field. +func (c *CodeownersError) GetMessage() string { + if c == nil { + return "" + } + return c.Message +} + +// GetPath returns the Path field. +func (c *CodeownersError) GetPath() string { + if c == nil { + return "" + } + return c.Path +} + +// GetSource returns the Source field. +func (c *CodeownersError) GetSource() string { + if c == nil { + return "" + } + return c.Source +} + // GetSuggestion returns the Suggestion field if it's non-nil, zero value otherwise. func (c *CodeownersError) GetSuggestion() string { if c == nil || c.Suggestion == nil { @@ -2582,6 +4710,14 @@ func (c *CodeownersError) GetSuggestion() string { return *c.Suggestion } +// GetErrors returns the Errors slice if it's non-nil, nil otherwise. +func (c *CodeownersErrors) GetErrors() []*CodeownersError { + if c == nil || c.Errors == nil { + return nil + } + return c.Errors +} + // GetContentType returns the ContentType field if it's non-nil, zero value otherwise. func (c *CodeQLDatabase) GetContentType() string { if c == nil || c.ContentType == nil { @@ -2694,6 +4830,14 @@ func (c *CodeResult) GetSHA() string { return *c.SHA } +// GetTextMatches returns the TextMatches slice if it's non-nil, nil otherwise. +func (c *CodeResult) GetTextMatches() []*TextMatch { + if c == nil || c.TextMatches == nil { + return nil + } + return c.TextMatches +} + // GetAction returns the Action field if it's non-nil, zero value otherwise. func (c *CodeScanningAlertEvent) GetAction() string { if c == nil || c.Action == nil { @@ -2774,6 +4918,62 @@ func (c *CodeScanningAlertState) GetDismissedReason() string { return *c.DismissedReason } +// GetState returns the State field. +func (c *CodeScanningAlertState) GetState() string { + if c == nil { + return "" + } + return c.State +} + +// GetParameters returns the Parameters field. +func (c *CodeScanningBranchRule) GetParameters() CodeScanningRuleParameters { + if c == nil { + return CodeScanningRuleParameters{} + } + return c.Parameters +} + +// GetRunnerLabel returns the RunnerLabel field if it's non-nil, zero value otherwise. +func (c *CodeScanningDefaultSetupOptions) GetRunnerLabel() string { + if c == nil || c.RunnerLabel == nil { + return "" + } + return *c.RunnerLabel +} + +// GetRunnerType returns the RunnerType field. +func (c *CodeScanningDefaultSetupOptions) GetRunnerType() string { + if c == nil { + return "" + } + return c.RunnerType +} + +// GetAllowAdvanced returns the AllowAdvanced field if it's non-nil, zero value otherwise. +func (c *CodeScanningOptions) GetAllowAdvanced() bool { + if c == nil || c.AllowAdvanced == nil { + return false + } + return *c.AllowAdvanced +} + +// GetCodeScanningTools returns the CodeScanningTools slice if it's non-nil, nil otherwise. +func (c *CodeScanningRuleParameters) GetCodeScanningTools() []*RuleCodeScanningTool { + if c == nil || c.CodeScanningTools == nil { + return nil + } + return c.CodeScanningTools +} + +// GetCodeResults returns the CodeResults slice if it's non-nil, nil otherwise. +func (c *CodeSearchResult) GetCodeResults() []*CodeResult { + if c == nil || c.CodeResults == nil { + return nil + } + return c.CodeResults +} + // GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. func (c *CodeSearchResult) GetIncompleteResults() bool { if c == nil || c.IncompleteResults == nil { @@ -2790,6 +4990,14 @@ func (c *CodeSearchResult) GetTotal() int { return *c.Total } +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (c *CodeSecurity) GetStatus() string { + if c == nil || c.Status == nil { + return "" + } + return *c.Status +} + // GetAdvancedSecurity returns the AdvancedSecurity field if it's non-nil, zero value otherwise. func (c *CodeSecurityConfiguration) GetAdvancedSecurity() string { if c == nil || c.AdvancedSecurity == nil { @@ -2806,6 +5014,38 @@ func (c *CodeSecurityConfiguration) GetCodeScanningDefaultSetup() string { return *c.CodeScanningDefaultSetup } +// GetCodeScanningDefaultSetupOptions returns the CodeScanningDefaultSetupOptions field. +func (c *CodeSecurityConfiguration) GetCodeScanningDefaultSetupOptions() *CodeScanningDefaultSetupOptions { + if c == nil { + return nil + } + return c.CodeScanningDefaultSetupOptions +} + +// GetCodeScanningDelegatedAlertDismissal returns the CodeScanningDelegatedAlertDismissal field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetCodeScanningDelegatedAlertDismissal() string { + if c == nil || c.CodeScanningDelegatedAlertDismissal == nil { + return "" + } + return *c.CodeScanningDelegatedAlertDismissal +} + +// GetCodeScanningOptions returns the CodeScanningOptions field. +func (c *CodeSecurityConfiguration) GetCodeScanningOptions() *CodeScanningOptions { + if c == nil { + return nil + } + return c.CodeScanningOptions +} + +// GetCodeSecurity returns the CodeSecurity field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetCodeSecurity() string { + if c == nil || c.CodeSecurity == nil { + return "" + } + return *c.CodeSecurity +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (c *CodeSecurityConfiguration) GetCreatedAt() Timestamp { if c == nil || c.CreatedAt == nil { @@ -2822,6 +5062,14 @@ func (c *CodeSecurityConfiguration) GetDependabotAlerts() string { return *c.DependabotAlerts } +// GetDependabotDelegatedAlertDismissal returns the DependabotDelegatedAlertDismissal field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetDependabotDelegatedAlertDismissal() string { + if c == nil || c.DependabotDelegatedAlertDismissal == nil { + return "" + } + return *c.DependabotDelegatedAlertDismissal +} + // GetDependabotSecurityUpdates returns the DependabotSecurityUpdates field if it's non-nil, zero value otherwise. func (c *CodeSecurityConfiguration) GetDependabotSecurityUpdates() string { if c == nil || c.DependabotSecurityUpdates == nil { @@ -2854,12 +5102,12 @@ func (c *CodeSecurityConfiguration) GetDependencyGraphAutosubmitActionOptions() return c.DependencyGraphAutosubmitActionOptions } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. +// GetDescription returns the Description field. func (c *CodeSecurityConfiguration) GetDescription() string { - if c == nil || c.Description == nil { + if c == nil { return "" } - return *c.Description + return c.Description } // GetEnforcement returns the Enforcement field if it's non-nil, zero value otherwise. @@ -2886,12 +5134,12 @@ func (c *CodeSecurityConfiguration) GetID() int64 { return *c.ID } -// GetName returns the Name field if it's non-nil, zero value otherwise. +// GetName returns the Name field. func (c *CodeSecurityConfiguration) GetName() string { - if c == nil || c.Name == nil { + if c == nil { return "" } - return *c.Name + return c.Name } // GetPrivateVulnerabilityReporting returns the PrivateVulnerabilityReporting field if it's non-nil, zero value otherwise. @@ -2902,6 +5150,14 @@ func (c *CodeSecurityConfiguration) GetPrivateVulnerabilityReporting() string { return *c.PrivateVulnerabilityReporting } +// GetSecretProtection returns the SecretProtection field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetSecretProtection() string { + if c == nil || c.SecretProtection == nil { + return "" + } + return *c.SecretProtection +} + // GetSecretScanning returns the SecretScanning field if it's non-nil, zero value otherwise. func (c *CodeSecurityConfiguration) GetSecretScanning() string { if c == nil || c.SecretScanning == nil { @@ -2910,6 +5166,46 @@ func (c *CodeSecurityConfiguration) GetSecretScanning() string { return *c.SecretScanning } +// GetSecretScanningDelegatedAlertDismissal returns the SecretScanningDelegatedAlertDismissal field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetSecretScanningDelegatedAlertDismissal() string { + if c == nil || c.SecretScanningDelegatedAlertDismissal == nil { + return "" + } + return *c.SecretScanningDelegatedAlertDismissal +} + +// GetSecretScanningDelegatedBypass returns the SecretScanningDelegatedBypass field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetSecretScanningDelegatedBypass() string { + if c == nil || c.SecretScanningDelegatedBypass == nil { + return "" + } + return *c.SecretScanningDelegatedBypass +} + +// GetSecretScanningDelegatedBypassOptions returns the SecretScanningDelegatedBypassOptions field. +func (c *CodeSecurityConfiguration) GetSecretScanningDelegatedBypassOptions() *SecretScanningDelegatedBypassOptions { + if c == nil { + return nil + } + return c.SecretScanningDelegatedBypassOptions +} + +// GetSecretScanningExtendedMetadata returns the SecretScanningExtendedMetadata field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetSecretScanningExtendedMetadata() string { + if c == nil || c.SecretScanningExtendedMetadata == nil { + return "" + } + return *c.SecretScanningExtendedMetadata +} + +// GetSecretScanningGenericSecrets returns the SecretScanningGenericSecrets field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetSecretScanningGenericSecrets() string { + if c == nil || c.SecretScanningGenericSecrets == nil { + return "" + } + return *c.SecretScanningGenericSecrets +} + // GetSecretScanningNonProviderPatterns returns the SecretScanningNonProviderPatterns field if it's non-nil, zero value otherwise. func (c *CodeSecurityConfiguration) GetSecretScanningNonProviderPatterns() string { if c == nil || c.SecretScanningNonProviderPatterns == nil { @@ -3134,6 +5430,14 @@ func (c *Codespace) GetPullsURL() string { return *c.PullsURL } +// GetRecentFolders returns the RecentFolders slice if it's non-nil, nil otherwise. +func (c *Codespace) GetRecentFolders() []string { + if c == nil || c.RecentFolders == nil { + return nil + } + return c.RecentFolders +} + // GetRepository returns the Repository field. func (c *Codespace) GetRepository() *Repository { if c == nil { @@ -3214,6 +5518,238 @@ func (c *Codespace) GetWebURL() string { return *c.WebURL } +// GetClientIP returns the ClientIP field if it's non-nil, zero value otherwise. +func (c *CodespaceCreateForUserOptions) GetClientIP() string { + if c == nil || c.ClientIP == nil { + return "" + } + return *c.ClientIP +} + +// GetDevcontainerPath returns the DevcontainerPath field if it's non-nil, zero value otherwise. +func (c *CodespaceCreateForUserOptions) GetDevcontainerPath() string { + if c == nil || c.DevcontainerPath == nil { + return "" + } + return *c.DevcontainerPath +} + +// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. +func (c *CodespaceCreateForUserOptions) GetDisplayName() string { + if c == nil || c.DisplayName == nil { + return "" + } + return *c.DisplayName +} + +// GetGeo returns the Geo field if it's non-nil, zero value otherwise. +func (c *CodespaceCreateForUserOptions) GetGeo() string { + if c == nil || c.Geo == nil { + return "" + } + return *c.Geo +} + +// GetIdleTimeoutMinutes returns the IdleTimeoutMinutes field if it's non-nil, zero value otherwise. +func (c *CodespaceCreateForUserOptions) GetIdleTimeoutMinutes() int { + if c == nil || c.IdleTimeoutMinutes == nil { + return 0 + } + return *c.IdleTimeoutMinutes +} + +// GetLocation returns the Location field if it's non-nil, zero value otherwise. +func (c *CodespaceCreateForUserOptions) GetLocation() string { + if c == nil || c.Location == nil { + return "" + } + return *c.Location +} + +// GetMachine returns the Machine field if it's non-nil, zero value otherwise. +func (c *CodespaceCreateForUserOptions) GetMachine() string { + if c == nil || c.Machine == nil { + return "" + } + return *c.Machine +} + +// GetMultiRepoPermissionsOptOut returns the MultiRepoPermissionsOptOut field if it's non-nil, zero value otherwise. +func (c *CodespaceCreateForUserOptions) GetMultiRepoPermissionsOptOut() bool { + if c == nil || c.MultiRepoPermissionsOptOut == nil { + return false + } + return *c.MultiRepoPermissionsOptOut +} + +// GetPullRequest returns the PullRequest field. +func (c *CodespaceCreateForUserOptions) GetPullRequest() *CodespacePullRequestOptions { + if c == nil { + return nil + } + return c.PullRequest +} + +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (c *CodespaceCreateForUserOptions) GetRef() string { + if c == nil || c.Ref == nil { + return "" + } + return *c.Ref +} + +// GetRepositoryID returns the RepositoryID field. +func (c *CodespaceCreateForUserOptions) GetRepositoryID() int64 { + if c == nil { + return 0 + } + return c.RepositoryID +} + +// GetRetentionPeriodMinutes returns the RetentionPeriodMinutes field if it's non-nil, zero value otherwise. +func (c *CodespaceCreateForUserOptions) GetRetentionPeriodMinutes() int { + if c == nil || c.RetentionPeriodMinutes == nil { + return 0 + } + return *c.RetentionPeriodMinutes +} + +// GetWorkingDirectory returns the WorkingDirectory field if it's non-nil, zero value otherwise. +func (c *CodespaceCreateForUserOptions) GetWorkingDirectory() string { + if c == nil || c.WorkingDirectory == nil { + return "" + } + return *c.WorkingDirectory +} + +// GetBillableOwner returns the BillableOwner field. +func (c *CodespaceDefaultAttributes) GetBillableOwner() *User { + if c == nil { + return nil + } + return c.BillableOwner +} + +// GetDefaults returns the Defaults field. +func (c *CodespaceDefaultAttributes) GetDefaults() *CodespaceDefaults { + if c == nil { + return nil + } + return c.Defaults +} + +// GetDevcontainerPath returns the DevcontainerPath field if it's non-nil, zero value otherwise. +func (c *CodespaceDefaults) GetDevcontainerPath() string { + if c == nil || c.DevcontainerPath == nil { + return "" + } + return *c.DevcontainerPath +} + +// GetLocation returns the Location field. +func (c *CodespaceDefaults) GetLocation() string { + if c == nil { + return "" + } + return c.Location +} + +// GetBranch returns the Branch field if it's non-nil, zero value otherwise. +func (c *CodespaceExport) GetBranch() string { + if c == nil || c.Branch == nil { + return "" + } + return *c.Branch +} + +// GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. +func (c *CodespaceExport) GetCompletedAt() Timestamp { + if c == nil || c.CompletedAt == nil { + return Timestamp{} + } + return *c.CompletedAt +} + +// GetExportURL returns the ExportURL field if it's non-nil, zero value otherwise. +func (c *CodespaceExport) GetExportURL() string { + if c == nil || c.ExportURL == nil { + return "" + } + return *c.ExportURL +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (c *CodespaceExport) GetHTMLURL() string { + if c == nil || c.HTMLURL == nil { + return "" + } + return *c.HTMLURL +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *CodespaceExport) GetID() string { + if c == nil || c.ID == nil { + return "" + } + return *c.ID +} + +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (c *CodespaceExport) GetSHA() string { + if c == nil || c.SHA == nil { + return "" + } + return *c.SHA +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (c *CodespaceExport) GetState() string { + if c == nil || c.State == nil { + return "" + } + return *c.State +} + +// GetClientIP returns the ClientIP field if it's non-nil, zero value otherwise. +func (c *CodespaceGetDefaultAttributesOptions) GetClientIP() string { + if c == nil || c.ClientIP == nil { + return "" + } + return *c.ClientIP +} + +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (c *CodespaceGetDefaultAttributesOptions) GetRef() string { + if c == nil || c.Ref == nil { + return "" + } + return *c.Ref +} + +// GetAccepted returns the Accepted field. +func (c *CodespacePermissions) GetAccepted() bool { + if c == nil { + return false + } + return c.Accepted +} + +// GetPullRequestNumber returns the PullRequestNumber field. +func (c *CodespacePullRequestOptions) GetPullRequestNumber() int64 { + if c == nil { + return 0 + } + return c.PullRequestNumber +} + +// GetRepositoryID returns the RepositoryID field. +func (c *CodespacePullRequestOptions) GetRepositoryID() int64 { + if c == nil { + return 0 + } + return c.RepositoryID +} + // GetAhead returns the Ahead field if it's non-nil, zero value otherwise. func (c *CodespacesGitStatus) GetAhead() int { if c == nil || c.Ahead == nil { @@ -3310,6 +5846,46 @@ func (c *CodespacesMachine) GetStorageInBytes() int64 { return *c.StorageInBytes } +// GetMachines returns the Machines slice if it's non-nil, nil otherwise. +func (c *CodespacesMachines) GetMachines() []*CodespacesMachine { + if c == nil || c.Machines == nil { + return nil + } + return c.Machines +} + +// GetTotalCount returns the TotalCount field. +func (c *CodespacesMachines) GetTotalCount() int64 { + if c == nil { + return 0 + } + return c.TotalCount +} + +// GetSelectedUsernames returns the SelectedUsernames slice if it's non-nil, nil otherwise. +func (c *CodespacesOrgAccessControlRequest) GetSelectedUsernames() []string { + if c == nil || c.SelectedUsernames == nil { + return nil + } + return c.SelectedUsernames +} + +// GetVisibility returns the Visibility field. +func (c *CodespacesOrgAccessControlRequest) GetVisibility() string { + if c == nil { + return "" + } + return c.Visibility +} + +// GetAllowedPortPrivacySettings returns the AllowedPortPrivacySettings slice if it's non-nil, nil otherwise. +func (c *CodespacesRuntimeConstraints) GetAllowedPortPrivacySettings() []string { + if c == nil || c.AllowedPortPrivacySettings == nil { + return nil + } + return c.AllowedPortPrivacySettings +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (c *CollaboratorInvitation) GetCreatedAt() Timestamp { if c == nil || c.CreatedAt == nil { @@ -3414,6 +5990,14 @@ func (c *CombinedStatus) GetState() string { return *c.State } +// GetStatuses returns the Statuses slice if it's non-nil, nil otherwise. +func (c *CombinedStatus) GetStatuses() []*RepoStatus { + if c == nil || c.Statuses == nil { + return nil + } + return c.Statuses +} + // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. func (c *CombinedStatus) GetTotalCount() int { if c == nil || c.TotalCount == nil { @@ -3422,6 +6006,14 @@ func (c *CombinedStatus) GetTotalCount() int { return *c.TotalCount } +// GetBody returns the Body field. +func (c *Comment) GetBody() string { + if c == nil { + return "" + } + return c.Body +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (c *Comment) GetCreatedAt() Timestamp { if c == nil || c.CreatedAt == nil { @@ -3614,6 +6206,14 @@ func (c *Commit) GetNodeID() string { return *c.NodeID } +// GetParents returns the Parents slice if it's non-nil, nil otherwise. +func (c *Commit) GetParents() []*Commit { + if c == nil || c.Parents == nil { + return nil + } + return c.Parents +} + // GetSHA returns the SHA field if it's non-nil, zero value otherwise. func (c *Commit) GetSHA() string { if c == nil || c.SHA == nil { @@ -3854,6 +6454,14 @@ func (c *CommitResult) GetHTMLURL() string { return *c.HTMLURL } +// GetParents returns the Parents slice if it's non-nil, nil otherwise. +func (c *CommitResult) GetParents() []*Commit { + if c == nil || c.Parents == nil { + return nil + } + return c.Parents +} + // GetRepository returns the Repository field. func (c *CommitResult) GetRepository() *Repository { if c == nil { @@ -3862,12 +6470,12 @@ func (c *CommitResult) GetRepository() *Repository { return c.Repository } -// GetScore returns the Score field. -func (c *CommitResult) GetScore() *float64 { - if c == nil { - return nil +// GetScore returns the Score field if it's non-nil, zero value otherwise. +func (c *CommitResult) GetScore() float64 { + if c == nil || c.Score == nil { + return 0 } - return c.Score + return *c.Score } // GetSHA returns the SHA field if it's non-nil, zero value otherwise. @@ -3910,6 +6518,14 @@ func (c *CommitsComparison) GetBehindBy() int { return *c.BehindBy } +// GetCommits returns the Commits slice if it's non-nil, nil otherwise. +func (c *CommitsComparison) GetCommits() []*RepositoryCommit { + if c == nil || c.Commits == nil { + return nil + } + return c.Commits +} + // GetDiffURL returns the DiffURL field if it's non-nil, zero value otherwise. func (c *CommitsComparison) GetDiffURL() string { if c == nil || c.DiffURL == nil { @@ -3918,6 +6534,14 @@ func (c *CommitsComparison) GetDiffURL() string { return *c.DiffURL } +// GetFiles returns the Files slice if it's non-nil, nil otherwise. +func (c *CommitsComparison) GetFiles() []*CommitFile { + if c == nil || c.Files == nil { + return nil + } + return c.Files +} + // GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. func (c *CommitsComparison) GetHTMLURL() string { if c == nil || c.HTMLURL == nil { @@ -3974,6 +6598,54 @@ func (c *CommitsComparison) GetURL() string { return *c.URL } +// GetAuthor returns the Author field. +func (c *CommitsListOptions) GetAuthor() string { + if c == nil { + return "" + } + return c.Author +} + +// GetPath returns the Path field. +func (c *CommitsListOptions) GetPath() string { + if c == nil { + return "" + } + return c.Path +} + +// GetSHA returns the SHA field. +func (c *CommitsListOptions) GetSHA() string { + if c == nil { + return "" + } + return c.SHA +} + +// GetSince returns the Since field. +func (c *CommitsListOptions) GetSince() time.Time { + if c == nil { + return time.Time{} + } + return c.Since +} + +// GetUntil returns the Until field. +func (c *CommitsListOptions) GetUntil() time.Time { + if c == nil { + return time.Time{} + } + return c.Until +} + +// GetCommits returns the Commits slice if it's non-nil, nil otherwise. +func (c *CommitsSearchResult) GetCommits() []*CommitResult { + if c == nil || c.Commits == nil { + return nil + } + return c.Commits +} + // GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. func (c *CommitsSearchResult) GetIncompleteResults() bool { if c == nil || c.IncompleteResults == nil { @@ -4118,6 +6790,22 @@ func (c *CommunityHealthMetrics) GetUpdatedAt() Timestamp { return *c.UpdatedAt } +// GetNodes returns the Nodes slice if it's non-nil, nil otherwise. +func (c *ConfigApplyEvents) GetNodes() []*ConfigApplyEventsNode { + if c == nil || c.Nodes == nil { + return nil + } + return c.Nodes +} + +// GetEvents returns the Events slice if it's non-nil, nil otherwise. +func (c *ConfigApplyEventsNode) GetEvents() []*ConfigApplyEventsNodeEvent { + if c == nil || c.Events == nil { + return nil + } + return c.Events +} + // GetLastRequestID returns the LastRequestID field if it's non-nil, zero value otherwise. func (c *ConfigApplyEventsNode) GetLastRequestID() string { if c == nil || c.LastRequestID == nil { @@ -4238,6 +6926,14 @@ func (c *ConfigApplyOptions) GetRunID() string { return *c.RunID } +// GetNodes returns the Nodes slice if it's non-nil, nil otherwise. +func (c *ConfigApplyStatus) GetNodes() []*ConfigApplyStatusNode { + if c == nil || c.Nodes == nil { + return nil + } + return c.Nodes +} + // GetRunning returns the Running field if it's non-nil, zero value otherwise. func (c *ConfigApplyStatus) GetRunning() bool { if c == nil || c.Running == nil { @@ -4702,6 +7398,14 @@ func (c *ConfigSettingsLDAP) GetAdminGroup() string { return *c.AdminGroup } +// GetBase returns the Base slice if it's non-nil, nil otherwise. +func (c *ConfigSettingsLDAP) GetBase() []string { + if c == nil || c.Base == nil { + return nil + } + return c.Base +} + // GetBindDN returns the BindDN field if it's non-nil, zero value otherwise. func (c *ConfigSettingsLDAP) GetBindDN() string { if c == nil || c.BindDN == nil { @@ -4806,6 +7510,14 @@ func (c *ConfigSettingsLDAP) GetUID() string { return *c.UID } +// GetUserGroups returns the UserGroups slice if it's non-nil, nil otherwise. +func (c *ConfigSettingsLDAP) GetUserGroups() []string { + if c == nil || c.UserGroups == nil { + return nil + } + return c.UserGroups +} + // GetUserSyncEmails returns the UserSyncEmails field if it's non-nil, zero value otherwise. func (c *ConfigSettingsLDAP) GetUserSyncEmails() bool { if c == nil || c.UserSyncEmails == nil { @@ -5446,6 +8158,14 @@ func (c *Contributor) GetURL() string { return *c.URL } +// GetApprovalPolicy returns the ApprovalPolicy field. +func (c *ContributorApprovalPermissions) GetApprovalPolicy() string { + if c == nil { + return "" + } + return c.ApprovalPolicy +} + // GetAuthor returns the Author field. func (c *ContributorStats) GetAuthor() *Contributor { if c == nil { @@ -5462,6 +8182,278 @@ func (c *ContributorStats) GetTotal() int { return *c.Total } +// GetWeeks returns the Weeks slice if it's non-nil, nil otherwise. +func (c *ContributorStats) GetWeeks() []*WeeklyStats { + if c == nil || c.Weeks == nil { + return nil + } + return c.Weeks +} + +// GetParameters returns the Parameters field. +func (c *CopilotCodeReviewBranchRule) GetParameters() CopilotCodeReviewRuleParameters { + if c == nil { + return CopilotCodeReviewRuleParameters{} + } + return c.Parameters +} + +// GetReviewDraftPullRequests returns the ReviewDraftPullRequests field. +func (c *CopilotCodeReviewRuleParameters) GetReviewDraftPullRequests() bool { + if c == nil { + return false + } + return c.ReviewDraftPullRequests +} + +// GetReviewOnPush returns the ReviewOnPush field. +func (c *CopilotCodeReviewRuleParameters) GetReviewOnPush() bool { + if c == nil { + return false + } + return c.ReviewOnPush +} + +// GetCodeAcceptanceActivityCount returns the CodeAcceptanceActivityCount field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetCodeAcceptanceActivityCount() int { + if c == nil || c.CodeAcceptanceActivityCount == nil { + return 0 + } + return *c.CodeAcceptanceActivityCount +} + +// GetCodeGenerationActivityCount returns the CodeGenerationActivityCount field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetCodeGenerationActivityCount() int { + if c == nil || c.CodeGenerationActivityCount == nil { + return 0 + } + return *c.CodeGenerationActivityCount +} + +// GetDailyActiveCLIUsers returns the DailyActiveCLIUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetDailyActiveCLIUsers() int { + if c == nil || c.DailyActiveCLIUsers == nil { + return 0 + } + return *c.DailyActiveCLIUsers +} + +// GetDailyActiveCopilotCloudAgentUsers returns the DailyActiveCopilotCloudAgentUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetDailyActiveCopilotCloudAgentUsers() int { + if c == nil || c.DailyActiveCopilotCloudAgentUsers == nil { + return 0 + } + return *c.DailyActiveCopilotCloudAgentUsers +} + +// GetDailyActiveUsers returns the DailyActiveUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetDailyActiveUsers() int { + if c == nil || c.DailyActiveUsers == nil { + return 0 + } + return *c.DailyActiveUsers +} + +// GetDay returns the Day field. +func (c *CopilotDailyMetrics) GetDay() string { + if c == nil { + return "" + } + return c.Day +} + +// GetEnterpriseID returns the EnterpriseID field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetEnterpriseID() string { + if c == nil || c.EnterpriseID == nil { + return "" + } + return *c.EnterpriseID +} + +// GetLOCAddedSum returns the LOCAddedSum field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetLOCAddedSum() int { + if c == nil || c.LOCAddedSum == nil { + return 0 + } + return *c.LOCAddedSum +} + +// GetLOCDeletedSum returns the LOCDeletedSum field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetLOCDeletedSum() int { + if c == nil || c.LOCDeletedSum == nil { + return 0 + } + return *c.LOCDeletedSum +} + +// GetLOCSuggestedToAddSum returns the LOCSuggestedToAddSum field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetLOCSuggestedToAddSum() int { + if c == nil || c.LOCSuggestedToAddSum == nil { + return 0 + } + return *c.LOCSuggestedToAddSum +} + +// GetLOCSuggestedToDeleteSum returns the LOCSuggestedToDeleteSum field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetLOCSuggestedToDeleteSum() int { + if c == nil || c.LOCSuggestedToDeleteSum == nil { + return 0 + } + return *c.LOCSuggestedToDeleteSum +} + +// GetMonthlyActiveAgentUsers returns the MonthlyActiveAgentUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetMonthlyActiveAgentUsers() int { + if c == nil || c.MonthlyActiveAgentUsers == nil { + return 0 + } + return *c.MonthlyActiveAgentUsers +} + +// GetMonthlyActiveChatUsers returns the MonthlyActiveChatUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetMonthlyActiveChatUsers() int { + if c == nil || c.MonthlyActiveChatUsers == nil { + return 0 + } + return *c.MonthlyActiveChatUsers +} + +// GetMonthlyActiveCopilotCloudAgentUsers returns the MonthlyActiveCopilotCloudAgentUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetMonthlyActiveCopilotCloudAgentUsers() int { + if c == nil || c.MonthlyActiveCopilotCloudAgentUsers == nil { + return 0 + } + return *c.MonthlyActiveCopilotCloudAgentUsers +} + +// GetMonthlyActiveUsers returns the MonthlyActiveUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetMonthlyActiveUsers() int { + if c == nil || c.MonthlyActiveUsers == nil { + return 0 + } + return *c.MonthlyActiveUsers +} + +// GetOrganizationID returns the OrganizationID field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetOrganizationID() string { + if c == nil || c.OrganizationID == nil { + return "" + } + return *c.OrganizationID +} + +// GetPullRequests returns the PullRequests field. +func (c *CopilotDailyMetrics) GetPullRequests() *CopilotMetricsPullRequests { + if c == nil { + return nil + } + return c.PullRequests +} + +// GetTotalsByCLI returns the TotalsByCLI field. +func (c *CopilotDailyMetrics) GetTotalsByCLI() *CopilotMetricsCLI { + if c == nil { + return nil + } + return c.TotalsByCLI +} + +// GetTotalsByFeature returns the TotalsByFeature slice if it's non-nil, nil otherwise. +func (c *CopilotDailyMetrics) GetTotalsByFeature() []*CopilotMetricsFeature { + if c == nil || c.TotalsByFeature == nil { + return nil + } + return c.TotalsByFeature +} + +// GetTotalsByIDE returns the TotalsByIDE slice if it's non-nil, nil otherwise. +func (c *CopilotDailyMetrics) GetTotalsByIDE() []*CopilotMetricsIDE { + if c == nil || c.TotalsByIDE == nil { + return nil + } + return c.TotalsByIDE +} + +// GetTotalsByLanguageFeature returns the TotalsByLanguageFeature slice if it's non-nil, nil otherwise. +func (c *CopilotDailyMetrics) GetTotalsByLanguageFeature() []*CopilotMetricsLanguageFeature { + if c == nil || c.TotalsByLanguageFeature == nil { + return nil + } + return c.TotalsByLanguageFeature +} + +// GetTotalsByLanguageModel returns the TotalsByLanguageModel slice if it's non-nil, nil otherwise. +func (c *CopilotDailyMetrics) GetTotalsByLanguageModel() []*CopilotMetricsLanguageModel { + if c == nil || c.TotalsByLanguageModel == nil { + return nil + } + return c.TotalsByLanguageModel +} + +// GetTotalsByModelFeature returns the TotalsByModelFeature slice if it's non-nil, nil otherwise. +func (c *CopilotDailyMetrics) GetTotalsByModelFeature() []*CopilotMetricsModelFeature { + if c == nil || c.TotalsByModelFeature == nil { + return nil + } + return c.TotalsByModelFeature +} + +// GetUserInitiatedInteractionCount returns the UserInitiatedInteractionCount field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetUserInitiatedInteractionCount() int { + if c == nil || c.UserInitiatedInteractionCount == nil { + return 0 + } + return *c.UserInitiatedInteractionCount +} + +// GetWeeklyActiveCopilotCloudAgentUsers returns the WeeklyActiveCopilotCloudAgentUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetWeeklyActiveCopilotCloudAgentUsers() int { + if c == nil || c.WeeklyActiveCopilotCloudAgentUsers == nil { + return 0 + } + return *c.WeeklyActiveCopilotCloudAgentUsers +} + +// GetWeeklyActiveUsers returns the WeeklyActiveUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetWeeklyActiveUsers() int { + if c == nil || c.WeeklyActiveUsers == nil { + return 0 + } + return *c.WeeklyActiveUsers +} + +// GetDownloadLinks returns the DownloadLinks slice if it's non-nil, nil otherwise. +func (c *CopilotDailyMetricsReport) GetDownloadLinks() []string { + if c == nil || c.DownloadLinks == nil { + return nil + } + return c.DownloadLinks +} + +// GetReportDay returns the ReportDay field. +func (c *CopilotDailyMetricsReport) GetReportDay() string { + if c == nil { + return "" + } + return c.ReportDay +} + +// GetModels returns the Models slice if it's non-nil, nil otherwise. +func (c *CopilotDotcomChat) GetModels() []*CopilotDotcomChatModel { + if c == nil || c.Models == nil { + return nil + } + return c.Models +} + +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotDotcomChat) GetTotalEngagedUsers() int { + if c == nil { + return 0 + } + return c.TotalEngagedUsers +} + // GetCustomModelTrainingDate returns the CustomModelTrainingDate field if it's non-nil, zero value otherwise. func (c *CopilotDotcomChatModel) GetCustomModelTrainingDate() string { if c == nil || c.CustomModelTrainingDate == nil { @@ -5470,6 +8462,54 @@ func (c *CopilotDotcomChatModel) GetCustomModelTrainingDate() string { return *c.CustomModelTrainingDate } +// GetIsCustomModel returns the IsCustomModel field. +func (c *CopilotDotcomChatModel) GetIsCustomModel() bool { + if c == nil { + return false + } + return c.IsCustomModel +} + +// GetName returns the Name field. +func (c *CopilotDotcomChatModel) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetTotalChats returns the TotalChats field. +func (c *CopilotDotcomChatModel) GetTotalChats() int { + if c == nil { + return 0 + } + return c.TotalChats +} + +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotDotcomChatModel) GetTotalEngagedUsers() int { + if c == nil { + return 0 + } + return c.TotalEngagedUsers +} + +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (c *CopilotDotcomPullRequests) GetRepositories() []*CopilotDotcomPullRequestsRepository { + if c == nil || c.Repositories == nil { + return nil + } + return c.Repositories +} + +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotDotcomPullRequests) GetTotalEngagedUsers() int { + if c == nil { + return 0 + } + return c.TotalEngagedUsers +} + // GetCustomModelTrainingDate returns the CustomModelTrainingDate field if it's non-nil, zero value otherwise. func (c *CopilotDotcomPullRequestsModel) GetCustomModelTrainingDate() string { if c == nil || c.CustomModelTrainingDate == nil { @@ -5478,6 +8518,102 @@ func (c *CopilotDotcomPullRequestsModel) GetCustomModelTrainingDate() string { return *c.CustomModelTrainingDate } +// GetIsCustomModel returns the IsCustomModel field. +func (c *CopilotDotcomPullRequestsModel) GetIsCustomModel() bool { + if c == nil { + return false + } + return c.IsCustomModel +} + +// GetName returns the Name field. +func (c *CopilotDotcomPullRequestsModel) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotDotcomPullRequestsModel) GetTotalEngagedUsers() int { + if c == nil { + return 0 + } + return c.TotalEngagedUsers +} + +// GetTotalPRSummariesCreated returns the TotalPRSummariesCreated field. +func (c *CopilotDotcomPullRequestsModel) GetTotalPRSummariesCreated() int { + if c == nil { + return 0 + } + return c.TotalPRSummariesCreated +} + +// GetModels returns the Models slice if it's non-nil, nil otherwise. +func (c *CopilotDotcomPullRequestsRepository) GetModels() []*CopilotDotcomPullRequestsModel { + if c == nil || c.Models == nil { + return nil + } + return c.Models +} + +// GetName returns the Name field. +func (c *CopilotDotcomPullRequestsRepository) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotDotcomPullRequestsRepository) GetTotalEngagedUsers() int { + if c == nil { + return 0 + } + return c.TotalEngagedUsers +} + +// GetEditors returns the Editors slice if it's non-nil, nil otherwise. +func (c *CopilotIDEChat) GetEditors() []*CopilotIDEChatEditor { + if c == nil || c.Editors == nil { + return nil + } + return c.Editors +} + +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotIDEChat) GetTotalEngagedUsers() int { + if c == nil { + return 0 + } + return c.TotalEngagedUsers +} + +// GetModels returns the Models slice if it's non-nil, nil otherwise. +func (c *CopilotIDEChatEditor) GetModels() []*CopilotIDEChatModel { + if c == nil || c.Models == nil { + return nil + } + return c.Models +} + +// GetName returns the Name field. +func (c *CopilotIDEChatEditor) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotIDEChatEditor) GetTotalEngagedUsers() int { + if c == nil { + return 0 + } + return c.TotalEngagedUsers +} + // GetCustomModelTrainingDate returns the CustomModelTrainingDate field if it's non-nil, zero value otherwise. func (c *CopilotIDEChatModel) GetCustomModelTrainingDate() string { if c == nil || c.CustomModelTrainingDate == nil { @@ -5486,6 +8622,118 @@ func (c *CopilotIDEChatModel) GetCustomModelTrainingDate() string { return *c.CustomModelTrainingDate } +// GetIsCustomModel returns the IsCustomModel field. +func (c *CopilotIDEChatModel) GetIsCustomModel() bool { + if c == nil { + return false + } + return c.IsCustomModel +} + +// GetName returns the Name field. +func (c *CopilotIDEChatModel) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetTotalChatCopyEvents returns the TotalChatCopyEvents field. +func (c *CopilotIDEChatModel) GetTotalChatCopyEvents() int { + if c == nil { + return 0 + } + return c.TotalChatCopyEvents +} + +// GetTotalChatInsertionEvents returns the TotalChatInsertionEvents field. +func (c *CopilotIDEChatModel) GetTotalChatInsertionEvents() int { + if c == nil { + return 0 + } + return c.TotalChatInsertionEvents +} + +// GetTotalChats returns the TotalChats field. +func (c *CopilotIDEChatModel) GetTotalChats() int { + if c == nil { + return 0 + } + return c.TotalChats +} + +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotIDEChatModel) GetTotalEngagedUsers() int { + if c == nil { + return 0 + } + return c.TotalEngagedUsers +} + +// GetEditors returns the Editors slice if it's non-nil, nil otherwise. +func (c *CopilotIDECodeCompletions) GetEditors() []*CopilotIDECodeCompletionsEditor { + if c == nil || c.Editors == nil { + return nil + } + return c.Editors +} + +// GetLanguages returns the Languages slice if it's non-nil, nil otherwise. +func (c *CopilotIDECodeCompletions) GetLanguages() []*CopilotIDECodeCompletionsLanguage { + if c == nil || c.Languages == nil { + return nil + } + return c.Languages +} + +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotIDECodeCompletions) GetTotalEngagedUsers() int { + if c == nil { + return 0 + } + return c.TotalEngagedUsers +} + +// GetModels returns the Models slice if it's non-nil, nil otherwise. +func (c *CopilotIDECodeCompletionsEditor) GetModels() []*CopilotIDECodeCompletionsModel { + if c == nil || c.Models == nil { + return nil + } + return c.Models +} + +// GetName returns the Name field. +func (c *CopilotIDECodeCompletionsEditor) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotIDECodeCompletionsEditor) GetTotalEngagedUsers() int { + if c == nil { + return 0 + } + return c.TotalEngagedUsers +} + +// GetName returns the Name field. +func (c *CopilotIDECodeCompletionsLanguage) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotIDECodeCompletionsLanguage) GetTotalEngagedUsers() int { + if c == nil { + return 0 + } + return c.TotalEngagedUsers +} + // GetCustomModelTrainingDate returns the CustomModelTrainingDate field if it's non-nil, zero value otherwise. func (c *CopilotIDECodeCompletionsModel) GetCustomModelTrainingDate() string { if c == nil || c.CustomModelTrainingDate == nil { @@ -5494,6 +8742,86 @@ func (c *CopilotIDECodeCompletionsModel) GetCustomModelTrainingDate() string { return *c.CustomModelTrainingDate } +// GetIsCustomModel returns the IsCustomModel field. +func (c *CopilotIDECodeCompletionsModel) GetIsCustomModel() bool { + if c == nil { + return false + } + return c.IsCustomModel +} + +// GetLanguages returns the Languages slice if it's non-nil, nil otherwise. +func (c *CopilotIDECodeCompletionsModel) GetLanguages() []*CopilotIDECodeCompletionsModelLanguage { + if c == nil || c.Languages == nil { + return nil + } + return c.Languages +} + +// GetName returns the Name field. +func (c *CopilotIDECodeCompletionsModel) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotIDECodeCompletionsModel) GetTotalEngagedUsers() int { + if c == nil { + return 0 + } + return c.TotalEngagedUsers +} + +// GetName returns the Name field. +func (c *CopilotIDECodeCompletionsModelLanguage) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetTotalCodeAcceptances returns the TotalCodeAcceptances field. +func (c *CopilotIDECodeCompletionsModelLanguage) GetTotalCodeAcceptances() int { + if c == nil { + return 0 + } + return c.TotalCodeAcceptances +} + +// GetTotalCodeLinesAccepted returns the TotalCodeLinesAccepted field. +func (c *CopilotIDECodeCompletionsModelLanguage) GetTotalCodeLinesAccepted() int { + if c == nil { + return 0 + } + return c.TotalCodeLinesAccepted +} + +// GetTotalCodeLinesSuggested returns the TotalCodeLinesSuggested field. +func (c *CopilotIDECodeCompletionsModelLanguage) GetTotalCodeLinesSuggested() int { + if c == nil { + return 0 + } + return c.TotalCodeLinesSuggested +} + +// GetTotalCodeSuggestions returns the TotalCodeSuggestions field. +func (c *CopilotIDECodeCompletionsModelLanguage) GetTotalCodeSuggestions() int { + if c == nil { + return 0 + } + return c.TotalCodeSuggestions +} + +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotIDECodeCompletionsModelLanguage) GetTotalEngagedUsers() int { + if c == nil { + return 0 + } + return c.TotalEngagedUsers +} + // GetCopilotDotcomChat returns the CopilotDotcomChat field. func (c *CopilotMetrics) GetCopilotDotcomChat() *CopilotDotcomChat { if c == nil { @@ -5526,6 +8854,14 @@ func (c *CopilotMetrics) GetCopilotIDECodeCompletions() *CopilotIDECodeCompletio return c.CopilotIDECodeCompletions } +// GetDate returns the Date field. +func (c *CopilotMetrics) GetDate() string { + if c == nil { + return "" + } + return c.Date +} + // GetTotalActiveUsers returns the TotalActiveUsers field if it's non-nil, zero value otherwise. func (c *CopilotMetrics) GetTotalActiveUsers() int { if c == nil || c.TotalActiveUsers == nil { @@ -5542,6 +8878,238 @@ func (c *CopilotMetrics) GetTotalEngagedUsers() int { return *c.TotalEngagedUsers } +// GetChatPanelAgentMode returns the ChatPanelAgentMode field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsChatPanel) GetChatPanelAgentMode() int { + if c == nil || c.ChatPanelAgentMode == nil { + return 0 + } + return *c.ChatPanelAgentMode +} + +// GetChatPanelAskMode returns the ChatPanelAskMode field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsChatPanel) GetChatPanelAskMode() int { + if c == nil || c.ChatPanelAskMode == nil { + return 0 + } + return *c.ChatPanelAskMode +} + +// GetChatPanelCustomMode returns the ChatPanelCustomMode field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsChatPanel) GetChatPanelCustomMode() int { + if c == nil || c.ChatPanelCustomMode == nil { + return 0 + } + return *c.ChatPanelCustomMode +} + +// GetChatPanelEditMode returns the ChatPanelEditMode field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsChatPanel) GetChatPanelEditMode() int { + if c == nil || c.ChatPanelEditMode == nil { + return 0 + } + return *c.ChatPanelEditMode +} + +// GetChatPanelUnknownMode returns the ChatPanelUnknownMode field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsChatPanel) GetChatPanelUnknownMode() int { + if c == nil || c.ChatPanelUnknownMode == nil { + return 0 + } + return *c.ChatPanelUnknownMode +} + +// GetLastKnownCLIVersion returns the LastKnownCLIVersion field. +func (c *CopilotMetricsCLI) GetLastKnownCLIVersion() *CopilotMetricsCLIVersion { + if c == nil { + return nil + } + return c.LastKnownCLIVersion +} + +// GetPromptCount returns the PromptCount field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCLI) GetPromptCount() int { + if c == nil || c.PromptCount == nil { + return 0 + } + return *c.PromptCount +} + +// GetRequestCount returns the RequestCount field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCLI) GetRequestCount() int { + if c == nil || c.RequestCount == nil { + return 0 + } + return *c.RequestCount +} + +// GetSessionCount returns the SessionCount field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCLI) GetSessionCount() int { + if c == nil || c.SessionCount == nil { + return 0 + } + return *c.SessionCount +} + +// GetTokenUsage returns the TokenUsage field. +func (c *CopilotMetricsCLI) GetTokenUsage() *CopilotMetricsCLITokenUsage { + if c == nil { + return nil + } + return c.TokenUsage +} + +// GetAvgTokensPerRequest returns the AvgTokensPerRequest field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCLITokenUsage) GetAvgTokensPerRequest() float64 { + if c == nil || c.AvgTokensPerRequest == nil { + return 0 + } + return *c.AvgTokensPerRequest +} + +// GetOutputTokensSum returns the OutputTokensSum field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCLITokenUsage) GetOutputTokensSum() int { + if c == nil || c.OutputTokensSum == nil { + return 0 + } + return *c.OutputTokensSum +} + +// GetPromptTokensSum returns the PromptTokensSum field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCLITokenUsage) GetPromptTokensSum() int { + if c == nil || c.PromptTokensSum == nil { + return 0 + } + return *c.PromptTokensSum +} + +// GetCLIVersion returns the CLIVersion field. +func (c *CopilotMetricsCLIVersion) GetCLIVersion() string { + if c == nil { + return "" + } + return c.CLIVersion +} + +// GetSampledAt returns the SampledAt field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCLIVersion) GetSampledAt() Timestamp { + if c == nil || c.SampledAt == nil { + return Timestamp{} + } + return *c.SampledAt +} + +// GetCodeAcceptanceActivityCount returns the CodeAcceptanceActivityCount field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCodeActivity) GetCodeAcceptanceActivityCount() int { + if c == nil || c.CodeAcceptanceActivityCount == nil { + return 0 + } + return *c.CodeAcceptanceActivityCount +} + +// GetCodeGenerationActivityCount returns the CodeGenerationActivityCount field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCodeActivity) GetCodeGenerationActivityCount() int { + if c == nil || c.CodeGenerationActivityCount == nil { + return 0 + } + return *c.CodeGenerationActivityCount +} + +// GetLOCAddedSum returns the LOCAddedSum field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCodeActivity) GetLOCAddedSum() int { + if c == nil || c.LOCAddedSum == nil { + return 0 + } + return *c.LOCAddedSum +} + +// GetLOCDeletedSum returns the LOCDeletedSum field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCodeActivity) GetLOCDeletedSum() int { + if c == nil || c.LOCDeletedSum == nil { + return 0 + } + return *c.LOCDeletedSum +} + +// GetLOCSuggestedToAddSum returns the LOCSuggestedToAddSum field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCodeActivity) GetLOCSuggestedToAddSum() int { + if c == nil || c.LOCSuggestedToAddSum == nil { + return 0 + } + return *c.LOCSuggestedToAddSum +} + +// GetLOCSuggestedToDeleteSum returns the LOCSuggestedToDeleteSum field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCodeActivity) GetLOCSuggestedToDeleteSum() int { + if c == nil || c.LOCSuggestedToDeleteSum == nil { + return 0 + } + return *c.LOCSuggestedToDeleteSum +} + +// GetFeature returns the Feature field. +func (c *CopilotMetricsFeature) GetFeature() string { + if c == nil { + return "" + } + return c.Feature +} + +// GetUserInitiatedInteractionCount returns the UserInitiatedInteractionCount field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsFeature) GetUserInitiatedInteractionCount() int { + if c == nil || c.UserInitiatedInteractionCount == nil { + return 0 + } + return *c.UserInitiatedInteractionCount +} + +// GetIDE returns the IDE field. +func (c *CopilotMetricsIDE) GetIDE() string { + if c == nil { + return "" + } + return c.IDE +} + +// GetUserInitiatedInteractionCount returns the UserInitiatedInteractionCount field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsIDE) GetUserInitiatedInteractionCount() int { + if c == nil || c.UserInitiatedInteractionCount == nil { + return 0 + } + return *c.UserInitiatedInteractionCount +} + +// GetFeature returns the Feature field. +func (c *CopilotMetricsLanguageFeature) GetFeature() string { + if c == nil { + return "" + } + return c.Feature +} + +// GetLanguage returns the Language field. +func (c *CopilotMetricsLanguageFeature) GetLanguage() string { + if c == nil { + return "" + } + return c.Language +} + +// GetLanguage returns the Language field. +func (c *CopilotMetricsLanguageModel) GetLanguage() string { + if c == nil { + return "" + } + return c.Language +} + +// GetModel returns the Model field. +func (c *CopilotMetricsLanguageModel) GetModel() string { + if c == nil { + return "" + } + return c.Model +} + // GetSince returns the Since field if it's non-nil, zero value otherwise. func (c *CopilotMetricsListOptions) GetSince() time.Time { if c == nil || c.Since == nil { @@ -5558,6 +9126,190 @@ func (c *CopilotMetricsListOptions) GetUntil() time.Time { return *c.Until } +// GetFeature returns the Feature field. +func (c *CopilotMetricsModelFeature) GetFeature() string { + if c == nil { + return "" + } + return c.Feature +} + +// GetModel returns the Model field. +func (c *CopilotMetricsModelFeature) GetModel() string { + if c == nil { + return "" + } + return c.Model +} + +// GetUserInitiatedInteractionCount returns the UserInitiatedInteractionCount field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsModelFeature) GetUserInitiatedInteractionCount() int { + if c == nil || c.UserInitiatedInteractionCount == nil { + return 0 + } + return *c.UserInitiatedInteractionCount +} + +// GetMedianMinutesToMerge returns the MedianMinutesToMerge field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetMedianMinutesToMerge() float64 { + if c == nil || c.MedianMinutesToMerge == nil { + return 0 + } + return *c.MedianMinutesToMerge +} + +// GetMedianMinutesToMergeCopilotAuthored returns the MedianMinutesToMergeCopilotAuthored field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetMedianMinutesToMergeCopilotAuthored() float64 { + if c == nil || c.MedianMinutesToMergeCopilotAuthored == nil { + return 0 + } + return *c.MedianMinutesToMergeCopilotAuthored +} + +// GetMedianMinutesToMergeCopilotReviewed returns the MedianMinutesToMergeCopilotReviewed field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetMedianMinutesToMergeCopilotReviewed() float64 { + if c == nil || c.MedianMinutesToMergeCopilotReviewed == nil { + return 0 + } + return *c.MedianMinutesToMergeCopilotReviewed +} + +// GetTotalAppliedSuggestions returns the TotalAppliedSuggestions field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetTotalAppliedSuggestions() int { + if c == nil || c.TotalAppliedSuggestions == nil { + return 0 + } + return *c.TotalAppliedSuggestions +} + +// GetTotalCopilotAppliedSuggestions returns the TotalCopilotAppliedSuggestions field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetTotalCopilotAppliedSuggestions() int { + if c == nil || c.TotalCopilotAppliedSuggestions == nil { + return 0 + } + return *c.TotalCopilotAppliedSuggestions +} + +// GetTotalCopilotSuggestions returns the TotalCopilotSuggestions field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetTotalCopilotSuggestions() int { + if c == nil || c.TotalCopilotSuggestions == nil { + return 0 + } + return *c.TotalCopilotSuggestions +} + +// GetTotalCreated returns the TotalCreated field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetTotalCreated() int { + if c == nil || c.TotalCreated == nil { + return 0 + } + return *c.TotalCreated +} + +// GetTotalCreatedByCopilot returns the TotalCreatedByCopilot field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetTotalCreatedByCopilot() int { + if c == nil || c.TotalCreatedByCopilot == nil { + return 0 + } + return *c.TotalCreatedByCopilot +} + +// GetTotalMerged returns the TotalMerged field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetTotalMerged() int { + if c == nil || c.TotalMerged == nil { + return 0 + } + return *c.TotalMerged +} + +// GetTotalMergedCreatedByCopilot returns the TotalMergedCreatedByCopilot field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetTotalMergedCreatedByCopilot() int { + if c == nil || c.TotalMergedCreatedByCopilot == nil { + return 0 + } + return *c.TotalMergedCreatedByCopilot +} + +// GetTotalMergedReviewedByCopilot returns the TotalMergedReviewedByCopilot field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetTotalMergedReviewedByCopilot() int { + if c == nil || c.TotalMergedReviewedByCopilot == nil { + return 0 + } + return *c.TotalMergedReviewedByCopilot +} + +// GetTotalReviewed returns the TotalReviewed field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetTotalReviewed() int { + if c == nil || c.TotalReviewed == nil { + return 0 + } + return *c.TotalReviewed +} + +// GetTotalReviewedByCopilot returns the TotalReviewedByCopilot field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetTotalReviewedByCopilot() int { + if c == nil || c.TotalReviewedByCopilot == nil { + return 0 + } + return *c.TotalReviewedByCopilot +} + +// GetTotalSuggestions returns the TotalSuggestions field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetTotalSuggestions() int { + if c == nil || c.TotalSuggestions == nil { + return 0 + } + return *c.TotalSuggestions +} + +// GetDownloadLinks returns the DownloadLinks slice if it's non-nil, nil otherwise. +func (c *CopilotMetricsReport) GetDownloadLinks() []string { + if c == nil || c.DownloadLinks == nil { + return nil + } + return c.DownloadLinks +} + +// GetReportEndDay returns the ReportEndDay field. +func (c *CopilotMetricsReport) GetReportEndDay() string { + if c == nil { + return "" + } + return c.ReportEndDay +} + +// GetReportStartDay returns the ReportStartDay field. +func (c *CopilotMetricsReport) GetReportStartDay() string { + if c == nil { + return "" + } + return c.ReportStartDay +} + +// GetDay returns the Day field. +func (c *CopilotMetricsReportOptions) GetDay() string { + if c == nil { + return "" + } + return c.Day +} + +// GetCopilotChat returns the CopilotChat field. +func (c *CopilotOrganizationDetails) GetCopilotChat() string { + if c == nil { + return "" + } + return c.CopilotChat +} + +// GetPublicCodeSuggestions returns the PublicCodeSuggestions field. +func (c *CopilotOrganizationDetails) GetPublicCodeSuggestions() string { + if c == nil { + return "" + } + return c.PublicCodeSuggestions +} + // GetSeatBreakdown returns the SeatBreakdown field. func (c *CopilotOrganizationDetails) GetSeatBreakdown() *CopilotSeatBreakdown { if c == nil { @@ -5566,6 +9318,118 @@ func (c *CopilotOrganizationDetails) GetSeatBreakdown() *CopilotSeatBreakdown { return c.SeatBreakdown } +// GetSeatManagementSetting returns the SeatManagementSetting field. +func (c *CopilotOrganizationDetails) GetSeatManagementSetting() string { + if c == nil { + return "" + } + return c.SeatManagementSetting +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (c *CopilotPeriodicMetrics) GetCreatedAt() Timestamp { + if c == nil || c.CreatedAt == nil { + return Timestamp{} + } + return *c.CreatedAt +} + +// GetDayTotals returns the DayTotals slice if it's non-nil, nil otherwise. +func (c *CopilotPeriodicMetrics) GetDayTotals() []*CopilotDailyMetrics { + if c == nil || c.DayTotals == nil { + return nil + } + return c.DayTotals +} + +// GetEnterpriseID returns the EnterpriseID field if it's non-nil, zero value otherwise. +func (c *CopilotPeriodicMetrics) GetEnterpriseID() string { + if c == nil || c.EnterpriseID == nil { + return "" + } + return *c.EnterpriseID +} + +// GetOrganizationID returns the OrganizationID field if it's non-nil, zero value otherwise. +func (c *CopilotPeriodicMetrics) GetOrganizationID() string { + if c == nil || c.OrganizationID == nil { + return "" + } + return *c.OrganizationID +} + +// GetReportEndDay returns the ReportEndDay field. +func (c *CopilotPeriodicMetrics) GetReportEndDay() string { + if c == nil { + return "" + } + return c.ReportEndDay +} + +// GetReportStartDay returns the ReportStartDay field. +func (c *CopilotPeriodicMetrics) GetReportStartDay() string { + if c == nil { + return "" + } + return c.ReportStartDay +} + +// GetActiveThisCycle returns the ActiveThisCycle field. +func (c *CopilotSeatBreakdown) GetActiveThisCycle() int { + if c == nil { + return 0 + } + return c.ActiveThisCycle +} + +// GetAddedThisCycle returns the AddedThisCycle field. +func (c *CopilotSeatBreakdown) GetAddedThisCycle() int { + if c == nil { + return 0 + } + return c.AddedThisCycle +} + +// GetInactiveThisCycle returns the InactiveThisCycle field. +func (c *CopilotSeatBreakdown) GetInactiveThisCycle() int { + if c == nil { + return 0 + } + return c.InactiveThisCycle +} + +// GetPendingCancellation returns the PendingCancellation field. +func (c *CopilotSeatBreakdown) GetPendingCancellation() int { + if c == nil { + return 0 + } + return c.PendingCancellation +} + +// GetPendingInvitation returns the PendingInvitation field. +func (c *CopilotSeatBreakdown) GetPendingInvitation() int { + if c == nil { + return 0 + } + return c.PendingInvitation +} + +// GetTotal returns the Total field. +func (c *CopilotSeatBreakdown) GetTotal() int { + if c == nil { + return 0 + } + return c.Total +} + +// GetAssignee returns the Assignee field. +func (c *CopilotSeatDetails) GetAssignee() any { + if c == nil { + return nil + } + return c.Assignee +} + // GetAssigningTeam returns the AssigningTeam field. func (c *CopilotSeatDetails) GetAssigningTeam() *Team { if c == nil { @@ -5622,6 +9486,742 @@ func (c *CopilotSeatDetails) GetUpdatedAt() Timestamp { return *c.UpdatedAt } +// GetCodeAcceptanceActivityCount returns the CodeAcceptanceActivityCount field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetCodeAcceptanceActivityCount() int { + if c == nil || c.CodeAcceptanceActivityCount == nil { + return 0 + } + return *c.CodeAcceptanceActivityCount +} + +// GetCodeGenerationActivityCount returns the CodeGenerationActivityCount field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetCodeGenerationActivityCount() int { + if c == nil || c.CodeGenerationActivityCount == nil { + return 0 + } + return *c.CodeGenerationActivityCount +} + +// GetDay returns the Day field. +func (c *CopilotUserDailyMetrics) GetDay() string { + if c == nil { + return "" + } + return c.Day +} + +// GetEnterpriseID returns the EnterpriseID field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetEnterpriseID() string { + if c == nil || c.EnterpriseID == nil { + return "" + } + return *c.EnterpriseID +} + +// GetLOCAddedSum returns the LOCAddedSum field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetLOCAddedSum() int { + if c == nil || c.LOCAddedSum == nil { + return 0 + } + return *c.LOCAddedSum +} + +// GetLOCDeletedSum returns the LOCDeletedSum field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetLOCDeletedSum() int { + if c == nil || c.LOCDeletedSum == nil { + return 0 + } + return *c.LOCDeletedSum +} + +// GetLOCSuggestedToAddSum returns the LOCSuggestedToAddSum field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetLOCSuggestedToAddSum() int { + if c == nil || c.LOCSuggestedToAddSum == nil { + return 0 + } + return *c.LOCSuggestedToAddSum +} + +// GetLOCSuggestedToDeleteSum returns the LOCSuggestedToDeleteSum field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetLOCSuggestedToDeleteSum() int { + if c == nil || c.LOCSuggestedToDeleteSum == nil { + return 0 + } + return *c.LOCSuggestedToDeleteSum +} + +// GetOrganizationID returns the OrganizationID field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetOrganizationID() string { + if c == nil || c.OrganizationID == nil { + return "" + } + return *c.OrganizationID +} + +// GetTotalsByCLI returns the TotalsByCLI field. +func (c *CopilotUserDailyMetrics) GetTotalsByCLI() *CopilotMetricsCLI { + if c == nil { + return nil + } + return c.TotalsByCLI +} + +// GetTotalsByFeature returns the TotalsByFeature slice if it's non-nil, nil otherwise. +func (c *CopilotUserDailyMetrics) GetTotalsByFeature() []*CopilotMetricsFeature { + if c == nil || c.TotalsByFeature == nil { + return nil + } + return c.TotalsByFeature +} + +// GetTotalsByIDE returns the TotalsByIDE slice if it's non-nil, nil otherwise. +func (c *CopilotUserDailyMetrics) GetTotalsByIDE() []*CopilotUserMetricsIDE { + if c == nil || c.TotalsByIDE == nil { + return nil + } + return c.TotalsByIDE +} + +// GetTotalsByLanguageFeature returns the TotalsByLanguageFeature slice if it's non-nil, nil otherwise. +func (c *CopilotUserDailyMetrics) GetTotalsByLanguageFeature() []*CopilotMetricsLanguageFeature { + if c == nil || c.TotalsByLanguageFeature == nil { + return nil + } + return c.TotalsByLanguageFeature +} + +// GetTotalsByLanguageModel returns the TotalsByLanguageModel slice if it's non-nil, nil otherwise. +func (c *CopilotUserDailyMetrics) GetTotalsByLanguageModel() []*CopilotMetricsLanguageModel { + if c == nil || c.TotalsByLanguageModel == nil { + return nil + } + return c.TotalsByLanguageModel +} + +// GetTotalsByModelFeature returns the TotalsByModelFeature slice if it's non-nil, nil otherwise. +func (c *CopilotUserDailyMetrics) GetTotalsByModelFeature() []*CopilotMetricsModelFeature { + if c == nil || c.TotalsByModelFeature == nil { + return nil + } + return c.TotalsByModelFeature +} + +// GetUsedAgent returns the UsedAgent field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetUsedAgent() bool { + if c == nil || c.UsedAgent == nil { + return false + } + return *c.UsedAgent +} + +// GetUsedChat returns the UsedChat field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetUsedChat() bool { + if c == nil || c.UsedChat == nil { + return false + } + return *c.UsedChat +} + +// GetUsedCLI returns the UsedCLI field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetUsedCLI() bool { + if c == nil || c.UsedCLI == nil { + return false + } + return *c.UsedCLI +} + +// GetUsedCopilotCodeReviewActive returns the UsedCopilotCodeReviewActive field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetUsedCopilotCodeReviewActive() bool { + if c == nil || c.UsedCopilotCodeReviewActive == nil { + return false + } + return *c.UsedCopilotCodeReviewActive +} + +// GetUsedCopilotCodeReviewPassive returns the UsedCopilotCodeReviewPassive field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetUsedCopilotCodeReviewPassive() bool { + if c == nil || c.UsedCopilotCodeReviewPassive == nil { + return false + } + return *c.UsedCopilotCodeReviewPassive +} + +// GetUsedCopilotCodingAgent returns the UsedCopilotCodingAgent field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetUsedCopilotCodingAgent() bool { + if c == nil || c.UsedCopilotCodingAgent == nil { + return false + } + return *c.UsedCopilotCodingAgent +} + +// GetUserID returns the UserID field. +func (c *CopilotUserDailyMetrics) GetUserID() int { + if c == nil { + return 0 + } + return c.UserID +} + +// GetUserInitiatedInteractionCount returns the UserInitiatedInteractionCount field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetUserInitiatedInteractionCount() int { + if c == nil || c.UserInitiatedInteractionCount == nil { + return 0 + } + return *c.UserInitiatedInteractionCount +} + +// GetUserLogin returns the UserLogin field. +func (c *CopilotUserDailyMetrics) GetUserLogin() string { + if c == nil { + return "" + } + return c.UserLogin +} + +// GetIDE returns the IDE field. +func (c *CopilotUserMetricsIDE) GetIDE() string { + if c == nil { + return "" + } + return c.IDE +} + +// GetLastKnownIDEVersion returns the LastKnownIDEVersion field. +func (c *CopilotUserMetricsIDE) GetLastKnownIDEVersion() *CopilotUserMetricsIDEVersion { + if c == nil { + return nil + } + return c.LastKnownIDEVersion +} + +// GetLastKnownPluginVersion returns the LastKnownPluginVersion field. +func (c *CopilotUserMetricsIDE) GetLastKnownPluginVersion() *CopilotUserMetricsPluginVersion { + if c == nil { + return nil + } + return c.LastKnownPluginVersion +} + +// GetUserInitiatedInteractionCount returns the UserInitiatedInteractionCount field if it's non-nil, zero value otherwise. +func (c *CopilotUserMetricsIDE) GetUserInitiatedInteractionCount() int { + if c == nil || c.UserInitiatedInteractionCount == nil { + return 0 + } + return *c.UserInitiatedInteractionCount +} + +// GetIDEVersion returns the IDEVersion field. +func (c *CopilotUserMetricsIDEVersion) GetIDEVersion() string { + if c == nil { + return "" + } + return c.IDEVersion +} + +// GetSampledAt returns the SampledAt field if it's non-nil, zero value otherwise. +func (c *CopilotUserMetricsIDEVersion) GetSampledAt() Timestamp { + if c == nil || c.SampledAt == nil { + return Timestamp{} + } + return *c.SampledAt +} + +// GetPlugin returns the Plugin field. +func (c *CopilotUserMetricsPluginVersion) GetPlugin() string { + if c == nil { + return "" + } + return c.Plugin +} + +// GetPluginVersion returns the PluginVersion field. +func (c *CopilotUserMetricsPluginVersion) GetPluginVersion() string { + if c == nil { + return "" + } + return c.PluginVersion +} + +// GetSampledAt returns the SampledAt field if it's non-nil, zero value otherwise. +func (c *CopilotUserMetricsPluginVersion) GetSampledAt() Timestamp { + if c == nil || c.SampledAt == nil { + return Timestamp{} + } + return *c.SampledAt +} + +// GetCodeAcceptanceActivityCount returns the CodeAcceptanceActivityCount field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetCodeAcceptanceActivityCount() int { + if c == nil || c.CodeAcceptanceActivityCount == nil { + return 0 + } + return *c.CodeAcceptanceActivityCount +} + +// GetCodeGenerationActivityCount returns the CodeGenerationActivityCount field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetCodeGenerationActivityCount() int { + if c == nil || c.CodeGenerationActivityCount == nil { + return 0 + } + return *c.CodeGenerationActivityCount +} + +// GetDay returns the Day field. +func (c *CopilotUserPeriodicMetrics) GetDay() string { + if c == nil { + return "" + } + return c.Day +} + +// GetEnterpriseID returns the EnterpriseID field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetEnterpriseID() string { + if c == nil || c.EnterpriseID == nil { + return "" + } + return *c.EnterpriseID +} + +// GetLOCAddedSum returns the LOCAddedSum field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetLOCAddedSum() int { + if c == nil || c.LOCAddedSum == nil { + return 0 + } + return *c.LOCAddedSum +} + +// GetLOCDeletedSum returns the LOCDeletedSum field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetLOCDeletedSum() int { + if c == nil || c.LOCDeletedSum == nil { + return 0 + } + return *c.LOCDeletedSum +} + +// GetLOCSuggestedToAddSum returns the LOCSuggestedToAddSum field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetLOCSuggestedToAddSum() int { + if c == nil || c.LOCSuggestedToAddSum == nil { + return 0 + } + return *c.LOCSuggestedToAddSum +} + +// GetLOCSuggestedToDeleteSum returns the LOCSuggestedToDeleteSum field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetLOCSuggestedToDeleteSum() int { + if c == nil || c.LOCSuggestedToDeleteSum == nil { + return 0 + } + return *c.LOCSuggestedToDeleteSum +} + +// GetOrganizationID returns the OrganizationID field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetOrganizationID() string { + if c == nil || c.OrganizationID == nil { + return "" + } + return *c.OrganizationID +} + +// GetReportEndDay returns the ReportEndDay field. +func (c *CopilotUserPeriodicMetrics) GetReportEndDay() string { + if c == nil { + return "" + } + return c.ReportEndDay +} + +// GetReportStartDay returns the ReportStartDay field. +func (c *CopilotUserPeriodicMetrics) GetReportStartDay() string { + if c == nil { + return "" + } + return c.ReportStartDay +} + +// GetTotalsByCLI returns the TotalsByCLI field. +func (c *CopilotUserPeriodicMetrics) GetTotalsByCLI() *CopilotMetricsCLI { + if c == nil { + return nil + } + return c.TotalsByCLI +} + +// GetTotalsByFeature returns the TotalsByFeature slice if it's non-nil, nil otherwise. +func (c *CopilotUserPeriodicMetrics) GetTotalsByFeature() []*CopilotMetricsFeature { + if c == nil || c.TotalsByFeature == nil { + return nil + } + return c.TotalsByFeature +} + +// GetTotalsByIDE returns the TotalsByIDE slice if it's non-nil, nil otherwise. +func (c *CopilotUserPeriodicMetrics) GetTotalsByIDE() []*CopilotUserMetricsIDE { + if c == nil || c.TotalsByIDE == nil { + return nil + } + return c.TotalsByIDE +} + +// GetTotalsByLanguageFeature returns the TotalsByLanguageFeature slice if it's non-nil, nil otherwise. +func (c *CopilotUserPeriodicMetrics) GetTotalsByLanguageFeature() []*CopilotMetricsLanguageFeature { + if c == nil || c.TotalsByLanguageFeature == nil { + return nil + } + return c.TotalsByLanguageFeature +} + +// GetTotalsByLanguageModel returns the TotalsByLanguageModel slice if it's non-nil, nil otherwise. +func (c *CopilotUserPeriodicMetrics) GetTotalsByLanguageModel() []*CopilotMetricsLanguageModel { + if c == nil || c.TotalsByLanguageModel == nil { + return nil + } + return c.TotalsByLanguageModel +} + +// GetTotalsByModelFeature returns the TotalsByModelFeature slice if it's non-nil, nil otherwise. +func (c *CopilotUserPeriodicMetrics) GetTotalsByModelFeature() []*CopilotMetricsModelFeature { + if c == nil || c.TotalsByModelFeature == nil { + return nil + } + return c.TotalsByModelFeature +} + +// GetUsedAgent returns the UsedAgent field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetUsedAgent() bool { + if c == nil || c.UsedAgent == nil { + return false + } + return *c.UsedAgent +} + +// GetUsedChat returns the UsedChat field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetUsedChat() bool { + if c == nil || c.UsedChat == nil { + return false + } + return *c.UsedChat +} + +// GetUsedCLI returns the UsedCLI field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetUsedCLI() bool { + if c == nil || c.UsedCLI == nil { + return false + } + return *c.UsedCLI +} + +// GetUsedCopilotCodeReviewActive returns the UsedCopilotCodeReviewActive field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetUsedCopilotCodeReviewActive() bool { + if c == nil || c.UsedCopilotCodeReviewActive == nil { + return false + } + return *c.UsedCopilotCodeReviewActive +} + +// GetUsedCopilotCodeReviewPassive returns the UsedCopilotCodeReviewPassive field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetUsedCopilotCodeReviewPassive() bool { + if c == nil || c.UsedCopilotCodeReviewPassive == nil { + return false + } + return *c.UsedCopilotCodeReviewPassive +} + +// GetUsedCopilotCodingAgent returns the UsedCopilotCodingAgent field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetUsedCopilotCodingAgent() bool { + if c == nil || c.UsedCopilotCodingAgent == nil { + return false + } + return *c.UsedCopilotCodingAgent +} + +// GetUserID returns the UserID field. +func (c *CopilotUserPeriodicMetrics) GetUserID() int { + if c == nil { + return 0 + } + return c.UserID +} + +// GetUserInitiatedInteractionCount returns the UserInitiatedInteractionCount field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetUserInitiatedInteractionCount() int { + if c == nil || c.UserInitiatedInteractionCount == nil { + return 0 + } + return *c.UserInitiatedInteractionCount +} + +// GetUserLogin returns the UserLogin field. +func (c *CopilotUserPeriodicMetrics) GetUserLogin() string { + if c == nil { + return "" + } + return c.UserLogin +} + +// GetAzureSubscription returns the AzureSubscription field if it's non-nil, zero value otherwise. +func (c *CostCenter) GetAzureSubscription() string { + if c == nil || c.AzureSubscription == nil { + return "" + } + return *c.AzureSubscription +} + +// GetID returns the ID field. +func (c *CostCenter) GetID() string { + if c == nil { + return "" + } + return c.ID +} + +// GetName returns the Name field. +func (c *CostCenter) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetResources returns the Resources slice if it's non-nil, nil otherwise. +func (c *CostCenter) GetResources() []*CostCenterResource { + if c == nil || c.Resources == nil { + return nil + } + return c.Resources +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (c *CostCenter) GetState() string { + if c == nil || c.State == nil { + return "" + } + return *c.State +} + +// GetName returns the Name field. +func (c *CostCenterRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetName returns the Name field. +func (c *CostCenterResource) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetType returns the Type field. +func (c *CostCenterResource) GetType() string { + if c == nil { + return "" + } + return c.Type +} + +// GetOrganizations returns the Organizations slice if it's non-nil, nil otherwise. +func (c *CostCenterResourceRequest) GetOrganizations() []string { + if c == nil || c.Organizations == nil { + return nil + } + return c.Organizations +} + +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (c *CostCenterResourceRequest) GetRepositories() []string { + if c == nil || c.Repositories == nil { + return nil + } + return c.Repositories +} + +// GetUsers returns the Users slice if it's non-nil, nil otherwise. +func (c *CostCenterResourceRequest) GetUsers() []string { + if c == nil || c.Users == nil { + return nil + } + return c.Users +} + +// GetCostCenters returns the CostCenters slice if it's non-nil, nil otherwise. +func (c *CostCenters) GetCostCenters() []*CostCenter { + if c == nil || c.CostCenters == nil { + return nil + } + return c.CostCenters +} + +// GetCluster returns the Cluster field if it's non-nil, zero value otherwise. +func (c *CreateArtifactDeploymentRequest) GetCluster() string { + if c == nil || c.Cluster == nil { + return "" + } + return *c.Cluster +} + +// GetDeploymentName returns the DeploymentName field. +func (c *CreateArtifactDeploymentRequest) GetDeploymentName() string { + if c == nil { + return "" + } + return c.DeploymentName +} + +// GetDigest returns the Digest field. +func (c *CreateArtifactDeploymentRequest) GetDigest() string { + if c == nil { + return "" + } + return c.Digest +} + +// GetGithubRepository returns the GithubRepository field if it's non-nil, zero value otherwise. +func (c *CreateArtifactDeploymentRequest) GetGithubRepository() string { + if c == nil || c.GithubRepository == nil { + return "" + } + return *c.GithubRepository +} + +// GetLogicalEnvironment returns the LogicalEnvironment field. +func (c *CreateArtifactDeploymentRequest) GetLogicalEnvironment() string { + if c == nil { + return "" + } + return c.LogicalEnvironment +} + +// GetName returns the Name field. +func (c *CreateArtifactDeploymentRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetPhysicalEnvironment returns the PhysicalEnvironment field if it's non-nil, zero value otherwise. +func (c *CreateArtifactDeploymentRequest) GetPhysicalEnvironment() string { + if c == nil || c.PhysicalEnvironment == nil { + return "" + } + return *c.PhysicalEnvironment +} + +// GetRuntimeRisks returns the RuntimeRisks slice if it's non-nil, nil otherwise. +func (c *CreateArtifactDeploymentRequest) GetRuntimeRisks() []DeploymentRuntimeRisk { + if c == nil || c.RuntimeRisks == nil { + return nil + } + return c.RuntimeRisks +} + +// GetStatus returns the Status field. +func (c *CreateArtifactDeploymentRequest) GetStatus() string { + if c == nil { + return "" + } + return c.Status +} + +// GetTags returns the Tags map if it's non-nil, an empty map otherwise. +func (c *CreateArtifactDeploymentRequest) GetTags() map[string]string { + if c == nil || c.Tags == nil { + return map[string]string{} + } + return c.Tags +} + +// GetVersion returns the Version field if it's non-nil, zero value otherwise. +func (c *CreateArtifactDeploymentRequest) GetVersion() string { + if c == nil || c.Version == nil { + return "" + } + return *c.Version +} + +// GetArtifactURL returns the ArtifactURL field if it's non-nil, zero value otherwise. +func (c *CreateArtifactStorageRequest) GetArtifactURL() string { + if c == nil || c.ArtifactURL == nil { + return "" + } + return *c.ArtifactURL +} + +// GetDigest returns the Digest field. +func (c *CreateArtifactStorageRequest) GetDigest() string { + if c == nil { + return "" + } + return c.Digest +} + +// GetGithubRepository returns the GithubRepository field if it's non-nil, zero value otherwise. +func (c *CreateArtifactStorageRequest) GetGithubRepository() string { + if c == nil || c.GithubRepository == nil { + return "" + } + return *c.GithubRepository +} + +// GetName returns the Name field. +func (c *CreateArtifactStorageRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetPath returns the Path field if it's non-nil, zero value otherwise. +func (c *CreateArtifactStorageRequest) GetPath() string { + if c == nil || c.Path == nil { + return "" + } + return *c.Path +} + +// GetRegistryURL returns the RegistryURL field. +func (c *CreateArtifactStorageRequest) GetRegistryURL() string { + if c == nil { + return "" + } + return c.RegistryURL +} + +// GetRepository returns the Repository field if it's non-nil, zero value otherwise. +func (c *CreateArtifactStorageRequest) GetRepository() string { + if c == nil || c.Repository == nil { + return "" + } + return *c.Repository +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (c *CreateArtifactStorageRequest) GetStatus() string { + if c == nil || c.Status == nil { + return "" + } + return *c.Status +} + +// GetVersion returns the Version field if it's non-nil, zero value otherwise. +func (c *CreateArtifactStorageRequest) GetVersion() string { + if c == nil || c.Version == nil { + return "" + } + return *c.Version +} + +// GetActions returns the Actions slice if it's non-nil, nil otherwise. +func (c *CreateCheckRunOptions) GetActions() []*CheckRunAction { + if c == nil || c.Actions == nil { + return nil + } + return c.Actions +} + // GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. func (c *CreateCheckRunOptions) GetCompletedAt() Timestamp { if c == nil || c.CompletedAt == nil { @@ -5654,6 +10254,22 @@ func (c *CreateCheckRunOptions) GetExternalID() string { return *c.ExternalID } +// GetHeadSHA returns the HeadSHA field. +func (c *CreateCheckRunOptions) GetHeadSHA() string { + if c == nil { + return "" + } + return c.HeadSHA +} + +// GetName returns the Name field. +func (c *CreateCheckRunOptions) GetName() string { + if c == nil { + return "" + } + return c.Name +} + // GetOutput returns the Output field. func (c *CreateCheckRunOptions) GetOutput() *CheckRunOutput { if c == nil { @@ -5686,6 +10302,14 @@ func (c *CreateCheckSuiteOptions) GetHeadBranch() string { return *c.HeadBranch } +// GetHeadSHA returns the HeadSHA field. +func (c *CreateCheckSuiteOptions) GetHeadSHA() string { + if c == nil { + return "" + } + return c.HeadSHA +} + // GetClientIP returns the ClientIP field if it's non-nil, zero value otherwise. func (c *CreateCodespaceOptions) GetClientIP() string { if c == nil || c.ClientIP == nil { @@ -5726,6 +10350,14 @@ func (c *CreateCodespaceOptions) GetIdleTimeoutMinutes() int { return *c.IdleTimeoutMinutes } +// GetLocation returns the Location field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceOptions) GetLocation() string { + if c == nil || c.Location == nil { + return "" + } + return *c.Location +} + // GetMachine returns the Machine field if it's non-nil, zero value otherwise. func (c *CreateCodespaceOptions) GetMachine() string { if c == nil || c.Machine == nil { @@ -5766,6 +10398,46 @@ func (c *CreateCodespaceOptions) GetWorkingDirectory() string { return *c.WorkingDirectory } +// GetSigner returns the Signer field. +func (c *CreateCommitOptions) GetSigner() MessageSigner { + if c == nil { + return nil + } + return c.Signer +} + +// GetBaseRole returns the BaseRole field if it's non-nil, zero value otherwise. +func (c *CreateCustomOrgRoleRequest) GetBaseRole() string { + if c == nil || c.BaseRole == nil { + return "" + } + return *c.BaseRole +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (c *CreateCustomOrgRoleRequest) GetDescription() string { + if c == nil || c.Description == nil { + return "" + } + return *c.Description +} + +// GetName returns the Name field. +func (c *CreateCustomOrgRoleRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetPermissions returns the Permissions slice if it's non-nil, nil otherwise. +func (c *CreateCustomOrgRoleRequest) GetPermissions() []string { + if c == nil || c.Permissions == nil { + return nil + } + return c.Permissions +} + // GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise. func (c *CreateEnterpriseRunnerGroupRequest) GetAllowsPublicRepositories() bool { if c == nil || c.AllowsPublicRepositories == nil { @@ -5782,6 +10454,14 @@ func (c *CreateEnterpriseRunnerGroupRequest) GetName() string { return *c.Name } +// GetNetworkConfigurationID returns the NetworkConfigurationID field if it's non-nil, zero value otherwise. +func (c *CreateEnterpriseRunnerGroupRequest) GetNetworkConfigurationID() string { + if c == nil || c.NetworkConfigurationID == nil { + return "" + } + return *c.NetworkConfigurationID +} + // GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. func (c *CreateEnterpriseRunnerGroupRequest) GetRestrictedToWorkflows() bool { if c == nil || c.RestrictedToWorkflows == nil { @@ -5790,6 +10470,30 @@ func (c *CreateEnterpriseRunnerGroupRequest) GetRestrictedToWorkflows() bool { return *c.RestrictedToWorkflows } +// GetRunners returns the Runners slice if it's non-nil, nil otherwise. +func (c *CreateEnterpriseRunnerGroupRequest) GetRunners() []int64 { + if c == nil || c.Runners == nil { + return nil + } + return c.Runners +} + +// GetSelectedOrganizationIDs returns the SelectedOrganizationIDs slice if it's non-nil, nil otherwise. +func (c *CreateEnterpriseRunnerGroupRequest) GetSelectedOrganizationIDs() []int64 { + if c == nil || c.SelectedOrganizationIDs == nil { + return nil + } + return c.SelectedOrganizationIDs +} + +// GetSelectedWorkflows returns the SelectedWorkflows slice if it's non-nil, nil otherwise. +func (c *CreateEnterpriseRunnerGroupRequest) GetSelectedWorkflows() []string { + if c == nil || c.SelectedWorkflows == nil { + return nil + } + return c.SelectedWorkflows +} + // GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. func (c *CreateEnterpriseRunnerGroupRequest) GetVisibility() string { if c == nil || c.Visibility == nil { @@ -5870,6 +10574,214 @@ func (c *CreateEvent) GetSender() *User { return c.Sender } +// GetEnableStaticIP returns the EnableStaticIP field if it's non-nil, zero value otherwise. +func (c *CreateHostedRunnerRequest) GetEnableStaticIP() bool { + if c == nil || c.EnableStaticIP == nil { + return false + } + return *c.EnableStaticIP +} + +// GetImage returns the Image field. +func (c *CreateHostedRunnerRequest) GetImage() HostedRunnerImage { + if c == nil { + return HostedRunnerImage{} + } + return c.Image +} + +// GetImageGen returns the ImageGen field if it's non-nil, zero value otherwise. +func (c *CreateHostedRunnerRequest) GetImageGen() bool { + if c == nil || c.ImageGen == nil { + return false + } + return *c.ImageGen +} + +// GetMaximumRunners returns the MaximumRunners field if it's non-nil, zero value otherwise. +func (c *CreateHostedRunnerRequest) GetMaximumRunners() int64 { + if c == nil || c.MaximumRunners == nil { + return 0 + } + return *c.MaximumRunners +} + +// GetName returns the Name field. +func (c *CreateHostedRunnerRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetRunnerGroupID returns the RunnerGroupID field. +func (c *CreateHostedRunnerRequest) GetRunnerGroupID() int64 { + if c == nil { + return 0 + } + return c.RunnerGroupID +} + +// GetSize returns the Size field. +func (c *CreateHostedRunnerRequest) GetSize() string { + if c == nil { + return "" + } + return c.Size +} + +// GetAccountID returns the AccountID field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetAccountID() string { + if c == nil || c.AccountID == nil { + return "" + } + return *c.AccountID +} + +// GetAudience returns the Audience field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetAudience() string { + if c == nil || c.Audience == nil { + return "" + } + return *c.Audience +} + +// GetAuthType returns the AuthType field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetAuthType() string { + if c == nil || c.AuthType == nil { + return "" + } + return *c.AuthType +} + +// GetAWSRegion returns the AWSRegion field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetAWSRegion() string { + if c == nil || c.AWSRegion == nil { + return "" + } + return *c.AWSRegion +} + +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetClientID() string { + if c == nil || c.ClientID == nil { + return "" + } + return *c.ClientID +} + +// GetDomain returns the Domain field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetDomain() string { + if c == nil || c.Domain == nil { + return "" + } + return *c.Domain +} + +// GetDomainOwner returns the DomainOwner field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetDomainOwner() string { + if c == nil || c.DomainOwner == nil { + return "" + } + return *c.DomainOwner +} + +// GetEncryptedValue returns the EncryptedValue field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetEncryptedValue() string { + if c == nil || c.EncryptedValue == nil { + return "" + } + return *c.EncryptedValue +} + +// GetIdentityMappingName returns the IdentityMappingName field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetIdentityMappingName() string { + if c == nil || c.IdentityMappingName == nil { + return "" + } + return *c.IdentityMappingName +} + +// GetJFrogOIDCProviderName returns the JFrogOIDCProviderName field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetJFrogOIDCProviderName() string { + if c == nil || c.JFrogOIDCProviderName == nil { + return "" + } + return *c.JFrogOIDCProviderName +} + +// GetKeyID returns the KeyID field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetKeyID() string { + if c == nil || c.KeyID == nil { + return "" + } + return *c.KeyID +} + +// GetRegistryType returns the RegistryType field. +func (c *CreateOrganizationPrivateRegistry) GetRegistryType() PrivateRegistryType { + if c == nil { + return "" + } + return c.RegistryType +} + +// GetReplacesBase returns the ReplacesBase field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetReplacesBase() bool { + if c == nil || c.ReplacesBase == nil { + return false + } + return *c.ReplacesBase +} + +// GetRoleName returns the RoleName field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetRoleName() string { + if c == nil || c.RoleName == nil { + return "" + } + return *c.RoleName +} + +// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs slice if it's non-nil, nil otherwise. +func (c *CreateOrganizationPrivateRegistry) GetSelectedRepositoryIDs() []int64 { + if c == nil || c.SelectedRepositoryIDs == nil { + return nil + } + return c.SelectedRepositoryIDs +} + +// GetTenantID returns the TenantID field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetTenantID() string { + if c == nil || c.TenantID == nil { + return "" + } + return *c.TenantID +} + +// GetURL returns the URL field. +func (c *CreateOrganizationPrivateRegistry) GetURL() string { + if c == nil { + return "" + } + return c.URL +} + +// GetUsername returns the Username field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetUsername() string { + if c == nil || c.Username == nil { + return "" + } + return *c.Username +} + +// GetVisibility returns the Visibility field. +func (c *CreateOrganizationPrivateRegistry) GetVisibility() PrivateRegistryVisibility { + if c == nil { + return "" + } + return c.Visibility +} + // GetEmail returns the Email field if it's non-nil, zero value otherwise. func (c *CreateOrgInvitationOptions) GetEmail() string { if c == nil || c.Email == nil { @@ -5894,6 +10806,14 @@ func (c *CreateOrgInvitationOptions) GetRole() string { return *c.Role } +// GetTeamID returns the TeamID slice if it's non-nil, nil otherwise. +func (c *CreateOrgInvitationOptions) GetTeamID() []int64 { + if c == nil || c.TeamID == nil { + return nil + } + return c.TeamID +} + // GetBaseRole returns the BaseRole field if it's non-nil, zero value otherwise. func (c *CreateOrUpdateCustomRepoRoleOptions) GetBaseRole() string { if c == nil || c.BaseRole == nil { @@ -5918,6 +10838,14 @@ func (c *CreateOrUpdateCustomRepoRoleOptions) GetName() string { return *c.Name } +// GetPermissions returns the Permissions slice if it's non-nil, nil otherwise. +func (c *CreateOrUpdateCustomRepoRoleOptions) GetPermissions() []string { + if c == nil || c.Permissions == nil { + return nil + } + return c.Permissions +} + // GetColor returns the Color field if it's non-nil, zero value otherwise. func (c *CreateOrUpdateIssueTypesOptions) GetColor() string { if c == nil || c.Color == nil { @@ -5934,6 +10862,14 @@ func (c *CreateOrUpdateIssueTypesOptions) GetDescription() string { return *c.Description } +// GetIsEnabled returns the IsEnabled field. +func (c *CreateOrUpdateIssueTypesOptions) GetIsEnabled() bool { + if c == nil { + return false + } + return c.IsEnabled +} + // GetIsPrivate returns the IsPrivate field if it's non-nil, zero value otherwise. func (c *CreateOrUpdateIssueTypesOptions) GetIsPrivate() bool { if c == nil || c.IsPrivate == nil { @@ -5942,36 +10878,36 @@ func (c *CreateOrUpdateIssueTypesOptions) GetIsPrivate() bool { return *c.IsPrivate } -// GetBaseRole returns the BaseRole field if it's non-nil, zero value otherwise. -func (c *CreateOrUpdateOrgRoleOptions) GetBaseRole() string { - if c == nil || c.BaseRole == nil { +// GetName returns the Name field. +func (c *CreateOrUpdateIssueTypesOptions) GetName() string { + if c == nil { return "" } - return *c.BaseRole + return c.Name } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (c *CreateOrUpdateOrgRoleOptions) GetDescription() string { - if c == nil || c.Description == nil { - return "" +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (c *CreateProtectedChanges) GetFrom() bool { + if c == nil || c.From == nil { + return false } - return *c.Description + return *c.From } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CreateOrUpdateOrgRoleOptions) GetName() string { - if c == nil || c.Name == nil { +// GetRef returns the Ref field. +func (c *CreateRef) GetRef() string { + if c == nil { return "" } - return *c.Name + return c.Ref } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (c *CreateProtectedChanges) GetFrom() bool { - if c == nil || c.From == nil { - return false +// GetSHA returns the SHA field. +func (c *CreateRef) GetSHA() string { + if c == nil { + return "" } - return *c.From + return c.SHA } // GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise. @@ -5990,6 +10926,14 @@ func (c *CreateRunnerGroupRequest) GetName() string { return *c.Name } +// GetNetworkConfigurationID returns the NetworkConfigurationID field if it's non-nil, zero value otherwise. +func (c *CreateRunnerGroupRequest) GetNetworkConfigurationID() string { + if c == nil || c.NetworkConfigurationID == nil { + return "" + } + return *c.NetworkConfigurationID +} + // GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. func (c *CreateRunnerGroupRequest) GetRestrictedToWorkflows() bool { if c == nil || c.RestrictedToWorkflows == nil { @@ -5998,6 +10942,30 @@ func (c *CreateRunnerGroupRequest) GetRestrictedToWorkflows() bool { return *c.RestrictedToWorkflows } +// GetRunners returns the Runners slice if it's non-nil, nil otherwise. +func (c *CreateRunnerGroupRequest) GetRunners() []int64 { + if c == nil || c.Runners == nil { + return nil + } + return c.Runners +} + +// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs slice if it's non-nil, nil otherwise. +func (c *CreateRunnerGroupRequest) GetSelectedRepositoryIDs() []int64 { + if c == nil || c.SelectedRepositoryIDs == nil { + return nil + } + return c.SelectedRepositoryIDs +} + +// GetSelectedWorkflows returns the SelectedWorkflows slice if it's non-nil, nil otherwise. +func (c *CreateRunnerGroupRequest) GetSelectedWorkflows() []string { + if c == nil || c.SelectedWorkflows == nil { + return nil + } + return c.SelectedWorkflows +} + // GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. func (c *CreateRunnerGroupRequest) GetVisibility() string { if c == nil || c.Visibility == nil { @@ -6006,6 +10974,46 @@ func (c *CreateRunnerGroupRequest) GetVisibility() string { return *c.Visibility } +// GetMessage returns the Message field. +func (c *CreateTag) GetMessage() string { + if c == nil { + return "" + } + return c.Message +} + +// GetObject returns the Object field. +func (c *CreateTag) GetObject() string { + if c == nil { + return "" + } + return c.Object +} + +// GetTag returns the Tag field. +func (c *CreateTag) GetTag() string { + if c == nil { + return "" + } + return c.Tag +} + +// GetTagger returns the Tagger field. +func (c *CreateTag) GetTagger() *CommitAuthor { + if c == nil { + return nil + } + return c.Tagger +} + +// GetType returns the Type field. +func (c *CreateTag) GetType() string { + if c == nil { + return "" + } + return c.Type +} + // GetCanAdminsBypass returns the CanAdminsBypass field if it's non-nil, zero value otherwise. func (c *CreateUpdateEnvironment) GetCanAdminsBypass() bool { if c == nil || c.CanAdminsBypass == nil { @@ -6030,6 +11038,14 @@ func (c *CreateUpdateEnvironment) GetPreventSelfReview() bool { return *c.PreventSelfReview } +// GetReviewers returns the Reviewers slice if it's non-nil, nil otherwise. +func (c *CreateUpdateEnvironment) GetReviewers() []*EnvReviewers { + if c == nil || c.Reviewers == nil { + return nil + } + return c.Reviewers +} + // GetWaitTimer returns the WaitTimer field if it's non-nil, zero value otherwise. func (c *CreateUpdateEnvironment) GetWaitTimer() int { if c == nil || c.WaitTimer == nil { @@ -6046,6 +11062,14 @@ func (c *CreateUserRequest) GetEmail() string { return *c.Email } +// GetLogin returns the Login field. +func (c *CreateUserRequest) GetLogin() string { + if c == nil { + return "" + } + return c.Login +} + // GetSuspended returns the Suspended field if it's non-nil, zero value otherwise. func (c *CreateUserRequest) GetSuspended() bool { if c == nil || c.Suspended == nil { @@ -6062,6 +11086,22 @@ func (c *CreateWorkflowDispatchEventRequest) GetInputs() map[string]any { return c.Inputs } +// GetRef returns the Ref field. +func (c *CreateWorkflowDispatchEventRequest) GetRef() string { + if c == nil { + return "" + } + return c.Ref +} + +// GetReturnRunDetails returns the ReturnRunDetails field if it's non-nil, zero value otherwise. +func (c *CreateWorkflowDispatchEventRequest) GetReturnRunDetails() bool { + if c == nil || c.ReturnRunDetails == nil { + return false + } + return *c.ReturnRunDetails +} + // GetCreated returns the Created field if it's non-nil, zero value otherwise. func (c *CreationInfo) GetCreated() Timestamp { if c == nil || c.Created == nil { @@ -6070,6 +11110,14 @@ func (c *CreationInfo) GetCreated() Timestamp { return *c.Created } +// GetCreators returns the Creators slice if it's non-nil, nil otherwise. +func (c *CreationInfo) GetCreators() []string { + if c == nil || c.Creators == nil { + return nil + } + return c.Creators +} + // GetAuthorizedCredentialExpiresAt returns the AuthorizedCredentialExpiresAt field if it's non-nil, zero value otherwise. func (c *CredentialAuthorization) GetAuthorizedCredentialExpiresAt() Timestamp { if c == nil || c.AuthorizedCredentialExpiresAt == nil { @@ -6150,6 +11198,14 @@ func (c *CredentialAuthorization) GetLogin() string { return *c.Login } +// GetScopes returns the Scopes slice if it's non-nil, nil otherwise. +func (c *CredentialAuthorization) GetScopes() []string { + if c == nil || c.Scopes == nil { + return nil + } + return c.Scopes +} + // GetTokenLastEight returns the TokenLastEight field if it's non-nil, zero value otherwise. func (c *CredentialAuthorization) GetTokenLastEight() string { if c == nil || c.TokenLastEight == nil { @@ -6158,6 +11214,14 @@ func (c *CredentialAuthorization) GetTokenLastEight() string { return *c.TokenLastEight } +// GetLogin returns the Login field. +func (c *CredentialAuthorizationsListOptions) GetLogin() string { + if c == nil { + return "" + } + return c.Login +} + // GetType returns the Type field if it's non-nil, zero value otherwise. func (c *Credit) GetType() string { if c == nil || c.Type == nil { @@ -6247,7 +11311,7 @@ func (c *CustomDeploymentProtectionRuleRequest) GetIntegrationID() int64 { } // GetBaseRole returns the BaseRole field if it's non-nil, zero value otherwise. -func (c *CustomOrgRoles) GetBaseRole() string { +func (c *CustomOrgRole) GetBaseRole() string { if c == nil || c.BaseRole == nil { return "" } @@ -6255,7 +11319,7 @@ func (c *CustomOrgRoles) GetBaseRole() string { } // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (c *CustomOrgRoles) GetCreatedAt() Timestamp { +func (c *CustomOrgRole) GetCreatedAt() Timestamp { if c == nil || c.CreatedAt == nil { return Timestamp{} } @@ -6263,7 +11327,7 @@ func (c *CustomOrgRoles) GetCreatedAt() Timestamp { } // GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (c *CustomOrgRoles) GetDescription() string { +func (c *CustomOrgRole) GetDescription() string { if c == nil || c.Description == nil { return "" } @@ -6271,7 +11335,7 @@ func (c *CustomOrgRoles) GetDescription() string { } // GetID returns the ID field if it's non-nil, zero value otherwise. -func (c *CustomOrgRoles) GetID() int64 { +func (c *CustomOrgRole) GetID() int64 { if c == nil || c.ID == nil { return 0 } @@ -6279,7 +11343,7 @@ func (c *CustomOrgRoles) GetID() int64 { } // GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CustomOrgRoles) GetName() string { +func (c *CustomOrgRole) GetName() string { if c == nil || c.Name == nil { return "" } @@ -6287,15 +11351,23 @@ func (c *CustomOrgRoles) GetName() string { } // GetOrg returns the Org field. -func (c *CustomOrgRoles) GetOrg() *Organization { +func (c *CustomOrgRole) GetOrg() *Organization { if c == nil { return nil } return c.Org } +// GetPermissions returns the Permissions slice if it's non-nil, nil otherwise. +func (c *CustomOrgRole) GetPermissions() []string { + if c == nil || c.Permissions == nil { + return nil + } + return c.Permissions +} + // GetSource returns the Source field if it's non-nil, zero value otherwise. -func (c *CustomOrgRoles) GetSource() string { +func (c *CustomOrgRole) GetSource() string { if c == nil || c.Source == nil { return "" } @@ -6303,19 +11375,43 @@ func (c *CustomOrgRoles) GetSource() string { } // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (c *CustomOrgRoles) GetUpdatedAt() Timestamp { +func (c *CustomOrgRole) GetUpdatedAt() Timestamp { if c == nil || c.UpdatedAt == nil { return Timestamp{} } return *c.UpdatedAt } -// GetDefaultValue returns the DefaultValue field if it's non-nil, zero value otherwise. -func (c *CustomProperty) GetDefaultValue() string { - if c == nil || c.DefaultValue == nil { +// GetPatternScope returns the PatternScope field if it's non-nil, zero value otherwise. +func (c *CustomPatternBackfillScan) GetPatternScope() string { + if c == nil || c.PatternScope == nil { return "" } - return *c.DefaultValue + return *c.PatternScope +} + +// GetPatternSlug returns the PatternSlug field if it's non-nil, zero value otherwise. +func (c *CustomPatternBackfillScan) GetPatternSlug() string { + if c == nil || c.PatternSlug == nil { + return "" + } + return *c.PatternSlug +} + +// GetAllowedValues returns the AllowedValues slice if it's non-nil, nil otherwise. +func (c *CustomProperty) GetAllowedValues() []string { + if c == nil || c.AllowedValues == nil { + return nil + } + return c.AllowedValues +} + +// GetDefaultValue returns the DefaultValue field. +func (c *CustomProperty) GetDefaultValue() any { + if c == nil { + return nil + } + return c.DefaultValue } // GetDescription returns the Description field if it's non-nil, zero value otherwise. @@ -6350,6 +11446,14 @@ func (c *CustomProperty) GetSourceType() string { return *c.SourceType } +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (c *CustomProperty) GetURL() string { + if c == nil || c.URL == nil { + return "" + } + return *c.URL +} + // GetValuesEditableBy returns the ValuesEditableBy field if it's non-nil, zero value otherwise. func (c *CustomProperty) GetValuesEditableBy() string { if c == nil || c.ValuesEditableBy == nil { @@ -6358,6 +11462,14 @@ func (c *CustomProperty) GetValuesEditableBy() string { return *c.ValuesEditableBy } +// GetValueType returns the ValueType field. +func (c *CustomProperty) GetValueType() PropertyValueType { + if c == nil { + return "" + } + return c.ValueType +} + // GetAction returns the Action field if it's non-nil, zero value otherwise. func (c *CustomPropertyEvent) GetAction() string { if c == nil || c.Action == nil { @@ -6406,6 +11518,22 @@ func (c *CustomPropertyEvent) GetSender() *User { return c.Sender } +// GetPropertyName returns the PropertyName field. +func (c *CustomPropertyValue) GetPropertyName() string { + if c == nil { + return "" + } + return c.PropertyName +} + +// GetValue returns the Value field. +func (c *CustomPropertyValue) GetValue() any { + if c == nil { + return nil + } + return c.Value +} + // GetAction returns the Action field if it's non-nil, zero value otherwise. func (c *CustomPropertyValuesEvent) GetAction() string { if c == nil || c.Action == nil { @@ -6430,6 +11558,22 @@ func (c *CustomPropertyValuesEvent) GetInstallation() *Installation { return c.Installation } +// GetNewPropertyValues returns the NewPropertyValues slice if it's non-nil, nil otherwise. +func (c *CustomPropertyValuesEvent) GetNewPropertyValues() []*CustomPropertyValue { + if c == nil || c.NewPropertyValues == nil { + return nil + } + return c.NewPropertyValues +} + +// GetOldPropertyValues returns the OldPropertyValues slice if it's non-nil, nil otherwise. +func (c *CustomPropertyValuesEvent) GetOldPropertyValues() []*CustomPropertyValue { + if c == nil || c.OldPropertyValues == nil { + return nil + } + return c.OldPropertyValues +} + // GetOrg returns the Org field. func (c *CustomPropertyValuesEvent) GetOrg() *Organization { if c == nil { @@ -6502,6 +11646,14 @@ func (c *CustomRepoRoles) GetOrg() *Organization { return c.Org } +// GetPermissions returns the Permissions slice if it's non-nil, nil otherwise. +func (c *CustomRepoRoles) GetPermissions() []string { + if c == nil || c.Permissions == nil { + return nil + } + return c.Permissions +} + // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. func (c *CustomRepoRoles) GetUpdatedAt() Timestamp { if c == nil || c.UpdatedAt == nil { @@ -6510,6 +11662,38 @@ func (c *CustomRepoRoles) GetUpdatedAt() Timestamp { return *c.UpdatedAt } +// GetEncryptedToken returns the EncryptedToken field. +func (d *DatadogConfig) GetEncryptedToken() string { + if d == nil { + return "" + } + return d.EncryptedToken +} + +// GetKeyID returns the KeyID field. +func (d *DatadogConfig) GetKeyID() string { + if d == nil { + return "" + } + return d.KeyID +} + +// GetSite returns the Site field. +func (d *DatadogConfig) GetSite() string { + if d == nil { + return "" + } + return d.Site +} + +// GetLanguages returns the Languages slice if it's non-nil, nil otherwise. +func (d *DefaultSetupConfiguration) GetLanguages() []string { + if d == nil || d.Languages == nil { + return nil + } + return d.Languages +} + // GetQuerySuite returns the QuerySuite field if it's non-nil, zero value otherwise. func (d *DefaultSetupConfiguration) GetQuerySuite() string { if d == nil || d.QuerySuite == nil { @@ -6598,6 +11782,38 @@ func (d *DeleteAnalysis) GetNextAnalysisURL() string { return *d.NextAnalysisURL } +// GetCostCenterState returns the CostCenterState field. +func (d *DeleteCostCenterResponse) GetCostCenterState() string { + if d == nil { + return "" + } + return d.CostCenterState +} + +// GetID returns the ID field. +func (d *DeleteCostCenterResponse) GetID() string { + if d == nil { + return "" + } + return d.ID +} + +// GetMessage returns the Message field. +func (d *DeleteCostCenterResponse) GetMessage() string { + if d == nil { + return "" + } + return d.Message +} + +// GetName returns the Name field. +func (d *DeleteCostCenterResponse) GetName() string { + if d == nil { + return "" + } + return d.Name +} + // GetInstallation returns the Installation field. func (d *DeleteEvent) GetInstallation() *Installation { if d == nil { @@ -6854,6 +12070,54 @@ func (d *DependabotAlertState) GetDismissedReason() string { return *d.DismissedReason } +// GetState returns the State field. +func (d *DependabotAlertState) GetState() string { + if d == nil { + return "" + } + return d.State +} + +// GetEncryptedValue returns the EncryptedValue field. +func (d *DependabotEncryptedSecret) GetEncryptedValue() string { + if d == nil { + return "" + } + return d.EncryptedValue +} + +// GetKeyID returns the KeyID field. +func (d *DependabotEncryptedSecret) GetKeyID() string { + if d == nil { + return "" + } + return d.KeyID +} + +// GetName returns the Name field. +func (d *DependabotEncryptedSecret) GetName() string { + if d == nil { + return "" + } + return d.Name +} + +// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs field. +func (d *DependabotEncryptedSecret) GetSelectedRepositoryIDs() DependabotSecretsSelectedRepoIDs { + if d == nil { + return nil + } + return d.SelectedRepositoryIDs +} + +// GetVisibility returns the Visibility field. +func (d *DependabotEncryptedSecret) GetVisibility() string { + if d == nil { + return "" + } + return d.Visibility +} + // GetCVEID returns the CVEID field if it's non-nil, zero value otherwise. func (d *DependabotSecurityAdvisory) GetCVEID() string { if d == nil || d.CVEID == nil { @@ -6870,6 +12134,14 @@ func (d *DependabotSecurityAdvisory) GetCVSS() *AdvisoryCVSS { return d.CVSS } +// GetCWEs returns the CWEs slice if it's non-nil, nil otherwise. +func (d *DependabotSecurityAdvisory) GetCWEs() []*AdvisoryCWEs { + if d == nil || d.CWEs == nil { + return nil + } + return d.CWEs +} + // GetDescription returns the Description field if it's non-nil, zero value otherwise. func (d *DependabotSecurityAdvisory) GetDescription() string { if d == nil || d.Description == nil { @@ -6894,6 +12166,14 @@ func (d *DependabotSecurityAdvisory) GetGHSAID() string { return *d.GHSAID } +// GetIdentifiers returns the Identifiers slice if it's non-nil, nil otherwise. +func (d *DependabotSecurityAdvisory) GetIdentifiers() []*AdvisoryIdentifier { + if d == nil || d.Identifiers == nil { + return nil + } + return d.Identifiers +} + // GetPublishedAt returns the PublishedAt field if it's non-nil, zero value otherwise. func (d *DependabotSecurityAdvisory) GetPublishedAt() Timestamp { if d == nil || d.PublishedAt == nil { @@ -6902,6 +12182,14 @@ func (d *DependabotSecurityAdvisory) GetPublishedAt() Timestamp { return *d.PublishedAt } +// GetReferences returns the References slice if it's non-nil, nil otherwise. +func (d *DependabotSecurityAdvisory) GetReferences() []*AdvisoryReference { + if d == nil || d.References == nil { + return nil + } + return d.References +} + // GetSeverity returns the Severity field if it's non-nil, zero value otherwise. func (d *DependabotSecurityAdvisory) GetSeverity() string { if d == nil || d.Severity == nil { @@ -6926,6 +12214,14 @@ func (d *DependabotSecurityAdvisory) GetUpdatedAt() Timestamp { return *d.UpdatedAt } +// GetVulnerabilities returns the Vulnerabilities slice if it's non-nil, nil otherwise. +func (d *DependabotSecurityAdvisory) GetVulnerabilities() []*AdvisoryVulnerability { + if d == nil || d.Vulnerabilities == nil { + return nil + } + return d.Vulnerabilities +} + // GetWithdrawnAt returns the WithdrawnAt field if it's non-nil, zero value otherwise. func (d *DependabotSecurityAdvisory) GetWithdrawnAt() Timestamp { if d == nil || d.WithdrawnAt == nil { @@ -6990,6 +12286,14 @@ func (d *DependencyGraphSnapshot) GetJob() *DependencyGraphSnapshotJob { return d.Job } +// GetMetadata returns the Metadata map if it's non-nil, an empty map otherwise. +func (d *DependencyGraphSnapshot) GetMetadata() map[string]any { + if d == nil || d.Metadata == nil { + return map[string]any{} + } + return d.Metadata +} + // GetRef returns the Ref field if it's non-nil, zero value otherwise. func (d *DependencyGraphSnapshot) GetRef() string { if d == nil || d.Ref == nil { @@ -7014,6 +12318,14 @@ func (d *DependencyGraphSnapshot) GetSha() string { return *d.Sha } +// GetVersion returns the Version field. +func (d *DependencyGraphSnapshot) GetVersion() int { + if d == nil { + return 0 + } + return d.Version +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (d *DependencyGraphSnapshotCreationData) GetCreatedAt() Timestamp { if d == nil || d.CreatedAt == nil { @@ -7022,6 +12334,14 @@ func (d *DependencyGraphSnapshotCreationData) GetCreatedAt() Timestamp { return *d.CreatedAt } +// GetID returns the ID field. +func (d *DependencyGraphSnapshotCreationData) GetID() int64 { + if d == nil { + return 0 + } + return d.ID +} + // GetMessage returns the Message field if it's non-nil, zero value otherwise. func (d *DependencyGraphSnapshotCreationData) GetMessage() string { if d == nil || d.Message == nil { @@ -7094,6 +12414,14 @@ func (d *DependencyGraphSnapshotManifest) GetFile() *DependencyGraphSnapshotMani return d.File } +// GetMetadata returns the Metadata map if it's non-nil, an empty map otherwise. +func (d *DependencyGraphSnapshotManifest) GetMetadata() map[string]any { + if d == nil || d.Metadata == nil { + return map[string]any{} + } + return d.Metadata +} + // GetName returns the Name field if it's non-nil, zero value otherwise. func (d *DependencyGraphSnapshotManifest) GetName() string { if d == nil || d.Name == nil { @@ -7110,6 +12438,22 @@ func (d *DependencyGraphSnapshotManifestFile) GetSourceLocation() string { return *d.SourceLocation } +// GetDependencies returns the Dependencies slice if it's non-nil, nil otherwise. +func (d *DependencyGraphSnapshotResolvedDependency) GetDependencies() []string { + if d == nil || d.Dependencies == nil { + return nil + } + return d.Dependencies +} + +// GetMetadata returns the Metadata map if it's non-nil, an empty map otherwise. +func (d *DependencyGraphSnapshotResolvedDependency) GetMetadata() map[string]any { + if d == nil || d.Metadata == nil { + return map[string]any{} + } + return d.Metadata +} + // GetPackageURL returns the PackageURL field if it's non-nil, zero value otherwise. func (d *DependencyGraphSnapshotResolvedDependency) GetPackageURL() string { if d == nil || d.PackageURL == nil { @@ -7230,6 +12574,14 @@ func (d *Deployment) GetNodeID() string { return *d.NodeID } +// GetPayload returns the Payload field. +func (d *Deployment) GetPayload() json.RawMessage { + if d == nil { + return json.RawMessage{} + } + return d.Payload +} + // GetRef returns the Ref field if it's non-nil, zero value otherwise. func (d *Deployment) GetRef() string { if d == nil || d.Ref == nil { @@ -7334,6 +12686,14 @@ func (d *DeploymentBranchPolicyRequest) GetType() string { return *d.Type } +// GetBranchPolicies returns the BranchPolicies slice if it's non-nil, nil otherwise. +func (d *DeploymentBranchPolicyResponse) GetBranchPolicies() []*DeploymentBranchPolicy { + if d == nil || d.BranchPolicies == nil { + return nil + } + return d.BranchPolicies +} + // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. func (d *DeploymentBranchPolicyResponse) GetTotalCount() int { if d == nil || d.TotalCount == nil { @@ -7454,6 +12814,14 @@ func (d *DeploymentProtectionRuleEvent) GetOrganization() *Organization { return d.Organization } +// GetPullRequests returns the PullRequests slice if it's non-nil, nil otherwise. +func (d *DeploymentProtectionRuleEvent) GetPullRequests() []*PullRequest { + if d == nil || d.PullRequests == nil { + return nil + } + return d.PullRequests +} + // GetRepo returns the Repo field. func (d *DeploymentProtectionRuleEvent) GetRepo() *Repository { if d == nil { @@ -7494,6 +12862,14 @@ func (d *DeploymentRequest) GetEnvironment() string { return *d.Environment } +// GetPayload returns the Payload field. +func (d *DeploymentRequest) GetPayload() any { + if d == nil { + return nil + } + return d.Payload +} + // GetProductionEnvironment returns the ProductionEnvironment field if it's non-nil, zero value otherwise. func (d *DeploymentRequest) GetProductionEnvironment() bool { if d == nil || d.ProductionEnvironment == nil { @@ -7606,6 +12982,14 @@ func (d *DeploymentReviewEvent) GetRequester() *User { return d.Requester } +// GetReviewers returns the Reviewers slice if it's non-nil, nil otherwise. +func (d *DeploymentReviewEvent) GetReviewers() []*RequiredReviewer { + if d == nil || d.Reviewers == nil { + return nil + } + return d.Reviewers +} + // GetSender returns the Sender field. func (d *DeploymentReviewEvent) GetSender() *User { if d == nil { @@ -7630,6 +13014,14 @@ func (d *DeploymentReviewEvent) GetWorkflowJobRun() *WorkflowJobRun { return d.WorkflowJobRun } +// GetWorkflowJobRuns returns the WorkflowJobRuns slice if it's non-nil, nil otherwise. +func (d *DeploymentReviewEvent) GetWorkflowJobRuns() []*WorkflowJobRun { + if d == nil || d.WorkflowJobRuns == nil { + return nil + } + return d.WorkflowJobRuns +} + // GetWorkflowRun returns the WorkflowRun field. func (d *DeploymentReviewEvent) GetWorkflowRun() *WorkflowRun { if d == nil { @@ -7638,6 +13030,38 @@ func (d *DeploymentReviewEvent) GetWorkflowRun() *WorkflowRun { return d.WorkflowRun } +// GetEnvironment returns the Environment field. +func (d *DeploymentsListOptions) GetEnvironment() string { + if d == nil { + return "" + } + return d.Environment +} + +// GetRef returns the Ref field. +func (d *DeploymentsListOptions) GetRef() string { + if d == nil { + return "" + } + return d.Ref +} + +// GetSHA returns the SHA field. +func (d *DeploymentsListOptions) GetSHA() string { + if d == nil { + return "" + } + return d.SHA +} + +// GetTask returns the Task field. +func (d *DeploymentsListOptions) GetTask() string { + if d == nil { + return "" + } + return d.Task +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (d *DeploymentStatus) GetCreatedAt() Timestamp { if d == nil || d.CreatedAt == nil { @@ -7854,6 +13278,46 @@ func (d *DeploymentStatusRequest) GetState() string { return *d.State } +// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. +func (d *DevContainer) GetDisplayName() string { + if d == nil || d.DisplayName == nil { + return "" + } + return *d.DisplayName +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (d *DevContainer) GetName() string { + if d == nil || d.Name == nil { + return "" + } + return *d.Name +} + +// GetPath returns the Path field. +func (d *DevContainer) GetPath() string { + if d == nil { + return "" + } + return d.Path +} + +// GetDevcontainers returns the Devcontainers slice if it's non-nil, nil otherwise. +func (d *DevContainerConfigurations) GetDevcontainers() []*DevContainer { + if d == nil || d.Devcontainers == nil { + return nil + } + return d.Devcontainers +} + +// GetTotalCount returns the TotalCount field. +func (d *DevContainerConfigurations) GetTotalCount() int64 { + if d == nil { + return 0 + } + return d.TotalCount +} + // GetActiveLockReason returns the ActiveLockReason field if it's non-nil, zero value otherwise. func (d *Discussion) GetActiveLockReason() string { if d == nil || d.ActiveLockReason == nil { @@ -8246,6 +13710,14 @@ func (d *DiscussionCommentEvent) GetSender() *User { return d.Sender } +// GetDirection returns the Direction field. +func (d *DiscussionCommentListOptions) GetDirection() string { + if d == nil { + return "" + } + return d.Direction +} + // GetAction returns the Action field if it's non-nil, zero value otherwise. func (d *DiscussionEvent) GetAction() string { if d == nil || d.Action == nil { @@ -8294,6 +13766,38 @@ func (d *DiscussionEvent) GetSender() *User { return d.Sender } +// GetDirection returns the Direction field. +func (d *DiscussionListOptions) GetDirection() string { + if d == nil { + return "" + } + return d.Direction +} + +// GetApps returns the Apps slice if it's non-nil, nil otherwise. +func (d *DismissalRestrictions) GetApps() []*App { + if d == nil || d.Apps == nil { + return nil + } + return d.Apps +} + +// GetTeams returns the Teams slice if it's non-nil, nil otherwise. +func (d *DismissalRestrictions) GetTeams() []*Team { + if d == nil || d.Teams == nil { + return nil + } + return d.Teams +} + +// GetUsers returns the Users slice if it's non-nil, nil otherwise. +func (d *DismissalRestrictions) GetUsers() []*User { + if d == nil || d.Users == nil { + return nil + } + return d.Users +} + // GetApps returns the Apps field if it's non-nil, zero value otherwise. func (d *DismissalRestrictionsRequest) GetApps() []string { if d == nil || d.Apps == nil { @@ -8366,6 +13870,14 @@ func (d *DispatchRequestOptions) GetClientPayload() json.RawMessage { return *d.ClientPayload } +// GetEventType returns the EventType field. +func (d *DispatchRequestOptions) GetEventType() string { + if d == nil { + return "" + } + return d.EventType +} + // GetBody returns the Body field if it's non-nil, zero value otherwise. func (d *DraftReviewComment) GetBody() string { if d == nil || d.Body == nil { @@ -8550,6 +14062,54 @@ func (e *EditTitle) GetFrom() string { return *e.From } +// GetFrom returns the From slice if it's non-nil, nil otherwise. +func (e *EditTopics) GetFrom() []string { + if e == nil || e.From == nil { + return nil + } + return e.From +} + +// GetEncryptedValue returns the EncryptedValue field. +func (e *EncryptedSecret) GetEncryptedValue() string { + if e == nil { + return "" + } + return e.EncryptedValue +} + +// GetKeyID returns the KeyID field. +func (e *EncryptedSecret) GetKeyID() string { + if e == nil { + return "" + } + return e.KeyID +} + +// GetName returns the Name field. +func (e *EncryptedSecret) GetName() string { + if e == nil { + return "" + } + return e.Name +} + +// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs field. +func (e *EncryptedSecret) GetSelectedRepositoryIDs() SelectedRepoIDs { + if e == nil { + return nil + } + return e.SelectedRepositoryIDs +} + +// GetVisibility returns the Visibility field. +func (e *EncryptedSecret) GetVisibility() string { + if e == nil { + return "" + } + return e.Visibility +} + // GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. func (e *Enterprise) GetAvatarURL() string { if e == nil || e.AvatarURL == nil { @@ -8630,6 +14190,438 @@ func (e *Enterprise) GetWebsiteURL() string { return *e.WebsiteURL } +// GetBudgetAlerting returns the BudgetAlerting field. +func (e *EnterpriseBudget) GetBudgetAlerting() *EnterpriseBudgetAlerting { + if e == nil { + return nil + } + return e.BudgetAlerting +} + +// GetBudgetAmount returns the BudgetAmount field if it's non-nil, zero value otherwise. +func (e *EnterpriseBudget) GetBudgetAmount() int { + if e == nil || e.BudgetAmount == nil { + return 0 + } + return *e.BudgetAmount +} + +// GetBudgetEntityName returns the BudgetEntityName field if it's non-nil, zero value otherwise. +func (e *EnterpriseBudget) GetBudgetEntityName() string { + if e == nil || e.BudgetEntityName == nil { + return "" + } + return *e.BudgetEntityName +} + +// GetBudgetProductSKU returns the BudgetProductSKU field if it's non-nil, zero value otherwise. +func (e *EnterpriseBudget) GetBudgetProductSKU() string { + if e == nil || e.BudgetProductSKU == nil { + return "" + } + return *e.BudgetProductSKU +} + +// GetBudgetScope returns the BudgetScope field if it's non-nil, zero value otherwise. +func (e *EnterpriseBudget) GetBudgetScope() string { + if e == nil || e.BudgetScope == nil { + return "" + } + return *e.BudgetScope +} + +// GetBudgetType returns the BudgetType field if it's non-nil, zero value otherwise. +func (e *EnterpriseBudget) GetBudgetType() string { + if e == nil || e.BudgetType == nil { + return "" + } + return *e.BudgetType +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (e *EnterpriseBudget) GetID() string { + if e == nil || e.ID == nil { + return "" + } + return *e.ID +} + +// GetPreventFurtherUsage returns the PreventFurtherUsage field if it's non-nil, zero value otherwise. +func (e *EnterpriseBudget) GetPreventFurtherUsage() bool { + if e == nil || e.PreventFurtherUsage == nil { + return false + } + return *e.PreventFurtherUsage +} + +// GetAlertRecipients returns the AlertRecipients slice if it's non-nil, nil otherwise. +func (e *EnterpriseBudgetAlerting) GetAlertRecipients() []string { + if e == nil || e.AlertRecipients == nil { + return nil + } + return e.AlertRecipients +} + +// GetWillAlert returns the WillAlert field if it's non-nil, zero value otherwise. +func (e *EnterpriseBudgetAlerting) GetWillAlert() bool { + if e == nil || e.WillAlert == nil { + return false + } + return *e.WillAlert +} + +// GetTotalSeatsConsumed returns the TotalSeatsConsumed field. +func (e *EnterpriseConsumedLicenses) GetTotalSeatsConsumed() int { + if e == nil { + return 0 + } + return e.TotalSeatsConsumed +} + +// GetTotalSeatsPurchased returns the TotalSeatsPurchased field. +func (e *EnterpriseConsumedLicenses) GetTotalSeatsPurchased() int { + if e == nil { + return 0 + } + return e.TotalSeatsPurchased +} + +// GetUsers returns the Users slice if it's non-nil, nil otherwise. +func (e *EnterpriseConsumedLicenses) GetUsers() []*EnterpriseLicensedUsers { + if e == nil || e.Users == nil { + return nil + } + return e.Users +} + +// GetBudgetAlerting returns the BudgetAlerting field. +func (e *EnterpriseCreateBudget) GetBudgetAlerting() *EnterpriseBudgetAlerting { + if e == nil { + return nil + } + return e.BudgetAlerting +} + +// GetBudgetAmount returns the BudgetAmount field. +func (e *EnterpriseCreateBudget) GetBudgetAmount() int { + if e == nil { + return 0 + } + return e.BudgetAmount +} + +// GetBudgetEntityName returns the BudgetEntityName field if it's non-nil, zero value otherwise. +func (e *EnterpriseCreateBudget) GetBudgetEntityName() string { + if e == nil || e.BudgetEntityName == nil { + return "" + } + return *e.BudgetEntityName +} + +// GetBudgetProductSKU returns the BudgetProductSKU field if it's non-nil, zero value otherwise. +func (e *EnterpriseCreateBudget) GetBudgetProductSKU() string { + if e == nil || e.BudgetProductSKU == nil { + return "" + } + return *e.BudgetProductSKU +} + +// GetBudgetScope returns the BudgetScope field. +func (e *EnterpriseCreateBudget) GetBudgetScope() string { + if e == nil { + return "" + } + return e.BudgetScope +} + +// GetBudgetType returns the BudgetType field. +func (e *EnterpriseCreateBudget) GetBudgetType() string { + if e == nil { + return "" + } + return e.BudgetType +} + +// GetPreventFurtherUsage returns the PreventFurtherUsage field. +func (e *EnterpriseCreateBudget) GetPreventFurtherUsage() bool { + if e == nil { + return false + } + return e.PreventFurtherUsage +} + +// GetBudget returns the Budget field. +func (e *EnterpriseCreateOrUpdateBudgetResponse) GetBudget() *EnterpriseBudget { + if e == nil { + return nil + } + return e.Budget +} + +// GetMessage returns the Message field. +func (e *EnterpriseCreateOrUpdateBudgetResponse) GetMessage() string { + if e == nil { + return "" + } + return e.Message +} + +// GetOrganizationID returns the OrganizationID field if it's non-nil, zero value otherwise. +func (e *EnterpriseCustomPropertiesValues) GetOrganizationID() int64 { + if e == nil || e.OrganizationID == nil { + return 0 + } + return *e.OrganizationID +} + +// GetOrganizationLogin returns the OrganizationLogin field if it's non-nil, zero value otherwise. +func (e *EnterpriseCustomPropertiesValues) GetOrganizationLogin() string { + if e == nil || e.OrganizationLogin == nil { + return "" + } + return *e.OrganizationLogin +} + +// GetProperties returns the Properties slice if it's non-nil, nil otherwise. +func (e *EnterpriseCustomPropertiesValues) GetProperties() []*CustomPropertyValue { + if e == nil || e.Properties == nil { + return nil + } + return e.Properties +} + +// GetProperties returns the Properties slice if it's non-nil, nil otherwise. +func (e *EnterpriseCustomPropertySchema) GetProperties() []*CustomProperty { + if e == nil || e.Properties == nil { + return nil + } + return e.Properties +} + +// GetOrganizationLogin returns the OrganizationLogin slice if it's non-nil, nil otherwise. +func (e *EnterpriseCustomPropertyValuesRequest) GetOrganizationLogin() []string { + if e == nil || e.OrganizationLogin == nil { + return nil + } + return e.OrganizationLogin +} + +// GetProperties returns the Properties slice if it's non-nil, nil otherwise. +func (e *EnterpriseCustomPropertyValuesRequest) GetProperties() []*CustomPropertyValue { + if e == nil || e.Properties == nil { + return nil + } + return e.Properties +} + +// GetID returns the ID field. +func (e *EnterpriseDeleteBudgetResponse) GetID() string { + if e == nil { + return "" + } + return e.ID +} + +// GetMessage returns the Message field. +func (e *EnterpriseDeleteBudgetResponse) GetMessage() string { + if e == nil { + return "" + } + return e.Message +} + +// GetEnterpriseServerEmails returns the EnterpriseServerEmails slice if it's non-nil, nil otherwise. +func (e *EnterpriseLicensedUsers) GetEnterpriseServerEmails() []string { + if e == nil || e.EnterpriseServerEmails == nil { + return nil + } + return e.EnterpriseServerEmails +} + +// GetEnterpriseServerUser returns the EnterpriseServerUser field if it's non-nil, zero value otherwise. +func (e *EnterpriseLicensedUsers) GetEnterpriseServerUser() bool { + if e == nil || e.EnterpriseServerUser == nil { + return false + } + return *e.EnterpriseServerUser +} + +// GetEnterpriseServerUserIDs returns the EnterpriseServerUserIDs slice if it's non-nil, nil otherwise. +func (e *EnterpriseLicensedUsers) GetEnterpriseServerUserIDs() []string { + if e == nil || e.EnterpriseServerUserIDs == nil { + return nil + } + return e.EnterpriseServerUserIDs +} + +// GetGithubComEnterpriseRoles returns the GithubComEnterpriseRoles slice if it's non-nil, nil otherwise. +func (e *EnterpriseLicensedUsers) GetGithubComEnterpriseRoles() []string { + if e == nil || e.GithubComEnterpriseRoles == nil { + return nil + } + return e.GithubComEnterpriseRoles +} + +// GetGithubComLogin returns the GithubComLogin field. +func (e *EnterpriseLicensedUsers) GetGithubComLogin() string { + if e == nil { + return "" + } + return e.GithubComLogin +} + +// GetGithubComMemberRoles returns the GithubComMemberRoles slice if it's non-nil, nil otherwise. +func (e *EnterpriseLicensedUsers) GetGithubComMemberRoles() []string { + if e == nil || e.GithubComMemberRoles == nil { + return nil + } + return e.GithubComMemberRoles +} + +// GetGithubComName returns the GithubComName field if it's non-nil, zero value otherwise. +func (e *EnterpriseLicensedUsers) GetGithubComName() string { + if e == nil || e.GithubComName == nil { + return "" + } + return *e.GithubComName +} + +// GetGithubComOrgsWithPendingInvites returns the GithubComOrgsWithPendingInvites slice if it's non-nil, nil otherwise. +func (e *EnterpriseLicensedUsers) GetGithubComOrgsWithPendingInvites() []string { + if e == nil || e.GithubComOrgsWithPendingInvites == nil { + return nil + } + return e.GithubComOrgsWithPendingInvites +} + +// GetGithubComProfile returns the GithubComProfile field if it's non-nil, zero value otherwise. +func (e *EnterpriseLicensedUsers) GetGithubComProfile() string { + if e == nil || e.GithubComProfile == nil { + return "" + } + return *e.GithubComProfile +} + +// GetGithubComSamlNameID returns the GithubComSamlNameID field if it's non-nil, zero value otherwise. +func (e *EnterpriseLicensedUsers) GetGithubComSamlNameID() string { + if e == nil || e.GithubComSamlNameID == nil { + return "" + } + return *e.GithubComSamlNameID +} + +// GetGithubComTwoFactorAuth returns the GithubComTwoFactorAuth field if it's non-nil, zero value otherwise. +func (e *EnterpriseLicensedUsers) GetGithubComTwoFactorAuth() bool { + if e == nil || e.GithubComTwoFactorAuth == nil { + return false + } + return *e.GithubComTwoFactorAuth +} + +// GetGithubComUser returns the GithubComUser field. +func (e *EnterpriseLicensedUsers) GetGithubComUser() bool { + if e == nil { + return false + } + return e.GithubComUser +} + +// GetGithubComVerifiedDomainEmails returns the GithubComVerifiedDomainEmails slice if it's non-nil, nil otherwise. +func (e *EnterpriseLicensedUsers) GetGithubComVerifiedDomainEmails() []string { + if e == nil || e.GithubComVerifiedDomainEmails == nil { + return nil + } + return e.GithubComVerifiedDomainEmails +} + +// GetLicenseType returns the LicenseType field. +func (e *EnterpriseLicensedUsers) GetLicenseType() string { + if e == nil { + return "" + } + return e.LicenseType +} + +// GetTotalUserAccounts returns the TotalUserAccounts field. +func (e *EnterpriseLicensedUsers) GetTotalUserAccounts() int { + if e == nil { + return 0 + } + return e.TotalUserAccounts +} + +// GetVisualStudioLicenseStatus returns the VisualStudioLicenseStatus field if it's non-nil, zero value otherwise. +func (e *EnterpriseLicensedUsers) GetVisualStudioLicenseStatus() string { + if e == nil || e.VisualStudioLicenseStatus == nil { + return "" + } + return *e.VisualStudioLicenseStatus +} + +// GetVisualStudioSubscriptionEmail returns the VisualStudioSubscriptionEmail field if it's non-nil, zero value otherwise. +func (e *EnterpriseLicensedUsers) GetVisualStudioSubscriptionEmail() string { + if e == nil || e.VisualStudioSubscriptionEmail == nil { + return "" + } + return *e.VisualStudioSubscriptionEmail +} + +// GetVisualStudioSubscriptionUser returns the VisualStudioSubscriptionUser field. +func (e *EnterpriseLicensedUsers) GetVisualStudioSubscriptionUser() bool { + if e == nil { + return false + } + return e.VisualStudioSubscriptionUser +} + +// GetDescription returns the Description field. +func (e *EnterpriseLicenseSyncStatus) GetDescription() string { + if e == nil { + return "" + } + return e.Description +} + +// GetProperties returns the Properties field. +func (e *EnterpriseLicenseSyncStatus) GetProperties() *ServerInstanceProperties { + if e == nil { + return nil + } + return e.Properties +} + +// GetTitle returns the Title field. +func (e *EnterpriseLicenseSyncStatus) GetTitle() string { + if e == nil { + return "" + } + return e.Title +} + +// GetBudgets returns the Budgets slice if it's non-nil, nil otherwise. +func (e *EnterpriseListBudgets) GetBudgets() []*EnterpriseBudget { + if e == nil || e.Budgets == nil { + return nil + } + return e.Budgets +} + +// GetHasNextPage returns the HasNextPage field if it's non-nil, zero value otherwise. +func (e *EnterpriseListBudgets) GetHasNextPage() bool { + if e == nil || e.HasNextPage == nil { + return false + } + return *e.HasNextPage +} + +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (e *EnterpriseListBudgets) GetTotalCount() int { + if e == nil || e.TotalCount == nil { + return 0 + } + return *e.TotalCount +} + // GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise. func (e *EnterpriseRunnerGroup) GetAllowsPublicRepositories() bool { if e == nil || e.AllowsPublicRepositories == nil { @@ -8646,6 +14638,14 @@ func (e *EnterpriseRunnerGroup) GetDefault() bool { return *e.Default } +// GetHostedRunnersURL returns the HostedRunnersURL field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetHostedRunnersURL() string { + if e == nil || e.HostedRunnersURL == nil { + return "" + } + return *e.HostedRunnersURL +} + // GetID returns the ID field if it's non-nil, zero value otherwise. func (e *EnterpriseRunnerGroup) GetID() int64 { if e == nil || e.ID == nil { @@ -8670,6 +14670,14 @@ func (e *EnterpriseRunnerGroup) GetName() string { return *e.Name } +// GetNetworkConfigurationID returns the NetworkConfigurationID field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetNetworkConfigurationID() string { + if e == nil || e.NetworkConfigurationID == nil { + return "" + } + return *e.NetworkConfigurationID +} + // GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. func (e *EnterpriseRunnerGroup) GetRestrictedToWorkflows() bool { if e == nil || e.RestrictedToWorkflows == nil { @@ -8694,6 +14702,14 @@ func (e *EnterpriseRunnerGroup) GetSelectedOrganizationsURL() string { return *e.SelectedOrganizationsURL } +// GetSelectedWorkflows returns the SelectedWorkflows slice if it's non-nil, nil otherwise. +func (e *EnterpriseRunnerGroup) GetSelectedWorkflows() []string { + if e == nil || e.SelectedWorkflows == nil { + return nil + } + return e.SelectedWorkflows +} + // GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. func (e *EnterpriseRunnerGroup) GetVisibility() string { if e == nil || e.Visibility == nil { @@ -8710,6 +14726,14 @@ func (e *EnterpriseRunnerGroup) GetWorkflowRestrictionsReadOnly() bool { return *e.WorkflowRestrictionsReadOnly } +// GetRunnerGroups returns the RunnerGroups slice if it's non-nil, nil otherwise. +func (e *EnterpriseRunnerGroups) GetRunnerGroups() []*EnterpriseRunnerGroup { + if e == nil || e.RunnerGroups == nil { + return nil + } + return e.RunnerGroups +} + // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. func (e *EnterpriseRunnerGroups) GetTotalCount() int { if e == nil || e.TotalCount == nil { @@ -8758,6 +14782,182 @@ func (e *EnterpriseSecurityAnalysisSettings) GetSecretScanningValidityChecksEnab return *e.SecretScanningValidityChecksEnabled } +// GetCreatedAt returns the CreatedAt field. +func (e *EnterpriseTeam) GetCreatedAt() Timestamp { + if e == nil { + return Timestamp{} + } + return e.CreatedAt +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (e *EnterpriseTeam) GetDescription() string { + if e == nil || e.Description == nil { + return "" + } + return *e.Description +} + +// GetGroupID returns the GroupID field. +func (e *EnterpriseTeam) GetGroupID() string { + if e == nil { + return "" + } + return e.GroupID +} + +// GetHTMLURL returns the HTMLURL field. +func (e *EnterpriseTeam) GetHTMLURL() string { + if e == nil { + return "" + } + return e.HTMLURL +} + +// GetID returns the ID field. +func (e *EnterpriseTeam) GetID() int64 { + if e == nil { + return 0 + } + return e.ID +} + +// GetMemberURL returns the MemberURL field. +func (e *EnterpriseTeam) GetMemberURL() string { + if e == nil { + return "" + } + return e.MemberURL +} + +// GetName returns the Name field. +func (e *EnterpriseTeam) GetName() string { + if e == nil { + return "" + } + return e.Name +} + +// GetOrganizationSelectionType returns the OrganizationSelectionType field if it's non-nil, zero value otherwise. +func (e *EnterpriseTeam) GetOrganizationSelectionType() string { + if e == nil || e.OrganizationSelectionType == nil { + return "" + } + return *e.OrganizationSelectionType +} + +// GetSlug returns the Slug field. +func (e *EnterpriseTeam) GetSlug() string { + if e == nil { + return "" + } + return e.Slug +} + +// GetUpdatedAt returns the UpdatedAt field. +func (e *EnterpriseTeam) GetUpdatedAt() Timestamp { + if e == nil { + return Timestamp{} + } + return e.UpdatedAt +} + +// GetURL returns the URL field. +func (e *EnterpriseTeam) GetURL() string { + if e == nil { + return "" + } + return e.URL +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (e *EnterpriseTeamCreateOrUpdateRequest) GetDescription() string { + if e == nil || e.Description == nil { + return "" + } + return *e.Description +} + +// GetGroupID returns the GroupID field if it's non-nil, zero value otherwise. +func (e *EnterpriseTeamCreateOrUpdateRequest) GetGroupID() string { + if e == nil || e.GroupID == nil { + return "" + } + return *e.GroupID +} + +// GetName returns the Name field. +func (e *EnterpriseTeamCreateOrUpdateRequest) GetName() string { + if e == nil { + return "" + } + return e.Name +} + +// GetOrganizationSelectionType returns the OrganizationSelectionType field if it's non-nil, zero value otherwise. +func (e *EnterpriseTeamCreateOrUpdateRequest) GetOrganizationSelectionType() string { + if e == nil || e.OrganizationSelectionType == nil { + return "" + } + return *e.OrganizationSelectionType +} + +// GetBudgetAlerting returns the BudgetAlerting field. +func (e *EnterpriseUpdateBudget) GetBudgetAlerting() *EnterpriseBudgetAlerting { + if e == nil { + return nil + } + return e.BudgetAlerting +} + +// GetBudgetAmount returns the BudgetAmount field if it's non-nil, zero value otherwise. +func (e *EnterpriseUpdateBudget) GetBudgetAmount() int { + if e == nil || e.BudgetAmount == nil { + return 0 + } + return *e.BudgetAmount +} + +// GetBudgetEntityName returns the BudgetEntityName field if it's non-nil, zero value otherwise. +func (e *EnterpriseUpdateBudget) GetBudgetEntityName() string { + if e == nil || e.BudgetEntityName == nil { + return "" + } + return *e.BudgetEntityName +} + +// GetBudgetProductSKU returns the BudgetProductSKU field if it's non-nil, zero value otherwise. +func (e *EnterpriseUpdateBudget) GetBudgetProductSKU() string { + if e == nil || e.BudgetProductSKU == nil { + return "" + } + return *e.BudgetProductSKU +} + +// GetBudgetScope returns the BudgetScope field if it's non-nil, zero value otherwise. +func (e *EnterpriseUpdateBudget) GetBudgetScope() string { + if e == nil || e.BudgetScope == nil { + return "" + } + return *e.BudgetScope +} + +// GetBudgetType returns the BudgetType field if it's non-nil, zero value otherwise. +func (e *EnterpriseUpdateBudget) GetBudgetType() string { + if e == nil || e.BudgetType == nil { + return "" + } + return *e.BudgetType +} + +// GetPreventFurtherUsage returns the PreventFurtherUsage field if it's non-nil, zero value otherwise. +func (e *EnterpriseUpdateBudget) GetPreventFurtherUsage() bool { + if e == nil || e.PreventFurtherUsage == nil { + return false + } + return *e.PreventFurtherUsage +} + // GetCanAdminsBypass returns the CanAdminsBypass field if it's non-nil, zero value otherwise. func (e *Environment) GetCanAdminsBypass() bool { if e == nil || e.CanAdminsBypass == nil { @@ -8830,6 +15030,14 @@ func (e *Environment) GetOwner() string { return *e.Owner } +// GetProtectionRules returns the ProtectionRules slice if it's non-nil, nil otherwise. +func (e *Environment) GetProtectionRules() []*ProtectionRule { + if e == nil || e.ProtectionRules == nil { + return nil + } + return e.ProtectionRules +} + // GetRepo returns the Repo field if it's non-nil, zero value otherwise. func (e *Environment) GetRepo() string { if e == nil || e.Repo == nil { @@ -8838,6 +15046,14 @@ func (e *Environment) GetRepo() string { return *e.Repo } +// GetReviewers returns the Reviewers slice if it's non-nil, nil otherwise. +func (e *Environment) GetReviewers() []*EnvReviewers { + if e == nil || e.Reviewers == nil { + return nil + } + return e.Reviewers +} + // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. func (e *Environment) GetUpdatedAt() Timestamp { if e == nil || e.UpdatedAt == nil { @@ -8862,6 +15078,14 @@ func (e *Environment) GetWaitTimer() int { return *e.WaitTimer } +// GetEnvironments returns the Environments slice if it's non-nil, nil otherwise. +func (e *EnvResponse) GetEnvironments() []*Environment { + if e == nil || e.Environments == nil { + return nil + } + return e.Environments +} + // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. func (e *EnvResponse) GetTotalCount() int { if e == nil || e.TotalCount == nil { @@ -8886,6 +15110,38 @@ func (e *EnvReviewers) GetType() string { return *e.Type } +// GetCode returns the Code field. +func (e *Error) GetCode() string { + if e == nil { + return "" + } + return e.Code +} + +// GetField returns the Field field. +func (e *Error) GetField() string { + if e == nil { + return "" + } + return e.Field +} + +// GetMessage returns the Message field. +func (e *Error) GetMessage() string { + if e == nil { + return "" + } + return e.Message +} + +// GetResource returns the Resource field. +func (e *Error) GetResource() string { + if e == nil { + return "" + } + return e.Resource +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (e *ErrorBlock) GetCreatedAt() Timestamp { if e == nil || e.CreatedAt == nil { @@ -8894,6 +15150,14 @@ func (e *ErrorBlock) GetCreatedAt() Timestamp { return *e.CreatedAt } +// GetReason returns the Reason field. +func (e *ErrorBlock) GetReason() string { + if e == nil { + return "" + } + return e.Reason +} + // GetBlock returns the Block field. func (e *ErrorResponse) GetBlock() *ErrorBlock { if e == nil { @@ -8902,6 +15166,30 @@ func (e *ErrorResponse) GetBlock() *ErrorBlock { return e.Block } +// GetDocumentationURL returns the DocumentationURL field. +func (e *ErrorResponse) GetDocumentationURL() string { + if e == nil { + return "" + } + return e.DocumentationURL +} + +// GetErrors returns the Errors slice if it's non-nil, nil otherwise. +func (e *ErrorResponse) GetErrors() []Error { + if e == nil || e.Errors == nil { + return nil + } + return e.Errors +} + +// GetMessage returns the Message field. +func (e *ErrorResponse) GetMessage() string { + if e == nil { + return "" + } + return e.Message +} + // GetActor returns the Actor field. func (e *Event) GetActor() *User { if e == nil { @@ -8982,6 +15270,22 @@ func (e *ExternalGroup) GetGroupName() string { return *e.GroupName } +// GetMembers returns the Members slice if it's non-nil, nil otherwise. +func (e *ExternalGroup) GetMembers() []*ExternalGroupMember { + if e == nil || e.Members == nil { + return nil + } + return e.Members +} + +// GetTeams returns the Teams slice if it's non-nil, nil otherwise. +func (e *ExternalGroup) GetTeams() []*ExternalGroupTeam { + if e == nil || e.Teams == nil { + return nil + } + return e.Teams +} + // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. func (e *ExternalGroup) GetUpdatedAt() Timestamp { if e == nil || e.UpdatedAt == nil { @@ -8990,6 +15294,14 @@ func (e *ExternalGroup) GetUpdatedAt() Timestamp { return *e.UpdatedAt } +// GetGroups returns the Groups slice if it's non-nil, nil otherwise. +func (e *ExternalGroupList) GetGroups() []*ExternalGroup { + if e == nil || e.Groups == nil { + return nil + } + return e.Groups +} + // GetMemberEmail returns the MemberEmail field if it's non-nil, zero value otherwise. func (e *ExternalGroupMember) GetMemberEmail() string { if e == nil || e.MemberEmail == nil { @@ -9078,6 +15390,14 @@ func (f *FeedLinks) GetCurrentUserOrganization() *FeedLink { return f.CurrentUserOrganization } +// GetCurrentUserOrganizations returns the CurrentUserOrganizations slice if it's non-nil, nil otherwise. +func (f *FeedLinks) GetCurrentUserOrganizations() []*FeedLink { + if f == nil || f.CurrentUserOrganizations == nil { + return nil + } + return f.CurrentUserOrganizations +} + // GetCurrentUserPublic returns the CurrentUserPublic field. func (f *FeedLinks) GetCurrentUserPublic() *FeedLink { if f == nil { @@ -9118,6 +15438,14 @@ func (f *Feeds) GetCurrentUserOrganizationURL() string { return *f.CurrentUserOrganizationURL } +// GetCurrentUserOrganizationURLs returns the CurrentUserOrganizationURLs slice if it's non-nil, nil otherwise. +func (f *Feeds) GetCurrentUserOrganizationURLs() []string { + if f == nil || f.CurrentUserOrganizationURLs == nil { + return nil + } + return f.CurrentUserOrganizationURLs +} + // GetCurrentUserPublicURL returns the CurrentUserPublicURL field if it's non-nil, zero value otherwise. func (f *Feeds) GetCurrentUserPublicURL() string { if f == nil || f.CurrentUserPublicURL == nil { @@ -9158,6 +15486,182 @@ func (f *Feeds) GetUserURL() string { return *f.UserURL } +// GetFieldName returns the FieldName field if it's non-nil, zero value otherwise. +func (f *FieldValue) GetFieldName() string { + if f == nil || f.FieldName == nil { + return "" + } + return *f.FieldName +} + +// GetFieldNodeID returns the FieldNodeID field if it's non-nil, zero value otherwise. +func (f *FieldValue) GetFieldNodeID() string { + if f == nil || f.FieldNodeID == nil { + return "" + } + return *f.FieldNodeID +} + +// GetFieldType returns the FieldType field if it's non-nil, zero value otherwise. +func (f *FieldValue) GetFieldType() string { + if f == nil || f.FieldType == nil { + return "" + } + return *f.FieldType +} + +// GetFrom returns the From field. +func (f *FieldValue) GetFrom() json.RawMessage { + if f == nil { + return json.RawMessage{} + } + return f.From +} + +// GetProjectNumber returns the ProjectNumber field if it's non-nil, zero value otherwise. +func (f *FieldValue) GetProjectNumber() int64 { + if f == nil || f.ProjectNumber == nil { + return 0 + } + return *f.ProjectNumber +} + +// GetTo returns the To field. +func (f *FieldValue) GetTo() json.RawMessage { + if f == nil { + return json.RawMessage{} + } + return f.To +} + +// GetParameters returns the Parameters field. +func (f *FileExtensionRestrictionBranchRule) GetParameters() FileExtensionRestrictionRuleParameters { + if f == nil { + return FileExtensionRestrictionRuleParameters{} + } + return f.Parameters +} + +// GetRestrictedFileExtensions returns the RestrictedFileExtensions slice if it's non-nil, nil otherwise. +func (f *FileExtensionRestrictionRuleParameters) GetRestrictedFileExtensions() []string { + if f == nil || f.RestrictedFileExtensions == nil { + return nil + } + return f.RestrictedFileExtensions +} + +// GetParameters returns the Parameters field. +func (f *FilePathRestrictionBranchRule) GetParameters() FilePathRestrictionRuleParameters { + if f == nil { + return FilePathRestrictionRuleParameters{} + } + return f.Parameters +} + +// GetRestrictedFilePaths returns the RestrictedFilePaths slice if it's non-nil, nil otherwise. +func (f *FilePathRestrictionRuleParameters) GetRestrictedFilePaths() []string { + if f == nil || f.RestrictedFilePaths == nil { + return nil + } + return f.RestrictedFilePaths +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (f *FineGrainedPersonalAccessTokenRequest) GetCreatedAt() Timestamp { + if f == nil || f.CreatedAt == nil { + return Timestamp{} + } + return *f.CreatedAt +} + +// GetID returns the ID field. +func (f *FineGrainedPersonalAccessTokenRequest) GetID() int64 { + if f == nil { + return 0 + } + return f.ID +} + +// GetOwner returns the Owner field. +func (f *FineGrainedPersonalAccessTokenRequest) GetOwner() User { + if f == nil { + return User{} + } + return f.Owner +} + +// GetPermissions returns the Permissions field. +func (f *FineGrainedPersonalAccessTokenRequest) GetPermissions() PersonalAccessTokenPermissions { + if f == nil { + return PersonalAccessTokenPermissions{} + } + return f.Permissions +} + +// GetReason returns the Reason field. +func (f *FineGrainedPersonalAccessTokenRequest) GetReason() string { + if f == nil { + return "" + } + return f.Reason +} + +// GetRepositoriesURL returns the RepositoriesURL field. +func (f *FineGrainedPersonalAccessTokenRequest) GetRepositoriesURL() string { + if f == nil { + return "" + } + return f.RepositoriesURL +} + +// GetRepositorySelection returns the RepositorySelection field. +func (f *FineGrainedPersonalAccessTokenRequest) GetRepositorySelection() string { + if f == nil { + return "" + } + return f.RepositorySelection +} + +// GetTokenExpired returns the TokenExpired field. +func (f *FineGrainedPersonalAccessTokenRequest) GetTokenExpired() bool { + if f == nil { + return false + } + return f.TokenExpired +} + +// GetTokenExpiresAt returns the TokenExpiresAt field if it's non-nil, zero value otherwise. +func (f *FineGrainedPersonalAccessTokenRequest) GetTokenExpiresAt() Timestamp { + if f == nil || f.TokenExpiresAt == nil { + return Timestamp{} + } + return *f.TokenExpiresAt +} + +// GetTokenID returns the TokenID field. +func (f *FineGrainedPersonalAccessTokenRequest) GetTokenID() int64 { + if f == nil { + return 0 + } + return f.TokenID +} + +// GetTokenLastUsedAt returns the TokenLastUsedAt field if it's non-nil, zero value otherwise. +func (f *FineGrainedPersonalAccessTokenRequest) GetTokenLastUsedAt() Timestamp { + if f == nil || f.TokenLastUsedAt == nil { + return Timestamp{} + } + return *f.TokenLastUsedAt +} + +// GetTokenName returns the TokenName field. +func (f *FineGrainedPersonalAccessTokenRequest) GetTokenName() string { + if f == nil { + return "" + } + return f.TokenName +} + // GetIdentifier returns the Identifier field if it's non-nil, zero value otherwise. func (f *FirstPatchedVersion) GetIdentifier() string { if f == nil || f.Identifier == nil { @@ -9198,6 +15702,30 @@ func (f *ForkEvent) GetSender() *User { return f.Sender } +// GetLabels returns the Labels slice if it's non-nil, nil otherwise. +func (g *GenerateJITConfigRequest) GetLabels() []string { + if g == nil || g.Labels == nil { + return nil + } + return g.Labels +} + +// GetName returns the Name field. +func (g *GenerateJITConfigRequest) GetName() string { + if g == nil { + return "" + } + return g.Name +} + +// GetRunnerGroupID returns the RunnerGroupID field. +func (g *GenerateJITConfigRequest) GetRunnerGroupID() int64 { + if g == nil { + return 0 + } + return g.RunnerGroupID +} + // GetWorkFolder returns the WorkFolder field if it's non-nil, zero value otherwise. func (g *GenerateJITConfigRequest) GetWorkFolder() string { if g == nil || g.WorkFolder == nil { @@ -9206,6 +15734,14 @@ func (g *GenerateJITConfigRequest) GetWorkFolder() string { return *g.WorkFolder } +// GetConfigurationFilePath returns the ConfigurationFilePath field if it's non-nil, zero value otherwise. +func (g *GenerateNotesOptions) GetConfigurationFilePath() string { + if g == nil || g.ConfigurationFilePath == nil { + return "" + } + return *g.ConfigurationFilePath +} + // GetPreviousTagName returns the PreviousTagName field if it's non-nil, zero value otherwise. func (g *GenerateNotesOptions) GetPreviousTagName() string { if g == nil || g.PreviousTagName == nil { @@ -9214,6 +15750,14 @@ func (g *GenerateNotesOptions) GetPreviousTagName() string { return *g.PreviousTagName } +// GetTagName returns the TagName field. +func (g *GenerateNotesOptions) GetTagName() string { + if g == nil { + return "" + } + return g.TagName +} + // GetTargetCommitish returns the TargetCommitish field if it's non-nil, zero value otherwise. func (g *GenerateNotesOptions) GetTargetCommitish() string { if g == nil || g.TargetCommitish == nil { @@ -9246,6 +15790,30 @@ func (g *GetAuditLogOptions) GetPhrase() string { return *g.Phrase } +// GetRef returns the Ref field. +func (g *GetCodeownersErrorsOptions) GetRef() string { + if g == nil { + return "" + } + return g.Ref +} + +// GetFields returns the Fields slice if it's non-nil, nil otherwise. +func (g *GetProjectItemOptions) GetFields() []int64 { + if g == nil || g.Fields == nil { + return nil + } + return g.Fields +} + +// GetExcludedAttributes returns the ExcludedAttributes field if it's non-nil, zero value otherwise. +func (g *GetProvisionedSCIMGroupEnterpriseOptions) GetExcludedAttributes() string { + if g == nil || g.ExcludedAttributes == nil { + return "" + } + return *g.ExcludedAttributes +} + // GetComments returns the Comments field if it's non-nil, zero value otherwise. func (g *Gist) GetComments() int { if g == nil || g.Comments == nil { @@ -9526,6 +16094,14 @@ func (g *GistFork) GetUser() *User { return g.User } +// GetSince returns the Since field. +func (g *GistListOptions) GetSince() time.Time { + if g == nil { + return time.Time{} + } + return g.Since +} + // GetPrivateGists returns the PrivateGists field if it's non-nil, zero value otherwise. func (g *GistStats) GetPrivateGists() int { if g == nil || g.PrivateGists == nil { @@ -9614,6 +16190,14 @@ func (g *GitObject) GetURL() string { return *g.URL } +// GetCredits returns the Credits slice if it's non-nil, nil otherwise. +func (g *GlobalSecurityAdvisory) GetCredits() []*Credit { + if g == nil || g.Credits == nil { + return nil + } + return g.Credits +} + // GetGithubReviewedAt returns the GithubReviewedAt field if it's non-nil, zero value otherwise. func (g *GlobalSecurityAdvisory) GetGithubReviewedAt() Timestamp { if g == nil || g.GithubReviewedAt == nil { @@ -9638,6 +16222,14 @@ func (g *GlobalSecurityAdvisory) GetNVDPublishedAt() Timestamp { return *g.NVDPublishedAt } +// GetReferences returns the References slice if it's non-nil, nil otherwise. +func (g *GlobalSecurityAdvisory) GetReferences() []string { + if g == nil || g.References == nil { + return nil + } + return g.References +} + // GetRepositoryAdvisoryURL returns the RepositoryAdvisoryURL field if it's non-nil, zero value otherwise. func (g *GlobalSecurityAdvisory) GetRepositoryAdvisoryURL() string { if g == nil || g.RepositoryAdvisoryURL == nil { @@ -9662,6 +16254,14 @@ func (g *GlobalSecurityAdvisory) GetType() string { return *g.Type } +// GetVulnerabilities returns the Vulnerabilities slice if it's non-nil, nil otherwise. +func (g *GlobalSecurityAdvisory) GetVulnerabilities() []*GlobalSecurityVulnerability { + if g == nil || g.Vulnerabilities == nil { + return nil + } + return g.Vulnerabilities +} + // GetFirstPatchedVersion returns the FirstPatchedVersion field if it's non-nil, zero value otherwise. func (g *GlobalSecurityVulnerability) GetFirstPatchedVersion() string { if g == nil || g.FirstPatchedVersion == nil { @@ -9678,6 +16278,14 @@ func (g *GlobalSecurityVulnerability) GetPackage() *VulnerabilityPackage { return g.Package } +// GetVulnerableFunctions returns the VulnerableFunctions slice if it's non-nil, nil otherwise. +func (g *GlobalSecurityVulnerability) GetVulnerableFunctions() []string { + if g == nil || g.VulnerableFunctions == nil { + return nil + } + return g.VulnerableFunctions +} + // GetVulnerableVersionRange returns the VulnerableVersionRange field if it's non-nil, zero value otherwise. func (g *GlobalSecurityVulnerability) GetVulnerableVersionRange() string { if g == nil || g.VulnerableVersionRange == nil { @@ -9702,6 +16310,14 @@ func (g *GollumEvent) GetOrg() *Organization { return g.Org } +// GetPages returns the Pages slice if it's non-nil, nil otherwise. +func (g *GollumEvent) GetPages() []*Page { + if g == nil || g.Pages == nil { + return nil + } + return g.Pages +} + // GetRepo returns the Repo field. func (g *GollumEvent) GetRepo() *Repository { if g == nil { @@ -9718,6 +16334,30 @@ func (g *GollumEvent) GetSender() *User { return g.Sender } +// GetBucket returns the Bucket field. +func (g *GoogleCloudConfig) GetBucket() string { + if g == nil { + return "" + } + return g.Bucket +} + +// GetEncryptedJSONCredentials returns the EncryptedJSONCredentials field. +func (g *GoogleCloudConfig) GetEncryptedJSONCredentials() string { + if g == nil { + return "" + } + return g.EncryptedJSONCredentials +} + +// GetKeyID returns the KeyID field. +func (g *GoogleCloudConfig) GetKeyID() string { + if g == nil { + return "" + } + return g.KeyID +} + // GetEmail returns the Email field if it's non-nil, zero value otherwise. func (g *GPGEmail) GetEmail() string { if g == nil || g.Email == nil { @@ -9774,6 +16414,14 @@ func (g *GPGKey) GetCreatedAt() Timestamp { return *g.CreatedAt } +// GetEmails returns the Emails slice if it's non-nil, nil otherwise. +func (g *GPGKey) GetEmails() []*GPGEmail { + if g == nil || g.Emails == nil { + return nil + } + return g.Emails +} + // GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. func (g *GPGKey) GetExpiresAt() Timestamp { if g == nil || g.ExpiresAt == nil { @@ -9822,6 +16470,14 @@ func (g *GPGKey) GetRawKey() string { return *g.RawKey } +// GetSubkeys returns the Subkeys slice if it's non-nil, nil otherwise. +func (g *GPGKey) GetSubkeys() []*GPGKey { + if g == nil || g.Subkeys == nil { + return nil + } + return g.Subkeys +} + // GetApp returns the App field. func (g *Grant) GetApp() *AuthorizationApp { if g == nil { @@ -9846,6 +16502,14 @@ func (g *Grant) GetID() int64 { return *g.ID } +// GetScopes returns the Scopes slice if it's non-nil, nil otherwise. +func (g *Grant) GetScopes() []string { + if g == nil || g.Scopes == nil { + return nil + } + return g.Scopes +} + // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. func (g *Grant) GetUpdatedAt() Timestamp { if g == nil || g.UpdatedAt == nil { @@ -9862,6 +16526,14 @@ func (g *Grant) GetURL() string { return *g.URL } +// GetAdded returns the Added slice if it's non-nil, nil otherwise. +func (h *HeadCommit) GetAdded() []string { + if h == nil || h.Added == nil { + return nil + } + return h.Added +} + // GetAuthor returns the Author field. func (h *HeadCommit) GetAuthor() *CommitAuthor { if h == nil { @@ -9902,6 +16574,22 @@ func (h *HeadCommit) GetMessage() string { return *h.Message } +// GetModified returns the Modified slice if it's non-nil, nil otherwise. +func (h *HeadCommit) GetModified() []string { + if h == nil || h.Modified == nil { + return nil + } + return h.Modified +} + +// GetRemoved returns the Removed slice if it's non-nil, nil otherwise. +func (h *HeadCommit) GetRemoved() []string { + if h == nil || h.Removed == nil { + return nil + } + return h.Removed +} + // GetSHA returns the SHA field if it's non-nil, zero value otherwise. func (h *HeadCommit) GetSHA() string { if h == nil || h.SHA == nil { @@ -9934,6 +16622,54 @@ func (h *HeadCommit) GetURL() string { return *h.URL } +// GetDomain returns the Domain field. +func (h *HecConfig) GetDomain() string { + if h == nil { + return "" + } + return h.Domain +} + +// GetEncryptedToken returns the EncryptedToken field. +func (h *HecConfig) GetEncryptedToken() string { + if h == nil { + return "" + } + return h.EncryptedToken +} + +// GetKeyID returns the KeyID field. +func (h *HecConfig) GetKeyID() string { + if h == nil { + return "" + } + return h.KeyID +} + +// GetPath returns the Path field. +func (h *HecConfig) GetPath() string { + if h == nil { + return "" + } + return h.Path +} + +// GetPort returns the Port field. +func (h *HecConfig) GetPort() uint16 { + if h == nil { + return 0 + } + return h.Port +} + +// GetSSLVerify returns the SSLVerify field. +func (h *HecConfig) GetSSLVerify() bool { + if h == nil { + return false + } + return h.SSLVerify +} + // GetActive returns the Active field if it's non-nil, zero value otherwise. func (h *Hook) GetActive() bool { if h == nil || h.Active == nil { @@ -9958,6 +16694,14 @@ func (h *Hook) GetCreatedAt() Timestamp { return *h.CreatedAt } +// GetEvents returns the Events slice if it's non-nil, nil otherwise. +func (h *Hook) GetEvents() []string { + if h == nil || h.Events == nil { + return nil + } + return h.Events +} + // GetID returns the ID field if it's non-nil, zero value otherwise. func (h *Hook) GetID() int64 { if h == nil || h.ID == nil { @@ -10070,12 +16814,12 @@ func (h *HookDelivery) GetDeliveredAt() Timestamp { return *h.DeliveredAt } -// GetDuration returns the Duration field. -func (h *HookDelivery) GetDuration() *float64 { - if h == nil { - return nil +// GetDuration returns the Duration field if it's non-nil, zero value otherwise. +func (h *HookDelivery) GetDuration() float64 { + if h == nil || h.Duration == nil { + return 0 } - return h.Duration + return *h.Duration } // GetEvent returns the Event field if it's non-nil, zero value otherwise. @@ -10278,6 +17022,14 @@ func (h *HostedRunner) GetPublicIPEnabled() bool { return *h.PublicIPEnabled } +// GetPublicIPs returns the PublicIPs slice if it's non-nil, nil otherwise. +func (h *HostedRunner) GetPublicIPs() []*HostedRunnerPublicIP { + if h == nil || h.PublicIPs == nil { + return nil + } + return h.PublicIPs +} + // GetRunnerGroupID returns the RunnerGroupID field if it's non-nil, zero value otherwise. func (h *HostedRunner) GetRunnerGroupID() int64 { if h == nil || h.RunnerGroupID == nil { @@ -10294,6 +17046,166 @@ func (h *HostedRunner) GetStatus() string { return *h.Status } +// GetID returns the ID field. +func (h *HostedRunnerCustomImage) GetID() int64 { + if h == nil { + return 0 + } + return h.ID +} + +// GetLatestVersion returns the LatestVersion field. +func (h *HostedRunnerCustomImage) GetLatestVersion() string { + if h == nil { + return "" + } + return h.LatestVersion +} + +// GetName returns the Name field. +func (h *HostedRunnerCustomImage) GetName() string { + if h == nil { + return "" + } + return h.Name +} + +// GetPlatform returns the Platform field. +func (h *HostedRunnerCustomImage) GetPlatform() string { + if h == nil { + return "" + } + return h.Platform +} + +// GetSource returns the Source field. +func (h *HostedRunnerCustomImage) GetSource() string { + if h == nil { + return "" + } + return h.Source +} + +// GetState returns the State field. +func (h *HostedRunnerCustomImage) GetState() string { + if h == nil { + return "" + } + return h.State +} + +// GetTotalVersionsSize returns the TotalVersionsSize field. +func (h *HostedRunnerCustomImage) GetTotalVersionsSize() int { + if h == nil { + return 0 + } + return h.TotalVersionsSize +} + +// GetVersionsCount returns the VersionsCount field. +func (h *HostedRunnerCustomImage) GetVersionsCount() int { + if h == nil { + return 0 + } + return h.VersionsCount +} + +// GetImages returns the Images slice if it's non-nil, nil otherwise. +func (h *HostedRunnerCustomImages) GetImages() []*HostedRunnerCustomImage { + if h == nil || h.Images == nil { + return nil + } + return h.Images +} + +// GetTotalCount returns the TotalCount field. +func (h *HostedRunnerCustomImages) GetTotalCount() int { + if h == nil { + return 0 + } + return h.TotalCount +} + +// GetCreatedOn returns the CreatedOn field. +func (h *HostedRunnerCustomImageVersion) GetCreatedOn() Timestamp { + if h == nil { + return Timestamp{} + } + return h.CreatedOn +} + +// GetSizeGB returns the SizeGB field. +func (h *HostedRunnerCustomImageVersion) GetSizeGB() int { + if h == nil { + return 0 + } + return h.SizeGB +} + +// GetState returns the State field. +func (h *HostedRunnerCustomImageVersion) GetState() string { + if h == nil { + return "" + } + return h.State +} + +// GetStateDetails returns the StateDetails field. +func (h *HostedRunnerCustomImageVersion) GetStateDetails() string { + if h == nil { + return "" + } + return h.StateDetails +} + +// GetVersion returns the Version field. +func (h *HostedRunnerCustomImageVersion) GetVersion() string { + if h == nil { + return "" + } + return h.Version +} + +// GetImageVersions returns the ImageVersions slice if it's non-nil, nil otherwise. +func (h *HostedRunnerCustomImageVersions) GetImageVersions() []*HostedRunnerCustomImageVersion { + if h == nil || h.ImageVersions == nil { + return nil + } + return h.ImageVersions +} + +// GetTotalCount returns the TotalCount field. +func (h *HostedRunnerCustomImageVersions) GetTotalCount() int { + if h == nil { + return 0 + } + return h.TotalCount +} + +// GetID returns the ID field. +func (h *HostedRunnerImage) GetID() string { + if h == nil { + return "" + } + return h.ID +} + +// GetSource returns the Source field. +func (h *HostedRunnerImage) GetSource() string { + if h == nil { + return "" + } + return h.Source +} + +// GetVersion returns the Version field if it's non-nil, zero value otherwise. +func (h *HostedRunnerImage) GetVersion() string { + if h == nil || h.Version == nil { + return "" + } + return *h.Version +} + // GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. func (h *HostedRunnerImageDetail) GetDisplayName() string { if h == nil || h.DisplayName == nil { @@ -10334,6 +17246,150 @@ func (h *HostedRunnerImageDetail) GetVersion() string { return *h.Version } +// GetImages returns the Images slice if it's non-nil, nil otherwise. +func (h *HostedRunnerImages) GetImages() []*HostedRunnerImageSpecs { + if h == nil || h.Images == nil { + return nil + } + return h.Images +} + +// GetTotalCount returns the TotalCount field. +func (h *HostedRunnerImages) GetTotalCount() int { + if h == nil { + return 0 + } + return h.TotalCount +} + +// GetDisplayName returns the DisplayName field. +func (h *HostedRunnerImageSpecs) GetDisplayName() string { + if h == nil { + return "" + } + return h.DisplayName +} + +// GetID returns the ID field. +func (h *HostedRunnerImageSpecs) GetID() string { + if h == nil { + return "" + } + return h.ID +} + +// GetPlatform returns the Platform field. +func (h *HostedRunnerImageSpecs) GetPlatform() string { + if h == nil { + return "" + } + return h.Platform +} + +// GetSizeGB returns the SizeGB field. +func (h *HostedRunnerImageSpecs) GetSizeGB() int { + if h == nil { + return 0 + } + return h.SizeGB +} + +// GetSource returns the Source field. +func (h *HostedRunnerImageSpecs) GetSource() string { + if h == nil { + return "" + } + return h.Source +} + +// GetCPUCores returns the CPUCores field. +func (h *HostedRunnerMachineSpec) GetCPUCores() int { + if h == nil { + return 0 + } + return h.CPUCores +} + +// GetID returns the ID field. +func (h *HostedRunnerMachineSpec) GetID() string { + if h == nil { + return "" + } + return h.ID +} + +// GetMemoryGB returns the MemoryGB field. +func (h *HostedRunnerMachineSpec) GetMemoryGB() int { + if h == nil { + return 0 + } + return h.MemoryGB +} + +// GetStorageGB returns the StorageGB field. +func (h *HostedRunnerMachineSpec) GetStorageGB() int { + if h == nil { + return 0 + } + return h.StorageGB +} + +// GetMachineSpecs returns the MachineSpecs slice if it's non-nil, nil otherwise. +func (h *HostedRunnerMachineSpecs) GetMachineSpecs() []*HostedRunnerMachineSpec { + if h == nil || h.MachineSpecs == nil { + return nil + } + return h.MachineSpecs +} + +// GetTotalCount returns the TotalCount field. +func (h *HostedRunnerMachineSpecs) GetTotalCount() int { + if h == nil { + return 0 + } + return h.TotalCount +} + +// GetPlatforms returns the Platforms slice if it's non-nil, nil otherwise. +func (h *HostedRunnerPlatforms) GetPlatforms() []string { + if h == nil || h.Platforms == nil { + return nil + } + return h.Platforms +} + +// GetTotalCount returns the TotalCount field. +func (h *HostedRunnerPlatforms) GetTotalCount() int { + if h == nil { + return 0 + } + return h.TotalCount +} + +// GetEnabled returns the Enabled field. +func (h *HostedRunnerPublicIP) GetEnabled() bool { + if h == nil { + return false + } + return h.Enabled +} + +// GetLength returns the Length field. +func (h *HostedRunnerPublicIP) GetLength() int { + if h == nil { + return 0 + } + return h.Length +} + +// GetPrefix returns the Prefix field. +func (h *HostedRunnerPublicIP) GetPrefix() string { + if h == nil { + return "" + } + return h.Prefix +} + // GetPublicIPs returns the PublicIPs field. func (h *HostedRunnerPublicIPLimits) GetPublicIPs() *PublicIPUsage { if h == nil { @@ -10342,6 +17398,46 @@ func (h *HostedRunnerPublicIPLimits) GetPublicIPs() *PublicIPUsage { return h.PublicIPs } +// GetRunners returns the Runners slice if it's non-nil, nil otherwise. +func (h *HostedRunners) GetRunners() []*HostedRunner { + if h == nil || h.Runners == nil { + return nil + } + return h.Runners +} + +// GetTotalCount returns the TotalCount field. +func (h *HostedRunners) GetTotalCount() int { + if h == nil { + return 0 + } + return h.TotalCount +} + +// GetContexts returns the Contexts slice if it's non-nil, nil otherwise. +func (h *Hovercard) GetContexts() []*UserContext { + if h == nil || h.Contexts == nil { + return nil + } + return h.Contexts +} + +// GetSubjectID returns the SubjectID field. +func (h *HovercardOptions) GetSubjectID() string { + if h == nil { + return "" + } + return h.SubjectID +} + +// GetSubjectType returns the SubjectType field. +func (h *HovercardOptions) GetSubjectType() string { + if h == nil { + return "" + } + return h.SubjectType +} + // GetGroupDescription returns the GroupDescription field if it's non-nil, zero value otherwise. func (i *IDPGroup) GetGroupDescription() string { if i == nil || i.GroupDescription == nil { @@ -10366,6 +17462,54 @@ func (i *IDPGroup) GetGroupName() string { return *i.GroupName } +// GetGroups returns the Groups slice if it's non-nil, nil otherwise. +func (i *IDPGroupList) GetGroups() []*IDPGroup { + if i == nil || i.Groups == nil { + return nil + } + return i.Groups +} + +// GetEnforcedRepositories returns the EnforcedRepositories field if it's non-nil, zero value otherwise. +func (i *ImmutableReleasePolicy) GetEnforcedRepositories() string { + if i == nil || i.EnforcedRepositories == nil { + return "" + } + return *i.EnforcedRepositories +} + +// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs slice if it's non-nil, nil otherwise. +func (i *ImmutableReleasePolicy) GetSelectedRepositoryIDs() []int64 { + if i == nil || i.SelectedRepositoryIDs == nil { + return nil + } + return i.SelectedRepositoryIDs +} + +// GetEnforcedRepositories returns the EnforcedRepositories field if it's non-nil, zero value otherwise. +func (i *ImmutableReleaseSettings) GetEnforcedRepositories() string { + if i == nil || i.EnforcedRepositories == nil { + return "" + } + return *i.EnforcedRepositories +} + +// GetSelectedRepositoriesURL returns the SelectedRepositoriesURL field if it's non-nil, zero value otherwise. +func (i *ImmutableReleaseSettings) GetSelectedRepositoriesURL() string { + if i == nil || i.SelectedRepositoriesURL == nil { + return "" + } + return *i.SelectedRepositoriesURL +} + +// GetScopes returns the Scopes slice if it's non-nil, nil otherwise. +func (i *ImpersonateUserOptions) GetScopes() []string { + if i == nil || i.Scopes == nil { + return nil + } + return i.Scopes +} + // GetAuthorsCount returns the AuthorsCount field if it's non-nil, zero value otherwise. func (i *Import) GetAuthorsCount() int { if i == nil || i.AuthorsCount == nil { @@ -10454,6 +17598,14 @@ func (i *Import) GetPercent() int { return *i.Percent } +// GetProjectChoices returns the ProjectChoices slice if it's non-nil, nil otherwise. +func (i *Import) GetProjectChoices() []*Import { + if i == nil || i.ProjectChoices == nil { + return nil + } + return i.ProjectChoices +} + // GetPushPercent returns the PushPercent field if it's non-nil, zero value otherwise. func (i *Import) GetPushPercent() int { if i == nil || i.PushPercent == nil { @@ -10542,6 +17694,70 @@ func (i *Import) GetVCSUsername() string { return *i.VCSUsername } +// GetLicense returns the License field. +func (i *InitialConfigOptions) GetLicense() string { + if i == nil { + return "" + } + return i.License +} + +// GetPassword returns the Password field. +func (i *InitialConfigOptions) GetPassword() string { + if i == nil { + return "" + } + return i.Password +} + +// GetAccessibleRepositoriesURL returns the AccessibleRepositoriesURL field if it's non-nil, zero value otherwise. +func (i *InstallableOrganization) GetAccessibleRepositoriesURL() string { + if i == nil || i.AccessibleRepositoriesURL == nil { + return "" + } + return *i.AccessibleRepositoriesURL +} + +// GetID returns the ID field. +func (i *InstallableOrganization) GetID() int64 { + if i == nil { + return 0 + } + return i.ID +} + +// GetLogin returns the Login field. +func (i *InstallableOrganization) GetLogin() string { + if i == nil { + return "" + } + return i.Login +} + +// GetClientID returns the ClientID field. +func (i *InstallAppRequest) GetClientID() string { + if i == nil { + return "" + } + return i.ClientID +} + +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (i *InstallAppRequest) GetRepositories() []string { + if i == nil || i.Repositories == nil { + return nil + } + return i.Repositories +} + +// GetRepositorySelection returns the RepositorySelection field. +func (i *InstallAppRequest) GetRepositorySelection() string { + if i == nil { + return "" + } + return i.RepositorySelection +} + // GetAccessTokensURL returns the AccessTokensURL field if it's non-nil, zero value otherwise. func (i *Installation) GetAccessTokensURL() string { if i == nil || i.AccessTokensURL == nil { @@ -10574,6 +17790,14 @@ func (i *Installation) GetAppSlug() string { return *i.AppSlug } +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (i *Installation) GetClientID() string { + if i == nil || i.ClientID == nil { + return "" + } + return *i.ClientID +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (i *Installation) GetCreatedAt() Timestamp { if i == nil || i.CreatedAt == nil { @@ -10582,6 +17806,14 @@ func (i *Installation) GetCreatedAt() Timestamp { return *i.CreatedAt } +// GetEvents returns the Events slice if it's non-nil, nil otherwise. +func (i *Installation) GetEvents() []string { + if i == nil || i.Events == nil { + return nil + } + return i.Events +} + // GetHasMultipleSingleFiles returns the HasMultipleSingleFiles field if it's non-nil, zero value otherwise. func (i *Installation) GetHasMultipleSingleFiles() bool { if i == nil || i.HasMultipleSingleFiles == nil { @@ -10646,6 +17878,14 @@ func (i *Installation) GetSingleFileName() string { return *i.SingleFileName } +// GetSingleFilePaths returns the SingleFilePaths slice if it's non-nil, nil otherwise. +func (i *Installation) GetSingleFilePaths() []string { + if i == nil || i.SingleFilePaths == nil { + return nil + } + return i.SingleFilePaths +} + // GetSuspendedAt returns the SuspendedAt field if it's non-nil, zero value otherwise. func (i *Installation) GetSuspendedAt() Timestamp { if i == nil || i.SuspendedAt == nil { @@ -10726,6 +17966,14 @@ func (i *InstallationEvent) GetOrg() *Organization { return i.Org } +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (i *InstallationEvent) GetRepositories() []*Repository { + if i == nil || i.Repositories == nil { + return nil + } + return i.Repositories +} + // GetRequester returns the Requester field. func (i *InstallationEvent) GetRequester() *User { if i == nil { @@ -11038,6 +18286,14 @@ func (i *InstallationPermissions) GetOrganizationCodespacesSettings() string { return *i.OrganizationCodespacesSettings } +// GetOrganizationCopilotMetrics returns the OrganizationCopilotMetrics field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationCopilotMetrics() string { + if i == nil || i.OrganizationCopilotMetrics == nil { + return "" + } + return *i.OrganizationCopilotMetrics +} + // GetOrganizationCopilotSeatManagement returns the OrganizationCopilotSeatManagement field if it's non-nil, zero value otherwise. func (i *InstallationPermissions) GetOrganizationCopilotSeatManagement() string { if i == nil || i.OrganizationCopilotSeatManagement == nil { @@ -11366,6 +18622,22 @@ func (i *InstallationRepositoriesEvent) GetOrg() *Organization { return i.Org } +// GetRepositoriesAdded returns the RepositoriesAdded slice if it's non-nil, nil otherwise. +func (i *InstallationRepositoriesEvent) GetRepositoriesAdded() []*Repository { + if i == nil || i.RepositoriesAdded == nil { + return nil + } + return i.RepositoriesAdded +} + +// GetRepositoriesRemoved returns the RepositoriesRemoved slice if it's non-nil, nil otherwise. +func (i *InstallationRepositoriesEvent) GetRepositoriesRemoved() []*Repository { + if i == nil || i.RepositoriesRemoved == nil { + return nil + } + return i.RepositoriesRemoved +} + // GetRepositorySelection returns the RepositorySelection field if it's non-nil, zero value otherwise. func (i *InstallationRepositoriesEvent) GetRepositorySelection() string { if i == nil || i.RepositorySelection == nil { @@ -11518,6 +18790,14 @@ func (i *InstallationToken) GetPermissions() *InstallationPermissions { return i.Permissions } +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (i *InstallationToken) GetRepositories() []*Repository { + if i == nil || i.Repositories == nil { + return nil + } + return i.Repositories +} + // GetToken returns the Token field if it's non-nil, zero value otherwise. func (i *InstallationToken) GetToken() string { if i == nil || i.Token == nil { @@ -11534,6 +18814,22 @@ func (i *InstallationTokenListRepoOptions) GetPermissions() *InstallationPermiss return i.Permissions } +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (i *InstallationTokenListRepoOptions) GetRepositories() []string { + if i == nil || i.Repositories == nil { + return nil + } + return i.Repositories +} + +// GetRepositoryIDs returns the RepositoryIDs slice if it's non-nil, nil otherwise. +func (i *InstallationTokenListRepoOptions) GetRepositoryIDs() []int64 { + if i == nil || i.RepositoryIDs == nil { + return nil + } + return i.RepositoryIDs +} + // GetPermissions returns the Permissions field. func (i *InstallationTokenOptions) GetPermissions() *InstallationPermissions { if i == nil { @@ -11542,6 +18838,22 @@ func (i *InstallationTokenOptions) GetPermissions() *InstallationPermissions { return i.Permissions } +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (i *InstallationTokenOptions) GetRepositories() []string { + if i == nil || i.Repositories == nil { + return nil + } + return i.Repositories +} + +// GetRepositoryIDs returns the RepositoryIDs slice if it's non-nil, nil otherwise. +func (i *InstallationTokenOptions) GetRepositoryIDs() []int64 { + if i == nil || i.RepositoryIDs == nil { + return nil + } + return i.RepositoryIDs +} + // GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. func (i *InteractionRestriction) GetExpiresAt() Timestamp { if i == nil || i.ExpiresAt == nil { @@ -11670,6 +18982,14 @@ func (i *Issue) GetAssignee() *User { return i.Assignee } +// GetAssignees returns the Assignees slice if it's non-nil, nil otherwise. +func (i *Issue) GetAssignees() []*User { + if i == nil || i.Assignees == nil { + return nil + } + return i.Assignees +} + // GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise. func (i *Issue) GetAuthorAssociation() string { if i == nil || i.AuthorAssociation == nil { @@ -11758,6 +19078,22 @@ func (i *Issue) GetID() int64 { return *i.ID } +// GetIssueFieldValues returns the IssueFieldValues slice if it's non-nil, nil otherwise. +func (i *Issue) GetIssueFieldValues() []*IssueFieldValue { + if i == nil || i.IssueFieldValues == nil { + return nil + } + return i.IssueFieldValues +} + +// GetLabels returns the Labels slice if it's non-nil, nil otherwise. +func (i *Issue) GetLabels() []*Label { + if i == nil || i.Labels == nil { + return nil + } + return i.Labels +} + // GetLabelsURL returns the LabelsURL field if it's non-nil, zero value otherwise. func (i *Issue) GetLabelsURL() string { if i == nil || i.LabelsURL == nil { @@ -11798,6 +19134,14 @@ func (i *Issue) GetNumber() int { return *i.Number } +// GetParentIssueURL returns the ParentIssueURL field if it's non-nil, zero value otherwise. +func (i *Issue) GetParentIssueURL() string { + if i == nil || i.ParentIssueURL == nil { + return "" + } + return *i.ParentIssueURL +} + // GetPullRequestLinks returns the PullRequestLinks field. func (i *Issue) GetPullRequestLinks() *PullRequestLinks { if i == nil { @@ -11846,6 +19190,14 @@ func (i *Issue) GetStateReason() string { return *i.StateReason } +// GetTextMatches returns the TextMatches slice if it's non-nil, nil otherwise. +func (i *Issue) GetTextMatches() []*TextMatch { + if i == nil || i.TextMatches == nil { + return nil + } + return i.TextMatches +} + // GetTitle returns the Title field if it's non-nil, zero value otherwise. func (i *Issue) GetTitle() string { if i == nil || i.Title == nil { @@ -12038,6 +19390,14 @@ func (i *IssueCommentEvent) GetSender() *User { return i.Sender } +// GetAction returns the Action field. +func (i *IssueEvent) GetAction() string { + if i == nil { + return "" + } + return i.Action +} + // GetActor returns the Actor field. func (i *IssueEvent) GetActor() *User { if i == nil { @@ -12190,6 +19550,70 @@ func (i *IssueEvent) GetURL() string { return *i.URL } +// GetDataType returns the DataType field. +func (i *IssueFieldValue) GetDataType() string { + if i == nil { + return "" + } + return i.DataType +} + +// GetIssueFieldID returns the IssueFieldID field. +func (i *IssueFieldValue) GetIssueFieldID() int64 { + if i == nil { + return 0 + } + return i.IssueFieldID +} + +// GetNodeID returns the NodeID field. +func (i *IssueFieldValue) GetNodeID() string { + if i == nil { + return "" + } + return i.NodeID +} + +// GetSingleSelectOption returns the SingleSelectOption field. +func (i *IssueFieldValue) GetSingleSelectOption() *IssueFieldValueSingleSelectOption { + if i == nil { + return nil + } + return i.SingleSelectOption +} + +// GetValue returns the Value field. +func (i *IssueFieldValue) GetValue() any { + if i == nil { + return nil + } + return i.Value +} + +// GetColor returns the Color field. +func (i *IssueFieldValueSingleSelectOption) GetColor() string { + if i == nil { + return "" + } + return i.Color +} + +// GetID returns the ID field. +func (i *IssueFieldValueSingleSelectOption) GetID() int64 { + if i == nil { + return 0 + } + return i.ID +} + +// GetName returns the Name field. +func (i *IssueFieldValueSingleSelectOption) GetName() string { + if i == nil { + return "" + } + return i.Name +} + // GetAssignee returns the Assignee field if it's non-nil, zero value otherwise. func (i *IssueImport) GetAssignee() string { if i == nil || i.Assignee == nil { @@ -12198,6 +19622,14 @@ func (i *IssueImport) GetAssignee() string { return *i.Assignee } +// GetBody returns the Body field. +func (i *IssueImport) GetBody() string { + if i == nil { + return "" + } + return i.Body +} + // GetClosed returns the Closed field if it's non-nil, zero value otherwise. func (i *IssueImport) GetClosed() bool { if i == nil || i.Closed == nil { @@ -12222,6 +19654,14 @@ func (i *IssueImport) GetCreatedAt() Timestamp { return *i.CreatedAt } +// GetLabels returns the Labels slice if it's non-nil, nil otherwise. +func (i *IssueImport) GetLabels() []string { + if i == nil || i.Labels == nil { + return nil + } + return i.Labels +} + // GetMilestone returns the Milestone field if it's non-nil, zero value otherwise. func (i *IssueImport) GetMilestone() int { if i == nil || i.Milestone == nil { @@ -12230,6 +19670,14 @@ func (i *IssueImport) GetMilestone() int { return *i.Milestone } +// GetTitle returns the Title field. +func (i *IssueImport) GetTitle() string { + if i == nil { + return "" + } + return i.Title +} + // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. func (i *IssueImport) GetUpdatedAt() Timestamp { if i == nil || i.UpdatedAt == nil { @@ -12278,6 +19726,22 @@ func (i *IssueImportError) GetValue() string { return *i.Value } +// GetComments returns the Comments slice if it's non-nil, nil otherwise. +func (i *IssueImportRequest) GetComments() []*Comment { + if i == nil || i.Comments == nil { + return nil + } + return i.Comments +} + +// GetIssueImport returns the IssueImport field. +func (i *IssueImportRequest) GetIssueImport() IssueImport { + if i == nil { + return IssueImport{} + } + return i.IssueImport +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (i *IssueImportResponse) GetCreatedAt() Timestamp { if i == nil || i.CreatedAt == nil { @@ -12294,6 +19758,14 @@ func (i *IssueImportResponse) GetDocumentationURL() string { return *i.DocumentationURL } +// GetErrors returns the Errors slice if it's non-nil, nil otherwise. +func (i *IssueImportResponse) GetErrors() []*IssueImportError { + if i == nil || i.Errors == nil { + return nil + } + return i.Errors +} + // GetID returns the ID field if it's non-nil, zero value otherwise. func (i *IssueImportResponse) GetID() int { if i == nil || i.ID == nil { @@ -12350,6 +19822,142 @@ func (i *IssueImportResponse) GetURL() string { return *i.URL } +// GetDirection returns the Direction field. +func (i *IssueListByOrgOptions) GetDirection() string { + if i == nil { + return "" + } + return i.Direction +} + +// GetFilter returns the Filter field. +func (i *IssueListByOrgOptions) GetFilter() string { + if i == nil { + return "" + } + return i.Filter +} + +// GetLabels returns the Labels slice if it's non-nil, nil otherwise. +func (i *IssueListByOrgOptions) GetLabels() []string { + if i == nil || i.Labels == nil { + return nil + } + return i.Labels +} + +// GetSince returns the Since field. +func (i *IssueListByOrgOptions) GetSince() time.Time { + if i == nil { + return time.Time{} + } + return i.Since +} + +// GetSort returns the Sort field. +func (i *IssueListByOrgOptions) GetSort() string { + if i == nil { + return "" + } + return i.Sort +} + +// GetState returns the State field. +func (i *IssueListByOrgOptions) GetState() string { + if i == nil { + return "" + } + return i.State +} + +// GetType returns the Type field. +func (i *IssueListByOrgOptions) GetType() string { + if i == nil { + return "" + } + return i.Type +} + +// GetAssignee returns the Assignee field. +func (i *IssueListByRepoOptions) GetAssignee() string { + if i == nil { + return "" + } + return i.Assignee +} + +// GetCreator returns the Creator field. +func (i *IssueListByRepoOptions) GetCreator() string { + if i == nil { + return "" + } + return i.Creator +} + +// GetDirection returns the Direction field. +func (i *IssueListByRepoOptions) GetDirection() string { + if i == nil { + return "" + } + return i.Direction +} + +// GetLabels returns the Labels slice if it's non-nil, nil otherwise. +func (i *IssueListByRepoOptions) GetLabels() []string { + if i == nil || i.Labels == nil { + return nil + } + return i.Labels +} + +// GetMentioned returns the Mentioned field. +func (i *IssueListByRepoOptions) GetMentioned() string { + if i == nil { + return "" + } + return i.Mentioned +} + +// GetMilestone returns the Milestone field. +func (i *IssueListByRepoOptions) GetMilestone() string { + if i == nil { + return "" + } + return i.Milestone +} + +// GetSince returns the Since field. +func (i *IssueListByRepoOptions) GetSince() time.Time { + if i == nil { + return time.Time{} + } + return i.Since +} + +// GetSort returns the Sort field. +func (i *IssueListByRepoOptions) GetSort() string { + if i == nil { + return "" + } + return i.Sort +} + +// GetState returns the State field. +func (i *IssueListByRepoOptions) GetState() string { + if i == nil { + return "" + } + return i.State +} + +// GetType returns the Type field. +func (i *IssueListByRepoOptions) GetType() string { + if i == nil { + return "" + } + return i.Type +} + // GetDirection returns the Direction field if it's non-nil, zero value otherwise. func (i *IssueListCommentsOptions) GetDirection() string { if i == nil || i.Direction == nil { @@ -12398,6 +20006,14 @@ func (i *IssueRequest) GetBody() string { return *i.Body } +// GetIssueFieldValues returns the IssueFieldValues slice if it's non-nil, nil otherwise. +func (i *IssueRequest) GetIssueFieldValues() []*IssueRequestFieldValue { + if i == nil || i.IssueFieldValues == nil { + return nil + } + return i.IssueFieldValues +} + // GetLabels returns the Labels field if it's non-nil, zero value otherwise. func (i *IssueRequest) GetLabels() []string { if i == nil || i.Labels == nil { @@ -12446,6 +20062,22 @@ func (i *IssueRequest) GetType() string { return *i.Type } +// GetFieldID returns the FieldID field. +func (i *IssueRequestFieldValue) GetFieldID() int64 { + if i == nil { + return 0 + } + return i.FieldID +} + +// GetValue returns the Value field. +func (i *IssueRequestFieldValue) GetValue() any { + if i == nil { + return nil + } + return i.Value +} + // GetAction returns the Action field if it's non-nil, zero value otherwise. func (i *IssuesEvent) GetAction() string { if i == nil || i.Action == nil { @@ -12534,6 +20166,14 @@ func (i *IssuesSearchResult) GetIncompleteResults() bool { return *i.IncompleteResults } +// GetIssues returns the Issues slice if it's non-nil, nil otherwise. +func (i *IssuesSearchResult) GetIssues() []*Issue { + if i == nil || i.Issues == nil { + return nil + } + return i.Issues +} + // GetTotal returns the Total field if it's non-nil, zero value otherwise. func (i *IssuesSearchResult) GetTotal() int { if i == nil || i.Total == nil { @@ -12638,6 +20278,14 @@ func (j *JITRunnerConfig) GetRunner() *Runner { return j.Runner } +// GetJobs returns the Jobs slice if it's non-nil, nil otherwise. +func (j *Jobs) GetJobs() []*WorkflowJob { + if j == nil || j.Jobs == nil { + return nil + } + return j.Jobs +} + // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. func (j *Jobs) GetTotalCount() int { if j == nil || j.TotalCount == nil { @@ -12870,12 +20518,12 @@ func (l *LabelResult) GetName() string { return *l.Name } -// GetScore returns the Score field. -func (l *LabelResult) GetScore() *float64 { - if l == nil { - return nil +// GetScore returns the Score field if it's non-nil, zero value otherwise. +func (l *LabelResult) GetScore() float64 { + if l == nil || l.Score == nil { + return 0 } - return l.Score + return *l.Score } // GetURL returns the URL field if it's non-nil, zero value otherwise. @@ -12894,6 +20542,14 @@ func (l *LabelsSearchResult) GetIncompleteResults() bool { return *l.IncompleteResults } +// GetLabels returns the Labels slice if it's non-nil, nil otherwise. +func (l *LabelsSearchResult) GetLabels() []*LabelResult { + if l == nil || l.Labels == nil { + return nil + } + return l.Labels +} + // GetTotal returns the Total field if it's non-nil, zero value otherwise. func (l *LabelsSearchResult) GetTotal() int { if l == nil || l.Total == nil { @@ -12934,6 +20590,46 @@ func (l *LargeFile) GetSize() int { return *l.Size } +// GetProperties returns the Properties field. +func (l *LastLicenseSync) GetProperties() *LastLicenseSyncProperties { + if l == nil { + return nil + } + return l.Properties +} + +// GetType returns the Type field. +func (l *LastLicenseSync) GetType() string { + if l == nil { + return "" + } + return l.Type +} + +// GetDate returns the Date field if it's non-nil, zero value otherwise. +func (l *LastLicenseSyncProperties) GetDate() Timestamp { + if l == nil || l.Date == nil { + return Timestamp{} + } + return *l.Date +} + +// GetError returns the Error field. +func (l *LastLicenseSyncProperties) GetError() string { + if l == nil { + return "" + } + return l.Error +} + +// GetStatus returns the Status field. +func (l *LastLicenseSyncProperties) GetStatus() string { + if l == nil { + return "" + } + return l.Status +} + // GetBody returns the Body field if it's non-nil, zero value otherwise. func (l *License) GetBody() string { if l == nil || l.Body == nil { @@ -13246,6 +20942,86 @@ func (l *ListAlertsOptions) GetState() string { return *l.State } +// GetCollab returns the Collab field. +func (l *ListAllIssuesOptions) GetCollab() bool { + if l == nil { + return false + } + return l.Collab +} + +// GetDirection returns the Direction field. +func (l *ListAllIssuesOptions) GetDirection() string { + if l == nil { + return "" + } + return l.Direction +} + +// GetFilter returns the Filter field. +func (l *ListAllIssuesOptions) GetFilter() string { + if l == nil { + return "" + } + return l.Filter +} + +// GetLabels returns the Labels slice if it's non-nil, nil otherwise. +func (l *ListAllIssuesOptions) GetLabels() []string { + if l == nil || l.Labels == nil { + return nil + } + return l.Labels +} + +// GetOrgs returns the Orgs field. +func (l *ListAllIssuesOptions) GetOrgs() bool { + if l == nil { + return false + } + return l.Orgs +} + +// GetOwned returns the Owned field. +func (l *ListAllIssuesOptions) GetOwned() bool { + if l == nil { + return false + } + return l.Owned +} + +// GetPulls returns the Pulls field. +func (l *ListAllIssuesOptions) GetPulls() bool { + if l == nil { + return false + } + return l.Pulls +} + +// GetSince returns the Since field. +func (l *ListAllIssuesOptions) GetSince() time.Time { + if l == nil { + return time.Time{} + } + return l.Since +} + +// GetSort returns the Sort field. +func (l *ListAllIssuesOptions) GetSort() string { + if l == nil { + return "" + } + return l.Sort +} + +// GetState returns the State field. +func (l *ListAllIssuesOptions) GetState() string { + if l == nil { + return "" + } + return l.State +} + // GetName returns the Name field if it's non-nil, zero value otherwise. func (l *ListArtifactsOptions) GetName() string { if l == nil || l.Name == nil { @@ -13286,6 +21062,14 @@ func (l *ListCheckRunsOptions) GetStatus() string { return *l.Status } +// GetCheckRuns returns the CheckRuns slice if it's non-nil, nil otherwise. +func (l *ListCheckRunsResults) GetCheckRuns() []*CheckRun { + if l == nil || l.CheckRuns == nil { + return nil + } + return l.CheckRuns +} + // GetTotal returns the Total field if it's non-nil, zero value otherwise. func (l *ListCheckRunsResults) GetTotal() int { if l == nil || l.Total == nil { @@ -13295,7 +21079,7 @@ func (l *ListCheckRunsResults) GetTotal() int { } // GetAppID returns the AppID field if it's non-nil, zero value otherwise. -func (l *ListCheckSuiteOptions) GetAppID() int { +func (l *ListCheckSuiteOptions) GetAppID() int64 { if l == nil || l.AppID == nil { return 0 } @@ -13310,6 +21094,14 @@ func (l *ListCheckSuiteOptions) GetCheckName() string { return *l.CheckName } +// GetCheckSuites returns the CheckSuites slice if it's non-nil, nil otherwise. +func (l *ListCheckSuiteResults) GetCheckSuites() []*CheckSuite { + if l == nil || l.CheckSuites == nil { + return nil + } + return l.CheckSuites +} + // GetTotal returns the Total field if it's non-nil, zero value otherwise. func (l *ListCheckSuiteResults) GetTotal() int { if l == nil || l.Total == nil { @@ -13318,6 +21110,46 @@ func (l *ListCheckSuiteResults) GetTotal() int { return *l.Total } +// GetAfter returns the After field. +func (l *ListCodeSecurityConfigurationRepositoriesOptions) GetAfter() string { + if l == nil { + return "" + } + return l.After +} + +// GetBefore returns the Before field. +func (l *ListCodeSecurityConfigurationRepositoriesOptions) GetBefore() string { + if l == nil { + return "" + } + return l.Before +} + +// GetPerPage returns the PerPage field. +func (l *ListCodeSecurityConfigurationRepositoriesOptions) GetPerPage() int { + if l == nil { + return 0 + } + return l.PerPage +} + +// GetStatus returns the Status field. +func (l *ListCodeSecurityConfigurationRepositoriesOptions) GetStatus() string { + if l == nil { + return "" + } + return l.Status +} + +// GetCodespaces returns the Codespaces slice if it's non-nil, nil otherwise. +func (l *ListCodespaces) GetCodespaces() []*Codespace { + if l == nil || l.Codespaces == nil { + return nil + } + return l.Codespaces +} + // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. func (l *ListCodespaces) GetTotalCount() int { if l == nil || l.TotalCount == nil { @@ -13326,6 +21158,126 @@ func (l *ListCodespaces) GetTotalCount() int { return *l.TotalCount } +// GetRepositoryID returns the RepositoryID field. +func (l *ListCodespacesOptions) GetRepositoryID() int64 { + if l == nil { + return 0 + } + return l.RepositoryID +} + +// GetAffiliation returns the Affiliation field. +func (l *ListCollaboratorsOptions) GetAffiliation() string { + if l == nil { + return "" + } + return l.Affiliation +} + +// GetPermission returns the Permission field. +func (l *ListCollaboratorsOptions) GetPermission() string { + if l == nil { + return "" + } + return l.Permission +} + +// GetAnon returns the Anon field. +func (l *ListContributorsOptions) GetAnon() string { + if l == nil { + return "" + } + return l.Anon +} + +// GetSeats returns the Seats slice if it's non-nil, nil otherwise. +func (l *ListCopilotSeatsResponse) GetSeats() []*CopilotSeatDetails { + if l == nil || l.Seats == nil { + return nil + } + return l.Seats +} + +// GetTotalSeats returns the TotalSeats field. +func (l *ListCopilotSeatsResponse) GetTotalSeats() int64 { + if l == nil { + return 0 + } + return l.TotalSeats +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (l *ListCostCenterOptions) GetState() string { + if l == nil || l.State == nil { + return "" + } + return *l.State +} + +// GetAfter returns the After field. +func (l *ListCursorOptions) GetAfter() string { + if l == nil { + return "" + } + return l.After +} + +// GetBefore returns the Before field. +func (l *ListCursorOptions) GetBefore() string { + if l == nil { + return "" + } + return l.Before +} + +// GetCursor returns the Cursor field. +func (l *ListCursorOptions) GetCursor() string { + if l == nil { + return "" + } + return l.Cursor +} + +// GetFirst returns the First field. +func (l *ListCursorOptions) GetFirst() int { + if l == nil { + return 0 + } + return l.First +} + +// GetLast returns the Last field. +func (l *ListCursorOptions) GetLast() int { + if l == nil { + return 0 + } + return l.Last +} + +// GetPage returns the Page field. +func (l *ListCursorOptions) GetPage() string { + if l == nil { + return "" + } + return l.Page +} + +// GetPerPage returns the PerPage field. +func (l *ListCursorOptions) GetPerPage() int { + if l == nil { + return 0 + } + return l.PerPage +} + +// GetAvailableIntegrations returns the AvailableIntegrations slice if it's non-nil, nil otherwise. +func (l *ListCustomDeploymentRuleIntegrationsResponse) GetAvailableIntegrations() []*CustomDeploymentProtectionRuleApp { + if l == nil || l.AvailableIntegrations == nil { + return nil + } + return l.AvailableIntegrations +} + // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. func (l *ListCustomDeploymentRuleIntegrationsResponse) GetTotalCount() int { if l == nil || l.TotalCount == nil { @@ -13334,6 +21286,22 @@ func (l *ListCustomDeploymentRuleIntegrationsResponse) GetTotalCount() int { return *l.TotalCount } +// GetRepositoryQuery returns the RepositoryQuery field. +func (l *ListCustomPropertyValuesOptions) GetRepositoryQuery() string { + if l == nil { + return "" + } + return l.RepositoryQuery +} + +// GetProtectionRules returns the ProtectionRules slice if it's non-nil, nil otherwise. +func (l *ListDeploymentProtectionRuleResponse) GetProtectionRules() []*CustomDeploymentProtectionRule { + if l == nil || l.ProtectionRules == nil { + return nil + } + return l.ProtectionRules +} + // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. func (l *ListDeploymentProtectionRuleResponse) GetTotalCount() int { if l == nil || l.TotalCount == nil { @@ -13342,6 +21310,38 @@ func (l *ListDeploymentProtectionRuleResponse) GetTotalCount() int { return *l.TotalCount } +// GetAfter returns the After field. +func (l *ListEnterpriseCodeSecurityConfigurationOptions) GetAfter() string { + if l == nil { + return "" + } + return l.After +} + +// GetBefore returns the Before field. +func (l *ListEnterpriseCodeSecurityConfigurationOptions) GetBefore() string { + if l == nil { + return "" + } + return l.Before +} + +// GetPerPage returns the PerPage field. +func (l *ListEnterpriseCodeSecurityConfigurationOptions) GetPerPage() int { + if l == nil { + return 0 + } + return l.PerPage +} + +// GetVisibleToOrganization returns the VisibleToOrganization field. +func (l *ListEnterpriseRunnerGroupOptions) GetVisibleToOrganization() string { + if l == nil { + return "" + } + return l.VisibleToOrganization +} + // GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. func (l *ListExternalGroupsOptions) GetDisplayName() string { if l == nil || l.DisplayName == nil { @@ -13350,6 +21350,70 @@ func (l *ListExternalGroupsOptions) GetDisplayName() string { return *l.DisplayName } +// GetDirection returns the Direction field. +func (l *ListFineGrainedPATOptions) GetDirection() string { + if l == nil { + return "" + } + return l.Direction +} + +// GetLastUsedAfter returns the LastUsedAfter field. +func (l *ListFineGrainedPATOptions) GetLastUsedAfter() string { + if l == nil { + return "" + } + return l.LastUsedAfter +} + +// GetLastUsedBefore returns the LastUsedBefore field. +func (l *ListFineGrainedPATOptions) GetLastUsedBefore() string { + if l == nil { + return "" + } + return l.LastUsedBefore +} + +// GetOwner returns the Owner slice if it's non-nil, nil otherwise. +func (l *ListFineGrainedPATOptions) GetOwner() []string { + if l == nil || l.Owner == nil { + return nil + } + return l.Owner +} + +// GetPermission returns the Permission field. +func (l *ListFineGrainedPATOptions) GetPermission() string { + if l == nil { + return "" + } + return l.Permission +} + +// GetRepository returns the Repository field. +func (l *ListFineGrainedPATOptions) GetRepository() string { + if l == nil { + return "" + } + return l.Repository +} + +// GetSort returns the Sort field. +func (l *ListFineGrainedPATOptions) GetSort() string { + if l == nil { + return "" + } + return l.Sort +} + +// GetTokenID returns the TokenID slice if it's non-nil, nil otherwise. +func (l *ListFineGrainedPATOptions) GetTokenID() []int64 { + if l == nil || l.TokenID == nil { + return nil + } + return l.TokenID +} + // GetAffects returns the Affects field if it's non-nil, zero value otherwise. func (l *ListGlobalSecurityAdvisoriesOptions) GetAffects() string { if l == nil || l.Affects == nil { @@ -13366,6 +21430,14 @@ func (l *ListGlobalSecurityAdvisoriesOptions) GetCVEID() string { return *l.CVEID } +// GetCWEs returns the CWEs slice if it's non-nil, nil otherwise. +func (l *ListGlobalSecurityAdvisoriesOptions) GetCWEs() []string { + if l == nil || l.CWEs == nil { + return nil + } + return l.CWEs +} + // GetEcosystem returns the Ecosystem field if it's non-nil, zero value otherwise. func (l *ListGlobalSecurityAdvisoriesOptions) GetEcosystem() string { if l == nil || l.Ecosystem == nil { @@ -13430,6 +21502,86 @@ func (l *ListGlobalSecurityAdvisoriesOptions) GetUpdated() string { return *l.Updated } +// GetQuery returns the Query field. +func (l *ListIDPGroupsOptions) GetQuery() string { + if l == nil { + return "" + } + return l.Query +} + +// GetFeatured returns the Featured field if it's non-nil, zero value otherwise. +func (l *ListLicensesOptions) GetFeatured() bool { + if l == nil || l.Featured == nil { + return false + } + return *l.Featured +} + +// GetFilter returns the Filter field. +func (l *ListMembersOptions) GetFilter() string { + if l == nil { + return "" + } + return l.Filter +} + +// GetPublicOnly returns the PublicOnly field. +func (l *ListMembersOptions) GetPublicOnly() bool { + if l == nil { + return false + } + return l.PublicOnly +} + +// GetRole returns the Role field. +func (l *ListMembersOptions) GetRole() string { + if l == nil { + return "" + } + return l.Role +} + +// GetPage returns the Page field. +func (l *ListOptions) GetPage() int { + if l == nil { + return 0 + } + return l.Page +} + +// GetPerPage returns the PerPage field. +func (l *ListOptions) GetPerPage() int { + if l == nil { + return 0 + } + return l.PerPage +} + +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (l *ListOrganizationCopilotCodingAgentRepositoriesResponse) GetRepositories() []*Repository { + if l == nil || l.Repositories == nil { + return nil + } + return l.Repositories +} + +// GetTotalCount returns the TotalCount field. +func (l *ListOrganizationCopilotCodingAgentRepositoriesResponse) GetTotalCount() int { + if l == nil { + return 0 + } + return l.TotalCount +} + +// GetOrganizations returns the Organizations slice if it's non-nil, nil otherwise. +func (l *ListOrganizations) GetOrganizations() []*Organization { + if l == nil || l.Organizations == nil { + return nil + } + return l.Organizations +} + // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. func (l *ListOrganizations) GetTotalCount() int { if l == nil || l.TotalCount == nil { @@ -13438,6 +21590,206 @@ func (l *ListOrganizations) GetTotalCount() int { return *l.TotalCount } +// GetAfter returns the After field. +func (l *ListOrgCodeSecurityConfigurationOptions) GetAfter() string { + if l == nil { + return "" + } + return l.After +} + +// GetBefore returns the Before field. +func (l *ListOrgCodeSecurityConfigurationOptions) GetBefore() string { + if l == nil { + return "" + } + return l.Before +} + +// GetPerPage returns the PerPage field. +func (l *ListOrgCodeSecurityConfigurationOptions) GetPerPage() int { + if l == nil { + return 0 + } + return l.PerPage +} + +// GetTargetType returns the TargetType field. +func (l *ListOrgCodeSecurityConfigurationOptions) GetTargetType() string { + if l == nil { + return "" + } + return l.TargetType +} + +// GetState returns the State field. +func (l *ListOrgMembershipsOptions) GetState() string { + if l == nil { + return "" + } + return l.State +} + +// GetVisibleToRepository returns the VisibleToRepository field. +func (l *ListOrgRunnerGroupOptions) GetVisibleToRepository() string { + if l == nil { + return "" + } + return l.VisibleToRepository +} + +// GetFilter returns the Filter field. +func (l *ListOutsideCollaboratorsOptions) GetFilter() string { + if l == nil { + return "" + } + return l.Filter +} + +// GetState returns the State field. +func (l *ListPackageVersionsOptions) GetState() string { + if l == nil { + return "" + } + return l.State +} + +// GetFields returns the Fields slice if it's non-nil, nil otherwise. +func (l *ListProjectItemsOptions) GetFields() []int64 { + if l == nil || l.Fields == nil { + return nil + } + return l.Fields +} + +// GetQuery returns the Query field. +func (l *ListProjectsOptions) GetQuery() string { + if l == nil { + return "" + } + return l.Query +} + +// GetAfter returns the After field. +func (l *ListProjectsPaginationOptions) GetAfter() string { + if l == nil { + return "" + } + return l.After +} + +// GetBefore returns the Before field. +func (l *ListProjectsPaginationOptions) GetBefore() string { + if l == nil { + return "" + } + return l.Before +} + +// GetPerPage returns the PerPage field. +func (l *ListProjectsPaginationOptions) GetPerPage() int { + if l == nil { + return 0 + } + return l.PerPage +} + +// GetCount returns the Count field if it's non-nil, zero value otherwise. +func (l *ListProvisionedSCIMGroupsEnterpriseOptions) GetCount() int { + if l == nil || l.Count == nil { + return 0 + } + return *l.Count +} + +// GetExcludedAttributes returns the ExcludedAttributes field if it's non-nil, zero value otherwise. +func (l *ListProvisionedSCIMGroupsEnterpriseOptions) GetExcludedAttributes() string { + if l == nil || l.ExcludedAttributes == nil { + return "" + } + return *l.ExcludedAttributes +} + +// GetFilter returns the Filter field if it's non-nil, zero value otherwise. +func (l *ListProvisionedSCIMGroupsEnterpriseOptions) GetFilter() string { + if l == nil || l.Filter == nil { + return "" + } + return *l.Filter +} + +// GetStartIndex returns the StartIndex field if it's non-nil, zero value otherwise. +func (l *ListProvisionedSCIMGroupsEnterpriseOptions) GetStartIndex() int { + if l == nil || l.StartIndex == nil { + return 0 + } + return *l.StartIndex +} + +// GetCount returns the Count field if it's non-nil, zero value otherwise. +func (l *ListProvisionedSCIMUsersEnterpriseOptions) GetCount() int { + if l == nil || l.Count == nil { + return 0 + } + return *l.Count +} + +// GetFilter returns the Filter field if it's non-nil, zero value otherwise. +func (l *ListProvisionedSCIMUsersEnterpriseOptions) GetFilter() string { + if l == nil || l.Filter == nil { + return "" + } + return *l.Filter +} + +// GetStartIndex returns the StartIndex field if it's non-nil, zero value otherwise. +func (l *ListProvisionedSCIMUsersEnterpriseOptions) GetStartIndex() int { + if l == nil || l.StartIndex == nil { + return 0 + } + return *l.StartIndex +} + +// GetContent returns the Content field. +func (l *ListReactionOptions) GetContent() string { + if l == nil { + return "" + } + return l.Content +} + +// GetClientIP returns the ClientIP field if it's non-nil, zero value otherwise. +func (l *ListRepoMachineTypesOptions) GetClientIP() string { + if l == nil || l.ClientIP == nil { + return "" + } + return *l.ClientIP +} + +// GetLocation returns the Location field if it's non-nil, zero value otherwise. +func (l *ListRepoMachineTypesOptions) GetLocation() string { + if l == nil || l.Location == nil { + return "" + } + return *l.Location +} + +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (l *ListRepoMachineTypesOptions) GetRef() string { + if l == nil || l.Ref == nil { + return "" + } + return *l.Ref +} + +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (l *ListRepositories) GetRepositories() []*Repository { + if l == nil || l.Repositories == nil { + return nil + } + return l.Repositories +} + // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. func (l *ListRepositories) GetTotalCount() int { if l == nil || l.TotalCount == nil { @@ -13446,6 +21798,94 @@ func (l *ListRepositories) GetTotalCount() int { return *l.TotalCount } +// GetActivityType returns the ActivityType field. +func (l *ListRepositoryActivityOptions) GetActivityType() string { + if l == nil { + return "" + } + return l.ActivityType +} + +// GetActor returns the Actor field. +func (l *ListRepositoryActivityOptions) GetActor() string { + if l == nil { + return "" + } + return l.Actor +} + +// GetAfter returns the After field. +func (l *ListRepositoryActivityOptions) GetAfter() string { + if l == nil { + return "" + } + return l.After +} + +// GetBefore returns the Before field. +func (l *ListRepositoryActivityOptions) GetBefore() string { + if l == nil { + return "" + } + return l.Before +} + +// GetDirection returns the Direction field. +func (l *ListRepositoryActivityOptions) GetDirection() string { + if l == nil { + return "" + } + return l.Direction +} + +// GetPerPage returns the PerPage field. +func (l *ListRepositoryActivityOptions) GetPerPage() int { + if l == nil { + return 0 + } + return l.PerPage +} + +// GetRef returns the Ref field. +func (l *ListRepositoryActivityOptions) GetRef() string { + if l == nil { + return "" + } + return l.Ref +} + +// GetTimePeriod returns the TimePeriod field. +func (l *ListRepositoryActivityOptions) GetTimePeriod() string { + if l == nil { + return "" + } + return l.TimePeriod +} + +// GetDirection returns the Direction field. +func (l *ListRepositorySecurityAdvisoriesOptions) GetDirection() string { + if l == nil { + return "" + } + return l.Direction +} + +// GetSort returns the Sort field. +func (l *ListRepositorySecurityAdvisoriesOptions) GetSort() string { + if l == nil { + return "" + } + return l.Sort +} + +// GetState returns the State field. +func (l *ListRepositorySecurityAdvisoriesOptions) GetState() string { + if l == nil { + return "" + } + return l.State +} + // GetName returns the Name field if it's non-nil, zero value otherwise. func (l *ListRunnersOptions) GetName() string { if l == nil || l.Name == nil { @@ -13478,6 +21918,126 @@ func (l *ListSCIMProvisionedIdentitiesOptions) GetStartIndex() int { return *l.StartIndex } +// GetDirection returns the Direction field. +func (l *ListUserIssuesOptions) GetDirection() string { + if l == nil { + return "" + } + return l.Direction +} + +// GetFilter returns the Filter field. +func (l *ListUserIssuesOptions) GetFilter() string { + if l == nil { + return "" + } + return l.Filter +} + +// GetLabels returns the Labels slice if it's non-nil, nil otherwise. +func (l *ListUserIssuesOptions) GetLabels() []string { + if l == nil || l.Labels == nil { + return nil + } + return l.Labels +} + +// GetSince returns the Since field. +func (l *ListUserIssuesOptions) GetSince() time.Time { + if l == nil { + return time.Time{} + } + return l.Since +} + +// GetSort returns the Sort field. +func (l *ListUserIssuesOptions) GetSort() string { + if l == nil { + return "" + } + return l.Sort +} + +// GetState returns the State field. +func (l *ListUserIssuesOptions) GetState() string { + if l == nil { + return "" + } + return l.State +} + +// GetFilter returns the Filter field. +func (l *ListWorkflowJobsOptions) GetFilter() string { + if l == nil { + return "" + } + return l.Filter +} + +// GetActor returns the Actor field. +func (l *ListWorkflowRunsOptions) GetActor() string { + if l == nil { + return "" + } + return l.Actor +} + +// GetBranch returns the Branch field. +func (l *ListWorkflowRunsOptions) GetBranch() string { + if l == nil { + return "" + } + return l.Branch +} + +// GetCheckSuiteID returns the CheckSuiteID field. +func (l *ListWorkflowRunsOptions) GetCheckSuiteID() int64 { + if l == nil { + return 0 + } + return l.CheckSuiteID +} + +// GetCreated returns the Created field. +func (l *ListWorkflowRunsOptions) GetCreated() string { + if l == nil { + return "" + } + return l.Created +} + +// GetEvent returns the Event field. +func (l *ListWorkflowRunsOptions) GetEvent() string { + if l == nil { + return "" + } + return l.Event +} + +// GetExcludePullRequests returns the ExcludePullRequests field. +func (l *ListWorkflowRunsOptions) GetExcludePullRequests() bool { + if l == nil { + return false + } + return l.ExcludePullRequests +} + +// GetHeadSHA returns the HeadSHA field. +func (l *ListWorkflowRunsOptions) GetHeadSHA() string { + if l == nil { + return "" + } + return l.HeadSHA +} + +// GetStatus returns the Status field. +func (l *ListWorkflowRunsOptions) GetStatus() string { + if l == nil { + return "" + } + return l.Status +} + // GetEndColumn returns the EndColumn field if it's non-nil, zero value otherwise. func (l *Location) GetEndColumn() int { if l == nil || l.EndColumn == nil { @@ -13526,6 +22086,14 @@ func (l *LockBranch) GetEnabled() bool { return *l.Enabled } +// GetLockReason returns the LockReason field. +func (l *LockIssueOptions) GetLockReason() string { + if l == nil { + return "" + } + return l.LockReason +} + // GetHostname returns the Hostname field if it's non-nil, zero value otherwise. func (m *MaintenanceOperationStatus) GetHostname() string { if m == nil || m.Hostname == nil { @@ -13550,6 +22118,22 @@ func (m *MaintenanceOperationStatus) GetUUID() string { return *m.UUID } +// GetEnabled returns the Enabled field. +func (m *MaintenanceOptions) GetEnabled() bool { + if m == nil { + return false + } + return m.Enabled +} + +// GetIPExceptionList returns the IPExceptionList slice if it's non-nil, nil otherwise. +func (m *MaintenanceOptions) GetIPExceptionList() []string { + if m == nil || m.IPExceptionList == nil { + return nil + } + return m.IPExceptionList +} + // GetMaintenanceModeMessage returns the MaintenanceModeMessage field if it's non-nil, zero value otherwise. func (m *MaintenanceOptions) GetMaintenanceModeMessage() string { if m == nil || m.MaintenanceModeMessage == nil { @@ -13582,6 +22166,14 @@ func (m *MaintenanceStatus) GetCanUnsetMaintenance() bool { return *m.CanUnsetMaintenance } +// GetConnectionServices returns the ConnectionServices slice if it's non-nil, nil otherwise. +func (m *MaintenanceStatus) GetConnectionServices() []*ConnectionServiceItem { + if m == nil || m.ConnectionServices == nil { + return nil + } + return m.ConnectionServices +} + // GetHostname returns the Hostname field if it's non-nil, zero value otherwise. func (m *MaintenanceStatus) GetHostname() string { if m == nil || m.Hostname == nil { @@ -13590,6 +22182,14 @@ func (m *MaintenanceStatus) GetHostname() string { return *m.Hostname } +// GetIPExceptionList returns the IPExceptionList slice if it's non-nil, nil otherwise. +func (m *MaintenanceStatus) GetIPExceptionList() []string { + if m == nil || m.IPExceptionList == nil { + return nil + } + return m.IPExceptionList +} + // GetMaintenanceModeMessage returns the MaintenanceModeMessage field if it's non-nil, zero value otherwise. func (m *MaintenanceStatus) GetMaintenanceModeMessage() string { if m == nil || m.MaintenanceModeMessage == nil { @@ -13622,6 +22222,22 @@ func (m *MaintenanceStatus) GetUUID() string { return *m.UUID } +// GetContext returns the Context field. +func (m *MarkdownOptions) GetContext() string { + if m == nil { + return "" + } + return m.Context +} + +// GetMode returns the Mode field. +func (m *MarkdownOptions) GetMode() string { + if m == nil { + return "" + } + return m.Mode +} + // GetEffectiveDate returns the EffectiveDate field if it's non-nil, zero value otherwise. func (m *MarketplacePendingChange) GetEffectiveDate() Timestamp { if m == nil || m.EffectiveDate == nil { @@ -13990,6 +22606,14 @@ func (m *MarketplacePurchaseEvent) GetSender() *User { return m.Sender } +// GetIndices returns the Indices slice if it's non-nil, nil otherwise. +func (m *Match) GetIndices() []int { + if m == nil || m.Indices == nil { + return nil + } + return m.Indices +} + // GetText returns the Text field if it's non-nil, zero value otherwise. func (m *Match) GetText() string { if m == nil || m.Text == nil { @@ -13998,6 +22622,38 @@ func (m *Match) GetText() string { return *m.Text } +// GetParameters returns the Parameters field. +func (m *MaxFilePathLengthBranchRule) GetParameters() MaxFilePathLengthRuleParameters { + if m == nil { + return MaxFilePathLengthRuleParameters{} + } + return m.Parameters +} + +// GetMaxFilePathLength returns the MaxFilePathLength field. +func (m *MaxFilePathLengthRuleParameters) GetMaxFilePathLength() int { + if m == nil { + return 0 + } + return m.MaxFilePathLength +} + +// GetParameters returns the Parameters field. +func (m *MaxFileSizeBranchRule) GetParameters() MaxFileSizeRuleParameters { + if m == nil { + return MaxFileSizeRuleParameters{} + } + return m.Parameters +} + +// GetMaxFileSize returns the MaxFileSize field. +func (m *MaxFileSizeRuleParameters) GetMaxFileSize() int64 { + if m == nil { + return 0 + } + return m.MaxFileSize +} + // GetPermission returns the Permission field. func (m *MemberChanges) GetPermission() *MemberChangesPermission { if m == nil { @@ -14302,6 +22958,70 @@ func (m *MergeGroupEvent) GetSender() *User { return m.Sender } +// GetParameters returns the Parameters field. +func (m *MergeQueueBranchRule) GetParameters() MergeQueueRuleParameters { + if m == nil { + return MergeQueueRuleParameters{} + } + return m.Parameters +} + +// GetCheckResponseTimeoutMinutes returns the CheckResponseTimeoutMinutes field. +func (m *MergeQueueRuleParameters) GetCheckResponseTimeoutMinutes() int { + if m == nil { + return 0 + } + return m.CheckResponseTimeoutMinutes +} + +// GetGroupingStrategy returns the GroupingStrategy field. +func (m *MergeQueueRuleParameters) GetGroupingStrategy() MergeGroupingStrategy { + if m == nil { + return "" + } + return m.GroupingStrategy +} + +// GetMaxEntriesToBuild returns the MaxEntriesToBuild field. +func (m *MergeQueueRuleParameters) GetMaxEntriesToBuild() int { + if m == nil { + return 0 + } + return m.MaxEntriesToBuild +} + +// GetMaxEntriesToMerge returns the MaxEntriesToMerge field. +func (m *MergeQueueRuleParameters) GetMaxEntriesToMerge() int { + if m == nil { + return 0 + } + return m.MaxEntriesToMerge +} + +// GetMergeMethod returns the MergeMethod field. +func (m *MergeQueueRuleParameters) GetMergeMethod() MergeQueueMergeMethod { + if m == nil { + return "" + } + return m.MergeMethod +} + +// GetMinEntriesToMerge returns the MinEntriesToMerge field. +func (m *MergeQueueRuleParameters) GetMinEntriesToMerge() int { + if m == nil { + return 0 + } + return m.MinEntriesToMerge +} + +// GetMinEntriesToMergeWaitMinutes returns the MinEntriesToMergeWaitMinutes field. +func (m *MergeQueueRuleParameters) GetMinEntriesToMergeWaitMinutes() int { + if m == nil { + return 0 + } + return m.MinEntriesToMergeWaitMinutes +} + // GetText returns the Text field if it's non-nil, zero value otherwise. func (m *Message) GetText() string { if m == nil || m.Text == nil { @@ -14454,6 +23174,14 @@ func (m *Migration) GetLockRepositories() bool { return *m.LockRepositories } +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (m *Migration) GetRepositories() []*Repository { + if m == nil || m.Repositories == nil { + return nil + } + return m.Repositories +} + // GetState returns the State field if it's non-nil, zero value otherwise. func (m *Migration) GetState() string { if m == nil || m.State == nil { @@ -14478,6 +23206,38 @@ func (m *Migration) GetURL() string { return *m.URL } +// GetExclude returns the Exclude slice if it's non-nil, nil otherwise. +func (m *MigrationOptions) GetExclude() []string { + if m == nil || m.Exclude == nil { + return nil + } + return m.Exclude +} + +// GetExcludeAttachments returns the ExcludeAttachments field. +func (m *MigrationOptions) GetExcludeAttachments() bool { + if m == nil { + return false + } + return m.ExcludeAttachments +} + +// GetExcludeReleases returns the ExcludeReleases field. +func (m *MigrationOptions) GetExcludeReleases() bool { + if m == nil { + return false + } + return m.ExcludeReleases +} + +// GetLockRepositories returns the LockRepositories field. +func (m *MigrationOptions) GetLockRepositories() bool { + if m == nil { + return false + } + return m.LockRepositories +} + // GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise. func (m *Milestone) GetClosedAt() Timestamp { if m == nil || m.ClosedAt == nil { @@ -14662,6 +23422,30 @@ func (m *MilestoneEvent) GetSender() *User { return m.Sender } +// GetDirection returns the Direction field. +func (m *MilestoneListOptions) GetDirection() string { + if m == nil { + return "" + } + return m.Direction +} + +// GetSort returns the Sort field. +func (m *MilestoneListOptions) GetSort() string { + if m == nil { + return "" + } + return m.Sort +} + +// GetState returns the State field. +func (m *MilestoneListOptions) GetState() string { + if m == nil { + return "" + } + return m.State +} + // GetClosedMilestones returns the ClosedMilestones field if it's non-nil, zero value otherwise. func (m *MilestoneStats) GetClosedMilestones() int { if m == nil || m.ClosedMilestones == nil { @@ -14702,6 +23486,14 @@ func (m *MostRecentInstance) GetCategory() string { return *m.Category } +// GetClassifications returns the Classifications slice if it's non-nil, nil otherwise. +func (m *MostRecentInstance) GetClassifications() []string { + if m == nil || m.Classifications == nil { + return nil + } + return m.Classifications +} + // GetCommitSHA returns the CommitSHA field if it's non-nil, zero value otherwise. func (m *MostRecentInstance) GetCommitSHA() string { if m == nil || m.CommitSHA == nil { @@ -14790,6 +23582,14 @@ func (n *NetworkConfiguration) GetName() string { return *n.Name } +// GetNetworkSettingsIDs returns the NetworkSettingsIDs slice if it's non-nil, nil otherwise. +func (n *NetworkConfiguration) GetNetworkSettingsIDs() []string { + if n == nil || n.NetworkSettingsIDs == nil { + return nil + } + return n.NetworkSettingsIDs +} + // GetComputeService returns the ComputeService field. func (n *NetworkConfigurationRequest) GetComputeService() *ComputeService { if n == nil { @@ -14806,6 +23606,22 @@ func (n *NetworkConfigurationRequest) GetName() string { return *n.Name } +// GetNetworkSettingsIDs returns the NetworkSettingsIDs slice if it's non-nil, nil otherwise. +func (n *NetworkConfigurationRequest) GetNetworkSettingsIDs() []string { + if n == nil || n.NetworkSettingsIDs == nil { + return nil + } + return n.NetworkSettingsIDs +} + +// GetNetworkConfigurations returns the NetworkConfigurations slice if it's non-nil, nil otherwise. +func (n *NetworkConfigurations) GetNetworkConfigurations() []*NetworkConfiguration { + if n == nil || n.NetworkConfigurations == nil { + return nil + } + return n.NetworkConfigurations +} + // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. func (n *NetworkConfigurations) GetTotalCount() int64 { if n == nil || n.TotalCount == nil { @@ -14934,6 +23750,22 @@ func (n *NewTeam) GetLDAPDN() string { return *n.LDAPDN } +// GetMaintainers returns the Maintainers slice if it's non-nil, nil otherwise. +func (n *NewTeam) GetMaintainers() []string { + if n == nil || n.Maintainers == nil { + return nil + } + return n.Maintainers +} + +// GetName returns the Name field. +func (n *NewTeam) GetName() string { + if n == nil { + return "" + } + return n.Name +} + // GetNotificationSetting returns the NotificationSetting field if it's non-nil, zero value otherwise. func (n *NewTeam) GetNotificationSetting() string { if n == nil || n.NotificationSetting == nil { @@ -14966,6 +23798,22 @@ func (n *NewTeam) GetPrivacy() string { return *n.Privacy } +// GetRepoNames returns the RepoNames slice if it's non-nil, nil otherwise. +func (n *NewTeam) GetRepoNames() []string { + if n == nil || n.RepoNames == nil { + return nil + } + return n.RepoNames +} + +// GetClusterRoles returns the ClusterRoles slice if it's non-nil, nil otherwise. +func (n *NodeDetails) GetClusterRoles() []string { + if n == nil || n.ClusterRoles == nil { + return nil + } + return n.ClusterRoles +} + // GetHostname returns the Hostname field if it's non-nil, zero value otherwise. func (n *NodeDetails) GetHostname() string { if n == nil || n.Hostname == nil { @@ -14982,6 +23830,14 @@ func (n *NodeDetails) GetUUID() string { return *n.UUID } +// GetNodes returns the Nodes slice if it's non-nil, nil otherwise. +func (n *NodeMetadataStatus) GetNodes() []*NodeDetails { + if n == nil || n.Nodes == nil { + return nil + } + return n.Nodes +} + // GetTopology returns the Topology field if it's non-nil, zero value otherwise. func (n *NodeMetadataStatus) GetTopology() string { if n == nil || n.Topology == nil { @@ -15086,6 +23942,38 @@ func (n *Notification) GetURL() string { return *n.URL } +// GetAll returns the All field. +func (n *NotificationListOptions) GetAll() bool { + if n == nil { + return false + } + return n.All +} + +// GetBefore returns the Before field. +func (n *NotificationListOptions) GetBefore() time.Time { + if n == nil { + return time.Time{} + } + return n.Before +} + +// GetParticipating returns the Participating field. +func (n *NotificationListOptions) GetParticipating() bool { + if n == nil { + return false + } + return n.Participating +} + +// GetSince returns the Since field. +func (n *NotificationListOptions) GetSince() time.Time { + if n == nil { + return time.Time{} + } + return n.Since +} + // GetLatestCommentURL returns the LatestCommentURL field if it's non-nil, zero value otherwise. func (n *NotificationSubject) GetLatestCommentURL() string { if n == nil || n.LatestCommentURL == nil { @@ -15142,6 +24030,14 @@ func (o *OAuthAPP) GetURL() string { return *o.URL } +// GetIncludeClaimKeys returns the IncludeClaimKeys slice if it's non-nil, nil otherwise. +func (o *OIDCSubjectClaimCustomTemplate) GetIncludeClaimKeys() []string { + if o == nil || o.IncludeClaimKeys == nil { + return nil + } + return o.IncludeClaimKeys +} + // GetUseDefault returns the UseDefault field if it's non-nil, zero value otherwise. func (o *OIDCSubjectClaimCustomTemplate) GetUseDefault() bool { if o == nil || o.UseDefault == nil { @@ -15158,6 +24054,14 @@ func (o *Organization) GetAdvancedSecurityEnabledForNewRepos() bool { return *o.AdvancedSecurityEnabledForNewRepos } +// GetArchivedAt returns the ArchivedAt field if it's non-nil, zero value otherwise. +func (o *Organization) GetArchivedAt() Timestamp { + if o == nil || o.ArchivedAt == nil { + return Timestamp{} + } + return *o.ArchivedAt +} + // GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. func (o *Organization) GetAvatarURL() string { if o == nil || o.AvatarURL == nil { @@ -15222,6 +24126,14 @@ func (o *Organization) GetDefaultRepoSettings() string { return *o.DefaultRepoSettings } +// GetDefaultRepositoryBranch returns the DefaultRepositoryBranch field if it's non-nil, zero value otherwise. +func (o *Organization) GetDefaultRepositoryBranch() string { + if o == nil || o.DefaultRepositoryBranch == nil { + return "" + } + return *o.DefaultRepositoryBranch +} + // GetDependabotAlertsEnabledForNewRepos returns the DependabotAlertsEnabledForNewRepos field if it's non-nil, zero value otherwise. func (o *Organization) GetDependabotAlertsEnabledForNewRepos() bool { if o == nil || o.DependabotAlertsEnabledForNewRepos == nil { @@ -15246,6 +24158,14 @@ func (o *Organization) GetDependencyGraphEnabledForNewRepos() bool { return *o.DependencyGraphEnabledForNewRepos } +// GetDeployKeysEnabledForRepositories returns the DeployKeysEnabledForRepositories field if it's non-nil, zero value otherwise. +func (o *Organization) GetDeployKeysEnabledForRepositories() bool { + if o == nil || o.DeployKeysEnabledForRepositories == nil { + return false + } + return *o.DeployKeysEnabledForRepositories +} + // GetDescription returns the Description field if it's non-nil, zero value otherwise. func (o *Organization) GetDescription() string { if o == nil || o.Description == nil { @@ -15262,6 +24182,14 @@ func (o *Organization) GetDiskUsage() int { return *o.DiskUsage } +// GetDisplayCommenterFullNameSettingEnabled returns the DisplayCommenterFullNameSettingEnabled field if it's non-nil, zero value otherwise. +func (o *Organization) GetDisplayCommenterFullNameSettingEnabled() bool { + if o == nil || o.DisplayCommenterFullNameSettingEnabled == nil { + return false + } + return *o.DisplayCommenterFullNameSettingEnabled +} + // GetEmail returns the Email field if it's non-nil, zero value otherwise. func (o *Organization) GetEmail() string { if o == nil || o.Email == nil { @@ -15374,6 +24302,14 @@ func (o *Organization) GetMembersAllowedRepositoryCreationType() string { return *o.MembersAllowedRepositoryCreationType } +// GetMembersCanChangeRepoVisibility returns the MembersCanChangeRepoVisibility field if it's non-nil, zero value otherwise. +func (o *Organization) GetMembersCanChangeRepoVisibility() bool { + if o == nil || o.MembersCanChangeRepoVisibility == nil { + return false + } + return *o.MembersCanChangeRepoVisibility +} + // GetMembersCanCreateInternalRepos returns the MembersCanCreateInternalRepos field if it's non-nil, zero value otherwise. func (o *Organization) GetMembersCanCreateInternalRepos() bool { if o == nil || o.MembersCanCreateInternalRepos == nil { @@ -15430,6 +24366,30 @@ func (o *Organization) GetMembersCanCreateRepos() bool { return *o.MembersCanCreateRepos } +// GetMembersCanCreateTeams returns the MembersCanCreateTeams field if it's non-nil, zero value otherwise. +func (o *Organization) GetMembersCanCreateTeams() bool { + if o == nil || o.MembersCanCreateTeams == nil { + return false + } + return *o.MembersCanCreateTeams +} + +// GetMembersCanDeleteIssues returns the MembersCanDeleteIssues field if it's non-nil, zero value otherwise. +func (o *Organization) GetMembersCanDeleteIssues() bool { + if o == nil || o.MembersCanDeleteIssues == nil { + return false + } + return *o.MembersCanDeleteIssues +} + +// GetMembersCanDeleteRepositories returns the MembersCanDeleteRepositories field if it's non-nil, zero value otherwise. +func (o *Organization) GetMembersCanDeleteRepositories() bool { + if o == nil || o.MembersCanDeleteRepositories == nil { + return false + } + return *o.MembersCanDeleteRepositories +} + // GetMembersCanForkPrivateRepos returns the MembersCanForkPrivateRepos field if it's non-nil, zero value otherwise. func (o *Organization) GetMembersCanForkPrivateRepos() bool { if o == nil || o.MembersCanForkPrivateRepos == nil { @@ -15438,6 +24398,22 @@ func (o *Organization) GetMembersCanForkPrivateRepos() bool { return *o.MembersCanForkPrivateRepos } +// GetMembersCanInviteOutsideCollaborators returns the MembersCanInviteOutsideCollaborators field if it's non-nil, zero value otherwise. +func (o *Organization) GetMembersCanInviteOutsideCollaborators() bool { + if o == nil || o.MembersCanInviteOutsideCollaborators == nil { + return false + } + return *o.MembersCanInviteOutsideCollaborators +} + +// GetMembersCanViewDependencyInsights returns the MembersCanViewDependencyInsights field if it's non-nil, zero value otherwise. +func (o *Organization) GetMembersCanViewDependencyInsights() bool { + if o == nil || o.MembersCanViewDependencyInsights == nil { + return false + } + return *o.MembersCanViewDependencyInsights +} + // GetMembersURL returns the MembersURL field if it's non-nil, zero value otherwise. func (o *Organization) GetMembersURL() string { if o == nil || o.MembersURL == nil { @@ -15510,6 +24486,14 @@ func (o *Organization) GetPublicRepos() int { return *o.PublicRepos } +// GetReadersCanCreateDiscussions returns the ReadersCanCreateDiscussions field if it's non-nil, zero value otherwise. +func (o *Organization) GetReadersCanCreateDiscussions() bool { + if o == nil || o.ReadersCanCreateDiscussions == nil { + return false + } + return *o.ReadersCanCreateDiscussions +} + // GetReposURL returns the ReposURL field if it's non-nil, zero value otherwise. func (o *Organization) GetReposURL() string { if o == nil || o.ReposURL == nil { @@ -15526,6 +24510,22 @@ func (o *Organization) GetSecretScanningEnabledForNewRepos() bool { return *o.SecretScanningEnabledForNewRepos } +// GetSecretScanningPushProtectionCustomLink returns the SecretScanningPushProtectionCustomLink field if it's non-nil, zero value otherwise. +func (o *Organization) GetSecretScanningPushProtectionCustomLink() string { + if o == nil || o.SecretScanningPushProtectionCustomLink == nil { + return "" + } + return *o.SecretScanningPushProtectionCustomLink +} + +// GetSecretScanningPushProtectionCustomLinkEnabled returns the SecretScanningPushProtectionCustomLinkEnabled field if it's non-nil, zero value otherwise. +func (o *Organization) GetSecretScanningPushProtectionCustomLinkEnabled() bool { + if o == nil || o.SecretScanningPushProtectionCustomLinkEnabled == nil { + return false + } + return *o.SecretScanningPushProtectionCustomLinkEnabled +} + // GetSecretScanningPushProtectionEnabledForNewRepos returns the SecretScanningPushProtectionEnabledForNewRepos field if it's non-nil, zero value otherwise. func (o *Organization) GetSecretScanningPushProtectionEnabledForNewRepos() bool { if o == nil || o.SecretScanningPushProtectionEnabledForNewRepos == nil { @@ -15598,6 +24598,22 @@ func (o *Organization) GetWebCommitSignoffRequired() bool { return *o.WebCommitSignoffRequired } +// GetProperties returns the Properties slice if it's non-nil, nil otherwise. +func (o *OrganizationCustomPropertyValues) GetProperties() []*CustomPropertyValue { + if o == nil || o.Properties == nil { + return nil + } + return o.Properties +} + +// GetCustomRepoRoles returns the CustomRepoRoles slice if it's non-nil, nil otherwise. +func (o *OrganizationCustomRepoRoles) GetCustomRepoRoles() []*CustomRepoRoles { + if o == nil || o.CustomRepoRoles == nil { + return nil + } + return o.CustomRepoRoles +} + // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. func (o *OrganizationCustomRepoRoles) GetTotalCount() int { if o == nil || o.TotalCount == nil { @@ -15606,6 +24622,14 @@ func (o *OrganizationCustomRepoRoles) GetTotalCount() int { return *o.TotalCount } +// GetCustomRepoRoles returns the CustomRepoRoles slice if it's non-nil, nil otherwise. +func (o *OrganizationCustomRoles) GetCustomRepoRoles() []*CustomOrgRole { + if o == nil || o.CustomRepoRoles == nil { + return nil + } + return o.CustomRepoRoles +} + // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. func (o *OrganizationCustomRoles) GetTotalCount() int { if o == nil || o.TotalCount == nil { @@ -15662,6 +24686,30 @@ func (o *OrganizationEvent) GetSender() *User { return o.Sender } +// GetDescription returns the Description field. +func (o *OrganizationFineGrainedPermission) GetDescription() string { + if o == nil { + return "" + } + return o.Description +} + +// GetName returns the Name field. +func (o *OrganizationFineGrainedPermission) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +// GetInstallations returns the Installations slice if it's non-nil, nil otherwise. +func (o *OrganizationInstallations) GetInstallations() []*Installation { + if o == nil || o.Installations == nil { + return nil + } + return o.Installations +} + // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. func (o *OrganizationInstallations) GetTotalCount() int { if o == nil || o.TotalCount == nil { @@ -15670,6 +24718,22 @@ func (o *OrganizationInstallations) GetTotalCount() int { return *o.TotalCount } +// GetPerPage returns the PerPage field. +func (o *OrganizationsListOptions) GetPerPage() int { + if o == nil { + return 0 + } + return o.PerPage +} + +// GetSince returns the Since field. +func (o *OrganizationsListOptions) GetSince() int64 { + if o == nil { + return 0 + } + return o.Since +} + // GetAction returns the Action field if it's non-nil, zero value otherwise. func (o *OrgBlockEvent) GetAction() string { if o == nil || o.Action == nil { @@ -15886,6 +24950,14 @@ func (p *Package) GetVisibility() string { return *p.Visibility } +// GetTags returns the Tags slice if it's non-nil, nil otherwise. +func (p *PackageContainerMetadata) GetTags() []string { + if p == nil || p.Tags == nil { + return nil + } + return p.Tags +} + // GetAction returns the Action field if it's non-nil, zero value otherwise. func (p *PackageEvent) GetAction() string { if p == nil || p.Action == nil { @@ -15974,6 +25046,30 @@ func (p *PackageEventContainerMetadataTag) GetName() string { return *p.Name } +// GetReferenceCategory returns the ReferenceCategory field. +func (p *PackageExternalRef) GetReferenceCategory() string { + if p == nil { + return "" + } + return p.ReferenceCategory +} + +// GetReferenceLocator returns the ReferenceLocator field. +func (p *PackageExternalRef) GetReferenceLocator() string { + if p == nil { + return "" + } + return p.ReferenceLocator +} + +// GetReferenceType returns the ReferenceType field. +func (p *PackageExternalRef) GetReferenceType() string { + if p == nil { + return "" + } + return p.ReferenceType +} + // GetAuthor returns the Author field. func (p *PackageFile) GetAuthor() *User { if p == nil { @@ -16142,6 +25238,22 @@ func (p *PackageNPMMetadata) GetCommitOID() string { return *p.CommitOID } +// GetContributors returns the Contributors slice if it's non-nil, nil otherwise. +func (p *PackageNPMMetadata) GetContributors() []any { + if p == nil || p.Contributors == nil { + return nil + } + return p.Contributors +} + +// GetCPU returns the CPU slice if it's non-nil, nil otherwise. +func (p *PackageNPMMetadata) GetCPU() []string { + if p == nil || p.CPU == nil { + return nil + } + return p.CPU +} + // GetDeletedByID returns the DeletedByID field if it's non-nil, zero value otherwise. func (p *PackageNPMMetadata) GetDeletedByID() int64 { if p == nil || p.DeletedByID == nil { @@ -16198,6 +25310,14 @@ func (p *PackageNPMMetadata) GetEngines() map[string]string { return p.Engines } +// GetFiles returns the Files slice if it's non-nil, nil otherwise. +func (p *PackageNPMMetadata) GetFiles() []string { + if p == nil || p.Files == nil { + return nil + } + return p.Files +} + // GetGitHead returns the GitHead field if it's non-nil, zero value otherwise. func (p *PackageNPMMetadata) GetGitHead() string { if p == nil || p.GitHead == nil { @@ -16238,6 +25358,14 @@ func (p *PackageNPMMetadata) GetInstallationCommand() string { return *p.InstallationCommand } +// GetKeywords returns the Keywords slice if it's non-nil, nil otherwise. +func (p *PackageNPMMetadata) GetKeywords() []string { + if p == nil || p.Keywords == nil { + return nil + } + return p.Keywords +} + // GetLicense returns the License field if it's non-nil, zero value otherwise. func (p *PackageNPMMetadata) GetLicense() string { if p == nil || p.License == nil { @@ -16254,6 +25382,14 @@ func (p *PackageNPMMetadata) GetMain() string { return *p.Main } +// GetMaintainers returns the Maintainers slice if it's non-nil, nil otherwise. +func (p *PackageNPMMetadata) GetMaintainers() []any { + if p == nil || p.Maintainers == nil { + return nil + } + return p.Maintainers +} + // GetMan returns the Man map if it's non-nil, an empty map otherwise. func (p *PackageNPMMetadata) GetMan() map[string]any { if p == nil || p.Man == nil { @@ -16302,6 +25438,14 @@ func (p *PackageNPMMetadata) GetOptionalDependencies() map[string]string { return p.OptionalDependencies } +// GetOS returns the OS slice if it's non-nil, nil otherwise. +func (p *PackageNPMMetadata) GetOS() []string { + if p == nil || p.OS == nil { + return nil + } + return p.OS +} + // GetPeerDependencies returns the PeerDependencies map if it's non-nil, an empty map otherwise. func (p *PackageNPMMetadata) GetPeerDependencies() map[string]string { if p == nil || p.PeerDependencies == nil { @@ -16358,6 +25502,14 @@ func (p *PackageNPMMetadata) GetVersion() string { return *p.Version } +// GetID returns the ID field. +func (p *PackageNugetMetadata) GetID() json.RawMessage { + if p == nil { + return json.RawMessage{} + } + return p.ID +} + // GetName returns the Name field if it's non-nil, zero value otherwise. func (p *PackageNugetMetadata) GetName() string { if p == nil || p.Name == nil { @@ -16366,6 +25518,14 @@ func (p *PackageNugetMetadata) GetName() string { return *p.Name } +// GetValue returns the Value field. +func (p *PackageNugetMetadata) GetValue() json.RawMessage { + if p == nil { + return json.RawMessage{} + } + return p.Value +} + // GetAboutURL returns the AboutURL field if it's non-nil, zero value otherwise. func (p *PackageRegistry) GetAboutURL() string { if p == nil || p.AboutURL == nil { @@ -16494,6 +25654,30 @@ func (p *PackageRelease) GetURL() string { return *p.URL } +// GetIncludedGigabytesBandwidth returns the IncludedGigabytesBandwidth field. +func (p *PackagesBilling) GetIncludedGigabytesBandwidth() int { + if p == nil { + return 0 + } + return p.IncludedGigabytesBandwidth +} + +// GetTotalGigabytesBandwidthUsed returns the TotalGigabytesBandwidthUsed field. +func (p *PackagesBilling) GetTotalGigabytesBandwidthUsed() int { + if p == nil { + return 0 + } + return p.TotalGigabytesBandwidthUsed +} + +// GetTotalPaidGigabytesBandwidthUsed returns the TotalPaidGigabytesBandwidthUsed field. +func (p *PackagesBilling) GetTotalPaidGigabytesBandwidthUsed() int { + if p == nil { + return 0 + } + return p.TotalPaidGigabytesBandwidthUsed +} + // GetAuthor returns the Author field. func (p *PackageVersion) GetAuthor() *User { if p == nil { @@ -16542,6 +25726,14 @@ func (p *PackageVersion) GetDescription() string { return *p.Description } +// GetDockerMetadata returns the DockerMetadata slice if it's non-nil, nil otherwise. +func (p *PackageVersion) GetDockerMetadata() []any { + if p == nil || p.DockerMetadata == nil { + return nil + } + return p.DockerMetadata +} + // GetDraft returns the Draft field if it's non-nil, zero value otherwise. func (p *PackageVersion) GetDraft() bool { if p == nil || p.Draft == nil { @@ -16606,6 +25798,22 @@ func (p *PackageVersion) GetNPMMetadata() *PackageNPMMetadata { return p.NPMMetadata } +// GetNugetMetadata returns the NugetMetadata slice if it's non-nil, nil otherwise. +func (p *PackageVersion) GetNugetMetadata() []*PackageNugetMetadata { + if p == nil || p.NugetMetadata == nil { + return nil + } + return p.NugetMetadata +} + +// GetPackageFiles returns the PackageFiles slice if it's non-nil, nil otherwise. +func (p *PackageVersion) GetPackageFiles() []*PackageFile { + if p == nil || p.PackageFiles == nil { + return nil + } + return p.PackageFiles +} + // GetPackageHTMLURL returns the PackageHTMLURL field if it's non-nil, zero value otherwise. func (p *PackageVersion) GetPackageHTMLURL() string { if p == nil || p.PackageHTMLURL == nil { @@ -17278,6 +26486,14 @@ func (p *PagesHTTPSCertificate) GetDescription() string { return *p.Description } +// GetDomains returns the Domains slice if it's non-nil, nil otherwise. +func (p *PagesHTTPSCertificate) GetDomains() []string { + if p == nil || p.Domains == nil { + return nil + } + return p.Domains +} + // GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. func (p *PagesHTTPSCertificate) GetExpiresAt() string { if p == nil || p.ExpiresAt == nil { @@ -17390,6 +26606,14 @@ func (p *PagesUpdateWithoutCNAME) GetSource() *PagesSource { return p.Source } +// GetParameters returns the Parameters field. +func (p *PatternBranchRule) GetParameters() PatternRuleParameters { + if p == nil { + return PatternRuleParameters{} + } + return p.Parameters +} + // GetName returns the Name field if it's non-nil, zero value otherwise. func (p *PatternRuleParameters) GetName() string { if p == nil || p.Name == nil { @@ -17406,6 +26630,22 @@ func (p *PatternRuleParameters) GetNegate() bool { return *p.Negate } +// GetOperator returns the Operator field. +func (p *PatternRuleParameters) GetOperator() PatternRuleOperator { + if p == nil { + return "" + } + return p.Operator +} + +// GetPattern returns the Pattern field. +func (p *PatternRuleParameters) GetPattern() string { + if p == nil { + return "" + } + return p.Pattern +} + // GetCurrentUserCanApprove returns the CurrentUserCanApprove field if it's non-nil, zero value otherwise. func (p *PendingDeployment) GetCurrentUserCanApprove() bool { if p == nil || p.CurrentUserCanApprove == nil { @@ -17422,6 +26662,14 @@ func (p *PendingDeployment) GetEnvironment() *PendingDeploymentEnvironment { return p.Environment } +// GetReviewers returns the Reviewers slice if it's non-nil, nil otherwise. +func (p *PendingDeployment) GetReviewers() []*RequiredReviewer { + if p == nil || p.Reviewers == nil { + return nil + } + return p.Reviewers +} + // GetWaitTimer returns the WaitTimer field if it's non-nil, zero value otherwise. func (p *PendingDeployment) GetWaitTimer() int64 { if p == nil || p.WaitTimer == nil { @@ -17478,6 +26726,30 @@ func (p *PendingDeploymentEnvironment) GetURL() string { return *p.URL } +// GetComment returns the Comment field. +func (p *PendingDeploymentsRequest) GetComment() string { + if p == nil { + return "" + } + return p.Comment +} + +// GetEnvironmentIDs returns the EnvironmentIDs slice if it's non-nil, nil otherwise. +func (p *PendingDeploymentsRequest) GetEnvironmentIDs() []int64 { + if p == nil || p.EnvironmentIDs == nil { + return nil + } + return p.EnvironmentIDs +} + +// GetState returns the State field. +func (p *PendingDeploymentsRequest) GetState() string { + if p == nil { + return "" + } + return p.State +} + // GetAccessGrantedAt returns the AccessGrantedAt field if it's non-nil, zero value otherwise. func (p *PersonalAccessToken) GetAccessGrantedAt() Timestamp { if p == nil || p.AccessGrantedAt == nil { @@ -17646,6 +26918,14 @@ func (p *PersonalAccessTokenRequest) GetPermissionsUpgraded() *PersonalAccessTok return p.PermissionsUpgraded } +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (p *PersonalAccessTokenRequest) GetRepositories() []*Repository { + if p == nil || p.Repositories == nil { + return nil + } + return p.Repositories +} + // GetRepositoryCount returns the RepositoryCount field if it's non-nil, zero value otherwise. func (p *PersonalAccessTokenRequest) GetRepositoryCount() int64 { if p == nil || p.RepositoryCount == nil { @@ -17830,6 +27110,222 @@ func (p *Plan) GetSpace() int { return *p.Space } +// GetAutoTriggerChecks returns the AutoTriggerChecks slice if it's non-nil, nil otherwise. +func (p *PreferenceList) GetAutoTriggerChecks() []*AutoTriggerCheck { + if p == nil || p.AutoTriggerChecks == nil { + return nil + } + return p.AutoTriggerChecks +} + +// GetDiscountAmount returns the DiscountAmount field. +func (p *PremiumRequestUsageItem) GetDiscountAmount() float64 { + if p == nil { + return 0 + } + return p.DiscountAmount +} + +// GetDiscountQuantity returns the DiscountQuantity field. +func (p *PremiumRequestUsageItem) GetDiscountQuantity() float64 { + if p == nil { + return 0 + } + return p.DiscountQuantity +} + +// GetGrossAmount returns the GrossAmount field. +func (p *PremiumRequestUsageItem) GetGrossAmount() float64 { + if p == nil { + return 0 + } + return p.GrossAmount +} + +// GetGrossQuantity returns the GrossQuantity field. +func (p *PremiumRequestUsageItem) GetGrossQuantity() float64 { + if p == nil { + return 0 + } + return p.GrossQuantity +} + +// GetModel returns the Model field. +func (p *PremiumRequestUsageItem) GetModel() string { + if p == nil { + return "" + } + return p.Model +} + +// GetNetAmount returns the NetAmount field. +func (p *PremiumRequestUsageItem) GetNetAmount() float64 { + if p == nil { + return 0 + } + return p.NetAmount +} + +// GetNetQuantity returns the NetQuantity field. +func (p *PremiumRequestUsageItem) GetNetQuantity() float64 { + if p == nil { + return 0 + } + return p.NetQuantity +} + +// GetPricePerUnit returns the PricePerUnit field. +func (p *PremiumRequestUsageItem) GetPricePerUnit() float64 { + if p == nil { + return 0 + } + return p.PricePerUnit +} + +// GetProduct returns the Product field. +func (p *PremiumRequestUsageItem) GetProduct() string { + if p == nil { + return "" + } + return p.Product +} + +// GetSKU returns the SKU field. +func (p *PremiumRequestUsageItem) GetSKU() string { + if p == nil { + return "" + } + return p.SKU +} + +// GetUnitType returns the UnitType field. +func (p *PremiumRequestUsageItem) GetUnitType() string { + if p == nil { + return "" + } + return p.UnitType +} + +// GetModel returns the Model field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageReport) GetModel() string { + if p == nil || p.Model == nil { + return "" + } + return *p.Model +} + +// GetOrganization returns the Organization field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageReport) GetOrganization() string { + if p == nil || p.Organization == nil { + return "" + } + return *p.Organization +} + +// GetProduct returns the Product field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageReport) GetProduct() string { + if p == nil || p.Product == nil { + return "" + } + return *p.Product +} + +// GetTimePeriod returns the TimePeriod field. +func (p *PremiumRequestUsageReport) GetTimePeriod() PremiumRequestUsageTimePeriod { + if p == nil { + return PremiumRequestUsageTimePeriod{} + } + return p.TimePeriod +} + +// GetUsageItems returns the UsageItems slice if it's non-nil, nil otherwise. +func (p *PremiumRequestUsageReport) GetUsageItems() []*PremiumRequestUsageItem { + if p == nil || p.UsageItems == nil { + return nil + } + return p.UsageItems +} + +// GetUser returns the User field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageReport) GetUser() string { + if p == nil || p.User == nil { + return "" + } + return *p.User +} + +// GetDay returns the Day field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageReportOptions) GetDay() int { + if p == nil || p.Day == nil { + return 0 + } + return *p.Day +} + +// GetModel returns the Model field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageReportOptions) GetModel() string { + if p == nil || p.Model == nil { + return "" + } + return *p.Model +} + +// GetMonth returns the Month field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageReportOptions) GetMonth() int { + if p == nil || p.Month == nil { + return 0 + } + return *p.Month +} + +// GetProduct returns the Product field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageReportOptions) GetProduct() string { + if p == nil || p.Product == nil { + return "" + } + return *p.Product +} + +// GetUser returns the User field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageReportOptions) GetUser() string { + if p == nil || p.User == nil { + return "" + } + return *p.User +} + +// GetYear returns the Year field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageReportOptions) GetYear() int { + if p == nil || p.Year == nil { + return 0 + } + return *p.Year +} + +// GetDay returns the Day field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageTimePeriod) GetDay() int { + if p == nil || p.Day == nil { + return 0 + } + return *p.Day +} + +// GetMonth returns the Month field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageTimePeriod) GetMonth() int { + if p == nil || p.Month == nil { + return 0 + } + return *p.Month +} + +// GetYear returns the Year field. +func (p *PremiumRequestUsageTimePeriod) GetYear() int { + if p == nil { + return 0 + } + return p.Year +} + // GetConfigURL returns the ConfigURL field if it's non-nil, zero value otherwise. func (p *PreReceiveHook) GetConfigURL() string { if p == nil || p.ConfigURL == nil { @@ -17862,6 +27358,182 @@ func (p *PreReceiveHook) GetName() string { return *p.Name } +// GetConfigurations returns the Configurations slice if it's non-nil, nil otherwise. +func (p *PrivateRegistries) GetConfigurations() []*PrivateRegistry { + if p == nil || p.Configurations == nil { + return nil + } + return p.Configurations +} + +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (p *PrivateRegistries) GetTotalCount() int { + if p == nil || p.TotalCount == nil { + return 0 + } + return *p.TotalCount +} + +// GetAccountID returns the AccountID field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetAccountID() string { + if p == nil || p.AccountID == nil { + return "" + } + return *p.AccountID +} + +// GetAudience returns the Audience field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetAudience() string { + if p == nil || p.Audience == nil { + return "" + } + return *p.Audience +} + +// GetAuthType returns the AuthType field. +func (p *PrivateRegistry) GetAuthType() *PrivateRegistryAuthType { + if p == nil { + return nil + } + return p.AuthType +} + +// GetAWSRegion returns the AWSRegion field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetAWSRegion() string { + if p == nil || p.AWSRegion == nil { + return "" + } + return *p.AWSRegion +} + +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetClientID() string { + if p == nil || p.ClientID == nil { + return "" + } + return *p.ClientID +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetCreatedAt() Timestamp { + if p == nil || p.CreatedAt == nil { + return Timestamp{} + } + return *p.CreatedAt +} + +// GetDomain returns the Domain field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetDomain() string { + if p == nil || p.Domain == nil { + return "" + } + return *p.Domain +} + +// GetDomainOwner returns the DomainOwner field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetDomainOwner() string { + if p == nil || p.DomainOwner == nil { + return "" + } + return *p.DomainOwner +} + +// GetIdentityMappingName returns the IdentityMappingName field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetIdentityMappingName() string { + if p == nil || p.IdentityMappingName == nil { + return "" + } + return *p.IdentityMappingName +} + +// GetJFrogOIDCProviderName returns the JFrogOIDCProviderName field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetJFrogOIDCProviderName() string { + if p == nil || p.JFrogOIDCProviderName == nil { + return "" + } + return *p.JFrogOIDCProviderName +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetName() string { + if p == nil || p.Name == nil { + return "" + } + return *p.Name +} + +// GetRegistryType returns the RegistryType field. +func (p *PrivateRegistry) GetRegistryType() *PrivateRegistryType { + if p == nil { + return nil + } + return p.RegistryType +} + +// GetReplacesBase returns the ReplacesBase field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetReplacesBase() bool { + if p == nil || p.ReplacesBase == nil { + return false + } + return *p.ReplacesBase +} + +// GetRoleName returns the RoleName field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetRoleName() string { + if p == nil || p.RoleName == nil { + return "" + } + return *p.RoleName +} + +// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs slice if it's non-nil, nil otherwise. +func (p *PrivateRegistry) GetSelectedRepositoryIDs() []int64 { + if p == nil || p.SelectedRepositoryIDs == nil { + return nil + } + return p.SelectedRepositoryIDs +} + +// GetTenantID returns the TenantID field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetTenantID() string { + if p == nil || p.TenantID == nil { + return "" + } + return *p.TenantID +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetUpdatedAt() Timestamp { + if p == nil || p.UpdatedAt == nil { + return Timestamp{} + } + return *p.UpdatedAt +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetURL() string { + if p == nil || p.URL == nil { + return "" + } + return *p.URL +} + +// GetUsername returns the Username field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetUsername() string { + if p == nil || p.Username == nil { + return "" + } + return *p.Username +} + +// GetVisibility returns the Visibility field. +func (p *PrivateRegistry) GetVisibility() *PrivateRegistryVisibility { + if p == nil { + return nil + } + return p.Visibility +} + // GetHRef returns the HRef field if it's non-nil, zero value otherwise. func (p *PRLink) GetHRef() string { if p == nil || p.HRef == nil { @@ -18078,6 +27750,22 @@ func (p *ProjectV2) GetID() int64 { return *p.ID } +// GetIsTemplate returns the IsTemplate field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetIsTemplate() bool { + if p == nil || p.IsTemplate == nil { + return false + } + return *p.IsTemplate +} + +// GetLatestStatusUpdate returns the LatestStatusUpdate field. +func (p *ProjectV2) GetLatestStatusUpdate() *ProjectV2StatusUpdate { + if p == nil { + return nil + } + return p.LatestStatusUpdate +} + // GetName returns the Name field if it's non-nil, zero value otherwise. func (p *ProjectV2) GetName() string { if p == nil || p.Name == nil { @@ -18182,6 +27870,62 @@ func (p *ProjectV2) GetURL() string { return *p.URL } +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (p *ProjectV2DraftIssue) GetBody() string { + if p == nil || p.Body == nil { + return "" + } + return *p.Body +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (p *ProjectV2DraftIssue) GetCreatedAt() Timestamp { + if p == nil || p.CreatedAt == nil { + return Timestamp{} + } + return *p.CreatedAt +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *ProjectV2DraftIssue) GetID() int64 { + if p == nil || p.ID == nil { + return 0 + } + return *p.ID +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (p *ProjectV2DraftIssue) GetNodeID() string { + if p == nil || p.NodeID == nil { + return "" + } + return *p.NodeID +} + +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (p *ProjectV2DraftIssue) GetTitle() string { + if p == nil || p.Title == nil { + return "" + } + return *p.Title +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (p *ProjectV2DraftIssue) GetUpdatedAt() Timestamp { + if p == nil || p.UpdatedAt == nil { + return Timestamp{} + } + return *p.UpdatedAt +} + +// GetUser returns the User field. +func (p *ProjectV2DraftIssue) GetUser() *User { + if p == nil { + return nil + } + return p.User +} + // GetAction returns the Action field if it's non-nil, zero value otherwise. func (p *ProjectV2Event) GetAction() string { if p == nil || p.Action == nil { @@ -18222,6 +27966,166 @@ func (p *ProjectV2Event) GetSender() *User { return p.Sender } +// GetConfiguration returns the Configuration field. +func (p *ProjectV2Field) GetConfiguration() *ProjectV2FieldConfiguration { + if p == nil { + return nil + } + return p.Configuration +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (p *ProjectV2Field) GetCreatedAt() Timestamp { + if p == nil || p.CreatedAt == nil { + return Timestamp{} + } + return *p.CreatedAt +} + +// GetDataType returns the DataType field if it's non-nil, zero value otherwise. +func (p *ProjectV2Field) GetDataType() string { + if p == nil || p.DataType == nil { + return "" + } + return *p.DataType +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *ProjectV2Field) GetID() int64 { + if p == nil || p.ID == nil { + return 0 + } + return *p.ID +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (p *ProjectV2Field) GetName() string { + if p == nil || p.Name == nil { + return "" + } + return *p.Name +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (p *ProjectV2Field) GetNodeID() string { + if p == nil || p.NodeID == nil { + return "" + } + return *p.NodeID +} + +// GetOptions returns the Options slice if it's non-nil, nil otherwise. +func (p *ProjectV2Field) GetOptions() []*ProjectV2FieldOption { + if p == nil || p.Options == nil { + return nil + } + return p.Options +} + +// GetProjectURL returns the ProjectURL field if it's non-nil, zero value otherwise. +func (p *ProjectV2Field) GetProjectURL() string { + if p == nil || p.ProjectURL == nil { + return "" + } + return *p.ProjectURL +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (p *ProjectV2Field) GetUpdatedAt() Timestamp { + if p == nil || p.UpdatedAt == nil { + return Timestamp{} + } + return *p.UpdatedAt +} + +// GetDuration returns the Duration field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldConfiguration) GetDuration() int { + if p == nil || p.Duration == nil { + return 0 + } + return *p.Duration +} + +// GetIterations returns the Iterations slice if it's non-nil, nil otherwise. +func (p *ProjectV2FieldConfiguration) GetIterations() []*ProjectV2FieldIteration { + if p == nil || p.Iterations == nil { + return nil + } + return p.Iterations +} + +// GetStartDay returns the StartDay field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldConfiguration) GetStartDay() int { + if p == nil || p.StartDay == nil { + return 0 + } + return *p.StartDay +} + +// GetDuration returns the Duration field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldIteration) GetDuration() int { + if p == nil || p.Duration == nil { + return 0 + } + return *p.Duration +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldIteration) GetID() string { + if p == nil || p.ID == nil { + return "" + } + return *p.ID +} + +// GetStartDate returns the StartDate field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldIteration) GetStartDate() string { + if p == nil || p.StartDate == nil { + return "" + } + return *p.StartDate +} + +// GetTitle returns the Title field. +func (p *ProjectV2FieldIteration) GetTitle() *ProjectV2TextContent { + if p == nil { + return nil + } + return p.Title +} + +// GetColor returns the Color field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldOption) GetColor() string { + if p == nil || p.Color == nil { + return "" + } + return *p.Color +} + +// GetDescription returns the Description field. +func (p *ProjectV2FieldOption) GetDescription() *ProjectV2TextContent { + if p == nil { + return nil + } + return p.Description +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldOption) GetID() string { + if p == nil || p.ID == nil { + return "" + } + return *p.ID +} + +// GetName returns the Name field. +func (p *ProjectV2FieldOption) GetName() *ProjectV2TextContent { + if p == nil { + return nil + } + return p.Name +} + // GetArchivedAt returns the ArchivedAt field if it's non-nil, zero value otherwise. func (p *ProjectV2Item) GetArchivedAt() Timestamp { if p == nil || p.ArchivedAt == nil { @@ -18230,6 +28134,14 @@ func (p *ProjectV2Item) GetArchivedAt() Timestamp { return *p.ArchivedAt } +// GetContent returns the Content field. +func (p *ProjectV2Item) GetContent() *ProjectV2ItemContent { + if p == nil { + return nil + } + return p.Content +} + // GetContentNodeID returns the ContentNodeID field if it's non-nil, zero value otherwise. func (p *ProjectV2Item) GetContentNodeID() string { if p == nil || p.ContentNodeID == nil { @@ -18238,12 +28150,12 @@ func (p *ProjectV2Item) GetContentNodeID() string { return *p.ContentNodeID } -// GetContentType returns the ContentType field if it's non-nil, zero value otherwise. -func (p *ProjectV2Item) GetContentType() string { - if p == nil || p.ContentType == nil { - return "" +// GetContentType returns the ContentType field. +func (p *ProjectV2Item) GetContentType() *ProjectV2ItemContentType { + if p == nil { + return nil } - return *p.ContentType + return p.ContentType } // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. @@ -18262,6 +28174,14 @@ func (p *ProjectV2Item) GetCreator() *User { return p.Creator } +// GetFields returns the Fields slice if it's non-nil, nil otherwise. +func (p *ProjectV2Item) GetFields() []*ProjectV2ItemFieldValue { + if p == nil || p.Fields == nil { + return nil + } + return p.Fields +} + // GetID returns the ID field if it's non-nil, zero value otherwise. func (p *ProjectV2Item) GetID() int64 { if p == nil || p.ID == nil { @@ -18270,6 +28190,14 @@ func (p *ProjectV2Item) GetID() int64 { return *p.ID } +// GetItemURL returns the ItemURL field if it's non-nil, zero value otherwise. +func (p *ProjectV2Item) GetItemURL() string { + if p == nil || p.ItemURL == nil { + return "" + } + return *p.ItemURL +} + // GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. func (p *ProjectV2Item) GetNodeID() string { if p == nil || p.NodeID == nil { @@ -18286,6 +28214,14 @@ func (p *ProjectV2Item) GetProjectNodeID() string { return *p.ProjectNodeID } +// GetProjectURL returns the ProjectURL field if it's non-nil, zero value otherwise. +func (p *ProjectV2Item) GetProjectURL() string { + if p == nil || p.ProjectURL == nil { + return "" + } + return *p.ProjectURL +} + // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. func (p *ProjectV2Item) GetUpdatedAt() Timestamp { if p == nil || p.UpdatedAt == nil { @@ -18302,6 +28238,38 @@ func (p *ProjectV2ItemChange) GetArchivedAt() *ArchivedAt { return p.ArchivedAt } +// GetFieldValue returns the FieldValue field. +func (p *ProjectV2ItemChange) GetFieldValue() *FieldValue { + if p == nil { + return nil + } + return p.FieldValue +} + +// GetDraftIssue returns the DraftIssue field. +func (p *ProjectV2ItemContent) GetDraftIssue() *ProjectV2DraftIssue { + if p == nil { + return nil + } + return p.DraftIssue +} + +// GetIssue returns the Issue field. +func (p *ProjectV2ItemContent) GetIssue() *Issue { + if p == nil { + return nil + } + return p.Issue +} + +// GetPullRequest returns the PullRequest field. +func (p *ProjectV2ItemContent) GetPullRequest() *PullRequest { + if p == nil { + return nil + } + return p.PullRequest +} + // GetAction returns the Action field if it's non-nil, zero value otherwise. func (p *ProjectV2ItemEvent) GetAction() string { if p == nil || p.Action == nil { @@ -18350,6 +28318,134 @@ func (p *ProjectV2ItemEvent) GetSender() *User { return p.Sender } +// GetDataType returns the DataType field if it's non-nil, zero value otherwise. +func (p *ProjectV2ItemFieldValue) GetDataType() string { + if p == nil || p.DataType == nil { + return "" + } + return *p.DataType +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *ProjectV2ItemFieldValue) GetID() int64 { + if p == nil || p.ID == nil { + return 0 + } + return *p.ID +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (p *ProjectV2ItemFieldValue) GetName() string { + if p == nil || p.Name == nil { + return "" + } + return *p.Name +} + +// GetValue returns the Value field. +func (p *ProjectV2ItemFieldValue) GetValue() any { + if p == nil { + return nil + } + return p.Value +} + +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (p *ProjectV2StatusUpdate) GetBody() string { + if p == nil || p.Body == nil { + return "" + } + return *p.Body +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (p *ProjectV2StatusUpdate) GetCreatedAt() Timestamp { + if p == nil || p.CreatedAt == nil { + return Timestamp{} + } + return *p.CreatedAt +} + +// GetCreator returns the Creator field. +func (p *ProjectV2StatusUpdate) GetCreator() *User { + if p == nil { + return nil + } + return p.Creator +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *ProjectV2StatusUpdate) GetID() int64 { + if p == nil || p.ID == nil { + return 0 + } + return *p.ID +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (p *ProjectV2StatusUpdate) GetNodeID() string { + if p == nil || p.NodeID == nil { + return "" + } + return *p.NodeID +} + +// GetProjectNodeID returns the ProjectNodeID field if it's non-nil, zero value otherwise. +func (p *ProjectV2StatusUpdate) GetProjectNodeID() string { + if p == nil || p.ProjectNodeID == nil { + return "" + } + return *p.ProjectNodeID +} + +// GetStartDate returns the StartDate field if it's non-nil, zero value otherwise. +func (p *ProjectV2StatusUpdate) GetStartDate() string { + if p == nil || p.StartDate == nil { + return "" + } + return *p.StartDate +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (p *ProjectV2StatusUpdate) GetStatus() string { + if p == nil || p.Status == nil { + return "" + } + return *p.Status +} + +// GetTargetDate returns the TargetDate field if it's non-nil, zero value otherwise. +func (p *ProjectV2StatusUpdate) GetTargetDate() string { + if p == nil || p.TargetDate == nil { + return "" + } + return *p.TargetDate +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (p *ProjectV2StatusUpdate) GetUpdatedAt() Timestamp { + if p == nil || p.UpdatedAt == nil { + return Timestamp{} + } + return *p.UpdatedAt +} + +// GetHTML returns the HTML field if it's non-nil, zero value otherwise. +func (p *ProjectV2TextContent) GetHTML() string { + if p == nil || p.HTML == nil { + return "" + } + return *p.HTML +} + +// GetRaw returns the Raw field if it's non-nil, zero value otherwise. +func (p *ProjectV2TextContent) GetRaw() string { + if p == nil || p.Raw == nil { + return "" + } + return *p.Raw +} + // GetAllowDeletions returns the AllowDeletions field. func (p *Protection) GetAllowDeletions() *AllowDeletions { if p == nil { @@ -18566,6 +28662,14 @@ func (p *ProtectionChanges) GetRequiredStatusChecksEnforcementLevel() *RequiredS return p.RequiredStatusChecksEnforcementLevel } +// GetRequireLastPushApproval returns the RequireLastPushApproval field. +func (p *ProtectionChanges) GetRequireLastPushApproval() *RequireLastPushApprovalChanges { + if p == nil { + return nil + } + return p.RequireLastPushApproval +} + // GetSignatureRequirementEnforcementLevel returns the SignatureRequirementEnforcementLevel field. func (p *ProtectionChanges) GetSignatureRequirementEnforcementLevel() *SignatureRequirementEnforcementLevelChanges { if p == nil { @@ -18606,6 +28710,14 @@ func (p *ProtectionRequest) GetBlockCreations() bool { return *p.BlockCreations } +// GetEnforceAdmins returns the EnforceAdmins field. +func (p *ProtectionRequest) GetEnforceAdmins() bool { + if p == nil { + return false + } + return p.EnforceAdmins +} + // GetLockBranch returns the LockBranch field if it's non-nil, zero value otherwise. func (p *ProtectionRequest) GetLockBranch() bool { if p == nil || p.LockBranch == nil { @@ -18678,6 +28790,14 @@ func (p *ProtectionRule) GetPreventSelfReview() bool { return *p.PreventSelfReview } +// GetReviewers returns the Reviewers slice if it's non-nil, nil otherwise. +func (p *ProtectionRule) GetReviewers() []*RequiredReviewer { + if p == nil || p.Reviewers == nil { + return nil + } + return p.Reviewers +} + // GetType returns the Type field if it's non-nil, zero value otherwise. func (p *ProtectionRule) GetType() string { if p == nil || p.Type == nil { @@ -18726,6 +28846,22 @@ func (p *PublicEvent) GetSender() *User { return p.Sender } +// GetCurrentUsage returns the CurrentUsage field. +func (p *PublicIPUsage) GetCurrentUsage() int64 { + if p == nil { + return 0 + } + return p.CurrentUsage +} + +// GetMaximum returns the Maximum field. +func (p *PublicIPUsage) GetMaximum() int64 { + if p == nil { + return 0 + } + return p.Maximum +} + // GetKey returns the Key field if it's non-nil, zero value otherwise. func (p *PublicKey) GetKey() string { if p == nil || p.Key == nil { @@ -18742,6 +28878,22 @@ func (p *PublicKey) GetKeyID() string { return *p.KeyID } +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (p *PublishCodespaceOptions) GetName() string { + if p == nil || p.Name == nil { + return "" + } + return *p.Name +} + +// GetPrivate returns the Private field if it's non-nil, zero value otherwise. +func (p *PublishCodespaceOptions) GetPrivate() bool { + if p == nil || p.Private == nil { + return false + } + return *p.Private +} + // GetActiveLockReason returns the ActiveLockReason field if it's non-nil, zero value otherwise. func (p *PullRequest) GetActiveLockReason() string { if p == nil || p.ActiveLockReason == nil { @@ -18766,6 +28918,14 @@ func (p *PullRequest) GetAssignee() *User { return p.Assignee } +// GetAssignees returns the Assignees slice if it's non-nil, nil otherwise. +func (p *PullRequest) GetAssignees() []*User { + if p == nil || p.Assignees == nil { + return nil + } + return p.Assignees +} + // GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise. func (p *PullRequest) GetAuthorAssociation() string { if p == nil || p.AuthorAssociation == nil { @@ -18910,6 +29070,14 @@ func (p *PullRequest) GetIssueURL() string { return *p.IssueURL } +// GetLabels returns the Labels slice if it's non-nil, nil otherwise. +func (p *PullRequest) GetLabels() []*Label { + if p == nil || p.Labels == nil { + return nil + } + return p.Labels +} + // GetLinks returns the Links field. func (p *PullRequest) GetLinks() *PRLinks { if p == nil { @@ -19022,6 +29190,22 @@ func (p *PullRequest) GetRebaseable() bool { return *p.Rebaseable } +// GetRequestedReviewers returns the RequestedReviewers slice if it's non-nil, nil otherwise. +func (p *PullRequest) GetRequestedReviewers() []*User { + if p == nil || p.RequestedReviewers == nil { + return nil + } + return p.RequestedReviewers +} + +// GetRequestedTeams returns the RequestedTeams slice if it's non-nil, nil otherwise. +func (p *PullRequest) GetRequestedTeams() []*Team { + if p == nil || p.RequestedTeams == nil { + return nil + } + return p.RequestedTeams +} + // GetReviewComments returns the ReviewComments field if it's non-nil, zero value otherwise. func (p *PullRequest) GetReviewComments() int { if p == nil || p.ReviewComments == nil { @@ -19166,6 +29350,14 @@ func (p *PullRequestBranch) GetUser() *User { return p.User } +// GetParameters returns the Parameters field. +func (p *PullRequestBranchRule) GetParameters() PullRequestRuleParameters { + if p == nil { + return PullRequestRuleParameters{} + } + return p.Parameters +} + // GetExpectedHeadSHA returns the ExpectedHeadSHA field if it's non-nil, zero value otherwise. func (p *PullRequestBranchUpdateOptions) GetExpectedHeadSHA() string { if p == nil || p.ExpectedHeadSHA == nil { @@ -19486,6 +29678,14 @@ func (p *PullRequestEvent) GetPullRequest() *PullRequest { return p.PullRequest } +// GetReason returns the Reason field if it's non-nil, zero value otherwise. +func (p *PullRequestEvent) GetReason() string { + if p == nil || p.Reason == nil { + return "" + } + return *p.Reason +} + // GetRepo returns the Repo field. func (p *PullRequestEvent) GetRepo() *Repository { if p == nil { @@ -19558,6 +29758,70 @@ func (p *PullRequestLinks) GetURL() string { return *p.URL } +// GetDirection returns the Direction field. +func (p *PullRequestListCommentsOptions) GetDirection() string { + if p == nil { + return "" + } + return p.Direction +} + +// GetSince returns the Since field. +func (p *PullRequestListCommentsOptions) GetSince() time.Time { + if p == nil { + return time.Time{} + } + return p.Since +} + +// GetSort returns the Sort field. +func (p *PullRequestListCommentsOptions) GetSort() string { + if p == nil { + return "" + } + return p.Sort +} + +// GetBase returns the Base field. +func (p *PullRequestListOptions) GetBase() string { + if p == nil { + return "" + } + return p.Base +} + +// GetDirection returns the Direction field. +func (p *PullRequestListOptions) GetDirection() string { + if p == nil { + return "" + } + return p.Direction +} + +// GetHead returns the Head field. +func (p *PullRequestListOptions) GetHead() string { + if p == nil { + return "" + } + return p.Head +} + +// GetSort returns the Sort field. +func (p *PullRequestListOptions) GetSort() string { + if p == nil { + return "" + } + return p.Sort +} + +// GetState returns the State field. +func (p *PullRequestListOptions) GetState() string { + if p == nil { + return "" + } + return p.State +} + // GetMerged returns the Merged field if it's non-nil, zero value otherwise. func (p *PullRequestMergeResult) GetMerged() bool { if p == nil || p.Merged == nil { @@ -19582,6 +29846,38 @@ func (p *PullRequestMergeResult) GetSHA() string { return *p.SHA } +// GetCommitTitle returns the CommitTitle field. +func (p *PullRequestOptions) GetCommitTitle() string { + if p == nil { + return "" + } + return p.CommitTitle +} + +// GetDontDefaultIfBlank returns the DontDefaultIfBlank field. +func (p *PullRequestOptions) GetDontDefaultIfBlank() bool { + if p == nil { + return false + } + return p.DontDefaultIfBlank +} + +// GetMergeMethod returns the MergeMethod field. +func (p *PullRequestOptions) GetMergeMethod() string { + if p == nil { + return "" + } + return p.MergeMethod +} + +// GetSHA returns the SHA field. +func (p *PullRequestOptions) GetSHA() string { + if p == nil { + return "" + } + return p.SHA +} + // GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise. func (p *PullRequestReview) GetAuthorAssociation() string { if p == nil || p.AuthorAssociation == nil { @@ -19798,6 +30094,14 @@ func (p *PullRequestReviewRequest) GetBody() string { return *p.Body } +// GetComments returns the Comments slice if it's non-nil, nil otherwise. +func (p *PullRequestReviewRequest) GetComments() []*DraftReviewComment { + if p == nil || p.Comments == nil { + return nil + } + return p.Comments +} + // GetCommitID returns the CommitID field if it's non-nil, zero value otherwise. func (p *PullRequestReviewRequest) GetCommitID() string { if p == nil || p.CommitID == nil { @@ -19838,6 +30142,38 @@ func (p *PullRequestReviewsEnforcement) GetDismissalRestrictions() *DismissalRes return p.DismissalRestrictions } +// GetDismissStaleReviews returns the DismissStaleReviews field. +func (p *PullRequestReviewsEnforcement) GetDismissStaleReviews() bool { + if p == nil { + return false + } + return p.DismissStaleReviews +} + +// GetRequireCodeOwnerReviews returns the RequireCodeOwnerReviews field. +func (p *PullRequestReviewsEnforcement) GetRequireCodeOwnerReviews() bool { + if p == nil { + return false + } + return p.RequireCodeOwnerReviews +} + +// GetRequiredApprovingReviewCount returns the RequiredApprovingReviewCount field. +func (p *PullRequestReviewsEnforcement) GetRequiredApprovingReviewCount() int { + if p == nil { + return 0 + } + return p.RequiredApprovingReviewCount +} + +// GetRequireLastPushApproval returns the RequireLastPushApproval field. +func (p *PullRequestReviewsEnforcement) GetRequireLastPushApproval() bool { + if p == nil { + return false + } + return p.RequireLastPushApproval +} + // GetFrom returns the From field if it's non-nil, zero value otherwise. func (p *PullRequestReviewsEnforcementLevelChanges) GetFrom() string { if p == nil || p.From == nil { @@ -19862,6 +30198,30 @@ func (p *PullRequestReviewsEnforcementRequest) GetDismissalRestrictionsRequest() return p.DismissalRestrictionsRequest } +// GetDismissStaleReviews returns the DismissStaleReviews field. +func (p *PullRequestReviewsEnforcementRequest) GetDismissStaleReviews() bool { + if p == nil { + return false + } + return p.DismissStaleReviews +} + +// GetRequireCodeOwnerReviews returns the RequireCodeOwnerReviews field. +func (p *PullRequestReviewsEnforcementRequest) GetRequireCodeOwnerReviews() bool { + if p == nil { + return false + } + return p.RequireCodeOwnerReviews +} + +// GetRequiredApprovingReviewCount returns the RequiredApprovingReviewCount field. +func (p *PullRequestReviewsEnforcementRequest) GetRequiredApprovingReviewCount() int { + if p == nil { + return 0 + } + return p.RequiredApprovingReviewCount +} + // GetRequireLastPushApproval returns the RequireLastPushApproval field if it's non-nil, zero value otherwise. func (p *PullRequestReviewsEnforcementRequest) GetRequireLastPushApproval() bool { if p == nil || p.RequireLastPushApproval == nil { @@ -19902,6 +30262,14 @@ func (p *PullRequestReviewsEnforcementUpdate) GetRequireCodeOwnerReviews() bool return *p.RequireCodeOwnerReviews } +// GetRequiredApprovingReviewCount returns the RequiredApprovingReviewCount field. +func (p *PullRequestReviewsEnforcementUpdate) GetRequiredApprovingReviewCount() int { + if p == nil { + return 0 + } + return p.RequiredApprovingReviewCount +} + // GetRequireLastPushApproval returns the RequireLastPushApproval field if it's non-nil, zero value otherwise. func (p *PullRequestReviewsEnforcementUpdate) GetRequireLastPushApproval() bool { if p == nil || p.RequireLastPushApproval == nil { @@ -19966,12 +30334,60 @@ func (p *PullRequestReviewThreadEvent) GetThread() *PullRequestThread { return p.Thread } -// GetAutomaticCopilotCodeReviewEnabled returns the AutomaticCopilotCodeReviewEnabled field if it's non-nil, zero value otherwise. -func (p *PullRequestRuleParameters) GetAutomaticCopilotCodeReviewEnabled() bool { - if p == nil || p.AutomaticCopilotCodeReviewEnabled == nil { +// GetAllowedMergeMethods returns the AllowedMergeMethods slice if it's non-nil, nil otherwise. +func (p *PullRequestRuleParameters) GetAllowedMergeMethods() []PullRequestMergeMethod { + if p == nil || p.AllowedMergeMethods == nil { + return nil + } + return p.AllowedMergeMethods +} + +// GetDismissStaleReviewsOnPush returns the DismissStaleReviewsOnPush field. +func (p *PullRequestRuleParameters) GetDismissStaleReviewsOnPush() bool { + if p == nil { + return false + } + return p.DismissStaleReviewsOnPush +} + +// GetRequireCodeOwnerReview returns the RequireCodeOwnerReview field. +func (p *PullRequestRuleParameters) GetRequireCodeOwnerReview() bool { + if p == nil { return false } - return *p.AutomaticCopilotCodeReviewEnabled + return p.RequireCodeOwnerReview +} + +// GetRequiredApprovingReviewCount returns the RequiredApprovingReviewCount field. +func (p *PullRequestRuleParameters) GetRequiredApprovingReviewCount() int { + if p == nil { + return 0 + } + return p.RequiredApprovingReviewCount +} + +// GetRequiredReviewers returns the RequiredReviewers slice if it's non-nil, nil otherwise. +func (p *PullRequestRuleParameters) GetRequiredReviewers() []*RulesetRequiredReviewer { + if p == nil || p.RequiredReviewers == nil { + return nil + } + return p.RequiredReviewers +} + +// GetRequiredReviewThreadResolution returns the RequiredReviewThreadResolution field. +func (p *PullRequestRuleParameters) GetRequiredReviewThreadResolution() bool { + if p == nil { + return false + } + return p.RequiredReviewThreadResolution +} + +// GetRequireLastPushApproval returns the RequireLastPushApproval field. +func (p *PullRequestRuleParameters) GetRequireLastPushApproval() bool { + if p == nil { + return false + } + return p.RequireLastPushApproval } // GetAction returns the Action field if it's non-nil, zero value otherwise. @@ -20094,6 +30510,14 @@ func (p *PullRequestTargetEvent) GetSender() *User { return p.Sender } +// GetComments returns the Comments slice if it's non-nil, nil otherwise. +func (p *PullRequestThread) GetComments() []*PullRequestComment { + if p == nil || p.Comments == nil { + return nil + } + return p.Comments +} + // GetID returns the ID field if it's non-nil, zero value otherwise. func (p *PullRequestThread) GetID() int64 { if p == nil || p.ID == nil { @@ -20614,6 +31038,14 @@ func (p *PushEventRepository) GetSVNURL() string { return *p.SVNURL } +// GetTopics returns the Topics slice if it's non-nil, nil otherwise. +func (p *PushEventRepository) GetTopics() []string { + if p == nil || p.Topics == nil { + return nil + } + return p.Topics +} + // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. func (p *PushEventRepository) GetUpdatedAt() Timestamp { if p == nil || p.UpdatedAt == nil { @@ -20638,6 +31070,102 @@ func (p *PushEventRepository) GetWatchersCount() int { return *p.WatchersCount } +// GetExpireAt returns the ExpireAt field if it's non-nil, zero value otherwise. +func (p *PushProtectionBypass) GetExpireAt() Timestamp { + if p == nil || p.ExpireAt == nil { + return Timestamp{} + } + return *p.ExpireAt +} + +// GetReason returns the Reason field. +func (p *PushProtectionBypass) GetReason() string { + if p == nil { + return "" + } + return p.Reason +} + +// GetTokenType returns the TokenType field. +func (p *PushProtectionBypass) GetTokenType() string { + if p == nil { + return "" + } + return p.TokenType +} + +// GetPlaceholderID returns the PlaceholderID field. +func (p *PushProtectionBypassRequest) GetPlaceholderID() string { + if p == nil { + return "" + } + return p.PlaceholderID +} + +// GetReason returns the Reason field. +func (p *PushProtectionBypassRequest) GetReason() string { + if p == nil { + return "" + } + return p.Reason +} + +// GetLimit returns the Limit field. +func (r *Rate) GetLimit() int { + if r == nil { + return 0 + } + return r.Limit +} + +// GetRemaining returns the Remaining field. +func (r *Rate) GetRemaining() int { + if r == nil { + return 0 + } + return r.Remaining +} + +// GetReset returns the Reset field. +func (r *Rate) GetReset() Timestamp { + if r == nil { + return Timestamp{} + } + return r.Reset +} + +// GetResource returns the Resource field. +func (r *Rate) GetResource() string { + if r == nil { + return "" + } + return r.Resource +} + +// GetUsed returns the Used field. +func (r *Rate) GetUsed() int { + if r == nil { + return 0 + } + return r.Used +} + +// GetMessage returns the Message field. +func (r *RateLimitError) GetMessage() string { + if r == nil { + return "" + } + return r.Message +} + +// GetRate returns the Rate field. +func (r *RateLimitError) GetRate() Rate { + if r == nil { + return Rate{} + } + return r.Rate +} + // GetActionsRunnerRegistration returns the ActionsRunnerRegistration field. func (r *RateLimits) GetActionsRunnerRegistration() *Rate { if r == nil { @@ -20678,6 +31206,14 @@ func (r *RateLimits) GetCore() *Rate { return r.Core } +// GetDependencySBOM returns the DependencySBOM field. +func (r *RateLimits) GetDependencySBOM() *Rate { + if r == nil { + return nil + } + return r.DependencySBOM +} + // GetDependencySnapshots returns the DependencySnapshots field. func (r *RateLimits) GetDependencySnapshots() *Rate { if r == nil { @@ -20726,6 +31262,14 @@ func (r *RateLimits) GetSourceImport() *Rate { return r.SourceImport } +// GetType returns the Type field. +func (r *RawOptions) GetType() RawType { + if r == nil { + return 0 + } + return r.Type +} + // GetContent returns the Content field if it's non-nil, zero value otherwise. func (r *Reaction) GetContent() string { if r == nil || r.Content == nil { @@ -20846,6 +31390,38 @@ func (r *Reactions) GetURL() string { return *r.URL } +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (r *ReassignedResource) GetName() string { + if r == nil || r.Name == nil { + return "" + } + return *r.Name +} + +// GetPreviousCostCenter returns the PreviousCostCenter field if it's non-nil, zero value otherwise. +func (r *ReassignedResource) GetPreviousCostCenter() string { + if r == nil || r.PreviousCostCenter == nil { + return "" + } + return *r.PreviousCostCenter +} + +// GetResourceType returns the ResourceType field if it's non-nil, zero value otherwise. +func (r *ReassignedResource) GetResourceType() string { + if r == nil || r.ResourceType == nil { + return "" + } + return *r.ResourceType +} + +// GetStatusCode returns the StatusCode field. +func (r *RedirectionError) GetStatusCode() int { + if r == nil { + return 0 + } + return r.StatusCode +} + // GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. func (r *Reference) GetNodeID() string { if r == nil || r.NodeID == nil { @@ -20998,6 +31574,14 @@ func (r *ReleaseAsset) GetCreatedAt() Timestamp { return *r.CreatedAt } +// GetDigest returns the Digest field if it's non-nil, zero value otherwise. +func (r *ReleaseAsset) GetDigest() string { + if r == nil || r.Digest == nil { + return "" + } + return *r.Digest +} + // GetDownloadCount returns the DownloadCount field if it's non-nil, zero value otherwise. func (r *ReleaseAsset) GetDownloadCount() int { if r == nil || r.DownloadCount == nil { @@ -21158,6 +31742,14 @@ func (r *ReleaseVersion) GetVersion() string { return *r.Version } +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (r *RemoveResourcesFromCostCenterResponse) GetMessage() string { + if r == nil || r.Message == nil { + return "" + } + return *r.Message +} + // GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. func (r *RemoveToken) GetExpiresAt() Timestamp { if r == nil || r.ExpiresAt == nil { @@ -21246,6 +31838,38 @@ func (r *RepoAdvisoryCreditDetailed) GetUser() *User { return r.User } +// GetProperties returns the Properties slice if it's non-nil, nil otherwise. +func (r *RepoCustomPropertyValue) GetProperties() []*CustomPropertyValue { + if r == nil || r.Properties == nil { + return nil + } + return r.Properties +} + +// GetRepositoryFullName returns the RepositoryFullName field. +func (r *RepoCustomPropertyValue) GetRepositoryFullName() string { + if r == nil { + return "" + } + return r.RepositoryFullName +} + +// GetRepositoryID returns the RepositoryID field. +func (r *RepoCustomPropertyValue) GetRepositoryID() int64 { + if r == nil { + return 0 + } + return r.RepositoryID +} + +// GetRepositoryName returns the RepositoryName field. +func (r *RepoCustomPropertyValue) GetRepositoryName() string { + if r == nil { + return "" + } + return r.RepositoryName +} + // GetDownloadLocation returns the DownloadLocation field if it's non-nil, zero value otherwise. func (r *RepoDependencies) GetDownloadLocation() string { if r == nil || r.DownloadLocation == nil { @@ -21254,6 +31878,14 @@ func (r *RepoDependencies) GetDownloadLocation() string { return *r.DownloadLocation } +// GetExternalRefs returns the ExternalRefs slice if it's non-nil, nil otherwise. +func (r *RepoDependencies) GetExternalRefs() []*PackageExternalRef { + if r == nil || r.ExternalRefs == nil { + return nil + } + return r.ExternalRefs +} + // GetFilesAnalyzed returns the FilesAnalyzed field if it's non-nil, zero value otherwise. func (r *RepoDependencies) GetFilesAnalyzed() bool { if r == nil || r.FilesAnalyzed == nil { @@ -21302,6 +31934,38 @@ func (r *RepoDependencies) GetVersionInfo() string { return *r.VersionInfo } +// GetDescription returns the Description field. +func (r *RepoFineGrainedPermission) GetDescription() string { + if r == nil { + return "" + } + return r.Description +} + +// GetName returns the Name field. +func (r *RepoFineGrainedPermission) GetName() string { + if r == nil { + return "" + } + return r.Name +} + +// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. +func (r *RepoImmutableReleasesStatus) GetEnabled() bool { + if r == nil || r.Enabled == nil { + return false + } + return *r.Enabled +} + +// GetEnforcedByOwner returns the EnforcedByOwner field if it's non-nil, zero value otherwise. +func (r *RepoImmutableReleasesStatus) GetEnforcedByOwner() bool { + if r == nil || r.EnforcedByOwner == nil { + return false + } + return *r.EnforcedByOwner +} + // GetBranch returns the Branch field if it's non-nil, zero value otherwise. func (r *RepoMergeUpstreamRequest) GetBranch() string { if r == nil || r.Branch == nil { @@ -21350,6 +32014,14 @@ func (r *RepositoriesSearchResult) GetIncompleteResults() bool { return *r.IncompleteResults } +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (r *RepositoriesSearchResult) GetRepositories() []*Repository { + if r == nil || r.Repositories == nil { + return nil + } + return r.Repositories +} + // GetTotal returns the Total field if it's non-nil, zero value otherwise. func (r *RepositoriesSearchResult) GetTotal() int { if r == nil || r.Total == nil { @@ -21942,10 +32614,10 @@ func (r *Repository) GetParent() *Repository { return r.Parent } -// GetPermissions returns the Permissions map if it's non-nil, an empty map otherwise. -func (r *Repository) GetPermissions() map[string]bool { - if r == nil || r.Permissions == nil { - return map[string]bool{} +// GetPermissions returns the Permissions field. +func (r *Repository) GetPermissions() *RepositoryPermissions { + if r == nil { + return nil } return r.Permissions } @@ -22126,6 +32798,22 @@ func (r *Repository) GetTemplateRepository() *Repository { return r.TemplateRepository } +// GetTextMatches returns the TextMatches slice if it's non-nil, nil otherwise. +func (r *Repository) GetTextMatches() []*TextMatch { + if r == nil || r.TextMatches == nil { + return nil + } + return r.TextMatches +} + +// GetTopics returns the Topics slice if it's non-nil, nil otherwise. +func (r *Repository) GetTopics() []string { + if r == nil || r.Topics == nil { + return nil + } + return r.Topics +} + // GetTreesURL returns the TreesURL field if it's non-nil, zero value otherwise. func (r *Repository) GetTreesURL() string { if r == nil || r.TreesURL == nil { @@ -22198,20 +32886,268 @@ func (r *RepositoryActionsAccessLevel) GetAccessLevel() string { return *r.AccessLevel } -// GetAdvancedSecurityCommitters returns the AdvancedSecurityCommitters field if it's non-nil, zero value otherwise. +// GetAdvancedSecurityCommitters returns the AdvancedSecurityCommitters field. func (r *RepositoryActiveCommitters) GetAdvancedSecurityCommitters() int { - if r == nil || r.AdvancedSecurityCommitters == nil { + if r == nil { return 0 } - return *r.AdvancedSecurityCommitters + return r.AdvancedSecurityCommitters } -// GetName returns the Name field if it's non-nil, zero value otherwise. +// GetAdvancedSecurityCommittersBreakdown returns the AdvancedSecurityCommittersBreakdown slice if it's non-nil, nil otherwise. +func (r *RepositoryActiveCommitters) GetAdvancedSecurityCommittersBreakdown() []*AdvancedSecurityCommittersBreakdown { + if r == nil || r.AdvancedSecurityCommittersBreakdown == nil { + return nil + } + return r.AdvancedSecurityCommittersBreakdown +} + +// GetName returns the Name field. func (r *RepositoryActiveCommitters) GetName() string { - if r == nil || r.Name == nil { + if r == nil { return "" } - return *r.Name + return r.Name +} + +// GetActivityType returns the ActivityType field. +func (r *RepositoryActivity) GetActivityType() string { + if r == nil { + return "" + } + return r.ActivityType +} + +// GetActor returns the Actor field. +func (r *RepositoryActivity) GetActor() *RepositoryActor { + if r == nil { + return nil + } + return r.Actor +} + +// GetAfter returns the After field. +func (r *RepositoryActivity) GetAfter() string { + if r == nil { + return "" + } + return r.After +} + +// GetBefore returns the Before field. +func (r *RepositoryActivity) GetBefore() string { + if r == nil { + return "" + } + return r.Before +} + +// GetID returns the ID field. +func (r *RepositoryActivity) GetID() int64 { + if r == nil { + return 0 + } + return r.ID +} + +// GetNodeID returns the NodeID field. +func (r *RepositoryActivity) GetNodeID() string { + if r == nil { + return "" + } + return r.NodeID +} + +// GetRef returns the Ref field. +func (r *RepositoryActivity) GetRef() string { + if r == nil { + return "" + } + return r.Ref +} + +// GetTimestamp returns the Timestamp field if it's non-nil, zero value otherwise. +func (r *RepositoryActivity) GetTimestamp() Timestamp { + if r == nil || r.Timestamp == nil { + return Timestamp{} + } + return *r.Timestamp +} + +// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetAvatarURL() string { + if r == nil || r.AvatarURL == nil { + return "" + } + return *r.AvatarURL +} + +// GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetEventsURL() string { + if r == nil || r.EventsURL == nil { + return "" + } + return *r.EventsURL +} + +// GetFollowersURL returns the FollowersURL field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetFollowersURL() string { + if r == nil || r.FollowersURL == nil { + return "" + } + return *r.FollowersURL +} + +// GetFollowingURL returns the FollowingURL field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetFollowingURL() string { + if r == nil || r.FollowingURL == nil { + return "" + } + return *r.FollowingURL +} + +// GetGistsURL returns the GistsURL field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetGistsURL() string { + if r == nil || r.GistsURL == nil { + return "" + } + return *r.GistsURL +} + +// GetGravatarID returns the GravatarID field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetGravatarID() string { + if r == nil || r.GravatarID == nil { + return "" + } + return *r.GravatarID +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetHTMLURL() string { + if r == nil || r.HTMLURL == nil { + return "" + } + return *r.HTMLURL +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetID() int64 { + if r == nil || r.ID == nil { + return 0 + } + return *r.ID +} + +// GetLogin returns the Login field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetLogin() string { + if r == nil || r.Login == nil { + return "" + } + return *r.Login +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetNodeID() string { + if r == nil || r.NodeID == nil { + return "" + } + return *r.NodeID +} + +// GetOrganizationsURL returns the OrganizationsURL field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetOrganizationsURL() string { + if r == nil || r.OrganizationsURL == nil { + return "" + } + return *r.OrganizationsURL +} + +// GetReceivedEventsURL returns the ReceivedEventsURL field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetReceivedEventsURL() string { + if r == nil || r.ReceivedEventsURL == nil { + return "" + } + return *r.ReceivedEventsURL +} + +// GetReposURL returns the ReposURL field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetReposURL() string { + if r == nil || r.ReposURL == nil { + return "" + } + return *r.ReposURL +} + +// GetSiteAdmin returns the SiteAdmin field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetSiteAdmin() bool { + if r == nil || r.SiteAdmin == nil { + return false + } + return *r.SiteAdmin +} + +// GetStarredURL returns the StarredURL field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetStarredURL() string { + if r == nil || r.StarredURL == nil { + return "" + } + return *r.StarredURL +} + +// GetSubscriptionsURL returns the SubscriptionsURL field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetSubscriptionsURL() string { + if r == nil || r.SubscriptionsURL == nil { + return "" + } + return *r.SubscriptionsURL +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetType() string { + if r == nil || r.Type == nil { + return "" + } + return *r.Type +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetURL() string { + if r == nil || r.URL == nil { + return "" + } + return *r.URL +} + +// GetUserViewType returns the UserViewType field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetUserViewType() string { + if r == nil || r.UserViewType == nil { + return "" + } + return *r.UserViewType +} + +// GetPermission returns the Permission field. +func (r *RepositoryAddCollaboratorOptions) GetPermission() string { + if r == nil { + return "" + } + return r.Permission +} + +// GetRepository returns the Repository field. +func (r *RepositoryAttachment) GetRepository() *Repository { + if r == nil { + return nil + } + return r.Repository +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (r *RepositoryAttachment) GetStatus() string { + if r == nil || r.Status == nil { + return "" + } + return *r.Status } // GetConfiguration returns the Configuration field. @@ -22358,6 +33294,14 @@ func (r *RepositoryCommit) GetCommitter() *User { return r.Committer } +// GetFiles returns the Files slice if it's non-nil, nil otherwise. +func (r *RepositoryCommit) GetFiles() []*CommitFile { + if r == nil || r.Files == nil { + return nil + } + return r.Files +} + // GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. func (r *RepositoryCommit) GetHTMLURL() string { if r == nil || r.HTMLURL == nil { @@ -22374,6 +33318,14 @@ func (r *RepositoryCommit) GetNodeID() string { return *r.NodeID } +// GetParents returns the Parents slice if it's non-nil, nil otherwise. +func (r *RepositoryCommit) GetParents() []*Commit { + if r == nil || r.Parents == nil { + return nil + } + return r.Parents +} + // GetSHA returns the SHA field if it's non-nil, zero value otherwise. func (r *RepositoryCommit) GetSHA() string { if r == nil || r.SHA == nil { @@ -22518,6 +33470,14 @@ func (r *RepositoryContentFileOptions) GetCommitter() *CommitAuthor { return r.Committer } +// GetContent returns the Content slice if it's non-nil, nil otherwise. +func (r *RepositoryContentFileOptions) GetContent() []byte { + if r == nil || r.Content == nil { + return nil + } + return r.Content +} + // GetMessage returns the Message field if it's non-nil, zero value otherwise. func (r *RepositoryContentFileOptions) GetMessage() string { if r == nil || r.Message == nil { @@ -22534,6 +33494,14 @@ func (r *RepositoryContentFileOptions) GetSHA() string { return *r.SHA } +// GetRef returns the Ref field. +func (r *RepositoryContentGetOptions) GetRef() string { + if r == nil { + return "" + } + return r.Ref +} + // GetContent returns the Content field. func (r *RepositoryContentResponse) GetContent() *RepositoryContent { if r == nil { @@ -22542,6 +33510,30 @@ func (r *RepositoryContentResponse) GetContent() *RepositoryContent { return r.Content } +// GetDefaultBranchOnly returns the DefaultBranchOnly field. +func (r *RepositoryCreateForkOptions) GetDefaultBranchOnly() bool { + if r == nil { + return false + } + return r.DefaultBranchOnly +} + +// GetName returns the Name field. +func (r *RepositoryCreateForkOptions) GetName() string { + if r == nil { + return "" + } + return r.Name +} + +// GetOrganization returns the Organization field. +func (r *RepositoryCreateForkOptions) GetOrganization() string { + if r == nil { + return "" + } + return r.Organization +} + // GetAction returns the Action field if it's non-nil, zero value otherwise. func (r *RepositoryDispatchEvent) GetAction() string { if r == nil || r.Action == nil { @@ -22558,6 +33550,14 @@ func (r *RepositoryDispatchEvent) GetBranch() string { return *r.Branch } +// GetClientPayload returns the ClientPayload field. +func (r *RepositoryDispatchEvent) GetClientPayload() json.RawMessage { + if r == nil { + return json.RawMessage{} + } + return r.ClientPayload +} + // GetInstallation returns the Installation field. func (r *RepositoryDispatchEvent) GetInstallation() *Installation { if r == nil { @@ -22838,6 +33838,150 @@ func (r *RepositoryLicense) GetURL() string { return *r.URL } +// GetSince returns the Since field. +func (r *RepositoryListAllOptions) GetSince() int64 { + if r == nil { + return 0 + } + return r.Since +} + +// GetAffiliation returns the Affiliation field. +func (r *RepositoryListByAuthenticatedUserOptions) GetAffiliation() string { + if r == nil { + return "" + } + return r.Affiliation +} + +// GetDirection returns the Direction field. +func (r *RepositoryListByAuthenticatedUserOptions) GetDirection() string { + if r == nil { + return "" + } + return r.Direction +} + +// GetSort returns the Sort field. +func (r *RepositoryListByAuthenticatedUserOptions) GetSort() string { + if r == nil { + return "" + } + return r.Sort +} + +// GetType returns the Type field. +func (r *RepositoryListByAuthenticatedUserOptions) GetType() string { + if r == nil { + return "" + } + return r.Type +} + +// GetVisibility returns the Visibility field. +func (r *RepositoryListByAuthenticatedUserOptions) GetVisibility() string { + if r == nil { + return "" + } + return r.Visibility +} + +// GetDirection returns the Direction field. +func (r *RepositoryListByOrgOptions) GetDirection() string { + if r == nil { + return "" + } + return r.Direction +} + +// GetSort returns the Sort field. +func (r *RepositoryListByOrgOptions) GetSort() string { + if r == nil { + return "" + } + return r.Sort +} + +// GetType returns the Type field. +func (r *RepositoryListByOrgOptions) GetType() string { + if r == nil { + return "" + } + return r.Type +} + +// GetDirection returns the Direction field. +func (r *RepositoryListByUserOptions) GetDirection() string { + if r == nil { + return "" + } + return r.Direction +} + +// GetSort returns the Sort field. +func (r *RepositoryListByUserOptions) GetSort() string { + if r == nil { + return "" + } + return r.Sort +} + +// GetType returns the Type field. +func (r *RepositoryListByUserOptions) GetType() string { + if r == nil { + return "" + } + return r.Type +} + +// GetSort returns the Sort field. +func (r *RepositoryListForksOptions) GetSort() string { + if r == nil { + return "" + } + return r.Sort +} + +// GetAffiliation returns the Affiliation field. +func (r *RepositoryListOptions) GetAffiliation() string { + if r == nil { + return "" + } + return r.Affiliation +} + +// GetDirection returns the Direction field. +func (r *RepositoryListOptions) GetDirection() string { + if r == nil { + return "" + } + return r.Direction +} + +// GetSort returns the Sort field. +func (r *RepositoryListOptions) GetSort() string { + if r == nil { + return "" + } + return r.Sort +} + +// GetType returns the Type field. +func (r *RepositoryListOptions) GetType() string { + if r == nil { + return "" + } + return r.Type +} + +// GetVisibility returns the Visibility field. +func (r *RepositoryListOptions) GetVisibility() string { + if r == nil { + return "" + } + return r.Visibility +} + // GetIncludesParents returns the IncludesParents field if it's non-nil, zero value otherwise. func (r *RepositoryListRulesetsOptions) GetIncludesParents() bool { if r == nil || r.IncludesParents == nil { @@ -22870,6 +34014,22 @@ func (r *RepositoryMergeRequest) GetHead() string { return *r.Head } +// GetAll returns the All slice if it's non-nil, nil otherwise. +func (r *RepositoryParticipation) GetAll() []int { + if r == nil || r.All == nil { + return nil + } + return r.All +} + +// GetOwner returns the Owner slice if it's non-nil, nil otherwise. +func (r *RepositoryParticipation) GetOwner() []int { + if r == nil || r.Owner == nil { + return nil + } + return r.Owner +} + // GetPermission returns the Permission field if it's non-nil, zero value otherwise. func (r *RepositoryPermissionLevel) GetPermission() string { if r == nil || r.Permission == nil { @@ -22894,6 +34054,54 @@ func (r *RepositoryPermissionLevel) GetUser() *User { return r.User } +// GetAdmin returns the Admin field if it's non-nil, zero value otherwise. +func (r *RepositoryPermissions) GetAdmin() bool { + if r == nil || r.Admin == nil { + return false + } + return *r.Admin +} + +// GetMaintain returns the Maintain field if it's non-nil, zero value otherwise. +func (r *RepositoryPermissions) GetMaintain() bool { + if r == nil || r.Maintain == nil { + return false + } + return *r.Maintain +} + +// GetPull returns the Pull field if it's non-nil, zero value otherwise. +func (r *RepositoryPermissions) GetPull() bool { + if r == nil || r.Pull == nil { + return false + } + return *r.Pull +} + +// GetPush returns the Push field if it's non-nil, zero value otherwise. +func (r *RepositoryPermissions) GetPush() bool { + if r == nil || r.Push == nil { + return false + } + return *r.Push +} + +// GetTriage returns the Triage field if it's non-nil, zero value otherwise. +func (r *RepositoryPermissions) GetTriage() bool { + if r == nil || r.Triage == nil { + return false + } + return *r.Triage +} + +// GetAssets returns the Assets slice if it's non-nil, nil otherwise. +func (r *RepositoryRelease) GetAssets() []*ReleaseAsset { + if r == nil || r.Assets == nil { + return nil + } + return r.Assets +} + // GetAssetsURL returns the AssetsURL field if it's non-nil, zero value otherwise. func (r *RepositoryRelease) GetAssetsURL() string { if r == nil || r.AssetsURL == nil { @@ -22966,6 +34174,14 @@ func (r *RepositoryRelease) GetID() int64 { return *r.ID } +// GetImmutable returns the Immutable field if it's non-nil, zero value otherwise. +func (r *RepositoryRelease) GetImmutable() bool { + if r == nil || r.Immutable == nil { + return false + } + return *r.Immutable +} + // GetMakeLatest returns the MakeLatest field if it's non-nil, zero value otherwise. func (r *RepositoryRelease) GetMakeLatest() string { if r == nil || r.MakeLatest == nil { @@ -23054,6 +34270,46 @@ func (r *RepositoryRelease) GetZipballURL() string { return *r.ZipballURL } +// GetBody returns the Body field. +func (r *RepositoryReleaseNotes) GetBody() string { + if r == nil { + return "" + } + return r.Body +} + +// GetName returns the Name field. +func (r *RepositoryReleaseNotes) GetName() string { + if r == nil { + return "" + } + return r.Name +} + +// GetParameters returns the Parameters field. +func (r *RepositoryRule) GetParameters() any { + if r == nil { + return nil + } + return r.Parameters +} + +// GetType returns the Type field. +func (r *RepositoryRule) GetType() RepositoryRuleType { + if r == nil { + return "" + } + return r.Type +} + +// GetBypassActors returns the BypassActors slice if it's non-nil, nil otherwise. +func (r *RepositoryRuleset) GetBypassActors() []*BypassActor { + if r == nil || r.BypassActors == nil { + return nil + } + return r.BypassActors +} + // GetConditions returns the Conditions field. func (r *RepositoryRuleset) GetConditions() *RepositoryRulesetConditions { if r == nil { @@ -23078,6 +34334,14 @@ func (r *RepositoryRuleset) GetCurrentUserCanBypass() *BypassMode { return r.CurrentUserCanBypass } +// GetEnforcement returns the Enforcement field. +func (r *RepositoryRuleset) GetEnforcement() RulesetEnforcement { + if r == nil { + return "" + } + return r.Enforcement +} + // GetID returns the ID field if it's non-nil, zero value otherwise. func (r *RepositoryRuleset) GetID() int64 { if r == nil || r.ID == nil { @@ -23094,6 +34358,14 @@ func (r *RepositoryRuleset) GetLinks() *RepositoryRulesetLinks { return r.Links } +// GetName returns the Name field. +func (r *RepositoryRuleset) GetName() string { + if r == nil { + return "" + } + return r.Name +} + // GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. func (r *RepositoryRuleset) GetNodeID() string { if r == nil || r.NodeID == nil { @@ -23110,6 +34382,14 @@ func (r *RepositoryRuleset) GetRules() *RepositoryRulesetRules { return r.Rules } +// GetSource returns the Source field. +func (r *RepositoryRuleset) GetSource() string { + if r == nil { + return "" + } + return r.Source +} + // GetSourceType returns the SourceType field. func (r *RepositoryRuleset) GetSourceType() *RulesetSourceType { if r == nil { @@ -23134,6 +34414,30 @@ func (r *RepositoryRuleset) GetUpdatedAt() Timestamp { return *r.UpdatedAt } +// GetAdded returns the Added slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetChangedConditions) GetAdded() []*RepositoryRulesetConditions { + if r == nil || r.Added == nil { + return nil + } + return r.Added +} + +// GetDeleted returns the Deleted slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetChangedConditions) GetDeleted() []*RepositoryRulesetConditions { + if r == nil || r.Deleted == nil { + return nil + } + return r.Deleted +} + +// GetUpdated returns the Updated slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetChangedConditions) GetUpdated() []*RepositoryRulesetUpdatedConditions { + if r == nil || r.Updated == nil { + return nil + } + return r.Updated +} + // GetConfiguration returns the Configuration field. func (r *RepositoryRulesetChangedRule) GetConfiguration() *RepositoryRulesetChangeSource { if r == nil { @@ -23158,6 +34462,30 @@ func (r *RepositoryRulesetChangedRule) GetRuleType() *RepositoryRulesetChangeSou return r.RuleType } +// GetAdded returns the Added slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetChangedRules) GetAdded() []*RepositoryRule { + if r == nil || r.Added == nil { + return nil + } + return r.Added +} + +// GetDeleted returns the Deleted slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetChangedRules) GetDeleted() []*RepositoryRule { + if r == nil || r.Deleted == nil { + return nil + } + return r.Deleted +} + +// GetUpdated returns the Updated slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetChangedRules) GetUpdated() []*RepositoryRulesetUpdatedRules { + if r == nil || r.Updated == nil { + return nil + } + return r.Updated +} + // GetConditions returns the Conditions field. func (r *RepositoryRulesetChanges) GetConditions() *RepositoryRulesetChangedConditions { if r == nil { @@ -23198,6 +34526,14 @@ func (r *RepositoryRulesetChangeSource) GetFrom() string { return *r.From } +// GetFrom returns the From slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetChangeSources) GetFrom() []string { + if r == nil || r.From == nil { + return nil + } + return r.From +} + // GetOrganizationID returns the OrganizationID field. func (r *RepositoryRulesetConditions) GetOrganizationID() *RepositoryRulesetOrganizationIDsConditionParameters { if r == nil { @@ -23214,6 +34550,14 @@ func (r *RepositoryRulesetConditions) GetOrganizationName() *RepositoryRulesetOr return r.OrganizationName } +// GetOrganizationProperty returns the OrganizationProperty field. +func (r *RepositoryRulesetConditions) GetOrganizationProperty() *RepositoryRulesetOrganizationPropertyConditionParameters { + if r == nil { + return nil + } + return r.OrganizationProperty +} + // GetRefName returns the RefName field. func (r *RepositoryRulesetConditions) GetRefName() *RepositoryRulesetRefConditionParameters { if r == nil { @@ -23334,6 +34678,86 @@ func (r *RepositoryRulesetLinks) GetSelf() *RepositoryRulesetLink { return r.Self } +// GetOrganizationIDs returns the OrganizationIDs slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetOrganizationIDsConditionParameters) GetOrganizationIDs() []int64 { + if r == nil || r.OrganizationIDs == nil { + return nil + } + return r.OrganizationIDs +} + +// GetExclude returns the Exclude slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetOrganizationNamesConditionParameters) GetExclude() []string { + if r == nil || r.Exclude == nil { + return nil + } + return r.Exclude +} + +// GetInclude returns the Include slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetOrganizationNamesConditionParameters) GetInclude() []string { + if r == nil || r.Include == nil { + return nil + } + return r.Include +} + +// GetExclude returns the Exclude slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetOrganizationPropertyConditionParameters) GetExclude() []*RepositoryRulesetRepositoryPropertyTargetParameters { + if r == nil || r.Exclude == nil { + return nil + } + return r.Exclude +} + +// GetInclude returns the Include slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetOrganizationPropertyConditionParameters) GetInclude() []*RepositoryRulesetRepositoryPropertyTargetParameters { + if r == nil || r.Include == nil { + return nil + } + return r.Include +} + +// GetExclude returns the Exclude slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetRefConditionParameters) GetExclude() []string { + if r == nil || r.Exclude == nil { + return nil + } + return r.Exclude +} + +// GetInclude returns the Include slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetRefConditionParameters) GetInclude() []string { + if r == nil || r.Include == nil { + return nil + } + return r.Include +} + +// GetRepositoryIDs returns the RepositoryIDs slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetRepositoryIDsConditionParameters) GetRepositoryIDs() []int64 { + if r == nil || r.RepositoryIDs == nil { + return nil + } + return r.RepositoryIDs +} + +// GetExclude returns the Exclude slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetRepositoryNamesConditionParameters) GetExclude() []string { + if r == nil || r.Exclude == nil { + return nil + } + return r.Exclude +} + +// GetInclude returns the Include slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetRepositoryNamesConditionParameters) GetInclude() []string { + if r == nil || r.Include == nil { + return nil + } + return r.Include +} + // GetProtected returns the Protected field if it's non-nil, zero value otherwise. func (r *RepositoryRulesetRepositoryNamesConditionParameters) GetProtected() bool { if r == nil || r.Protected == nil { @@ -23342,6 +34766,38 @@ func (r *RepositoryRulesetRepositoryNamesConditionParameters) GetProtected() boo return *r.Protected } +// GetExclude returns the Exclude slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetRepositoryPropertyConditionParameters) GetExclude() []*RepositoryRulesetRepositoryPropertyTargetParameters { + if r == nil || r.Exclude == nil { + return nil + } + return r.Exclude +} + +// GetInclude returns the Include slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetRepositoryPropertyConditionParameters) GetInclude() []*RepositoryRulesetRepositoryPropertyTargetParameters { + if r == nil || r.Include == nil { + return nil + } + return r.Include +} + +// GetName returns the Name field. +func (r *RepositoryRulesetRepositoryPropertyTargetParameters) GetName() string { + if r == nil { + return "" + } + return r.Name +} + +// GetPropertyValues returns the PropertyValues slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetRepositoryPropertyTargetParameters) GetPropertyValues() []string { + if r == nil || r.PropertyValues == nil { + return nil + } + return r.PropertyValues +} + // GetSource returns the Source field if it's non-nil, zero value otherwise. func (r *RepositoryRulesetRepositoryPropertyTargetParameters) GetSource() string { if r == nil || r.Source == nil { @@ -23390,6 +34846,14 @@ func (r *RepositoryRulesetRules) GetCommitterEmailPattern() *PatternRuleParamete return r.CommitterEmailPattern } +// GetCopilotCodeReview returns the CopilotCodeReview field. +func (r *RepositoryRulesetRules) GetCopilotCodeReview() *CopilotCodeReviewRuleParameters { + if r == nil { + return nil + } + return r.CopilotCodeReview +} + // GetCreation returns the Creation field. func (r *RepositoryRulesetRules) GetCreation() *EmptyRuleParameters { if r == nil { @@ -23462,6 +34926,46 @@ func (r *RepositoryRulesetRules) GetPullRequest() *PullRequestRuleParameters { return r.PullRequest } +// GetRepositoryCreate returns the RepositoryCreate field. +func (r *RepositoryRulesetRules) GetRepositoryCreate() *EmptyRuleParameters { + if r == nil { + return nil + } + return r.RepositoryCreate +} + +// GetRepositoryDelete returns the RepositoryDelete field. +func (r *RepositoryRulesetRules) GetRepositoryDelete() *EmptyRuleParameters { + if r == nil { + return nil + } + return r.RepositoryDelete +} + +// GetRepositoryName returns the RepositoryName field. +func (r *RepositoryRulesetRules) GetRepositoryName() *SimplePatternRuleParameters { + if r == nil { + return nil + } + return r.RepositoryName +} + +// GetRepositoryTransfer returns the RepositoryTransfer field. +func (r *RepositoryRulesetRules) GetRepositoryTransfer() *EmptyRuleParameters { + if r == nil { + return nil + } + return r.RepositoryTransfer +} + +// GetRepositoryVisibility returns the RepositoryVisibility field. +func (r *RepositoryRulesetRules) GetRepositoryVisibility() *RepositoryVisibilityRuleParameters { + if r == nil { + return nil + } + return r.RepositoryVisibility +} + // GetRequiredDeployments returns the RequiredDeployments field. func (r *RepositoryRulesetRules) GetRequiredDeployments() *RequiredDeploymentsRuleParameters { if r == nil { @@ -23614,6 +35118,22 @@ func (r *RepositoryTag) GetZipballURL() string { return *r.ZipballURL } +// GetInternal returns the Internal field. +func (r *RepositoryVisibilityRuleParameters) GetInternal() bool { + if r == nil { + return false + } + return r.Internal +} + +// GetPrivate returns the Private field. +func (r *RepositoryVisibilityRuleParameters) GetPrivate() bool { + if r == nil { + return false + } + return r.Private +} + // GetAffectedPackageName returns the AffectedPackageName field if it's non-nil, zero value otherwise. func (r *RepositoryVulnerabilityAlert) GetAffectedPackageName() string { if r == nil || r.AffectedPackageName == nil { @@ -23894,6 +35414,14 @@ func (r *RepoStatus) GetURL() string { return *r.URL } +// GetIdentifier returns the Identifier field. +func (r *RequestedAction) GetIdentifier() string { + if r == nil { + return "" + } + return r.Identifier +} + // GetFrom returns the From field if it's non-nil, zero value otherwise. func (r *RequireCodeOwnerReviewChanges) GetFrom() bool { if r == nil || r.From == nil { @@ -23902,6 +35430,14 @@ func (r *RequireCodeOwnerReviewChanges) GetFrom() bool { return *r.From } +// GetEnabled returns the Enabled field. +func (r *RequiredConversationResolution) GetEnabled() bool { + if r == nil { + return false + } + return r.Enabled +} + // GetFrom returns the From field if it's non-nil, zero value otherwise. func (r *RequiredConversationResolutionLevelChanges) GetFrom() string { if r == nil || r.From == nil { @@ -23910,12 +35446,36 @@ func (r *RequiredConversationResolutionLevelChanges) GetFrom() string { return *r.From } +// GetParameters returns the Parameters field. +func (r *RequiredDeploymentsBranchRule) GetParameters() RequiredDeploymentsRuleParameters { + if r == nil { + return RequiredDeploymentsRuleParameters{} + } + return r.Parameters +} + // GetFrom returns the From field if it's non-nil, zero value otherwise. func (r *RequiredDeploymentsEnforcementLevelChanges) GetFrom() string { if r == nil || r.From == nil { return "" } - return *r.From + return *r.From +} + +// GetRequiredDeploymentEnvironments returns the RequiredDeploymentEnvironments slice if it's non-nil, nil otherwise. +func (r *RequiredDeploymentsRuleParameters) GetRequiredDeploymentEnvironments() []string { + if r == nil || r.RequiredDeploymentEnvironments == nil { + return nil + } + return r.RequiredDeploymentEnvironments +} + +// GetReviewer returns the Reviewer field. +func (r *RequiredReviewer) GetReviewer() any { + if r == nil { + return nil + } + return r.Reviewer } // GetType returns the Type field if it's non-nil, zero value otherwise. @@ -23934,6 +35494,14 @@ func (r *RequiredStatusCheck) GetAppID() int64 { return *r.AppID } +// GetContext returns the Context field. +func (r *RequiredStatusCheck) GetContext() string { + if r == nil { + return "" + } + return r.Context +} + // GetChecks returns the Checks field if it's non-nil, zero value otherwise. func (r *RequiredStatusChecks) GetChecks() []*RequiredStatusCheck { if r == nil || r.Checks == nil { @@ -23958,6 +35526,14 @@ func (r *RequiredStatusChecks) GetContextsURL() string { return *r.ContextsURL } +// GetStrict returns the Strict field. +func (r *RequiredStatusChecks) GetStrict() bool { + if r == nil { + return false + } + return r.Strict +} + // GetURL returns the URL field if it's non-nil, zero value otherwise. func (r *RequiredStatusChecks) GetURL() string { if r == nil || r.URL == nil { @@ -23966,6 +35542,22 @@ func (r *RequiredStatusChecks) GetURL() string { return *r.URL } +// GetParameters returns the Parameters field. +func (r *RequiredStatusChecksBranchRule) GetParameters() RequiredStatusChecksRuleParameters { + if r == nil { + return RequiredStatusChecksRuleParameters{} + } + return r.Parameters +} + +// GetFrom returns the From slice if it's non-nil, nil otherwise. +func (r *RequiredStatusChecksChanges) GetFrom() []string { + if r == nil || r.From == nil { + return nil + } + return r.From +} + // GetFrom returns the From field if it's non-nil, zero value otherwise. func (r *RequiredStatusChecksEnforcementLevelChanges) GetFrom() string { if r == nil || r.From == nil { @@ -23974,6 +35566,22 @@ func (r *RequiredStatusChecksEnforcementLevelChanges) GetFrom() string { return *r.From } +// GetChecks returns the Checks slice if it's non-nil, nil otherwise. +func (r *RequiredStatusChecksRequest) GetChecks() []*RequiredStatusCheck { + if r == nil || r.Checks == nil { + return nil + } + return r.Checks +} + +// GetContexts returns the Contexts slice if it's non-nil, nil otherwise. +func (r *RequiredStatusChecksRequest) GetContexts() []string { + if r == nil || r.Contexts == nil { + return nil + } + return r.Contexts +} + // GetStrict returns the Strict field if it's non-nil, zero value otherwise. func (r *RequiredStatusChecksRequest) GetStrict() bool { if r == nil || r.Strict == nil { @@ -23990,6 +35598,158 @@ func (r *RequiredStatusChecksRuleParameters) GetDoNotEnforceOnCreate() bool { return *r.DoNotEnforceOnCreate } +// GetRequiredStatusChecks returns the RequiredStatusChecks slice if it's non-nil, nil otherwise. +func (r *RequiredStatusChecksRuleParameters) GetRequiredStatusChecks() []*RuleStatusCheck { + if r == nil || r.RequiredStatusChecks == nil { + return nil + } + return r.RequiredStatusChecks +} + +// GetStrictRequiredStatusChecksPolicy returns the StrictRequiredStatusChecksPolicy field. +func (r *RequiredStatusChecksRuleParameters) GetStrictRequiredStatusChecksPolicy() bool { + if r == nil { + return false + } + return r.StrictRequiredStatusChecksPolicy +} + +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (r *RequireLastPushApprovalChanges) GetFrom() bool { + if r == nil || r.From == nil { + return false + } + return *r.From +} + +// GetEnabled returns the Enabled field. +func (r *RequireLinearHistory) GetEnabled() bool { + if r == nil { + return false + } + return r.Enabled +} + +// GetAfter returns the After field. +func (r *Response) GetAfter() string { + if r == nil { + return "" + } + return r.After +} + +// GetBefore returns the Before field. +func (r *Response) GetBefore() string { + if r == nil { + return "" + } + return r.Before +} + +// GetCursor returns the Cursor field. +func (r *Response) GetCursor() string { + if r == nil { + return "" + } + return r.Cursor +} + +// GetFirstPage returns the FirstPage field. +func (r *Response) GetFirstPage() int { + if r == nil { + return 0 + } + return r.FirstPage +} + +// GetLastPage returns the LastPage field. +func (r *Response) GetLastPage() int { + if r == nil { + return 0 + } + return r.LastPage +} + +// GetNextPage returns the NextPage field. +func (r *Response) GetNextPage() int { + if r == nil { + return 0 + } + return r.NextPage +} + +// GetNextPageToken returns the NextPageToken field. +func (r *Response) GetNextPageToken() string { + if r == nil { + return "" + } + return r.NextPageToken +} + +// GetPrevPage returns the PrevPage field. +func (r *Response) GetPrevPage() int { + if r == nil { + return 0 + } + return r.PrevPage +} + +// GetRate returns the Rate field. +func (r *Response) GetRate() Rate { + if r == nil { + return Rate{} + } + return r.Rate +} + +// GetTokenExpiration returns the TokenExpiration field. +func (r *Response) GetTokenExpiration() Timestamp { + if r == nil { + return Timestamp{} + } + return r.TokenExpiration +} + +// GetComment returns the Comment field. +func (r *ReviewCustomDeploymentProtectionRuleRequest) GetComment() string { + if r == nil { + return "" + } + return r.Comment +} + +// GetEnvironmentName returns the EnvironmentName field. +func (r *ReviewCustomDeploymentProtectionRuleRequest) GetEnvironmentName() string { + if r == nil { + return "" + } + return r.EnvironmentName +} + +// GetState returns the State field. +func (r *ReviewCustomDeploymentProtectionRuleRequest) GetState() string { + if r == nil { + return "" + } + return r.State +} + +// GetTeams returns the Teams slice if it's non-nil, nil otherwise. +func (r *Reviewers) GetTeams() []*Team { + if r == nil || r.Teams == nil { + return nil + } + return r.Teams +} + +// GetUsers returns the Users slice if it's non-nil, nil otherwise. +func (r *Reviewers) GetUsers() []*User { + if r == nil || r.Users == nil { + return nil + } + return r.Users +} + // GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. func (r *ReviewersRequest) GetNodeID() string { if r == nil || r.NodeID == nil { @@ -23998,6 +35758,30 @@ func (r *ReviewersRequest) GetNodeID() string { return *r.NodeID } +// GetReviewers returns the Reviewers slice if it's non-nil, nil otherwise. +func (r *ReviewersRequest) GetReviewers() []string { + if r == nil || r.Reviewers == nil { + return nil + } + return r.Reviewers +} + +// GetTeamReviewers returns the TeamReviewers slice if it's non-nil, nil otherwise. +func (r *ReviewersRequest) GetTeamReviewers() []string { + if r == nil || r.TeamReviewers == nil { + return nil + } + return r.TeamReviewers +} + +// GetAction returns the Action field. +func (r *ReviewPersonalAccessTokenRequestOptions) GetAction() string { + if r == nil { + return "" + } + return r.Action +} + // GetReason returns the Reason field if it's non-nil, zero value otherwise. func (r *ReviewPersonalAccessTokenRequestOptions) GetReason() string { if r == nil || r.Reason == nil { @@ -24062,6 +35846,86 @@ func (r *Rule) GetSeverity() string { return *r.Severity } +// GetTags returns the Tags slice if it's non-nil, nil otherwise. +func (r *Rule) GetTags() []string { + if r == nil || r.Tags == nil { + return nil + } + return r.Tags +} + +// GetAlertsThreshold returns the AlertsThreshold field. +func (r *RuleCodeScanningTool) GetAlertsThreshold() CodeScanningAlertsThreshold { + if r == nil { + return "" + } + return r.AlertsThreshold +} + +// GetSecurityAlertsThreshold returns the SecurityAlertsThreshold field. +func (r *RuleCodeScanningTool) GetSecurityAlertsThreshold() CodeScanningSecurityAlertsThreshold { + if r == nil { + return "" + } + return r.SecurityAlertsThreshold +} + +// GetTool returns the Tool field. +func (r *RuleCodeScanningTool) GetTool() string { + if r == nil { + return "" + } + return r.Tool +} + +// GetFilePatterns returns the FilePatterns slice if it's non-nil, nil otherwise. +func (r *RulesetRequiredReviewer) GetFilePatterns() []string { + if r == nil || r.FilePatterns == nil { + return nil + } + return r.FilePatterns +} + +// GetMinimumApprovals returns the MinimumApprovals field if it's non-nil, zero value otherwise. +func (r *RulesetRequiredReviewer) GetMinimumApprovals() int { + if r == nil || r.MinimumApprovals == nil { + return 0 + } + return *r.MinimumApprovals +} + +// GetReviewer returns the Reviewer field. +func (r *RulesetRequiredReviewer) GetReviewer() *RulesetReviewer { + if r == nil { + return nil + } + return r.Reviewer +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (r *RulesetReviewer) GetID() int64 { + if r == nil || r.ID == nil { + return 0 + } + return *r.ID +} + +// GetType returns the Type field. +func (r *RulesetReviewer) GetType() *RulesetReviewerType { + if r == nil { + return nil + } + return r.Type +} + +// GetContext returns the Context field. +func (r *RuleStatusCheck) GetContext() string { + if r == nil { + return "" + } + return r.Context +} + // GetIntegrationID returns the IntegrationID field if it's non-nil, zero value otherwise. func (r *RuleStatusCheck) GetIntegrationID() int64 { if r == nil || r.IntegrationID == nil { @@ -24070,6 +35934,14 @@ func (r *RuleStatusCheck) GetIntegrationID() int64 { return *r.IntegrationID } +// GetPath returns the Path field. +func (r *RuleWorkflow) GetPath() string { + if r == nil { + return "" + } + return r.Path +} + // GetRef returns the Ref field if it's non-nil, zero value otherwise. func (r *RuleWorkflow) GetRef() string { if r == nil || r.Ref == nil { @@ -24110,6 +35982,14 @@ func (r *Runner) GetID() int64 { return *r.ID } +// GetLabels returns the Labels slice if it's non-nil, nil otherwise. +func (r *Runner) GetLabels() []*RunnerLabels { + if r == nil || r.Labels == nil { + return nil + } + return r.Labels +} + // GetName returns the Name field if it's non-nil, zero value otherwise. func (r *Runner) GetName() string { if r == nil || r.Name == nil { @@ -24198,6 +36078,14 @@ func (r *RunnerGroup) GetDefault() bool { return *r.Default } +// GetHostedRunnersURL returns the HostedRunnersURL field if it's non-nil, zero value otherwise. +func (r *RunnerGroup) GetHostedRunnersURL() string { + if r == nil || r.HostedRunnersURL == nil { + return "" + } + return *r.HostedRunnersURL +} + // GetID returns the ID field if it's non-nil, zero value otherwise. func (r *RunnerGroup) GetID() int64 { if r == nil || r.ID == nil { @@ -24222,6 +36110,14 @@ func (r *RunnerGroup) GetName() string { return *r.Name } +// GetNetworkConfigurationID returns the NetworkConfigurationID field if it's non-nil, zero value otherwise. +func (r *RunnerGroup) GetNetworkConfigurationID() string { + if r == nil || r.NetworkConfigurationID == nil { + return "" + } + return *r.NetworkConfigurationID +} + // GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. func (r *RunnerGroup) GetRestrictedToWorkflows() bool { if r == nil || r.RestrictedToWorkflows == nil { @@ -24246,6 +36142,14 @@ func (r *RunnerGroup) GetSelectedRepositoriesURL() string { return *r.SelectedRepositoriesURL } +// GetSelectedWorkflows returns the SelectedWorkflows slice if it's non-nil, nil otherwise. +func (r *RunnerGroup) GetSelectedWorkflows() []string { + if r == nil || r.SelectedWorkflows == nil { + return nil + } + return r.SelectedWorkflows +} + // GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. func (r *RunnerGroup) GetVisibility() string { if r == nil || r.Visibility == nil { @@ -24262,6 +36166,22 @@ func (r *RunnerGroup) GetWorkflowRestrictionsReadOnly() bool { return *r.WorkflowRestrictionsReadOnly } +// GetRunnerGroups returns the RunnerGroups slice if it's non-nil, nil otherwise. +func (r *RunnerGroups) GetRunnerGroups() []*RunnerGroup { + if r == nil || r.RunnerGroups == nil { + return nil + } + return r.RunnerGroups +} + +// GetTotalCount returns the TotalCount field. +func (r *RunnerGroups) GetTotalCount() int { + if r == nil { + return 0 + } + return r.TotalCount +} + // GetID returns the ID field if it's non-nil, zero value otherwise. func (r *RunnerLabels) GetID() int64 { if r == nil || r.ID == nil { @@ -24286,6 +36206,22 @@ func (r *RunnerLabels) GetType() string { return *r.Type } +// GetRunners returns the Runners slice if it's non-nil, nil otherwise. +func (r *Runners) GetRunners() []*Runner { + if r == nil || r.Runners == nil { + return nil + } + return r.Runners +} + +// GetTotalCount returns the TotalCount field. +func (r *Runners) GetTotalCount() int { + if r == nil { + return 0 + } + return r.TotalCount +} + // GetCheckoutURI returns the CheckoutURI field if it's non-nil, zero value otherwise. func (s *SarifAnalysis) GetCheckoutURI() string { if s == nil || s.CheckoutURI == nil { @@ -24390,6 +36326,14 @@ func (s *SBOMInfo) GetDataLicense() string { return *s.DataLicense } +// GetDocumentDescribes returns the DocumentDescribes slice if it's non-nil, nil otherwise. +func (s *SBOMInfo) GetDocumentDescribes() []string { + if s == nil || s.DocumentDescribes == nil { + return nil + } + return s.DocumentDescribes +} + // GetDocumentNamespace returns the DocumentNamespace field if it's non-nil, zero value otherwise. func (s *SBOMInfo) GetDocumentNamespace() string { if s == nil || s.DocumentNamespace == nil { @@ -24406,6 +36350,22 @@ func (s *SBOMInfo) GetName() string { return *s.Name } +// GetPackages returns the Packages slice if it's non-nil, nil otherwise. +func (s *SBOMInfo) GetPackages() []*RepoDependencies { + if s == nil || s.Packages == nil { + return nil + } + return s.Packages +} + +// GetRelationships returns the Relationships slice if it's non-nil, nil otherwise. +func (s *SBOMInfo) GetRelationships() []*SBOMRelationship { + if s == nil || s.Relationships == nil { + return nil + } + return s.Relationships +} + // GetSPDXID returns the SPDXID field if it's non-nil, zero value otherwise. func (s *SBOMInfo) GetSPDXID() string { if s == nil || s.SPDXID == nil { @@ -24422,6 +36382,30 @@ func (s *SBOMInfo) GetSPDXVersion() string { return *s.SPDXVersion } +// GetRelatedSPDXElement returns the RelatedSPDXElement field. +func (s *SBOMRelationship) GetRelatedSPDXElement() string { + if s == nil { + return "" + } + return s.RelatedSPDXElement +} + +// GetRelationshipType returns the RelationshipType field. +func (s *SBOMRelationship) GetRelationshipType() string { + if s == nil { + return "" + } + return s.RelationshipType +} + +// GetSPDXElementID returns the SPDXElementID field. +func (s *SBOMRelationship) GetSPDXElementID() string { + if s == nil { + return "" + } + return s.SPDXElementID +} + // GetAnalysisKey returns the AnalysisKey field if it's non-nil, zero value otherwise. func (s *ScanningAnalysis) GetAnalysisKey() string { if s == nil || s.AnalysisKey == nil { @@ -24542,16 +36526,72 @@ func (s *ScanningAnalysis) GetWarning() string { return *s.Warning } +// GetOperations returns the Operations slice if it's non-nil, nil otherwise. +func (s *SCIMEnterpriseAttribute) GetOperations() []*SCIMEnterpriseAttributeOperation { + if s == nil || s.Operations == nil { + return nil + } + return s.Operations +} + +// GetSchemas returns the Schemas slice if it's non-nil, nil otherwise. +func (s *SCIMEnterpriseAttribute) GetSchemas() []string { + if s == nil || s.Schemas == nil { + return nil + } + return s.Schemas +} + +// GetOp returns the Op field. +func (s *SCIMEnterpriseAttributeOperation) GetOp() string { + if s == nil { + return "" + } + return s.Op +} + +// GetPath returns the Path field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseAttributeOperation) GetPath() string { + if s == nil || s.Path == nil { + return "" + } + return *s.Path +} + +// GetValue returns the Value field. +func (s *SCIMEnterpriseAttributeOperation) GetValue() any { + if s == nil { + return nil + } + return s.Value +} + // GetDisplay returns the Display field if it's non-nil, zero value otherwise. -func (s *SCIMDisplayReference) GetDisplay() string { +func (s *SCIMEnterpriseDisplayReference) GetDisplay() string { if s == nil || s.Display == nil { return "" } return *s.Display } +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseDisplayReference) GetRef() string { + if s == nil || s.Ref == nil { + return "" + } + return *s.Ref +} + +// GetValue returns the Value field. +func (s *SCIMEnterpriseDisplayReference) GetValue() string { + if s == nil { + return "" + } + return s.Value +} + // GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. -func (s *SCIMGroupAttributes) GetDisplayName() string { +func (s *SCIMEnterpriseGroupAttributes) GetDisplayName() string { if s == nil || s.DisplayName == nil { return "" } @@ -24559,7 +36599,7 @@ func (s *SCIMGroupAttributes) GetDisplayName() string { } // GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise. -func (s *SCIMGroupAttributes) GetExternalID() string { +func (s *SCIMEnterpriseGroupAttributes) GetExternalID() string { if s == nil || s.ExternalID == nil { return "" } @@ -24567,23 +36607,79 @@ func (s *SCIMGroupAttributes) GetExternalID() string { } // GetID returns the ID field if it's non-nil, zero value otherwise. -func (s *SCIMGroupAttributes) GetID() string { +func (s *SCIMEnterpriseGroupAttributes) GetID() string { if s == nil || s.ID == nil { return "" } return *s.ID } +// GetMembers returns the Members slice if it's non-nil, nil otherwise. +func (s *SCIMEnterpriseGroupAttributes) GetMembers() []*SCIMEnterpriseDisplayReference { + if s == nil || s.Members == nil { + return nil + } + return s.Members +} + // GetMeta returns the Meta field. -func (s *SCIMGroupAttributes) GetMeta() *SCIMMeta { +func (s *SCIMEnterpriseGroupAttributes) GetMeta() *SCIMEnterpriseMeta { if s == nil { return nil } return s.Meta } +// GetSchemas returns the Schemas slice if it's non-nil, nil otherwise. +func (s *SCIMEnterpriseGroupAttributes) GetSchemas() []string { + if s == nil || s.Schemas == nil { + return nil + } + return s.Schemas +} + +// GetItemsPerPage returns the ItemsPerPage field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseGroups) GetItemsPerPage() int { + if s == nil || s.ItemsPerPage == nil { + return 0 + } + return *s.ItemsPerPage +} + +// GetResources returns the Resources slice if it's non-nil, nil otherwise. +func (s *SCIMEnterpriseGroups) GetResources() []*SCIMEnterpriseGroupAttributes { + if s == nil || s.Resources == nil { + return nil + } + return s.Resources +} + +// GetSchemas returns the Schemas slice if it's non-nil, nil otherwise. +func (s *SCIMEnterpriseGroups) GetSchemas() []string { + if s == nil || s.Schemas == nil { + return nil + } + return s.Schemas +} + +// GetStartIndex returns the StartIndex field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseGroups) GetStartIndex() int { + if s == nil || s.StartIndex == nil { + return 0 + } + return *s.StartIndex +} + +// GetTotalResults returns the TotalResults field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseGroups) GetTotalResults() int { + if s == nil || s.TotalResults == nil { + return 0 + } + return *s.TotalResults +} + // GetCreated returns the Created field if it's non-nil, zero value otherwise. -func (s *SCIMMeta) GetCreated() Timestamp { +func (s *SCIMEnterpriseMeta) GetCreated() Timestamp { if s == nil || s.Created == nil { return Timestamp{} } @@ -24591,7 +36687,7 @@ func (s *SCIMMeta) GetCreated() Timestamp { } // GetLastModified returns the LastModified field if it's non-nil, zero value otherwise. -func (s *SCIMMeta) GetLastModified() Timestamp { +func (s *SCIMEnterpriseMeta) GetLastModified() Timestamp { if s == nil || s.LastModified == nil { return Timestamp{} } @@ -24599,31 +36695,223 @@ func (s *SCIMMeta) GetLastModified() Timestamp { } // GetLocation returns the Location field if it's non-nil, zero value otherwise. -func (s *SCIMMeta) GetLocation() string { +func (s *SCIMEnterpriseMeta) GetLocation() string { if s == nil || s.Location == nil { return "" } return *s.Location } -// GetResourceType returns the ResourceType field if it's non-nil, zero value otherwise. -func (s *SCIMMeta) GetResourceType() string { - if s == nil || s.ResourceType == nil { +// GetResourceType returns the ResourceType field. +func (s *SCIMEnterpriseMeta) GetResourceType() string { + if s == nil { return "" } - return *s.ResourceType + return s.ResourceType +} + +// GetActive returns the Active field. +func (s *SCIMEnterpriseUserAttributes) GetActive() bool { + if s == nil { + return false + } + return s.Active +} + +// GetDisplayName returns the DisplayName field. +func (s *SCIMEnterpriseUserAttributes) GetDisplayName() string { + if s == nil { + return "" + } + return s.DisplayName +} + +// GetEmails returns the Emails slice if it's non-nil, nil otherwise. +func (s *SCIMEnterpriseUserAttributes) GetEmails() []*SCIMEnterpriseUserEmail { + if s == nil || s.Emails == nil { + return nil + } + return s.Emails +} + +// GetExternalID returns the ExternalID field. +func (s *SCIMEnterpriseUserAttributes) GetExternalID() string { + if s == nil { + return "" + } + return s.ExternalID +} + +// GetGroups returns the Groups slice if it's non-nil, nil otherwise. +func (s *SCIMEnterpriseUserAttributes) GetGroups() []*SCIMEnterpriseDisplayReference { + if s == nil || s.Groups == nil { + return nil + } + return s.Groups +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseUserAttributes) GetID() string { + if s == nil || s.ID == nil { + return "" + } + return *s.ID +} + +// GetMeta returns the Meta field. +func (s *SCIMEnterpriseUserAttributes) GetMeta() *SCIMEnterpriseMeta { + if s == nil { + return nil + } + return s.Meta +} + +// GetName returns the Name field. +func (s *SCIMEnterpriseUserAttributes) GetName() *SCIMEnterpriseUserName { + if s == nil { + return nil + } + return s.Name +} + +// GetRoles returns the Roles slice if it's non-nil, nil otherwise. +func (s *SCIMEnterpriseUserAttributes) GetRoles() []*SCIMEnterpriseUserRole { + if s == nil || s.Roles == nil { + return nil + } + return s.Roles +} + +// GetSchemas returns the Schemas slice if it's non-nil, nil otherwise. +func (s *SCIMEnterpriseUserAttributes) GetSchemas() []string { + if s == nil || s.Schemas == nil { + return nil + } + return s.Schemas +} + +// GetUserName returns the UserName field. +func (s *SCIMEnterpriseUserAttributes) GetUserName() string { + if s == nil { + return "" + } + return s.UserName +} + +// GetPrimary returns the Primary field. +func (s *SCIMEnterpriseUserEmail) GetPrimary() bool { + if s == nil { + return false + } + return s.Primary +} + +// GetType returns the Type field. +func (s *SCIMEnterpriseUserEmail) GetType() string { + if s == nil { + return "" + } + return s.Type +} + +// GetValue returns the Value field. +func (s *SCIMEnterpriseUserEmail) GetValue() string { + if s == nil { + return "" + } + return s.Value +} + +// GetFamilyName returns the FamilyName field. +func (s *SCIMEnterpriseUserName) GetFamilyName() string { + if s == nil { + return "" + } + return s.FamilyName +} + +// GetFormatted returns the Formatted field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseUserName) GetFormatted() string { + if s == nil || s.Formatted == nil { + return "" + } + return *s.Formatted +} + +// GetGivenName returns the GivenName field. +func (s *SCIMEnterpriseUserName) GetGivenName() string { + if s == nil { + return "" + } + return s.GivenName +} + +// GetMiddleName returns the MiddleName field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseUserName) GetMiddleName() string { + if s == nil || s.MiddleName == nil { + return "" + } + return *s.MiddleName +} + +// GetDisplay returns the Display field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseUserRole) GetDisplay() string { + if s == nil || s.Display == nil { + return "" + } + return *s.Display +} + +// GetPrimary returns the Primary field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseUserRole) GetPrimary() bool { + if s == nil || s.Primary == nil { + return false + } + return *s.Primary +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseUserRole) GetType() string { + if s == nil || s.Type == nil { + return "" + } + return *s.Type +} + +// GetValue returns the Value field. +func (s *SCIMEnterpriseUserRole) GetValue() string { + if s == nil { + return "" + } + return s.Value } // GetItemsPerPage returns the ItemsPerPage field if it's non-nil, zero value otherwise. -func (s *SCIMProvisionedGroups) GetItemsPerPage() int { +func (s *SCIMEnterpriseUsers) GetItemsPerPage() int { if s == nil || s.ItemsPerPage == nil { return 0 } return *s.ItemsPerPage } +// GetResources returns the Resources slice if it's non-nil, nil otherwise. +func (s *SCIMEnterpriseUsers) GetResources() []*SCIMEnterpriseUserAttributes { + if s == nil || s.Resources == nil { + return nil + } + return s.Resources +} + +// GetSchemas returns the Schemas slice if it's non-nil, nil otherwise. +func (s *SCIMEnterpriseUsers) GetSchemas() []string { + if s == nil || s.Schemas == nil { + return nil + } + return s.Schemas +} + // GetStartIndex returns the StartIndex field if it's non-nil, zero value otherwise. -func (s *SCIMProvisionedGroups) GetStartIndex() int { +func (s *SCIMEnterpriseUsers) GetStartIndex() int { if s == nil || s.StartIndex == nil { return 0 } @@ -24631,13 +36919,45 @@ func (s *SCIMProvisionedGroups) GetStartIndex() int { } // GetTotalResults returns the TotalResults field if it's non-nil, zero value otherwise. -func (s *SCIMProvisionedGroups) GetTotalResults() int { +func (s *SCIMEnterpriseUsers) GetTotalResults() int { if s == nil || s.TotalResults == nil { return 0 } return *s.TotalResults } +// GetCreated returns the Created field if it's non-nil, zero value otherwise. +func (s *SCIMMeta) GetCreated() Timestamp { + if s == nil || s.Created == nil { + return Timestamp{} + } + return *s.Created +} + +// GetLastModified returns the LastModified field if it's non-nil, zero value otherwise. +func (s *SCIMMeta) GetLastModified() Timestamp { + if s == nil || s.LastModified == nil { + return Timestamp{} + } + return *s.LastModified +} + +// GetLocation returns the Location field if it's non-nil, zero value otherwise. +func (s *SCIMMeta) GetLocation() string { + if s == nil || s.Location == nil { + return "" + } + return *s.Location +} + +// GetResourceType returns the ResourceType field if it's non-nil, zero value otherwise. +func (s *SCIMMeta) GetResourceType() string { + if s == nil || s.ResourceType == nil { + return "" + } + return *s.ResourceType +} + // GetItemsPerPage returns the ItemsPerPage field if it's non-nil, zero value otherwise. func (s *SCIMProvisionedIdentities) GetItemsPerPage() int { if s == nil || s.ItemsPerPage == nil { @@ -24646,6 +36966,22 @@ func (s *SCIMProvisionedIdentities) GetItemsPerPage() int { return *s.ItemsPerPage } +// GetResources returns the Resources slice if it's non-nil, nil otherwise. +func (s *SCIMProvisionedIdentities) GetResources() []*SCIMUserAttributes { + if s == nil || s.Resources == nil { + return nil + } + return s.Resources +} + +// GetSchemas returns the Schemas slice if it's non-nil, nil otherwise. +func (s *SCIMProvisionedIdentities) GetSchemas() []string { + if s == nil || s.Schemas == nil { + return nil + } + return s.Schemas +} + // GetStartIndex returns the StartIndex field if it's non-nil, zero value otherwise. func (s *SCIMProvisionedIdentities) GetStartIndex() int { if s == nil || s.StartIndex == nil { @@ -24678,6 +37014,14 @@ func (s *SCIMUserAttributes) GetDisplayName() string { return *s.DisplayName } +// GetEmails returns the Emails slice if it's non-nil, nil otherwise. +func (s *SCIMUserAttributes) GetEmails() []*SCIMUserEmail { + if s == nil || s.Emails == nil { + return nil + } + return s.Emails +} + // GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise. func (s *SCIMUserAttributes) GetExternalID() string { if s == nil || s.ExternalID == nil { @@ -24686,6 +37030,14 @@ func (s *SCIMUserAttributes) GetExternalID() string { return *s.ExternalID } +// GetGroups returns the Groups slice if it's non-nil, nil otherwise. +func (s *SCIMUserAttributes) GetGroups() []string { + if s == nil || s.Groups == nil { + return nil + } + return s.Groups +} + // GetID returns the ID field if it's non-nil, zero value otherwise. func (s *SCIMUserAttributes) GetID() string { if s == nil || s.ID == nil { @@ -24702,6 +37054,38 @@ func (s *SCIMUserAttributes) GetMeta() *SCIMMeta { return s.Meta } +// GetName returns the Name field. +func (s *SCIMUserAttributes) GetName() SCIMUserName { + if s == nil { + return SCIMUserName{} + } + return s.Name +} + +// GetRoles returns the Roles slice if it's non-nil, nil otherwise. +func (s *SCIMUserAttributes) GetRoles() []*SCIMUserRole { + if s == nil || s.Roles == nil { + return nil + } + return s.Roles +} + +// GetSchemas returns the Schemas slice if it's non-nil, nil otherwise. +func (s *SCIMUserAttributes) GetSchemas() []string { + if s == nil || s.Schemas == nil { + return nil + } + return s.Schemas +} + +// GetUserName returns the UserName field. +func (s *SCIMUserAttributes) GetUserName() string { + if s == nil { + return "" + } + return s.UserName +} + // GetPrimary returns the Primary field if it's non-nil, zero value otherwise. func (s *SCIMUserEmail) GetPrimary() bool { if s == nil || s.Primary == nil { @@ -24718,6 +37102,22 @@ func (s *SCIMUserEmail) GetType() string { return *s.Type } +// GetValue returns the Value field. +func (s *SCIMUserEmail) GetValue() string { + if s == nil { + return "" + } + return s.Value +} + +// GetFamilyName returns the FamilyName field. +func (s *SCIMUserName) GetFamilyName() string { + if s == nil { + return "" + } + return s.FamilyName +} + // GetFormatted returns the Formatted field if it's non-nil, zero value otherwise. func (s *SCIMUserName) GetFormatted() string { if s == nil || s.Formatted == nil { @@ -24726,6 +37126,150 @@ func (s *SCIMUserName) GetFormatted() string { return *s.Formatted } +// GetGivenName returns the GivenName field. +func (s *SCIMUserName) GetGivenName() string { + if s == nil { + return "" + } + return s.GivenName +} + +// GetDisplay returns the Display field if it's non-nil, zero value otherwise. +func (s *SCIMUserRole) GetDisplay() string { + if s == nil || s.Display == nil { + return "" + } + return *s.Display +} + +// GetPrimary returns the Primary field if it's non-nil, zero value otherwise. +func (s *SCIMUserRole) GetPrimary() bool { + if s == nil || s.Primary == nil { + return false + } + return *s.Primary +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (s *SCIMUserRole) GetType() string { + if s == nil || s.Type == nil { + return "" + } + return *s.Type +} + +// GetValue returns the Value field. +func (s *SCIMUserRole) GetValue() string { + if s == nil { + return "" + } + return s.Value +} + +// GetAdvancedSearch returns the AdvancedSearch field if it's non-nil, zero value otherwise. +func (s *SearchOptions) GetAdvancedSearch() bool { + if s == nil || s.AdvancedSearch == nil { + return false + } + return *s.AdvancedSearch +} + +// GetOrder returns the Order field. +func (s *SearchOptions) GetOrder() string { + if s == nil { + return "" + } + return s.Order +} + +// GetSort returns the Sort field. +func (s *SearchOptions) GetSort() string { + if s == nil { + return "" + } + return s.Sort +} + +// GetTextMatch returns the TextMatch field. +func (s *SearchOptions) GetTextMatch() bool { + if s == nil { + return false + } + return s.TextMatch +} + +// GetSeatsCreated returns the SeatsCreated field. +func (s *SeatAssignments) GetSeatsCreated() int { + if s == nil { + return 0 + } + return s.SeatsCreated +} + +// GetSeatsCancelled returns the SeatsCancelled field. +func (s *SeatCancellations) GetSeatsCancelled() int { + if s == nil { + return 0 + } + return s.SeatsCancelled +} + +// GetCreatedAt returns the CreatedAt field. +func (s *Secret) GetCreatedAt() Timestamp { + if s == nil { + return Timestamp{} + } + return s.CreatedAt +} + +// GetName returns the Name field. +func (s *Secret) GetName() string { + if s == nil { + return "" + } + return s.Name +} + +// GetSelectedRepositoriesURL returns the SelectedRepositoriesURL field. +func (s *Secret) GetSelectedRepositoriesURL() string { + if s == nil { + return "" + } + return s.SelectedRepositoriesURL +} + +// GetUpdatedAt returns the UpdatedAt field. +func (s *Secret) GetUpdatedAt() Timestamp { + if s == nil { + return Timestamp{} + } + return s.UpdatedAt +} + +// GetVisibility returns the Visibility field. +func (s *Secret) GetVisibility() string { + if s == nil { + return "" + } + return s.Visibility +} + +// GetSecrets returns the Secrets slice if it's non-nil, nil otherwise. +func (s *Secrets) GetSecrets() []*Secret { + if s == nil || s.Secrets == nil { + return nil + } + return s.Secrets +} + +// GetTotalCount returns the TotalCount field. +func (s *Secrets) GetTotalCount() int { + if s == nil { + return 0 + } + return s.TotalCount +} + // GetStatus returns the Status field if it's non-nil, zero value otherwise. func (s *SecretScanning) GetStatus() string { if s == nil || s.Status == nil { @@ -24742,6 +37286,22 @@ func (s *SecretScanningAlert) GetCreatedAt() Timestamp { return *s.CreatedAt } +// GetFirstLocationDetected returns the FirstLocationDetected field. +func (s *SecretScanningAlert) GetFirstLocationDetected() *SecretScanningAlertLocationDetails { + if s == nil { + return nil + } + return s.FirstLocationDetected +} + +// GetHasMoreLocations returns the HasMoreLocations field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetHasMoreLocations() bool { + if s == nil || s.HasMoreLocations == nil { + return false + } + return *s.HasMoreLocations +} + // GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. func (s *SecretScanningAlert) GetHTMLURL() string { if s == nil || s.HTMLURL == nil { @@ -24998,6 +37558,70 @@ func (s *SecretScanningAlertEvent) GetSender() *User { return s.Sender } +// GetDirection returns the Direction field. +func (s *SecretScanningAlertListOptions) GetDirection() string { + if s == nil { + return "" + } + return s.Direction +} + +// GetIsMultiRepo returns the IsMultiRepo field. +func (s *SecretScanningAlertListOptions) GetIsMultiRepo() bool { + if s == nil { + return false + } + return s.IsMultiRepo +} + +// GetIsPubliclyLeaked returns the IsPubliclyLeaked field. +func (s *SecretScanningAlertListOptions) GetIsPubliclyLeaked() bool { + if s == nil { + return false + } + return s.IsPubliclyLeaked +} + +// GetResolution returns the Resolution field. +func (s *SecretScanningAlertListOptions) GetResolution() string { + if s == nil { + return "" + } + return s.Resolution +} + +// GetSecretType returns the SecretType field. +func (s *SecretScanningAlertListOptions) GetSecretType() string { + if s == nil { + return "" + } + return s.SecretType +} + +// GetSort returns the Sort field. +func (s *SecretScanningAlertListOptions) GetSort() string { + if s == nil { + return "" + } + return s.Sort +} + +// GetState returns the State field. +func (s *SecretScanningAlertListOptions) GetState() string { + if s == nil { + return "" + } + return s.State +} + +// GetValidity returns the Validity field. +func (s *SecretScanningAlertListOptions) GetValidity() string { + if s == nil { + return "" + } + return s.Validity +} + // GetDetails returns the Details field. func (s *SecretScanningAlertLocation) GetDetails() *SecretScanningAlertLocationDetails { if s == nil { @@ -25166,6 +37790,214 @@ func (s *SecretScanningAlertUpdateOptions) GetResolutionComment() string { return *s.ResolutionComment } +// GetState returns the State field. +func (s *SecretScanningAlertUpdateOptions) GetState() string { + if s == nil { + return "" + } + return s.State +} + +// GetCustomPatternVersion returns the CustomPatternVersion field if it's non-nil, zero value otherwise. +func (s *SecretScanningCustomPatternSetting) GetCustomPatternVersion() string { + if s == nil || s.CustomPatternVersion == nil { + return "" + } + return *s.CustomPatternVersion +} + +// GetPushProtectionSetting returns the PushProtectionSetting field. +func (s *SecretScanningCustomPatternSetting) GetPushProtectionSetting() string { + if s == nil { + return "" + } + return s.PushProtectionSetting +} + +// GetTokenType returns the TokenType field. +func (s *SecretScanningCustomPatternSetting) GetTokenType() string { + if s == nil { + return "" + } + return s.TokenType +} + +// GetReviewers returns the Reviewers slice if it's non-nil, nil otherwise. +func (s *SecretScanningDelegatedBypassOptions) GetReviewers() []*BypassReviewer { + if s == nil || s.Reviewers == nil { + return nil + } + return s.Reviewers +} + +// GetCustomPatternOverrides returns the CustomPatternOverrides slice if it's non-nil, nil otherwise. +func (s *SecretScanningPatternConfigs) GetCustomPatternOverrides() []*SecretScanningPatternOverride { + if s == nil || s.CustomPatternOverrides == nil { + return nil + } + return s.CustomPatternOverrides +} + +// GetPatternConfigVersion returns the PatternConfigVersion field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternConfigs) GetPatternConfigVersion() string { + if s == nil || s.PatternConfigVersion == nil { + return "" + } + return *s.PatternConfigVersion +} + +// GetProviderPatternOverrides returns the ProviderPatternOverrides slice if it's non-nil, nil otherwise. +func (s *SecretScanningPatternConfigs) GetProviderPatternOverrides() []*SecretScanningPatternOverride { + if s == nil || s.ProviderPatternOverrides == nil { + return nil + } + return s.ProviderPatternOverrides +} + +// GetPatternConfigVersion returns the PatternConfigVersion field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternConfigsUpdate) GetPatternConfigVersion() string { + if s == nil || s.PatternConfigVersion == nil { + return "" + } + return *s.PatternConfigVersion +} + +// GetCustomPatternSettings returns the CustomPatternSettings slice if it's non-nil, nil otherwise. +func (s *SecretScanningPatternConfigsUpdateOptions) GetCustomPatternSettings() []*SecretScanningCustomPatternSetting { + if s == nil || s.CustomPatternSettings == nil { + return nil + } + return s.CustomPatternSettings +} + +// GetPatternConfigVersion returns the PatternConfigVersion field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternConfigsUpdateOptions) GetPatternConfigVersion() string { + if s == nil || s.PatternConfigVersion == nil { + return "" + } + return *s.PatternConfigVersion +} + +// GetProviderPatternSettings returns the ProviderPatternSettings slice if it's non-nil, nil otherwise. +func (s *SecretScanningPatternConfigsUpdateOptions) GetProviderPatternSettings() []*SecretScanningProviderPatternSetting { + if s == nil || s.ProviderPatternSettings == nil { + return nil + } + return s.ProviderPatternSettings +} + +// GetAlertTotal returns the AlertTotal field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternOverride) GetAlertTotal() int { + if s == nil || s.AlertTotal == nil { + return 0 + } + return *s.AlertTotal +} + +// GetAlertTotalPercentage returns the AlertTotalPercentage field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternOverride) GetAlertTotalPercentage() int { + if s == nil || s.AlertTotalPercentage == nil { + return 0 + } + return *s.AlertTotalPercentage +} + +// GetBypassrate returns the Bypassrate field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternOverride) GetBypassrate() int { + if s == nil || s.Bypassrate == nil { + return 0 + } + return *s.Bypassrate +} + +// GetCustomPatternVersion returns the CustomPatternVersion field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternOverride) GetCustomPatternVersion() string { + if s == nil || s.CustomPatternVersion == nil { + return "" + } + return *s.CustomPatternVersion +} + +// GetDefaultSetting returns the DefaultSetting field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternOverride) GetDefaultSetting() string { + if s == nil || s.DefaultSetting == nil { + return "" + } + return *s.DefaultSetting +} + +// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternOverride) GetDisplayName() string { + if s == nil || s.DisplayName == nil { + return "" + } + return *s.DisplayName +} + +// GetEnterpriseSetting returns the EnterpriseSetting field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternOverride) GetEnterpriseSetting() string { + if s == nil || s.EnterpriseSetting == nil { + return "" + } + return *s.EnterpriseSetting +} + +// GetFalsePositiveRate returns the FalsePositiveRate field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternOverride) GetFalsePositiveRate() int { + if s == nil || s.FalsePositiveRate == nil { + return 0 + } + return *s.FalsePositiveRate +} + +// GetFalsePositives returns the FalsePositives field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternOverride) GetFalsePositives() int { + if s == nil || s.FalsePositives == nil { + return 0 + } + return *s.FalsePositives +} + +// GetSetting returns the Setting field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternOverride) GetSetting() string { + if s == nil || s.Setting == nil { + return "" + } + return *s.Setting +} + +// GetSlug returns the Slug field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternOverride) GetSlug() string { + if s == nil || s.Slug == nil { + return "" + } + return *s.Slug +} + +// GetTokenType returns the TokenType field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternOverride) GetTokenType() string { + if s == nil || s.TokenType == nil { + return "" + } + return *s.TokenType +} + +// GetPushProtectionSetting returns the PushProtectionSetting field. +func (s *SecretScanningProviderPatternSetting) GetPushProtectionSetting() string { + if s == nil { + return "" + } + return s.PushProtectionSetting +} + +// GetTokenType returns the TokenType field. +func (s *SecretScanningProviderPatternSetting) GetTokenType() string { + if s == nil { + return "" + } + return s.TokenType +} + // GetStatus returns the Status field if it's non-nil, zero value otherwise. func (s *SecretScanningPushProtection) GetStatus() string { if s == nil || s.Status == nil { @@ -25174,6 +38006,38 @@ func (s *SecretScanningPushProtection) GetStatus() string { return *s.Status } +// GetBackfillScans returns the BackfillScans slice if it's non-nil, nil otherwise. +func (s *SecretScanningScanHistory) GetBackfillScans() []*SecretsScan { + if s == nil || s.BackfillScans == nil { + return nil + } + return s.BackfillScans +} + +// GetCustomPatternBackfillScans returns the CustomPatternBackfillScans slice if it's non-nil, nil otherwise. +func (s *SecretScanningScanHistory) GetCustomPatternBackfillScans() []*CustomPatternBackfillScan { + if s == nil || s.CustomPatternBackfillScans == nil { + return nil + } + return s.CustomPatternBackfillScans +} + +// GetIncrementalScans returns the IncrementalScans slice if it's non-nil, nil otherwise. +func (s *SecretScanningScanHistory) GetIncrementalScans() []*SecretsScan { + if s == nil || s.IncrementalScans == nil { + return nil + } + return s.IncrementalScans +} + +// GetPatternUpdateScans returns the PatternUpdateScans slice if it's non-nil, nil otherwise. +func (s *SecretScanningScanHistory) GetPatternUpdateScans() []*SecretsScan { + if s == nil || s.PatternUpdateScans == nil { + return nil + } + return s.PatternUpdateScans +} + // GetStatus returns the Status field if it's non-nil, zero value otherwise. func (s *SecretScanningValidityChecks) GetStatus() string { if s == nil || s.Status == nil { @@ -25182,6 +38046,38 @@ func (s *SecretScanningValidityChecks) GetStatus() string { return *s.Status } +// GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. +func (s *SecretsScan) GetCompletedAt() Timestamp { + if s == nil || s.CompletedAt == nil { + return Timestamp{} + } + return *s.CompletedAt +} + +// GetStartedAt returns the StartedAt field if it's non-nil, zero value otherwise. +func (s *SecretsScan) GetStartedAt() Timestamp { + if s == nil || s.StartedAt == nil { + return Timestamp{} + } + return *s.StartedAt +} + +// GetStatus returns the Status field. +func (s *SecretsScan) GetStatus() string { + if s == nil { + return "" + } + return s.Status +} + +// GetType returns the Type field. +func (s *SecretsScan) GetType() string { + if s == nil { + return "" + } + return s.Type +} + // GetAuthor returns the Author field. func (s *SecurityAdvisory) GetAuthor() *User { if s == nil { @@ -25198,6 +38094,22 @@ func (s *SecurityAdvisory) GetClosedAt() Timestamp { return *s.ClosedAt } +// GetCollaboratingTeams returns the CollaboratingTeams slice if it's non-nil, nil otherwise. +func (s *SecurityAdvisory) GetCollaboratingTeams() []*Team { + if s == nil || s.CollaboratingTeams == nil { + return nil + } + return s.CollaboratingTeams +} + +// GetCollaboratingUsers returns the CollaboratingUsers slice if it's non-nil, nil otherwise. +func (s *SecurityAdvisory) GetCollaboratingUsers() []*User { + if s == nil || s.CollaboratingUsers == nil { + return nil + } + return s.CollaboratingUsers +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (s *SecurityAdvisory) GetCreatedAt() Timestamp { if s == nil || s.CreatedAt == nil { @@ -25206,6 +38118,22 @@ func (s *SecurityAdvisory) GetCreatedAt() Timestamp { return *s.CreatedAt } +// GetCredits returns the Credits slice if it's non-nil, nil otherwise. +func (s *SecurityAdvisory) GetCredits() []*RepoAdvisoryCredit { + if s == nil || s.Credits == nil { + return nil + } + return s.Credits +} + +// GetCreditsDetailed returns the CreditsDetailed slice if it's non-nil, nil otherwise. +func (s *SecurityAdvisory) GetCreditsDetailed() []*RepoAdvisoryCreditDetailed { + if s == nil || s.CreditsDetailed == nil { + return nil + } + return s.CreditsDetailed +} + // GetCVEID returns the CVEID field if it's non-nil, zero value otherwise. func (s *SecurityAdvisory) GetCVEID() string { if s == nil || s.CVEID == nil { @@ -25222,6 +38150,22 @@ func (s *SecurityAdvisory) GetCVSS() *AdvisoryCVSS { return s.CVSS } +// GetCWEIDs returns the CWEIDs slice if it's non-nil, nil otherwise. +func (s *SecurityAdvisory) GetCWEIDs() []string { + if s == nil || s.CWEIDs == nil { + return nil + } + return s.CWEIDs +} + +// GetCWEs returns the CWEs slice if it's non-nil, nil otherwise. +func (s *SecurityAdvisory) GetCWEs() []*AdvisoryCWEs { + if s == nil || s.CWEs == nil { + return nil + } + return s.CWEs +} + // GetDescription returns the Description field if it's non-nil, zero value otherwise. func (s *SecurityAdvisory) GetDescription() string { if s == nil || s.Description == nil { @@ -25246,6 +38190,14 @@ func (s *SecurityAdvisory) GetHTMLURL() string { return *s.HTMLURL } +// GetIdentifiers returns the Identifiers slice if it's non-nil, nil otherwise. +func (s *SecurityAdvisory) GetIdentifiers() []*AdvisoryIdentifier { + if s == nil || s.Identifiers == nil { + return nil + } + return s.Identifiers +} + // GetPrivateFork returns the PrivateFork field. func (s *SecurityAdvisory) GetPrivateFork() *Repository { if s == nil { @@ -25270,6 +38222,14 @@ func (s *SecurityAdvisory) GetPublisher() *User { return s.Publisher } +// GetReferences returns the References slice if it's non-nil, nil otherwise. +func (s *SecurityAdvisory) GetReferences() []*AdvisoryReference { + if s == nil || s.References == nil { + return nil + } + return s.References +} + // GetSeverity returns the Severity field if it's non-nil, zero value otherwise. func (s *SecurityAdvisory) GetSeverity() string { if s == nil || s.Severity == nil { @@ -25318,6 +38278,14 @@ func (s *SecurityAdvisory) GetURL() string { return *s.URL } +// GetVulnerabilities returns the Vulnerabilities slice if it's non-nil, nil otherwise. +func (s *SecurityAdvisory) GetVulnerabilities() []*AdvisoryVulnerability { + if s == nil || s.Vulnerabilities == nil { + return nil + } + return s.Vulnerabilities +} + // GetWithdrawnAt returns the WithdrawnAt field if it's non-nil, zero value otherwise. func (s *SecurityAdvisory) GetWithdrawnAt() Timestamp { if s == nil || s.WithdrawnAt == nil { @@ -25398,6 +38366,14 @@ func (s *SecurityAndAnalysis) GetAdvancedSecurity() *AdvancedSecurity { return s.AdvancedSecurity } +// GetCodeSecurity returns the CodeSecurity field. +func (s *SecurityAndAnalysis) GetCodeSecurity() *CodeSecurity { + if s == nil { + return nil + } + return s.CodeSecurity +} + // GetDependabotSecurityUpdates returns the DependabotSecurityUpdates field. func (s *SecurityAndAnalysis) GetDependabotSecurityUpdates() *DependabotSecurityUpdates { if s == nil { @@ -25494,6 +38470,14 @@ func (s *SecurityAndAnalysisEvent) GetSender() *User { return s.Sender } +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (s *SelectedReposList) GetRepositories() []*Repository { + if s == nil || s.Repositories == nil { + return nil + } + return s.Repositories +} + // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. func (s *SelectedReposList) GetTotalCount() int { if s == nil || s.TotalCount == nil { @@ -25502,6 +38486,142 @@ func (s *SelectedReposList) GetTotalCount() int { return *s.TotalCount } +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (s *SelfHostedRunnersAllowedRepos) GetRepositories() []*Repository { + if s == nil || s.Repositories == nil { + return nil + } + return s.Repositories +} + +// GetTotalCount returns the TotalCount field. +func (s *SelfHostedRunnersAllowedRepos) GetTotalCount() int { + if s == nil { + return 0 + } + return s.TotalCount +} + +// GetEnabledRepositories returns the EnabledRepositories field if it's non-nil, zero value otherwise. +func (s *SelfHostedRunnersSettingsOrganization) GetEnabledRepositories() string { + if s == nil || s.EnabledRepositories == nil { + return "" + } + return *s.EnabledRepositories +} + +// GetSelectedRepositoriesURL returns the SelectedRepositoriesURL field if it's non-nil, zero value otherwise. +func (s *SelfHostedRunnersSettingsOrganization) GetSelectedRepositoriesURL() string { + if s == nil || s.SelectedRepositoriesURL == nil { + return "" + } + return *s.SelectedRepositoriesURL +} + +// GetEnabledRepositories returns the EnabledRepositories field if it's non-nil, zero value otherwise. +func (s *SelfHostedRunnersSettingsOrganizationOpt) GetEnabledRepositories() string { + if s == nil || s.EnabledRepositories == nil { + return "" + } + return *s.EnabledRepositories +} + +// GetDisableSelfHostedRunnersForAllOrgs returns the DisableSelfHostedRunnersForAllOrgs field if it's non-nil, zero value otherwise. +func (s *SelfHostRunnerPermissionsEnterprise) GetDisableSelfHostedRunnersForAllOrgs() bool { + if s == nil || s.DisableSelfHostedRunnersForAllOrgs == nil { + return false + } + return *s.DisableSelfHostedRunnersForAllOrgs +} + +// GetServerInstances returns the ServerInstances field. +func (s *ServerInstanceProperties) GetServerInstances() *ServerInstances { + if s == nil { + return nil + } + return s.ServerInstances +} + +// GetItems returns the Items field. +func (s *ServerInstances) GetItems() *ServiceInstanceItems { + if s == nil { + return nil + } + return s.Items +} + +// GetType returns the Type field. +func (s *ServerInstances) GetType() string { + if s == nil { + return "" + } + return s.Type +} + +// GetHostname returns the Hostname field. +func (s *ServerItemProperties) GetHostname() string { + if s == nil { + return "" + } + return s.Hostname +} + +// GetLastSync returns the LastSync field. +func (s *ServerItemProperties) GetLastSync() *LastLicenseSync { + if s == nil { + return nil + } + return s.LastSync +} + +// GetServerID returns the ServerID field. +func (s *ServerItemProperties) GetServerID() string { + if s == nil { + return "" + } + return s.ServerID +} + +// GetProperties returns the Properties field. +func (s *ServiceInstanceItems) GetProperties() *ServerItemProperties { + if s == nil { + return nil + } + return s.Properties +} + +// GetType returns the Type field. +func (s *ServiceInstanceItems) GetType() string { + if s == nil { + return "" + } + return s.Type +} + +// GetSelectedOrganizationIDs returns the SelectedOrganizationIDs slice if it's non-nil, nil otherwise. +func (s *SetOrgAccessRunnerGroupRequest) GetSelectedOrganizationIDs() []int64 { + if s == nil || s.SelectedOrganizationIDs == nil { + return nil + } + return s.SelectedOrganizationIDs +} + +// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs slice if it's non-nil, nil otherwise. +func (s *SetRepoAccessRunnerGroupRequest) GetSelectedRepositoryIDs() []int64 { + if s == nil || s.SelectedRepositoryIDs == nil { + return nil + } + return s.SelectedRepositoryIDs +} + +// GetRunners returns the Runners slice if it's non-nil, nil otherwise. +func (s *SetRunnerGroupRunnersRequest) GetRunners() []int64 { + if s == nil || s.Runners == nil { + return nil + } + return s.Runners +} + // GetFrom returns the From field if it's non-nil, zero value otherwise. func (s *SignatureRequirementEnforcementLevelChanges) GetFrom() string { if s == nil || s.From == nil { @@ -25558,6 +38678,38 @@ func (s *SignatureVerification) GetVerified() bool { return *s.Verified } +// GetNegate returns the Negate field. +func (s *SimplePatternRuleParameters) GetNegate() bool { + if s == nil { + return false + } + return s.Negate +} + +// GetPattern returns the Pattern field. +func (s *SimplePatternRuleParameters) GetPattern() string { + if s == nil { + return "" + } + return s.Pattern +} + +// GetProvider returns the Provider field if it's non-nil, zero value otherwise. +func (s *SocialAccount) GetProvider() string { + if s == nil || s.Provider == nil { + return "" + } + return *s.Provider +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (s *SocialAccount) GetURL() string { + if s == nil || s.URL == nil { + return "" + } + return *s.URL +} + // GetActor returns the Actor field. func (s *Source) GetActor() *User { if s == nil { @@ -25654,6 +38806,46 @@ func (s *SourceImportAuthor) GetURL() string { return *s.URL } +// GetDomain returns the Domain field. +func (s *SplunkConfig) GetDomain() string { + if s == nil { + return "" + } + return s.Domain +} + +// GetEncryptedToken returns the EncryptedToken field. +func (s *SplunkConfig) GetEncryptedToken() string { + if s == nil { + return "" + } + return s.EncryptedToken +} + +// GetKeyID returns the KeyID field. +func (s *SplunkConfig) GetKeyID() string { + if s == nil { + return "" + } + return s.KeyID +} + +// GetPort returns the Port field. +func (s *SplunkConfig) GetPort() uint16 { + if s == nil { + return 0 + } + return s.Port +} + +// GetSSLVerify returns the SSLVerify field. +func (s *SplunkConfig) GetSSLVerify() bool { + if s == nil { + return false + } + return s.SSLVerify +} + // GetPrivacyLevel returns the PrivacyLevel field if it's non-nil, zero value otherwise. func (s *SponsorshipChanges) GetPrivacyLevel() string { if s == nil || s.PrivacyLevel == nil { @@ -25734,6 +38926,14 @@ func (s *SponsorshipTier) GetFrom() string { return *s.From } +// GetKey returns the Key field. +func (s *SSHKeyOptions) GetKey() string { + if s == nil { + return "" + } + return s.Key +} + // GetHostname returns the Hostname field if it's non-nil, zero value otherwise. func (s *SSHKeyStatus) GetHostname() string { if s == nil || s.Hostname == nil { @@ -25878,6 +39078,14 @@ func (s *StarredRepository) GetStarredAt() Timestamp { return *s.StarredAt } +// GetBranches returns the Branches slice if it's non-nil, nil otherwise. +func (s *StatusEvent) GetBranches() []*Branch { + if s == nil || s.Branches == nil { + return nil + } + return s.Branches +} + // GetCommit returns the Commit field. func (s *StatusEvent) GetCommit() *RepositoryCommit { if s == nil { @@ -25990,6 +39198,30 @@ func (s *StatusEvent) GetUpdatedAt() Timestamp { return *s.UpdatedAt } +// GetDaysLeftInBillingCycle returns the DaysLeftInBillingCycle field. +func (s *StorageBilling) GetDaysLeftInBillingCycle() int { + if s == nil { + return 0 + } + return s.DaysLeftInBillingCycle +} + +// GetEstimatedPaidStorageForMonth returns the EstimatedPaidStorageForMonth field. +func (s *StorageBilling) GetEstimatedPaidStorageForMonth() int { + if s == nil { + return 0 + } + return s.EstimatedPaidStorageForMonth +} + +// GetEstimatedStorageForMonth returns the EstimatedStorageForMonth field. +func (s *StorageBilling) GetEstimatedStorageForMonth() int { + if s == nil { + return 0 + } + return s.EstimatedStorageForMonth +} + // GetAfterID returns the AfterID field if it's non-nil, zero value otherwise. func (s *SubIssueRequest) GetAfterID() int64 { if s == nil || s.AfterID == nil { @@ -26014,6 +39246,14 @@ func (s *SubIssueRequest) GetReplaceParent() bool { return *s.ReplaceParent } +// GetSubIssueID returns the SubIssueID field. +func (s *SubIssueRequest) GetSubIssueID() int64 { + if s == nil { + return 0 + } + return s.SubIssueID +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (s *Subscription) GetCreatedAt() Timestamp { if s == nil || s.CreatedAt == nil { @@ -26070,6 +39310,14 @@ func (s *Subscription) GetURL() string { return *s.URL } +// GetNodes returns the Nodes slice if it's non-nil, nil otherwise. +func (s *SystemRequirements) GetNodes() []*SystemRequirementsNode { + if s == nil || s.Nodes == nil { + return nil + } + return s.Nodes +} + // GetStatus returns the Status field if it's non-nil, zero value otherwise. func (s *SystemRequirements) GetStatus() string { if s == nil || s.Status == nil { @@ -26086,6 +39334,14 @@ func (s *SystemRequirementsNode) GetHostname() string { return *s.Hostname } +// GetRolesStatus returns the RolesStatus slice if it's non-nil, nil otherwise. +func (s *SystemRequirementsNode) GetRolesStatus() []*SystemRequirementsNodeRoleStatus { + if s == nil || s.RolesStatus == nil { + return nil + } + return s.RolesStatus +} + // GetStatus returns the Status field if it's non-nil, zero value otherwise. func (s *SystemRequirementsNode) GetStatus() string { if s == nil || s.Status == nil { @@ -26382,6 +39638,14 @@ func (t *Team) GetSlug() string { return *t.Slug } +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (t *Team) GetType() string { + if t == nil || t.Type == nil { + return "" + } + return *t.Type +} + // GetURL returns the URL field if it's non-nil, zero value otherwise. func (t *Team) GetURL() string { if t == nil || t.URL == nil { @@ -26430,6 +39694,22 @@ func (t *TeamAddEvent) GetTeam() *Team { return t.Team } +// GetRole returns the Role field. +func (t *TeamAddTeamMembershipOptions) GetRole() string { + if t == nil { + return "" + } + return t.Role +} + +// GetPermission returns the Permission field. +func (t *TeamAddTeamRepoOptions) GetPermission() string { + if t == nil { + return "" + } + return t.Permission +} + // GetDescription returns the Description field. func (t *TeamChange) GetDescription() *TeamDescription { if t == nil { @@ -26750,6 +40030,14 @@ func (t *TeamLDAPMapping) GetURL() string { return *t.URL } +// GetRole returns the Role field. +func (t *TeamListTeamMembersOptions) GetRole() string { + if t == nil { + return "" + } + return t.Role +} + // GetFrom returns the From field if it's non-nil, zero value otherwise. func (t *TeamName) GetFrom() string { if t == nil || t.From == nil { @@ -26862,6 +40150,14 @@ func (t *TextMatch) GetFragment() string { return *t.Fragment } +// GetMatches returns the Matches slice if it's non-nil, nil otherwise. +func (t *TextMatch) GetMatches() []*Match { + if t == nil || t.Matches == nil { + return nil + } + return t.Matches +} + // GetObjectType returns the ObjectType field if it's non-nil, zero value otherwise. func (t *TextMatch) GetObjectType() string { if t == nil || t.ObjectType == nil { @@ -26998,6 +40294,14 @@ func (t *Timeline) GetMilestone() *Milestone { return t.Milestone } +// GetParents returns the Parents slice if it's non-nil, nil otherwise. +func (t *Timeline) GetParents() []*Commit { + if t == nil || t.Parents == nil { + return nil + } + return t.Parents +} + // GetPerformedViaGithubApp returns the PerformedViaGithubApp field. func (t *Timeline) GetPerformedViaGithubApp() *App { if t == nil { @@ -27166,12 +40470,12 @@ func (t *TopicResult) GetName() string { return *t.Name } -// GetScore returns the Score field. -func (t *TopicResult) GetScore() *float64 { - if t == nil { - return nil +// GetScore returns the Score field if it's non-nil, zero value otherwise. +func (t *TopicResult) GetScore() float64 { + if t == nil || t.Score == nil { + return 0 } - return t.Score + return *t.Score } // GetShortDescription returns the ShortDescription field if it's non-nil, zero value otherwise. @@ -27198,6 +40502,14 @@ func (t *TopicsSearchResult) GetIncompleteResults() bool { return *t.IncompleteResults } +// GetTopics returns the Topics slice if it's non-nil, nil otherwise. +func (t *TopicsSearchResult) GetTopics() []*TopicResult { + if t == nil || t.Topics == nil { + return nil + } + return t.Topics +} + // GetTotal returns the Total field if it's non-nil, zero value otherwise. func (t *TopicsSearchResult) GetTotal() int { if t == nil || t.Total == nil { @@ -27206,6 +40518,38 @@ func (t *TopicsSearchResult) GetTotal() int { return *t.Total } +// GetTotalActiveCachesCount returns the TotalActiveCachesCount field. +func (t *TotalCacheUsage) GetTotalActiveCachesCount() int { + if t == nil { + return 0 + } + return t.TotalActiveCachesCount +} + +// GetTotalActiveCachesUsageSizeInBytes returns the TotalActiveCachesUsageSizeInBytes field. +func (t *TotalCacheUsage) GetTotalActiveCachesUsageSizeInBytes() int64 { + if t == nil { + return 0 + } + return t.TotalActiveCachesUsageSizeInBytes +} + +// GetPer returns the Per field. +func (t *TrafficBreakdownOptions) GetPer() string { + if t == nil { + return "" + } + return t.Per +} + +// GetClones returns the Clones slice if it's non-nil, nil otherwise. +func (t *TrafficClones) GetClones() []*TrafficData { + if t == nil || t.Clones == nil { + return nil + } + return t.Clones +} + // GetCount returns the Count field if it's non-nil, zero value otherwise. func (t *TrafficClones) GetCount() int { if t == nil || t.Count == nil { @@ -27318,6 +40662,14 @@ func (t *TrafficViews) GetUniques() int { return *t.Uniques } +// GetViews returns the Views slice if it's non-nil, nil otherwise. +func (t *TrafficViews) GetViews() []*TrafficData { + if t == nil || t.Views == nil { + return nil + } + return t.Views +} + // GetNewName returns the NewName field if it's non-nil, zero value otherwise. func (t *TransferRequest) GetNewName() string { if t == nil || t.NewName == nil { @@ -27326,6 +40678,30 @@ func (t *TransferRequest) GetNewName() string { return *t.NewName } +// GetNewOwner returns the NewOwner field. +func (t *TransferRequest) GetNewOwner() string { + if t == nil { + return "" + } + return t.NewOwner +} + +// GetTeamID returns the TeamID slice if it's non-nil, nil otherwise. +func (t *TransferRequest) GetTeamID() []int64 { + if t == nil || t.TeamID == nil { + return nil + } + return t.TeamID +} + +// GetEntries returns the Entries slice if it's non-nil, nil otherwise. +func (t *Tree) GetEntries() []*TreeEntry { + if t == nil || t.Entries == nil { + return nil + } + return t.Entries +} + // GetSHA returns the SHA field if it's non-nil, zero value otherwise. func (t *Tree) GetSHA() string { if t == nil || t.SHA == nil { @@ -27398,6 +40774,46 @@ func (t *TreeEntry) GetURL() string { return *t.URL } +// GetClientID returns the ClientID field. +func (u *UnauthenticatedRateLimitedTransport) GetClientID() string { + if u == nil { + return "" + } + return u.ClientID +} + +// GetClientSecret returns the ClientSecret field. +func (u *UnauthenticatedRateLimitedTransport) GetClientSecret() string { + if u == nil { + return "" + } + return u.ClientSecret +} + +// GetRepositorySelection returns the RepositorySelection field if it's non-nil, zero value otherwise. +func (u *UpdateAppInstallationRepositoriesOptions) GetRepositorySelection() string { + if u == nil || u.RepositorySelection == nil { + return "" + } + return *u.RepositorySelection +} + +// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs slice if it's non-nil, nil otherwise. +func (u *UpdateAppInstallationRepositoriesOptions) GetSelectedRepositoryIDs() []int64 { + if u == nil || u.SelectedRepositoryIDs == nil { + return nil + } + return u.SelectedRepositoryIDs +} + +// GetOp returns the Op field. +func (u *UpdateAttributeForSCIMUserOperations) GetOp() string { + if u == nil { + return "" + } + return u.Op +} + // GetPath returns the Path field if it's non-nil, zero value otherwise. func (u *UpdateAttributeForSCIMUserOperations) GetPath() string { if u == nil || u.Path == nil { @@ -27406,6 +40822,46 @@ func (u *UpdateAttributeForSCIMUserOperations) GetPath() string { return *u.Path } +// GetValue returns the Value field. +func (u *UpdateAttributeForSCIMUserOperations) GetValue() json.RawMessage { + if u == nil { + return json.RawMessage{} + } + return u.Value +} + +// GetOperations returns the Operations field. +func (u *UpdateAttributeForSCIMUserOptions) GetOperations() UpdateAttributeForSCIMUserOperations { + if u == nil { + return UpdateAttributeForSCIMUserOperations{} + } + return u.Operations +} + +// GetSchemas returns the Schemas slice if it's non-nil, nil otherwise. +func (u *UpdateAttributeForSCIMUserOptions) GetSchemas() []string { + if u == nil || u.Schemas == nil { + return nil + } + return u.Schemas +} + +// GetParameters returns the Parameters field. +func (u *UpdateBranchRule) GetParameters() UpdateRuleParameters { + if u == nil { + return UpdateRuleParameters{} + } + return u.Parameters +} + +// GetActions returns the Actions slice if it's non-nil, nil otherwise. +func (u *UpdateCheckRunOptions) GetActions() []*CheckRunAction { + if u == nil || u.Actions == nil { + return nil + } + return u.Actions +} + // GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. func (u *UpdateCheckRunOptions) GetCompletedAt() Timestamp { if u == nil || u.CompletedAt == nil { @@ -27438,6 +40894,14 @@ func (u *UpdateCheckRunOptions) GetExternalID() string { return *u.ExternalID } +// GetName returns the Name field. +func (u *UpdateCheckRunOptions) GetName() string { + if u == nil { + return "" + } + return u.Name +} + // GetOutput returns the Output field. func (u *UpdateCheckRunOptions) GetOutput() *CheckRunOutput { if u == nil { @@ -27454,6 +40918,62 @@ func (u *UpdateCheckRunOptions) GetStatus() string { return *u.Status } +// GetMachine returns the Machine field if it's non-nil, zero value otherwise. +func (u *UpdateCodespaceOptions) GetMachine() string { + if u == nil || u.Machine == nil { + return "" + } + return *u.Machine +} + +// GetRecentFolders returns the RecentFolders slice if it's non-nil, nil otherwise. +func (u *UpdateCodespaceOptions) GetRecentFolders() []string { + if u == nil || u.RecentFolders == nil { + return nil + } + return u.RecentFolders +} + +// GetBaseRole returns the BaseRole field if it's non-nil, zero value otherwise. +func (u *UpdateCustomOrgRoleRequest) GetBaseRole() string { + if u == nil || u.BaseRole == nil { + return "" + } + return *u.BaseRole +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (u *UpdateCustomOrgRoleRequest) GetDescription() string { + if u == nil || u.Description == nil { + return "" + } + return *u.Description +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (u *UpdateCustomOrgRoleRequest) GetName() string { + if u == nil || u.Name == nil { + return "" + } + return *u.Name +} + +// GetPermissions returns the Permissions slice if it's non-nil, nil otherwise. +func (u *UpdateCustomOrgRoleRequest) GetPermissions() []string { + if u == nil || u.Permissions == nil { + return nil + } + return u.Permissions +} + +// GetLanguages returns the Languages slice if it's non-nil, nil otherwise. +func (u *UpdateDefaultSetupConfigurationOptions) GetLanguages() []string { + if u == nil || u.Languages == nil { + return nil + } + return u.Languages +} + // GetQuerySuite returns the QuerySuite field if it's non-nil, zero value otherwise. func (u *UpdateDefaultSetupConfigurationOptions) GetQuerySuite() string { if u == nil || u.QuerySuite == nil { @@ -27462,6 +40982,14 @@ func (u *UpdateDefaultSetupConfigurationOptions) GetQuerySuite() string { return *u.QuerySuite } +// GetState returns the State field. +func (u *UpdateDefaultSetupConfigurationOptions) GetState() string { + if u == nil { + return "" + } + return u.State +} + // GetRunID returns the RunID field if it's non-nil, zero value otherwise. func (u *UpdateDefaultSetupConfigurationResponse) GetRunID() int64 { if u == nil || u.RunID == nil { @@ -27494,6 +41022,14 @@ func (u *UpdateEnterpriseRunnerGroupRequest) GetName() string { return *u.Name } +// GetNetworkConfigurationID returns the NetworkConfigurationID field if it's non-nil, zero value otherwise. +func (u *UpdateEnterpriseRunnerGroupRequest) GetNetworkConfigurationID() string { + if u == nil || u.NetworkConfigurationID == nil { + return "" + } + return *u.NetworkConfigurationID +} + // GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. func (u *UpdateEnterpriseRunnerGroupRequest) GetRestrictedToWorkflows() bool { if u == nil || u.RestrictedToWorkflows == nil { @@ -27502,6 +41038,14 @@ func (u *UpdateEnterpriseRunnerGroupRequest) GetRestrictedToWorkflows() bool { return *u.RestrictedToWorkflows } +// GetSelectedWorkflows returns the SelectedWorkflows slice if it's non-nil, nil otherwise. +func (u *UpdateEnterpriseRunnerGroupRequest) GetSelectedWorkflows() []string { + if u == nil || u.SelectedWorkflows == nil { + return nil + } + return u.SelectedWorkflows +} + // GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. func (u *UpdateEnterpriseRunnerGroupRequest) GetVisibility() string { if u == nil || u.Visibility == nil { @@ -27510,6 +41054,270 @@ func (u *UpdateEnterpriseRunnerGroupRequest) GetVisibility() string { return *u.Visibility } +// GetEnableStaticIP returns the EnableStaticIP field if it's non-nil, zero value otherwise. +func (u *UpdateHostedRunnerRequest) GetEnableStaticIP() bool { + if u == nil || u.EnableStaticIP == nil { + return false + } + return *u.EnableStaticIP +} + +// GetImageID returns the ImageID field if it's non-nil, zero value otherwise. +func (u *UpdateHostedRunnerRequest) GetImageID() string { + if u == nil || u.ImageID == nil { + return "" + } + return *u.ImageID +} + +// GetImageVersion returns the ImageVersion field if it's non-nil, zero value otherwise. +func (u *UpdateHostedRunnerRequest) GetImageVersion() string { + if u == nil || u.ImageVersion == nil { + return "" + } + return *u.ImageVersion +} + +// GetMaximumRunners returns the MaximumRunners field if it's non-nil, zero value otherwise. +func (u *UpdateHostedRunnerRequest) GetMaximumRunners() int64 { + if u == nil || u.MaximumRunners == nil { + return 0 + } + return *u.MaximumRunners +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (u *UpdateHostedRunnerRequest) GetName() string { + if u == nil || u.Name == nil { + return "" + } + return *u.Name +} + +// GetRunnerGroupID returns the RunnerGroupID field if it's non-nil, zero value otherwise. +func (u *UpdateHostedRunnerRequest) GetRunnerGroupID() int64 { + if u == nil || u.RunnerGroupID == nil { + return 0 + } + return *u.RunnerGroupID +} + +// GetSize returns the Size field if it's non-nil, zero value otherwise. +func (u *UpdateHostedRunnerRequest) GetSize() string { + if u == nil || u.Size == nil { + return "" + } + return *u.Size +} + +// GetAccountID returns the AccountID field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetAccountID() string { + if u == nil || u.AccountID == nil { + return "" + } + return *u.AccountID +} + +// GetAudience returns the Audience field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetAudience() string { + if u == nil || u.Audience == nil { + return "" + } + return *u.Audience +} + +// GetAuthType returns the AuthType field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetAuthType() string { + if u == nil || u.AuthType == nil { + return "" + } + return *u.AuthType +} + +// GetAWSRegion returns the AWSRegion field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetAWSRegion() string { + if u == nil || u.AWSRegion == nil { + return "" + } + return *u.AWSRegion +} + +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetClientID() string { + if u == nil || u.ClientID == nil { + return "" + } + return *u.ClientID +} + +// GetDomain returns the Domain field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetDomain() string { + if u == nil || u.Domain == nil { + return "" + } + return *u.Domain +} + +// GetDomainOwner returns the DomainOwner field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetDomainOwner() string { + if u == nil || u.DomainOwner == nil { + return "" + } + return *u.DomainOwner +} + +// GetEncryptedValue returns the EncryptedValue field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetEncryptedValue() string { + if u == nil || u.EncryptedValue == nil { + return "" + } + return *u.EncryptedValue +} + +// GetIdentityMappingName returns the IdentityMappingName field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetIdentityMappingName() string { + if u == nil || u.IdentityMappingName == nil { + return "" + } + return *u.IdentityMappingName +} + +// GetJFrogOIDCProviderName returns the JFrogOIDCProviderName field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetJFrogOIDCProviderName() string { + if u == nil || u.JFrogOIDCProviderName == nil { + return "" + } + return *u.JFrogOIDCProviderName +} + +// GetKeyID returns the KeyID field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetKeyID() string { + if u == nil || u.KeyID == nil { + return "" + } + return *u.KeyID +} + +// GetRegistryType returns the RegistryType field. +func (u *UpdateOrganizationPrivateRegistry) GetRegistryType() *PrivateRegistryType { + if u == nil { + return nil + } + return u.RegistryType +} + +// GetReplacesBase returns the ReplacesBase field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetReplacesBase() bool { + if u == nil || u.ReplacesBase == nil { + return false + } + return *u.ReplacesBase +} + +// GetRoleName returns the RoleName field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetRoleName() string { + if u == nil || u.RoleName == nil { + return "" + } + return *u.RoleName +} + +// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs slice if it's non-nil, nil otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetSelectedRepositoryIDs() []int64 { + if u == nil || u.SelectedRepositoryIDs == nil { + return nil + } + return u.SelectedRepositoryIDs +} + +// GetTenantID returns the TenantID field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetTenantID() string { + if u == nil || u.TenantID == nil { + return "" + } + return *u.TenantID +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetURL() string { + if u == nil || u.URL == nil { + return "" + } + return *u.URL +} + +// GetUsername returns the Username field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetUsername() string { + if u == nil || u.Username == nil { + return "" + } + return *u.Username +} + +// GetVisibility returns the Visibility field. +func (u *UpdateOrganizationPrivateRegistry) GetVisibility() *PrivateRegistryVisibility { + if u == nil { + return nil + } + return u.Visibility +} + +// GetArchived returns the Archived field if it's non-nil, zero value otherwise. +func (u *UpdateProjectItemOptions) GetArchived() bool { + if u == nil || u.Archived == nil { + return false + } + return *u.Archived +} + +// GetFields returns the Fields slice if it's non-nil, nil otherwise. +func (u *UpdateProjectItemOptions) GetFields() []*UpdateProjectV2Field { + if u == nil || u.Fields == nil { + return nil + } + return u.Fields +} + +// GetID returns the ID field. +func (u *UpdateProjectV2Field) GetID() int64 { + if u == nil { + return 0 + } + return u.ID +} + +// GetValue returns the Value field. +func (u *UpdateProjectV2Field) GetValue() any { + if u == nil { + return nil + } + return u.Value +} + +// GetForce returns the Force field if it's non-nil, zero value otherwise. +func (u *UpdateRef) GetForce() bool { + if u == nil || u.Force == nil { + return false + } + return *u.Force +} + +// GetSHA returns the SHA field. +func (u *UpdateRef) GetSHA() string { + if u == nil { + return "" + } + return u.SHA +} + +// GetUpdateAllowsFetchAndMerge returns the UpdateAllowsFetchAndMerge field. +func (u *UpdateRuleParameters) GetUpdateAllowsFetchAndMerge() bool { + if u == nil { + return false + } + return u.UpdateAllowsFetchAndMerge +} + // GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise. func (u *UpdateRunnerGroupRequest) GetAllowsPublicRepositories() bool { if u == nil || u.AllowsPublicRepositories == nil { @@ -27526,6 +41334,14 @@ func (u *UpdateRunnerGroupRequest) GetName() string { return *u.Name } +// GetNetworkConfigurationID returns the NetworkConfigurationID field if it's non-nil, zero value otherwise. +func (u *UpdateRunnerGroupRequest) GetNetworkConfigurationID() string { + if u == nil || u.NetworkConfigurationID == nil { + return "" + } + return *u.NetworkConfigurationID +} + // GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. func (u *UpdateRunnerGroupRequest) GetRestrictedToWorkflows() bool { if u == nil || u.RestrictedToWorkflows == nil { @@ -27534,6 +41350,14 @@ func (u *UpdateRunnerGroupRequest) GetRestrictedToWorkflows() bool { return *u.RestrictedToWorkflows } +// GetSelectedWorkflows returns the SelectedWorkflows slice if it's non-nil, nil otherwise. +func (u *UpdateRunnerGroupRequest) GetSelectedWorkflows() []string { + if u == nil || u.SelectedWorkflows == nil { + return nil + } + return u.SelectedWorkflows +} + // GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. func (u *UpdateRunnerGroupRequest) GetVisibility() string { if u == nil || u.Visibility == nil { @@ -27542,6 +41366,166 @@ func (u *UpdateRunnerGroupRequest) GetVisibility() string { return *u.Visibility } +// GetLicense returns the License field. +func (u *UploadLicenseOptions) GetLicense() string { + if u == nil { + return "" + } + return u.License +} + +// GetLabel returns the Label field. +func (u *UploadOptions) GetLabel() string { + if u == nil { + return "" + } + return u.Label +} + +// GetMediaType returns the MediaType field. +func (u *UploadOptions) GetMediaType() string { + if u == nil { + return "" + } + return u.MediaType +} + +// GetName returns the Name field. +func (u *UploadOptions) GetName() string { + if u == nil { + return "" + } + return u.Name +} + +// GetDate returns the Date field. +func (u *UsageItem) GetDate() string { + if u == nil { + return "" + } + return u.Date +} + +// GetDiscountAmount returns the DiscountAmount field. +func (u *UsageItem) GetDiscountAmount() float64 { + if u == nil { + return 0 + } + return u.DiscountAmount +} + +// GetGrossAmount returns the GrossAmount field. +func (u *UsageItem) GetGrossAmount() float64 { + if u == nil { + return 0 + } + return u.GrossAmount +} + +// GetNetAmount returns the NetAmount field. +func (u *UsageItem) GetNetAmount() float64 { + if u == nil { + return 0 + } + return u.NetAmount +} + +// GetOrganizationName returns the OrganizationName field if it's non-nil, zero value otherwise. +func (u *UsageItem) GetOrganizationName() string { + if u == nil || u.OrganizationName == nil { + return "" + } + return *u.OrganizationName +} + +// GetPricePerUnit returns the PricePerUnit field. +func (u *UsageItem) GetPricePerUnit() float64 { + if u == nil { + return 0 + } + return u.PricePerUnit +} + +// GetProduct returns the Product field. +func (u *UsageItem) GetProduct() string { + if u == nil { + return "" + } + return u.Product +} + +// GetQuantity returns the Quantity field. +func (u *UsageItem) GetQuantity() float64 { + if u == nil { + return 0 + } + return u.Quantity +} + +// GetRepositoryName returns the RepositoryName field if it's non-nil, zero value otherwise. +func (u *UsageItem) GetRepositoryName() string { + if u == nil || u.RepositoryName == nil { + return "" + } + return *u.RepositoryName +} + +// GetSKU returns the SKU field. +func (u *UsageItem) GetSKU() string { + if u == nil { + return "" + } + return u.SKU +} + +// GetUnitType returns the UnitType field. +func (u *UsageItem) GetUnitType() string { + if u == nil { + return "" + } + return u.UnitType +} + +// GetUsageItems returns the UsageItems slice if it's non-nil, nil otherwise. +func (u *UsageReport) GetUsageItems() []*UsageItem { + if u == nil || u.UsageItems == nil { + return nil + } + return u.UsageItems +} + +// GetDay returns the Day field if it's non-nil, zero value otherwise. +func (u *UsageReportOptions) GetDay() int { + if u == nil || u.Day == nil { + return 0 + } + return *u.Day +} + +// GetHour returns the Hour field if it's non-nil, zero value otherwise. +func (u *UsageReportOptions) GetHour() int { + if u == nil || u.Hour == nil { + return 0 + } + return *u.Hour +} + +// GetMonth returns the Month field if it's non-nil, zero value otherwise. +func (u *UsageReportOptions) GetMonth() int { + if u == nil || u.Month == nil { + return 0 + } + return *u.Month +} + +// GetYear returns the Year field if it's non-nil, zero value otherwise. +func (u *UsageReportOptions) GetYear() int { + if u == nil || u.Year == nil { + return 0 + } + return *u.Year +} + // GetAssignment returns the Assignment field if it's non-nil, zero value otherwise. func (u *User) GetAssignment() string { if u == nil || u.Assignment == nil { @@ -27574,6 +41558,14 @@ func (u *User) GetBlog() string { return *u.Blog } +// GetBusinessPlus returns the BusinessPlus field if it's non-nil, zero value otherwise. +func (u *User) GetBusinessPlus() bool { + if u == nil || u.BusinessPlus == nil { + return false + } + return *u.BusinessPlus +} + // GetCollaborators returns the Collaborators field if it's non-nil, zero value otherwise. func (u *User) GetCollaborators() int { if u == nil || u.Collaborators == nil { @@ -27694,6 +41686,14 @@ func (u *User) GetID() int64 { return *u.ID } +// GetInheritedFrom returns the InheritedFrom slice if it's non-nil, nil otherwise. +func (u *User) GetInheritedFrom() []*Team { + if u == nil || u.InheritedFrom == nil { + return nil + } + return u.InheritedFrom +} + // GetLdapDn returns the LdapDn field if it's non-nil, zero value otherwise. func (u *User) GetLdapDn() string { if u == nil || u.LdapDn == nil { @@ -27734,6 +41734,14 @@ func (u *User) GetNodeID() string { return *u.NodeID } +// GetNotificationEmail returns the NotificationEmail field if it's non-nil, zero value otherwise. +func (u *User) GetNotificationEmail() string { + if u == nil || u.NotificationEmail == nil { + return "" + } + return *u.NotificationEmail +} + // GetOrganizationsURL returns the OrganizationsURL field if it's non-nil, zero value otherwise. func (u *User) GetOrganizationsURL() string { if u == nil || u.OrganizationsURL == nil { @@ -27750,10 +41758,10 @@ func (u *User) GetOwnedPrivateRepos() int64 { return *u.OwnedPrivateRepos } -// GetPermissions returns the Permissions map if it's non-nil, an empty map otherwise. -func (u *User) GetPermissions() map[string]bool { - if u == nil || u.Permissions == nil { - return map[string]bool{} +// GetPermissions returns the Permissions field. +func (u *User) GetPermissions() *RepositoryPermissions { + if u == nil { + return nil } return u.Permissions } @@ -27846,6 +41854,14 @@ func (u *User) GetSuspendedAt() Timestamp { return *u.SuspendedAt } +// GetTextMatches returns the TextMatches slice if it's non-nil, nil otherwise. +func (u *User) GetTextMatches() []*TextMatch { + if u == nil || u.TextMatches == nil { + return nil + } + return u.TextMatches +} + // GetTotalPrivateRepos returns the TotalPrivateRepos field if it's non-nil, zero value otherwise. func (u *User) GetTotalPrivateRepos() int64 { if u == nil || u.TotalPrivateRepos == nil { @@ -27894,6 +41910,14 @@ func (u *User) GetURL() string { return *u.URL } +// GetUserViewType returns the UserViewType field if it's non-nil, zero value otherwise. +func (u *User) GetUserViewType() string { + if u == nil || u.UserViewType == nil { + return "" + } + return *u.UserViewType +} + // GetApp returns the App field. func (u *UserAuthorization) GetApp() *OAuthAPP { if u == nil { @@ -27950,6 +41974,14 @@ func (u *UserAuthorization) GetNoteURL() string { return *u.NoteURL } +// GetScopes returns the Scopes slice if it's non-nil, nil otherwise. +func (u *UserAuthorization) GetScopes() []string { + if u == nil || u.Scopes == nil { + return nil + } + return u.Scopes +} + // GetToken returns the Token field if it's non-nil, zero value otherwise. func (u *UserAuthorization) GetToken() string { if u == nil || u.Token == nil { @@ -28206,6 +42238,22 @@ func (u *UserLDAPMapping) GetURL() string { return *u.URL } +// GetPerPage returns the PerPage field. +func (u *UserListOptions) GetPerPage() int { + if u == nil { + return 0 + } + return u.PerPage +} + +// GetSince returns the Since field. +func (u *UserListOptions) GetSince() int64 { + if u == nil { + return 0 + } + return u.Since +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (u *UserMigration) GetCreatedAt() string { if u == nil || u.CreatedAt == nil { @@ -28246,6 +42294,14 @@ func (u *UserMigration) GetLockRepositories() bool { return *u.LockRepositories } +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (u *UserMigration) GetRepositories() []*Repository { + if u == nil || u.Repositories == nil { + return nil + } + return u.Repositories +} + // GetState returns the State field if it's non-nil, zero value otherwise. func (u *UserMigration) GetState() string { if u == nil || u.State == nil { @@ -28270,6 +42326,22 @@ func (u *UserMigration) GetURL() string { return *u.URL } +// GetExcludeAttachments returns the ExcludeAttachments field. +func (u *UserMigrationOptions) GetExcludeAttachments() bool { + if u == nil { + return false + } + return u.ExcludeAttachments +} + +// GetLockRepositories returns the LockRepositories field. +func (u *UserMigrationOptions) GetLockRepositories() bool { + if u == nil { + return false + } + return u.LockRepositories +} + // GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. func (u *UsersSearchResult) GetIncompleteResults() bool { if u == nil || u.IncompleteResults == nil { @@ -28286,6 +42358,14 @@ func (u *UsersSearchResult) GetTotal() int { return *u.Total } +// GetUsers returns the Users slice if it's non-nil, nil otherwise. +func (u *UsersSearchResult) GetUsers() []*User { + if u == nil || u.Users == nil { + return nil + } + return u.Users +} + // GetAdminUsers returns the AdminUsers field if it's non-nil, zero value otherwise. func (u *UserStats) GetAdminUsers() int { if u == nil || u.AdminUsers == nil { @@ -28374,6 +42454,14 @@ func (w *WatchEvent) GetSender() *User { return w.Sender } +// GetDays returns the Days slice if it's non-nil, nil otherwise. +func (w *WeeklyCommitActivity) GetDays() []int { + if w == nil || w.Days == nil { + return nil + } + return w.Days +} + // GetTotal returns the Total field if it's non-nil, zero value otherwise. func (w *WeeklyCommitActivity) GetTotal() int { if w == nil || w.Total == nil { @@ -28510,6 +42598,14 @@ func (w *WorkflowBill) GetTotalMS() int64 { return *w.TotalMS } +// GetInputs returns the Inputs field. +func (w *WorkflowDispatchEvent) GetInputs() json.RawMessage { + if w == nil { + return json.RawMessage{} + } + return w.Inputs +} + // GetInstallation returns the Installation field. func (w *WorkflowDispatchEvent) GetInstallation() *Installation { if w == nil { @@ -28558,6 +42654,30 @@ func (w *WorkflowDispatchEvent) GetWorkflow() string { return *w.Workflow } +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (w *WorkflowDispatchRunDetails) GetHTMLURL() string { + if w == nil || w.HTMLURL == nil { + return "" + } + return *w.HTMLURL +} + +// GetRunURL returns the RunURL field if it's non-nil, zero value otherwise. +func (w *WorkflowDispatchRunDetails) GetRunURL() string { + if w == nil || w.RunURL == nil { + return "" + } + return *w.RunURL +} + +// GetWorkflowRunID returns the WorkflowRunID field if it's non-nil, zero value otherwise. +func (w *WorkflowDispatchRunDetails) GetWorkflowRunID() int64 { + if w == nil || w.WorkflowRunID == nil { + return 0 + } + return *w.WorkflowRunID +} + // GetCheckRunURL returns the CheckRunURL field if it's non-nil, zero value otherwise. func (w *WorkflowJob) GetCheckRunURL() string { if w == nil || w.CheckRunURL == nil { @@ -28622,6 +42742,14 @@ func (w *WorkflowJob) GetID() int64 { return *w.ID } +// GetLabels returns the Labels slice if it's non-nil, nil otherwise. +func (w *WorkflowJob) GetLabels() []string { + if w == nil || w.Labels == nil { + return nil + } + return w.Labels +} + // GetName returns the Name field if it's non-nil, zero value otherwise. func (w *WorkflowJob) GetName() string { if w == nil || w.Name == nil { @@ -28710,6 +42838,14 @@ func (w *WorkflowJob) GetStatus() string { return *w.Status } +// GetSteps returns the Steps slice if it's non-nil, nil otherwise. +func (w *WorkflowJob) GetSteps() []*TaskStep { + if w == nil || w.Steps == nil { + return nil + } + return w.Steps +} + // GetURL returns the URL field if it's non-nil, zero value otherwise. func (w *WorkflowJob) GetURL() string { if w == nil || w.URL == nil { @@ -29022,6 +43158,22 @@ func (w *WorkflowRun) GetPreviousAttemptURL() string { return *w.PreviousAttemptURL } +// GetPullRequests returns the PullRequests slice if it's non-nil, nil otherwise. +func (w *WorkflowRun) GetPullRequests() []*PullRequest { + if w == nil || w.PullRequests == nil { + return nil + } + return w.PullRequests +} + +// GetReferencedWorkflows returns the ReferencedWorkflows slice if it's non-nil, nil otherwise. +func (w *WorkflowRun) GetReferencedWorkflows() []*ReferencedWorkflow { + if w == nil || w.ReferencedWorkflows == nil { + return nil + } + return w.ReferencedWorkflows +} + // GetRepository returns the Repository field. func (w *WorkflowRun) GetRepository() *Repository { if w == nil { @@ -29118,6 +43270,14 @@ func (w *WorkflowRunAttemptOptions) GetExcludePullRequests() bool { return *w.ExcludePullRequests } +// GetJobRuns returns the JobRuns slice if it's non-nil, nil otherwise. +func (w *WorkflowRunBill) GetJobRuns() []*WorkflowRunJobRun { + if w == nil || w.JobRuns == nil { + return nil + } + return w.JobRuns +} + // GetJobs returns the Jobs field if it's non-nil, zero value otherwise. func (w *WorkflowRunBill) GetJobs() int { if w == nil || w.Jobs == nil { @@ -29214,6 +43374,14 @@ func (w *WorkflowRuns) GetTotalCount() int { return *w.TotalCount } +// GetWorkflowRuns returns the WorkflowRuns slice if it's non-nil, nil otherwise. +func (w *WorkflowRuns) GetWorkflowRuns() []*WorkflowRun { + if w == nil || w.WorkflowRuns == nil { + return nil + } + return w.WorkflowRuns +} + // GetBillable returns the Billable field. func (w *WorkflowRunUsage) GetBillable() *WorkflowRunBillMap { if w == nil { @@ -29238,6 +43406,86 @@ func (w *Workflows) GetTotalCount() int { return *w.TotalCount } +// GetWorkflows returns the Workflows slice if it's non-nil, nil otherwise. +func (w *Workflows) GetWorkflows() []*Workflow { + if w == nil || w.Workflows == nil { + return nil + } + return w.Workflows +} + +// GetParameters returns the Parameters field. +func (w *WorkflowsBranchRule) GetParameters() WorkflowsRuleParameters { + if w == nil { + return WorkflowsRuleParameters{} + } + return w.Parameters +} + +// GetRequireApprovalForForkPRWorkflows returns the RequireApprovalForForkPRWorkflows field if it's non-nil, zero value otherwise. +func (w *WorkflowsPermissions) GetRequireApprovalForForkPRWorkflows() bool { + if w == nil || w.RequireApprovalForForkPRWorkflows == nil { + return false + } + return *w.RequireApprovalForForkPRWorkflows +} + +// GetRunWorkflowsFromForkPullRequests returns the RunWorkflowsFromForkPullRequests field if it's non-nil, zero value otherwise. +func (w *WorkflowsPermissions) GetRunWorkflowsFromForkPullRequests() bool { + if w == nil || w.RunWorkflowsFromForkPullRequests == nil { + return false + } + return *w.RunWorkflowsFromForkPullRequests +} + +// GetSendSecretsAndVariables returns the SendSecretsAndVariables field if it's non-nil, zero value otherwise. +func (w *WorkflowsPermissions) GetSendSecretsAndVariables() bool { + if w == nil || w.SendSecretsAndVariables == nil { + return false + } + return *w.SendSecretsAndVariables +} + +// GetSendWriteTokensToWorkflows returns the SendWriteTokensToWorkflows field if it's non-nil, zero value otherwise. +func (w *WorkflowsPermissions) GetSendWriteTokensToWorkflows() bool { + if w == nil || w.SendWriteTokensToWorkflows == nil { + return false + } + return *w.SendWriteTokensToWorkflows +} + +// GetRequireApprovalForForkPRWorkflows returns the RequireApprovalForForkPRWorkflows field if it's non-nil, zero value otherwise. +func (w *WorkflowsPermissionsOpt) GetRequireApprovalForForkPRWorkflows() bool { + if w == nil || w.RequireApprovalForForkPRWorkflows == nil { + return false + } + return *w.RequireApprovalForForkPRWorkflows +} + +// GetRunWorkflowsFromForkPullRequests returns the RunWorkflowsFromForkPullRequests field. +func (w *WorkflowsPermissionsOpt) GetRunWorkflowsFromForkPullRequests() bool { + if w == nil { + return false + } + return w.RunWorkflowsFromForkPullRequests +} + +// GetSendSecretsAndVariables returns the SendSecretsAndVariables field if it's non-nil, zero value otherwise. +func (w *WorkflowsPermissionsOpt) GetSendSecretsAndVariables() bool { + if w == nil || w.SendSecretsAndVariables == nil { + return false + } + return *w.SendSecretsAndVariables +} + +// GetSendWriteTokensToWorkflows returns the SendWriteTokensToWorkflows field if it's non-nil, zero value otherwise. +func (w *WorkflowsPermissionsOpt) GetSendWriteTokensToWorkflows() bool { + if w == nil || w.SendWriteTokensToWorkflows == nil { + return false + } + return *w.SendWriteTokensToWorkflows +} + // GetDoNotEnforceOnCreate returns the DoNotEnforceOnCreate field if it's non-nil, zero value otherwise. func (w *WorkflowsRuleParameters) GetDoNotEnforceOnCreate() bool { if w == nil || w.DoNotEnforceOnCreate == nil { @@ -29246,6 +43494,14 @@ func (w *WorkflowsRuleParameters) GetDoNotEnforceOnCreate() bool { return *w.DoNotEnforceOnCreate } +// GetWorkflows returns the Workflows slice if it's non-nil, nil otherwise. +func (w *WorkflowsRuleParameters) GetWorkflows() []*RuleWorkflow { + if w == nil || w.Workflows == nil { + return nil + } + return w.Workflows +} + // GetBillable returns the Billable field. func (w *WorkflowUsage) GetBillable() *WorkflowBillMap { if w == nil { diff --git a/vendor/github.com/google/go-github/v88/github/github-iterators.go b/vendor/github.com/google/go-github/v88/github/github-iterators.go new file mode 100644 index 000000000..6833b56cb --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/github-iterators.go @@ -0,0 +1,7631 @@ +// Code generated by gen-iterators; DO NOT EDIT. +// Instead, please run "go generate ./..." as described here: +// https://github.com/google/go-github/blob/master/CONTRIBUTING.md#submitting-a-patch + +// Copyright 2026 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "iter" +) + +// ListArtifactsIter returns an iterator that paginates through all results of ListArtifacts. +func (s *ActionsService) ListArtifactsIter(ctx context.Context, owner string, repo string, opts *ListArtifactsOptions) iter.Seq2[*Artifact, error] { + return func(yield func(*Artifact, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListArtifactsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListArtifacts(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Artifact + if results != nil { + iterItems = results.Artifacts + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListCacheUsageByRepoForOrgIter returns an iterator that paginates through all results of ListCacheUsageByRepoForOrg. +func (s *ActionsService) ListCacheUsageByRepoForOrgIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*ActionsCacheUsage, error] { + return func(yield func(*ActionsCacheUsage, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCacheUsageByRepoForOrg(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*ActionsCacheUsage + if results != nil { + iterItems = results.RepoCacheUsage + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCachesIter returns an iterator that paginates through all results of ListCaches. +func (s *ActionsService) ListCachesIter(ctx context.Context, owner string, repo string, opts *ActionsCacheListOptions) iter.Seq2[*ActionsCache, error] { + return func(yield func(*ActionsCache, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ActionsCacheListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCaches(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*ActionsCache + if results != nil { + iterItems = results.ActionsCaches + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListEnabledOrgsInEnterpriseIter returns an iterator that paginates through all results of ListEnabledOrgsInEnterprise. +func (s *ActionsService) ListEnabledOrgsInEnterpriseIter(ctx context.Context, owner string, opts *ListOptions) iter.Seq2[*Organization, error] { + return func(yield func(*Organization, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListEnabledOrgsInEnterprise(ctx, owner, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Organization + if results != nil { + iterItems = results.Organizations + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListEnabledReposInOrgIter returns an iterator that paginates through all results of ListEnabledReposInOrg. +func (s *ActionsService) ListEnabledReposInOrgIter(ctx context.Context, owner string, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListEnabledReposInOrg(ctx, owner, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListEnvSecretsIter returns an iterator that paginates through all results of ListEnvSecrets. +func (s *ActionsService) ListEnvSecretsIter(ctx context.Context, repoID int, env string, opts *ListOptions) iter.Seq2[*Secret, error] { + return func(yield func(*Secret, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListEnvSecrets(ctx, repoID, env, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Secret + if results != nil { + iterItems = results.Secrets + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListEnvVariablesIter returns an iterator that paginates through all results of ListEnvVariables. +func (s *ActionsService) ListEnvVariablesIter(ctx context.Context, owner string, repo string, env string, opts *ListOptions) iter.Seq2[*ActionsVariable, error] { + return func(yield func(*ActionsVariable, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListEnvVariables(ctx, owner, repo, env, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*ActionsVariable + if results != nil { + iterItems = results.Variables + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListHostedRunnersIter returns an iterator that paginates through all results of ListHostedRunners. +func (s *ActionsService) ListHostedRunnersIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*HostedRunner, error] { + return func(yield func(*HostedRunner, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListHostedRunners(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*HostedRunner + if results != nil { + iterItems = results.Runners + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListOrgSecretsIter returns an iterator that paginates through all results of ListOrgSecrets. +func (s *ActionsService) ListOrgSecretsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Secret, error] { + return func(yield func(*Secret, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrgSecrets(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Secret + if results != nil { + iterItems = results.Secrets + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListOrgVariablesIter returns an iterator that paginates through all results of ListOrgVariables. +func (s *ActionsService) ListOrgVariablesIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*ActionsVariable, error] { + return func(yield func(*ActionsVariable, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrgVariables(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*ActionsVariable + if results != nil { + iterItems = results.Variables + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListOrganizationRunnerGroupsIter returns an iterator that paginates through all results of ListOrganizationRunnerGroups. +func (s *ActionsService) ListOrganizationRunnerGroupsIter(ctx context.Context, org string, opts *ListOrgRunnerGroupOptions) iter.Seq2[*RunnerGroup, error] { + return func(yield func(*RunnerGroup, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOrgRunnerGroupOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrganizationRunnerGroups(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*RunnerGroup + if results != nil { + iterItems = results.RunnerGroups + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListOrganizationRunnersIter returns an iterator that paginates through all results of ListOrganizationRunners. +func (s *ActionsService) ListOrganizationRunnersIter(ctx context.Context, org string, opts *ListRunnersOptions) iter.Seq2[*Runner, error] { + return func(yield func(*Runner, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListRunnersOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrganizationRunners(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Runner + if results != nil { + iterItems = results.Runners + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListRepoOrgSecretsIter returns an iterator that paginates through all results of ListRepoOrgSecrets. +func (s *ActionsService) ListRepoOrgSecretsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Secret, error] { + return func(yield func(*Secret, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepoOrgSecrets(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Secret + if results != nil { + iterItems = results.Secrets + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRepoOrgVariablesIter returns an iterator that paginates through all results of ListRepoOrgVariables. +func (s *ActionsService) ListRepoOrgVariablesIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*ActionsVariable, error] { + return func(yield func(*ActionsVariable, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepoOrgVariables(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*ActionsVariable + if results != nil { + iterItems = results.Variables + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRepoSecretsIter returns an iterator that paginates through all results of ListRepoSecrets. +func (s *ActionsService) ListRepoSecretsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Secret, error] { + return func(yield func(*Secret, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepoSecrets(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Secret + if results != nil { + iterItems = results.Secrets + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRepoVariablesIter returns an iterator that paginates through all results of ListRepoVariables. +func (s *ActionsService) ListRepoVariablesIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*ActionsVariable, error] { + return func(yield func(*ActionsVariable, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepoVariables(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*ActionsVariable + if results != nil { + iterItems = results.Variables + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRepositoriesSelfHostedRunnersAllowedInOrganizationIter returns an iterator that paginates through all results of ListRepositoriesSelfHostedRunnersAllowedInOrganization. +func (s *ActionsService) ListRepositoriesSelfHostedRunnersAllowedInOrganizationIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepositoriesSelfHostedRunnersAllowedInOrganization(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRepositoryAccessRunnerGroupIter returns an iterator that paginates through all results of ListRepositoryAccessRunnerGroup. +func (s *ActionsService) ListRepositoryAccessRunnerGroupIter(ctx context.Context, org string, groupID int64, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepositoryAccessRunnerGroup(ctx, org, groupID, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRepositoryWorkflowRunsIter returns an iterator that paginates through all results of ListRepositoryWorkflowRuns. +func (s *ActionsService) ListRepositoryWorkflowRunsIter(ctx context.Context, owner string, repo string, opts *ListWorkflowRunsOptions) iter.Seq2[*WorkflowRun, error] { + return func(yield func(*WorkflowRun, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListWorkflowRunsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepositoryWorkflowRuns(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*WorkflowRun + if results != nil { + iterItems = results.WorkflowRuns + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListRunnerGroupHostedRunnersIter returns an iterator that paginates through all results of ListRunnerGroupHostedRunners. +func (s *ActionsService) ListRunnerGroupHostedRunnersIter(ctx context.Context, org string, groupID int64, opts *ListOptions) iter.Seq2[*HostedRunner, error] { + return func(yield func(*HostedRunner, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRunnerGroupHostedRunners(ctx, org, groupID, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*HostedRunner + if results != nil { + iterItems = results.Runners + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRunnerGroupRunnersIter returns an iterator that paginates through all results of ListRunnerGroupRunners. +func (s *ActionsService) ListRunnerGroupRunnersIter(ctx context.Context, org string, groupID int64, opts *ListOptions) iter.Seq2[*Runner, error] { + return func(yield func(*Runner, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRunnerGroupRunners(ctx, org, groupID, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Runner + if results != nil { + iterItems = results.Runners + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRunnersIter returns an iterator that paginates through all results of ListRunners. +func (s *ActionsService) ListRunnersIter(ctx context.Context, owner string, repo string, opts *ListRunnersOptions) iter.Seq2[*Runner, error] { + return func(yield func(*Runner, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListRunnersOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRunners(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Runner + if results != nil { + iterItems = results.Runners + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListSelectedReposForOrgSecretIter returns an iterator that paginates through all results of ListSelectedReposForOrgSecret. +func (s *ActionsService) ListSelectedReposForOrgSecretIter(ctx context.Context, org string, name string, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListSelectedReposForOrgSecret(ctx, org, name, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListSelectedReposForOrgVariableIter returns an iterator that paginates through all results of ListSelectedReposForOrgVariable. +func (s *ActionsService) ListSelectedReposForOrgVariableIter(ctx context.Context, org string, name string, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListSelectedReposForOrgVariable(ctx, org, name, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListWorkflowJobsIter returns an iterator that paginates through all results of ListWorkflowJobs. +func (s *ActionsService) ListWorkflowJobsIter(ctx context.Context, owner string, repo string, runID int64, opts *ListWorkflowJobsOptions) iter.Seq2[*WorkflowJob, error] { + return func(yield func(*WorkflowJob, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListWorkflowJobsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListWorkflowJobs(ctx, owner, repo, runID, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*WorkflowJob + if results != nil { + iterItems = results.Jobs + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListWorkflowJobsAttemptIter returns an iterator that paginates through all results of ListWorkflowJobsAttempt. +func (s *ActionsService) ListWorkflowJobsAttemptIter(ctx context.Context, owner string, repo string, runID int64, attemptNumber int64, opts *ListOptions) iter.Seq2[*WorkflowJob, error] { + return func(yield func(*WorkflowJob, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListWorkflowJobsAttempt(ctx, owner, repo, runID, attemptNumber, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*WorkflowJob + if results != nil { + iterItems = results.Jobs + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListWorkflowRunArtifactsIter returns an iterator that paginates through all results of ListWorkflowRunArtifacts. +func (s *ActionsService) ListWorkflowRunArtifactsIter(ctx context.Context, owner string, repo string, runID int64, opts *ListOptions) iter.Seq2[*Artifact, error] { + return func(yield func(*Artifact, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListWorkflowRunArtifacts(ctx, owner, repo, runID, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Artifact + if results != nil { + iterItems = results.Artifacts + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListWorkflowRunsByFileNameIter returns an iterator that paginates through all results of ListWorkflowRunsByFileName. +func (s *ActionsService) ListWorkflowRunsByFileNameIter(ctx context.Context, owner string, repo string, workflowFileName string, opts *ListWorkflowRunsOptions) iter.Seq2[*WorkflowRun, error] { + return func(yield func(*WorkflowRun, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListWorkflowRunsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListWorkflowRunsByFileName(ctx, owner, repo, workflowFileName, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*WorkflowRun + if results != nil { + iterItems = results.WorkflowRuns + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListWorkflowRunsByIDIter returns an iterator that paginates through all results of ListWorkflowRunsByID. +func (s *ActionsService) ListWorkflowRunsByIDIter(ctx context.Context, owner string, repo string, workflowID int64, opts *ListWorkflowRunsOptions) iter.Seq2[*WorkflowRun, error] { + return func(yield func(*WorkflowRun, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListWorkflowRunsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListWorkflowRunsByID(ctx, owner, repo, workflowID, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*WorkflowRun + if results != nil { + iterItems = results.WorkflowRuns + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListWorkflowsIter returns an iterator that paginates through all results of ListWorkflows. +func (s *ActionsService) ListWorkflowsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Workflow, error] { + return func(yield func(*Workflow, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListWorkflows(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Workflow + if results != nil { + iterItems = results.Workflows + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListEventsIter returns an iterator that paginates through all results of ListEvents. +func (s *ActivityService) ListEventsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*Event, error] { + return func(yield func(*Event, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListEvents(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListEventsForOrganizationIter returns an iterator that paginates through all results of ListEventsForOrganization. +func (s *ActivityService) ListEventsForOrganizationIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Event, error] { + return func(yield func(*Event, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListEventsForOrganization(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListEventsForRepoNetworkIter returns an iterator that paginates through all results of ListEventsForRepoNetwork. +func (s *ActivityService) ListEventsForRepoNetworkIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Event, error] { + return func(yield func(*Event, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListEventsForRepoNetwork(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListEventsPerformedByUserIter returns an iterator that paginates through all results of ListEventsPerformedByUser. +func (s *ActivityService) ListEventsPerformedByUserIter(ctx context.Context, user string, publicOnly bool, opts *ListOptions) iter.Seq2[*Event, error] { + return func(yield func(*Event, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListEventsPerformedByUser(ctx, user, publicOnly, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListEventsReceivedByUserIter returns an iterator that paginates through all results of ListEventsReceivedByUser. +func (s *ActivityService) ListEventsReceivedByUserIter(ctx context.Context, user string, publicOnly bool, opts *ListOptions) iter.Seq2[*Event, error] { + return func(yield func(*Event, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListEventsReceivedByUser(ctx, user, publicOnly, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListIssueEventsForRepositoryIter returns an iterator that paginates through all results of ListIssueEventsForRepository. +func (s *ActivityService) ListIssueEventsForRepositoryIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*IssueEvent, error] { + return func(yield func(*IssueEvent, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListIssueEventsForRepository(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListNotificationsIter returns an iterator that paginates through all results of ListNotifications. +func (s *ActivityService) ListNotificationsIter(ctx context.Context, opts *NotificationListOptions) iter.Seq2[*Notification, error] { + return func(yield func(*Notification, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &NotificationListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListNotifications(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListRepositoryEventsIter returns an iterator that paginates through all results of ListRepositoryEvents. +func (s *ActivityService) ListRepositoryEventsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Event, error] { + return func(yield func(*Event, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepositoryEvents(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRepositoryNotificationsIter returns an iterator that paginates through all results of ListRepositoryNotifications. +func (s *ActivityService) ListRepositoryNotificationsIter(ctx context.Context, owner string, repo string, opts *NotificationListOptions) iter.Seq2[*Notification, error] { + return func(yield func(*Notification, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &NotificationListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepositoryNotifications(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListStargazersIter returns an iterator that paginates through all results of ListStargazers. +func (s *ActivityService) ListStargazersIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Stargazer, error] { + return func(yield func(*Stargazer, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListStargazers(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListStarredIter returns an iterator that paginates through all results of ListStarred. +func (s *ActivityService) ListStarredIter(ctx context.Context, user string, opts *ActivityListStarredOptions) iter.Seq2[*StarredRepository, error] { + return func(yield func(*StarredRepository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ActivityListStarredOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListStarred(ctx, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListUserEventsForOrganizationIter returns an iterator that paginates through all results of ListUserEventsForOrganization. +func (s *ActivityService) ListUserEventsForOrganizationIter(ctx context.Context, org string, user string, opts *ListOptions) iter.Seq2[*Event, error] { + return func(yield func(*Event, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUserEventsForOrganization(ctx, org, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListWatchedIter returns an iterator that paginates through all results of ListWatched. +func (s *ActivityService) ListWatchedIter(ctx context.Context, user string, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListWatched(ctx, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListWatchersIter returns an iterator that paginates through all results of ListWatchers. +func (s *ActivityService) ListWatchersIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListWatchers(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListHookDeliveriesIter returns an iterator that paginates through all results of ListHookDeliveries. +func (s *AppsService) ListHookDeliveriesIter(ctx context.Context, opts *ListCursorOptions) iter.Seq2[*HookDelivery, error] { + return func(yield func(*HookDelivery, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListCursorOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListHookDeliveries(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.Cursor == "" { + break + } + opts.Cursor = resp.Cursor + } + } +} + +// ListInstallationRequestsIter returns an iterator that paginates through all results of ListInstallationRequests. +func (s *AppsService) ListInstallationRequestsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*InstallationRequest, error] { + return func(yield func(*InstallationRequest, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListInstallationRequests(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListInstallationsIter returns an iterator that paginates through all results of ListInstallations. +func (s *AppsService) ListInstallationsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*Installation, error] { + return func(yield func(*Installation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListInstallations(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListReposIter returns an iterator that paginates through all results of ListRepos. +func (s *AppsService) ListReposIter(ctx context.Context, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepos(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListUserInstallationsIter returns an iterator that paginates through all results of ListUserInstallations. +func (s *AppsService) ListUserInstallationsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*Installation, error] { + return func(yield func(*Installation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUserInstallations(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListUserReposIter returns an iterator that paginates through all results of ListUserRepos. +func (s *AppsService) ListUserReposIter(ctx context.Context, id int64, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUserRepos(ctx, id, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCheckRunAnnotationsIter returns an iterator that paginates through all results of ListCheckRunAnnotations. +func (s *ChecksService) ListCheckRunAnnotationsIter(ctx context.Context, owner string, repo string, checkRunID int64, opts *ListOptions) iter.Seq2[*CheckRunAnnotation, error] { + return func(yield func(*CheckRunAnnotation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCheckRunAnnotations(ctx, owner, repo, checkRunID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCheckRunsCheckSuiteIter returns an iterator that paginates through all results of ListCheckRunsCheckSuite. +func (s *ChecksService) ListCheckRunsCheckSuiteIter(ctx context.Context, owner string, repo string, checkSuiteID int64, opts *ListCheckRunsOptions) iter.Seq2[*CheckRun, error] { + return func(yield func(*CheckRun, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListCheckRunsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCheckRunsCheckSuite(ctx, owner, repo, checkSuiteID, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*CheckRun + if results != nil { + iterItems = results.CheckRuns + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListCheckRunsForRefIter returns an iterator that paginates through all results of ListCheckRunsForRef. +func (s *ChecksService) ListCheckRunsForRefIter(ctx context.Context, owner string, repo string, ref string, opts *ListCheckRunsOptions) iter.Seq2[*CheckRun, error] { + return func(yield func(*CheckRun, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListCheckRunsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCheckRunsForRef(ctx, owner, repo, ref, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*CheckRun + if results != nil { + iterItems = results.CheckRuns + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListCheckSuitesForRefIter returns an iterator that paginates through all results of ListCheckSuitesForRef. +func (s *ChecksService) ListCheckSuitesForRefIter(ctx context.Context, owner string, repo string, ref string, opts *ListCheckSuiteOptions) iter.Seq2[*CheckSuite, error] { + return func(yield func(*CheckSuite, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListCheckSuiteOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCheckSuitesForRef(ctx, owner, repo, ref, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*CheckSuite + if results != nil { + iterItems = results.CheckSuites + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListAcceptedAssignmentsIter returns an iterator that paginates through all results of ListAcceptedAssignments. +func (s *ClassroomService) ListAcceptedAssignmentsIter(ctx context.Context, assignmentID int64, opts *ListOptions) iter.Seq2[*AcceptedAssignment, error] { + return func(yield func(*AcceptedAssignment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAcceptedAssignments(ctx, assignmentID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListClassroomAssignmentsIter returns an iterator that paginates through all results of ListClassroomAssignments. +func (s *ClassroomService) ListClassroomAssignmentsIter(ctx context.Context, classroomID int64, opts *ListOptions) iter.Seq2[*ClassroomAssignment, error] { + return func(yield func(*ClassroomAssignment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListClassroomAssignments(ctx, classroomID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListClassroomsIter returns an iterator that paginates through all results of ListClassrooms. +func (s *ClassroomService) ListClassroomsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*Classroom, error] { + return func(yield func(*Classroom, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListClassrooms(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListAlertInstancesIter returns an iterator that paginates through all results of ListAlertInstances. +func (s *CodeScanningService) ListAlertInstancesIter(ctx context.Context, owner string, repo string, id int64, opts *AlertInstancesListOptions) iter.Seq2[*MostRecentInstance, error] { + return func(yield func(*MostRecentInstance, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &AlertInstancesListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAlertInstances(ctx, owner, repo, id, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListAlertsForOrgIter returns an iterator that paginates through all results of ListAlertsForOrg. +func (s *CodeScanningService) ListAlertsForOrgIter(ctx context.Context, org string, opts *AlertListOptions) iter.Seq2[*Alert, error] { + return func(yield func(*Alert, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &AlertListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAlertsForOrg(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" && resp.NextPage == 0 { + break + } + opts.ListCursorOptions.After = resp.After + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListAlertsForRepoIter returns an iterator that paginates through all results of ListAlertsForRepo. +func (s *CodeScanningService) ListAlertsForRepoIter(ctx context.Context, owner string, repo string, opts *AlertListOptions) iter.Seq2[*Alert, error] { + return func(yield func(*Alert, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &AlertListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAlertsForRepo(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" && resp.NextPage == 0 { + break + } + opts.ListCursorOptions.After = resp.After + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListAnalysesForRepoIter returns an iterator that paginates through all results of ListAnalysesForRepo. +func (s *CodeScanningService) ListAnalysesForRepoIter(ctx context.Context, owner string, repo string, opts *AnalysesListOptions) iter.Seq2[*ScanningAnalysis, error] { + return func(yield func(*ScanningAnalysis, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &AnalysesListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAnalysesForRepo(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListIter returns an iterator that paginates through all results of List. +func (s *CodespacesService) ListIter(ctx context.Context, opts *ListCodespacesOptions) iter.Seq2[*Codespace, error] { + return func(yield func(*Codespace, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListCodespacesOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.List(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Codespace + if results != nil { + iterItems = results.Codespaces + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListDevContainerConfigurationsIter returns an iterator that paginates through all results of ListDevContainerConfigurations. +func (s *CodespacesService) ListDevContainerConfigurationsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*DevContainer, error] { + return func(yield func(*DevContainer, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListDevContainerConfigurations(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*DevContainer + if results != nil { + iterItems = results.Devcontainers + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListInOrgIter returns an iterator that paginates through all results of ListInOrg. +func (s *CodespacesService) ListInOrgIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Codespace, error] { + return func(yield func(*Codespace, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListInOrg(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Codespace + if results != nil { + iterItems = results.Codespaces + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListInRepoIter returns an iterator that paginates through all results of ListInRepo. +func (s *CodespacesService) ListInRepoIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Codespace, error] { + return func(yield func(*Codespace, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListInRepo(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Codespace + if results != nil { + iterItems = results.Codespaces + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListOrgSecretsIter returns an iterator that paginates through all results of ListOrgSecrets. +func (s *CodespacesService) ListOrgSecretsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Secret, error] { + return func(yield func(*Secret, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrgSecrets(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Secret + if results != nil { + iterItems = results.Secrets + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRepoSecretsIter returns an iterator that paginates through all results of ListRepoSecrets. +func (s *CodespacesService) ListRepoSecretsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Secret, error] { + return func(yield func(*Secret, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepoSecrets(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Secret + if results != nil { + iterItems = results.Secrets + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListSelectedReposForOrgSecretIter returns an iterator that paginates through all results of ListSelectedReposForOrgSecret. +func (s *CodespacesService) ListSelectedReposForOrgSecretIter(ctx context.Context, org string, name string, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListSelectedReposForOrgSecret(ctx, org, name, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListSelectedReposForUserSecretIter returns an iterator that paginates through all results of ListSelectedReposForUserSecret. +func (s *CodespacesService) ListSelectedReposForUserSecretIter(ctx context.Context, name string, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListSelectedReposForUserSecret(ctx, name, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListUserCodespacesInOrgIter returns an iterator that paginates through all results of ListUserCodespacesInOrg. +func (s *CodespacesService) ListUserCodespacesInOrgIter(ctx context.Context, org string, username string, opts *ListOptions) iter.Seq2[*Codespace, error] { + return func(yield func(*Codespace, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUserCodespacesInOrg(ctx, org, username, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Codespace + if results != nil { + iterItems = results.Codespaces + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListUserSecretsIter returns an iterator that paginates through all results of ListUserSecrets. +func (s *CodespacesService) ListUserSecretsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*Secret, error] { + return func(yield func(*Secret, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUserSecrets(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Secret + if results != nil { + iterItems = results.Secrets + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCopilotEnterpriseSeatsIter returns an iterator that paginates through all results of ListCopilotEnterpriseSeats. +func (s *CopilotService) ListCopilotEnterpriseSeatsIter(ctx context.Context, enterprise string, opts *ListOptions) iter.Seq2[*CopilotSeatDetails, error] { + return func(yield func(*CopilotSeatDetails, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCopilotEnterpriseSeats(ctx, enterprise, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*CopilotSeatDetails + if results != nil { + iterItems = results.Seats + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCopilotSeatsIter returns an iterator that paginates through all results of ListCopilotSeats. +func (s *CopilotService) ListCopilotSeatsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*CopilotSeatDetails, error] { + return func(yield func(*CopilotSeatDetails, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCopilotSeats(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*CopilotSeatDetails + if results != nil { + iterItems = results.Seats + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListOrganizationCodingAgentRepositoriesIter returns an iterator that paginates through all results of ListOrganizationCodingAgentRepositories. +func (s *CopilotService) ListOrganizationCodingAgentRepositoriesIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrganizationCodingAgentRepositories(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListOrgAlertsIter returns an iterator that paginates through all results of ListOrgAlerts. +func (s *DependabotService) ListOrgAlertsIter(ctx context.Context, org string, opts *ListAlertsOptions) iter.Seq2[*DependabotAlert, error] { + return func(yield func(*DependabotAlert, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListAlertsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrgAlerts(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" && resp.NextPage == 0 { + break + } + opts.ListCursorOptions.After = resp.After + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListOrgSecretsIter returns an iterator that paginates through all results of ListOrgSecrets. +func (s *DependabotService) ListOrgSecretsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Secret, error] { + return func(yield func(*Secret, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrgSecrets(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Secret + if results != nil { + iterItems = results.Secrets + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRepoAlertsIter returns an iterator that paginates through all results of ListRepoAlerts. +func (s *DependabotService) ListRepoAlertsIter(ctx context.Context, owner string, repo string, opts *ListAlertsOptions) iter.Seq2[*DependabotAlert, error] { + return func(yield func(*DependabotAlert, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListAlertsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepoAlerts(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" && resp.NextPage == 0 { + break + } + opts.ListCursorOptions.After = resp.After + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListRepoSecretsIter returns an iterator that paginates through all results of ListRepoSecrets. +func (s *DependabotService) ListRepoSecretsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Secret, error] { + return func(yield func(*Secret, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepoSecrets(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Secret + if results != nil { + iterItems = results.Secrets + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListSelectedReposForOrgSecretIter returns an iterator that paginates through all results of ListSelectedReposForOrgSecret. +func (s *DependabotService) ListSelectedReposForOrgSecretIter(ctx context.Context, org string, name string, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListSelectedReposForOrgSecret(ctx, org, name, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListAppAccessibleOrganizationRepositoriesIter returns an iterator that paginates through all results of ListAppAccessibleOrganizationRepositories. +func (s *EnterpriseService) ListAppAccessibleOrganizationRepositoriesIter(ctx context.Context, enterprise string, org string, opts *ListOptions) iter.Seq2[*AccessibleRepository, error] { + return func(yield func(*AccessibleRepository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAppAccessibleOrganizationRepositories(ctx, enterprise, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListAppInstallableOrganizationsIter returns an iterator that paginates through all results of ListAppInstallableOrganizations. +func (s *EnterpriseService) ListAppInstallableOrganizationsIter(ctx context.Context, enterprise string, opts *ListOptions) iter.Seq2[*InstallableOrganization, error] { + return func(yield func(*InstallableOrganization, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAppInstallableOrganizations(ctx, enterprise, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListAppInstallationsIter returns an iterator that paginates through all results of ListAppInstallations. +func (s *EnterpriseService) ListAppInstallationsIter(ctx context.Context, enterprise string, org string, opts *ListOptions) iter.Seq2[*Installation, error] { + return func(yield func(*Installation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAppInstallations(ctx, enterprise, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListAssignmentsIter returns an iterator that paginates through all results of ListAssignments. +func (s *EnterpriseService) ListAssignmentsIter(ctx context.Context, enterprise string, enterpriseTeam string, opts *ListOptions) iter.Seq2[*Organization, error] { + return func(yield func(*Organization, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAssignments(ctx, enterprise, enterpriseTeam, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCodeSecurityConfigurationRepositoriesIter returns an iterator that paginates through all results of ListCodeSecurityConfigurationRepositories. +func (s *EnterpriseService) ListCodeSecurityConfigurationRepositoriesIter(ctx context.Context, enterprise string, configurationID int64, opts *ListCodeSecurityConfigurationRepositoriesOptions) iter.Seq2[*RepositoryAttachment, error] { + return func(yield func(*RepositoryAttachment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListCodeSecurityConfigurationRepositoriesOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCodeSecurityConfigurationRepositories(ctx, enterprise, configurationID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListCodeSecurityConfigurationsIter returns an iterator that paginates through all results of ListCodeSecurityConfigurations. +func (s *EnterpriseService) ListCodeSecurityConfigurationsIter(ctx context.Context, enterprise string, opts *ListEnterpriseCodeSecurityConfigurationOptions) iter.Seq2[*CodeSecurityConfiguration, error] { + return func(yield func(*CodeSecurityConfiguration, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListEnterpriseCodeSecurityConfigurationOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCodeSecurityConfigurations(ctx, enterprise, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListConsumedLicensesIter returns an iterator that paginates through all results of ListConsumedLicenses. +func (s *EnterpriseService) ListConsumedLicensesIter(ctx context.Context, enterprise string, opts *ListOptions) iter.Seq2[*EnterpriseLicensedUsers, error] { + return func(yield func(*EnterpriseLicensedUsers, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListConsumedLicenses(ctx, enterprise, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*EnterpriseLicensedUsers + if results != nil { + iterItems = results.Users + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListEnterpriseNetworkConfigurationsIter returns an iterator that paginates through all results of ListEnterpriseNetworkConfigurations. +func (s *EnterpriseService) ListEnterpriseNetworkConfigurationsIter(ctx context.Context, enterprise string, opts *ListOptions) iter.Seq2[*NetworkConfiguration, error] { + return func(yield func(*NetworkConfiguration, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListEnterpriseNetworkConfigurations(ctx, enterprise, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*NetworkConfiguration + if results != nil { + iterItems = results.NetworkConfigurations + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListHostedRunnersIter returns an iterator that paginates through all results of ListHostedRunners. +func (s *EnterpriseService) ListHostedRunnersIter(ctx context.Context, enterprise string, opts *ListOptions) iter.Seq2[*HostedRunner, error] { + return func(yield func(*HostedRunner, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListHostedRunners(ctx, enterprise, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*HostedRunner + if results != nil { + iterItems = results.Runners + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListOrganizationAccessRunnerGroupIter returns an iterator that paginates through all results of ListOrganizationAccessRunnerGroup. +func (s *EnterpriseService) ListOrganizationAccessRunnerGroupIter(ctx context.Context, enterprise string, groupID int64, opts *ListOptions) iter.Seq2[*Organization, error] { + return func(yield func(*Organization, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrganizationAccessRunnerGroup(ctx, enterprise, groupID, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Organization + if results != nil { + iterItems = results.Organizations + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListOrganizationCustomPropertyValuesIter returns an iterator that paginates through all results of ListOrganizationCustomPropertyValues. +func (s *EnterpriseService) ListOrganizationCustomPropertyValuesIter(ctx context.Context, enterprise string, opts *ListOptions) iter.Seq2[*EnterpriseCustomPropertiesValues, error] { + return func(yield func(*EnterpriseCustomPropertiesValues, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrganizationCustomPropertyValues(ctx, enterprise, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRepositoriesForOrgAppInstallationIter returns an iterator that paginates through all results of ListRepositoriesForOrgAppInstallation. +func (s *EnterpriseService) ListRepositoriesForOrgAppInstallationIter(ctx context.Context, enterprise string, org string, installationID int64, opts *ListOptions) iter.Seq2[*AccessibleRepository, error] { + return func(yield func(*AccessibleRepository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepositoriesForOrgAppInstallation(ctx, enterprise, org, installationID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRunnerGroupRunnersIter returns an iterator that paginates through all results of ListRunnerGroupRunners. +func (s *EnterpriseService) ListRunnerGroupRunnersIter(ctx context.Context, enterprise string, groupID int64, opts *ListOptions) iter.Seq2[*Runner, error] { + return func(yield func(*Runner, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRunnerGroupRunners(ctx, enterprise, groupID, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Runner + if results != nil { + iterItems = results.Runners + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRunnerGroupsIter returns an iterator that paginates through all results of ListRunnerGroups. +func (s *EnterpriseService) ListRunnerGroupsIter(ctx context.Context, enterprise string, opts *ListEnterpriseRunnerGroupOptions) iter.Seq2[*EnterpriseRunnerGroup, error] { + return func(yield func(*EnterpriseRunnerGroup, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListEnterpriseRunnerGroupOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRunnerGroups(ctx, enterprise, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*EnterpriseRunnerGroup + if results != nil { + iterItems = results.RunnerGroups + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListRunnersIter returns an iterator that paginates through all results of ListRunners. +func (s *EnterpriseService) ListRunnersIter(ctx context.Context, enterprise string, opts *ListRunnersOptions) iter.Seq2[*Runner, error] { + return func(yield func(*Runner, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListRunnersOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRunners(ctx, enterprise, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Runner + if results != nil { + iterItems = results.Runners + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListTeamMembersIter returns an iterator that paginates through all results of ListTeamMembers. +func (s *EnterpriseService) ListTeamMembersIter(ctx context.Context, enterprise string, enterpriseTeam string, opts *ListOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListTeamMembers(ctx, enterprise, enterpriseTeam, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListTeamsIter returns an iterator that paginates through all results of ListTeams. +func (s *EnterpriseService) ListTeamsIter(ctx context.Context, enterprise string, opts *ListOptions) iter.Seq2[*EnterpriseTeam, error] { + return func(yield func(*EnterpriseTeam, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListTeams(ctx, enterprise, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListIter returns an iterator that paginates through all results of List. +func (s *GistsService) ListIter(ctx context.Context, user string, opts *GistListOptions) iter.Seq2[*Gist, error] { + return func(yield func(*Gist, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &GistListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.List(ctx, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListAllIter returns an iterator that paginates through all results of ListAll. +func (s *GistsService) ListAllIter(ctx context.Context, opts *GistListOptions) iter.Seq2[*Gist, error] { + return func(yield func(*Gist, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &GistListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAll(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListCommentsIter returns an iterator that paginates through all results of ListComments. +func (s *GistsService) ListCommentsIter(ctx context.Context, gistID string, opts *ListOptions) iter.Seq2[*GistComment, error] { + return func(yield func(*GistComment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListComments(ctx, gistID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCommitsIter returns an iterator that paginates through all results of ListCommits. +func (s *GistsService) ListCommitsIter(ctx context.Context, id string, opts *ListOptions) iter.Seq2[*GistCommit, error] { + return func(yield func(*GistCommit, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCommits(ctx, id, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListForksIter returns an iterator that paginates through all results of ListForks. +func (s *GistsService) ListForksIter(ctx context.Context, id string, opts *ListOptions) iter.Seq2[*GistFork, error] { + return func(yield func(*GistFork, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListForks(ctx, id, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListStarredIter returns an iterator that paginates through all results of ListStarred. +func (s *GistsService) ListStarredIter(ctx context.Context, opts *GistListOptions) iter.Seq2[*Gist, error] { + return func(yield func(*Gist, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &GistListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListStarred(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListAllIssuesIter returns an iterator that paginates through all results of ListAllIssues. +func (s *IssuesService) ListAllIssuesIter(ctx context.Context, opts *ListAllIssuesOptions) iter.Seq2[*Issue, error] { + return func(yield func(*Issue, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListAllIssuesOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAllIssues(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListAssigneesIter returns an iterator that paginates through all results of ListAssignees. +func (s *IssuesService) ListAssigneesIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAssignees(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListByOrgIter returns an iterator that paginates through all results of ListByOrg. +func (s *IssuesService) ListByOrgIter(ctx context.Context, org string, opts *IssueListByOrgOptions) iter.Seq2[*Issue, error] { + return func(yield func(*Issue, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &IssueListByOrgOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListByOrg(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListByRepoIter returns an iterator that paginates through all results of ListByRepo. +func (s *IssuesService) ListByRepoIter(ctx context.Context, owner string, repo string, opts *IssueListByRepoOptions) iter.Seq2[*Issue, error] { + return func(yield func(*Issue, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &IssueListByRepoOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListByRepo(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" && resp.NextPage == 0 { + break + } + opts.ListCursorOptions.After = resp.After + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListCommentsIter returns an iterator that paginates through all results of ListComments. +func (s *IssuesService) ListCommentsIter(ctx context.Context, owner string, repo string, number int, opts *IssueListCommentsOptions) iter.Seq2[*IssueComment, error] { + return func(yield func(*IssueComment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &IssueListCommentsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListComments(ctx, owner, repo, number, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListIssueEventsIter returns an iterator that paginates through all results of ListIssueEvents. +func (s *IssuesService) ListIssueEventsIter(ctx context.Context, owner string, repo string, number int, opts *ListOptions) iter.Seq2[*IssueEvent, error] { + return func(yield func(*IssueEvent, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListIssueEvents(ctx, owner, repo, number, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListIssueTimelineIter returns an iterator that paginates through all results of ListIssueTimeline. +func (s *IssuesService) ListIssueTimelineIter(ctx context.Context, owner string, repo string, number int, opts *ListOptions) iter.Seq2[*Timeline, error] { + return func(yield func(*Timeline, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListIssueTimeline(ctx, owner, repo, number, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListLabelsIter returns an iterator that paginates through all results of ListLabels. +func (s *IssuesService) ListLabelsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Label, error] { + return func(yield func(*Label, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListLabels(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListLabelsByIssueIter returns an iterator that paginates through all results of ListLabelsByIssue. +func (s *IssuesService) ListLabelsByIssueIter(ctx context.Context, owner string, repo string, number int, opts *ListOptions) iter.Seq2[*Label, error] { + return func(yield func(*Label, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListLabelsByIssue(ctx, owner, repo, number, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListLabelsForMilestoneIter returns an iterator that paginates through all results of ListLabelsForMilestone. +func (s *IssuesService) ListLabelsForMilestoneIter(ctx context.Context, owner string, repo string, number int, opts *ListOptions) iter.Seq2[*Label, error] { + return func(yield func(*Label, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListLabelsForMilestone(ctx, owner, repo, number, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListMilestonesIter returns an iterator that paginates through all results of ListMilestones. +func (s *IssuesService) ListMilestonesIter(ctx context.Context, owner string, repo string, opts *MilestoneListOptions) iter.Seq2[*Milestone, error] { + return func(yield func(*Milestone, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &MilestoneListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListMilestones(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListRepositoryEventsIter returns an iterator that paginates through all results of ListRepositoryEvents. +func (s *IssuesService) ListRepositoryEventsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*IssueEvent, error] { + return func(yield func(*IssueEvent, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepositoryEvents(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListUserIssuesIter returns an iterator that paginates through all results of ListUserIssues. +func (s *IssuesService) ListUserIssuesIter(ctx context.Context, opts *ListUserIssuesOptions) iter.Seq2[*Issue, error] { + return func(yield func(*Issue, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListUserIssuesOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUserIssues(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListIter returns an iterator that paginates through all results of List. +func (s *LicensesService) ListIter(ctx context.Context, opts *ListLicensesOptions) iter.Seq2[*License, error] { + return func(yield func(*License, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListLicensesOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.List(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListMarketplacePurchasesForUserIter returns an iterator that paginates through all results of ListMarketplacePurchasesForUser. +func (s *MarketplaceService) ListMarketplacePurchasesForUserIter(ctx context.Context, opts *ListOptions) iter.Seq2[*MarketplacePurchase, error] { + return func(yield func(*MarketplacePurchase, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListMarketplacePurchasesForUser(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListPlanAccountsForPlanIter returns an iterator that paginates through all results of ListPlanAccountsForPlan. +func (s *MarketplaceService) ListPlanAccountsForPlanIter(ctx context.Context, planID int64, opts *ListOptions) iter.Seq2[*MarketplacePlanAccount, error] { + return func(yield func(*MarketplacePlanAccount, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListPlanAccountsForPlan(ctx, planID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListPlansIter returns an iterator that paginates through all results of ListPlans. +func (s *MarketplaceService) ListPlansIter(ctx context.Context, opts *ListOptions) iter.Seq2[*MarketplacePlan, error] { + return func(yield func(*MarketplacePlan, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListPlans(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListMigrationsIter returns an iterator that paginates through all results of ListMigrations. +func (s *MigrationService) ListMigrationsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Migration, error] { + return func(yield func(*Migration, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListMigrations(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListUserMigrationsIter returns an iterator that paginates through all results of ListUserMigrations. +func (s *MigrationService) ListUserMigrationsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*UserMigration, error] { + return func(yield func(*UserMigration, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUserMigrations(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListIter returns an iterator that paginates through all results of List. +func (s *OrganizationsService) ListIter(ctx context.Context, user string, opts *ListOptions) iter.Seq2[*Organization, error] { + return func(yield func(*Organization, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.List(ctx, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListAllRepositoryRulesetsIter returns an iterator that paginates through all results of ListAllRepositoryRulesets. +func (s *OrganizationsService) ListAllRepositoryRulesetsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*RepositoryRuleset, error] { + return func(yield func(*RepositoryRuleset, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAllRepositoryRulesets(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListAttestationsIter returns an iterator that paginates through all results of ListAttestations. +func (s *OrganizationsService) ListAttestationsIter(ctx context.Context, org string, subjectDigest string, opts *ListOptions) iter.Seq2[*Attestation, error] { + return func(yield func(*Attestation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAttestations(ctx, org, subjectDigest, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Attestation + if results != nil { + iterItems = results.Attestations + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListBlockedUsersIter returns an iterator that paginates through all results of ListBlockedUsers. +func (s *OrganizationsService) ListBlockedUsersIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListBlockedUsers(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCodeSecurityConfigurationRepositoriesIter returns an iterator that paginates through all results of ListCodeSecurityConfigurationRepositories. +func (s *OrganizationsService) ListCodeSecurityConfigurationRepositoriesIter(ctx context.Context, org string, configurationID int64, opts *ListCodeSecurityConfigurationRepositoriesOptions) iter.Seq2[*RepositoryAttachment, error] { + return func(yield func(*RepositoryAttachment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListCodeSecurityConfigurationRepositoriesOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCodeSecurityConfigurationRepositories(ctx, org, configurationID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListCodeSecurityConfigurationsIter returns an iterator that paginates through all results of ListCodeSecurityConfigurations. +func (s *OrganizationsService) ListCodeSecurityConfigurationsIter(ctx context.Context, org string, opts *ListOrgCodeSecurityConfigurationOptions) iter.Seq2[*CodeSecurityConfiguration, error] { + return func(yield func(*CodeSecurityConfiguration, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOrgCodeSecurityConfigurationOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCodeSecurityConfigurations(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListCredentialAuthorizationsIter returns an iterator that paginates through all results of ListCredentialAuthorizations. +func (s *OrganizationsService) ListCredentialAuthorizationsIter(ctx context.Context, org string, opts *CredentialAuthorizationsListOptions) iter.Seq2[*CredentialAuthorization, error] { + return func(yield func(*CredentialAuthorization, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &CredentialAuthorizationsListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCredentialAuthorizations(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListCustomPropertyValuesIter returns an iterator that paginates through all results of ListCustomPropertyValues. +func (s *OrganizationsService) ListCustomPropertyValuesIter(ctx context.Context, org string, opts *ListCustomPropertyValuesOptions) iter.Seq2[*RepoCustomPropertyValue, error] { + return func(yield func(*RepoCustomPropertyValue, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListCustomPropertyValuesOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCustomPropertyValues(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListFailedOrgInvitationsIter returns an iterator that paginates through all results of ListFailedOrgInvitations. +func (s *OrganizationsService) ListFailedOrgInvitationsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Invitation, error] { + return func(yield func(*Invitation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListFailedOrgInvitations(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListFineGrainedPersonalAccessTokenRequestsIter returns an iterator that paginates through all results of ListFineGrainedPersonalAccessTokenRequests. +func (s *OrganizationsService) ListFineGrainedPersonalAccessTokenRequestsIter(ctx context.Context, org string, opts *ListFineGrainedPATOptions) iter.Seq2[*FineGrainedPersonalAccessTokenRequest, error] { + return func(yield func(*FineGrainedPersonalAccessTokenRequest, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListFineGrainedPATOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListFineGrainedPersonalAccessTokenRequests(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListFineGrainedPersonalAccessTokensIter returns an iterator that paginates through all results of ListFineGrainedPersonalAccessTokens. +func (s *OrganizationsService) ListFineGrainedPersonalAccessTokensIter(ctx context.Context, org string, opts *ListFineGrainedPATOptions) iter.Seq2[*PersonalAccessToken, error] { + return func(yield func(*PersonalAccessToken, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListFineGrainedPATOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListFineGrainedPersonalAccessTokens(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListHookDeliveriesIter returns an iterator that paginates through all results of ListHookDeliveries. +func (s *OrganizationsService) ListHookDeliveriesIter(ctx context.Context, org string, id int64, opts *ListCursorOptions) iter.Seq2[*HookDelivery, error] { + return func(yield func(*HookDelivery, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListCursorOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListHookDeliveries(ctx, org, id, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.Cursor == "" { + break + } + opts.Cursor = resp.Cursor + } + } +} + +// ListHooksIter returns an iterator that paginates through all results of ListHooks. +func (s *OrganizationsService) ListHooksIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Hook, error] { + return func(yield func(*Hook, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListHooks(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListImmutableReleaseRepositoriesIter returns an iterator that paginates through all results of ListImmutableReleaseRepositories. +func (s *OrganizationsService) ListImmutableReleaseRepositoriesIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListImmutableReleaseRepositories(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListInstallationsIter returns an iterator that paginates through all results of ListInstallations. +func (s *OrganizationsService) ListInstallationsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Installation, error] { + return func(yield func(*Installation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListInstallations(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Installation + if results != nil { + iterItems = results.Installations + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListMembersIter returns an iterator that paginates through all results of ListMembers. +func (s *OrganizationsService) ListMembersIter(ctx context.Context, org string, opts *ListMembersOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListMembersOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListMembers(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListNetworkConfigurationsIter returns an iterator that paginates through all results of ListNetworkConfigurations. +func (s *OrganizationsService) ListNetworkConfigurationsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*NetworkConfiguration, error] { + return func(yield func(*NetworkConfiguration, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListNetworkConfigurations(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*NetworkConfiguration + if results != nil { + iterItems = results.NetworkConfigurations + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListOrgInvitationTeamsIter returns an iterator that paginates through all results of ListOrgInvitationTeams. +func (s *OrganizationsService) ListOrgInvitationTeamsIter(ctx context.Context, org string, invitationID string, opts *ListOptions) iter.Seq2[*Team, error] { + return func(yield func(*Team, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrgInvitationTeams(ctx, org, invitationID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListOrgMembershipsIter returns an iterator that paginates through all results of ListOrgMemberships. +func (s *OrganizationsService) ListOrgMembershipsIter(ctx context.Context, opts *ListOrgMembershipsOptions) iter.Seq2[*Membership, error] { + return func(yield func(*Membership, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOrgMembershipsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrgMemberships(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListOutsideCollaboratorsIter returns an iterator that paginates through all results of ListOutsideCollaborators. +func (s *OrganizationsService) ListOutsideCollaboratorsIter(ctx context.Context, org string, opts *ListOutsideCollaboratorsOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOutsideCollaboratorsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOutsideCollaborators(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListPackagesIter returns an iterator that paginates through all results of ListPackages. +func (s *OrganizationsService) ListPackagesIter(ctx context.Context, org string, opts *PackageListOptions) iter.Seq2[*Package, error] { + return func(yield func(*Package, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &PackageListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListPackages(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListPendingOrgInvitationsIter returns an iterator that paginates through all results of ListPendingOrgInvitations. +func (s *OrganizationsService) ListPendingOrgInvitationsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Invitation, error] { + return func(yield func(*Invitation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListPendingOrgInvitations(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListTeamsAssignedToOrgRoleIter returns an iterator that paginates through all results of ListTeamsAssignedToOrgRole. +func (s *OrganizationsService) ListTeamsAssignedToOrgRoleIter(ctx context.Context, org string, roleID int64, opts *ListOptions) iter.Seq2[*Team, error] { + return func(yield func(*Team, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListTeamsAssignedToOrgRole(ctx, org, roleID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListUsersAssignedToOrgRoleIter returns an iterator that paginates through all results of ListUsersAssignedToOrgRole. +func (s *OrganizationsService) ListUsersAssignedToOrgRoleIter(ctx context.Context, org string, roleID int64, opts *ListOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUsersAssignedToOrgRole(ctx, org, roleID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListOrganizationPrivateRegistriesIter returns an iterator that paginates through all results of ListOrganizationPrivateRegistries. +func (s *PrivateRegistriesService) ListOrganizationPrivateRegistriesIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*PrivateRegistry, error] { + return func(yield func(*PrivateRegistry, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrganizationPrivateRegistries(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*PrivateRegistry + if results != nil { + iterItems = results.Configurations + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListOrganizationProjectFieldsIter returns an iterator that paginates through all results of ListOrganizationProjectFields. +func (s *ProjectsService) ListOrganizationProjectFieldsIter(ctx context.Context, org string, projectNumber int, opts *ListProjectsOptions) iter.Seq2[*ProjectV2Field, error] { + return func(yield func(*ProjectV2Field, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListProjectsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrganizationProjectFields(ctx, org, projectNumber, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListOrganizationProjectItemsIter returns an iterator that paginates through all results of ListOrganizationProjectItems. +func (s *ProjectsService) ListOrganizationProjectItemsIter(ctx context.Context, org string, projectNumber int, opts *ListProjectItemsOptions) iter.Seq2[*ProjectV2Item, error] { + return func(yield func(*ProjectV2Item, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListProjectItemsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrganizationProjectItems(ctx, org, projectNumber, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListOrganizationProjectsIter returns an iterator that paginates through all results of ListOrganizationProjects. +func (s *ProjectsService) ListOrganizationProjectsIter(ctx context.Context, org string, opts *ListProjectsOptions) iter.Seq2[*ProjectV2, error] { + return func(yield func(*ProjectV2, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListProjectsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrganizationProjects(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListUserProjectFieldsIter returns an iterator that paginates through all results of ListUserProjectFields. +func (s *ProjectsService) ListUserProjectFieldsIter(ctx context.Context, user string, projectNumber int, opts *ListProjectsOptions) iter.Seq2[*ProjectV2Field, error] { + return func(yield func(*ProjectV2Field, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListProjectsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUserProjectFields(ctx, user, projectNumber, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListUserProjectItemsIter returns an iterator that paginates through all results of ListUserProjectItems. +func (s *ProjectsService) ListUserProjectItemsIter(ctx context.Context, username string, projectNumber int, opts *ListProjectItemsOptions) iter.Seq2[*ProjectV2Item, error] { + return func(yield func(*ProjectV2Item, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListProjectItemsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUserProjectItems(ctx, username, projectNumber, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListUserProjectsIter returns an iterator that paginates through all results of ListUserProjects. +func (s *ProjectsService) ListUserProjectsIter(ctx context.Context, username string, opts *ListProjectsOptions) iter.Seq2[*ProjectV2, error] { + return func(yield func(*ProjectV2, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListProjectsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUserProjects(ctx, username, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListIter returns an iterator that paginates through all results of List. +func (s *PullRequestsService) ListIter(ctx context.Context, owner string, repo string, opts *PullRequestListOptions) iter.Seq2[*PullRequest, error] { + return func(yield func(*PullRequest, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &PullRequestListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.List(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListCommentsIter returns an iterator that paginates through all results of ListComments. +func (s *PullRequestsService) ListCommentsIter(ctx context.Context, owner string, repo string, number int, opts *PullRequestListCommentsOptions) iter.Seq2[*PullRequestComment, error] { + return func(yield func(*PullRequestComment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &PullRequestListCommentsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListComments(ctx, owner, repo, number, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListCommitsIter returns an iterator that paginates through all results of ListCommits. +func (s *PullRequestsService) ListCommitsIter(ctx context.Context, owner string, repo string, number int, opts *ListOptions) iter.Seq2[*RepositoryCommit, error] { + return func(yield func(*RepositoryCommit, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCommits(ctx, owner, repo, number, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListFilesIter returns an iterator that paginates through all results of ListFiles. +func (s *PullRequestsService) ListFilesIter(ctx context.Context, owner string, repo string, number int, opts *ListOptions) iter.Seq2[*CommitFile, error] { + return func(yield func(*CommitFile, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListFiles(ctx, owner, repo, number, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListPullRequestsWithCommitIter returns an iterator that paginates through all results of ListPullRequestsWithCommit. +func (s *PullRequestsService) ListPullRequestsWithCommitIter(ctx context.Context, owner string, repo string, sha string, opts *ListOptions) iter.Seq2[*PullRequest, error] { + return func(yield func(*PullRequest, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListPullRequestsWithCommit(ctx, owner, repo, sha, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListReviewCommentsIter returns an iterator that paginates through all results of ListReviewComments. +func (s *PullRequestsService) ListReviewCommentsIter(ctx context.Context, owner string, repo string, number int, reviewID int64, opts *ListOptions) iter.Seq2[*PullRequestComment, error] { + return func(yield func(*PullRequestComment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListReviewComments(ctx, owner, repo, number, reviewID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListReviewsIter returns an iterator that paginates through all results of ListReviews. +func (s *PullRequestsService) ListReviewsIter(ctx context.Context, owner string, repo string, number int, opts *ListOptions) iter.Seq2[*PullRequestReview, error] { + return func(yield func(*PullRequestReview, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListReviews(ctx, owner, repo, number, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCommentReactionsIter returns an iterator that paginates through all results of ListCommentReactions. +func (s *ReactionsService) ListCommentReactionsIter(ctx context.Context, owner string, repo string, id int64, opts *ListReactionOptions) iter.Seq2[*Reaction, error] { + return func(yield func(*Reaction, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListReactionOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCommentReactions(ctx, owner, repo, id, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListIssueCommentReactionsIter returns an iterator that paginates through all results of ListIssueCommentReactions. +func (s *ReactionsService) ListIssueCommentReactionsIter(ctx context.Context, owner string, repo string, id int64, opts *ListReactionOptions) iter.Seq2[*Reaction, error] { + return func(yield func(*Reaction, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListReactionOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListIssueCommentReactions(ctx, owner, repo, id, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListIssueReactionsIter returns an iterator that paginates through all results of ListIssueReactions. +func (s *ReactionsService) ListIssueReactionsIter(ctx context.Context, owner string, repo string, number int, opts *ListReactionOptions) iter.Seq2[*Reaction, error] { + return func(yield func(*Reaction, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListReactionOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListIssueReactions(ctx, owner, repo, number, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListPullRequestCommentReactionsIter returns an iterator that paginates through all results of ListPullRequestCommentReactions. +func (s *ReactionsService) ListPullRequestCommentReactionsIter(ctx context.Context, owner string, repo string, id int64, opts *ListReactionOptions) iter.Seq2[*Reaction, error] { + return func(yield func(*Reaction, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListReactionOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListPullRequestCommentReactions(ctx, owner, repo, id, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListReleaseReactionsIter returns an iterator that paginates through all results of ListReleaseReactions. +func (s *ReactionsService) ListReleaseReactionsIter(ctx context.Context, owner string, repo string, releaseID int64, opts *ListReactionOptions) iter.Seq2[*Reaction, error] { + return func(yield func(*Reaction, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListReactionOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListReleaseReactions(ctx, owner, repo, releaseID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListTeamDiscussionCommentReactionsIter returns an iterator that paginates through all results of ListTeamDiscussionCommentReactions. +func (s *ReactionsService) ListTeamDiscussionCommentReactionsIter(ctx context.Context, teamID int64, discussionNumber int, commentNumber int, opts *ListReactionOptions) iter.Seq2[*Reaction, error] { + return func(yield func(*Reaction, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListReactionOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListTeamDiscussionCommentReactions(ctx, teamID, discussionNumber, commentNumber, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListTeamDiscussionReactionsIter returns an iterator that paginates through all results of ListTeamDiscussionReactions. +func (s *ReactionsService) ListTeamDiscussionReactionsIter(ctx context.Context, teamID int64, discussionNumber int, opts *ListReactionOptions) iter.Seq2[*Reaction, error] { + return func(yield func(*Reaction, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListReactionOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListTeamDiscussionReactions(ctx, teamID, discussionNumber, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListCommitComparisonFilesIter returns an iterator that paginates through all results of CompareCommits. +func (s *RepositoriesService) ListCommitComparisonFilesIter(ctx context.Context, owner string, repo string, base string, head string, opts *ListOptions) iter.Seq2[*CommitFile, error] { + return func(yield func(*CommitFile, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.CompareCommits(ctx, owner, repo, base, head, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*CommitFile + if results != nil { + iterItems = results.Files + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCombinedStatusIter returns an iterator that paginates through all results of GetCombinedStatus. +func (s *RepositoriesService) ListCombinedStatusIter(ctx context.Context, owner string, repo string, ref string, opts *ListOptions) iter.Seq2[*RepoStatus, error] { + return func(yield func(*RepoStatus, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.GetCombinedStatus(ctx, owner, repo, ref, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*RepoStatus + if results != nil { + iterItems = results.Statuses + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCommitFilesIter returns an iterator that paginates through all results of GetCommit. +func (s *RepositoriesService) ListCommitFilesIter(ctx context.Context, owner string, repo string, sha string, opts *ListOptions) iter.Seq2[*CommitFile, error] { + return func(yield func(*CommitFile, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.GetCommit(ctx, owner, repo, sha, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*CommitFile + if results != nil { + iterItems = results.Files + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListIter returns an iterator that paginates through all results of List. +func (s *RepositoriesService) ListIter(ctx context.Context, user string, opts *RepositoryListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &RepositoryListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.List(ctx, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListAllTopicsIter returns an iterator that paginates through all results of ListAllTopics. +func (s *RepositoriesService) ListAllTopicsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[string, error] { + return func(yield func(string, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAllTopics(ctx, owner, repo, opts) + if err != nil { + yield(*new(string), err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListAttestationsIter returns an iterator that paginates through all results of ListAttestations. +func (s *RepositoriesService) ListAttestationsIter(ctx context.Context, owner string, repo string, subjectDigest string, opts *ListOptions) iter.Seq2[*Attestation, error] { + return func(yield func(*Attestation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAttestations(ctx, owner, repo, subjectDigest, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Attestation + if results != nil { + iterItems = results.Attestations + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListBranchesIter returns an iterator that paginates through all results of ListBranches. +func (s *RepositoriesService) ListBranchesIter(ctx context.Context, owner string, repo string, opts *BranchListOptions) iter.Seq2[*Branch, error] { + return func(yield func(*Branch, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &BranchListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListBranches(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListByAuthenticatedUserIter returns an iterator that paginates through all results of ListByAuthenticatedUser. +func (s *RepositoriesService) ListByAuthenticatedUserIter(ctx context.Context, opts *RepositoryListByAuthenticatedUserOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &RepositoryListByAuthenticatedUserOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListByAuthenticatedUser(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListByOrgIter returns an iterator that paginates through all results of ListByOrg. +func (s *RepositoriesService) ListByOrgIter(ctx context.Context, org string, opts *RepositoryListByOrgOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &RepositoryListByOrgOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListByOrg(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListByUserIter returns an iterator that paginates through all results of ListByUser. +func (s *RepositoriesService) ListByUserIter(ctx context.Context, user string, opts *RepositoryListByUserOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &RepositoryListByUserOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListByUser(ctx, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListCollaboratorsIter returns an iterator that paginates through all results of ListCollaborators. +func (s *RepositoriesService) ListCollaboratorsIter(ctx context.Context, owner string, repo string, opts *ListCollaboratorsOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListCollaboratorsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCollaborators(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListCommentsIter returns an iterator that paginates through all results of ListComments. +func (s *RepositoriesService) ListCommentsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*RepositoryComment, error] { + return func(yield func(*RepositoryComment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListComments(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCommitCommentsIter returns an iterator that paginates through all results of ListCommitComments. +func (s *RepositoriesService) ListCommitCommentsIter(ctx context.Context, owner string, repo string, sha string, opts *ListOptions) iter.Seq2[*RepositoryComment, error] { + return func(yield func(*RepositoryComment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCommitComments(ctx, owner, repo, sha, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCommitsIter returns an iterator that paginates through all results of ListCommits. +func (s *RepositoriesService) ListCommitsIter(ctx context.Context, owner string, repo string, opts *CommitsListOptions) iter.Seq2[*RepositoryCommit, error] { + return func(yield func(*RepositoryCommit, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &CommitsListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCommits(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListContributorsIter returns an iterator that paginates through all results of ListContributors. +func (s *RepositoriesService) ListContributorsIter(ctx context.Context, owner string, repository string, opts *ListContributorsOptions) iter.Seq2[*Contributor, error] { + return func(yield func(*Contributor, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListContributorsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListContributors(ctx, owner, repository, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListCustomDeploymentRuleIntegrationsIter returns an iterator that paginates through all results of ListCustomDeploymentRuleIntegrations. +func (s *RepositoriesService) ListCustomDeploymentRuleIntegrationsIter(ctx context.Context, owner string, repo string, environment string, opts *ListOptions) iter.Seq2[*CustomDeploymentProtectionRuleApp, error] { + return func(yield func(*CustomDeploymentProtectionRuleApp, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCustomDeploymentRuleIntegrations(ctx, owner, repo, environment, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*CustomDeploymentProtectionRuleApp + if results != nil { + iterItems = results.AvailableIntegrations + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListDeploymentBranchPoliciesIter returns an iterator that paginates through all results of ListDeploymentBranchPolicies. +func (s *RepositoriesService) ListDeploymentBranchPoliciesIter(ctx context.Context, owner string, repo string, environment string, opts *ListOptions) iter.Seq2[*DeploymentBranchPolicy, error] { + return func(yield func(*DeploymentBranchPolicy, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListDeploymentBranchPolicies(ctx, owner, repo, environment, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*DeploymentBranchPolicy + if results != nil { + iterItems = results.BranchPolicies + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListDeploymentStatusesIter returns an iterator that paginates through all results of ListDeploymentStatuses. +func (s *RepositoriesService) ListDeploymentStatusesIter(ctx context.Context, owner string, repo string, deployment int64, opts *ListOptions) iter.Seq2[*DeploymentStatus, error] { + return func(yield func(*DeploymentStatus, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListDeploymentStatuses(ctx, owner, repo, deployment, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListDeploymentsIter returns an iterator that paginates through all results of ListDeployments. +func (s *RepositoriesService) ListDeploymentsIter(ctx context.Context, owner string, repo string, opts *DeploymentsListOptions) iter.Seq2[*Deployment, error] { + return func(yield func(*Deployment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &DeploymentsListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListDeployments(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListEnvironmentsIter returns an iterator that paginates through all results of ListEnvironments. +func (s *RepositoriesService) ListEnvironmentsIter(ctx context.Context, owner string, repo string, opts *EnvironmentListOptions) iter.Seq2[*Environment, error] { + return func(yield func(*Environment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &EnvironmentListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListEnvironments(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Environment + if results != nil { + iterItems = results.Environments + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListForksIter returns an iterator that paginates through all results of ListForks. +func (s *RepositoriesService) ListForksIter(ctx context.Context, owner string, repo string, opts *RepositoryListForksOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &RepositoryListForksOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListForks(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListHookDeliveriesIter returns an iterator that paginates through all results of ListHookDeliveries. +func (s *RepositoriesService) ListHookDeliveriesIter(ctx context.Context, owner string, repo string, id int64, opts *ListCursorOptions) iter.Seq2[*HookDelivery, error] { + return func(yield func(*HookDelivery, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListCursorOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListHookDeliveries(ctx, owner, repo, id, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.Cursor == "" { + break + } + opts.Cursor = resp.Cursor + } + } +} + +// ListHooksIter returns an iterator that paginates through all results of ListHooks. +func (s *RepositoriesService) ListHooksIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Hook, error] { + return func(yield func(*Hook, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListHooks(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListInvitationsIter returns an iterator that paginates through all results of ListInvitations. +func (s *RepositoriesService) ListInvitationsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*RepositoryInvitation, error] { + return func(yield func(*RepositoryInvitation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListInvitations(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListKeysIter returns an iterator that paginates through all results of ListKeys. +func (s *RepositoriesService) ListKeysIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Key, error] { + return func(yield func(*Key, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListKeys(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListPagesBuildsIter returns an iterator that paginates through all results of ListPagesBuilds. +func (s *RepositoriesService) ListPagesBuildsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*PagesBuild, error] { + return func(yield func(*PagesBuild, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListPagesBuilds(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListPreReceiveHooksIter returns an iterator that paginates through all results of ListPreReceiveHooks. +func (s *RepositoriesService) ListPreReceiveHooksIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*PreReceiveHook, error] { + return func(yield func(*PreReceiveHook, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListPreReceiveHooks(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListReleaseAssetsIter returns an iterator that paginates through all results of ListReleaseAssets. +func (s *RepositoriesService) ListReleaseAssetsIter(ctx context.Context, owner string, repo string, id int64, opts *ListOptions) iter.Seq2[*ReleaseAsset, error] { + return func(yield func(*ReleaseAsset, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListReleaseAssets(ctx, owner, repo, id, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListReleasesIter returns an iterator that paginates through all results of ListReleases. +func (s *RepositoriesService) ListReleasesIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*RepositoryRelease, error] { + return func(yield func(*RepositoryRelease, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListReleases(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRepositoryActivitiesIter returns an iterator that paginates through all results of ListRepositoryActivities. +func (s *RepositoriesService) ListRepositoryActivitiesIter(ctx context.Context, owner string, repo string, opts *ListRepositoryActivityOptions) iter.Seq2[*RepositoryActivity, error] { + return func(yield func(*RepositoryActivity, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListRepositoryActivityOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepositoryActivities(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListStatusesIter returns an iterator that paginates through all results of ListStatuses. +func (s *RepositoriesService) ListStatusesIter(ctx context.Context, owner string, repo string, ref string, opts *ListOptions) iter.Seq2[*RepoStatus, error] { + return func(yield func(*RepoStatus, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListStatuses(ctx, owner, repo, ref, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListTagsIter returns an iterator that paginates through all results of ListTags. +func (s *RepositoriesService) ListTagsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*RepositoryTag, error] { + return func(yield func(*RepositoryTag, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListTags(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListTeamsIter returns an iterator that paginates through all results of ListTeams. +func (s *RepositoriesService) ListTeamsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Team, error] { + return func(yield func(*Team, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListTeams(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListAlertsForEnterpriseIter returns an iterator that paginates through all results of ListAlertsForEnterprise. +func (s *SecretScanningService) ListAlertsForEnterpriseIter(ctx context.Context, enterprise string, opts *SecretScanningAlertListOptions) iter.Seq2[*SecretScanningAlert, error] { + return func(yield func(*SecretScanningAlert, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &SecretScanningAlertListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAlertsForEnterprise(ctx, enterprise, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" && resp.NextPage == 0 { + break + } + opts.ListCursorOptions.After = resp.After + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListAlertsForOrgIter returns an iterator that paginates through all results of ListAlertsForOrg. +func (s *SecretScanningService) ListAlertsForOrgIter(ctx context.Context, org string, opts *SecretScanningAlertListOptions) iter.Seq2[*SecretScanningAlert, error] { + return func(yield func(*SecretScanningAlert, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &SecretScanningAlertListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAlertsForOrg(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" && resp.NextPage == 0 { + break + } + opts.ListCursorOptions.After = resp.After + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListAlertsForRepoIter returns an iterator that paginates through all results of ListAlertsForRepo. +func (s *SecretScanningService) ListAlertsForRepoIter(ctx context.Context, owner string, repo string, opts *SecretScanningAlertListOptions) iter.Seq2[*SecretScanningAlert, error] { + return func(yield func(*SecretScanningAlert, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &SecretScanningAlertListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAlertsForRepo(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" && resp.NextPage == 0 { + break + } + opts.ListCursorOptions.After = resp.After + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListLocationsForAlertIter returns an iterator that paginates through all results of ListLocationsForAlert. +func (s *SecretScanningService) ListLocationsForAlertIter(ctx context.Context, owner string, repo string, number int64, opts *ListOptions) iter.Seq2[*SecretScanningAlertLocation, error] { + return func(yield func(*SecretScanningAlertLocation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListLocationsForAlert(ctx, owner, repo, number, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListGlobalSecurityAdvisoriesIter returns an iterator that paginates through all results of ListGlobalSecurityAdvisories. +func (s *SecurityAdvisoriesService) ListGlobalSecurityAdvisoriesIter(ctx context.Context, opts *ListGlobalSecurityAdvisoriesOptions) iter.Seq2[*GlobalSecurityAdvisory, error] { + return func(yield func(*GlobalSecurityAdvisory, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListGlobalSecurityAdvisoriesOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListGlobalSecurityAdvisories(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.ListCursorOptions.After = resp.After + } + } +} + +// ListRepositorySecurityAdvisoriesIter returns an iterator that paginates through all results of ListRepositorySecurityAdvisories. +func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisoriesIter(ctx context.Context, owner string, repo string, opts *ListRepositorySecurityAdvisoriesOptions) iter.Seq2[*SecurityAdvisory, error] { + return func(yield func(*SecurityAdvisory, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListRepositorySecurityAdvisoriesOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepositorySecurityAdvisories(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.ListCursorOptions.After = resp.After + } + } +} + +// ListRepositorySecurityAdvisoriesForOrgIter returns an iterator that paginates through all results of ListRepositorySecurityAdvisoriesForOrg. +func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisoriesForOrgIter(ctx context.Context, org string, opts *ListRepositorySecurityAdvisoriesOptions) iter.Seq2[*SecurityAdvisory, error] { + return func(yield func(*SecurityAdvisory, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListRepositorySecurityAdvisoriesOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepositorySecurityAdvisoriesForOrg(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.ListCursorOptions.After = resp.After + } + } +} + +// ListByIssueIter returns an iterator that paginates through all results of ListByIssue. +func (s *SubIssueService) ListByIssueIter(ctx context.Context, owner string, repo string, issueNumber int64, opts *ListOptions) iter.Seq2[*SubIssue, error] { + return func(yield func(*SubIssue, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListByIssue(ctx, owner, repo, issueNumber, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListChildTeamsByParentIDIter returns an iterator that paginates through all results of ListChildTeamsByParentID. +func (s *TeamsService) ListChildTeamsByParentIDIter(ctx context.Context, orgID int64, teamID int64, opts *ListOptions) iter.Seq2[*Team, error] { + return func(yield func(*Team, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListChildTeamsByParentID(ctx, orgID, teamID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListChildTeamsByParentSlugIter returns an iterator that paginates through all results of ListChildTeamsByParentSlug. +func (s *TeamsService) ListChildTeamsByParentSlugIter(ctx context.Context, org string, slug string, opts *ListOptions) iter.Seq2[*Team, error] { + return func(yield func(*Team, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListChildTeamsByParentSlug(ctx, org, slug, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCommentsByIDIter returns an iterator that paginates through all results of ListCommentsByID. +func (s *TeamsService) ListCommentsByIDIter(ctx context.Context, orgID int64, teamID int64, discussionNumber int, options *DiscussionCommentListOptions) iter.Seq2[*DiscussionComment, error] { + return func(yield func(*DiscussionComment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if options == nil { + options = &DiscussionCommentListOptions{} + } else { + options = Ptr(*options) + } + + for { + results, resp, err := s.ListCommentsByID(ctx, orgID, teamID, discussionNumber, options) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + options.ListOptions.Page = resp.NextPage + } + } +} + +// ListCommentsBySlugIter returns an iterator that paginates through all results of ListCommentsBySlug. +func (s *TeamsService) ListCommentsBySlugIter(ctx context.Context, org string, slug string, discussionNumber int, options *DiscussionCommentListOptions) iter.Seq2[*DiscussionComment, error] { + return func(yield func(*DiscussionComment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if options == nil { + options = &DiscussionCommentListOptions{} + } else { + options = Ptr(*options) + } + + for { + results, resp, err := s.ListCommentsBySlug(ctx, org, slug, discussionNumber, options) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + options.ListOptions.Page = resp.NextPage + } + } +} + +// ListDiscussionsByIDIter returns an iterator that paginates through all results of ListDiscussionsByID. +func (s *TeamsService) ListDiscussionsByIDIter(ctx context.Context, orgID int64, teamID int64, opts *DiscussionListOptions) iter.Seq2[*TeamDiscussion, error] { + return func(yield func(*TeamDiscussion, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &DiscussionListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListDiscussionsByID(ctx, orgID, teamID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListDiscussionsBySlugIter returns an iterator that paginates through all results of ListDiscussionsBySlug. +func (s *TeamsService) ListDiscussionsBySlugIter(ctx context.Context, org string, slug string, opts *DiscussionListOptions) iter.Seq2[*TeamDiscussion, error] { + return func(yield func(*TeamDiscussion, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &DiscussionListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListDiscussionsBySlug(ctx, org, slug, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListExternalGroupsIter returns an iterator that paginates through all results of ListExternalGroups. +func (s *TeamsService) ListExternalGroupsIter(ctx context.Context, org string, opts *ListExternalGroupsOptions) iter.Seq2[*ExternalGroup, error] { + return func(yield func(*ExternalGroup, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListExternalGroupsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListExternalGroups(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*ExternalGroup + if results != nil { + iterItems = results.Groups + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListIDPGroupsInOrganizationIter returns an iterator that paginates through all results of ListIDPGroupsInOrganization. +func (s *TeamsService) ListIDPGroupsInOrganizationIter(ctx context.Context, org string, opts *ListIDPGroupsOptions) iter.Seq2[*IDPGroup, error] { + return func(yield func(*IDPGroup, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListIDPGroupsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListIDPGroupsInOrganization(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*IDPGroup + if results != nil { + iterItems = results.Groups + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.ListCursorOptions.After = resp.After + } + } +} + +// ListPendingTeamInvitationsByIDIter returns an iterator that paginates through all results of ListPendingTeamInvitationsByID. +func (s *TeamsService) ListPendingTeamInvitationsByIDIter(ctx context.Context, orgID int64, teamID int64, opts *ListOptions) iter.Seq2[*Invitation, error] { + return func(yield func(*Invitation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListPendingTeamInvitationsByID(ctx, orgID, teamID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListPendingTeamInvitationsBySlugIter returns an iterator that paginates through all results of ListPendingTeamInvitationsBySlug. +func (s *TeamsService) ListPendingTeamInvitationsBySlugIter(ctx context.Context, org string, slug string, opts *ListOptions) iter.Seq2[*Invitation, error] { + return func(yield func(*Invitation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListPendingTeamInvitationsBySlug(ctx, org, slug, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListTeamMembersByIDIter returns an iterator that paginates through all results of ListTeamMembersByID. +func (s *TeamsService) ListTeamMembersByIDIter(ctx context.Context, orgID int64, teamID int64, opts *TeamListTeamMembersOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &TeamListTeamMembersOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListTeamMembersByID(ctx, orgID, teamID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListTeamMembersBySlugIter returns an iterator that paginates through all results of ListTeamMembersBySlug. +func (s *TeamsService) ListTeamMembersBySlugIter(ctx context.Context, org string, slug string, opts *TeamListTeamMembersOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &TeamListTeamMembersOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListTeamMembersBySlug(ctx, org, slug, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListTeamReposByIDIter returns an iterator that paginates through all results of ListTeamReposByID. +func (s *TeamsService) ListTeamReposByIDIter(ctx context.Context, orgID int64, teamID int64, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListTeamReposByID(ctx, orgID, teamID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListTeamReposBySlugIter returns an iterator that paginates through all results of ListTeamReposBySlug. +func (s *TeamsService) ListTeamReposBySlugIter(ctx context.Context, org string, slug string, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListTeamReposBySlug(ctx, org, slug, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListTeamsIter returns an iterator that paginates through all results of ListTeams. +func (s *TeamsService) ListTeamsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Team, error] { + return func(yield func(*Team, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListTeams(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListUserTeamsIter returns an iterator that paginates through all results of ListUserTeams. +func (s *TeamsService) ListUserTeamsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*Team, error] { + return func(yield func(*Team, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUserTeams(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListAttestationsIter returns an iterator that paginates through all results of ListAttestations. +func (s *UsersService) ListAttestationsIter(ctx context.Context, user string, subjectDigest string, opts *ListOptions) iter.Seq2[*Attestation, error] { + return func(yield func(*Attestation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAttestations(ctx, user, subjectDigest, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Attestation + if results != nil { + iterItems = results.Attestations + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListBlockedUsersIter returns an iterator that paginates through all results of ListBlockedUsers. +func (s *UsersService) ListBlockedUsersIter(ctx context.Context, opts *ListOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListBlockedUsers(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListEmailsIter returns an iterator that paginates through all results of ListEmails. +func (s *UsersService) ListEmailsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*UserEmail, error] { + return func(yield func(*UserEmail, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListEmails(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListFollowersIter returns an iterator that paginates through all results of ListFollowers. +func (s *UsersService) ListFollowersIter(ctx context.Context, user string, opts *ListOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListFollowers(ctx, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListFollowingIter returns an iterator that paginates through all results of ListFollowing. +func (s *UsersService) ListFollowingIter(ctx context.Context, user string, opts *ListOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListFollowing(ctx, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListGPGKeysIter returns an iterator that paginates through all results of ListGPGKeys. +func (s *UsersService) ListGPGKeysIter(ctx context.Context, user string, opts *ListOptions) iter.Seq2[*GPGKey, error] { + return func(yield func(*GPGKey, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListGPGKeys(ctx, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListInvitationsIter returns an iterator that paginates through all results of ListInvitations. +func (s *UsersService) ListInvitationsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*RepositoryInvitation, error] { + return func(yield func(*RepositoryInvitation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListInvitations(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListKeysIter returns an iterator that paginates through all results of ListKeys. +func (s *UsersService) ListKeysIter(ctx context.Context, user string, opts *ListOptions) iter.Seq2[*Key, error] { + return func(yield func(*Key, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListKeys(ctx, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListPackageVersionsIter returns an iterator that paginates through all results of ListPackageVersions. +func (s *UsersService) ListPackageVersionsIter(ctx context.Context, packageType string, packageName string, opts *ListPackageVersionsOptions) iter.Seq2[*PackageVersion, error] { + return func(yield func(*PackageVersion, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListPackageVersionsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListPackageVersions(ctx, packageType, packageName, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListPackagesIter returns an iterator that paginates through all results of ListPackages. +func (s *UsersService) ListPackagesIter(ctx context.Context, user string, opts *PackageListOptions) iter.Seq2[*Package, error] { + return func(yield func(*Package, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &PackageListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListPackages(ctx, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListSSHSigningKeysIter returns an iterator that paginates through all results of ListSSHSigningKeys. +func (s *UsersService) ListSSHSigningKeysIter(ctx context.Context, user string, opts *ListOptions) iter.Seq2[*SSHSigningKey, error] { + return func(yield func(*SSHSigningKey, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListSSHSigningKeys(ctx, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListSocialAccountsIter returns an iterator that paginates through all results of ListSocialAccounts. +func (s *UsersService) ListSocialAccountsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*SocialAccount, error] { + return func(yield func(*SocialAccount, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListSocialAccounts(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListUserSocialAccountsIter returns an iterator that paginates through all results of ListUserSocialAccounts. +func (s *UsersService) ListUserSocialAccountsIter(ctx context.Context, username string, opts *ListOptions) iter.Seq2[*SocialAccount, error] { + return func(yield func(*SocialAccount, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUserSocialAccounts(ctx, username, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} diff --git a/vendor/github.com/google/go-github/v73/github/github.go b/vendor/github.com/google/go-github/v88/github/github.go similarity index 66% rename from vendor/github.com/google/go-github/v73/github/github.go rename to vendor/github.com/google/go-github/v88/github/github.go index 8f3f3e431..08838a249 100644 --- a/vendor/github.com/google/go-github/v73/github/github.go +++ b/vendor/github.com/google/go-github/v88/github/github.go @@ -4,8 +4,9 @@ // license that can be found in the LICENSE file. //go:generate go run gen-accessors.go +//go:generate go run gen-iterators.go //go:generate go run gen-stringify-test.go -//go:generate ../script/metadata.sh update-go +//go:generate sh ../script/metadata.sh update-go package github @@ -18,8 +19,8 @@ import ( "io" "net/http" "net/url" - "reflect" "regexp" + "slices" "strconv" "strings" "sync" @@ -29,21 +30,28 @@ import ( ) const ( - Version = "v73.0.0" - - defaultAPIVersion = "2022-11-28" - defaultBaseURL = "https://api.github.com/" - defaultUserAgent = "go-github" + "/" + Version - uploadBaseURL = "https://uploads.github.com/" - - headerAPIVersion = "X-Github-Api-Version" - headerRateLimit = "X-Ratelimit-Limit" - headerRateRemaining = "X-Ratelimit-Remaining" - headerRateUsed = "X-Ratelimit-Used" - headerRateReset = "X-Ratelimit-Reset" - headerRateResource = "X-Ratelimit-Resource" - headerOTP = "X-Github-Otp" - headerRetryAfter = "Retry-After" + Version = "v88.0.0" + + HeaderRateLimit = "X-Ratelimit-Limit" + HeaderRateRemaining = "X-Ratelimit-Remaining" + HeaderRateReset = "X-Ratelimit-Reset" + HeaderRateResource = "X-Ratelimit-Resource" + HeaderRateUsed = "X-Ratelimit-Used" + HeaderRequestID = "X-Github-Request-Id" + + // https://docs.github.com/en/rest/about-the-rest-api/api-versions#about-api-versioning + defaultAPIVersion = api20221128 + latestAPIVersion = api20260310 + api20221128 = "2022-11-28" + api20260310 = "2026-03-10" + + defaultBaseURL = "https://api.github.com/" + defaultUserAgent = "go-github" + "/" + Version + uploadBaseURL = "https://uploads.github.com/" + + headerAPIVersion = "X-Github-Api-Version" + headerOTP = "X-Github-Otp" + headerRetryAfter = "Retry-After" headerTokenExpiration = "Github-Authentication-Token-Expiration" @@ -55,8 +63,9 @@ const ( mediaTypeOrgPermissionRepo = "application/vnd.github.v3.repository+json" mediaTypeIssueImportAPI = "application/vnd.github.golden-comet-preview+json" mediaTypeStarring = "application/vnd.github.star+json" + mediaTypeSCIM = "application/scim+json" - // Media Type values to access preview APIs + // Media Type values to access preview APIs. // These media types will be added to the API request as headers // and used to enable particular features on GitHub API that are still in preview. // After some time, specific media types will be promoted (to a "stable" state). @@ -71,7 +80,7 @@ const ( // versions. Additionally, non-functional (preview) headers don't create any side effects // on GitHub Cloud version. // - // See https://github.com/google/go-github/pull/2125 for full context. + // See https://github.com/google/go-github/pull/2125 and https://github.com/google/go-github/pull/2188 for full context. // https://help.github.com/enterprise/2.4/admin/guides/migrations/exporting-the-github-com-organization-s-repositories/ mediaTypeMigrationsPreview = "application/vnd.github.wyandotte-preview+json" @@ -152,24 +161,30 @@ const ( mediaTypeContentAttachmentsPreview = "application/vnd.github.corsair-preview+json" ) -var errNonNilContext = errors.New("context must be non-nil") +// ErrPathForbidden is returned when a URL path contains ".." as a path +// segment, which could allow path traversal attacks. +var ErrPathForbidden = errors.New("path must not contain '..' due to auth vulnerability issue") // A Client manages communication with the GitHub API. type Client struct { - clientMu sync.Mutex // clientMu protects the client during calls that modify the CheckRedirect func. client *http.Client // HTTP client used to communicate with the API. clientIgnoreRedirects *http.Client // HTTP client used to communicate with the API on endpoints where we don't want to follow redirects. // Base URL for API requests. Defaults to the public GitHub API, but can be - // set to a domain endpoint to use with GitHub Enterprise. BaseURL should + // set to a domain endpoint to use with GitHub Enterprise. baseURL should // always be specified with a trailing slash. - BaseURL *url.URL + baseURL *url.URL // Base URL for uploading files. - UploadURL *url.URL + uploadURL *url.URL // User agent used when communicating with the GitHub API. - UserAgent string + userAgent string + + // disableRateLimitCheck stops the client checking for rate limits or tracking + // them. This is different to setting BypassRateLimitCheck in the context, + // as that still tracks the rate limits. + disableRateLimitCheck bool rateMu sync.Mutex rateLimits [Categories]Rate // Rate limits for the client as determined by the most recent API calls. @@ -177,10 +192,10 @@ type Client struct { // If specified, Client will block requests for at most this duration in case of reaching a secondary // rate limit - MaxSecondaryRateLimitRetryAfterDuration time.Duration + maxSecondaryRateLimitRetryAfterDuration time.Duration // Whether to respect rate limit headers on endpoints that return 302 redirections to artifacts - RateLimitRedirectionalEndpoints bool + rateLimitRedirectionalEndpoints bool common service // Reuse a single struct instead of allocating one for each service on the heap. @@ -192,10 +207,12 @@ type Client struct { Authorizations *AuthorizationsService Billing *BillingService Checks *ChecksService + Classroom *ClassroomService CodeScanning *CodeScanningService CodesOfConduct *CodesOfConductService Codespaces *CodespacesService Copilot *CopilotService + Credentials *CredentialsService Dependabot *DependabotService DependencyGraph *DependencyGraphService Emojis *EmojisService @@ -212,6 +229,8 @@ type Client struct { Meta *MetaService Migrations *MigrationService Organizations *OrganizationsService + PrivateRegistries *PrivateRegistriesService + Projects *ProjectsService PullRequests *PullRequestsService RateLimit *RateLimitService Reactions *ReactionsService @@ -233,8 +252,6 @@ type service struct { // This should only be used for requests to the GitHub API because // request headers will contain an authorization token. func (c *Client) Client() *http.Client { - c.clientMu.Lock() - defer c.clientMu.Unlock() clientCopy := *c.client return &clientCopy } @@ -299,11 +316,12 @@ type RawOptions struct { Type RawType } +type structPtr[T any] interface{ *T } + // addOptions adds the parameters in opts as URL query parameters to s. opts // must be a struct whose fields may contain "url" tags. -func addOptions(s string, opts any) (string, error) { - v := reflect.ValueOf(opts) - if v.Kind() == reflect.Ptr && v.IsNil() { +func addOptions[P structPtr[T], T any](s string, opts P) (string, error) { + if opts == nil { return s, nil } @@ -321,106 +339,304 @@ func addOptions(s string, opts any) (string, error) { return u.String(), nil } -// NewClient returns a new GitHub API client. If a nil httpClient is -// provided, a new http.Client will be used. To use API methods which require -// authentication, either use Client.WithAuthToken or provide NewClient with -// an http.Client that will perform the authentication for you (such as that -// provided by the golang.org/x/oauth2 library). -func NewClient(httpClient *http.Client) *Client { - if httpClient == nil { - httpClient = &http.Client{} +// errUninitialized is returned when an uninitialized Client is used. +var errUninitialized = errors.New("client is not initialized") + +// clientOptions holds the configuration options for a Client. +type clientOptions struct { + httpClient *http.Client + transport http.RoundTripper + timeout *time.Duration + userAgent *string + envProxy bool + token *string + baseURL *url.URL + uploadURL *url.URL + disableRateLimitCheck bool + rateLimitRedirectionalEndpoints bool + maxSecondaryRateLimitRetryAfterDuration *time.Duration + marketplaceStubbed bool +} + +// ClientOptionsFunc is a functional option for providing configuration options +// to a Client. +type ClientOptionsFunc func(*clientOptions) error + +// WithHTTPClient returns a ClientOptionsFunc that sets the http.Client +// for a Client. If not set, a default http.Client will be used. +func WithHTTPClient(httpClient *http.Client) ClientOptionsFunc { + return func(o *clientOptions) error { + if httpClient == nil { + return errors.New("http client must not be nil") + } + + httpClient := *httpClient + o.httpClient = &httpClient + return nil } - httpClient2 := *httpClient - c := &Client{client: &httpClient2} - c.initialize() - return c } -// WithAuthToken returns a copy of the client configured to use the provided token for the Authorization header. -func (c *Client) WithAuthToken(token string) *Client { - c2 := c.copy() - defer c2.initialize() - transport := c2.client.Transport - if transport == nil { - transport = http.DefaultTransport +// WithTransport returns a ClientOptionsFunc that sets the http.RoundTripper +// for a Client. This overrides the transport set by [WithHTTPClient]. If not +// set and no HTTP client is provided, the default http.RoundTripper will be used. +func WithTransport(transport http.RoundTripper) ClientOptionsFunc { + return func(o *clientOptions) error { + if transport == nil { + return errors.New("transport must not be nil") + } + + o.transport = transport + return nil } - c2.client.Transport = roundTripperFunc( - func(req *http.Request) (*http.Response, error) { - req = req.Clone(req.Context()) - req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token)) - return transport.RoundTrip(req) - }, - ) - return c2 } -// WithEnterpriseURLs returns a copy of the client configured to use the provided base and -// upload URLs. If the base URL does not have the suffix "/api/v3/", it will be added -// automatically. If the upload URL does not have the suffix "/api/uploads", it will be -// added automatically. -// -// Note that WithEnterpriseURLs is a convenience helper only; -// its behavior is equivalent to setting the BaseURL and UploadURL fields. -// -// Another important thing is that by default, the GitHub Enterprise URL format -// should be http(s)://[hostname]/api/v3/ or you will always receive the 406 status code. -// The upload URL format should be http(s)://[hostname]/api/uploads/. -func (c *Client) WithEnterpriseURLs(baseURL, uploadURL string) (*Client, error) { - c2 := c.copy() - defer c2.initialize() - var err error - c2.BaseURL, err = url.Parse(baseURL) - if err != nil { - return nil, err +// WithTimeout returns a ClientOptionsFunc that sets the timeout for a Client. +// This overrides the timeout set by [WithHTTPClient]. If not set and no HTTP +// client is provided, the default http.Client with no timeout will be used. +// It is recommended to provide a timeout for production environments. +func WithTimeout(timeout time.Duration) ClientOptionsFunc { + return func(o *clientOptions) error { + if timeout < 0 { + return errors.New("timeout must not be negative") + } + + o.timeout = &timeout + return nil } +} - if !strings.HasSuffix(c2.BaseURL.Path, "/") { - c2.BaseURL.Path += "/" +// WithUserAgent returns a ClientOptionsFunc that sets the User-Agent header +// for a Client. If not set, a default User-Agent will be used. +func WithUserAgent(userAgent string) ClientOptionsFunc { + return func(o *clientOptions) error { + o.userAgent = &userAgent + return nil } - if !strings.HasSuffix(c2.BaseURL.Path, "/api/v3/") && - !strings.HasPrefix(c2.BaseURL.Host, "api.") && - !strings.Contains(c2.BaseURL.Host, ".api.") { - c2.BaseURL.Path += "api/v3/" +} + +// WithEnvProxy returns a ClientOptionsFunc that configures the Client to use +// the HTTP proxy settings from the environment variables +// (e.g., HTTP_PROXY, HTTPS_PROXY, NO_PROXY). +// If not set, the client will not use environment proxy settings. +func WithEnvProxy() ClientOptionsFunc { + return func(o *clientOptions) error { + o.envProxy = true + return nil } +} - c2.UploadURL, err = url.Parse(uploadURL) - if err != nil { - return nil, err +// WithAuthToken returns a ClientOptionsFunc that sets the authentication token +// for a Client. If not set, the client will make unauthenticated requests. +func WithAuthToken(token string) ClientOptionsFunc { + return func(o *clientOptions) error { + if token == "" { + return errors.New("token must not be empty") + } + + o.token = &token + return nil } +} + +// WithURLs returns a ClientOptionsFunc that sets the base and upload URLs +// while only validating the URL format. Nil values will be ignored and default +// URLs will be used. +func WithURLs(baseURL, uploadURL *string) ClientOptionsFunc { + return func(o *clientOptions) error { + if baseURL != nil { + b, err := parseURL(*baseURL) + if err != nil { + return fmt.Errorf("invalid base url: %w", err) + } + + o.baseURL = b + } - if !strings.HasSuffix(c2.UploadURL.Path, "/") { - c2.UploadURL.Path += "/" + if uploadURL != nil { + u, err := parseURL(*uploadURL) + if err != nil { + return fmt.Errorf("invalid upload url: %w", err) + } + + o.uploadURL = u + } + + return nil } - if !strings.HasSuffix(c2.UploadURL.Path, "/api/uploads/") && - !strings.HasPrefix(c2.UploadURL.Host, "api.") && - !strings.Contains(c2.UploadURL.Host, ".api.") { - c2.UploadURL.Path += "api/uploads/" +} + +// WithEnterpriseURLs returns a ClientOptionsFunc that sets the base and upload +// URLs for a Client. +func WithEnterpriseURLs(baseURL, uploadURL string) ClientOptionsFunc { + return func(o *clientOptions) error { + b, err := parseURL(baseURL) + if err != nil { + return fmt.Errorf("invalid base url: %w", err) + } + + if !strings.HasSuffix(b.Path, "/api/v3/") && + !strings.HasPrefix(b.Host, "api.") && + !strings.Contains(b.Host, ".api.") { + b.Path += "api/v3/" + } + + o.baseURL = b + + u, err := parseURL(uploadURL) + if err != nil { + return fmt.Errorf("invalid upload url: %w", err) + } + + if !strings.HasSuffix(u.Path, "/api/uploads/") && + !strings.HasPrefix(u.Host, "api.") && + !strings.Contains(u.Host, ".api.") && + !strings.HasPrefix(u.Host, "uploads.") { + u.Path += "api/uploads/" + } + + o.uploadURL = u + + return nil } - return c2, nil } -// initialize sets default values and initializes services. -func (c *Client) initialize() { - if c.client == nil { +// WithDisableRateLimitCheck returns a ClientOptionsFunc that disables rate +// limit checking for a Client. If not set, the client will check for rate +// limits and track them. +func WithDisableRateLimitCheck() ClientOptionsFunc { + return func(o *clientOptions) error { + o.disableRateLimitCheck = true + return nil + } +} + +// WithRateLimitRedirectionalEndpoints returns a ClientOptionsFunc that +// configures the Client to respect rate limit headers on endpoints that +// return 302 redirection to artifacts. If not set, the client will not +// respect rate limit headers on these endpoints. +func WithRateLimitRedirectionalEndpoints() ClientOptionsFunc { + return func(o *clientOptions) error { + o.rateLimitRedirectionalEndpoints = true + return nil + } +} + +// WithMaxSecondaryRateLimitRetryAfterDuration returns a ClientOptionsFunc +// that configures the Client secondary rate limit max retry after duration. +func WithMaxSecondaryRateLimitRetryAfterDuration(duration time.Duration) ClientOptionsFunc { + return func(o *clientOptions) error { + o.maxSecondaryRateLimitRetryAfterDuration = &duration + return nil + } +} + +// NewClient returns a new GitHub API client configured with the provided +// options. The default configuration is suitable for making unauthenticated +// requests to the public GitHub API. +// +// For GitHub Enterprise, use [WithEnterpriseURLs] to set the base and upload +// URLs. +// +// To make authenticated requests, use [WithAuthToken] or [WithHTTPClient] to +// pass in a [http.Client] that performs authentication +// (e.g., using golang.org/x/oauth2). +// +// For production usage it is recommended to provide a timeout using +// [WithTimeout] or by providing a custom [http.Client] with an appropriate +// timeout using [WithHTTPClient]. +func NewClient(opts ...ClientOptionsFunc) (*Client, error) { + o := clientOptions{} + for _, opt := range opts { + if err := opt(&o); err != nil { + return nil, err + } + } + + return newClient(o) +} + +// newClient creates a new Client with the provided options. This is an internal +// helper function that is called by [NewClient] and [Client.Clone]. +func newClient(opts clientOptions) (*Client, error) { + c := &Client{} + + if opts.httpClient != nil { + c.client = opts.httpClient + } else { c.client = &http.Client{} } - // Copy the main http client into the IgnoreRedirects one, overriding the `CheckRedirect` func - c.clientIgnoreRedirects = &http.Client{} - c.clientIgnoreRedirects.Transport = c.client.Transport - c.clientIgnoreRedirects.Timeout = c.client.Timeout - c.clientIgnoreRedirects.Jar = c.client.Jar - c.clientIgnoreRedirects.CheckRedirect = func(req *http.Request, via []*http.Request) error { - return http.ErrUseLastResponse + + if opts.transport != nil { + c.client.Transport = opts.transport + } + + if opts.timeout != nil { + c.client.Timeout = *opts.timeout } - if c.BaseURL == nil { - c.BaseURL, _ = url.Parse(defaultBaseURL) + + if opts.envProxy { + transport := c.client.Transport + if transport == nil { + transport = http.DefaultTransport + } + + t, ok := transport.(*http.Transport) + if !ok { + return nil, errors.New("cannot set environment proxy on non-http transport") + } + + t2 := t.Clone() + t2.Proxy = http.ProxyFromEnvironment + c.client.Transport = t2 } - if c.UploadURL == nil { - c.UploadURL, _ = url.Parse(uploadBaseURL) + + if opts.token != nil { + transport := c.client.Transport + if transport == nil { + transport = http.DefaultTransport + } + c.client.Transport = roundTripperFunc(func(req *http.Request) (*http.Response, error) { + req = req.Clone(req.Context()) + req.Header.Set("Authorization", fmt.Sprintf("Bearer %v", *opts.token)) + return transport.RoundTrip(req) + }) } - if c.UserAgent == "" { - c.UserAgent = defaultUserAgent + + c.clientIgnoreRedirects = &http.Client{ + Transport: c.client.Transport, + Timeout: c.client.Timeout, + Jar: c.client.Jar, + CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }, } + + if opts.userAgent != nil { + c.userAgent = *opts.userAgent + } else { + c.userAgent = defaultUserAgent + } + + if opts.baseURL != nil { + c.baseURL = opts.baseURL + } else { + c.baseURL, _ = url.Parse(defaultBaseURL) + } + + if opts.uploadURL != nil { + c.uploadURL = opts.uploadURL + } else { + c.uploadURL, _ = url.Parse(uploadBaseURL) + } + + c.disableRateLimitCheck = opts.disableRateLimitCheck + + if !c.disableRateLimitCheck { + c.rateLimitRedirectionalEndpoints = opts.rateLimitRedirectionalEndpoints + + if opts.maxSecondaryRateLimitRetryAfterDuration != nil { + c.maxSecondaryRateLimitRetryAfterDuration = *opts.maxSecondaryRateLimitRetryAfterDuration + } + } + c.common.client = c c.Actions = (*ActionsService)(&c.common) c.Activity = (*ActivityService)(&c.common) @@ -429,10 +645,12 @@ func (c *Client) initialize() { c.Authorizations = (*AuthorizationsService)(&c.common) c.Billing = (*BillingService)(&c.common) c.Checks = (*ChecksService)(&c.common) + c.Classroom = (*ClassroomService)(&c.common) c.CodeScanning = (*CodeScanningService)(&c.common) c.Codespaces = (*CodespacesService)(&c.common) c.CodesOfConduct = (*CodesOfConductService)(&c.common) c.Copilot = (*CopilotService)(&c.common) + c.Credentials = (*CredentialsService)(&c.common) c.Dependabot = (*DependabotService)(&c.common) c.DependencyGraph = (*DependencyGraphService)(&c.common) c.Emojis = (*EmojisService)(&c.common) @@ -445,10 +663,12 @@ func (c *Client) initialize() { c.Issues = (*IssuesService)(&c.common) c.Licenses = (*LicensesService)(&c.common) c.Markdown = (*MarkdownService)(&c.common) - c.Marketplace = &MarketplaceService{client: c} + c.Marketplace = &MarketplaceService{client: c, Stubbed: opts.marketplaceStubbed} c.Meta = (*MetaService)(&c.common) c.Migrations = (*MigrationService)(&c.common) c.Organizations = (*OrganizationsService)(&c.common) + c.PrivateRegistries = (*PrivateRegistriesService)(&c.common) + c.Projects = (*ProjectsService)(&c.common) c.PullRequests = (*PullRequestsService)(&c.common) c.RateLimit = (*RateLimitService)(&c.common) c.Reactions = (*ReactionsService)(&c.common) @@ -460,51 +680,84 @@ func (c *Client) initialize() { c.SubIssue = (*SubIssueService)(&c.common) c.Teams = (*TeamsService)(&c.common) c.Users = (*UsersService)(&c.common) + + return c, nil } -// copy returns a copy of the current client. It must be initialized before use. -func (c *Client) copy() *Client { - c.clientMu.Lock() - // can't use *c here because that would copy mutexes by value. - clone := Client{ - client: &http.Client{}, - UserAgent: c.UserAgent, - BaseURL: c.BaseURL, - UploadURL: c.UploadURL, - RateLimitRedirectionalEndpoints: c.RateLimitRedirectionalEndpoints, - secondaryRateLimitReset: c.secondaryRateLimitReset, - } - c.clientMu.Unlock() - if c.client != nil { - clone.client.Transport = c.client.Transport - clone.client.CheckRedirect = c.client.CheckRedirect - clone.client.Jar = c.client.Jar - clone.client.Timeout = c.client.Timeout - } - c.rateMu.Lock() - copy(clone.rateLimits[:], c.rateLimits[:]) - c.rateMu.Unlock() - return &clone +// UserAgent returns the User-Agent header value for the client. +func (c *Client) UserAgent() string { + return c.userAgent } -// NewClientWithEnvProxy enhances NewClient with the HttpProxy env. -func NewClientWithEnvProxy() *Client { - return NewClient(&http.Client{Transport: &http.Transport{Proxy: http.ProxyFromEnvironment}}) +// BaseURL returns the base URL for API requests. +func (c *Client) BaseURL() string { + if c.baseURL == nil { + return "" + } + return c.baseURL.String() } -// NewTokenClient returns a new GitHub API client authenticated with the provided token. -// Deprecated: Use NewClient(nil).WithAuthToken(token) instead. -func NewTokenClient(_ context.Context, token string) *Client { - // This always returns a nil error. - return NewClient(nil).WithAuthToken(token) +// UploadURL returns the base URL for upload API requests. +func (c *Client) UploadURL() string { + if c.uploadURL == nil { + return "" + } + return c.uploadURL.String() } -// NewEnterpriseClient returns a new GitHub API client with provided -// base URL and upload URL (often is your GitHub Enterprise hostname). -// -// Deprecated: Use NewClient(httpClient).WithEnterpriseURLs(baseURL, uploadURL) instead. -func NewEnterpriseClient(baseURL, uploadURL string, httpClient *http.Client) (*Client, error) { - return NewClient(httpClient).WithEnterpriseURLs(baseURL, uploadURL) +// Clone returns a copy of the client with the same configuration and services. +// The returned client has its own http.Client but shares the client +// configuration such as transport and timeout. The returned client starts with +// the same rate limit information as the original client, but it is not +// updated when the original client's rate limit information is updated. +// The returned client is independent of the original client and can be +// modified without affecting the original client. +func (c *Client) Clone(opts ...ClientOptionsFunc) (*Client, error) { + if c.client == nil { + return nil, errUninitialized + } + + o := clientOptions{ + userAgent: &c.userAgent, + baseURL: Ptr(*c.baseURL), + uploadURL: Ptr(*c.uploadURL), + disableRateLimitCheck: c.disableRateLimitCheck, + rateLimitRedirectionalEndpoints: c.rateLimitRedirectionalEndpoints, + maxSecondaryRateLimitRetryAfterDuration: &c.maxSecondaryRateLimitRetryAfterDuration, + } + + if c.Marketplace != nil { + o.marketplaceStubbed = c.Marketplace.Stubbed + } + + for _, opt := range opts { + if err := opt(&o); err != nil { + return nil, err + } + } + + if o.httpClient == nil { + o.httpClient = &http.Client{ + Transport: c.client.Transport, + CheckRedirect: c.client.CheckRedirect, + Jar: c.client.Jar, + Timeout: c.client.Timeout, + } + } + + clone, err := newClient(o) + if err != nil { + return nil, err + } + + if !clone.disableRateLimitCheck { + c.rateMu.Lock() + clone.rateLimits = c.rateLimits + clone.secondaryRateLimitReset = c.secondaryRateLimitReset + c.rateMu.Unlock() + } + + return clone, nil } // RequestOption represents an option that can modify an http.Request. @@ -524,12 +777,16 @@ func WithVersion(version string) RequestOption { // Relative URLs should always be specified without a preceding slash. If // specified, the value pointed to by body is JSON encoded and included as the // request body. -func (c *Client) NewRequest(method, urlStr string, body any, opts ...RequestOption) (*http.Request, error) { - if !strings.HasSuffix(c.BaseURL.Path, "/") { - return nil, fmt.Errorf("baseURL must have a trailing slash, but %q does not", c.BaseURL) +func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body any, opts ...RequestOption) (*http.Request, error) { + if !strings.HasSuffix(c.baseURL.Path, "/") { + return nil, fmt.Errorf("baseURL must have a trailing slash, but %q does not", c.baseURL) } - u, err := c.BaseURL.Parse(urlStr) + if err := checkURLPathTraversal(urlStr); err != nil { + return nil, err + } + + u, err := c.baseURL.Parse(urlStr) if err != nil { return nil, err } @@ -545,7 +802,7 @@ func (c *Client) NewRequest(method, urlStr string, body any, opts ...RequestOpti } } - req, err := http.NewRequest(method, u.String(), buf) + req, err := http.NewRequestWithContext(ctx, method, u.String(), buf) if err != nil { return nil, err } @@ -554,8 +811,8 @@ func (c *Client) NewRequest(method, urlStr string, body any, opts ...RequestOpti req.Header.Set("Content-Type", "application/json") } req.Header.Set("Accept", mediaTypeV3) - if c.UserAgent != "" { - req.Header.Set("User-Agent", c.UserAgent) + if c.userAgent != "" { + req.Header.Set("User-Agent", c.userAgent) } req.Header.Set(headerAPIVersion, defaultAPIVersion) @@ -570,25 +827,29 @@ func (c *Client) NewRequest(method, urlStr string, body any, opts ...RequestOpti // in which case it is resolved relative to the BaseURL of the Client. // Relative URLs should always be specified without a preceding slash. // Body is sent with Content-Type: application/x-www-form-urlencoded. -func (c *Client) NewFormRequest(urlStr string, body io.Reader, opts ...RequestOption) (*http.Request, error) { - if !strings.HasSuffix(c.BaseURL.Path, "/") { - return nil, fmt.Errorf("baseURL must have a trailing slash, but %q does not", c.BaseURL) +func (c *Client) NewFormRequest(ctx context.Context, urlStr string, body io.Reader, opts ...RequestOption) (*http.Request, error) { + if !strings.HasSuffix(c.baseURL.Path, "/") { + return nil, fmt.Errorf("baseURL must have a trailing slash, but %q does not", c.baseURL) + } + + if err := checkURLPathTraversal(urlStr); err != nil { + return nil, err } - u, err := c.BaseURL.Parse(urlStr) + u, err := c.baseURL.Parse(urlStr) if err != nil { return nil, err } - req, err := http.NewRequest(http.MethodPost, u.String(), body) + req, err := http.NewRequestWithContext(ctx, "POST", u.String(), body) if err != nil { return nil, err } req.Header.Set("Content-Type", "application/x-www-form-urlencoded") req.Header.Set("Accept", mediaTypeV3) - if c.UserAgent != "" { - req.Header.Set("User-Agent", c.UserAgent) + if c.userAgent != "" { + req.Header.Set("User-Agent", c.userAgent) } req.Header.Set(headerAPIVersion, defaultAPIVersion) @@ -599,19 +860,56 @@ func (c *Client) NewFormRequest(urlStr string, body io.Reader, opts ...RequestOp return req, nil } +// checkURLPathTraversal returns ErrPathForbidden if urlStr contains ".." as a +// path segment (e.g. "a/../b"), preventing path traversal attacks. It does not +// match ".." embedded within a segment (e.g. "file..txt"). The check is +// performed only on the path portion of the URL, ignoring any query string or +// fragment. +func checkURLPathTraversal(urlStr string) error { + if !strings.Contains(urlStr, "..") { + return nil + } + u, err := url.Parse(urlStr) + if err != nil { + return err + } + if slices.Contains(strings.Split(u.Path, "/"), "..") { + return ErrPathForbidden + } + return nil +} + // NewUploadRequest creates an upload request. A relative URL can be provided in // urlStr, in which case it is resolved relative to the UploadURL of the Client. // Relative URLs should always be specified without a preceding slash. -func (c *Client) NewUploadRequest(urlStr string, reader io.Reader, size int64, mediaType string, opts ...RequestOption) (*http.Request, error) { - if !strings.HasSuffix(c.UploadURL.Path, "/") { - return nil, fmt.Errorf("uploadURL must have a trailing slash, but %q does not", c.UploadURL) +func (c *Client) NewUploadRequest(ctx context.Context, urlStr string, reader io.Reader, size int64, mediaType string, opts ...RequestOption) (*http.Request, error) { + if !strings.HasSuffix(c.uploadURL.Path, "/") { + return nil, fmt.Errorf("uploadURL must have a trailing slash, but %q does not", c.uploadURL) + } + + if err := checkURLPathTraversal(urlStr); err != nil { + return nil, err } - u, err := c.UploadURL.Parse(urlStr) + + u, err := c.uploadURL.Parse(urlStr) if err != nil { return nil, err } - req, err := http.NewRequest("POST", u.String(), reader) + requestBody := reader + if reader != nil { + // Wrap the provided reader so transport code does not observe concrete body types + // (for example *os.File) and switch to platform-specific sendfile fast paths. + // + // Why this exists: + // race-enabled test runs on Windows have surfaced data races in the sendfile path + // while request read/write loops run concurrently. Hiding concrete type information + // keeps uploads on the generic io.Reader copy path, which is race-stable and preserves + // request semantics (same bytes, same headers, same content length). + requestBody = uploadRequestBodyReader{Reader: reader} + } + + req, err := http.NewRequestWithContext(ctx, "POST", u.String(), requestBody) if err != nil { return nil, err } @@ -623,7 +921,7 @@ func (c *Client) NewUploadRequest(urlStr string, reader io.Reader, size int64, m } req.Header.Set("Content-Type", mediaType) req.Header.Set("Accept", mediaTypeV3) - req.Header.Set("User-Agent", c.UserAgent) + req.Header.Set("User-Agent", c.userAgent) req.Header.Set(headerAPIVersion, defaultAPIVersion) for _, opt := range opts { @@ -633,6 +931,12 @@ func (c *Client) NewUploadRequest(urlStr string, reader io.Reader, size int64, m return req, nil } +// uploadRequestBodyReader intentionally wraps an io.Reader to hide concrete reader types. +// See NewUploadRequest for why this prevents race-prone transport optimizations. +type uploadRequestBodyReader struct { + io.Reader +} + // Response is a GitHub API response. This wraps the standard http.Response // returned from GitHub and provides convenient access to things like // pagination links. @@ -696,7 +1000,7 @@ func newResponse(r *http.Response) *Response { // various pagination link values in the Response. func (r *Response) populatePageValues() { if links, ok := r.Response.Header["Link"]; ok && len(links) > 0 { - for _, link := range strings.Split(links[0], ",") { + for link := range strings.SplitSeq(links[0], ",") { segments := strings.Split(strings.TrimSpace(link), ";") // link must at least have href and rel @@ -719,8 +1023,7 @@ func (r *Response) populatePageValues() { if cursor := q.Get("cursor"); cursor != "" { for _, segment := range segments[1:] { - switch strings.TrimSpace(segment) { - case `rel="next"`: + if strings.TrimSpace(segment) == `rel="next"` { r.Cursor = cursor } } @@ -764,21 +1067,21 @@ func (r *Response) populatePageValues() { // parseRate parses the rate related headers. func parseRate(r *http.Response) Rate { var rate Rate - if limit := r.Header.Get(headerRateLimit); limit != "" { + if limit := r.Header.Get(HeaderRateLimit); limit != "" { rate.Limit, _ = strconv.Atoi(limit) } - if remaining := r.Header.Get(headerRateRemaining); remaining != "" { + if remaining := r.Header.Get(HeaderRateRemaining); remaining != "" { rate.Remaining, _ = strconv.Atoi(remaining) } - if used := r.Header.Get(headerRateUsed); used != "" { + if used := r.Header.Get(HeaderRateUsed); used != "" { rate.Used, _ = strconv.Atoi(used) } - if reset := r.Header.Get(headerRateReset); reset != "" { + if reset := r.Header.Get(HeaderRateReset); reset != "" { if v, _ := strconv.ParseInt(reset, 10, 64); v != 0 { rate.Reset = Timestamp{time.Unix(v, 0)} } } - if resource := r.Header.Get(headerRateResource); resource != "" { + if resource := r.Header.Get(HeaderRateResource); resource != "" { rate.Resource = resource } return rate @@ -799,7 +1102,7 @@ func parseSecondaryRate(r *http.Response) *time.Duration { // According to GitHub support, endpoints might return x-ratelimit-reset instead, // as an integer which represents the number of seconds since epoch UTC, // representing the time to resume making requests. - if v := r.Header.Get(headerRateReset); v != "" { + if v := r.Header.Get(HeaderRateReset); v != "" { secondsSinceEpoch, _ := strconv.ParseInt(v, 10, 64) // Error handling is noop. retryAfter := time.Until(time.Unix(secondsSinceEpoch, 0)) return &retryAfter @@ -835,36 +1138,39 @@ const ( SleepUntilPrimaryRateLimitResetWhenRateLimited ) +// maxErrorBodySize is the maximum number of bytes read from an HTTP error +// response body. Limits memory allocation when a server returns an +// unexpectedly large error body. +const maxErrorBodySize = 1 * 1024 * 1024 // 1 MiB + // bareDo sends an API request using `caller` http.Client passed in the parameters // and lets you handle the api response. If an error or API Error occurs, the error -// will contain more information. Otherwise you are supposed to read and close the +// will contain more information. Otherwise, you are supposed to read and close the // response's Body. If rate limit is exceeded and reset time is in the future, // bareDo returns *RateLimitError immediately without making a network API call. -// -// The provided ctx must be non-nil, if it is nil an error is returned. If it is -// canceled or times out, ctx.Err() will be returned. -func (c *Client) bareDo(ctx context.Context, caller *http.Client, req *http.Request) (*Response, error) { - if ctx == nil { - return nil, errNonNilContext - } +func (c *Client) bareDo(caller *http.Client, req *http.Request) (*Response, error) { + ctx := req.Context() - req = withContext(ctx, req) + rateLimitCategory := CoreCategory - rateLimitCategory := GetRateLimitCategory(req.Method, req.URL.Path) + if !c.disableRateLimitCheck { + rateLimitCategory = GetRateLimitCategory(req.Method, req.URL.Path) - if bypass := ctx.Value(BypassRateLimitCheck); bypass == nil { - // If we've hit rate limit, don't make further requests before Reset time. - if err := c.checkRateLimitBeforeDo(req, rateLimitCategory); err != nil { - return &Response{ - Response: err.Response, - Rate: err.Rate, - }, err - } - // If we've hit a secondary rate limit, don't make further requests before Retry After. - if err := c.checkSecondaryRateLimitBeforeDo(req); err != nil { - return &Response{ - Response: err.Response, - }, err + if bypass := ctx.Value(BypassRateLimitCheck); bypass == nil { + // If we've hit rate limit, don't make further requests before Reset time. + if err := c.checkRateLimitBeforeDo(req, rateLimitCategory); err != nil { + return &Response{ + Response: err.Response, + Rate: err.Rate, + }, err + } + + // If we've hit a secondary rate limit, don't make further requests before Retry After. + if err := c.checkSecondaryRateLimitBeforeDo(req); err != nil { + return &Response{ + Response: err.Response, + }, err + } } } @@ -884,7 +1190,8 @@ func (c *Client) bareDo(ctx context.Context, caller *http.Client, req *http.Requ } // If the error type is *url.Error, sanitize its URL before returning. - if e, ok := err.(*url.Error); ok { + var e *url.Error + if errors.As(err, &e) { if url, err := url.Parse(e.URL); err == nil { e.URL = sanitizeURL(url).String() return response, e @@ -894,9 +1201,10 @@ func (c *Client) bareDo(ctx context.Context, caller *http.Client, req *http.Requ return response, err } - // Don't update the rate limits if this was a cached response. - // X-From-Cache is set by https://github.com/gregjones/httpcache - if response.Header.Get("X-From-Cache") == "" { + // Don't update the rate limits if the client has rate limits disabled or if + // this was a cached response. The X-From-Cache is set by + // https://github.com/bartventer/httpcache if it's enabled. + if !c.disableRateLimitCheck && response.Header.Get("X-From-Cache") == "" { c.rateMu.Lock() c.rateLimits[rateLimitCategory] = response.Rate c.rateMu.Unlock() @@ -910,9 +1218,9 @@ func (c *Client) bareDo(ctx context.Context, caller *http.Client, req *http.Requ // added to the AcceptedError and returned. // // Issue #1022 - aerr, ok := err.(*AcceptedError) - if ok { - b, readErr := io.ReadAll(resp.Body) + var aerr *AcceptedError + if errors.As(err, &aerr) { + b, readErr := io.ReadAll(io.LimitReader(resp.Body, maxErrorBodySize)) if readErr != nil { return response, readErr } @@ -921,21 +1229,23 @@ func (c *Client) bareDo(ctx context.Context, caller *http.Client, req *http.Requ err = aerr } - rateLimitError, ok := err.(*RateLimitError) - if ok && req.Context().Value(SleepUntilPrimaryRateLimitResetWhenRateLimited) != nil { - if err := sleepUntilResetWithBuffer(req.Context(), rateLimitError.Rate.Reset.Time); err != nil { + var rateLimitError *RateLimitError + if errors.As(err, &rateLimitError) && + ctx.Value(SleepUntilPrimaryRateLimitResetWhenRateLimited) != nil { + if err := sleepUntilResetWithBuffer(ctx, rateLimitError.Rate.Reset.Time); err != nil { return response, err } - // retry the request once when the rate limit has reset - return c.bareDo(context.WithValue(req.Context(), SleepUntilPrimaryRateLimitResetWhenRateLimited, nil), caller, req) + // retry the request now the rate limit should have been reset + newReq := req.Clone(context.WithValue(ctx, SleepUntilPrimaryRateLimitResetWhenRateLimited, nil)) + return c.bareDo(caller, newReq) } // Update the secondary rate limit if we hit it. - rerr, ok := err.(*AbuseRateLimitError) - if ok && rerr.RetryAfter != nil { + var rerr *AbuseRateLimitError + if errors.As(err, &rerr) && rerr.RetryAfter != nil { // if a max duration is specified, make sure that we are waiting at most this duration - if c.MaxSecondaryRateLimitRetryAfterDuration > 0 && rerr.GetRetryAfter() > c.MaxSecondaryRateLimitRetryAfterDuration { - rerr.RetryAfter = &c.MaxSecondaryRateLimitRetryAfterDuration + if c.maxSecondaryRateLimitRetryAfterDuration > 0 && rerr.GetRetryAfter() > c.maxSecondaryRateLimitRetryAfterDuration { + rerr.RetryAfter = &c.maxSecondaryRateLimitRetryAfterDuration } c.rateMu.Lock() c.secondaryRateLimitReset = time.Now().Add(*rerr.RetryAfter) @@ -946,25 +1256,19 @@ func (c *Client) bareDo(ctx context.Context, caller *http.Client, req *http.Requ } // BareDo sends an API request and lets you handle the api response. If an error -// or API Error occurs, the error will contain more information. Otherwise you +// or API Error occurs, the error will contain more information. Otherwise, you // are supposed to read and close the response's Body. If rate limit is exceeded // and reset time is in the future, BareDo returns *RateLimitError immediately // without making a network API call. -// -// The provided ctx must be non-nil, if it is nil an error is returned. If it is -// canceled or times out, ctx.Err() will be returned. -func (c *Client) BareDo(ctx context.Context, req *http.Request) (*Response, error) { - return c.bareDo(ctx, c.client, req) +func (c *Client) BareDo(req *http.Request) (*Response, error) { + return c.bareDo(c.client, req) } // bareDoIgnoreRedirects has the exact same behavior as BareDo but stops at the first // redirection code returned by the API. If a redirection is returned by the api, bareDoIgnoreRedirects // returns a *RedirectionError. -// -// The provided ctx must be non-nil, if it is nil an error is returned. If it is -// canceled or times out, ctx.Err() will be returned. -func (c *Client) bareDoIgnoreRedirects(ctx context.Context, req *http.Request) (*Response, error) { - return c.bareDo(ctx, c.clientIgnoreRedirects, req) +func (c *Client) bareDoIgnoreRedirects(req *http.Request) (*Response, error) { + return c.bareDo(c.clientIgnoreRedirects, req) } var errInvalidLocation = errors.New("invalid or empty Location header in redirection response") @@ -973,20 +1277,17 @@ var errInvalidLocation = errors.New("invalid or empty Location header in redirec // a 302, it will parse the Location header into a *url.URL and return that. // This is useful for endpoints that return a 302 in successful cases but still might return 301s for // permanent redirections. -// -// The provided ctx must be non-nil, if it is nil an error is returned. If it is -// canceled or times out, ctx.Err() will be returned. -func (c *Client) bareDoUntilFound(ctx context.Context, req *http.Request, maxRedirects int) (*url.URL, *Response, error) { - response, err := c.bareDoIgnoreRedirects(ctx, req) +func (c *Client) bareDoUntilFound(req *http.Request, maxRedirects int) (*url.URL, *Response, error) { + response, err := c.bareDoIgnoreRedirects(req) if err != nil { - rerr, ok := err.(*RedirectionError) - if ok { + var rerr *RedirectionError + if errors.As(err, &rerr) { // If we receive a 302, transform potential relative locations into absolute and return it. if rerr.StatusCode == http.StatusFound { if rerr.Location == nil { return nil, nil, errInvalidLocation } - newURL := c.BaseURL.ResolveReference(rerr.Location) + newURL := c.baseURL.ResolveReference(rerr.Location) return newURL, response, nil } // If permanent redirect response is returned, follow it @@ -994,10 +1295,16 @@ func (c *Client) bareDoUntilFound(ctx context.Context, req *http.Request, maxRed if rerr.Location == nil { return nil, nil, errInvalidLocation } - newURL := c.BaseURL.ResolveReference(rerr.Location) - newRequest := req.Clone(ctx) + newURL := c.baseURL.ResolveReference(rerr.Location) + // Refuse to follow a permanent redirect to a different host: + // req.Clone preserves Authorization headers added by the auth + // transport, so a cross-host target would leak credentials. + if newURL.Host != c.baseURL.Host { + return nil, response, fmt.Errorf("refusing to follow cross-host redirect from %q to %q", c.baseURL.Host, newURL.Host) + } + newRequest := req.Clone(req.Context()) newRequest.URL = newURL - return c.bareDoUntilFound(ctx, newRequest, maxRedirects-1) + return c.bareDoUntilFound(newRequest, maxRedirects-1) } // If we reached the maximum amount of redirections, return an error if maxRedirects <= 0 && rerr.StatusCode == http.StatusMovedPermanently { @@ -1018,11 +1325,8 @@ func (c *Client) bareDoUntilFound(ctx context.Context, req *http.Request, maxRed // decode it. If v is nil, and no error happens, the response is returned as is. // If rate limit is exceeded and reset time is in the future, Do returns // *RateLimitError immediately without making a network API call. -// -// The provided ctx must be non-nil, if it is nil an error is returned. If it -// is canceled or times out, ctx.Err() will be returned. -func (c *Client) Do(ctx context.Context, req *http.Request, v any) (*Response, error) { - resp, err := c.BareDo(ctx, req) +func (c *Client) Do(req *http.Request, v any) (*Response, error) { + resp, err := c.BareDo(req) if err != nil { return resp, err } @@ -1049,6 +1353,8 @@ func (c *Client) Do(ctx context.Context, req *http.Request, v any) (*Response, e // from Client.Do, and if so, returns it so that Client.Do can skip making a network API call unnecessarily. // Otherwise it returns nil, and Client.Do should proceed normally. func (c *Client) checkRateLimitBeforeDo(req *http.Request, rateLimitCategory RateLimitCategory) *RateLimitError { + ctx := req.Context() + c.rateMu.Lock() rate := c.rateLimits[rateLimitCategory] c.rateMu.Unlock() @@ -1062,8 +1368,8 @@ func (c *Client) checkRateLimitBeforeDo(req *http.Request, rateLimitCategory Rat Body: io.NopCloser(strings.NewReader("")), } - if req.Context().Value(SleepUntilPrimaryRateLimitResetWhenRateLimited) != nil { - if err := sleepUntilResetWithBuffer(req.Context(), rate.Reset.Time); err == nil { + if ctx.Value(SleepUntilPrimaryRateLimitResetWhenRateLimited) != nil { + if err := sleepUntilResetWithBuffer(ctx, rate.Reset.Time); err == nil { return nil } return &RateLimitError{ @@ -1129,7 +1435,7 @@ func compareHTTPResponse(r1, r2 *http.Response) bool { /* An ErrorResponse reports one or more errors caused by an API request. -GitHub API docs: https://docs.github.com/rest/#client-errors +GitHub API docs: https://docs.github.com/rest?apiVersion=2022-11-28#client-errors */ type ErrorResponse struct { Response *http.Response `json:"-"` // HTTP response that caused this error @@ -1140,7 +1446,7 @@ type ErrorResponse struct { Block *ErrorBlock `json:"block,omitempty"` // Most errors will also include a documentation_url field pointing // to some content that might help you resolve the error, see - // https://docs.github.com/rest/#client-errors + // https://docs.github.com/rest?apiVersion=2022-11-28#client-errors DocumentationURL string `json:"documentation_url,omitempty"` } @@ -1154,13 +1460,13 @@ type ErrorBlock struct { func (r *ErrorResponse) Error() string { if r.Response != nil && r.Response.Request != nil { - return fmt.Sprintf("%v %v: %d %v %+v", + return fmt.Sprintf("%v %v: %v %v %+v", r.Response.Request.Method, sanitizeURL(r.Response.Request.URL), r.Response.StatusCode, r.Message, r.Errors) } if r.Response != nil { - return fmt.Sprintf("%d %v %+v", r.Response.StatusCode, r.Message, r.Errors) + return fmt.Sprintf("%v %v %+v", r.Response.StatusCode, r.Message, r.Errors) } return fmt.Sprintf("%v %+v", r.Message, r.Errors) @@ -1168,8 +1474,8 @@ func (r *ErrorResponse) Error() string { // Is returns whether the provided error equals this error. func (r *ErrorResponse) Is(target error) bool { - v, ok := target.(*ErrorResponse) - if !ok { + var v *ErrorResponse + if !errors.As(target, &v) { return false } @@ -1226,15 +1532,15 @@ type RateLimitError struct { } func (r *RateLimitError) Error() string { - return fmt.Sprintf("%v %v: %d %v %v", + return fmt.Sprintf("%v %v: %v %v %v", r.Response.Request.Method, sanitizeURL(r.Response.Request.URL), r.Response.StatusCode, r.Message, formatRateReset(time.Until(r.Rate.Reset.Time))) } // Is returns whether the provided error equals this error. func (r *RateLimitError) Is(target error) bool { - v, ok := target.(*RateLimitError) - if !ok { + var v *RateLimitError + if !errors.As(target, &v) { return false } @@ -1260,15 +1566,15 @@ func (*AcceptedError) Error() string { // Is returns whether the provided error equals this error. func (ae *AcceptedError) Is(target error) bool { - v, ok := target.(*AcceptedError) - if !ok { + var v *AcceptedError + if !errors.As(target, &v) { return false } return bytes.Equal(ae.Raw, v.Raw) } // AbuseRateLimitError occurs when GitHub returns 403 Forbidden response with the -// "documentation_url" field value equal to "https://docs.github.com/rest/overview/rate-limits-for-the-rest-api#about-secondary-rate-limits". +// "documentation_url" field value equal to "https://docs.github.com/rest/overview/rate-limits-for-the-rest-api?apiVersion=2022-11-28#about-secondary-rate-limits". type AbuseRateLimitError struct { Response *http.Response // HTTP response that caused this error Message string `json:"message"` // error message @@ -1280,15 +1586,19 @@ type AbuseRateLimitError struct { } func (r *AbuseRateLimitError) Error() string { - return fmt.Sprintf("%v %v: %d %v", + retryInfo := "" + if r.RetryAfter != nil && *r.RetryAfter > 0 { + retryInfo = fmt.Sprintf(" [retry after %v]", r.RetryAfter.Round(time.Second)) + } + return fmt.Sprintf("%v %v: %v %v%v", r.Response.Request.Method, sanitizeURL(r.Response.Request.URL), - r.Response.StatusCode, r.Message) + r.Response.StatusCode, r.Message, retryInfo) } // Is returns whether the provided error equals this error. func (r *AbuseRateLimitError) Is(target error) bool { - v, ok := target.(*AbuseRateLimitError) - if !ok { + var v *AbuseRateLimitError + if !errors.As(target, &v) { return false } @@ -1314,15 +1624,15 @@ type RedirectionError struct { } func (r *RedirectionError) Error() string { - return fmt.Sprintf("%v %v: %d location %v", + return fmt.Sprintf("%v %v: %v location %v", r.Response.Request.Method, sanitizeURL(r.Response.Request.URL), r.StatusCode, sanitizeURL(r.Location)) } // Is returns whether the provided error equals this error. func (r *RedirectionError) Is(target error) bool { - v, ok := target.(*RedirectionError) - if !ok { + var v *RedirectionError + if !errors.As(target, &v) { return false } @@ -1331,15 +1641,23 @@ func (r *RedirectionError) Is(target error) bool { r.Location != nil && v.Location != nil && r.Location.String() == v.Location.String()) // or they are both not nil and marshaled identically } -// sanitizeURL redacts the client_secret parameter from the URL which may be +var sensitiveParams = []string{"client_secret", "access_token", "token"} + +// sanitizeURL redacts sensitive parameters from the URL which may be // exposed to the user. func sanitizeURL(uri *url.URL) *url.URL { if uri == nil { return nil } params := uri.Query() - if len(params.Get("client_secret")) > 0 { - params.Set("client_secret", "REDACTED") + var redacted bool + for _, p := range sensitiveParams { + if len(params.Get(p)) > 0 { + params.Set(p, "REDACTED") + redacted = true + } + } + if redacted { uri.RawQuery = params.Encode() } return uri @@ -1365,7 +1683,7 @@ GitHub error responses structure are often undocumented and inconsistent. Sometimes error is just a simple string (Issue #540). In such cases, Message represents an error message as a workaround. -GitHub API docs: https://docs.github.com/rest/#client-errors +GitHub API docs: https://docs.github.com/rest?apiVersion=2022-11-28#client-errors */ type Error struct { Resource string `json:"resource"` // resource on which the error occurred @@ -1379,6 +1697,7 @@ func (e *Error) Error() string { e.Code, e.Field, e.Resource) } +// UnmarshalJSON implements the json.Unmarshaler interface. func (e *Error) UnmarshalJSON(data []byte) error { type aliasError Error // avoid infinite recursion by using type alias. if err := json.Unmarshal(data, (*aliasError)(e)); err != nil { @@ -1406,7 +1725,7 @@ func CheckResponse(r *http.Response) error { } errorResponse := &ErrorResponse{Response: r} - data, err := io.ReadAll(r.Body) + data, err := io.ReadAll(io.LimitReader(r.Body, maxErrorBodySize)) if err == nil && data != nil { err = json.Unmarshal(data, errorResponse) if err != nil { @@ -1421,13 +1740,18 @@ func CheckResponse(r *http.Response) error { switch { case r.StatusCode == http.StatusUnauthorized && strings.HasPrefix(r.Header.Get(headerOTP), "required"): return (*TwoFactorAuthError)(errorResponse) - case r.StatusCode == http.StatusForbidden && r.Header.Get(headerRateRemaining) == "0": + // Primary rate limit exceeded: GitHub returns 403 or 429 with X-RateLimit-Remaining: 0 + // See: https://docs.github.com/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28 + case (r.StatusCode == http.StatusForbidden || r.StatusCode == http.StatusTooManyRequests) && + r.Header.Get(HeaderRateRemaining) == "0": return &RateLimitError{ Rate: parseRate(r), Response: errorResponse.Response, Message: errorResponse.Message, } - case r.StatusCode == http.StatusForbidden && + // Secondary rate limit exceeded: GitHub returns 403 or 429 with specific documentation_url + // See: https://docs.github.com/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#about-secondary-rate-limits + case (r.StatusCode == http.StatusForbidden || r.StatusCode == http.StatusTooManyRequests) && (strings.HasSuffix(errorResponse.DocumentationURL, "#abuse-rate-limits") || strings.HasSuffix(errorResponse.DocumentationURL, "secondary-rate-limits")): abuseRateLimitError := &AbuseRateLimitError{ @@ -1472,7 +1796,8 @@ func parseBoolResponse(err error) (bool, error) { return true, nil } - if err, ok := err.(*ErrorResponse); ok && err.Response.StatusCode == http.StatusNotFound { + var rerr *ErrorResponse + if errors.As(err, &rerr) && rerr.Response.StatusCode == http.StatusNotFound { // Simply false. In this one case, we do not pass the error through. return false, nil } @@ -1481,6 +1806,7 @@ func parseBoolResponse(err error) (bool, error) { return false, err } +// RateLimitCategory represents the enumeration of rate limit categories. type RateLimitCategory uint8 const ( @@ -1495,6 +1821,7 @@ const ( DependencySnapshotsCategory CodeSearchCategory AuditLogCategory + DependencySBOMCategory Categories // An array of this length will be able to contain all rate limit categories. ) @@ -1502,15 +1829,15 @@ const ( // GetRateLimitCategory returns the rate limit RateLimitCategory of the endpoint, determined by HTTP method and Request.URL.Path. func GetRateLimitCategory(method, path string) RateLimitCategory { switch { - // https://docs.github.com/rest/rate-limit#about-rate-limits + // https://docs.github.com/rest/rate-limit?apiVersion=2022-11-28#about-rate-limits default: // NOTE: coreCategory is returned for actionsRunnerRegistrationCategory too, // because no API found for this category. return CoreCategory - // https://docs.github.com/en/rest/search/search#search-code + // https://docs.github.com/rest/search/search?apiVersion=2022-11-28#search-code case strings.HasPrefix(path, "/search/code") && - method == http.MethodGet: + method == "GET": return CodeSearchCategory case strings.HasPrefix(path, "/search/"): @@ -1519,32 +1846,37 @@ func GetRateLimitCategory(method, path string) RateLimitCategory { return GraphqlCategory case strings.HasPrefix(path, "/app-manifests/") && strings.HasSuffix(path, "/conversions") && - method == http.MethodPost: + method == "POST": return IntegrationManifestCategory - // https://docs.github.com/rest/migrations/source-imports#start-an-import + // https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#start-an-import case strings.HasPrefix(path, "/repos/") && strings.HasSuffix(path, "/import") && - method == http.MethodPut: + method == "PUT": return SourceImportCategory - // https://docs.github.com/rest/code-scanning#upload-an-analysis-as-sarif-data + // https://docs.github.com/rest/code-scanning?apiVersion=2022-11-28#upload-an-analysis-as-sarif-data case strings.HasSuffix(path, "/code-scanning/sarifs"): return CodeScanningUploadCategory - // https://docs.github.com/enterprise-cloud@latest/rest/scim + // https://docs.github.com/enterprise-cloud@latest/rest/scim?apiVersion=2022-11-28 case strings.HasPrefix(path, "/scim/"): return ScimCategory - // https://docs.github.com/en/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository + // https://docs.github.com/rest/dependency-graph/dependency-submission?apiVersion=2022-11-28#create-a-snapshot-of-dependencies-for-a-repository case strings.HasPrefix(path, "/repos/") && strings.HasSuffix(path, "/dependency-graph/snapshots") && - method == http.MethodPost: + method == "POST": return DependencySnapshotsCategory - // https://docs.github.com/en/enterprise-cloud@latest/rest/orgs/orgs?apiVersion=2022-11-28#get-the-audit-log-for-an-organization + // https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs?apiVersion=2022-11-28#get-the-audit-log-for-an-organization case strings.HasSuffix(path, "/audit-log"): return AuditLogCategory + + // https://docs.github.com/rest/dependency-graph/sboms?apiVersion=2022-11-28#export-a-software-bill-of-materials-sbom-for-a-repository + case strings.HasPrefix(path, "/repos/") && + strings.HasSuffix(path, "/dependency-graph/sbom"): + return DependencySBOMCategory } } @@ -1562,15 +1894,14 @@ func setCredentialsAsHeaders(req *http.Request, id, secret string) *http.Request // // Since we are going to modify only req.Header here, we only need a deep copy // of req.Header. - convertedRequest := new(http.Request) - *convertedRequest = *req + convertedRequest := *req convertedRequest.Header = make(http.Header, len(req.Header)) for k, s := range req.Header { convertedRequest.Header[k] = append([]string(nil), s...) } convertedRequest.SetBasicAuth(id, secret) - return convertedRequest + return &convertedRequest } /* @@ -1586,8 +1917,8 @@ that need to use a higher rate limit associated with your OAuth application. This will add the client id and secret as a base64-encoded string in the format ClientID:ClientSecret and apply it as an "Authorization": "Basic" header. -See https://docs.github.com/rest/#unauthenticated-rate-limited-requests for -more information. +See https://docs.github.com/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#primary-rate-limit-for-oauth-apps +for more information. */ type UnauthenticatedRateLimitedTransport struct { // ClientID is the GitHub OAuth client ID of the current application, which @@ -1681,9 +2012,9 @@ func formatRateReset(d time.Duration) string { var timeString string if minutes > 0 { - timeString = fmt.Sprintf("%dm%02ds", minutes, seconds) + timeString = fmt.Sprintf("%vm%02ds", minutes, seconds) } else { - timeString = fmt.Sprintf("%ds", seconds) + timeString = fmt.Sprintf("%vs", seconds) } if isNegative { @@ -1709,14 +2040,13 @@ func sleepUntilResetWithBuffer(ctx context.Context, reset time.Time) error { // When using roundTripWithOptionalFollowRedirect, note that it // is the responsibility of the caller to close the response body. func (c *Client) roundTripWithOptionalFollowRedirect(ctx context.Context, u string, maxRedirects int, opts ...RequestOption) (*http.Response, error) { - req, err := c.NewRequest("GET", u, nil, opts...) + req, err := c.NewRequest(ctx, "GET", u, nil, opts...) if err != nil { return nil, err } var resp *http.Response // Use http.DefaultTransport if no custom Transport is configured - req = withContext(ctx, req) if c.client.Transport == nil { resp, err = http.DefaultTransport.RoundTrip(req) } else { @@ -1730,11 +2060,35 @@ func (c *Client) roundTripWithOptionalFollowRedirect(ctx context.Context, u stri if maxRedirects > 0 && resp.StatusCode == http.StatusMovedPermanently { _ = resp.Body.Close() u = resp.Header.Get("Location") + if err := c.checkRedirectHost(u); err != nil { + return nil, err + } resp, err = c.roundTripWithOptionalFollowRedirect(ctx, u, maxRedirects-1, opts...) } return resp, err } +// checkRedirectHost returns an error if the redirect target is on a different +// host than the client's configured BaseURL. This prevents credentials attached +// by the auth transport from being sent to an attacker-controlled host when a +// compromised or malicious API response returns a cross-origin Location header. +// An empty Location is also rejected. +func (c *Client) checkRedirectHost(location string) error { + if location == "" { + return errInvalidLocation + } + target, err := url.Parse(location) + if err != nil { + return fmt.Errorf("invalid redirect location %q: %w", location, err) + } + // Resolve relative locations against BaseURL so relative paths are allowed. + target = c.baseURL.ResolveReference(target) + if target.Host != c.baseURL.Host { + return fmt.Errorf("refusing to follow cross-host redirect from %q to %q", c.baseURL.Host, target.Host) + } + return nil +} + // Ptr is a helper routine that allocates a new T value // to store v and returns a pointer to it. func Ptr[T any](v T) *T { @@ -1745,25 +2099,33 @@ func Ptr[T any](v T) *T { // to store v and returns a pointer to it. // // Deprecated: use Ptr instead. -func Bool(v bool) *bool { return &v } +// +//go:fix inline +func Bool(v bool) *bool { return Ptr(v) } // Int is a helper routine that allocates a new int value // to store v and returns a pointer to it. // // Deprecated: use Ptr instead. -func Int(v int) *int { return &v } +// +//go:fix inline +func Int(v int) *int { return Ptr(v) } // Int64 is a helper routine that allocates a new int64 value // to store v and returns a pointer to it. // // Deprecated: use Ptr instead. -func Int64(v int64) *int64 { return &v } +// +//go:fix inline +func Int64(v int64) *int64 { return Ptr(v) } // String is a helper routine that allocates a new string value // to store v and returns a pointer to it. // // Deprecated: use Ptr instead. -func String(v string) *string { return &v } +// +//go:fix inline +func String(v string) *string { return Ptr(v) } // roundTripperFunc creates a RoundTripper (transport). type roundTripperFunc func(*http.Request) (*http.Response, error) diff --git a/vendor/github.com/google/go-github/v73/github/gitignore.go b/vendor/github.com/google/go-github/v88/github/gitignore.go similarity index 76% rename from vendor/github.com/google/go-github/v73/github/gitignore.go rename to vendor/github.com/google/go-github/v88/github/gitignore.go index 34cf285e1..9a2c8b2d1 100644 --- a/vendor/github.com/google/go-github/v73/github/gitignore.go +++ b/vendor/github.com/google/go-github/v88/github/gitignore.go @@ -13,7 +13,7 @@ import ( // GitignoresService provides access to the gitignore related functions in the // GitHub API. // -// GitHub API docs: https://docs.github.com/rest/gitignore/ +// GitHub API docs: https://docs.github.com/rest/gitignore?apiVersion=2022-11-28 type GitignoresService service // Gitignore represents a .gitignore file as returned by the GitHub API. @@ -28,17 +28,17 @@ func (g Gitignore) String() string { // List all available Gitignore templates. // -// GitHub API docs: https://docs.github.com/rest/gitignore/gitignore#get-all-gitignore-templates +// GitHub API docs: https://docs.github.com/rest/gitignore/gitignore?apiVersion=2022-11-28#get-all-gitignore-templates // //meta:operation GET /gitignore/templates func (s *GitignoresService) List(ctx context.Context) ([]string, *Response, error) { - req, err := s.client.NewRequest("GET", "gitignore/templates", nil) + req, err := s.client.NewRequest(ctx, "GET", "gitignore/templates", nil) if err != nil { return nil, nil, err } var availableTemplates []string - resp, err := s.client.Do(ctx, req, &availableTemplates) + resp, err := s.client.Do(req, &availableTemplates) if err != nil { return nil, resp, err } @@ -48,18 +48,18 @@ func (s *GitignoresService) List(ctx context.Context) ([]string, *Response, erro // Get a Gitignore by name. // -// GitHub API docs: https://docs.github.com/rest/gitignore/gitignore#get-a-gitignore-template +// GitHub API docs: https://docs.github.com/rest/gitignore/gitignore?apiVersion=2022-11-28#get-a-gitignore-template // //meta:operation GET /gitignore/templates/{name} func (s *GitignoresService) Get(ctx context.Context, name string) (*Gitignore, *Response, error) { u := fmt.Sprintf("gitignore/templates/%v", name) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - gitignore := new(Gitignore) - resp, err := s.client.Do(ctx, req, gitignore) + var gitignore *Gitignore + resp, err := s.client.Do(req, &gitignore) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/interactions.go b/vendor/github.com/google/go-github/v88/github/interactions.go similarity index 92% rename from vendor/github.com/google/go-github/v73/github/interactions.go rename to vendor/github.com/google/go-github/v88/github/interactions.go index 2268273dd..92bd24b4d 100644 --- a/vendor/github.com/google/go-github/v73/github/interactions.go +++ b/vendor/github.com/google/go-github/v88/github/interactions.go @@ -8,7 +8,7 @@ package github // InteractionsService handles communication with the repository and organization related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/interactions/ +// GitHub API docs: https://docs.github.com/rest/interactions?apiVersion=2022-11-28 type InteractionsService service // InteractionRestriction represents the interaction restrictions for repository and organization. diff --git a/vendor/github.com/google/go-github/v73/github/interactions_orgs.go b/vendor/github.com/google/go-github/v88/github/interactions_orgs.go similarity index 72% rename from vendor/github.com/google/go-github/v73/github/interactions_orgs.go rename to vendor/github.com/google/go-github/v88/github/interactions_orgs.go index 47998c4ee..8ec5e8936 100644 --- a/vendor/github.com/google/go-github/v73/github/interactions_orgs.go +++ b/vendor/github.com/google/go-github/v88/github/interactions_orgs.go @@ -12,22 +12,20 @@ import ( // GetRestrictionsForOrg fetches the interaction restrictions for an organization. // -// GitHub API docs: https://docs.github.com/rest/interactions/orgs#get-interaction-restrictions-for-an-organization +// GitHub API docs: https://docs.github.com/rest/interactions/orgs?apiVersion=2022-11-28#get-interaction-restrictions-for-an-organization // //meta:operation GET /orgs/{org}/interaction-limits func (s *InteractionsService) GetRestrictionsForOrg(ctx context.Context, organization string) (*InteractionRestriction, *Response, error) { u := fmt.Sprintf("orgs/%v/interaction-limits", organization) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) - organizationInteractions := new(InteractionRestriction) - - resp, err := s.client.Do(ctx, req, organizationInteractions) + var organizationInteractions *InteractionRestriction + resp, err := s.client.Do(req, &organizationInteractions) if err != nil { return nil, resp, err } @@ -41,25 +39,23 @@ func (s *InteractionsService) GetRestrictionsForOrg(ctx context.Context, organiz // in public repositories for the given organization. // Possible values are: "existing_users", "contributors_only", "collaborators_only". // -// GitHub API docs: https://docs.github.com/rest/interactions/orgs#set-interaction-restrictions-for-an-organization +// GitHub API docs: https://docs.github.com/rest/interactions/orgs?apiVersion=2022-11-28#set-interaction-restrictions-for-an-organization // //meta:operation PUT /orgs/{org}/interaction-limits func (s *InteractionsService) UpdateRestrictionsForOrg(ctx context.Context, organization, limit string) (*InteractionRestriction, *Response, error) { u := fmt.Sprintf("orgs/%v/interaction-limits", organization) - interaction := &InteractionRestriction{Limit: Ptr(limit)} + interaction := &InteractionRestriction{Limit: &limit} - req, err := s.client.NewRequest("PUT", u, interaction) + req, err := s.client.NewRequest(ctx, "PUT", u, interaction) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) - organizationInteractions := new(InteractionRestriction) - - resp, err := s.client.Do(ctx, req, organizationInteractions) + var organizationInteractions *InteractionRestriction + resp, err := s.client.Do(req, &organizationInteractions) if err != nil { return nil, resp, err } @@ -69,18 +65,17 @@ func (s *InteractionsService) UpdateRestrictionsForOrg(ctx context.Context, orga // RemoveRestrictionsFromOrg removes the interaction restrictions for an organization. // -// GitHub API docs: https://docs.github.com/rest/interactions/orgs#remove-interaction-restrictions-for-an-organization +// GitHub API docs: https://docs.github.com/rest/interactions/orgs?apiVersion=2022-11-28#remove-interaction-restrictions-for-an-organization // //meta:operation DELETE /orgs/{org}/interaction-limits func (s *InteractionsService) RemoveRestrictionsFromOrg(ctx context.Context, organization string) (*Response, error) { u := fmt.Sprintf("orgs/%v/interaction-limits", organization) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/interactions_repos.go b/vendor/github.com/google/go-github/v88/github/interactions_repos.go similarity index 72% rename from vendor/github.com/google/go-github/v73/github/interactions_repos.go rename to vendor/github.com/google/go-github/v88/github/interactions_repos.go index 58fd4f04f..8de75e73c 100644 --- a/vendor/github.com/google/go-github/v73/github/interactions_repos.go +++ b/vendor/github.com/google/go-github/v88/github/interactions_repos.go @@ -12,22 +12,20 @@ import ( // GetRestrictionsForRepo fetches the interaction restrictions for a repository. // -// GitHub API docs: https://docs.github.com/rest/interactions/repos#get-interaction-restrictions-for-a-repository +// GitHub API docs: https://docs.github.com/rest/interactions/repos?apiVersion=2022-11-28#get-interaction-restrictions-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/interaction-limits func (s *InteractionsService) GetRestrictionsForRepo(ctx context.Context, owner, repo string) (*InteractionRestriction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) - repositoryInteractions := new(InteractionRestriction) - - resp, err := s.client.Do(ctx, req, repositoryInteractions) + var repositoryInteractions *InteractionRestriction + resp, err := s.client.Do(req, &repositoryInteractions) if err != nil { return nil, resp, err } @@ -41,25 +39,23 @@ func (s *InteractionsService) GetRestrictionsForRepo(ctx context.Context, owner, // for the given repository. // Possible values are: "existing_users", "contributors_only", "collaborators_only". // -// GitHub API docs: https://docs.github.com/rest/interactions/repos#set-interaction-restrictions-for-a-repository +// GitHub API docs: https://docs.github.com/rest/interactions/repos?apiVersion=2022-11-28#set-interaction-restrictions-for-a-repository // //meta:operation PUT /repos/{owner}/{repo}/interaction-limits func (s *InteractionsService) UpdateRestrictionsForRepo(ctx context.Context, owner, repo, limit string) (*InteractionRestriction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo) - interaction := &InteractionRestriction{Limit: Ptr(limit)} + interaction := &InteractionRestriction{Limit: &limit} - req, err := s.client.NewRequest("PUT", u, interaction) + req, err := s.client.NewRequest(ctx, "PUT", u, interaction) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) - repositoryInteractions := new(InteractionRestriction) - - resp, err := s.client.Do(ctx, req, repositoryInteractions) + var repositoryInteractions *InteractionRestriction + resp, err := s.client.Do(req, &repositoryInteractions) if err != nil { return nil, resp, err } @@ -69,18 +65,17 @@ func (s *InteractionsService) UpdateRestrictionsForRepo(ctx context.Context, own // RemoveRestrictionsFromRepo removes the interaction restrictions for a repository. // -// GitHub API docs: https://docs.github.com/rest/interactions/repos#remove-interaction-restrictions-for-a-repository +// GitHub API docs: https://docs.github.com/rest/interactions/repos?apiVersion=2022-11-28#remove-interaction-restrictions-for-a-repository // //meta:operation DELETE /repos/{owner}/{repo}/interaction-limits func (s *InteractionsService) RemoveRestrictionsFromRepo(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/issue_import.go b/vendor/github.com/google/go-github/v88/github/issue_import.go similarity index 86% rename from vendor/github.com/google/go-github/v73/github/issue_import.go rename to vendor/github.com/google/go-github/v88/github/issue_import.go index 4f0637108..31761632c 100644 --- a/vendor/github.com/google/go-github/v73/github/issue_import.go +++ b/vendor/github.com/google/go-github/v88/github/issue_import.go @@ -9,6 +9,7 @@ import ( "bytes" "context" "encoding/json" + "errors" "fmt" ) @@ -75,28 +76,27 @@ type IssueImportError struct { //meta:operation POST /repos/{owner}/{repo}/import/issues func (s *IssueImportService) Create(ctx context.Context, owner, repo string, issue *IssueImportRequest) (*IssueImportResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/issues", owner, repo) - req, err := s.client.NewRequest("POST", u, issue) + req, err := s.client.NewRequest(ctx, "POST", u, issue) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeIssueImportAPI) - i := new(IssueImportResponse) - resp, err := s.client.Do(ctx, req, i) + var i IssueImportResponse + resp, err := s.client.Do(req, &i) if err != nil { - aerr, ok := err.(*AcceptedError) - if ok { - if err := json.Unmarshal(aerr.Raw, i); err != nil { - return i, resp, err + var aerr *AcceptedError + if errors.As(err, &aerr) { + if err := json.Unmarshal(aerr.Raw, &i); err != nil { + return &i, resp, err } - return i, resp, err + return &i, resp, err } return nil, resp, err } - return i, resp, nil + return &i, resp, nil } // CheckStatus checks the status of an imported issue. @@ -106,16 +106,15 @@ func (s *IssueImportService) Create(ctx context.Context, owner, repo string, iss //meta:operation GET /repos/{owner}/{repo}/import/issues/{issue_number} func (s *IssueImportService) CheckStatus(ctx context.Context, owner, repo string, issueID int64) (*IssueImportResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/issues/%v", owner, repo, issueID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeIssueImportAPI) - i := new(IssueImportResponse) - resp, err := s.client.Do(ctx, req, i) + var i *IssueImportResponse + resp, err := s.client.Do(req, &i) if err != nil { return nil, resp, err } @@ -130,16 +129,15 @@ func (s *IssueImportService) CheckStatus(ctx context.Context, owner, repo string //meta:operation GET /repos/{owner}/{repo}/import/issues func (s *IssueImportService) CheckStatusSince(ctx context.Context, owner, repo string, since Timestamp) ([]*IssueImportResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/issues?since=%v", owner, repo, since.Format("2006-01-02")) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeIssueImportAPI) var b bytes.Buffer - resp, err := s.client.Do(ctx, req, &b) + resp, err := s.client.Do(req, &b) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v88/github/issues.go b/vendor/github.com/google/go-github/v88/github/issues.go new file mode 100644 index 000000000..bea89912b --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/issues.go @@ -0,0 +1,541 @@ +// Copyright 2013 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" + "time" +) + +// IssuesService handles communication with the issue related +// methods of the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/issues?apiVersion=2022-11-28 +type IssuesService service + +// Issue represents a GitHub issue on a repository. +// +// Note: As far as the GitHub API is concerned, every pull request is an issue, +// but not every issue is a pull request. Some endpoints, events, and webhooks +// may also return pull requests via this struct. If PullRequestLinks is nil, +// this is an issue, and if PullRequestLinks is not nil, this is a pull request. +// The IsPullRequest helper method can be used to check that. +type Issue struct { + ID *int64 `json:"id,omitempty"` + Number *int `json:"number,omitempty"` + State *string `json:"state,omitempty"` + // StateReason can be one of: "completed", "not_planned", "reopened". + StateReason *string `json:"state_reason,omitempty"` + Locked *bool `json:"locked,omitempty"` + Title *string `json:"title,omitempty"` + Body *string `json:"body,omitempty"` + // AuthorAssociation is the issue author's relationship to the repository. + // Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE". + // + // Deprecated: GitHub will remove this field from Events API payloads on October 7, 2025. + // Use the Issues REST API endpoint to retrieve this information. + // See: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#get-an-issue + AuthorAssociation *string `json:"author_association,omitempty"` + User *User `json:"user,omitempty"` + Labels []*Label `json:"labels,omitempty"` + Assignee *User `json:"assignee,omitempty"` + Comments *int `json:"comments,omitempty"` + ClosedAt *Timestamp `json:"closed_at,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + ClosedBy *User `json:"closed_by,omitempty"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + CommentsURL *string `json:"comments_url,omitempty"` + EventsURL *string `json:"events_url,omitempty"` + LabelsURL *string `json:"labels_url,omitempty"` + RepositoryURL *string `json:"repository_url,omitempty"` + ParentIssueURL *string `json:"parent_issue_url,omitempty"` + Milestone *Milestone `json:"milestone,omitempty"` + PullRequestLinks *PullRequestLinks `json:"pull_request,omitempty"` + Repository *Repository `json:"repository,omitempty"` + Reactions *Reactions `json:"reactions,omitempty"` + Assignees []*User `json:"assignees,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Draft *bool `json:"draft,omitempty"` + Type *IssueType `json:"type,omitempty"` + IssueFieldValues []*IssueFieldValue `json:"issue_field_values,omitempty"` + + // TextMatches is only populated from search results that request text matches + // See: search.go and https://docs.github.com/rest/search/#text-match-metadata + TextMatches []*TextMatch `json:"text_matches,omitempty"` + + // ActiveLockReason is populated only when LockReason is provided while locking the issue. + // Possible values are: "off-topic", "too heated", "resolved", and "spam". + ActiveLockReason *string `json:"active_lock_reason,omitempty"` +} + +func (i Issue) String() string { + return Stringify(i) +} + +// IsPullRequest reports whether the issue is also a pull request. It uses the +// method recommended by GitHub's API documentation, which is to check whether +// PullRequestLinks is non-nil. +func (i Issue) IsPullRequest() bool { + return i.PullRequestLinks != nil +} + +// IssueRequest represents a request to create/edit an issue. +// It is separate from Issue above because otherwise Labels +// and Assignee fail to serialize to the correct JSON. +type IssueRequest struct { + Title *string `json:"title,omitempty"` + Body *string `json:"body,omitempty"` + Labels *[]string `json:"labels,omitempty"` + Assignee *string `json:"assignee,omitempty"` + State *string `json:"state,omitempty"` + // StateReason can be 'completed' or 'not_planned'. + StateReason *string `json:"state_reason,omitempty"` + Milestone *int `json:"milestone,omitempty"` + Assignees *[]string `json:"assignees,omitempty"` + Type *string `json:"type,omitempty"` + IssueFieldValues []*IssueRequestFieldValue `json:"issue_field_values,omitempty"` +} + +// PullRequestLinks object is added to the Issue object when it's an issue included +// in the IssueCommentEvent webhook payload, if the webhook is fired by a comment on a PR. +type PullRequestLinks struct { + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + DiffURL *string `json:"diff_url,omitempty"` + PatchURL *string `json:"patch_url,omitempty"` + MergedAt *Timestamp `json:"merged_at,omitempty"` +} + +// IssueType represents the type of issue. +// For now it shows up when receiving an Issue event. +type IssueType struct { + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + Color *string `json:"color,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` +} + +// IssueFieldValueSingleSelectOption represents a single-select option for an issue field value. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#get-an-issue +type IssueFieldValueSingleSelectOption struct { + ID int64 `json:"id"` + Name string `json:"name"` + Color string `json:"color"` +} + +// IssueRequestFieldValue represents a custom field value to set on an issue. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#update-an-issue +type IssueRequestFieldValue struct { + FieldID int64 `json:"field_id"` + Value any `json:"value"` +} + +// IssueFieldValue represents a custom field value attached to an issue. +// The Value field contains a string for text, single_select, and date fields, +// or a number for numeric fields. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#get-an-issue +type IssueFieldValue struct { + IssueFieldID int64 `json:"issue_field_id"` + NodeID string `json:"node_id"` + DataType string `json:"data_type"` + Value any `json:"value"` + SingleSelectOption *IssueFieldValueSingleSelectOption `json:"single_select_option,omitempty"` +} + +// ListAllIssuesOptions specifies the optional parameters to the +// IssuesService.ListAllIssues method. +type ListAllIssuesOptions struct { + // Filter specifies which issues to list. Possible values are: assigned, + // created, mentioned, subscribed, repos, all. Default is "assigned". + Filter string `url:"filter,omitempty"` + + // State filters issues based on their state. Possible values are: open, + // closed, all. Default is "open". + State string `url:"state,omitempty"` + + // Labels filters issues based on their label. + Labels []string `url:"labels,comma,omitempty"` + + // Sort specifies how to sort issues. Possible values are: created, updated, + // and comments. Default value is "created". + Sort string `url:"sort,omitempty"` + + // Direction in which to sort issues. Possible values are: asc, desc. + // Default is "desc". + Direction string `url:"direction,omitempty"` + + // Since filters issues by time. + Since time.Time `url:"since,omitempty"` + + Collab bool `url:"collab,omitempty"` + Orgs bool `url:"orgs,omitempty"` + Owned bool `url:"owned,omitempty"` + Pulls bool `url:"pulls,omitempty"` + + ListOptions +} + +// ListAllIssues gets issues assigned to the authenticated user across all visible repositories including owned repositories, +// member repositories, and organization repositories. +// You can use the filter query parameter to fetch issues that are not necessarily assigned to you. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#list-issues-assigned-to-the-authenticated-user +// +//meta:operation GET /issues +func (s *IssuesService) ListAllIssues(ctx context.Context, opts *ListAllIssuesOptions) ([]*Issue, *Response, error) { + u := "issues" + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeReactionsPreview) + + var issues []*Issue + resp, err := s.client.Do(req, &issues) + if err != nil { + return nil, resp, err + } + + return issues, resp, nil +} + +// ListUserIssuesOptions specifies the optional parameters to the +// IssuesService.ListUserIssues method. +type ListUserIssuesOptions struct { + // Filter specifies which issues to list. Possible values are: assigned, + // created, mentioned, subscribed, repos, all. Default is "assigned". + Filter string `url:"filter,omitempty"` + + // State filters issues based on their state. Possible values are: open, + // closed, all. Default is "open". + State string `url:"state,omitempty"` + + // Labels filters issues based on their label. + Labels []string `url:"labels,comma,omitempty"` + + // Sort specifies how to sort issues. Possible values are: created, updated, + // and comments. Default value is "created". + Sort string `url:"sort,omitempty"` + + // Direction in which to sort issues. Possible values are: asc, desc. + // Default is "desc". + Direction string `url:"direction,omitempty"` + + // Since filters issues by time. + Since time.Time `url:"since,omitempty"` + + ListOptions +} + +// ListUserIssues gets issues across owned and member repositories assigned to the authenticated user. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#list-user-account-issues-assigned-to-the-authenticated-user +// +//meta:operation GET /user/issues +func (s *IssuesService) ListUserIssues(ctx context.Context, opts *ListUserIssuesOptions) ([]*Issue, *Response, error) { + u := "user/issues" + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeReactionsPreview) + + var issues []*Issue + resp, err := s.client.Do(req, &issues) + if err != nil { + return nil, resp, err + } + + return issues, resp, nil +} + +// IssueListByOrgOptions specifies the optional parameters to the +// IssuesService.ListByOrg method. +type IssueListByOrgOptions struct { + // Filter specifies which issues to list. Possible values are: assigned, + // created, mentioned, subscribed, repos, all. Default is "assigned". + Filter string `url:"filter,omitempty"` + + // State filters issues based on their state. Possible values are: open, + // closed, all. Default is "open". + State string `url:"state,omitempty"` + + // Labels filters issues based on their label. + Labels []string `url:"labels,comma,omitempty"` + + // Type can be the name of an issue type. + Type string `url:"type,omitempty"` + + // Sort specifies how to sort issues. Possible values are: created, updated, + // and comments. Default value is "created". + Sort string `url:"sort,omitempty"` + + // Direction in which to sort issues. Possible values are: asc, desc. + // Default is "desc". + Direction string `url:"direction,omitempty"` + + // Since filters issues by time. + Since time.Time `url:"since,omitempty"` + + ListOptions +} + +// ListByOrg fetches the issues in the specified organization for the +// authenticated user. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#list-organization-issues-assigned-to-the-authenticated-user +// +//meta:operation GET /orgs/{org}/issues +func (s *IssuesService) ListByOrg(ctx context.Context, org string, opts *IssueListByOrgOptions) ([]*Issue, *Response, error) { + u := fmt.Sprintf("orgs/%v/issues", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeReactionsPreview) + + var issues []*Issue + resp, err := s.client.Do(req, &issues) + if err != nil { + return nil, resp, err + } + + return issues, resp, nil +} + +// IssueListByRepoOptions specifies the optional parameters to the +// IssuesService.ListByRepo method. +type IssueListByRepoOptions struct { + // Milestone limits issues for the specified milestone. Possible values are + // a milestone number, "none" for issues with no milestone, "*" for issues + // with any milestone. + Milestone string `url:"milestone,omitempty"` + + // State filters issues based on their state. Possible values are: open, + // closed, all. Default is "open". + State string `url:"state,omitempty"` + + // Assignee filters issues based on their assignee. Possible values are a + // user name, "none" for issues that are not assigned, "*" for issues with + // any assigned user. + Assignee string `url:"assignee,omitempty"` + + // Type can be the name of an issue type. + // If the string * is passed, issues with any type are accepted. + // If the string none is passed, issues without type are returned. + Type string `url:"type,omitempty"` + + // Creator filters issues based on their creator. + Creator string `url:"creator,omitempty"` + + // Mentioned filters issues to those mentioned a specific user. + Mentioned string `url:"mentioned,omitempty"` + + // Labels filters issues based on their label. + Labels []string `url:"labels,omitempty,comma"` + + // Sort specifies how to sort issues. Possible values are: created, updated, + // and comments. Default value is "created". + Sort string `url:"sort,omitempty"` + + // Direction in which to sort issues. Possible values are: asc, desc. + // Default is "desc". + Direction string `url:"direction,omitempty"` + + // Since filters issues by time. + Since time.Time `url:"since,omitempty"` + + // ListCursorOptions specifies the optional parameters for cursor pagination. + ListCursorOptions + + // Add ListOptions so offset pagination with integer type "page" query parameter is accepted + // since ListCursorOptions accepts "page" as string only. + ListOptions +} + +// ListByRepo lists the issues for the specified repository. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#list-repository-issues +// +//meta:operation GET /repos/{owner}/{repo}/issues +func (s *IssuesService) ListByRepo(ctx context.Context, owner, repo string, opts *IssueListByRepoOptions) ([]*Issue, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeReactionsPreview) + + var issues []*Issue + resp, err := s.client.Do(req, &issues) + if err != nil { + return nil, resp, err + } + + return issues, resp, nil +} + +// Get a single issue. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#get-an-issue +// +//meta:operation GET /repos/{owner}/{repo}/issues/{issue_number} +func (s *IssuesService) Get(ctx context.Context, owner, repo string, number int) (*Issue, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v", owner, repo, number) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeReactionsPreview) + + var issue *Issue + resp, err := s.client.Do(req, &issue) + if err != nil { + return nil, resp, err + } + + return issue, resp, nil +} + +// Create a new issue on the specified repository. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#create-an-issue +// +//meta:operation POST /repos/{owner}/{repo}/issues +func (s *IssuesService) Create(ctx context.Context, owner, repo string, issue *IssueRequest) (*Issue, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues", owner, repo) + req, err := s.client.NewRequest(ctx, "POST", u, issue) + if err != nil { + return nil, nil, err + } + + var i *Issue + resp, err := s.client.Do(req, &i) + if err != nil { + return nil, resp, err + } + + return i, resp, nil +} + +// Edit (update) an issue. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#update-an-issue +// +//meta:operation PATCH /repos/{owner}/{repo}/issues/{issue_number} +func (s *IssuesService) Edit(ctx context.Context, owner, repo string, number int, issue *IssueRequest) (*Issue, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v", owner, repo, number) + req, err := s.client.NewRequest(ctx, "PATCH", u, issue) + if err != nil { + return nil, nil, err + } + + var i *Issue + resp, err := s.client.Do(req, &i) + if err != nil { + return nil, resp, err + } + + return i, resp, nil +} + +// RemoveMilestone removes a milestone from an issue. +// +// This is a helper method to explicitly update an issue with a `null` milestone, thereby removing it. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#update-an-issue +// +//meta:operation PATCH /repos/{owner}/{repo}/issues/{issue_number} +func (s *IssuesService) RemoveMilestone(ctx context.Context, owner, repo string, issueNumber int) (*Issue, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v", owner, repo, issueNumber) + req, err := s.client.NewRequest(ctx, "PATCH", u, &struct { + Milestone *Milestone `json:"milestone"` + }{}) + if err != nil { + return nil, nil, err + } + + var i *Issue + resp, err := s.client.Do(req, &i) + if err != nil { + return nil, resp, err + } + + return i, resp, nil +} + +// LockIssueOptions specifies the optional parameters to the +// IssuesService.Lock method. +type LockIssueOptions struct { + // LockReason specifies the reason to lock this issue. + // Providing a lock reason can help make it clearer to contributors why an issue + // was locked. Possible values are: "off-topic", "too heated", "resolved", and "spam". + LockReason string `json:"lock_reason,omitempty"` +} + +// Lock an issue's conversation. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#lock-an-issue +// +//meta:operation PUT /repos/{owner}/{repo}/issues/{issue_number}/lock +func (s *IssuesService) Lock(ctx context.Context, owner, repo string, number int, opts *LockIssueOptions) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/lock", owner, repo, number) + req, err := s.client.NewRequest(ctx, "PUT", u, opts) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// Unlock an issue's conversation. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#unlock-an-issue +// +//meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/lock +func (s *IssuesService) Unlock(ctx context.Context, owner, repo string, number int) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/lock", owner, repo, number) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v73/github/issues_assignees.go b/vendor/github.com/google/go-github/v88/github/issues_assignees.go similarity index 81% rename from vendor/github.com/google/go-github/v73/github/issues_assignees.go rename to vendor/github.com/google/go-github/v88/github/issues_assignees.go index fd065771e..3b2dd4d3a 100644 --- a/vendor/github.com/google/go-github/v73/github/issues_assignees.go +++ b/vendor/github.com/google/go-github/v88/github/issues_assignees.go @@ -13,7 +13,7 @@ import ( // ListAssignees fetches all available assignees (owners and collaborators) to // which issues may be assigned. // -// GitHub API docs: https://docs.github.com/rest/issues/assignees#list-assignees +// GitHub API docs: https://docs.github.com/rest/issues/assignees?apiVersion=2022-11-28#list-assignees // //meta:operation GET /repos/{owner}/{repo}/assignees func (s *IssuesService) ListAssignees(ctx context.Context, owner, repo string, opts *ListOptions) ([]*User, *Response, error) { @@ -23,13 +23,13 @@ func (s *IssuesService) ListAssignees(ctx context.Context, owner, repo string, o return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var assignees []*User - resp, err := s.client.Do(ctx, req, &assignees) + resp, err := s.client.Do(req, &assignees) if err != nil { return nil, resp, err } @@ -39,24 +39,24 @@ func (s *IssuesService) ListAssignees(ctx context.Context, owner, repo string, o // IsAssignee checks if a user is an assignee for the specified repository. // -// GitHub API docs: https://docs.github.com/rest/issues/assignees#check-if-a-user-can-be-assigned +// GitHub API docs: https://docs.github.com/rest/issues/assignees?apiVersion=2022-11-28#check-if-a-user-can-be-assigned // //meta:operation GET /repos/{owner}/{repo}/assignees/{assignee} func (s *IssuesService) IsAssignee(ctx context.Context, owner, repo, user string) (bool, *Response, error) { u := fmt.Sprintf("repos/%v/%v/assignees/%v", owner, repo, user) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return false, nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) assignee, err := parseBoolResponse(err) return assignee, resp, err } // AddAssignees adds the provided GitHub users as assignees to the issue. // -// GitHub API docs: https://docs.github.com/rest/issues/assignees#add-assignees-to-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/assignees?apiVersion=2022-11-28#add-assignees-to-an-issue // //meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/assignees func (s *IssuesService) AddAssignees(ctx context.Context, owner, repo string, number int, assignees []string) (*Issue, *Response, error) { @@ -64,13 +64,13 @@ func (s *IssuesService) AddAssignees(ctx context.Context, owner, repo string, nu Assignees []string `json:"assignees,omitempty"` }{Assignees: assignees} u := fmt.Sprintf("repos/%v/%v/issues/%v/assignees", owner, repo, number) - req, err := s.client.NewRequest("POST", u, users) + req, err := s.client.NewRequest(ctx, "POST", u, users) if err != nil { return nil, nil, err } - issue := &Issue{} - resp, err := s.client.Do(ctx, req, issue) + var issue *Issue + resp, err := s.client.Do(req, &issue) if err != nil { return nil, resp, err } @@ -80,7 +80,7 @@ func (s *IssuesService) AddAssignees(ctx context.Context, owner, repo string, nu // RemoveAssignees removes the provided GitHub users as assignees from the issue. // -// GitHub API docs: https://docs.github.com/rest/issues/assignees#remove-assignees-from-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/assignees?apiVersion=2022-11-28#remove-assignees-from-an-issue // //meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/assignees func (s *IssuesService) RemoveAssignees(ctx context.Context, owner, repo string, number int, assignees []string) (*Issue, *Response, error) { @@ -88,13 +88,13 @@ func (s *IssuesService) RemoveAssignees(ctx context.Context, owner, repo string, Assignees []string `json:"assignees,omitempty"` }{Assignees: assignees} u := fmt.Sprintf("repos/%v/%v/issues/%v/assignees", owner, repo, number) - req, err := s.client.NewRequest("DELETE", u, users) + req, err := s.client.NewRequest(ctx, "DELETE", u, users) if err != nil { return nil, nil, err } - issue := &Issue{} - resp, err := s.client.Do(ctx, req, issue) + var issue *Issue + resp, err := s.client.Do(req, &issue) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/issues_comments.go b/vendor/github.com/google/go-github/v88/github/issues_comments.go similarity index 66% rename from vendor/github.com/google/go-github/v73/github/issues_comments.go rename to vendor/github.com/google/go-github/v88/github/issues_comments.go index 74a4e60f7..f7ab4b80e 100644 --- a/vendor/github.com/google/go-github/v73/github/issues_comments.go +++ b/vendor/github.com/google/go-github/v88/github/issues_comments.go @@ -22,6 +22,10 @@ type IssueComment struct { UpdatedAt *Timestamp `json:"updated_at,omitempty"` // AuthorAssociation is the comment author's relationship to the issue's repository. // Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE". + // + // Deprecated: GitHub will remove this field from Events API payloads on October 7, 2025. + // Use the Issue Comments REST API endpoint to retrieve this information. + // See: https://docs.github.com/rest/issues/comments?apiVersion=2022-11-28#get-an-issue-comment AuthorAssociation *string `json:"author_association,omitempty"` URL *string `json:"url,omitempty"` HTMLURL *string `json:"html_url,omitempty"` @@ -50,33 +54,33 @@ type IssueListCommentsOptions struct { // ListComments lists all comments on the specified issue. Specifying an issue // number of 0 will return all comments on all issues for the repository. // -// GitHub API docs: https://docs.github.com/rest/issues/comments#list-issue-comments -// GitHub API docs: https://docs.github.com/rest/issues/comments#list-issue-comments-for-a-repository +// GitHub API docs: https://docs.github.com/rest/issues/comments?apiVersion=2022-11-28#list-issue-comments +// +// GitHub API docs: https://docs.github.com/rest/issues/comments?apiVersion=2022-11-28#list-issue-comments-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/issues/comments //meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/comments -func (s *IssuesService) ListComments(ctx context.Context, owner string, repo string, number int, opts *IssueListCommentsOptions) ([]*IssueComment, *Response, error) { +func (s *IssuesService) ListComments(ctx context.Context, owner, repo string, number int, opts *IssueListCommentsOptions) ([]*IssueComment, *Response, error) { var u string if number == 0 { u = fmt.Sprintf("repos/%v/%v/issues/comments", owner, repo) } else { - u = fmt.Sprintf("repos/%v/%v/issues/%d/comments", owner, repo, number) + u = fmt.Sprintf("repos/%v/%v/issues/%v/comments", owner, repo, number) } u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeReactionsPreview) var comments []*IssueComment - resp, err := s.client.Do(ctx, req, &comments) + resp, err := s.client.Do(req, &comments) if err != nil { return nil, resp, err } @@ -86,22 +90,21 @@ func (s *IssuesService) ListComments(ctx context.Context, owner string, repo str // GetComment fetches the specified issue comment. // -// GitHub API docs: https://docs.github.com/rest/issues/comments#get-an-issue-comment +// GitHub API docs: https://docs.github.com/rest/issues/comments?apiVersion=2022-11-28#get-an-issue-comment // //meta:operation GET /repos/{owner}/{repo}/issues/comments/{comment_id} -func (s *IssuesService) GetComment(ctx context.Context, owner string, repo string, commentID int64) (*IssueComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID) +func (s *IssuesService) GetComment(ctx context.Context, owner, repo string, commentID int64) (*IssueComment, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/comments/%v", owner, repo, commentID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeReactionsPreview) - comment := new(IssueComment) - resp, err := s.client.Do(ctx, req, comment) + var comment *IssueComment + resp, err := s.client.Do(req, &comment) if err != nil { return nil, resp, err } @@ -111,17 +114,17 @@ func (s *IssuesService) GetComment(ctx context.Context, owner string, repo strin // CreateComment creates a new comment on the specified issue. // -// GitHub API docs: https://docs.github.com/rest/issues/comments#create-an-issue-comment +// GitHub API docs: https://docs.github.com/rest/issues/comments?apiVersion=2022-11-28#create-an-issue-comment // //meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/comments -func (s *IssuesService) CreateComment(ctx context.Context, owner string, repo string, number int, comment *IssueComment) (*IssueComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/comments", owner, repo, number) - req, err := s.client.NewRequest("POST", u, comment) +func (s *IssuesService) CreateComment(ctx context.Context, owner, repo string, number int, comment *IssueComment) (*IssueComment, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/comments", owner, repo, number) + req, err := s.client.NewRequest(ctx, "POST", u, comment) if err != nil { return nil, nil, err } - c := new(IssueComment) - resp, err := s.client.Do(ctx, req, c) + var c *IssueComment + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -132,17 +135,17 @@ func (s *IssuesService) CreateComment(ctx context.Context, owner string, repo st // EditComment updates an issue comment. // A non-nil comment.Body must be provided. Other comment fields should be left nil. // -// GitHub API docs: https://docs.github.com/rest/issues/comments#update-an-issue-comment +// GitHub API docs: https://docs.github.com/rest/issues/comments?apiVersion=2022-11-28#update-an-issue-comment // //meta:operation PATCH /repos/{owner}/{repo}/issues/comments/{comment_id} -func (s *IssuesService) EditComment(ctx context.Context, owner string, repo string, commentID int64, comment *IssueComment) (*IssueComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID) - req, err := s.client.NewRequest("PATCH", u, comment) +func (s *IssuesService) EditComment(ctx context.Context, owner, repo string, commentID int64, comment *IssueComment) (*IssueComment, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/comments/%v", owner, repo, commentID) + req, err := s.client.NewRequest(ctx, "PATCH", u, comment) if err != nil { return nil, nil, err } - c := new(IssueComment) - resp, err := s.client.Do(ctx, req, c) + var c *IssueComment + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -152,14 +155,14 @@ func (s *IssuesService) EditComment(ctx context.Context, owner string, repo stri // DeleteComment deletes an issue comment. // -// GitHub API docs: https://docs.github.com/rest/issues/comments#delete-an-issue-comment +// GitHub API docs: https://docs.github.com/rest/issues/comments?apiVersion=2022-11-28#delete-an-issue-comment // //meta:operation DELETE /repos/{owner}/{repo}/issues/comments/{comment_id} -func (s *IssuesService) DeleteComment(ctx context.Context, owner string, repo string, commentID int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID) - req, err := s.client.NewRequest("DELETE", u, nil) +func (s *IssuesService) DeleteComment(ctx context.Context, owner, repo string, commentID int64) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/comments/%v", owner, repo, commentID) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/issues_events.go b/vendor/github.com/google/go-github/v88/github/issues_events.go similarity index 90% rename from vendor/github.com/google/go-github/v73/github/issues_events.go rename to vendor/github.com/google/go-github/v88/github/issues_events.go index 8e234d7e0..82aa38f9a 100644 --- a/vendor/github.com/google/go-github/v73/github/issues_events.go +++ b/vendor/github.com/google/go-github/v88/github/issues_events.go @@ -104,7 +104,7 @@ type DismissedReview struct { // ListIssueEvents lists events for the specified issue. // -// GitHub API docs: https://docs.github.com/rest/issues/events#list-issue-events +// GitHub API docs: https://docs.github.com/rest/issues/events?apiVersion=2022-11-28#list-issue-events // //meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/events func (s *IssuesService) ListIssueEvents(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*IssueEvent, *Response, error) { @@ -114,7 +114,7 @@ func (s *IssuesService) ListIssueEvents(ctx context.Context, owner, repo string, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } @@ -122,7 +122,7 @@ func (s *IssuesService) ListIssueEvents(ctx context.Context, owner, repo string, req.Header.Set("Accept", mediaTypeProjectCardDetailsPreview) var events []*IssueEvent - resp, err := s.client.Do(ctx, req, &events) + resp, err := s.client.Do(req, &events) if err != nil { return nil, resp, err } @@ -132,7 +132,7 @@ func (s *IssuesService) ListIssueEvents(ctx context.Context, owner, repo string, // ListRepositoryEvents lists events for the specified repository. // -// GitHub API docs: https://docs.github.com/rest/issues/events#list-issue-events-for-a-repository +// GitHub API docs: https://docs.github.com/rest/issues/events?apiVersion=2022-11-28#list-issue-events-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/issues/events func (s *IssuesService) ListRepositoryEvents(ctx context.Context, owner, repo string, opts *ListOptions) ([]*IssueEvent, *Response, error) { @@ -142,13 +142,13 @@ func (s *IssuesService) ListRepositoryEvents(ctx context.Context, owner, repo st return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var events []*IssueEvent - resp, err := s.client.Do(ctx, req, &events) + resp, err := s.client.Do(req, &events) if err != nil { return nil, resp, err } @@ -158,19 +158,19 @@ func (s *IssuesService) ListRepositoryEvents(ctx context.Context, owner, repo st // GetEvent returns the specified issue event. // -// GitHub API docs: https://docs.github.com/rest/issues/events#get-an-issue-event +// GitHub API docs: https://docs.github.com/rest/issues/events?apiVersion=2022-11-28#get-an-issue-event // //meta:operation GET /repos/{owner}/{repo}/issues/events/{event_id} func (s *IssuesService) GetEvent(ctx context.Context, owner, repo string, id int64) (*IssueEvent, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/events/%v", owner, repo, id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - event := new(IssueEvent) - resp, err := s.client.Do(ctx, req, event) + var event *IssueEvent + resp, err := s.client.Do(req, &event) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/issues_labels.go b/vendor/github.com/google/go-github/v88/github/issues_labels.go similarity index 52% rename from vendor/github.com/google/go-github/v73/github/issues_labels.go rename to vendor/github.com/google/go-github/v88/github/issues_labels.go index b97b00f3e..c334ed660 100644 --- a/vendor/github.com/google/go-github/v73/github/issues_labels.go +++ b/vendor/github.com/google/go-github/v88/github/issues_labels.go @@ -27,23 +27,23 @@ func (l Label) String() string { // ListLabels lists all labels for a repository. // -// GitHub API docs: https://docs.github.com/rest/issues/labels#list-labels-for-a-repository +// GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#list-labels-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/labels -func (s *IssuesService) ListLabels(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*Label, *Response, error) { +func (s *IssuesService) ListLabels(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/labels", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var labels []*Label - resp, err := s.client.Do(ctx, req, &labels) + resp, err := s.client.Do(req, &labels) if err != nil { return nil, resp, err } @@ -53,18 +53,18 @@ func (s *IssuesService) ListLabels(ctx context.Context, owner string, repo strin // GetLabel gets a single label. // -// GitHub API docs: https://docs.github.com/rest/issues/labels#get-a-label +// GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#get-a-label // //meta:operation GET /repos/{owner}/{repo}/labels/{name} -func (s *IssuesService) GetLabel(ctx context.Context, owner string, repo string, name string) (*Label, *Response, error) { +func (s *IssuesService) GetLabel(ctx context.Context, owner, repo, name string) (*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - label := new(Label) - resp, err := s.client.Do(ctx, req, label) + var label *Label + resp, err := s.client.Do(req, &label) if err != nil { return nil, resp, err } @@ -74,18 +74,18 @@ func (s *IssuesService) GetLabel(ctx context.Context, owner string, repo string, // CreateLabel creates a new label on the specified repository. // -// GitHub API docs: https://docs.github.com/rest/issues/labels#create-a-label +// GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#create-a-label // //meta:operation POST /repos/{owner}/{repo}/labels -func (s *IssuesService) CreateLabel(ctx context.Context, owner string, repo string, label *Label) (*Label, *Response, error) { +func (s *IssuesService) CreateLabel(ctx context.Context, owner, repo string, label *Label) (*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/labels", owner, repo) - req, err := s.client.NewRequest("POST", u, label) + req, err := s.client.NewRequest(ctx, "POST", u, label) if err != nil { return nil, nil, err } - l := new(Label) - resp, err := s.client.Do(ctx, req, l) + var l *Label + resp, err := s.client.Do(req, &l) if err != nil { return nil, resp, err } @@ -95,18 +95,18 @@ func (s *IssuesService) CreateLabel(ctx context.Context, owner string, repo stri // EditLabel edits a label. // -// GitHub API docs: https://docs.github.com/rest/issues/labels#update-a-label +// GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#update-a-label // //meta:operation PATCH /repos/{owner}/{repo}/labels/{name} -func (s *IssuesService) EditLabel(ctx context.Context, owner string, repo string, name string, label *Label) (*Label, *Response, error) { +func (s *IssuesService) EditLabel(ctx context.Context, owner, repo, name string, label *Label) (*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name) - req, err := s.client.NewRequest("PATCH", u, label) + req, err := s.client.NewRequest(ctx, "PATCH", u, label) if err != nil { return nil, nil, err } - l := new(Label) - resp, err := s.client.Do(ctx, req, l) + var l *Label + resp, err := s.client.Do(req, &l) if err != nil { return nil, resp, err } @@ -116,37 +116,37 @@ func (s *IssuesService) EditLabel(ctx context.Context, owner string, repo string // DeleteLabel deletes a label. // -// GitHub API docs: https://docs.github.com/rest/issues/labels#delete-a-label +// GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#delete-a-label // //meta:operation DELETE /repos/{owner}/{repo}/labels/{name} -func (s *IssuesService) DeleteLabel(ctx context.Context, owner string, repo string, name string) (*Response, error) { +func (s *IssuesService) DeleteLabel(ctx context.Context, owner, repo, name string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListLabelsByIssue lists all labels for an issue. // -// GitHub API docs: https://docs.github.com/rest/issues/labels#list-labels-for-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#list-labels-for-an-issue // //meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/labels -func (s *IssuesService) ListLabelsByIssue(ctx context.Context, owner string, repo string, number int, opts *ListOptions) ([]*Label, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) +func (s *IssuesService) ListLabelsByIssue(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*Label, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/labels", owner, repo, number) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var labels []*Label - resp, err := s.client.Do(ctx, req, &labels) + resp, err := s.client.Do(req, &labels) if err != nil { return nil, resp, err } @@ -156,18 +156,18 @@ func (s *IssuesService) ListLabelsByIssue(ctx context.Context, owner string, rep // AddLabelsToIssue adds labels to an issue. // -// GitHub API docs: https://docs.github.com/rest/issues/labels#add-labels-to-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#add-labels-to-an-issue // //meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/labels -func (s *IssuesService) AddLabelsToIssue(ctx context.Context, owner string, repo string, number int, labels []string) ([]*Label, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) - req, err := s.client.NewRequest("POST", u, labels) +func (s *IssuesService) AddLabelsToIssue(ctx context.Context, owner, repo string, number int, labels []string) ([]*Label, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/labels", owner, repo, number) + req, err := s.client.NewRequest(ctx, "POST", u, labels) if err != nil { return nil, nil, err } var l []*Label - resp, err := s.client.Do(ctx, req, &l) + resp, err := s.client.Do(req, &l) if err != nil { return nil, resp, err } @@ -177,33 +177,33 @@ func (s *IssuesService) AddLabelsToIssue(ctx context.Context, owner string, repo // RemoveLabelForIssue removes a label for an issue. // -// GitHub API docs: https://docs.github.com/rest/issues/labels#remove-a-label-from-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#remove-a-label-from-an-issue // //meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name} -func (s *IssuesService) RemoveLabelForIssue(ctx context.Context, owner string, repo string, number int, label string) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/labels/%v", owner, repo, number, label) - req, err := s.client.NewRequest("DELETE", u, nil) +func (s *IssuesService) RemoveLabelForIssue(ctx context.Context, owner, repo string, number int, label string) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/labels/%v", owner, repo, number, label) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ReplaceLabelsForIssue replaces all labels for an issue. // -// GitHub API docs: https://docs.github.com/rest/issues/labels#set-labels-for-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#set-labels-for-an-issue // //meta:operation PUT /repos/{owner}/{repo}/issues/{issue_number}/labels -func (s *IssuesService) ReplaceLabelsForIssue(ctx context.Context, owner string, repo string, number int, labels []string) ([]*Label, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) - req, err := s.client.NewRequest("PUT", u, labels) +func (s *IssuesService) ReplaceLabelsForIssue(ctx context.Context, owner, repo string, number int, labels []string) ([]*Label, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/labels", owner, repo, number) + req, err := s.client.NewRequest(ctx, "PUT", u, labels) if err != nil { return nil, nil, err } var l []*Label - resp, err := s.client.Do(ctx, req, &l) + resp, err := s.client.Do(req, &l) if err != nil { return nil, resp, err } @@ -213,38 +213,38 @@ func (s *IssuesService) ReplaceLabelsForIssue(ctx context.Context, owner string, // RemoveLabelsForIssue removes all labels for an issue. // -// GitHub API docs: https://docs.github.com/rest/issues/labels#remove-all-labels-from-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#remove-all-labels-from-an-issue // //meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels -func (s *IssuesService) RemoveLabelsForIssue(ctx context.Context, owner string, repo string, number int) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) - req, err := s.client.NewRequest("DELETE", u, nil) +func (s *IssuesService) RemoveLabelsForIssue(ctx context.Context, owner, repo string, number int) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/labels", owner, repo, number) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListLabelsForMilestone lists labels for every issue in a milestone. // -// GitHub API docs: https://docs.github.com/rest/issues/labels#list-labels-for-issues-in-a-milestone +// GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#list-labels-for-issues-in-a-milestone // //meta:operation GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels -func (s *IssuesService) ListLabelsForMilestone(ctx context.Context, owner string, repo string, number int, opts *ListOptions) ([]*Label, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/milestones/%d/labels", owner, repo, number) +func (s *IssuesService) ListLabelsForMilestone(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*Label, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/milestones/%v/labels", owner, repo, number) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var labels []*Label - resp, err := s.client.Do(ctx, req, &labels) + resp, err := s.client.Do(req, &labels) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/issues_milestones.go b/vendor/github.com/google/go-github/v88/github/issues_milestones.go similarity index 73% rename from vendor/github.com/google/go-github/v73/github/issues_milestones.go rename to vendor/github.com/google/go-github/v88/github/issues_milestones.go index 6c31bcd05..9365745de 100644 --- a/vendor/github.com/google/go-github/v73/github/issues_milestones.go +++ b/vendor/github.com/google/go-github/v88/github/issues_milestones.go @@ -54,23 +54,23 @@ type MilestoneListOptions struct { // ListMilestones lists all milestones for a repository. // -// GitHub API docs: https://docs.github.com/rest/issues/milestones#list-milestones +// GitHub API docs: https://docs.github.com/rest/issues/milestones?apiVersion=2022-11-28#list-milestones // //meta:operation GET /repos/{owner}/{repo}/milestones -func (s *IssuesService) ListMilestones(ctx context.Context, owner string, repo string, opts *MilestoneListOptions) ([]*Milestone, *Response, error) { +func (s *IssuesService) ListMilestones(ctx context.Context, owner, repo string, opts *MilestoneListOptions) ([]*Milestone, *Response, error) { u := fmt.Sprintf("repos/%v/%v/milestones", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var milestones []*Milestone - resp, err := s.client.Do(ctx, req, &milestones) + resp, err := s.client.Do(req, &milestones) if err != nil { return nil, resp, err } @@ -80,18 +80,18 @@ func (s *IssuesService) ListMilestones(ctx context.Context, owner string, repo s // GetMilestone gets a single milestone. // -// GitHub API docs: https://docs.github.com/rest/issues/milestones#get-a-milestone +// GitHub API docs: https://docs.github.com/rest/issues/milestones?apiVersion=2022-11-28#get-a-milestone // //meta:operation GET /repos/{owner}/{repo}/milestones/{milestone_number} -func (s *IssuesService) GetMilestone(ctx context.Context, owner string, repo string, number int) (*Milestone, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number) - req, err := s.client.NewRequest("GET", u, nil) +func (s *IssuesService) GetMilestone(ctx context.Context, owner, repo string, number int) (*Milestone, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/milestones/%v", owner, repo, number) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - milestone := new(Milestone) - resp, err := s.client.Do(ctx, req, milestone) + var milestone *Milestone + resp, err := s.client.Do(req, &milestone) if err != nil { return nil, resp, err } @@ -101,18 +101,18 @@ func (s *IssuesService) GetMilestone(ctx context.Context, owner string, repo str // CreateMilestone creates a new milestone on the specified repository. // -// GitHub API docs: https://docs.github.com/rest/issues/milestones#create-a-milestone +// GitHub API docs: https://docs.github.com/rest/issues/milestones?apiVersion=2022-11-28#create-a-milestone // //meta:operation POST /repos/{owner}/{repo}/milestones -func (s *IssuesService) CreateMilestone(ctx context.Context, owner string, repo string, milestone *Milestone) (*Milestone, *Response, error) { +func (s *IssuesService) CreateMilestone(ctx context.Context, owner, repo string, milestone *Milestone) (*Milestone, *Response, error) { u := fmt.Sprintf("repos/%v/%v/milestones", owner, repo) - req, err := s.client.NewRequest("POST", u, milestone) + req, err := s.client.NewRequest(ctx, "POST", u, milestone) if err != nil { return nil, nil, err } - m := new(Milestone) - resp, err := s.client.Do(ctx, req, m) + var m *Milestone + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -122,18 +122,18 @@ func (s *IssuesService) CreateMilestone(ctx context.Context, owner string, repo // EditMilestone edits a milestone. // -// GitHub API docs: https://docs.github.com/rest/issues/milestones#update-a-milestone +// GitHub API docs: https://docs.github.com/rest/issues/milestones?apiVersion=2022-11-28#update-a-milestone // //meta:operation PATCH /repos/{owner}/{repo}/milestones/{milestone_number} -func (s *IssuesService) EditMilestone(ctx context.Context, owner string, repo string, number int, milestone *Milestone) (*Milestone, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number) - req, err := s.client.NewRequest("PATCH", u, milestone) +func (s *IssuesService) EditMilestone(ctx context.Context, owner, repo string, number int, milestone *Milestone) (*Milestone, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/milestones/%v", owner, repo, number) + req, err := s.client.NewRequest(ctx, "PATCH", u, milestone) if err != nil { return nil, nil, err } - m := new(Milestone) - resp, err := s.client.Do(ctx, req, m) + var m *Milestone + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -143,15 +143,15 @@ func (s *IssuesService) EditMilestone(ctx context.Context, owner string, repo st // DeleteMilestone deletes a milestone. // -// GitHub API docs: https://docs.github.com/rest/issues/milestones#delete-a-milestone +// GitHub API docs: https://docs.github.com/rest/issues/milestones?apiVersion=2022-11-28#delete-a-milestone // //meta:operation DELETE /repos/{owner}/{repo}/milestones/{milestone_number} -func (s *IssuesService) DeleteMilestone(ctx context.Context, owner string, repo string, number int) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number) - req, err := s.client.NewRequest("DELETE", u, nil) +func (s *IssuesService) DeleteMilestone(ctx context.Context, owner, repo string, number int) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/milestones/%v", owner, repo, number) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/issues_timeline.go b/vendor/github.com/google/go-github/v88/github/issues_timeline.go similarity index 97% rename from vendor/github.com/google/go-github/v73/github/issues_timeline.go rename to vendor/github.com/google/go-github/v88/github/issues_timeline.go index 903f5b89c..7cebc47c7 100644 --- a/vendor/github.com/google/go-github/v73/github/issues_timeline.go +++ b/vendor/github.com/google/go-github/v88/github/issues_timeline.go @@ -173,7 +173,7 @@ type Source struct { // ListIssueTimeline lists events for the specified issue. // -// GitHub API docs: https://docs.github.com/rest/issues/timeline#list-timeline-events-for-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/timeline?apiVersion=2022-11-28#list-timeline-events-for-an-issue // //meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/timeline func (s *IssuesService) ListIssueTimeline(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*Timeline, *Response, error) { @@ -183,17 +183,16 @@ func (s *IssuesService) ListIssueTimeline(ctx context.Context, owner, repo strin return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. acceptHeaders := []string{mediaTypeTimelinePreview, mediaTypeProjectCardDetailsPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) var events []*Timeline - resp, err := s.client.Do(ctx, req, &events) + resp, err := s.client.Do(req, &events) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/licenses.go b/vendor/github.com/google/go-github/v88/github/licenses.go similarity index 75% rename from vendor/github.com/google/go-github/v73/github/licenses.go rename to vendor/github.com/google/go-github/v88/github/licenses.go index 34b8a3d8a..8d34f6feb 100644 --- a/vendor/github.com/google/go-github/v73/github/licenses.go +++ b/vendor/github.com/google/go-github/v88/github/licenses.go @@ -13,7 +13,7 @@ import ( // LicensesService handles communication with the license related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/licenses/ +// GitHub API docs: https://docs.github.com/rest/licenses?apiVersion=2022-11-28 type LicensesService service // RepositoryLicense represents the license for a repository. @@ -58,19 +58,32 @@ func (l License) String() string { return Stringify(l) } +// ListLicensesOptions specifies the optional parameters to the LicensesService.List method. +type ListLicensesOptions struct { + Featured *bool `url:"featured,omitempty"` + + ListOptions +} + // List popular open source licenses. // -// GitHub API docs: https://docs.github.com/rest/licenses/licenses#get-all-commonly-used-licenses +// GitHub API docs: https://docs.github.com/rest/licenses/licenses?apiVersion=2022-11-28#get-all-commonly-used-licenses // //meta:operation GET /licenses -func (s *LicensesService) List(ctx context.Context) ([]*License, *Response, error) { - req, err := s.client.NewRequest("GET", "licenses", nil) +func (s *LicensesService) List(ctx context.Context, opts *ListLicensesOptions) ([]*License, *Response, error) { + u := "licenses" + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var licenses []*License - resp, err := s.client.Do(ctx, req, &licenses) + resp, err := s.client.Do(req, &licenses) if err != nil { return nil, resp, err } @@ -80,19 +93,19 @@ func (s *LicensesService) List(ctx context.Context) ([]*License, *Response, erro // Get extended metadata for one license. // -// GitHub API docs: https://docs.github.com/rest/licenses/licenses#get-a-license +// GitHub API docs: https://docs.github.com/rest/licenses/licenses?apiVersion=2022-11-28#get-a-license // //meta:operation GET /licenses/{license} func (s *LicensesService) Get(ctx context.Context, licenseName string) (*License, *Response, error) { - u := fmt.Sprintf("licenses/%s", licenseName) + u := fmt.Sprintf("licenses/%v", licenseName) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - license := new(License) - resp, err := s.client.Do(ctx, req, license) + var license *License + resp, err := s.client.Do(req, &license) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/markdown.go b/vendor/github.com/google/go-github/v88/github/markdown.go similarity index 84% rename from vendor/github.com/google/go-github/v73/github/markdown.go rename to vendor/github.com/google/go-github/v88/github/markdown.go index 0fd896c6c..60e4660cd 100644 --- a/vendor/github.com/google/go-github/v73/github/markdown.go +++ b/vendor/github.com/google/go-github/v88/github/markdown.go @@ -40,27 +40,27 @@ type markdownRenderRequest struct { // Render renders an arbitrary Render document. // -// GitHub API docs: https://docs.github.com/rest/markdown/markdown#render-a-markdown-document +// GitHub API docs: https://docs.github.com/rest/markdown/markdown?apiVersion=2022-11-28#render-a-markdown-document // //meta:operation POST /markdown func (s *MarkdownService) Render(ctx context.Context, text string, opts *MarkdownOptions) (string, *Response, error) { - request := &markdownRenderRequest{Text: Ptr(text)} + request := &markdownRenderRequest{Text: &text} if opts != nil { if opts.Mode != "" { - request.Mode = Ptr(opts.Mode) + request.Mode = &opts.Mode } if opts.Context != "" { - request.Context = Ptr(opts.Context) + request.Context = &opts.Context } } - req, err := s.client.NewRequest("POST", "markdown", request) + req, err := s.client.NewRequest(ctx, "POST", "markdown", request) if err != nil { return "", nil, err } - buf := new(bytes.Buffer) - resp, err := s.client.Do(ctx, req, buf) + var buf bytes.Buffer + resp, err := s.client.Do(req, &buf) if err != nil { return "", resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/messages.go b/vendor/github.com/google/go-github/v88/github/messages.go similarity index 94% rename from vendor/github.com/google/go-github/v73/github/messages.go rename to vendor/github.com/google/go-github/v88/github/messages.go index 21eb7c70c..9bb43c75d 100644 --- a/vendor/github.com/google/go-github/v73/github/messages.go +++ b/vendor/github.com/google/go-github/v88/github/messages.go @@ -19,11 +19,12 @@ import ( "fmt" "hash" "io" + "maps" "mime" "net/http" "net/url" "reflect" - "sort" + "slices" "strings" ) @@ -41,6 +42,10 @@ const ( EventTypeHeader = "X-Github-Event" // DeliveryIDHeader is the GitHub header key used to pass the unique ID for the webhook event. DeliveryIDHeader = "X-Github-Delivery" + + // maxPayloadSize is the maximum size of a GitHub webhook payload. + // GitHub documents a 25 MB limit for webhook payloads. + maxPayloadSize = 25 * 1024 * 1024 ) var ( @@ -145,8 +150,19 @@ func checkMAC(message, messageMAC, key []byte, hashFunc func() hash.Hash) bool { return hmac.Equal(messageMAC, expectedMAC) } -// messageMAC returns the hex-decoded HMAC tag from the signature and its -// corresponding hash function. +// readPayloadBody reads the body from readable, enforcing maxPayloadSize. +func readPayloadBody(readable io.Reader) ([]byte, error) { + body, err := io.ReadAll(io.LimitReader(readable, maxPayloadSize+1)) + if err != nil { + return nil, err + } + if len(body) > maxPayloadSize { + return nil, errors.New("webhook payload exceeds maximum allowed size") + } + return body, nil +} + +// messageMAC returns the MAC method and the corresponding hash function. func messageMAC(signature string) ([]byte, func() hash.Hash, error) { if signature == "" { return nil, nil, errors.New("missing signature") @@ -198,7 +214,7 @@ func ValidatePayloadFromBody(contentType string, readable io.Reader, signature s switch contentType { case "application/json": var err error - if body, err = io.ReadAll(readable); err != nil { + if body, err = readPayloadBody(readable); err != nil { return nil, err } @@ -212,7 +228,7 @@ func ValidatePayloadFromBody(contentType string, readable io.Reader, signature s const payloadFormParam = "payload" var err error - if body, err = io.ReadAll(readable); err != nil { + if body, err = readPayloadBody(readable); err != nil { return nil, err } @@ -334,12 +350,7 @@ func ParseWebHook(messageType string, payload []byte) (any, error) { // MessageTypes returns a sorted list of all the known GitHub event type strings // supported by go-github. func MessageTypes() []string { - types := make([]string, 0, len(eventTypeMapping)) - for t := range eventTypeMapping { - types = append(types, t) - } - sort.Strings(types) - return types + return slices.Sorted(maps.Keys(eventTypeMapping)) } // EventForType returns an empty struct matching the specified GitHub event type. diff --git a/vendor/github.com/google/go-github/v73/github/meta.go b/vendor/github.com/google/go-github/v88/github/meta.go similarity index 80% rename from vendor/github.com/google/go-github/v73/github/meta.go rename to vendor/github.com/google/go-github/v88/github/meta.go index 692353569..d895b3328 100644 --- a/vendor/github.com/google/go-github/v73/github/meta.go +++ b/vendor/github.com/google/go-github/v88/github/meta.go @@ -56,6 +56,14 @@ type APIMeta struct { // GitHub Action macOS runner will originate from. ActionsMacos []string `json:"actions_macos,omitempty"` + // An array of IP addresses in CIDR format specifying the IP addresses + // GitHub Codespaces will originate from. + Codespaces []string `json:"codespaces,omitempty"` + + // An array of IP addresses in CIDR format specifying the IP addresses + // GitHub Copilot will originate from. + Copilot []string `json:"copilot,omitempty"` + // An array of IP addresses in CIDR format specifying the IP addresses // Dependabot will originate from. Dependabot []string `json:"dependabot,omitempty"` @@ -86,9 +94,16 @@ type APIMetaDomains struct { Copilot []string `json:"copilot,omitempty"` Packages []string `json:"packages,omitempty"` Actions []string `json:"actions,omitempty"` + ActionsInbound *ActionsInboundDomains `json:"actions_inbound,omitempty"` ArtifactAttestations *APIMetaArtifactAttestations `json:"artifact_attestations,omitempty"` } +// ActionsInboundDomains represents the domains associated with GitHub Actions inbound traffic. +type ActionsInboundDomains struct { + FullDomains []string `json:"full_domains,omitempty"` + WildcardDomains []string `json:"wildcard_domains,omitempty"` +} + // APIMetaArtifactAttestations represents the artifact attestation services domains. type APIMetaArtifactAttestations struct { TrustDomain string `json:"trust_domain,omitempty"` @@ -99,17 +114,17 @@ type APIMetaArtifactAttestations struct { // this endpoint on your organization’s GitHub Enterprise installation, this // endpoint provides information about that installation. // -// GitHub API docs: https://docs.github.com/rest/meta/meta#get-github-meta-information +// GitHub API docs: https://docs.github.com/rest/meta/meta?apiVersion=2022-11-28#get-github-meta-information // //meta:operation GET /meta func (s *MetaService) Get(ctx context.Context) (*APIMeta, *Response, error) { - req, err := s.client.NewRequest("GET", "meta", nil) + req, err := s.client.NewRequest(ctx, "GET", "meta", nil) if err != nil { return nil, nil, err } - meta := new(APIMeta) - resp, err := s.client.Do(ctx, req, meta) + var meta *APIMeta + resp, err := s.client.Do(req, &meta) if err != nil { return nil, resp, err } @@ -127,22 +142,22 @@ func (c *Client) APIMeta(ctx context.Context) (*APIMeta, *Response, error) { // Octocat returns an ASCII art octocat with the specified message in a speech // bubble. If message is empty, a random zen phrase is used. // -// GitHub API docs: https://docs.github.com/rest/meta/meta#get-octocat +// GitHub API docs: https://docs.github.com/rest/meta/meta?apiVersion=2022-11-28#get-octocat // //meta:operation GET /octocat func (s *MetaService) Octocat(ctx context.Context, message string) (string, *Response, error) { u := "octocat" if message != "" { - u = fmt.Sprintf("%s?s=%s", u, url.QueryEscape(message)) + u = fmt.Sprintf("%v?s=%v", u, url.QueryEscape(message)) } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return "", nil, err } - buf := new(bytes.Buffer) - resp, err := s.client.Do(ctx, req, buf) + var buf bytes.Buffer + resp, err := s.client.Do(req, &buf) if err != nil { return "", resp, err } @@ -160,19 +175,19 @@ func (c *Client) Octocat(ctx context.Context, message string) (string, *Response // Zen returns a random line from The Zen of GitHub. // -// See also: http://warpspire.com/posts/taste/ +// See also: https://warpspire.com/posts/taste/ // -// GitHub API docs: https://docs.github.com/rest/meta/meta#get-the-zen-of-github +// GitHub API docs: https://docs.github.com/rest/meta/meta?apiVersion=2022-11-28#get-the-zen-of-github // //meta:operation GET /zen func (s *MetaService) Zen(ctx context.Context) (string, *Response, error) { - req, err := s.client.NewRequest("GET", "zen", nil) + req, err := s.client.NewRequest(ctx, "GET", "zen", nil) if err != nil { return "", nil, err } - buf := new(bytes.Buffer) - resp, err := s.client.Do(ctx, req, buf) + var buf bytes.Buffer + resp, err := s.client.Do(req, &buf) if err != nil { return "", resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/migrations.go b/vendor/github.com/google/go-github/v88/github/migrations.go similarity index 75% rename from vendor/github.com/google/go-github/v73/github/migrations.go rename to vendor/github.com/google/go-github/v88/github/migrations.go index 766c4c38e..0ebf8b122 100644 --- a/vendor/github.com/google/go-github/v73/github/migrations.go +++ b/vendor/github.com/google/go-github/v88/github/migrations.go @@ -9,14 +9,12 @@ import ( "context" "errors" "fmt" - "net/http" - "strings" ) // MigrationService provides access to the migration related functions // in the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/migration/ +// GitHub API docs: https://docs.github.com/rest/migrations?apiVersion=2022-11-28 type MigrationService service // Migration represents a GitHub migration (archival). @@ -55,6 +53,14 @@ type MigrationOptions struct { // ExcludeAttachments indicates whether attachments should be excluded from // the migration (to reduce migration archive file size). ExcludeAttachments bool + + // ExcludeReleases indicates whether releases should be excluded from + // the migration (to reduce migration archive file size). + ExcludeReleases bool + + // Exclude is a slice of related items to exclude from the response in order + // to improve performance of the request. Supported values are: "repositories" + Exclude []string } // startMigration represents the body of a StartMigration request. @@ -69,12 +75,20 @@ type startMigration struct { // ExcludeAttachments indicates whether attachments should be excluded from // the migration (to reduce migration archive file size). ExcludeAttachments *bool `json:"exclude_attachments,omitempty"` + + // ExcludeReleases indicates whether releases should be excluded from + // the migration (to reduce migration archive file size). + ExcludeReleases *bool `json:"exclude_releases,omitempty"` + + // Exclude is a slice of related items to exclude from the response in order + // to improve performance of the request. Supported values are: "repositories" + Exclude []string `json:"exclude,omitempty"` } // StartMigration starts the generation of a migration archive. // repos is a slice of repository names to migrate. // -// GitHub API docs: https://docs.github.com/rest/migrations/orgs#start-an-organization-migration +// GitHub API docs: https://docs.github.com/rest/migrations/orgs?apiVersion=2022-11-28#start-an-organization-migration // //meta:operation POST /orgs/{org}/migrations func (s *MigrationService) StartMigration(ctx context.Context, org string, repos []string, opts *MigrationOptions) (*Migration, *Response, error) { @@ -82,20 +96,21 @@ func (s *MigrationService) StartMigration(ctx context.Context, org string, repos body := &startMigration{Repositories: repos} if opts != nil { - body.LockRepositories = Ptr(opts.LockRepositories) - body.ExcludeAttachments = Ptr(opts.ExcludeAttachments) + body.LockRepositories = &opts.LockRepositories + body.ExcludeAttachments = &opts.ExcludeAttachments + body.ExcludeReleases = &opts.ExcludeReleases + body.Exclude = append(body.Exclude, opts.Exclude...) } - req, err := s.client.NewRequest("POST", u, body) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) - m := &Migration{} - resp, err := s.client.Do(ctx, req, m) + var m *Migration + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -105,7 +120,7 @@ func (s *MigrationService) StartMigration(ctx context.Context, org string, repos // ListMigrations lists the most recent migrations. // -// GitHub API docs: https://docs.github.com/rest/migrations/orgs#list-organization-migrations +// GitHub API docs: https://docs.github.com/rest/migrations/orgs?apiVersion=2022-11-28#list-organization-migrations // //meta:operation GET /orgs/{org}/migrations func (s *MigrationService) ListMigrations(ctx context.Context, org string, opts *ListOptions) ([]*Migration, *Response, error) { @@ -115,16 +130,15 @@ func (s *MigrationService) ListMigrations(ctx context.Context, org string, opts return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) var m []*Migration - resp, err := s.client.Do(ctx, req, &m) + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -135,22 +149,21 @@ func (s *MigrationService) ListMigrations(ctx context.Context, org string, opts // MigrationStatus gets the status of a specific migration archive. // id is the migration ID. // -// GitHub API docs: https://docs.github.com/rest/migrations/orgs#get-an-organization-migration-status +// GitHub API docs: https://docs.github.com/rest/migrations/orgs?apiVersion=2022-11-28#get-an-organization-migration-status // //meta:operation GET /orgs/{org}/migrations/{migration_id} func (s *MigrationService) MigrationStatus(ctx context.Context, org string, id int64) (*Migration, *Response, error) { u := fmt.Sprintf("orgs/%v/migrations/%v", org, id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) - m := &Migration{} - resp, err := s.client.Do(ctx, req, m) + var m *Migration + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -161,60 +174,47 @@ func (s *MigrationService) MigrationStatus(ctx context.Context, org string, id i // MigrationArchiveURL fetches a migration archive URL. // id is the migration ID. // -// GitHub API docs: https://docs.github.com/rest/migrations/orgs#download-an-organization-migration-archive +// GitHub API docs: https://docs.github.com/rest/migrations/orgs?apiVersion=2022-11-28#download-an-organization-migration-archive // //meta:operation GET /orgs/{org}/migrations/{migration_id}/archive func (s *MigrationService) MigrationArchiveURL(ctx context.Context, org string, id int64) (url string, err error) { u := fmt.Sprintf("orgs/%v/migrations/%v/archive", org, id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return "", err } - - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) - s.client.clientMu.Lock() - defer s.client.clientMu.Unlock() - - // Disable the redirect mechanism because AWS fails if the GitHub auth token is provided. - var loc string - saveRedirect := s.client.client.CheckRedirect - s.client.client.CheckRedirect = func(req *http.Request, via []*http.Request) error { - loc = req.URL.String() - return errors.New("disable redirect") + loc, _, err := s.client.bareDoUntilFound(req, 10) + if err != nil { + return "", err } - defer func() { s.client.client.CheckRedirect = saveRedirect }() - _, err = s.client.Do(ctx, req, nil) // expect error from disable redirect - if err == nil { + if loc == nil { return "", errors.New("expected redirect, none provided") } - if !strings.Contains(err.Error(), "disable redirect") { - return "", err - } - return loc, nil + + return loc.String(), nil } // DeleteMigration deletes a previous migration archive. // id is the migration ID. // -// GitHub API docs: https://docs.github.com/rest/migrations/orgs#delete-an-organization-migration-archive +// GitHub API docs: https://docs.github.com/rest/migrations/orgs?apiVersion=2022-11-28#delete-an-organization-migration-archive // //meta:operation DELETE /orgs/{org}/migrations/{migration_id}/archive func (s *MigrationService) DeleteMigration(ctx context.Context, org string, id int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/migrations/%v/archive", org, id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // UnlockRepo unlocks a repository that was locked for migration. @@ -222,19 +222,18 @@ func (s *MigrationService) DeleteMigration(ctx context.Context, org string, id i // You should unlock each migrated repository and delete them when the migration // is complete and you no longer need the source data. // -// GitHub API docs: https://docs.github.com/rest/migrations/orgs#unlock-an-organization-repository +// GitHub API docs: https://docs.github.com/rest/migrations/orgs?apiVersion=2022-11-28#unlock-an-organization-repository // //meta:operation DELETE /orgs/{org}/migrations/{migration_id}/repos/{repo_name}/lock func (s *MigrationService) UnlockRepo(ctx context.Context, org string, id int64, repo string) (*Response, error) { u := fmt.Sprintf("orgs/%v/migrations/%v/repos/%v/lock", org, id, repo) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/migrations_source_import.go b/vendor/github.com/google/go-github/v88/github/migrations_source_import.go similarity index 88% rename from vendor/github.com/google/go-github/v73/github/migrations_source_import.go rename to vendor/github.com/google/go-github/v88/github/migrations_source_import.go index f484b77d4..0503dcad2 100644 --- a/vendor/github.com/google/go-github/v73/github/migrations_source_import.go +++ b/vendor/github.com/google/go-github/v88/github/migrations_source_import.go @@ -115,7 +115,7 @@ func (i Import) String() string { // SourceImportAuthor identifies an author imported from a source repository. // -// GitHub API docs: https://docs.github.com/rest/migration/source_imports/#get-commit-authors +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#get-commit-authors type SourceImportAuthor struct { ID *int64 `json:"id,omitempty"` RemoteID *string `json:"remote_id,omitempty"` @@ -132,7 +132,7 @@ func (a SourceImportAuthor) String() string { // LargeFile identifies a file larger than 100MB found during a repository import. // -// GitHub API docs: https://docs.github.com/rest/migration/source_imports/#get-large-files +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#get-large-files type LargeFile struct { RefName *string `json:"ref_name,omitempty"` Path *string `json:"path,omitempty"` @@ -146,18 +146,18 @@ func (f LargeFile) String() string { // StartImport initiates a repository import. // -// GitHub API docs: https://docs.github.com/rest/migrations/source-imports#start-an-import +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#start-an-import // //meta:operation PUT /repos/{owner}/{repo}/import func (s *MigrationService) StartImport(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import", owner, repo) - req, err := s.client.NewRequest("PUT", u, in) + req, err := s.client.NewRequest(ctx, "PUT", u, in) if err != nil { return nil, nil, err } - out := new(Import) - resp, err := s.client.Do(ctx, req, out) + var out *Import + resp, err := s.client.Do(req, &out) if err != nil { return nil, resp, err } @@ -167,18 +167,18 @@ func (s *MigrationService) StartImport(ctx context.Context, owner, repo string, // ImportProgress queries for the status and progress of an ongoing repository import. // -// GitHub API docs: https://docs.github.com/rest/migrations/source-imports#get-an-import-status +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#get-an-import-status // //meta:operation GET /repos/{owner}/{repo}/import func (s *MigrationService) ImportProgress(ctx context.Context, owner, repo string) (*Import, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - out := new(Import) - resp, err := s.client.Do(ctx, req, out) + var out *Import + resp, err := s.client.Do(req, &out) if err != nil { return nil, resp, err } @@ -188,18 +188,18 @@ func (s *MigrationService) ImportProgress(ctx context.Context, owner, repo strin // UpdateImport initiates a repository import. // -// GitHub API docs: https://docs.github.com/rest/migrations/source-imports#update-an-import +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#update-an-import // //meta:operation PATCH /repos/{owner}/{repo}/import func (s *MigrationService) UpdateImport(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import", owner, repo) - req, err := s.client.NewRequest("PATCH", u, in) + req, err := s.client.NewRequest(ctx, "PATCH", u, in) if err != nil { return nil, nil, err } - out := new(Import) - resp, err := s.client.Do(ctx, req, out) + var out *Import + resp, err := s.client.Do(req, &out) if err != nil { return nil, resp, err } @@ -219,18 +219,18 @@ func (s *MigrationService) UpdateImport(ctx context.Context, owner, repo string, // This method and MapCommitAuthor allow you to provide correct Git author // information. // -// GitHub API docs: https://docs.github.com/rest/migrations/source-imports#get-commit-authors +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#get-commit-authors // //meta:operation GET /repos/{owner}/{repo}/import/authors func (s *MigrationService) CommitAuthors(ctx context.Context, owner, repo string) ([]*SourceImportAuthor, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/authors", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var authors []*SourceImportAuthor - resp, err := s.client.Do(ctx, req, &authors) + resp, err := s.client.Do(req, &authors) if err != nil { return nil, resp, err } @@ -242,18 +242,18 @@ func (s *MigrationService) CommitAuthors(ctx context.Context, owner, repo string // application can continue updating authors any time before you push new // commits to the repository. // -// GitHub API docs: https://docs.github.com/rest/migrations/source-imports#map-a-commit-author +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#map-a-commit-author // //meta:operation PATCH /repos/{owner}/{repo}/import/authors/{author_id} func (s *MigrationService) MapCommitAuthor(ctx context.Context, owner, repo string, id int64, author *SourceImportAuthor) (*SourceImportAuthor, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/authors/%v", owner, repo, id) - req, err := s.client.NewRequest("PATCH", u, author) + req, err := s.client.NewRequest(ctx, "PATCH", u, author) if err != nil { return nil, nil, err } - out := new(SourceImportAuthor) - resp, err := s.client.Do(ctx, req, out) + var out *SourceImportAuthor + resp, err := s.client.Do(req, &out) if err != nil { return nil, resp, err } @@ -265,18 +265,18 @@ func (s *MigrationService) MapCommitAuthor(ctx context.Context, owner, repo stri // files larger than 100MB. Only the UseLFS field on the provided Import is // used. // -// GitHub API docs: https://docs.github.com/rest/migrations/source-imports#update-git-lfs-preference +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#update-git-lfs-preference // //meta:operation PATCH /repos/{owner}/{repo}/import/lfs func (s *MigrationService) SetLFSPreference(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/lfs", owner, repo) - req, err := s.client.NewRequest("PATCH", u, in) + req, err := s.client.NewRequest(ctx, "PATCH", u, in) if err != nil { return nil, nil, err } - out := new(Import) - resp, err := s.client.Do(ctx, req, out) + var out *Import + resp, err := s.client.Do(req, &out) if err != nil { return nil, resp, err } @@ -286,18 +286,18 @@ func (s *MigrationService) SetLFSPreference(ctx context.Context, owner, repo str // LargeFiles lists files larger than 100MB found during the import. // -// GitHub API docs: https://docs.github.com/rest/migrations/source-imports#get-large-files +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#get-large-files // //meta:operation GET /repos/{owner}/{repo}/import/large_files func (s *MigrationService) LargeFiles(ctx context.Context, owner, repo string) ([]*LargeFile, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/large_files", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var files []*LargeFile - resp, err := s.client.Do(ctx, req, &files) + resp, err := s.client.Do(req, &files) if err != nil { return nil, resp, err } @@ -307,15 +307,15 @@ func (s *MigrationService) LargeFiles(ctx context.Context, owner, repo string) ( // CancelImport stops an import for a repository. // -// GitHub API docs: https://docs.github.com/rest/migrations/source-imports#cancel-an-import +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#cancel-an-import // //meta:operation DELETE /repos/{owner}/{repo}/import func (s *MigrationService) CancelImport(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/import", owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/migrations_user.go b/vendor/github.com/google/go-github/v88/github/migrations_user.go similarity index 81% rename from vendor/github.com/google/go-github/v73/github/migrations_user.go rename to vendor/github.com/google/go-github/v88/github/migrations_user.go index a7bd79499..6387d7f15 100644 --- a/vendor/github.com/google/go-github/v73/github/migrations_user.go +++ b/vendor/github.com/google/go-github/v88/github/migrations_user.go @@ -67,7 +67,7 @@ type startUserMigration struct { // StartUserMigration starts the generation of a migration archive. // repos is a slice of repository names to migrate. // -// GitHub API docs: https://docs.github.com/rest/migrations/users#start-a-user-migration +// GitHub API docs: https://docs.github.com/rest/migrations/users?apiVersion=2022-11-28#start-a-user-migration // //meta:operation POST /user/migrations func (s *MigrationService) StartUserMigration(ctx context.Context, repos []string, opts *UserMigrationOptions) (*UserMigration, *Response, error) { @@ -75,20 +75,19 @@ func (s *MigrationService) StartUserMigration(ctx context.Context, repos []strin body := &startUserMigration{Repositories: repos} if opts != nil { - body.LockRepositories = Ptr(opts.LockRepositories) - body.ExcludeAttachments = Ptr(opts.ExcludeAttachments) + body.LockRepositories = &opts.LockRepositories + body.ExcludeAttachments = &opts.ExcludeAttachments } - req, err := s.client.NewRequest("POST", u, body) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) - m := &UserMigration{} - resp, err := s.client.Do(ctx, req, m) + var m *UserMigration + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -98,7 +97,7 @@ func (s *MigrationService) StartUserMigration(ctx context.Context, repos []strin // ListUserMigrations lists the most recent migrations. // -// GitHub API docs: https://docs.github.com/rest/migrations/users#list-user-migrations +// GitHub API docs: https://docs.github.com/rest/migrations/users?apiVersion=2022-11-28#list-user-migrations // //meta:operation GET /user/migrations func (s *MigrationService) ListUserMigrations(ctx context.Context, opts *ListOptions) ([]*UserMigration, *Response, error) { @@ -108,16 +107,15 @@ func (s *MigrationService) ListUserMigrations(ctx context.Context, opts *ListOpt return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) var m []*UserMigration - resp, err := s.client.Do(ctx, req, &m) + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -128,22 +126,21 @@ func (s *MigrationService) ListUserMigrations(ctx context.Context, opts *ListOpt // UserMigrationStatus gets the status of a specific migration archive. // id is the migration ID. // -// GitHub API docs: https://docs.github.com/rest/migrations/users#get-a-user-migration-status +// GitHub API docs: https://docs.github.com/rest/migrations/users?apiVersion=2022-11-28#get-a-user-migration-status // //meta:operation GET /user/migrations/{migration_id} func (s *MigrationService) UserMigrationStatus(ctx context.Context, id int64) (*UserMigration, *Response, error) { u := fmt.Sprintf("user/migrations/%v", id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) - m := &UserMigration{} - resp, err := s.client.Do(ctx, req, m) + var m *UserMigration + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -154,35 +151,35 @@ func (s *MigrationService) UserMigrationStatus(ctx context.Context, id int64) (* // UserMigrationArchiveURL gets the URL for a specific migration archive. // id is the migration ID. // -// GitHub API docs: https://docs.github.com/rest/migrations/users#download-a-user-migration-archive +// GitHub API docs: https://docs.github.com/rest/migrations/users?apiVersion=2022-11-28#download-a-user-migration-archive // //meta:operation GET /user/migrations/{migration_id}/archive func (s *MigrationService) UserMigrationArchiveURL(ctx context.Context, id int64) (string, error) { url := fmt.Sprintf("user/migrations/%v/archive", id) - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return "", err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) - m := &UserMigration{} - var loc string originalRedirect := s.client.client.CheckRedirect - s.client.client.CheckRedirect = func(req *http.Request, via []*http.Request) error { + s.client.client.CheckRedirect = func(req *http.Request, _ []*http.Request) error { loc = req.URL.String() return http.ErrUseLastResponse } defer func() { s.client.client.CheckRedirect = originalRedirect }() - resp, err := s.client.Do(ctx, req, m) + + var m *UserMigration + resp, err := s.client.Do(req, &m) if err == nil { return "", errors.New("expected redirect, none provided") } + loc = resp.Header.Get("Location") return loc, nil } @@ -190,21 +187,20 @@ func (s *MigrationService) UserMigrationArchiveURL(ctx context.Context, id int64 // DeleteUserMigration will delete a previous migration archive. // id is the migration ID. // -// GitHub API docs: https://docs.github.com/rest/migrations/users#delete-a-user-migration-archive +// GitHub API docs: https://docs.github.com/rest/migrations/users?apiVersion=2022-11-28#delete-a-user-migration-archive // //meta:operation DELETE /user/migrations/{migration_id}/archive func (s *MigrationService) DeleteUserMigration(ctx context.Context, id int64) (*Response, error) { url := fmt.Sprintf("user/migrations/%v/archive", id) - req, err := s.client.NewRequest("DELETE", url, nil) + req, err := s.client.NewRequest(ctx, "DELETE", url, nil) if err != nil { return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // UnlockUserRepo will unlock a repo that was locked for migration. @@ -212,19 +208,18 @@ func (s *MigrationService) DeleteUserMigration(ctx context.Context, id int64) (* // You should unlock each migrated repository and delete them when the migration // is complete and you no longer need the source data. // -// GitHub API docs: https://docs.github.com/rest/migrations/users#unlock-a-user-repository +// GitHub API docs: https://docs.github.com/rest/migrations/users?apiVersion=2022-11-28#unlock-a-user-repository // //meta:operation DELETE /user/migrations/{migration_id}/repos/{repo_name}/lock func (s *MigrationService) UnlockUserRepo(ctx context.Context, id int64, repo string) (*Response, error) { url := fmt.Sprintf("user/migrations/%v/repos/%v/lock", id, repo) - req, err := s.client.NewRequest("DELETE", url, nil) + req, err := s.client.NewRequest(ctx, "DELETE", url, nil) if err != nil { return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/orgs.go b/vendor/github.com/google/go-github/v88/github/orgs.go similarity index 71% rename from vendor/github.com/google/go-github/v73/github/orgs.go rename to vendor/github.com/google/go-github/v88/github/orgs.go index 27c0f1028..d577b98b6 100644 --- a/vendor/github.com/google/go-github/v73/github/orgs.go +++ b/vendor/github.com/google/go-github/v88/github/orgs.go @@ -13,7 +13,7 @@ import ( // OrganizationsService provides access to the organization related functions // in the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/orgs/ +// GitHub API docs: https://docs.github.com/rest/orgs?apiVersion=2022-11-28 type OrganizationsService service // Organization represents a GitHub organization account. @@ -36,6 +36,7 @@ type Organization struct { Following *int `json:"following,omitempty"` CreatedAt *Timestamp `json:"created_at,omitempty"` UpdatedAt *Timestamp `json:"updated_at,omitempty"` + ArchivedAt *Timestamp `json:"archived_at,omitempty"` TotalPrivateRepos *int64 `json:"total_private_repos,omitempty"` OwnedPrivateRepos *int64 `json:"owned_private_repos,omitempty"` PrivateGists *int `json:"private_gists,omitempty"` @@ -67,6 +68,9 @@ type Organization struct { // MembersCanForkPrivateRepos toggles whether organization members can fork private organization repositories. MembersCanForkPrivateRepos *bool `json:"members_can_fork_private_repositories,omitempty"` + // DeployKeysEnabledForRepositories toggles whether deploy keys may be added and used for repositories in the organization. + DeployKeysEnabledForRepositories *bool `json:"deploy_keys_enabled_for_repositories,omitempty"` + // MembersAllowedRepositoryCreationType denotes if organization members can create repositories // and the type of repositories they can create. Possible values are: "all", "private", or "none". // @@ -97,6 +101,28 @@ type Organization struct { SecretScanningPushProtectionEnabledForNewRepos *bool `json:"secret_scanning_push_protection_enabled_for_new_repositories,omitempty"` // SecretScanningValidityChecksEnabled toggles whether secret scanning validity check is enabled. SecretScanningValidityChecksEnabled *bool `json:"secret_scanning_validity_checks_enabled,omitempty"` + // SecretScanningPushProtectionCustomLinkEnabled toggles whether a custom link is shown to contributors blocked by secret scanning push protection. + SecretScanningPushProtectionCustomLinkEnabled *bool `json:"secret_scanning_push_protection_custom_link_enabled,omitempty"` + // SecretScanningPushProtectionCustomLink is the URL displayed to contributors blocked by secret scanning push protection. + SecretScanningPushProtectionCustomLink *string `json:"secret_scanning_push_protection_custom_link,omitempty"` + // MembersCanDeleteRepositories toggles whether members with admin permissions can delete a repository. + MembersCanDeleteRepositories *bool `json:"members_can_delete_repositories,omitempty"` + // MembersCanChangeRepoVisibility toggles whether members with admin permissions can change the visibility for a repository. + MembersCanChangeRepoVisibility *bool `json:"members_can_change_repo_visibility,omitempty"` + // MembersCanInviteOutsideCollaborators toggles whether members with admin permissions can invite outside collaborators. + MembersCanInviteOutsideCollaborators *bool `json:"members_can_invite_outside_collaborators,omitempty"` + // MembersCanDeleteIssues toggles whether members with admin permissions can delete issues. + MembersCanDeleteIssues *bool `json:"members_can_delete_issues,omitempty"` + // DisplayCommenterFullNameSettingEnabled toggles whether members can see the comment author's profile name in private repositories. + DisplayCommenterFullNameSettingEnabled *bool `json:"display_commenter_full_name_setting_enabled,omitempty"` + // ReadersCanCreateDiscussions toggles whether users with read access can create and comment on discussions. + ReadersCanCreateDiscussions *bool `json:"readers_can_create_discussions,omitempty"` + // MembersCanCreateTeams toggles whether members of an organization can create new teams. + MembersCanCreateTeams *bool `json:"members_can_create_teams,omitempty"` + // MembersCanViewDependencyInsights toggles whether members may view dependency insights. + MembersCanViewDependencyInsights *bool `json:"members_can_view_dependency_insights,omitempty"` + // DefaultRepositoryBranch is the default branch for new repositories in the organization. + DefaultRepositoryBranch *string `json:"default_repository_branch,omitempty"` // API URLs URL *string `json:"url,omitempty"` @@ -135,13 +161,11 @@ func (p Plan) String() string { // OrganizationsListOptions specifies the optional parameters to the // OrganizationsService.ListAll method. type OrganizationsListOptions struct { - // Since filters Organizations by ID. + // An organization ID. Only return organizations with an ID greater than this ID. Since int64 `url:"since,omitempty"` - // Note: Pagination is powered exclusively by the Since parameter, - // ListOptions.Page has no effect. - // ListOptions.PerPage controls an undocumented GitHub API parameter. - ListOptions + // The number of results per page (max 100). + PerPage int `url:"per_page,omitempty"` } // ListAll lists all organizations, in the order that they were created on GitHub. @@ -150,7 +174,7 @@ type OrganizationsListOptions struct { // listing the next set of organizations, use the ID of the last-returned organization // as the opts.Since parameter for the next call. // -// GitHub API docs: https://docs.github.com/rest/orgs/orgs#list-organizations +// GitHub API docs: https://docs.github.com/rest/orgs/orgs?apiVersion=2022-11-28#list-organizations // //meta:operation GET /organizations func (s *OrganizationsService) ListAll(ctx context.Context, opts *OrganizationsListOptions) ([]*Organization, *Response, error) { @@ -159,13 +183,13 @@ func (s *OrganizationsService) ListAll(ctx context.Context, opts *OrganizationsL return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } orgs := []*Organization{} - resp, err := s.client.Do(ctx, req, &orgs) + resp, err := s.client.Do(req, &orgs) if err != nil { return nil, resp, err } @@ -175,8 +199,9 @@ func (s *OrganizationsService) ListAll(ctx context.Context, opts *OrganizationsL // List the organizations for a user. Passing the empty string will list // organizations for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/orgs/orgs#list-organizations-for-a-user -// GitHub API docs: https://docs.github.com/rest/orgs/orgs#list-organizations-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/orgs/orgs?apiVersion=2022-11-28#list-organizations-for-a-user +// +// GitHub API docs: https://docs.github.com/rest/orgs/orgs?apiVersion=2022-11-28#list-organizations-for-the-authenticated-user // //meta:operation GET /user/orgs //meta:operation GET /users/{username}/orgs @@ -192,13 +217,13 @@ func (s *OrganizationsService) List(ctx context.Context, user string, opts *List return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var orgs []*Organization - resp, err := s.client.Do(ctx, req, &orgs) + resp, err := s.client.Do(req, &orgs) if err != nil { return nil, resp, err } @@ -208,26 +233,25 @@ func (s *OrganizationsService) List(ctx context.Context, user string, opts *List // Get fetches an organization by name. // -// GitHub API docs: https://docs.github.com/rest/orgs/orgs#get-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/orgs?apiVersion=2022-11-28#get-an-organization // //meta:operation GET /orgs/{org} func (s *OrganizationsService) Get(ctx context.Context, org string) (*Organization, *Response, error) { u := fmt.Sprintf("orgs/%v", org) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMemberAllowedRepoCreationTypePreview) - organization := new(Organization) - resp, err := s.client.Do(ctx, req, organization) + var o *Organization + resp, err := s.client.Do(req, &o) if err != nil { return nil, resp, err } - return organization, resp, nil + return o, resp, nil } // GetByID fetches an organization. @@ -236,38 +260,37 @@ func (s *OrganizationsService) Get(ctx context.Context, org string) (*Organizati // //meta:operation GET /organizations/{organization_id} func (s *OrganizationsService) GetByID(ctx context.Context, id int64) (*Organization, *Response, error) { - u := fmt.Sprintf("organizations/%d", id) - req, err := s.client.NewRequest("GET", u, nil) + u := fmt.Sprintf("organizations/%v", id) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - organization := new(Organization) - resp, err := s.client.Do(ctx, req, organization) + var org *Organization + resp, err := s.client.Do(req, &org) if err != nil { return nil, resp, err } - return organization, resp, nil + return org, resp, nil } // Edit an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/orgs#update-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/orgs?apiVersion=2022-11-28#update-an-organization // //meta:operation PATCH /orgs/{org} func (s *OrganizationsService) Edit(ctx context.Context, name string, org *Organization) (*Organization, *Response, error) { u := fmt.Sprintf("orgs/%v", name) - req, err := s.client.NewRequest("PATCH", u, org) + req, err := s.client.NewRequest(ctx, "PATCH", u, org) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMemberAllowedRepoCreationTypePreview) - o := new(Organization) - resp, err := s.client.Do(ctx, req, o) + var o *Organization + resp, err := s.client.Do(req, &o) if err != nil { return nil, resp, err } @@ -277,22 +300,22 @@ func (s *OrganizationsService) Edit(ctx context.Context, name string, org *Organ // Delete an organization by name. // -// GitHub API docs: https://docs.github.com/rest/orgs/orgs#delete-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/orgs?apiVersion=2022-11-28#delete-an-organization // //meta:operation DELETE /orgs/{org} func (s *OrganizationsService) Delete(ctx context.Context, org string) (*Response, error) { u := fmt.Sprintf("orgs/%v", org) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListInstallations lists installations for an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/orgs#list-app-installations-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/orgs?apiVersion=2022-11-28#list-app-installations-for-an-organization // //meta:operation GET /orgs/{org}/installations func (s *OrganizationsService) ListInstallations(ctx context.Context, org string, opts *ListOptions) (*OrganizationInstallations, *Response, error) { @@ -303,13 +326,13 @@ func (s *OrganizationsService) ListInstallations(ctx context.Context, org string return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - result := new(OrganizationInstallations) - resp, err := s.client.Do(ctx, req, result) + var result *OrganizationInstallations + resp, err := s.client.Do(req, &result) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/orgs_actions_allowed.go b/vendor/github.com/google/go-github/v88/github/orgs_actions_allowed.go similarity index 61% rename from vendor/github.com/google/go-github/v73/github/orgs_actions_allowed.go rename to vendor/github.com/google/go-github/v88/github/orgs_actions_allowed.go index b115e094a..fdec0c73a 100644 --- a/vendor/github.com/google/go-github/v73/github/orgs_actions_allowed.go +++ b/vendor/github.com/google/go-github/v88/github/orgs_actions_allowed.go @@ -13,7 +13,7 @@ import ( // // Deprecated: please use `client.Actions.GetActionsAllowed` instead. // -// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-allowed-actions-and-reusable-workflows-for-an-organization // //meta:operation GET /orgs/{org}/actions/permissions/selected-actions func (s *OrganizationsService) GetActionsAllowed(ctx context.Context, org string) (*ActionsAllowed, *Response, error) { @@ -21,14 +21,14 @@ func (s *OrganizationsService) GetActionsAllowed(ctx context.Context, org string return s2.GetActionsAllowed(ctx, org) } -// EditActionsAllowed sets the actions that are allowed in an organization. +// UpdateActionsAllowed sets the actions that are allowed in an organization. // -// Deprecated: please use `client.Actions.EditActionsAllowed` instead. +// Deprecated: please use `client.Actions.UpdateActionsAllowed` instead. // -// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-allowed-actions-and-reusable-workflows-for-an-organization // //meta:operation PUT /orgs/{org}/actions/permissions/selected-actions -func (s *OrganizationsService) EditActionsAllowed(ctx context.Context, org string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { +func (s *OrganizationsService) UpdateActionsAllowed(ctx context.Context, org string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { s2 := (*ActionsService)(s) - return s2.EditActionsAllowed(ctx, org, actionsAllowed) + return s2.UpdateActionsAllowed(ctx, org, actionsAllowed) } diff --git a/vendor/github.com/google/go-github/v73/github/orgs_actions_permissions.go b/vendor/github.com/google/go-github/v88/github/orgs_actions_permissions.go similarity index 60% rename from vendor/github.com/google/go-github/v73/github/orgs_actions_permissions.go rename to vendor/github.com/google/go-github/v88/github/orgs_actions_permissions.go index 97df1c967..8f2531886 100644 --- a/vendor/github.com/google/go-github/v73/github/orgs_actions_permissions.go +++ b/vendor/github.com/google/go-github/v88/github/orgs_actions_permissions.go @@ -13,7 +13,7 @@ import ( // // Deprecated: please use `client.Actions.GetActionsPermissions` instead. // -// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-github-actions-permissions-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-github-actions-permissions-for-an-organization // //meta:operation GET /orgs/{org}/actions/permissions func (s *OrganizationsService) GetActionsPermissions(ctx context.Context, org string) (*ActionsPermissions, *Response, error) { @@ -21,14 +21,14 @@ func (s *OrganizationsService) GetActionsPermissions(ctx context.Context, org st return s2.GetActionsPermissions(ctx, org) } -// EditActionsPermissions sets the permissions policy for repositories and allowed actions in an organization. +// UpdateActionsPermissions sets the permissions policy for repositories and allowed actions in an organization. // -// Deprecated: please use `client.Actions.EditActionsPermissions` instead. +// Deprecated: please use `client.Actions.UpdateActionsPermissions` instead. // -// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-github-actions-permissions-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-github-actions-permissions-for-an-organization // //meta:operation PUT /orgs/{org}/actions/permissions -func (s *OrganizationsService) EditActionsPermissions(ctx context.Context, org string, actionsPermissions ActionsPermissions) (*ActionsPermissions, *Response, error) { +func (s *OrganizationsService) UpdateActionsPermissions(ctx context.Context, org string, actionsPermissions ActionsPermissions) (*ActionsPermissions, *Response, error) { s2 := (*ActionsService)(s) - return s2.EditActionsPermissions(ctx, org, actionsPermissions) + return s2.UpdateActionsPermissions(ctx, org, actionsPermissions) } diff --git a/vendor/github.com/google/go-github/v88/github/orgs_artifacts.go b/vendor/github.com/google/go-github/v88/github/orgs_artifacts.go new file mode 100644 index 000000000..ce3e04b0a --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/orgs_artifacts.go @@ -0,0 +1,219 @@ +// Copyright 2026 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// DeploymentRuntimeRisk represents the runtime risk of a deployment. +type DeploymentRuntimeRisk string + +const ( + DeploymentRuntimeRiskCriticalResource DeploymentRuntimeRisk = "critical-resource" + DeploymentRuntimeRiskInternetExposed DeploymentRuntimeRisk = "internet-exposed" + DeploymentRuntimeRiskLateralMovement DeploymentRuntimeRisk = "lateral-movement" + DeploymentRuntimeRiskSensitiveData DeploymentRuntimeRisk = "sensitive-data" +) + +// ArtifactDeploymentRecord represents a GitHub artifact deployment record. +type ArtifactDeploymentRecord struct { + ID *int64 `json:"id,omitempty"` + Digest *string `json:"digest,omitempty"` + LogicalEnvironment *string `json:"logical_environment,omitempty"` + PhysicalEnvironment *string `json:"physical_environment,omitempty"` + Cluster *string `json:"cluster,omitempty"` + DeploymentName *string `json:"deployment_name,omitempty"` + Tags map[string]string `json:"tags,omitempty"` + RuntimeRisks []DeploymentRuntimeRisk `json:"runtime_risks,omitempty"` + AttestationID *int64 `json:"attestation_id,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` +} + +// CreateArtifactDeploymentRequest represents the request body for creating a deployment record. +type CreateArtifactDeploymentRequest struct { + Name string `json:"name"` + Digest string `json:"digest"` + Version *string `json:"version,omitempty"` + Status string `json:"status"` + LogicalEnvironment string `json:"logical_environment"` + PhysicalEnvironment *string `json:"physical_environment,omitempty"` + Cluster *string `json:"cluster,omitempty"` + DeploymentName string `json:"deployment_name"` + Tags map[string]string `json:"tags,omitempty"` + RuntimeRisks []DeploymentRuntimeRisk `json:"runtime_risks,omitempty"` + GithubRepository *string `json:"github_repository,omitempty"` +} + +// ArtifactDeploymentResponse represents the response for deployment records. +type ArtifactDeploymentResponse struct { + TotalCount *int `json:"total_count,omitempty"` + DeploymentRecords []*ArtifactDeploymentRecord `json:"deployment_records,omitempty"` +} + +// ClusterArtifactDeployment represents a deployment within a cluster record request. +type ClusterArtifactDeployment struct { + Name string `json:"name"` + Digest string `json:"digest"` + Version *string `json:"version,omitempty"` + Status string `json:"status"` + DeploymentName string `json:"deployment_name"` + Tags map[string]string `json:"tags,omitempty"` + RuntimeRisks []DeploymentRuntimeRisk `json:"runtime_risks,omitempty"` + GithubRepository *string `json:"github_repository,omitempty"` +} + +// ClusterDeploymentRecordsRequest represents the request body for setting cluster deployment records. +type ClusterDeploymentRecordsRequest struct { + LogicalEnvironment string `json:"logical_environment"` + PhysicalEnvironment *string `json:"physical_environment,omitempty"` + Deployments []*ClusterArtifactDeployment `json:"deployments"` +} + +// ArtifactStorageRecord represents a GitHub artifact storage record. +type ArtifactStorageRecord struct { + ID *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Digest *string `json:"digest,omitempty"` + ArtifactURL *string `json:"artifact_url,omitempty"` + RegistryURL *string `json:"registry_url,omitempty"` + Repository *string `json:"repository,omitempty"` + Status *string `json:"status,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` +} + +// CreateArtifactStorageRequest represents the request body for creating a storage record. +type CreateArtifactStorageRequest struct { + Name string `json:"name"` + Digest string `json:"digest"` + Version *string `json:"version,omitempty"` + ArtifactURL *string `json:"artifact_url,omitempty"` + Path *string `json:"path,omitempty"` + RegistryURL string `json:"registry_url"` + Repository *string `json:"repository,omitempty"` + Status *string `json:"status,omitempty"` + GithubRepository *string `json:"github_repository,omitempty"` +} + +// ArtifactStorageResponse represents the response for storage records. +type ArtifactStorageResponse struct { + TotalCount *int `json:"total_count,omitempty"` + StorageRecords []*ArtifactStorageRecord `json:"storage_records,omitempty"` +} + +// CreateArtifactDeploymentRecord creates or updates deployment records for an artifact associated with an organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/artifact-metadata?apiVersion=2022-11-28#create-an-artifact-deployment-record +// +//meta:operation POST /orgs/{org}/artifacts/metadata/deployment-record +func (s *OrganizationsService) CreateArtifactDeploymentRecord(ctx context.Context, org string, record CreateArtifactDeploymentRequest) (*ArtifactDeploymentResponse, *Response, error) { + u := fmt.Sprintf("orgs/%v/artifacts/metadata/deployment-record", org) + req, err := s.client.NewRequest(ctx, "POST", u, record) + if err != nil { + return nil, nil, err + } + + var v *ArtifactDeploymentResponse + resp, err := s.client.Do(req, &v) + if err != nil { + return nil, resp, err + } + + return v, resp, nil +} + +// SetClusterDeploymentRecords sets deployment records for a given cluster. +// +// GitHub API docs: https://docs.github.com/rest/orgs/artifact-metadata?apiVersion=2022-11-28#set-cluster-deployment-records +// +//meta:operation POST /orgs/{org}/artifacts/metadata/deployment-record/cluster/{cluster} +func (s *OrganizationsService) SetClusterDeploymentRecords(ctx context.Context, org, cluster string, request ClusterDeploymentRecordsRequest) (*ArtifactDeploymentResponse, *Response, error) { + u := fmt.Sprintf("orgs/%v/artifacts/metadata/deployment-record/cluster/%v", org, cluster) + req, err := s.client.NewRequest(ctx, "POST", u, request) + if err != nil { + return nil, nil, err + } + + var v *ArtifactDeploymentResponse + resp, err := s.client.Do(req, &v) + if err != nil { + return nil, resp, err + } + + return v, resp, nil +} + +// CreateArtifactStorageRecord creates metadata storage records for artifacts. +// +// GitHub API docs: https://docs.github.com/rest/orgs/artifact-metadata?apiVersion=2022-11-28#create-artifact-metadata-storage-record +// +//meta:operation POST /orgs/{org}/artifacts/metadata/storage-record +func (s *OrganizationsService) CreateArtifactStorageRecord(ctx context.Context, org string, record CreateArtifactStorageRequest) (*ArtifactStorageResponse, *Response, error) { + u := fmt.Sprintf("orgs/%v/artifacts/metadata/storage-record", org) + req, err := s.client.NewRequest(ctx, "POST", u, record) + if err != nil { + return nil, nil, err + } + + var v *ArtifactStorageResponse + resp, err := s.client.Do(req, &v) + if err != nil { + return nil, resp, err + } + + return v, resp, nil +} + +// ListArtifactDeploymentRecords lists deployment records for an artifact metadata. +// +// subjectDigest is SHA256 digest of the artifact, in the form sha256:HEX_DIGEST. +// +// GitHub API docs: https://docs.github.com/rest/orgs/artifact-metadata?apiVersion=2022-11-28#list-artifact-deployment-records +// +//meta:operation GET /orgs/{org}/artifacts/{subject_digest}/metadata/deployment-records +func (s *OrganizationsService) ListArtifactDeploymentRecords(ctx context.Context, org, subjectDigest string) (*ArtifactDeploymentResponse, *Response, error) { + u := fmt.Sprintf("orgs/%v/artifacts/%v/metadata/deployment-records", org, subjectDigest) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var v *ArtifactDeploymentResponse + resp, err := s.client.Do(req, &v) + if err != nil { + return nil, resp, err + } + + return v, resp, nil +} + +// ListArtifactStorageRecords lists artifact storage records with a given subject digest. +// +// subjectDigest is SHA256 digest of the artifact, in the form sha256:HEX_DIGEST. +// +// GitHub API docs: https://docs.github.com/rest/orgs/artifact-metadata?apiVersion=2022-11-28#list-artifact-storage-records +// +//meta:operation GET /orgs/{org}/artifacts/{subject_digest}/metadata/storage-records +func (s *OrganizationsService) ListArtifactStorageRecords(ctx context.Context, org, subjectDigest string) (*ArtifactStorageResponse, *Response, error) { + u := fmt.Sprintf("orgs/%v/artifacts/%v/metadata/storage-records", org, subjectDigest) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var v *ArtifactStorageResponse + resp, err := s.client.Do(req, &v) + if err != nil { + return nil, resp, err + } + + return v, resp, nil +} diff --git a/vendor/github.com/google/go-github/v73/github/orgs_attestations.go b/vendor/github.com/google/go-github/v88/github/orgs_attestations.go similarity index 75% rename from vendor/github.com/google/go-github/v73/github/orgs_attestations.go rename to vendor/github.com/google/go-github/v88/github/orgs_attestations.go index 3d5793c18..bfc4f61c7 100644 --- a/vendor/github.com/google/go-github/v73/github/orgs_attestations.go +++ b/vendor/github.com/google/go-github/v88/github/orgs_attestations.go @@ -14,24 +14,24 @@ import ( // with a given subject digest that are associated with repositories // owned by an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/orgs#list-attestations +// GitHub API docs: https://docs.github.com/rest/orgs/attestations?apiVersion=2022-11-28#list-attestations // //meta:operation GET /orgs/{org}/attestations/{subject_digest} func (s *OrganizationsService) ListAttestations(ctx context.Context, org, subjectDigest string, opts *ListOptions) (*AttestationsResponse, *Response, error) { - var u = fmt.Sprintf("orgs/%v/attestations/%v", org, subjectDigest) + u := fmt.Sprintf("orgs/%v/attestations/%v", org, subjectDigest) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var attestations *AttestationsResponse - resp, err := s.client.Do(ctx, req, &attestations) + resp, err := s.client.Do(req, &attestations) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/orgs_audit_log.go b/vendor/github.com/google/go-github/v88/github/orgs_audit_log.go similarity index 92% rename from vendor/github.com/google/go-github/v73/github/orgs_audit_log.go rename to vendor/github.com/google/go-github/v88/github/orgs_audit_log.go index 409faebbc..164450f78 100644 --- a/vendor/github.com/google/go-github/v73/github/orgs_audit_log.go +++ b/vendor/github.com/google/go-github/v88/github/orgs_audit_log.go @@ -43,7 +43,7 @@ type AuditEntry struct { HashedToken *string `json:"hashed_token,omitempty"` Org *string `json:"org,omitempty"` OrgID *int64 `json:"org_id,omitempty"` - Timestamp *Timestamp `json:"@timestamp,omitempty"` // The time the audit log event occurred, given as a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time). + Timestamp *Timestamp `json:"@timestamp,omitempty"` // The time the audit log event occurred, given as a [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time). TokenID *int64 `json:"token_id,omitempty"` TokenScopes *string `json:"token_scopes,omitempty"` User *string `json:"user,omitempty"` // The user that was affected by the action performed (if available). @@ -56,6 +56,7 @@ type AuditEntry struct { AdditionalFields map[string]any `json:"-"` } +// UnmarshalJSON implements the json.Unmarshaler interface. func (a *AuditEntry) UnmarshalJSON(data []byte) error { type entryAlias AuditEntry var v entryAlias @@ -89,9 +90,10 @@ func (a *AuditEntry) UnmarshalJSON(data []byte) error { return nil } -func (a *AuditEntry) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaler interface. +func (a AuditEntry) MarshalJSON() ([]byte, error) { type entryAlias AuditEntry - v := entryAlias(*a) + v := entryAlias(a) defBytes, err := json.Marshal(v) if err != nil { return nil, err @@ -117,7 +119,7 @@ func (a *AuditEntry) MarshalJSON() ([]byte, error) { // GetAuditLog gets the audit-log entries for an organization. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs#get-the-audit-log-for-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs?apiVersion=2022-11-28#get-the-audit-log-for-an-organization // //meta:operation GET /orgs/{org}/audit-log func (s *OrganizationsService) GetAuditLog(ctx context.Context, org string, opts *GetAuditLogOptions) ([]*AuditEntry, *Response, error) { @@ -127,13 +129,13 @@ func (s *OrganizationsService) GetAuditLog(ctx context.Context, org string, opts return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var auditEntries []*AuditEntry - resp, err := s.client.Do(ctx, req, &auditEntries) + resp, err := s.client.Do(req, &auditEntries) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v88/github/orgs_codesecurity_configurations.go b/vendor/github.com/google/go-github/v88/github/orgs_codesecurity_configurations.go new file mode 100644 index 000000000..701e2cc8f --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/orgs_codesecurity_configurations.go @@ -0,0 +1,382 @@ +// Copyright 2024 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" + "net/http" +) + +// DependencyGraphAutosubmitActionOptions represents the options for the DependencyGraphAutosubmitAction. +type DependencyGraphAutosubmitActionOptions struct { + LabeledRunners *bool `json:"labeled_runners,omitempty"` +} + +// CodeScanningOptions represents the options for the Security Configuration code scanning feature. +type CodeScanningOptions struct { + AllowAdvanced *bool `json:"allow_advanced,omitempty"` +} + +// CodeScanningDefaultSetupOptions represents the feature options for the code scanning default options. +type CodeScanningDefaultSetupOptions struct { + RunnerType string `json:"runner_type"` + RunnerLabel *string `json:"runner_label,omitempty"` +} + +// RepositoryAttachment represents a repository attachment to a code security configuration. +type RepositoryAttachment struct { + Status *string `json:"status"` + Repository *Repository `json:"repository"` +} + +// SecretScanningDelegatedBypassOptions represents the feature options for the secret scanning delegated bypass. +type SecretScanningDelegatedBypassOptions struct { + Reviewers []*BypassReviewer `json:"reviewers,omitzero"` +} + +// BypassReviewer represents the bypass reviewers for the delegated bypass of a code security configuration. +// SecurityConfigurationID is added by GitHub in responses. +type BypassReviewer struct { + ReviewerID int64 `json:"reviewer_id"` + ReviewerType string `json:"reviewer_type"` + SecurityConfigurationID *int64 `json:"security_configuration_id,omitempty"` +} + +// CodeSecurityConfiguration represents a code security configuration. +type CodeSecurityConfiguration struct { + ID *int64 `json:"id,omitempty"` + TargetType *string `json:"target_type,omitempty"` + Name string `json:"name"` + Description string `json:"description"` + AdvancedSecurity *string `json:"advanced_security,omitempty"` + DependencyGraph *string `json:"dependency_graph,omitempty"` + DependencyGraphAutosubmitAction *string `json:"dependency_graph_autosubmit_action,omitempty"` + DependencyGraphAutosubmitActionOptions *DependencyGraphAutosubmitActionOptions `json:"dependency_graph_autosubmit_action_options,omitempty"` + DependabotAlerts *string `json:"dependabot_alerts,omitempty"` + DependabotDelegatedAlertDismissal *string `json:"dependabot_delegated_alert_dismissal,omitempty"` + DependabotSecurityUpdates *string `json:"dependabot_security_updates,omitempty"` + CodeScanningDefaultSetup *string `json:"code_scanning_default_setup,omitempty"` + CodeScanningDefaultSetupOptions *CodeScanningDefaultSetupOptions `json:"code_scanning_default_setup_options,omitempty"` + CodeScanningDelegatedAlertDismissal *string `json:"code_scanning_delegated_alert_dismissal,omitempty"` + CodeScanningOptions *CodeScanningOptions `json:"code_scanning_options,omitempty"` + CodeSecurity *string `json:"code_security,omitempty"` + SecretScanning *string `json:"secret_scanning,omitempty"` + SecretScanningPushProtection *string `json:"secret_scanning_push_protection,omitempty"` + SecretScanningDelegatedBypass *string `json:"secret_scanning_delegated_bypass,omitempty"` + SecretScanningDelegatedBypassOptions *SecretScanningDelegatedBypassOptions `json:"secret_scanning_delegated_bypass_options,omitempty"` + SecretScanningValidityChecks *string `json:"secret_scanning_validity_checks,omitempty"` + SecretScanningNonProviderPatterns *string `json:"secret_scanning_non_provider_patterns,omitempty"` + SecretScanningGenericSecrets *string `json:"secret_scanning_generic_secrets,omitempty"` + SecretScanningDelegatedAlertDismissal *string `json:"secret_scanning_delegated_alert_dismissal,omitempty"` + SecretScanningExtendedMetadata *string `json:"secret_scanning_extended_metadata,omitempty"` + SecretProtection *string `json:"secret_protection,omitempty"` + PrivateVulnerabilityReporting *string `json:"private_vulnerability_reporting,omitempty"` + Enforcement *string `json:"enforcement,omitempty"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` +} + +// CodeSecurityConfigurationWithDefaultForNewRepos represents a code security configuration with default for new repos param. +type CodeSecurityConfigurationWithDefaultForNewRepos struct { + Configuration *CodeSecurityConfiguration `json:"configuration"` + DefaultForNewRepos *string `json:"default_for_new_repos,omitempty"` +} + +// RepositoryCodeSecurityConfiguration represents a code security configuration for a repository. +type RepositoryCodeSecurityConfiguration struct { + State *string `json:"state,omitempty"` + Configuration *CodeSecurityConfiguration `json:"configuration,omitempty"` +} + +// ListOrgCodeSecurityConfigurationOptions specifies optional parameters to get security configurations for orgs. +// +// Note: Pagination is powered by before/after cursor-style pagination. After the initial call, +// inspect the returned *Response. Use resp.After as the opts.After value to request +// the next page, and resp.Before as the opts.Before value to request the previous +// page. Set either Before or After for a request; if both are +// supplied GitHub API will return an error. PerPage controls the number of items +// per page (max 100 per GitHub API docs). +type ListOrgCodeSecurityConfigurationOptions struct { + // A cursor, as given in the Link header. If specified, the query only searches for security configurations before this cursor. + Before string `url:"before,omitempty"` + + // A cursor, as given in the Link header. If specified, the query only searches for security configurations after this cursor. + After string `url:"after,omitempty"` + + // For paginated result sets, the number of results to include per page. + PerPage int `url:"per_page,omitempty"` + + // The target type of the code security configurations to get. + // + // `target_type` defaults to all, can be one of `global`, `all` + TargetType string `url:"target_type,omitempty"` +} + +// ListCodeSecurityConfigurationRepositoriesOptions specifies optional parameters to list repositories for security configurations for orgs and enterprises. +// +// Note: Pagination is powered by before/after cursor-style pagination. After the initial call, +// inspect the returned *Response. Use resp.After as the opts.After value to request +// the next page, and resp.Before as the opts.Before value to request the previous +// page. Set either Before or After for a request; if both are +// supplied GitHub API will return an error. PerPage controls the number of items +// per page (max 100 per GitHub API docs). +type ListCodeSecurityConfigurationRepositoriesOptions struct { + // A cursor, as given in the Link header. If specified, the query only searches for repositories before this cursor. + Before string `url:"before,omitempty"` + + // A cursor, as given in the Link header. If specified, the query only searches for repositories after this cursor. + After string `url:"after,omitempty"` + + // For paginated result sets, the number of results to include per page. + PerPage int `url:"per_page,omitempty"` + + // A comma-separated list of statuses. If specified, only repositories with these attachment statuses will be returned. + // + // `status` defaults to all, can be one of `all`, `attached`, `attaching`, `removed`, `enforced`, `failed`, `updating`, `removed_by_enterprise` and also `detached` but only for the org endpoint. + Status string `url:"status,omitempty"` +} + +// ListCodeSecurityConfigurations gets code security configurations for an organization. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#get-code-security-configurations-for-an-organization +// +//meta:operation GET /orgs/{org}/code-security/configurations +func (s *OrganizationsService) ListCodeSecurityConfigurations(ctx context.Context, org string, opts *ListOrgCodeSecurityConfigurationOptions) ([]*CodeSecurityConfiguration, *Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var configurations []*CodeSecurityConfiguration + resp, err := s.client.Do(req, &configurations) + if err != nil { + return nil, resp, err + } + return configurations, resp, nil +} + +// CreateCodeSecurityConfiguration creates a code security configuration for an organization. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#create-a-code-security-configuration +// +//meta:operation POST /orgs/{org}/code-security/configurations +func (s *OrganizationsService) CreateCodeSecurityConfiguration(ctx context.Context, org string, config CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations", org) + + req, err := s.client.NewRequest(ctx, "POST", u, config) + if err != nil { + return nil, nil, err + } + + var configuration *CodeSecurityConfiguration + resp, err := s.client.Do(req, &configuration) + if err != nil { + return nil, resp, err + } + return configuration, resp, nil +} + +// ListDefaultCodeSecurityConfigurations gets default code security configurations for an organization. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#get-default-code-security-configurations +// +//meta:operation GET /orgs/{org}/code-security/configurations/defaults +func (s *OrganizationsService) ListDefaultCodeSecurityConfigurations(ctx context.Context, org string) ([]*CodeSecurityConfigurationWithDefaultForNewRepos, *Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations/defaults", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var configurations []*CodeSecurityConfigurationWithDefaultForNewRepos + resp, err := s.client.Do(req, &configurations) + if err != nil { + return nil, resp, err + } + return configurations, resp, nil +} + +// DetachCodeSecurityConfigurationsFromRepositories detaches code security configuration from an organization's repositories. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#detach-configurations-from-repositories +// +//meta:operation DELETE /orgs/{org}/code-security/configurations/detach +func (s *OrganizationsService) DetachCodeSecurityConfigurationsFromRepositories(ctx context.Context, org string, repoIDs []int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations/detach", org) + type selectedRepoIDs struct { + SelectedIDs []int64 `json:"selected_repository_ids"` + } + req, err := s.client.NewRequest(ctx, "DELETE", u, selectedRepoIDs{SelectedIDs: repoIDs}) + if err != nil { + return nil, err + } + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + return resp, nil +} + +// GetCodeSecurityConfiguration gets a code security configuration available in an organization. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#get-a-code-security-configuration +// +//meta:operation GET /orgs/{org}/code-security/configurations/{configuration_id} +func (s *OrganizationsService) GetCodeSecurityConfiguration(ctx context.Context, org string, configurationID int64) (*CodeSecurityConfiguration, *Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations/%v", org, configurationID) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var configuration *CodeSecurityConfiguration + resp, err := s.client.Do(req, &configuration) + if err != nil { + return nil, resp, err + } + return configuration, resp, nil +} + +// UpdateCodeSecurityConfiguration updates a code security configuration for an organization. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#update-a-code-security-configuration +// +//meta:operation PATCH /orgs/{org}/code-security/configurations/{configuration_id} +func (s *OrganizationsService) UpdateCodeSecurityConfiguration(ctx context.Context, org string, configurationID int64, config CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations/%v", org, configurationID) + + req, err := s.client.NewRequest(ctx, "PATCH", u, config) + if err != nil { + return nil, nil, err + } + + var configuration *CodeSecurityConfiguration + resp, err := s.client.Do(req, &configuration) + if err != nil { + return nil, resp, err + } + return configuration, resp, nil +} + +// DeleteCodeSecurityConfiguration deletes a code security configuration for an organization. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#delete-a-code-security-configuration +// +//meta:operation DELETE /orgs/{org}/code-security/configurations/{configuration_id} +func (s *OrganizationsService) DeleteCodeSecurityConfiguration(ctx context.Context, org string, configurationID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations/%v", org, configurationID) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + return resp, nil +} + +// AttachCodeSecurityConfigurationToRepositories attaches code security configurations to repositories for an organization. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#attach-a-configuration-to-repositories +// +//meta:operation POST /orgs/{org}/code-security/configurations/{configuration_id}/attach +func (s *OrganizationsService) AttachCodeSecurityConfigurationToRepositories(ctx context.Context, org string, configurationID int64, scope string, repoIDs []int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations/%v/attach", org, configurationID) + type selectedRepoIDs struct { + Scope string `json:"scope"` + SelectedIDs []int64 `json:"selected_repository_ids,omitempty"` + } + req, err := s.client.NewRequest(ctx, "POST", u, selectedRepoIDs{Scope: scope, SelectedIDs: repoIDs}) + if err != nil { + return nil, err + } + resp, err := s.client.Do(req, nil) + if err != nil && resp.StatusCode != http.StatusAccepted { // StatusAccepted(202) is the expected status code as job is queued for processing + return resp, err + } + return resp, nil +} + +// SetDefaultCodeSecurityConfiguration sets a code security configuration as the default for an organization. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#set-a-code-security-configuration-as-a-default-for-an-organization +// +//meta:operation PUT /orgs/{org}/code-security/configurations/{configuration_id}/defaults +func (s *OrganizationsService) SetDefaultCodeSecurityConfiguration(ctx context.Context, org string, configurationID int64, newReposParam string) (*CodeSecurityConfigurationWithDefaultForNewRepos, *Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations/%v/defaults", org, configurationID) + type configParam struct { + DefaultForNewRepos string `json:"default_for_new_repos"` + } + req, err := s.client.NewRequest(ctx, "PUT", u, configParam{DefaultForNewRepos: newReposParam}) + if err != nil { + return nil, nil, err + } + var config *CodeSecurityConfigurationWithDefaultForNewRepos + resp, err := s.client.Do(req, &config) + if err != nil { + return nil, resp, err + } + return config, resp, nil +} + +// ListCodeSecurityConfigurationRepositories gets repositories associated with a code security configuration. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#get-repositories-associated-with-a-code-security-configuration +// +//meta:operation GET /orgs/{org}/code-security/configurations/{configuration_id}/repositories +func (s *OrganizationsService) ListCodeSecurityConfigurationRepositories(ctx context.Context, org string, configurationID int64, opts *ListCodeSecurityConfigurationRepositoriesOptions) ([]*RepositoryAttachment, *Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations/%v/repositories", org, configurationID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var attachments []*RepositoryAttachment + resp, err := s.client.Do(req, &attachments) + if err != nil { + return nil, resp, err + } + + return attachments, resp, nil +} + +// GetCodeSecurityConfigurationForRepository gets code security configuration that manages a repository's code security settings. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#get-the-code-security-configuration-associated-with-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/code-security-configuration +func (s *OrganizationsService) GetCodeSecurityConfigurationForRepository(ctx context.Context, org, repo string) (*RepositoryCodeSecurityConfiguration, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/code-security-configuration", org, repo) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + var repoConfig *RepositoryCodeSecurityConfiguration + resp, err := s.client.Do(req, &repoConfig) + if err != nil { + return nil, resp, err + } + return repoConfig, resp, nil +} diff --git a/vendor/github.com/google/go-github/v73/github/orgs_credential_authorizations.go b/vendor/github.com/google/go-github/v88/github/orgs_credential_authorizations.go similarity index 89% rename from vendor/github.com/google/go-github/v73/github/orgs_credential_authorizations.go rename to vendor/github.com/google/go-github/v88/github/orgs_credential_authorizations.go index dca42433c..c21bfaf5a 100644 --- a/vendor/github.com/google/go-github/v73/github/orgs_credential_authorizations.go +++ b/vendor/github.com/google/go-github/v88/github/orgs_credential_authorizations.go @@ -8,7 +8,6 @@ package github import ( "context" "fmt" - "net/http" ) // CredentialAuthorization represents a credential authorized through SAML SSO. @@ -58,7 +57,7 @@ type CredentialAuthorization struct { // CredentialAuthorizationsListOptions adds the Login option as supported by the // list SAML SSO authorizations for organizations endpoint alongside paging options // such as Page and PerPage. -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs#list-saml-sso-authorizations-for-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs?apiVersion=2022-11-28#list-saml-sso-authorizations-for-an-organization type CredentialAuthorizationsListOptions struct { ListOptions // For credentials authorizations for an organization, limit the list of authorizations to a specific login (aka github username) @@ -68,7 +67,7 @@ type CredentialAuthorizationsListOptions struct { // ListCredentialAuthorizations lists credentials authorized through SAML SSO // for a given organization. Only available with GitHub Enterprise Cloud. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs#list-saml-sso-authorizations-for-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs?apiVersion=2022-11-28#list-saml-sso-authorizations-for-an-organization // //meta:operation GET /orgs/{org}/credential-authorizations func (s *OrganizationsService) ListCredentialAuthorizations(ctx context.Context, org string, opts *CredentialAuthorizationsListOptions) ([]*CredentialAuthorization, *Response, error) { @@ -78,13 +77,13 @@ func (s *OrganizationsService) ListCredentialAuthorizations(ctx context.Context, return nil, nil, err } - req, err := s.client.NewRequest(http.MethodGet, u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var creds []*CredentialAuthorization - resp, err := s.client.Do(ctx, req, &creds) + resp, err := s.client.Do(req, &creds) if err != nil { return nil, resp, err } @@ -95,15 +94,15 @@ func (s *OrganizationsService) ListCredentialAuthorizations(ctx context.Context, // RemoveCredentialAuthorization revokes the SAML SSO authorization for a given // credential within an organization. Only available with GitHub Enterprise Cloud. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs#remove-a-saml-sso-authorization-for-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs?apiVersion=2022-11-28#remove-a-saml-sso-authorization-for-an-organization // //meta:operation DELETE /orgs/{org}/credential-authorizations/{credential_id} func (s *OrganizationsService) RemoveCredentialAuthorization(ctx context.Context, org string, credentialID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/credential-authorizations/%v", org, credentialID) - req, err := s.client.NewRequest(http.MethodDelete, u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/orgs_custom_repository_roles.go b/vendor/github.com/google/go-github/v88/github/orgs_custom_repository_roles.go similarity index 67% rename from vendor/github.com/google/go-github/v73/github/orgs_custom_repository_roles.go rename to vendor/github.com/google/go-github/v88/github/orgs_custom_repository_roles.go index 44408db14..001fc0329 100644 --- a/vendor/github.com/google/go-github/v73/github/orgs_custom_repository_roles.go +++ b/vendor/github.com/google/go-github/v88/github/orgs_custom_repository_roles.go @@ -38,22 +38,28 @@ type CreateOrUpdateCustomRepoRoleOptions struct { Permissions []string `json:"permissions"` } +// RepoFineGrainedPermission represents a fine-grained permission that can be used in a custom repository role. +type RepoFineGrainedPermission struct { + Name string `json:"name"` + Description string `json:"description"` +} + // ListCustomRepoRoles lists the custom repository roles available in this organization. // In order to see custom repository roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles#list-custom-repository-roles-in-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles?apiVersion=2022-11-28#list-custom-repository-roles-in-an-organization // //meta:operation GET /orgs/{org}/custom-repository-roles func (s *OrganizationsService) ListCustomRepoRoles(ctx context.Context, org string) (*OrganizationCustomRepoRoles, *Response, error) { u := fmt.Sprintf("orgs/%v/custom-repository-roles", org) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - customRepoRoles := new(OrganizationCustomRepoRoles) - resp, err := s.client.Do(ctx, req, customRepoRoles) + var customRepoRoles *OrganizationCustomRepoRoles + resp, err := s.client.Do(req, &customRepoRoles) if err != nil { return nil, resp, err } @@ -64,19 +70,19 @@ func (s *OrganizationsService) ListCustomRepoRoles(ctx context.Context, org stri // GetCustomRepoRole gets a custom repository roles available in this organization. // In order to see custom repository roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles#get-a-custom-repository-role +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles?apiVersion=2022-11-28#get-a-custom-repository-role // //meta:operation GET /orgs/{org}/custom-repository-roles/{role_id} func (s *OrganizationsService) GetCustomRepoRole(ctx context.Context, org string, roleID int64) (*CustomRepoRoles, *Response, error) { u := fmt.Sprintf("orgs/%v/custom-repository-roles/%v", org, roleID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - resultingRole := new(CustomRepoRoles) - resp, err := s.client.Do(ctx, req, resultingRole) + var resultingRole *CustomRepoRoles + resp, err := s.client.Do(req, &resultingRole) if err != nil { return nil, resp, err } @@ -87,19 +93,19 @@ func (s *OrganizationsService) GetCustomRepoRole(ctx context.Context, org string // CreateCustomRepoRole creates a custom repository role in this organization. // In order to create custom repository roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles#create-a-custom-repository-role +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles?apiVersion=2022-11-28#create-a-custom-repository-role // //meta:operation POST /orgs/{org}/custom-repository-roles func (s *OrganizationsService) CreateCustomRepoRole(ctx context.Context, org string, opts *CreateOrUpdateCustomRepoRoleOptions) (*CustomRepoRoles, *Response, error) { u := fmt.Sprintf("orgs/%v/custom-repository-roles", org) - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, opts) if err != nil { return nil, nil, err } - resultingRole := new(CustomRepoRoles) - resp, err := s.client.Do(ctx, req, resultingRole) + var resultingRole *CustomRepoRoles + resp, err := s.client.Do(req, &resultingRole) if err != nil { return nil, resp, err } @@ -110,19 +116,19 @@ func (s *OrganizationsService) CreateCustomRepoRole(ctx context.Context, org str // UpdateCustomRepoRole updates a custom repository role in this organization. // In order to update custom repository roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles#update-a-custom-repository-role +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles?apiVersion=2022-11-28#update-a-custom-repository-role // //meta:operation PATCH /orgs/{org}/custom-repository-roles/{role_id} func (s *OrganizationsService) UpdateCustomRepoRole(ctx context.Context, org string, roleID int64, opts *CreateOrUpdateCustomRepoRoleOptions) (*CustomRepoRoles, *Response, error) { u := fmt.Sprintf("orgs/%v/custom-repository-roles/%v", org, roleID) - req, err := s.client.NewRequest("PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, opts) if err != nil { return nil, nil, err } - resultingRole := new(CustomRepoRoles) - resp, err := s.client.Do(ctx, req, resultingRole) + var resultingRole *CustomRepoRoles + resp, err := s.client.Do(req, &resultingRole) if err != nil { return nil, resp, err } @@ -133,22 +139,45 @@ func (s *OrganizationsService) UpdateCustomRepoRole(ctx context.Context, org str // DeleteCustomRepoRole deletes an existing custom repository role in this organization. // In order to delete custom repository roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles#delete-a-custom-repository-role +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles?apiVersion=2022-11-28#delete-a-custom-repository-role // //meta:operation DELETE /orgs/{org}/custom-repository-roles/{role_id} func (s *OrganizationsService) DeleteCustomRepoRole(ctx context.Context, org string, roleID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/custom-repository-roles/%v", org, roleID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - resultingRole := new(CustomRepoRoles) - resp, err := s.client.Do(ctx, req, resultingRole) + var resultingRole *CustomRepoRoles + resp, err := s.client.Do(req, &resultingRole) if err != nil { return resp, err } return resp, nil } + +// ListRepositoryFineGrainedPermissions lists the fine-grained permissions that can be used in custom repository roles for an organization. +// The authenticated user must be an administrator of the organization or of a repository of the organization to use this endpoint. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles?apiVersion=2022-11-28#list-repository-fine-grained-permissions-for-an-organization +// +//meta:operation GET /orgs/{org}/repository-fine-grained-permissions +func (s *OrganizationsService) ListRepositoryFineGrainedPermissions(ctx context.Context, org string) ([]*RepoFineGrainedPermission, *Response, error) { + u := fmt.Sprintf("orgs/%v/repository-fine-grained-permissions", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var perms []*RepoFineGrainedPermission + resp, err := s.client.Do(req, &perms) + if err != nil { + return nil, resp, err + } + + return perms, resp, nil +} diff --git a/vendor/github.com/google/go-github/v73/github/orgs_hooks.go b/vendor/github.com/google/go-github/v88/github/orgs_hooks.go similarity index 61% rename from vendor/github.com/google/go-github/v73/github/orgs_hooks.go rename to vendor/github.com/google/go-github/v88/github/orgs_hooks.go index c2eef77c9..e0b8d29f4 100644 --- a/vendor/github.com/google/go-github/v73/github/orgs_hooks.go +++ b/vendor/github.com/google/go-github/v88/github/orgs_hooks.go @@ -7,12 +7,13 @@ package github import ( "context" + "errors" "fmt" ) // ListHooks lists all Hooks for the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#list-organization-webhooks +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks?apiVersion=2022-11-28#list-organization-webhooks // //meta:operation GET /orgs/{org}/hooks func (s *OrganizationsService) ListHooks(ctx context.Context, org string, opts *ListOptions) ([]*Hook, *Response, error) { @@ -22,13 +23,13 @@ func (s *OrganizationsService) ListHooks(ctx context.Context, org string, opts * return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var hooks []*Hook - resp, err := s.client.Do(ctx, req, &hooks) + resp, err := s.client.Do(req, &hooks) if err != nil { return nil, resp, err } @@ -38,18 +39,18 @@ func (s *OrganizationsService) ListHooks(ctx context.Context, org string, opts * // GetHook returns a single specified Hook. // -// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#get-an-organization-webhook +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks?apiVersion=2022-11-28#get-an-organization-webhook // //meta:operation GET /orgs/{org}/hooks/{hook_id} func (s *OrganizationsService) GetHook(ctx context.Context, org string, id int64) (*Hook, *Response, error) { - u := fmt.Sprintf("orgs/%v/hooks/%d", org, id) - req, err := s.client.NewRequest("GET", u, nil) + u := fmt.Sprintf("orgs/%v/hooks/%v", org, id) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - hook := new(Hook) - resp, err := s.client.Do(ctx, req, hook) + var hook *Hook + resp, err := s.client.Do(req, &hook) if err != nil { return nil, resp, err } @@ -63,10 +64,14 @@ func (s *OrganizationsService) GetHook(ctx context.Context, org string, id int64 // Note that only a subset of the hook fields are used and hook must // not be nil. // -// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#create-an-organization-webhook +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks?apiVersion=2022-11-28#create-an-organization-webhook // //meta:operation POST /orgs/{org}/hooks func (s *OrganizationsService) CreateHook(ctx context.Context, org string, hook *Hook) (*Hook, *Response, error) { + if hook == nil { + return nil, nil, errors.New("hook must be provided") + } + u := fmt.Sprintf("orgs/%v/hooks", org) hookReq := &createHookRequest{ @@ -76,13 +81,13 @@ func (s *OrganizationsService) CreateHook(ctx context.Context, org string, hook Config: hook.Config, } - req, err := s.client.NewRequest("POST", u, hookReq) + req, err := s.client.NewRequest(ctx, "POST", u, hookReq) if err != nil { return nil, nil, err } - h := new(Hook) - resp, err := s.client.Do(ctx, req, h) + var h *Hook + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } @@ -92,18 +97,18 @@ func (s *OrganizationsService) CreateHook(ctx context.Context, org string, hook // EditHook updates a specified Hook. // -// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#update-an-organization-webhook +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks?apiVersion=2022-11-28#update-an-organization-webhook // //meta:operation PATCH /orgs/{org}/hooks/{hook_id} func (s *OrganizationsService) EditHook(ctx context.Context, org string, id int64, hook *Hook) (*Hook, *Response, error) { - u := fmt.Sprintf("orgs/%v/hooks/%d", org, id) - req, err := s.client.NewRequest("PATCH", u, hook) + u := fmt.Sprintf("orgs/%v/hooks/%v", org, id) + req, err := s.client.NewRequest(ctx, "PATCH", u, hook) if err != nil { return nil, nil, err } - h := new(Hook) - resp, err := s.client.Do(ctx, req, h) + var h *Hook + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } @@ -113,30 +118,30 @@ func (s *OrganizationsService) EditHook(ctx context.Context, org string, id int6 // PingHook triggers a 'ping' event to be sent to the Hook. // -// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#ping-an-organization-webhook +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks?apiVersion=2022-11-28#ping-an-organization-webhook // //meta:operation POST /orgs/{org}/hooks/{hook_id}/pings func (s *OrganizationsService) PingHook(ctx context.Context, org string, id int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/hooks/%d/pings", org, id) - req, err := s.client.NewRequest("POST", u, nil) + u := fmt.Sprintf("orgs/%v/hooks/%v/pings", org, id) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DeleteHook deletes a specified Hook. // -// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#delete-an-organization-webhook +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks?apiVersion=2022-11-28#delete-an-organization-webhook // //meta:operation DELETE /orgs/{org}/hooks/{hook_id} func (s *OrganizationsService) DeleteHook(ctx context.Context, org string, id int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/hooks/%d", org, id) - req, err := s.client.NewRequest("DELETE", u, nil) + u := fmt.Sprintf("orgs/%v/hooks/%v", org, id) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/orgs_hooks_configuration.go b/vendor/github.com/google/go-github/v88/github/orgs_hooks_configuration.go similarity index 69% rename from vendor/github.com/google/go-github/v73/github/orgs_hooks_configuration.go rename to vendor/github.com/google/go-github/v88/github/orgs_hooks_configuration.go index aeb616fc4..63eb1adb2 100644 --- a/vendor/github.com/google/go-github/v73/github/orgs_hooks_configuration.go +++ b/vendor/github.com/google/go-github/v88/github/orgs_hooks_configuration.go @@ -12,18 +12,18 @@ import ( // GetHookConfiguration returns the configuration for the specified organization webhook. // -// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#get-a-webhook-configuration-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks?apiVersion=2022-11-28#get-a-webhook-configuration-for-an-organization // //meta:operation GET /orgs/{org}/hooks/{hook_id}/config func (s *OrganizationsService) GetHookConfiguration(ctx context.Context, org string, id int64) (*HookConfig, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%v/config", org, id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - config := new(HookConfig) - resp, err := s.client.Do(ctx, req, config) + var config *HookConfig + resp, err := s.client.Do(req, &config) if err != nil { return nil, resp, err } @@ -33,18 +33,18 @@ func (s *OrganizationsService) GetHookConfiguration(ctx context.Context, org str // EditHookConfiguration updates the configuration for the specified organization webhook. // -// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#update-a-webhook-configuration-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks?apiVersion=2022-11-28#update-a-webhook-configuration-for-an-organization // //meta:operation PATCH /orgs/{org}/hooks/{hook_id}/config func (s *OrganizationsService) EditHookConfiguration(ctx context.Context, org string, id int64, config *HookConfig) (*HookConfig, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%v/config", org, id) - req, err := s.client.NewRequest("PATCH", u, config) + req, err := s.client.NewRequest(ctx, "PATCH", u, config) if err != nil { return nil, nil, err } - c := new(HookConfig) - resp, err := s.client.Do(ctx, req, c) + var c *HookConfig + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/orgs_hooks_deliveries.go b/vendor/github.com/google/go-github/v88/github/orgs_hooks_deliveries.go similarity index 72% rename from vendor/github.com/google/go-github/v73/github/orgs_hooks_deliveries.go rename to vendor/github.com/google/go-github/v88/github/orgs_hooks_deliveries.go index c1c301240..0150bc695 100644 --- a/vendor/github.com/google/go-github/v73/github/orgs_hooks_deliveries.go +++ b/vendor/github.com/google/go-github/v88/github/orgs_hooks_deliveries.go @@ -12,7 +12,7 @@ import ( // ListHookDeliveries lists webhook deliveries for a webhook configured in an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#list-deliveries-for-an-organization-webhook +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks?apiVersion=2022-11-28#list-deliveries-for-an-organization-webhook // //meta:operation GET /orgs/{org}/hooks/{hook_id}/deliveries func (s *OrganizationsService) ListHookDeliveries(ctx context.Context, org string, id int64, opts *ListCursorOptions) ([]*HookDelivery, *Response, error) { @@ -22,13 +22,13 @@ func (s *OrganizationsService) ListHookDeliveries(ctx context.Context, org strin return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } deliveries := []*HookDelivery{} - resp, err := s.client.Do(ctx, req, &deliveries) + resp, err := s.client.Do(req, &deliveries) if err != nil { return nil, resp, err } @@ -38,18 +38,18 @@ func (s *OrganizationsService) ListHookDeliveries(ctx context.Context, org strin // GetHookDelivery returns a delivery for a webhook configured in an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#get-a-webhook-delivery-for-an-organization-webhook +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks?apiVersion=2022-11-28#get-a-webhook-delivery-for-an-organization-webhook // //meta:operation GET /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id} func (s *OrganizationsService) GetHookDelivery(ctx context.Context, owner string, hookID, deliveryID int64) (*HookDelivery, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%v/deliveries/%v", owner, hookID, deliveryID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - h := new(HookDelivery) - resp, err := s.client.Do(ctx, req, h) + var h *HookDelivery + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } @@ -59,18 +59,18 @@ func (s *OrganizationsService) GetHookDelivery(ctx context.Context, owner string // RedeliverHookDelivery redelivers a delivery for a webhook configured in an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#redeliver-a-delivery-for-an-organization-webhook +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks?apiVersion=2022-11-28#redeliver-a-delivery-for-an-organization-webhook // //meta:operation POST /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}/attempts func (s *OrganizationsService) RedeliverHookDelivery(ctx context.Context, owner string, hookID, deliveryID int64) (*HookDelivery, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%v/deliveries/%v/attempts", owner, hookID, deliveryID) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - h := new(HookDelivery) - resp, err := s.client.Do(ctx, req, h) + var h *HookDelivery + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v88/github/orgs_immutable_releases.go b/vendor/github.com/google/go-github/v88/github/orgs_immutable_releases.go new file mode 100644 index 000000000..e9c3fe9c0 --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/orgs_immutable_releases.go @@ -0,0 +1,174 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// ImmutableReleaseSettings represents the response from the immutable releases settings endpoint. +type ImmutableReleaseSettings struct { + // EnforcedRepositories specifies how immutable releases are enforced in the organization. Possible values include "all", "none", or "selected". + EnforcedRepositories *string `json:"enforced_repositories,omitempty"` + // SelectedRepositoriesURL provides the API URL for managing the repositories + // selected for immutable releases enforcement when EnforcedRepositories is set to "selected". + SelectedRepositoriesURL *string `json:"selected_repositories_url,omitempty"` +} + +// ImmutableReleasePolicy is for setting the immutable releases policy for repositories in an organization. +type ImmutableReleasePolicy struct { + // EnforcedRepositories specifies how immutable releases are enforced in the organization. Possible values include "all", "none", or "selected". + EnforcedRepositories *string `json:"enforced_repositories,omitempty"` + // An array of repository ids for which immutable releases enforcement should be applied. + // You can only provide a list of repository ids when the enforced_repositories is set to "selected" + SelectedRepositoryIDs []int64 `json:"selected_repository_ids,omitempty"` +} + +// setImmutableReleasesRepositoriesOptions represents the request body for setting repositories. +type setImmutableReleasesRepositoriesOptions struct { + SelectedRepositoryIDs []int64 `json:"selected_repository_ids"` +} + +// GetImmutableReleasesSettings returns the immutable releases configuration that applies to repositories within the given organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/orgs?apiVersion=2022-11-28#get-immutable-releases-settings-for-an-organization +// +//meta:operation GET /orgs/{org}/settings/immutable-releases +func (s *OrganizationsService) GetImmutableReleasesSettings(ctx context.Context, org string) (*ImmutableReleaseSettings, *Response, error) { + u := fmt.Sprintf("orgs/%v/settings/immutable-releases", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var settings *ImmutableReleaseSettings + resp, err := s.client.Do(req, &settings) + if err != nil { + return nil, resp, err + } + + return settings, resp, nil +} + +// UpdateImmutableReleasesSettings sets immutable releases settings for an organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/orgs?apiVersion=2022-11-28#set-immutable-releases-settings-for-an-organization +// +//meta:operation PUT /orgs/{org}/settings/immutable-releases +func (s *OrganizationsService) UpdateImmutableReleasesSettings(ctx context.Context, org string, opts ImmutableReleasePolicy) (*Response, error) { + u := fmt.Sprintf("orgs/%v/settings/immutable-releases", org) + + req, err := s.client.NewRequest(ctx, "PUT", u, opts) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// ListImmutableReleaseRepositories lists selected repositories for immutable releases enforcement in an organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/orgs?apiVersion=2022-11-28#list-selected-repositories-for-immutable-releases-enforcement +// +//meta:operation GET /orgs/{org}/settings/immutable-releases/repositories +func (s *OrganizationsService) ListImmutableReleaseRepositories(ctx context.Context, org string, opts *ListOptions) (*ListRepositories, *Response, error) { + u := fmt.Sprintf("orgs/%v/settings/immutable-releases/repositories", org) + + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var repositories *ListRepositories + resp, err := s.client.Do(req, &repositories) + if err != nil { + return nil, resp, err + } + + return repositories, resp, nil +} + +// SetImmutableReleaseRepositories sets selected repositories for immutable releases enforcement. +// It requires the organization's immutable releases policy for enforced_repositories to be set to "selected". +// +// GitHub API docs: https://docs.github.com/rest/orgs/orgs?apiVersion=2022-11-28#set-selected-repositories-for-immutable-releases-enforcement +// +//meta:operation PUT /orgs/{org}/settings/immutable-releases/repositories +func (s *OrganizationsService) SetImmutableReleaseRepositories(ctx context.Context, org string, repositoryIDs []int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/settings/immutable-releases/repositories", org) + + body := &setImmutableReleasesRepositoriesOptions{ + SelectedRepositoryIDs: repositoryIDs, + } + + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// EnableRepositoryForImmutableRelease enables a selected repository for immutable releases in an organization. +// It requires enforced_repositories to be set to "selected". +// +// GitHub API docs: https://docs.github.com/rest/orgs/orgs?apiVersion=2022-11-28#enable-a-selected-repository-for-immutable-releases-in-an-organization +// +//meta:operation PUT /orgs/{org}/settings/immutable-releases/repositories/{repository_id} +func (s *OrganizationsService) EnableRepositoryForImmutableRelease(ctx context.Context, org string, repoID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/settings/immutable-releases/repositories/%v", org, repoID) + + req, err := s.client.NewRequest(ctx, "PUT", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// DisableRepositoryForImmutableRelease removes a repository from the organization's selected list for immutable releases enforcement. +// It requires enforced_repositories to be set to "selected". +// +// GitHub API docs: https://docs.github.com/rest/orgs/orgs?apiVersion=2022-11-28#disable-a-selected-repository-for-immutable-releases-in-an-organization +// +//meta:operation DELETE /orgs/{org}/settings/immutable-releases/repositories/{repository_id} +func (s *OrganizationsService) DisableRepositoryForImmutableRelease(ctx context.Context, org string, repoID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/settings/immutable-releases/repositories/%v", org, repoID) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/vendor/github.com/google/go-github/v73/github/orgs_issue_types.go b/vendor/github.com/google/go-github/v88/github/orgs_issue_types.go similarity index 74% rename from vendor/github.com/google/go-github/v73/github/orgs_issue_types.go rename to vendor/github.com/google/go-github/v88/github/orgs_issue_types.go index 73e6f8d63..2a1f1aa3a 100644 --- a/vendor/github.com/google/go-github/v73/github/orgs_issue_types.go +++ b/vendor/github.com/google/go-github/v88/github/orgs_issue_types.go @@ -21,19 +21,19 @@ type CreateOrUpdateIssueTypesOptions struct { // ListIssueTypes lists all issue types for an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/issue-types#list-issue-types-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/issue-types?apiVersion=2022-11-28#list-issue-types-for-an-organization // //meta:operation GET /orgs/{org}/issue-types func (s *OrganizationsService) ListIssueTypes(ctx context.Context, org string) ([]*IssueType, *Response, error) { u := fmt.Sprintf("orgs/%v/issue-types", org) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var issueTypes []*IssueType - resp, err := s.client.Do(ctx, req, &issueTypes) + resp, err := s.client.Do(req, &issueTypes) if err != nil { return nil, resp, err } @@ -43,18 +43,18 @@ func (s *OrganizationsService) ListIssueTypes(ctx context.Context, org string) ( // CreateIssueType creates a new issue type for an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/issue-types#create-issue-type-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/issue-types?apiVersion=2022-11-28#create-issue-type-for-an-organization // //meta:operation POST /orgs/{org}/issue-types -func (s *OrganizationsService) CreateIssueType(ctx context.Context, org string, opt *CreateOrUpdateIssueTypesOptions) (*IssueType, *Response, error) { +func (s *OrganizationsService) CreateIssueType(ctx context.Context, org string, opts *CreateOrUpdateIssueTypesOptions) (*IssueType, *Response, error) { u := fmt.Sprintf("orgs/%v/issue-types", org) - req, err := s.client.NewRequest("POST", u, opt) + req, err := s.client.NewRequest(ctx, "POST", u, opts) if err != nil { return nil, nil, err } - issueType := new(IssueType) - resp, err := s.client.Do(ctx, req, issueType) + var issueType *IssueType + resp, err := s.client.Do(req, &issueType) if err != nil { return nil, resp, err } @@ -64,18 +64,18 @@ func (s *OrganizationsService) CreateIssueType(ctx context.Context, org string, // UpdateIssueType updates GitHub Pages for the named repo. // -// GitHub API docs: https://docs.github.com/rest/orgs/issue-types#update-issue-type-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/issue-types?apiVersion=2022-11-28#update-issue-type-for-an-organization // //meta:operation PUT /orgs/{org}/issue-types/{issue_type_id} -func (s *OrganizationsService) UpdateIssueType(ctx context.Context, org string, issueTypeID int64, opt *CreateOrUpdateIssueTypesOptions) (*IssueType, *Response, error) { +func (s *OrganizationsService) UpdateIssueType(ctx context.Context, org string, issueTypeID int64, opts *CreateOrUpdateIssueTypesOptions) (*IssueType, *Response, error) { u := fmt.Sprintf("orgs/%v/issue-types/%v", org, issueTypeID) - req, err := s.client.NewRequest("PUT", u, opt) + req, err := s.client.NewRequest(ctx, "PUT", u, opts) if err != nil { return nil, nil, err } - issueType := new(IssueType) - resp, err := s.client.Do(ctx, req, issueType) + var issueType *IssueType + resp, err := s.client.Do(req, &issueType) if err != nil { return nil, resp, err } @@ -85,15 +85,15 @@ func (s *OrganizationsService) UpdateIssueType(ctx context.Context, org string, // DeleteIssueType deletes an issue type for an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/issue-types#delete-issue-type-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/issue-types?apiVersion=2022-11-28#delete-issue-type-for-an-organization // //meta:operation DELETE /orgs/{org}/issue-types/{issue_type_id} func (s *OrganizationsService) DeleteIssueType(ctx context.Context, org string, issueTypeID int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/issue-types/%d", org, issueTypeID) - req, err := s.client.NewRequest("DELETE", u, nil) + u := fmt.Sprintf("orgs/%v/issue-types/%v", org, issueTypeID) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/orgs_members.go b/vendor/github.com/google/go-github/v88/github/orgs_members.go similarity index 74% rename from vendor/github.com/google/go-github/v73/github/orgs_members.go rename to vendor/github.com/google/go-github/v88/github/orgs_members.go index d818d7f9f..ab5dc65af 100644 --- a/vendor/github.com/google/go-github/v73/github/orgs_members.go +++ b/vendor/github.com/google/go-github/v88/github/orgs_members.go @@ -69,10 +69,11 @@ type ListMembersOptions struct { // ListMembers lists the members for an organization. If the authenticated // user is an owner of the organization, this will return both concealed and -// public members, otherwise it will only return public members. +// public members; otherwise, it will only return public members. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#list-organization-members -// GitHub API docs: https://docs.github.com/rest/orgs/members#list-public-organization-members +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#list-organization-members +// +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#list-public-organization-members // //meta:operation GET /orgs/{org}/members //meta:operation GET /orgs/{org}/public_members @@ -88,13 +89,13 @@ func (s *OrganizationsService) ListMembers(ctx context.Context, org string, opts return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var members []*User - resp, err := s.client.Do(ctx, req, &members) + resp, err := s.client.Do(req, &members) if err != nil { return nil, resp, err } @@ -104,96 +105,96 @@ func (s *OrganizationsService) ListMembers(ctx context.Context, org string, opts // IsMember checks if a user is a member of an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#check-organization-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#check-organization-membership-for-a-user // //meta:operation GET /orgs/{org}/members/{username} func (s *OrganizationsService) IsMember(ctx context.Context, org, user string) (bool, *Response, error) { u := fmt.Sprintf("orgs/%v/members/%v", org, user) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return false, nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) member, err := parseBoolResponse(err) return member, resp, err } // IsPublicMember checks if a user is a public member of an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#check-public-organization-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#check-public-organization-membership-for-a-user // //meta:operation GET /orgs/{org}/public_members/{username} func (s *OrganizationsService) IsPublicMember(ctx context.Context, org, user string) (bool, *Response, error) { u := fmt.Sprintf("orgs/%v/public_members/%v", org, user) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return false, nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) member, err := parseBoolResponse(err) return member, resp, err } // RemoveMember removes a user from all teams of an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#remove-an-organization-member +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#remove-an-organization-member // //meta:operation DELETE /orgs/{org}/members/{username} func (s *OrganizationsService) RemoveMember(ctx context.Context, org, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/members/%v", org, user) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // CancelInvite cancels an organization invitation. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#cancel-an-organization-invitation +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#cancel-an-organization-invitation // //meta:operation DELETE /orgs/{org}/invitations/{invitation_id} func (s *OrganizationsService) CancelInvite(ctx context.Context, org string, invitationID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/invitations/%v", org, invitationID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // PublicizeMembership publicizes a user's membership in an organization. (A // user cannot publicize the membership for another user.) // -// GitHub API docs: https://docs.github.com/rest/orgs/members#set-public-organization-membership-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#set-public-organization-membership-for-the-authenticated-user // //meta:operation PUT /orgs/{org}/public_members/{username} func (s *OrganizationsService) PublicizeMembership(ctx context.Context, org, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/public_members/%v", org, user) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ConcealMembership conceals a user's membership in an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#remove-public-organization-membership-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#remove-public-organization-membership-for-the-authenticated-user // //meta:operation DELETE /orgs/{org}/public_members/{username} func (s *OrganizationsService) ConcealMembership(ctx context.Context, org, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/public_members/%v", org, user) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListOrgMembershipsOptions specifies optional parameters to the @@ -208,7 +209,7 @@ type ListOrgMembershipsOptions struct { // ListOrgMemberships lists the organization memberships for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#list-organization-memberships-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#list-organization-memberships-for-the-authenticated-user // //meta:operation GET /user/memberships/orgs func (s *OrganizationsService) ListOrgMemberships(ctx context.Context, opts *ListOrgMembershipsOptions) ([]*Membership, *Response, error) { @@ -218,13 +219,13 @@ func (s *OrganizationsService) ListOrgMemberships(ctx context.Context, opts *Lis return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var memberships []*Membership - resp, err := s.client.Do(ctx, req, &memberships) + resp, err := s.client.Do(req, &memberships) if err != nil { return nil, resp, err } @@ -236,8 +237,9 @@ func (s *OrganizationsService) ListOrgMemberships(ctx context.Context, opts *Lis // Passing an empty string for user will get the membership for the // authenticated user. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#get-an-organization-membership-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/rest/orgs/members#get-organization-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#get-an-organization-membership-for-the-authenticated-user +// +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#get-organization-membership-for-a-user // //meta:operation GET /orgs/{org}/memberships/{username} //meta:operation GET /user/memberships/orgs/{org} @@ -249,13 +251,13 @@ func (s *OrganizationsService) GetOrgMembership(ctx context.Context, user, org s u = fmt.Sprintf("user/memberships/orgs/%v", org) } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - membership := new(Membership) - resp, err := s.client.Do(ctx, req, membership) + var membership *Membership + resp, err := s.client.Do(req, &membership) if err != nil { return nil, resp, err } @@ -267,8 +269,9 @@ func (s *OrganizationsService) GetOrgMembership(ctx context.Context, user, org s // Passing an empty string for user will edit the membership for the // authenticated user. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#set-organization-membership-for-a-user -// GitHub API docs: https://docs.github.com/rest/orgs/members#update-an-organization-membership-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#set-organization-membership-for-a-user +// +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#update-an-organization-membership-for-the-authenticated-user // //meta:operation PUT /orgs/{org}/memberships/{username} //meta:operation PATCH /user/memberships/orgs/{org} @@ -282,13 +285,13 @@ func (s *OrganizationsService) EditOrgMembership(ctx context.Context, user, org method = "PATCH" } - req, err := s.client.NewRequest(method, u, membership) + req, err := s.client.NewRequest(ctx, method, u, membership) if err != nil { return nil, nil, err } - m := new(Membership) - resp, err := s.client.Do(ctx, req, m) + var m *Membership + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -299,22 +302,22 @@ func (s *OrganizationsService) EditOrgMembership(ctx context.Context, user, org // RemoveOrgMembership removes user from the specified organization. If the // user has been invited to the organization, this will cancel their invitation. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#remove-organization-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#remove-organization-membership-for-a-user // //meta:operation DELETE /orgs/{org}/memberships/{username} func (s *OrganizationsService) RemoveOrgMembership(ctx context.Context, user, org string) (*Response, error) { u := fmt.Sprintf("orgs/%v/memberships/%v", org, user) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListPendingOrgInvitations returns a list of pending invitations. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#list-pending-organization-invitations +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#list-pending-organization-invitations // //meta:operation GET /orgs/{org}/invitations func (s *OrganizationsService) ListPendingOrgInvitations(ctx context.Context, org string, opts *ListOptions) ([]*Invitation, *Response, error) { @@ -324,13 +327,13 @@ func (s *OrganizationsService) ListPendingOrgInvitations(ctx context.Context, or return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var pendingInvitations []*Invitation - resp, err := s.client.Do(ctx, req, &pendingInvitations) + resp, err := s.client.Do(req, &pendingInvitations) if err != nil { return nil, resp, err } @@ -362,19 +365,19 @@ type CreateOrgInvitationOptions struct { // In order to create invitations in an organization, // the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#create-an-organization-invitation +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#create-an-organization-invitation // //meta:operation POST /orgs/{org}/invitations func (s *OrganizationsService) CreateOrgInvitation(ctx context.Context, org string, opts *CreateOrgInvitationOptions) (*Invitation, *Response, error) { u := fmt.Sprintf("orgs/%v/invitations", org) - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, opts) if err != nil { return nil, nil, err } var invitation *Invitation - resp, err := s.client.Do(ctx, req, &invitation) + resp, err := s.client.Do(req, &invitation) if err != nil { return nil, resp, err } @@ -385,7 +388,7 @@ func (s *OrganizationsService) CreateOrgInvitation(ctx context.Context, org stri // ListOrgInvitationTeams lists all teams associated with an invitation. In order to see invitations in an organization, // the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#list-organization-invitation-teams +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#list-organization-invitation-teams // //meta:operation GET /orgs/{org}/invitations/{invitation_id}/teams func (s *OrganizationsService) ListOrgInvitationTeams(ctx context.Context, org, invitationID string, opts *ListOptions) ([]*Team, *Response, error) { @@ -395,13 +398,13 @@ func (s *OrganizationsService) ListOrgInvitationTeams(ctx context.Context, org, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var orgInvitationTeams []*Team - resp, err := s.client.Do(ctx, req, &orgInvitationTeams) + resp, err := s.client.Do(req, &orgInvitationTeams) if err != nil { return nil, resp, err } @@ -411,7 +414,7 @@ func (s *OrganizationsService) ListOrgInvitationTeams(ctx context.Context, org, // ListFailedOrgInvitations returns a list of failed invitations. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#list-failed-organization-invitations +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#list-failed-organization-invitations // //meta:operation GET /orgs/{org}/failed_invitations func (s *OrganizationsService) ListFailedOrgInvitations(ctx context.Context, org string, opts *ListOptions) ([]*Invitation, *Response, error) { @@ -421,13 +424,13 @@ func (s *OrganizationsService) ListFailedOrgInvitations(ctx context.Context, org return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var failedInvitations []*Invitation - resp, err := s.client.Do(ctx, req, &failedInvitations) + resp, err := s.client.Do(req, &failedInvitations) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/orgs_network_configurations.go b/vendor/github.com/google/go-github/v88/github/orgs_network_configurations.go similarity index 83% rename from vendor/github.com/google/go-github/v73/github/orgs_network_configurations.go rename to vendor/github.com/google/go-github/v88/github/orgs_network_configurations.go index 82a819c20..a62f34f4c 100644 --- a/vendor/github.com/google/go-github/v73/github/orgs_network_configurations.go +++ b/vendor/github.com/google/go-github/v88/github/orgs_network_configurations.go @@ -89,10 +89,7 @@ func validateNetworkConfigurationRequest(req NetworkConfigurationRequest) error } networkIDs := req.NetworkSettingsIDs - if err := validateNetworkSettingsID(networkIDs); err != nil { - return err - } - return nil + return validateNetworkSettingsID(networkIDs) } // NetworkConfigurationRequest represents a request to create or update a network configuration for an organization. @@ -104,7 +101,7 @@ type NetworkConfigurationRequest struct { // ListNetworkConfigurations lists all hosted compute network configurations configured in an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/network-configurations#list-hosted-compute-network-configurations-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/network-configurations?apiVersion=2022-11-28#list-hosted-compute-network-configurations-for-an-organization // //meta:operation GET /orgs/{org}/settings/network-configurations func (s *OrganizationsService) ListNetworkConfigurations(ctx context.Context, org string, opts *ListOptions) (*NetworkConfigurations, *Response, error) { @@ -114,22 +111,23 @@ func (s *OrganizationsService) ListNetworkConfigurations(ctx context.Context, or return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - configurations := &NetworkConfigurations{} - resp, err := s.client.Do(ctx, req, configurations) + var configurations *NetworkConfigurations + resp, err := s.client.Do(req, &configurations) if err != nil { return nil, resp, err } + return configurations, resp, nil } // CreateNetworkConfiguration creates a hosted compute network configuration for an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/network-configurations#create-a-hosted-compute-network-configuration-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/network-configurations?apiVersion=2022-11-28#create-a-hosted-compute-network-configuration-for-an-organization // //meta:operation POST /orgs/{org}/settings/network-configurations func (s *OrganizationsService) CreateNetworkConfiguration(ctx context.Context, org string, createReq NetworkConfigurationRequest) (*NetworkConfiguration, *Response, error) { @@ -138,42 +136,44 @@ func (s *OrganizationsService) CreateNetworkConfiguration(ctx context.Context, o } u := fmt.Sprintf("orgs/%v/settings/network-configurations", org) - req, err := s.client.NewRequest("POST", u, createReq) + req, err := s.client.NewRequest(ctx, "POST", u, createReq) if err != nil { return nil, nil, err } - configuration := &NetworkConfiguration{} - resp, err := s.client.Do(ctx, req, configuration) + var configuration *NetworkConfiguration + resp, err := s.client.Do(req, &configuration) if err != nil { return nil, resp, err } + return configuration, resp, nil } // GetNetworkConfiguration gets a hosted compute network configuration configured in an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/network-configurations#get-a-hosted-compute-network-configuration-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/network-configurations?apiVersion=2022-11-28#get-a-hosted-compute-network-configuration-for-an-organization // //meta:operation GET /orgs/{org}/settings/network-configurations/{network_configuration_id} func (s *OrganizationsService) GetNetworkConfiguration(ctx context.Context, org, networkID string) (*NetworkConfiguration, *Response, error) { u := fmt.Sprintf("orgs/%v/settings/network-configurations/%v", org, networkID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - configuration := &NetworkConfiguration{} - resp, err := s.client.Do(ctx, req, configuration) + var configuration *NetworkConfiguration + resp, err := s.client.Do(req, &configuration) if err != nil { return nil, resp, err } + return configuration, resp, nil } // UpdateNetworkConfiguration updates a hosted compute network configuration for an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/network-configurations#update-a-hosted-compute-network-configuration-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/network-configurations?apiVersion=2022-11-28#update-a-hosted-compute-network-configuration-for-an-organization // //meta:operation PATCH /orgs/{org}/settings/network-configurations/{network_configuration_id} func (s *OrganizationsService) UpdateNetworkConfiguration(ctx context.Context, org, networkID string, updateReq NetworkConfigurationRequest) (*NetworkConfiguration, *Response, error) { @@ -182,55 +182,58 @@ func (s *OrganizationsService) UpdateNetworkConfiguration(ctx context.Context, o } u := fmt.Sprintf("orgs/%v/settings/network-configurations/%v", org, networkID) - req, err := s.client.NewRequest("PATCH", u, updateReq) + req, err := s.client.NewRequest(ctx, "PATCH", u, updateReq) if err != nil { return nil, nil, err } - configuration := &NetworkConfiguration{} - resp, err := s.client.Do(ctx, req, configuration) + var configuration *NetworkConfiguration + resp, err := s.client.Do(req, &configuration) if err != nil { return nil, resp, err } + return configuration, resp, nil } // DeleteNetworkConfigurations deletes a hosted compute network configuration from an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/network-configurations#delete-a-hosted-compute-network-configuration-from-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/network-configurations?apiVersion=2022-11-28#delete-a-hosted-compute-network-configuration-from-an-organization // //meta:operation DELETE /orgs/{org}/settings/network-configurations/{network_configuration_id} func (s *OrganizationsService) DeleteNetworkConfigurations(ctx context.Context, org, networkID string) (*Response, error) { u := fmt.Sprintf("orgs/%v/settings/network-configurations/%v", org, networkID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - configuration := &NetworkConfiguration{} - resp, err := s.client.Do(ctx, req, configuration) + var configuration *NetworkConfiguration + resp, err := s.client.Do(req, &configuration) if err != nil { return resp, err } + return resp, nil } // GetNetworkConfigurationResource gets a hosted compute network settings resource configured for an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/network-configurations#get-a-hosted-compute-network-settings-resource-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/network-configurations?apiVersion=2022-11-28#get-a-hosted-compute-network-settings-resource-for-an-organization // //meta:operation GET /orgs/{org}/settings/network-settings/{network_settings_id} func (s *OrganizationsService) GetNetworkConfigurationResource(ctx context.Context, org, networkID string) (*NetworkSettingsResource, *Response, error) { u := fmt.Sprintf("orgs/%v/settings/network-settings/%v", org, networkID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - resource := &NetworkSettingsResource{} - resp, err := s.client.Do(ctx, req, resource) + var resource *NetworkSettingsResource + resp, err := s.client.Do(req, &resource) if err != nil { return nil, resp, err } + return resource, resp, nil } diff --git a/vendor/github.com/google/go-github/v88/github/orgs_organization_properties.go b/vendor/github.com/google/go-github/v88/github/orgs_organization_properties.go new file mode 100644 index 000000000..aa6faa637 --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/orgs_organization_properties.go @@ -0,0 +1,60 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// OrganizationCustomPropertyValues represents the custom property values for an organization. +type OrganizationCustomPropertyValues struct { + // List of custom property names and associated values to apply to the organization. + Properties []*CustomPropertyValue `json:"properties,omitempty"` +} + +// GetOrganizationCustomPropertyValues returns all custom property names and their values for an organization. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-properties-for-orgs?apiVersion=2022-11-28#get-all-custom-property-values-for-an-organization +// +//meta:operation GET /organizations/{org}/org-properties/values +func (s *OrganizationsService) GetOrganizationCustomPropertyValues(ctx context.Context, org string) ([]*CustomPropertyValue, *Response, error) { + u := fmt.Sprintf("organizations/%v/org-properties/values", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var values []*CustomPropertyValue + resp, err := s.client.Do(req, &values) + if err != nil { + return nil, resp, err + } + + return values, resp, nil +} + +// CreateOrUpdateOrganizationCustomPropertyValues creates or updates custom property values for an organization. +// To remove a custom property value from an organization, set the property value to null. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-properties-for-orgs?apiVersion=2022-11-28#create-or-update-custom-property-values-for-an-organization +// +//meta:operation PATCH /organizations/{org}/org-properties/values +func (s *OrganizationsService) CreateOrUpdateOrganizationCustomPropertyValues(ctx context.Context, org string, values OrganizationCustomPropertyValues) (*Response, error) { + u := fmt.Sprintf("organizations/%v/org-properties/values", org) + req, err := s.client.NewRequest(ctx, "PATCH", u, values) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/vendor/github.com/google/go-github/v73/github/orgs_organization_roles.go b/vendor/github.com/google/go-github/v88/github/orgs_organization_roles.go similarity index 63% rename from vendor/github.com/google/go-github/v73/github/orgs_organization_roles.go rename to vendor/github.com/google/go-github/v88/github/orgs_organization_roles.go index 0954b92d4..c0503ce0d 100644 --- a/vendor/github.com/google/go-github/v73/github/orgs_organization_roles.go +++ b/vendor/github.com/google/go-github/v88/github/orgs_organization_roles.go @@ -12,12 +12,12 @@ import ( // OrganizationCustomRoles represents custom organization roles available in specified organization. type OrganizationCustomRoles struct { - TotalCount *int `json:"total_count,omitempty"` - CustomRepoRoles []*CustomOrgRoles `json:"roles,omitempty"` + TotalCount *int `json:"total_count,omitempty"` + CustomRepoRoles []*CustomOrgRole `json:"roles,omitempty"` } -// CustomOrgRoles represents custom organization role available in specified organization. -type CustomOrgRoles struct { +// CustomOrgRole represents custom organization role available in specified organization. +type CustomOrgRole struct { ID *int64 `json:"id,omitempty"` Name *string `json:"name,omitempty"` Description *string `json:"description,omitempty"` @@ -29,30 +29,44 @@ type CustomOrgRoles struct { BaseRole *string `json:"base_role,omitempty"` } -// CreateOrUpdateOrgRoleOptions represents options required to create or update a custom organization role. -type CreateOrUpdateOrgRoleOptions struct { - Name *string `json:"name,omitempty"` +// CreateCustomOrgRoleRequest represents body parameters required to create a custom organization role. +type CreateCustomOrgRoleRequest struct { + Name string `json:"name"` Description *string `json:"description,omitempty"` Permissions []string `json:"permissions"` - BaseRole *string `json:"base_role,omitempty"` + BaseRole *string `json:"base_role,omitempty"` // Can be one of: read, triage, write, maintain, admin +} + +// UpdateCustomOrgRoleRequest represents body parameters to update a custom organization role. +type UpdateCustomOrgRoleRequest struct { + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + Permissions []string `json:"permissions,omitempty"` + BaseRole *string `json:"base_role,omitempty"` // Can be one of: none, read, triage, write, maintain, admin +} + +// OrganizationFineGrainedPermission represents a fine-grained permission that protects organization resources. +type OrganizationFineGrainedPermission struct { + Name string `json:"name"` + Description string `json:"description"` } // ListRoles lists the custom roles available in this organization. // In order to see custom roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#get-all-organization-roles-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles?apiVersion=2022-11-28#get-all-organization-roles-for-an-organization // //meta:operation GET /orgs/{org}/organization-roles func (s *OrganizationsService) ListRoles(ctx context.Context, org string) (*OrganizationCustomRoles, *Response, error) { u := fmt.Sprintf("orgs/%v/organization-roles", org) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - customRepoRoles := new(OrganizationCustomRoles) - resp, err := s.client.Do(ctx, req, customRepoRoles) + var customRepoRoles *OrganizationCustomRoles + resp, err := s.client.Do(req, &customRepoRoles) if err != nil { return nil, resp, err } @@ -63,19 +77,19 @@ func (s *OrganizationsService) ListRoles(ctx context.Context, org string) (*Orga // GetOrgRole gets an organization role in this organization. // In order to get organization roles in an organization, the authenticated user must be an organization owner, or have access via an organization role. // -// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#get-an-organization-role +// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles?apiVersion=2022-11-28#get-an-organization-role // //meta:operation GET /orgs/{org}/organization-roles/{role_id} -func (s *OrganizationsService) GetOrgRole(ctx context.Context, org string, roleID int64) (*CustomOrgRoles, *Response, error) { +func (s *OrganizationsService) GetOrgRole(ctx context.Context, org string, roleID int64) (*CustomOrgRole, *Response, error) { u := fmt.Sprintf("orgs/%v/organization-roles/%v", org, roleID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - resultingRole := new(CustomOrgRoles) - resp, err := s.client.Do(ctx, req, resultingRole) + var resultingRole *CustomOrgRole + resp, err := s.client.Do(req, &resultingRole) if err != nil { return nil, resp, err } @@ -86,19 +100,19 @@ func (s *OrganizationsService) GetOrgRole(ctx context.Context, org string, roleI // CreateCustomOrgRole creates a custom role in this organization. // In order to create custom roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/organization-roles#create-a-custom-organization-role +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/organization-roles?apiVersion=2022-11-28#create-a-custom-organization-role // //meta:operation POST /orgs/{org}/organization-roles -func (s *OrganizationsService) CreateCustomOrgRole(ctx context.Context, org string, opts *CreateOrUpdateOrgRoleOptions) (*CustomOrgRoles, *Response, error) { +func (s *OrganizationsService) CreateCustomOrgRole(ctx context.Context, org string, request CreateCustomOrgRoleRequest) (*CustomOrgRole, *Response, error) { u := fmt.Sprintf("orgs/%v/organization-roles", org) - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, request) if err != nil { return nil, nil, err } - resultingRole := new(CustomOrgRoles) - resp, err := s.client.Do(ctx, req, resultingRole) + var resultingRole *CustomOrgRole + resp, err := s.client.Do(req, &resultingRole) if err != nil { return nil, resp, err } @@ -109,19 +123,19 @@ func (s *OrganizationsService) CreateCustomOrgRole(ctx context.Context, org stri // UpdateCustomOrgRole updates a custom role in this organization. // In order to update custom roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/organization-roles#update-a-custom-organization-role +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/organization-roles?apiVersion=2022-11-28#update-a-custom-organization-role // //meta:operation PATCH /orgs/{org}/organization-roles/{role_id} -func (s *OrganizationsService) UpdateCustomOrgRole(ctx context.Context, org string, roleID int64, opts *CreateOrUpdateOrgRoleOptions) (*CustomOrgRoles, *Response, error) { +func (s *OrganizationsService) UpdateCustomOrgRole(ctx context.Context, org string, roleID int64, request UpdateCustomOrgRoleRequest) (*CustomOrgRole, *Response, error) { u := fmt.Sprintf("orgs/%v/organization-roles/%v", org, roleID) - req, err := s.client.NewRequest("PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, request) if err != nil { return nil, nil, err } - resultingRole := new(CustomOrgRoles) - resp, err := s.client.Do(ctx, req, resultingRole) + var resultingRole *CustomOrgRole + resp, err := s.client.Do(req, &resultingRole) if err != nil { return nil, resp, err } @@ -132,19 +146,19 @@ func (s *OrganizationsService) UpdateCustomOrgRole(ctx context.Context, org stri // DeleteCustomOrgRole deletes an existing custom role in this organization. // In order to delete custom roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/organization-roles#delete-a-custom-organization-role +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/organization-roles?apiVersion=2022-11-28#delete-a-custom-organization-role // //meta:operation DELETE /orgs/{org}/organization-roles/{role_id} func (s *OrganizationsService) DeleteCustomOrgRole(ctx context.Context, org string, roleID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/organization-roles/%v", org, roleID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - resultingRole := new(CustomOrgRoles) - resp, err := s.client.Do(ctx, req, resultingRole) + var resultingRole *CustomOrgRole + resp, err := s.client.Do(req, &resultingRole) if err != nil { return resp, err } @@ -155,18 +169,18 @@ func (s *OrganizationsService) DeleteCustomOrgRole(ctx context.Context, org stri // AssignOrgRoleToTeam assigns an existing organization role to a team in this organization. // In order to assign organization roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#assign-an-organization-role-to-a-team +// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles?apiVersion=2022-11-28#assign-an-organization-role-to-a-team // //meta:operation PUT /orgs/{org}/organization-roles/teams/{team_slug}/{role_id} func (s *OrganizationsService) AssignOrgRoleToTeam(ctx context.Context, org, teamSlug string, roleID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/organization-roles/teams/%v/%v", org, teamSlug, roleID) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -177,18 +191,18 @@ func (s *OrganizationsService) AssignOrgRoleToTeam(ctx context.Context, org, tea // RemoveOrgRoleFromTeam removes an existing organization role assignment from a team in this organization. // In order to remove organization role assignments in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#remove-an-organization-role-from-a-team +// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles?apiVersion=2022-11-28#remove-an-organization-role-from-a-team // //meta:operation DELETE /orgs/{org}/organization-roles/teams/{team_slug}/{role_id} func (s *OrganizationsService) RemoveOrgRoleFromTeam(ctx context.Context, org, teamSlug string, roleID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/organization-roles/teams/%v/%v", org, teamSlug, roleID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -199,18 +213,18 @@ func (s *OrganizationsService) RemoveOrgRoleFromTeam(ctx context.Context, org, t // AssignOrgRoleToUser assigns an existing organization role to a user in this organization. // In order to assign organization roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#assign-an-organization-role-to-a-user +// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles?apiVersion=2022-11-28#assign-an-organization-role-to-a-user // //meta:operation PUT /orgs/{org}/organization-roles/users/{username}/{role_id} func (s *OrganizationsService) AssignOrgRoleToUser(ctx context.Context, org, username string, roleID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/organization-roles/users/%v/%v", org, username, roleID) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -221,18 +235,18 @@ func (s *OrganizationsService) AssignOrgRoleToUser(ctx context.Context, org, use // RemoveOrgRoleFromUser removes an existing organization role assignment from a user in this organization. // In order to remove organization role assignments in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#remove-an-organization-role-from-a-user +// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles?apiVersion=2022-11-28#remove-an-organization-role-from-a-user // //meta:operation DELETE /orgs/{org}/organization-roles/users/{username}/{role_id} func (s *OrganizationsService) RemoveOrgRoleFromUser(ctx context.Context, org, username string, roleID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/organization-roles/users/%v/%v", org, username, roleID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -243,7 +257,7 @@ func (s *OrganizationsService) RemoveOrgRoleFromUser(ctx context.Context, org, u // ListTeamsAssignedToOrgRole returns all teams assigned to a specific organization role. // In order to list teams assigned to an organization role, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#list-teams-that-are-assigned-to-an-organization-role +// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles?apiVersion=2022-11-28#list-teams-that-are-assigned-to-an-organization-role // //meta:operation GET /orgs/{org}/organization-roles/{role_id}/teams func (s *OrganizationsService) ListTeamsAssignedToOrgRole(ctx context.Context, org string, roleID int64, opts *ListOptions) ([]*Team, *Response, error) { @@ -253,13 +267,13 @@ func (s *OrganizationsService) ListTeamsAssignedToOrgRole(ctx context.Context, o return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var teams []*Team - resp, err := s.client.Do(ctx, req, &teams) + resp, err := s.client.Do(req, &teams) if err != nil { return nil, resp, err } @@ -270,7 +284,7 @@ func (s *OrganizationsService) ListTeamsAssignedToOrgRole(ctx context.Context, o // ListUsersAssignedToOrgRole returns all users assigned to a specific organization role. // In order to list users assigned to an organization role, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#list-users-that-are-assigned-to-an-organization-role +// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles?apiVersion=2022-11-28#list-users-that-are-assigned-to-an-organization-role // //meta:operation GET /orgs/{org}/organization-roles/{role_id}/users func (s *OrganizationsService) ListUsersAssignedToOrgRole(ctx context.Context, org string, roleID int64, opts *ListOptions) ([]*User, *Response, error) { @@ -280,16 +294,44 @@ func (s *OrganizationsService) ListUsersAssignedToOrgRole(ctx context.Context, o return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var users []*User - resp, err := s.client.Do(ctx, req, &users) + resp, err := s.client.Do(req, &users) if err != nil { return nil, resp, err } return users, resp, nil } + +// ListFineGrainedPermissions lists the fine-grained permissions that can be used in custom organization roles for an organization. +// +// To use this endpoint, the authenticated user must be one of: +// - An administrator for the organization. +// - A user, or a user on a team, with the fine-grained permissions of `read_organization_custom_org_role` in the organization. +// +// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/organization-roles?apiVersion=2022-11-28#list-organization-fine-grained-permissions-for-an-organization +// +//meta:operation GET /orgs/{org}/organization-fine-grained-permissions +func (s *OrganizationsService) ListFineGrainedPermissions(ctx context.Context, org string) ([]*OrganizationFineGrainedPermission, *Response, error) { + u := fmt.Sprintf("orgs/%v/organization-fine-grained-permissions", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions []*OrganizationFineGrainedPermission + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} diff --git a/vendor/github.com/google/go-github/v73/github/orgs_outside_collaborators.go b/vendor/github.com/google/go-github/v88/github/orgs_outside_collaborators.go similarity index 80% rename from vendor/github.com/google/go-github/v73/github/orgs_outside_collaborators.go rename to vendor/github.com/google/go-github/v88/github/orgs_outside_collaborators.go index 56034d726..61a4861d4 100644 --- a/vendor/github.com/google/go-github/v73/github/orgs_outside_collaborators.go +++ b/vendor/github.com/google/go-github/v88/github/orgs_outside_collaborators.go @@ -27,7 +27,7 @@ type ListOutsideCollaboratorsOptions struct { // Warning: The API may change without advance notice during the preview period. // Preview features are not supported for production use. // -// GitHub API docs: https://docs.github.com/rest/orgs/outside-collaborators#list-outside-collaborators-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/outside-collaborators?apiVersion=2022-11-28#list-outside-collaborators-for-an-organization // //meta:operation GET /orgs/{org}/outside_collaborators func (s *OrganizationsService) ListOutsideCollaborators(ctx context.Context, org string, opts *ListOutsideCollaboratorsOptions) ([]*User, *Response, error) { @@ -37,13 +37,13 @@ func (s *OrganizationsService) ListOutsideCollaborators(ctx context.Context, org return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var members []*User - resp, err := s.client.Do(ctx, req, &members) + resp, err := s.client.Do(req, &members) if err != nil { return nil, resp, err } @@ -54,17 +54,17 @@ func (s *OrganizationsService) ListOutsideCollaborators(ctx context.Context, org // RemoveOutsideCollaborator removes a user from the list of outside collaborators; // consequently, removing them from all the organization's repositories. // -// GitHub API docs: https://docs.github.com/rest/orgs/outside-collaborators#remove-outside-collaborator-from-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/outside-collaborators?apiVersion=2022-11-28#remove-outside-collaborator-from-an-organization // //meta:operation DELETE /orgs/{org}/outside_collaborators/{username} -func (s *OrganizationsService) RemoveOutsideCollaborator(ctx context.Context, org string, user string) (*Response, error) { +func (s *OrganizationsService) RemoveOutsideCollaborator(ctx context.Context, org, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/outside_collaborators/%v", org, user) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ConvertMemberToOutsideCollaborator reduces the permission level of a member of the @@ -73,15 +73,15 @@ func (s *OrganizationsService) RemoveOutsideCollaborator(ctx context.Context, or // Responses for converting a non-member or the last owner to an outside collaborator // are listed in GitHub API docs. // -// GitHub API docs: https://docs.github.com/rest/orgs/outside-collaborators#convert-an-organization-member-to-outside-collaborator +// GitHub API docs: https://docs.github.com/rest/orgs/outside-collaborators?apiVersion=2022-11-28#convert-an-organization-member-to-outside-collaborator // //meta:operation PUT /orgs/{org}/outside_collaborators/{username} -func (s *OrganizationsService) ConvertMemberToOutsideCollaborator(ctx context.Context, org string, user string) (*Response, error) { +func (s *OrganizationsService) ConvertMemberToOutsideCollaborator(ctx context.Context, org, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/outside_collaborators/%v", org, user) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/orgs_packages.go b/vendor/github.com/google/go-github/v88/github/orgs_packages.go similarity index 81% rename from vendor/github.com/google/go-github/v73/github/orgs_packages.go rename to vendor/github.com/google/go-github/v88/github/orgs_packages.go index edd8e508f..54762e5e7 100644 --- a/vendor/github.com/google/go-github/v73/github/orgs_packages.go +++ b/vendor/github.com/google/go-github/v88/github/orgs_packages.go @@ -13,7 +13,7 @@ import ( // ListPackages lists the packages for an organization. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#list-packages-for-an-organization +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#list-packages-for-an-organization // //meta:operation GET /orgs/{org}/packages func (s *OrganizationsService) ListPackages(ctx context.Context, org string, opts *PackageListOptions) ([]*Package, *Response, error) { @@ -23,13 +23,13 @@ func (s *OrganizationsService) ListPackages(ctx context.Context, org string, opt return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var packages []*Package - resp, err := s.client.Do(ctx, req, &packages) + resp, err := s.client.Do(req, &packages) if err != nil { return nil, resp, err } @@ -41,18 +41,18 @@ func (s *OrganizationsService) ListPackages(ctx context.Context, org string, opt // // Note that packageName is escaped for the URL path so that you don't need to. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#get-a-package-for-an-organization +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#get-a-package-for-an-organization // //meta:operation GET /orgs/{org}/packages/{package_type}/{package_name} func (s *OrganizationsService) GetPackage(ctx context.Context, org, packageType, packageName string) (*Package, *Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v", org, packageType, url.PathEscape(packageName)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var pack *Package - resp, err := s.client.Do(ctx, req, &pack) + resp, err := s.client.Do(req, &pack) if err != nil { return nil, resp, err } @@ -64,41 +64,41 @@ func (s *OrganizationsService) GetPackage(ctx context.Context, org, packageType, // // Note that packageName is escaped for the URL path so that you don't need to. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#delete-a-package-for-an-organization +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#delete-a-package-for-an-organization // //meta:operation DELETE /orgs/{org}/packages/{package_type}/{package_name} func (s *OrganizationsService) DeletePackage(ctx context.Context, org, packageType, packageName string) (*Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v", org, packageType, url.PathEscape(packageName)) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RestorePackage restores a package to an organization. // // Note that packageName is escaped for the URL path so that you don't need to. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#restore-a-package-for-an-organization +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#restore-a-package-for-an-organization // //meta:operation POST /orgs/{org}/packages/{package_type}/{package_name}/restore func (s *OrganizationsService) RestorePackage(ctx context.Context, org, packageType, packageName string) (*Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v/restore", org, packageType, url.PathEscape(packageName)) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // PackageGetAllVersions gets all versions of a package in an organization. // // Note that packageName is escaped for the URL path so that you don't need to. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-an-organization +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#list-package-versions-for-a-package-owned-by-an-organization // //meta:operation GET /orgs/{org}/packages/{package_type}/{package_name}/versions func (s *OrganizationsService) PackageGetAllVersions(ctx context.Context, org, packageType, packageName string, opts *PackageListOptions) ([]*PackageVersion, *Response, error) { @@ -108,13 +108,13 @@ func (s *OrganizationsService) PackageGetAllVersions(ctx context.Context, org, p return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var versions []*PackageVersion - resp, err := s.client.Do(ctx, req, &versions) + resp, err := s.client.Do(req, &versions) if err != nil { return nil, resp, err } @@ -126,18 +126,18 @@ func (s *OrganizationsService) PackageGetAllVersions(ctx context.Context, org, p // // Note that packageName is escaped for the URL path so that you don't need to. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#get-a-package-version-for-an-organization +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#get-a-package-version-for-an-organization // //meta:operation GET /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id} func (s *OrganizationsService) PackageGetVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*PackageVersion, *Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v", org, packageType, url.PathEscape(packageName), packageVersionID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var version *PackageVersion - resp, err := s.client.Do(ctx, req, &version) + resp, err := s.client.Do(req, &version) if err != nil { return nil, resp, err } @@ -149,32 +149,32 @@ func (s *OrganizationsService) PackageGetVersion(ctx context.Context, org, packa // // Note that packageName is escaped for the URL path so that you don't need to. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#delete-package-version-for-an-organization +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#delete-package-version-for-an-organization // //meta:operation DELETE /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id} func (s *OrganizationsService) PackageDeleteVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v", org, packageType, url.PathEscape(packageName), packageVersionID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // PackageRestoreVersion restores a package version to an organization. // // Note that packageName is escaped for the URL path so that you don't need to. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#restore-package-version-for-an-organization +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#restore-package-version-for-an-organization // //meta:operation POST /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore func (s *OrganizationsService) PackageRestoreVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v/restore", org, packageType, url.PathEscape(packageName), packageVersionID) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/orgs_personal_access_tokens.go b/vendor/github.com/google/go-github/v88/github/orgs_personal_access_tokens.go similarity index 55% rename from vendor/github.com/google/go-github/v73/github/orgs_personal_access_tokens.go rename to vendor/github.com/google/go-github/v88/github/orgs_personal_access_tokens.go index 276fbbb49..98b1ea81a 100644 --- a/vendor/github.com/google/go-github/v73/github/orgs_personal_access_tokens.go +++ b/vendor/github.com/google/go-github/v88/github/orgs_personal_access_tokens.go @@ -7,15 +7,16 @@ package github import ( "context" + "errors" "fmt" - "net/http" "net/url" + "strconv" "strings" ) // PersonalAccessToken represents the minimal representation of an organization programmatic access grant. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/personal-access-tokens?apiVersion=2022-11-28 +// GitHub API docs: https://docs.github.com/rest/orgs/personal-access-tokens?apiVersion=2022-11-28 type PersonalAccessToken struct { // "Unique identifier of the fine-grained personal access token. // The `pat_id` used to get details about an approved fine-grained personal access token. @@ -83,13 +84,16 @@ type ListFineGrainedPATOptions struct { // This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. LastUsedAfter string `url:"last_used_after,omitempty"` + // TokenID filters results by the given fine-grained personal access token IDs. + TokenID []int64 `url:"-"` + ListOptions } // ListFineGrainedPersonalAccessTokens lists approved fine-grained personal access tokens owned by organization members that can access organization resources. // Only GitHub Apps can call this API, using the `Personal access tokens` organization permissions (read). // -// GitHub API docs: https://docs.github.com/rest/orgs/personal-access-tokens#list-fine-grained-personal-access-tokens-with-access-to-organization-resources +// GitHub API docs: https://docs.github.com/rest/orgs/personal-access-tokens?apiVersion=2022-11-28#list-fine-grained-personal-access-tokens-with-access-to-organization-resources // //meta:operation GET /orgs/{org}/personal-access-tokens func (s *OrganizationsService) ListFineGrainedPersonalAccessTokens(ctx context.Context, org string, opts *ListFineGrainedPATOptions) ([]*PersonalAccessToken, *Response, error) { @@ -100,14 +104,83 @@ func (s *OrganizationsService) ListFineGrainedPersonalAccessTokens(ctx context.C return nil, nil, err } - req, err := s.client.NewRequest(http.MethodGet, u, opts) + req, err := s.client.NewRequest(ctx, "GET", u, opts) if err != nil { return nil, nil, err } var pats []*PersonalAccessToken - resp, err := s.client.Do(ctx, req, &pats) + resp, err := s.client.Do(req, &pats) + if err != nil { + return nil, resp, err + } + + return pats, resp, nil +} + +// FineGrainedPersonalAccessTokenRequest represents the details of a request to access organization resources via a fine-grained personal access token. +type FineGrainedPersonalAccessTokenRequest struct { + // Unique identifier of the request for access via fine-grained personal access token. + ID int64 `json:"id"` + + // Reason is the reason for the request. + Reason string `json:"reason"` + + // Owner is the GitHub user associated with the token. + Owner User `json:"owner"` + + // RepositorySelection is the type of repository selection requested. + // Possible values are: "none", "all", "subset". + RepositorySelection string `json:"repository_selection"` + + // URL to the list of repositories the fine-grained personal access token can access. + // Only follow when `repository_selection` is `subset`. + RepositoriesURL string `json:"repositories_url"` + + // Permissions are the permissions requested, categorized by type. + Permissions PersonalAccessTokenPermissions `json:"permissions"` + + // Date and time when the request was created. + CreatedAt *Timestamp `json:"created_at"` + + // Whether the associated fine-grained personal access token has expired. + TokenExpired bool `json:"token_expired"` + + // Date and time when the associated fine-grained personal access token expires. + TokenExpiresAt *Timestamp `json:"token_expires_at"` + + // TokenID + TokenID int64 `json:"token_id"` + + // TokenName + TokenName string `json:"token_name"` + + // Date and time when the associated fine-grained personal access token was last used for authentication. + TokenLastUsedAt *Timestamp `json:"token_last_used_at"` +} + +// ListFineGrainedPersonalAccessTokenRequests lists requests to access organization resources via fine-grained personal access tokens. +// Only GitHub Apps can call this API, using the `Personal access tokens` organization permissions (read). +// +// GitHub API docs: https://docs.github.com/rest/orgs/personal-access-tokens?apiVersion=2022-11-28#list-requests-to-access-organization-resources-with-fine-grained-personal-access-tokens +// +//meta:operation GET /orgs/{org}/personal-access-token-requests +func (s *OrganizationsService) ListFineGrainedPersonalAccessTokenRequests(ctx context.Context, org string, opts *ListFineGrainedPATOptions) ([]*FineGrainedPersonalAccessTokenRequest, *Response, error) { + u := fmt.Sprintf("orgs/%v/personal-access-token-requests", org) + // The `owner` parameter is a special case that uses the `owner[]=...` format and needs a custom function to format it correctly. + u, err := addListFineGrainedPATOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, opts) + if err != nil { + return nil, nil, err + } + + var pats []*FineGrainedPersonalAccessTokenRequest + resp, err := s.client.Do(req, &pats) if err != nil { return nil, resp, err } @@ -125,40 +198,44 @@ type ReviewPersonalAccessTokenRequestOptions struct { // Only GitHub Apps can call this API, using the `organization_personal_access_token_requests: write` permission. // `action` can be one of `approve` or `deny`. // -// GitHub API docs: https://docs.github.com/rest/orgs/personal-access-tokens#review-a-request-to-access-organization-resources-with-a-fine-grained-personal-access-token +// GitHub API docs: https://docs.github.com/rest/orgs/personal-access-tokens?apiVersion=2022-11-28#review-a-request-to-access-organization-resources-with-a-fine-grained-personal-access-token // //meta:operation POST /orgs/{org}/personal-access-token-requests/{pat_request_id} func (s *OrganizationsService) ReviewPersonalAccessTokenRequest(ctx context.Context, org string, requestID int64, opts ReviewPersonalAccessTokenRequestOptions) (*Response, error) { u := fmt.Sprintf("orgs/%v/personal-access-token-requests/%v", org, requestID) - req, err := s.client.NewRequest(http.MethodPost, u, &opts) + req, err := s.client.NewRequest(ctx, "POST", u, &opts) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } -// addListFineGrainedPATOptions adds the owner parameter to the URL query string with the correct format if it is set. +// addListFineGrainedPATOptions adds the owner and token_id parameters to the URL query string with the correct format if they are set. // // GitHub API expects the owner parameter to be a list of strings in the `owner[]=...` format. -// For multiple owner values, the owner parameter is repeated in the query string. +// For multiple owner and token_id values, the owner and token_id parameters are repeated in the query string. // // Example: -// owner[]=user1&owner[]=user2 -// This will filter the results to only include fine-grained personal access tokens owned by `user1` and `user2`. +// owner[]=user1&owner[]=user2&token_id[]=123&token_id[]=456 +// This will filter the results to only include fine-grained personal access tokens owned by `user1` and `user2` and with token IDs `123` and `456`. // -// This function ensures the owner parameter is formatted correctly in the URL query string. +// This function ensures the owner and token_id parameters are formatted correctly in the URL query string. func addListFineGrainedPATOptions(s string, opts *ListFineGrainedPATOptions) (string, error) { u, err := addOptions(s, opts) if err != nil { return s, err } + if opts == nil { + return "", errors.New("opts must be provided") + } + if len(opts.Owner) > 0 { ownerVals := make([]string, len(opts.Owner)) for i, owner := range opts.Owner { - ownerVals[i] = fmt.Sprintf("owner[]=%s", url.QueryEscape(owner)) + ownerVals[i] = fmt.Sprintf("owner[]=%v", url.QueryEscape(owner)) } ownerQuery := strings.Join(ownerVals, "&") @@ -168,6 +245,20 @@ func addListFineGrainedPATOptions(s string, opts *ListFineGrainedPATOptions) (st u += "?" + ownerQuery } } + if len(opts.TokenID) > 0 { + tokenIDVals := make([]string, len(opts.TokenID)) + for i, tokenID := range opts.TokenID { + tokenIDVals[i] = fmt.Sprintf("token_id[]=%v", url.QueryEscape(strconv.FormatInt(tokenID, 10))) + } + tokenIDQuery := strings.Join(tokenIDVals, "&") + + if strings.Contains(u, "?") { + u += "&" + tokenIDQuery + } else { + u += "?" + tokenIDQuery + } + return u, nil + } return u, nil } diff --git a/vendor/github.com/google/go-github/v73/github/orgs_properties.go b/vendor/github.com/google/go-github/v88/github/orgs_properties.go similarity index 69% rename from vendor/github.com/google/go-github/v73/github/orgs_properties.go rename to vendor/github.com/google/go-github/v88/github/orgs_properties.go index 257e76599..d45ba463a 100644 --- a/vendor/github.com/google/go-github/v73/github/orgs_properties.go +++ b/vendor/github.com/google/go-github/v88/github/orgs_properties.go @@ -10,6 +10,19 @@ import ( "encoding/json" "errors" "fmt" + "strconv" +) + +// PropertyValueType represents the type of a custom property value. +type PropertyValueType string + +// Valid values for CustomProperty.ValueType. +const ( + PropertyValueTypeString PropertyValueType = "string" + PropertyValueTypeSingleSelect PropertyValueType = "single_select" + PropertyValueTypeMultiSelect PropertyValueType = "multi_select" + PropertyValueTypeTrueFalse PropertyValueType = "true_false" + PropertyValueTypeURL PropertyValueType = "url" ) // CustomProperty represents an organization custom property object. @@ -17,14 +30,16 @@ type CustomProperty struct { // PropertyName is required for most endpoints except when calling CreateOrUpdateCustomProperty; // where this is sent in the path and thus can be omitted. PropertyName *string `json:"property_name,omitempty"` + // The URL that can be used to fetch, update, or delete info about this property via the API. + URL *string `json:"url,omitempty"` // SourceType is the source type of the property where it has been created. Can be one of: organization, enterprise. SourceType *string `json:"source_type,omitempty"` - // The type of the value for the property. Can be one of: string, single_select, multi_select, true_false. - ValueType string `json:"value_type"` + // The type of the value for the property. Can be one of: string, single_select, multi_select, true_false, url. + ValueType PropertyValueType `json:"value_type"` // Whether the property is required. Required *bool `json:"required,omitempty"` // Default value of the property. - DefaultValue *string `json:"default_value,omitempty"` + DefaultValue any `json:"default_value,omitempty"` // Short description of the property. Description *string `json:"description,omitempty"` // An ordered list of the allowed values of the property. The property can have up to 200 @@ -34,6 +49,56 @@ type CustomProperty struct { ValuesEditableBy *string `json:"values_editable_by,omitempty"` } +// DefaultValueString returns the DefaultValue as a string if the ValueType is string or single_select or url. +func (cp CustomProperty) DefaultValueString() (string, bool) { + switch cp.ValueType { + case PropertyValueTypeString, PropertyValueTypeSingleSelect, PropertyValueTypeURL: + s, ok := cp.DefaultValue.(string) + return s, ok + default: + return "", false + } +} + +// DefaultValueStrings returns the DefaultValue as a slice of string if the ValueType is multi_select. +func (cp CustomProperty) DefaultValueStrings() ([]string, bool) { + switch cp.ValueType { + case PropertyValueTypeMultiSelect: + switch v := cp.DefaultValue.(type) { + case []string: + return v, true + case []any: + vals := make([]string, len(v)) + for i, item := range v { + s, ok := item.(string) + if !ok { + return nil, false + } + vals[i] = s + } + return vals, true + default: + return nil, false + } + default: + return nil, false + } +} + +// DefaultValueBool returns the DefaultValue as a string if the ValueType is true_false. +func (cp CustomProperty) DefaultValueBool() (bool, bool) { + switch cp.ValueType { + case PropertyValueTypeTrueFalse: + if s, ok := cp.DefaultValue.(string); ok { + b, err := strconv.ParseBool(s) + return b, err == nil + } + return false, false + default: + return false, false + } +} + // RepoCustomPropertyValue represents a repository custom property value. type RepoCustomPropertyValue struct { RepositoryID int64 `json:"repository_id"` @@ -91,19 +156,19 @@ func (cpv *CustomPropertyValue) UnmarshalJSON(data []byte) error { // GetAllCustomProperties gets all custom properties that are defined for the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#get-all-custom-properties-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties?apiVersion=2022-11-28#get-all-custom-properties-for-an-organization // //meta:operation GET /orgs/{org}/properties/schema func (s *OrganizationsService) GetAllCustomProperties(ctx context.Context, org string) ([]*CustomProperty, *Response, error) { u := fmt.Sprintf("orgs/%v/properties/schema", org) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var customProperties []*CustomProperty - resp, err := s.client.Do(ctx, req, &customProperties) + resp, err := s.client.Do(req, &customProperties) if err != nil { return nil, resp, err } @@ -113,7 +178,7 @@ func (s *OrganizationsService) GetAllCustomProperties(ctx context.Context, org s // CreateOrUpdateCustomProperties creates new or updates existing custom properties that are defined for the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#create-or-update-custom-properties-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties?apiVersion=2022-11-28#create-or-update-custom-properties-for-an-organization // //meta:operation PATCH /orgs/{org}/properties/schema func (s *OrganizationsService) CreateOrUpdateCustomProperties(ctx context.Context, org string, properties []*CustomProperty) ([]*CustomProperty, *Response, error) { @@ -125,13 +190,13 @@ func (s *OrganizationsService) CreateOrUpdateCustomProperties(ctx context.Contex Properties: properties, } - req, err := s.client.NewRequest("PATCH", u, params) + req, err := s.client.NewRequest(ctx, "PATCH", u, params) if err != nil { return nil, nil, err } var customProperties []*CustomProperty - resp, err := s.client.Do(ctx, req, &customProperties) + resp, err := s.client.Do(req, &customProperties) if err != nil { return nil, resp, err } @@ -141,19 +206,19 @@ func (s *OrganizationsService) CreateOrUpdateCustomProperties(ctx context.Contex // GetCustomProperty gets a custom property that is defined for the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#get-a-custom-property-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties?apiVersion=2022-11-28#get-a-custom-property-for-an-organization // //meta:operation GET /orgs/{org}/properties/schema/{custom_property_name} func (s *OrganizationsService) GetCustomProperty(ctx context.Context, org, name string) (*CustomProperty, *Response, error) { u := fmt.Sprintf("orgs/%v/properties/schema/%v", org, name) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var customProperty *CustomProperty - resp, err := s.client.Do(ctx, req, &customProperty) + resp, err := s.client.Do(req, &customProperty) if err != nil { return nil, resp, err } @@ -163,19 +228,19 @@ func (s *OrganizationsService) GetCustomProperty(ctx context.Context, org, name // CreateOrUpdateCustomProperty creates a new or updates an existing custom property that is defined for the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#create-or-update-a-custom-property-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties?apiVersion=2022-11-28#create-or-update-a-custom-property-for-an-organization // //meta:operation PUT /orgs/{org}/properties/schema/{custom_property_name} func (s *OrganizationsService) CreateOrUpdateCustomProperty(ctx context.Context, org, customPropertyName string, property *CustomProperty) (*CustomProperty, *Response, error) { u := fmt.Sprintf("orgs/%v/properties/schema/%v", org, customPropertyName) - req, err := s.client.NewRequest("PUT", u, property) + req, err := s.client.NewRequest(ctx, "PUT", u, property) if err != nil { return nil, nil, err } var customProperty *CustomProperty - resp, err := s.client.Do(ctx, req, &customProperty) + resp, err := s.client.Do(req, &customProperty) if err != nil { return nil, resp, err } @@ -185,23 +250,23 @@ func (s *OrganizationsService) CreateOrUpdateCustomProperty(ctx context.Context, // RemoveCustomProperty removes a custom property that is defined for the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#remove-a-custom-property-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties?apiVersion=2022-11-28#remove-a-custom-property-for-an-organization // //meta:operation DELETE /orgs/{org}/properties/schema/{custom_property_name} func (s *OrganizationsService) RemoveCustomProperty(ctx context.Context, org, customPropertyName string) (*Response, error) { u := fmt.Sprintf("orgs/%v/properties/schema/%v", org, customPropertyName) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListCustomPropertyValues lists all custom property values for repositories in the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#list-custom-property-values-for-organization-repositories +// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties?apiVersion=2022-11-28#list-custom-property-values-for-organization-repositories // //meta:operation GET /orgs/{org}/properties/values func (s *OrganizationsService) ListCustomPropertyValues(ctx context.Context, org string, opts *ListCustomPropertyValuesOptions) ([]*RepoCustomPropertyValue, *Response, error) { @@ -211,13 +276,13 @@ func (s *OrganizationsService) ListCustomPropertyValues(ctx context.Context, org return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var repoCustomPropertyValues []*RepoCustomPropertyValue - resp, err := s.client.Do(ctx, req, &repoCustomPropertyValues) + resp, err := s.client.Do(req, &repoCustomPropertyValues) if err != nil { return nil, resp, err } @@ -227,7 +292,7 @@ func (s *OrganizationsService) ListCustomPropertyValues(ctx context.Context, org // CreateOrUpdateRepoCustomPropertyValues creates new or updates existing custom property values across multiple repositories for the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#create-or-update-custom-property-values-for-organization-repositories +// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties?apiVersion=2022-11-28#create-or-update-custom-property-values-for-organization-repositories // //meta:operation PATCH /orgs/{org}/properties/values func (s *OrganizationsService) CreateOrUpdateRepoCustomPropertyValues(ctx context.Context, org string, repoNames []string, properties []*CustomPropertyValue) (*Response, error) { @@ -241,10 +306,10 @@ func (s *OrganizationsService) CreateOrUpdateRepoCustomPropertyValues(ctx contex Properties: properties, } - req, err := s.client.NewRequest("PATCH", u, params) + req, err := s.client.NewRequest(ctx, "PATCH", u, params) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/orgs_rules.go b/vendor/github.com/google/go-github/v88/github/orgs_rules.go similarity index 53% rename from vendor/github.com/google/go-github/v73/github/orgs_rules.go rename to vendor/github.com/google/go-github/v88/github/orgs_rules.go index 357eb8ce7..308afe2a1 100644 --- a/vendor/github.com/google/go-github/v73/github/orgs_rules.go +++ b/vendor/github.com/google/go-github/v88/github/orgs_rules.go @@ -10,12 +10,12 @@ import ( "fmt" ) -// GetAllRepositoryRulesets gets all the repository rulesets for the specified organization. +// ListAllRepositoryRulesets gets all the repository rulesets for the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/rules#get-all-organization-repository-rulesets +// GitHub API docs: https://docs.github.com/rest/orgs/rules?apiVersion=2022-11-28#get-all-organization-repository-rulesets // //meta:operation GET /orgs/{org}/rulesets -func (s *OrganizationsService) GetAllRepositoryRulesets(ctx context.Context, org string, opts *ListOptions) ([]*RepositoryRuleset, *Response, error) { +func (s *OrganizationsService) ListAllRepositoryRulesets(ctx context.Context, org string, opts *ListOptions) ([]*RepositoryRuleset, *Response, error) { u := fmt.Sprintf("orgs/%v/rulesets", org) u, err := addOptions(u, opts) @@ -23,13 +23,13 @@ func (s *OrganizationsService) GetAllRepositoryRulesets(ctx context.Context, org return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var rulesets []*RepositoryRuleset - resp, err := s.client.Do(ctx, req, &rulesets) + resp, err := s.client.Do(req, &rulesets) if err != nil { return nil, resp, err } @@ -39,19 +39,19 @@ func (s *OrganizationsService) GetAllRepositoryRulesets(ctx context.Context, org // CreateRepositoryRuleset creates a repository ruleset for the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/rules#create-an-organization-repository-ruleset +// GitHub API docs: https://docs.github.com/rest/orgs/rules?apiVersion=2022-11-28#create-an-organization-repository-ruleset // //meta:operation POST /orgs/{org}/rulesets func (s *OrganizationsService) CreateRepositoryRuleset(ctx context.Context, org string, ruleset RepositoryRuleset) (*RepositoryRuleset, *Response, error) { u := fmt.Sprintf("orgs/%v/rulesets", org) - req, err := s.client.NewRequest("POST", u, ruleset) + req, err := s.client.NewRequest(ctx, "POST", u, ruleset) if err != nil { return nil, nil, err } var rs *RepositoryRuleset - resp, err := s.client.Do(ctx, req, &rs) + resp, err := s.client.Do(req, &rs) if err != nil { return nil, resp, err } @@ -61,19 +61,19 @@ func (s *OrganizationsService) CreateRepositoryRuleset(ctx context.Context, org // GetRepositoryRuleset gets a repository ruleset for the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/rules#get-an-organization-repository-ruleset +// GitHub API docs: https://docs.github.com/rest/orgs/rules?apiVersion=2022-11-28#get-an-organization-repository-ruleset // //meta:operation GET /orgs/{org}/rulesets/{ruleset_id} func (s *OrganizationsService) GetRepositoryRuleset(ctx context.Context, org string, rulesetID int64) (*RepositoryRuleset, *Response, error) { u := fmt.Sprintf("orgs/%v/rulesets/%v", org, rulesetID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var ruleset *RepositoryRuleset - resp, err := s.client.Do(ctx, req, &ruleset) + resp, err := s.client.Do(req, &ruleset) if err != nil { return nil, resp, err } @@ -83,19 +83,19 @@ func (s *OrganizationsService) GetRepositoryRuleset(ctx context.Context, org str // UpdateRepositoryRuleset updates a repository ruleset for the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/rules#update-an-organization-repository-ruleset +// GitHub API docs: https://docs.github.com/rest/orgs/rules?apiVersion=2022-11-28#update-an-organization-repository-ruleset // //meta:operation PUT /orgs/{org}/rulesets/{ruleset_id} func (s *OrganizationsService) UpdateRepositoryRuleset(ctx context.Context, org string, rulesetID int64, ruleset RepositoryRuleset) (*RepositoryRuleset, *Response, error) { u := fmt.Sprintf("orgs/%v/rulesets/%v", org, rulesetID) - req, err := s.client.NewRequest("PUT", u, ruleset) + req, err := s.client.NewRequest(ctx, "PUT", u, ruleset) if err != nil { return nil, nil, err } var rs *RepositoryRuleset - resp, err := s.client.Do(ctx, req, &rs) + resp, err := s.client.Do(req, &rs) if err != nil { return nil, resp, err } @@ -103,43 +103,18 @@ func (s *OrganizationsService) UpdateRepositoryRuleset(ctx context.Context, org return rs, resp, nil } -// UpdateRepositoryRulesetClearBypassActor clears the bypass actors for a repository ruleset for the specified organization. -// -// This function is necessary as the UpdateRepositoryRuleset function does not marshal ByPassActor if passed as an empty array. -// -// GitHub API docs: https://docs.github.com/rest/orgs/rules#update-an-organization-repository-ruleset -// -//meta:operation PUT /orgs/{org}/rulesets/{ruleset_id} -func (s *OrganizationsService) UpdateRepositoryRulesetClearBypassActor(ctx context.Context, org string, rulesetID int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/rulesets/%v", org, rulesetID) - - rsClearBypassActor := rulesetClearBypassActors{} - - req, err := s.client.NewRequest("PUT", u, rsClearBypassActor) - if err != nil { - return nil, err - } - - resp, err := s.client.Do(ctx, req, nil) - if err != nil { - return resp, err - } - - return resp, nil -} - // DeleteRepositoryRuleset deletes a repository ruleset from the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/rules#delete-an-organization-repository-ruleset +// GitHub API docs: https://docs.github.com/rest/orgs/rules?apiVersion=2022-11-28#delete-an-organization-repository-ruleset // //meta:operation DELETE /orgs/{org}/rulesets/{ruleset_id} func (s *OrganizationsService) DeleteRepositoryRuleset(ctx context.Context, org string, rulesetID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/rulesets/%v", org, rulesetID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/orgs_security_managers.go b/vendor/github.com/google/go-github/v88/github/orgs_security_managers.go similarity index 81% rename from vendor/github.com/google/go-github/v73/github/orgs_security_managers.go rename to vendor/github.com/google/go-github/v88/github/orgs_security_managers.go index b8562a2fd..088a5700a 100644 --- a/vendor/github.com/google/go-github/v73/github/orgs_security_managers.go +++ b/vendor/github.com/google/go-github/v88/github/orgs_security_managers.go @@ -14,19 +14,19 @@ import ( // // Deprecated: Please use `client.Organizations.ListTeamsAssignedToOrgRole` instead. // -// GitHub API docs: https://docs.github.com/rest/orgs/security-managers#list-security-manager-teams +// GitHub API docs: https://docs.github.com/rest/orgs/security-managers?apiVersion=2022-11-28#list-security-manager-teams // //meta:operation GET /orgs/{org}/security-managers func (s *OrganizationsService) ListSecurityManagerTeams(ctx context.Context, org string) ([]*Team, *Response, error) { u := fmt.Sprintf("orgs/%v/security-managers", org) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var teams []*Team - resp, err := s.client.Do(ctx, req, &teams) + resp, err := s.client.Do(req, &teams) if err != nil { return nil, resp, err } @@ -38,32 +38,32 @@ func (s *OrganizationsService) ListSecurityManagerTeams(ctx context.Context, org // // Deprecated: Please use `client.Organizations.AssignOrgRoleToTeam` instead. // -// GitHub API docs: https://docs.github.com/rest/orgs/security-managers#add-a-security-manager-team +// GitHub API docs: https://docs.github.com/rest/orgs/security-managers?apiVersion=2022-11-28#add-a-security-manager-team // //meta:operation PUT /orgs/{org}/security-managers/teams/{team_slug} func (s *OrganizationsService) AddSecurityManagerTeam(ctx context.Context, org, team string) (*Response, error) { u := fmt.Sprintf("orgs/%v/security-managers/teams/%v", org, team) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RemoveSecurityManagerTeam removes a team from the list of security managers for an organization. // // Deprecated: Please use `client.Organizations.RemoveOrgRoleFromTeam` instead. // -// GitHub API docs: https://docs.github.com/rest/orgs/security-managers#remove-a-security-manager-team +// GitHub API docs: https://docs.github.com/rest/orgs/security-managers?apiVersion=2022-11-28#remove-a-security-manager-team // //meta:operation DELETE /orgs/{org}/security-managers/teams/{team_slug} func (s *OrganizationsService) RemoveSecurityManagerTeam(ctx context.Context, org, team string) (*Response, error) { u := fmt.Sprintf("orgs/%v/security-managers/teams/%v", org, team) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/orgs_users_blocking.go b/vendor/github.com/google/go-github/v88/github/orgs_users_blocking.go similarity index 61% rename from vendor/github.com/google/go-github/v73/github/orgs_users_blocking.go rename to vendor/github.com/google/go-github/v88/github/orgs_users_blocking.go index 62bd9116c..62d578c93 100644 --- a/vendor/github.com/google/go-github/v73/github/orgs_users_blocking.go +++ b/vendor/github.com/google/go-github/v88/github/orgs_users_blocking.go @@ -12,7 +12,7 @@ import ( // ListBlockedUsers lists all the users blocked by an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/blocking#list-users-blocked-by-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/blocking?apiVersion=2022-11-28#list-users-blocked-by-an-organization // //meta:operation GET /orgs/{org}/blocks func (s *OrganizationsService) ListBlockedUsers(ctx context.Context, org string, opts *ListOptions) ([]*User, *Response, error) { @@ -22,16 +22,15 @@ func (s *OrganizationsService) ListBlockedUsers(ctx context.Context, org string, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeBlockUsersPreview) var blockedUsers []*User - resp, err := s.client.Do(ctx, req, &blockedUsers) + resp, err := s.client.Do(req, &blockedUsers) if err != nil { return nil, resp, err } @@ -41,59 +40,56 @@ func (s *OrganizationsService) ListBlockedUsers(ctx context.Context, org string, // IsBlocked reports whether specified user is blocked from an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/blocking#check-if-a-user-is-blocked-by-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/blocking?apiVersion=2022-11-28#check-if-a-user-is-blocked-by-an-organization // //meta:operation GET /orgs/{org}/blocks/{username} -func (s *OrganizationsService) IsBlocked(ctx context.Context, org string, user string) (bool, *Response, error) { +func (s *OrganizationsService) IsBlocked(ctx context.Context, org, user string) (bool, *Response, error) { u := fmt.Sprintf("orgs/%v/blocks/%v", org, user) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return false, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeBlockUsersPreview) - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) isBlocked, err := parseBoolResponse(err) return isBlocked, resp, err } // BlockUser blocks specified user from an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/blocking#block-a-user-from-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/blocking?apiVersion=2022-11-28#block-a-user-from-an-organization // //meta:operation PUT /orgs/{org}/blocks/{username} -func (s *OrganizationsService) BlockUser(ctx context.Context, org string, user string) (*Response, error) { +func (s *OrganizationsService) BlockUser(ctx context.Context, org, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/blocks/%v", org, user) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeBlockUsersPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // UnblockUser unblocks specified user from an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/blocking#unblock-a-user-from-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/blocking?apiVersion=2022-11-28#unblock-a-user-from-an-organization // //meta:operation DELETE /orgs/{org}/blocks/{username} -func (s *OrganizationsService) UnblockUser(ctx context.Context, org string, user string) (*Response, error) { +func (s *OrganizationsService) UnblockUser(ctx context.Context, org, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/blocks/%v", org, user) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeBlockUsersPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/packages.go b/vendor/github.com/google/go-github/v88/github/packages.go similarity index 99% rename from vendor/github.com/google/go-github/v73/github/packages.go rename to vendor/github.com/google/go-github/v88/github/packages.go index cc04a044d..0ad0ed69e 100644 --- a/vendor/github.com/google/go-github/v73/github/packages.go +++ b/vendor/github.com/google/go-github/v88/github/packages.go @@ -264,7 +264,7 @@ func (mt PackageEventContainerMetadataTag) String() string { // PackageNugetMetadata represents nuget metadata for a GitHub package. type PackageNugetMetadata struct { - ID json.RawMessage `json:"id,omitempty"` // Can either be a int64 or string + ID json.RawMessage `json:"id,omitempty"` // Can either be an int64 or string Name *string `json:"name,omitempty"` Value json.RawMessage `json:"value,omitempty"` // Can either be a bool, string, integer or object } diff --git a/vendor/github.com/google/go-github/v88/github/private_registries.go b/vendor/github.com/google/go-github/v88/github/private_registries.go new file mode 100644 index 000000000..d1899f4f9 --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/private_registries.go @@ -0,0 +1,362 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// PrivateRegistriesService handles communication with the private registries +// methods of the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/private-registries?apiVersion=2026-03-10 +type PrivateRegistriesService service + +// PrivateRegistryType represents the type of private registry. +type PrivateRegistryType string + +const ( + PrivateRegistryTypeMavenRepository PrivateRegistryType = "maven_repository" + PrivateRegistryTypeNugetFeed PrivateRegistryType = "nuget_feed" + PrivateRegistryTypeGoProxyServer PrivateRegistryType = "goproxy_server" + PrivateRegistryTypeNpmRegistry PrivateRegistryType = "npm_registry" + PrivateRegistryTypeRubygemsServer PrivateRegistryType = "rubygems_server" + PrivateRegistryTypeCargoRegistry PrivateRegistryType = "cargo_registry" + PrivateRegistryTypeComposerRepository PrivateRegistryType = "composer_repository" + PrivateRegistryTypeDockerRegistry PrivateRegistryType = "docker_registry" + PrivateRegistryTypeGitSource PrivateRegistryType = "git_source" + PrivateRegistryTypeHelmRegistry PrivateRegistryType = "helm_registry" + PrivateRegistryTypeHexOrganization PrivateRegistryType = "hex_organization" + PrivateRegistryTypeHexRepository PrivateRegistryType = "hex_repository" + PrivateRegistryTypePubRepository PrivateRegistryType = "pub_repository" + PrivateRegistryTypePythonIndex PrivateRegistryType = "python_index" + PrivateRegistryTypeTerraformRegistry PrivateRegistryType = "terraform_registry" +) + +// PrivateRegistryVisibility represents the visibility of a private registry. +type PrivateRegistryVisibility string + +const ( + PrivateRegistryVisibilityPrivate PrivateRegistryVisibility = "private" + PrivateRegistryVisibilityAll PrivateRegistryVisibility = "all" + PrivateRegistryVisibilitySelected PrivateRegistryVisibility = "selected" +) + +// PrivateRegistryAuthType represents the authentication type for a private registry. +type PrivateRegistryAuthType string + +const ( + PrivateRegistryAuthTypeToken PrivateRegistryAuthType = "token" + PrivateRegistryAuthTypeUsernamePassword PrivateRegistryAuthType = "username_password" + PrivateRegistryAuthTypeOIDCAzure PrivateRegistryAuthType = "oidc_azure" + PrivateRegistryAuthTypeOIDCAWS PrivateRegistryAuthType = "oidc_aws" + PrivateRegistryAuthTypeOIDCJFrog PrivateRegistryAuthType = "oidc_jfrog" +) + +// PrivateRegistry represents a private registry configuration. +type PrivateRegistry struct { + // Name of the private registry. + Name *string `json:"name,omitempty"` + // RegistryType is the type of private registry. You can find the list of supported types in PrivateRegistryType. + RegistryType *PrivateRegistryType `json:"registry_type,omitempty"` + // AuthType is the authentication type for the private registry. + AuthType *PrivateRegistryAuthType `json:"auth_type,omitempty"` + // URL is the URL of the private registry. + URL *string `json:"url,omitempty"` + // Username to use when authenticating with the private registry. + // This field is omitted if the private registry does not require a username for authentication. + Username *string `json:"username,omitempty"` + // ReplacesBase indicates whether this private registry should replace the base registry. + ReplacesBase *bool `json:"replaces_base,omitempty"` + // Visibility is the visibility of the private registry. Possible values are: "private", "all", and "selected". + Visibility *PrivateRegistryVisibility `json:"visibility,omitempty"` + // SelectedRepositoryIDs is an array of repository IDs that can access the organization private registry. + SelectedRepositoryIDs []int64 `json:"selected_repository_ids,omitempty"` + // TenantID is the tenant ID of the Azure AD application. + TenantID *string `json:"tenant_id,omitempty"` + // ClientID is the client ID of the Azure AD application. + ClientID *string `json:"client_id,omitempty"` + // AWSRegion is the AWS region. + AWSRegion *string `json:"aws_region,omitempty"` + // AccountID is the AWS account ID. + AccountID *string `json:"account_id,omitempty"` + // RoleName is the AWS IAM role name. + RoleName *string `json:"role_name,omitempty"` + // Domain is the CodeArtifact domain. + Domain *string `json:"domain,omitempty"` + // DomainOwner is the CodeArtifact domain owner. + DomainOwner *string `json:"domain_owner,omitempty"` + // JFrogOIDCProviderName is the JFrog OIDC provider name. + JFrogOIDCProviderName *string `json:"jfrog_oidc_provider_name,omitempty"` + // Audience is the OIDC audience. + Audience *string `json:"audience,omitempty"` + // IdentityMappingName is the JFrog identity mapping name. + IdentityMappingName *string `json:"identity_mapping_name,omitempty"` + // CreatedAt is the timestamp when the private registry was created. + CreatedAt *Timestamp `json:"created_at,omitempty"` + // UpdatedAt is the timestamp when the private registry was last updated. + UpdatedAt *Timestamp `json:"updated_at,omitempty"` +} + +// PrivateRegistries represents a list of private registries. +type PrivateRegistries struct { + // TotalCount is the total number of private registries. + TotalCount *int `json:"total_count,omitempty"` + // Configurations is the list of private registry configurations. + Configurations []*PrivateRegistry `json:"configurations,omitempty"` +} + +// CreateOrganizationPrivateRegistry represents the payload to create a private registry. +type CreateOrganizationPrivateRegistry struct { + // RegistryType is the type of private registry. + // You can find the list of supported types in PrivateRegistryType. + RegistryType PrivateRegistryType `json:"registry_type"` + + // URL is the URL of the private registry. + URL string `json:"url"` + + // The username to use when authenticating with the private registry. + // This field should be omitted if the private registry does not require a username for authentication. + Username *string `json:"username,omitempty"` + + // ReplacesBase indicates whether this private registry should replace the base registry + // (e.g., npmjs.org for npm, rubygems.org for rubygems). + ReplacesBase *bool `json:"replaces_base,omitempty"` + + // The value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) + // using the public key retrieved from the PrivateRegistriesService.GetOrganizationPrivateRegistriesPublicKey. + // Required when AuthType is "token" or "username_password". Should be omitted for OIDC auth types. + EncryptedValue *string `json:"encrypted_value,omitempty"` + // KeyID is the ID of the public key used to encrypt the secret. + // Required when AuthType is "token" or "username_password". Should be omitted for OIDC auth types. + KeyID *string `json:"key_id,omitempty"` + // Visibility is the visibility of the private registry. + // Possible values are: "private", "all", and "selected". + Visibility PrivateRegistryVisibility `json:"visibility"` + + // An array of repository IDs that can access the organization private registry. + // You can only provide a list of repository IDs when CreateOrganizationPrivateRegistry.Visibility is set to PrivateRegistryVisibilitySelected. + // This field should be omitted if visibility is set to PrivateRegistryVisibilityAll or PrivateRegistryVisibilityPrivate. + SelectedRepositoryIDs []int64 `json:"selected_repository_ids,omitempty"` + + // AuthType is the authentication type for the private registry. + // Defaults to "token" if not specified. Use "oidc_azure", "oidc_aws", or "oidc_jfrog" for OIDC authentication. + AuthType *string `json:"auth_type,omitempty"` + + // TenantID is the tenant ID of the Azure AD application. Required when AuthType is "oidc_azure". + TenantID *string `json:"tenant_id,omitempty"` + // ClientID is the client ID of the Azure AD application. Required when AuthType is "oidc_azure". + ClientID *string `json:"client_id,omitempty"` + + // AWSRegion is the AWS region. Required when AuthType is "oidc_aws". + AWSRegion *string `json:"aws_region,omitempty"` + // AccountID is the AWS account ID. Required when AuthType is "oidc_aws". + AccountID *string `json:"account_id,omitempty"` + // RoleName is the AWS IAM role name. Required when AuthType is "oidc_aws". + RoleName *string `json:"role_name,omitempty"` + // Domain is the CodeArtifact domain. Required when AuthType is "oidc_aws". + Domain *string `json:"domain,omitempty"` + // DomainOwner is the CodeArtifact domain owner (AWS account ID). Required when AuthType is "oidc_aws". + DomainOwner *string `json:"domain_owner,omitempty"` + + // JFrogOIDCProviderName is the JFrog OIDC provider name. Required when AuthType is "oidc_jfrog". + JFrogOIDCProviderName *string `json:"jfrog_oidc_provider_name,omitempty"` + + // Audience is the OIDC audience. Optional for "oidc_aws" and "oidc_jfrog" auth types. + Audience *string `json:"audience,omitempty"` + // IdentityMappingName is the JFrog identity mapping name. Optional for "oidc_jfrog" auth type. + IdentityMappingName *string `json:"identity_mapping_name,omitempty"` +} + +// UpdateOrganizationPrivateRegistry represents the payload to update a private registry. +type UpdateOrganizationPrivateRegistry struct { + // RegistryType is the type of private registry. + // You can find the list of supported types in PrivateRegistryType. + RegistryType *PrivateRegistryType `json:"registry_type,omitempty"` + + // URL is the URL of the private registry. + URL *string `json:"url,omitempty"` + + // The username to use when authenticating with the private registry. + // This field should be omitted if the private registry does not require a username for authentication. + Username *string `json:"username,omitempty"` + + // ReplacesBase indicates whether this private registry should replace the base registry + // (e.g., npmjs.org for npm, rubygems.org for rubygems). + ReplacesBase *bool `json:"replaces_base,omitempty"` + + // The value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) + // using the public key retrieved from the PrivateRegistriesService.GetOrganizationPrivateRegistriesPublicKey. + EncryptedValue *string `json:"encrypted_value,omitempty"` + // KeyID is the ID of the public key used to encrypt the secret. + KeyID *string `json:"key_id,omitempty"` + // Visibility is the visibility of the private registry. + // Possible values are: "private", "all", and "selected". + Visibility *PrivateRegistryVisibility `json:"visibility,omitempty"` + + // An array of repository IDs that can access the organization private registry. + // You can only provide a list of repository IDs when UpdateOrganizationPrivateRegistry.Visibility is set to PrivateRegistryVisibilitySelected. + // This field should be omitted if visibility is set to PrivateRegistryVisibilityAll or PrivateRegistryVisibilityPrivate. + SelectedRepositoryIDs []int64 `json:"selected_repository_ids,omitempty"` + + // AuthType is the authentication type for the private registry. + // This field cannot be changed after creation. If provided, it must match the existing auth_type. + AuthType *string `json:"auth_type,omitempty"` + + // TenantID is the tenant ID of the Azure AD application. Required when AuthType is "oidc_azure". + TenantID *string `json:"tenant_id,omitempty"` + // ClientID is the client ID of the Azure AD application. Required when AuthType is "oidc_azure". + ClientID *string `json:"client_id,omitempty"` + + // AWSRegion is the AWS region. Required when AuthType is "oidc_aws". + AWSRegion *string `json:"aws_region,omitempty"` + // AccountID is the AWS account ID. Required when AuthType is "oidc_aws". + AccountID *string `json:"account_id,omitempty"` + // RoleName is the AWS IAM role name. Required when AuthType is "oidc_aws". + RoleName *string `json:"role_name,omitempty"` + // Domain is the CodeArtifact domain. Required when AuthType is "oidc_aws". + Domain *string `json:"domain,omitempty"` + // DomainOwner is the CodeArtifact domain owner (AWS account ID). Required when AuthType is "oidc_aws". + DomainOwner *string `json:"domain_owner,omitempty"` + + // JFrogOIDCProviderName is the JFrog OIDC provider name. Required when AuthType is "oidc_jfrog". + JFrogOIDCProviderName *string `json:"jfrog_oidc_provider_name,omitempty"` + + // Audience is the OIDC audience. Optional for "oidc_aws" and "oidc_jfrog" auth types. + Audience *string `json:"audience,omitempty"` + // IdentityMappingName is the JFrog identity mapping name. Optional for "oidc_jfrog" auth type. + IdentityMappingName *string `json:"identity_mapping_name,omitempty"` +} + +// ListOrganizationPrivateRegistries lists private registries for an organization. +// +// GitHub API docs: https://docs.github.com/rest/private-registries/organization-configurations?apiVersion=2026-03-10#list-private-registries-for-an-organization +// +//meta:operation GET /orgs/{org}/private-registries +func (s *PrivateRegistriesService) ListOrganizationPrivateRegistries(ctx context.Context, org string, opts *ListOptions) (*PrivateRegistries, *Response, error) { + u := fmt.Sprintf("orgs/%v/private-registries", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var privateRegistries PrivateRegistries + resp, err := s.client.Do(req, &privateRegistries) + if err != nil { + return nil, resp, err + } + return &privateRegistries, resp, nil +} + +// CreateOrganizationPrivateRegistry creates a private registry configuration with an encrypted value for an organization. +// +// GitHub API docs: https://docs.github.com/rest/private-registries/organization-configurations?apiVersion=2026-03-10#create-a-private-registry-for-an-organization +// +//meta:operation POST /orgs/{org}/private-registries +func (s *PrivateRegistriesService) CreateOrganizationPrivateRegistry(ctx context.Context, org string, privateRegistry CreateOrganizationPrivateRegistry) (*PrivateRegistry, *Response, error) { + u := fmt.Sprintf("orgs/%v/private-registries", org) + + req, err := s.client.NewRequest(ctx, "POST", u, privateRegistry, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var result PrivateRegistry + resp, err := s.client.Do(req, &result) + if err != nil { + return nil, resp, err + } + return &result, resp, nil +} + +// GetOrganizationPrivateRegistriesPublicKey retrieves the public key for encrypting secrets for an organization's private registries. +// +// GitHub API docs: https://docs.github.com/rest/private-registries/organization-configurations?apiVersion=2026-03-10#get-private-registries-public-key-for-an-organization +// +//meta:operation GET /orgs/{org}/private-registries/public-key +func (s *PrivateRegistriesService) GetOrganizationPrivateRegistriesPublicKey(ctx context.Context, org string) (*PublicKey, *Response, error) { + u := fmt.Sprintf("orgs/%v/private-registries/public-key", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var publicKey PublicKey + resp, err := s.client.Do(req, &publicKey) + if err != nil { + return nil, resp, err + } + return &publicKey, resp, nil +} + +// GetOrganizationPrivateRegistry gets a specific private registry for an organization. +// The `name` parameter is the name of the private registry to retrieve. It is the same as PrivateRegistry.Name. +// +// GitHub API docs: https://docs.github.com/rest/private-registries/organization-configurations?apiVersion=2026-03-10#get-a-private-registry-for-an-organization +// +//meta:operation GET /orgs/{org}/private-registries/{secret_name} +func (s *PrivateRegistriesService) GetOrganizationPrivateRegistry(ctx context.Context, org, secretName string) (*PrivateRegistry, *Response, error) { + u := fmt.Sprintf("orgs/%v/private-registries/%v", org, secretName) + + req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var privateRegistry PrivateRegistry + resp, err := s.client.Do(req, &privateRegistry) + if err != nil { + return nil, resp, err + } + + return &privateRegistry, resp, nil +} + +// UpdateOrganizationPrivateRegistry updates a specific private registry for an organization. +// The `name` parameter is the name of the private registry to update. It is the same as PrivateRegistry.Name. +// +// GitHub API docs: https://docs.github.com/rest/private-registries/organization-configurations?apiVersion=2026-03-10#update-a-private-registry-for-an-organization +// +//meta:operation PATCH /orgs/{org}/private-registries/{secret_name} +func (s *PrivateRegistriesService) UpdateOrganizationPrivateRegistry(ctx context.Context, org, secretName string, privateRegistry UpdateOrganizationPrivateRegistry) (*Response, error) { + u := fmt.Sprintf("orgs/%v/private-registries/%v", org, secretName) + + req, err := s.client.NewRequest(ctx, "PATCH", u, privateRegistry, WithVersion(api20260310)) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// DeleteOrganizationPrivateRegistry deletes a specific private registry for an organization. +// The `name` parameter is the name of the private registry to delete. It is the same as PrivateRegistry.Name. +// +// GitHub API docs: https://docs.github.com/rest/private-registries/organization-configurations?apiVersion=2026-03-10#delete-a-private-registry-for-an-organization +// +//meta:operation DELETE /orgs/{org}/private-registries/{secret_name} +func (s *PrivateRegistriesService) DeleteOrganizationPrivateRegistry(ctx context.Context, org, secretName string) (*Response, error) { + u := fmt.Sprintf("orgs/%v/private-registries/%v", org, secretName) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/vendor/github.com/google/go-github/v88/github/projects.go b/vendor/github.com/google/go-github/v88/github/projects.go new file mode 100644 index 000000000..98574148b --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/projects.go @@ -0,0 +1,730 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "encoding/json" + "fmt" +) + +// ProjectsService handles communication with the project V2 +// methods of the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/projects?apiVersion=2022-11-28 +type ProjectsService service + +// ProjectV2ItemContentType represents the type of content in a ProjectV2Item. +type ProjectV2ItemContentType string + +// This is the set of possible content types for a ProjectV2Item. +const ( + ProjectV2ItemContentTypeDraftIssue ProjectV2ItemContentType = "DraftIssue" + ProjectV2ItemContentTypeIssue ProjectV2ItemContentType = "Issue" + ProjectV2ItemContentTypePullRequest ProjectV2ItemContentType = "PullRequest" +) + +// ProjectV2StatusUpdate represents a status update for a project. +type ProjectV2StatusUpdate struct { + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + ProjectNodeID *string `json:"project_node_id,omitempty"` + Creator *User `json:"creator,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + // Status can be one of: "INACTIVE", "ON_TRACK", "AT_RISK", "OFF_TRACK", "COMPLETE". + Status *string `json:"status,omitempty"` + StartDate *string `json:"start_date,omitempty"` + TargetDate *string `json:"target_date,omitempty"` + Body *string `json:"body,omitempty"` +} + +// ProjectV2DraftIssue represents a draft issue in a project. +type ProjectV2DraftIssue struct { + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Title *string `json:"title,omitempty"` + Body *string `json:"body,omitempty"` + User *User `json:"user,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` +} + +// ProjectV2 represents a v2 project. +type ProjectV2 struct { + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Owner *User `json:"owner,omitempty"` + Creator *User `json:"creator,omitempty"` + Title *string `json:"title,omitempty"` + Description *string `json:"description,omitempty"` + Public *bool `json:"public,omitempty"` + ClosedAt *Timestamp `json:"closed_at,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + DeletedAt *Timestamp `json:"deleted_at,omitempty"` + Number *int `json:"number,omitempty"` + ShortDescription *string `json:"short_description,omitempty"` + DeletedBy *User `json:"deleted_by,omitempty"` + State *string `json:"state,omitempty"` + LatestStatusUpdate *ProjectV2StatusUpdate `json:"latest_status_update,omitempty"` + IsTemplate *bool `json:"is_template,omitempty"` + + // Fields migrated from the Project (classic) struct: + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + ColumnsURL *string `json:"columns_url,omitempty"` + OwnerURL *string `json:"owner_url,omitempty"` + Name *string `json:"name,omitempty"` + Body *string `json:"body,omitempty"` + OrganizationPermission *string `json:"organization_permission,omitempty"` + Private *bool `json:"private,omitempty"` +} + +func (p ProjectV2) String() string { return Stringify(p) } + +// ListProjectsPaginationOptions specifies optional parameters to list projects for user / organization. +// +// Note: Pagination is powered by before/after cursor-style pagination. After the initial call, +// inspect the returned *Response. Use resp.After as the opts.After value to request +// the next page, and resp.Before as the opts.Before value to request the previous +// page. Set either Before or After for a request; if both are +// supplied GitHub API will return an error. PerPage controls the number of items +// per page (max 100 per GitHub API docs). +type ListProjectsPaginationOptions struct { + // A cursor, as given in the Link header. If specified, the query only searches for events before this cursor. + Before string `url:"before,omitempty"` + + // A cursor, as given in the Link header. If specified, the query only searches for events after this cursor. + After string `url:"after,omitempty"` + + // For paginated result sets, the number of results to include per page. + PerPage int `url:"per_page,omitempty"` +} + +// ListProjectsOptions specifies optional parameters to list projects for user / organization. +type ListProjectsOptions struct { + ListProjectsPaginationOptions + + // Q is an optional query string to limit results to projects of the specified type. + Query string `url:"q,omitempty"` +} + +// ProjectV2TextContent represents text content in a project field option or iteration. +// It includes both HTML and raw text representations. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields?apiVersion=2022-11-28 +type ProjectV2TextContent struct { + HTML *string `json:"html,omitempty"` + Raw *string `json:"raw,omitempty"` +} + +// ProjectV2FieldOption represents an option for a project field of type single_select or multi_select. +// It defines the available choices that can be selected for dropdown-style fields. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields?apiVersion=2022-11-28 +type ProjectV2FieldOption struct { + ID *string `json:"id,omitempty"` // The unique identifier for this option. + Color *string `json:"color,omitempty"` // The color associated with this option (e.g., "blue", "red"). + Description *ProjectV2TextContent `json:"description,omitempty"` // An optional description for this option. + Name *ProjectV2TextContent `json:"name,omitempty"` // The display name of the option. +} + +// ProjectV2FieldIteration represents an iteration within a project field of type iteration. +// It defines a specific time-bound period that can be associated with project items. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields?apiVersion=2022-11-28 +type ProjectV2FieldIteration struct { + ID *string `json:"id,omitempty"` // The unique identifier for the iteration. + Title *ProjectV2TextContent `json:"title,omitempty"` // The title of the iteration. + StartDate *string `json:"start_date,omitempty"` // The start date of the iteration in ISO 8601 format. + Duration *int `json:"duration,omitempty"` // The duration of the iteration in seconds. +} + +// ProjectV2FieldConfiguration represents the configuration for a project field of type iteration. +// It defines settings such as duration and start day for iterations within the project. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields?apiVersion=2022-11-28 +type ProjectV2FieldConfiguration struct { + Duration *int `json:"duration,omitempty"` // The duration of the iteration field in seconds. + StartDay *int `json:"start_day,omitempty"` // The start day for the iteration. + Iterations []*ProjectV2FieldIteration `json:"iterations,omitempty"` // The list of iterations associated with the configuration. +} + +// ProjectV2ItemContent is a union type that holds the content of a ProjectV2Item. +// The actual type depends on the ContentType field of the parent ProjectV2Item. +// Only one of the fields will be populated after unmarshaling. +type ProjectV2ItemContent struct { + Issue *Issue `json:"-"` + PullRequest *PullRequest `json:"-"` + DraftIssue *ProjectV2DraftIssue `json:"-"` +} + +// MarshalJSON implements custom marshaling for ProjectV2ItemContent. +func (c ProjectV2ItemContent) MarshalJSON() ([]byte, error) { + if c.Issue != nil { + return json.Marshal(c.Issue) + } + if c.PullRequest != nil { + return json.Marshal(c.PullRequest) + } + if c.DraftIssue != nil { + return json.Marshal(c.DraftIssue) + } + return []byte("null"), nil +} + +// ProjectV2Item represents a full project item with field values. +// This type is used by Get, List, and Update operations which return field values. +// The Content field is automatically unmarshaled into the appropriate type based on ContentType. +type ProjectV2Item struct { + ArchivedAt *Timestamp `json:"archived_at,omitempty"` + Content *ProjectV2ItemContent `json:"content,omitempty"` + ContentType *ProjectV2ItemContentType `json:"content_type,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + Creator *User `json:"creator,omitempty"` + Fields []*ProjectV2ItemFieldValue `json:"fields,omitempty"` + ID *int64 `json:"id,omitempty"` + ItemURL *string `json:"item_url,omitempty"` + NodeID *string `json:"node_id,omitempty"` + ProjectURL *string `json:"project_url,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + + // ProjectNodeID and ContentNodeID are used in ProjectsV2Item Webhook payloads. + // They may not be populated in all API responses, but are included here for completeness. + // See: https://docs.github.com/en/webhooks/webhook-events-and-payloads#projects_v2_item + ProjectNodeID *string `json:"project_node_id,omitempty"` + ContentNodeID *string `json:"content_node_id,omitempty"` +} + +// UnmarshalJSON implements custom unmarshaling for ProjectV2Item. +// It uses the ContentType field to determine how to unmarshal the Content field. +func (p *ProjectV2Item) UnmarshalJSON(data []byte) error { + type contentAlias ProjectV2Item + + aux := &struct { + Content json.RawMessage `json:"content,omitempty"` + *contentAlias + }{ + contentAlias: (*contentAlias)(p), + } + + if err := json.Unmarshal(data, aux); err != nil { + return err + } + + // Now unmarshal the content based on ContentType + if len(aux.Content) > 0 && string(aux.Content) != "null" && p.ContentType != nil { + p.Content = &ProjectV2ItemContent{} + switch *p.ContentType { + case ProjectV2ItemContentTypeIssue: + p.Content.Issue = &Issue{} + return json.Unmarshal(aux.Content, p.Content.Issue) + case ProjectV2ItemContentTypePullRequest: + p.Content.PullRequest = &PullRequest{} + return json.Unmarshal(aux.Content, p.Content.PullRequest) + case ProjectV2ItemContentTypeDraftIssue: + p.Content.DraftIssue = &ProjectV2DraftIssue{} + return json.Unmarshal(aux.Content, p.Content.DraftIssue) + } + } + + return nil +} + +// ProjectV2Field represents a field in a GitHub Projects V2 project. +// Fields define the structure and data types for project items. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields?apiVersion=2022-11-28 +type ProjectV2Field struct { + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Name *string `json:"name,omitempty"` + DataType *string `json:"data_type,omitempty"` + ProjectURL *string `json:"project_url,omitempty"` + Options []*ProjectV2FieldOption `json:"options,omitempty"` + Configuration *ProjectV2FieldConfiguration `json:"configuration,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` +} + +// ProjectV2ItemFieldValue represents a field value of a project item. +type ProjectV2ItemFieldValue struct { + ID *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + DataType *string `json:"data_type,omitempty"` + // Value set for the field. The type depends on the field type: + // - text: string + // - number: float64 + // - date: string (ISO 8601 date format, e.g. "2023-06-23") or null + // - single_select: object with "id", "name", "color", "description" fields or null + // - iteration: object with "id", "title", "start_date", "duration" fields or null + // - title: object with "text" field (read-only, reflects the item's title) or null + // - assignees: array of user objects with "login", "id", etc. or null + // - labels: array of label objects with "id", "name", "color", etc. or null + // - linked_pull_requests: array of pull request objects or null + // - milestone: milestone object with "id", "title", "description", etc. or null + // - repository: repository object with "id", "name", "full_name", etc. or null + // - reviewers: array of user objects or null + // - status: object with "id", "name", "color", "description" fields (same structure as single_select) or null + Value any `json:"value,omitempty"` +} + +// ListOrganizationProjects lists Projects V2 for an organization. +// +// GitHub API docs: https://docs.github.com/rest/projects/projects?apiVersion=2022-11-28#list-projects-for-organization +// +//meta:operation GET /orgs/{org}/projectsV2 +func (s *ProjectsService) ListOrganizationProjects(ctx context.Context, org string, opts *ListProjectsOptions) ([]*ProjectV2, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var projects []*ProjectV2 + resp, err := s.client.Do(req, &projects) + if err != nil { + return nil, resp, err + } + + return projects, resp, nil +} + +// GetOrganizationProject gets a Projects V2 project for an organization by ID. +// +// GitHub API docs: https://docs.github.com/rest/projects/projects?apiVersion=2022-11-28#get-project-for-organization +// +//meta:operation GET /orgs/{org}/projectsV2/{project_number} +func (s *ProjectsService) GetOrganizationProject(ctx context.Context, org string, projectNumber int) (*ProjectV2, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v", org, projectNumber) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var project *ProjectV2 + resp, err := s.client.Do(req, &project) + if err != nil { + return nil, resp, err + } + + return project, resp, nil +} + +// ListUserProjects lists Projects V2 for a user. +// +// GitHub API docs: https://docs.github.com/rest/projects/projects?apiVersion=2022-11-28#list-projects-for-user +// +//meta:operation GET /users/{username}/projectsV2 +func (s *ProjectsService) ListUserProjects(ctx context.Context, username string, opts *ListProjectsOptions) ([]*ProjectV2, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2", username) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var projects []*ProjectV2 + resp, err := s.client.Do(req, &projects) + if err != nil { + return nil, resp, err + } + + return projects, resp, nil +} + +// GetUserProject gets a Projects V2 project for a user by ID. +// +// GitHub API docs: https://docs.github.com/rest/projects/projects?apiVersion=2022-11-28#get-project-for-user +// +//meta:operation GET /users/{username}/projectsV2/{project_number} +func (s *ProjectsService) GetUserProject(ctx context.Context, username string, projectNumber int) (*ProjectV2, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v", username, projectNumber) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var project *ProjectV2 + resp, err := s.client.Do(req, &project) + if err != nil { + return nil, resp, err + } + + return project, resp, nil +} + +// ListOrganizationProjectFields lists Projects V2 for an organization. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields?apiVersion=2022-11-28#list-project-fields-for-organization +// +//meta:operation GET /orgs/{org}/projectsV2/{project_number}/fields +func (s *ProjectsService) ListOrganizationProjectFields(ctx context.Context, org string, projectNumber int, opts *ListProjectsOptions) ([]*ProjectV2Field, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/fields", org, projectNumber) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var fields []*ProjectV2Field + resp, err := s.client.Do(req, &fields) + if err != nil { + return nil, resp, err + } + + return fields, resp, nil +} + +// ListUserProjectFields lists Projects V2 for a user. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields?apiVersion=2022-11-28#list-project-fields-for-user +// +//meta:operation GET /users/{username}/projectsV2/{project_number}/fields +func (s *ProjectsService) ListUserProjectFields(ctx context.Context, user string, projectNumber int, opts *ListProjectsOptions) ([]*ProjectV2Field, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v/fields", user, projectNumber) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var fields []*ProjectV2Field + resp, err := s.client.Do(req, &fields) + if err != nil { + return nil, resp, err + } + + return fields, resp, nil +} + +// GetOrganizationProjectField gets a single project field from an organization owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields?apiVersion=2022-11-28#get-project-field-for-organization +// +//meta:operation GET /orgs/{org}/projectsV2/{project_number}/fields/{field_id} +func (s *ProjectsService) GetOrganizationProjectField(ctx context.Context, org string, projectNumber int, fieldID int64) (*ProjectV2Field, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/fields/%v", org, projectNumber, fieldID) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var field *ProjectV2Field + resp, err := s.client.Do(req, &field) + if err != nil { + return nil, resp, err + } + + return field, resp, nil +} + +// GetUserProjectField gets a single project field from a user owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields?apiVersion=2022-11-28#get-project-field-for-user +// +//meta:operation GET /users/{username}/projectsV2/{project_number}/fields/{field_id} +func (s *ProjectsService) GetUserProjectField(ctx context.Context, user string, projectNumber int, fieldID int64) (*ProjectV2Field, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v/fields/%v", user, projectNumber, fieldID) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var field *ProjectV2Field + resp, err := s.client.Do(req, &field) + if err != nil { + return nil, resp, err + } + + return field, resp, nil +} + +// ListProjectItemsOptions specifies optional parameters when listing project items. +// Note: Pagination uses before/after cursor-style pagination similar to ListProjectsOptions. +// "Fields" can be used to restrict which field values are returned (by their numeric IDs). +type ListProjectItemsOptions struct { + // Embed ListProjectsOptions to reuse pagination and query parameters. + ListProjectsOptions + // Fields restricts which field values are returned by numeric field IDs. + Fields []int64 `url:"fields,omitempty,comma"` +} + +// GetProjectItemOptions specifies optional parameters when getting a project item. +type GetProjectItemOptions struct { + // Fields restricts which field values are returned by numeric field IDs. + Fields []int64 `url:"fields,omitempty,comma"` +} + +// AddProjectItemOptions represents the payload to add an item (issue or pull request) +// to a project. The Type must be either "Issue" or "PullRequest" (as per API docs) and +// ID is the numerical ID of that issue or pull request. +type AddProjectItemOptions struct { + Type *ProjectV2ItemContentType `json:"type,omitempty"` + ID *int64 `json:"id,omitempty"` +} + +// UpdateProjectV2Field represents a field update for a project item. +// +// GitHub API docs: https://docs.github.com/rest/projects/items?apiVersion=2022-11-28#update-project-item-for-organization +type UpdateProjectV2Field struct { + // ID is the field ID to update. + ID int64 `json:"id"` + // Value is the new value to set for the field. The type depends on the field type. + // For text fields: string + // For number fields: float64 or int + // For single_select fields: string (option ID) + // For date fields: string (ISO 8601 date) + // For iteration fields: string (iteration ID) + // Note: Some field types (title, assignees, labels, etc.) are read-only or managed through other API endpoints. + Value any `json:"value"` +} + +// UpdateProjectItemOptions represents fields that can be modified for a project item. +// The GitHub API expects either archived status updates or field value updates. +type UpdateProjectItemOptions struct { + // Archived indicates whether the item should be archived (true) or unarchived (false). + // This is used for archive/unarchive operations. + Archived *bool `json:"archived,omitempty"` + // Fields contains field updates to apply to the project item. + // Each entry specifies a field ID and its new value. + Fields []*UpdateProjectV2Field `json:"fields,omitempty"` +} + +// ListOrganizationProjectItems lists items for an organization owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items?apiVersion=2022-11-28#list-items-for-an-organization-owned-project +// +//meta:operation GET /orgs/{org}/projectsV2/{project_number}/items +func (s *ProjectsService) ListOrganizationProjectItems(ctx context.Context, org string, projectNumber int, opts *ListProjectItemsOptions) ([]*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/items", org, projectNumber) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var items []*ProjectV2Item + resp, err := s.client.Do(req, &items) + if err != nil { + return nil, resp, err + } + + return items, resp, nil +} + +// AddOrganizationProjectItem adds an issue or pull request item to an organization owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items?apiVersion=2022-11-28#add-item-to-organization-owned-project +// +//meta:operation POST /orgs/{org}/projectsV2/{project_number}/items +func (s *ProjectsService) AddOrganizationProjectItem(ctx context.Context, org string, projectNumber int, opts *AddProjectItemOptions) (*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/items", org, projectNumber) + req, err := s.client.NewRequest(ctx, "POST", u, opts) + if err != nil { + return nil, nil, err + } + + var item *ProjectV2Item + resp, err := s.client.Do(req, &item) + if err != nil { + return nil, resp, err + } + + return item, resp, nil +} + +// GetOrganizationProjectItem gets a single item from an organization owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items?apiVersion=2022-11-28#get-an-item-for-an-organization-owned-project +// +//meta:operation GET /orgs/{org}/projectsV2/{project_number}/items/{item_id} +func (s *ProjectsService) GetOrganizationProjectItem(ctx context.Context, org string, projectNumber int, itemID int64, opts *GetProjectItemOptions) (*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/items/%v", org, projectNumber, itemID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var item *ProjectV2Item + resp, err := s.client.Do(req, &item) + if err != nil { + return nil, resp, err + } + + return item, resp, nil +} + +// UpdateOrganizationProjectItem updates an item in an organization owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items?apiVersion=2022-11-28#update-project-item-for-organization +// +//meta:operation PATCH /orgs/{org}/projectsV2/{project_number}/items/{item_id} +func (s *ProjectsService) UpdateOrganizationProjectItem(ctx context.Context, org string, projectNumber int, itemID int64, opts *UpdateProjectItemOptions) (*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/items/%v", org, projectNumber, itemID) + req, err := s.client.NewRequest(ctx, "PATCH", u, opts) + if err != nil { + return nil, nil, err + } + + var item *ProjectV2Item + resp, err := s.client.Do(req, &item) + if err != nil { + return nil, resp, err + } + + return item, resp, nil +} + +// DeleteOrganizationProjectItem deletes an item from an organization owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items?apiVersion=2022-11-28#delete-project-item-for-organization +// +//meta:operation DELETE /orgs/{org}/projectsV2/{project_number}/items/{item_id} +func (s *ProjectsService) DeleteOrganizationProjectItem(ctx context.Context, org string, projectNumber int, itemID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/items/%v", org, projectNumber, itemID) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// ListUserProjectItems lists items for a user owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items?apiVersion=2022-11-28#list-items-for-a-user-owned-project +// +//meta:operation GET /users/{username}/projectsV2/{project_number}/items +func (s *ProjectsService) ListUserProjectItems(ctx context.Context, username string, projectNumber int, opts *ListProjectItemsOptions) ([]*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v/items", username, projectNumber) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var items []*ProjectV2Item + resp, err := s.client.Do(req, &items) + if err != nil { + return nil, resp, err + } + + return items, resp, nil +} + +// AddUserProjectItem adds an issue or pull request item to a user owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items?apiVersion=2022-11-28#add-item-to-user-owned-project +// +//meta:operation POST /users/{username}/projectsV2/{project_number}/items +func (s *ProjectsService) AddUserProjectItem(ctx context.Context, username string, projectNumber int, opts *AddProjectItemOptions) (*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v/items", username, projectNumber) + req, err := s.client.NewRequest(ctx, "POST", u, opts) + if err != nil { + return nil, nil, err + } + + var item *ProjectV2Item + resp, err := s.client.Do(req, &item) + if err != nil { + return nil, resp, err + } + + return item, resp, nil +} + +// GetUserProjectItem gets a single item from a user owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items?apiVersion=2022-11-28#get-an-item-for-a-user-owned-project +// +//meta:operation GET /users/{username}/projectsV2/{project_number}/items/{item_id} +func (s *ProjectsService) GetUserProjectItem(ctx context.Context, username string, projectNumber int, itemID int64, opts *GetProjectItemOptions) (*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v/items/%v", username, projectNumber, itemID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var item *ProjectV2Item + resp, err := s.client.Do(req, &item) + if err != nil { + return nil, resp, err + } + + return item, resp, nil +} + +// UpdateUserProjectItem updates an item in a user owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items?apiVersion=2022-11-28#update-project-item-for-user +// +//meta:operation PATCH /users/{username}/projectsV2/{project_number}/items/{item_id} +func (s *ProjectsService) UpdateUserProjectItem(ctx context.Context, username string, projectNumber int, itemID int64, opts *UpdateProjectItemOptions) (*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v/items/%v", username, projectNumber, itemID) + req, err := s.client.NewRequest(ctx, "PATCH", u, opts) + if err != nil { + return nil, nil, err + } + + var item *ProjectV2Item + resp, err := s.client.Do(req, &item) + if err != nil { + return nil, resp, err + } + + return item, resp, nil +} + +// DeleteUserProjectItem deletes an item from a user owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items?apiVersion=2022-11-28#delete-project-item-for-user +// +//meta:operation DELETE /users/{username}/projectsV2/{project_number}/items/{item_id} +func (s *ProjectsService) DeleteUserProjectItem(ctx context.Context, username string, projectNumber int, itemID int64) (*Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v/items/%v", username, projectNumber, itemID) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v73/github/pulls.go b/vendor/github.com/google/go-github/v88/github/pulls.go similarity index 68% rename from vendor/github.com/google/go-github/v73/github/pulls.go rename to vendor/github.com/google/go-github/v88/github/pulls.go index f3c6e929c..d70167980 100644 --- a/vendor/github.com/google/go-github/v73/github/pulls.go +++ b/vendor/github.com/google/go-github/v88/github/pulls.go @@ -15,7 +15,7 @@ import ( // PullRequestsService handles communication with the pull request related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/pulls/ +// GitHub API docs: https://docs.github.com/rest/pulls?apiVersion=2022-11-28 type PullRequestsService service // PullRequestAutoMerge represents the "auto_merge" response for a PullRequest. @@ -28,32 +28,38 @@ type PullRequestAutoMerge struct { // PullRequest represents a GitHub pull request on a repository. type PullRequest struct { - ID *int64 `json:"id,omitempty"` - Number *int `json:"number,omitempty"` - State *string `json:"state,omitempty"` - Locked *bool `json:"locked,omitempty"` - Title *string `json:"title,omitempty"` - Body *string `json:"body,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - ClosedAt *Timestamp `json:"closed_at,omitempty"` - MergedAt *Timestamp `json:"merged_at,omitempty"` - Labels []*Label `json:"labels,omitempty"` - User *User `json:"user,omitempty"` - Draft *bool `json:"draft,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - IssueURL *string `json:"issue_url,omitempty"` - StatusesURL *string `json:"statuses_url,omitempty"` - DiffURL *string `json:"diff_url,omitempty"` - PatchURL *string `json:"patch_url,omitempty"` - CommitsURL *string `json:"commits_url,omitempty"` - CommentsURL *string `json:"comments_url,omitempty"` - ReviewCommentsURL *string `json:"review_comments_url,omitempty"` - ReviewCommentURL *string `json:"review_comment_url,omitempty"` - Assignee *User `json:"assignee,omitempty"` - Assignees []*User `json:"assignees,omitempty"` - Milestone *Milestone `json:"milestone,omitempty"` + ID *int64 `json:"id,omitempty"` + Number *int `json:"number,omitempty"` + State *string `json:"state,omitempty"` + Locked *bool `json:"locked,omitempty"` + Title *string `json:"title,omitempty"` + Body *string `json:"body,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + ClosedAt *Timestamp `json:"closed_at,omitempty"` + MergedAt *Timestamp `json:"merged_at,omitempty"` + Labels []*Label `json:"labels,omitempty"` + User *User `json:"user,omitempty"` + Draft *bool `json:"draft,omitempty"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + IssueURL *string `json:"issue_url,omitempty"` + StatusesURL *string `json:"statuses_url,omitempty"` + DiffURL *string `json:"diff_url,omitempty"` + PatchURL *string `json:"patch_url,omitempty"` + CommitsURL *string `json:"commits_url,omitempty"` + CommentsURL *string `json:"comments_url,omitempty"` + ReviewCommentsURL *string `json:"review_comments_url,omitempty"` + ReviewCommentURL *string `json:"review_comment_url,omitempty"` + Assignee *User `json:"assignee,omitempty"` + Assignees []*User `json:"assignees,omitempty"` + Milestone *Milestone `json:"milestone,omitempty"` + // AuthorAssociation is the pull request author's relationship to the repository. + // Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE". + // + // Deprecated: GitHub will remove this field from Events API payloads on October 7, 2025. + // Use the Pull Requests REST API endpoint to retrieve this information. + // See: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#get-a-pull-request AuthorAssociation *string `json:"author_association,omitempty"` NodeID *string `json:"node_id,omitempty"` RequestedReviewers []*User `json:"requested_reviewers,omitempty"` @@ -136,7 +142,7 @@ type PullRequestListOptions struct { Sort string `url:"sort,omitempty"` // Direction in which to sort pull requests. Possible values are: asc, desc. - // If Sort is "created" or not specified, Default is "desc", otherwise Default + // If Sort is "created" or not specified, Default is "desc"; otherwise, Default // is "asc" Direction string `url:"direction,omitempty"` @@ -145,23 +151,23 @@ type PullRequestListOptions struct { // List the pull requests for the specified repository. // -// GitHub API docs: https://docs.github.com/rest/pulls/pulls#list-pull-requests +// GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#list-pull-requests // //meta:operation GET /repos/{owner}/{repo}/pulls -func (s *PullRequestsService) List(ctx context.Context, owner string, repo string, opts *PullRequestListOptions) ([]*PullRequest, *Response, error) { +func (s *PullRequestsService) List(ctx context.Context, owner, repo string, opts *PullRequestListOptions) ([]*PullRequest, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var pulls []*PullRequest - resp, err := s.client.Do(ctx, req, &pulls) + resp, err := s.client.Do(req, &pulls) if err != nil { return nil, resp, err } @@ -176,7 +182,7 @@ func (s *PullRequestsService) List(ctx context.Context, owner string, repo strin // not present in the repository's default branch, the result will only include // open pull requests. // -// GitHub API docs: https://docs.github.com/rest/commits/commits#list-pull-requests-associated-with-a-commit +// GitHub API docs: https://docs.github.com/rest/commits/commits?apiVersion=2022-11-28#list-pull-requests-associated-with-a-commit // //meta:operation GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, owner, repo, sha string, opts *ListOptions) ([]*PullRequest, *Response, error) { @@ -186,15 +192,14 @@ func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, ow return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeListPullsOrBranchesForCommitPreview) var pulls []*PullRequest - resp, err := s.client.Do(ctx, req, &pulls) + resp, err := s.client.Do(req, &pulls) if err != nil { return nil, resp, err } @@ -204,18 +209,18 @@ func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, ow // Get a single pull request. // -// GitHub API docs: https://docs.github.com/rest/pulls/pulls#get-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#get-a-pull-request // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number} -func (s *PullRequestsService) Get(ctx context.Context, owner string, repo string, number int) (*PullRequest, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number) - req, err := s.client.NewRequest("GET", u, nil) +func (s *PullRequestsService) Get(ctx context.Context, owner, repo string, number int) (*PullRequest, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/%v", owner, repo, number) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - pull := new(PullRequest) - resp, err := s.client.Do(ctx, req, pull) + var pull *PullRequest + resp, err := s.client.Do(req, &pull) if err != nil { return nil, resp, err } @@ -225,12 +230,12 @@ func (s *PullRequestsService) Get(ctx context.Context, owner string, repo string // GetRaw gets a single pull request in raw (diff or patch) format. // -// GitHub API docs: https://docs.github.com/rest/pulls/pulls#get-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#get-a-pull-request // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number} -func (s *PullRequestsService) GetRaw(ctx context.Context, owner string, repo string, number int, opts RawOptions) (string, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number) - req, err := s.client.NewRequest("GET", u, nil) +func (s *PullRequestsService) GetRaw(ctx context.Context, owner, repo string, number int, opts RawOptions) (string, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/%v", owner, repo, number) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return "", nil, err } @@ -241,11 +246,11 @@ func (s *PullRequestsService) GetRaw(ctx context.Context, owner string, repo str case Patch: req.Header.Set("Accept", mediaTypeV3Patch) default: - return "", nil, fmt.Errorf("unsupported raw type %d", opts.Type) + return "", nil, fmt.Errorf("unsupported raw type %v", opts.Type) } var buf bytes.Buffer - resp, err := s.client.Do(ctx, req, &buf) + resp, err := s.client.Do(req, &buf) if err != nil { return "", resp, err } @@ -274,18 +279,18 @@ type NewPullRequest struct { // Create a new pull request on the specified repository. // -// GitHub API docs: https://docs.github.com/rest/pulls/pulls#create-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#create-a-pull-request // //meta:operation POST /repos/{owner}/{repo}/pulls -func (s *PullRequestsService) Create(ctx context.Context, owner string, repo string, pull *NewPullRequest) (*PullRequest, *Response, error) { +func (s *PullRequestsService) Create(ctx context.Context, owner, repo string, pull *NewPullRequest) (*PullRequest, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo) - req, err := s.client.NewRequest("POST", u, pull) + req, err := s.client.NewRequest(ctx, "POST", u, pull) if err != nil { return nil, nil, err } - p := new(PullRequest) - resp, err := s.client.Do(ctx, req, p) + var p *PullRequest + resp, err := s.client.Do(req, &p) if err != nil { return nil, resp, err } @@ -315,22 +320,21 @@ type PullRequestBranchUpdateResponse struct { // A follow up request, after a delay of a second or so, should result // in a successful request. // -// GitHub API docs: https://docs.github.com/rest/pulls/pulls#update-a-pull-request-branch +// GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#update-a-pull-request-branch // //meta:operation PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch func (s *PullRequestsService) UpdateBranch(ctx context.Context, owner, repo string, number int, opts *PullRequestBranchUpdateOptions) (*PullRequestBranchUpdateResponse, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/update-branch", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/update-branch", owner, repo, number) - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, opts) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeUpdatePullRequestBranchPreview) - p := new(PullRequestBranchUpdateResponse) - resp, err := s.client.Do(ctx, req, p) + var p *PullRequestBranchUpdateResponse + resp, err := s.client.Do(req, &p) if err != nil { return nil, resp, err } @@ -352,15 +356,15 @@ type pullRequestUpdate struct { // The following fields are editable: Title, Body, State, Base.Ref and MaintainerCanModify. // Base.Ref updates the base branch of the pull request. // -// GitHub API docs: https://docs.github.com/rest/pulls/pulls#update-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#update-a-pull-request // //meta:operation PATCH /repos/{owner}/{repo}/pulls/{pull_number} -func (s *PullRequestsService) Edit(ctx context.Context, owner string, repo string, number int, pull *PullRequest) (*PullRequest, *Response, error) { +func (s *PullRequestsService) Edit(ctx context.Context, owner, repo string, number int, pull *PullRequest) (*PullRequest, *Response, error) { if pull == nil { return nil, nil, errors.New("pull must be provided") } - u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v", owner, repo, number) update := &pullRequestUpdate{ Title: pull.Title, @@ -375,13 +379,13 @@ func (s *PullRequestsService) Edit(ctx context.Context, owner string, repo strin update.Base = pull.Base.Ref } - req, err := s.client.NewRequest("PATCH", u, update) + req, err := s.client.NewRequest(ctx, "PATCH", u, update) if err != nil { return nil, nil, err } - p := new(PullRequest) - resp, err := s.client.Do(ctx, req, p) + var p *PullRequest + resp, err := s.client.Do(req, &p) if err != nil { return nil, resp, err } @@ -391,23 +395,23 @@ func (s *PullRequestsService) Edit(ctx context.Context, owner string, repo strin // ListCommits lists the commits in a pull request. // -// GitHub API docs: https://docs.github.com/rest/pulls/pulls#list-commits-on-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#list-commits-on-a-pull-request // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/commits -func (s *PullRequestsService) ListCommits(ctx context.Context, owner string, repo string, number int, opts *ListOptions) ([]*RepositoryCommit, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/commits", owner, repo, number) +func (s *PullRequestsService) ListCommits(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*RepositoryCommit, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/%v/commits", owner, repo, number) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var commits []*RepositoryCommit - resp, err := s.client.Do(ctx, req, &commits) + resp, err := s.client.Do(req, &commits) if err != nil { return nil, resp, err } @@ -417,23 +421,23 @@ func (s *PullRequestsService) ListCommits(ctx context.Context, owner string, rep // ListFiles lists the files in a pull request. // -// GitHub API docs: https://docs.github.com/rest/pulls/pulls#list-pull-requests-files +// GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#list-pull-requests-files // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/files -func (s *PullRequestsService) ListFiles(ctx context.Context, owner string, repo string, number int, opts *ListOptions) ([]*CommitFile, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/files", owner, repo, number) +func (s *PullRequestsService) ListFiles(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*CommitFile, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/%v/files", owner, repo, number) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var commitFiles []*CommitFile - resp, err := s.client.Do(ctx, req, &commitFiles) + resp, err := s.client.Do(req, &commitFiles) if err != nil { return nil, resp, err } @@ -443,17 +447,17 @@ func (s *PullRequestsService) ListFiles(ctx context.Context, owner string, repo // IsMerged checks if a pull request has been merged. // -// GitHub API docs: https://docs.github.com/rest/pulls/pulls#check-if-a-pull-request-has-been-merged +// GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#check-if-a-pull-request-has-been-merged // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/merge -func (s *PullRequestsService) IsMerged(ctx context.Context, owner string, repo string, number int) (bool, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/merge", owner, repo, number) - req, err := s.client.NewRequest("GET", u, nil) +func (s *PullRequestsService) IsMerged(ctx context.Context, owner, repo string, number int) (bool, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/%v/merge", owner, repo, number) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return false, nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) merged, err := parseBoolResponse(err) return merged, resp, err } @@ -487,13 +491,13 @@ type pullRequestMergeRequest struct { // Merge a pull request. // commitMessage is an extra detail to append to automatic commit message. // -// GitHub API docs: https://docs.github.com/rest/pulls/pulls#merge-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#merge-a-pull-request // //meta:operation PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge -func (s *PullRequestsService) Merge(ctx context.Context, owner string, repo string, number int, commitMessage string, options *PullRequestOptions) (*PullRequestMergeResult, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/merge", owner, repo, number) +func (s *PullRequestsService) Merge(ctx context.Context, owner, repo string, number int, commitMessage string, options *PullRequestOptions) (*PullRequestMergeResult, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/%v/merge", owner, repo, number) - pullRequestBody := &pullRequestMergeRequest{} + var pullRequestBody pullRequestMergeRequest if commitMessage != "" { pullRequestBody.CommitMessage = &commitMessage } @@ -505,13 +509,13 @@ func (s *PullRequestsService) Merge(ctx context.Context, owner string, repo stri pullRequestBody.CommitMessage = &commitMessage } } - req, err := s.client.NewRequest("PUT", u, pullRequestBody) + req, err := s.client.NewRequest(ctx, "PUT", u, &pullRequestBody) if err != nil { return nil, nil, err } - mergeResult := new(PullRequestMergeResult) - resp, err := s.client.Do(ctx, req, mergeResult) + var mergeResult *PullRequestMergeResult + resp, err := s.client.Do(req, &mergeResult) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/pulls_comments.go b/vendor/github.com/google/go-github/v88/github/pulls_comments.go similarity index 73% rename from vendor/github.com/google/go-github/v73/github/pulls_comments.go rename to vendor/github.com/google/go-github/v88/github/pulls_comments.go index a9ffe8d7c..e85d45a55 100644 --- a/vendor/github.com/google/go-github/v73/github/pulls_comments.go +++ b/vendor/github.com/google/go-github/v88/github/pulls_comments.go @@ -37,11 +37,15 @@ type PullRequestComment struct { UpdatedAt *Timestamp `json:"updated_at,omitempty"` // AuthorAssociation is the comment author's relationship to the pull request's repository. // Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE". + // + // Deprecated: GitHub will remove this field from Events API payloads on October 7, 2025. + // Use the Pull Request Comments REST API endpoint to retrieve this information. + // See: https://docs.github.com/rest/pulls/comments?apiVersion=2022-11-28#get-a-review-comment-for-a-pull-request AuthorAssociation *string `json:"author_association,omitempty"` URL *string `json:"url,omitempty"` HTMLURL *string `json:"html_url,omitempty"` PullRequestURL *string `json:"pull_request_url,omitempty"` - // Can be one of: LINE, FILE from https://docs.github.com/rest/pulls/comments#create-a-review-comment-for-a-pull-request + // Can be one of: LINE, FILE from https://docs.github.com/rest/pulls/comments?apiVersion=2022-11-28#create-a-review-comment-for-a-pull-request SubjectType *string `json:"subject_type,omitempty"` } @@ -68,8 +72,9 @@ type PullRequestListCommentsOptions struct { // pull request number of 0 will return all comments on all pull requests for // the repository. // -// GitHub API docs: https://docs.github.com/rest/pulls/comments#list-review-comments-in-a-repository -// GitHub API docs: https://docs.github.com/rest/pulls/comments#list-review-comments-on-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/comments?apiVersion=2022-11-28#list-review-comments-in-a-repository +// +// GitHub API docs: https://docs.github.com/rest/pulls/comments?apiVersion=2022-11-28#list-review-comments-on-a-pull-request // //meta:operation GET /repos/{owner}/{repo}/pulls/comments //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/comments @@ -78,24 +83,23 @@ func (s *PullRequestsService) ListComments(ctx context.Context, owner, repo stri if number == 0 { u = fmt.Sprintf("repos/%v/%v/pulls/comments", owner, repo) } else { - u = fmt.Sprintf("repos/%v/%v/pulls/%d/comments", owner, repo, number) + u = fmt.Sprintf("repos/%v/%v/pulls/%v/comments", owner, repo, number) } u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) var comments []*PullRequestComment - resp, err := s.client.Do(ctx, req, &comments) + resp, err := s.client.Do(req, &comments) if err != nil { return nil, resp, err } @@ -105,22 +109,21 @@ func (s *PullRequestsService) ListComments(ctx context.Context, owner, repo stri // GetComment fetches the specified pull request comment. // -// GitHub API docs: https://docs.github.com/rest/pulls/comments#get-a-review-comment-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/comments?apiVersion=2022-11-28#get-a-review-comment-for-a-pull-request // //meta:operation GET /repos/{owner}/{repo}/pulls/comments/{comment_id} func (s *PullRequestsService) GetComment(ctx context.Context, owner, repo string, commentID int64) (*PullRequestComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID) - req, err := s.client.NewRequest("GET", u, nil) + u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v", owner, repo, commentID) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - comment := new(PullRequestComment) - resp, err := s.client.Do(ctx, req, comment) + var comment *PullRequestComment + resp, err := s.client.Do(req, &comment) if err != nil { return nil, resp, err } @@ -130,21 +133,20 @@ func (s *PullRequestsService) GetComment(ctx context.Context, owner, repo string // CreateComment creates a new comment on the specified pull request. // -// GitHub API docs: https://docs.github.com/rest/pulls/comments#create-a-review-comment-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/comments?apiVersion=2022-11-28#create-a-review-comment-for-a-pull-request // //meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/comments func (s *PullRequestsService) CreateComment(ctx context.Context, owner, repo string, number int, comment *PullRequestComment) (*PullRequestComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/comments", owner, repo, number) - req, err := s.client.NewRequest("POST", u, comment) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/comments", owner, repo, number) + req, err := s.client.NewRequest(ctx, "POST", u, comment) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when their respective API fully launches. acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - c := new(PullRequestComment) - resp, err := s.client.Do(ctx, req, c) + var c *PullRequestComment + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -154,7 +156,7 @@ func (s *PullRequestsService) CreateComment(ctx context.Context, owner, repo str // CreateCommentInReplyTo creates a new comment as a reply to an existing pull request comment. // -// GitHub API docs: https://docs.github.com/rest/pulls/comments#create-a-review-comment-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/comments?apiVersion=2022-11-28#create-a-review-comment-for-a-pull-request // //meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/comments func (s *PullRequestsService) CreateCommentInReplyTo(ctx context.Context, owner, repo string, number int, body string, commentID int64) (*PullRequestComment, *Response, error) { @@ -165,14 +167,14 @@ func (s *PullRequestsService) CreateCommentInReplyTo(ctx context.Context, owner, Body: body, InReplyTo: commentID, } - u := fmt.Sprintf("repos/%v/%v/pulls/%d/comments", owner, repo, number) - req, err := s.client.NewRequest("POST", u, comment) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/comments", owner, repo, number) + req, err := s.client.NewRequest(ctx, "POST", u, comment) if err != nil { return nil, nil, err } - c := new(PullRequestComment) - resp, err := s.client.Do(ctx, req, c) + var c *PullRequestComment + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -183,18 +185,18 @@ func (s *PullRequestsService) CreateCommentInReplyTo(ctx context.Context, owner, // EditComment updates a pull request comment. // A non-nil comment.Body must be provided. Other comment fields should be left nil. // -// GitHub API docs: https://docs.github.com/rest/pulls/comments#update-a-review-comment-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/comments?apiVersion=2022-11-28#update-a-review-comment-for-a-pull-request // //meta:operation PATCH /repos/{owner}/{repo}/pulls/comments/{comment_id} func (s *PullRequestsService) EditComment(ctx context.Context, owner, repo string, commentID int64, comment *PullRequestComment) (*PullRequestComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID) - req, err := s.client.NewRequest("PATCH", u, comment) + u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v", owner, repo, commentID) + req, err := s.client.NewRequest(ctx, "PATCH", u, comment) if err != nil { return nil, nil, err } - c := new(PullRequestComment) - resp, err := s.client.Do(ctx, req, c) + var c *PullRequestComment + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -204,14 +206,15 @@ func (s *PullRequestsService) EditComment(ctx context.Context, owner, repo strin // DeleteComment deletes a pull request comment. // -// GitHub API docs: https://docs.github.com/rest/pulls/comments#delete-a-review-comment-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/comments?apiVersion=2022-11-28#delete-a-review-comment-for-a-pull-request // //meta:operation DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id} func (s *PullRequestsService) DeleteComment(ctx context.Context, owner, repo string, commentID int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID) - req, err := s.client.NewRequest("DELETE", u, nil) + u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v", owner, repo, commentID) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/pulls_reviewers.go b/vendor/github.com/google/go-github/v88/github/pulls_reviewers.go similarity index 77% rename from vendor/github.com/google/go-github/v73/github/pulls_reviewers.go rename to vendor/github.com/google/go-github/v88/github/pulls_reviewers.go index 526047937..612291a51 100644 --- a/vendor/github.com/google/go-github/v73/github/pulls_reviewers.go +++ b/vendor/github.com/google/go-github/v88/github/pulls_reviewers.go @@ -32,18 +32,18 @@ type removeReviewersRequest struct { // RequestReviewers creates a review request for the provided reviewers for the specified pull request. // -// GitHub API docs: https://docs.github.com/rest/pulls/review-requests#request-reviewers-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/review-requests?apiVersion=2022-11-28#request-reviewers-for-a-pull-request // //meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers func (s *PullRequestsService) RequestReviewers(ctx context.Context, owner, repo string, number int, reviewers ReviewersRequest) (*PullRequest, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/pulls/%d/requested_reviewers", owner, repo, number) - req, err := s.client.NewRequest("POST", u, &reviewers) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/requested_reviewers", owner, repo, number) + req, err := s.client.NewRequest(ctx, "POST", u, &reviewers) if err != nil { return nil, nil, err } - r := new(PullRequest) - resp, err := s.client.Do(ctx, req, r) + var r *PullRequest + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -53,23 +53,19 @@ func (s *PullRequestsService) RequestReviewers(ctx context.Context, owner, repo // ListReviewers lists reviewers whose reviews have been requested on the specified pull request. // -// GitHub API docs: https://docs.github.com/rest/pulls/review-requests#get-all-requested-reviewers-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/review-requests?apiVersion=2022-11-28#get-all-requested-reviewers-for-a-pull-request // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers -func (s *PullRequestsService) ListReviewers(ctx context.Context, owner, repo string, number int, opts *ListOptions) (*Reviewers, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/requested_reviewers", owner, repo, number) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } +func (s *PullRequestsService) ListReviewers(ctx context.Context, owner, repo string, number int) (*Reviewers, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/%v/requested_reviewers", owner, repo, number) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - reviewers := new(Reviewers) - resp, err := s.client.Do(ctx, req, reviewers) + var reviewers *Reviewers + resp, err := s.client.Do(req, &reviewers) if err != nil { return nil, resp, err } @@ -79,7 +75,7 @@ func (s *PullRequestsService) ListReviewers(ctx context.Context, owner, repo str // RemoveReviewers removes the review request for the provided reviewers for the specified pull request. // -// GitHub API docs: https://docs.github.com/rest/pulls/review-requests#remove-requested-reviewers-from-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/review-requests?apiVersion=2022-11-28#remove-requested-reviewers-from-a-pull-request // //meta:operation DELETE /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers func (s *PullRequestsService) RemoveReviewers(ctx context.Context, owner, repo string, number int, reviewers ReviewersRequest) (*Response, error) { @@ -93,11 +89,11 @@ func (s *PullRequestsService) RemoveReviewers(ctx context.Context, owner, repo s removeRequest.Reviewers = []string{} } - u := fmt.Sprintf("repos/%s/%s/pulls/%d/requested_reviewers", owner, repo, number) - req, err := s.client.NewRequest("DELETE", u, &removeRequest) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/requested_reviewers", owner, repo, number) + req, err := s.client.NewRequest(ctx, "DELETE", u, &removeRequest) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/pulls_reviews.go b/vendor/github.com/google/go-github/v88/github/pulls_reviews.go similarity index 75% rename from vendor/github.com/google/go-github/v73/github/pulls_reviews.go rename to vendor/github.com/google/go-github/v88/github/pulls_reviews.go index 27b8dc37d..716ddc9a2 100644 --- a/vendor/github.com/google/go-github/v73/github/pulls_reviews.go +++ b/vendor/github.com/google/go-github/v88/github/pulls_reviews.go @@ -24,8 +24,12 @@ type PullRequestReview struct { HTMLURL *string `json:"html_url,omitempty"` PullRequestURL *string `json:"pull_request_url,omitempty"` State *string `json:"state,omitempty"` - // AuthorAssociation is the comment author's relationship to the issue's repository. + // AuthorAssociation is the review author's relationship to the repository. // Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE". + // + // Deprecated: GitHub will remove this field from Events API payloads on October 7, 2025. + // Use the Pull Request Reviews REST API endpoint to retrieve this information. + // See: https://docs.github.com/rest/pulls/reviews?apiVersion=2022-11-28#get-a-review-for-a-pull-request AuthorAssociation *string `json:"author_association,omitempty"` } @@ -100,23 +104,23 @@ func (r PullRequestReviewDismissalRequest) String() string { // ListReviews lists all reviews on the specified pull request. // -// GitHub API docs: https://docs.github.com/rest/pulls/reviews#list-reviews-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/reviews?apiVersion=2022-11-28#list-reviews-for-a-pull-request // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews func (s *PullRequestsService) ListReviews(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*PullRequestReview, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews", owner, repo, number) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var reviews []*PullRequestReview - resp, err := s.client.Do(ctx, req, &reviews) + resp, err := s.client.Do(req, &reviews) if err != nil { return nil, resp, err } @@ -126,19 +130,19 @@ func (s *PullRequestsService) ListReviews(ctx context.Context, owner, repo strin // GetReview fetches the specified pull request review. // -// GitHub API docs: https://docs.github.com/rest/pulls/reviews#get-a-review-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/reviews?apiVersion=2022-11-28#get-a-review-for-a-pull-request // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string, number int, reviewID int64) (*PullRequestReview, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews/%v", owner, repo, number, reviewID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - review := new(PullRequestReview) - resp, err := s.client.Do(ctx, req, review) + var review *PullRequestReview + resp, err := s.client.Do(req, &review) if err != nil { return nil, resp, err } @@ -148,19 +152,19 @@ func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string, // DeletePendingReview deletes the specified pull request pending review. // -// GitHub API docs: https://docs.github.com/rest/pulls/reviews#delete-a-pending-review-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/reviews?apiVersion=2022-11-28#delete-a-pending-review-for-a-pull-request // //meta:operation DELETE /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, repo string, number int, reviewID int64) (*PullRequestReview, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews/%v", owner, repo, number, reviewID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, nil, err } - review := new(PullRequestReview) - resp, err := s.client.Do(ctx, req, review) + var review *PullRequestReview + resp, err := s.client.Do(req, &review) if err != nil { return nil, resp, err } @@ -170,23 +174,23 @@ func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, re // ListReviewComments lists all the comments for the specified review. // -// GitHub API docs: https://docs.github.com/rest/pulls/reviews#list-comments-for-a-pull-request-review +// GitHub API docs: https://docs.github.com/rest/pulls/reviews?apiVersion=2022-11-28#list-comments-for-a-pull-request-review // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, repo string, number int, reviewID int64, opts *ListOptions) ([]*PullRequestComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/comments", owner, repo, number, reviewID) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews/%v/comments", owner, repo, number, reviewID) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var comments []*PullRequestComment - resp, err := s.client.Do(ctx, req, &comments) + resp, err := s.client.Do(req, &comments) if err != nil { return nil, resp, err } @@ -230,13 +234,13 @@ func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, rep // It is waaaaaay better. // ``` // -// GitHub API docs: https://docs.github.com/rest/pulls/reviews#create-a-review-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/reviews?apiVersion=2022-11-28#create-a-review-for-a-pull-request // //meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews func (s *PullRequestsService) CreateReview(ctx context.Context, owner, repo string, number int, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews", owner, repo, number) - req, err := s.client.NewRequest("POST", u, review) + req, err := s.client.NewRequest(ctx, "POST", u, review) if err != nil { return nil, nil, err } @@ -250,8 +254,8 @@ func (s *PullRequestsService) CreateReview(ctx context.Context, owner, repo stri req.Header.Set("Accept", mediaTypeMultiLineCommentsPreview) } - r := new(PullRequestReview) - resp, err := s.client.Do(ctx, req, r) + var r *PullRequestReview + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -261,22 +265,22 @@ func (s *PullRequestsService) CreateReview(ctx context.Context, owner, repo stri // UpdateReview updates the review summary on the specified pull request. // -// GitHub API docs: https://docs.github.com/rest/pulls/reviews#update-a-review-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/reviews?apiVersion=2022-11-28#update-a-review-for-a-pull-request // //meta:operation PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} func (s *PullRequestsService) UpdateReview(ctx context.Context, owner, repo string, number int, reviewID int64, body string) (*PullRequestReview, *Response, error) { opts := &struct { Body string `json:"body"` }{Body: body} - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews/%v", owner, repo, number, reviewID) - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, opts) if err != nil { return nil, nil, err } - review := &PullRequestReview{} - resp, err := s.client.Do(ctx, req, review) + var review *PullRequestReview + resp, err := s.client.Do(req, &review) if err != nil { return nil, resp, err } @@ -286,19 +290,19 @@ func (s *PullRequestsService) UpdateReview(ctx context.Context, owner, repo stri // SubmitReview submits a specified review on the specified pull request. // -// GitHub API docs: https://docs.github.com/rest/pulls/reviews#submit-a-review-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/reviews?apiVersion=2022-11-28#submit-a-review-for-a-pull-request // //meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo string, number int, reviewID int64, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/events", owner, repo, number, reviewID) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews/%v/events", owner, repo, number, reviewID) - req, err := s.client.NewRequest("POST", u, review) + req, err := s.client.NewRequest(ctx, "POST", u, review) if err != nil { return nil, nil, err } - r := new(PullRequestReview) - resp, err := s.client.Do(ctx, req, r) + var r *PullRequestReview + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -308,19 +312,19 @@ func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo stri // DismissReview dismisses a specified review on the specified pull request. // -// GitHub API docs: https://docs.github.com/rest/pulls/reviews#dismiss-a-review-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/reviews?apiVersion=2022-11-28#dismiss-a-review-for-a-pull-request // //meta:operation PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals func (s *PullRequestsService) DismissReview(ctx context.Context, owner, repo string, number int, reviewID int64, review *PullRequestReviewDismissalRequest) (*PullRequestReview, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/dismissals", owner, repo, number, reviewID) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews/%v/dismissals", owner, repo, number, reviewID) - req, err := s.client.NewRequest("PUT", u, review) + req, err := s.client.NewRequest(ctx, "PUT", u, review) if err != nil { return nil, nil, err } - r := new(PullRequestReview) - resp, err := s.client.Do(ctx, req, r) + var r *PullRequestReview + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/pulls_threads.go b/vendor/github.com/google/go-github/v88/github/pulls_threads.go similarity index 100% rename from vendor/github.com/google/go-github/v73/github/pulls_threads.go rename to vendor/github.com/google/go-github/v88/github/pulls_threads.go diff --git a/vendor/github.com/google/go-github/v73/github/rate_limit.go b/vendor/github.com/google/go-github/v88/github/rate_limit.go similarity index 82% rename from vendor/github.com/google/go-github/v73/github/rate_limit.go rename to vendor/github.com/google/go-github/v88/github/rate_limit.go index 6236eba8f..a63f8382d 100644 --- a/vendor/github.com/google/go-github/v73/github/rate_limit.go +++ b/vendor/github.com/google/go-github/v88/github/rate_limit.go @@ -26,7 +26,7 @@ type Rate struct { // The rate limit resource that the request counted against. // For more information about the different resources, see REST API endpoints for rate limits. - // GitHub API docs: https://docs.github.com/en/rest/rate-limit/rate-limit#get-rate-limit-status-for-the-authenticated-user + // GitHub API docs: https://docs.github.com/rest/rate-limit/rate-limit?apiVersion=2022-11-28#get-rate-limit-status-for-the-authenticated-user Resource string `json:"resource,omitempty"` } @@ -40,20 +40,20 @@ type RateLimits struct { // requests are limited to 60 per hour. Authenticated requests are // limited to 5,000 per hour. // - // GitHub API docs: https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting + // GitHub API docs: https://docs.github.com/rest/overview/resources-in-the-rest-api?apiVersion=2022-11-28#rate-limiting Core *Rate `json:"core"` // The rate limit for search API requests. Unauthenticated requests // are limited to 10 requests per minutes. Authenticated requests are // limited to 30 per minute. // - // GitHub API docs: https://docs.github.com/en/rest/search#rate-limit + // GitHub API docs: https://docs.github.com/rest/search?apiVersion=2022-11-28#rate-limit Search *Rate `json:"search"` // GitHub API docs: https://docs.github.com/en/graphql/overview/resource-limitations#rate-limit GraphQL *Rate `json:"graphql"` - // GitHub API dos: https://docs.github.com/en/rest/rate-limit + // GitHub API docs: https://docs.github.com/rest/rate-limit?apiVersion=2022-11-28 IntegrationManifest *Rate `json:"integration_manifest"` SourceImport *Rate `json:"source_import"` @@ -63,6 +63,7 @@ type RateLimits struct { DependencySnapshots *Rate `json:"dependency_snapshots"` CodeSearch *Rate `json:"code_search"` AuditLog *Rate `json:"audit_log"` + DependencySBOM *Rate `json:"dependency_sbom"` } func (r RateLimits) String() string { @@ -71,11 +72,16 @@ func (r RateLimits) String() string { // Get returns the rate limits for the current client. // -// GitHub API docs: https://docs.github.com/rest/rate-limit/rate-limit#get-rate-limit-status-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/rate-limit/rate-limit?apiVersion=2022-11-28#get-rate-limit-status-for-the-authenticated-user // //meta:operation GET /rate_limit func (s *RateLimitService) Get(ctx context.Context) (*RateLimits, *Response, error) { - req, err := s.client.NewRequest("GET", "rate_limit", nil) + // This resource is not subject to rate limits. + if !s.client.disableRateLimitCheck { + ctx = context.WithValue(ctx, BypassRateLimitCheck, true) + } + + req, err := s.client.NewRequest(ctx, "GET", "rate_limit", nil) if err != nil { return nil, nil, err } @@ -84,9 +90,7 @@ func (s *RateLimitService) Get(ctx context.Context) (*RateLimits, *Response, err Resources *RateLimits `json:"resources"` }) - // This resource is not subject to rate limits. - ctx = context.WithValue(ctx, BypassRateLimitCheck, true) - resp, err := s.client.Do(ctx, req, response) + resp, err := s.client.Do(req, response) if err != nil { return nil, resp, err } @@ -126,6 +130,9 @@ func (s *RateLimitService) Get(ctx context.Context) (*RateLimits, *Response, err if response.Resources.AuditLog != nil { s.client.rateLimits[AuditLogCategory] = *response.Resources.AuditLog } + if response.Resources.DependencySBOM != nil { + s.client.rateLimits[DependencySBOMCategory] = *response.Resources.DependencySBOM + } s.client.rateMu.Unlock() } diff --git a/vendor/github.com/google/go-github/v73/github/reactions.go b/vendor/github.com/google/go-github/v88/github/reactions.go similarity index 83% rename from vendor/github.com/google/go-github/v73/github/reactions.go rename to vendor/github.com/google/go-github/v88/github/reactions.go index 5233f78d3..daf44c36f 100644 --- a/vendor/github.com/google/go-github/v73/github/reactions.go +++ b/vendor/github.com/google/go-github/v88/github/reactions.go @@ -8,13 +8,12 @@ package github import ( "context" "fmt" - "net/http" ) // ReactionsService provides access to the reactions-related functions in the // GitHub API. // -// GitHub API docs: https://docs.github.com/rest/reactions +// GitHub API docs: https://docs.github.com/rest/reactions?apiVersion=2022-11-28 type ReactionsService service // Reaction represents a GitHub reaction. @@ -60,7 +59,7 @@ type ListReactionOptions struct { // ListCommentReactions lists the reactions for a commit comment. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-commit-comment +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#list-reactions-for-a-commit-comment // //meta:operation GET /repos/{owner}/{repo}/comments/{comment_id}/reactions func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListReactionOptions) ([]*Reaction, *Response, error) { @@ -70,16 +69,15 @@ func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -92,23 +90,22 @@ func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo // previously created reaction will be returned with Status: 200 OK. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-commit-comment +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#create-reaction-for-a-commit-comment // //meta:operation POST /repos/{owner}/{repo}/comments/{comment_id}/reactions func (s *ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id) - body := &Reaction{Content: Ptr(content)} - req, err := s.client.NewRequest("POST", u, body) + body := &Reaction{Content: &content} + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) + var m *Reaction + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -118,7 +115,7 @@ func (s *ReactionsService) CreateCommentReaction(ctx context.Context, owner, rep // DeleteCommentReaction deletes the reaction for a commit comment. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-a-commit-comment-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#delete-a-commit-comment-reaction // //meta:operation DELETE /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id} func (s *ReactionsService) DeleteCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { @@ -129,7 +126,7 @@ func (s *ReactionsService) DeleteCommentReaction(ctx context.Context, owner, rep // DeleteCommentReactionByID deletes the reaction for a commit comment by repository ID. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-a-commit-comment-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#delete-a-commit-comment-reaction // //meta:operation DELETE /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id} func (s *ReactionsService) DeleteCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { @@ -140,7 +137,7 @@ func (s *ReactionsService) DeleteCommentReactionByID(ctx context.Context, repoID // ListIssueReactions lists the reactions for an issue. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#list-reactions-for-an-issue +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#list-reactions-for-an-issue // //meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/reactions func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo string, number int, opts *ListReactionOptions) ([]*Reaction, *Response, error) { @@ -150,16 +147,15 @@ func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo s return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -172,23 +168,22 @@ func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo s // previously created reaction will be returned with Status: 200 OK. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#create-reaction-for-an-issue +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#create-reaction-for-an-issue // //meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/reactions func (s *ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo string, number int, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number) - body := &Reaction{Content: Ptr(content)} - req, err := s.client.NewRequest("POST", u, body) + body := &Reaction{Content: &content} + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) + var m *Reaction + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -198,7 +193,7 @@ func (s *ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo // DeleteIssueReaction deletes the reaction to an issue. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-an-issue-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#delete-an-issue-reaction // //meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id} func (s *ReactionsService) DeleteIssueReaction(ctx context.Context, owner, repo string, issueNumber int, reactionID int64) (*Response, error) { @@ -209,7 +204,7 @@ func (s *ReactionsService) DeleteIssueReaction(ctx context.Context, owner, repo // DeleteIssueReactionByID deletes the reaction to an issue by repository ID. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-an-issue-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#delete-an-issue-reaction // //meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id} func (s *ReactionsService) DeleteIssueReactionByID(ctx context.Context, repoID, issueNumber int, reactionID int64) (*Response, error) { @@ -220,7 +215,7 @@ func (s *ReactionsService) DeleteIssueReactionByID(ctx context.Context, repoID, // ListIssueCommentReactions lists the reactions for an issue comment. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#list-reactions-for-an-issue-comment +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#list-reactions-for-an-issue-comment // //meta:operation GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListReactionOptions) ([]*Reaction, *Response, error) { @@ -230,16 +225,15 @@ func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -252,23 +246,22 @@ func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, // previously created reaction will be returned with Status: 200 OK. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#create-reaction-for-an-issue-comment +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#create-reaction-for-an-issue-comment // //meta:operation POST /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions func (s *ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id) - body := &Reaction{Content: Ptr(content)} - req, err := s.client.NewRequest("POST", u, body) + body := &Reaction{Content: &content} + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) + var m *Reaction + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -278,7 +271,7 @@ func (s *ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner // DeleteIssueCommentReaction deletes the reaction to an issue comment. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-an-issue-comment-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#delete-an-issue-comment-reaction // //meta:operation DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id} func (s *ReactionsService) DeleteIssueCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { @@ -289,7 +282,7 @@ func (s *ReactionsService) DeleteIssueCommentReaction(ctx context.Context, owner // DeleteIssueCommentReactionByID deletes the reaction to an issue comment by repository ID. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-an-issue-comment-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#delete-an-issue-comment-reaction // //meta:operation DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id} func (s *ReactionsService) DeleteIssueCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { @@ -300,7 +293,7 @@ func (s *ReactionsService) DeleteIssueCommentReactionByID(ctx context.Context, r // ListPullRequestCommentReactions lists the reactions for a pull request review comment. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-pull-request-review-comment +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#list-reactions-for-a-pull-request-review-comment // //meta:operation GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListReactionOptions) ([]*Reaction, *Response, error) { @@ -310,16 +303,15 @@ func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -332,23 +324,22 @@ func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, // previously created reaction will be returned with Status: 200 OK. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-pull-request-review-comment +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#create-reaction-for-a-pull-request-review-comment // //meta:operation POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions func (s *ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id) - body := &Reaction{Content: Ptr(content)} - req, err := s.client.NewRequest("POST", u, body) + body := &Reaction{Content: &content} + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) + var m *Reaction + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -358,7 +349,7 @@ func (s *ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, // DeletePullRequestCommentReaction deletes the reaction to a pull request review comment. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-a-pull-request-comment-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#delete-a-pull-request-comment-reaction // //meta:operation DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id} func (s *ReactionsService) DeletePullRequestCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { @@ -369,7 +360,7 @@ func (s *ReactionsService) DeletePullRequestCommentReaction(ctx context.Context, // DeletePullRequestCommentReactionByID deletes the reaction to a pull request review comment by repository ID. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-a-pull-request-comment-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#delete-a-pull-request-comment-reaction // //meta:operation DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id} func (s *ReactionsService) DeletePullRequestCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { @@ -380,7 +371,7 @@ func (s *ReactionsService) DeletePullRequestCommentReactionByID(ctx context.Cont // ListTeamDiscussionReactions lists the reactions for a team discussion. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-team-discussion-legacy +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/reactions/reactions#list-reactions-for-a-team-discussion-legacy // //meta:operation GET /teams/{team_id}/discussions/{discussion_number}/reactions func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, teamID int64, discussionNumber int, opts *ListReactionOptions) ([]*Reaction, *Response, error) { @@ -390,7 +381,7 @@ func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, team return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } @@ -398,7 +389,7 @@ func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, team req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -409,22 +400,22 @@ func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, team // CreateTeamDiscussionReaction creates a reaction for a team discussion. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion-legacy +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/reactions/reactions#create-reaction-for-a-team-discussion-legacy // //meta:operation POST /teams/{team_id}/discussions/{discussion_number}/reactions func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, teamID int64, discussionNumber int, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber) - body := &Reaction{Content: Ptr(content)} - req, err := s.client.NewRequest("POST", u, body) + body := &Reaction{Content: &content} + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeReactionsPreview) - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) + var m *Reaction + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -434,7 +425,7 @@ func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, tea // DeleteTeamDiscussionReaction deletes the reaction to a team discussion. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-team-discussion-reaction +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/reactions/reactions#delete-team-discussion-reaction // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id} func (s *ReactionsService) DeleteTeamDiscussionReaction(ctx context.Context, org, teamSlug string, discussionNumber int, reactionID int64) (*Response, error) { @@ -445,7 +436,7 @@ func (s *ReactionsService) DeleteTeamDiscussionReaction(ctx context.Context, org // DeleteTeamDiscussionReactionByOrgIDAndTeamID deletes the reaction to a team discussion by organization ID and team ID. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/reactions/reactions#create-reaction-for-a-team-discussion // //meta:operation POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions func (s *ReactionsService) DeleteTeamDiscussionReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber int, reactionID int64) (*Response, error) { @@ -456,7 +447,7 @@ func (s *ReactionsService) DeleteTeamDiscussionReactionByOrgIDAndTeamID(ctx cont // ListTeamDiscussionCommentReactions lists the reactions for a team discussion comment. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-team-discussion-comment-legacy +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/reactions/reactions#list-reactions-for-a-team-discussion-comment-legacy // //meta:operation GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Context, teamID int64, discussionNumber, commentNumber int, opts *ListReactionOptions) ([]*Reaction, *Response, error) { @@ -466,7 +457,7 @@ func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Contex return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } @@ -474,7 +465,7 @@ func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Contex req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -484,22 +475,22 @@ func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Contex // CreateTeamDiscussionCommentReaction creates a reaction for a team discussion comment. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion-comment-legacy +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/reactions/reactions#create-reaction-for-a-team-discussion-comment-legacy // //meta:operation POST /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Context, teamID int64, discussionNumber, commentNumber int, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber) - body := &Reaction{Content: Ptr(content)} - req, err := s.client.NewRequest("POST", u, body) + body := &Reaction{Content: &content} + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeReactionsPreview) - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) + var m *Reaction + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -509,7 +500,7 @@ func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Conte // DeleteTeamDiscussionCommentReaction deletes the reaction to a team discussion comment. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-team-discussion-comment-reaction +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/reactions/reactions#delete-team-discussion-comment-reaction // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id} func (s *ReactionsService) DeleteTeamDiscussionCommentReaction(ctx context.Context, org, teamSlug string, discussionNumber, commentNumber int, reactionID int64) (*Response, error) { @@ -520,7 +511,7 @@ func (s *ReactionsService) DeleteTeamDiscussionCommentReaction(ctx context.Conte // DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID deletes the reaction to a team discussion comment by organization ID and team ID. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion-comment +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/reactions/reactions#create-reaction-for-a-team-discussion-comment // //meta:operation POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions func (s *ReactionsService) DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber, commentNumber int, reactionID int64) (*Response, error) { @@ -530,15 +521,14 @@ func (s *ReactionsService) DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID(c } func (s *ReactionsService) deleteReaction(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest(http.MethodDelete, url, nil) + req, err := s.client.NewRequest(ctx, "DELETE", url, nil) if err != nil { return nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // CreateReleaseReaction creates a reaction to a release. @@ -546,22 +536,22 @@ func (s *ReactionsService) deleteReaction(ctx context.Context, url string) (*Res // added the reaction type to this release. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-release +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#create-reaction-for-a-release // //meta:operation POST /repos/{owner}/{repo}/releases/{release_id}/reactions func (s *ReactionsService) CreateReleaseReaction(ctx context.Context, owner, repo string, releaseID int64, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/releases/%v/reactions", owner, repo, releaseID) - body := &Reaction{Content: Ptr(content)} - req, err := s.client.NewRequest("POST", u, body) + body := &Reaction{Content: &content} + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeReactionsPreview) - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) + var m *Reaction + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -571,7 +561,7 @@ func (s *ReactionsService) CreateReleaseReaction(ctx context.Context, owner, rep // ListReleaseReactions lists the reactions for a release. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-release +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#list-reactions-for-a-release // //meta:operation GET /repos/{owner}/{repo}/releases/{release_id}/reactions func (s *ReactionsService) ListReleaseReactions(ctx context.Context, owner, repo string, releaseID int64, opts *ListReactionOptions) ([]*Reaction, *Response, error) { @@ -581,16 +571,15 @@ func (s *ReactionsService) ListReleaseReactions(ctx context.Context, owner, repo return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -600,7 +589,7 @@ func (s *ReactionsService) ListReleaseReactions(ctx context.Context, owner, repo // DeleteReleaseReaction deletes the reaction for a release. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-a-release-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#delete-a-release-reaction // //meta:operation DELETE /repos/{owner}/{repo}/releases/{release_id}/reactions/{reaction_id} func (s *ReactionsService) DeleteReleaseReaction(ctx context.Context, owner, repo string, releaseID, reactionID int64) (*Response, error) { @@ -611,7 +600,7 @@ func (s *ReactionsService) DeleteReleaseReaction(ctx context.Context, owner, rep // DeleteReleaseReactionByID deletes the reaction for a release by repository ID. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-a-release-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#delete-a-release-reaction // //meta:operation DELETE /repos/{owner}/{repo}/releases/{release_id}/reactions/{reaction_id} func (s *ReactionsService) DeleteReleaseReactionByID(ctx context.Context, repoID, releaseID, reactionID int64) (*Response, error) { diff --git a/vendor/github.com/google/go-github/v73/github/repos.go b/vendor/github.com/google/go-github/v88/github/repos.go similarity index 77% rename from vendor/github.com/google/go-github/v73/github/repos.go rename to vendor/github.com/google/go-github/v88/github/repos.go index 714835343..b3e41a5f7 100644 --- a/vendor/github.com/google/go-github/v73/github/repos.go +++ b/vendor/github.com/google/go-github/v88/github/repos.go @@ -22,64 +22,64 @@ var ErrBranchNotProtected = errors.New("branch is not protected") // RepositoriesService handles communication with the repository related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/repos/ +// GitHub API docs: https://docs.github.com/rest/repos?apiVersion=2022-11-28 type RepositoriesService service // Repository represents a GitHub repository. type Repository struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Owner *User `json:"owner,omitempty"` - Name *string `json:"name,omitempty"` - FullName *string `json:"full_name,omitempty"` - Description *string `json:"description,omitempty"` - Homepage *string `json:"homepage,omitempty"` - CodeOfConduct *CodeOfConduct `json:"code_of_conduct,omitempty"` - DefaultBranch *string `json:"default_branch,omitempty"` - MasterBranch *string `json:"master_branch,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - PushedAt *Timestamp `json:"pushed_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - CloneURL *string `json:"clone_url,omitempty"` - GitURL *string `json:"git_url,omitempty"` - MirrorURL *string `json:"mirror_url,omitempty"` - SSHURL *string `json:"ssh_url,omitempty"` - SVNURL *string `json:"svn_url,omitempty"` - Language *string `json:"language,omitempty"` - Fork *bool `json:"fork,omitempty"` - ForksCount *int `json:"forks_count,omitempty"` - NetworkCount *int `json:"network_count,omitempty"` - OpenIssuesCount *int `json:"open_issues_count,omitempty"` - OpenIssues *int `json:"open_issues,omitempty"` // Deprecated: Replaced by OpenIssuesCount. For backward compatibility OpenIssues is still populated. - StargazersCount *int `json:"stargazers_count,omitempty"` - SubscribersCount *int `json:"subscribers_count,omitempty"` - WatchersCount *int `json:"watchers_count,omitempty"` // Deprecated: Replaced by StargazersCount. For backward compatibility WatchersCount is still populated. - Watchers *int `json:"watchers,omitempty"` // Deprecated: Replaced by StargazersCount. For backward compatibility Watchers is still populated. - Size *int `json:"size,omitempty"` - AutoInit *bool `json:"auto_init,omitempty"` - Parent *Repository `json:"parent,omitempty"` - Source *Repository `json:"source,omitempty"` - TemplateRepository *Repository `json:"template_repository,omitempty"` - Organization *Organization `json:"organization,omitempty"` - Permissions map[string]bool `json:"permissions,omitempty"` - AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"` - AllowUpdateBranch *bool `json:"allow_update_branch,omitempty"` - AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"` - AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"` - AllowAutoMerge *bool `json:"allow_auto_merge,omitempty"` - AllowForking *bool `json:"allow_forking,omitempty"` - WebCommitSignoffRequired *bool `json:"web_commit_signoff_required,omitempty"` - DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` - UseSquashPRTitleAsDefault *bool `json:"use_squash_pr_title_as_default,omitempty"` - SquashMergeCommitTitle *string `json:"squash_merge_commit_title,omitempty"` // Can be one of: "PR_TITLE", "COMMIT_OR_PR_TITLE" - SquashMergeCommitMessage *string `json:"squash_merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "COMMIT_MESSAGES", "BLANK" - MergeCommitTitle *string `json:"merge_commit_title,omitempty"` // Can be one of: "PR_TITLE", "MERGE_MESSAGE" - MergeCommitMessage *string `json:"merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "PR_TITLE", "BLANK" - Topics []string `json:"topics,omitempty"` - CustomProperties map[string]any `json:"custom_properties,omitempty"` - Archived *bool `json:"archived,omitempty"` - Disabled *bool `json:"disabled,omitempty"` + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Owner *User `json:"owner,omitempty"` + Name *string `json:"name,omitempty"` + FullName *string `json:"full_name,omitempty"` + Description *string `json:"description,omitempty"` + Homepage *string `json:"homepage,omitempty"` + CodeOfConduct *CodeOfConduct `json:"code_of_conduct,omitempty"` + DefaultBranch *string `json:"default_branch,omitempty"` + MasterBranch *string `json:"master_branch,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + PushedAt *Timestamp `json:"pushed_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + CloneURL *string `json:"clone_url,omitempty"` + GitURL *string `json:"git_url,omitempty"` + MirrorURL *string `json:"mirror_url,omitempty"` + SSHURL *string `json:"ssh_url,omitempty"` + SVNURL *string `json:"svn_url,omitempty"` + Language *string `json:"language,omitempty"` + Fork *bool `json:"fork,omitempty"` + ForksCount *int `json:"forks_count,omitempty"` + NetworkCount *int `json:"network_count,omitempty"` + OpenIssuesCount *int `json:"open_issues_count,omitempty"` + OpenIssues *int `json:"open_issues,omitempty"` // Deprecated: Replaced by OpenIssuesCount. For backward compatibility OpenIssues is still populated. + StargazersCount *int `json:"stargazers_count,omitempty"` + SubscribersCount *int `json:"subscribers_count,omitempty"` + WatchersCount *int `json:"watchers_count,omitempty"` // Deprecated: Replaced by StargazersCount. For backward compatibility WatchersCount is still populated. + Watchers *int `json:"watchers,omitempty"` // Deprecated: Replaced by StargazersCount. For backward compatibility Watchers is still populated. + Size *int `json:"size,omitempty"` + AutoInit *bool `json:"auto_init,omitempty"` + Parent *Repository `json:"parent,omitempty"` + Source *Repository `json:"source,omitempty"` + TemplateRepository *Repository `json:"template_repository,omitempty"` + Organization *Organization `json:"organization,omitempty"` + Permissions *RepositoryPermissions `json:"permissions,omitempty"` + AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"` + AllowUpdateBranch *bool `json:"allow_update_branch,omitempty"` + AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"` + AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"` + AllowAutoMerge *bool `json:"allow_auto_merge,omitempty"` + AllowForking *bool `json:"allow_forking,omitempty"` + WebCommitSignoffRequired *bool `json:"web_commit_signoff_required,omitempty"` + DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` + UseSquashPRTitleAsDefault *bool `json:"use_squash_pr_title_as_default,omitempty"` + SquashMergeCommitTitle *string `json:"squash_merge_commit_title,omitempty"` // Can be one of: "PR_TITLE", "COMMIT_OR_PR_TITLE" + SquashMergeCommitMessage *string `json:"squash_merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "COMMIT_MESSAGES", "BLANK" + MergeCommitTitle *string `json:"merge_commit_title,omitempty"` // Can be one of: "PR_TITLE", "MERGE_MESSAGE" + MergeCommitMessage *string `json:"merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "PR_TITLE", "BLANK" + Topics []string `json:"topics,omitempty"` + CustomProperties map[string]any `json:"custom_properties,omitempty"` + Archived *bool `json:"archived,omitempty"` + Disabled *bool `json:"disabled,omitempty"` // Only provided when using RepositoriesService.Get while in preview License *License `json:"license,omitempty"` @@ -142,7 +142,7 @@ type Repository struct { TeamsURL *string `json:"teams_url,omitempty"` // TextMatches is only populated from search results that request text matches - // See: search.go and https://docs.github.com/rest/search/#text-match-metadata + // See: search.go and https://docs.github.com/rest/search?apiVersion=2022-11-28#text-match-metadata TextMatches []*TextMatch `json:"text_matches,omitempty"` // Visibility is only used for Create and Edit endpoints. The visibility field @@ -151,7 +151,7 @@ type Repository struct { Visibility *string `json:"visibility,omitempty"` // RoleName is only returned by the API 'check team permissions for a repository'. - // See: teams.go (IsTeamRepoByID) https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-repository + // See: teams.go (IsTeamRepoByID) https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#check-team-permissions-for-a-repository RoleName *string `json:"role_name,omitempty"` } @@ -200,6 +200,16 @@ type SecurityAndAnalysis struct { SecretScanningPushProtection *SecretScanningPushProtection `json:"secret_scanning_push_protection,omitempty"` DependabotSecurityUpdates *DependabotSecurityUpdates `json:"dependabot_security_updates,omitempty"` SecretScanningValidityChecks *SecretScanningValidityChecks `json:"secret_scanning_validity_checks,omitempty"` + CodeSecurity *CodeSecurity `json:"code_security,omitempty"` +} + +// RepositoryPermissions represents the permissions a user has for a repository. +type RepositoryPermissions struct { + Admin *bool `json:"admin,omitempty"` + Maintain *bool `json:"maintain,omitempty"` + Push *bool `json:"push,omitempty"` + Triage *bool `json:"triage,omitempty"` + Pull *bool `json:"pull,omitempty"` } func (s SecurityAndAnalysis) String() string { @@ -257,13 +267,25 @@ type SecretScanningValidityChecks struct { Status *string `json:"status,omitempty"` } +// CodeSecurity represents the state of code security on a repository. +// +// GitHub API docs: https://docs.github.com/en/code-security/getting-started/github-security-features#available-with-github-code-security +type CodeSecurity struct { + Status *string `json:"status,omitempty"` +} + +func (c CodeSecurity) String() string { + return Stringify(c) +} + // List calls either RepositoriesService.ListByUser or RepositoriesService.ListByAuthenticatedUser // depending on whether user is empty. // // Deprecated: Use RepositoriesService.ListByUser or RepositoriesService.ListByAuthenticatedUser instead. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#list-repositories-for-a-user -// GitHub API docs: https://docs.github.com/rest/repos/repos#list-repositories-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-repositories-for-a-user +// +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-repositories-for-the-authenticated-user // //meta:operation GET /user/repos //meta:operation GET /users/{username}/repos @@ -303,7 +325,7 @@ type RepositoryListByUserOptions struct { Sort string `url:"sort,omitempty"` // The order to sort by. - // Default: asc when using full_name, otherwise desc. + // Default: asc when using full_name; otherwise, desc. // Can be one of: asc, desc Direction string `url:"direction,omitempty"` @@ -312,7 +334,7 @@ type RepositoryListByUserOptions struct { // ListByUser lists public repositories for the specified user. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#list-repositories-for-a-user +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-repositories-for-a-user // //meta:operation GET /users/{username}/repos func (s *RepositoriesService) ListByUser(ctx context.Context, user string, opts *RepositoryListByUserOptions) ([]*Repository, *Response, error) { @@ -322,13 +344,13 @@ func (s *RepositoriesService) ListByUser(ctx context.Context, user string, opts return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var repos []*Repository - resp, err := s.client.Do(ctx, req, &repos) + resp, err := s.client.Do(req, &repos) if err != nil { return nil, resp, err } @@ -375,7 +397,7 @@ type RepositoryListByAuthenticatedUserOptions struct { // ListByAuthenticatedUser lists repositories for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#list-repositories-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-repositories-for-the-authenticated-user // //meta:operation GET /user/repos func (s *RepositoriesService) ListByAuthenticatedUser(ctx context.Context, opts *RepositoryListByAuthenticatedUserOptions) ([]*Repository, *Response, error) { @@ -385,13 +407,13 @@ func (s *RepositoriesService) ListByAuthenticatedUser(ctx context.Context, opts return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var repos []*Repository - resp, err := s.client.Do(ctx, req, &repos) + resp, err := s.client.Do(req, &repos) if err != nil { return nil, resp, err } @@ -419,7 +441,7 @@ type RepositoryListByOrgOptions struct { // ListByOrg lists the repositories for an organization. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#list-organization-repositories +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-organization-repositories // //meta:operation GET /orgs/{org}/repos func (s *RepositoriesService) ListByOrg(ctx context.Context, org string, opts *RepositoryListByOrgOptions) ([]*Repository, *Response, error) { @@ -429,17 +451,16 @@ func (s *RepositoriesService) ListByOrg(ctx context.Context, org string, opts *R return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. acceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) var repos []*Repository - resp, err := s.client.Do(ctx, req, &repos) + resp, err := s.client.Do(req, &repos) if err != nil { return nil, resp, err } @@ -456,7 +477,7 @@ type RepositoryListAllOptions struct { // ListAll lists all GitHub repositories in the order that they were created. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#list-public-repositories +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-public-repositories // //meta:operation GET /repositories func (s *RepositoriesService) ListAll(ctx context.Context, opts *RepositoryListAllOptions) ([]*Repository, *Response, error) { @@ -465,13 +486,13 @@ func (s *RepositoriesService) ListAll(ctx context.Context, opts *RepositoryListA return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var repos []*Repository - resp, err := s.client.Do(ctx, req, &repos) + resp, err := s.client.Do(req, &repos) if err != nil { return nil, resp, err } @@ -501,21 +522,22 @@ type createRepoRequest struct { // Creating an organization repository. Required for non-owners. TeamID *int64 `json:"team_id,omitempty"` - AutoInit *bool `json:"auto_init,omitempty"` - GitignoreTemplate *string `json:"gitignore_template,omitempty"` - LicenseTemplate *string `json:"license_template,omitempty"` - AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"` - AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"` - AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"` - AllowUpdateBranch *bool `json:"allow_update_branch,omitempty"` - AllowAutoMerge *bool `json:"allow_auto_merge,omitempty"` - AllowForking *bool `json:"allow_forking,omitempty"` - DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` - UseSquashPRTitleAsDefault *bool `json:"use_squash_pr_title_as_default,omitempty"` - SquashMergeCommitTitle *string `json:"squash_merge_commit_title,omitempty"` - SquashMergeCommitMessage *string `json:"squash_merge_commit_message,omitempty"` - MergeCommitTitle *string `json:"merge_commit_title,omitempty"` - MergeCommitMessage *string `json:"merge_commit_message,omitempty"` + AutoInit *bool `json:"auto_init,omitempty"` + GitignoreTemplate *string `json:"gitignore_template,omitempty"` + LicenseTemplate *string `json:"license_template,omitempty"` + AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"` + AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"` + AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"` + AllowUpdateBranch *bool `json:"allow_update_branch,omitempty"` + AllowAutoMerge *bool `json:"allow_auto_merge,omitempty"` + AllowForking *bool `json:"allow_forking,omitempty"` + DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` + UseSquashPRTitleAsDefault *bool `json:"use_squash_pr_title_as_default,omitempty"` + SquashMergeCommitTitle *string `json:"squash_merge_commit_title,omitempty"` + SquashMergeCommitMessage *string `json:"squash_merge_commit_message,omitempty"` + MergeCommitTitle *string `json:"merge_commit_title,omitempty"` + MergeCommitMessage *string `json:"merge_commit_message,omitempty"` + CustomProperties map[string]any `json:"custom_properties,omitempty"` } // Create a new repository. If an organization is specified, the new @@ -530,12 +552,17 @@ type createRepoRequest struct { // changes propagate throughout its servers. You may set up a loop with // exponential back-off to verify repository's creation. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#create-a-repository-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/rest/repos/repos#create-an-organization-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#create-a-repository-for-the-authenticated-user +// +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#create-an-organization-repository // //meta:operation POST /orgs/{org}/repos //meta:operation POST /user/repos func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repository) (*Repository, *Response, error) { + if repo == nil { + return nil, nil, errors.New("repository must be provided") + } + var u string if org != "" { u = fmt.Sprintf("orgs/%v/repos", org) @@ -570,17 +597,18 @@ func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repo SquashMergeCommitMessage: repo.SquashMergeCommitMessage, MergeCommitTitle: repo.MergeCommitTitle, MergeCommitMessage: repo.MergeCommitMessage, + CustomProperties: repo.CustomProperties, } - req, err := s.client.NewRequest("POST", u, repoReq) + req, err := s.client.NewRequest(ctx, "POST", u, repoReq) if err != nil { return nil, nil, err } acceptHeaders := []string{mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - r := new(Repository) - resp, err := s.client.Do(ctx, req, r) + var r *Repository + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -601,20 +629,20 @@ type TemplateRepoRequest struct { // CreateFromTemplate generates a repository from a template. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#create-a-repository-using-a-template +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#create-a-repository-using-a-template // //meta:operation POST /repos/{template_owner}/{template_repo}/generate func (s *RepositoriesService) CreateFromTemplate(ctx context.Context, templateOwner, templateRepo string, templateRepoReq *TemplateRepoRequest) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/generate", templateOwner, templateRepo) - req, err := s.client.NewRequest("POST", u, templateRepoReq) + req, err := s.client.NewRequest(ctx, "POST", u, templateRepoReq) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeRepositoryTemplatePreview) - r := new(Repository) - resp, err := s.client.Do(ctx, req, r) + var r *Repository + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -624,18 +652,17 @@ func (s *RepositoriesService) CreateFromTemplate(ctx context.Context, templateOw // Get fetches a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#get-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#get-a-repository // //meta:operation GET /repos/{owner}/{repo} func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when the license support fully launches - // https://docs.github.com/rest/licenses/#get-a-repositorys-license + // https://docs.github.com/rest/licenses?apiVersion=2022-11-28#get-a-repositorys-license acceptHeaders := []string{ mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview, @@ -644,8 +671,8 @@ func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Rep } req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - repository := new(Repository) - resp, err := s.client.Do(ctx, req, repository) + var repository *Repository + resp, err := s.client.Do(req, &repository) if err != nil { return nil, resp, err } @@ -654,24 +681,23 @@ func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Rep } // GetCodeOfConduct gets the contents of a repository's code of conduct. -// Note that https://docs.github.com/rest/codes-of-conduct#about-the-codes-of-conduct-api +// Note that https://docs.github.com/rest/codes-of-conduct?apiVersion=2022-11-28#about-the-codes-of-conduct-api // says to use the GET /repos/{owner}/{repo} endpoint. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#get-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#get-a-repository // //meta:operation GET /repos/{owner}/{repo} func (s *RepositoriesService) GetCodeOfConduct(ctx context.Context, owner, repo string) (*CodeOfConduct, *Response, error) { u := fmt.Sprintf("repos/%v/%v", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeCodesOfConductPreview) - r := new(Repository) - resp, err := s.client.Do(ctx, req, r) + var r *Repository + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -685,14 +711,14 @@ func (s *RepositoriesService) GetCodeOfConduct(ctx context.Context, owner, repo // //meta:operation GET /repositories/{repository_id} func (s *RepositoriesService) GetByID(ctx context.Context, id int64) (*Repository, *Response, error) { - u := fmt.Sprintf("repositories/%d", id) - req, err := s.client.NewRequest("GET", u, nil) + u := fmt.Sprintf("repositories/%v", id) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - repository := new(Repository) - resp, err := s.client.Do(ctx, req, repository) + var repository *Repository + resp, err := s.client.Do(req, &repository) if err != nil { return nil, resp, err } @@ -702,20 +728,20 @@ func (s *RepositoriesService) GetByID(ctx context.Context, id int64) (*Repositor // Edit updates a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#update-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#update-a-repository // //meta:operation PATCH /repos/{owner}/{repo} func (s *RepositoriesService) Edit(ctx context.Context, owner, repo string, repository *Repository) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v", owner, repo) - req, err := s.client.NewRequest("PATCH", u, repository) + req, err := s.client.NewRequest(ctx, "PATCH", u, repository) if err != nil { return nil, nil, err } acceptHeaders := []string{mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - r := new(Repository) - resp, err := s.client.Do(ctx, req, r) + var r *Repository + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -725,17 +751,17 @@ func (s *RepositoriesService) Edit(ctx context.Context, owner, repo string, repo // Delete a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#delete-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#delete-a-repository // //meta:operation DELETE /repos/{owner}/{repo} func (s *RepositoriesService) Delete(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v", owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // Contributor represents a repository contributor. @@ -774,78 +800,75 @@ type ListContributorsOptions struct { // GetVulnerabilityAlerts checks if vulnerability alerts are enabled for a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#check-if-vulnerability-alerts-are-enabled-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#check-if-vulnerability-alerts-are-enabled-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/vulnerability-alerts func (s *RepositoriesService) GetVulnerabilityAlerts(ctx context.Context, owner, repository string) (bool, *Response, error) { u := fmt.Sprintf("repos/%v/%v/vulnerability-alerts", owner, repository) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return false, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredVulnerabilityAlertsPreview) - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) vulnerabilityAlertsEnabled, err := parseBoolResponse(err) return vulnerabilityAlertsEnabled, resp, err } // EnableVulnerabilityAlerts enables vulnerability alerts and the dependency graph for a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#enable-vulnerability-alerts +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#enable-vulnerability-alerts // //meta:operation PUT /repos/{owner}/{repo}/vulnerability-alerts func (s *RepositoriesService) EnableVulnerabilityAlerts(ctx context.Context, owner, repository string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/vulnerability-alerts", owner, repository) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredVulnerabilityAlertsPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DisableVulnerabilityAlerts disables vulnerability alerts and the dependency graph for a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#disable-vulnerability-alerts +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#disable-vulnerability-alerts // //meta:operation DELETE /repos/{owner}/{repo}/vulnerability-alerts func (s *RepositoriesService) DisableVulnerabilityAlerts(ctx context.Context, owner, repository string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/vulnerability-alerts", owner, repository) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredVulnerabilityAlertsPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // GetAutomatedSecurityFixes checks if the automated security fixes for a repository are enabled. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#check-if-dependabot-security-updates-are-enabled-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#check-if-dependabot-security-updates-are-enabled-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/automated-security-fixes func (s *RepositoriesService) GetAutomatedSecurityFixes(ctx context.Context, owner, repository string) (*AutomatedSecurityFixes, *Response, error) { u := fmt.Sprintf("repos/%v/%v/automated-security-fixes", owner, repository) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - p := new(AutomatedSecurityFixes) - resp, err := s.client.Do(ctx, req, p) + var p *AutomatedSecurityFixes + resp, err := s.client.Do(req, &p) if err != nil { return nil, resp, err } @@ -854,55 +877,55 @@ func (s *RepositoriesService) GetAutomatedSecurityFixes(ctx context.Context, own // EnableAutomatedSecurityFixes enables the automated security fixes for a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#enable-dependabot-security-updates +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#enable-dependabot-security-updates // //meta:operation PUT /repos/{owner}/{repo}/automated-security-fixes func (s *RepositoriesService) EnableAutomatedSecurityFixes(ctx context.Context, owner, repository string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/automated-security-fixes", owner, repository) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DisableAutomatedSecurityFixes disables vulnerability alerts and the dependency graph for a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#disable-dependabot-security-updates +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#disable-dependabot-security-updates // //meta:operation DELETE /repos/{owner}/{repo}/automated-security-fixes func (s *RepositoriesService) DisableAutomatedSecurityFixes(ctx context.Context, owner, repository string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/automated-security-fixes", owner, repository) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListContributors lists contributors for a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#list-repository-contributors +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-repository-contributors // //meta:operation GET /repos/{owner}/{repo}/contributors -func (s *RepositoriesService) ListContributors(ctx context.Context, owner string, repository string, opts *ListContributorsOptions) ([]*Contributor, *Response, error) { +func (s *RepositoriesService) ListContributors(ctx context.Context, owner, repository string, opts *ListContributorsOptions) ([]*Contributor, *Response, error) { u := fmt.Sprintf("repos/%v/%v/contributors", owner, repository) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var contributor []*Contributor - resp, err := s.client.Do(ctx, req, &contributor) + resp, err := s.client.Do(req, &contributor) if err != nil { return nil, resp, err } @@ -919,18 +942,18 @@ func (s *RepositoriesService) ListContributors(ctx context.Context, owner string // "Python": 7769 // } // -// GitHub API docs: https://docs.github.com/rest/repos/repos#list-repository-languages +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-repository-languages // //meta:operation GET /repos/{owner}/{repo}/languages -func (s *RepositoriesService) ListLanguages(ctx context.Context, owner string, repo string) (map[string]int, *Response, error) { +func (s *RepositoriesService) ListLanguages(ctx context.Context, owner, repo string) (map[string]int, *Response, error) { u := fmt.Sprintf("repos/%v/%v/languages", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } languages := make(map[string]int) - resp, err := s.client.Do(ctx, req, &languages) + resp, err := s.client.Do(req, &languages) if err != nil { return nil, resp, err } @@ -940,23 +963,23 @@ func (s *RepositoriesService) ListLanguages(ctx context.Context, owner string, r // ListTeams lists the teams for the specified repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#list-repository-teams +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-repository-teams // //meta:operation GET /repos/{owner}/{repo}/teams -func (s *RepositoriesService) ListTeams(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*Team, *Response, error) { +func (s *RepositoriesService) ListTeams(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Team, *Response, error) { u := fmt.Sprintf("repos/%v/%v/teams", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var teams []*Team - resp, err := s.client.Do(ctx, req, &teams) + resp, err := s.client.Do(req, &teams) if err != nil { return nil, resp, err } @@ -974,23 +997,23 @@ type RepositoryTag struct { // ListTags lists tags for the specified repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#list-repository-tags +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-repository-tags // //meta:operation GET /repos/{owner}/{repo}/tags -func (s *RepositoriesService) ListTags(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*RepositoryTag, *Response, error) { +func (s *RepositoriesService) ListTags(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryTag, *Response, error) { u := fmt.Sprintf("repos/%v/%v/tags", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var tags []*RepositoryTag - resp, err := s.client.Do(ctx, req, &tags) + resp, err := s.client.Do(req, &tags) if err != nil { return nil, resp, err } @@ -1010,7 +1033,8 @@ type Branch struct { // such as 'List branches'. In such cases, if branch protection is // enabled, Protected will be `true` but this will be nil, and // additional protection details can be obtained by calling GetBranch(). - Protection *Protection `json:"protection,omitempty"` + Protection *Protection `json:"protection,omitempty"` + ProtectionURL *string `json:"protection_url,omitempty"` } // Protection represents a repository branch's protection. @@ -1073,6 +1097,7 @@ type BranchProtectionRule struct { RequiredConversationResolutionLevel *string `json:"required_conversation_resolution_level,omitempty"` AuthorizedActorsOnly *bool `json:"authorized_actors_only,omitempty"` AuthorizedActorNames []string `json:"authorized_actor_names,omitempty"` + RequireLastPushApproval *bool `json:"require_last_push_approval,omitempty"` } // ProtectionChanges represents the changes to the rule if the BranchProtection was edited. @@ -1092,6 +1117,7 @@ type ProtectionChanges struct { RequiredStatusChecks *RequiredStatusChecksChanges `json:"required_status_checks,omitempty"` RequiredStatusChecksEnforcementLevel *RequiredStatusChecksEnforcementLevelChanges `json:"required_status_checks_enforcement_level,omitempty"` SignatureRequirementEnforcementLevel *SignatureRequirementEnforcementLevelChanges `json:"signature_requirement_enforcement_level,omitempty"` + RequireLastPushApproval *RequireLastPushApprovalChanges `json:"require_last_push_approval,omitempty"` } // AdminEnforcedChanges represents the changes made to the AdminEnforced policy. @@ -1169,6 +1195,11 @@ type SignatureRequirementEnforcementLevelChanges struct { From *string `json:"from,omitempty"` } +// RequireLastPushApprovalChanges represents the changes made to the RequireLastPushApproval policy. +type RequireLastPushApprovalChanges struct { + From *bool `json:"from,omitempty"` +} + // ProtectionRequest represents a request to create/edit a branch's protection. type ProtectionRequest struct { RequiredStatusChecks *RequiredStatusChecks `json:"required_status_checks"` @@ -1194,7 +1225,7 @@ type ProtectionRequest struct { AllowForkSyncing *bool `json:"allow_fork_syncing,omitempty"` } -// RequiredStatusChecks represents the protection status of a individual branch. +// RequiredStatusChecks represents the protection status of an individual branch. type RequiredStatusChecks struct { // Require branches to be up to date before merging. (Required.) Strict bool `json:"strict"` @@ -1400,23 +1431,23 @@ type AutomatedSecurityFixes struct { // ListBranches lists branches for the specified repository. // -// GitHub API docs: https://docs.github.com/rest/branches/branches#list-branches +// GitHub API docs: https://docs.github.com/rest/branches/branches?apiVersion=2022-11-28#list-branches // //meta:operation GET /repos/{owner}/{repo}/branches -func (s *RepositoriesService) ListBranches(ctx context.Context, owner string, repo string, opts *BranchListOptions) ([]*Branch, *Response, error) { +func (s *RepositoriesService) ListBranches(ctx context.Context, owner, repo string, opts *BranchListOptions) ([]*Branch, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var branches []*Branch - resp, err := s.client.Do(ctx, req, &branches) + resp, err := s.client.Do(req, &branches) if err != nil { return nil, resp, err } @@ -1428,7 +1459,7 @@ func (s *RepositoriesService) ListBranches(ctx context.Context, owner string, re // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branches#get-a-branch +// GitHub API docs: https://docs.github.com/rest/branches/branches?apiVersion=2022-11-28#get-a-branch // //meta:operation GET /repos/{owner}/{repo}/branches/{branch} func (s *RepositoriesService) GetBranch(ctx context.Context, owner, repo, branch string, maxRedirects int) (*Branch, *Response, error) { @@ -1441,11 +1472,11 @@ func (s *RepositoriesService) GetBranch(ctx context.Context, owner, repo, branch defer resp.Body.Close() if resp.StatusCode != http.StatusOK { - return nil, newResponse(resp), fmt.Errorf("unexpected status code: %s", resp.Status) + return nil, newResponse(resp), fmt.Errorf("unexpected status code: %v", resp.Status) } - b := new(Branch) - err = json.NewDecoder(resp.Body).Decode(b) + var b *Branch + err = json.NewDecoder(resp.Body).Decode(&b) return b, newResponse(resp), err } @@ -1461,19 +1492,19 @@ type renameBranchRequest struct { // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branches#rename-a-branch +// GitHub API docs: https://docs.github.com/rest/branches/branches?apiVersion=2022-11-28#rename-a-branch // //meta:operation POST /repos/{owner}/{repo}/branches/{branch}/rename func (s *RepositoriesService) RenameBranch(ctx context.Context, owner, repo, branch, newName string) (*Branch, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/rename", owner, repo, url.PathEscape(branch)) r := &renameBranchRequest{NewName: newName} - req, err := s.client.NewRequest("POST", u, r) + req, err := s.client.NewRequest(ctx, "POST", u, r) if err != nil { return nil, nil, err } - b := new(Branch) - resp, err := s.client.Do(ctx, req, b) + var b *Branch + resp, err := s.client.Do(req, &b) if err != nil { return nil, resp, err } @@ -1485,21 +1516,20 @@ func (s *RepositoriesService) RenameBranch(ctx context.Context, owner, repo, bra // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-branch-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#get-branch-protection // //meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection func (s *RepositoriesService) GetBranchProtection(ctx context.Context, owner, repo, branch string) (*Protection, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - p := new(Protection) - resp, err := s.client.Do(ctx, req, p) + var p *Protection + resp, err := s.client.Do(req, &p) if err != nil { if isBranchNotProtected(err) { err = ErrBranchNotProtected @@ -1514,18 +1544,18 @@ func (s *RepositoriesService) GetBranchProtection(ctx context.Context, owner, re // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-status-checks-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#get-status-checks-protection // //meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks func (s *RepositoriesService) GetRequiredStatusChecks(ctx context.Context, owner, repo, branch string) (*RequiredStatusChecks, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - p := new(RequiredStatusChecks) - resp, err := s.client.Do(ctx, req, p) + var p *RequiredStatusChecks + resp, err := s.client.Do(req, &p) if err != nil { if isBranchNotProtected(err) { err = ErrBranchNotProtected @@ -1540,17 +1570,17 @@ func (s *RepositoriesService) GetRequiredStatusChecks(ctx context.Context, owner // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-all-status-check-contexts +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#get-all-status-check-contexts // //meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts func (s *RepositoriesService) ListRequiredStatusChecksContexts(ctx context.Context, owner, repo, branch string) (contexts []string, resp *Response, err error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks/contexts", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - resp, err = s.client.Do(ctx, req, &contexts) + resp, err = s.client.Do(req, &contexts) if err != nil { if isBranchNotProtected(err) { err = ErrBranchNotProtected @@ -1565,21 +1595,20 @@ func (s *RepositoriesService) ListRequiredStatusChecksContexts(ctx context.Conte // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#update-branch-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#update-branch-protection // //meta:operation PUT /repos/{owner}/{repo}/branches/{branch}/protection func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner, repo, branch string, preq *ProtectionRequest) (*Protection, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("PUT", u, preq) + req, err := s.client.NewRequest(ctx, "PUT", u, preq) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - p := new(Protection) - resp, err := s.client.Do(ctx, req, p) + var p *Protection + resp, err := s.client.Do(req, &p) if err != nil { return nil, resp, err } @@ -1591,39 +1620,41 @@ func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner, // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#delete-branch-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#delete-branch-protection // //meta:operation DELETE /repos/{owner}/{repo}/branches/{branch}/protection func (s *RepositoriesService) RemoveBranchProtection(ctx context.Context, owner, repo, branch string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // GetSignaturesProtectedBranch gets required signatures of protected branch. // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-commit-signature-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#get-commit-signature-protection // //meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures func (s *RepositoriesService) GetSignaturesProtectedBranch(ctx context.Context, owner, repo, branch string) (*SignaturesProtectedBranch, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeSignaturePreview) - p := new(SignaturesProtectedBranch) - resp, err := s.client.Do(ctx, req, p) + var p *SignaturesProtectedBranch + resp, err := s.client.Do(req, &p) if err != nil { + if isBranchNotProtected(err) { + err = ErrBranchNotProtected + } return nil, resp, err } @@ -1635,21 +1666,20 @@ func (s *RepositoriesService) GetSignaturesProtectedBranch(ctx context.Context, // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#create-commit-signature-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#create-commit-signature-protection // //meta:operation POST /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures func (s *RepositoriesService) RequireSignaturesOnProtectedBranch(ctx context.Context, owner, repo, branch string) (*SignaturesProtectedBranch, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeSignaturePreview) - r := new(SignaturesProtectedBranch) - resp, err := s.client.Do(ctx, req, r) + var r *SignaturesProtectedBranch + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -1661,38 +1691,37 @@ func (s *RepositoriesService) RequireSignaturesOnProtectedBranch(ctx context.Con // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#delete-commit-signature-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#delete-commit-signature-protection // //meta:operation DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures func (s *RepositoriesService) OptionalSignaturesOnProtectedBranch(ctx context.Context, owner, repo, branch string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeSignaturePreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // UpdateRequiredStatusChecks updates the required status checks for a given protected branch. // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#update-status-check-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#update-status-check-protection // //meta:operation PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks func (s *RepositoriesService) UpdateRequiredStatusChecks(ctx context.Context, owner, repo, branch string, sreq *RequiredStatusChecksRequest) (*RequiredStatusChecks, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("PATCH", u, sreq) + req, err := s.client.NewRequest(ctx, "PATCH", u, sreq) if err != nil { return nil, nil, err } - sc := new(RequiredStatusChecks) - resp, err := s.client.Do(ctx, req, sc) + var sc *RequiredStatusChecks + resp, err := s.client.Do(req, &sc) if err != nil { return nil, resp, err } @@ -1704,33 +1733,33 @@ func (s *RepositoriesService) UpdateRequiredStatusChecks(ctx context.Context, ow // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#remove-status-check-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#remove-status-check-protection // //meta:operation DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks func (s *RepositoriesService) RemoveRequiredStatusChecks(ctx context.Context, owner, repo, branch string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // License gets the contents of a repository's license if one is detected. // -// GitHub API docs: https://docs.github.com/rest/licenses/licenses#get-the-license-for-a-repository +// GitHub API docs: https://docs.github.com/rest/licenses/licenses?apiVersion=2022-11-28#get-the-license-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/license func (s *RepositoriesService) License(ctx context.Context, owner, repo string) (*RepositoryLicense, *Response, error) { u := fmt.Sprintf("repos/%v/%v/license", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - r := &RepositoryLicense{} - resp, err := s.client.Do(ctx, req, r) + var r *RepositoryLicense + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -1742,21 +1771,20 @@ func (s *RepositoriesService) License(ctx context.Context, owner, repo string) ( // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-pull-request-review-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#get-pull-request-review-protection // //meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews func (s *RepositoriesService) GetPullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string) (*PullRequestReviewsEnforcement, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - r := new(PullRequestReviewsEnforcement) - resp, err := s.client.Do(ctx, req, r) + var r *PullRequestReviewsEnforcement + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -1769,21 +1797,20 @@ func (s *RepositoriesService) GetPullRequestReviewEnforcement(ctx context.Contex // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#update-pull-request-review-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#update-pull-request-review-protection // //meta:operation PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string, patch *PullRequestReviewsEnforcementUpdate) (*PullRequestReviewsEnforcement, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("PATCH", u, patch) + req, err := s.client.NewRequest(ctx, "PATCH", u, patch) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - r := new(PullRequestReviewsEnforcement) - resp, err := s.client.Do(ctx, req, r) + var r *PullRequestReviewsEnforcement + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -1796,7 +1823,7 @@ func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Con // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#update-pull-request-review-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#update-pull-request-review-protection // //meta:operation PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context, owner, repo, branch string) (*PullRequestReviewsEnforcement, *Response, error) { @@ -1806,16 +1833,15 @@ func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context, DismissalRestrictionsRequest `json:"dismissal_restrictions"` }) - req, err := s.client.NewRequest("PATCH", u, data) + req, err := s.client.NewRequest(ctx, "PATCH", u, data) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - r := new(PullRequestReviewsEnforcement) - resp, err := s.client.Do(ctx, req, r) + var r *PullRequestReviewsEnforcement + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -1827,35 +1853,35 @@ func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context, // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#delete-pull-request-review-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#delete-pull-request-review-protection // //meta:operation DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews func (s *RepositoriesService) RemovePullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // GetAdminEnforcement gets admin enforcement information of a protected branch. // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-admin-branch-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#get-admin-branch-protection // //meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins func (s *RepositoriesService) GetAdminEnforcement(ctx context.Context, owner, repo, branch string) (*AdminEnforcement, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - r := new(AdminEnforcement) - resp, err := s.client.Do(ctx, req, r) + var r *AdminEnforcement + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -1868,18 +1894,18 @@ func (s *RepositoriesService) GetAdminEnforcement(ctx context.Context, owner, re // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#set-admin-branch-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#set-admin-branch-protection // //meta:operation POST /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins func (s *RepositoriesService) AddAdminEnforcement(ctx context.Context, owner, repo, branch string) (*AdminEnforcement, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - r := new(AdminEnforcement) - resp, err := s.client.Do(ctx, req, r) + var r *AdminEnforcement + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -1891,17 +1917,17 @@ func (s *RepositoriesService) AddAdminEnforcement(ctx context.Context, owner, re // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#delete-admin-branch-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#delete-admin-branch-protection // //meta:operation DELETE /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins func (s *RepositoriesService) RemoveAdminEnforcement(ctx context.Context, owner, repo, branch string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // repositoryTopics represents a collection of repository topics. @@ -1911,21 +1937,25 @@ type repositoryTopics struct { // ListAllTopics lists topics for a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#get-all-repository-topics +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#get-all-repository-topics // //meta:operation GET /repos/{owner}/{repo}/topics -func (s *RepositoriesService) ListAllTopics(ctx context.Context, owner, repo string) ([]string, *Response, error) { +func (s *RepositoriesService) ListAllTopics(ctx context.Context, owner, repo string, opts *ListOptions) ([]string, *Response, error) { u := fmt.Sprintf("repos/%v/%v/topics", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeTopicsPreview) - topics := new(repositoryTopics) - resp, err := s.client.Do(ctx, req, topics) + var topics *repositoryTopics + resp, err := s.client.Do(req, &topics) if err != nil { return nil, resp, err } @@ -1935,7 +1965,7 @@ func (s *RepositoriesService) ListAllTopics(ctx context.Context, owner, repo str // ReplaceAllTopics replaces all repository topics. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#replace-all-repository-topics +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#replace-all-repository-topics // //meta:operation PUT /repos/{owner}/{repo}/topics func (s *RepositoriesService) ReplaceAllTopics(ctx context.Context, owner, repo string, topics []string) ([]string, *Response, error) { @@ -1946,16 +1976,15 @@ func (s *RepositoriesService) ReplaceAllTopics(ctx context.Context, owner, repo if t.Names == nil { t.Names = []string{} } - req, err := s.client.NewRequest("PUT", u, t) + req, err := s.client.NewRequest(ctx, "PUT", u, t) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeTopicsPreview) t = new(repositoryTopics) - resp, err := s.client.Do(ctx, req, t) + resp, err := s.client.Do(req, t) if err != nil { return nil, resp, err } @@ -1970,18 +1999,18 @@ func (s *RepositoriesService) ReplaceAllTopics(ctx context.Context, owner, repo // // Deprecated: Please use ListAppRestrictions instead. // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-apps-with-access-to-the-protected-branch +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#get-apps-with-access-to-the-protected-branch // //meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps func (s *RepositoriesService) ListApps(ctx context.Context, owner, repo, branch string) ([]*App, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var apps []*App - resp, err := s.client.Do(ctx, req, &apps) + resp, err := s.client.Do(req, &apps) if err != nil { return nil, resp, err } @@ -1994,7 +2023,7 @@ func (s *RepositoriesService) ListApps(ctx context.Context, owner, repo, branch // // Note: This is a wrapper around ListApps so a naming convention with ListUserRestrictions and ListTeamRestrictions is preserved. // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-apps-with-access-to-the-protected-branch +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#get-apps-with-access-to-the-protected-branch // //meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps func (s *RepositoriesService) ListAppRestrictions(ctx context.Context, owner, repo, branch string) ([]*App, *Response, error) { @@ -2009,18 +2038,18 @@ func (s *RepositoriesService) ListAppRestrictions(ctx context.Context, owner, re // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#set-app-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#set-app-access-restrictions // //meta:operation PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps func (s *RepositoriesService) ReplaceAppRestrictions(ctx context.Context, owner, repo, branch string, apps []string) ([]*App, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("PUT", u, apps) + req, err := s.client.NewRequest(ctx, "PUT", u, apps) if err != nil { return nil, nil, err } var newApps []*App - resp, err := s.client.Do(ctx, req, &newApps) + resp, err := s.client.Do(req, &newApps) if err != nil { return nil, resp, err } @@ -2035,18 +2064,18 @@ func (s *RepositoriesService) ReplaceAppRestrictions(ctx context.Context, owner, // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#add-app-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#add-app-access-restrictions // //meta:operation POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps func (s *RepositoriesService) AddAppRestrictions(ctx context.Context, owner, repo, branch string, apps []string) ([]*App, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("POST", u, apps) + req, err := s.client.NewRequest(ctx, "POST", u, apps) if err != nil { return nil, nil, err } var newApps []*App - resp, err := s.client.Do(ctx, req, &newApps) + resp, err := s.client.Do(req, &newApps) if err != nil { return nil, resp, err } @@ -2061,18 +2090,18 @@ func (s *RepositoriesService) AddAppRestrictions(ctx context.Context, owner, rep // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#remove-app-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#remove-app-access-restrictions // //meta:operation DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps func (s *RepositoriesService) RemoveAppRestrictions(ctx context.Context, owner, repo, branch string, apps []string) ([]*App, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("DELETE", u, apps) + req, err := s.client.NewRequest(ctx, "DELETE", u, apps) if err != nil { return nil, nil, err } var newApps []*App - resp, err := s.client.Do(ctx, req, &newApps) + resp, err := s.client.Do(req, &newApps) if err != nil { return nil, resp, err } @@ -2085,18 +2114,18 @@ func (s *RepositoriesService) RemoveAppRestrictions(ctx context.Context, owner, // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-teams-with-access-to-the-protected-branch +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#get-teams-with-access-to-the-protected-branch // //meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams func (s *RepositoriesService) ListTeamRestrictions(ctx context.Context, owner, repo, branch string) ([]*Team, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/teams", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var teams []*Team - resp, err := s.client.Do(ctx, req, &teams) + resp, err := s.client.Do(req, &teams) if err != nil { return nil, resp, err } @@ -2112,18 +2141,18 @@ func (s *RepositoriesService) ListTeamRestrictions(ctx context.Context, owner, r // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#set-team-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#set-team-access-restrictions // //meta:operation PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams func (s *RepositoriesService) ReplaceTeamRestrictions(ctx context.Context, owner, repo, branch string, teams []string) ([]*Team, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/teams", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("PUT", u, teams) + req, err := s.client.NewRequest(ctx, "PUT", u, teams) if err != nil { return nil, nil, err } var newTeams []*Team - resp, err := s.client.Do(ctx, req, &newTeams) + resp, err := s.client.Do(req, &newTeams) if err != nil { return nil, resp, err } @@ -2138,18 +2167,18 @@ func (s *RepositoriesService) ReplaceTeamRestrictions(ctx context.Context, owner // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#add-team-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#add-team-access-restrictions // //meta:operation POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams func (s *RepositoriesService) AddTeamRestrictions(ctx context.Context, owner, repo, branch string, teams []string) ([]*Team, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/teams", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("POST", u, teams) + req, err := s.client.NewRequest(ctx, "POST", u, teams) if err != nil { return nil, nil, err } var newTeams []*Team - resp, err := s.client.Do(ctx, req, &newTeams) + resp, err := s.client.Do(req, &newTeams) if err != nil { return nil, resp, err } @@ -2164,18 +2193,18 @@ func (s *RepositoriesService) AddTeamRestrictions(ctx context.Context, owner, re // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#remove-team-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#remove-team-access-restrictions // //meta:operation DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams func (s *RepositoriesService) RemoveTeamRestrictions(ctx context.Context, owner, repo, branch string, teams []string) ([]*Team, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/teams", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("DELETE", u, teams) + req, err := s.client.NewRequest(ctx, "DELETE", u, teams) if err != nil { return nil, nil, err } var newTeams []*Team - resp, err := s.client.Do(ctx, req, &newTeams) + resp, err := s.client.Do(req, &newTeams) if err != nil { return nil, resp, err } @@ -2188,18 +2217,18 @@ func (s *RepositoriesService) RemoveTeamRestrictions(ctx context.Context, owner, // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-users-with-access-to-the-protected-branch +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#get-users-with-access-to-the-protected-branch // //meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users func (s *RepositoriesService) ListUserRestrictions(ctx context.Context, owner, repo, branch string) ([]*User, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/users", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var users []*User - resp, err := s.client.Do(ctx, req, &users) + resp, err := s.client.Do(req, &users) if err != nil { return nil, resp, err } @@ -2215,18 +2244,18 @@ func (s *RepositoriesService) ListUserRestrictions(ctx context.Context, owner, r // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#set-user-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#set-user-access-restrictions // //meta:operation PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users func (s *RepositoriesService) ReplaceUserRestrictions(ctx context.Context, owner, repo, branch string, users []string) ([]*User, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/users", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("PUT", u, users) + req, err := s.client.NewRequest(ctx, "PUT", u, users) if err != nil { return nil, nil, err } var newUsers []*User - resp, err := s.client.Do(ctx, req, &newUsers) + resp, err := s.client.Do(req, &newUsers) if err != nil { return nil, resp, err } @@ -2241,18 +2270,18 @@ func (s *RepositoriesService) ReplaceUserRestrictions(ctx context.Context, owner // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#add-user-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#add-user-access-restrictions // //meta:operation POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users func (s *RepositoriesService) AddUserRestrictions(ctx context.Context, owner, repo, branch string, users []string) ([]*User, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/users", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("POST", u, users) + req, err := s.client.NewRequest(ctx, "POST", u, users) if err != nil { return nil, nil, err } var newUsers []*User - resp, err := s.client.Do(ctx, req, &newUsers) + resp, err := s.client.Do(req, &newUsers) if err != nil { return nil, resp, err } @@ -2267,18 +2296,18 @@ func (s *RepositoriesService) AddUserRestrictions(ctx context.Context, owner, re // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#remove-user-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#remove-user-access-restrictions // //meta:operation DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users func (s *RepositoriesService) RemoveUserRestrictions(ctx context.Context, owner, repo, branch string, users []string) ([]*User, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/users", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("DELETE", u, users) + req, err := s.client.NewRequest(ctx, "DELETE", u, users) if err != nil { return nil, nil, err } var newUsers []*User - resp, err := s.client.Do(ctx, req, &newUsers) + resp, err := s.client.Do(req, &newUsers) if err != nil { return nil, resp, err } @@ -2301,19 +2330,19 @@ type TransferRequest struct { // A follow up request, after a delay of a second or so, should result // in a successful request. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#transfer-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#transfer-a-repository // //meta:operation POST /repos/{owner}/{repo}/transfer func (s *RepositoriesService) Transfer(ctx context.Context, owner, repo string, transfer TransferRequest) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/transfer", owner, repo) - req, err := s.client.NewRequest("POST", u, &transfer) + req, err := s.client.NewRequest(ctx, "POST", u, &transfer) if err != nil { return nil, nil, err } - r := new(Repository) - resp, err := s.client.Do(ctx, req, r) + var r *Repository + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -2332,19 +2361,19 @@ type DispatchRequestOptions struct { // Dispatch triggers a repository_dispatch event in a GitHub Actions workflow. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#create-a-repository-dispatch-event +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#create-a-repository-dispatch-event // //meta:operation POST /repos/{owner}/{repo}/dispatches func (s *RepositoriesService) Dispatch(ctx context.Context, owner, repo string, opts DispatchRequestOptions) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/dispatches", owner, repo) - req, err := s.client.NewRequest("POST", u, &opts) + req, err := s.client.NewRequest(ctx, "POST", u, &opts) if err != nil { return nil, nil, err } - r := new(Repository) - resp, err := s.client.Do(ctx, req, r) + var r *Repository + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -2355,25 +2384,25 @@ func (s *RepositoriesService) Dispatch(ctx context.Context, owner, repo string, // isBranchNotProtected determines whether a branch is not protected // based on the error message returned by GitHub API. func isBranchNotProtected(err error) bool { - errorResponse, ok := err.(*ErrorResponse) - return ok && errorResponse.Message == githubBranchNotProtected + var errorResponse *ErrorResponse + return errors.As(err, &errorResponse) && errorResponse.Message == githubBranchNotProtected } // EnablePrivateReporting enables private reporting of vulnerabilities for a // repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#enable-private-vulnerability-reporting-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#enable-private-vulnerability-reporting-for-a-repository // //meta:operation PUT /repos/{owner}/{repo}/private-vulnerability-reporting func (s *RepositoriesService) EnablePrivateReporting(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/private-vulnerability-reporting", owner, repo) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -2384,18 +2413,18 @@ func (s *RepositoriesService) EnablePrivateReporting(ctx context.Context, owner, // DisablePrivateReporting disables private reporting of vulnerabilities for a // repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#disable-private-vulnerability-reporting-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#disable-private-vulnerability-reporting-for-a-repository // //meta:operation DELETE /repos/{owner}/{repo}/private-vulnerability-reporting func (s *RepositoriesService) DisablePrivateReporting(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/private-vulnerability-reporting", owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -2411,18 +2440,114 @@ type checkPrivateReporting struct { // IsPrivateReportingEnabled checks if private vulnerability reporting is enabled // for the repository and returns a boolean indicating the status. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#check-if-private-vulnerability-reporting-is-enabled-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#check-if-private-vulnerability-reporting-is-enabled-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/private-vulnerability-reporting func (s *RepositoriesService) IsPrivateReportingEnabled(ctx context.Context, owner, repo string) (bool, *Response, error) { u := fmt.Sprintf("repos/%v/%v/private-vulnerability-reporting", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return false, nil, err } - privateReporting := new(checkPrivateReporting) - resp, err := s.client.Do(ctx, req, privateReporting) + var privateReporting checkPrivateReporting + resp, err := s.client.Do(req, &privateReporting) return privateReporting.Enabled, resp, err } + +// ListRepositoryActivityOptions specifies the optional parameters to the +// RepositoriesService.ListRepositoryActivities method. +type ListRepositoryActivityOptions struct { + // The direction to sort the results by. + // Default: desc + // Can be one of: asc, desc + Direction string `url:"direction,omitempty"` + + // For paginated result sets, The number of results per page (max 100). + PerPage int `url:"per_page,omitempty"` + + // A cursor, as given in the Link header. If specified, the query only searches for events before this cursor. + Before string `url:"before,omitempty"` + + // A cursor, as given in the Link header. If specified, the query only searches for events after this cursor. + After string `url:"after,omitempty"` + + // The Git reference for the activities you want to list. + // The ref for a branch can be formatted either as refs/heads/BRANCH_NAME or BRANCH_NAME, where BRANCH_NAME is the name of your branch. + Ref string `url:"ref,omitempty"` + + // The GitHub username to use to filter by the actor who performed the activity. + Actor string `url:"actor,omitempty"` + + // The time period to filter by. + // For example, day will filter for activity that occurred in the past 24 hours, and week will filter for activity that occurred in the past 7 days (168 hours). + // Can be one of: day, week, month, quarter, year + TimePeriod string `url:"time_period,omitempty"` + + // The activity type to filter by. + // For example, you can choose to filter by "force_push", to see all force pushes to the repository. + // Can be one of: push, force_push, branch_creation, branch_deletion, pr_merge, merge_queue_merge + ActivityType string `url:"activity_type,omitempty"` +} + +// RepositoryActor represents a repository actor. +type RepositoryActor struct { + Login *string `json:"login,omitempty"` + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + AvatarURL *string `json:"avatar_url,omitempty"` + GravatarID *string `json:"gravatar_id,omitempty"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + FollowersURL *string `json:"followers_url,omitempty"` + FollowingURL *string `json:"following_url,omitempty"` + GistsURL *string `json:"gists_url,omitempty"` + StarredURL *string `json:"starred_url,omitempty"` + SubscriptionsURL *string `json:"subscriptions_url,omitempty"` + OrganizationsURL *string `json:"organizations_url,omitempty"` + ReposURL *string `json:"repos_url,omitempty"` + EventsURL *string `json:"events_url,omitempty"` + ReceivedEventsURL *string `json:"received_events_url,omitempty"` + Type *string `json:"type,omitempty"` + UserViewType *string `json:"user_view_type,omitempty"` + SiteAdmin *bool `json:"site_admin,omitempty"` +} + +// RepositoryActivity represents a repository activity. +type RepositoryActivity struct { + ID int64 `json:"id"` + NodeID string `json:"node_id"` + Before string `json:"before"` + After string `json:"after"` + Ref string `json:"ref"` + Timestamp *Timestamp `json:"timestamp"` + ActivityType string `json:"activity_type"` + Actor *RepositoryActor `json:"actor,omitempty"` +} + +// ListRepositoryActivities lists the activities for a repository. +// +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-repository-activities +// +//meta:operation GET /repos/{owner}/{repo}/activity +func (s *RepositoriesService) ListRepositoryActivities(ctx context.Context, owner, repo string, opts *ListRepositoryActivityOptions) ([]*RepositoryActivity, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/activity", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var activities []*RepositoryActivity + resp, err := s.client.Do(req, &activities) + if err != nil { + return nil, resp, err + } + + return activities, resp, nil +} diff --git a/vendor/github.com/google/go-github/v73/github/repos_actions_access.go b/vendor/github.com/google/go-github/v88/github/repos_actions_access.go similarity index 78% rename from vendor/github.com/google/go-github/v73/github/repos_actions_access.go rename to vendor/github.com/google/go-github/v88/github/repos_actions_access.go index 2da1f01cc..42739999f 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_actions_access.go +++ b/vendor/github.com/google/go-github/v88/github/repos_actions_access.go @@ -12,7 +12,7 @@ import ( // RepositoryActionsAccessLevel represents the repository actions access level. // -// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-the-level-of-access-for-workflows-outside-of-the-repository +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-the-level-of-access-for-workflows-outside-of-the-repository type RepositoryActionsAccessLevel struct { // AccessLevel specifies the level of access that workflows outside of the repository have // to actions and reusable workflows within the repository. @@ -23,18 +23,18 @@ type RepositoryActionsAccessLevel struct { // GetActionsAccessLevel gets the level of access that workflows outside of the repository have // to actions and reusable workflows in the repository. // -// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-the-level-of-access-for-workflows-outside-of-the-repository +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-the-level-of-access-for-workflows-outside-of-the-repository // //meta:operation GET /repos/{owner}/{repo}/actions/permissions/access func (s *RepositoriesService) GetActionsAccessLevel(ctx context.Context, owner, repo string) (*RepositoryActionsAccessLevel, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions/access", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - raal := new(RepositoryActionsAccessLevel) - resp, err := s.client.Do(ctx, req, raal) + var raal *RepositoryActionsAccessLevel + resp, err := s.client.Do(req, &raal) if err != nil { return nil, resp, err } @@ -45,15 +45,15 @@ func (s *RepositoriesService) GetActionsAccessLevel(ctx context.Context, owner, // EditActionsAccessLevel sets the level of access that workflows outside of the repository have // to actions and reusable workflows in the repository. // -// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-the-level-of-access-for-workflows-outside-of-the-repository +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-the-level-of-access-for-workflows-outside-of-the-repository // //meta:operation PUT /repos/{owner}/{repo}/actions/permissions/access func (s *RepositoriesService) EditActionsAccessLevel(ctx context.Context, owner, repo string, repositoryActionsAccessLevel RepositoryActionsAccessLevel) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions/access", owner, repo) - req, err := s.client.NewRequest("PUT", u, repositoryActionsAccessLevel) + req, err := s.client.NewRequest(ctx, "PUT", u, repositoryActionsAccessLevel) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/repos_actions_allowed.go b/vendor/github.com/google/go-github/v88/github/repos_actions_allowed.go similarity index 76% rename from vendor/github.com/google/go-github/v73/github/repos_actions_allowed.go rename to vendor/github.com/google/go-github/v88/github/repos_actions_allowed.go index e9ebff1d3..d8a019e67 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_actions_allowed.go +++ b/vendor/github.com/google/go-github/v88/github/repos_actions_allowed.go @@ -12,18 +12,18 @@ import ( // GetActionsAllowed gets the allowed actions and reusable workflows for a repository. // -// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-allowed-actions-and-reusable-workflows-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/actions/permissions/selected-actions func (s *RepositoriesService) GetActionsAllowed(ctx context.Context, org, repo string) (*ActionsAllowed, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions/selected-actions", org, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - actionsAllowed := new(ActionsAllowed) - resp, err := s.client.Do(ctx, req, actionsAllowed) + var actionsAllowed *ActionsAllowed + resp, err := s.client.Do(req, &actionsAllowed) if err != nil { return nil, resp, err } @@ -33,18 +33,18 @@ func (s *RepositoriesService) GetActionsAllowed(ctx context.Context, org, repo s // EditActionsAllowed sets the allowed actions and reusable workflows for a repository. // -// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-allowed-actions-and-reusable-workflows-for-a-repository // //meta:operation PUT /repos/{owner}/{repo}/actions/permissions/selected-actions func (s *RepositoriesService) EditActionsAllowed(ctx context.Context, org, repo string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions/selected-actions", org, repo) - req, err := s.client.NewRequest("PUT", u, actionsAllowed) + req, err := s.client.NewRequest(ctx, "PUT", u, actionsAllowed) if err != nil { return nil, nil, err } - p := new(ActionsAllowed) - resp, err := s.client.Do(ctx, req, p) + var p *ActionsAllowed + resp, err := s.client.Do(req, &p) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v88/github/repos_actions_permissions.go b/vendor/github.com/google/go-github/v88/github/repos_actions_permissions.go new file mode 100644 index 000000000..ea4bed00a --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/repos_actions_permissions.go @@ -0,0 +1,230 @@ +// Copyright 2022 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// ActionsPermissionsRepository represents a policy for repositories and allowed actions in a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28 +type ActionsPermissionsRepository struct { + Enabled *bool `json:"enabled,omitempty"` + AllowedActions *string `json:"allowed_actions,omitempty"` + SelectedActionsURL *string `json:"selected_actions_url,omitempty"` + SHAPinningRequired *bool `json:"sha_pinning_required,omitempty"` +} + +func (a ActionsPermissionsRepository) String() string { + return Stringify(a) +} + +// DefaultWorkflowPermissionRepository represents the default permissions for GitHub Actions workflows for a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28 +type DefaultWorkflowPermissionRepository struct { + DefaultWorkflowPermissions *string `json:"default_workflow_permissions,omitempty"` + CanApprovePullRequestReviews *bool `json:"can_approve_pull_request_reviews,omitempty"` +} + +// GetActionsPermissions gets the GitHub Actions permissions policy for repositories and allowed actions in a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-github-actions-permissions-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/permissions +func (s *RepositoriesService) GetActionsPermissions(ctx context.Context, owner, repo string) (*ActionsPermissionsRepository, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions", owner, repo) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions *ActionsPermissionsRepository + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// UpdateActionsPermissions sets the permissions policy for repositories and allowed actions in a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-github-actions-permissions-for-a-repository +// +//meta:operation PUT /repos/{owner}/{repo}/actions/permissions +func (s *RepositoriesService) UpdateActionsPermissions(ctx context.Context, owner, repo string, actionsPermissionsRepository ActionsPermissionsRepository) (*ActionsPermissionsRepository, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions", owner, repo) + req, err := s.client.NewRequest(ctx, "PUT", u, actionsPermissionsRepository) + if err != nil { + return nil, nil, err + } + + var permissions *ActionsPermissionsRepository + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// GetDefaultWorkflowPermissions gets the GitHub Actions default workflow permissions in a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-default-workflow-permissions-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/permissions/workflow +func (s *RepositoriesService) GetDefaultWorkflowPermissions(ctx context.Context, owner, repo string) (*DefaultWorkflowPermissionRepository, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/workflow", owner, repo) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions *DefaultWorkflowPermissionRepository + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// UpdateDefaultWorkflowPermissions sets the GitHub Actions default workflow permissions in a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-default-workflow-permissions-for-a-repository +// +//meta:operation PUT /repos/{owner}/{repo}/actions/permissions/workflow +func (s *RepositoriesService) UpdateDefaultWorkflowPermissions(ctx context.Context, owner, repo string, permissions DefaultWorkflowPermissionRepository) (*DefaultWorkflowPermissionRepository, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/workflow", owner, repo) + req, err := s.client.NewRequest(ctx, "PUT", u, permissions) + if err != nil { + return nil, nil, err + } + + var p *DefaultWorkflowPermissionRepository + resp, err := s.client.Do(req, &p) + if err != nil { + return nil, resp, err + } + + return p, resp, nil +} + +// GetArtifactAndLogRetentionPeriod gets the artifact and log retention period for a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-artifact-and-log-retention-settings-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/permissions/artifact-and-log-retention +func (s *RepositoriesService) GetArtifactAndLogRetentionPeriod(ctx context.Context, owner, repo string) (*ArtifactPeriod, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/artifact-and-log-retention", owner, repo) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var arp *ArtifactPeriod + resp, err := s.client.Do(req, &arp) + if err != nil { + return nil, resp, err + } + + return arp, resp, nil +} + +// UpdateArtifactAndLogRetentionPeriod sets the artifact and log retention period for a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-artifact-and-log-retention-settings-for-a-repository +// +//meta:operation PUT /repos/{owner}/{repo}/actions/permissions/artifact-and-log-retention +func (s *RepositoriesService) UpdateArtifactAndLogRetentionPeriod(ctx context.Context, owner, repo string, period ArtifactPeriodOpt) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/artifact-and-log-retention", owner, repo) + req, err := s.client.NewRequest(ctx, "PUT", u, period) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// GetPrivateRepoForkPRWorkflowSettings gets the settings for whether workflows from fork pull requests can run on a private repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-private-repo-fork-pr-workflow-settings-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/permissions/fork-pr-workflows-private-repos +func (s *RepositoriesService) GetPrivateRepoForkPRWorkflowSettings(ctx context.Context, owner, repo string) (*WorkflowsPermissions, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/fork-pr-workflows-private-repos", owner, repo) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions *WorkflowsPermissions + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// UpdatePrivateRepoForkPRWorkflowSettings sets the settings for whether workflows from fork pull requests can run on a private repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-private-repo-fork-pr-workflow-settings-for-a-repository +// +//meta:operation PUT /repos/{owner}/{repo}/actions/permissions/fork-pr-workflows-private-repos +func (s *RepositoriesService) UpdatePrivateRepoForkPRWorkflowSettings(ctx context.Context, owner, repo string, permissions *WorkflowsPermissionsOpt) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/fork-pr-workflows-private-repos", owner, repo) + req, err := s.client.NewRequest(ctx, "PUT", u, permissions) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// GetForkPRContributorApprovalPermissions gets the fork PR contributor approval policy for a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-fork-pr-contributor-approval-permissions-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/permissions/fork-pr-contributor-approval +func (s *ActionsService) GetForkPRContributorApprovalPermissions(ctx context.Context, owner, repo string) (*ContributorApprovalPermissions, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/fork-pr-contributor-approval", owner, repo) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var policy *ContributorApprovalPermissions + resp, err := s.client.Do(req, &policy) + if err != nil { + return nil, resp, err + } + + return policy, resp, nil +} + +// UpdateForkPRContributorApprovalPermissions sets the fork PR contributor approval policy for a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-fork-pr-contributor-approval-permissions-for-a-repository +// +//meta:operation PUT /repos/{owner}/{repo}/actions/permissions/fork-pr-contributor-approval +func (s *ActionsService) UpdateForkPRContributorApprovalPermissions(ctx context.Context, owner, repo string, policy ContributorApprovalPermissions) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/fork-pr-contributor-approval", owner, repo) + req, err := s.client.NewRequest(ctx, "PUT", u, policy) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v73/github/repos_attestations.go b/vendor/github.com/google/go-github/v88/github/repos_attestations.go similarity index 74% rename from vendor/github.com/google/go-github/v73/github/repos_attestations.go rename to vendor/github.com/google/go-github/v88/github/repos_attestations.go index 2e5425502..edca5dc66 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_attestations.go +++ b/vendor/github.com/google/go-github/v88/github/repos_attestations.go @@ -13,24 +13,24 @@ import ( // ListAttestations returns a collection of artifact attestations // with a given subject digest that are associated with a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#list-attestations +// GitHub API docs: https://docs.github.com/rest/repos/attestations?apiVersion=2022-11-28#list-attestations // //meta:operation GET /repos/{owner}/{repo}/attestations/{subject_digest} func (s *RepositoriesService) ListAttestations(ctx context.Context, owner, repo, subjectDigest string, opts *ListOptions) (*AttestationsResponse, *Response, error) { - var u = fmt.Sprintf("repos/%v/%v/attestations/%v", owner, repo, subjectDigest) + u := fmt.Sprintf("repos/%v/%v/attestations/%v", owner, repo, subjectDigest) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var attestations *AttestationsResponse - resp, err := s.client.Do(ctx, req, &attestations) + resp, err := s.client.Do(req, &attestations) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/repos_autolinks.go b/vendor/github.com/google/go-github/v88/github/repos_autolinks.go similarity index 79% rename from vendor/github.com/google/go-github/v73/github/repos_autolinks.go rename to vendor/github.com/google/go-github/v88/github/repos_autolinks.go index 6c209b2d5..91656c51f 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_autolinks.go +++ b/vendor/github.com/google/go-github/v88/github/repos_autolinks.go @@ -17,7 +17,7 @@ type AutolinkOptions struct { IsAlphanumeric *bool `json:"is_alphanumeric,omitempty"` } -// Autolink represents autolinks to external resources like JIRA issues and Zendesk tickets. +// Autolink represents autolinks to external resources like Jira issues and Zendesk tickets. type Autolink struct { ID *int64 `json:"id,omitempty"` KeyPrefix *string `json:"key_prefix,omitempty"` @@ -28,23 +28,19 @@ type Autolink struct { // ListAutolinks returns a list of autolinks configured for the given repository. // Information about autolinks are only available to repository administrators. // -// GitHub API docs: https://docs.github.com/rest/repos/autolinks#get-all-autolinks-of-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/autolinks?apiVersion=2022-11-28#get-all-autolinks-of-a-repository // //meta:operation GET /repos/{owner}/{repo}/autolinks -func (s *RepositoriesService) ListAutolinks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Autolink, *Response, error) { +func (s *RepositoriesService) ListAutolinks(ctx context.Context, owner, repo string) ([]*Autolink, *Response, error) { u := fmt.Sprintf("repos/%v/%v/autolinks", owner, repo) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var autolinks []*Autolink - resp, err := s.client.Do(ctx, req, &autolinks) + resp, err := s.client.Do(req, &autolinks) if err != nil { return nil, resp, err } @@ -55,18 +51,18 @@ func (s *RepositoriesService) ListAutolinks(ctx context.Context, owner, repo str // AddAutolink creates an autolink reference for a repository. // Users with admin access to the repository can create an autolink. // -// GitHub API docs: https://docs.github.com/rest/repos/autolinks#create-an-autolink-reference-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/autolinks?apiVersion=2022-11-28#create-an-autolink-reference-for-a-repository // //meta:operation POST /repos/{owner}/{repo}/autolinks func (s *RepositoriesService) AddAutolink(ctx context.Context, owner, repo string, opts *AutolinkOptions) (*Autolink, *Response, error) { u := fmt.Sprintf("repos/%v/%v/autolinks", owner, repo) - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, opts) if err != nil { return nil, nil, err } - al := new(Autolink) - resp, err := s.client.Do(ctx, req, al) + var al *Autolink + resp, err := s.client.Do(req, &al) if err != nil { return nil, resp, err } @@ -76,19 +72,19 @@ func (s *RepositoriesService) AddAutolink(ctx context.Context, owner, repo strin // GetAutolink returns a single autolink reference by ID that was configured for the given repository. // Information about autolinks are only available to repository administrators. // -// GitHub API docs: https://docs.github.com/rest/repos/autolinks#get-an-autolink-reference-of-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/autolinks?apiVersion=2022-11-28#get-an-autolink-reference-of-a-repository // //meta:operation GET /repos/{owner}/{repo}/autolinks/{autolink_id} func (s *RepositoriesService) GetAutolink(ctx context.Context, owner, repo string, id int64) (*Autolink, *Response, error) { u := fmt.Sprintf("repos/%v/%v/autolinks/%v", owner, repo, id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var autolink *Autolink - resp, err := s.client.Do(ctx, req, &autolink) + resp, err := s.client.Do(req, &autolink) if err != nil { return nil, resp, err } @@ -99,14 +95,14 @@ func (s *RepositoriesService) GetAutolink(ctx context.Context, owner, repo strin // DeleteAutolink deletes a single autolink reference by ID that was configured for the given repository. // Information about autolinks are only available to repository administrators. // -// GitHub API docs: https://docs.github.com/rest/repos/autolinks#delete-an-autolink-reference-from-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/autolinks?apiVersion=2022-11-28#delete-an-autolink-reference-from-a-repository // //meta:operation DELETE /repos/{owner}/{repo}/autolinks/{autolink_id} func (s *RepositoriesService) DeleteAutolink(ctx context.Context, owner, repo string, id int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/autolinks/%v", owner, repo, id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/repos_codeowners.go b/vendor/github.com/google/go-github/v88/github/repos_codeowners.go similarity index 87% rename from vendor/github.com/google/go-github/v73/github/repos_codeowners.go rename to vendor/github.com/google/go-github/v88/github/repos_codeowners.go index 93eeae09b..d178294f7 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_codeowners.go +++ b/vendor/github.com/google/go-github/v88/github/repos_codeowners.go @@ -36,7 +36,7 @@ type CodeownersError struct { // GetCodeownersErrors lists any syntax errors that are detected in the CODEOWNERS file. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#list-codeowners-errors +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-codeowners-errors // //meta:operation GET /repos/{owner}/{repo}/codeowners/errors func (s *RepositoriesService) GetCodeownersErrors(ctx context.Context, owner, repo string, opts *GetCodeownersErrorsOptions) (*CodeownersErrors, *Response, error) { @@ -46,13 +46,13 @@ func (s *RepositoriesService) GetCodeownersErrors(ctx context.Context, owner, re return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - codeownersErrors := &CodeownersErrors{} - resp, err := s.client.Do(ctx, req, codeownersErrors) + var codeownersErrors *CodeownersErrors + resp, err := s.client.Do(req, &codeownersErrors) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/repos_collaborators.go b/vendor/github.com/google/go-github/v88/github/repos_collaborators.go similarity index 84% rename from vendor/github.com/google/go-github/v73/github/repos_collaborators.go rename to vendor/github.com/google/go-github/v88/github/repos_collaborators.go index d6c985359..582f47b23 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_collaborators.go +++ b/vendor/github.com/google/go-github/v88/github/repos_collaborators.go @@ -34,7 +34,7 @@ type ListCollaboratorsOptions struct { } // CollaboratorInvitation represents an invitation created when adding a collaborator. -// GitHub API docs: https://docs.github.com/rest/repos/collaborators/#response-when-a-new-invitation-is-created +// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators?apiVersion=2022-11-28#add-a-repository-collaborator type CollaboratorInvitation struct { ID *int64 `json:"id,omitempty"` Repo *Repository `json:"repository,omitempty"` @@ -48,7 +48,7 @@ type CollaboratorInvitation struct { // ListCollaborators lists the GitHub users that have access to the repository. // -// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators#list-repository-collaborators +// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators?apiVersion=2022-11-28#list-repository-collaborators // //meta:operation GET /repos/{owner}/{repo}/collaborators func (s *RepositoriesService) ListCollaborators(ctx context.Context, owner, repo string, opts *ListCollaboratorsOptions) ([]*User, *Response, error) { @@ -58,13 +58,13 @@ func (s *RepositoriesService) ListCollaborators(ctx context.Context, owner, repo return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var users []*User - resp, err := s.client.Do(ctx, req, &users) + resp, err := s.client.Do(req, &users) if err != nil { return nil, resp, err } @@ -77,17 +77,17 @@ func (s *RepositoriesService) ListCollaborators(ctx context.Context, owner, repo // Note: This will return false if the user is not a collaborator OR the user // is not a GitHub user. // -// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators#check-if-a-user-is-a-repository-collaborator +// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators?apiVersion=2022-11-28#check-if-a-user-is-a-repository-collaborator // //meta:operation GET /repos/{owner}/{repo}/collaborators/{username} func (s *RepositoriesService) IsCollaborator(ctx context.Context, owner, repo, user string) (bool, *Response, error) { u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return false, nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) isCollab, err := parseBoolResponse(err) return isCollab, resp, err } @@ -105,18 +105,18 @@ type RepositoryPermissionLevel struct { // GetPermissionLevel retrieves the specific permission level a collaborator has for a given repository. // -// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators#get-repository-permissions-for-a-user +// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators?apiVersion=2022-11-28#get-repository-permissions-for-a-user // //meta:operation GET /repos/{owner}/{repo}/collaborators/{username}/permission func (s *RepositoriesService) GetPermissionLevel(ctx context.Context, owner, repo, user string) (*RepositoryPermissionLevel, *Response, error) { u := fmt.Sprintf("repos/%v/%v/collaborators/%v/permission", owner, repo, user) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - rpl := new(RepositoryPermissionLevel) - resp, err := s.client.Do(ctx, req, rpl) + var rpl *RepositoryPermissionLevel + resp, err := s.client.Do(req, &rpl) if err != nil { return nil, resp, err } @@ -130,7 +130,7 @@ type RepositoryAddCollaboratorOptions struct { // Permission specifies the permission to grant the user on this repository. // Possible values are: // pull - team members can pull, but not push to or administer this repository - // push - team members can pull and push, but not administer this repository + // push - team members can push and pull, but not administer this repository // admin - team members can pull, push and administer this repository // maintain - team members can manage the repository without access to sensitive or destructive actions. // triage - team members can proactively manage issues and pull requests without write access. @@ -142,18 +142,18 @@ type RepositoryAddCollaboratorOptions struct { // AddCollaborator sends an invitation to the specified GitHub user // to become a collaborator to the given repo. // -// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators#add-a-repository-collaborator +// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators?apiVersion=2022-11-28#add-a-repository-collaborator // //meta:operation PUT /repos/{owner}/{repo}/collaborators/{username} func (s *RepositoriesService) AddCollaborator(ctx context.Context, owner, repo, user string, opts *RepositoryAddCollaboratorOptions) (*CollaboratorInvitation, *Response, error) { u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user) - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, opts) if err != nil { return nil, nil, err } - acr := new(CollaboratorInvitation) - resp, err := s.client.Do(ctx, req, acr) + var acr *CollaboratorInvitation + resp, err := s.client.Do(req, &acr) if err != nil { return nil, resp, err } @@ -164,15 +164,15 @@ func (s *RepositoriesService) AddCollaborator(ctx context.Context, owner, repo, // RemoveCollaborator removes the specified GitHub user as collaborator from the given repo. // Note: Does not return error if a valid user that is not a collaborator is removed. // -// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators#remove-a-repository-collaborator +// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators?apiVersion=2022-11-28#remove-a-repository-collaborator // //meta:operation DELETE /repos/{owner}/{repo}/collaborators/{username} func (s *RepositoriesService) RemoveCollaborator(ctx context.Context, owner, repo, user string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/repos_comments.go b/vendor/github.com/google/go-github/v88/github/repos_comments.go similarity index 81% rename from vendor/github.com/google/go-github/v73/github/repos_comments.go rename to vendor/github.com/google/go-github/v88/github/repos_comments.go index 766a614cc..b94337589 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_comments.go +++ b/vendor/github.com/google/go-github/v88/github/repos_comments.go @@ -35,7 +35,7 @@ func (r RepositoryComment) String() string { // ListComments lists all the comments for the repository. // -// GitHub API docs: https://docs.github.com/rest/commits/comments#list-commit-comments-for-a-repository +// GitHub API docs: https://docs.github.com/rest/commits/comments?apiVersion=2022-11-28#list-commit-comments-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/comments func (s *RepositoriesService) ListComments(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryComment, *Response, error) { @@ -45,16 +45,15 @@ func (s *RepositoriesService) ListComments(ctx context.Context, owner, repo stri return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeReactionsPreview) var comments []*RepositoryComment - resp, err := s.client.Do(ctx, req, &comments) + resp, err := s.client.Do(req, &comments) if err != nil { return nil, resp, err } @@ -64,7 +63,7 @@ func (s *RepositoriesService) ListComments(ctx context.Context, owner, repo stri // ListCommitComments lists all the comments for a given commit SHA. // -// GitHub API docs: https://docs.github.com/rest/commits/comments#list-commit-comments +// GitHub API docs: https://docs.github.com/rest/commits/comments?apiVersion=2022-11-28#list-commit-comments // //meta:operation GET /repos/{owner}/{repo}/commits/{commit_sha}/comments func (s *RepositoriesService) ListCommitComments(ctx context.Context, owner, repo, sha string, opts *ListOptions) ([]*RepositoryComment, *Response, error) { @@ -74,16 +73,15 @@ func (s *RepositoriesService) ListCommitComments(ctx context.Context, owner, rep return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeReactionsPreview) var comments []*RepositoryComment - resp, err := s.client.Do(ctx, req, &comments) + resp, err := s.client.Do(req, &comments) if err != nil { return nil, resp, err } @@ -94,18 +92,18 @@ func (s *RepositoriesService) ListCommitComments(ctx context.Context, owner, rep // CreateComment creates a comment for the given commit. // Note: GitHub allows for comments to be created for non-existing files and positions. // -// GitHub API docs: https://docs.github.com/rest/commits/comments#create-a-commit-comment +// GitHub API docs: https://docs.github.com/rest/commits/comments?apiVersion=2022-11-28#create-a-commit-comment // //meta:operation POST /repos/{owner}/{repo}/commits/{commit_sha}/comments func (s *RepositoriesService) CreateComment(ctx context.Context, owner, repo, sha string, comment *RepositoryComment) (*RepositoryComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v/comments", owner, repo, sha) - req, err := s.client.NewRequest("POST", u, comment) + req, err := s.client.NewRequest(ctx, "POST", u, comment) if err != nil { return nil, nil, err } - c := new(RepositoryComment) - resp, err := s.client.Do(ctx, req, c) + var c *RepositoryComment + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -115,21 +113,20 @@ func (s *RepositoriesService) CreateComment(ctx context.Context, owner, repo, sh // GetComment gets a single comment from a repository. // -// GitHub API docs: https://docs.github.com/rest/commits/comments#get-a-commit-comment +// GitHub API docs: https://docs.github.com/rest/commits/comments?apiVersion=2022-11-28#get-a-commit-comment // //meta:operation GET /repos/{owner}/{repo}/comments/{comment_id} func (s *RepositoriesService) GetComment(ctx context.Context, owner, repo string, id int64) (*RepositoryComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeReactionsPreview) - c := new(RepositoryComment) - resp, err := s.client.Do(ctx, req, c) + var c *RepositoryComment + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -139,18 +136,18 @@ func (s *RepositoriesService) GetComment(ctx context.Context, owner, repo string // UpdateComment updates the body of a single comment. // -// GitHub API docs: https://docs.github.com/rest/commits/comments#update-a-commit-comment +// GitHub API docs: https://docs.github.com/rest/commits/comments?apiVersion=2022-11-28#update-a-commit-comment // //meta:operation PATCH /repos/{owner}/{repo}/comments/{comment_id} func (s *RepositoriesService) UpdateComment(ctx context.Context, owner, repo string, id int64, comment *RepositoryComment) (*RepositoryComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id) - req, err := s.client.NewRequest("PATCH", u, comment) + req, err := s.client.NewRequest(ctx, "PATCH", u, comment) if err != nil { return nil, nil, err } - c := new(RepositoryComment) - resp, err := s.client.Do(ctx, req, c) + var c *RepositoryComment + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -160,14 +157,15 @@ func (s *RepositoriesService) UpdateComment(ctx context.Context, owner, repo str // DeleteComment deletes a single comment from a repository. // -// GitHub API docs: https://docs.github.com/rest/commits/comments#delete-a-commit-comment +// GitHub API docs: https://docs.github.com/rest/commits/comments?apiVersion=2022-11-28#delete-a-commit-comment // //meta:operation DELETE /repos/{owner}/{repo}/comments/{comment_id} func (s *RepositoriesService) DeleteComment(ctx context.Context, owner, repo string, id int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/repos_commits.go b/vendor/github.com/google/go-github/v88/github/repos_commits.go similarity index 87% rename from vendor/github.com/google/go-github/v73/github/repos_commits.go rename to vendor/github.com/google/go-github/v88/github/repos_commits.go index cca7430cb..cf380af1a 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_commits.go +++ b/vendor/github.com/google/go-github/v88/github/repos_commits.go @@ -124,7 +124,7 @@ type BranchCommit struct { // ListCommits lists the commits of a repository. // -// GitHub API docs: https://docs.github.com/rest/commits/commits#list-commits +// GitHub API docs: https://docs.github.com/rest/commits/commits?apiVersion=2022-11-28#list-commits // //meta:operation GET /repos/{owner}/{repo}/commits func (s *RepositoriesService) ListCommits(ctx context.Context, owner, repo string, opts *CommitsListOptions) ([]*RepositoryCommit, *Response, error) { @@ -134,13 +134,13 @@ func (s *RepositoriesService) ListCommits(ctx context.Context, owner, repo strin return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var commits []*RepositoryCommit - resp, err := s.client.Do(ctx, req, &commits) + resp, err := s.client.Do(req, &commits) if err != nil { return nil, resp, err } @@ -150,7 +150,7 @@ func (s *RepositoriesService) ListCommits(ctx context.Context, owner, repo strin // GetCommit fetches the specified commit, including all details about it. // -// GitHub API docs: https://docs.github.com/rest/commits/commits#get-a-commit +// GitHub API docs: https://docs.github.com/rest/commits/commits?apiVersion=2022-11-28#get-a-commit // //meta:operation GET /repos/{owner}/{repo}/commits/{ref} func (s *RepositoriesService) GetCommit(ctx context.Context, owner, repo, sha string, opts *ListOptions) (*RepositoryCommit, *Response, error) { @@ -160,13 +160,13 @@ func (s *RepositoriesService) GetCommit(ctx context.Context, owner, repo, sha st return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - commit := new(RepositoryCommit) - resp, err := s.client.Do(ctx, req, commit) + var commit *RepositoryCommit + resp, err := s.client.Do(req, &commit) if err != nil { return nil, resp, err } @@ -176,12 +176,12 @@ func (s *RepositoriesService) GetCommit(ctx context.Context, owner, repo, sha st // GetCommitRaw fetches the specified commit in raw (diff or patch) format. // -// GitHub API docs: https://docs.github.com/rest/commits/commits#get-a-commit +// GitHub API docs: https://docs.github.com/rest/commits/commits?apiVersion=2022-11-28#get-a-commit // //meta:operation GET /repos/{owner}/{repo}/commits/{ref} -func (s *RepositoriesService) GetCommitRaw(ctx context.Context, owner string, repo string, sha string, opts RawOptions) (string, *Response, error) { +func (s *RepositoriesService) GetCommitRaw(ctx context.Context, owner, repo, sha string, opts RawOptions) (string, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, sha) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return "", nil, err } @@ -192,11 +192,11 @@ func (s *RepositoriesService) GetCommitRaw(ctx context.Context, owner string, re case Patch: req.Header.Set("Accept", mediaTypeV3Patch) default: - return "", nil, fmt.Errorf("unsupported raw type %d", opts.Type) + return "", nil, fmt.Errorf("unsupported raw type %v", opts.Type) } var buf bytes.Buffer - resp, err := s.client.Do(ctx, req, &buf) + resp, err := s.client.Do(req, &buf) if err != nil { return "", resp, err } @@ -207,13 +207,13 @@ func (s *RepositoriesService) GetCommitRaw(ctx context.Context, owner string, re // GetCommitSHA1 gets the SHA-1 of a commit reference. If a last-known SHA1 is // supplied and no new commits have occurred, a 304 Unmodified response is returned. // -// GitHub API docs: https://docs.github.com/rest/commits/commits#get-a-commit +// GitHub API docs: https://docs.github.com/rest/commits/commits?apiVersion=2022-11-28#get-a-commit // //meta:operation GET /repos/{owner}/{repo}/commits/{ref} func (s *RepositoriesService) GetCommitSHA1(ctx context.Context, owner, repo, ref, lastSHA string) (string, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, refURLEscape(ref)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return "", nil, err } @@ -224,7 +224,7 @@ func (s *RepositoriesService) GetCommitSHA1(ctx context.Context, owner, repo, re req.Header.Set("Accept", mediaTypeV3SHA) var buf bytes.Buffer - resp, err := s.client.Do(ctx, req, &buf) + resp, err := s.client.Do(req, &buf) if err != nil { return "", resp, err } @@ -234,10 +234,10 @@ func (s *RepositoriesService) GetCommitSHA1(ctx context.Context, owner, repo, re // CompareCommits compares a range of commits with each other. // -// GitHub API docs: https://docs.github.com/rest/commits/commits#compare-two-commits +// GitHub API docs: https://docs.github.com/rest/commits/commits?apiVersion=2022-11-28#compare-two-commits // //meta:operation GET /repos/{owner}/{repo}/compare/{basehead} -func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo string, base, head string, opts *ListOptions) (*CommitsComparison, *Response, error) { +func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo, base, head string, opts *ListOptions) (*CommitsComparison, *Response, error) { escapedBase := url.QueryEscape(base) escapedHead := url.QueryEscape(head) @@ -247,13 +247,13 @@ func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo st return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - comp := new(CommitsComparison) - resp, err := s.client.Do(ctx, req, comp) + var comp *CommitsComparison + resp, err := s.client.Do(req, &comp) if err != nil { return nil, resp, err } @@ -267,7 +267,7 @@ func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo st // To compare branches across other repositories in the same network as "repo", // use the format ":branch". // -// GitHub API docs: https://docs.github.com/rest/commits/commits#compare-two-commits +// GitHub API docs: https://docs.github.com/rest/commits/commits?apiVersion=2022-11-28#compare-two-commits // //meta:operation GET /repos/{owner}/{repo}/compare/{basehead} func (s *RepositoriesService) CompareCommitsRaw(ctx context.Context, owner, repo, base, head string, opts RawOptions) (string, *Response, error) { @@ -276,7 +276,7 @@ func (s *RepositoriesService) CompareCommitsRaw(ctx context.Context, owner, repo u := fmt.Sprintf("repos/%v/%v/compare/%v...%v", owner, repo, escapedBase, escapedHead) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return "", nil, err } @@ -287,11 +287,11 @@ func (s *RepositoriesService) CompareCommitsRaw(ctx context.Context, owner, repo case Patch: req.Header.Set("Accept", mediaTypeV3Patch) default: - return "", nil, fmt.Errorf("unsupported raw type %d", opts.Type) + return "", nil, fmt.Errorf("unsupported raw type %v", opts.Type) } var buf bytes.Buffer - resp, err := s.client.Do(ctx, req, &buf) + resp, err := s.client.Do(req, &buf) if err != nil { return "", resp, err } @@ -302,21 +302,20 @@ func (s *RepositoriesService) CompareCommitsRaw(ctx context.Context, owner, repo // ListBranchesHeadCommit gets all branches where the given commit SHA is the HEAD, // or latest commit for the branch. // -// GitHub API docs: https://docs.github.com/rest/commits/commits#list-branches-for-head-commit +// GitHub API docs: https://docs.github.com/rest/commits/commits?apiVersion=2022-11-28#list-branches-for-head-commit // //meta:operation GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head func (s *RepositoriesService) ListBranchesHeadCommit(ctx context.Context, owner, repo, sha string) ([]*BranchCommit, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v/branches-where-head", owner, repo, sha) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeListPullsOrBranchesForCommitPreview) var branchCommits []*BranchCommit - resp, err := s.client.Do(ctx, req, &branchCommits) + resp, err := s.client.Do(req, &branchCommits) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/repos_community_health.go b/vendor/github.com/google/go-github/v88/github/repos_community_health.go similarity index 91% rename from vendor/github.com/google/go-github/v73/github/repos_community_health.go rename to vendor/github.com/google/go-github/v88/github/repos_community_health.go index 54d1b414e..143da8c4e 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_community_health.go +++ b/vendor/github.com/google/go-github/v88/github/repos_community_health.go @@ -43,18 +43,18 @@ type CommunityHealthMetrics struct { // GetCommunityHealthMetrics retrieves all the community health metrics for a repository. // -// GitHub API docs: https://docs.github.com/rest/metrics/community#get-community-profile-metrics +// GitHub API docs: https://docs.github.com/rest/metrics/community?apiVersion=2022-11-28#get-community-profile-metrics // //meta:operation GET /repos/{owner}/{repo}/community/profile func (s *RepositoriesService) GetCommunityHealthMetrics(ctx context.Context, owner, repo string) (*CommunityHealthMetrics, *Response, error) { u := fmt.Sprintf("repos/%v/%v/community/profile", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - metrics := &CommunityHealthMetrics{} - resp, err := s.client.Do(ctx, req, metrics) + var metrics *CommunityHealthMetrics + resp, err := s.client.Do(req, &metrics) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/repos_contents.go b/vendor/github.com/google/go-github/v88/github/repos_contents.go similarity index 69% rename from vendor/github.com/google/go-github/v73/github/repos_contents.go rename to vendor/github.com/google/go-github/v88/github/repos_contents.go index 5d7329c4f..024496fe5 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_contents.go +++ b/vendor/github.com/google/go-github/v88/github/repos_contents.go @@ -4,7 +4,7 @@ // license that can be found in the LICENSE file. // Repository contents API methods. -// GitHub API docs: https://docs.github.com/rest/repos/contents/ +// GitHub API docs: https://docs.github.com/rest/repos/contents?apiVersion=2022-11-28 package github @@ -17,11 +17,17 @@ import ( "io" "net/http" "net/url" - "path" "strings" ) -var ErrPathForbidden = errors.New("path must not contain '..' due to auth vulnerability issue") +// ErrContentsDirectory indicates that the contents are not available for a directory. +var ErrContentsDirectory = errors.New("contents not available for directory") + +// ErrContentsSubmodule indicates that the contents are not available for a submodule. +var ErrContentsSubmodule = errors.New("contents not available for submodule") + +// ErrContentsNoDownloadURL indicates that the contents download URL is empty, which may occur when file size > 100 MB. +var ErrContentsNoDownloadURL = errors.New("contents download url is empty") // RepositoryContent represents a file or directory in a github repository. type RepositoryContent struct { @@ -48,7 +54,7 @@ type RepositoryContent struct { // RepositoryContentResponse holds the parsed response from CreateFile, UpdateFile, and DeleteFile. type RepositoryContentResponse struct { Content *RepositoryContent `json:"content,omitempty"` - Commit `json:"commit,omitempty"` + Commit `json:"commit"` } // RepositoryContentFileOptions specifies optional parameters for CreateFile, UpdateFile, and DeleteFile. @@ -62,7 +68,7 @@ type RepositoryContentFileOptions struct { } // RepositoryContentGetOptions represents an optional ref parameter, which can be a SHA, -// branch, or tag. +// branch, or tag. E.g., `6540c41b`, `heads/main`, `tags/v1.0`. type RepositoryContentGetOptions struct { Ref string `url:"ref,omitempty"` } @@ -100,7 +106,7 @@ func (r *RepositoryContent) GetContent() (string, error) { // GetReadme gets the Readme file for the repository. // -// GitHub API docs: https://docs.github.com/rest/repos/contents#get-a-repository-readme +// GitHub API docs: https://docs.github.com/rest/repos/contents?apiVersion=2022-11-28#get-a-repository-readme // //meta:operation GET /repos/{owner}/{repo}/readme func (s *RepositoriesService) GetReadme(ctx context.Context, owner, repo string, opts *RepositoryContentGetOptions) (*RepositoryContent, *Response, error) { @@ -110,13 +116,13 @@ func (s *RepositoriesService) GetReadme(ctx context.Context, owner, repo string, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - readme := new(RepositoryContent) - resp, err := s.client.Do(ctx, req, readme) + var readme *RepositoryContent + resp, err := s.client.Do(req, &readme) if err != nil { return nil, resp, err } @@ -133,44 +139,16 @@ func (s *RepositoriesService) GetReadme(ctx context.Context, owner, repo string, // returned error is nil. Callers should check the returned Response status // code to verify the content is from a successful response. // -// GitHub API docs: https://docs.github.com/rest/repos/contents#get-repository-content +// DownloadContents returns [ErrContentsDirectory] if the path references a +// directory, [ErrContentsSubmodule] if the path references a submodule, and +// [ErrContentsNoDownloadURL] if the file's download URL is empty. +// +// GitHub API docs: https://docs.github.com/rest/repos/contents?apiVersion=2022-11-28#get-repository-content // //meta:operation GET /repos/{owner}/{repo}/contents/{path} func (s *RepositoriesService) DownloadContents(ctx context.Context, owner, repo, filepath string, opts *RepositoryContentGetOptions) (io.ReadCloser, *Response, error) { - dir := path.Dir(filepath) - filename := path.Base(filepath) - fileContent, _, resp, err := s.GetContents(ctx, owner, repo, filepath, opts) - if err == nil && fileContent != nil { - content, err := fileContent.GetContent() - if err == nil && content != "" { - return io.NopCloser(strings.NewReader(content)), resp, nil - } - } - - _, dirContents, resp, err := s.GetContents(ctx, owner, repo, dir, opts) - if err != nil { - return nil, resp, err - } - - for _, contents := range dirContents { - if contents.GetName() == filename { - if contents.GetDownloadURL() == "" { - return nil, resp, fmt.Errorf("no download link found for %s", filepath) - } - dlReq, err := http.NewRequestWithContext(ctx, http.MethodGet, *contents.DownloadURL, nil) - if err != nil { - return nil, resp, err - } - dlResp, err := s.client.client.Do(dlReq) - if err != nil { - return nil, &Response{Response: dlResp}, err - } - - return dlResp.Body, &Response{Response: dlResp}, nil - } - } - - return nil, resp, fmt.Errorf("no file named %s found in %s", filename, dir) + rc, _, resp, err := s.DownloadContentsWithMeta(ctx, owner, repo, filepath, opts) + return rc, resp, err } // DownloadContentsWithMeta is identical to DownloadContents but additionally @@ -182,44 +160,49 @@ func (s *RepositoriesService) DownloadContents(ctx context.Context, owner, repo, // returned error is nil. Callers should check the returned Response status // code to verify the content is from a successful response. // -// GitHub API docs: https://docs.github.com/rest/repos/contents#get-repository-content +// DownloadContentsWithMeta returns [ErrContentsDirectory] if the path +// references a directory, [ErrContentsSubmodule] if the path references a +// submodule, and [ErrContentsNoDownloadURL] if the file's download URL is +// empty. +// +// GitHub API docs: https://docs.github.com/rest/repos/contents?apiVersion=2022-11-28#get-repository-content // //meta:operation GET /repos/{owner}/{repo}/contents/{path} func (s *RepositoriesService) DownloadContentsWithMeta(ctx context.Context, owner, repo, filepath string, opts *RepositoryContentGetOptions) (io.ReadCloser, *RepositoryContent, *Response, error) { - dir := path.Dir(filepath) - filename := path.Base(filepath) fileContent, _, resp, err := s.GetContents(ctx, owner, repo, filepath, opts) - if err == nil && fileContent != nil { - content, err := fileContent.GetContent() - if err == nil && content != "" { - return io.NopCloser(strings.NewReader(content)), fileContent, resp, nil - } + if err != nil { + return nil, nil, resp, err + } + + if fileContent == nil { + return nil, nil, resp, ErrContentsDirectory + } + + if fileContent.GetType() == "submodule" { + return nil, fileContent, resp, ErrContentsSubmodule + } + + content, err := fileContent.GetContent() + if err == nil && content != "" { + return io.NopCloser(strings.NewReader(content)), fileContent, resp, nil + } + + downloadURL := fileContent.GetDownloadURL() + if downloadURL == "" { + return nil, fileContent, resp, ErrContentsNoDownloadURL } - _, dirContents, resp, err := s.GetContents(ctx, owner, repo, dir, opts) + dlReq, err := http.NewRequestWithContext(ctx, "GET", downloadURL, nil) if err != nil { - return nil, nil, resp, err + return nil, fileContent, resp, err } - for _, contents := range dirContents { - if contents.GetName() == filename { - if contents.GetDownloadURL() == "" { - return nil, contents, resp, fmt.Errorf("no download link found for %s", filepath) - } - dlReq, err := http.NewRequestWithContext(ctx, http.MethodGet, *contents.DownloadURL, nil) - if err != nil { - return nil, contents, resp, err - } - dlResp, err := s.client.client.Do(dlReq) - if err != nil { - return nil, contents, &Response{Response: dlResp}, err - } - - return dlResp.Body, contents, &Response{Response: dlResp}, nil - } + dlResp, err := s.client.client.Do(dlReq) + if err != nil { + return nil, fileContent, &Response{Response: dlResp}, err } - return nil, nil, resp, fmt.Errorf("no file named %s found in %s", filename, dir) + return dlResp.Body, fileContent, &Response{Response: dlResp}, nil } // GetContents can return either the metadata and content of a single file @@ -229,31 +212,24 @@ func (s *RepositoriesService) DownloadContentsWithMeta(ctx context.Context, owne // as possible, both result types will be returned but only one will contain a // value and the other will be nil. // -// Due to an auth vulnerability issue in the GitHub v3 API, ".." is not allowed -// to appear anywhere in the "path" or this method will return an error. -// -// GitHub API docs: https://docs.github.com/rest/repos/contents#get-repository-content +// GitHub API docs: https://docs.github.com/rest/repos/contents?apiVersion=2022-11-28#get-repository-content // //meta:operation GET /repos/{owner}/{repo}/contents/{path} func (s *RepositoriesService) GetContents(ctx context.Context, owner, repo, path string, opts *RepositoryContentGetOptions) (fileContent *RepositoryContent, directoryContent []*RepositoryContent, resp *Response, err error) { - if strings.Contains(path, "..") { - return nil, nil, nil, ErrPathForbidden - } - escapedPath := (&url.URL{Path: strings.TrimSuffix(path, "/")}).String() - u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, escapedPath) + u := fmt.Sprintf("repos/%v/%v/contents/%v", owner, repo, escapedPath) u, err = addOptions(u, opts) if err != nil { return nil, nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, nil, err } var rawJSON json.RawMessage - resp, err = s.client.Do(ctx, req, &rawJSON) + resp, err = s.client.Do(req, &rawJSON) if err != nil { return nil, nil, resp, err } @@ -268,24 +244,24 @@ func (s *RepositoriesService) GetContents(ctx context.Context, owner, repo, path return nil, directoryContent, resp, nil } - return nil, nil, resp, fmt.Errorf("unmarshaling failed for both file and directory content: %s and %s", fileUnmarshalError, directoryUnmarshalError) + return nil, nil, resp, fmt.Errorf("unmarshaling failed for both file and directory content: %v and %v", fileUnmarshalError, directoryUnmarshalError) } // CreateFile creates a new file in a repository at the given path and returns // the commit and file metadata. // -// GitHub API docs: https://docs.github.com/rest/repos/contents#create-or-update-file-contents +// GitHub API docs: https://docs.github.com/rest/repos/contents?apiVersion=2022-11-28#create-or-update-file-contents // //meta:operation PUT /repos/{owner}/{repo}/contents/{path} func (s *RepositoriesService) CreateFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path) - req, err := s.client.NewRequest("PUT", u, opts) + u := fmt.Sprintf("repos/%v/%v/contents/%v", owner, repo, path) + req, err := s.client.NewRequest(ctx, "PUT", u, opts) if err != nil { return nil, nil, err } - createResponse := new(RepositoryContentResponse) - resp, err := s.client.Do(ctx, req, createResponse) + var createResponse *RepositoryContentResponse + resp, err := s.client.Do(req, &createResponse) if err != nil { return nil, resp, err } @@ -296,18 +272,18 @@ func (s *RepositoriesService) CreateFile(ctx context.Context, owner, repo, path // UpdateFile updates a file in a repository at the given path and returns the // commit and file metadata. Requires the blob SHA of the file being updated. // -// GitHub API docs: https://docs.github.com/rest/repos/contents#create-or-update-file-contents +// GitHub API docs: https://docs.github.com/rest/repos/contents?apiVersion=2022-11-28#create-or-update-file-contents // //meta:operation PUT /repos/{owner}/{repo}/contents/{path} func (s *RepositoriesService) UpdateFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path) - req, err := s.client.NewRequest("PUT", u, opts) + u := fmt.Sprintf("repos/%v/%v/contents/%v", owner, repo, path) + req, err := s.client.NewRequest(ctx, "PUT", u, opts) if err != nil { return nil, nil, err } - updateResponse := new(RepositoryContentResponse) - resp, err := s.client.Do(ctx, req, updateResponse) + var updateResponse *RepositoryContentResponse + resp, err := s.client.Do(req, &updateResponse) if err != nil { return nil, resp, err } @@ -318,18 +294,18 @@ func (s *RepositoriesService) UpdateFile(ctx context.Context, owner, repo, path // DeleteFile deletes a file from a repository and returns the commit. // Requires the blob SHA of the file to be deleted. // -// GitHub API docs: https://docs.github.com/rest/repos/contents#delete-a-file +// GitHub API docs: https://docs.github.com/rest/repos/contents?apiVersion=2022-11-28#delete-a-file // //meta:operation DELETE /repos/{owner}/{repo}/contents/{path} func (s *RepositoriesService) DeleteFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path) - req, err := s.client.NewRequest("DELETE", u, opts) + u := fmt.Sprintf("repos/%v/%v/contents/%v", owner, repo, path) + req, err := s.client.NewRequest(ctx, "DELETE", u, opts) if err != nil { return nil, nil, err } - deleteResponse := new(RepositoryContentResponse) - resp, err := s.client.Do(ctx, req, deleteResponse) + var deleteResponse *RepositoryContentResponse + resp, err := s.client.Do(req, &deleteResponse) if err != nil { return nil, resp, err } @@ -352,18 +328,19 @@ const ( // repository. The archiveFormat can be specified by either the github.Tarball // or github.Zipball constant. // -// GitHub API docs: https://docs.github.com/rest/repos/contents#download-a-repository-archive-tar -// GitHub API docs: https://docs.github.com/rest/repos/contents#download-a-repository-archive-zip +// GitHub API docs: https://docs.github.com/rest/repos/contents?apiVersion=2022-11-28#download-a-repository-archive-tar +// +// GitHub API docs: https://docs.github.com/rest/repos/contents?apiVersion=2022-11-28#download-a-repository-archive-zip // //meta:operation GET /repos/{owner}/{repo}/tarball/{ref} //meta:operation GET /repos/{owner}/{repo}/zipball/{ref} func (s *RepositoriesService) GetArchiveLink(ctx context.Context, owner, repo string, archiveformat ArchiveFormat, opts *RepositoryContentGetOptions, maxRedirects int) (*url.URL, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/%s", owner, repo, archiveformat) + u := fmt.Sprintf("repos/%v/%v/%v", owner, repo, archiveformat) if opts != nil && opts.Ref != "" { - u += fmt.Sprintf("/%s", opts.Ref) + u += fmt.Sprintf("/%v", opts.Ref) } - if s.client.RateLimitRedirectionalEndpoints { + if s.client.rateLimitRedirectionalEndpoints { return s.getArchiveLinkWithRateLimit(ctx, u, maxRedirects) } @@ -390,12 +367,12 @@ func (s *RepositoriesService) getArchiveLinkWithoutRateLimit(ctx context.Context } func (s *RepositoriesService) getArchiveLinkWithRateLimit(ctx context.Context, u string, maxRedirects int) (*url.URL, *Response, error) { - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - url, resp, err := s.client.bareDoUntilFound(ctx, req, maxRedirects) + url, resp, err := s.client.bareDoUntilFound(req, maxRedirects) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/repos_deployment_branch_policies.go b/vendor/github.com/google/go-github/v88/github/repos_deployment_branch_policies.go similarity index 81% rename from vendor/github.com/google/go-github/v73/github/repos_deployment_branch_policies.go rename to vendor/github.com/google/go-github/v88/github/repos_deployment_branch_policies.go index 77ac73e44..e4760f22e 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_deployment_branch_policies.go +++ b/vendor/github.com/google/go-github/v88/github/repos_deployment_branch_policies.go @@ -32,19 +32,23 @@ type DeploymentBranchPolicyRequest struct { // ListDeploymentBranchPolicies lists the deployment branch policies for an environment. // -// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies#list-deployment-branch-policies +// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies?apiVersion=2022-11-28#list-deployment-branch-policies // //meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies -func (s *RepositoriesService) ListDeploymentBranchPolicies(ctx context.Context, owner, repo, environment string) (*DeploymentBranchPolicyResponse, *Response, error) { +func (s *RepositoriesService) ListDeploymentBranchPolicies(ctx context.Context, owner, repo, environment string, opts *ListOptions) (*DeploymentBranchPolicyResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment-branch-policies", owner, repo, environment) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var list *DeploymentBranchPolicyResponse - resp, err := s.client.Do(ctx, req, &list) + resp, err := s.client.Do(req, &list) if err != nil { return nil, resp, err } @@ -54,19 +58,19 @@ func (s *RepositoriesService) ListDeploymentBranchPolicies(ctx context.Context, // GetDeploymentBranchPolicy gets a deployment branch policy for an environment. // -// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies#get-a-deployment-branch-policy +// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies?apiVersion=2022-11-28#get-a-deployment-branch-policy // //meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id} func (s *RepositoriesService) GetDeploymentBranchPolicy(ctx context.Context, owner, repo, environment string, branchPolicyID int64) (*DeploymentBranchPolicy, *Response, error) { u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment-branch-policies/%v", owner, repo, environment, branchPolicyID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var policy *DeploymentBranchPolicy - resp, err := s.client.Do(ctx, req, &policy) + resp, err := s.client.Do(req, &policy) if err != nil { return nil, resp, err } @@ -76,19 +80,19 @@ func (s *RepositoriesService) GetDeploymentBranchPolicy(ctx context.Context, own // CreateDeploymentBranchPolicy creates a deployment branch policy for an environment. // -// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies#create-a-deployment-branch-policy +// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies?apiVersion=2022-11-28#create-a-deployment-branch-policy // //meta:operation POST /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies func (s *RepositoriesService) CreateDeploymentBranchPolicy(ctx context.Context, owner, repo, environment string, request *DeploymentBranchPolicyRequest) (*DeploymentBranchPolicy, *Response, error) { u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment-branch-policies", owner, repo, environment) - req, err := s.client.NewRequest("POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, request) if err != nil { return nil, nil, err } var policy *DeploymentBranchPolicy - resp, err := s.client.Do(ctx, req, &policy) + resp, err := s.client.Do(req, &policy) if err != nil { return nil, resp, err } @@ -98,19 +102,19 @@ func (s *RepositoriesService) CreateDeploymentBranchPolicy(ctx context.Context, // UpdateDeploymentBranchPolicy updates a deployment branch policy for an environment. // -// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies#update-a-deployment-branch-policy +// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies?apiVersion=2022-11-28#update-a-deployment-branch-policy // //meta:operation PUT /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id} func (s *RepositoriesService) UpdateDeploymentBranchPolicy(ctx context.Context, owner, repo, environment string, branchPolicyID int64, request *DeploymentBranchPolicyRequest) (*DeploymentBranchPolicy, *Response, error) { u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment-branch-policies/%v", owner, repo, environment, branchPolicyID) - req, err := s.client.NewRequest("PUT", u, request) + req, err := s.client.NewRequest(ctx, "PUT", u, request) if err != nil { return nil, nil, err } var policy *DeploymentBranchPolicy - resp, err := s.client.Do(ctx, req, &policy) + resp, err := s.client.Do(req, &policy) if err != nil { return nil, resp, err } @@ -120,16 +124,16 @@ func (s *RepositoriesService) UpdateDeploymentBranchPolicy(ctx context.Context, // DeleteDeploymentBranchPolicy deletes a deployment branch policy for an environment. // -// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies#delete-a-deployment-branch-policy +// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies?apiVersion=2022-11-28#delete-a-deployment-branch-policy // //meta:operation DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id} func (s *RepositoriesService) DeleteDeploymentBranchPolicy(ctx context.Context, owner, repo, environment string, branchPolicyID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment-branch-policies/%v", owner, repo, environment, branchPolicyID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/repos_deployment_protection_rules.go b/vendor/github.com/google/go-github/v88/github/repos_deployment_protection_rules.go similarity index 82% rename from vendor/github.com/google/go-github/v73/github/repos_deployment_protection_rules.go rename to vendor/github.com/google/go-github/v88/github/repos_deployment_protection_rules.go index 29d490328..50c3901d7 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_deployment_protection_rules.go +++ b/vendor/github.com/google/go-github/v88/github/repos_deployment_protection_rules.go @@ -45,19 +45,19 @@ type CustomDeploymentProtectionRuleRequest struct { // GetAllDeploymentProtectionRules gets all the deployment protection rules for an environment. // -// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules#get-all-deployment-protection-rules-for-an-environment +// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules?apiVersion=2022-11-28#get-all-deployment-protection-rules-for-an-environment // //meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules func (s *RepositoriesService) GetAllDeploymentProtectionRules(ctx context.Context, owner, repo, environment string) (*ListDeploymentProtectionRuleResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules", owner, repo, environment) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var list *ListDeploymentProtectionRuleResponse - resp, err := s.client.Do(ctx, req, &list) + resp, err := s.client.Do(req, &list) if err != nil { return nil, resp, err } @@ -67,19 +67,19 @@ func (s *RepositoriesService) GetAllDeploymentProtectionRules(ctx context.Contex // CreateCustomDeploymentProtectionRule creates a custom deployment protection rule on an environment. // -// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules#create-a-custom-deployment-protection-rule-on-an-environment +// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules?apiVersion=2022-11-28#create-a-custom-deployment-protection-rule-on-an-environment // //meta:operation POST /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules func (s *RepositoriesService) CreateCustomDeploymentProtectionRule(ctx context.Context, owner, repo, environment string, request *CustomDeploymentProtectionRuleRequest) (*CustomDeploymentProtectionRule, *Response, error) { u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules", owner, repo, environment) - req, err := s.client.NewRequest("POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, request) if err != nil { return nil, nil, err } - protectionRule := new(CustomDeploymentProtectionRule) - resp, err := s.client.Do(ctx, req, protectionRule) + var protectionRule *CustomDeploymentProtectionRule + resp, err := s.client.Do(req, &protectionRule) if err != nil { return nil, resp, err } @@ -89,19 +89,23 @@ func (s *RepositoriesService) CreateCustomDeploymentProtectionRule(ctx context.C // ListCustomDeploymentRuleIntegrations lists the custom deployment rule integrations for an environment. // -// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules#list-custom-deployment-rule-integrations-available-for-an-environment +// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules?apiVersion=2022-11-28#list-custom-deployment-rule-integrations-available-for-an-environment // //meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/apps -func (s *RepositoriesService) ListCustomDeploymentRuleIntegrations(ctx context.Context, owner, repo, environment string) (*ListCustomDeploymentRuleIntegrationsResponse, *Response, error) { +func (s *RepositoriesService) ListCustomDeploymentRuleIntegrations(ctx context.Context, owner, repo, environment string, opts *ListOptions) (*ListCustomDeploymentRuleIntegrationsResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules/apps", owner, repo, environment) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var list *ListCustomDeploymentRuleIntegrationsResponse - resp, err := s.client.Do(ctx, req, &list) + resp, err := s.client.Do(req, &list) if err != nil { return nil, resp, err } @@ -111,19 +115,19 @@ func (s *RepositoriesService) ListCustomDeploymentRuleIntegrations(ctx context.C // GetCustomDeploymentProtectionRule gets a custom deployment protection rule for an environment. // -// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules#get-a-custom-deployment-protection-rule +// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules?apiVersion=2022-11-28#get-a-custom-deployment-protection-rule // //meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id} func (s *RepositoriesService) GetCustomDeploymentProtectionRule(ctx context.Context, owner, repo, environment string, protectionRuleID int64) (*CustomDeploymentProtectionRule, *Response, error) { u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules/%v", owner, repo, environment, protectionRuleID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var protectionRule *CustomDeploymentProtectionRule - resp, err := s.client.Do(ctx, req, &protectionRule) + resp, err := s.client.Do(req, &protectionRule) if err != nil { return nil, resp, err } @@ -133,16 +137,16 @@ func (s *RepositoriesService) GetCustomDeploymentProtectionRule(ctx context.Cont // DisableCustomDeploymentProtectionRule disables a custom deployment protection rule for an environment. // -// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules#disable-a-custom-protection-rule-for-an-environment +// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules?apiVersion=2022-11-28#disable-a-custom-protection-rule-for-an-environment // //meta:operation DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id} func (s *RepositoriesService) DisableCustomDeploymentProtectionRule(ctx context.Context, owner, repo, environment string, protectionRuleID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules/%v", owner, repo, environment, protectionRuleID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/repos_deployments.go b/vendor/github.com/google/go-github/v88/github/repos_deployments.go similarity index 87% rename from vendor/github.com/google/go-github/v73/github/repos_deployments.go rename to vendor/github.com/google/go-github/v88/github/repos_deployments.go index ded36a95b..541436df5 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_deployments.go +++ b/vendor/github.com/google/go-github/v88/github/repos_deployments.go @@ -49,7 +49,7 @@ type DeploymentsListOptions struct { // SHA of the Deployment. SHA string `url:"sha,omitempty"` - // List deployments for a given ref. + // List deployments for a given ref. This can be a branch, tag, or SHA. Ref string `url:"ref,omitempty"` // List deployments for a given task. @@ -63,7 +63,7 @@ type DeploymentsListOptions struct { // ListDeployments lists the deployments of a repository. // -// GitHub API docs: https://docs.github.com/rest/deployments/deployments#list-deployments +// GitHub API docs: https://docs.github.com/rest/deployments/deployments?apiVersion=2022-11-28#list-deployments // //meta:operation GET /repos/{owner}/{repo}/deployments func (s *RepositoriesService) ListDeployments(ctx context.Context, owner, repo string, opts *DeploymentsListOptions) ([]*Deployment, *Response, error) { @@ -73,13 +73,13 @@ func (s *RepositoriesService) ListDeployments(ctx context.Context, owner, repo s return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var deployments []*Deployment - resp, err := s.client.Do(ctx, req, &deployments) + resp, err := s.client.Do(req, &deployments) if err != nil { return nil, resp, err } @@ -89,19 +89,19 @@ func (s *RepositoriesService) ListDeployments(ctx context.Context, owner, repo s // GetDeployment returns a single deployment of a repository. // -// GitHub API docs: https://docs.github.com/rest/deployments/deployments#get-a-deployment +// GitHub API docs: https://docs.github.com/rest/deployments/deployments?apiVersion=2022-11-28#get-a-deployment // //meta:operation GET /repos/{owner}/{repo}/deployments/{deployment_id} func (s *RepositoriesService) GetDeployment(ctx context.Context, owner, repo string, deploymentID int64) (*Deployment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments/%v", owner, repo, deploymentID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - deployment := new(Deployment) - resp, err := s.client.Do(ctx, req, deployment) + var deployment *Deployment + resp, err := s.client.Do(req, &deployment) if err != nil { return nil, resp, err } @@ -111,23 +111,22 @@ func (s *RepositoriesService) GetDeployment(ctx context.Context, owner, repo str // CreateDeployment creates a new deployment for a repository. // -// GitHub API docs: https://docs.github.com/rest/deployments/deployments#create-a-deployment +// GitHub API docs: https://docs.github.com/rest/deployments/deployments?apiVersion=2022-11-28#create-a-deployment // //meta:operation POST /repos/{owner}/{repo}/deployments func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo string, request *DeploymentRequest) (*Deployment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments", owner, repo) - req, err := s.client.NewRequest("POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, request) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - d := new(Deployment) - resp, err := s.client.Do(ctx, req, d) + var d *Deployment + resp, err := s.client.Do(req, &d) if err != nil { return nil, resp, err } @@ -137,16 +136,16 @@ func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo // DeleteDeployment deletes an existing deployment for a repository. // -// GitHub API docs: https://docs.github.com/rest/deployments/deployments#delete-a-deployment +// GitHub API docs: https://docs.github.com/rest/deployments/deployments?apiVersion=2022-11-28#delete-a-deployment // //meta:operation DELETE /repos/{owner}/{repo}/deployments/{deployment_id} func (s *RepositoriesService) DeleteDeployment(ctx context.Context, owner, repo string, deploymentID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments/%v", owner, repo, deploymentID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DeploymentStatus represents the status of a @@ -183,7 +182,7 @@ type DeploymentStatusRequest struct { // ListDeploymentStatuses lists the statuses of a given deployment of a repository. // -// GitHub API docs: https://docs.github.com/rest/deployments/statuses#list-deployment-statuses +// GitHub API docs: https://docs.github.com/rest/deployments/statuses?apiVersion=2022-11-28#list-deployment-statuses // //meta:operation GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner, repo string, deployment int64, opts *ListOptions) ([]*DeploymentStatus, *Response, error) { @@ -193,17 +192,16 @@ func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) var statuses []*DeploymentStatus - resp, err := s.client.Do(ctx, req, &statuses) + resp, err := s.client.Do(req, &statuses) if err != nil { return nil, resp, err } @@ -213,23 +211,22 @@ func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner, // GetDeploymentStatus returns a single deployment status of a repository. // -// GitHub API docs: https://docs.github.com/rest/deployments/statuses#get-a-deployment-status +// GitHub API docs: https://docs.github.com/rest/deployments/statuses?apiVersion=2022-11-28#get-a-deployment-status // //meta:operation GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses/{status_id} func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, repo string, deploymentID, deploymentStatusID int64) (*DeploymentStatus, *Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses/%v", owner, repo, deploymentID, deploymentStatusID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - d := new(DeploymentStatus) - resp, err := s.client.Do(ctx, req, d) + var d *DeploymentStatus + resp, err := s.client.Do(req, &d) if err != nil { return nil, resp, err } @@ -239,23 +236,22 @@ func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, re // CreateDeploymentStatus creates a new status for a deployment. // -// GitHub API docs: https://docs.github.com/rest/deployments/statuses#create-a-deployment-status +// GitHub API docs: https://docs.github.com/rest/deployments/statuses?apiVersion=2022-11-28#create-a-deployment-status // //meta:operation POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner, repo string, deployment int64, request *DeploymentStatusRequest) (*DeploymentStatus, *Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses", owner, repo, deployment) - req, err := s.client.NewRequest("POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, request) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - d := new(DeploymentStatus) - resp, err := s.client.Do(ctx, req, d) + var d *DeploymentStatus + resp, err := s.client.Do(req, &d) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/repos_environments.go b/vendor/github.com/google/go-github/v88/github/repos_environments.go similarity index 88% rename from vendor/github.com/google/go-github/v73/github/repos_environments.go rename to vendor/github.com/google/go-github/v88/github/repos_environments.go index eab51a11b..74b5faf6f 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_environments.go +++ b/vendor/github.com/google/go-github/v88/github/repos_environments.go @@ -107,23 +107,23 @@ func (r *RequiredReviewer) UnmarshalJSON(data []byte) error { // ListEnvironments lists all environments for a repository. // -// GitHub API docs: https://docs.github.com/rest/deployments/environments#list-environments +// GitHub API docs: https://docs.github.com/rest/deployments/environments?apiVersion=2022-11-28#list-environments // //meta:operation GET /repos/{owner}/{repo}/environments func (s *RepositoriesService) ListEnvironments(ctx context.Context, owner, repo string, opts *EnvironmentListOptions) (*EnvResponse, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/environments", owner, repo) + u := fmt.Sprintf("repos/%v/%v/environments", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var list *EnvResponse - resp, err := s.client.Do(ctx, req, &list) + resp, err := s.client.Do(req, &list) if err != nil { return nil, resp, err } @@ -132,19 +132,18 @@ func (s *RepositoriesService) ListEnvironments(ctx context.Context, owner, repo // GetEnvironment get a single environment for a repository. // -// GitHub API docs: https://docs.github.com/rest/deployments/environments#get-an-environment +// GitHub API docs: https://docs.github.com/rest/deployments/environments?apiVersion=2022-11-28#get-an-environment // //meta:operation GET /repos/{owner}/{repo}/environments/{environment_name} func (s *RepositoriesService) GetEnvironment(ctx context.Context, owner, repo, name string) (*Environment, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/environments/%s", owner, repo, name) - - req, err := s.client.NewRequest("GET", u, nil) + u := fmt.Sprintf("repos/%v/%v/environments/%v", owner, repo, name) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var env *Environment - resp, err := s.client.Do(ctx, req, &env) + resp, err := s.client.Do(req, &env) if err != nil { return nil, resp, err } @@ -154,8 +153,8 @@ func (s *RepositoriesService) GetEnvironment(ctx context.Context, owner, repo, n // MarshalJSON implements the json.Marshaler interface. // As the only way to clear a WaitTimer is to set it to 0, a missing WaitTimer object should default to 0, not null. // As the default value for CanAdminsBypass is true, a nil value here marshals to true. -func (c *CreateUpdateEnvironment) MarshalJSON() ([]byte, error) { - type Alias CreateUpdateEnvironment +func (c CreateUpdateEnvironment) MarshalJSON() ([]byte, error) { + type alias CreateUpdateEnvironment if c.WaitTimer == nil { c.WaitTimer = Ptr(0) } @@ -163,9 +162,9 @@ func (c *CreateUpdateEnvironment) MarshalJSON() ([]byte, error) { c.CanAdminsBypass = Ptr(true) } return json.Marshal(&struct { - *Alias + alias }{ - Alias: (*Alias)(c), + alias: alias(c), }) } @@ -190,19 +189,18 @@ type createUpdateEnvironmentNoEnterprise struct { // CreateUpdateEnvironment create or update a new environment for a repository. // -// GitHub API docs: https://docs.github.com/rest/deployments/environments#create-or-update-an-environment +// GitHub API docs: https://docs.github.com/rest/deployments/environments?apiVersion=2022-11-28#create-or-update-an-environment // //meta:operation PUT /repos/{owner}/{repo}/environments/{environment_name} func (s *RepositoriesService) CreateUpdateEnvironment(ctx context.Context, owner, repo, name string, environment *CreateUpdateEnvironment) (*Environment, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/environments/%s", owner, repo, name) - - req, err := s.client.NewRequest("PUT", u, environment) + u := fmt.Sprintf("repos/%v/%v/environments/%v", owner, repo, name) + req, err := s.client.NewRequest(ctx, "PUT", u, environment) if err != nil { return nil, nil, err } - e := new(Environment) - resp, err := s.client.Do(ctx, req, e) + var e *Environment + resp, err := s.client.Do(req, &e) if err != nil { // The API returns 422 when the pricing plan doesn't support all the fields sent. // This path will be executed for Pro/Teams private repos. @@ -215,38 +213,40 @@ func (s *RepositoriesService) CreateUpdateEnvironment(ctx context.Context, owner } return nil, resp, err } + return e, resp, nil } // createNewEnvNoEnterprise is an internal function for cases where the original call returned 422. // Currently only the `deployment_branch_policy` parameter is supported for Pro/Team private repos. func (s *RepositoriesService) createNewEnvNoEnterprise(ctx context.Context, u string, environment *CreateUpdateEnvironment) (*Environment, *Response, error) { - req, err := s.client.NewRequest("PUT", u, &createUpdateEnvironmentNoEnterprise{ + req, err := s.client.NewRequest(ctx, "PUT", u, &createUpdateEnvironmentNoEnterprise{ DeploymentBranchPolicy: environment.DeploymentBranchPolicy, }) if err != nil { return nil, nil, err } - e := new(Environment) - resp, err := s.client.Do(ctx, req, e) + var e *Environment + resp, err := s.client.Do(req, &e) if err != nil { return nil, resp, err } + return e, resp, nil } // DeleteEnvironment delete an environment from a repository. // -// GitHub API docs: https://docs.github.com/rest/deployments/environments#delete-an-environment +// GitHub API docs: https://docs.github.com/rest/deployments/environments?apiVersion=2022-11-28#delete-an-environment // //meta:operation DELETE /repos/{owner}/{repo}/environments/{environment_name} func (s *RepositoriesService) DeleteEnvironment(ctx context.Context, owner, repo, name string) (*Response, error) { - u := fmt.Sprintf("repos/%s/%s/environments/%s", owner, repo, name) - - req, err := s.client.NewRequest("DELETE", u, nil) + u := fmt.Sprintf("repos/%v/%v/environments/%v", owner, repo, name) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/repos_forks.go b/vendor/github.com/google/go-github/v88/github/repos_forks.go similarity index 79% rename from vendor/github.com/google/go-github/v73/github/repos_forks.go rename to vendor/github.com/google/go-github/v88/github/repos_forks.go index 60fb49da5..2e4ec16d7 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_forks.go +++ b/vendor/github.com/google/go-github/v88/github/repos_forks.go @@ -8,6 +8,7 @@ package github import ( "context" "encoding/json" + "errors" "fmt" ) @@ -23,7 +24,7 @@ type RepositoryListForksOptions struct { // ListForks lists the forks of the specified repository. // -// GitHub API docs: https://docs.github.com/rest/repos/forks#list-forks +// GitHub API docs: https://docs.github.com/rest/repos/forks?apiVersion=2022-11-28#list-forks // //meta:operation GET /repos/{owner}/{repo}/forks func (s *RepositoriesService) ListForks(ctx context.Context, owner, repo string, opts *RepositoryListForksOptions) ([]*Repository, *Response, error) { @@ -33,16 +34,15 @@ func (s *RepositoriesService) ListForks(ctx context.Context, owner, repo string, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when topics API fully launches. req.Header.Set("Accept", mediaTypeTopicsPreview) var repos []*Repository - resp, err := s.client.Do(ctx, req, &repos) + resp, err := s.client.Do(req, &repos) if err != nil { return nil, resp, err } @@ -68,30 +68,31 @@ type RepositoryCreateForkOptions struct { // A follow up request, after a delay of a second or so, should result // in a successful request. // -// GitHub API docs: https://docs.github.com/rest/repos/forks#create-a-fork +// GitHub API docs: https://docs.github.com/rest/repos/forks?apiVersion=2022-11-28#create-a-fork // //meta:operation POST /repos/{owner}/{repo}/forks func (s *RepositoriesService) CreateFork(ctx context.Context, owner, repo string, opts *RepositoryCreateForkOptions) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/forks", owner, repo) - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, opts) if err != nil { return nil, nil, err } - fork := new(Repository) - resp, err := s.client.Do(ctx, req, fork) + var fork Repository + resp, err := s.client.Do(req, &fork) if err != nil { // Persist AcceptedError's metadata to the Repository object. - if aerr, ok := err.(*AcceptedError); ok { - if err := json.Unmarshal(aerr.Raw, fork); err != nil { - return fork, resp, err + var aerr *AcceptedError + if errors.As(err, &aerr) { + if err := json.Unmarshal(aerr.Raw, &fork); err != nil { + return &fork, resp, err } - return fork, resp, err + return &fork, resp, err } return nil, resp, err } - return fork, resp, nil + return &fork, resp, nil } diff --git a/vendor/github.com/google/go-github/v73/github/repos_hooks.go b/vendor/github.com/google/go-github/v88/github/repos_hooks.go similarity index 73% rename from vendor/github.com/google/go-github/v73/github/repos_hooks.go rename to vendor/github.com/google/go-github/v88/github/repos_hooks.go index 67b80b857..9bdd8428b 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_hooks.go +++ b/vendor/github.com/google/go-github/v88/github/repos_hooks.go @@ -7,6 +7,7 @@ package github import ( "context" + "errors" "fmt" "net/http" "net/url" @@ -79,10 +80,14 @@ type createHookRequest struct { // Note that only a subset of the hook fields are used and hook must // not be nil. // -// GitHub API docs: https://docs.github.com/rest/repos/webhooks#create-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#create-a-repository-webhook // //meta:operation POST /repos/{owner}/{repo}/hooks func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string, hook *Hook) (*Hook, *Response, error) { + if hook == nil { + return nil, nil, errors.New("hook must be provided") + } + u := fmt.Sprintf("repos/%v/%v/hooks", owner, repo) hookReq := &createHookRequest{ @@ -92,13 +97,13 @@ func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string Config: hook.Config, } - req, err := s.client.NewRequest("POST", u, hookReq) + req, err := s.client.NewRequest(ctx, "POST", u, hookReq) if err != nil { return nil, nil, err } - h := new(Hook) - resp, err := s.client.Do(ctx, req, h) + var h *Hook + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } @@ -108,7 +113,7 @@ func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string // ListHooks lists all Hooks for the specified repository. // -// GitHub API docs: https://docs.github.com/rest/repos/webhooks#list-repository-webhooks +// GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#list-repository-webhooks // //meta:operation GET /repos/{owner}/{repo}/hooks func (s *RepositoriesService) ListHooks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Hook, *Response, error) { @@ -118,13 +123,13 @@ func (s *RepositoriesService) ListHooks(ctx context.Context, owner, repo string, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var hooks []*Hook - resp, err := s.client.Do(ctx, req, &hooks) + resp, err := s.client.Do(req, &hooks) if err != nil { return nil, resp, err } @@ -134,17 +139,18 @@ func (s *RepositoriesService) ListHooks(ctx context.Context, owner, repo string, // GetHook returns a single specified Hook. // -// GitHub API docs: https://docs.github.com/rest/repos/webhooks#get-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#get-a-repository-webhook // //meta:operation GET /repos/{owner}/{repo}/hooks/{hook_id} func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, id int64) (*Hook, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id) - req, err := s.client.NewRequest("GET", u, nil) + u := fmt.Sprintf("repos/%v/%v/hooks/%v", owner, repo, id) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - h := new(Hook) - resp, err := s.client.Do(ctx, req, h) + + var h *Hook + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } @@ -154,17 +160,18 @@ func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, i // EditHook updates a specified Hook. // -// GitHub API docs: https://docs.github.com/rest/repos/webhooks#update-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#update-a-repository-webhook // //meta:operation PATCH /repos/{owner}/{repo}/hooks/{hook_id} func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, id int64, hook *Hook) (*Hook, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id) - req, err := s.client.NewRequest("PATCH", u, hook) + u := fmt.Sprintf("repos/%v/%v/hooks/%v", owner, repo, id) + req, err := s.client.NewRequest(ctx, "PATCH", u, hook) if err != nil { return nil, nil, err } - h := new(Hook) - resp, err := s.client.Do(ctx, req, h) + + var h *Hook + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } @@ -174,44 +181,45 @@ func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, // DeleteHook deletes a specified Hook. // -// GitHub API docs: https://docs.github.com/rest/repos/webhooks#delete-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#delete-a-repository-webhook // //meta:operation DELETE /repos/{owner}/{repo}/hooks/{hook_id} func (s *RepositoriesService) DeleteHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id) - req, err := s.client.NewRequest("DELETE", u, nil) + u := fmt.Sprintf("repos/%v/%v/hooks/%v", owner, repo, id) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + + return s.client.Do(req, nil) } // PingHook triggers a 'ping' event to be sent to the Hook. // -// GitHub API docs: https://docs.github.com/rest/repos/webhooks#ping-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#ping-a-repository-webhook // //meta:operation POST /repos/{owner}/{repo}/hooks/{hook_id}/pings func (s *RepositoriesService) PingHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/hooks/%d/pings", owner, repo, id) - req, err := s.client.NewRequest("POST", u, nil) + u := fmt.Sprintf("repos/%v/%v/hooks/%v/pings", owner, repo, id) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // TestHook triggers a test Hook by github. // -// GitHub API docs: https://docs.github.com/rest/repos/webhooks#test-the-push-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#test-the-push-repository-webhook // //meta:operation POST /repos/{owner}/{repo}/hooks/{hook_id}/tests func (s *RepositoriesService) TestHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/hooks/%d/tests", owner, repo, id) - req, err := s.client.NewRequest("POST", u, nil) + u := fmt.Sprintf("repos/%v/%v/hooks/%v/tests", owner, repo, id) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // Subscribe lets servers register to receive updates when a topic is updated. @@ -220,12 +228,12 @@ func (s *RepositoriesService) TestHook(ctx context.Context, owner, repo string, // //meta:operation POST /hub func (s *RepositoriesService) Subscribe(ctx context.Context, owner, repo, event, callback string, secret []byte) (*Response, error) { - req, err := s.createWebSubRequest("subscribe", owner, repo, event, callback, secret) + req, err := s.createWebSubRequest(ctx, "subscribe", owner, repo, event, callback, secret) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // Unsubscribe lets servers unregister to no longer receive updates when a topic is updated. @@ -234,21 +242,21 @@ func (s *RepositoriesService) Subscribe(ctx context.Context, owner, repo, event, // //meta:operation POST /hub func (s *RepositoriesService) Unsubscribe(ctx context.Context, owner, repo, event, callback string, secret []byte) (*Response, error) { - req, err := s.createWebSubRequest("unsubscribe", owner, repo, event, callback, secret) + req, err := s.createWebSubRequest(ctx, "unsubscribe", owner, repo, event, callback, secret) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // createWebSubRequest returns a subscribe/unsubscribe request that implements // the WebSub (formerly PubSubHubbub) protocol. // // See: https://www.w3.org/TR/websub/#subscriber-sends-subscription-request -func (s *RepositoriesService) createWebSubRequest(hubMode, owner, repo, event, callback string, secret []byte) (*http.Request, error) { +func (s *RepositoriesService) createWebSubRequest(ctx context.Context, hubMode, owner, repo, event, callback string, secret []byte) (*http.Request, error) { topic := fmt.Sprintf( - "https://github.com/%s/%s/events/%s", + "https://github.com/%v/%v/events/%v", owner, repo, event, @@ -262,7 +270,7 @@ func (s *RepositoriesService) createWebSubRequest(hubMode, owner, repo, event, c } body := strings.NewReader(form.Encode()) - req, err := s.client.NewFormRequest("hub", body) + req, err := s.client.NewFormRequest(ctx, "hub", body) if err != nil { return nil, err } diff --git a/vendor/github.com/google/go-github/v73/github/repos_hooks_configuration.go b/vendor/github.com/google/go-github/v88/github/repos_hooks_configuration.go similarity index 76% rename from vendor/github.com/google/go-github/v73/github/repos_hooks_configuration.go rename to vendor/github.com/google/go-github/v88/github/repos_hooks_configuration.go index 9560bd7a4..37880922b 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_hooks_configuration.go +++ b/vendor/github.com/google/go-github/v88/github/repos_hooks_configuration.go @@ -16,7 +16,7 @@ type HookConfig struct { // Possible values are `json` and `form`, the field is not specified the default is `form` ContentType *string `json:"content_type,omitempty"` // The possible values are 0 and 1. - // Setting it to 1 will allow skip certificate verification for the host, + // Setting it to 1 will allow skipping certificate verification for the host, // potentially exposing to MitM attacks: https://en.wikipedia.org/wiki/Man-in-the-middle_attack InsecureSSL *string `json:"insecure_ssl,omitempty"` URL *string `json:"url,omitempty"` @@ -27,18 +27,18 @@ type HookConfig struct { // GetHookConfiguration returns the configuration for the specified repository webhook. // -// GitHub API docs: https://docs.github.com/rest/repos/webhooks#get-a-webhook-configuration-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#get-a-webhook-configuration-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/hooks/{hook_id}/config func (s *RepositoriesService) GetHookConfiguration(ctx context.Context, owner, repo string, id int64) (*HookConfig, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%v/config", owner, repo, id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - config := new(HookConfig) - resp, err := s.client.Do(ctx, req, config) + var config *HookConfig + resp, err := s.client.Do(req, &config) if err != nil { return nil, resp, err } @@ -48,18 +48,18 @@ func (s *RepositoriesService) GetHookConfiguration(ctx context.Context, owner, r // EditHookConfiguration updates the configuration for the specified repository webhook. // -// GitHub API docs: https://docs.github.com/rest/repos/webhooks#update-a-webhook-configuration-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#update-a-webhook-configuration-for-a-repository // //meta:operation PATCH /repos/{owner}/{repo}/hooks/{hook_id}/config func (s *RepositoriesService) EditHookConfiguration(ctx context.Context, owner, repo string, id int64, config *HookConfig) (*HookConfig, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%v/config", owner, repo, id) - req, err := s.client.NewRequest("PATCH", u, config) + req, err := s.client.NewRequest(ctx, "PATCH", u, config) if err != nil { return nil, nil, err } - c := new(HookConfig) - resp, err := s.client.Do(ctx, req, c) + var c *HookConfig + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/repos_hooks_deliveries.go b/vendor/github.com/google/go-github/v88/github/repos_hooks_deliveries.go similarity index 83% rename from vendor/github.com/google/go-github/v73/github/repos_hooks_deliveries.go rename to vendor/github.com/google/go-github/v88/github/repos_hooks_deliveries.go index 526d82c6f..85b83e045 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_hooks_deliveries.go +++ b/vendor/github.com/google/go-github/v88/github/repos_hooks_deliveries.go @@ -15,8 +15,8 @@ import ( // HookDelivery represents the data that is received from GitHub's Webhook Delivery API // // GitHub API docs: -// - https://docs.github.com/rest/webhooks/repo-deliveries#list-deliveries-for-a-repository-webhook -// - https://docs.github.com/rest/webhooks/repo-deliveries#get-a-delivery-for-a-repository-webhook +// - https://docs.github.com/rest/webhooks/repo-deliveries?apiVersion=2022-11-28#list-deliveries-for-a-repository-webhook +// - https://docs.github.com/rest/webhooks/repo-deliveries?apiVersion=2022-11-28#get-a-delivery-for-a-repository-webhook type HookDelivery struct { ID *int64 `json:"id,omitempty"` GUID *string `json:"guid,omitempty"` @@ -84,7 +84,7 @@ func (r HookResponse) String() string { // ListHookDeliveries lists webhook deliveries for a webhook configured in a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/webhooks#list-deliveries-for-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#list-deliveries-for-a-repository-webhook // //meta:operation GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries func (s *RepositoriesService) ListHookDeliveries(ctx context.Context, owner, repo string, id int64, opts *ListCursorOptions) ([]*HookDelivery, *Response, error) { @@ -94,13 +94,13 @@ func (s *RepositoriesService) ListHookDeliveries(ctx context.Context, owner, rep return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } deliveries := []*HookDelivery{} - resp, err := s.client.Do(ctx, req, &deliveries) + resp, err := s.client.Do(req, &deliveries) if err != nil { return nil, resp, err } @@ -110,18 +110,18 @@ func (s *RepositoriesService) ListHookDeliveries(ctx context.Context, owner, rep // GetHookDelivery returns a delivery for a webhook configured in a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/webhooks#get-a-delivery-for-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#get-a-delivery-for-a-repository-webhook // //meta:operation GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id} func (s *RepositoriesService) GetHookDelivery(ctx context.Context, owner, repo string, hookID, deliveryID int64) (*HookDelivery, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%v/deliveries/%v", owner, repo, hookID, deliveryID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - h := new(HookDelivery) - resp, err := s.client.Do(ctx, req, h) + var h *HookDelivery + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } @@ -131,18 +131,18 @@ func (s *RepositoriesService) GetHookDelivery(ctx context.Context, owner, repo s // RedeliverHookDelivery redelivers a delivery for a webhook configured in a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/webhooks#redeliver-a-delivery-for-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#redeliver-a-delivery-for-a-repository-webhook // //meta:operation POST /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}/attempts func (s *RepositoriesService) RedeliverHookDelivery(ctx context.Context, owner, repo string, hookID, deliveryID int64) (*HookDelivery, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%v/deliveries/%v/attempts", owner, repo, hookID, deliveryID) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - h := new(HookDelivery) - resp, err := s.client.Do(ctx, req, h) + var h *HookDelivery + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v88/github/repos_immutable_releases.go b/vendor/github.com/google/go-github/v88/github/repos_immutable_releases.go new file mode 100644 index 000000000..db91b6d02 --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/repos_immutable_releases.go @@ -0,0 +1,82 @@ +// Copyright 2026 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// RepoImmutableReleasesStatus represents the immutable releases status for a repository. +type RepoImmutableReleasesStatus struct { + Enabled *bool `json:"enabled,omitempty"` + EnforcedByOwner *bool `json:"enforced_by_owner,omitempty"` +} + +// EnableImmutableReleases enables immutable releases for a repository. +// +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#enable-immutable-releases +// +//meta:operation PUT /repos/{owner}/{repo}/immutable-releases +func (s *RepositoriesService) EnableImmutableReleases(ctx context.Context, owner, repo string) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/immutable-releases", owner, repo) + + req, err := s.client.NewRequest(ctx, "PUT", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// DisableImmutableReleases disables immutable releases for a repository. +// +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#disable-immutable-releases +// +//meta:operation DELETE /repos/{owner}/{repo}/immutable-releases +func (s *RepositoriesService) DisableImmutableReleases(ctx context.Context, owner, repo string) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/immutable-releases", owner, repo) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// AreImmutableReleasesEnabled checks if immutable releases are enabled for +// the repository. +// +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#check-if-immutable-releases-are-enabled-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/immutable-releases +func (s *RepositoriesService) AreImmutableReleasesEnabled(ctx context.Context, owner, repo string) (*RepoImmutableReleasesStatus, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/immutable-releases", owner, repo) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var status *RepoImmutableReleasesStatus + resp, err := s.client.Do(req, &status) + if err != nil { + return nil, resp, err + } + + return status, resp, nil +} diff --git a/vendor/github.com/google/go-github/v73/github/repos_invitations.go b/vendor/github.com/google/go-github/v88/github/repos_invitations.go similarity index 85% rename from vendor/github.com/google/go-github/v73/github/repos_invitations.go rename to vendor/github.com/google/go-github/v88/github/repos_invitations.go index 98fe01d1c..944610134 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_invitations.go +++ b/vendor/github.com/google/go-github/v88/github/repos_invitations.go @@ -28,7 +28,7 @@ type RepositoryInvitation struct { // ListInvitations lists all currently-open repository invitations. // -// GitHub API docs: https://docs.github.com/rest/collaborators/invitations#list-repository-invitations +// GitHub API docs: https://docs.github.com/rest/collaborators/invitations?apiVersion=2022-11-28#list-repository-invitations // //meta:operation GET /repos/{owner}/{repo}/invitations func (s *RepositoriesService) ListInvitations(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryInvitation, *Response, error) { @@ -38,13 +38,13 @@ func (s *RepositoriesService) ListInvitations(ctx context.Context, owner, repo s return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } invites := []*RepositoryInvitation{} - resp, err := s.client.Do(ctx, req, &invites) + resp, err := s.client.Do(req, &invites) if err != nil { return nil, resp, err } @@ -54,17 +54,17 @@ func (s *RepositoriesService) ListInvitations(ctx context.Context, owner, repo s // DeleteInvitation deletes a repository invitation. // -// GitHub API docs: https://docs.github.com/rest/collaborators/invitations#delete-a-repository-invitation +// GitHub API docs: https://docs.github.com/rest/collaborators/invitations?apiVersion=2022-11-28#delete-a-repository-invitation // //meta:operation DELETE /repos/{owner}/{repo}/invitations/{invitation_id} func (s *RepositoriesService) DeleteInvitation(ctx context.Context, owner, repo string, invitationID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/invitations/%v", owner, repo, invitationID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // UpdateInvitation updates the permissions associated with a repository @@ -73,7 +73,7 @@ func (s *RepositoriesService) DeleteInvitation(ctx context.Context, owner, repo // permissions represents the permissions that the associated user will have // on the repository. Possible values are: "read", "write", "admin". // -// GitHub API docs: https://docs.github.com/rest/collaborators/invitations#update-a-repository-invitation +// GitHub API docs: https://docs.github.com/rest/collaborators/invitations?apiVersion=2022-11-28#update-a-repository-invitation // //meta:operation PATCH /repos/{owner}/{repo}/invitations/{invitation_id} func (s *RepositoriesService) UpdateInvitation(ctx context.Context, owner, repo string, invitationID int64, permissions string) (*RepositoryInvitation, *Response, error) { @@ -81,13 +81,13 @@ func (s *RepositoriesService) UpdateInvitation(ctx context.Context, owner, repo Permissions string `json:"permissions"` }{Permissions: permissions} u := fmt.Sprintf("repos/%v/%v/invitations/%v", owner, repo, invitationID) - req, err := s.client.NewRequest("PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, opts) if err != nil { return nil, nil, err } - invite := &RepositoryInvitation{} - resp, err := s.client.Do(ctx, req, invite) + var invite *RepositoryInvitation + resp, err := s.client.Do(req, &invite) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/repos_keys.go b/vendor/github.com/google/go-github/v88/github/repos_keys.go similarity index 67% rename from vendor/github.com/google/go-github/v73/github/repos_keys.go rename to vendor/github.com/google/go-github/v88/github/repos_keys.go index cc86f8bbd..0635c4a20 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_keys.go +++ b/vendor/github.com/google/go-github/v88/github/repos_keys.go @@ -14,23 +14,23 @@ import ( // ListKeys lists the deploy keys for a repository. // -// GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys#list-deploy-keys +// GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys?apiVersion=2022-11-28#list-deploy-keys // //meta:operation GET /repos/{owner}/{repo}/keys -func (s *RepositoriesService) ListKeys(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*Key, *Response, error) { +func (s *RepositoriesService) ListKeys(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Key, *Response, error) { u := fmt.Sprintf("repos/%v/%v/keys", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var keys []*Key - resp, err := s.client.Do(ctx, req, &keys) + resp, err := s.client.Do(req, &keys) if err != nil { return nil, resp, err } @@ -40,19 +40,19 @@ func (s *RepositoriesService) ListKeys(ctx context.Context, owner string, repo s // GetKey fetches a single deploy key. // -// GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys#get-a-deploy-key +// GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys?apiVersion=2022-11-28#get-a-deploy-key // //meta:operation GET /repos/{owner}/{repo}/keys/{key_id} -func (s *RepositoriesService) GetKey(ctx context.Context, owner string, repo string, id int64) (*Key, *Response, error) { +func (s *RepositoriesService) GetKey(ctx context.Context, owner, repo string, id int64) (*Key, *Response, error) { u := fmt.Sprintf("repos/%v/%v/keys/%v", owner, repo, id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - key := new(Key) - resp, err := s.client.Do(ctx, req, key) + var key *Key + resp, err := s.client.Do(req, &key) if err != nil { return nil, resp, err } @@ -62,19 +62,19 @@ func (s *RepositoriesService) GetKey(ctx context.Context, owner string, repo str // CreateKey adds a deploy key for a repository. // -// GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys#create-a-deploy-key +// GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys?apiVersion=2022-11-28#create-a-deploy-key // //meta:operation POST /repos/{owner}/{repo}/keys -func (s *RepositoriesService) CreateKey(ctx context.Context, owner string, repo string, key *Key) (*Key, *Response, error) { +func (s *RepositoriesService) CreateKey(ctx context.Context, owner, repo string, key *Key) (*Key, *Response, error) { u := fmt.Sprintf("repos/%v/%v/keys", owner, repo) - req, err := s.client.NewRequest("POST", u, key) + req, err := s.client.NewRequest(ctx, "POST", u, key) if err != nil { return nil, nil, err } - k := new(Key) - resp, err := s.client.Do(ctx, req, k) + var k *Key + resp, err := s.client.Do(req, &k) if err != nil { return nil, resp, err } @@ -84,16 +84,16 @@ func (s *RepositoriesService) CreateKey(ctx context.Context, owner string, repo // DeleteKey deletes a deploy key. // -// GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys#delete-a-deploy-key +// GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys?apiVersion=2022-11-28#delete-a-deploy-key // //meta:operation DELETE /repos/{owner}/{repo}/keys/{key_id} -func (s *RepositoriesService) DeleteKey(ctx context.Context, owner string, repo string, id int64) (*Response, error) { +func (s *RepositoriesService) DeleteKey(ctx context.Context, owner, repo string, id int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/keys/%v", owner, repo, id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/repos_lfs.go b/vendor/github.com/google/go-github/v88/github/repos_lfs.go similarity index 77% rename from vendor/github.com/google/go-github/v73/github/repos_lfs.go rename to vendor/github.com/google/go-github/v88/github/repos_lfs.go index f0153c080..685e17b27 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_lfs.go +++ b/vendor/github.com/google/go-github/v88/github/repos_lfs.go @@ -12,18 +12,18 @@ import ( // EnableLFS turns the LFS (Large File Storage) feature ON for the selected repo. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/repos/lfs#enable-git-lfs-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/repos/lfs?apiVersion=2022-11-28#enable-git-lfs-for-a-repository // //meta:operation PUT /repos/{owner}/{repo}/lfs func (s *RepositoriesService) EnableLFS(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/lfs", owner, repo) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -33,18 +33,18 @@ func (s *RepositoriesService) EnableLFS(ctx context.Context, owner, repo string) // DisableLFS turns the LFS (Large File Storage) feature OFF for the selected repo. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/repos/lfs#disable-git-lfs-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/repos/lfs?apiVersion=2022-11-28#disable-git-lfs-for-a-repository // //meta:operation DELETE /repos/{owner}/{repo}/lfs func (s *RepositoriesService) DisableLFS(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/lfs", owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/repos_merging.go b/vendor/github.com/google/go-github/v88/github/repos_merging.go similarity index 84% rename from vendor/github.com/google/go-github/v73/github/repos_merging.go rename to vendor/github.com/google/go-github/v88/github/repos_merging.go index b26e5da1a..2ec93ebc1 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_merging.go +++ b/vendor/github.com/google/go-github/v88/github/repos_merging.go @@ -34,18 +34,18 @@ type RepoMergeUpstreamResult struct { // Merge a branch in the specified repository. // -// GitHub API docs: https://docs.github.com/rest/branches/branches#merge-a-branch +// GitHub API docs: https://docs.github.com/rest/branches/branches?apiVersion=2022-11-28#merge-a-branch // //meta:operation POST /repos/{owner}/{repo}/merges func (s *RepositoriesService) Merge(ctx context.Context, owner, repo string, request *RepositoryMergeRequest) (*RepositoryCommit, *Response, error) { u := fmt.Sprintf("repos/%v/%v/merges", owner, repo) - req, err := s.client.NewRequest("POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, request) if err != nil { return nil, nil, err } - commit := new(RepositoryCommit) - resp, err := s.client.Do(ctx, req, commit) + var commit *RepositoryCommit + resp, err := s.client.Do(req, &commit) if err != nil { return nil, resp, err } @@ -56,18 +56,18 @@ func (s *RepositoriesService) Merge(ctx context.Context, owner, repo string, req // MergeUpstream syncs a branch of a forked repository to keep it up-to-date // with the upstream repository. // -// GitHub API docs: https://docs.github.com/rest/branches/branches#sync-a-fork-branch-with-the-upstream-repository +// GitHub API docs: https://docs.github.com/rest/branches/branches?apiVersion=2022-11-28#sync-a-fork-branch-with-the-upstream-repository // //meta:operation POST /repos/{owner}/{repo}/merge-upstream func (s *RepositoriesService) MergeUpstream(ctx context.Context, owner, repo string, request *RepoMergeUpstreamRequest) (*RepoMergeUpstreamResult, *Response, error) { u := fmt.Sprintf("repos/%v/%v/merge-upstream", owner, repo) - req, err := s.client.NewRequest("POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, request) if err != nil { return nil, nil, err } - result := new(RepoMergeUpstreamResult) - resp, err := s.client.Do(ctx, req, result) + var result *RepoMergeUpstreamResult + resp, err := s.client.Do(req, &result) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/repos_pages.go b/vendor/github.com/google/go-github/v88/github/repos_pages.go similarity index 82% rename from vendor/github.com/google/go-github/v73/github/repos_pages.go rename to vendor/github.com/google/go-github/v88/github/repos_pages.go index 930f6000b..9064bcf65 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_pages.go +++ b/vendor/github.com/google/go-github/v88/github/repos_pages.go @@ -7,6 +7,7 @@ package github import ( "context" + "errors" "fmt" ) @@ -103,10 +104,14 @@ type createPagesRequest struct { // EnablePages enables GitHub Pages for the named repo. // -// GitHub API docs: https://docs.github.com/rest/pages/pages#create-a-github-pages-site +// GitHub API docs: https://docs.github.com/rest/pages/pages?apiVersion=2022-11-28#create-a-github-pages-site // //meta:operation POST /repos/{owner}/{repo}/pages func (s *RepositoriesService) EnablePages(ctx context.Context, owner, repo string, pages *Pages) (*Pages, *Response, error) { + if pages == nil { + return nil, nil, errors.New("pages must be provided") + } + u := fmt.Sprintf("repos/%v/%v/pages", owner, repo) pagesReq := &createPagesRequest{ @@ -114,15 +119,15 @@ func (s *RepositoriesService) EnablePages(ctx context.Context, owner, repo strin Source: pages.Source, } - req, err := s.client.NewRequest("POST", u, pagesReq) + req, err := s.client.NewRequest(ctx, "POST", u, pagesReq) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeEnablePagesAPIPreview) - enable := new(Pages) - resp, err := s.client.Do(ctx, req, enable) + var enable *Pages + resp, err := s.client.Do(req, &enable) if err != nil { return nil, resp, err } @@ -155,18 +160,18 @@ type PagesUpdate struct { // UpdatePages updates GitHub Pages for the named repo. // -// GitHub API docs: https://docs.github.com/rest/pages/pages#update-information-about-a-github-pages-site +// GitHub API docs: https://docs.github.com/rest/pages/pages?apiVersion=2022-11-28#update-information-about-a-github-pages-site // //meta:operation PUT /repos/{owner}/{repo}/pages func (s *RepositoriesService) UpdatePages(ctx context.Context, owner, repo string, opts *PagesUpdate) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/pages", owner, repo) - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, opts) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -184,19 +189,18 @@ type PagesUpdateWithoutCNAME struct { // UpdatePagesGHES updates GitHub Pages for the named repo in GitHub Enterprise Servers. // -// GitHub API docs: https://docs.github.com/rest/pages/pages#update-information-about-a-github-pages-site +// GitHub API docs: https://docs.github.com/rest/pages/pages?apiVersion=2022-11-28#update-information-about-a-github-pages-site // //meta:operation PUT /repos/{owner}/{repo}/pages func (s *RepositoriesService) UpdatePagesGHES(ctx context.Context, owner, repo string, opts *PagesUpdateWithoutCNAME) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/pages", owner, repo) - req, err := s.client.NewRequest("PUT", u, opts) - + req, err := s.client.NewRequest(ctx, "PUT", u, opts) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -205,36 +209,35 @@ func (s *RepositoriesService) UpdatePagesGHES(ctx context.Context, owner, repo s // DisablePages disables GitHub Pages for the named repo. // -// GitHub API docs: https://docs.github.com/rest/pages/pages#delete-a-github-pages-site +// GitHub API docs: https://docs.github.com/rest/pages/pages?apiVersion=2022-11-28#delete-a-github-pages-site // //meta:operation DELETE /repos/{owner}/{repo}/pages func (s *RepositoriesService) DisablePages(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/pages", owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeEnablePagesAPIPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // GetPagesInfo fetches information about a GitHub Pages site. // -// GitHub API docs: https://docs.github.com/rest/pages/pages#get-a-github-pages-site +// GitHub API docs: https://docs.github.com/rest/pages/pages?apiVersion=2022-11-28#get-a-github-pages-site // //meta:operation GET /repos/{owner}/{repo}/pages func (s *RepositoriesService) GetPagesInfo(ctx context.Context, owner, repo string) (*Pages, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pages", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - site := new(Pages) - resp, err := s.client.Do(ctx, req, site) + var site *Pages + resp, err := s.client.Do(req, &site) if err != nil { return nil, resp, err } @@ -244,7 +247,7 @@ func (s *RepositoriesService) GetPagesInfo(ctx context.Context, owner, repo stri // ListPagesBuilds lists the builds for a GitHub Pages site. // -// GitHub API docs: https://docs.github.com/rest/pages/pages#list-github-pages-builds +// GitHub API docs: https://docs.github.com/rest/pages/pages?apiVersion=2022-11-28#list-github-pages-builds // //meta:operation GET /repos/{owner}/{repo}/pages/builds func (s *RepositoriesService) ListPagesBuilds(ctx context.Context, owner, repo string, opts *ListOptions) ([]*PagesBuild, *Response, error) { @@ -254,13 +257,13 @@ func (s *RepositoriesService) ListPagesBuilds(ctx context.Context, owner, repo s return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var pages []*PagesBuild - resp, err := s.client.Do(ctx, req, &pages) + resp, err := s.client.Do(req, &pages) if err != nil { return nil, resp, err } @@ -270,18 +273,18 @@ func (s *RepositoriesService) ListPagesBuilds(ctx context.Context, owner, repo s // GetLatestPagesBuild fetches the latest build information for a GitHub pages site. // -// GitHub API docs: https://docs.github.com/rest/pages/pages#get-latest-pages-build +// GitHub API docs: https://docs.github.com/rest/pages/pages?apiVersion=2022-11-28#get-latest-pages-build // //meta:operation GET /repos/{owner}/{repo}/pages/builds/latest func (s *RepositoriesService) GetLatestPagesBuild(ctx context.Context, owner, repo string) (*PagesBuild, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pages/builds/latest", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - build := new(PagesBuild) - resp, err := s.client.Do(ctx, req, build) + var build *PagesBuild + resp, err := s.client.Do(req, &build) if err != nil { return nil, resp, err } @@ -291,18 +294,18 @@ func (s *RepositoriesService) GetLatestPagesBuild(ctx context.Context, owner, re // GetPageBuild fetches the specific build information for a GitHub pages site. // -// GitHub API docs: https://docs.github.com/rest/pages/pages#get-github-pages-build +// GitHub API docs: https://docs.github.com/rest/pages/pages?apiVersion=2022-11-28#get-github-pages-build // //meta:operation GET /repos/{owner}/{repo}/pages/builds/{build_id} func (s *RepositoriesService) GetPageBuild(ctx context.Context, owner, repo string, id int64) (*PagesBuild, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pages/builds/%v", owner, repo, id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - build := new(PagesBuild) - resp, err := s.client.Do(ctx, req, build) + var build *PagesBuild + resp, err := s.client.Do(req, &build) if err != nil { return nil, resp, err } @@ -312,18 +315,18 @@ func (s *RepositoriesService) GetPageBuild(ctx context.Context, owner, repo stri // RequestPageBuild requests a build of a GitHub Pages site without needing to push new commit. // -// GitHub API docs: https://docs.github.com/rest/pages/pages#request-a-github-pages-build +// GitHub API docs: https://docs.github.com/rest/pages/pages?apiVersion=2022-11-28#request-a-github-pages-build // //meta:operation POST /repos/{owner}/{repo}/pages/builds func (s *RepositoriesService) RequestPageBuild(ctx context.Context, owner, repo string) (*PagesBuild, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pages/builds", owner, repo) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - build := new(PagesBuild) - resp, err := s.client.Do(ctx, req, build) + var build *PagesBuild + resp, err := s.client.Do(req, &build) if err != nil { return nil, resp, err } @@ -333,18 +336,18 @@ func (s *RepositoriesService) RequestPageBuild(ctx context.Context, owner, repo // GetPageHealthCheck gets a DNS health check for the CNAME record configured for a repository's GitHub Pages. // -// GitHub API docs: https://docs.github.com/rest/pages/pages#get-a-dns-health-check-for-github-pages +// GitHub API docs: https://docs.github.com/rest/pages/pages?apiVersion=2022-11-28#get-a-dns-health-check-for-github-pages // //meta:operation GET /repos/{owner}/{repo}/pages/health func (s *RepositoriesService) GetPageHealthCheck(ctx context.Context, owner, repo string) (*PagesHealthCheckResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pages/health", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - healthCheckResponse := new(PagesHealthCheckResponse) - resp, err := s.client.Do(ctx, req, healthCheckResponse) + var healthCheckResponse *PagesHealthCheckResponse + resp, err := s.client.Do(req, &healthCheckResponse) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/repos_prereceive_hooks.go b/vendor/github.com/google/go-github/v88/github/repos_prereceive_hooks.go similarity index 72% rename from vendor/github.com/google/go-github/v73/github/repos_prereceive_hooks.go rename to vendor/github.com/google/go-github/v88/github/repos_prereceive_hooks.go index 144d2ec33..7119fd60e 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_prereceive_hooks.go +++ b/vendor/github.com/google/go-github/v88/github/repos_prereceive_hooks.go @@ -24,7 +24,7 @@ func (p PreReceiveHook) String() string { // ListPreReceiveHooks lists all pre-receive hooks for the specified repository. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/repo-pre-receive-hooks#list-pre-receive-hooks-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/repo-pre-receive-hooks#list-pre-receive-hooks-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/pre-receive-hooks func (s *RepositoriesService) ListPreReceiveHooks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*PreReceiveHook, *Response, error) { @@ -34,16 +34,15 @@ func (s *RepositoriesService) ListPreReceiveHooks(ctx context.Context, owner, re return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypePreReceiveHooksPreview) var hooks []*PreReceiveHook - resp, err := s.client.Do(ctx, req, &hooks) + resp, err := s.client.Do(req, &hooks) if err != nil { return nil, resp, err } @@ -53,21 +52,20 @@ func (s *RepositoriesService) ListPreReceiveHooks(ctx context.Context, owner, re // GetPreReceiveHook returns a single specified pre-receive hook. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/repo-pre-receive-hooks#get-a-pre-receive-hook-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/repo-pre-receive-hooks#get-a-pre-receive-hook-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} func (s *RepositoriesService) GetPreReceiveHook(ctx context.Context, owner, repo string, id int64) (*PreReceiveHook, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%d", owner, repo, id) - req, err := s.client.NewRequest("GET", u, nil) + u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%v", owner, repo, id) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypePreReceiveHooksPreview) - h := new(PreReceiveHook) - resp, err := s.client.Do(ctx, req, h) + var h *PreReceiveHook + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } @@ -77,21 +75,20 @@ func (s *RepositoriesService) GetPreReceiveHook(ctx context.Context, owner, repo // UpdatePreReceiveHook updates a specified pre-receive hook. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/repo-pre-receive-hooks#update-pre-receive-hook-enforcement-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/repo-pre-receive-hooks#update-pre-receive-hook-enforcement-for-a-repository // //meta:operation PATCH /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} func (s *RepositoriesService) UpdatePreReceiveHook(ctx context.Context, owner, repo string, id int64, hook *PreReceiveHook) (*PreReceiveHook, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%d", owner, repo, id) - req, err := s.client.NewRequest("PATCH", u, hook) + u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%v", owner, repo, id) + req, err := s.client.NewRequest(ctx, "PATCH", u, hook) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypePreReceiveHooksPreview) - h := new(PreReceiveHook) - resp, err := s.client.Do(ctx, req, h) + var h *PreReceiveHook + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } @@ -101,18 +98,17 @@ func (s *RepositoriesService) UpdatePreReceiveHook(ctx context.Context, owner, r // DeletePreReceiveHook deletes a specified pre-receive hook. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/repo-pre-receive-hooks#remove-pre-receive-hook-enforcement-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/repo-pre-receive-hooks#remove-pre-receive-hook-enforcement-for-a-repository // //meta:operation DELETE /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} func (s *RepositoriesService) DeletePreReceiveHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%d", owner, repo, id) - req, err := s.client.NewRequest("DELETE", u, nil) + u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%v", owner, repo, id) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypePreReceiveHooksPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/repos_properties.go b/vendor/github.com/google/go-github/v88/github/repos_properties.go similarity index 80% rename from vendor/github.com/google/go-github/v73/github/repos_properties.go rename to vendor/github.com/google/go-github/v88/github/repos_properties.go index 5b12bc8b3..11be33bc9 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_properties.go +++ b/vendor/github.com/google/go-github/v88/github/repos_properties.go @@ -12,19 +12,19 @@ import ( // GetAllCustomPropertyValues gets all custom property values that are set for a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/custom-properties#get-all-custom-property-values-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/custom-properties?apiVersion=2022-11-28#get-all-custom-property-values-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/properties/values func (s *RepositoriesService) GetAllCustomPropertyValues(ctx context.Context, org, repo string) ([]*CustomPropertyValue, *Response, error) { u := fmt.Sprintf("repos/%v/%v/properties/values", org, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var customPropertyValues []*CustomPropertyValue - resp, err := s.client.Do(ctx, req, &customPropertyValues) + resp, err := s.client.Do(req, &customPropertyValues) if err != nil { return nil, resp, err } @@ -34,7 +34,7 @@ func (s *RepositoriesService) GetAllCustomPropertyValues(ctx context.Context, or // CreateOrUpdateCustomProperties creates new or updates existing custom property values for a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/custom-properties#create-or-update-custom-property-values-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/custom-properties?apiVersion=2022-11-28#create-or-update-custom-property-values-for-a-repository // //meta:operation PATCH /repos/{owner}/{repo}/properties/values func (s *RepositoriesService) CreateOrUpdateCustomProperties(ctx context.Context, org, repo string, customPropertyValues []*CustomPropertyValue) (*Response, error) { @@ -46,12 +46,12 @@ func (s *RepositoriesService) CreateOrUpdateCustomProperties(ctx context.Context Properties: customPropertyValues, } - req, err := s.client.NewRequest("PATCH", u, params) + req, err := s.client.NewRequest(ctx, "PATCH", u, params) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/repos_releases.go b/vendor/github.com/google/go-github/v88/github/repos_releases.go similarity index 68% rename from vendor/github.com/google/go-github/v73/github/repos_releases.go rename to vendor/github.com/google/go-github/v88/github/repos_releases.go index 6023f6327..cedd0a7e4 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_releases.go +++ b/vendor/github.com/google/go-github/v88/github/repos_releases.go @@ -45,6 +45,7 @@ type RepositoryRelease struct { TarballURL *string `json:"tarball_url,omitempty"` Author *User `json:"author,omitempty"` NodeID *string `json:"node_id,omitempty"` + Immutable *bool `json:"immutable,omitempty"` } func (r RepositoryRelease) String() string { @@ -59,9 +60,10 @@ type RepositoryReleaseNotes struct { // GenerateNotesOptions represents the options to generate release notes. type GenerateNotesOptions struct { - TagName string `json:"tag_name"` - PreviousTagName *string `json:"previous_tag_name,omitempty"` - TargetCommitish *string `json:"target_commitish,omitempty"` + TagName string `json:"tag_name"` + PreviousTagName *string `json:"previous_tag_name,omitempty"` + TargetCommitish *string `json:"target_commitish,omitempty"` + ConfigurationFilePath *string `json:"configuration_file_path,omitempty"` } // ReleaseAsset represents a GitHub release asset in a repository. @@ -79,6 +81,7 @@ type ReleaseAsset struct { BrowserDownloadURL *string `json:"browser_download_url,omitempty"` Uploader *User `json:"uploader,omitempty"` NodeID *string `json:"node_id,omitempty"` + Digest *string `json:"digest,omitempty"` } func (r ReleaseAsset) String() string { @@ -87,23 +90,23 @@ func (r ReleaseAsset) String() string { // ListReleases lists the releases for a repository. // -// GitHub API docs: https://docs.github.com/rest/releases/releases#list-releases +// GitHub API docs: https://docs.github.com/rest/releases/releases?apiVersion=2022-11-28#list-releases // //meta:operation GET /repos/{owner}/{repo}/releases func (s *RepositoriesService) ListReleases(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryRelease, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases", owner, repo) + u := fmt.Sprintf("repos/%v/%v/releases", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var releases []*RepositoryRelease - resp, err := s.client.Do(ctx, req, &releases) + resp, err := s.client.Do(req, &releases) if err != nil { return nil, resp, err } @@ -112,48 +115,48 @@ func (s *RepositoriesService) ListReleases(ctx context.Context, owner, repo stri // GetRelease fetches a single release. // -// GitHub API docs: https://docs.github.com/rest/releases/releases#get-a-release +// GitHub API docs: https://docs.github.com/rest/releases/releases?apiVersion=2022-11-28#get-a-release // //meta:operation GET /repos/{owner}/{repo}/releases/{release_id} func (s *RepositoriesService) GetRelease(ctx context.Context, owner, repo string, id int64) (*RepositoryRelease, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/releases/%v", owner, repo, id) return s.getSingleRelease(ctx, u) } // GetLatestRelease fetches the latest published release for the repository. // -// GitHub API docs: https://docs.github.com/rest/releases/releases#get-the-latest-release +// GitHub API docs: https://docs.github.com/rest/releases/releases?apiVersion=2022-11-28#get-the-latest-release // //meta:operation GET /repos/{owner}/{repo}/releases/latest func (s *RepositoriesService) GetLatestRelease(ctx context.Context, owner, repo string) (*RepositoryRelease, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/latest", owner, repo) + u := fmt.Sprintf("repos/%v/%v/releases/latest", owner, repo) return s.getSingleRelease(ctx, u) } // GetReleaseByTag fetches a release with the specified tag. // -// GitHub API docs: https://docs.github.com/rest/releases/releases#get-a-release-by-tag-name +// GitHub API docs: https://docs.github.com/rest/releases/releases?apiVersion=2022-11-28#get-a-release-by-tag-name // //meta:operation GET /repos/{owner}/{repo}/releases/tags/{tag} func (s *RepositoriesService) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*RepositoryRelease, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/tags/%s", owner, repo, tag) + u := fmt.Sprintf("repos/%v/%v/releases/tags/%v", owner, repo, tag) return s.getSingleRelease(ctx, u) } // GenerateReleaseNotes generates the release notes for the given tag. // -// GitHub API docs: https://docs.github.com/rest/releases/releases#generate-release-notes-content-for-a-release +// GitHub API docs: https://docs.github.com/rest/releases/releases?apiVersion=2022-11-28#generate-release-notes-content-for-a-release // //meta:operation POST /repos/{owner}/{repo}/releases/generate-notes func (s *RepositoriesService) GenerateReleaseNotes(ctx context.Context, owner, repo string, opts *GenerateNotesOptions) (*RepositoryReleaseNotes, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/generate-notes", owner, repo) - req, err := s.client.NewRequest("POST", u, opts) + u := fmt.Sprintf("repos/%v/%v/releases/generate-notes", owner, repo) + req, err := s.client.NewRequest(ctx, "POST", u, opts) if err != nil { return nil, nil, err } - r := new(RepositoryReleaseNotes) - resp, err := s.client.Do(ctx, req, r) + var r *RepositoryReleaseNotes + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -162,16 +165,17 @@ func (s *RepositoriesService) GenerateReleaseNotes(ctx context.Context, owner, r } func (s *RepositoriesService) getSingleRelease(ctx context.Context, url string) (*RepositoryRelease, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } - release := new(RepositoryRelease) - resp, err := s.client.Do(ctx, req, release) + var release *RepositoryRelease + resp, err := s.client.Do(req, &release) if err != nil { return nil, resp, err } + return release, resp, nil } @@ -198,11 +202,15 @@ type repositoryReleaseRequest struct { // Note that only a subset of the release fields are used. // See RepositoryRelease for more information. // -// GitHub API docs: https://docs.github.com/rest/releases/releases#create-a-release +// GitHub API docs: https://docs.github.com/rest/releases/releases?apiVersion=2022-11-28#create-a-release // //meta:operation POST /repos/{owner}/{repo}/releases func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo string, release *RepositoryRelease) (*RepositoryRelease, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases", owner, repo) + if release == nil { + return nil, nil, errors.New("release must be provided") + } + + u := fmt.Sprintf("repos/%v/%v/releases", owner, repo) releaseReq := &repositoryReleaseRequest{ TagName: release.TagName, @@ -216,16 +224,17 @@ func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo str GenerateReleaseNotes: release.GenerateReleaseNotes, } - req, err := s.client.NewRequest("POST", u, releaseReq) + req, err := s.client.NewRequest(ctx, "POST", u, releaseReq) if err != nil { return nil, nil, err } - r := new(RepositoryRelease) - resp, err := s.client.Do(ctx, req, r) + var r *RepositoryRelease + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } + return r, resp, nil } @@ -234,11 +243,15 @@ func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo str // Note that only a subset of the release fields are used. // See RepositoryRelease for more information. // -// GitHub API docs: https://docs.github.com/rest/releases/releases#update-a-release +// GitHub API docs: https://docs.github.com/rest/releases/releases?apiVersion=2022-11-28#update-a-release // //meta:operation PATCH /repos/{owner}/{repo}/releases/{release_id} func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo string, id int64, release *RepositoryRelease) (*RepositoryRelease, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id) + if release == nil { + return nil, nil, errors.New("release must be provided") + } + + u := fmt.Sprintf("repos/%v/%v/releases/%v", owner, repo, id) releaseReq := &repositoryReleaseRequest{ TagName: release.TagName, @@ -251,53 +264,54 @@ func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo strin DiscussionCategoryName: release.DiscussionCategoryName, } - req, err := s.client.NewRequest("PATCH", u, releaseReq) + req, err := s.client.NewRequest(ctx, "PATCH", u, releaseReq) if err != nil { return nil, nil, err } - r := new(RepositoryRelease) - resp, err := s.client.Do(ctx, req, r) + var r *RepositoryRelease + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } + return r, resp, nil } // DeleteRelease delete a single release from a repository. // -// GitHub API docs: https://docs.github.com/rest/releases/releases#delete-a-release +// GitHub API docs: https://docs.github.com/rest/releases/releases?apiVersion=2022-11-28#delete-a-release // //meta:operation DELETE /repos/{owner}/{repo}/releases/{release_id} func (s *RepositoriesService) DeleteRelease(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/releases/%v", owner, repo, id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListReleaseAssets lists the release's assets. // -// GitHub API docs: https://docs.github.com/rest/releases/assets#list-release-assets +// GitHub API docs: https://docs.github.com/rest/releases/assets?apiVersion=2022-11-28#list-release-assets // //meta:operation GET /repos/{owner}/{repo}/releases/{release_id}/assets func (s *RepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*ReleaseAsset, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/releases/%v/assets", owner, repo, id) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var assets []*ReleaseAsset - resp, err := s.client.Do(ctx, req, &assets) + resp, err := s.client.Do(req, &assets) if err != nil { return nil, resp, err } @@ -306,22 +320,23 @@ func (s *RepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo // GetReleaseAsset fetches a single release asset. // -// GitHub API docs: https://docs.github.com/rest/releases/assets#get-a-release-asset +// GitHub API docs: https://docs.github.com/rest/releases/assets?apiVersion=2022-11-28#get-a-release-asset // //meta:operation GET /repos/{owner}/{repo}/releases/assets/{asset_id} func (s *RepositoriesService) GetReleaseAsset(ctx context.Context, owner, repo string, id int64) (*ReleaseAsset, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/releases/assets/%v", owner, repo, id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - asset := new(ReleaseAsset) - resp, err := s.client.Do(ctx, req, asset) + var asset *ReleaseAsset + resp, err := s.client.Do(req, &asset) if err != nil { return nil, resp, err } + return asset, resp, nil } @@ -338,56 +353,46 @@ func (s *RepositoriesService) GetReleaseAsset(ctx context.Context, owner, repo s // it's necessary to pass an http.Client that performs authenticated requests. // If nil is passed the redirectURL will be returned instead. // -// GitHub API docs: https://docs.github.com/rest/releases/assets#get-a-release-asset +// GitHub API docs: https://docs.github.com/rest/releases/assets?apiVersion=2022-11-28#get-a-release-asset // //meta:operation GET /repos/{owner}/{repo}/releases/assets/{asset_id} func (s *RepositoriesService) DownloadReleaseAsset(ctx context.Context, owner, repo string, id int64, followRedirectsClient *http.Client) (rc io.ReadCloser, redirectURL string, err error) { - u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/releases/assets/%v", owner, repo, id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, "", err } req.Header.Set("Accept", defaultMediaType) - s.client.clientMu.Lock() - defer s.client.clientMu.Unlock() - - var loc string - saveRedirect := s.client.client.CheckRedirect - s.client.client.CheckRedirect = func(req *http.Request, via []*http.Request) error { - loc = req.URL.String() - return errors.New("disable redirect") + loc, resp, err := s.client.bareDoUntilFound(req, 10) + if err != nil { + return nil, "", err } - defer func() { s.client.client.CheckRedirect = saveRedirect }() - req = withContext(ctx, req) - resp, err := s.client.client.Do(req) - if err != nil { - if !strings.Contains(err.Error(), "disable redirect") { - return nil, "", err - } - if followRedirectsClient != nil { - rc, err := s.downloadReleaseAssetFromURL(ctx, followRedirectsClient, loc) - return rc, "", err - } - return nil, loc, nil // Intentionally return no error with valid redirect URL. + // No redirect, stream the response body directly. + if loc == nil { + return resp.Body, "", nil } - if err := CheckResponse(resp); err != nil { - _ = resp.Body.Close() - return nil, "", err + // Close body as it's not needed when following redirects or returning the redirect URL. + _ = resp.Body.Close() + + // Got a redirect URL. + redirectStr := loc.String() + if followRedirectsClient != nil { + rc, err := s.downloadReleaseAssetFromURL(ctx, followRedirectsClient, redirectStr) + return rc, "", err } - return resp.Body, "", nil + return nil, redirectStr, nil } func (s *RepositoriesService) downloadReleaseAssetFromURL(ctx context.Context, followRedirectsClient *http.Client, url string) (rc io.ReadCloser, err error) { - req, err := http.NewRequest("GET", url, nil) + req, err := http.NewRequestWithContext(ctx, "GET", url, nil) if err != nil { return nil, err } - req = withContext(ctx, req) req.Header.Set("Accept", defaultMediaType) resp, err := followRedirectsClient.Do(req) if err != nil { @@ -402,48 +407,53 @@ func (s *RepositoriesService) downloadReleaseAssetFromURL(ctx context.Context, f // EditReleaseAsset edits a repository release asset. // -// GitHub API docs: https://docs.github.com/rest/releases/assets#update-a-release-asset +// GitHub API docs: https://docs.github.com/rest/releases/assets?apiVersion=2022-11-28#update-a-release-asset // //meta:operation PATCH /repos/{owner}/{repo}/releases/assets/{asset_id} func (s *RepositoriesService) EditReleaseAsset(ctx context.Context, owner, repo string, id int64, release *ReleaseAsset) (*ReleaseAsset, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/releases/assets/%v", owner, repo, id) - req, err := s.client.NewRequest("PATCH", u, release) + req, err := s.client.NewRequest(ctx, "PATCH", u, release) if err != nil { return nil, nil, err } - asset := new(ReleaseAsset) - resp, err := s.client.Do(ctx, req, asset) + var asset *ReleaseAsset + resp, err := s.client.Do(req, &asset) if err != nil { return nil, resp, err } + return asset, resp, nil } // DeleteReleaseAsset delete a single release asset from a repository. // -// GitHub API docs: https://docs.github.com/rest/releases/assets#delete-a-release-asset +// GitHub API docs: https://docs.github.com/rest/releases/assets?apiVersion=2022-11-28#delete-a-release-asset // //meta:operation DELETE /repos/{owner}/{repo}/releases/assets/{asset_id} func (s *RepositoriesService) DeleteReleaseAsset(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/releases/assets/%v", owner, repo, id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // UploadReleaseAsset creates an asset by uploading a file into a release repository. // To upload assets that cannot be represented by an os.File, call NewUploadRequest directly. // -// GitHub API docs: https://docs.github.com/rest/releases/assets#upload-a-release-asset +// GitHub API docs: https://docs.github.com/rest/releases/assets?apiVersion=2022-11-28#upload-a-release-asset // //meta:operation POST /repos/{owner}/{repo}/releases/{release_id}/assets func (s *RepositoriesService) UploadReleaseAsset(ctx context.Context, owner, repo string, id int64, opts *UploadOptions, file *os.File) (*ReleaseAsset, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id) + if file == nil { + return nil, nil, errors.New("file must be provided") + } + + u := fmt.Sprintf("repos/%v/%v/releases/%v/assets", owner, repo, id) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -462,15 +472,90 @@ func (s *RepositoriesService) UploadReleaseAsset(ctx context.Context, owner, rep mediaType = opts.MediaType } - req, err := s.client.NewUploadRequest(u, file, stat.Size(), mediaType) + req, err := s.client.NewUploadRequest(ctx, u, file, stat.Size(), mediaType) if err != nil { return nil, nil, err } - asset := new(ReleaseAsset) - resp, err := s.client.Do(ctx, req, asset) + var asset *ReleaseAsset + resp, err := s.client.Do(req, &asset) if err != nil { return nil, resp, err } + + return asset, resp, nil +} + +// UploadReleaseAssetFromRelease uploads an asset using the UploadURL that's embedded +// in a RepositoryRelease object. +// +// This is a convenience wrapper that extracts the release.UploadURL (which is usually +// templated like "https://uploads.github.com/.../assets{?name,label}") and uploads +// the provided data (reader + size) using the existing upload helpers. +// +// GitHub API docs: https://docs.github.com/rest/releases/assets?apiVersion=2022-11-28#upload-a-release-asset +// +//meta:operation POST /repos/{owner}/{repo}/releases/{release_id}/assets +func (s *RepositoriesService) UploadReleaseAssetFromRelease( + ctx context.Context, + release *RepositoryRelease, + opts *UploadOptions, + reader io.Reader, + size int64, +) (*ReleaseAsset, *Response, error) { + if release == nil || release.UploadURL == nil { + return nil, nil, errors.New("release UploadURL must be provided") + } + if reader == nil { + return nil, nil, errors.New("reader must be provided") + } + if size < 0 { + return nil, nil, errors.New("size must be >= 0") + } + + // Strip URI-template portion (e.g. "{?name,label}") if present. + uploadURL := *release.UploadURL + if idx := strings.Index(uploadURL, "{"); idx != -1 { + uploadURL = uploadURL[:idx] + } + + // If this is a *relative* URL (no scheme), normalize it by trimming a leading "/" + // so it works with Client.BaseURL path prefixes (e.g. "/api-v3/"). + if !strings.HasPrefix(uploadURL, "http://") && !strings.HasPrefix(uploadURL, "https://") { + uploadURL = strings.TrimPrefix(uploadURL, "/") + } + + // addOptions will append name/label query params (same behavior as UploadReleaseAsset). + u, err := addOptions(uploadURL, opts) + if err != nil { + return nil, nil, err + } + + // determine media type + mediaType := defaultMediaType + if opts != nil { + switch { + case opts.MediaType != "": + mediaType = opts.MediaType + case opts.Name != "": + if ext := filepath.Ext(opts.Name); ext != "" { + if mt := mime.TypeByExtension(ext); mt != "" { + mediaType = mt + } + } + } + } + + req, err := s.client.NewUploadRequest(ctx, u, reader, size, mediaType) + if err != nil { + return nil, nil, err + } + + var asset *ReleaseAsset + resp, err := s.client.Do(req, &asset) + if err != nil { + return nil, resp, err + } + return asset, resp, nil } diff --git a/vendor/github.com/google/go-github/v88/github/repos_rules.go b/vendor/github.com/google/go-github/v88/github/repos_rules.go new file mode 100644 index 000000000..ddf8929e2 --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/repos_rules.go @@ -0,0 +1,300 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" + "iter" +) + +// ListRulesForBranch gets all the repository rules that apply to the specified branch. +// +// GitHub API docs: https://docs.github.com/rest/repos/rules?apiVersion=2022-11-28#get-rules-for-a-branch +// +//meta:operation GET /repos/{owner}/{repo}/rules/branches/{branch} +func (s *RepositoriesService) ListRulesForBranch(ctx context.Context, owner, repo, branch string, opts *ListOptions) (*BranchRules, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/rules/branches/%v", owner, repo, branch) + + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var rules *BranchRules + resp, err := s.client.Do(req, &rules) + if err != nil { + return nil, resp, err + } + + return rules, resp, nil +} + +// ListRulesForBranchIter returns an iterator that paginates through all results of ListRulesForBranch. +// +// Note that since [BranchRules] contains a large number of slices, this iterator +// returns type `any` and it is therefore the responsibility of the caller to perform a +// type switch to determine what item is being returned for each iteration. +func (s *RepositoriesService) ListRulesForBranchIter(ctx context.Context, owner, repo, branch string, opts *ListOptions) iter.Seq2[any, error] { + return func(yield func(any, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRulesForBranch(ctx, owner, repo, branch, opts) + if err != nil { + yield(nil, err) + return + } + + // Now iterate through ALL possible results from [BranchRules]. + for _, item := range results.Creation { + if !yield(item, nil) { + return + } + } + for _, item := range results.Update { + if !yield(item, nil) { + return + } + } + for _, item := range results.Deletion { + if !yield(item, nil) { + return + } + } + for _, item := range results.RequiredLinearHistory { + if !yield(item, nil) { + return + } + } + for _, item := range results.MergeQueue { + if !yield(item, nil) { + return + } + } + for _, item := range results.RequiredDeployments { + if !yield(item, nil) { + return + } + } + for _, item := range results.RequiredSignatures { + if !yield(item, nil) { + return + } + } + for _, item := range results.PullRequest { + if !yield(item, nil) { + return + } + } + for _, item := range results.RequiredStatusChecks { + if !yield(item, nil) { + return + } + } + for _, item := range results.NonFastForward { + if !yield(item, nil) { + return + } + } + for _, item := range results.CommitMessagePattern { + if !yield(item, nil) { + return + } + } + for _, item := range results.CommitAuthorEmailPattern { + if !yield(item, nil) { + return + } + } + for _, item := range results.CommitterEmailPattern { + if !yield(item, nil) { + return + } + } + for _, item := range results.BranchNamePattern { + if !yield(item, nil) { + return + } + } + for _, item := range results.TagNamePattern { + if !yield(item, nil) { + return + } + } + for _, item := range results.Workflows { + if !yield(item, nil) { + return + } + } + for _, item := range results.CodeScanning { + if !yield(item, nil) { + return + } + } + for _, item := range results.CopilotCodeReview { + if !yield(item, nil) { + return + } + } + for _, item := range results.FileExtensionRestriction { + if !yield(item, nil) { + return + } + } + for _, item := range results.FilePathRestriction { + if !yield(item, nil) { + return + } + } + for _, item := range results.MaxFilePathLength { + if !yield(item, nil) { + return + } + } + for _, item := range results.MaxFileSize { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// RepositoryListRulesetsOptions specifies optional parameters to the +// RepositoriesService.GetAllRulesets method. +type RepositoryListRulesetsOptions struct { + // IncludesParents indicates whether to include rulesets configured at the organization or enterprise level that apply to the repository. + IncludesParents *bool `url:"includes_parents,omitempty"` + ListOptions +} + +// GetAllRulesets gets all the repository rulesets for the specified repository. +// By default, this endpoint will include rulesets configured at the organization or enterprise level that apply to the repository. +// To exclude those rulesets, set the `RepositoryListRulesetsOptions.IncludesParents` parameter to `false`. +// +// GitHub API docs: https://docs.github.com/rest/repos/rules?apiVersion=2022-11-28#get-all-repository-rulesets +// +//meta:operation GET /repos/{owner}/{repo}/rulesets +func (s *RepositoriesService) GetAllRulesets(ctx context.Context, owner, repo string, opts *RepositoryListRulesetsOptions) ([]*RepositoryRuleset, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/rulesets", owner, repo) + + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var ruleset []*RepositoryRuleset + resp, err := s.client.Do(req, &ruleset) + if err != nil { + return nil, resp, err + } + + return ruleset, resp, nil +} + +// CreateRuleset creates a repository ruleset for the specified repository. +// +// GitHub API docs: https://docs.github.com/rest/repos/rules?apiVersion=2022-11-28#create-a-repository-ruleset +// +//meta:operation POST /repos/{owner}/{repo}/rulesets +func (s *RepositoriesService) CreateRuleset(ctx context.Context, owner, repo string, ruleset RepositoryRuleset) (*RepositoryRuleset, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/rulesets", owner, repo) + + req, err := s.client.NewRequest(ctx, "POST", u, ruleset) + if err != nil { + return nil, nil, err + } + + var rs *RepositoryRuleset + resp, err := s.client.Do(req, &rs) + if err != nil { + return nil, resp, err + } + + return rs, resp, nil +} + +// GetRuleset gets a repository ruleset for the specified repository. +// If includesParents is true, rulesets configured at the organization or enterprise level that apply to the repository will be returned. +// +// GitHub API docs: https://docs.github.com/rest/repos/rules?apiVersion=2022-11-28#get-a-repository-ruleset +// +//meta:operation GET /repos/{owner}/{repo}/rulesets/{ruleset_id} +func (s *RepositoriesService) GetRuleset(ctx context.Context, owner, repo string, rulesetID int64, includesParents bool) (*RepositoryRuleset, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/rulesets/%v?includes_parents=%v", owner, repo, rulesetID, includesParents) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var ruleset *RepositoryRuleset + resp, err := s.client.Do(req, &ruleset) + if err != nil { + return nil, resp, err + } + + return ruleset, resp, nil +} + +// UpdateRuleset updates a repository ruleset for the specified repository. +// +// GitHub API docs: https://docs.github.com/rest/repos/rules?apiVersion=2022-11-28#update-a-repository-ruleset +// +//meta:operation PUT /repos/{owner}/{repo}/rulesets/{ruleset_id} +func (s *RepositoriesService) UpdateRuleset(ctx context.Context, owner, repo string, rulesetID int64, ruleset RepositoryRuleset) (*RepositoryRuleset, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/rulesets/%v", owner, repo, rulesetID) + + req, err := s.client.NewRequest(ctx, "PUT", u, ruleset) + if err != nil { + return nil, nil, err + } + + var rs *RepositoryRuleset + resp, err := s.client.Do(req, &rs) + if err != nil { + return nil, resp, err + } + + return rs, resp, nil +} + +// DeleteRuleset deletes a repository ruleset for the specified repository. +// +// GitHub API docs: https://docs.github.com/rest/repos/rules?apiVersion=2022-11-28#delete-a-repository-ruleset +// +//meta:operation DELETE /repos/{owner}/{repo}/rulesets/{ruleset_id} +func (s *RepositoriesService) DeleteRuleset(ctx context.Context, owner, repo string, rulesetID int64) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/rulesets/%v", owner, repo, rulesetID) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v73/github/repos_stats.go b/vendor/github.com/google/go-github/v88/github/repos_stats.go similarity index 89% rename from vendor/github.com/google/go-github/v73/github/repos_stats.go rename to vendor/github.com/google/go-github/v88/github/repos_stats.go index a6ef9c0da..8234886f0 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_stats.go +++ b/vendor/github.com/google/go-github/v88/github/repos_stats.go @@ -45,18 +45,18 @@ func (w WeeklyStats) String() string { // it is now computing the requested statistics. A follow up request, after a // delay of a second or so, should result in a successful request. // -// GitHub API docs: https://docs.github.com/rest/metrics/statistics#get-all-contributor-commit-activity +// GitHub API docs: https://docs.github.com/rest/metrics/statistics?apiVersion=2022-11-28#get-all-contributor-commit-activity // //meta:operation GET /repos/{owner}/{repo}/stats/contributors func (s *RepositoriesService) ListContributorsStats(ctx context.Context, owner, repo string) ([]*ContributorStats, *Response, error) { u := fmt.Sprintf("repos/%v/%v/stats/contributors", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var contributorStats []*ContributorStats - resp, err := s.client.Do(ctx, req, &contributorStats) + resp, err := s.client.Do(req, &contributorStats) if err != nil { return nil, resp, err } @@ -86,18 +86,18 @@ func (w WeeklyCommitActivity) String() string { // it is now computing the requested statistics. A follow up request, after a // delay of a second or so, should result in a successful request. // -// GitHub API docs: https://docs.github.com/rest/metrics/statistics#get-the-last-year-of-commit-activity +// GitHub API docs: https://docs.github.com/rest/metrics/statistics?apiVersion=2022-11-28#get-the-last-year-of-commit-activity // //meta:operation GET /repos/{owner}/{repo}/stats/commit_activity func (s *RepositoriesService) ListCommitActivity(ctx context.Context, owner, repo string) ([]*WeeklyCommitActivity, *Response, error) { u := fmt.Sprintf("repos/%v/%v/stats/commit_activity", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var weeklyCommitActivity []*WeeklyCommitActivity - resp, err := s.client.Do(ctx, req, &weeklyCommitActivity) + resp, err := s.client.Do(req, &weeklyCommitActivity) if err != nil { return nil, resp, err } @@ -115,18 +115,18 @@ func (s *RepositoriesService) ListCommitActivity(ctx context.Context, owner, rep // it is now computing the requested statistics. A follow up request, after a // delay of a second or so, should result in a successful request. // -// GitHub API docs: https://docs.github.com/rest/metrics/statistics#get-the-weekly-commit-activity +// GitHub API docs: https://docs.github.com/rest/metrics/statistics?apiVersion=2022-11-28#get-the-weekly-commit-activity // //meta:operation GET /repos/{owner}/{repo}/stats/code_frequency func (s *RepositoriesService) ListCodeFrequency(ctx context.Context, owner, repo string) ([]*WeeklyStats, *Response, error) { u := fmt.Sprintf("repos/%v/%v/stats/code_frequency", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var weeks [][]int - resp, err := s.client.Do(ctx, req, &weeks) + resp, err := s.client.Do(req, &weeks) if err != nil { return nil, resp, err } @@ -150,7 +150,7 @@ func (s *RepositoriesService) ListCodeFrequency(ctx context.Context, owner, repo // RepositoryParticipation is the number of commits by everyone // who has contributed to the repository (including the owner) -// as well as the number of commits by the owner themself. +// as well as the number of commits by the owner themselves. type RepositoryParticipation struct { All []int `json:"all,omitempty"` Owner []int `json:"owner,omitempty"` @@ -173,18 +173,18 @@ func (r RepositoryParticipation) String() string { // it is now computing the requested statistics. A follow up request, after a // delay of a second or so, should result in a successful request. // -// GitHub API docs: https://docs.github.com/rest/metrics/statistics#get-the-weekly-commit-count +// GitHub API docs: https://docs.github.com/rest/metrics/statistics?apiVersion=2022-11-28#get-the-weekly-commit-count // //meta:operation GET /repos/{owner}/{repo}/stats/participation func (s *RepositoriesService) ListParticipation(ctx context.Context, owner, repo string) (*RepositoryParticipation, *Response, error) { u := fmt.Sprintf("repos/%v/%v/stats/participation", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - participation := new(RepositoryParticipation) - resp, err := s.client.Do(ctx, req, participation) + var participation *RepositoryParticipation + resp, err := s.client.Do(req, &participation) if err != nil { return nil, resp, err } @@ -208,18 +208,18 @@ type PunchCard struct { // it is now computing the requested statistics. A follow up request, after a // delay of a second or so, should result in a successful request. // -// GitHub API docs: https://docs.github.com/rest/metrics/statistics#get-the-hourly-commit-count-for-each-day +// GitHub API docs: https://docs.github.com/rest/metrics/statistics?apiVersion=2022-11-28#get-the-hourly-commit-count-for-each-day // //meta:operation GET /repos/{owner}/{repo}/stats/punch_card func (s *RepositoriesService) ListPunchCard(ctx context.Context, owner, repo string) ([]*PunchCard, *Response, error) { u := fmt.Sprintf("repos/%v/%v/stats/punch_card", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var results [][]int - resp, err := s.client.Do(ctx, req, &results) + resp, err := s.client.Do(req, &results) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/repos_statuses.go b/vendor/github.com/google/go-github/v88/github/repos_statuses.go similarity index 82% rename from vendor/github.com/google/go-github/v73/github/repos_statuses.go rename to vendor/github.com/google/go-github/v88/github/repos_statuses.go index e7b030475..2b845b1a4 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_statuses.go +++ b/vendor/github.com/google/go-github/v88/github/repos_statuses.go @@ -43,9 +43,9 @@ func (r RepoStatus) String() string { } // ListStatuses lists the statuses of a repository at the specified -// reference. ref can be a SHA, a branch name, or a tag name. +// reference. The ref can be a SHA, a branch name, or a tag name. // -// GitHub API docs: https://docs.github.com/rest/commits/statuses#list-commit-statuses-for-a-reference +// GitHub API docs: https://docs.github.com/rest/commits/statuses?apiVersion=2022-11-28#list-commit-statuses-for-a-reference // //meta:operation GET /repos/{owner}/{repo}/commits/{ref}/statuses func (s *RepositoriesService) ListStatuses(ctx context.Context, owner, repo, ref string, opts *ListOptions) ([]*RepoStatus, *Response, error) { @@ -55,13 +55,13 @@ func (s *RepositoriesService) ListStatuses(ctx context.Context, owner, repo, ref return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var statuses []*RepoStatus - resp, err := s.client.Do(ctx, req, &statuses) + resp, err := s.client.Do(req, &statuses) if err != nil { return nil, resp, err } @@ -70,20 +70,20 @@ func (s *RepositoriesService) ListStatuses(ctx context.Context, owner, repo, ref } // CreateStatus creates a new status for a repository at the specified -// reference. Ref can be a SHA, a branch name, or a tag name. +// reference. The ref can be a SHA, a branch name, or a tag name. // -// GitHub API docs: https://docs.github.com/rest/commits/statuses#create-a-commit-status +// GitHub API docs: https://docs.github.com/rest/commits/statuses?apiVersion=2022-11-28#create-a-commit-status // //meta:operation POST /repos/{owner}/{repo}/statuses/{sha} -func (s *RepositoriesService) CreateStatus(ctx context.Context, owner, repo, ref string, status *RepoStatus) (*RepoStatus, *Response, error) { +func (s *RepositoriesService) CreateStatus(ctx context.Context, owner, repo, ref string, status RepoStatus) (*RepoStatus, *Response, error) { u := fmt.Sprintf("repos/%v/%v/statuses/%v", owner, repo, refURLEscape(ref)) - req, err := s.client.NewRequest("POST", u, status) + req, err := s.client.NewRequest(ctx, "POST", u, &status) if err != nil { return nil, nil, err } - repoStatus := new(RepoStatus) - resp, err := s.client.Do(ctx, req, repoStatus) + var repoStatus *RepoStatus + resp, err := s.client.Do(req, &repoStatus) if err != nil { return nil, resp, err } @@ -111,9 +111,9 @@ func (s CombinedStatus) String() string { } // GetCombinedStatus returns the combined status of a repository at the specified -// reference. ref can be a SHA, a branch name, or a tag name. +// reference. The ref can be a SHA, a branch name, or a tag name. // -// GitHub API docs: https://docs.github.com/rest/commits/statuses#get-the-combined-status-for-a-specific-reference +// GitHub API docs: https://docs.github.com/rest/commits/statuses?apiVersion=2022-11-28#get-the-combined-status-for-a-specific-reference // //meta:operation GET /repos/{owner}/{repo}/commits/{ref}/status func (s *RepositoriesService) GetCombinedStatus(ctx context.Context, owner, repo, ref string, opts *ListOptions) (*CombinedStatus, *Response, error) { @@ -123,13 +123,13 @@ func (s *RepositoriesService) GetCombinedStatus(ctx context.Context, owner, repo return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - status := new(CombinedStatus) - resp, err := s.client.Do(ctx, req, status) + var status *CombinedStatus + resp, err := s.client.Do(req, &status) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/repos_tags.go b/vendor/github.com/google/go-github/v88/github/repos_tags.go similarity index 51% rename from vendor/github.com/google/go-github/v73/github/repos_tags.go rename to vendor/github.com/google/go-github/v88/github/repos_tags.go index b6dc36e2a..a45e76cc5 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_tags.go +++ b/vendor/github.com/google/go-github/v88/github/repos_tags.go @@ -22,22 +22,23 @@ type tagProtectionRequest struct { Pattern string `json:"pattern"` } -// Deprecated: ListTagProtection lists tag protection of the specified repository. -// Deprecation notice: This operation is deprecated and will be removed after August 30, 2024. Use the "Repository Rulesets" endpoint instead: https://docs.github.com/rest/repos/rules#get-all-repository-rulesets +// ListTagProtection lists tag protection of the specified repository. // -// GitHub API docs: https://docs.github.com/rest/repos/tags#closing-down---list-tag-protection-states-for-a-repository +// Deprecated: This operation is deprecated and will be removed after August 30, 2024. Use the "Repository Rulesets" endpoint instead: https://docs.github.com/rest/repos/rules?apiVersion=2022-11-28#get-all-repository-rulesets +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/repos/tags#closing-down---list-tag-protection-states-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/tags/protection func (s *RepositoriesService) ListTagProtection(ctx context.Context, owner, repo string) ([]*TagProtection, *Response, error) { u := fmt.Sprintf("repos/%v/%v/tags/protection", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var tagProtections []*TagProtection - resp, err := s.client.Do(ctx, req, &tagProtections) + resp, err := s.client.Do(req, &tagProtections) if err != nil { return nil, resp, err } @@ -45,22 +46,23 @@ func (s *RepositoriesService) ListTagProtection(ctx context.Context, owner, repo return tagProtections, resp, nil } -// Deprecated: CreateTagProtection creates the tag protection of the specified repository. -// Deprecation notice: This operation is deprecated and will be removed after August 30, 2024. Use the "Repository Rulesets" endpoint instead: https://docs.github.com/rest/repos/rules#create-a-repository-ruleset +// CreateTagProtection creates the tag protection of the specified repository. +// +// Deprecated: This operation is deprecated and will be removed after August 30, 2024. Use the "Repository Rulesets" endpoint instead: https://docs.github.com/rest/repos/rules?apiVersion=2022-11-28#create-a-repository-ruleset // -// GitHub API docs: https://docs.github.com/rest/repos/tags#closing-down---create-a-tag-protection-state-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/repos/tags#closing-down---create-a-tag-protection-state-for-a-repository // //meta:operation POST /repos/{owner}/{repo}/tags/protection func (s *RepositoriesService) CreateTagProtection(ctx context.Context, owner, repo, pattern string) (*TagProtection, *Response, error) { u := fmt.Sprintf("repos/%v/%v/tags/protection", owner, repo) r := &tagProtectionRequest{Pattern: pattern} - req, err := s.client.NewRequest("POST", u, r) + req, err := s.client.NewRequest(ctx, "POST", u, r) if err != nil { return nil, nil, err } - tagProtection := new(TagProtection) - resp, err := s.client.Do(ctx, req, tagProtection) + var tagProtection *TagProtection + resp, err := s.client.Do(req, &tagProtection) if err != nil { return nil, resp, err } @@ -68,18 +70,19 @@ func (s *RepositoriesService) CreateTagProtection(ctx context.Context, owner, re return tagProtection, resp, nil } -// Deprecated: DeleteTagProtection deletes a tag protection from the specified repository. -// Deprecation notice: This operation is deprecated and will be removed after August 30, 2024. Use the "Repository Rulesets" endpoint instead: https://docs.github.com/rest/repos/rules#delete-a-repository-ruleset +// DeleteTagProtection deletes a tag protection from the specified repository. +// +// Deprecated: This operation is deprecated and will be removed after August 30, 2024. Use the "Repository Rulesets" endpoint instead: https://docs.github.com/rest/repos/rules?apiVersion=2022-11-28#delete-a-repository-ruleset // -// GitHub API docs: https://docs.github.com/rest/repos/tags#closing-down---delete-a-tag-protection-state-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/repos/tags#closing-down---delete-a-tag-protection-state-for-a-repository // //meta:operation DELETE /repos/{owner}/{repo}/tags/protection/{tag_protection_id} func (s *RepositoriesService) DeleteTagProtection(ctx context.Context, owner, repo string, tagProtectionID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/tags/protection/%v", owner, repo, tagProtectionID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/repos_traffic.go b/vendor/github.com/google/go-github/v88/github/repos_traffic.go similarity index 86% rename from vendor/github.com/google/go-github/v73/github/repos_traffic.go rename to vendor/github.com/google/go-github/v88/github/repos_traffic.go index ae2f1a86b..b67af094b 100644 --- a/vendor/github.com/google/go-github/v73/github/repos_traffic.go +++ b/vendor/github.com/google/go-github/v88/github/repos_traffic.go @@ -54,19 +54,19 @@ type TrafficBreakdownOptions struct { // ListTrafficReferrers list the top 10 referrers over the last 14 days. // -// GitHub API docs: https://docs.github.com/rest/metrics/traffic#get-top-referral-sources +// GitHub API docs: https://docs.github.com/rest/metrics/traffic?apiVersion=2022-11-28#get-top-referral-sources // //meta:operation GET /repos/{owner}/{repo}/traffic/popular/referrers func (s *RepositoriesService) ListTrafficReferrers(ctx context.Context, owner, repo string) ([]*TrafficReferrer, *Response, error) { u := fmt.Sprintf("repos/%v/%v/traffic/popular/referrers", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var trafficReferrers []*TrafficReferrer - resp, err := s.client.Do(ctx, req, &trafficReferrers) + resp, err := s.client.Do(req, &trafficReferrers) if err != nil { return nil, resp, err } @@ -76,19 +76,19 @@ func (s *RepositoriesService) ListTrafficReferrers(ctx context.Context, owner, r // ListTrafficPaths list the top 10 popular content over the last 14 days. // -// GitHub API docs: https://docs.github.com/rest/metrics/traffic#get-top-referral-paths +// GitHub API docs: https://docs.github.com/rest/metrics/traffic?apiVersion=2022-11-28#get-top-referral-paths // //meta:operation GET /repos/{owner}/{repo}/traffic/popular/paths func (s *RepositoriesService) ListTrafficPaths(ctx context.Context, owner, repo string) ([]*TrafficPath, *Response, error) { u := fmt.Sprintf("repos/%v/%v/traffic/popular/paths", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var paths []*TrafficPath - resp, err := s.client.Do(ctx, req, &paths) + resp, err := s.client.Do(req, &paths) if err != nil { return nil, resp, err } @@ -98,7 +98,7 @@ func (s *RepositoriesService) ListTrafficPaths(ctx context.Context, owner, repo // ListTrafficViews get total number of views for the last 14 days and breaks it down either per day or week. // -// GitHub API docs: https://docs.github.com/rest/metrics/traffic#get-page-views +// GitHub API docs: https://docs.github.com/rest/metrics/traffic?apiVersion=2022-11-28#get-page-views // //meta:operation GET /repos/{owner}/{repo}/traffic/views func (s *RepositoriesService) ListTrafficViews(ctx context.Context, owner, repo string, opts *TrafficBreakdownOptions) (*TrafficViews, *Response, error) { @@ -108,13 +108,13 @@ func (s *RepositoriesService) ListTrafficViews(ctx context.Context, owner, repo return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - trafficViews := new(TrafficViews) - resp, err := s.client.Do(ctx, req, &trafficViews) + var trafficViews *TrafficViews + resp, err := s.client.Do(req, &trafficViews) if err != nil { return nil, resp, err } @@ -124,7 +124,7 @@ func (s *RepositoriesService) ListTrafficViews(ctx context.Context, owner, repo // ListTrafficClones get total number of clones for the last 14 days and breaks it down either per day or week for the last 14 days. // -// GitHub API docs: https://docs.github.com/rest/metrics/traffic#get-repository-clones +// GitHub API docs: https://docs.github.com/rest/metrics/traffic?apiVersion=2022-11-28#get-repository-clones // //meta:operation GET /repos/{owner}/{repo}/traffic/clones func (s *RepositoriesService) ListTrafficClones(ctx context.Context, owner, repo string, opts *TrafficBreakdownOptions) (*TrafficClones, *Response, error) { @@ -134,13 +134,13 @@ func (s *RepositoriesService) ListTrafficClones(ctx context.Context, owner, repo return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - trafficClones := new(TrafficClones) - resp, err := s.client.Do(ctx, req, &trafficClones) + var trafficClones *TrafficClones + resp, err := s.client.Do(req, &trafficClones) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/rules.go b/vendor/github.com/google/go-github/v88/github/rules.go similarity index 80% rename from vendor/github.com/google/go-github/v73/github/rules.go rename to vendor/github.com/google/go-github/v88/github/rules.go index 4def2d19e..93ccf95ad 100644 --- a/vendor/github.com/google/go-github/v73/github/rules.go +++ b/vendor/github.com/google/go-github/v88/github/rules.go @@ -7,7 +7,8 @@ package github import ( "encoding/json" - "reflect" + "fmt" + "strconv" ) // RulesetTarget represents a GitHub ruleset target. @@ -15,9 +16,10 @@ type RulesetTarget string // This is the set of GitHub ruleset targets. const ( - RulesetTargetBranch RulesetTarget = "branch" - RulesetTargetTag RulesetTarget = "tag" - RulesetTargetPush RulesetTarget = "push" + RulesetTargetBranch RulesetTarget = "branch" + RulesetTargetTag RulesetTarget = "tag" + RulesetTargetPush RulesetTarget = "push" + RulesetTargetRepository RulesetTarget = "repository" ) // RulesetSourceType represents a GitHub ruleset source type. @@ -58,8 +60,9 @@ type BypassMode string // This is the set of GitHub ruleset bypass modes. const ( BypassModeAlways BypassMode = "always" - BypassModePullRequest BypassMode = "pull_request" + BypassModeExempt BypassMode = "exempt" BypassModeNever BypassMode = "never" + BypassModePullRequest BypassMode = "pull_request" ) // RepositoryRuleType represents a GitHub ruleset rule type. @@ -67,27 +70,38 @@ type RepositoryRuleType string // This is the set of GitHub ruleset rule types. const ( + // Branch or tag target rules. + RulesetRuleTypeBranchNamePattern RepositoryRuleType = "branch_name_pattern" + RulesetRuleTypeCodeScanning RepositoryRuleType = "code_scanning" + RulesetRuleTypeCommitAuthorEmailPattern RepositoryRuleType = "commit_author_email_pattern" + RulesetRuleTypeCommitMessagePattern RepositoryRuleType = "commit_message_pattern" + RulesetRuleTypeCommitterEmailPattern RepositoryRuleType = "committer_email_pattern" + RulesetRuleTypeCopilotCodeReview RepositoryRuleType = "copilot_code_review" RulesetRuleTypeCreation RepositoryRuleType = "creation" - RulesetRuleTypeUpdate RepositoryRuleType = "update" RulesetRuleTypeDeletion RepositoryRuleType = "deletion" - RulesetRuleTypeRequiredLinearHistory RepositoryRuleType = "required_linear_history" RulesetRuleTypeMergeQueue RepositoryRuleType = "merge_queue" + RulesetRuleTypeNonFastForward RepositoryRuleType = "non_fast_forward" + RulesetRuleTypePullRequest RepositoryRuleType = "pull_request" RulesetRuleTypeRequiredDeployments RepositoryRuleType = "required_deployments" + RulesetRuleTypeRequiredLinearHistory RepositoryRuleType = "required_linear_history" RulesetRuleTypeRequiredSignatures RepositoryRuleType = "required_signatures" - RulesetRuleTypePullRequest RepositoryRuleType = "pull_request" RulesetRuleTypeRequiredStatusChecks RepositoryRuleType = "required_status_checks" - RulesetRuleTypeNonFastForward RepositoryRuleType = "non_fast_forward" - RulesetRuleTypeCommitMessagePattern RepositoryRuleType = "commit_message_pattern" - RulesetRuleTypeCommitAuthorEmailPattern RepositoryRuleType = "commit_author_email_pattern" - RulesetRuleTypeCommitterEmailPattern RepositoryRuleType = "committer_email_pattern" - RulesetRuleTypeBranchNamePattern RepositoryRuleType = "branch_name_pattern" RulesetRuleTypeTagNamePattern RepositoryRuleType = "tag_name_pattern" + RulesetRuleTypeUpdate RepositoryRuleType = "update" + RulesetRuleTypeWorkflows RepositoryRuleType = "workflows" + + // Push target rules. + RulesetRuleTypeFileExtensionRestriction RepositoryRuleType = "file_extension_restriction" RulesetRuleTypeFilePathRestriction RepositoryRuleType = "file_path_restriction" RulesetRuleTypeMaxFilePathLength RepositoryRuleType = "max_file_path_length" - RulesetRuleTypeFileExtensionRestriction RepositoryRuleType = "file_extension_restriction" RulesetRuleTypeMaxFileSize RepositoryRuleType = "max_file_size" - RulesetRuleTypeWorkflows RepositoryRuleType = "workflows" - RulesetRuleTypeCodeScanning RepositoryRuleType = "code_scanning" + + // Repository target rules. + RulesetRuleTypeRepositoryCreate RepositoryRuleType = "repository_create" + RulesetRuleTypeRepositoryDelete RepositoryRuleType = "repository_delete" + RulesetRuleTypeRepositoryName RepositoryRuleType = "repository_name" + RulesetRuleTypeRepositoryTransfer RepositoryRuleType = "repository_transfer" + RulesetRuleTypeRepositoryVisibility RepositoryRuleType = "repository_visibility" ) // MergeGroupingStrategy models a GitHub merge grouping strategy. @@ -129,6 +143,14 @@ const ( MergeQueueMergeMethodSquash MergeQueueMergeMethod = "SQUASH" ) +// RulesetReviewerType represents the type of reviewer in a ruleset required reviewer. +type RulesetReviewerType string + +// This is the set of GitHub ruleset reviewer types. +const ( + RulesetReviewerTypeTeam RulesetReviewerType = "Team" +) + // PatternRuleOperator models a GitHub pattern rule operator. type PatternRuleOperator string @@ -171,7 +193,7 @@ type RepositoryRuleset struct { SourceType *RulesetSourceType `json:"source_type,omitempty"` Source string `json:"source"` Enforcement RulesetEnforcement `json:"enforcement"` - BypassActors []*BypassActor `json:"bypass_actors,omitempty"` + BypassActors []*BypassActor `json:"bypass_actors,omitzero"` CurrentUserCanBypass *BypassMode `json:"current_user_can_bypass,omitempty"` NodeID *string `json:"node_id,omitempty"` Links *RepositoryRulesetLinks `json:"_links,omitempty"` @@ -202,12 +224,13 @@ type RepositoryRulesetLink struct { // RepositoryRulesetConditions represents the conditions object in a ruleset. // Set either RepositoryName or RepositoryID or RepositoryProperty, not more than one. type RepositoryRulesetConditions struct { - RefName *RepositoryRulesetRefConditionParameters `json:"ref_name,omitempty"` - RepositoryID *RepositoryRulesetRepositoryIDsConditionParameters `json:"repository_id,omitempty"` - RepositoryName *RepositoryRulesetRepositoryNamesConditionParameters `json:"repository_name,omitempty"` - RepositoryProperty *RepositoryRulesetRepositoryPropertyConditionParameters `json:"repository_property,omitempty"` - OrganizationID *RepositoryRulesetOrganizationIDsConditionParameters `json:"organization_id,omitempty"` - OrganizationName *RepositoryRulesetOrganizationNamesConditionParameters `json:"organization_name,omitempty"` + RefName *RepositoryRulesetRefConditionParameters `json:"ref_name,omitempty"` + RepositoryID *RepositoryRulesetRepositoryIDsConditionParameters `json:"repository_id,omitempty"` + RepositoryName *RepositoryRulesetRepositoryNamesConditionParameters `json:"repository_name,omitempty"` + RepositoryProperty *RepositoryRulesetRepositoryPropertyConditionParameters `json:"repository_property,omitempty"` + OrganizationID *RepositoryRulesetOrganizationIDsConditionParameters `json:"organization_id,omitempty"` + OrganizationName *RepositoryRulesetOrganizationNamesConditionParameters `json:"organization_name,omitempty"` + OrganizationProperty *RepositoryRulesetOrganizationPropertyConditionParameters `json:"organization_property,omitempty"` } // RepositoryRulesetRefConditionParameters represents the conditions object for ref_names. @@ -216,6 +239,12 @@ type RepositoryRulesetRefConditionParameters struct { Exclude []string `json:"exclude"` } +// RepositoryRulesetOrganizationPropertyConditionParameters represents the conditions object for an organization property selector. +type RepositoryRulesetOrganizationPropertyConditionParameters struct { + Include []*RepositoryRulesetRepositoryPropertyTargetParameters `json:"include"` + Exclude []*RepositoryRulesetRepositoryPropertyTargetParameters `json:"exclude"` +} + // RepositoryRulesetRepositoryIDsConditionParameters represents the conditions object for repository_id. type RepositoryRulesetRepositoryIDsConditionParameters struct { RepositoryIDs []int64 `json:"repository_ids,omitempty"` @@ -261,6 +290,7 @@ type RepositoryRule struct { // RepositoryRulesetRules represents a GitHub ruleset rules object. // This type doesn't have JSON annotations as it uses custom marshaling. type RepositoryRulesetRules struct { + // Branch or tag target rules. Creation *EmptyRuleParameters Update *UpdateRuleParameters Deletion *EmptyRuleParameters @@ -276,17 +306,28 @@ type RepositoryRulesetRules struct { CommitterEmailPattern *PatternRuleParameters BranchNamePattern *PatternRuleParameters TagNamePattern *PatternRuleParameters + Workflows *WorkflowsRuleParameters + CodeScanning *CodeScanningRuleParameters + CopilotCodeReview *CopilotCodeReviewRuleParameters + + // Push target rules. + FileExtensionRestriction *FileExtensionRestrictionRuleParameters FilePathRestriction *FilePathRestrictionRuleParameters MaxFilePathLength *MaxFilePathLengthRuleParameters - FileExtensionRestriction *FileExtensionRestrictionRuleParameters MaxFileSize *MaxFileSizeRuleParameters - Workflows *WorkflowsRuleParameters - CodeScanning *CodeScanningRuleParameters + + // Repository target rules. + RepositoryCreate *EmptyRuleParameters + RepositoryDelete *EmptyRuleParameters + RepositoryName *SimplePatternRuleParameters + RepositoryTransfer *EmptyRuleParameters + RepositoryVisibility *RepositoryVisibilityRuleParameters } // BranchRules represents the rules active for a GitHub repository branch. // This type doesn't have JSON annotations as it uses custom marshaling. type BranchRules struct { + // Branch or tag target rules. Creation []*BranchRuleMetadata Update []*UpdateBranchRule Deletion []*BranchRuleMetadata @@ -302,12 +343,15 @@ type BranchRules struct { CommitterEmailPattern []*PatternBranchRule BranchNamePattern []*PatternBranchRule TagNamePattern []*PatternBranchRule + Workflows []*WorkflowsBranchRule + CodeScanning []*CodeScanningBranchRule + CopilotCodeReview []*CopilotCodeReviewBranchRule + + // Push target rules. + FileExtensionRestriction []*FileExtensionRestrictionBranchRule FilePathRestriction []*FilePathRestrictionBranchRule MaxFilePathLength []*MaxFilePathLengthBranchRule - FileExtensionRestriction []*FileExtensionRestrictionBranchRule MaxFileSize []*MaxFileSizeBranchRule - Workflows []*WorkflowsBranchRule - CodeScanning []*CodeScanningBranchRule } // BranchRuleMetadata represents the metadata for a branch rule. @@ -389,6 +433,12 @@ type CodeScanningBranchRule struct { Parameters CodeScanningRuleParameters `json:"parameters"` } +// CopilotCodeReviewBranchRule represents a copilot code review branch rule. +type CopilotCodeReviewBranchRule struct { + BranchRuleMetadata + Parameters CopilotCodeReviewRuleParameters `json:"parameters"` +} + // EmptyRuleParameters represents the parameters for a rule with no options. type EmptyRuleParameters struct{} @@ -415,13 +465,57 @@ type RequiredDeploymentsRuleParameters struct { // PullRequestRuleParameters represents the pull_request rule parameters. type PullRequestRuleParameters struct { - AllowedMergeMethods []PullRequestMergeMethod `json:"allowed_merge_methods"` - AutomaticCopilotCodeReviewEnabled *bool `json:"automatic_copilot_code_review_enabled,omitempty"` - DismissStaleReviewsOnPush bool `json:"dismiss_stale_reviews_on_push"` - RequireCodeOwnerReview bool `json:"require_code_owner_review"` - RequireLastPushApproval bool `json:"require_last_push_approval"` - RequiredApprovingReviewCount int `json:"required_approving_review_count"` - RequiredReviewThreadResolution bool `json:"required_review_thread_resolution"` + AllowedMergeMethods []PullRequestMergeMethod `json:"allowed_merge_methods,omitempty"` + DismissStaleReviewsOnPush bool `json:"dismiss_stale_reviews_on_push"` + RequireCodeOwnerReview bool `json:"require_code_owner_review"` + RequireLastPushApproval bool `json:"require_last_push_approval"` + RequiredApprovingReviewCount int `json:"required_approving_review_count"` + RequiredReviewers []*RulesetRequiredReviewer `json:"required_reviewers,omitempty"` + RequiredReviewThreadResolution bool `json:"required_review_thread_resolution"` +} + +// RulesetRequiredReviewer represents required reviewer parameters for pull requests in rulesets. +type RulesetRequiredReviewer struct { + MinimumApprovals *int `json:"minimum_approvals,omitempty"` + FilePatterns []string `json:"file_patterns,omitempty"` + Reviewer *RulesetReviewer `json:"reviewer,omitempty"` +} + +// RulesetReviewer represents a reviewer in a ruleset required reviewer rule. +type RulesetReviewer struct { + ID *int64 `json:"id,omitempty"` + Type *RulesetReviewerType `json:"type,omitempty"` +} + +// UnmarshalJSON is a custom JSON unmarshaler for RulesetReviewer. +func (r *RulesetReviewer) UnmarshalJSON(data []byte) error { + var aux struct { + ID any `json:"id,omitempty"` + Type *RulesetReviewerType `json:"type,omitempty"` + } + + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + + r.Type = aux.Type + + if aux.ID != nil { + switch id := aux.ID.(type) { + case float64: + r.ID = Ptr(int64(id)) + case string: + i, err := strconv.ParseInt(id, 10, 64) + if err != nil { + return err + } + r.ID = &i + default: + return fmt.Errorf("unexpected type for reviewer.ID: %T", id) + } + } + + return nil } // RequiredStatusChecksRuleParameters represents the required status checks rule parameters. @@ -485,6 +579,12 @@ type CodeScanningRuleParameters struct { CodeScanningTools []*RuleCodeScanningTool `json:"code_scanning_tools"` } +// CopilotCodeReviewRuleParameters represents the copilot_code_review rule parameters. +type CopilotCodeReviewRuleParameters struct { + ReviewOnPush bool `json:"review_on_push"` + ReviewDraftPullRequests bool `json:"review_draft_pull_requests"` +} + // RuleCodeScanningTool represents a single code scanning tool for the code scanning parameters. type RuleCodeScanningTool struct { AlertsThreshold CodeScanningAlertsThreshold `json:"alerts_threshold"` @@ -492,6 +592,18 @@ type RuleCodeScanningTool struct { Tool string `json:"tool"` } +// SimplePatternRuleParameters represents the parameters for a simple pattern rule. +type SimplePatternRuleParameters struct { + Negate bool `json:"negate"` + Pattern string `json:"pattern"` +} + +// RepositoryVisibilityRuleParameters represents the repository visibility rule parameters. +type RepositoryVisibilityRuleParameters struct { + Internal bool `json:"internal"` + Private bool `json:"private"` +} + // repositoryRulesetRuleWrapper is a helper type to marshal & unmarshal a ruleset rule. type repositoryRulesetRuleWrapper struct { Type RepositoryRuleType `json:"type"` @@ -499,10 +611,8 @@ type repositoryRulesetRuleWrapper struct { } // MarshalJSON is a custom JSON marshaler for RulesetRules. -func (r *RepositoryRulesetRules) MarshalJSON() ([]byte, error) { - // The RepositoryRulesetRules type marshals to between 1 and 21 rules. - // If new rules are added to RepositoryRulesetRules the capacity below needs increasing - rawRules := make([]json.RawMessage, 0, 21) +func (r RepositoryRulesetRules) MarshalJSON() ([]byte, error) { + var rawRules []json.RawMessage if r.Creation != nil { bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeCreation, r.Creation) @@ -672,17 +782,86 @@ func (r *RepositoryRulesetRules) MarshalJSON() ([]byte, error) { rawRules = append(rawRules, json.RawMessage(bytes)) } + if r.CopilotCodeReview != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeCopilotCodeReview, r.CopilotCodeReview) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.RepositoryCreate != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeRepositoryCreate, r.RepositoryCreate) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.RepositoryDelete != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeRepositoryDelete, r.RepositoryDelete) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.RepositoryName != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeRepositoryName, r.RepositoryName) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.RepositoryTransfer != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeRepositoryTransfer, r.RepositoryTransfer) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.RepositoryVisibility != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeRepositoryVisibility, r.RepositoryVisibility) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if len(rawRules) == 0 { + return []byte("[]"), nil + } + return json.Marshal(rawRules) } // marshalRepositoryRulesetRule is a helper function to marshal a ruleset rule. -// -// TODO: Benchmark the code that uses reflection. -// TODO: Use a generator here instead of reflection if there is a significant performance hit. func marshalRepositoryRulesetRule[T any](t RepositoryRuleType, params T) ([]byte, error) { - paramsType := reflect.TypeFor[T]() + hasParams := true + + switch t { + case RulesetRuleTypeCreation, + RulesetRuleTypeDeletion, + RulesetRuleTypeRequiredLinearHistory, + RulesetRuleTypeRequiredSignatures, + RulesetRuleTypeNonFastForward, + RulesetRuleTypeRepositoryCreate, + RulesetRuleTypeRepositoryDelete, + RulesetRuleTypeRepositoryTransfer: + hasParams = false + case RulesetRuleTypeUpdate: + paramsTyped, ok := any(params).(*UpdateRuleParameters) + if !ok { + return nil, fmt.Errorf("expected UpdateRuleParameters for rule type %v", t) + } + if paramsTyped == nil || *paramsTyped == (UpdateRuleParameters{}) { + hasParams = false + } + } - if paramsType.Kind() == reflect.Pointer && (reflect.ValueOf(params).IsNil() || reflect.ValueOf(params).Elem().IsZero()) { + if !hasParams { return json.Marshal(repositoryRulesetRuleWrapper{Type: t}) } @@ -842,6 +1021,36 @@ func (r *RepositoryRulesetRules) UnmarshalJSON(data []byte) error { return err } } + case RulesetRuleTypeCopilotCodeReview: + r.CopilotCodeReview = &CopilotCodeReviewRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, r.CopilotCodeReview); err != nil { + return err + } + } + case RulesetRuleTypeRepositoryCreate: + r.RepositoryCreate = &EmptyRuleParameters{} + case RulesetRuleTypeRepositoryDelete: + r.RepositoryDelete = &EmptyRuleParameters{} + case RulesetRuleTypeRepositoryName: + r.RepositoryName = &SimplePatternRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, r.RepositoryName); err != nil { + return err + } + } + case RulesetRuleTypeRepositoryTransfer: + r.RepositoryTransfer = &EmptyRuleParameters{} + case RulesetRuleTypeRepositoryVisibility: + r.RepositoryVisibility = &RepositoryVisibilityRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, r.RepositoryVisibility); err != nil { + return err + } + } } } @@ -1035,6 +1244,16 @@ func (r *BranchRules) UnmarshalJSON(data []byte) error { } r.CodeScanning = append(r.CodeScanning, &CodeScanningBranchRule{BranchRuleMetadata: w.BranchRuleMetadata, Parameters: *params}) + case RulesetRuleTypeCopilotCodeReview: + params := &CopilotCodeReviewRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, params); err != nil { + return err + } + } + + r.CopilotCodeReview = append(r.CopilotCodeReview, &CopilotCodeReviewBranchRule{BranchRuleMetadata: w.BranchRuleMetadata, Parameters: *params}) } } @@ -1052,7 +1271,14 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { r.Type = w.Type switch r.Type { - case RulesetRuleTypeCreation: + case RulesetRuleTypeCreation, + RulesetRuleTypeDeletion, + RulesetRuleTypeRequiredLinearHistory, + RulesetRuleTypeRequiredSignatures, + RulesetRuleTypeNonFastForward, + RulesetRuleTypeRepositoryCreate, + RulesetRuleTypeRepositoryDelete, + RulesetRuleTypeRepositoryTransfer: r.Parameters = nil case RulesetRuleTypeUpdate: p := &UpdateRuleParameters{} @@ -1064,10 +1290,6 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeDeletion: - r.Parameters = nil - case RulesetRuleTypeRequiredLinearHistory: - r.Parameters = nil case RulesetRuleTypeMergeQueue: p := &MergeQueueRuleParameters{} @@ -1088,8 +1310,6 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeRequiredSignatures: - r.Parameters = nil case RulesetRuleTypePullRequest: p := &PullRequestRuleParameters{} @@ -1110,9 +1330,11 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeNonFastForward: - r.Parameters = nil - case RulesetRuleTypeCommitMessagePattern: + case RulesetRuleTypeCommitMessagePattern, + RulesetRuleTypeCommitAuthorEmailPattern, + RulesetRuleTypeCommitterEmailPattern, + RulesetRuleTypeBranchNamePattern, + RulesetRuleTypeTagNamePattern: p := &PatternRuleParameters{} if w.Parameters != nil { @@ -1122,18 +1344,8 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeCommitAuthorEmailPattern: - p := &PatternRuleParameters{} - - if w.Parameters != nil { - if err := json.Unmarshal(w.Parameters, p); err != nil { - return err - } - } - - r.Parameters = p - case RulesetRuleTypeCommitterEmailPattern: - p := &PatternRuleParameters{} + case RulesetRuleTypeFilePathRestriction: + p := &FilePathRestrictionRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { @@ -1142,8 +1354,8 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeBranchNamePattern: - p := &PatternRuleParameters{} + case RulesetRuleTypeMaxFilePathLength: + p := &MaxFilePathLengthRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { @@ -1152,8 +1364,8 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeTagNamePattern: - p := &PatternRuleParameters{} + case RulesetRuleTypeFileExtensionRestriction: + p := &FileExtensionRestrictionRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { @@ -1162,8 +1374,8 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeFilePathRestriction: - p := &FilePathRestrictionRuleParameters{} + case RulesetRuleTypeMaxFileSize: + p := &MaxFileSizeRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { @@ -1172,8 +1384,8 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeMaxFilePathLength: - p := &MaxFilePathLengthRuleParameters{} + case RulesetRuleTypeWorkflows: + p := &WorkflowsRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { @@ -1182,8 +1394,8 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeFileExtensionRestriction: - p := &FileExtensionRestrictionRuleParameters{} + case RulesetRuleTypeCodeScanning: + p := &CodeScanningRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { @@ -1192,8 +1404,8 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeMaxFileSize: - p := &MaxFileSizeRuleParameters{} + case RulesetRuleTypeCopilotCodeReview: + p := &CopilotCodeReviewRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { @@ -1202,8 +1414,8 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeWorkflows: - p := &WorkflowsRuleParameters{} + case RulesetRuleTypeRepositoryName: + p := &SimplePatternRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { @@ -1212,15 +1424,14 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeCodeScanning: - p := &CodeScanningRuleParameters{} + case RulesetRuleTypeRepositoryVisibility: + p := &RepositoryVisibilityRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { return err } } - r.Parameters = p } diff --git a/vendor/github.com/google/go-github/v73/github/scim.go b/vendor/github.com/google/go-github/v88/github/scim.go similarity index 69% rename from vendor/github.com/google/go-github/v73/github/scim.go rename to vendor/github.com/google/go-github/v88/github/scim.go index 70f063caa..f82b6bc38 100644 --- a/vendor/github.com/google/go-github/v73/github/scim.go +++ b/vendor/github.com/google/go-github/v88/github/scim.go @@ -14,32 +14,13 @@ import ( // SCIMService provides access to SCIM related functions in the // GitHub API. // -// GitHub API docs: https://docs.github.com/rest/scim +// GitHub API docs: https://docs.github.com/rest/scim?apiVersion=2022-11-28 type SCIMService service -// SCIMGroupAttributes represents supported SCIM Group attributes. -// -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/scim#list-provisioned-scim-groups-for-an-enterprise -type SCIMGroupAttributes struct { - DisplayName *string `json:"displayName,omitempty"` // The name of the group, suitable for display to end-users. (Optional.) - Members []*SCIMDisplayReference `json:"members,omitempty"` // (Optional.) - Schemas []string `json:"schemas,omitempty"` // (Optional.) - ExternalID *string `json:"externalId,omitempty"` // (Optional.) - // Only populated as a result of calling ListSCIMProvisionedIdentitiesOptions: - ID *string `json:"id,omitempty"` - Meta *SCIMMeta `json:"meta,omitempty"` -} - -// SCIMDisplayReference represents a JSON SCIM (System for Cross-domain Identity Management) resource. -type SCIMDisplayReference struct { - Value string `json:"value"` // (Required.) - Ref string `json:"$ref"` // (Required.) - Display *string `json:"display,omitempty"` // (Optional.) -} - // SCIMUserAttributes represents supported SCIM User attributes. // -// GitHub API docs: https://docs.github.com/rest/scim#supported-scim-user-attributes +// GitHub Enterprise Cloud API docs: https://docs.github.com/rest/scim?apiVersion=2022-11-28#supported-scim-user-attributes +// GitHub Enterprise Server API docs: https://docs.github.com/en/enterprise-server@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#supported-scim-user-attributes type SCIMUserAttributes struct { UserName string `json:"userName"` // Configured by the admin. Could be an email, login, or username. (Required.) Name SCIMUserName `json:"name"` // (Required.) @@ -48,6 +29,7 @@ type SCIMUserAttributes struct { Schemas []string `json:"schemas,omitempty"` // (Optional.) ExternalID *string `json:"externalId,omitempty"` // (Optional.) Groups []string `json:"groups,omitempty"` // (Optional.) + Roles []*SCIMUserRole `json:"roles,omitempty"` // (Optional, GHES only.) Active *bool `json:"active,omitempty"` // (Optional.) // Only populated as a result of calling ListSCIMProvisionedIdentitiesOptions or GetSCIMProvisioningInfoForUser: ID *string `json:"id,omitempty"` @@ -68,6 +50,18 @@ type SCIMUserEmail struct { Type *string `json:"type,omitempty"` // (Optional.) } +// SCIMUserRole is an enterprise-wide role granted to the user. This is only +// supported in GitHub Enterprise Server, and not GitHub Enterprise Cloud. +// See the docs for allowed role names. +// +// https://docs.github.com/en/enterprise-server@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#provision-a-scim-enterprise-user +type SCIMUserRole struct { + Value string `json:"value"` // (Required.) + Display *string `json:"display,omitempty"` // (Optional.) + Type *string `json:"type,omitempty"` // (Optional.) + Primary *bool `json:"primary,omitempty"` // (Optional.) +} + // SCIMMeta represents metadata about the SCIM resource. type SCIMMeta struct { ResourceType *string `json:"resourceType,omitempty"` @@ -76,15 +70,6 @@ type SCIMMeta struct { Location *string `json:"location,omitempty"` } -// SCIMProvisionedGroups represents the result of calling ListSCIMProvisionedGroupsForEnterprise. -type SCIMProvisionedGroups struct { - Schemas []string `json:"schemas,omitempty"` - TotalResults *int `json:"totalResults,omitempty"` - ItemsPerPage *int `json:"itemsPerPage,omitempty"` - StartIndex *int `json:"startIndex,omitempty"` - Resources []*SCIMGroupAttributes `json:"Resources,omitempty"` -} - // SCIMProvisionedIdentities represents the result of calling ListSCIMProvisionedIdentities. type SCIMProvisionedIdentities struct { Schemas []string `json:"schemas,omitempty"` @@ -110,7 +95,7 @@ type ListSCIMProvisionedIdentitiesOptions struct { // ListSCIMProvisionedIdentities lists SCIM provisioned identities. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim#list-scim-provisioned-identities +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim?apiVersion=2022-11-28#list-scim-provisioned-identities // //meta:operation GET /scim/v2/organizations/{org}/Users func (s *SCIMService) ListSCIMProvisionedIdentities(ctx context.Context, org string, opts *ListSCIMProvisionedIdentitiesOptions) (*SCIMProvisionedIdentities, *Response, error) { @@ -120,13 +105,13 @@ func (s *SCIMService) ListSCIMProvisionedIdentities(ctx context.Context, org str return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - identities := new(SCIMProvisionedIdentities) - resp, err := s.client.Do(ctx, req, identities) + var identities *SCIMProvisionedIdentities + resp, err := s.client.Do(req, &identities) if err != nil { return nil, resp, err } @@ -136,19 +121,19 @@ func (s *SCIMService) ListSCIMProvisionedIdentities(ctx context.Context, org str // ProvisionAndInviteSCIMUser provisions organization membership for a user, and sends an activation email to the email address. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim#provision-and-invite-a-scim-user +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim?apiVersion=2022-11-28#provision-and-invite-a-scim-user // //meta:operation POST /scim/v2/organizations/{org}/Users func (s *SCIMService) ProvisionAndInviteSCIMUser(ctx context.Context, org string, opts *SCIMUserAttributes) (*SCIMUserAttributes, *Response, error) { u := fmt.Sprintf("scim/v2/organizations/%v/Users", org) - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, opts) if err != nil { return nil, nil, err } - user := new(SCIMUserAttributes) - resp, err := s.client.Do(ctx, req, user) + var user *SCIMUserAttributes + resp, err := s.client.Do(req, &user) if err != nil { return nil, resp, err } @@ -158,18 +143,18 @@ func (s *SCIMService) ProvisionAndInviteSCIMUser(ctx context.Context, org string // GetSCIMProvisioningInfoForUser returns SCIM provisioning information for a user. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim#get-scim-provisioning-information-for-a-user +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim?apiVersion=2022-11-28#get-scim-provisioning-information-for-a-user // //meta:operation GET /scim/v2/organizations/{org}/Users/{scim_user_id} func (s *SCIMService) GetSCIMProvisioningInfoForUser(ctx context.Context, org, scimUserID string) (*SCIMUserAttributes, *Response, error) { u := fmt.Sprintf("scim/v2/organizations/%v/Users/%v", org, scimUserID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - user := new(SCIMUserAttributes) - resp, err := s.client.Do(ctx, req, &user) + var user *SCIMUserAttributes + resp, err := s.client.Do(req, &user) if err != nil { return nil, resp, err } @@ -179,7 +164,7 @@ func (s *SCIMService) GetSCIMProvisioningInfoForUser(ctx context.Context, org, s // UpdateProvisionedOrgMembership updates a provisioned organization membership. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim#update-a-provisioned-organization-membership +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim?apiVersion=2022-11-28#update-a-provisioned-organization-membership // //meta:operation PUT /scim/v2/organizations/{org}/Users/{scim_user_id} func (s *SCIMService) UpdateProvisionedOrgMembership(ctx context.Context, org, scimUserID string, opts *SCIMUserAttributes) (*Response, error) { @@ -189,12 +174,12 @@ func (s *SCIMService) UpdateProvisionedOrgMembership(ctx context.Context, org, s return nil, err } - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // UpdateAttributeForSCIMUserOptions represents options for UpdateAttributeForSCIMUser. @@ -214,7 +199,7 @@ type UpdateAttributeForSCIMUserOperations struct { // UpdateAttributeForSCIMUser updates an attribute for an SCIM user. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim#update-an-attribute-for-a-scim-user +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim?apiVersion=2022-11-28#update-an-attribute-for-a-scim-user // //meta:operation PATCH /scim/v2/organizations/{org}/Users/{scim_user_id} func (s *SCIMService) UpdateAttributeForSCIMUser(ctx context.Context, org, scimUserID string, opts *UpdateAttributeForSCIMUserOptions) (*Response, error) { @@ -224,47 +209,25 @@ func (s *SCIMService) UpdateAttributeForSCIMUser(ctx context.Context, org, scimU return nil, err } - req, err := s.client.NewRequest("PATCH", u, nil) + req, err := s.client.NewRequest(ctx, "PATCH", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DeleteSCIMUserFromOrg deletes SCIM user from an organization. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim#delete-a-scim-user-from-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim?apiVersion=2022-11-28#delete-a-scim-user-from-an-organization // //meta:operation DELETE /scim/v2/organizations/{org}/Users/{scim_user_id} func (s *SCIMService) DeleteSCIMUserFromOrg(ctx context.Context, org, scimUserID string) (*Response, error) { u := fmt.Sprintf("scim/v2/organizations/%v/Users/%v", org, scimUserID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) -} - -// ListSCIMProvisionedGroupsForEnterprise lists SCIM provisioned groups for an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#list-provisioned-scim-groups-for-an-enterprise -// -//meta:operation GET /scim/v2/enterprises/{enterprise}/Groups -func (s *SCIMService) ListSCIMProvisionedGroupsForEnterprise(ctx context.Context, enterprise string, opts *ListSCIMProvisionedIdentitiesOptions) (*SCIMProvisionedGroups, *Response, error) { - u := fmt.Sprintf("scim/v2/enterprises/%v/Groups", enterprise) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - groups := new(SCIMProvisionedGroups) - resp, err := s.client.Do(ctx, req, groups) - if err != nil { - return nil, resp, err - } - - return groups, resp, nil + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/search.go b/vendor/github.com/google/go-github/v88/github/search.go similarity index 86% rename from vendor/github.com/google/go-github/v73/github/search.go rename to vendor/github.com/google/go-github/v88/github/search.go index 71b5ae51e..ee7d33357 100644 --- a/vendor/github.com/google/go-github/v73/github/search.go +++ b/vendor/github.com/google/go-github/v88/github/search.go @@ -32,7 +32,7 @@ import ( // For example, querying with "language:c++" and "leveldb", then query should be // "language:c++ leveldb" but not "language:c+++leveldb". // -// GitHub API docs: https://docs.github.com/rest/search/ +// GitHub API docs: https://docs.github.com/rest/search?apiVersion=2022-11-28 type SearchService service // SearchOptions specifies optional parameters to the SearchService methods. @@ -54,6 +54,9 @@ type SearchOptions struct { // Whether to retrieve text match metadata with a query TextMatch bool `url:"-"` + // Whether to enable advanced search for issues + AdvancedSearch *bool `url:"advanced_search,omitempty"` + ListOptions } @@ -72,12 +75,12 @@ type RepositoriesSearchResult struct { // Repositories searches repositories via various criteria. // -// GitHub API docs: https://docs.github.com/rest/search/search#search-repositories +// GitHub API docs: https://docs.github.com/rest/search/search?apiVersion=2022-11-28#search-repositories // //meta:operation GET /search/repositories func (s *SearchService) Repositories(ctx context.Context, query string, opts *SearchOptions) (*RepositoriesSearchResult, *Response, error) { - result := new(RepositoriesSearchResult) - resp, err := s.search(ctx, "repositories", &searchParameters{Query: query}, opts, result) + var result *RepositoriesSearchResult + resp, err := s.search(ctx, "repositories", &searchParameters{Query: query}, opts, &result) if err != nil { return nil, resp, err } @@ -92,6 +95,7 @@ type TopicsSearchResult struct { Topics []*TopicResult `json:"items,omitempty"` } +// TopicResult represents a topic search result. type TopicResult struct { Name *string `json:"name,omitempty"` DisplayName *string `json:"display_name,omitempty"` @@ -109,12 +113,12 @@ type TopicResult struct { // Please see https://help.github.com/articles/searching-topics for more // information about search qualifiers. // -// GitHub API docs: https://docs.github.com/rest/search/search#search-topics +// GitHub API docs: https://docs.github.com/rest/search/search?apiVersion=2022-11-28#search-topics // //meta:operation GET /search/topics func (s *SearchService) Topics(ctx context.Context, query string, opts *SearchOptions) (*TopicsSearchResult, *Response, error) { - result := new(TopicsSearchResult) - resp, err := s.search(ctx, "topics", &searchParameters{Query: query}, opts, result) + var result *TopicsSearchResult + resp, err := s.search(ctx, "topics", &searchParameters{Query: query}, opts, &result) if err != nil { return nil, resp, err } @@ -146,12 +150,12 @@ type CommitResult struct { // Commits searches commits via various criteria. // -// GitHub API docs: https://docs.github.com/rest/search/search#search-commits +// GitHub API docs: https://docs.github.com/rest/search/search?apiVersion=2022-11-28#search-commits // //meta:operation GET /search/commits func (s *SearchService) Commits(ctx context.Context, query string, opts *SearchOptions) (*CommitsSearchResult, *Response, error) { - result := new(CommitsSearchResult) - resp, err := s.search(ctx, "commits", &searchParameters{Query: query}, opts, result) + var result *CommitsSearchResult + resp, err := s.search(ctx, "commits", &searchParameters{Query: query}, opts, &result) if err != nil { return nil, resp, err } @@ -168,12 +172,12 @@ type IssuesSearchResult struct { // Issues searches issues via various criteria. // -// GitHub API docs: https://docs.github.com/rest/search/search#search-issues-and-pull-requests +// GitHub API docs: https://docs.github.com/rest/search/search?apiVersion=2022-11-28#search-issues-and-pull-requests // //meta:operation GET /search/issues func (s *SearchService) Issues(ctx context.Context, query string, opts *SearchOptions) (*IssuesSearchResult, *Response, error) { - result := new(IssuesSearchResult) - resp, err := s.search(ctx, "issues", &searchParameters{Query: query}, opts, result) + var result *IssuesSearchResult + resp, err := s.search(ctx, "issues", &searchParameters{Query: query}, opts, &result) if err != nil { return nil, resp, err } @@ -190,12 +194,12 @@ type UsersSearchResult struct { // Users searches users via various criteria. // -// GitHub API docs: https://docs.github.com/rest/search/search#search-users +// GitHub API docs: https://docs.github.com/rest/search/search?apiVersion=2022-11-28#search-users // //meta:operation GET /search/users func (s *SearchService) Users(ctx context.Context, query string, opts *SearchOptions) (*UsersSearchResult, *Response, error) { - result := new(UsersSearchResult) - resp, err := s.search(ctx, "users", &searchParameters{Query: query}, opts, result) + var result *UsersSearchResult + resp, err := s.search(ctx, "users", &searchParameters{Query: query}, opts, &result) if err != nil { return nil, resp, err } @@ -245,12 +249,12 @@ func (c CodeResult) String() string { // Code searches code via various criteria. // -// GitHub API docs: https://docs.github.com/rest/search/search#search-code +// GitHub API docs: https://docs.github.com/rest/search/search?apiVersion=2022-11-28#search-code // //meta:operation GET /search/code func (s *SearchService) Code(ctx context.Context, query string, opts *SearchOptions) (*CodeSearchResult, *Response, error) { - result := new(CodeSearchResult) - resp, err := s.search(ctx, "code", &searchParameters{Query: query}, opts, result) + var result *CodeSearchResult + resp, err := s.search(ctx, "code", &searchParameters{Query: query}, opts, &result) if err != nil { return nil, resp, err } @@ -282,12 +286,12 @@ func (l LabelResult) String() string { // Labels searches labels in the repository with ID repoID via various criteria. // -// GitHub API docs: https://docs.github.com/rest/search/search#search-labels +// GitHub API docs: https://docs.github.com/rest/search/search?apiVersion=2022-11-28#search-labels // //meta:operation GET /search/labels func (s *SearchService) Labels(ctx context.Context, repoID int64, query string, opts *SearchOptions) (*LabelsSearchResult, *Response, error) { - result := new(LabelsSearchResult) - resp, err := s.search(ctx, "labels", &searchParameters{RepositoryID: &repoID, Query: query}, opts, result) + var result *LabelsSearchResult + resp, err := s.search(ctx, "labels", &searchParameters{RepositoryID: &repoID, Query: query}, opts, &result) if err != nil { return nil, resp, err } @@ -310,9 +314,9 @@ func (s *SearchService) search(ctx context.Context, searchType string, parameter params.Set("repository_id", strconv.FormatInt(*parameters.RepositoryID, 10)) } params.Set("q", parameters.Query) - u := fmt.Sprintf("search/%s?%s", searchType, params.Encode()) + u := fmt.Sprintf("search/%v?%v", searchType, params.Encode()) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, err } @@ -320,22 +324,15 @@ func (s *SearchService) search(ctx context.Context, searchType string, parameter switch searchType { case "commits": // Accept header for search commits preview endpoint - // TODO: remove custom Accept header when this API fully launches. acceptHeaders = append(acceptHeaders, mediaTypeCommitSearchPreview) - case "topics": - // Accept header for search repositories based on topics preview endpoint - // TODO: remove custom Accept header when this API fully launches. - acceptHeaders = append(acceptHeaders, mediaTypeTopicsPreview) - case "repositories": + case "topics", "repositories": // Accept header for search repositories based on topics preview endpoint - // TODO: remove custom Accept header when this API fully launches. acceptHeaders = append(acceptHeaders, mediaTypeTopicsPreview) case "issues": // Accept header for search issues based on reactions preview endpoint - // TODO: remove custom Accept header when this API fully launches. acceptHeaders = append(acceptHeaders, mediaTypeReactionsPreview) } - // https://docs.github.com/rest/search#search-repositories + // https://docs.github.com/rest/search?apiVersion=2022-11-28#search-repositories // Accept header defaults to "application/vnd.github.v3+json" // We change it here to fetch back text-match metadata if opts != nil && opts.TextMatch { @@ -343,5 +340,5 @@ func (s *SearchService) search(ctx context.Context, searchType string, parameter } req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - return s.client.Do(ctx, req, result) + return s.client.Do(req, result) } diff --git a/vendor/github.com/google/go-github/v73/github/secret_scanning.go b/vendor/github.com/google/go-github/v88/github/secret_scanning.go similarity index 51% rename from vendor/github.com/google/go-github/v73/github/secret_scanning.go rename to vendor/github.com/google/go-github/v88/github/secret_scanning.go index ad2312d0b..74a7dfb3d 100644 --- a/vendor/github.com/google/go-github/v73/github/secret_scanning.go +++ b/vendor/github.com/google/go-github/v88/github/secret_scanning.go @@ -16,32 +16,34 @@ type SecretScanningService service // SecretScanningAlert represents a GitHub secret scanning alert. type SecretScanningAlert struct { - Number *int `json:"number,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - LocationsURL *string `json:"locations_url,omitempty"` - State *string `json:"state,omitempty"` - Resolution *string `json:"resolution,omitempty"` - ResolvedAt *Timestamp `json:"resolved_at,omitempty"` - ResolvedBy *User `json:"resolved_by,omitempty"` - SecretType *string `json:"secret_type,omitempty"` - SecretTypeDisplayName *string `json:"secret_type_display_name,omitempty"` - Secret *string `json:"secret,omitempty"` - Repository *Repository `json:"repository,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - IsBase64Encoded *bool `json:"is_base64_encoded,omitempty"` - MultiRepo *bool `json:"multi_repo,omitempty"` - PubliclyLeaked *bool `json:"publicly_leaked,omitempty"` - PushProtectionBypassed *bool `json:"push_protection_bypassed,omitempty"` - PushProtectionBypassedBy *User `json:"push_protection_bypassed_by,omitempty"` - PushProtectionBypassedAt *Timestamp `json:"push_protection_bypassed_at,omitempty"` - ResolutionComment *string `json:"resolution_comment,omitempty"` - PushProtectionBypassRequestComment *string `json:"push_protection_bypass_request_comment,omitempty"` - PushProtectionBypassRequestHTMLURL *string `json:"push_protection_bypass_request_html_url,omitempty"` - PushProtectionBypassRequestReviewer *User `json:"push_protection_bypass_request_reviewer,omitempty"` - PushProtectionBypassRequestReviewerComment *string `json:"push_protection_bypass_request_reviewer_comment,omitempty"` - Validity *string `json:"validity,omitempty"` + Number *int `json:"number,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + LocationsURL *string `json:"locations_url,omitempty"` + FirstLocationDetected *SecretScanningAlertLocationDetails `json:"first_location_detected,omitempty"` + HasMoreLocations *bool `json:"has_more_locations,omitempty"` + State *string `json:"state,omitempty"` + Resolution *string `json:"resolution,omitempty"` + ResolvedAt *Timestamp `json:"resolved_at,omitempty"` + ResolvedBy *User `json:"resolved_by,omitempty"` + SecretType *string `json:"secret_type,omitempty"` + SecretTypeDisplayName *string `json:"secret_type_display_name,omitempty"` + Secret *string `json:"secret,omitempty"` + Repository *Repository `json:"repository,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + IsBase64Encoded *bool `json:"is_base64_encoded,omitempty"` + MultiRepo *bool `json:"multi_repo,omitempty"` + PubliclyLeaked *bool `json:"publicly_leaked,omitempty"` + PushProtectionBypassed *bool `json:"push_protection_bypassed,omitempty"` + PushProtectionBypassedBy *User `json:"push_protection_bypassed_by,omitempty"` + PushProtectionBypassedAt *Timestamp `json:"push_protection_bypassed_at,omitempty"` + ResolutionComment *string `json:"resolution_comment,omitempty"` + PushProtectionBypassRequestComment *string `json:"push_protection_bypass_request_comment,omitempty"` + PushProtectionBypassRequestHTMLURL *string `json:"push_protection_bypass_request_html_url,omitempty"` + PushProtectionBypassRequestReviewer *User `json:"push_protection_bypass_request_reviewer,omitempty"` + PushProtectionBypassRequestReviewerComment *string `json:"push_protection_bypass_request_reviewer_comment,omitempty"` + Validity *string `json:"validity,omitempty"` } // SecretScanningAlertLocation represents the location for a secret scanning alert. @@ -97,9 +99,9 @@ type SecretScanningAlertListOptions struct { // List options can vary on the Enterprise type. // On Enterprise Cloud, Secret Scan alerts support requesting by page number // along with providing a cursor for an "after" param. - // See: https://docs.github.com/enterprise-cloud@latest/rest/secret-scanning#list-secret-scanning-alerts-for-an-organization + // See: https://docs.github.com/enterprise-cloud@latest/rest/secret-scanning?apiVersion=2022-11-28#list-secret-scanning-alerts-for-an-organization // Whereas on Enterprise Server, pagination is by index. - // See: https://docs.github.com/enterprise-server@3.6/rest/secret-scanning#list-secret-scanning-alerts-for-an-organization + // See: https://docs.github.com/enterprise-server@3.6/rest/secret-scanning?apiVersion=2022-11-28#list-secret-scanning-alerts-for-an-organization ListOptions } @@ -118,12 +120,59 @@ type SecretScanningAlertUpdateOptions struct { ResolutionComment *string `json:"resolution_comment,omitempty"` } +// PushProtectionBypassRequest represents the parameters for CreatePushProtectionBypass. +type PushProtectionBypassRequest struct { + // The reason for bypassing push protection. + // Can be one of: false_positive, used_in_tests, will_fix_later + Reason string `json:"reason"` + // PlaceholderID is an identifier used for the bypass request. + // GitHub Secret Scanning provides you with a unique PlaceholderID associated with that specific blocked push. + PlaceholderID string `json:"placeholder_id"` +} + +// PushProtectionBypass represents the response from CreatePushProtectionBypass. +type PushProtectionBypass struct { + // The reason for bypassing push protection. + Reason string `json:"reason"` + // The time that the bypass will expire in ISO 8601 format. + ExpireAt *Timestamp `json:"expire_at"` + // The token type this bypass is for. + TokenType string `json:"token_type"` +} + +// SecretsScan represents the common fields for a secret scanning scan. +type SecretsScan struct { + Type string `json:"type"` + Status string `json:"status"` + CompletedAt *Timestamp `json:"completed_at,omitempty"` + StartedAt *Timestamp `json:"started_at,omitempty"` +} + +// CustomPatternBackfillScan represents a scan with an associated custom pattern. +type CustomPatternBackfillScan struct { + SecretsScan + PatternSlug *string `json:"pattern_slug,omitempty"` + PatternScope *string `json:"pattern_scope,omitempty"` +} + +// SecretScanningScanHistory is the top-level struct for the secret scanning API response. +type SecretScanningScanHistory struct { + // Information on incremental scan performed by secret scanning on the repository. + IncrementalScans []*SecretsScan `json:"incremental_scans,omitempty"` + // Information on backfill scan performed by secret scanning on the repository. + BackfillScans []*SecretsScan `json:"backfill_scans,omitempty"` + // Information on pattern update scan performed by secret scanning on the repository. + PatternUpdateScans []*SecretsScan `json:"pattern_update_scans,omitempty"` + // Information on custom pattern backfill scan performed by secret scanning on the repository. + CustomPatternBackfillScans []*CustomPatternBackfillScan `json:"custom_pattern_backfill_scans,omitempty"` +} + // ListAlertsForEnterprise lists secret scanning alerts for eligible repositories in an enterprise, from newest to oldest. // // To use this endpoint, you must be a member of the enterprise, and you must use an access token with the repo scope or // security_events scope. Alerts are only returned for organizations in the enterprise for which you are an organization owner or a security manager. // -// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/secret-scanning/secret-scanning?apiVersion=2022-11-28#list-secret-scanning-alerts-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/secret-scanning/alerts func (s *SecretScanningService) ListAlertsForEnterprise(ctx context.Context, enterprise string, opts *SecretScanningAlertListOptions) ([]*SecretScanningAlert, *Response, error) { @@ -133,13 +182,13 @@ func (s *SecretScanningService) ListAlertsForEnterprise(ctx context.Context, ent return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var alerts []*SecretScanningAlert - resp, err := s.client.Do(ctx, req, &alerts) + resp, err := s.client.Do(req, &alerts) if err != nil { return nil, resp, err } @@ -152,7 +201,7 @@ func (s *SecretScanningService) ListAlertsForEnterprise(ctx context.Context, ent // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. // -// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-an-organization +// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning?apiVersion=2022-11-28#list-secret-scanning-alerts-for-an-organization // //meta:operation GET /orgs/{org}/secret-scanning/alerts func (s *SecretScanningService) ListAlertsForOrg(ctx context.Context, org string, opts *SecretScanningAlertListOptions) ([]*SecretScanningAlert, *Response, error) { @@ -162,13 +211,13 @@ func (s *SecretScanningService) ListAlertsForOrg(ctx context.Context, org string return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var alerts []*SecretScanningAlert - resp, err := s.client.Do(ctx, req, &alerts) + resp, err := s.client.Do(req, &alerts) if err != nil { return nil, resp, err } @@ -181,7 +230,7 @@ func (s *SecretScanningService) ListAlertsForOrg(ctx context.Context, org string // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. // -// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-a-repository +// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning?apiVersion=2022-11-28#list-secret-scanning-alerts-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/secret-scanning/alerts func (s *SecretScanningService) ListAlertsForRepo(ctx context.Context, owner, repo string, opts *SecretScanningAlertListOptions) ([]*SecretScanningAlert, *Response, error) { @@ -191,13 +240,13 @@ func (s *SecretScanningService) ListAlertsForRepo(ctx context.Context, owner, re return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var alerts []*SecretScanningAlert - resp, err := s.client.Do(ctx, req, &alerts) + resp, err := s.client.Do(req, &alerts) if err != nil { return nil, resp, err } @@ -210,19 +259,19 @@ func (s *SecretScanningService) ListAlertsForRepo(ctx context.Context, owner, re // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. // -// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning#get-a-secret-scanning-alert +// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning?apiVersion=2022-11-28#get-a-secret-scanning-alert // //meta:operation GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number} func (s *SecretScanningService) GetAlert(ctx context.Context, owner, repo string, number int64) (*SecretScanningAlert, *Response, error) { u := fmt.Sprintf("repos/%v/%v/secret-scanning/alerts/%v", owner, repo, number) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var alert *SecretScanningAlert - resp, err := s.client.Do(ctx, req, &alert) + resp, err := s.client.Do(req, &alert) if err != nil { return nil, resp, err } @@ -235,19 +284,19 @@ func (s *SecretScanningService) GetAlert(ctx context.Context, owner, repo string // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. // -// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning#update-a-secret-scanning-alert +// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning?apiVersion=2022-11-28#update-a-secret-scanning-alert // //meta:operation PATCH /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number} func (s *SecretScanningService) UpdateAlert(ctx context.Context, owner, repo string, number int64, opts *SecretScanningAlertUpdateOptions) (*SecretScanningAlert, *Response, error) { u := fmt.Sprintf("repos/%v/%v/secret-scanning/alerts/%v", owner, repo, number) - req, err := s.client.NewRequest("PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, opts) if err != nil { return nil, nil, err } var alert *SecretScanningAlert - resp, err := s.client.Do(ctx, req, &alert) + resp, err := s.client.Do(req, &alert) if err != nil { return nil, resp, err } @@ -260,7 +309,7 @@ func (s *SecretScanningService) UpdateAlert(ctx context.Context, owner, repo str // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. // -// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning#list-locations-for-a-secret-scanning-alert +// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning?apiVersion=2022-11-28#list-locations-for-a-secret-scanning-alert // //meta:operation GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations func (s *SecretScanningService) ListLocationsForAlert(ctx context.Context, owner, repo string, number int64, opts *ListOptions) ([]*SecretScanningAlertLocation, *Response, error) { @@ -270,16 +319,65 @@ func (s *SecretScanningService) ListLocationsForAlert(ctx context.Context, owner return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var locations []*SecretScanningAlertLocation - resp, err := s.client.Do(ctx, req, &locations) + resp, err := s.client.Do(req, &locations) if err != nil { return nil, resp, err } return locations, resp, nil } + +// CreatePushProtectionBypass creates a push protection bypass for a given repository. +// +// To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with +// the repo scope or security_events scope. +// +// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning?apiVersion=2022-11-28#create-a-push-protection-bypass +// +//meta:operation POST /repos/{owner}/{repo}/secret-scanning/push-protection-bypasses +func (s *SecretScanningService) CreatePushProtectionBypass(ctx context.Context, owner, repo string, request PushProtectionBypassRequest) (*PushProtectionBypass, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/secret-scanning/push-protection-bypasses", owner, repo) + + req, err := s.client.NewRequest(ctx, "POST", u, request) + if err != nil { + return nil, nil, err + } + + var pushProtectionBypass *PushProtectionBypass + resp, err := s.client.Do(req, &pushProtectionBypass) + if err != nil { + return nil, resp, err + } + return pushProtectionBypass, resp, nil +} + +// GetScanHistory fetches the secret scanning history for a given repository. +// +// To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with +// the repo scope or security_events scope and gitHub advanced security or secret scanning must be enabled. +// +// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning?apiVersion=2022-11-28#get-secret-scanning-scan-history-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/secret-scanning/scan-history +func (s *SecretScanningService) GetScanHistory(ctx context.Context, owner, repo string) (*SecretScanningScanHistory, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/secret-scanning/scan-history", owner, repo) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var secretScanningHistory *SecretScanningScanHistory + resp, err := s.client.Do(req, &secretScanningHistory) + if err != nil { + return nil, resp, err + } + + return secretScanningHistory, resp, nil +} diff --git a/vendor/github.com/google/go-github/v88/github/secret_scanning_pattern_configs.go b/vendor/github.com/google/go-github/v88/github/secret_scanning_pattern_configs.go new file mode 100644 index 000000000..4599b0faf --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/secret_scanning_pattern_configs.go @@ -0,0 +1,165 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// SecretScanningPatternConfigs represents a collection of GitHub secret scanning patterns +// and their settings related to push protection. +type SecretScanningPatternConfigs struct { + PatternConfigVersion *string `json:"pattern_config_version,omitempty"` + ProviderPatternOverrides []*SecretScanningPatternOverride `json:"provider_pattern_overrides,omitempty"` + CustomPatternOverrides []*SecretScanningPatternOverride `json:"custom_pattern_overrides,omitempty"` +} + +// SecretScanningPatternOverride represents an override for provider partner or custom organization patterns. +type SecretScanningPatternOverride struct { + TokenType *string `json:"token_type,omitempty"` + CustomPatternVersion *string `json:"custom_pattern_version,omitempty"` + Slug *string `json:"slug,omitempty"` + DisplayName *string `json:"display_name,omitempty"` + AlertTotal *int `json:"alert_total,omitempty"` + AlertTotalPercentage *int `json:"alert_total_percentage,omitempty"` + FalsePositives *int `json:"false_positives,omitempty"` + FalsePositiveRate *int `json:"false_positive_rate,omitempty"` + Bypassrate *int `json:"bypass_rate,omitempty"` + DefaultSetting *string `json:"default_setting,omitempty"` + EnterpriseSetting *string `json:"enterprise_setting,omitempty"` + Setting *string `json:"setting,omitempty"` +} + +// SecretScanningPatternConfigsUpdate represents a secret scanning pattern configurations update. +type SecretScanningPatternConfigsUpdate struct { + PatternConfigVersion *string `json:"pattern_config_version,omitempty"` +} + +// SecretScanningPatternConfigsUpdateOptions specifies optional parameters to +// the SecretScanningService.UpdatePatternConfigsForEnterprise method and +// the SecretScanningService.UpdatePatternConfigsForOrg method. +type SecretScanningPatternConfigsUpdateOptions struct { + // The version of the entity. + PatternConfigVersion *string `json:"pattern_config_version,omitempty"` + + // Pattern settings for provider patterns. + ProviderPatternSettings []*SecretScanningProviderPatternSetting `json:"provider_pattern_settings,omitempty"` + + // Pattern settings for custom patterns. + CustomPatternSettings []*SecretScanningCustomPatternSetting `json:"custom_pattern_settings,omitempty"` +} + +// SecretScanningProviderPatternSetting defines an optional pattern setting for provider patterns. +type SecretScanningProviderPatternSetting struct { + // The ID of the pattern to configure. + TokenType string `json:"token_type"` + + // Push protection setting to set for the pattern. + // Can be one of: "not-set", "disabled", "enabled" + PushProtectionSetting string `json:"push_protection_setting"` +} + +// SecretScanningCustomPatternSetting defines an optional pattern setting for custom patterns. +type SecretScanningCustomPatternSetting struct { + // The ID of the pattern to configure. + TokenType string `json:"token_type"` + + // The version of the entity + CustomPatternVersion *string `json:"custom_pattern_version,omitempty"` + + // Push protection setting to set for the pattern. + // Can be one of: "not-set", "disabled", "enabled" + PushProtectionSetting string `json:"push_protection_setting"` +} + +// ListPatternConfigsForEnterprise lists the secret scanning pattern configurations for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/secret-scanning/push-protection?apiVersion=2022-11-28#list-enterprise-pattern-configurations +// +//meta:operation GET /enterprises/{enterprise}/secret-scanning/pattern-configurations +func (s *SecretScanningService) ListPatternConfigsForEnterprise(ctx context.Context, enterprise string) (*SecretScanningPatternConfigs, *Response, error) { + u := fmt.Sprintf("enterprises/%v/secret-scanning/pattern-configurations", enterprise) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var patternConfigs *SecretScanningPatternConfigs + resp, err := s.client.Do(req, &patternConfigs) + if err != nil { + return nil, resp, err + } + + return patternConfigs, resp, nil +} + +// ListPatternConfigsForOrg lists the secret scanning pattern configurations for an organization. +// +// GitHub API docs: https://docs.github.com/rest/secret-scanning/push-protection?apiVersion=2022-11-28#list-organization-pattern-configurations +// +//meta:operation GET /orgs/{org}/secret-scanning/pattern-configurations +func (s *SecretScanningService) ListPatternConfigsForOrg(ctx context.Context, org string) (*SecretScanningPatternConfigs, *Response, error) { + u := fmt.Sprintf("orgs/%v/secret-scanning/pattern-configurations", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var patternConfigs *SecretScanningPatternConfigs + resp, err := s.client.Do(req, &patternConfigs) + if err != nil { + return nil, resp, err + } + + return patternConfigs, resp, nil +} + +// UpdatePatternConfigsForEnterprise updates the secret scanning pattern configurations for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/secret-scanning/push-protection?apiVersion=2022-11-28#update-enterprise-pattern-configurations +// +//meta:operation PATCH /enterprises/{enterprise}/secret-scanning/pattern-configurations +func (s *SecretScanningService) UpdatePatternConfigsForEnterprise(ctx context.Context, enterprise string, opts *SecretScanningPatternConfigsUpdateOptions) (*SecretScanningPatternConfigsUpdate, *Response, error) { + u := fmt.Sprintf("enterprises/%v/secret-scanning/pattern-configurations", enterprise) + + req, err := s.client.NewRequest(ctx, "PATCH", u, opts) + if err != nil { + return nil, nil, err + } + + var patternConfigsUpdate *SecretScanningPatternConfigsUpdate + resp, err := s.client.Do(req, &patternConfigsUpdate) + if err != nil { + return nil, resp, err + } + + return patternConfigsUpdate, resp, nil +} + +// UpdatePatternConfigsForOrg updates the secret scanning pattern configurations for an organization. +// +// GitHub API docs: https://docs.github.com/rest/secret-scanning/push-protection?apiVersion=2022-11-28#update-organization-pattern-configurations +// +//meta:operation PATCH /orgs/{org}/secret-scanning/pattern-configurations +func (s *SecretScanningService) UpdatePatternConfigsForOrg(ctx context.Context, org string, opts *SecretScanningPatternConfigsUpdateOptions) (*SecretScanningPatternConfigsUpdate, *Response, error) { + u := fmt.Sprintf("orgs/%v/secret-scanning/pattern-configurations", org) + + req, err := s.client.NewRequest(ctx, "PATCH", u, opts) + if err != nil { + return nil, nil, err + } + + var patternConfigsUpdate *SecretScanningPatternConfigsUpdate + resp, err := s.client.Do(req, &patternConfigsUpdate) + if err != nil { + return nil, resp, err + } + + return patternConfigsUpdate, resp, nil +} diff --git a/vendor/github.com/google/go-github/v73/github/security_advisories.go b/vendor/github.com/google/go-github/v88/github/security_advisories.go similarity index 82% rename from vendor/github.com/google/go-github/v73/github/security_advisories.go rename to vendor/github.com/google/go-github/v88/github/security_advisories.go index b5a43f1aa..c749f0b1b 100644 --- a/vendor/github.com/google/go-github/v73/github/security_advisories.go +++ b/vendor/github.com/google/go-github/v88/github/security_advisories.go @@ -8,9 +8,14 @@ package github import ( "context" "encoding/json" + "errors" "fmt" ) +// SecurityAdvisoriesService handles communication with the security advisories +// related methods of the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/security-advisories?apiVersion=2022-11-28 type SecurityAdvisoriesService service // SecurityAdvisorySubmission represents the Security Advisory Submission. @@ -126,20 +131,20 @@ type Credit struct { // RequestCVE requests a Common Vulnerabilities and Exposures (CVE) for a repository security advisory. // The ghsaID is the GitHub Security Advisory identifier of the advisory. // -// GitHub API docs: https://docs.github.com/rest/security-advisories/repository-advisories#request-a-cve-for-a-repository-security-advisory +// GitHub API docs: https://docs.github.com/rest/security-advisories/repository-advisories?apiVersion=2022-11-28#request-a-cve-for-a-repository-security-advisory // //meta:operation POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/cve func (s *SecurityAdvisoriesService) RequestCVE(ctx context.Context, owner, repo, ghsaID string) (*Response, error) { url := fmt.Sprintf("repos/%v/%v/security-advisories/%v/cve", owner, repo, ghsaID) - req, err := s.client.NewRequest("POST", url, nil) + req, err := s.client.NewRequest(ctx, "POST", url, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { - if _, ok := err.(*AcceptedError); ok { + if errors.As(err, new(*AcceptedError)) { return resp, nil } @@ -152,52 +157,53 @@ func (s *SecurityAdvisoriesService) RequestCVE(ctx context.Context, owner, repo, // CreateTemporaryPrivateFork creates a temporary private fork to collaborate on fixing a security vulnerability in your repository. // The ghsaID is the GitHub Security Advisory identifier of the advisory. // -// GitHub API docs: https://docs.github.com/rest/security-advisories/repository-advisories#create-a-temporary-private-fork +// GitHub API docs: https://docs.github.com/rest/security-advisories/repository-advisories?apiVersion=2022-11-28#create-a-temporary-private-fork // //meta:operation POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/forks func (s *SecurityAdvisoriesService) CreateTemporaryPrivateFork(ctx context.Context, owner, repo, ghsaID string) (*Repository, *Response, error) { url := fmt.Sprintf("repos/%v/%v/security-advisories/%v/forks", owner, repo, ghsaID) - req, err := s.client.NewRequest("POST", url, nil) + req, err := s.client.NewRequest(ctx, "POST", url, nil) if err != nil { return nil, nil, err } - fork := new(Repository) - resp, err := s.client.Do(ctx, req, fork) + var fork Repository + resp, err := s.client.Do(req, &fork) if err != nil { - if aerr, ok := err.(*AcceptedError); ok { - if err := json.Unmarshal(aerr.Raw, fork); err != nil { - return fork, resp, err + var aerr *AcceptedError + if errors.As(err, &aerr) { + if err := json.Unmarshal(aerr.Raw, &fork); err != nil { + return &fork, resp, err } - return fork, resp, err + return &fork, resp, err } return nil, resp, err } - return fork, resp, nil + return &fork, resp, nil } // ListRepositorySecurityAdvisoriesForOrg lists the repository security advisories for an organization. // -// GitHub API docs: https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories-for-an-organization +// GitHub API docs: https://docs.github.com/rest/security-advisories/repository-advisories?apiVersion=2022-11-28#list-repository-security-advisories-for-an-organization // //meta:operation GET /orgs/{org}/security-advisories -func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisoriesForOrg(ctx context.Context, org string, opt *ListRepositorySecurityAdvisoriesOptions) ([]*SecurityAdvisory, *Response, error) { +func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisoriesForOrg(ctx context.Context, org string, opts *ListRepositorySecurityAdvisoriesOptions) ([]*SecurityAdvisory, *Response, error) { url := fmt.Sprintf("orgs/%v/security-advisories", org) - url, err := addOptions(url, opt) + url, err := addOptions(url, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } var advisories []*SecurityAdvisory - resp, err := s.client.Do(ctx, req, &advisories) + resp, err := s.client.Do(req, &advisories) if err != nil { return nil, resp, err } @@ -207,23 +213,23 @@ func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisoriesForOrg(ctx c // ListRepositorySecurityAdvisories lists the security advisories in a repository. // -// GitHub API docs: https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories +// GitHub API docs: https://docs.github.com/rest/security-advisories/repository-advisories?apiVersion=2022-11-28#list-repository-security-advisories // //meta:operation GET /repos/{owner}/{repo}/security-advisories -func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisories(ctx context.Context, owner, repo string, opt *ListRepositorySecurityAdvisoriesOptions) ([]*SecurityAdvisory, *Response, error) { +func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisories(ctx context.Context, owner, repo string, opts *ListRepositorySecurityAdvisoriesOptions) ([]*SecurityAdvisory, *Response, error) { url := fmt.Sprintf("repos/%v/%v/security-advisories", owner, repo) - url, err := addOptions(url, opt) + url, err := addOptions(url, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } var advisories []*SecurityAdvisory - resp, err := s.client.Do(ctx, req, &advisories) + resp, err := s.client.Do(req, &advisories) if err != nil { return nil, resp, err } @@ -233,7 +239,7 @@ func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisories(ctx context // ListGlobalSecurityAdvisories lists all global security advisories. // -// GitHub API docs: https://docs.github.com/rest/security-advisories/global-advisories#list-global-security-advisories +// GitHub API docs: https://docs.github.com/rest/security-advisories/global-advisories?apiVersion=2022-11-28#list-global-security-advisories // //meta:operation GET /advisories func (s *SecurityAdvisoriesService) ListGlobalSecurityAdvisories(ctx context.Context, opts *ListGlobalSecurityAdvisoriesOptions) ([]*GlobalSecurityAdvisory, *Response, error) { @@ -243,13 +249,13 @@ func (s *SecurityAdvisoriesService) ListGlobalSecurityAdvisories(ctx context.Con return nil, nil, err } - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } var advisories []*GlobalSecurityAdvisory - resp, err := s.client.Do(ctx, req, &advisories) + resp, err := s.client.Do(req, &advisories) if err != nil { return nil, resp, err } @@ -259,18 +265,18 @@ func (s *SecurityAdvisoriesService) ListGlobalSecurityAdvisories(ctx context.Con // GetGlobalSecurityAdvisories gets a global security advisory using its GitHub Security Advisory (GHSA) identifier. // -// GitHub API docs: https://docs.github.com/rest/security-advisories/global-advisories#get-a-global-security-advisory +// GitHub API docs: https://docs.github.com/rest/security-advisories/global-advisories?apiVersion=2022-11-28#get-a-global-security-advisory // //meta:operation GET /advisories/{ghsa_id} func (s *SecurityAdvisoriesService) GetGlobalSecurityAdvisories(ctx context.Context, ghsaID string) (*GlobalSecurityAdvisory, *Response, error) { - url := fmt.Sprintf("advisories/%s", ghsaID) - req, err := s.client.NewRequest("GET", url, nil) + url := fmt.Sprintf("advisories/%v", ghsaID) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } var advisory *GlobalSecurityAdvisory - resp, err := s.client.Do(ctx, req, &advisory) + resp, err := s.client.Do(req, &advisory) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/strings.go b/vendor/github.com/google/go-github/v88/github/strings.go similarity index 57% rename from vendor/github.com/google/go-github/v73/github/strings.go rename to vendor/github.com/google/go-github/v88/github/strings.go index 46fd55ad1..dfbe3c685 100644 --- a/vendor/github.com/google/go-github/v73/github/strings.go +++ b/vendor/github.com/google/go-github/v88/github/strings.go @@ -9,24 +9,37 @@ import ( "bytes" "fmt" "reflect" + "strconv" + "sync" ) -var timestampType = reflect.TypeOf(Timestamp{}) +var timestampType = reflect.TypeFor[Timestamp]() + +var bufferPool = sync.Pool{ + New: func() any { + return new(bytes.Buffer) + }, +} // Stringify attempts to create a reasonable string representation of types in // the GitHub library. It does things like resolve pointers to their values // and omits struct fields with nil values. func Stringify(message any) string { - var buf bytes.Buffer + buf := bufferPool.Get().(*bytes.Buffer) + defer func() { + buf.Reset() + bufferPool.Put(buf) + }() + v := reflect.ValueOf(message) - stringifyValue(&buf, v) + stringifyValue(buf, v) return buf.String() } // stringifyValue was heavily inspired by the goprotobuf library. func stringifyValue(w *bytes.Buffer, val reflect.Value) { - if val.Kind() == reflect.Ptr && val.IsNil() { + if val.Kind() == reflect.Pointer && val.IsNil() { w.WriteString("") return } @@ -34,11 +47,23 @@ func stringifyValue(w *bytes.Buffer, val reflect.Value) { v := reflect.Indirect(val) switch v.Kind() { + case reflect.Bool: + w.Write(strconv.AppendBool(w.Bytes(), v.Bool())[w.Len():]) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + w.Write(strconv.AppendInt(w.Bytes(), v.Int(), 10)[w.Len():]) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + w.Write(strconv.AppendUint(w.Bytes(), v.Uint(), 10)[w.Len():]) + case reflect.Float32: + w.Write(strconv.AppendFloat(w.Bytes(), v.Float(), 'g', -1, 32)[w.Len():]) + case reflect.Float64: + w.Write(strconv.AppendFloat(w.Bytes(), v.Float(), 'g', -1, 64)[w.Len():]) case reflect.String: - fmt.Fprintf(w, `"%s"`, v) + w.WriteByte('"') + w.WriteString(v.String()) + w.WriteByte('"') case reflect.Slice: w.WriteByte('[') - for i := 0; i < v.Len(); i++ { + for i := range v.Len() { if i > 0 { w.WriteByte(' ') } @@ -55,16 +80,16 @@ func stringifyValue(w *bytes.Buffer, val reflect.Value) { // special handling of Timestamp values if v.Type() == timestampType { - fmt.Fprintf(w, "{%s}", v.Interface()) + fmt.Fprintf(w, "{%v}", v.Interface()) return } w.WriteByte('{') var sep bool - for i := 0; i < v.NumField(); i++ { + for i := range v.NumField() { fv := v.Field(i) - if fv.Kind() == reflect.Ptr && fv.IsNil() { + if fv.Kind() == reflect.Pointer && fv.IsNil() { continue } if fv.Kind() == reflect.Slice && fv.IsNil() { diff --git a/vendor/github.com/google/go-github/v73/github/sub_issue.go b/vendor/github.com/google/go-github/v88/github/sub_issue.go similarity index 72% rename from vendor/github.com/google/go-github/v73/github/sub_issue.go rename to vendor/github.com/google/go-github/v88/github/sub_issue.go index 8b24adb89..f56980f89 100644 --- a/vendor/github.com/google/go-github/v73/github/sub_issue.go +++ b/vendor/github.com/google/go-github/v88/github/sub_issue.go @@ -15,7 +15,7 @@ import ( // // Sub-issues help you group and manage your issues with a parent/child relationship. // -// GitHub API docs: https://docs.github.com/rest/issues/sub-issues +// GitHub API docs: https://docs.github.com/rest/issues/sub-issues?apiVersion=2022-11-28 type SubIssueService service // SubIssue represents a GitHub sub-issue on a repository. @@ -46,19 +46,19 @@ type SubIssueRequest struct { // Remove a sub-issue from the specified repository. // -// GitHub API docs: https://docs.github.com/rest/issues/sub-issues#remove-sub-issue +// GitHub API docs: https://docs.github.com/rest/issues/sub-issues?apiVersion=2022-11-28#remove-sub-issue // //meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/sub_issue -func (s *SubIssueService) Remove(ctx context.Context, owner, repo string, subIssueNumber int64, subIssue SubIssueRequest) (*SubIssue, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%v/sub_issues", owner, repo, subIssueNumber) +func (s *SubIssueService) Remove(ctx context.Context, owner, repo string, issueNumber int64, subIssue SubIssueRequest) (*SubIssue, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/sub_issue", owner, repo, issueNumber) - req, err := s.client.NewRequest("DELETE", u, subIssue) + req, err := s.client.NewRequest(ctx, "DELETE", u, subIssue) if err != nil { return nil, nil, err } - si := new(SubIssue) - resp, err := s.client.Do(ctx, req, si) + var si *SubIssue + resp, err := s.client.Do(req, &si) if err != nil { return nil, resp, err } @@ -68,23 +68,23 @@ func (s *SubIssueService) Remove(ctx context.Context, owner, repo string, subIss // ListByIssue lists all sub-issues for the specified issue. // -// GitHub API docs: https://docs.github.com/rest/issues/sub-issues#list-sub-issues +// GitHub API docs: https://docs.github.com/rest/issues/sub-issues?apiVersion=2022-11-28#list-sub-issues // //meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/sub_issues -func (s *SubIssueService) ListByIssue(ctx context.Context, owner, repo string, issueNumber int64, opts *IssueListOptions) ([]*SubIssue, *Response, error) { +func (s *SubIssueService) ListByIssue(ctx context.Context, owner, repo string, issueNumber int64, opts *ListOptions) ([]*SubIssue, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v/sub_issues", owner, repo, issueNumber) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var subIssues []*SubIssue - resp, err := s.client.Do(ctx, req, &subIssues) + resp, err := s.client.Do(req, &subIssues) if err != nil { return nil, resp, err } @@ -97,18 +97,18 @@ func (s *SubIssueService) ListByIssue(ctx context.Context, owner, repo string, i // The sub-issue to be added must belong to the same repository owner as the parent issue. // To replace the existing parent of a sub-issue, set replaceParent to true. // -// GitHub API docs: https://docs.github.com/rest/issues/sub-issues#add-sub-issue +// GitHub API docs: https://docs.github.com/rest/issues/sub-issues?apiVersion=2022-11-28#add-sub-issue // //meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/sub_issues func (s *SubIssueService) Add(ctx context.Context, owner, repo string, issueNumber int64, subIssue SubIssueRequest) (*SubIssue, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v/sub_issues", owner, repo, issueNumber) - req, err := s.client.NewRequest("POST", u, subIssue) + req, err := s.client.NewRequest(ctx, "POST", u, subIssue) if err != nil { return nil, nil, err } - si := new(SubIssue) - resp, err := s.client.Do(ctx, req, si) + var si *SubIssue + resp, err := s.client.Do(req, &si) if err != nil { return nil, resp, err } @@ -120,21 +120,42 @@ func (s *SubIssueService) Add(ctx context.Context, owner, repo string, issueNumb // // Either afterId or beforeId must be specified to determine the new position of the sub-issue. // -// GitHub API docs: https://docs.github.com/rest/issues/sub-issues#reprioritize-sub-issue +// GitHub API docs: https://docs.github.com/rest/issues/sub-issues?apiVersion=2022-11-28#reprioritize-sub-issue // //meta:operation PATCH /repos/{owner}/{repo}/issues/{issue_number}/sub_issues/priority func (s *SubIssueService) Reprioritize(ctx context.Context, owner, repo string, issueNumber int64, subIssue SubIssueRequest) (*SubIssue, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v/sub_issues/priority", owner, repo, issueNumber) - req, err := s.client.NewRequest("PATCH", u, subIssue) + req, err := s.client.NewRequest(ctx, "PATCH", u, subIssue) if err != nil { return nil, nil, err } - si := new(SubIssue) - resp, err := s.client.Do(ctx, req, si) + var si *SubIssue + resp, err := s.client.Do(req, &si) if err != nil { return nil, resp, err } return si, resp, nil } + +// GetParentIssue gets the parent issue of a sub-issue. +// +// GitHub API docs: https://docs.github.com/rest/issues/sub-issues?apiVersion=2022-11-28#get-parent-issue +// +//meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/parent +func (s *SubIssueService) GetParentIssue(ctx context.Context, owner, repo string, subIssueNumber int64) (*Issue, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/parent", owner, repo, subIssueNumber) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var parentIssue *Issue + resp, err := s.client.Do(req, &parentIssue) + if err != nil { + return nil, resp, err + } + + return parentIssue, resp, nil +} diff --git a/vendor/github.com/google/go-github/v73/github/teams.go b/vendor/github.com/google/go-github/v88/github/teams.go similarity index 79% rename from vendor/github.com/google/go-github/v73/github/teams.go rename to vendor/github.com/google/go-github/v88/github/teams.go index d334110f4..e8fddad79 100644 --- a/vendor/github.com/google/go-github/v73/github/teams.go +++ b/vendor/github.com/google/go-github/v88/github/teams.go @@ -14,7 +14,7 @@ import ( // TeamsService provides access to the team-related functions // in the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/teams/ +// GitHub API docs: https://docs.github.com/rest/teams?apiVersion=2022-11-28 type TeamsService service // Team represents a team within a GitHub organization. Teams are used to @@ -60,6 +60,10 @@ type Team struct { // possible values are: "direct", "indirect", "mixed". This is only populated when // calling the ListTeamsAssignedToOrgRole method. Assignment *string `json:"assignment,omitempty"` + + // Type identifies the ownership type of the team + // Possible values are: "organization", "enterprise". + Type *string `json:"type,omitempty"` } func (t Team) String() string { @@ -88,7 +92,7 @@ func (i Invitation) String() string { // ListTeams lists all of the teams for an organization. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#list-teams +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#list-teams // //meta:operation GET /orgs/{org}/teams func (s *TeamsService) ListTeams(ctx context.Context, org string, opts *ListOptions) ([]*Team, *Response, error) { @@ -98,13 +102,13 @@ func (s *TeamsService) ListTeams(ctx context.Context, org string, opts *ListOpti return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var teams []*Team - resp, err := s.client.Do(ctx, req, &teams) + resp, err := s.client.Do(req, &teams) if err != nil { return nil, resp, err } @@ -116,18 +120,18 @@ func (s *TeamsService) ListTeams(ctx context.Context, org string, opts *ListOpti // // Deprecated: Use GetTeamBySlug instead. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#get-a-team-by-name +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#get-a-team-by-name // //meta:operation GET /orgs/{org}/teams/{team_slug} func (s *TeamsService) GetTeamByID(ctx context.Context, orgID, teamID int64) (*Team, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v", orgID, teamID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - t := new(Team) - resp, err := s.client.Do(ctx, req, t) + var t *Team + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } @@ -137,18 +141,18 @@ func (s *TeamsService) GetTeamByID(ctx context.Context, orgID, teamID int64) (*T // GetTeamBySlug fetches a team, given a specified organization name, by slug. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#get-a-team-by-name +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#get-a-team-by-name // //meta:operation GET /orgs/{org}/teams/{team_slug} func (s *TeamsService) GetTeamBySlug(ctx context.Context, org, slug string) (*Team, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v", org, slug) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - t := new(Team) - resp, err := s.client.Do(ctx, req, t) + var t *Team + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } @@ -192,18 +196,18 @@ func (s NewTeam) String() string { // CreateTeam creates a new team within an organization. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#create-a-team +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#create-a-team // //meta:operation POST /orgs/{org}/teams func (s *TeamsService) CreateTeam(ctx context.Context, org string, team NewTeam) (*Team, *Response, error) { u := fmt.Sprintf("orgs/%v/teams", org) - req, err := s.client.NewRequest("POST", u, team) + req, err := s.client.NewRequest(ctx, "POST", u, team) if err != nil { return nil, nil, err } - t := new(Team) - resp, err := s.client.Do(ctx, req, t) + var t *Team + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } @@ -244,7 +248,7 @@ func copyNewTeamWithoutParent(team *NewTeam) *newTeamNoParent { // // Deprecated: Use EditTeamBySlug instead. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#update-a-team +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#update-a-team // //meta:operation PATCH /orgs/{org}/teams/{team_slug} func (s *TeamsService) EditTeamByID(ctx context.Context, orgID, teamID int64, team NewTeam, removeParent bool) (*Team, *Response, error) { @@ -254,16 +258,16 @@ func (s *TeamsService) EditTeamByID(ctx context.Context, orgID, teamID int64, te var err error if removeParent { teamRemoveParent := copyNewTeamWithoutParent(&team) - req, err = s.client.NewRequest("PATCH", u, teamRemoveParent) + req, err = s.client.NewRequest(ctx, "PATCH", u, teamRemoveParent) } else { - req, err = s.client.NewRequest("PATCH", u, team) + req, err = s.client.NewRequest(ctx, "PATCH", u, team) } if err != nil { return nil, nil, err } - t := new(Team) - resp, err := s.client.Do(ctx, req, t) + var t *Team + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } @@ -273,7 +277,7 @@ func (s *TeamsService) EditTeamByID(ctx context.Context, orgID, teamID int64, te // EditTeamBySlug edits a team, given an organization name, by slug. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#update-a-team +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#update-a-team // //meta:operation PATCH /orgs/{org}/teams/{team_slug} func (s *TeamsService) EditTeamBySlug(ctx context.Context, org, slug string, team NewTeam, removeParent bool) (*Team, *Response, error) { @@ -283,16 +287,16 @@ func (s *TeamsService) EditTeamBySlug(ctx context.Context, org, slug string, tea var err error if removeParent { teamRemoveParent := copyNewTeamWithoutParent(&team) - req, err = s.client.NewRequest("PATCH", u, teamRemoveParent) + req, err = s.client.NewRequest(ctx, "PATCH", u, teamRemoveParent) } else { - req, err = s.client.NewRequest("PATCH", u, team) + req, err = s.client.NewRequest(ctx, "PATCH", u, team) } if err != nil { return nil, nil, err } - t := new(Team) - resp, err := s.client.Do(ctx, req, t) + var t *Team + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } @@ -304,39 +308,39 @@ func (s *TeamsService) EditTeamBySlug(ctx context.Context, org, slug string, tea // // Deprecated: Use DeleteTeamBySlug instead. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#delete-a-team +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#delete-a-team // //meta:operation DELETE /orgs/{org}/teams/{team_slug} func (s *TeamsService) DeleteTeamByID(ctx context.Context, orgID, teamID int64) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v", orgID, teamID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DeleteTeamBySlug deletes a team reference by slug. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#delete-a-team +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#delete-a-team // //meta:operation DELETE /orgs/{org}/teams/{team_slug} func (s *TeamsService) DeleteTeamBySlug(ctx context.Context, org, slug string) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v", org, slug) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListChildTeamsByParentID lists child teams for a parent team given parent ID. // // Deprecated: Use ListChildTeamsByParentSlug instead. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#list-child-teams +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#list-child-teams // //meta:operation GET /orgs/{org}/teams/{team_slug}/teams func (s *TeamsService) ListChildTeamsByParentID(ctx context.Context, orgID, teamID int64, opts *ListOptions) ([]*Team, *Response, error) { @@ -346,13 +350,13 @@ func (s *TeamsService) ListChildTeamsByParentID(ctx context.Context, orgID, team return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var teams []*Team - resp, err := s.client.Do(ctx, req, &teams) + resp, err := s.client.Do(req, &teams) if err != nil { return nil, resp, err } @@ -362,7 +366,7 @@ func (s *TeamsService) ListChildTeamsByParentID(ctx context.Context, orgID, team // ListChildTeamsByParentSlug lists child teams for a parent team given parent slug. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#list-child-teams +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#list-child-teams // //meta:operation GET /orgs/{org}/teams/{team_slug}/teams func (s *TeamsService) ListChildTeamsByParentSlug(ctx context.Context, org, slug string, opts *ListOptions) ([]*Team, *Response, error) { @@ -372,13 +376,13 @@ func (s *TeamsService) ListChildTeamsByParentSlug(ctx context.Context, org, slug return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var teams []*Team - resp, err := s.client.Do(ctx, req, &teams) + resp, err := s.client.Do(req, &teams) if err != nil { return nil, resp, err } @@ -390,7 +394,7 @@ func (s *TeamsService) ListChildTeamsByParentSlug(ctx context.Context, org, slug // // Deprecated: Use ListTeamReposBySlug instead. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#list-team-repositories +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#list-team-repositories // //meta:operation GET /orgs/{org}/teams/{team_slug}/repos func (s *TeamsService) ListTeamReposByID(ctx context.Context, orgID, teamID int64, opts *ListOptions) ([]*Repository, *Response, error) { @@ -400,16 +404,15 @@ func (s *TeamsService) ListTeamReposByID(ctx context.Context, orgID, teamID int6 return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when topics API fully launches. req.Header.Set("Accept", mediaTypeTopicsPreview) var repos []*Repository - resp, err := s.client.Do(ctx, req, &repos) + resp, err := s.client.Do(req, &repos) if err != nil { return nil, resp, err } @@ -419,7 +422,7 @@ func (s *TeamsService) ListTeamReposByID(ctx context.Context, orgID, teamID int6 // ListTeamReposBySlug lists the repositories given a team slug that the specified team has access to. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#list-team-repositories +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#list-team-repositories // //meta:operation GET /orgs/{org}/teams/{team_slug}/repos func (s *TeamsService) ListTeamReposBySlug(ctx context.Context, org, slug string, opts *ListOptions) ([]*Repository, *Response, error) { @@ -429,16 +432,15 @@ func (s *TeamsService) ListTeamReposBySlug(ctx context.Context, org, slug string return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when topics API fully launches. req.Header.Set("Accept", mediaTypeTopicsPreview) var repos []*Repository - resp, err := s.client.Do(ctx, req, &repos) + resp, err := s.client.Do(req, &repos) if err != nil { return nil, resp, err } @@ -452,20 +454,20 @@ func (s *TeamsService) ListTeamReposBySlug(ctx context.Context, org, slug string // // Deprecated: Use IsTeamRepoBySlug instead. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-repository +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#check-team-permissions-for-a-repository // //meta:operation GET /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} func (s *TeamsService) IsTeamRepoByID(ctx context.Context, orgID, teamID int64, owner, repo string) (*Repository, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/repos/%v/%v", orgID, teamID, owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeOrgPermissionRepo) - repository := new(Repository) - resp, err := s.client.Do(ctx, req, repository) + var repository *Repository + resp, err := s.client.Do(req, &repository) if err != nil { return nil, resp, err } @@ -477,20 +479,20 @@ func (s *TeamsService) IsTeamRepoByID(ctx context.Context, orgID, teamID int64, // repository is managed by team, a Repository is returned which includes the // permissions team has for that repo. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-repository +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#check-team-permissions-for-a-repository // //meta:operation GET /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} func (s *TeamsService) IsTeamRepoBySlug(ctx context.Context, org, slug, owner, repo string) (*Repository, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/repos/%v/%v", org, slug, owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeOrgPermissionRepo) - repository := new(Repository) - resp, err := s.client.Do(ctx, req, repository) + var repository *Repository + resp, err := s.client.Do(req, &repository) if err != nil { return nil, resp, err } @@ -504,7 +506,7 @@ type TeamAddTeamRepoOptions struct { // Permission specifies the permission to grant the team on this repository. // Possible values are: // pull - team members can pull, but not push to or administer this repository - // push - team members can pull and push, but not administer this repository + // push - team members can push and pull, but not administer this repository // admin - team members can pull, push and administer this repository // maintain - team members can manage the repository without access to sensitive or destructive actions. // triage - team members can proactively manage issues and pull requests without write access. @@ -519,34 +521,34 @@ type TeamAddTeamRepoOptions struct { // // Deprecated: Use AddTeamRepoBySlug instead. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#add-or-update-team-repository-permissions +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#add-or-update-team-repository-permissions // //meta:operation PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} func (s *TeamsService) AddTeamRepoByID(ctx context.Context, orgID, teamID int64, owner, repo string, opts *TeamAddTeamRepoOptions) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/repos/%v/%v", orgID, teamID, owner, repo) - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, opts) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // AddTeamRepoBySlug adds a repository to be managed by the specified team given the team slug. // The specified repository must be owned by the organization to which the team // belongs, or a direct fork of a repository owned by the organization. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#add-or-update-team-repository-permissions +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#add-or-update-team-repository-permissions // //meta:operation PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} func (s *TeamsService) AddTeamRepoBySlug(ctx context.Context, org, slug, owner, repo string, opts *TeamAddTeamRepoOptions) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/repos/%v/%v", org, slug, owner, repo) - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, opts) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RemoveTeamRepoByID removes a repository from being managed by the specified @@ -555,39 +557,39 @@ func (s *TeamsService) AddTeamRepoBySlug(ctx context.Context, org, slug, owner, // // Deprecated: Use RemoveTeamRepoBySlug instead. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#remove-a-repository-from-a-team +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#remove-a-repository-from-a-team // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} func (s *TeamsService) RemoveTeamRepoByID(ctx context.Context, orgID, teamID int64, owner, repo string) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/repos/%v/%v", orgID, teamID, owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RemoveTeamRepoBySlug removes a repository from being managed by the specified // team given the team slug. Note that this does not delete the repository, it // just removes it from the team. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#remove-a-repository-from-a-team +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#remove-a-repository-from-a-team // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} func (s *TeamsService) RemoveTeamRepoBySlug(ctx context.Context, org, slug, owner, repo string) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/repos/%v/%v", org, slug, owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListUserTeams lists a user's teams // -// GitHub API docs: https://docs.github.com/rest/teams/teams#list-teams-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#list-teams-for-the-authenticated-user // //meta:operation GET /user/teams func (s *TeamsService) ListUserTeams(ctx context.Context, opts *ListOptions) ([]*Team, *Response, error) { @@ -597,13 +599,13 @@ func (s *TeamsService) ListUserTeams(ctx context.Context, opts *ListOptions) ([] return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var teams []*Team - resp, err := s.client.Do(ctx, req, &teams) + resp, err := s.client.Do(req, &teams) if err != nil { return nil, resp, err } @@ -615,22 +617,21 @@ func (s *TeamsService) ListUserTeams(ctx context.Context, opts *ListOptions) ([] // // Deprecated: Use ListTeamProjectsBySlug instead. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#list-team-projects +// GitHub API docs: https://docs.github.com/enterprise-server@3.16/rest/teams/teams#list-team-projects // //meta:operation GET /orgs/{org}/teams/{team_slug}/projects func (s *TeamsService) ListTeamProjectsByID(ctx context.Context, orgID, teamID int64) ([]*ProjectV2, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/projects", orgID, teamID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) var projects []*ProjectV2 - resp, err := s.client.Do(ctx, req, &projects) + resp, err := s.client.Do(req, &projects) if err != nil { return nil, resp, err } @@ -640,22 +641,21 @@ func (s *TeamsService) ListTeamProjectsByID(ctx context.Context, orgID, teamID i // ListTeamProjectsBySlug lists the organization projects for a team given the team slug. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#list-team-projects +// GitHub API docs: https://docs.github.com/enterprise-server@3.16/rest/teams/teams#list-team-projects // //meta:operation GET /orgs/{org}/teams/{team_slug}/projects func (s *TeamsService) ListTeamProjectsBySlug(ctx context.Context, org, slug string) ([]*ProjectV2, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/projects", org, slug) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) var projects []*ProjectV2 - resp, err := s.client.Do(ctx, req, &projects) + resp, err := s.client.Do(req, &projects) if err != nil { return nil, resp, err } @@ -668,21 +668,20 @@ func (s *TeamsService) ListTeamProjectsBySlug(ctx context.Context, org, slug str // // Deprecated: Use ReviewTeamProjectsBySlug instead. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-project +// GitHub API docs: https://docs.github.com/enterprise-server@3.16/rest/teams/teams#check-team-permissions-for-a-project // //meta:operation GET /orgs/{org}/teams/{team_slug}/projects/{project_id} func (s *TeamsService) ReviewTeamProjectsByID(ctx context.Context, orgID, teamID, projectID int64) (*ProjectV2, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/projects/%v", orgID, teamID, projectID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) - projects := &ProjectV2{} - resp, err := s.client.Do(ctx, req, &projects) + var projects *ProjectV2 + resp, err := s.client.Do(req, &projects) if err != nil { return nil, resp, err } @@ -693,21 +692,20 @@ func (s *TeamsService) ReviewTeamProjectsByID(ctx context.Context, orgID, teamID // ReviewTeamProjectsBySlug checks whether a team, given its slug, has read, write, or admin // permissions for an organization project. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-project +// GitHub API docs: https://docs.github.com/enterprise-server@3.16/rest/teams/teams#check-team-permissions-for-a-project // //meta:operation GET /orgs/{org}/teams/{team_slug}/projects/{project_id} func (s *TeamsService) ReviewTeamProjectsBySlug(ctx context.Context, org, slug string, projectID int64) (*ProjectV2, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/projects/%v", org, slug, projectID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) - projects := &ProjectV2{} - resp, err := s.client.Do(ctx, req, &projects) + var projects *ProjectV2 + resp, err := s.client.Do(req, &projects) if err != nil { return nil, resp, err } @@ -733,40 +731,38 @@ type TeamProjectOptions struct { // // Deprecated: Use AddTeamProjectBySlug instead. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#add-or-update-team-project-permissions +// GitHub API docs: https://docs.github.com/enterprise-server@3.16/rest/teams/teams#add-or-update-team-project-permissions // //meta:operation PUT /orgs/{org}/teams/{team_slug}/projects/{project_id} func (s *TeamsService) AddTeamProjectByID(ctx context.Context, orgID, teamID, projectID int64, opts *TeamProjectOptions) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/projects/%v", orgID, teamID, projectID) - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, opts) if err != nil { return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // AddTeamProjectBySlug adds an organization project to a team given the team slug. // To add a project to a team or update the team's permission on a project, the // authenticated user must have admin permissions for the project. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#add-or-update-team-project-permissions +// GitHub API docs: https://docs.github.com/enterprise-server@3.16/rest/teams/teams#add-or-update-team-project-permissions // //meta:operation PUT /orgs/{org}/teams/{team_slug}/projects/{project_id} func (s *TeamsService) AddTeamProjectBySlug(ctx context.Context, org, slug string, projectID int64, opts *TeamProjectOptions) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/projects/%v", org, slug, projectID) - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, opts) if err != nil { return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RemoveTeamProjectByID removes an organization project from a team given team ID. @@ -778,20 +774,19 @@ func (s *TeamsService) AddTeamProjectBySlug(ctx context.Context, org, slug strin // // Deprecated: Use RemoveTeamProjectBySlug instead. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#remove-a-project-from-a-team +// GitHub API docs: https://docs.github.com/enterprise-server@3.16/rest/teams/teams#remove-a-project-from-a-team // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/projects/{project_id} func (s *TeamsService) RemoveTeamProjectByID(ctx context.Context, orgID, teamID, projectID int64) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/projects/%v", orgID, teamID, projectID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RemoveTeamProjectBySlug removes an organization project from a team given team slug. @@ -801,20 +796,19 @@ func (s *TeamsService) RemoveTeamProjectByID(ctx context.Context, orgID, teamID, // or project. // Note: This endpoint removes the project from the team, but does not delete it. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#remove-a-project-from-a-team +// GitHub API docs: https://docs.github.com/enterprise-server@3.16/rest/teams/teams#remove-a-project-from-a-team // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/projects/{project_id} func (s *TeamsService) RemoveTeamProjectBySlug(ctx context.Context, org, slug string, projectID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/projects/%v", org, slug, projectID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListIDPGroupsOptions specifies the optional parameters to the ListIDPGroupsInOrganization method. @@ -839,7 +833,7 @@ type IDPGroup struct { // ListIDPGroupsInOrganization lists IDP groups available in an organization. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync#list-idp-groups-for-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync?apiVersion=2022-11-28#list-idp-groups-for-an-organization // //meta:operation GET /orgs/{org}/team-sync/groups func (s *TeamsService) ListIDPGroupsInOrganization(ctx context.Context, org string, opts *ListIDPGroupsOptions) (*IDPGroupList, *Response, error) { @@ -849,13 +843,13 @@ func (s *TeamsService) ListIDPGroupsInOrganization(ctx context.Context, org stri return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - groups := new(IDPGroupList) - resp, err := s.client.Do(ctx, req, groups) + var groups *IDPGroupList + resp, err := s.client.Do(req, &groups) if err != nil { return nil, resp, err } @@ -868,19 +862,19 @@ func (s *TeamsService) ListIDPGroupsInOrganization(ctx context.Context, org stri // // Deprecated: Use ListIDPGroupsForTeamBySlug instead. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync#list-idp-groups-for-a-team +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync?apiVersion=2022-11-28#list-idp-groups-for-a-team // //meta:operation GET /orgs/{org}/teams/{team_slug}/team-sync/group-mappings func (s *TeamsService) ListIDPGroupsForTeamByID(ctx context.Context, orgID, teamID int64) (*IDPGroupList, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/team-sync/group-mappings", orgID, teamID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - groups := new(IDPGroupList) - resp, err := s.client.Do(ctx, req, groups) + var groups *IDPGroupList + resp, err := s.client.Do(req, &groups) if err != nil { return nil, resp, err } @@ -891,19 +885,19 @@ func (s *TeamsService) ListIDPGroupsForTeamByID(ctx context.Context, orgID, team // ListIDPGroupsForTeamBySlug lists IDP groups connected to a team on GitHub // given organization name and team slug. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync#list-idp-groups-for-a-team +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync?apiVersion=2022-11-28#list-idp-groups-for-a-team // //meta:operation GET /orgs/{org}/teams/{team_slug}/team-sync/group-mappings func (s *TeamsService) ListIDPGroupsForTeamBySlug(ctx context.Context, org, slug string) (*IDPGroupList, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/team-sync/group-mappings", org, slug) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - groups := new(IDPGroupList) - resp, err := s.client.Do(ctx, req, groups) + var groups *IDPGroupList + resp, err := s.client.Do(req, &groups) if err != nil { return nil, resp, err } @@ -916,19 +910,19 @@ func (s *TeamsService) ListIDPGroupsForTeamBySlug(ctx context.Context, org, slug // // Deprecated: Use CreateOrUpdateIDPGroupConnectionsBySlug instead. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync#create-or-update-idp-group-connections +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync?apiVersion=2022-11-28#create-or-update-idp-group-connections // //meta:operation PATCH /orgs/{org}/teams/{team_slug}/team-sync/group-mappings func (s *TeamsService) CreateOrUpdateIDPGroupConnectionsByID(ctx context.Context, orgID, teamID int64, opts IDPGroupList) (*IDPGroupList, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/team-sync/group-mappings", orgID, teamID) - req, err := s.client.NewRequest("PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, opts) if err != nil { return nil, nil, err } - groups := new(IDPGroupList) - resp, err := s.client.Do(ctx, req, groups) + var groups *IDPGroupList + resp, err := s.client.Do(req, &groups) if err != nil { return nil, resp, err } @@ -939,19 +933,19 @@ func (s *TeamsService) CreateOrUpdateIDPGroupConnectionsByID(ctx context.Context // CreateOrUpdateIDPGroupConnectionsBySlug creates, updates, or removes a connection // between a team and an IDP group given organization name and team slug. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync#create-or-update-idp-group-connections +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync?apiVersion=2022-11-28#create-or-update-idp-group-connections // //meta:operation PATCH /orgs/{org}/teams/{team_slug}/team-sync/group-mappings func (s *TeamsService) CreateOrUpdateIDPGroupConnectionsBySlug(ctx context.Context, org, slug string, opts IDPGroupList) (*IDPGroupList, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/team-sync/group-mappings", org, slug) - req, err := s.client.NewRequest("PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, opts) if err != nil { return nil, nil, err } - groups := new(IDPGroupList) - resp, err := s.client.Do(ctx, req, groups) + var groups *IDPGroupList + resp, err := s.client.Do(req, &groups) if err != nil { return nil, resp, err } @@ -989,18 +983,18 @@ type ExternalGroupList struct { // GetExternalGroup fetches an external group. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups#get-an-external-group +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups?apiVersion=2022-11-28#get-an-external-group // //meta:operation GET /orgs/{org}/external-group/{group_id} func (s *TeamsService) GetExternalGroup(ctx context.Context, org string, groupID int64) (*ExternalGroup, *Response, error) { u := fmt.Sprintf("orgs/%v/external-group/%v", org, groupID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - externalGroup := new(ExternalGroup) - resp, err := s.client.Do(ctx, req, externalGroup) + var externalGroup *ExternalGroup + resp, err := s.client.Do(req, &externalGroup) if err != nil { return nil, resp, err } @@ -1018,7 +1012,7 @@ type ListExternalGroupsOptions struct { // ListExternalGroups lists external groups in an organization on GitHub. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups#list-external-groups-in-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups?apiVersion=2022-11-28#list-external-groups-available-to-an-organization // //meta:operation GET /orgs/{org}/external-groups func (s *TeamsService) ListExternalGroups(ctx context.Context, org string, opts *ListExternalGroupsOptions) (*ExternalGroupList, *Response, error) { @@ -1028,13 +1022,13 @@ func (s *TeamsService) ListExternalGroups(ctx context.Context, org string, opts return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - externalGroups := new(ExternalGroupList) - resp, err := s.client.Do(ctx, req, externalGroups) + var externalGroups *ExternalGroupList + resp, err := s.client.Do(req, &externalGroups) if err != nil { return nil, resp, err } @@ -1044,19 +1038,19 @@ func (s *TeamsService) ListExternalGroups(ctx context.Context, org string, opts // ListExternalGroupsForTeamBySlug lists external groups connected to a team on GitHub. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups#list-a-connection-between-an-external-group-and-a-team +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups?apiVersion=2022-11-28#list-a-connection-between-an-external-group-and-a-team // //meta:operation GET /orgs/{org}/teams/{team_slug}/external-groups func (s *TeamsService) ListExternalGroupsForTeamBySlug(ctx context.Context, org, slug string) (*ExternalGroupList, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/external-groups", org, slug) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - externalGroups := new(ExternalGroupList) - resp, err := s.client.Do(ctx, req, externalGroups) + var externalGroups *ExternalGroupList + resp, err := s.client.Do(req, &externalGroups) if err != nil { return nil, resp, err } @@ -1066,19 +1060,19 @@ func (s *TeamsService) ListExternalGroupsForTeamBySlug(ctx context.Context, org, // UpdateConnectedExternalGroup updates the connection between an external group and a team. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups#update-the-connection-between-an-external-group-and-a-team +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups?apiVersion=2022-11-28#update-the-connection-between-an-external-group-and-a-team // //meta:operation PATCH /orgs/{org}/teams/{team_slug}/external-groups func (s *TeamsService) UpdateConnectedExternalGroup(ctx context.Context, org, slug string, eg *ExternalGroup) (*ExternalGroup, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/external-groups", org, slug) - req, err := s.client.NewRequest("PATCH", u, eg) + req, err := s.client.NewRequest(ctx, "PATCH", u, eg) if err != nil { return nil, nil, err } - externalGroup := new(ExternalGroup) - resp, err := s.client.Do(ctx, req, externalGroup) + var externalGroup *ExternalGroup + resp, err := s.client.Do(req, &externalGroup) if err != nil { return nil, resp, err } @@ -1088,16 +1082,16 @@ func (s *TeamsService) UpdateConnectedExternalGroup(ctx context.Context, org, sl // RemoveConnectedExternalGroup removes the connection between an external group and a team. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups#remove-the-connection-between-an-external-group-and-a-team +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups?apiVersion=2022-11-28#remove-the-connection-between-an-external-group-and-a-team // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/external-groups func (s *TeamsService) RemoveConnectedExternalGroup(ctx context.Context, org, slug string) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/external-groups", org, slug) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/teams_discussion_comments.go b/vendor/github.com/google/go-github/v88/github/teams_discussion_comments.go similarity index 76% rename from vendor/github.com/google/go-github/v73/github/teams_discussion_comments.go rename to vendor/github.com/google/go-github/v88/github/teams_discussion_comments.go index 70bcbbc95..fe9ea1770 100644 --- a/vendor/github.com/google/go-github/v73/github/teams_discussion_comments.go +++ b/vendor/github.com/google/go-github/v88/github/teams_discussion_comments.go @@ -43,7 +43,7 @@ type DiscussionCommentListOptions struct { // ListCommentsByID lists all comments on a team discussion by team ID. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#list-discussion-comments +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussion-comments#list-discussion-comments // //meta:operation GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments func (s *TeamsService) ListCommentsByID(ctx context.Context, orgID, teamID int64, discussionNumber int, options *DiscussionCommentListOptions) ([]*DiscussionComment, *Response, error) { @@ -53,13 +53,13 @@ func (s *TeamsService) ListCommentsByID(ctx context.Context, orgID, teamID int64 return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var comments []*DiscussionComment - resp, err := s.client.Do(ctx, req, &comments) + resp, err := s.client.Do(req, &comments) if err != nil { return nil, resp, err } @@ -70,7 +70,7 @@ func (s *TeamsService) ListCommentsByID(ctx context.Context, orgID, teamID int64 // ListCommentsBySlug lists all comments on a team discussion by team slug. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#list-discussion-comments +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussion-comments#list-discussion-comments // //meta:operation GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments func (s *TeamsService) ListCommentsBySlug(ctx context.Context, org, slug string, discussionNumber int, options *DiscussionCommentListOptions) ([]*DiscussionComment, *Response, error) { @@ -80,13 +80,13 @@ func (s *TeamsService) ListCommentsBySlug(ctx context.Context, org, slug string, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var comments []*DiscussionComment - resp, err := s.client.Do(ctx, req, &comments) + resp, err := s.client.Do(req, &comments) if err != nil { return nil, resp, err } @@ -97,18 +97,18 @@ func (s *TeamsService) ListCommentsBySlug(ctx context.Context, org, slug string, // GetCommentByID gets a specific comment on a team discussion by team ID. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#get-a-discussion-comment +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussion-comments#get-a-discussion-comment // //meta:operation GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} func (s *TeamsService) GetCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber, commentNumber int) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v", orgID, teamID, discussionNumber, commentNumber) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - discussionComment := &DiscussionComment{} - resp, err := s.client.Do(ctx, req, discussionComment) + var discussionComment *DiscussionComment + resp, err := s.client.Do(req, &discussionComment) if err != nil { return nil, resp, err } @@ -119,19 +119,19 @@ func (s *TeamsService) GetCommentByID(ctx context.Context, orgID, teamID int64, // GetCommentBySlug gets a specific comment on a team discussion by team slug. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#get-a-discussion-comment +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussion-comments#get-a-discussion-comment // //meta:operation GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} func (s *TeamsService) GetCommentBySlug(ctx context.Context, org, slug string, discussionNumber, commentNumber int) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v", org, slug, discussionNumber, commentNumber) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - discussionComment := &DiscussionComment{} - resp, err := s.client.Do(ctx, req, discussionComment) + var discussionComment *DiscussionComment + resp, err := s.client.Do(req, &discussionComment) if err != nil { return nil, resp, err } @@ -142,18 +142,18 @@ func (s *TeamsService) GetCommentBySlug(ctx context.Context, org, slug string, d // CreateCommentByID creates a new comment on a team discussion by team ID. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#create-a-discussion-comment +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussion-comments#create-a-discussion-comment // //meta:operation POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments func (s *TeamsService) CreateCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments", orgID, teamID, discussionNumber) - req, err := s.client.NewRequest("POST", u, comment) + req, err := s.client.NewRequest(ctx, "POST", u, comment) if err != nil { return nil, nil, err } - discussionComment := &DiscussionComment{} - resp, err := s.client.Do(ctx, req, discussionComment) + var discussionComment *DiscussionComment + resp, err := s.client.Do(req, &discussionComment) if err != nil { return nil, resp, err } @@ -164,18 +164,18 @@ func (s *TeamsService) CreateCommentByID(ctx context.Context, orgID, teamID int6 // CreateCommentBySlug creates a new comment on a team discussion by team slug. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#create-a-discussion-comment +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussion-comments#create-a-discussion-comment // //meta:operation POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments func (s *TeamsService) CreateCommentBySlug(ctx context.Context, org, slug string, discussionNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments", org, slug, discussionNumber) - req, err := s.client.NewRequest("POST", u, comment) + req, err := s.client.NewRequest(ctx, "POST", u, comment) if err != nil { return nil, nil, err } - discussionComment := &DiscussionComment{} - resp, err := s.client.Do(ctx, req, discussionComment) + var discussionComment *DiscussionComment + resp, err := s.client.Do(req, &discussionComment) if err != nil { return nil, resp, err } @@ -187,18 +187,18 @@ func (s *TeamsService) CreateCommentBySlug(ctx context.Context, org, slug string // Authenticated user must grant write:discussion scope. // User is allowed to edit body of a comment only. // -// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#update-a-discussion-comment +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussion-comments#update-a-discussion-comment // //meta:operation PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} func (s *TeamsService) EditCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber, commentNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v", orgID, teamID, discussionNumber, commentNumber) - req, err := s.client.NewRequest("PATCH", u, comment) + req, err := s.client.NewRequest(ctx, "PATCH", u, comment) if err != nil { return nil, nil, err } - discussionComment := &DiscussionComment{} - resp, err := s.client.Do(ctx, req, discussionComment) + var discussionComment *DiscussionComment + resp, err := s.client.Do(req, &discussionComment) if err != nil { return nil, resp, err } @@ -210,18 +210,18 @@ func (s *TeamsService) EditCommentByID(ctx context.Context, orgID, teamID int64, // Authenticated user must grant write:discussion scope. // User is allowed to edit body of a comment only. // -// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#update-a-discussion-comment +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussion-comments#update-a-discussion-comment // //meta:operation PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} func (s *TeamsService) EditCommentBySlug(ctx context.Context, org, slug string, discussionNumber, commentNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v", org, slug, discussionNumber, commentNumber) - req, err := s.client.NewRequest("PATCH", u, comment) + req, err := s.client.NewRequest(ctx, "PATCH", u, comment) if err != nil { return nil, nil, err } - discussionComment := &DiscussionComment{} - resp, err := s.client.Do(ctx, req, discussionComment) + var discussionComment *DiscussionComment + resp, err := s.client.Do(req, &discussionComment) if err != nil { return nil, resp, err } @@ -232,31 +232,31 @@ func (s *TeamsService) EditCommentBySlug(ctx context.Context, org, slug string, // DeleteCommentByID deletes a comment on a team discussion by team ID. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#delete-a-discussion-comment +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussion-comments#delete-a-discussion-comment // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} func (s *TeamsService) DeleteCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber, commentNumber int) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v", orgID, teamID, discussionNumber, commentNumber) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DeleteCommentBySlug deletes a comment on a team discussion by team slug. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#delete-a-discussion-comment +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussion-comments#delete-a-discussion-comment // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} func (s *TeamsService) DeleteCommentBySlug(ctx context.Context, org, slug string, discussionNumber, commentNumber int) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v", org, slug, discussionNumber, commentNumber) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/teams_discussions.go b/vendor/github.com/google/go-github/v88/github/teams_discussions.go similarity index 77% rename from vendor/github.com/google/go-github/v73/github/teams_discussions.go rename to vendor/github.com/google/go-github/v88/github/teams_discussions.go index b056525f4..224409068 100644 --- a/vendor/github.com/google/go-github/v73/github/teams_discussions.go +++ b/vendor/github.com/google/go-github/v88/github/teams_discussions.go @@ -49,7 +49,7 @@ type DiscussionListOptions struct { // ListDiscussionsByID lists all discussions on team's page given Organization and Team ID. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussions#list-discussions +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussions#list-discussions // //meta:operation GET /orgs/{org}/teams/{team_slug}/discussions func (s *TeamsService) ListDiscussionsByID(ctx context.Context, orgID, teamID int64, opts *DiscussionListOptions) ([]*TeamDiscussion, *Response, error) { @@ -59,13 +59,13 @@ func (s *TeamsService) ListDiscussionsByID(ctx context.Context, orgID, teamID in return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var teamDiscussions []*TeamDiscussion - resp, err := s.client.Do(ctx, req, &teamDiscussions) + resp, err := s.client.Do(req, &teamDiscussions) if err != nil { return nil, resp, err } @@ -76,7 +76,7 @@ func (s *TeamsService) ListDiscussionsByID(ctx context.Context, orgID, teamID in // ListDiscussionsBySlug lists all discussions on team's page given Organization name and Team's slug. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussions#list-discussions +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussions#list-discussions // //meta:operation GET /orgs/{org}/teams/{team_slug}/discussions func (s *TeamsService) ListDiscussionsBySlug(ctx context.Context, org, slug string, opts *DiscussionListOptions) ([]*TeamDiscussion, *Response, error) { @@ -86,13 +86,13 @@ func (s *TeamsService) ListDiscussionsBySlug(ctx context.Context, org, slug stri return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var teamDiscussions []*TeamDiscussion - resp, err := s.client.Do(ctx, req, &teamDiscussions) + resp, err := s.client.Do(req, &teamDiscussions) if err != nil { return nil, resp, err } @@ -103,18 +103,18 @@ func (s *TeamsService) ListDiscussionsBySlug(ctx context.Context, org, slug stri // GetDiscussionByID gets a specific discussion on a team's page given Organization and Team ID. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussions#get-a-discussion +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussions#get-a-discussion // //meta:operation GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} func (s *TeamsService) GetDiscussionByID(ctx context.Context, orgID, teamID int64, discussionNumber int) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v", orgID, teamID, discussionNumber) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - teamDiscussion := &TeamDiscussion{} - resp, err := s.client.Do(ctx, req, teamDiscussion) + var teamDiscussion *TeamDiscussion + resp, err := s.client.Do(req, &teamDiscussion) if err != nil { return nil, resp, err } @@ -125,18 +125,18 @@ func (s *TeamsService) GetDiscussionByID(ctx context.Context, orgID, teamID int6 // GetDiscussionBySlug gets a specific discussion on a team's page given Organization name and Team's slug. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussions#get-a-discussion +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussions#get-a-discussion // //meta:operation GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} func (s *TeamsService) GetDiscussionBySlug(ctx context.Context, org, slug string, discussionNumber int) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v", org, slug, discussionNumber) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - teamDiscussion := &TeamDiscussion{} - resp, err := s.client.Do(ctx, req, teamDiscussion) + var teamDiscussion *TeamDiscussion + resp, err := s.client.Do(req, &teamDiscussion) if err != nil { return nil, resp, err } @@ -147,18 +147,18 @@ func (s *TeamsService) GetDiscussionBySlug(ctx context.Context, org, slug string // CreateDiscussionByID creates a new discussion post on a team's page given Organization and Team ID. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussions#create-a-discussion +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussions#create-a-discussion // //meta:operation POST /orgs/{org}/teams/{team_slug}/discussions func (s *TeamsService) CreateDiscussionByID(ctx context.Context, orgID, teamID int64, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions", orgID, teamID) - req, err := s.client.NewRequest("POST", u, discussion) + req, err := s.client.NewRequest(ctx, "POST", u, discussion) if err != nil { return nil, nil, err } - teamDiscussion := &TeamDiscussion{} - resp, err := s.client.Do(ctx, req, teamDiscussion) + var teamDiscussion *TeamDiscussion + resp, err := s.client.Do(req, &teamDiscussion) if err != nil { return nil, resp, err } @@ -169,18 +169,18 @@ func (s *TeamsService) CreateDiscussionByID(ctx context.Context, orgID, teamID i // CreateDiscussionBySlug creates a new discussion post on a team's page given Organization name and Team's slug. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussions#create-a-discussion +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussions#create-a-discussion // //meta:operation POST /orgs/{org}/teams/{team_slug}/discussions func (s *TeamsService) CreateDiscussionBySlug(ctx context.Context, org, slug string, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions", org, slug) - req, err := s.client.NewRequest("POST", u, discussion) + req, err := s.client.NewRequest(ctx, "POST", u, discussion) if err != nil { return nil, nil, err } - teamDiscussion := &TeamDiscussion{} - resp, err := s.client.Do(ctx, req, teamDiscussion) + var teamDiscussion *TeamDiscussion + resp, err := s.client.Do(req, &teamDiscussion) if err != nil { return nil, resp, err } @@ -192,18 +192,18 @@ func (s *TeamsService) CreateDiscussionBySlug(ctx context.Context, org, slug str // Authenticated user must grant write:discussion scope. // User is allowed to change Title and Body of a discussion only. // -// GitHub API docs: https://docs.github.com/rest/teams/discussions#update-a-discussion +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussions#update-a-discussion // //meta:operation PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} func (s *TeamsService) EditDiscussionByID(ctx context.Context, orgID, teamID int64, discussionNumber int, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v", orgID, teamID, discussionNumber) - req, err := s.client.NewRequest("PATCH", u, discussion) + req, err := s.client.NewRequest(ctx, "PATCH", u, discussion) if err != nil { return nil, nil, err } - teamDiscussion := &TeamDiscussion{} - resp, err := s.client.Do(ctx, req, teamDiscussion) + var teamDiscussion *TeamDiscussion + resp, err := s.client.Do(req, &teamDiscussion) if err != nil { return nil, resp, err } @@ -215,18 +215,18 @@ func (s *TeamsService) EditDiscussionByID(ctx context.Context, orgID, teamID int // Authenticated user must grant write:discussion scope. // User is allowed to change Title and Body of a discussion only. // -// GitHub API docs: https://docs.github.com/rest/teams/discussions#update-a-discussion +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussions#update-a-discussion // //meta:operation PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} func (s *TeamsService) EditDiscussionBySlug(ctx context.Context, org, slug string, discussionNumber int, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v", org, slug, discussionNumber) - req, err := s.client.NewRequest("PATCH", u, discussion) + req, err := s.client.NewRequest(ctx, "PATCH", u, discussion) if err != nil { return nil, nil, err } - teamDiscussion := &TeamDiscussion{} - resp, err := s.client.Do(ctx, req, teamDiscussion) + var teamDiscussion *TeamDiscussion + resp, err := s.client.Do(req, &teamDiscussion) if err != nil { return nil, resp, err } @@ -237,31 +237,31 @@ func (s *TeamsService) EditDiscussionBySlug(ctx context.Context, org, slug strin // DeleteDiscussionByID deletes a discussion from team's page given Organization and Team ID. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussions#delete-a-discussion +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussions#delete-a-discussion // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} func (s *TeamsService) DeleteDiscussionByID(ctx context.Context, orgID, teamID int64, discussionNumber int) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v", orgID, teamID, discussionNumber) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DeleteDiscussionBySlug deletes a discussion from team's page given Organization name and Team's slug. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussions#delete-a-discussion +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussions#delete-a-discussion // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} func (s *TeamsService) DeleteDiscussionBySlug(ctx context.Context, org, slug string, discussionNumber int) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v", org, slug, discussionNumber) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/teams_members.go b/vendor/github.com/google/go-github/v88/github/teams_members.go similarity index 75% rename from vendor/github.com/google/go-github/v73/github/teams_members.go rename to vendor/github.com/google/go-github/v88/github/teams_members.go index 059d993a3..bbea68504 100644 --- a/vendor/github.com/google/go-github/v73/github/teams_members.go +++ b/vendor/github.com/google/go-github/v88/github/teams_members.go @@ -23,7 +23,7 @@ type TeamListTeamMembersOptions struct { // ListTeamMembersByID lists all of the users who are members of a team, given a specified // organization ID, by team ID. // -// GitHub API docs: https://docs.github.com/rest/teams/members#list-team-members +// GitHub API docs: https://docs.github.com/rest/teams/members?apiVersion=2022-11-28#list-team-members // //meta:operation GET /orgs/{org}/teams/{team_slug}/members func (s *TeamsService) ListTeamMembersByID(ctx context.Context, orgID, teamID int64, opts *TeamListTeamMembersOptions) ([]*User, *Response, error) { @@ -33,13 +33,13 @@ func (s *TeamsService) ListTeamMembersByID(ctx context.Context, orgID, teamID in return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var members []*User - resp, err := s.client.Do(ctx, req, &members) + resp, err := s.client.Do(req, &members) if err != nil { return nil, resp, err } @@ -50,7 +50,7 @@ func (s *TeamsService) ListTeamMembersByID(ctx context.Context, orgID, teamID in // ListTeamMembersBySlug lists all of the users who are members of a team, given a specified // organization name, by team slug. // -// GitHub API docs: https://docs.github.com/rest/teams/members#list-team-members +// GitHub API docs: https://docs.github.com/rest/teams/members?apiVersion=2022-11-28#list-team-members // //meta:operation GET /orgs/{org}/teams/{team_slug}/members func (s *TeamsService) ListTeamMembersBySlug(ctx context.Context, org, slug string, opts *TeamListTeamMembersOptions) ([]*User, *Response, error) { @@ -60,13 +60,13 @@ func (s *TeamsService) ListTeamMembersBySlug(ctx context.Context, org, slug stri return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var members []*User - resp, err := s.client.Do(ctx, req, &members) + resp, err := s.client.Do(req, &members) if err != nil { return nil, resp, err } @@ -77,18 +77,18 @@ func (s *TeamsService) ListTeamMembersBySlug(ctx context.Context, org, slug stri // GetTeamMembershipByID returns the membership status for a user in a team, given a specified // organization ID, by team ID. // -// GitHub API docs: https://docs.github.com/rest/teams/members#list-team-members +// GitHub API docs: https://docs.github.com/rest/teams/members?apiVersion=2022-11-28#list-team-members // //meta:operation GET /orgs/{org}/teams/{team_slug}/members func (s *TeamsService) GetTeamMembershipByID(ctx context.Context, orgID, teamID int64, user string) (*Membership, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/memberships/%v", orgID, teamID, user) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - t := new(Membership) - resp, err := s.client.Do(ctx, req, t) + var t *Membership + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } @@ -99,18 +99,18 @@ func (s *TeamsService) GetTeamMembershipByID(ctx context.Context, orgID, teamID // GetTeamMembershipBySlug returns the membership status for a user in a team, given a specified // organization name, by team slug. // -// GitHub API docs: https://docs.github.com/rest/teams/members#get-team-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/teams/members?apiVersion=2022-11-28#get-team-membership-for-a-user // //meta:operation GET /orgs/{org}/teams/{team_slug}/memberships/{username} func (s *TeamsService) GetTeamMembershipBySlug(ctx context.Context, org, slug, user string) (*Membership, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/memberships/%v", org, slug, user) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - t := new(Membership) - resp, err := s.client.Do(ctx, req, t) + var t *Membership + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } @@ -135,18 +135,18 @@ type TeamAddTeamMembershipOptions struct { // AddTeamMembershipByID adds or invites a user to a team, given a specified // organization ID, by team ID. // -// GitHub API docs: https://docs.github.com/rest/teams/members#add-or-update-team-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/teams/members?apiVersion=2022-11-28#add-or-update-team-membership-for-a-user // //meta:operation PUT /orgs/{org}/teams/{team_slug}/memberships/{username} func (s *TeamsService) AddTeamMembershipByID(ctx context.Context, orgID, teamID int64, user string, opts *TeamAddTeamMembershipOptions) (*Membership, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/memberships/%v", orgID, teamID, user) - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, opts) if err != nil { return nil, nil, err } - t := new(Membership) - resp, err := s.client.Do(ctx, req, t) + var t *Membership + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } @@ -157,18 +157,18 @@ func (s *TeamsService) AddTeamMembershipByID(ctx context.Context, orgID, teamID // AddTeamMembershipBySlug adds or invites a user to a team, given a specified // organization name, by team slug. // -// GitHub API docs: https://docs.github.com/rest/teams/members#add-or-update-team-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/teams/members?apiVersion=2022-11-28#add-or-update-team-membership-for-a-user // //meta:operation PUT /orgs/{org}/teams/{team_slug}/memberships/{username} func (s *TeamsService) AddTeamMembershipBySlug(ctx context.Context, org, slug, user string, opts *TeamAddTeamMembershipOptions) (*Membership, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/memberships/%v", org, slug, user) - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, opts) if err != nil { return nil, nil, err } - t := new(Membership) - resp, err := s.client.Do(ctx, req, t) + var t *Membership + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } @@ -179,39 +179,39 @@ func (s *TeamsService) AddTeamMembershipBySlug(ctx context.Context, org, slug, u // RemoveTeamMembershipByID removes a user from a team, given a specified // organization ID, by team ID. // -// GitHub API docs: https://docs.github.com/rest/teams/members#remove-team-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/teams/members?apiVersion=2022-11-28#remove-team-membership-for-a-user // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/memberships/{username} func (s *TeamsService) RemoveTeamMembershipByID(ctx context.Context, orgID, teamID int64, user string) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/memberships/%v", orgID, teamID, user) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RemoveTeamMembershipBySlug removes a user from a team, given a specified // organization name, by team slug. // -// GitHub API docs: https://docs.github.com/rest/teams/members#remove-team-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/teams/members?apiVersion=2022-11-28#remove-team-membership-for-a-user // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/memberships/{username} func (s *TeamsService) RemoveTeamMembershipBySlug(ctx context.Context, org, slug, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/memberships/%v", org, slug, user) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListPendingTeamInvitationsByID gets pending invitation list of a team, given a specified // organization ID, by team ID. // -// GitHub API docs: https://docs.github.com/rest/teams/members#list-pending-team-invitations +// GitHub API docs: https://docs.github.com/rest/teams/members?apiVersion=2022-11-28#list-pending-team-invitations // //meta:operation GET /orgs/{org}/teams/{team_slug}/invitations func (s *TeamsService) ListPendingTeamInvitationsByID(ctx context.Context, orgID, teamID int64, opts *ListOptions) ([]*Invitation, *Response, error) { @@ -221,13 +221,13 @@ func (s *TeamsService) ListPendingTeamInvitationsByID(ctx context.Context, orgID return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var pendingInvitations []*Invitation - resp, err := s.client.Do(ctx, req, &pendingInvitations) + resp, err := s.client.Do(req, &pendingInvitations) if err != nil { return nil, resp, err } @@ -238,7 +238,7 @@ func (s *TeamsService) ListPendingTeamInvitationsByID(ctx context.Context, orgID // ListPendingTeamInvitationsBySlug get pending invitation list of a team, given a specified // organization name, by team slug. // -// GitHub API docs: https://docs.github.com/rest/teams/members#list-pending-team-invitations +// GitHub API docs: https://docs.github.com/rest/teams/members?apiVersion=2022-11-28#list-pending-team-invitations // //meta:operation GET /orgs/{org}/teams/{team_slug}/invitations func (s *TeamsService) ListPendingTeamInvitationsBySlug(ctx context.Context, org, slug string, opts *ListOptions) ([]*Invitation, *Response, error) { @@ -248,13 +248,13 @@ func (s *TeamsService) ListPendingTeamInvitationsBySlug(ctx context.Context, org return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var pendingInvitations []*Invitation - resp, err := s.client.Do(ctx, req, &pendingInvitations) + resp, err := s.client.Do(req, &pendingInvitations) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/timestamp.go b/vendor/github.com/google/go-github/v88/github/timestamp.go similarity index 99% rename from vendor/github.com/google/go-github/v73/github/timestamp.go rename to vendor/github.com/google/go-github/v88/github/timestamp.go index 71660193b..a26077da2 100644 --- a/vendor/github.com/google/go-github/v73/github/timestamp.go +++ b/vendor/github.com/google/go-github/v88/github/timestamp.go @@ -43,7 +43,7 @@ func (t *Timestamp) UnmarshalJSON(data []byte) (err error) { } else { t.Time, err = time.Parse(`"`+time.RFC3339+`"`, str) } - return + return err } // Equal reports whether t and u are equal based on time.Equal. diff --git a/vendor/github.com/google/go-github/v88/github/url.go b/vendor/github.com/google/go-github/v88/github/url.go new file mode 100644 index 000000000..f0411dccc --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/url.go @@ -0,0 +1,33 @@ +// Copyright 2026 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "errors" + "fmt" + "net/url" + "strings" +) + +// parseURL parses the given string as a URL and ensures that the path ends +// with a slash. If the input string is empty, it returns an error. If the URL +// cannot be parsed, it returns the parsing error. +func parseURL(s string) (*url.URL, error) { + if s == "" { + return nil, errors.New("url cannot be empty") + } + + u, err := url.Parse(s) + if err != nil { + return nil, fmt.Errorf("invalid url: %w", err) + } + + if !strings.HasSuffix(u.Path, "/") { + u.Path += "/" + } + + return u, nil +} diff --git a/vendor/github.com/google/go-github/v73/github/users.go b/vendor/github.com/google/go-github/v88/github/users.go similarity index 78% rename from vendor/github.com/google/go-github/v73/github/users.go rename to vendor/github.com/google/go-github/v88/github/users.go index 28db59c5e..00108a9ba 100644 --- a/vendor/github.com/google/go-github/v73/github/users.go +++ b/vendor/github.com/google/go-github/v88/github/users.go @@ -13,13 +13,14 @@ import ( // UsersService handles communication with the user related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/users/ +// GitHub API docs: https://docs.github.com/rest/users?apiVersion=2022-11-28 type UsersService service // User represents a GitHub user. type User struct { Login *string `json:"login,omitempty"` ID *int64 `json:"id,omitempty"` + UserViewType *string `json:"user_view_type,omitempty"` NodeID *string `json:"node_id,omitempty"` AvatarURL *string `json:"avatar_url,omitempty"` HTMLURL *string `json:"html_url,omitempty"` @@ -29,6 +30,7 @@ type User struct { Blog *string `json:"blog,omitempty"` Location *string `json:"location,omitempty"` Email *string `json:"email,omitempty"` + NotificationEmail *string `json:"notification_email,omitempty"` Hireable *bool `json:"hireable,omitempty"` Bio *string `json:"bio,omitempty"` TwitterUsername *string `json:"twitter_username,omitempty"` @@ -48,6 +50,7 @@ type User struct { Collaborators *int `json:"collaborators,omitempty"` TwoFactorAuthentication *bool `json:"two_factor_authentication,omitempty"` Plan *Plan `json:"plan,omitempty"` + BusinessPlus *bool `json:"business_plus,omitempty"` LdapDn *string `json:"ldap_dn,omitempty"` // API URLs @@ -63,13 +66,13 @@ type User struct { SubscriptionsURL *string `json:"subscriptions_url,omitempty"` // TextMatches is only populated from search results that request text matches - // See: search.go and https://docs.github.com/rest/search/#text-match-metadata + // See: search.go and https://docs.github.com/rest/search?apiVersion=2022-11-28#text-match-metadata TextMatches []*TextMatch `json:"text_matches,omitempty"` // Permissions and RoleName identify the permissions and role that a user has on a given // repository. These are only populated when calling Repositories.ListCollaborators. - Permissions map[string]bool `json:"permissions,omitempty"` - RoleName *string `json:"role_name,omitempty"` + Permissions *RepositoryPermissions `json:"permissions,omitempty"` + RoleName *string `json:"role_name,omitempty"` // Assignment identifies how a user was assigned to an organization role. Its // possible values are: "direct", "indirect", "mixed". This is only populated when @@ -87,8 +90,9 @@ func (u User) String() string { // Get fetches a user. Passing the empty string will fetch the authenticated // user. // -// GitHub API docs: https://docs.github.com/rest/users/users#get-a-user -// GitHub API docs: https://docs.github.com/rest/users/users#get-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/users?apiVersion=2022-11-28#get-a-user +// +// GitHub API docs: https://docs.github.com/rest/users/users?apiVersion=2022-11-28#get-the-authenticated-user // //meta:operation GET /user //meta:operation GET /users/{username} @@ -99,13 +103,13 @@ func (s *UsersService) Get(ctx context.Context, user string) (*User, *Response, } else { u = "user" } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - uResp := new(User) - resp, err := s.client.Do(ctx, req, uResp) + var uResp *User + resp, err := s.client.Do(req, &uResp) if err != nil { return nil, resp, err } @@ -115,18 +119,18 @@ func (s *UsersService) Get(ctx context.Context, user string) (*User, *Response, // GetByID fetches a user. // -// GitHub API docs: https://docs.github.com/rest/users/users#get-a-user-using-their-id +// GitHub API docs: https://docs.github.com/rest/users/users?apiVersion=2022-11-28#get-a-user-using-their-id // //meta:operation GET /user/{account_id} func (s *UsersService) GetByID(ctx context.Context, id int64) (*User, *Response, error) { - u := fmt.Sprintf("user/%d", id) - req, err := s.client.NewRequest("GET", u, nil) + u := fmt.Sprintf("user/%v", id) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - user := new(User) - resp, err := s.client.Do(ctx, req, user) + var user *User + resp, err := s.client.Do(req, &user) if err != nil { return nil, resp, err } @@ -136,18 +140,18 @@ func (s *UsersService) GetByID(ctx context.Context, id int64) (*User, *Response, // Edit the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/users#update-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/users?apiVersion=2022-11-28#update-the-authenticated-user // //meta:operation PATCH /user func (s *UsersService) Edit(ctx context.Context, user *User) (*User, *Response, error) { u := "user" - req, err := s.client.NewRequest("PATCH", u, user) + req, err := s.client.NewRequest(ctx, "PATCH", u, user) if err != nil { return nil, nil, err } - uResp := new(User) - resp, err := s.client.Do(ctx, req, uResp) + var uResp *User + resp, err := s.client.Do(req, &uResp) if err != nil { return nil, resp, err } @@ -180,7 +184,7 @@ type UserContext struct { // GetHovercard fetches contextual information about user. It requires authentication // via Basic Auth or via OAuth with the repo scope. // -// GitHub API docs: https://docs.github.com/rest/users/users#get-contextual-information-for-a-user +// GitHub API docs: https://docs.github.com/rest/users/users?apiVersion=2022-11-28#get-contextual-information-for-a-user // //meta:operation GET /users/{username}/hovercard func (s *UsersService) GetHovercard(ctx context.Context, user string, opts *HovercardOptions) (*Hovercard, *Response, error) { @@ -190,13 +194,13 @@ func (s *UsersService) GetHovercard(ctx context.Context, user string, opts *Hove return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - hc := new(Hovercard) - resp, err := s.client.Do(ctx, req, hc) + var hc *Hovercard + resp, err := s.client.Do(req, &hc) if err != nil { return nil, resp, err } @@ -207,20 +211,16 @@ func (s *UsersService) GetHovercard(ctx context.Context, user string, opts *Hove // UserListOptions specifies optional parameters to the UsersService.ListAll // method. type UserListOptions struct { - // ID of the last user seen - Since int64 `url:"since,omitempty"` - - // Note: Pagination is powered exclusively by the Since parameter, - // ListOptions.Page has no effect. - // ListOptions.PerPage controls an undocumented GitHub API parameter. - ListOptions + // A user ID. Only return users with an ID greater than this ID. + Since int64 `url:"since,omitempty"` + PerPage int `url:"per_page,omitempty"` } // ListAll lists all GitHub users. // // To paginate through all users, populate 'Since' with the ID of the last user. // -// GitHub API docs: https://docs.github.com/rest/users/users#list-users +// GitHub API docs: https://docs.github.com/rest/users/users?apiVersion=2022-11-28#list-users // //meta:operation GET /users func (s *UsersService) ListAll(ctx context.Context, opts *UserListOptions) ([]*User, *Response, error) { @@ -229,13 +229,13 @@ func (s *UsersService) ListAll(ctx context.Context, opts *UserListOptions) ([]*U return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var users []*User - resp, err := s.client.Do(ctx, req, &users) + resp, err := s.client.Do(req, &users) if err != nil { return nil, resp, err } @@ -246,7 +246,7 @@ func (s *UsersService) ListAll(ctx context.Context, opts *UserListOptions) ([]*U // ListInvitations lists all currently-open repository invitations for the // authenticated user. // -// GitHub API docs: https://docs.github.com/rest/collaborators/invitations#list-repository-invitations-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/collaborators/invitations?apiVersion=2022-11-28#list-repository-invitations-for-the-authenticated-user // //meta:operation GET /user/repository_invitations func (s *UsersService) ListInvitations(ctx context.Context, opts *ListOptions) ([]*RepositoryInvitation, *Response, error) { @@ -255,13 +255,13 @@ func (s *UsersService) ListInvitations(ctx context.Context, opts *ListOptions) ( return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } invites := []*RepositoryInvitation{} - resp, err := s.client.Do(ctx, req, &invites) + resp, err := s.client.Do(req, &invites) if err != nil { return nil, resp, err } @@ -272,31 +272,31 @@ func (s *UsersService) ListInvitations(ctx context.Context, opts *ListOptions) ( // AcceptInvitation accepts the currently-open repository invitation for the // authenticated user. // -// GitHub API docs: https://docs.github.com/rest/collaborators/invitations#accept-a-repository-invitation +// GitHub API docs: https://docs.github.com/rest/collaborators/invitations?apiVersion=2022-11-28#accept-a-repository-invitation // //meta:operation PATCH /user/repository_invitations/{invitation_id} func (s *UsersService) AcceptInvitation(ctx context.Context, invitationID int64) (*Response, error) { u := fmt.Sprintf("user/repository_invitations/%v", invitationID) - req, err := s.client.NewRequest("PATCH", u, nil) + req, err := s.client.NewRequest(ctx, "PATCH", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DeclineInvitation declines the currently-open repository invitation for the // authenticated user. // -// GitHub API docs: https://docs.github.com/rest/collaborators/invitations#decline-a-repository-invitation +// GitHub API docs: https://docs.github.com/rest/collaborators/invitations?apiVersion=2022-11-28#decline-a-repository-invitation // //meta:operation DELETE /user/repository_invitations/{invitation_id} func (s *UsersService) DeclineInvitation(ctx context.Context, invitationID int64) (*Response, error) { u := fmt.Sprintf("user/repository_invitations/%v", invitationID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/users_administration.go b/vendor/github.com/google/go-github/v88/github/users_administration.go similarity index 74% rename from vendor/github.com/google/go-github/v73/github/users_administration.go rename to vendor/github.com/google/go-github/v88/github/users_administration.go index 5d0d4c15e..2f09e408a 100644 --- a/vendor/github.com/google/go-github/v73/github/users_administration.go +++ b/vendor/github.com/google/go-github/v88/github/users_administration.go @@ -12,69 +12,69 @@ import ( // PromoteSiteAdmin promotes a user to a site administrator of a GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/users#promote-a-user-to-be-a-site-administrator +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/users#promote-a-user-to-be-a-site-administrator // //meta:operation PUT /users/{username}/site_admin func (s *UsersService) PromoteSiteAdmin(ctx context.Context, user string) (*Response, error) { u := fmt.Sprintf("users/%v/site_admin", user) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DemoteSiteAdmin demotes a user from site administrator of a GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/users#demote-a-site-administrator +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/users#demote-a-site-administrator // //meta:operation DELETE /users/{username}/site_admin func (s *UsersService) DemoteSiteAdmin(ctx context.Context, user string) (*Response, error) { u := fmt.Sprintf("users/%v/site_admin", user) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } -// UserSuspendOptions represents the reason a user is being suspended. +// UserSuspendOptions represents the reason to suspend a user. type UserSuspendOptions struct { Reason *string `json:"reason,omitempty"` } // Suspend a user on a GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/users#suspend-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/users#suspend-a-user // //meta:operation PUT /users/{username}/suspended func (s *UsersService) Suspend(ctx context.Context, user string, opts *UserSuspendOptions) (*Response, error) { u := fmt.Sprintf("users/%v/suspended", user) - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, opts) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // Unsuspend a user on a GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/users#unsuspend-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/users#unsuspend-a-user // //meta:operation DELETE /users/{username}/suspended func (s *UsersService) Unsuspend(ctx context.Context, user string) (*Response, error) { u := fmt.Sprintf("users/%v/suspended", user) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/users_attestations.go b/vendor/github.com/google/go-github/v88/github/users_attestations.go similarity index 81% rename from vendor/github.com/google/go-github/v73/github/users_attestations.go rename to vendor/github.com/google/go-github/v88/github/users_attestations.go index 18f60298d..23200cad3 100644 --- a/vendor/github.com/google/go-github/v73/github/users_attestations.go +++ b/vendor/github.com/google/go-github/v88/github/users_attestations.go @@ -14,24 +14,24 @@ import ( // with a given subject digest that are associated with repositories // owned by a user. // -// GitHub API docs: https://docs.github.com/rest/users/attestations#list-attestations +// GitHub API docs: https://docs.github.com/rest/users/attestations?apiVersion=2022-11-28#list-attestations // //meta:operation GET /users/{username}/attestations/{subject_digest} func (s *UsersService) ListAttestations(ctx context.Context, user, subjectDigest string, opts *ListOptions) (*AttestationsResponse, *Response, error) { - var u = fmt.Sprintf("users/%v/attestations/%v", user, subjectDigest) + u := fmt.Sprintf("users/%v/attestations/%v", user, subjectDigest) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var attestations *AttestationsResponse - res, err := s.client.Do(ctx, req, &attestations) + res, err := s.client.Do(req, &attestations) if err != nil { return nil, res, err } diff --git a/vendor/github.com/google/go-github/v73/github/users_blocking.go b/vendor/github.com/google/go-github/v88/github/users_blocking.go similarity index 65% rename from vendor/github.com/google/go-github/v73/github/users_blocking.go rename to vendor/github.com/google/go-github/v88/github/users_blocking.go index 3f2af38f6..9fa4da631 100644 --- a/vendor/github.com/google/go-github/v73/github/users_blocking.go +++ b/vendor/github.com/google/go-github/v88/github/users_blocking.go @@ -12,7 +12,7 @@ import ( // ListBlockedUsers lists all the blocked users by the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/blocking#list-users-blocked-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/blocking?apiVersion=2022-11-28#list-users-blocked-by-the-authenticated-user // //meta:operation GET /user/blocks func (s *UsersService) ListBlockedUsers(ctx context.Context, opts *ListOptions) ([]*User, *Response, error) { @@ -22,16 +22,15 @@ func (s *UsersService) ListBlockedUsers(ctx context.Context, opts *ListOptions) return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeBlockUsersPreview) var blockedUsers []*User - resp, err := s.client.Do(ctx, req, &blockedUsers) + resp, err := s.client.Do(req, &blockedUsers) if err != nil { return nil, resp, err } @@ -41,59 +40,56 @@ func (s *UsersService) ListBlockedUsers(ctx context.Context, opts *ListOptions) // IsBlocked reports whether specified user is blocked by the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/blocking#check-if-a-user-is-blocked-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/blocking?apiVersion=2022-11-28#check-if-a-user-is-blocked-by-the-authenticated-user // //meta:operation GET /user/blocks/{username} func (s *UsersService) IsBlocked(ctx context.Context, user string) (bool, *Response, error) { u := fmt.Sprintf("user/blocks/%v", user) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return false, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeBlockUsersPreview) - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) isBlocked, err := parseBoolResponse(err) return isBlocked, resp, err } // BlockUser blocks specified user for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/blocking#block-a-user +// GitHub API docs: https://docs.github.com/rest/users/blocking?apiVersion=2022-11-28#block-a-user // //meta:operation PUT /user/blocks/{username} func (s *UsersService) BlockUser(ctx context.Context, user string) (*Response, error) { u := fmt.Sprintf("user/blocks/%v", user) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeBlockUsersPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // UnblockUser unblocks specified user for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/blocking#unblock-a-user +// GitHub API docs: https://docs.github.com/rest/users/blocking?apiVersion=2022-11-28#unblock-a-user // //meta:operation DELETE /user/blocks/{username} func (s *UsersService) UnblockUser(ctx context.Context, user string) (*Response, error) { u := fmt.Sprintf("user/blocks/%v", user) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeBlockUsersPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/users_emails.go b/vendor/github.com/google/go-github/v88/github/users_emails.go similarity index 69% rename from vendor/github.com/google/go-github/v73/github/users_emails.go rename to vendor/github.com/google/go-github/v88/github/users_emails.go index 3d0e1bfaa..33e0f261c 100644 --- a/vendor/github.com/google/go-github/v73/github/users_emails.go +++ b/vendor/github.com/google/go-github/v88/github/users_emails.go @@ -17,7 +17,7 @@ type UserEmail struct { // ListEmails lists all email addresses for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/emails#list-email-addresses-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/emails?apiVersion=2022-11-28#list-email-addresses-for-the-authenticated-user // //meta:operation GET /user/emails func (s *UsersService) ListEmails(ctx context.Context, opts *ListOptions) ([]*UserEmail, *Response, error) { @@ -27,13 +27,13 @@ func (s *UsersService) ListEmails(ctx context.Context, opts *ListOptions) ([]*Us return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var emails []*UserEmail - resp, err := s.client.Do(ctx, req, &emails) + resp, err := s.client.Do(req, &emails) if err != nil { return nil, resp, err } @@ -43,18 +43,18 @@ func (s *UsersService) ListEmails(ctx context.Context, opts *ListOptions) ([]*Us // AddEmails adds email addresses of the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/emails#add-an-email-address-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/emails?apiVersion=2022-11-28#add-an-email-address-for-the-authenticated-user // //meta:operation POST /user/emails func (s *UsersService) AddEmails(ctx context.Context, emails []string) ([]*UserEmail, *Response, error) { u := "user/emails" - req, err := s.client.NewRequest("POST", u, emails) + req, err := s.client.NewRequest(ctx, "POST", u, emails) if err != nil { return nil, nil, err } var e []*UserEmail - resp, err := s.client.Do(ctx, req, &e) + resp, err := s.client.Do(req, &e) if err != nil { return nil, resp, err } @@ -64,23 +64,23 @@ func (s *UsersService) AddEmails(ctx context.Context, emails []string) ([]*UserE // DeleteEmails deletes email addresses from authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/emails#delete-an-email-address-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/emails?apiVersion=2022-11-28#delete-an-email-address-for-the-authenticated-user // //meta:operation DELETE /user/emails func (s *UsersService) DeleteEmails(ctx context.Context, emails []string) (*Response, error) { u := "user/emails" - req, err := s.client.NewRequest("DELETE", u, emails) + req, err := s.client.NewRequest(ctx, "DELETE", u, emails) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // SetEmailVisibility sets the visibility for the primary email address of the authenticated user. // `visibility` can be "private" or "public". // -// GitHub API docs: https://docs.github.com/rest/users/emails#set-primary-email-visibility-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/emails?apiVersion=2022-11-28#set-primary-email-visibility-for-the-authenticated-user // //meta:operation PATCH /user/email/visibility func (s *UsersService) SetEmailVisibility(ctx context.Context, visibility string) ([]*UserEmail, *Response, error) { @@ -90,13 +90,13 @@ func (s *UsersService) SetEmailVisibility(ctx context.Context, visibility string Visibility: &visibility, } - req, err := s.client.NewRequest("PATCH", u, updateVisibilityReq) + req, err := s.client.NewRequest(ctx, "PATCH", u, updateVisibilityReq) if err != nil { return nil, nil, err } var e []*UserEmail - resp, err := s.client.Do(ctx, req, &e) + resp, err := s.client.Do(req, &e) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v73/github/users_followers.go b/vendor/github.com/google/go-github/v88/github/users_followers.go similarity index 78% rename from vendor/github.com/google/go-github/v73/github/users_followers.go rename to vendor/github.com/google/go-github/v88/github/users_followers.go index ec6f531ea..4543cb8ec 100644 --- a/vendor/github.com/google/go-github/v73/github/users_followers.go +++ b/vendor/github.com/google/go-github/v88/github/users_followers.go @@ -13,8 +13,9 @@ import ( // ListFollowers lists the followers for a user. Passing the empty string will // fetch followers for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/followers#list-followers-of-a-user -// GitHub API docs: https://docs.github.com/rest/users/followers#list-followers-of-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/followers?apiVersion=2022-11-28#list-followers-of-a-user +// +// GitHub API docs: https://docs.github.com/rest/users/followers?apiVersion=2022-11-28#list-followers-of-the-authenticated-user // //meta:operation GET /user/followers //meta:operation GET /users/{username}/followers @@ -30,13 +31,13 @@ func (s *UsersService) ListFollowers(ctx context.Context, user string, opts *Lis return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var users []*User - resp, err := s.client.Do(ctx, req, &users) + resp, err := s.client.Do(req, &users) if err != nil { return nil, resp, err } @@ -47,8 +48,9 @@ func (s *UsersService) ListFollowers(ctx context.Context, user string, opts *Lis // ListFollowing lists the people that a user is following. Passing the empty // string will list people the authenticated user is following. // -// GitHub API docs: https://docs.github.com/rest/users/followers#list-the-people-a-user-follows -// GitHub API docs: https://docs.github.com/rest/users/followers#list-the-people-the-authenticated-user-follows +// GitHub API docs: https://docs.github.com/rest/users/followers?apiVersion=2022-11-28#list-the-people-a-user-follows +// +// GitHub API docs: https://docs.github.com/rest/users/followers?apiVersion=2022-11-28#list-the-people-the-authenticated-user-follows // //meta:operation GET /user/following //meta:operation GET /users/{username}/following @@ -64,13 +66,13 @@ func (s *UsersService) ListFollowing(ctx context.Context, user string, opts *Lis return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var users []*User - resp, err := s.client.Do(ctx, req, &users) + resp, err := s.client.Do(req, &users) if err != nil { return nil, resp, err } @@ -81,8 +83,9 @@ func (s *UsersService) ListFollowing(ctx context.Context, user string, opts *Lis // IsFollowing checks if "user" is following "target". Passing the empty // string for "user" will check if the authenticated user is following "target". // -// GitHub API docs: https://docs.github.com/rest/users/followers#check-if-a-person-is-followed-by-the-authenticated-user -// GitHub API docs: https://docs.github.com/rest/users/followers#check-if-a-user-follows-another-user +// GitHub API docs: https://docs.github.com/rest/users/followers?apiVersion=2022-11-28#check-if-a-person-is-followed-by-the-authenticated-user +// +// GitHub API docs: https://docs.github.com/rest/users/followers?apiVersion=2022-11-28#check-if-a-user-follows-another-user // //meta:operation GET /user/following/{username} //meta:operation GET /users/{username}/following/{target_user} @@ -94,42 +97,42 @@ func (s *UsersService) IsFollowing(ctx context.Context, user, target string) (bo u = fmt.Sprintf("user/following/%v", target) } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return false, nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) following, err := parseBoolResponse(err) return following, resp, err } // Follow will cause the authenticated user to follow the specified user. // -// GitHub API docs: https://docs.github.com/rest/users/followers#follow-a-user +// GitHub API docs: https://docs.github.com/rest/users/followers?apiVersion=2022-11-28#follow-a-user // //meta:operation PUT /user/following/{username} func (s *UsersService) Follow(ctx context.Context, user string) (*Response, error) { u := fmt.Sprintf("user/following/%v", user) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // Unfollow will cause the authenticated user to unfollow the specified user. // -// GitHub API docs: https://docs.github.com/rest/users/followers#unfollow-a-user +// GitHub API docs: https://docs.github.com/rest/users/followers?apiVersion=2022-11-28#unfollow-a-user // //meta:operation DELETE /user/following/{username} func (s *UsersService) Unfollow(ctx context.Context, user string) (*Response, error) { u := fmt.Sprintf("user/following/%v", user) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/users_gpg_keys.go b/vendor/github.com/google/go-github/v88/github/users_gpg_keys.go similarity index 77% rename from vendor/github.com/google/go-github/v73/github/users_gpg_keys.go rename to vendor/github.com/google/go-github/v88/github/users_gpg_keys.go index 2f296a1ef..f22ab81b2 100644 --- a/vendor/github.com/google/go-github/v73/github/users_gpg_keys.go +++ b/vendor/github.com/google/go-github/v88/github/users_gpg_keys.go @@ -44,8 +44,9 @@ type GPGEmail struct { // string will fetch keys for the authenticated user. It requires authentication // via Basic Auth or via OAuth with at least read:gpg_key scope. // -// GitHub API docs: https://docs.github.com/rest/users/gpg-keys#list-gpg-keys-for-a-user -// GitHub API docs: https://docs.github.com/rest/users/gpg-keys#list-gpg-keys-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/gpg-keys?apiVersion=2022-11-28#list-gpg-keys-for-a-user +// +// GitHub API docs: https://docs.github.com/rest/users/gpg-keys?apiVersion=2022-11-28#list-gpg-keys-for-the-authenticated-user // //meta:operation GET /user/gpg_keys //meta:operation GET /users/{username}/gpg_keys @@ -61,13 +62,13 @@ func (s *UsersService) ListGPGKeys(ctx context.Context, user string, opts *ListO return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var keys []*GPGKey - resp, err := s.client.Do(ctx, req, &keys) + resp, err := s.client.Do(req, &keys) if err != nil { return nil, resp, err } @@ -78,18 +79,18 @@ func (s *UsersService) ListGPGKeys(ctx context.Context, user string, opts *ListO // GetGPGKey gets extended details for a single GPG key. It requires authentication // via Basic Auth or via OAuth with at least read:gpg_key scope. // -// GitHub API docs: https://docs.github.com/rest/users/gpg-keys#get-a-gpg-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/gpg-keys?apiVersion=2022-11-28#get-a-gpg-key-for-the-authenticated-user // //meta:operation GET /user/gpg_keys/{gpg_key_id} func (s *UsersService) GetGPGKey(ctx context.Context, id int64) (*GPGKey, *Response, error) { u := fmt.Sprintf("user/gpg_keys/%v", id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - key := &GPGKey{} - resp, err := s.client.Do(ctx, req, key) + var key *GPGKey + resp, err := s.client.Do(req, &key) if err != nil { return nil, resp, err } @@ -100,20 +101,20 @@ func (s *UsersService) GetGPGKey(ctx context.Context, id int64) (*GPGKey, *Respo // CreateGPGKey creates a GPG key. It requires authentication via Basic Auth // or OAuth with at least write:gpg_key scope. // -// GitHub API docs: https://docs.github.com/rest/users/gpg-keys#create-a-gpg-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/gpg-keys?apiVersion=2022-11-28#create-a-gpg-key-for-the-authenticated-user // //meta:operation POST /user/gpg_keys func (s *UsersService) CreateGPGKey(ctx context.Context, armoredPublicKey string) (*GPGKey, *Response, error) { gpgKey := &struct { ArmoredPublicKey string `json:"armored_public_key"` }{ArmoredPublicKey: armoredPublicKey} - req, err := s.client.NewRequest("POST", "user/gpg_keys", gpgKey) + req, err := s.client.NewRequest(ctx, "POST", "user/gpg_keys", gpgKey) if err != nil { return nil, nil, err } - key := &GPGKey{} - resp, err := s.client.Do(ctx, req, key) + var key *GPGKey + resp, err := s.client.Do(req, &key) if err != nil { return nil, resp, err } @@ -124,15 +125,15 @@ func (s *UsersService) CreateGPGKey(ctx context.Context, armoredPublicKey string // DeleteGPGKey deletes a GPG key. It requires authentication via Basic Auth or // via OAuth with at least admin:gpg_key scope. // -// GitHub API docs: https://docs.github.com/rest/users/gpg-keys#delete-a-gpg-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/gpg-keys?apiVersion=2022-11-28#delete-a-gpg-key-for-the-authenticated-user // //meta:operation DELETE /user/gpg_keys/{gpg_key_id} func (s *UsersService) DeleteGPGKey(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("user/gpg_keys/%v", id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/users_keys.go b/vendor/github.com/google/go-github/v88/github/users_keys.go similarity index 69% rename from vendor/github.com/google/go-github/v73/github/users_keys.go rename to vendor/github.com/google/go-github/v88/github/users_keys.go index 4d42986ed..0c981d712 100644 --- a/vendor/github.com/google/go-github/v73/github/users_keys.go +++ b/vendor/github.com/google/go-github/v88/github/users_keys.go @@ -30,8 +30,9 @@ func (k Key) String() string { // ListKeys lists the verified public keys for a user. Passing the empty // string will fetch keys for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/keys#list-public-keys-for-a-user -// GitHub API docs: https://docs.github.com/rest/users/keys#list-public-ssh-keys-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/keys?apiVersion=2022-11-28#list-public-keys-for-a-user +// +// GitHub API docs: https://docs.github.com/rest/users/keys?apiVersion=2022-11-28#list-public-ssh-keys-for-the-authenticated-user // //meta:operation GET /user/keys //meta:operation GET /users/{username}/keys @@ -47,13 +48,13 @@ func (s *UsersService) ListKeys(ctx context.Context, user string, opts *ListOpti return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var keys []*Key - resp, err := s.client.Do(ctx, req, &keys) + resp, err := s.client.Do(req, &keys) if err != nil { return nil, resp, err } @@ -63,19 +64,19 @@ func (s *UsersService) ListKeys(ctx context.Context, user string, opts *ListOpti // GetKey fetches a single public key. // -// GitHub API docs: https://docs.github.com/rest/users/keys#get-a-public-ssh-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/keys?apiVersion=2022-11-28#get-a-public-ssh-key-for-the-authenticated-user // //meta:operation GET /user/keys/{key_id} func (s *UsersService) GetKey(ctx context.Context, id int64) (*Key, *Response, error) { u := fmt.Sprintf("user/keys/%v", id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - key := new(Key) - resp, err := s.client.Do(ctx, req, key) + var key *Key + resp, err := s.client.Do(req, &key) if err != nil { return nil, resp, err } @@ -85,19 +86,19 @@ func (s *UsersService) GetKey(ctx context.Context, id int64) (*Key, *Response, e // CreateKey adds a public key for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/keys#create-a-public-ssh-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/keys?apiVersion=2022-11-28#create-a-public-ssh-key-for-the-authenticated-user // //meta:operation POST /user/keys func (s *UsersService) CreateKey(ctx context.Context, key *Key) (*Key, *Response, error) { u := "user/keys" - req, err := s.client.NewRequest("POST", u, key) + req, err := s.client.NewRequest(ctx, "POST", u, key) if err != nil { return nil, nil, err } - k := new(Key) - resp, err := s.client.Do(ctx, req, k) + var k *Key + resp, err := s.client.Do(req, &k) if err != nil { return nil, resp, err } @@ -107,16 +108,16 @@ func (s *UsersService) CreateKey(ctx context.Context, key *Key) (*Key, *Response // DeleteKey deletes a public key. // -// GitHub API docs: https://docs.github.com/rest/users/keys#delete-a-public-ssh-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/keys?apiVersion=2022-11-28#delete-a-public-ssh-key-for-the-authenticated-user // //meta:operation DELETE /user/keys/{key_id} func (s *UsersService) DeleteKey(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("user/keys/%v", id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v73/github/users_packages.go b/vendor/github.com/google/go-github/v88/github/users_packages.go similarity index 70% rename from vendor/github.com/google/go-github/v73/github/users_packages.go rename to vendor/github.com/google/go-github/v88/github/users_packages.go index b813dd9d1..8a1fad3b6 100644 --- a/vendor/github.com/google/go-github/v73/github/users_packages.go +++ b/vendor/github.com/google/go-github/v88/github/users_packages.go @@ -14,8 +14,9 @@ import ( // ListPackages lists the packages for a user. Passing the empty string for "user" will // list packages for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#list-packages-for-a-user -// GitHub API docs: https://docs.github.com/rest/packages/packages#list-packages-for-the-authenticated-users-namespace +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#list-packages-for-a-user +// +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#list-packages-for-the-authenticated-users-namespace // //meta:operation GET /user/packages //meta:operation GET /users/{username}/packages @@ -31,13 +32,13 @@ func (s *UsersService) ListPackages(ctx context.Context, user string, opts *Pack return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var packages []*Package - resp, err := s.client.Do(ctx, req, &packages) + resp, err := s.client.Do(req, &packages) if err != nil { return nil, resp, err } @@ -48,8 +49,9 @@ func (s *UsersService) ListPackages(ctx context.Context, user string, opts *Pack // GetPackage gets a package by name for a user. Passing the empty string for "user" will // get the package for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#get-a-package-for-a-user -// GitHub API docs: https://docs.github.com/rest/packages/packages#get-a-package-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#get-a-package-for-a-user +// +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#get-a-package-for-the-authenticated-user // //meta:operation GET /user/packages/{package_type}/{package_name} //meta:operation GET /users/{username}/packages/{package_type}/{package_name} @@ -61,13 +63,13 @@ func (s *UsersService) GetPackage(ctx context.Context, user, packageType, packag u = fmt.Sprintf("user/packages/%v/%v", packageType, url.PathEscape(packageName)) } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var pack *Package - resp, err := s.client.Do(ctx, req, &pack) + resp, err := s.client.Do(req, &pack) if err != nil { return nil, resp, err } @@ -78,8 +80,9 @@ func (s *UsersService) GetPackage(ctx context.Context, user, packageType, packag // DeletePackage deletes a package from a user. Passing the empty string for "user" will // delete the package for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#delete-a-package-for-a-user -// GitHub API docs: https://docs.github.com/rest/packages/packages#delete-a-package-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#delete-a-package-for-a-user +// +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#delete-a-package-for-the-authenticated-user // //meta:operation DELETE /user/packages/{package_type}/{package_name} //meta:operation DELETE /users/{username}/packages/{package_type}/{package_name} @@ -91,19 +94,20 @@ func (s *UsersService) DeletePackage(ctx context.Context, user, packageType, pac u = fmt.Sprintf("user/packages/%v/%v", packageType, packageName) } - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RestorePackage restores a package to a user. Passing the empty string for "user" will // restore the package for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#restore-a-package-for-a-user -// GitHub API docs: https://docs.github.com/rest/packages/packages#restore-a-package-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#restore-a-package-for-a-user +// +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#restore-a-package-for-the-authenticated-user // //meta:operation POST /user/packages/{package_type}/{package_name}/restore //meta:operation POST /users/{username}/packages/{package_type}/{package_name}/restore @@ -115,41 +119,63 @@ func (s *UsersService) RestorePackage(ctx context.Context, user, packageType, pa u = fmt.Sprintf("user/packages/%v/%v/restore", packageType, packageName) } - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } -// PackageGetAllVersions gets all versions of a package for a user. Passing the empty string for "user" will -// get versions for the authenticated user. +// ListPackageVersionsOptions specifies the optional parameters to the UsersService.ListPackageVersions. +type ListPackageVersionsOptions struct { + // State of package either "active" or "deleted". + State string `url:"state,omitempty"` + + ListOptions +} + +// ListPackageVersions gets all versions of a package for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-a-user -// GitHub API docs: https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#list-package-versions-for-a-package-owned-by-the-authenticated-user // //meta:operation GET /user/packages/{package_type}/{package_name}/versions -//meta:operation GET /users/{username}/packages/{package_type}/{package_name}/versions -func (s *UsersService) PackageGetAllVersions(ctx context.Context, user, packageType, packageName string, opts *PackageListOptions) ([]*PackageVersion, *Response, error) { - var u string - if user != "" { - u = fmt.Sprintf("users/%v/packages/%v/%v/versions", user, packageType, packageName) - } else { - u = fmt.Sprintf("user/packages/%v/%v/versions", packageType, packageName) - } +func (s *UsersService) ListPackageVersions(ctx context.Context, packageType, packageName string, opts *ListPackageVersionsOptions) ([]*PackageVersion, *Response, error) { + u := fmt.Sprintf("user/packages/%v/%v/versions", packageType, packageName) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var versions []*PackageVersion - resp, err := s.client.Do(ctx, req, &versions) + resp, err := s.client.Do(req, &versions) + if err != nil { + return nil, resp, err + } + + return versions, resp, nil +} + +// ListUserPackageVersions returns package versions for a public package owned by a specified user. +// +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#list-package-versions-for-a-package-owned-by-a-user +// +//meta:operation GET /users/{username}/packages/{package_type}/{package_name}/versions +func (s *UsersService) ListUserPackageVersions(ctx context.Context, user, packageType, packageName string) ([]*PackageVersion, *Response, error) { + u := fmt.Sprintf("users/%v/packages/%v/%v/versions", user, packageType, packageName) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var versions []*PackageVersion + resp, err := s.client.Do(req, &versions) if err != nil { return nil, resp, err } @@ -160,8 +186,9 @@ func (s *UsersService) PackageGetAllVersions(ctx context.Context, user, packageT // PackageGetVersion gets a specific version of a package for a user. Passing the empty string for "user" will // get the version for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#get-a-package-version-for-a-user -// GitHub API docs: https://docs.github.com/rest/packages/packages#get-a-package-version-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#get-a-package-version-for-a-user +// +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#get-a-package-version-for-the-authenticated-user // //meta:operation GET /user/packages/{package_type}/{package_name}/versions/{package_version_id} //meta:operation GET /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id} @@ -173,13 +200,13 @@ func (s *UsersService) PackageGetVersion(ctx context.Context, user, packageType, u = fmt.Sprintf("user/packages/%v/%v/versions/%v", packageType, packageName, packageVersionID) } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var version *PackageVersion - resp, err := s.client.Do(ctx, req, &version) + resp, err := s.client.Do(req, &version) if err != nil { return nil, resp, err } @@ -190,8 +217,9 @@ func (s *UsersService) PackageGetVersion(ctx context.Context, user, packageType, // PackageDeleteVersion deletes a package version for a user. Passing the empty string for "user" will // delete the version for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#delete-a-package-version-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/rest/packages/packages#delete-package-version-for-a-user +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#delete-a-package-version-for-the-authenticated-user +// +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#delete-package-version-for-a-user // //meta:operation DELETE /user/packages/{package_type}/{package_name}/versions/{package_version_id} //meta:operation DELETE /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id} @@ -203,19 +231,20 @@ func (s *UsersService) PackageDeleteVersion(ctx context.Context, user, packageTy u = fmt.Sprintf("user/packages/%v/%v/versions/%v", packageType, packageName, packageVersionID) } - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // PackageRestoreVersion restores a package version to a user. Passing the empty string for "user" will // restore the version for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#restore-a-package-version-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/rest/packages/packages#restore-package-version-for-a-user +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#restore-a-package-version-for-the-authenticated-user +// +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#restore-package-version-for-a-user // //meta:operation POST /user/packages/{package_type}/{package_name}/versions/{package_version_id}/restore //meta:operation POST /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore @@ -227,10 +256,10 @@ func (s *UsersService) PackageRestoreVersion(ctx context.Context, user, packageT u = fmt.Sprintf("user/packages/%v/%v/versions/%v/restore", packageType, packageName, packageVersionID) } - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v88/github/users_social_accounts.go b/vendor/github.com/google/go-github/v88/github/users_social_accounts.go new file mode 100644 index 000000000..ebef40265 --- /dev/null +++ b/vendor/github.com/google/go-github/v88/github/users_social_accounts.go @@ -0,0 +1,110 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// SocialAccount represents a social account linked to a user. +type SocialAccount struct { + Provider *string `json:"provider,omitempty"` + URL *string `json:"url,omitempty"` +} + +// socialAccountsRequest represents the request body for adding or deleting social accounts. +type socialAccountsRequest struct { + AccountURLs []string `json:"account_urls"` +} + +// ListSocialAccounts lists all social accounts for the authenticated user. +// +// GitHub API docs: https://docs.github.com/rest/users/social-accounts?apiVersion=2022-11-28#list-social-accounts-for-the-authenticated-user +// +//meta:operation GET /user/social_accounts +func (s *UsersService) ListSocialAccounts(ctx context.Context, opts *ListOptions) ([]*SocialAccount, *Response, error) { + u := "user/social_accounts" + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var socialAccounts []*SocialAccount + resp, err := s.client.Do(req, &socialAccounts) + if err != nil { + return nil, resp, err + } + + return socialAccounts, resp, nil +} + +// AddSocialAccounts adds social accounts for the authenticated user. +// +// GitHub API docs: https://docs.github.com/rest/users/social-accounts?apiVersion=2022-11-28#add-social-accounts-for-the-authenticated-user +// +//meta:operation POST /user/social_accounts +func (s *UsersService) AddSocialAccounts(ctx context.Context, accountURLs []string) ([]*SocialAccount, *Response, error) { + u := "user/social_accounts" + req, err := s.client.NewRequest(ctx, "POST", u, &socialAccountsRequest{AccountURLs: accountURLs}) + if err != nil { + return nil, nil, err + } + + var accounts []*SocialAccount + resp, err := s.client.Do(req, &accounts) + if err != nil { + return nil, resp, err + } + + return accounts, resp, nil +} + +// DeleteSocialAccounts deletes social accounts for the authenticated user. +// +// GitHub API docs: https://docs.github.com/rest/users/social-accounts?apiVersion=2022-11-28#delete-social-accounts-for-the-authenticated-user +// +//meta:operation DELETE /user/social_accounts +func (s *UsersService) DeleteSocialAccounts(ctx context.Context, accountURLs []string) (*Response, error) { + u := "user/social_accounts" + req, err := s.client.NewRequest(ctx, "DELETE", u, &socialAccountsRequest{AccountURLs: accountURLs}) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// ListUserSocialAccounts lists all social accounts for a user. +// +// GitHub API docs: https://docs.github.com/rest/users/social-accounts?apiVersion=2022-11-28#list-social-accounts-for-a-user +// +//meta:operation GET /users/{username}/social_accounts +func (s *UsersService) ListUserSocialAccounts(ctx context.Context, username string, opts *ListOptions) ([]*SocialAccount, *Response, error) { + u := fmt.Sprintf("users/%v/social_accounts", username) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var addedAccounts []*SocialAccount + resp, err := s.client.Do(req, &addedAccounts) + if err != nil { + return nil, resp, err + } + + return addedAccounts, resp, nil +} diff --git a/vendor/github.com/google/go-github/v73/github/users_ssh_signing_keys.go b/vendor/github.com/google/go-github/v88/github/users_ssh_signing_keys.go similarity index 77% rename from vendor/github.com/google/go-github/v73/github/users_ssh_signing_keys.go rename to vendor/github.com/google/go-github/v88/github/users_ssh_signing_keys.go index fcc930be6..1ddda7fd8 100644 --- a/vendor/github.com/google/go-github/v73/github/users_ssh_signing_keys.go +++ b/vendor/github.com/google/go-github/v88/github/users_ssh_signing_keys.go @@ -25,8 +25,9 @@ func (k SSHSigningKey) String() string { // ListSSHSigningKeys lists the SSH signing keys for a user. Passing an empty // username string will fetch SSH signing keys for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys#list-ssh-signing-keys-for-a-user -// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys#list-ssh-signing-keys-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys?apiVersion=2022-11-28#list-ssh-signing-keys-for-a-user +// +// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys?apiVersion=2022-11-28#list-ssh-signing-keys-for-the-authenticated-user // //meta:operation GET /user/ssh_signing_keys //meta:operation GET /users/{username}/ssh_signing_keys @@ -42,13 +43,13 @@ func (s *UsersService) ListSSHSigningKeys(ctx context.Context, user string, opts return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var keys []*SSHSigningKey - resp, err := s.client.Do(ctx, req, &keys) + resp, err := s.client.Do(req, &keys) if err != nil { return nil, resp, err } @@ -58,19 +59,19 @@ func (s *UsersService) ListSSHSigningKeys(ctx context.Context, user string, opts // GetSSHSigningKey fetches a single SSH signing key for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys#get-an-ssh-signing-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys?apiVersion=2022-11-28#get-an-ssh-signing-key-for-the-authenticated-user // //meta:operation GET /user/ssh_signing_keys/{ssh_signing_key_id} func (s *UsersService) GetSSHSigningKey(ctx context.Context, id int64) (*SSHSigningKey, *Response, error) { u := fmt.Sprintf("user/ssh_signing_keys/%v", id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - key := new(SSHSigningKey) - resp, err := s.client.Do(ctx, req, key) + var key *SSHSigningKey + resp, err := s.client.Do(req, &key) if err != nil { return nil, resp, err } @@ -80,19 +81,19 @@ func (s *UsersService) GetSSHSigningKey(ctx context.Context, id int64) (*SSHSign // CreateSSHSigningKey adds a SSH signing key for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys#create-a-ssh-signing-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys?apiVersion=2022-11-28#create-a-ssh-signing-key-for-the-authenticated-user // //meta:operation POST /user/ssh_signing_keys func (s *UsersService) CreateSSHSigningKey(ctx context.Context, key *Key) (*SSHSigningKey, *Response, error) { u := "user/ssh_signing_keys" - req, err := s.client.NewRequest("POST", u, key) + req, err := s.client.NewRequest(ctx, "POST", u, key) if err != nil { return nil, nil, err } - k := new(SSHSigningKey) - resp, err := s.client.Do(ctx, req, k) + var k *SSHSigningKey + resp, err := s.client.Do(req, &k) if err != nil { return nil, resp, err } @@ -102,16 +103,16 @@ func (s *UsersService) CreateSSHSigningKey(ctx context.Context, key *Key) (*SSHS // DeleteSSHSigningKey deletes a SSH signing key for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys#delete-an-ssh-signing-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys?apiVersion=2022-11-28#delete-an-ssh-signing-key-for-the-authenticated-user // //meta:operation DELETE /user/ssh_signing_keys/{ssh_signing_key_id} func (s *UsersService) DeleteSSHSigningKey(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("user/ssh_signing_keys/%v", id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/sigstore/cosign/v3/internal/pkg/cosign/common.go b/vendor/github.com/sigstore/cosign/v3/internal/pkg/cosign/common.go index 44027402e..a0b021c14 100644 --- a/vendor/github.com/sigstore/cosign/v3/internal/pkg/cosign/common.go +++ b/vendor/github.com/sigstore/cosign/v3/internal/pkg/cosign/common.go @@ -46,6 +46,13 @@ type HashReader struct { } func NewHashReader(r io.Reader, ch crypto.Hash) HashReader { + if ch == 0 { + return HashReader{ + r: r, + h: nil, + ch: ch, + } + } h := ch.New() return HashReader{ r: io.TeeReader(r, h), @@ -58,16 +65,36 @@ func NewHashReader(r io.Reader, ch crypto.Hash) HashReader { func (h *HashReader) Read(p []byte) (n int, err error) { return h.r.Read(p) } // Sum implements hash.Hash. -func (h *HashReader) Sum(p []byte) []byte { return h.h.Sum(p) } +func (h *HashReader) Sum(p []byte) []byte { + if h.h == nil { + return nil + } + return h.h.Sum(p) +} // Reset implements hash.Hash. -func (h *HashReader) Reset() { h.h.Reset() } +func (h *HashReader) Reset() { + if h.h == nil { + return + } + h.h.Reset() +} // Size implements hash.Hash. -func (h *HashReader) Size() int { return h.h.Size() } +func (h *HashReader) Size() int { + if h.h == nil { + return 0 + } + return h.h.Size() +} // BlockSize implements hash.Hash. -func (h *HashReader) BlockSize() int { return h.h.BlockSize() } +func (h *HashReader) BlockSize() int { + if h.h == nil { + return 0 + } + return h.h.BlockSize() +} // Write implements hash.Hash func (h *HashReader) Write(p []byte) (int, error) { return 0, errors.New("not implemented") } //nolint: revive diff --git a/vendor/github.com/sigstore/cosign/v3/pkg/blob/load.go b/vendor/github.com/sigstore/cosign/v3/pkg/blob/load.go index 8ee624e93..29b388815 100644 --- a/vendor/github.com/sigstore/cosign/v3/pkg/blob/load.go +++ b/vendor/github.com/sigstore/cosign/v3/pkg/blob/load.go @@ -50,6 +50,9 @@ func LoadFileOrURL(fileRef string) ([]byte, error) { return nil, err } defer resp.Body.Close() + if resp.StatusCode < 200 || resp.StatusCode >= 300 { + return nil, fmt.Errorf("loading URL %s: server returned HTTP %d", fileRef, resp.StatusCode) + } raw, err = io.ReadAll(resp.Body) if err != nil { return nil, err diff --git a/vendor/github.com/sigstore/cosign/v3/pkg/cosign/attestation/attestation.go b/vendor/github.com/sigstore/cosign/v3/pkg/cosign/attestation/attestation.go index 7b8f4bff1..4f3b6b606 100644 --- a/vendor/github.com/sigstore/cosign/v3/pkg/cosign/attestation/attestation.go +++ b/vendor/github.com/sigstore/cosign/v3/pkg/cosign/attestation/attestation.go @@ -477,7 +477,7 @@ func generateCycloneDXStatement(rawPayload []byte, digest string, repo string) ( } func checkRequiredJSONFields(rawPayload []byte, typ reflect.Type) error { - if typ.Kind() == reflect.Ptr { + if typ.Kind() == reflect.Pointer { typ = typ.Elem() } var tmp map[string]interface{} diff --git a/vendor/github.com/sigstore/cosign/v3/pkg/cosign/bundle/sign.go b/vendor/github.com/sigstore/cosign/v3/pkg/cosign/bundle/sign.go index 2aba0b6c3..8d2afb577 100644 --- a/vendor/github.com/sigstore/cosign/v3/pkg/cosign/bundle/sign.go +++ b/vendor/github.com/sigstore/cosign/v3/pkg/cosign/bundle/sign.go @@ -21,6 +21,7 @@ import ( "fmt" "log" "net/http" + "sync" "time" "github.com/sigstore/cosign/v3/internal/ui" @@ -31,7 +32,8 @@ import ( ) type SignOptions struct { - TSAClientTransport http.RoundTripper + TSAClientTransport http.RoundTripper + CertificateProvider sign.CertificateProvider } func SignData(ctx context.Context, content sign.Content, keypair sign.Keypair, idToken string, cert []byte, signingConfig *root.SigningConfig, trustedMaterial root.TrustedMaterial, opts SignOptions) ([]byte, error) { @@ -42,20 +44,19 @@ func SignData(ctx context.Context, content sign.Content, keypair sign.Keypair, i } switch { - case idToken != "": - if len(signingConfig.FulcioCertificateAuthorityURLs()) == 0 { - return nil, fmt.Errorf("no fulcio URLs provided in signing config") + case opts.CertificateProvider != nil: + bundleOpts.CertificateProvider = opts.CertificateProvider + if idToken != "" { + bundleOpts.CertificateProviderOptions = &sign.CertificateProviderOptions{ + IDToken: idToken, + } } - fulcioSvc, err := root.SelectService(signingConfig.FulcioCertificateAuthorityURLs(), sign.FulcioAPIVersions, time.Now()) + case idToken != "": + provider, err := newFulcioProvider(signingConfig) if err != nil { return nil, err } - fulcioOpts := &sign.FulcioOptions{ - BaseURL: fulcioSvc.URL, - Timeout: 30 * time.Second, - Retries: 1, - } - bundleOpts.CertificateProvider = sign.NewFulcio(fulcioOpts) + bundleOpts.CertificateProvider = provider bundleOpts.CertificateProviderOptions = &sign.CertificateProviderOptions{ IDToken: idToken, } @@ -79,11 +80,13 @@ func SignData(ctx context.Context, content sign.Content, keypair sign.Keypair, i keyTrustedMaterial := root.NewTrustedPublicKeyMaterial(func(_ string) (root.TimeConstrainedVerifier, error) { return key, nil }) - trustedMaterial := &verifyTrustedMaterial{ - TrustedMaterial: bundleOpts.TrustedRoot, - keyTrustedMaterial: keyTrustedMaterial, + if bundleOpts.TrustedRoot != nil { + trustedMaterial := &verifyTrustedMaterial{ + TrustedMaterial: bundleOpts.TrustedRoot, + keyTrustedMaterial: keyTrustedMaterial, + } + bundleOpts.TrustedRoot = trustedMaterial } - bundleOpts.TrustedRoot = trustedMaterial } if len(signingConfig.TimestampAuthorityURLs()) != 0 { @@ -165,3 +168,45 @@ func (c *localCertProvider) GetCertificate(_ context.Context, _ sign.Keypair, _ } return certBlock.Bytes, nil } + +type cachingCertProvider struct { + provider sign.CertificateProvider + once sync.Once + fetch func() ([]byte, error) +} + +func (c *cachingCertProvider) GetCertificate(ctx context.Context, keypair sign.Keypair, opts *sign.CertificateProviderOptions) ([]byte, error) { + c.once.Do(func() { + c.fetch = sync.OnceValues(func() ([]byte, error) { + return c.provider.GetCertificate(ctx, keypair, opts) + }) + }) + return c.fetch() +} + +func newFulcioProvider(signingConfig *root.SigningConfig) (sign.CertificateProvider, error) { + if len(signingConfig.FulcioCertificateAuthorityURLs()) == 0 { + return nil, fmt.Errorf("no fulcio URLs provided in signing config") + } + fulcioSvc, err := root.SelectService(signingConfig.FulcioCertificateAuthorityURLs(), sign.FulcioAPIVersions, time.Now()) + if err != nil { + return nil, err + } + fulcioOpts := &sign.FulcioOptions{ + BaseURL: fulcioSvc.URL, + Timeout: 30 * time.Second, + Retries: 1, + } + return sign.NewFulcio(fulcioOpts), nil +} + +// NewCachingFulcioProvider creates a caching Fulcio provider from the given signing config. +// This function should not be used in long-running processes, as the certificate will +// expire. +func NewCachingFulcioProvider(signingConfig *root.SigningConfig) (sign.CertificateProvider, error) { + provider, err := newFulcioProvider(signingConfig) + if err != nil { + return nil, err + } + return &cachingCertProvider{provider: provider}, nil +} diff --git a/vendor/github.com/sigstore/cosign/v3/pkg/cosign/git/github/github.go b/vendor/github.com/sigstore/cosign/v3/pkg/cosign/git/github/github.go index 07ff36341..93405295a 100644 --- a/vendor/github.com/sigstore/cosign/v3/pkg/cosign/git/github/github.go +++ b/vendor/github.com/sigstore/cosign/v3/pkg/cosign/git/github/github.go @@ -25,7 +25,7 @@ import ( "os" "strings" - "github.com/google/go-github/v73/github" + "github.com/google/go-github/v88/github" "golang.org/x/crypto/nacl/box" "golang.org/x/oauth2" @@ -57,12 +57,16 @@ func (g *Gh) PutSecret(ctx context.Context, ref string, pf cosign.PassFunc) erro var client *github.Client if host, ok := env.LookupEnv(env.VariableGitHubHost); ok { var err error - client, err = github.NewClient(httpClient).WithEnterpriseURLs(host, host) + client, err = github.NewClient(github.WithHTTPClient(httpClient), github.WithEnterpriseURLs(host, host)) if err != nil { return fmt.Errorf("could not create github enterprise client: %w", err) } } else { - client = github.NewClient(httpClient) + var err error + client, err = github.NewClient(github.WithHTTPClient(httpClient)) + if err != nil { + return fmt.Errorf("could not create github client: %w", err) + } } keys, err := cosign.GenerateKeyPair(pf) @@ -87,7 +91,7 @@ func (g *Gh) PutSecret(ctx context.Context, ref string, pf cosign.PassFunc) erro return fmt.Errorf("could not get repository public key: %w", err) } - if getPubKeyResp.StatusCode < 200 && getPubKeyResp.StatusCode >= 300 { + if getPubKeyResp.StatusCode < 200 || getPubKeyResp.StatusCode >= 300 { bodyBytes, _ := io.ReadAll(getPubKeyResp.Body) return fmt.Errorf("%s", bodyBytes) } @@ -102,7 +106,7 @@ func (g *Gh) PutSecret(ctx context.Context, ref string, pf cosign.PassFunc) erro return fmt.Errorf("could not create \"COSIGN_PASSWORD\" github actions secret: %w", err) } - if passwordSecretEnvResp.StatusCode < 200 && passwordSecretEnvResp.StatusCode >= 300 { + if passwordSecretEnvResp.StatusCode < 200 || passwordSecretEnvResp.StatusCode >= 300 { bodyBytes, _ := io.ReadAll(passwordSecretEnvResp.Body) return fmt.Errorf("%s", bodyBytes) } @@ -119,7 +123,7 @@ func (g *Gh) PutSecret(ctx context.Context, ref string, pf cosign.PassFunc) erro return fmt.Errorf("could not create \"COSIGN_PRIVATE_KEY\" github actions secret: %w", err) } - if privateKeySecretEnvResp.StatusCode < 200 && privateKeySecretEnvResp.StatusCode >= 300 { + if privateKeySecretEnvResp.StatusCode < 200 || privateKeySecretEnvResp.StatusCode >= 300 { bodyBytes, _ := io.ReadAll(privateKeySecretEnvResp.Body) return fmt.Errorf("%s", bodyBytes) } @@ -136,7 +140,7 @@ func (g *Gh) PutSecret(ctx context.Context, ref string, pf cosign.PassFunc) erro return fmt.Errorf("could not create \"COSIGN_PUBLIC_KEY\" github actions secret: %w", err) } - if publicKeySecretEnvResp.StatusCode < 200 && publicKeySecretEnvResp.StatusCode >= 300 { + if publicKeySecretEnvResp.StatusCode < 200 || publicKeySecretEnvResp.StatusCode >= 300 { bodyBytes, _ := io.ReadAll(publicKeySecretEnvResp.Body) return fmt.Errorf("%s", bodyBytes) } diff --git a/vendor/github.com/sigstore/cosign/v3/pkg/cosign/pkcs11key/util.go b/vendor/github.com/sigstore/cosign/v3/pkg/cosign/pkcs11key/util.go index ce30a873e..5298d1dc0 100644 --- a/vendor/github.com/sigstore/cosign/v3/pkg/cosign/pkcs11key/util.go +++ b/vendor/github.com/sigstore/cosign/v3/pkg/cosign/pkcs11key/util.go @@ -39,7 +39,7 @@ func percentEncode(input []byte) string { var stringBuilder strings.Builder for i := 0; i < len(input); i++ { stringBuilder.WriteByte('%') - stringBuilder.WriteString(fmt.Sprintf("%.2x", input[i])) + fmt.Fprintf(&stringBuilder, "%.2x", input[i]) } return stringBuilder.String() diff --git a/vendor/github.com/sigstore/cosign/v3/pkg/cosign/tuf.go b/vendor/github.com/sigstore/cosign/v3/pkg/cosign/tuf.go index bf664b4bc..6a9c60ccc 100644 --- a/vendor/github.com/sigstore/cosign/v3/pkg/cosign/tuf.go +++ b/vendor/github.com/sigstore/cosign/v3/pkg/cosign/tuf.go @@ -50,6 +50,22 @@ func SigningConfig() (*root.SigningConfig, error) { return sc, nil } +func SigningConfigRekorV2() (*root.SigningConfig, error) { + opts, err := setTUFOpts() + if err != nil { + return nil, fmt.Errorf("error setting TUF options: %w", err) + } + client, err := tuf.New(opts) + if err != nil { + return nil, fmt.Errorf("error creating TUF client: %w", err) + } + jsonBytes, err := client.GetTarget("signing_config_rekor_v2.v0.2.json") + if err != nil { + return nil, fmt.Errorf("error getting signing config from TUF: %w", err) + } + return root.NewSigningConfigFromJSON(jsonBytes) +} + // setTUFOpts sets the TUF cache directory, the mirror URL, and the root.json in the TUF options. // The cache directory is provided by the user as an environment variable TUF_ROOT, or the default $HOME/.sigstore/root is used. // The mirror URL is provided by the user as an environment variable TUF_MIRROR. If not overridden by the user, the value set during `cosign initialize` in remote.json in the cache directory is used. diff --git a/vendor/github.com/sigstore/cosign/v3/pkg/cosign/verify.go b/vendor/github.com/sigstore/cosign/v3/pkg/cosign/verify.go index b97a584d8..56f1599a8 100644 --- a/vendor/github.com/sigstore/cosign/v3/pkg/cosign/verify.go +++ b/vendor/github.com/sigstore/cosign/v3/pkg/cosign/verify.go @@ -329,6 +329,20 @@ func verifyOCISignature(ctx context.Context, verifier signature.Verifier, sig pa return verifier.VerifySignature(bytes.NewReader(signature), bytes.NewReader(payload), options.WithContext(ctx)) } +type verifierWithCertChain struct { + signature.Verifier + cert *x509.Certificate + chain []*x509.Certificate +} + +func (v *verifierWithCertChain) GetCert() *x509.Certificate { + return v.cert +} + +func (v *verifierWithCertChain) GetChain() []*x509.Certificate { + return v.chain +} + // ValidateAndUnpackCert creates a Verifier from a certificate. Verifies that the // certificate chains up to a trusted root using intermediate certificate chain coming from CheckOpts. // Optionally verifies the subject and issuer of the certificate. @@ -390,7 +404,7 @@ func ValidateAndUnpackCertWithIntermediates(cert *x509.Certificate, co *CheckOpt // If IgnoreSCT is set, skip the SCT check if co.IgnoreSCT { - return verifier, chains[0], nil + return &verifierWithCertChain{Verifier: verifier, cert: cert, chain: chains[0]}, chains[0], nil } contains, err := ContainsSCT(cert.Raw) if err != nil { @@ -407,7 +421,7 @@ func ValidateAndUnpackCertWithIntermediates(cert *x509.Certificate, co *CheckOpt if err := verify.VerifySignedCertificateTimestamp(chains, 1, co.TrustedMaterial); err != nil { return nil, nil, err } - return verifier, chain, nil + return &verifierWithCertChain{Verifier: verifier, cert: cert, chain: chain}, chain, nil } if len(chain) < 2 { @@ -417,7 +431,7 @@ func ValidateAndUnpackCertWithIntermediates(cert *x509.Certificate, co *CheckOpt if err := VerifyEmbeddedSCT(context.Background(), chain, co.CTLogPubKeys); err != nil { return nil, nil, err } - return verifier, chain, nil + return &verifierWithCertChain{Verifier: verifier, cert: cert, chain: chain}, chain, nil } certPEM, err := cryptoutils.MarshalCertificateToPEM(chain[0]) if err != nil { @@ -431,7 +445,7 @@ func ValidateAndUnpackCertWithIntermediates(cert *x509.Certificate, co *CheckOpt return nil, nil, err } - return verifier, chain, nil + return &verifierWithCertChain{Verifier: verifier, cert: cert, chain: chain}, chain, nil } // CheckCertificatePolicy checks that the certificate subject and issuer match @@ -1018,7 +1032,33 @@ func loadSignatureFromFile(ctx context.Context, sigRef string, signedImgRef name } } - sig, err := static.NewSignature(payload, b64sig) + var opts []static.Option + if co.SigVerifier != nil { + if cb, ok := co.SigVerifier.(interface{ GetCert() *x509.Certificate }); ok { + if cert := cb.GetCert(); cert != nil { + var chain []*x509.Certificate + if ch, ok := co.SigVerifier.(interface{ GetChain() []*x509.Certificate }); ok { + chain = ch.GetChain() + } + + certPEM, err := cryptoutils.MarshalCertificateToPEM(cert) + if err != nil { + return nil, err + } + var chainPEM []byte + if len(chain) > 0 { + chainPEM, err = cryptoutils.MarshalCertificatesToPEM(chain) + if err != nil { + return nil, err + } + } + + opts = append(opts, static.WithCertChain(certPEM, chainPEM)) + } + } + } + + sig, err := static.NewSignature(payload, b64sig, opts...) if err != nil { return nil, err } @@ -1403,6 +1443,9 @@ func VerifyRFC3161Timestamp(sig oci.Signature, co *CheckOpts) (*timestamp.Timest if len(verifyErrs) > 0 { log.Printf("Warning: subset of signed timestamps failed to verify: %v", verifyErrs) } + if len(verifiedTimestamps) == 0 { + return nil, fmt.Errorf("expected at least one verified timestamp") + } return ×tamp.Timestamp{Time: verifiedTimestamps[0].Time}, nil } @@ -1688,9 +1731,15 @@ func GetBundles(_ context.Context, signedImgRef name.Reference, registryClientOp if err != nil { return nil, nil, err } + + bundleRepo := digest.Repository + if targetRepo := ociremote.TargetRepositoryFromOptions(registryClientOpts...); (targetRepo != name.Repository{}) { + bundleRepo = targetRepo + } + var bundles = make([]*sgbundle.Bundle, 0, len(index.Manifests)) for _, result := range index.Manifests { - st, err := name.ParseReference(fmt.Sprintf("%s@%s", digest.Repository, result.Digest.String()), nameOpts...) + st, err := name.ParseReference(fmt.Sprintf("%s@%s", bundleRepo, result.Digest.String()), nameOpts...) if err != nil { return nil, nil, err } diff --git a/vendor/github.com/sigstore/cosign/v3/pkg/cosign/verify_bundle.go b/vendor/github.com/sigstore/cosign/v3/pkg/cosign/verify_bundle.go index 1db22fae9..81eadb7d2 100644 --- a/vendor/github.com/sigstore/cosign/v3/pkg/cosign/verify_bundle.go +++ b/vendor/github.com/sigstore/cosign/v3/pkg/cosign/verify_bundle.go @@ -23,10 +23,15 @@ import ( // VerifyNewBundle verifies a Sigstore bundle with the given parameters func VerifyNewBundle(_ context.Context, co *CheckOpts, artifactPolicyOption verify.ArtifactPolicyOption, bundle verify.SignedEntity) (*verify.VerificationResult, error) { - if err := rekorV2Bundle(bundle, co); err != nil { + // Copy co so rekorV2Bundle's UseSignedTimestamps write stays per-call and + // doesn't race a *CheckOpts shared across goroutines. + // TODO(cody)(cosign v4): Consider changing function signature to take a + // non-pointer CheckOpts and avoid this copy. + coCopy := *co + if err := rekorV2Bundle(bundle, &coCopy); err != nil { return nil, err } - trustedMaterial, verifierOptions, policyOptions, err := co.verificationOptions() + trustedMaterial, verifierOptions, policyOptions, err := coCopy.verificationOptions() if err != nil { return nil, err } diff --git a/vendor/github.com/sigstore/cosign/v3/pkg/oci/remote/options.go b/vendor/github.com/sigstore/cosign/v3/pkg/oci/remote/options.go index c29c2970a..616a92a8e 100644 --- a/vendor/github.com/sigstore/cosign/v3/pkg/oci/remote/options.go +++ b/vendor/github.com/sigstore/cosign/v3/pkg/oci/remote/options.go @@ -129,6 +129,13 @@ func WithTargetRepository(repo name.Repository) Option { } } +// TargetRepositoryFromOptions extracts the TargetRepository that a +// WithTargetRepository option would have set in the provided options. +// Returns the zero name.Repository if no override was provided. +func TargetRepositoryFromOptions(opts ...Option) name.Repository { + return makeOptions(name.Repository{}, opts...).TargetRepository +} + // GetEnvTargetRepository returns the Repository specified by // `os.Getenv(RepoOverrideEnvKey)`, or the empty value if not set. // Returns an error if the value is set but cannot be parsed. diff --git a/vendor/github.com/sigstore/cosign/v3/pkg/oci/remote/referrers.go b/vendor/github.com/sigstore/cosign/v3/pkg/oci/remote/referrers.go index 1b67cdf39..4f21e23ea 100644 --- a/vendor/github.com/sigstore/cosign/v3/pkg/oci/remote/referrers.go +++ b/vendor/github.com/sigstore/cosign/v3/pkg/oci/remote/referrers.go @@ -21,14 +21,20 @@ import ( "github.com/google/go-containerregistry/pkg/v1/remote" ) +var remoteReferrers = remote.Referrers + // Referrers fetches references using registry options. func Referrers(d name.Digest, artifactType string, opts ...Option) (*v1.IndexManifest, error) { o := makeOptions(name.Repository{}, opts...) + if (o.TargetRepository != name.Repository{}) { + d = o.TargetRepository.Digest(d.DigestStr()) + } + rOpt := o.ROpt if artifactType != "" { rOpt = append(rOpt, remote.WithFilter("artifactType", artifactType)) } - idx, err := remote.Referrers(d, rOpt...) + idx, err := remoteReferrers(d, rOpt...) if err != nil { return nil, err } diff --git a/vendor/github.com/sigstore/cosign/v3/pkg/oci/remote/signatures.go b/vendor/github.com/sigstore/cosign/v3/pkg/oci/remote/signatures.go index 24a3e4dc8..dba27827a 100644 --- a/vendor/github.com/sigstore/cosign/v3/pkg/oci/remote/signatures.go +++ b/vendor/github.com/sigstore/cosign/v3/pkg/oci/remote/signatures.go @@ -76,6 +76,7 @@ func Bundle(ref name.Reference, opts ...Option) (*sgbundle.Bundle, error) { if err != nil { return nil, err } + defer layer0.Close() bundleBytes, err := io.ReadAll(layer0) if err != nil { return nil, err diff --git a/vendor/github.com/sigstore/cosign/v3/pkg/oci/remote/write.go b/vendor/github.com/sigstore/cosign/v3/pkg/oci/remote/write.go index cae1d8db1..9c88a442c 100644 --- a/vendor/github.com/sigstore/cosign/v3/pkg/oci/remote/write.go +++ b/vendor/github.com/sigstore/cosign/v3/pkg/oci/remote/write.go @@ -118,6 +118,7 @@ func WriteSignedImageIndexImages(ref name.Reference, sii oci.SignedImageIndex, d return err } manifest, err := v1.ParseManifest(fd) + fd.Close() if err != nil || manifest.Subject == nil { continue } diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/config.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/config.go index 2a64fd330..7f3a93522 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/config.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/config.go @@ -5,6 +5,8 @@ package otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.g import ( "context" + "os" + "strings" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" @@ -29,6 +31,14 @@ type InterceptorFilter func(*InterceptorInfo) bool // A Filter must return true if the request should be instrumented. type Filter func(*stats.RPCTagInfo) bool +type semconvMode int + +const ( + semconvModeNew semconvMode = iota // Default + semconvModeOld + semconvModeDup +) + // config is a group of options for this instrumentation. type config struct { Filter Filter @@ -47,6 +57,8 @@ type config struct { ReceivedEvent bool SentEvent bool + + semconvMode semconvMode } // Option applies an option value for a config. @@ -66,13 +78,33 @@ func newConfig(opts []Option) *config { Propagators: otel.GetTextMapPropagator(), TracerProvider: otel.GetTracerProvider(), MeterProvider: otel.GetMeterProvider(), + semconvMode: parseSemconvMode(), } for _, o := range opts { o.apply(c) } + return c } +func parseSemconvMode() semconvMode { + val := os.Getenv("OTEL_SEMCONV_STABILITY_OPT_IN") + if val == "" { + return semconvModeNew + } + parts := strings.SplitSeq(val, ",") + for p := range parts { + p = strings.TrimSpace(p) + if p == "rpc/dup" { + return semconvModeDup + } + if p == "rpc/old" { + return semconvModeOld + } + } + return semconvModeNew +} + // WithPublicEndpoint configures the Handler to link the span with an incoming // span context. If this option is not provided, then the association is a child // association instead of a link. diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal/parse.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal/parse.go index 7d7f172e0..5174f4dd1 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal/parse.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal/parse.go @@ -8,6 +8,7 @@ import ( "strings" "go.opentelemetry.io/otel/attribute" + oldsemconv "go.opentelemetry.io/otel/semconv/v1.37.0" //nolint:depguard // Use of v1.37.0 is required for backward compatibility stability opt-in. semconv "go.opentelemetry.io/otel/semconv/v1.40.0" ) @@ -25,3 +26,28 @@ func ParseFullMethod(fullMethod string) (string, []attribute.KeyValue) { name := fullMethod[1:] return name, []attribute.KeyValue{semconv.RPCMethod(name)} } + +// ParseFullMethodOld returns a span name following the old OpenTelemetry semantic +// conventions as well as all applicable span attribute.KeyValue attributes based +// on a gRPC's FullMethod. +// Based on the implementation in: +// https://github.com/open-telemetry/opentelemetry-go-contrib/blob/072dcf8ad7e5e48b506e05720b29d8b078759606/instrumentation/google.golang.org/grpc/otelgrpc/internal/parse.go#L20 +func ParseFullMethodOld(fullMethod string) (string, []attribute.KeyValue) { + if !strings.HasPrefix(fullMethod, "/") { + return fullMethod, nil + } + name := fullMethod[1:] + parts := strings.Split(name, "/") + if len(parts) < 2 { + return name, []attribute.KeyValue{ + attribute.String("rpc.system", "grpc"), + } + } + service := parts[0] + method := parts[1] + return name, []attribute.KeyValue{ + oldsemconv.RPCSystemKey.String("grpc"), + oldsemconv.RPCServiceKey.String(service), + oldsemconv.RPCMethodKey.String(method), + } +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/stats_handler.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/stats_handler.go index be9282f29..c9c44c159 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/stats_handler.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/stats_handler.go @@ -12,11 +12,12 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/metric" + oldrpcconv "go.opentelemetry.io/otel/semconv/v1.37.0/rpcconv" //nolint:depguard // Use of v1.37.0 is required for backward compatibility stability opt-in. semconv "go.opentelemetry.io/otel/semconv/v1.40.0" "go.opentelemetry.io/otel/semconv/v1.40.0/rpcconv" "go.opentelemetry.io/otel/trace" + grpc_codes "google.golang.org/grpc/codes" - "google.golang.org/grpc/peer" "google.golang.org/grpc/stats" "google.golang.org/grpc/status" @@ -35,7 +36,8 @@ type serverHandler struct { tracer trace.Tracer - duration rpcconv.ServerCallDuration + duration rpcconv.ServerCallDuration + oldDuration oldrpcconv.ServerDuration } // NewServerHandler creates a stats.Handler for a gRPC server. @@ -59,15 +61,26 @@ func NewServerHandler(opts ...Option) stats.Handler { ) var err error - h.duration, err = rpcconv.NewServerCallDuration( - meter, - metric.WithExplicitBucketBoundaries( - 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, - 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10, - ), - ) - if err != nil { - otel.Handle(err) + if c.semconvMode == semconvModeOld || c.semconvMode == semconvModeDup { + oldDur, err := oldrpcconv.NewServerDuration(meter) + if err != nil { + otel.Handle(err) + } else { + h.oldDuration = oldDur + } + } + + if c.semconvMode == semconvModeNew || c.semconvMode == semconvModeDup { + h.duration, err = rpcconv.NewServerCallDuration( + meter, + metric.WithExplicitBucketBoundaries( + 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, + 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10, + ), + ) + if err != nil { + otel.Handle(err) + } } return h @@ -86,8 +99,23 @@ func (*serverHandler) HandleConn(context.Context, stats.ConnStats) { func (h *serverHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context { ctx = extract(ctx, h.Propagators) - name, attrs := internal.ParseFullMethod(info.FullMethodName) - attrs = append(attrs, semconv.RPCSystemNameGRPC) + var name string + var attrs []attribute.KeyValue + + switch h.semconvMode { + case semconvModeOld: + name, attrs = internal.ParseFullMethodOld(info.FullMethodName) + case semconvModeDup: + var attrsNew, attrsOld []attribute.KeyValue + name, attrsNew = internal.ParseFullMethod(info.FullMethodName) + _, attrsOld = internal.ParseFullMethodOld(info.FullMethodName) + // Combine both. We append New last so its rpc.method (fully qualified) wins when deduplicated. + attrs = append(append([]attribute.KeyValue{}, attrsOld...), attrsNew...) + attrs = append(attrs, semconv.RPCSystemNameGRPC) // New convention + default: // semconvModeNew + name, attrs = internal.ParseFullMethod(info.FullMethodName) + attrs = append(attrs, semconv.RPCSystemNameGRPC) + } record := true if h.Filter != nil { @@ -131,10 +159,19 @@ func (h *serverHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) cont // HandleRPC processes the RPC stats. func (h *serverHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) { + var dur metric.Float64Histogram + if h.semconvMode == semconvModeNew || h.semconvMode == semconvModeDup { + dur = h.duration.Inst() + } + var oldDur metric.Float64Histogram + if h.semconvMode == semconvModeOld || h.semconvMode == semconvModeDup { + oldDur = h.oldDuration.Inst() + } h.handleRPC( ctx, rs, - h.duration.Inst(), + dur, + oldDur, serverStatus, ) } @@ -144,7 +181,8 @@ type clientHandler struct { tracer trace.Tracer - duration rpcconv.ClientCallDuration + duration rpcconv.ClientCallDuration + oldDuration oldrpcconv.ClientDuration } // NewClientHandler creates a stats.Handler for a gRPC client. @@ -168,15 +206,26 @@ func NewClientHandler(opts ...Option) stats.Handler { ) var err error - h.duration, err = rpcconv.NewClientCallDuration( - meter, - metric.WithExplicitBucketBoundaries( - 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, - 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10, - ), - ) - if err != nil { - otel.Handle(err) + if c.semconvMode == semconvModeOld || c.semconvMode == semconvModeDup { + oldDur, err := oldrpcconv.NewClientDuration(meter) + if err != nil { + otel.Handle(err) + } else { + h.oldDuration = oldDur + } + } + + if c.semconvMode == semconvModeNew || c.semconvMode == semconvModeDup { + h.duration, err = rpcconv.NewClientCallDuration( + meter, + metric.WithExplicitBucketBoundaries( + 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, + 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10, + ), + ) + if err != nil { + otel.Handle(err) + } } return h @@ -184,8 +233,23 @@ func NewClientHandler(opts ...Option) stats.Handler { // TagRPC can attach some information to the given context. func (h *clientHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context { - name, attrs := internal.ParseFullMethod(info.FullMethodName) - attrs = append(attrs, semconv.RPCSystemNameGRPC) + var name string + var attrs []attribute.KeyValue + + switch h.semconvMode { + case semconvModeOld: + name, attrs = internal.ParseFullMethodOld(info.FullMethodName) + case semconvModeDup: + var attrsNew, attrsOld []attribute.KeyValue + name, attrsNew = internal.ParseFullMethod(info.FullMethodName) + _, attrsOld = internal.ParseFullMethodOld(info.FullMethodName) + // Combine both. We append New last so its rpc.method (fully qualified) wins when deduplicated. + attrs = append(append([]attribute.KeyValue{}, attrsOld...), attrsNew...) + attrs = append(attrs, semconv.RPCSystemNameGRPC) // New convention + default: // semconvModeNew + name, attrs = internal.ParseFullMethod(info.FullMethodName) + attrs = append(attrs, semconv.RPCSystemNameGRPC) + } record := true if h.Filter != nil { @@ -219,10 +283,19 @@ func (h *clientHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) cont // HandleRPC processes the RPC stats. func (h *clientHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) { + var dur metric.Float64Histogram + if h.semconvMode == semconvModeNew || h.semconvMode == semconvModeDup { + dur = h.duration.Inst() + } + var oldDur metric.Float64Histogram + if h.semconvMode == semconvModeOld || h.semconvMode == semconvModeDup { + oldDur = h.oldDuration.Inst() + } h.handleRPC( ctx, rs, - h.duration.Inst(), + dur, + oldDur, func(s *status.Status) (codes.Code, string) { return codes.Error, s.Message() }, @@ -243,6 +316,7 @@ func (*config) handleRPC( ctx context.Context, rs stats.RPCStats, duration metric.Float64Histogram, + oldDuration metric.Float64Histogram, recordStatus func(*status.Status) (codes.Code, string), ) { gctx, _ := ctx.Value(gRPCContextKey{}).(*gRPCContext) @@ -255,12 +329,23 @@ func (*config) handleRPC( switch rs := rs.(type) { case *stats.Begin: case *stats.InPayload: + case *stats.InHeader: + if !rs.Client && rs.LocalAddr != nil { + if span.IsRecording() { + span.SetAttributes(serverAddrAttrs(rs.LocalAddr.String())...) + } + // TODO: add server.address and server.port to metrics once the API supports opt-in attributes. + } case *stats.OutPayload: case *stats.OutTrailer: case *stats.OutHeader: - if span.IsRecording() { - if p, ok := peer.FromContext(ctx); ok { - span.SetAttributes(serverAddrAttrs(p.Addr.String())...) + if rs.Client && rs.RemoteAddr != nil && (span.IsRecording() || gctx != nil) { + attrs := serverAddrAttrs(rs.RemoteAddr.String()) + if span.IsRecording() { + span.SetAttributes(attrs...) + } + if gctx != nil { + gctx.metricAttrs = append(gctx.metricAttrs, attrs...) } } case *stats.End: @@ -298,7 +383,13 @@ func (*config) handleRPC( // Measure right before calling Record() to capture as much elapsed time as possible. elapsedTime := float64(rs.EndTime.Sub(rs.BeginTime)) / float64(time.Second) - duration.Record(ctx, elapsedTime, recordOpts...) + if duration != nil { + duration.Record(ctx, elapsedTime, recordOpts...) + } + if oldDuration != nil { + oldDuration.Record(ctx, elapsedTime*1000.0, recordOpts...) + } + default: return } diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/version.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/version.go index 535e63a07..1e81d31fe 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/version.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/version.go @@ -4,4 +4,4 @@ package otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" // Version is the current release version of the gRPC instrumentation. -const Version = "0.67.0" +const Version = "0.68.0" diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/server.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/server.go index 6dcf1b5b5..83c6ae246 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/server.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/server.go @@ -364,7 +364,9 @@ func (n HTTPServer) MetricAttributes(server string, req *http.Request, statusCod if statusCode > 0 { num++ } - + if route == "" && req.Pattern != "" { + route = httpRoute(req.Pattern) + } if route != "" { num++ } diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/version.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/version.go index 1d90fc264..835ec5aa7 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/version.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/version.go @@ -4,4 +4,4 @@ package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" // Version is the current release version of the otelhttp instrumentation. -const Version = "0.67.0" +const Version = "0.68.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/rpcconv/metric.go b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/rpcconv/metric.go new file mode 100644 index 000000000..089b0c457 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/rpcconv/metric.go @@ -0,0 +1,1010 @@ +// Code generated from semantic convention specification. DO NOT EDIT. + +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package rpcconv provides types and functionality for OpenTelemetry semantic +// conventions in the "rpc" namespace. +package rpcconv + +import ( + "context" + "sync" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/noop" +) + +var ( + addOptPool = &sync.Pool{New: func() any { return &[]metric.AddOption{} }} + recOptPool = &sync.Pool{New: func() any { return &[]metric.RecordOption{} }} +) + +// ClientDuration is an instrument used to record metric values conforming to the +// "rpc.client.duration" semantic conventions. It represents the measures the +// duration of outbound RPC. +type ClientDuration struct { + metric.Float64Histogram +} + +var newClientDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Measures the duration of outbound RPC."), + metric.WithUnit("ms"), +} + +// NewClientDuration returns a new ClientDuration instrument. +func NewClientDuration( + m metric.Meter, + opt ...metric.Float64HistogramOption, +) (ClientDuration, error) { + // Check if the meter is nil. + if m == nil { + return ClientDuration{noop.Float64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newClientDurationOpts + } else { + opt = append(opt, newClientDurationOpts...) + } + + i, err := m.Float64Histogram( + "rpc.client.duration", + opt..., + ) + if err != nil { + return ClientDuration{noop.Float64Histogram{}}, err + } + return ClientDuration{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientDuration) Inst() metric.Float64Histogram { + return m.Float64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ClientDuration) Name() string { + return "rpc.client.duration" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientDuration) Unit() string { + return "ms" +} + +// Description returns the semantic convention description of the instrument +func (ClientDuration) Description() string { + return "Measures the duration of outbound RPC." +} + +// Record records val to the current distribution for attrs. +// +// While streaming RPCs may record this metric as start-of-batch +// to end-of-batch, it's hard to interpret in practice. +// +// **Streaming**: N/A. +func (m ClientDuration) Record(ctx context.Context, val float64, attrs ...attribute.KeyValue) { + if len(attrs) == 0 { + m.Float64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributes(attrs...)) + m.Float64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// While streaming RPCs may record this metric as start-of-batch +// to end-of-batch, it's hard to interpret in practice. +// +// **Streaming**: N/A. +func (m ClientDuration) RecordSet(ctx context.Context, val float64, set attribute.Set) { + if set.Len() == 0 { + m.Float64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Float64Histogram.Record(ctx, val, *o...) +} + +// ClientRequestSize is an instrument used to record metric values conforming to +// the "rpc.client.request.size" semantic conventions. It represents the measures +// the size of RPC request messages (uncompressed). +type ClientRequestSize struct { + metric.Int64Histogram +} + +var newClientRequestSizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the size of RPC request messages (uncompressed)."), + metric.WithUnit("By"), +} + +// NewClientRequestSize returns a new ClientRequestSize instrument. +func NewClientRequestSize( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ClientRequestSize, error) { + // Check if the meter is nil. + if m == nil { + return ClientRequestSize{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newClientRequestSizeOpts + } else { + opt = append(opt, newClientRequestSizeOpts...) + } + + i, err := m.Int64Histogram( + "rpc.client.request.size", + opt..., + ) + if err != nil { + return ClientRequestSize{noop.Int64Histogram{}}, err + } + return ClientRequestSize{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientRequestSize) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ClientRequestSize) Name() string { + return "rpc.client.request.size" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientRequestSize) Unit() string { + return "By" +} + +// Description returns the semantic convention description of the instrument +func (ClientRequestSize) Description() string { + return "Measures the size of RPC request messages (uncompressed)." +} + +// Record records val to the current distribution for attrs. +// +// **Streaming**: Recorded per message in a streaming batch +func (m ClientRequestSize) Record(ctx context.Context, val int64, attrs ...attribute.KeyValue) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributes(attrs...)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// **Streaming**: Recorded per message in a streaming batch +func (m ClientRequestSize) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// ClientRequestsPerRPC is an instrument used to record metric values conforming +// to the "rpc.client.requests_per_rpc" semantic conventions. It represents the +// measures the number of messages received per RPC. +type ClientRequestsPerRPC struct { + metric.Int64Histogram +} + +var newClientRequestsPerRPCOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the number of messages received per RPC."), + metric.WithUnit("{count}"), +} + +// NewClientRequestsPerRPC returns a new ClientRequestsPerRPC instrument. +func NewClientRequestsPerRPC( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ClientRequestsPerRPC, error) { + // Check if the meter is nil. + if m == nil { + return ClientRequestsPerRPC{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newClientRequestsPerRPCOpts + } else { + opt = append(opt, newClientRequestsPerRPCOpts...) + } + + i, err := m.Int64Histogram( + "rpc.client.requests_per_rpc", + opt..., + ) + if err != nil { + return ClientRequestsPerRPC{noop.Int64Histogram{}}, err + } + return ClientRequestsPerRPC{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientRequestsPerRPC) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ClientRequestsPerRPC) Name() string { + return "rpc.client.requests_per_rpc" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientRequestsPerRPC) Unit() string { + return "{count}" +} + +// Description returns the semantic convention description of the instrument +func (ClientRequestsPerRPC) Description() string { + return "Measures the number of messages received per RPC." +} + +// Record records val to the current distribution for attrs. +// +// Should be 1 for all non-streaming RPCs. +// +// **Streaming**: This metric is required for server and client streaming RPCs +func (m ClientRequestsPerRPC) Record(ctx context.Context, val int64, attrs ...attribute.KeyValue) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributes(attrs...)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// Should be 1 for all non-streaming RPCs. +// +// **Streaming**: This metric is required for server and client streaming RPCs +func (m ClientRequestsPerRPC) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// ClientResponseSize is an instrument used to record metric values conforming to +// the "rpc.client.response.size" semantic conventions. It represents the +// measures the size of RPC response messages (uncompressed). +type ClientResponseSize struct { + metric.Int64Histogram +} + +var newClientResponseSizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the size of RPC response messages (uncompressed)."), + metric.WithUnit("By"), +} + +// NewClientResponseSize returns a new ClientResponseSize instrument. +func NewClientResponseSize( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ClientResponseSize, error) { + // Check if the meter is nil. + if m == nil { + return ClientResponseSize{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newClientResponseSizeOpts + } else { + opt = append(opt, newClientResponseSizeOpts...) + } + + i, err := m.Int64Histogram( + "rpc.client.response.size", + opt..., + ) + if err != nil { + return ClientResponseSize{noop.Int64Histogram{}}, err + } + return ClientResponseSize{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientResponseSize) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ClientResponseSize) Name() string { + return "rpc.client.response.size" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientResponseSize) Unit() string { + return "By" +} + +// Description returns the semantic convention description of the instrument +func (ClientResponseSize) Description() string { + return "Measures the size of RPC response messages (uncompressed)." +} + +// Record records val to the current distribution for attrs. +// +// **Streaming**: Recorded per response in a streaming batch +func (m ClientResponseSize) Record(ctx context.Context, val int64, attrs ...attribute.KeyValue) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributes(attrs...)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// **Streaming**: Recorded per response in a streaming batch +func (m ClientResponseSize) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// ClientResponsesPerRPC is an instrument used to record metric values conforming +// to the "rpc.client.responses_per_rpc" semantic conventions. It represents the +// measures the number of messages sent per RPC. +type ClientResponsesPerRPC struct { + metric.Int64Histogram +} + +var newClientResponsesPerRPCOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the number of messages sent per RPC."), + metric.WithUnit("{count}"), +} + +// NewClientResponsesPerRPC returns a new ClientResponsesPerRPC instrument. +func NewClientResponsesPerRPC( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ClientResponsesPerRPC, error) { + // Check if the meter is nil. + if m == nil { + return ClientResponsesPerRPC{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newClientResponsesPerRPCOpts + } else { + opt = append(opt, newClientResponsesPerRPCOpts...) + } + + i, err := m.Int64Histogram( + "rpc.client.responses_per_rpc", + opt..., + ) + if err != nil { + return ClientResponsesPerRPC{noop.Int64Histogram{}}, err + } + return ClientResponsesPerRPC{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientResponsesPerRPC) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ClientResponsesPerRPC) Name() string { + return "rpc.client.responses_per_rpc" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientResponsesPerRPC) Unit() string { + return "{count}" +} + +// Description returns the semantic convention description of the instrument +func (ClientResponsesPerRPC) Description() string { + return "Measures the number of messages sent per RPC." +} + +// Record records val to the current distribution for attrs. +// +// Should be 1 for all non-streaming RPCs. +// +// **Streaming**: This metric is required for server and client streaming RPCs +func (m ClientResponsesPerRPC) Record(ctx context.Context, val int64, attrs ...attribute.KeyValue) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributes(attrs...)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// Should be 1 for all non-streaming RPCs. +// +// **Streaming**: This metric is required for server and client streaming RPCs +func (m ClientResponsesPerRPC) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// ServerDuration is an instrument used to record metric values conforming to the +// "rpc.server.duration" semantic conventions. It represents the measures the +// duration of inbound RPC. +type ServerDuration struct { + metric.Float64Histogram +} + +var newServerDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Measures the duration of inbound RPC."), + metric.WithUnit("ms"), +} + +// NewServerDuration returns a new ServerDuration instrument. +func NewServerDuration( + m metric.Meter, + opt ...metric.Float64HistogramOption, +) (ServerDuration, error) { + // Check if the meter is nil. + if m == nil { + return ServerDuration{noop.Float64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newServerDurationOpts + } else { + opt = append(opt, newServerDurationOpts...) + } + + i, err := m.Float64Histogram( + "rpc.server.duration", + opt..., + ) + if err != nil { + return ServerDuration{noop.Float64Histogram{}}, err + } + return ServerDuration{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ServerDuration) Inst() metric.Float64Histogram { + return m.Float64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ServerDuration) Name() string { + return "rpc.server.duration" +} + +// Unit returns the semantic convention unit of the instrument +func (ServerDuration) Unit() string { + return "ms" +} + +// Description returns the semantic convention description of the instrument +func (ServerDuration) Description() string { + return "Measures the duration of inbound RPC." +} + +// Record records val to the current distribution for attrs. +// +// While streaming RPCs may record this metric as start-of-batch +// to end-of-batch, it's hard to interpret in practice. +// +// **Streaming**: N/A. +func (m ServerDuration) Record(ctx context.Context, val float64, attrs ...attribute.KeyValue) { + if len(attrs) == 0 { + m.Float64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributes(attrs...)) + m.Float64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// While streaming RPCs may record this metric as start-of-batch +// to end-of-batch, it's hard to interpret in practice. +// +// **Streaming**: N/A. +func (m ServerDuration) RecordSet(ctx context.Context, val float64, set attribute.Set) { + if set.Len() == 0 { + m.Float64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Float64Histogram.Record(ctx, val, *o...) +} + +// ServerRequestSize is an instrument used to record metric values conforming to +// the "rpc.server.request.size" semantic conventions. It represents the measures +// the size of RPC request messages (uncompressed). +type ServerRequestSize struct { + metric.Int64Histogram +} + +var newServerRequestSizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the size of RPC request messages (uncompressed)."), + metric.WithUnit("By"), +} + +// NewServerRequestSize returns a new ServerRequestSize instrument. +func NewServerRequestSize( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ServerRequestSize, error) { + // Check if the meter is nil. + if m == nil { + return ServerRequestSize{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newServerRequestSizeOpts + } else { + opt = append(opt, newServerRequestSizeOpts...) + } + + i, err := m.Int64Histogram( + "rpc.server.request.size", + opt..., + ) + if err != nil { + return ServerRequestSize{noop.Int64Histogram{}}, err + } + return ServerRequestSize{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ServerRequestSize) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ServerRequestSize) Name() string { + return "rpc.server.request.size" +} + +// Unit returns the semantic convention unit of the instrument +func (ServerRequestSize) Unit() string { + return "By" +} + +// Description returns the semantic convention description of the instrument +func (ServerRequestSize) Description() string { + return "Measures the size of RPC request messages (uncompressed)." +} + +// Record records val to the current distribution for attrs. +// +// **Streaming**: Recorded per message in a streaming batch +func (m ServerRequestSize) Record(ctx context.Context, val int64, attrs ...attribute.KeyValue) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributes(attrs...)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// **Streaming**: Recorded per message in a streaming batch +func (m ServerRequestSize) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// ServerRequestsPerRPC is an instrument used to record metric values conforming +// to the "rpc.server.requests_per_rpc" semantic conventions. It represents the +// measures the number of messages received per RPC. +type ServerRequestsPerRPC struct { + metric.Int64Histogram +} + +var newServerRequestsPerRPCOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the number of messages received per RPC."), + metric.WithUnit("{count}"), +} + +// NewServerRequestsPerRPC returns a new ServerRequestsPerRPC instrument. +func NewServerRequestsPerRPC( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ServerRequestsPerRPC, error) { + // Check if the meter is nil. + if m == nil { + return ServerRequestsPerRPC{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newServerRequestsPerRPCOpts + } else { + opt = append(opt, newServerRequestsPerRPCOpts...) + } + + i, err := m.Int64Histogram( + "rpc.server.requests_per_rpc", + opt..., + ) + if err != nil { + return ServerRequestsPerRPC{noop.Int64Histogram{}}, err + } + return ServerRequestsPerRPC{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ServerRequestsPerRPC) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ServerRequestsPerRPC) Name() string { + return "rpc.server.requests_per_rpc" +} + +// Unit returns the semantic convention unit of the instrument +func (ServerRequestsPerRPC) Unit() string { + return "{count}" +} + +// Description returns the semantic convention description of the instrument +func (ServerRequestsPerRPC) Description() string { + return "Measures the number of messages received per RPC." +} + +// Record records val to the current distribution for attrs. +// +// Should be 1 for all non-streaming RPCs. +// +// **Streaming** : This metric is required for server and client streaming RPCs +func (m ServerRequestsPerRPC) Record(ctx context.Context, val int64, attrs ...attribute.KeyValue) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributes(attrs...)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// Should be 1 for all non-streaming RPCs. +// +// **Streaming** : This metric is required for server and client streaming RPCs +func (m ServerRequestsPerRPC) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// ServerResponseSize is an instrument used to record metric values conforming to +// the "rpc.server.response.size" semantic conventions. It represents the +// measures the size of RPC response messages (uncompressed). +type ServerResponseSize struct { + metric.Int64Histogram +} + +var newServerResponseSizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the size of RPC response messages (uncompressed)."), + metric.WithUnit("By"), +} + +// NewServerResponseSize returns a new ServerResponseSize instrument. +func NewServerResponseSize( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ServerResponseSize, error) { + // Check if the meter is nil. + if m == nil { + return ServerResponseSize{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newServerResponseSizeOpts + } else { + opt = append(opt, newServerResponseSizeOpts...) + } + + i, err := m.Int64Histogram( + "rpc.server.response.size", + opt..., + ) + if err != nil { + return ServerResponseSize{noop.Int64Histogram{}}, err + } + return ServerResponseSize{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ServerResponseSize) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ServerResponseSize) Name() string { + return "rpc.server.response.size" +} + +// Unit returns the semantic convention unit of the instrument +func (ServerResponseSize) Unit() string { + return "By" +} + +// Description returns the semantic convention description of the instrument +func (ServerResponseSize) Description() string { + return "Measures the size of RPC response messages (uncompressed)." +} + +// Record records val to the current distribution for attrs. +// +// **Streaming**: Recorded per response in a streaming batch +func (m ServerResponseSize) Record(ctx context.Context, val int64, attrs ...attribute.KeyValue) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributes(attrs...)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// **Streaming**: Recorded per response in a streaming batch +func (m ServerResponseSize) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// ServerResponsesPerRPC is an instrument used to record metric values conforming +// to the "rpc.server.responses_per_rpc" semantic conventions. It represents the +// measures the number of messages sent per RPC. +type ServerResponsesPerRPC struct { + metric.Int64Histogram +} + +var newServerResponsesPerRPCOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the number of messages sent per RPC."), + metric.WithUnit("{count}"), +} + +// NewServerResponsesPerRPC returns a new ServerResponsesPerRPC instrument. +func NewServerResponsesPerRPC( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ServerResponsesPerRPC, error) { + // Check if the meter is nil. + if m == nil { + return ServerResponsesPerRPC{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newServerResponsesPerRPCOpts + } else { + opt = append(opt, newServerResponsesPerRPCOpts...) + } + + i, err := m.Int64Histogram( + "rpc.server.responses_per_rpc", + opt..., + ) + if err != nil { + return ServerResponsesPerRPC{noop.Int64Histogram{}}, err + } + return ServerResponsesPerRPC{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ServerResponsesPerRPC) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ServerResponsesPerRPC) Name() string { + return "rpc.server.responses_per_rpc" +} + +// Unit returns the semantic convention unit of the instrument +func (ServerResponsesPerRPC) Unit() string { + return "{count}" +} + +// Description returns the semantic convention description of the instrument +func (ServerResponsesPerRPC) Description() string { + return "Measures the number of messages sent per RPC." +} + +// Record records val to the current distribution for attrs. +// +// Should be 1 for all non-streaming RPCs. +// +// **Streaming**: This metric is required for server and client streaming RPCs +func (m ServerResponsesPerRPC) Record(ctx context.Context, val int64, attrs ...attribute.KeyValue) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributes(attrs...)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// Should be 1 for all non-streaming RPCs. +// +// **Streaming**: This metric is required for server and client streaming RPCs +func (m ServerResponsesPerRPC) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} diff --git a/vendor/golang.org/x/sync/errgroup/errgroup.go b/vendor/golang.org/x/sync/errgroup/errgroup.go index f69fd7546..c261a8ebb 100644 --- a/vendor/golang.org/x/sync/errgroup/errgroup.go +++ b/vendor/golang.org/x/sync/errgroup/errgroup.go @@ -109,7 +109,7 @@ func (g *Group) TryGo(f func() error) bool { if g.sem != nil { select { case g.sem <- token{}: - // Note: this allows barging iff channels in general allow barging. + // Note: this allows barging if and only if channels in general allow barging. default: return false } diff --git a/vendor/golang.org/x/sync/semaphore/semaphore.go b/vendor/golang.org/x/sync/semaphore/semaphore.go index b618162aa..040c5bc50 100644 --- a/vendor/golang.org/x/sync/semaphore/semaphore.go +++ b/vendor/golang.org/x/sync/semaphore/semaphore.go @@ -83,7 +83,7 @@ func (s *Weighted) Acquire(ctx context.Context, n int64) error { default: isFront := s.waiters.Front() == elem s.waiters.Remove(elem) - // If we're at the front and there're extra tokens left, notify other waiters. + // If we're at the front and there are extra tokens left, notify other waiters. if isFront && s.size > s.cur { s.notifyWaiters() } @@ -139,15 +139,15 @@ func (s *Weighted) notifyWaiters() { w := next.Value.(waiter) if s.size-s.cur < w.n { - // Not enough tokens for the next waiter. We could keep going (to try to + // Not enough tokens for the next waiter. We could keep going (to try to // find a waiter with a smaller request), but under load that could cause // starvation for large requests; instead, we leave all remaining waiters // blocked. // // Consider a semaphore used as a read-write lock, with N tokens, N - // readers, and one writer. Each reader can Acquire(1) to obtain a read - // lock. The writer can Acquire(N) to obtain a write lock, excluding all - // of the readers. If we allow the readers to jump ahead in the queue, + // readers, and one writer. Each reader can Acquire(1) to obtain a read + // lock. The writer can Acquire(N) to obtain a write lock, excluding all + // of the readers. If we allow the readers to jump ahead in the queue, // the writer will starve — there is always one token available for every // reader. break diff --git a/vendor/golang.org/x/sync/singleflight/singleflight.go b/vendor/golang.org/x/sync/singleflight/singleflight.go index 90ca138af..32e40bdc8 100644 --- a/vendor/golang.org/x/sync/singleflight/singleflight.go +++ b/vendor/golang.org/x/sync/singleflight/singleflight.go @@ -15,12 +15,12 @@ import ( "sync" ) -// errGoexit indicates the runtime.Goexit was called in -// the user given function. +// errGoexit indicates runtime.Goexit was called in +// the user-given function. var errGoexit = errors.New("runtime.Goexit was called") // A panicError is an arbitrary value recovered from a panic -// with the stack trace during the execution of given function. +// with the stack trace during the execution of the given function. type panicError struct { value any stack []byte @@ -204,7 +204,7 @@ func (g *Group) doCall(c *call, key string, fn func() (any, error)) { } } -// Forget tells the singleflight to forget about a key. Future calls +// Forget tells the singleflight to forget about a key. Future calls // to Do for this key will call the function rather than waiting for // an earlier call to complete. func (g *Group) Forget(key string) { diff --git a/vendor/google.golang.org/genproto/googleapis/type/calendarperiod/calendar_period.pb.go b/vendor/google.golang.org/genproto/googleapis/type/calendarperiod/calendar_period.pb.go index 25617f09e..5dce5bc39 100644 --- a/vendor/google.golang.org/genproto/googleapis/type/calendarperiod/calendar_period.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/type/calendarperiod/calendar_period.pb.go @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/vendor/google.golang.org/genproto/googleapis/type/date/date.pb.go b/vendor/google.golang.org/genproto/googleapis/type/date/date.pb.go index c9ffca961..fb3c7f257 100644 --- a/vendor/google.golang.org/genproto/googleapis/type/date/date.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/type/date/date.pb.go @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -40,14 +40,17 @@ const ( // date is relative to the Gregorian Calendar. This can represent one of the // following: // -// * A full date, with non-zero year, month, and day values -// * A month and day value, with a zero year, such as an anniversary -// * A year on its own, with zero month and day values -// * A year and month value, with a zero day, such as a credit card expiration -// date +// - A full date, with non-zero year, month, and day values. +// - A month and day, with a zero year (for example, an anniversary). +// - A year on its own, with a zero month and a zero day. +// - A year and month, with a zero day (for example, a credit card expiration +// date). // -// Related types are [google.type.TimeOfDay][google.type.TimeOfDay] and -// `google.protobuf.Timestamp`. +// Related types: +// +// * [google.type.TimeOfDay][google.type.TimeOfDay] +// * [google.type.DateTime][google.type.DateTime] +// * [google.protobuf.Timestamp][google.protobuf.Timestamp] type Date struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -127,13 +130,13 @@ var file_google_type_date_proto_rawDesc = []byte{ 0x04, 0x79, 0x65, 0x61, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x79, 0x65, 0x61, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, 0x79, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x64, 0x61, 0x79, 0x42, 0x5d, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x64, 0x61, 0x79, 0x42, 0x5a, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x42, 0x09, 0x44, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x67, 0x65, 0x6e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, - 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x64, 0x61, 0x74, 0x65, 0x3b, 0x64, 0x61, 0x74, 0x65, 0xf8, - 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x54, 0x50, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x64, 0x61, 0x74, 0x65, 0x3b, 0x64, 0x61, 0x74, 0x65, 0xa2, + 0x02, 0x03, 0x47, 0x54, 0x50, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/vendor/google.golang.org/genproto/googleapis/type/expr/expr.pb.go b/vendor/google.golang.org/genproto/googleapis/type/expr/expr.pb.go index dd2fb5fb4..547b4e3b4 100644 --- a/vendor/google.golang.org/genproto/googleapis/type/expr/expr.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/type/expr/expr.pb.go @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/vendor/google.golang.org/genproto/googleapis/type/timeofday/timeofday.pb.go b/vendor/google.golang.org/genproto/googleapis/type/timeofday/timeofday.pb.go index 5e8fdc571..a02316fe5 100644 --- a/vendor/google.golang.org/genproto/googleapis/type/timeofday/timeofday.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/type/timeofday/timeofday.pb.go @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -44,15 +44,19 @@ type TimeOfDay struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Hours of day in 24 hour format. Should be from 0 to 23. An API may choose - // to allow the value "24:00:00" for scenarios like business closing time. + // Hours of a day in 24 hour format. Must be greater than or equal to 0 and + // typically must be less than or equal to 23. An API may choose to allow the + // value "24:00:00" for scenarios like business closing time. Hours int32 `protobuf:"varint,1,opt,name=hours,proto3" json:"hours,omitempty"` - // Minutes of hour of day. Must be from 0 to 59. + // Minutes of an hour. Must be greater than or equal to 0 and less than or + // equal to 59. Minutes int32 `protobuf:"varint,2,opt,name=minutes,proto3" json:"minutes,omitempty"` - // Seconds of minutes of the time. Must normally be from 0 to 59. An API may - // allow the value 60 if it allows leap-seconds. + // Seconds of a minute. Must be greater than or equal to 0 and typically must + // be less than or equal to 59. An API may allow the value 60 if it allows + // leap-seconds. Seconds int32 `protobuf:"varint,3,opt,name=seconds,proto3" json:"seconds,omitempty"` - // Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. + // Fractions of seconds, in nanoseconds. Must be greater than or equal to 0 + // and less than or equal to 999,999,999. Nanos int32 `protobuf:"varint,4,opt,name=nanos,proto3" json:"nanos,omitempty"` } @@ -128,14 +132,14 @@ var file_google_type_timeofday_proto_rawDesc = []byte{ 0x6d, 0x69, 0x6e, 0x75, 0x74, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x42, 0x6c, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x67, + 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x42, 0x69, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x42, 0x0e, 0x54, 0x69, 0x6d, 0x65, 0x4f, 0x66, 0x44, 0x61, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x67, 0x65, 0x6e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x66, 0x64, - 0x61, 0x79, 0x3b, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x66, 0x64, 0x61, 0x79, 0xf8, 0x01, 0x01, 0xa2, - 0x02, 0x03, 0x47, 0x54, 0x50, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x79, 0x3b, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x66, 0x64, 0x61, 0x79, 0xa2, 0x02, 0x03, 0x47, + 0x54, 0x50, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/vendor/modules.txt b/vendor/modules.txt index 9b1ea69fa..2bdafbbee 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -45,14 +45,14 @@ cloud.google.com/go/iam/internal cloud.google.com/go/monitoring/apiv3/v2 cloud.google.com/go/monitoring/apiv3/v2/monitoringpb cloud.google.com/go/monitoring/internal -# cloud.google.com/go/storage v1.62.2 +# cloud.google.com/go/storage v1.62.3 ## explicit; go 1.25.0 cloud.google.com/go/storage cloud.google.com/go/storage/experimental cloud.google.com/go/storage/internal cloud.google.com/go/storage/internal/apiv2 cloud.google.com/go/storage/internal/apiv2/storagepb -# github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.1 +# github.com/Azure/azure-sdk-for-go/sdk/azcore v1.22.0 ## explicit; go 1.25.0 github.com/Azure/azure-sdk-for-go/sdk/azcore github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/internal/resource @@ -157,7 +157,7 @@ github.com/apparentlymart/go-textseg/v15/textseg # github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 ## explicit; go 1.13 github.com/asaskevich/govalidator -# github.com/aws/aws-sdk-go-v2 v1.41.11 +# github.com/aws/aws-sdk-go-v2 v1.42.0 ## explicit; go 1.24 github.com/aws/aws-sdk-go-v2/aws github.com/aws/aws-sdk-go-v2/aws/arn @@ -183,15 +183,15 @@ github.com/aws/aws-sdk-go-v2/internal/shareddefaults github.com/aws/aws-sdk-go-v2/internal/strings github.com/aws/aws-sdk-go-v2/internal/sync/singleflight github.com/aws/aws-sdk-go-v2/internal/timeconv -# github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.12 +# github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.13 ## explicit; go 1.24 github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream/eventstreamapi -# github.com/aws/aws-sdk-go-v2/config v1.32.22 +# github.com/aws/aws-sdk-go-v2/config v1.32.24 ## explicit; go 1.24 github.com/aws/aws-sdk-go-v2/config github.com/aws/aws-sdk-go-v2/config/internal/ini -# github.com/aws/aws-sdk-go-v2/credentials v1.19.21 +# github.com/aws/aws-sdk-go-v2/credentials v1.19.23 ## explicit; go 1.24 github.com/aws/aws-sdk-go-v2/credentials github.com/aws/aws-sdk-go-v2/credentials/ec2rolecreds @@ -201,7 +201,7 @@ github.com/aws/aws-sdk-go-v2/credentials/logincreds github.com/aws/aws-sdk-go-v2/credentials/processcreds github.com/aws/aws-sdk-go-v2/credentials/ssocreds github.com/aws/aws-sdk-go-v2/credentials/stscreds -# github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.27 +# github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.29 ## explicit; go 1.24 github.com/aws/aws-sdk-go-v2/feature/ec2/imds github.com/aws/aws-sdk-go-v2/feature/ec2/imds/internal/config @@ -209,59 +209,59 @@ github.com/aws/aws-sdk-go-v2/feature/ec2/imds/internal/config ## explicit; go 1.24 github.com/aws/aws-sdk-go-v2/feature/s3/transfermanager github.com/aws/aws-sdk-go-v2/feature/s3/transfermanager/types -# github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.27 +# github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.29 ## explicit; go 1.24 github.com/aws/aws-sdk-go-v2/internal/configsources -# github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.27 +# github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.29 ## explicit; go 1.24 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 -# github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.28 +# github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.30 ## explicit; go 1.24 github.com/aws/aws-sdk-go-v2/internal/v4a github.com/aws/aws-sdk-go-v2/internal/v4a/internal/crypto github.com/aws/aws-sdk-go-v2/internal/v4a/internal/v4 -# github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.11 +# github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.12 ## explicit; go 1.24 github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding -# github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.20 +# github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.22 ## explicit; go 1.24 github.com/aws/aws-sdk-go-v2/service/internal/checksum -# github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.27 +# github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.29 ## explicit; go 1.24 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url -# github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.27 +# github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.29 ## explicit; go 1.24 github.com/aws/aws-sdk-go-v2/service/internal/s3shared github.com/aws/aws-sdk-go-v2/service/internal/s3shared/arn github.com/aws/aws-sdk-go-v2/service/internal/s3shared/config -# github.com/aws/aws-sdk-go-v2/service/s3 v1.103.1 +# github.com/aws/aws-sdk-go-v2/service/s3 v1.103.3 ## explicit; go 1.24 github.com/aws/aws-sdk-go-v2/service/s3 github.com/aws/aws-sdk-go-v2/service/s3/internal/arn github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations github.com/aws/aws-sdk-go-v2/service/s3/internal/endpoints github.com/aws/aws-sdk-go-v2/service/s3/types -# github.com/aws/aws-sdk-go-v2/service/signin v1.1.3 +# github.com/aws/aws-sdk-go-v2/service/signin v1.1.5 ## explicit; go 1.24 github.com/aws/aws-sdk-go-v2/service/signin github.com/aws/aws-sdk-go-v2/service/signin/internal/endpoints github.com/aws/aws-sdk-go-v2/service/signin/types -# github.com/aws/aws-sdk-go-v2/service/sso v1.31.1 +# github.com/aws/aws-sdk-go-v2/service/sso v1.31.3 ## explicit; go 1.24 github.com/aws/aws-sdk-go-v2/service/sso github.com/aws/aws-sdk-go-v2/service/sso/internal/endpoints github.com/aws/aws-sdk-go-v2/service/sso/types -# github.com/aws/aws-sdk-go-v2/service/ssooidc v1.36.4 +# github.com/aws/aws-sdk-go-v2/service/ssooidc v1.36.6 ## explicit; go 1.24 github.com/aws/aws-sdk-go-v2/service/ssooidc github.com/aws/aws-sdk-go-v2/service/ssooidc/internal/endpoints github.com/aws/aws-sdk-go-v2/service/ssooidc/types -# github.com/aws/aws-sdk-go-v2/service/sts v1.43.1 +# github.com/aws/aws-sdk-go-v2/service/sts v1.43.3 ## explicit; go 1.24 github.com/aws/aws-sdk-go-v2/service/sts github.com/aws/aws-sdk-go-v2/service/sts/internal/endpoints github.com/aws/aws-sdk-go-v2/service/sts/types -# github.com/aws/smithy-go v1.27.0 +# github.com/aws/smithy-go v1.27.1 ## explicit; go 1.24 github.com/aws/smithy-go github.com/aws/smithy-go/auth @@ -318,8 +318,8 @@ github.com/cncf/xds/go/xds/data/orca/v3 github.com/cncf/xds/go/xds/service/orca/v3 github.com/cncf/xds/go/xds/type/matcher/v3 github.com/cncf/xds/go/xds/type/v3 -# github.com/coreos/go-oidc/v3 v3.17.0 -## explicit; go 1.24.0 +# github.com/coreos/go-oidc/v3 v3.18.0 +## explicit; go 1.25.0 github.com/coreos/go-oidc/v3/oidc # github.com/cyberphone/json-canonicalization v0.0.0-20241213102144-19d51d7fe467 ## explicit @@ -402,8 +402,8 @@ github.com/evanphx/json-patch/v5/internal/json # github.com/felixge/httpsnoop v1.0.4 ## explicit; go 1.13 github.com/felixge/httpsnoop -# github.com/fsnotify/fsnotify v1.9.0 -## explicit; go 1.17 +# github.com/fsnotify/fsnotify v1.10.1 +## explicit; go 1.23 github.com/fsnotify/fsnotify github.com/fsnotify/fsnotify/internal # github.com/fxamacker/cbor/v2 v2.9.0 @@ -611,9 +611,9 @@ github.com/google/go-containerregistry/pkg/v1/static github.com/google/go-containerregistry/pkg/v1/stream github.com/google/go-containerregistry/pkg/v1/tarball github.com/google/go-containerregistry/pkg/v1/types -# github.com/google/go-github/v73 v73.0.0 -## explicit; go 1.23.0 -github.com/google/go-github/v73/github +# github.com/google/go-github/v88 v88.0.0 +## explicit; go 1.25.0 +github.com/google/go-github/v88/github # github.com/google/go-querystring v1.2.0 ## explicit; go 1.13 github.com/google/go-querystring/query @@ -859,8 +859,8 @@ github.com/secure-systems-lab/go-securesystemslib/signerverifier # github.com/shibumi/go-pathspec v1.3.0 ## explicit; go 1.17 github.com/shibumi/go-pathspec -# github.com/sigstore/cosign/v3 v3.0.6 -## explicit; go 1.25.7 +# github.com/sigstore/cosign/v3 v3.1.0 +## explicit; go 1.26.0 github.com/sigstore/cosign/v3/internal/pkg/cosign github.com/sigstore/cosign/v3/internal/pkg/cosign/payload/size github.com/sigstore/cosign/v3/internal/pkg/now @@ -1073,11 +1073,11 @@ go.opentelemetry.io/auto/sdk/internal/telemetry # go.opentelemetry.io/contrib/detectors/gcp v1.42.0 ## explicit; go 1.25.0 go.opentelemetry.io/contrib/detectors/gcp -# go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0 +# go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.68.0 ## explicit; go 1.25.0 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal -# go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0 +# go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0 ## explicit; go 1.25.0 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request @@ -1096,6 +1096,7 @@ go.opentelemetry.io/otel/internal/global go.opentelemetry.io/otel/propagation go.opentelemetry.io/otel/semconv/v1.17.0 go.opentelemetry.io/otel/semconv/v1.37.0 +go.opentelemetry.io/otel/semconv/v1.37.0/rpcconv go.opentelemetry.io/otel/semconv/v1.40.0 go.opentelemetry.io/otel/semconv/v1.40.0/httpconv go.opentelemetry.io/otel/semconv/v1.40.0/otelconv @@ -1253,7 +1254,7 @@ golang.org/x/oauth2/google/internal/stsexchange golang.org/x/oauth2/internal golang.org/x/oauth2/jws golang.org/x/oauth2/jwt -# golang.org/x/sync v0.20.0 +# golang.org/x/sync v0.21.0 ## explicit; go 1.25.0 golang.org/x/sync/errgroup golang.org/x/sync/semaphore @@ -1349,7 +1350,7 @@ google.golang.org/api/storage/v1 google.golang.org/api/transport google.golang.org/api/transport/grpc google.golang.org/api/transport/http -# google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7 +# google.golang.org/genproto v0.0.0-20260406210006-6f92a3bedf2d ## explicit; go 1.25.0 google.golang.org/genproto/googleapis/type/calendarperiod google.golang.org/genproto/googleapis/type/date