Skip to content

Commit 6ba736f

Browse files
authored
style!: rename Option structs to Options (#193)
BREAKING CHANGE: all structures that ended with `Option` now end with `Options` Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
1 parent 7f19def commit 6ba736f

136 files changed

Lines changed: 3660 additions & 3660 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ func main() {
237237
url := "https://your-sonarqube-instance.com"
238238
token := "your-sonarqube-token"
239239

240-
client, err := sonar.NewClient(&sonar.ClientCreateOption{
240+
client, err := sonar.NewClient(&sonar.ClientCreateOptions{
241241
URL: &url,
242242
Token: &token,
243243
})
@@ -246,7 +246,7 @@ func main() {
246246
}
247247

248248
// Search for projects
249-
projects, _, err := client.Projects.Search(context.Background(), &sonar.ProjectsSearchOption{
249+
projects, _, err := client.Projects.Search(context.Background(), &sonar.ProjectsSearchOptions{
250250
Ps: sonar.Int(10),
251251
})
252252
if err != nil {
@@ -259,7 +259,7 @@ func main() {
259259
}
260260

261261
// Search for open issues
262-
issues, _, err := client.Issues.Search(context.Background(), &sonar.IssuesSearchOption{
262+
issues, _, err := client.Issues.Search(context.Background(), &sonar.IssuesSearchOptions{
263263
Projects: sonar.String("my-project-key"),
264264
Statuses: sonar.String("OPEN,CONFIRMED"),
265265
})
@@ -276,7 +276,7 @@ func main() {
276276
**Token authentication (recommended):**
277277

278278
```go
279-
client, err := sonar.NewClient(&sonar.ClientCreateOption{
279+
client, err := sonar.NewClient(&sonar.ClientCreateOptions{
280280
URL: &url,
281281
Token: &token,
282282
})
@@ -285,7 +285,7 @@ client, err := sonar.NewClient(&sonar.ClientCreateOption{
285285
**Username/password authentication:**
286286

287287
```go
288-
client, err := sonar.NewClient(&sonar.ClientCreateOption{
288+
client, err := sonar.NewClient(&sonar.ClientCreateOptions{
289289
URL: &url,
290290
Username: &username,
291291
Password: &password,
@@ -302,7 +302,7 @@ import "time"
302302

303303
httpClient := &http.Client{Timeout: 60 * time.Second}
304304

305-
client, err := sonar.NewClient(&sonar.ClientCreateOption{
305+
client, err := sonar.NewClient(&sonar.ClientCreateOptions{
306306
URL: &url,
307307
Token: &token,
308308
HttpClient: httpClient,
@@ -312,7 +312,7 @@ client, err := sonar.NewClient(&sonar.ClientCreateOption{
312312
**Quality gate status:**
313313

314314
```go
315-
status, _, err := client.Qualitygates.ProjectStatus(ctx, &sonar.QualitygatesProjectStatusOption{
315+
status, _, err := client.Qualitygates.ProjectStatus(ctx, &sonar.QualitygatesProjectStatusOptions{
316316
ProjectKey: sonar.String("my-project"),
317317
})
318318
fmt.Printf("Quality Gate: %s\n", status.ProjectStatus.Status)
@@ -321,7 +321,7 @@ fmt.Printf("Quality Gate: %s\n", status.ProjectStatus.Status)
321321
**User management:**
322322

323323
```go
324-
users, _, err := client.Users.Search(&sonar.UsersSearchOption{
324+
users, _, err := client.Users.Search(&sonar.UsersSearchOptions{
325325
Query: "john",
326326
})
327327
for _, user := range users.Users {

integration_testing/alm_integrations_test.go

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ var _ = Describe("AlmIntegrations Service", Ordered, func() {
3232
})
3333

3434
It("should fail without required almSetting", func() {
35-
_, resp, err := client.AlmIntegrations.CheckPat(&sonar.AlmIntegrationsCheckPatOption{})
35+
_, resp, err := client.AlmIntegrations.CheckPat(&sonar.AlmIntegrationsCheckPatOptions{})
3636
Expect(err).To(HaveOccurred())
3737
Expect(err.Error()).To(ContainSubstring("AlmSetting"))
3838
Expect(resp).To(BeNil())
3939
})
4040

4141
It("should fail with almSetting too long", func() {
4242
longKey := string(make([]byte, 201))
43-
_, resp, err := client.AlmIntegrations.CheckPat(&sonar.AlmIntegrationsCheckPatOption{
43+
_, resp, err := client.AlmIntegrations.CheckPat(&sonar.AlmIntegrationsCheckPatOptions{
4444
AlmSetting: longKey,
4545
})
4646
Expect(err).To(HaveOccurred())
@@ -64,7 +64,7 @@ var _ = Describe("AlmIntegrations Service", Ordered, func() {
6464
})
6565

6666
It("should fail without required almSetting", func() {
67-
result, resp, err := client.AlmIntegrations.GetGithubClientId(&sonar.AlmIntegrationsGetGithubClientIdOption{})
67+
result, resp, err := client.AlmIntegrations.GetGithubClientId(&sonar.AlmIntegrationsGetGithubClientIdOptions{})
6868
Expect(err).To(HaveOccurred())
6969
Expect(err.Error()).To(ContainSubstring("AlmSetting"))
7070
Expect(resp).To(BeNil())
@@ -86,7 +86,7 @@ var _ = Describe("AlmIntegrations Service", Ordered, func() {
8686
})
8787

8888
It("should fail without required projectName", func() {
89-
resp, err := client.AlmIntegrations.ImportAzureProject(&sonar.AlmIntegrationsImportAzureProjectOption{
89+
resp, err := client.AlmIntegrations.ImportAzureProject(&sonar.AlmIntegrationsImportAzureProjectOptions{
9090
RepositoryName: "test-repo",
9191
})
9292
Expect(err).To(HaveOccurred())
@@ -95,7 +95,7 @@ var _ = Describe("AlmIntegrations Service", Ordered, func() {
9595
})
9696

9797
It("should fail without required repositoryName", func() {
98-
resp, err := client.AlmIntegrations.ImportAzureProject(&sonar.AlmIntegrationsImportAzureProjectOption{
98+
resp, err := client.AlmIntegrations.ImportAzureProject(&sonar.AlmIntegrationsImportAzureProjectOptions{
9999
ProjectName: "test-project",
100100
})
101101
Expect(err).To(HaveOccurred())
@@ -104,7 +104,7 @@ var _ = Describe("AlmIntegrations Service", Ordered, func() {
104104
})
105105

106106
It("should fail with invalid newCodeDefinitionType", func() {
107-
resp, err := client.AlmIntegrations.ImportAzureProject(&sonar.AlmIntegrationsImportAzureProjectOption{
107+
resp, err := client.AlmIntegrations.ImportAzureProject(&sonar.AlmIntegrationsImportAzureProjectOptions{
108108
ProjectName: "test-project",
109109
RepositoryName: "test-repo",
110110
NewCodeDefinitionType: "INVALID_TYPE",
@@ -115,7 +115,7 @@ var _ = Describe("AlmIntegrations Service", Ordered, func() {
115115
})
116116

117117
It("should fail with NUMBER_OF_DAYS type and invalid days value", func() {
118-
resp, err := client.AlmIntegrations.ImportAzureProject(&sonar.AlmIntegrationsImportAzureProjectOption{
118+
resp, err := client.AlmIntegrations.ImportAzureProject(&sonar.AlmIntegrationsImportAzureProjectOptions{
119119
ProjectName: "test-project",
120120
RepositoryName: "test-repo",
121121
NewCodeDefinitionType: "NUMBER_OF_DAYS",
@@ -127,7 +127,7 @@ var _ = Describe("AlmIntegrations Service", Ordered, func() {
127127
})
128128

129129
It("should fail with NUMBER_OF_DAYS type and days value too high", func() {
130-
resp, err := client.AlmIntegrations.ImportAzureProject(&sonar.AlmIntegrationsImportAzureProjectOption{
130+
resp, err := client.AlmIntegrations.ImportAzureProject(&sonar.AlmIntegrationsImportAzureProjectOptions{
131131
ProjectName: "test-project",
132132
RepositoryName: "test-repo",
133133
NewCodeDefinitionType: "NUMBER_OF_DAYS",
@@ -153,14 +153,14 @@ var _ = Describe("AlmIntegrations Service", Ordered, func() {
153153
})
154154

155155
It("should fail without required repositorySlug", func() {
156-
resp, err := client.AlmIntegrations.ImportBitbucketCloudRepo(&sonar.AlmIntegrationsImportBitbucketCloudRepoOption{})
156+
resp, err := client.AlmIntegrations.ImportBitbucketCloudRepo(&sonar.AlmIntegrationsImportBitbucketCloudRepoOptions{})
157157
Expect(err).To(HaveOccurred())
158158
Expect(err.Error()).To(ContainSubstring("RepositorySlug"))
159159
Expect(resp).To(BeNil())
160160
})
161161

162162
It("should fail with invalid newCodeDefinitionType", func() {
163-
resp, err := client.AlmIntegrations.ImportBitbucketCloudRepo(&sonar.AlmIntegrationsImportBitbucketCloudRepoOption{
163+
resp, err := client.AlmIntegrations.ImportBitbucketCloudRepo(&sonar.AlmIntegrationsImportBitbucketCloudRepoOptions{
164164
RepositorySlug: "test-slug",
165165
NewCodeDefinitionType: "INVALID_TYPE",
166166
})
@@ -184,7 +184,7 @@ var _ = Describe("AlmIntegrations Service", Ordered, func() {
184184
})
185185

186186
It("should fail without required projectKey", func() {
187-
resp, err := client.AlmIntegrations.ImportBitbucketServerProject(&sonar.AlmIntegrationsImportBitbucketServerProjectOption{
187+
resp, err := client.AlmIntegrations.ImportBitbucketServerProject(&sonar.AlmIntegrationsImportBitbucketServerProjectOptions{
188188
RepositorySlug: "test-slug",
189189
})
190190
Expect(err).To(HaveOccurred())
@@ -193,7 +193,7 @@ var _ = Describe("AlmIntegrations Service", Ordered, func() {
193193
})
194194

195195
It("should fail without required repositorySlug", func() {
196-
resp, err := client.AlmIntegrations.ImportBitbucketServerProject(&sonar.AlmIntegrationsImportBitbucketServerProjectOption{
196+
resp, err := client.AlmIntegrations.ImportBitbucketServerProject(&sonar.AlmIntegrationsImportBitbucketServerProjectOptions{
197197
ProjectKey: "test-project",
198198
})
199199
Expect(err).To(HaveOccurred())
@@ -216,15 +216,15 @@ var _ = Describe("AlmIntegrations Service", Ordered, func() {
216216
})
217217

218218
It("should fail without required repositoryKey", func() {
219-
resp, err := client.AlmIntegrations.ImportGithubProject(&sonar.AlmIntegrationsImportGithubProjectOption{})
219+
resp, err := client.AlmIntegrations.ImportGithubProject(&sonar.AlmIntegrationsImportGithubProjectOptions{})
220220
Expect(err).To(HaveOccurred())
221221
Expect(err.Error()).To(ContainSubstring("RepositoryKey"))
222222
Expect(resp).To(BeNil())
223223
})
224224

225225
It("should fail with repositoryKey too long", func() {
226226
longKey := string(make([]byte, 257))
227-
resp, err := client.AlmIntegrations.ImportGithubProject(&sonar.AlmIntegrationsImportGithubProjectOption{
227+
resp, err := client.AlmIntegrations.ImportGithubProject(&sonar.AlmIntegrationsImportGithubProjectOptions{
228228
RepositoryKey: longKey,
229229
})
230230
Expect(err).To(HaveOccurred())
@@ -247,7 +247,7 @@ var _ = Describe("AlmIntegrations Service", Ordered, func() {
247247
})
248248

249249
It("should fail without required gitlabProjectId", func() {
250-
resp, err := client.AlmIntegrations.ImportGitlabProject(&sonar.AlmIntegrationsImportGitlabProjectOption{})
250+
resp, err := client.AlmIntegrations.ImportGitlabProject(&sonar.AlmIntegrationsImportGitlabProjectOptions{})
251251
Expect(err).To(HaveOccurred())
252252
Expect(err.Error()).To(ContainSubstring("GitlabProjectId"))
253253
Expect(resp).To(BeNil())
@@ -269,7 +269,7 @@ var _ = Describe("AlmIntegrations Service", Ordered, func() {
269269
})
270270

271271
It("should fail without required almSetting", func() {
272-
result, resp, err := client.AlmIntegrations.ListAzureProjects(&sonar.AlmIntegrationsListAzureProjectsOption{})
272+
result, resp, err := client.AlmIntegrations.ListAzureProjects(&sonar.AlmIntegrationsListAzureProjectsOptions{})
273273
Expect(err).To(HaveOccurred())
274274
Expect(err.Error()).To(ContainSubstring("AlmSetting"))
275275
Expect(resp).To(BeNil())
@@ -292,7 +292,7 @@ var _ = Describe("AlmIntegrations Service", Ordered, func() {
292292
})
293293

294294
It("should fail without required almSetting", func() {
295-
result, resp, err := client.AlmIntegrations.ListBitbucketServerProjects(&sonar.AlmIntegrationsListBitbucketServerProjectsOption{})
295+
result, resp, err := client.AlmIntegrations.ListBitbucketServerProjects(&sonar.AlmIntegrationsListBitbucketServerProjectsOptions{})
296296
Expect(err).To(HaveOccurred())
297297
Expect(err.Error()).To(ContainSubstring("AlmSetting"))
298298
Expect(resp).To(BeNil())
@@ -315,7 +315,7 @@ var _ = Describe("AlmIntegrations Service", Ordered, func() {
315315
})
316316

317317
It("should fail without required almSetting", func() {
318-
result, resp, err := client.AlmIntegrations.ListGithubOrganizations(&sonar.AlmIntegrationsListGithubOrganizationsOption{})
318+
result, resp, err := client.AlmIntegrations.ListGithubOrganizations(&sonar.AlmIntegrationsListGithubOrganizationsOptions{})
319319
Expect(err).To(HaveOccurred())
320320
Expect(err.Error()).To(ContainSubstring("AlmSetting"))
321321
Expect(resp).To(BeNil())
@@ -338,7 +338,7 @@ var _ = Describe("AlmIntegrations Service", Ordered, func() {
338338
})
339339

340340
It("should fail without required almSetting", func() {
341-
result, resp, err := client.AlmIntegrations.ListGithubRepositories(&sonar.AlmIntegrationsListGithubRepositoriesOption{
341+
result, resp, err := client.AlmIntegrations.ListGithubRepositories(&sonar.AlmIntegrationsListGithubRepositoriesOptions{
342342
Organization: "test-org",
343343
})
344344
Expect(err).To(HaveOccurred())
@@ -348,7 +348,7 @@ var _ = Describe("AlmIntegrations Service", Ordered, func() {
348348
})
349349

350350
It("should fail without required organization", func() {
351-
result, resp, err := client.AlmIntegrations.ListGithubRepositories(&sonar.AlmIntegrationsListGithubRepositoriesOption{
351+
result, resp, err := client.AlmIntegrations.ListGithubRepositories(&sonar.AlmIntegrationsListGithubRepositoriesOptions{
352352
AlmSetting: "test-github",
353353
})
354354
Expect(err).To(HaveOccurred())
@@ -373,7 +373,7 @@ var _ = Describe("AlmIntegrations Service", Ordered, func() {
373373
})
374374

375375
It("should fail without required almSetting", func() {
376-
result, resp, err := client.AlmIntegrations.SearchAzureRepos(&sonar.AlmIntegrationsSearchAzureReposOption{})
376+
result, resp, err := client.AlmIntegrations.SearchAzureRepos(&sonar.AlmIntegrationsSearchAzureReposOptions{})
377377
Expect(err).To(HaveOccurred())
378378
Expect(err.Error()).To(ContainSubstring("AlmSetting"))
379379
Expect(resp).To(BeNil())
@@ -396,7 +396,7 @@ var _ = Describe("AlmIntegrations Service", Ordered, func() {
396396
})
397397

398398
It("should fail without required almSetting", func() {
399-
result, resp, err := client.AlmIntegrations.SearchBitbucketCloudRepos(&sonar.AlmIntegrationsSearchBitbucketCloudReposOption{})
399+
result, resp, err := client.AlmIntegrations.SearchBitbucketCloudRepos(&sonar.AlmIntegrationsSearchBitbucketCloudReposOptions{})
400400
Expect(err).To(HaveOccurred())
401401
Expect(err.Error()).To(ContainSubstring("AlmSetting"))
402402
Expect(resp).To(BeNil())
@@ -419,7 +419,7 @@ var _ = Describe("AlmIntegrations Service", Ordered, func() {
419419
})
420420

421421
It("should fail without required almSetting", func() {
422-
result, resp, err := client.AlmIntegrations.SearchBitbucketServerRepos(&sonar.AlmIntegrationsSearchBitbucketServerReposOption{})
422+
result, resp, err := client.AlmIntegrations.SearchBitbucketServerRepos(&sonar.AlmIntegrationsSearchBitbucketServerReposOptions{})
423423
Expect(err).To(HaveOccurred())
424424
Expect(err.Error()).To(ContainSubstring("AlmSetting"))
425425
Expect(resp).To(BeNil())
@@ -442,7 +442,7 @@ var _ = Describe("AlmIntegrations Service", Ordered, func() {
442442
})
443443

444444
It("should fail without required almSetting", func() {
445-
result, resp, err := client.AlmIntegrations.SearchGitlabRepos(&sonar.AlmIntegrationsSearchGitlabReposOption{})
445+
result, resp, err := client.AlmIntegrations.SearchGitlabRepos(&sonar.AlmIntegrationsSearchGitlabReposOptions{})
446446
Expect(err).To(HaveOccurred())
447447
Expect(err.Error()).To(ContainSubstring("AlmSetting"))
448448
Expect(resp).To(BeNil())
@@ -464,7 +464,7 @@ var _ = Describe("AlmIntegrations Service", Ordered, func() {
464464
})
465465

466466
It("should fail without required pat", func() {
467-
resp, err := client.AlmIntegrations.SetPat(&sonar.AlmIntegrationsSetPatOption{
467+
resp, err := client.AlmIntegrations.SetPat(&sonar.AlmIntegrationsSetPatOptions{
468468
AlmSetting: "test-alm",
469469
})
470470
Expect(err).To(HaveOccurred())
@@ -474,7 +474,7 @@ var _ = Describe("AlmIntegrations Service", Ordered, func() {
474474

475475
It("should fail with pat too long", func() {
476476
longPat := string(make([]byte, 2001))
477-
resp, err := client.AlmIntegrations.SetPat(&sonar.AlmIntegrationsSetPatOption{
477+
resp, err := client.AlmIntegrations.SetPat(&sonar.AlmIntegrationsSetPatOptions{
478478
AlmSetting: "test-alm",
479479
Pat: longPat,
480480
})

0 commit comments

Comments
 (0)