From 12eaf763b1f737de570a24904c36d78e34952e08 Mon Sep 17 00:00:00 2001 From: Miguel Elias dos Santos Date: Mon, 6 May 2024 22:13:29 +1000 Subject: [PATCH] Update go-github to v61 + gen endpoints --- .vscode/launch.json | 12 +++ go.mod | 2 +- go.sum | 4 +- src/mock/endpointpattern.go | 120 +++++++++++++---------- src/mock/endpointpattern_test.go | 2 +- src/mock/server_options_external_test.go | 2 +- src/mock/server_options_test.go | 2 +- src/mock/server_test.go | 2 +- src/mock/utils.go | 2 +- 9 files changed, 90 insertions(+), 58 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..f9d44a9 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,12 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Main", + "type": "go", + "request": "launch", + "mode": "auto", + "program": "main.go" + } + ] +} \ No newline at end of file diff --git a/go.mod b/go.mod index 448cec0..8b03d9f 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.21 require ( github.com/buger/jsonparser v1.1.1 github.com/go-kit/log v0.2.1 - github.com/google/go-github/v59 v59.0.0 + github.com/google/go-github/v61 v61.0.0 github.com/gorilla/mux v1.8.0 golang.org/x/time v0.3.0 ) diff --git a/go.sum b/go.sum index 9b77250..9bdea4d 100644 --- a/go.sum +++ b/go.sum @@ -7,8 +7,8 @@ github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KE github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-github/v59 v59.0.0 h1:7h6bgpF5as0YQLLkEiVqpgtJqjimMYhBkD4jT5aN3VA= -github.com/google/go-github/v59 v59.0.0/go.mod h1:rJU4R0rQHFVFDOkqGWxfLNo6vEk4dv40oDjhV/gH6wM= +github.com/google/go-github/v61 v61.0.0 h1:VwQCBwhyE9JclCI+22/7mLB1PuU9eowCXKY5pNlu1go= +github.com/google/go-github/v61 v61.0.0/go.mod h1:0WR+KmsWX75G2EbpyGsGmradjo3IiciuI4BmdVCobQY= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= diff --git a/src/mock/endpointpattern.go b/src/mock/endpointpattern.go index ccf8e61..5c99ded 100644 --- a/src/mock/endpointpattern.go +++ b/src/mock/endpointpattern.go @@ -162,6 +162,11 @@ var GetEmojis EndpointPattern = EndpointPattern{ Method: "GET", } +var GetEnterprisesCopilotUsageByEnterprise EndpointPattern = EndpointPattern{ + Pattern: "/enterprises/{enterprise}/copilot/usage", + Method: "GET", +} + var GetEnterprisesDependabotAlertsByEnterprise EndpointPattern = EndpointPattern{ Pattern: "/enterprises/{enterprise}/dependabot/alerts", Method: "GET", @@ -767,6 +772,11 @@ var DeleteOrgsCopilotBillingSelectedUsersByOrg EndpointPattern = EndpointPattern Method: "DELETE", } +var GetOrgsCopilotUsageByOrg EndpointPattern = EndpointPattern{ + Pattern: "/orgs/{org}/copilot/usage", + Method: "GET", +} + var GetOrgsDependabotAlertsByOrg EndpointPattern = EndpointPattern{ Pattern: "/orgs/{org}/dependabot/alerts", Method: "GET", @@ -1337,6 +1347,11 @@ var GetOrgsSettingsBillingSharedStorageByOrg EndpointPattern = EndpointPattern{ Method: "GET", } +var GetOrgsTeamCopilotUsageByOrgByTeamSlug EndpointPattern = EndpointPattern{ + Pattern: "/orgs/{org}/team/{team_slug}/copilot/usage", + Method: "GET", +} + var GetOrgsTeamsByOrg EndpointPattern = EndpointPattern{ Pattern: "/orgs/{org}/teams", Method: "GET", @@ -2702,6 +2717,56 @@ var DeleteReposEnvironmentsDeploymentProtectionRulesByOwnerByRepoByEnvironmentNa Method: "DELETE", } +var GetReposEnvironmentsSecretsByOwnerByRepoByEnvironmentName EndpointPattern = EndpointPattern{ + Pattern: "/repos/{owner}/{repo}/environments/{environment_name}/secrets", + Method: "GET", +} + +var GetReposEnvironmentsSecretsPublicKeyByOwnerByRepoByEnvironmentName EndpointPattern = EndpointPattern{ + Pattern: "/repos/{owner}/{repo}/environments/{environment_name}/secrets/public-key", + Method: "GET", +} + +var GetReposEnvironmentsSecretsByOwnerByRepoByEnvironmentNameBySecretName EndpointPattern = EndpointPattern{ + Pattern: "/repos/{owner}/{repo}/environments/{environment_name}/secrets/{secret_name}", + Method: "GET", +} + +var PutReposEnvironmentsSecretsByOwnerByRepoByEnvironmentNameBySecretName EndpointPattern = EndpointPattern{ + Pattern: "/repos/{owner}/{repo}/environments/{environment_name}/secrets/{secret_name}", + Method: "PUT", +} + +var DeleteReposEnvironmentsSecretsByOwnerByRepoByEnvironmentNameBySecretName EndpointPattern = EndpointPattern{ + Pattern: "/repos/{owner}/{repo}/environments/{environment_name}/secrets/{secret_name}", + Method: "DELETE", +} + +var GetReposEnvironmentsVariablesByOwnerByRepoByEnvironmentName EndpointPattern = EndpointPattern{ + Pattern: "/repos/{owner}/{repo}/environments/{environment_name}/variables", + Method: "GET", +} + +var PostReposEnvironmentsVariablesByOwnerByRepoByEnvironmentName EndpointPattern = EndpointPattern{ + Pattern: "/repos/{owner}/{repo}/environments/{environment_name}/variables", + Method: "POST", +} + +var GetReposEnvironmentsVariablesByOwnerByRepoByEnvironmentNameByName EndpointPattern = EndpointPattern{ + Pattern: "/repos/{owner}/{repo}/environments/{environment_name}/variables/{name}", + Method: "GET", +} + +var PatchReposEnvironmentsVariablesByOwnerByRepoByEnvironmentNameByName EndpointPattern = EndpointPattern{ + Pattern: "/repos/{owner}/{repo}/environments/{environment_name}/variables/{name}", + Method: "PATCH", +} + +var DeleteReposEnvironmentsVariablesByOwnerByRepoByEnvironmentNameByName EndpointPattern = EndpointPattern{ + Pattern: "/repos/{owner}/{repo}/environments/{environment_name}/variables/{name}", + Method: "DELETE", +} + var GetReposEventsByOwnerByRepo EndpointPattern = EndpointPattern{ Pattern: "/repos/{owner}/{repo}/events", Method: "GET", @@ -3232,6 +3297,11 @@ var GetReposPagesHealthByOwnerByRepo EndpointPattern = EndpointPattern{ Method: "GET", } +var GetReposPrivateVulnerabilityReportingByOwnerByRepo EndpointPattern = EndpointPattern{ + Pattern: "/repos/{owner}/{repo}/private-vulnerability-reporting", + Method: "GET", +} + var PutReposPrivateVulnerabilityReportingByOwnerByRepo EndpointPattern = EndpointPattern{ Pattern: "/repos/{owner}/{repo}/private-vulnerability-reporting", Method: "PUT", @@ -3752,56 +3822,6 @@ var GetRepositories EndpointPattern = EndpointPattern{ Method: "GET", } -var GetRepositoriesEnvironmentsSecretsByRepositoryIdByEnvironmentName EndpointPattern = EndpointPattern{ - Pattern: "/repositories/{repository_id}/environments/{environment_name}/secrets", - Method: "GET", -} - -var GetRepositoriesEnvironmentsSecretsPublicKeyByRepositoryIdByEnvironmentName EndpointPattern = EndpointPattern{ - Pattern: "/repositories/{repository_id}/environments/{environment_name}/secrets/public-key", - Method: "GET", -} - -var GetRepositoriesEnvironmentsSecretsByRepositoryIdByEnvironmentNameBySecretName EndpointPattern = EndpointPattern{ - Pattern: "/repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}", - Method: "GET", -} - -var PutRepositoriesEnvironmentsSecretsByRepositoryIdByEnvironmentNameBySecretName EndpointPattern = EndpointPattern{ - Pattern: "/repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}", - Method: "PUT", -} - -var DeleteRepositoriesEnvironmentsSecretsByRepositoryIdByEnvironmentNameBySecretName EndpointPattern = EndpointPattern{ - Pattern: "/repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}", - Method: "DELETE", -} - -var GetRepositoriesEnvironmentsVariablesByRepositoryIdByEnvironmentName EndpointPattern = EndpointPattern{ - Pattern: "/repositories/{repository_id}/environments/{environment_name}/variables", - Method: "GET", -} - -var PostRepositoriesEnvironmentsVariablesByRepositoryIdByEnvironmentName EndpointPattern = EndpointPattern{ - Pattern: "/repositories/{repository_id}/environments/{environment_name}/variables", - Method: "POST", -} - -var GetRepositoriesEnvironmentsVariablesByRepositoryIdByEnvironmentNameByName EndpointPattern = EndpointPattern{ - Pattern: "/repositories/{repository_id}/environments/{environment_name}/variables/{name}", - Method: "GET", -} - -var PatchRepositoriesEnvironmentsVariablesByRepositoryIdByEnvironmentNameByName EndpointPattern = EndpointPattern{ - Pattern: "/repositories/{repository_id}/environments/{environment_name}/variables/{name}", - Method: "PATCH", -} - -var DeleteRepositoriesEnvironmentsVariablesByRepositoryIdByEnvironmentNameByName EndpointPattern = EndpointPattern{ - Pattern: "/repositories/{repository_id}/environments/{environment_name}/variables/{name}", - Method: "DELETE", -} - var GetSearchCode EndpointPattern = EndpointPattern{ Pattern: "/search/code", Method: "GET", diff --git a/src/mock/endpointpattern_test.go b/src/mock/endpointpattern_test.go index 1832ce5..4706ea4 100644 --- a/src/mock/endpointpattern_test.go +++ b/src/mock/endpointpattern_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v61/github" ) func TestRepoGetContents(t *testing.T) { diff --git a/src/mock/server_options_external_test.go b/src/mock/server_options_external_test.go index b945491..cc62323 100644 --- a/src/mock/server_options_external_test.go +++ b/src/mock/server_options_external_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v61/github" "github.com/migueleliasweb/go-github-mock/src/mock" ) diff --git a/src/mock/server_options_test.go b/src/mock/server_options_test.go index 72ed3d2..4de0723 100644 --- a/src/mock/server_options_test.go +++ b/src/mock/server_options_test.go @@ -3,7 +3,7 @@ package mock import ( "testing" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v61/github" "github.com/gorilla/mux" ) diff --git a/src/mock/server_test.go b/src/mock/server_test.go index 7556f60..eb5e203 100644 --- a/src/mock/server_test.go +++ b/src/mock/server_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v61/github" ) func TestNewMockedHTTPClient(t *testing.T) { diff --git a/src/mock/utils.go b/src/mock/utils.go index f0e1750..0a2366d 100644 --- a/src/mock/utils.go +++ b/src/mock/utils.go @@ -4,7 +4,7 @@ import ( "encoding/json" "net/http" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v61/github" ) // MustMarshal helper function that wraps json.Marshal