HFtest / finalHFtestGitlab.json
linaABUyousef's picture
Upload finalHFtestGitlab.json
9a19737 verified
Invalid JSON: Unexpected non-whitespace character after JSON at line 2, column 1
{"element_type":"file","project_name":"finalHFtestGitlab","uuid":"9cb41bfa-e8ee-4355-a886-6e83675e5c04","name":"applications.go","imports":"import (\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/applications.go","code":"\/\/\n\/\/ Copyright 2021, Sander van Harmelen\n\/\/\n\/\/ Licensed under the Apache License, Version 2.0 (the \"License\");\n\/\/ you may not use this file except in compliance with the License.\n\/\/ You may obtain a copy of the License at\n\/\/\n\/\/ http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\/\/\n\/\/ Unless required by applicable law or agreed to in writing, software\n\/\/ distributed under the License is distributed on an \"AS IS\" BASIS,\n\/\/ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\/\/ See the License for the specific language governing permissions and\n\/\/ limitations under the License.\n\/\/\n\npackage main\n\nimport (\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)\n\nfunc applicationsExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t\/\/ Create an application\n\topts := &gitlab.CreateApplicationOptions{\n\t\tName: gitlab.Ptr(\"Travis\"),\n\t\tRedirectURI: gitlab.Ptr(\"http:\/\/example.org\"),\n\t\tScopes: gitlab.Ptr(\"api\"),\n\t}\n\tcreated, _, err := git.Applications.CreateApplication(opts)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Printf(\"Last created application : %v\", created)\n\n\t\/\/ List all applications\n\tapplications, _, err := git.Applications.ListApplications(&gitlab.ListApplicationsOptions{})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor _, app := range applications {\n\t\tlog.Printf(\"Found app : %v\", app)\n\t}\n\n\t\/\/ Delete an application\n\tresp, err := git.Applications.DeleteApplication(created.ID)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"Status code response : %d\", resp.StatusCode)\n}\n","global_vars":"","package":"package main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"cc12d03e-58a5-43ce-9c38-74b75e0417cb","name":"applicationsExample","imports":"['\"log\"']","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/applications.go","code":"func applicationsExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t\/\/ Create an application\n\topts := &gitlab.CreateApplicationOptions{\n\t\tName: gitlab.Ptr(\"Travis\"),\n\t\tRedirectURI: gitlab.Ptr(\"http:\/\/example.org\"),\n\t\tScopes: gitlab.Ptr(\"api\"),\n\t}\n\tcreated, _, err := git.Applications.CreateApplication(opts)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Printf(\"Last created application : %v\", created)\n\n\t\/\/ List all applications\n\tapplications, _, err := git.Applications.ListApplications(&gitlab.ListApplicationsOptions{})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor _, app := range applications {\n\t\tlog.Printf(\"Found app : %v\", app)\n\t}\n\n\t\/\/ Delete an application\n\tresp, err := git.Applications.DeleteApplication(created.ID)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"Status code response : %d\", resp.StatusCode)\n}","global_vars":"","package":"main","tags":""}
{"element_type":"file","project_name":"finalHFtestGitlab","uuid":"f748e4e9-9a0b-4f0d-9f9e-7203905f42f5","name":"basic_auth.go","imports":"import (\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/basic_auth.go","code":"\/\/\n\/\/ Copyright 2021, Sander van Harmelen\n\/\/\n\/\/ Licensed under the Apache License, Version 2.0 (the \"License\");\n\/\/ you may not use this file except in compliance with the License.\n\/\/ You may obtain a copy of the License at\n\/\/\n\/\/ http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\/\/\n\/\/ Unless required by applicable law or agreed to in writing, software\n\/\/ distributed under the License is distributed on an \"AS IS\" BASIS,\n\/\/ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\/\/ See the License for the specific language governing permissions and\n\/\/ limitations under the License.\n\/\/\n\npackage main\n\nimport (\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)\n\n\/\/ This example shows how to create a client with username and password.\nfunc basicAuthExample() {\n\tgit, err := gitlab.NewBasicAuthClient(\n\t\t\"svanharmelen\",\n\t\t\"password\",\n\t\tgitlab.WithBaseURL(\"https:\/\/gitlab.company.com\"),\n\t)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t\/\/ List all projects\n\tprojects, _, err := git.Projects.ListProjects(nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"Found %d projects\", len(projects))\n}\n","global_vars":"","package":"package main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"d9f364f8-7744-4982-87ac-e506219c342a","name":"basicAuthExample","imports":"['\"log\"']","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/basic_auth.go","code":"func basicAuthExample() {\n\tgit, err := gitlab.NewBasicAuthClient(\n\t\t\"svanharmelen\",\n\t\t\"password\",\n\t\tgitlab.WithBaseURL(\"https:\/\/gitlab.company.com\"),\n\t)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t\/\/ List all projects\n\tprojects, _, err := git.Projects.ListProjects(nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"Found %d projects\", len(projects))\n}","global_vars":"","package":"main","tags":""}
{"element_type":"file","project_name":"finalHFtestGitlab","uuid":"c85f0858-d093-4839-9a3b-7ff71043d046","name":"bitbucket_import.go","imports":"import (\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/bitbucket_import.go","code":"package main\n\nimport (\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)\n\nfunc bitbucketCloudExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tcloudOpt := &gitlab.ImportRepositoryFromBitbucketCloudOptions{\n\t\tBitbucketUsername: gitlab.Ptr(\"username\"),\n\t\tBitbucketAppPassword: gitlab.Ptr(\"password\"),\n\t\tRepoPath: gitlab.Ptr(\"some\/repo\"),\n\t\tTargetNamespace: gitlab.Ptr(\"some-group\"),\n\t\tNewName: gitlab.Ptr(\"some-repo\"),\n\t}\n\tcloudResp, _, err := git.Import.ImportRepositoryFromBitbucketCloud(cloudOpt)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Print(cloudResp.String())\n}\n\nfunc bitbucketServerExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tserverOpt := &gitlab.ImportRepositoryFromBitbucketServerOptions{\n\t\tBitbucketServerUrl: gitlab.Ptr(\"https:\/\/bitbucket.example.com\"),\n\t\tBitbucketServerUsername: gitlab.Ptr(\"username\"),\n\t\tPersonalAccessToken: gitlab.Ptr(\"access-token\"),\n\t\tBitbucketServerProject: gitlab.Ptr(\"some-project\"),\n\t\tBitbucketServerRepo: gitlab.Ptr(\"some-repo\"),\n\t\tNewName: gitlab.Ptr(\"some-other-repo\"),\n\t\tNewNamespace: gitlab.Ptr(\"some-group\"),\n\t\tTimeoutStrategy: gitlab.Ptr(\"pessimistic\"),\n\t}\n\tserverResp, _, err := git.Import.ImportRepositoryFromBitbucketServer(serverOpt)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Print(serverResp.String())\n}\n","global_vars":"","package":"package main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"f1345a1b-96b7-45df-bae4-d423f0e0e4ed","name":"bitbucketCloudExample","imports":"['\"log\"']","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/bitbucket_import.go","code":"func bitbucketCloudExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tcloudOpt := &gitlab.ImportRepositoryFromBitbucketCloudOptions{\n\t\tBitbucketUsername: gitlab.Ptr(\"username\"),\n\t\tBitbucketAppPassword: gitlab.Ptr(\"password\"),\n\t\tRepoPath: gitlab.Ptr(\"some\/repo\"),\n\t\tTargetNamespace: gitlab.Ptr(\"some-group\"),\n\t\tNewName: gitlab.Ptr(\"some-repo\"),\n\t}\n\tcloudResp, _, err := git.Import.ImportRepositoryFromBitbucketCloud(cloudOpt)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Print(cloudResp.String())\n}","global_vars":"","package":"main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"e613c921-35b8-4890-9859-878cfbabbd4f","name":"bitbucketServerExample","imports":"['\"log\"']","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/bitbucket_import.go","code":"func bitbucketServerExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tserverOpt := &gitlab.ImportRepositoryFromBitbucketServerOptions{\n\t\tBitbucketServerUrl: gitlab.Ptr(\"https:\/\/bitbucket.example.com\"),\n\t\tBitbucketServerUsername: gitlab.Ptr(\"username\"),\n\t\tPersonalAccessToken: gitlab.Ptr(\"access-token\"),\n\t\tBitbucketServerProject: gitlab.Ptr(\"some-project\"),\n\t\tBitbucketServerRepo: gitlab.Ptr(\"some-repo\"),\n\t\tNewName: gitlab.Ptr(\"some-other-repo\"),\n\t\tNewNamespace: gitlab.Ptr(\"some-group\"),\n\t\tTimeoutStrategy: gitlab.Ptr(\"pessimistic\"),\n\t}\n\tserverResp, _, err := git.Import.ImportRepositoryFromBitbucketServer(serverOpt)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Print(serverResp.String())\n}","global_vars":"","package":"main","tags":""}
{"element_type":"file","project_name":"finalHFtestGitlab","uuid":"06dd2287-87b6-42fb-afee-e2c5c037c5a4","name":"cluster_agents.go","imports":"import (\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/cluster_agents.go","code":"\/\/\n\/\/ Copyright 2021, Timo Furrer <tuxtimo@gmail.com>\n\/\/\n\/\/ Licensed under the Apache License, Version 2.0 (the \"License\");\n\/\/ you may not use this file except in compliance with the License.\n\/\/ You may obtain a copy of the License at\n\/\/\n\/\/ http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\/\/\n\/\/ Unless required by applicable law or agreed to in writing, software\n\/\/ distributed under the License is distributed on an \"AS IS\" BASIS,\n\/\/ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\/\/ See the License for the specific language governing permissions and\n\/\/ limitations under the License.\n\/\/\n\npackage main\n\nimport (\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)\n\nfunc clusterAgentsExample() {\n\tgit, err := gitlab.NewClient(\"tokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tprojectID := 33\n\topt := &gitlab.RegisterAgentOptions{\n\t\tName: gitlab.Ptr(\"agent-2\"),\n\t}\n\n\t\/\/ Register Cluster Agent\n\tclusterAgent, _, err := git.ClusterAgents.RegisterAgent(projectID, opt)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"Cluster Agent: %+v\\n\", clusterAgent)\n\n\t\/\/ List Cluster Agents\n\tclusterAgents, _, err := git.ClusterAgents.ListAgents(projectID, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"Cluster Agents: %+v\", clusterAgents)\n}\n","global_vars":"","package":"package main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"303b091d-48a8-46b5-b130-f9020d38f105","name":"clusterAgentsExample","imports":"['\"log\"']","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/cluster_agents.go","code":"func clusterAgentsExample() {\n\tgit, err := gitlab.NewClient(\"tokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tprojectID := 33\n\topt := &gitlab.RegisterAgentOptions{\n\t\tName: gitlab.Ptr(\"agent-2\"),\n\t}\n\n\t\/\/ Register Cluster Agent\n\tclusterAgent, _, err := git.ClusterAgents.RegisterAgent(projectID, opt)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"Cluster Agent: %+v\\n\", clusterAgent)\n\n\t\/\/ List Cluster Agents\n\tclusterAgents, _, err := git.ClusterAgents.ListAgents(projectID, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"Cluster Agents: %+v\", clusterAgents)\n}","global_vars":"","package":"main","tags":""}
{"element_type":"file","project_name":"finalHFtestGitlab","uuid":"1d402851-bfa2-4830-bc5d-cea9b60c7f16","name":"deployments_merge_requests.go","imports":"import (\n\t\"log\"\n\n\tgitlab \"gitlab.com\/gitlab-org\/api\/client-go\"\n)","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/deployments_merge_requests.go","code":"\/\/\n\/\/ Copyright 2022, Daniela Filipe Bento\n\/\/\n\/\/ Licensed under the Apache License, Version 2.0 (the \"License\");\n\/\/ you may not use this file except in compliance with the License.\n\/\/ You may obtain a copy of the License at\n\/\/\n\/\/ http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\/\/\n\/\/ Unless required by applicable law or agreed to in writing, software\n\/\/ distributed under the License is distributed on an \"AS IS\" BASIS,\n\/\/ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\/\/ See the License for the specific language governing permissions and\n\/\/ limitations under the License.\n\/\/\n\npackage main\n\nimport (\n\t\"log\"\n\n\tgitlab \"gitlab.com\/gitlab-org\/api\/client-go\"\n)\n\nfunc deploymentExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\topt := &gitlab.ListMergeRequestsOptions{}\n\tmergeRequests, _, err := git.DeploymentMergeRequests.ListDeploymentMergeRequests(1, 1, opt)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor _, mergeRequest := range mergeRequests {\n\t\tlog.Printf(\"Found merge request: %v\\n\", mergeRequest)\n\t}\n}\n","global_vars":"","package":"package main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"8d02e3f4-d1ed-4b2f-9bc6-3399bd67ca2d","name":"deploymentExample","imports":"['\"log\"']","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/deployments_merge_requests.go","code":"func deploymentExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\topt := &gitlab.ListMergeRequestsOptions{}\n\tmergeRequests, _, err := git.DeploymentMergeRequests.ListDeploymentMergeRequests(1, 1, opt)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor _, mergeRequest := range mergeRequests {\n\t\tlog.Printf(\"Found merge request: %v\\n\", mergeRequest)\n\t}\n}","global_vars":"","package":"main","tags":""}
{"element_type":"file","project_name":"finalHFtestGitlab","uuid":"e8ac3dfa-4386-4ea9-889e-815199c30da7","name":"impersonation.go","imports":"import (\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/impersonation.go","code":"\/\/\n\/\/ Copyright 2021, Sander van Harmelen\n\/\/\n\/\/ Licensed under the Apache License, Version 2.0 (the \"License\");\n\/\/ you may not use this file except in compliance with the License.\n\/\/ You may obtain a copy of the License at\n\/\/\n\/\/ http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\/\/\n\/\/ Unless required by applicable law or agreed to in writing, software\n\/\/ distributed under the License is distributed on an \"AS IS\" BASIS,\n\/\/ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\/\/ See the License for the specific language governing permissions and\n\/\/ limitations under the License.\n\/\/\n\npackage main\n\nimport (\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)\n\nfunc impersonationExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tuid := 1\n\n\t\/\/ list impersonation token from an user\n\ttokens, _, err := git.Users.GetAllImpersonationTokens(\n\t\tuid,\n\t\t&gitlab.GetAllImpersonationTokensOptions{State: gitlab.Ptr(\"active\")},\n\t)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor _, token := range tokens {\n\t\tlog.Printf(\"Found token: %s\", token.Token)\n\t}\n\n\t\/\/ create an impersonation token of an user\n\ttoken, _, err := git.Users.CreateImpersonationToken(\n\t\tuid,\n\t\t&gitlab.CreateImpersonationTokenOptions{Scopes: &[]string{\"api\"}},\n\t)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"Created token: %s\", token.Token)\n}\n","global_vars":"","package":"package main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"5a33a77a-4fbf-4cbe-850c-51621b788451","name":"impersonationExample","imports":"['\"log\"']","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/impersonation.go","code":"func impersonationExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tuid := 1\n\n\t\/\/ list impersonation token from an user\n\ttokens, _, err := git.Users.GetAllImpersonationTokens(\n\t\tuid,\n\t\t&gitlab.GetAllImpersonationTokensOptions{State: gitlab.Ptr(\"active\")},\n\t)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor _, token := range tokens {\n\t\tlog.Printf(\"Found token: %s\", token.Token)\n\t}\n\n\t\/\/ create an impersonation token of an user\n\ttoken, _, err := git.Users.CreateImpersonationToken(\n\t\tuid,\n\t\t&gitlab.CreateImpersonationTokenOptions{Scopes: &[]string{\"api\"}},\n\t)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"Created token: %s\", token.Token)\n}","global_vars":"","package":"main","tags":""}
{"element_type":"file","project_name":"finalHFtestGitlab","uuid":"2b59df61-90f9-4f4e-9b5c-b4539498e15e","name":"labels.go","imports":"import (\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/labels.go","code":"\/\/\n\/\/ Copyright 2021, Sander van Harmelen\n\/\/\n\/\/ Licensed under the Apache License, Version 2.0 (the \"License\");\n\/\/ you may not use this file except in compliance with the License.\n\/\/ You may obtain a copy of the License at\n\/\/\n\/\/ http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\/\/\n\/\/ Unless required by applicable law or agreed to in writing, software\n\/\/ distributed under the License is distributed on an \"AS IS\" BASIS,\n\/\/ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\/\/ See the License for the specific language governing permissions and\n\/\/ limitations under the License.\n\/\/\n\npackage main\n\nimport (\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)\n\nfunc labelExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t\/\/ Create new label\n\topt := &gitlab.CreateLabelOptions{\n\t\tName: gitlab.Ptr(\"My Label\"),\n\t\tColor: gitlab.Ptr(\"#11FF22\"),\n\t}\n\tlabel, _, err := git.Labels.CreateLabel(\"myname\/myproject\", opt)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Printf(\"Created label: %s\\nWith color: %s\\n\", label.Name, label.Color)\n\n\t\/\/ List all labels\n\tlabels, _, err := git.Labels.ListLabels(\"myname\/myproject\", nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor _, label := range labels {\n\t\tlog.Printf(\"Found label: %s\", label.Name)\n\t}\n}\n","global_vars":"","package":"package main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"8192e7d3-b30c-4034-bf01-9420179290dd","name":"labelExample","imports":"['\"log\"']","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/labels.go","code":"func labelExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t\/\/ Create new label\n\topt := &gitlab.CreateLabelOptions{\n\t\tName: gitlab.Ptr(\"My Label\"),\n\t\tColor: gitlab.Ptr(\"#11FF22\"),\n\t}\n\tlabel, _, err := git.Labels.CreateLabel(\"myname\/myproject\", opt)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Printf(\"Created label: %s\\nWith color: %s\\n\", label.Name, label.Color)\n\n\t\/\/ List all labels\n\tlabels, _, err := git.Labels.ListLabels(\"myname\/myproject\", nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor _, label := range labels {\n\t\tlog.Printf(\"Found label: %s\", label.Name)\n\t}\n}","global_vars":"","package":"main","tags":""}
{"element_type":"file","project_name":"finalHFtestGitlab","uuid":"49e6d3f4-5882-46fe-bf66-4153757d2b1c","name":"languages.go","imports":"import (\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/languages.go","code":"\/\/\n\/\/ Copyright 2021, Sander van Harmelen\n\/\/\n\/\/ Licensed under the Apache License, Version 2.0 (the \"License\");\n\/\/ you may not use this file except in compliance with the License.\n\/\/ You may obtain a copy of the License at\n\/\/\n\/\/ http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\/\/\n\/\/ Unless required by applicable law or agreed to in writing, software\n\/\/ distributed under the License is distributed on an \"AS IS\" BASIS,\n\/\/ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\/\/ See the License for the specific language governing permissions and\n\/\/ limitations under the License.\n\/\/\n\npackage main\n\nimport (\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)\n\nfunc languagesExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlanguages, _, err := git.Projects.GetProjectLanguages(\"2743054\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Printf(\"Found languages: %v\", languages)\n}\n","global_vars":"","package":"package main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"55a074c7-22cb-432b-b296-55e867676b64","name":"languagesExample","imports":"['\"log\"']","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/languages.go","code":"func languagesExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlanguages, _, err := git.Projects.GetProjectLanguages(\"2743054\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Printf(\"Found languages: %v\", languages)\n}","global_vars":"","package":"main","tags":""}
{"element_type":"file","project_name":"finalHFtestGitlab","uuid":"9f7e8166-4e05-40b4-adab-15e433060914","name":"main.go","imports":"","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/main.go","code":"\/\/\n\/\/ Copyright 2021, Sander van Harmelen\n\/\/\n\/\/ Licensed under the Apache License, Version 2.0 (the \"License\");\n\/\/ you may not use this file except in compliance with the License.\n\/\/ You may obtain a copy of the License at\n\/\/\n\/\/ http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\/\/\n\/\/ Unless required by applicable law or agreed to in writing, software\n\/\/ distributed under the License is distributed on an \"AS IS\" BASIS,\n\/\/ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\/\/ See the License for the specific language governing permissions and\n\/\/ limitations under the License.\n\/\/\n\npackage main\n\nfunc main() {\n\t\/\/ See the separate files in this directory for the examples. This file is only\n\t\/\/ here to provide a main() function for the `example` package, keeping Travis happy.\n}\n","global_vars":"","package":"package main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"b51a1f21-889a-4eb5-a11e-4bed06bed8fc","name":"main","imports":"","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/main.go","code":"func main() {\n\t\/\/ See the separate files in this directory for the examples. This file is only\n\t\/\/ here to provide a main() function for the `example` package, keeping Travis happy.\n}","global_vars":"","package":"main","tags":""}
{"element_type":"file","project_name":"finalHFtestGitlab","uuid":"b0c7ff18-46b2-4704-ba8d-d680db7e486f","name":"pagination.go","imports":"import (\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/pagination.go","code":"\/\/\n\/\/ Copyright 2021, Sander van Harmelen\n\/\/\n\/\/ Licensed under the Apache License, Version 2.0 (the \"License\");\n\/\/ you may not use this file except in compliance with the License.\n\/\/ You may obtain a copy of the License at\n\/\/\n\/\/ http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\/\/\n\/\/ Unless required by applicable law or agreed to in writing, software\n\/\/ distributed under the License is distributed on an \"AS IS\" BASIS,\n\/\/ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\/\/ See the License for the specific language governing permissions and\n\/\/ limitations under the License.\n\/\/\n\npackage main\n\nimport (\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)\n\nfunc pagination() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\topt := &gitlab.ListProjectsOptions{\n\t\tListOptions: gitlab.ListOptions{\n\t\t\tPerPage: 10,\n\t\t\tPage: 1,\n\t\t},\n\t}\n\n\tfor {\n\t\t\/\/ Get the first page with projects.\n\t\tps, resp, err := git.Projects.ListProjects(opt)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\t\/\/ List all the projects we've found so far.\n\t\tfor _, p := range ps {\n\t\t\tlog.Printf(\"Found project: %s\", p.Name)\n\t\t}\n\n\t\t\/\/ Exit the loop when we've seen all pages.\n\t\tif resp.NextPage == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\t\/\/ Update the page number to get the next page.\n\t\topt.Page = resp.NextPage\n\t}\n}\n\nfunc keysetPagination() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\topt := &gitlab.ListProjectsOptions{\n\t\tListOptions: gitlab.ListOptions{\n\t\t\tOrderBy: \"id\",\n\t\t\tPagination: \"keyset\",\n\t\t\tPerPage: 5,\n\t\t\tSort: \"asc\",\n\t\t},\n\t\tOwned: gitlab.Bool(true),\n\t}\n\n\toptions := []gitlab.RequestOptionFunc{}\n\n\tfor {\n\t\t\/\/ Get the first page with projects.\n\t\tps, resp, err := git.Projects.ListProjects(opt, options...)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\t\/\/ List all the projects we've found so far.\n\t\tfor _, p := range ps {\n\t\t\tlog.Printf(\"Found project: %s\", p.Name)\n\t\t}\n\n\t\t\/\/ Exit the loop when we've seen all pages.\n\t\tif resp.NextLink == \"\" {\n\t\t\tbreak\n\t\t}\n\n\t\t\/\/ Set all query parameters in the next request to values in the\n\t\t\/\/ returned parameters. This could go along with any existing options.\n\t\toptions = []gitlab.RequestOptionFunc{\n\t\t\tgitlab.WithKeysetPaginationParameters(resp.NextLink),\n\t\t}\n\t}\n}\n","global_vars":"","package":"package main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"c2a1413e-449f-49ac-b9e8-d6b7965be7c3","name":"pagination","imports":"['\"log\"']","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/pagination.go","code":"func pagination() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\topt := &gitlab.ListProjectsOptions{\n\t\tListOptions: gitlab.ListOptions{\n\t\t\tPerPage: 10,\n\t\t\tPage: 1,\n\t\t},\n\t}\n\n\tfor {\n\t\t\/\/ Get the first page with projects.\n\t\tps, resp, err := git.Projects.ListProjects(opt)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\t\/\/ List all the projects we've found so far.\n\t\tfor _, p := range ps {\n\t\t\tlog.Printf(\"Found project: %s\", p.Name)\n\t\t}\n\n\t\t\/\/ Exit the loop when we've seen all pages.\n\t\tif resp.NextPage == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\t\/\/ Update the page number to get the next page.\n\t\topt.Page = resp.NextPage\n\t}\n}","global_vars":"","package":"main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"a5423d25-6d17-4269-bf8b-994f30bda68a","name":"keysetPagination","imports":"['\"log\"']","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/pagination.go","code":"func keysetPagination() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\topt := &gitlab.ListProjectsOptions{\n\t\tListOptions: gitlab.ListOptions{\n\t\t\tOrderBy: \"id\",\n\t\t\tPagination: \"keyset\",\n\t\t\tPerPage: 5,\n\t\t\tSort: \"asc\",\n\t\t},\n\t\tOwned: gitlab.Bool(true),\n\t}\n\n\toptions := []gitlab.RequestOptionFunc{}\n\n\tfor {\n\t\t\/\/ Get the first page with projects.\n\t\tps, resp, err := git.Projects.ListProjects(opt, options...)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\t\/\/ List all the projects we've found so far.\n\t\tfor _, p := range ps {\n\t\t\tlog.Printf(\"Found project: %s\", p.Name)\n\t\t}\n\n\t\t\/\/ Exit the loop when we've seen all pages.\n\t\tif resp.NextLink == \"\" {\n\t\t\tbreak\n\t\t}\n\n\t\t\/\/ Set all query parameters in the next request to values in the\n\t\t\/\/ returned parameters. This could go along with any existing options.\n\t\toptions = []gitlab.RequestOptionFunc{\n\t\t\tgitlab.WithKeysetPaginationParameters(resp.NextLink),\n\t\t}\n\t}\n}","global_vars":"","package":"main","tags":""}
{"element_type":"file","project_name":"finalHFtestGitlab","uuid":"635d8222-a76e-4b71-af89-4e4e596d1a3e","name":"personal_access_tokens.go","imports":"import (\n\t\"encoding\/json\"\n\t\"fmt\"\n\t\"log\"\n\t\"time\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/personal_access_tokens.go","code":"\/\/\n\/\/ Copyright 2022, Ryan Glab <ryan.j.glab@gmail.com>\n\/\/\n\/\/ Licensed under the Apache License, Version 2.0 (the \"License\");\n\/\/ you may not use this file except in compliance with the License.\n\/\/ You may obtain a copy of the License at\n\/\/\n\/\/ http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\/\/\n\/\/ Unless required by applicable law or agreed to in writing, software\n\/\/ distributed under the License is distributed on an \"AS IS\" BASIS,\n\/\/ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\/\/ See the License for the specific language governing permissions and\n\/\/ limitations under the License.\n\/\/\n\npackage main\n\nimport (\n\t\"encoding\/json\"\n\t\"fmt\"\n\t\"log\"\n\t\"time\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)\n\nfunc patRevokeExample() {\n\tgit, err := gitlab.NewClient(\"glpat-123xyz\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tresp, err := git.PersonalAccessTokens.RevokePersonalAccessToken(99999999)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Printf(\"Response Code: %s\", resp.Status)\n}\n\nfunc patListExampleWithUserFilter() {\n\tgit, err := gitlab.NewClient(\"glpat-123xyz\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\topt := &gitlab.ListPersonalAccessTokensOptions{\n\t\tListOptions: gitlab.ListOptions{Page: 1, PerPage: 10},\n\t\tUserID: gitlab.Ptr(12345),\n\t}\n\n\tpersonalAccessTokens, _, err := git.PersonalAccessTokens.ListPersonalAccessTokens(opt)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tdata, err := json.Marshal(personalAccessTokens)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"Found personal access tokens: %s\", data)\n}\n\nfunc patRotateExample() {\n\tgit, err := gitlab.NewClient(\"glpat-123xyz\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\texpiry := gitlab.ISOTime(time.Date(2023, time.August, 15, 0, 0, 0, 0, time.UTC))\n\topts := &gitlab.RotatePersonalAccessTokenOptions{\n\t\tExpiresAt: &expiry,\n\t}\n\tnewPersonalAccessToken, _, err := git.PersonalAccessTokens.RotatePersonalAccessToken(12345, opts)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"Your new token is %s\\n\", newPersonalAccessToken.Token)\n}\n","global_vars":"","package":"package main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"2aaa7272-92cf-4293-bf45-a4183ff6fd31","name":"patRevokeExample","imports":"['\"fmt\"', '\"log\"']","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/personal_access_tokens.go","code":"func patRevokeExample() {\n\tgit, err := gitlab.NewClient(\"glpat-123xyz\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tresp, err := git.PersonalAccessTokens.RevokePersonalAccessToken(99999999)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Printf(\"Response Code: %s\", resp.Status)\n}","global_vars":"","package":"main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"ca73dce3-1c25-407d-927a-cb9562d6b352","name":"patListExampleWithUserFilter","imports":"['\"encoding\/json\"', '\"log\"']","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/personal_access_tokens.go","code":"func patListExampleWithUserFilter() {\n\tgit, err := gitlab.NewClient(\"glpat-123xyz\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\topt := &gitlab.ListPersonalAccessTokensOptions{\n\t\tListOptions: gitlab.ListOptions{Page: 1, PerPage: 10},\n\t\tUserID: gitlab.Ptr(12345),\n\t}\n\n\tpersonalAccessTokens, _, err := git.PersonalAccessTokens.ListPersonalAccessTokens(opt)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tdata, err := json.Marshal(personalAccessTokens)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"Found personal access tokens: %s\", data)\n}","global_vars":"","package":"main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"1d756a83-eb37-43aa-ba3b-d0b1630319b2","name":"patRotateExample","imports":"['\"log\"', '\"time\"']","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/personal_access_tokens.go","code":"func patRotateExample() {\n\tgit, err := gitlab.NewClient(\"glpat-123xyz\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\texpiry := gitlab.ISOTime(time.Date(2023, time.August, 15, 0, 0, 0, 0, time.UTC))\n\topts := &gitlab.RotatePersonalAccessTokenOptions{\n\t\tExpiresAt: &expiry,\n\t}\n\tnewPersonalAccessToken, _, err := git.PersonalAccessTokens.RotatePersonalAccessToken(12345, opts)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"Your new token is %s\\n\", newPersonalAccessToken.Token)\n}","global_vars":"","package":"main","tags":""}
{"element_type":"file","project_name":"finalHFtestGitlab","uuid":"4c0b0c7d-dacb-4cbb-906d-99a12cf186ad","name":"pipelines.go","imports":"import (\n\t\"log\"\n\t\"time\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/pipelines.go","code":"\/\/\n\/\/ Copyright 2021, Sander van Harmelen\n\/\/\n\/\/ Licensed under the Apache License, Version 2.0 (the \"License\");\n\/\/ you may not use this file except in compliance with the License.\n\/\/ You may obtain a copy of the License at\n\/\/\n\/\/ http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\/\/\n\/\/ Unless required by applicable law or agreed to in writing, software\n\/\/ distributed under the License is distributed on an \"AS IS\" BASIS,\n\/\/ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\/\/ See the License for the specific language governing permissions and\n\/\/ limitations under the License.\n\/\/\n\npackage main\n\nimport (\n\t\"log\"\n\t\"time\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)\n\nfunc pipelineExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\topt := &gitlab.ListProjectPipelinesOptions{\n\t\tScope: gitlab.Ptr(\"branches\"),\n\t\tStatus: gitlab.Ptr(gitlab.Running),\n\t\tRef: gitlab.Ptr(\"master\"),\n\t\tYamlErrors: gitlab.Ptr(true),\n\t\tName: gitlab.Ptr(\"name\"),\n\t\tUsername: gitlab.Ptr(\"username\"),\n\t\tUpdatedAfter: gitlab.Ptr(time.Now().Add(-24 * 365 * time.Hour)),\n\t\tUpdatedBefore: gitlab.Ptr(time.Now().Add(-7 * 24 * time.Hour)),\n\t\tOrderBy: gitlab.Ptr(\"status\"),\n\t\tSort: gitlab.Ptr(\"asc\"),\n\t}\n\n\tpipelines, _, err := git.Pipelines.ListProjectPipelines(2743054, opt)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor _, pipeline := range pipelines {\n\t\tlog.Printf(\"Found pipeline: %v\", pipeline)\n\t}\n}\n","global_vars":"","package":"package main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"bcfdb66c-2b30-4679-98ec-cf3fa59b7b7a","name":"pipelineExample","imports":"['\"log\"', '\"time\"']","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/pipelines.go","code":"func pipelineExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\topt := &gitlab.ListProjectPipelinesOptions{\n\t\tScope: gitlab.Ptr(\"branches\"),\n\t\tStatus: gitlab.Ptr(gitlab.Running),\n\t\tRef: gitlab.Ptr(\"master\"),\n\t\tYamlErrors: gitlab.Ptr(true),\n\t\tName: gitlab.Ptr(\"name\"),\n\t\tUsername: gitlab.Ptr(\"username\"),\n\t\tUpdatedAfter: gitlab.Ptr(time.Now().Add(-24 * 365 * time.Hour)),\n\t\tUpdatedBefore: gitlab.Ptr(time.Now().Add(-7 * 24 * time.Hour)),\n\t\tOrderBy: gitlab.Ptr(\"status\"),\n\t\tSort: gitlab.Ptr(\"asc\"),\n\t}\n\n\tpipelines, _, err := git.Pipelines.ListProjectPipelines(2743054, opt)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor _, pipeline := range pipelines {\n\t\tlog.Printf(\"Found pipeline: %v\", pipeline)\n\t}\n}","global_vars":"","package":"main","tags":""}
{"element_type":"file","project_name":"finalHFtestGitlab","uuid":"afe20567-ab0c-4b35-bf9a-73cd7e200e18","name":"pipelinestestreport.go","imports":"import (\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/pipelinestestreport.go","code":"\/\/\n\/\/ Copyright 2021, Sander van Harmelen\n\/\/\n\/\/ Licensed under the Apache License, Version 2.0 (the \"License\");\n\/\/ you may not use this file except in compliance with the License.\n\/\/ You may obtain a copy of the License at\n\/\/\n\/\/ http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\/\/\n\/\/ Unless required by applicable law or agreed to in writing, software\n\/\/ distributed under the License is distributed on an \"AS IS\" BASIS,\n\/\/ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\/\/ See the License for the specific language governing permissions and\n\/\/ limitations under the License.\n\/\/\n\npackage main\n\nimport (\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)\n\nfunc pipelineTestReportExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\topt := &gitlab.ListProjectPipelinesOptions{Ref: gitlab.Ptr(\"master\")}\n\tprojectID := 1234\n\n\tpipelines, _, err := git.Pipelines.ListProjectPipelines(projectID, opt)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor _, pipeline := range pipelines {\n\t\tlog.Printf(\"Found pipeline: %v\", pipeline)\n\n\t\treport, _, err := git.Pipelines.GetPipelineTestReport(projectID, pipeline.ID)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tlog.Printf(\"Found test report: %v\", report)\n\t}\n}\n","global_vars":"","package":"package main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"3509dccd-192f-45d3-a583-0787a99cade5","name":"pipelineTestReportExample","imports":"['\"log\"']","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/pipelinestestreport.go","code":"func pipelineTestReportExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\topt := &gitlab.ListProjectPipelinesOptions{Ref: gitlab.Ptr(\"master\")}\n\tprojectID := 1234\n\n\tpipelines, _, err := git.Pipelines.ListProjectPipelines(projectID, opt)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor _, pipeline := range pipelines {\n\t\tlog.Printf(\"Found pipeline: %v\", pipeline)\n\n\t\treport, _, err := git.Pipelines.GetPipelineTestReport(projectID, pipeline.ID)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tlog.Printf(\"Found test report: %v\", report)\n\t}\n}","global_vars":"","package":"main","tags":""}
{"element_type":"file","project_name":"finalHFtestGitlab","uuid":"2b994b28-75c8-4737-86f7-2fd11b5a2e1a","name":"projects.go","imports":"import (\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/projects.go","code":"\/\/\n\/\/ Copyright 2021, Sander van Harmelen\n\/\/\n\/\/ Licensed under the Apache License, Version 2.0 (the \"License\");\n\/\/ you may not use this file except in compliance with the License.\n\/\/ You may obtain a copy of the License at\n\/\/\n\/\/ http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\/\/\n\/\/ Unless required by applicable law or agreed to in writing, software\n\/\/ distributed under the License is distributed on an \"AS IS\" BASIS,\n\/\/ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\/\/ See the License for the specific language governing permissions and\n\/\/ limitations under the License.\n\/\/\n\npackage main\n\nimport (\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)\n\nfunc projectExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t\/\/ Create new project\n\tp := &gitlab.CreateProjectOptions{\n\t\tName: gitlab.Ptr(\"My Project\"),\n\t\tDescription: gitlab.Ptr(\"Just a test project to play with\"),\n\t\tMergeRequestsAccessLevel: gitlab.Ptr(gitlab.EnabledAccessControl),\n\t\tSnippetsAccessLevel: gitlab.Ptr(gitlab.EnabledAccessControl),\n\t\tVisibility: gitlab.Ptr(gitlab.PublicVisibility),\n\t}\n\tproject, _, err := git.Projects.CreateProject(p)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t\/\/ Add a new snippet\n\ts := &gitlab.CreateProjectSnippetOptions{\n\t\tTitle: gitlab.Ptr(\"Dummy Snippet\"),\n\t\tFileName: gitlab.Ptr(\"snippet.go\"),\n\t\tContent: gitlab.Ptr(\"package main....\"),\n\t\tVisibility: gitlab.Ptr(gitlab.PublicVisibility),\n\t}\n\t_, _, err = git.ProjectSnippets.CreateSnippet(project.ID, s)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t\/\/ List all project snippets\n\tsnippets, _, err := git.ProjectSnippets.ListSnippets(project.PathWithNamespace, &gitlab.ListProjectSnippetsOptions{})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor _, snippet := range snippets {\n\t\tlog.Printf(\"Found snippet: %s\", snippet.Title)\n\t}\n}\n","global_vars":"","package":"package main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"306588f6-0451-4080-b6b9-c1f0b8845a65","name":"projectExample","imports":"['\"log\"']","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/projects.go","code":"func projectExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t\/\/ Create new project\n\tp := &gitlab.CreateProjectOptions{\n\t\tName: gitlab.Ptr(\"My Project\"),\n\t\tDescription: gitlab.Ptr(\"Just a test project to play with\"),\n\t\tMergeRequestsAccessLevel: gitlab.Ptr(gitlab.EnabledAccessControl),\n\t\tSnippetsAccessLevel: gitlab.Ptr(gitlab.EnabledAccessControl),\n\t\tVisibility: gitlab.Ptr(gitlab.PublicVisibility),\n\t}\n\tproject, _, err := git.Projects.CreateProject(p)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t\/\/ Add a new snippet\n\ts := &gitlab.CreateProjectSnippetOptions{\n\t\tTitle: gitlab.Ptr(\"Dummy Snippet\"),\n\t\tFileName: gitlab.Ptr(\"snippet.go\"),\n\t\tContent: gitlab.Ptr(\"package main....\"),\n\t\tVisibility: gitlab.Ptr(gitlab.PublicVisibility),\n\t}\n\t_, _, err = git.ProjectSnippets.CreateSnippet(project.ID, s)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t\/\/ List all project snippets\n\tsnippets, _, err := git.ProjectSnippets.ListSnippets(project.PathWithNamespace, &gitlab.ListProjectSnippetsOptions{})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor _, snippet := range snippets {\n\t\tlog.Printf(\"Found snippet: %s\", snippet.Title)\n\t}\n}","global_vars":"","package":"main","tags":""}
{"element_type":"file","project_name":"finalHFtestGitlab","uuid":"27eed05c-fb6d-4a20-97be-546556970f5c","name":"repository_archive.go","imports":"import (\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/repository_archive.go","code":"\/\/\n\/\/ Copyright 2021, Sander van Harmelen\n\/\/\n\/\/ Licensed under the Apache License, Version 2.0 (the \"License\");\n\/\/ you may not use this file except in compliance with the License.\n\/\/ You may obtain a copy of the License at\n\/\/\n\/\/ http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\/\/\n\/\/ Unless required by applicable law or agreed to in writing, software\n\/\/ distributed under the License is distributed on an \"AS IS\" BASIS,\n\/\/ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\/\/ See the License for the specific language governing permissions and\n\/\/ limitations under the License.\n\/\/\n\npackage main\n\nimport (\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)\n\nfunc repositoryArchiveExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t\/\/ Get repository archive\n\topt := &gitlab.ArchiveOptions{\n\t\tFormat: gitlab.String(\"tar.gz\"),\n\t\tPath: gitlab.String(\"mydir\"),\n\t}\n\tcontent, _, err := git.Repositories.Archive(\"mygroup\/myproject\", opt, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"Repository archive contains %d byte(s)\", len(content))\n}\n","global_vars":"","package":"package main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"c2fcd11e-9ae2-423f-82bb-bb10895f43cf","name":"repositoryArchiveExample","imports":"['\"log\"']","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/repository_archive.go","code":"func repositoryArchiveExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t\/\/ Get repository archive\n\topt := &gitlab.ArchiveOptions{\n\t\tFormat: gitlab.String(\"tar.gz\"),\n\t\tPath: gitlab.String(\"mydir\"),\n\t}\n\tcontent, _, err := git.Repositories.Archive(\"mygroup\/myproject\", opt, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"Repository archive contains %d byte(s)\", len(content))\n}","global_vars":"","package":"main","tags":""}
{"element_type":"file","project_name":"finalHFtestGitlab","uuid":"782799d6-43cd-4edb-a42e-a805d471e947","name":"repository_files.go","imports":"import (\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/repository_files.go","code":"\/\/\n\/\/ Copyright 2021, Sander van Harmelen\n\/\/\n\/\/ Licensed under the Apache License, Version 2.0 (the \"License\");\n\/\/ you may not use this file except in compliance with the License.\n\/\/ You may obtain a copy of the License at\n\/\/\n\/\/ http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\/\/\n\/\/ Unless required by applicable law or agreed to in writing, software\n\/\/ distributed under the License is distributed on an \"AS IS\" BASIS,\n\/\/ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\/\/ See the License for the specific language governing permissions and\n\/\/ limitations under the License.\n\/\/\n\npackage main\n\nimport (\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)\n\nfunc repositoryFileExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t\/\/ Create a new repository file\n\tcf := &gitlab.CreateFileOptions{\n\t\tBranch: gitlab.Ptr(\"master\"),\n\t\tContent: gitlab.Ptr(\"My file contents\"),\n\t\tCommitMessage: gitlab.Ptr(\"Adding a test file\"),\n\t}\n\tfile, _, err := git.RepositoryFiles.CreateFile(\"myname\/myproject\", \"file.go\", cf)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t\/\/ Update a repository file\n\tuf := &gitlab.UpdateFileOptions{\n\t\tBranch: gitlab.Ptr(\"master\"),\n\t\tContent: gitlab.Ptr(\"My file content\"),\n\t\tCommitMessage: gitlab.Ptr(\"Fixing typo\"),\n\t}\n\t_, _, err = git.RepositoryFiles.UpdateFile(\"myname\/myproject\", file.FilePath, uf)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tgf := &gitlab.GetFileOptions{\n\t\tRef: gitlab.Ptr(\"master\"),\n\t}\n\tf, _, err := git.RepositoryFiles.GetFile(\"myname\/myproject\", file.FilePath, gf)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"File contains: %s\", f.Content)\n\n\tgfb := &gitlab.GetFileBlameOptions{\n\t\tRef: gitlab.Ptr(\"master\"),\n\t}\n\tfb, _, err := git.RepositoryFiles.GetFileBlame(\"myname\/myproject\", file.FilePath, gfb)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"Found %d blame ranges\", len(fb))\n}\n","global_vars":"","package":"package main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"9454deec-12f9-4805-9d50-05bbc4399051","name":"repositoryFileExample","imports":"['\"log\"']","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/repository_files.go","code":"func repositoryFileExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t\/\/ Create a new repository file\n\tcf := &gitlab.CreateFileOptions{\n\t\tBranch: gitlab.Ptr(\"master\"),\n\t\tContent: gitlab.Ptr(\"My file contents\"),\n\t\tCommitMessage: gitlab.Ptr(\"Adding a test file\"),\n\t}\n\tfile, _, err := git.RepositoryFiles.CreateFile(\"myname\/myproject\", \"file.go\", cf)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t\/\/ Update a repository file\n\tuf := &gitlab.UpdateFileOptions{\n\t\tBranch: gitlab.Ptr(\"master\"),\n\t\tContent: gitlab.Ptr(\"My file content\"),\n\t\tCommitMessage: gitlab.Ptr(\"Fixing typo\"),\n\t}\n\t_, _, err = git.RepositoryFiles.UpdateFile(\"myname\/myproject\", file.FilePath, uf)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tgf := &gitlab.GetFileOptions{\n\t\tRef: gitlab.Ptr(\"master\"),\n\t}\n\tf, _, err := git.RepositoryFiles.GetFile(\"myname\/myproject\", file.FilePath, gf)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"File contains: %s\", f.Content)\n\n\tgfb := &gitlab.GetFileBlameOptions{\n\t\tRef: gitlab.Ptr(\"master\"),\n\t}\n\tfb, _, err := git.RepositoryFiles.GetFileBlame(\"myname\/myproject\", file.FilePath, gfb)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"Found %d blame ranges\", len(fb))\n}","global_vars":"","package":"main","tags":""}
{"element_type":"file","project_name":"finalHFtestGitlab","uuid":"88512efa-c858-475c-ad34-ea9e0a725559","name":"services.go","imports":"import (\n\t\"fmt\"\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/services.go","code":"\/\/\n\/\/ Copyright 2023, Joel Gerber\n\/\/\n\/\/ Licensed under the Apache License, Version 2.0 (the \"License\");\n\/\/ you may not use this file except in compliance with the License.\n\/\/ You may obtain a copy of the License at\n\/\/\n\/\/ http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\/\/\n\/\/ Unless required by applicable law or agreed to in writing, software\n\/\/ distributed under the License is distributed on an \"AS IS\" BASIS,\n\/\/ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\/\/ See the License for the specific language governing permissions and\n\/\/ limitations under the License.\n\/\/\n\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)\n\nfunc dataDogExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t\/\/ Create new DataDog integration\n\topts := &gitlab.SetDataDogServiceOptions{\n\t\tAPIKey: gitlab.String(\"testing\"),\n\t\tDataDogEnv: gitlab.String(\"sandbox\"),\n\t\tDataDogService: gitlab.String(\"test\"),\n\t\tDataDogSite: gitlab.String(\"datadoghq.com\"),\n\t\tDataDogTags: gitlab.String(\"country:canada\\nprovince:ontario\"),\n\t\tArchiveTraceEvents: gitlab.Bool(true),\n\t}\n\n\tsvc, _, err := git.Services.SetDataDogService(1, opts)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Printf(\n\t\t\"api_url: %s, datadog_env: %s, datadog_service: %s, datadog_site: %s, datadog_tags: %s\",\n\t\tsvc.Properties.APIURL, svc.Properties.DataDogEnv, svc.Properties.DataDogService,\n\t\tsvc.Properties.DataDogSite, svc.Properties.DataDogTags,\n\t)\n\n\t\/\/ Delete the integration\n\t_, err = git.Services.DeleteDataDogService(1)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n","global_vars":"","package":"package main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"7434e2a4-fbc5-4ea8-9eb6-bd06d3d07566","name":"dataDogExample","imports":"['\"fmt\"', '\"log\"']","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/services.go","code":"func dataDogExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t\/\/ Create new DataDog integration\n\topts := &gitlab.SetDataDogServiceOptions{\n\t\tAPIKey: gitlab.String(\"testing\"),\n\t\tDataDogEnv: gitlab.String(\"sandbox\"),\n\t\tDataDogService: gitlab.String(\"test\"),\n\t\tDataDogSite: gitlab.String(\"datadoghq.com\"),\n\t\tDataDogTags: gitlab.String(\"country:canada\\nprovince:ontario\"),\n\t\tArchiveTraceEvents: gitlab.Bool(true),\n\t}\n\n\tsvc, _, err := git.Services.SetDataDogService(1, opts)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Printf(\n\t\t\"api_url: %s, datadog_env: %s, datadog_service: %s, datadog_site: %s, datadog_tags: %s\",\n\t\tsvc.Properties.APIURL, svc.Properties.DataDogEnv, svc.Properties.DataDogService,\n\t\tsvc.Properties.DataDogSite, svc.Properties.DataDogTags,\n\t)\n\n\t\/\/ Delete the integration\n\t_, err = git.Services.DeleteDataDogService(1)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}","global_vars":"","package":"main","tags":""}
{"element_type":"file","project_name":"finalHFtestGitlab","uuid":"4da2af02-8f7f-4d58-992c-2c730801fa0a","name":"topics.go","imports":"import (\n\t\"log\"\n\t\"os\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/topics.go","code":"\/\/\n\/\/ Copyright 2021, Timo Furrer <tuxtimo@gmail.com>\n\/\/\n\/\/ Licensed under the Apache License, Version 2.0 (the \"License\");\n\/\/ you may not use this file except in compliance with the License.\n\/\/ You may obtain a copy of the License at\n\/\/\n\/\/ http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\/\/\n\/\/ Unless required by applicable law or agreed to in writing, software\n\/\/ distributed under the License is distributed on an \"AS IS\" BASIS,\n\/\/ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\/\/ See the License for the specific language governing permissions and\n\/\/ limitations under the License.\n\/\/\n\npackage main\n\nimport (\n\t\"log\"\n\t\"os\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)\n\nfunc topicExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t\/\/ New topic\n\ttopic, _, err := git.Topics.CreateTopic(&gitlab.CreateTopicOptions{\n\t\tName: gitlab.Ptr(\"My Topic 2\"),\n\t\tDescription: gitlab.Ptr(\"Some description\"),\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tlog.Printf(\"Topic: %+v\\n\", topic)\n\n\t\/\/ Set topic avatar\n\tavatarFile, err := os.Open(\"5746961_detect_direction_gps_location_map_icon.png\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ttopic, _, err = git.Topics.UpdateTopic(topic.ID, &gitlab.UpdateTopicOptions{\n\t\tAvatar: &gitlab.TopicAvatar{\n\t\t\tFilename: \"5746961_detect_direction_gps_location_map_icon.png\",\n\t\t\tImage: avatarFile,\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tlog.Printf(\"Topic with Avatar: %+v\\n\", topic)\n\n\t\/\/ Remove topic avatar\n\ttopic, _, err = git.Topics.UpdateTopic(topic.ID, &gitlab.UpdateTopicOptions{\n\t\tAvatar: &gitlab.TopicAvatar{},\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tlog.Printf(\"Topic without Avatar: %+v\\n\", topic)\n}\n","global_vars":"","package":"package main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"8de456b2-e3c5-4678-827d-de88d33b45ab","name":"topicExample","imports":"['\"log\"', '\"os\"']","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/topics.go","code":"func topicExample() {\n\tgit, err := gitlab.NewClient(\"yourtokengoeshere\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t\/\/ New topic\n\ttopic, _, err := git.Topics.CreateTopic(&gitlab.CreateTopicOptions{\n\t\tName: gitlab.Ptr(\"My Topic 2\"),\n\t\tDescription: gitlab.Ptr(\"Some description\"),\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tlog.Printf(\"Topic: %+v\\n\", topic)\n\n\t\/\/ Set topic avatar\n\tavatarFile, err := os.Open(\"5746961_detect_direction_gps_location_map_icon.png\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ttopic, _, err = git.Topics.UpdateTopic(topic.ID, &gitlab.UpdateTopicOptions{\n\t\tAvatar: &gitlab.TopicAvatar{\n\t\t\tFilename: \"5746961_detect_direction_gps_location_map_icon.png\",\n\t\t\tImage: avatarFile,\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tlog.Printf(\"Topic with Avatar: %+v\\n\", topic)\n\n\t\/\/ Remove topic avatar\n\ttopic, _, err = git.Topics.UpdateTopic(topic.ID, &gitlab.UpdateTopicOptions{\n\t\tAvatar: &gitlab.TopicAvatar{},\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tlog.Printf(\"Topic without Avatar: %+v\\n\", topic)\n}","global_vars":"","package":"main","tags":""}
{"element_type":"file","project_name":"finalHFtestGitlab","uuid":"436ee933-33d4-452d-8e75-37ae39d41fd0","name":"webhook.go","imports":"import (\n\t\"encoding\/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"log\"\n\t\"net\/http\"\n\t\"strings\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/webhook.go","code":"package main\n\nimport (\n\t\"encoding\/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"log\"\n\t\"net\/http\"\n\t\"strings\"\n\n\t\"gitlab.com\/gitlab-org\/api\/client-go\"\n)\n\n\/\/ webhook is a HTTP Handler for Gitlab Webhook events.\ntype webhook struct {\n\tSecret string\n\tEventsToAccept []gitlab.EventType\n}\n\n\/\/ webhookExample shows how to create a Webhook server to parse Gitlab events.\nfunc webhookExample() {\n\twh := webhook{\n\t\tSecret: \"your-gitlab-secret\",\n\t\tEventsToAccept: []gitlab.EventType{gitlab.EventTypeMergeRequest, gitlab.EventTypePipeline},\n\t}\n\n\tmux := http.NewServeMux()\n\tmux.Handle(\"\/webhook\", wh)\n\tif err := http.ListenAndServe(\"0.0.0.0:8080\", mux); err != nil {\n\t\tlog.Fatalf(\"HTTP server ListenAndServe: %v\", err)\n\t}\n}\n\n\/\/ ServeHTTP tries to parse Gitlab events sent and calls handle function\n\/\/ with the successfully parsed events.\nfunc (hook webhook) ServeHTTP(writer http.ResponseWriter, request *http.Request) {\n\tevent, err := hook.parse(request)\n\tif err != nil {\n\t\twriter.WriteHeader(500)\n\t\tfmt.Fprintf(writer, \"could parse the webhook event: %v\", err)\n\t\treturn\n\t}\n\n\t\/\/ Handle the event before we return.\n\tif err := hook.handle(event); err != nil {\n\t\twriter.WriteHeader(500)\n\t\tfmt.Fprintf(writer, \"error handling the event: %v\", err)\n\t\treturn\n\t}\n\n\t\/\/ Write a response when were done.\n\twriter.WriteHeader(204)\n}\n\nfunc (hook webhook) handle(event interface{}) error {\n\tstr, err := json.Marshal(event)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not marshal json event for logging: %v\", err)\n\t}\n\n\t\/\/ Just write the event for this example.\n\tfmt.Println(string(str))\n\n\treturn nil\n}\n\n\/\/ parse verifies and parses the events specified in the request and\n\/\/ returns the parsed event or an error.\nfunc (hook webhook) parse(r *http.Request) (interface{}, error) {\n\tdefer func() {\n\t\tif _, err := io.Copy(io.Discard, r.Body); err != nil {\n\t\t\tlog.Printf(\"could discard request body: %v\", err)\n\t\t}\n\t\tif err := r.Body.Close(); err != nil {\n\t\t\tlog.Printf(\"could not close request body: %v\", err)\n\t\t}\n\t}()\n\n\tif r.Method != http.MethodPost {\n\t\treturn nil, errors.New(\"invalid HTTP Method\")\n\t}\n\n\t\/\/ If we have a secret set, we should check if the request matches it.\n\tif len(hook.Secret) > 0 {\n\t\tsignature := r.Header.Get(\"X-Gitlab-Token\")\n\t\tif signature != hook.Secret {\n\t\t\treturn nil, errors.New(\"token validation failed\")\n\t\t}\n\t}\n\n\tevent := r.Header.Get(\"X-Gitlab-Event\")\n\tif strings.TrimSpace(event) == \"\" {\n\t\treturn nil, errors.New(\"missing X-Gitlab-Event Header\")\n\t}\n\n\teventType := gitlab.EventType(event)\n\tif !isEventSubscribed(eventType, hook.EventsToAccept) {\n\t\treturn nil, errors.New(\"event not defined to be parsed\")\n\t}\n\n\tpayload, err := io.ReadAll(r.Body)\n\tif err != nil || len(payload) == 0 {\n\t\treturn nil, errors.New(\"error reading request body\")\n\t}\n\n\treturn gitlab.ParseWebhook(eventType, payload)\n}\n\nfunc isEventSubscribed(event gitlab.EventType, events []gitlab.EventType) bool {\n\tfor _, e := range events {\n\t\tif event == e {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n","global_vars":"","package":"package main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"69d87678-2965-4866-bb7b-a0411e326e8d","name":"webhookExample","imports":"['\"log\"', '\"net\/http\"']","structs":"['webhook']","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/webhook.go","code":"func webhookExample() {\n\twh := webhook{\n\t\tSecret: \"your-gitlab-secret\",\n\t\tEventsToAccept: []gitlab.EventType{gitlab.EventTypeMergeRequest, gitlab.EventTypePipeline},\n\t}\n\n\tmux := http.NewServeMux()\n\tmux.Handle(\"\/webhook\", wh)\n\tif err := http.ListenAndServe(\"0.0.0.0:8080\", mux); err != nil {\n\t\tlog.Fatalf(\"HTTP server ListenAndServe: %v\", err)\n\t}\n}","global_vars":"","package":"main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"496376d4-b87d-4460-aa27-ad5ced37996c","name":"ServeHTTP","imports":"['\"fmt\"', '\"net\/http\"']","structs":"['webhook']","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/webhook.go","code":"func (hook webhook) ServeHTTP(writer http.ResponseWriter, request *http.Request) {\n\tevent, err := hook.parse(request)\n\tif err != nil {\n\t\twriter.WriteHeader(500)\n\t\tfmt.Fprintf(writer, \"could parse the webhook event: %v\", err)\n\t\treturn\n\t}\n\n\t\/\/ Handle the event before we return.\n\tif err := hook.handle(event); err != nil {\n\t\twriter.WriteHeader(500)\n\t\tfmt.Fprintf(writer, \"error handling the event: %v\", err)\n\t\treturn\n\t}\n\n\t\/\/ Write a response when were done.\n\twriter.WriteHeader(204)\n}","global_vars":"","package":"main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"1cca8ac7-c967-4087-9378-7a5cd8a282e4","name":"handle","imports":"['\"encoding\/json\"', '\"fmt\"']","structs":"['webhook']","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/webhook.go","code":"func (hook webhook) handle(event interface{}) error {\n\tstr, err := json.Marshal(event)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not marshal json event for logging: %v\", err)\n\t}\n\n\t\/\/ Just write the event for this example.\n\tfmt.Println(string(str))\n\n\treturn nil\n}","global_vars":"","package":"main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"8392c765-a523-4302-94a4-8e6b04548beb","name":"parse","imports":"['\"errors\"', '\"io\"', '\"log\"', '\"net\/http\"', '\"strings\"']","structs":"['webhook']","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/webhook.go","code":"func (hook webhook) parse(r *http.Request) (interface{}, error) {\n\tdefer func() {\n\t\tif _, err := io.Copy(io.Discard, r.Body); err != nil {\n\t\t\tlog.Printf(\"could discard request body: %v\", err)\n\t\t}\n\t\tif err := r.Body.Close(); err != nil {\n\t\t\tlog.Printf(\"could not close request body: %v\", err)\n\t\t}\n\t}()\n\n\tif r.Method != http.MethodPost {\n\t\treturn nil, errors.New(\"invalid HTTP Method\")\n\t}\n\n\t\/\/ If we have a secret set, we should check if the request matches it.\n\tif len(hook.Secret) > 0 {\n\t\tsignature := r.Header.Get(\"X-Gitlab-Token\")\n\t\tif signature != hook.Secret {\n\t\t\treturn nil, errors.New(\"token validation failed\")\n\t\t}\n\t}\n\n\tevent := r.Header.Get(\"X-Gitlab-Event\")\n\tif strings.TrimSpace(event) == \"\" {\n\t\treturn nil, errors.New(\"missing X-Gitlab-Event Header\")\n\t}\n\n\teventType := gitlab.EventType(event)\n\tif !isEventSubscribed(eventType, hook.EventsToAccept) {\n\t\treturn nil, errors.New(\"event not defined to be parsed\")\n\t}\n\n\tpayload, err := io.ReadAll(r.Body)\n\tif err != nil || len(payload) == 0 {\n\t\treturn nil, errors.New(\"error reading request body\")\n\t}\n\n\treturn gitlab.ParseWebhook(eventType, payload)\n}","global_vars":"","package":"main","tags":""}
{"element_type":"function","project_name":"finalHFtestGitlab","uuid":"5c627c0c-1c67-481f-8297-941a1b5829c6","name":"isEventSubscribed","imports":"","structs":"","interfaces":"","file_location":"github.com\/finalHFtestGitlab\/\/tmp\/repos\/client-go\/examples\/webhook.go","code":"func isEventSubscribed(event gitlab.EventType, events []gitlab.EventType) bool {\n\tfor _, e := range events {\n\t\tif event == e {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}","global_vars":"","package":"main","tags":""}