From 26e9371fc9b84c66a4ec068bd1b4817727ef4f1d Mon Sep 17 00:00:00 2001 From: Caleb McCombs Date: Fri, 2 Jun 2023 17:44:18 -0700 Subject: [PATCH 01/40] Fix a typo in contributing doc --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 05e4bdfc..89ad4a36 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -37,7 +37,7 @@ to . > If you want to ask a question, we assume that you have read the available [Documentation](https://docs.go-atlassian.io/). -Before you ask a question, it is best to search for existing [Issues](https://github.com/ctreminiom/go-atlassianissues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first. +Before you ask a question, it is best to search for existing [Issues](https://github.com/ctreminiom/go-atlassian/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first. If you then still feel the need to ask a question and need clarification, we recommend the following: From 5c571f6c4c902003fd0428f5f2355abf24843dc3 Mon Sep 17 00:00:00 2001 From: Caleb McCombs Date: Fri, 2 Jun 2023 17:46:45 -0700 Subject: [PATCH 02/40] Add Confluence V2 Pages By Parent --- confluence/internal/page_impl.go | 42 ++++++++++ confluence/internal/page_impl_test.go | 114 ++++++++++++++++++++++++++ go-atlassian.iml | 9 ++ service/confluence/page.go | 11 +++ 4 files changed, 176 insertions(+) create mode 100644 go-atlassian.iml diff --git a/confluence/internal/page_impl.go b/confluence/internal/page_impl.go index 0667bd2b..ec557bf0 100644 --- a/confluence/internal/page_impl.go +++ b/confluence/internal/page_impl.go @@ -70,6 +70,19 @@ func (p *PageService) GetsBySpace(ctx context.Context, spaceID int, cursor strin return p.internalClient.GetsBySpace(ctx, spaceID, cursor, limit) } +// GetsByParent returns all children of a page. +// +// The number of results is limited by the limit parameter and additional results (if available) +// +// will be available through the next cursor +// +// GET /wiki/api/v2/pages/{id}/children +// +// https://docs.go-atlassian.io/confluence-cloud/v2/page#get-children +func (p *PageService) GetsByParent(ctx context.Context, pageID int, cursor string, limit int) (*model.PageChunkScheme, *model.ResponseScheme, error) { + return p.internalClient.GetsByParent(ctx, pageID, cursor, limit) +} + // Create creates a page in the space. // // Pages are created as published by default unless specified as a draft in the status field. @@ -228,6 +241,35 @@ func (i *internalPageImpl) GetsBySpace(ctx context.Context, spaceID int, cursor return chunk, response, nil } +func (i *internalPageImpl) GetsByParent(ctx context.Context, parentID int, cursor string, limit int) (*model.PageChunkScheme, *model.ResponseScheme, error) { + + if parentID == 0 { + return nil, nil, model.ErrNoPageIDError + } + + query := url.Values{} + query.Add("limit", strconv.Itoa(limit)) + + if cursor != "" { + query.Add("cursor", cursor) + } + + endpoint := fmt.Sprintf("wiki/api/v2/pages/%v/children?%v", parentID, query.Encode()) + + request, err := i.c.NewRequest(ctx, http.MethodGet, endpoint, nil) + if err != nil { + return nil, nil, err + } + + chunk := new(model.PageChunkScheme) + response, err := i.c.Call(request, chunk) + if err != nil { + return nil, response, err + } + + return chunk, response, nil +} + func (i *internalPageImpl) Create(ctx context.Context, payload *model.PageCreatePayloadScheme) (*model.PageScheme, *model.ResponseScheme, error) { reader, err := i.c.TransformStructToReader(payload) diff --git a/confluence/internal/page_impl_test.go b/confluence/internal/page_impl_test.go index 377f4db0..2ba60660 100644 --- a/confluence/internal/page_impl_test.go +++ b/confluence/internal/page_impl_test.go @@ -466,6 +466,120 @@ func Test_internalPageImpl_GetsBySpace(t *testing.T) { } } +func Test_internalPageImpl_GetsByParent(t *testing.T) { + + type fields struct { + c service.Client + } + + type args struct { + ctx context.Context + parentID int + cursor string + limit int + } + + testCases := []struct { + name string + fields fields + args args + on func(*fields) + wantErr bool + Err error + }{ + { + name: "when the parameters are correct", + args: args{ + ctx: context.TODO(), + parentID: 20001, + cursor: "cursor-sample", + limit: 200, + }, + on: func(fields *fields) { + + client := mocks.NewClient(t) + + client.On("NewRequest", + context.Background(), + http.MethodGet, + "wiki/api/v2/pages/20001/children?cursor=cursor-sample&limit=200", + nil). + Return(&http.Request{}, nil) + + client.On("Call", + &http.Request{}, + &model.PageChunkScheme{}). + Return(&model.ResponseScheme{}, nil) + + fields.c = client + }, + }, + + { + name: "when the parent id is not provided", + args: args{ + ctx: context.TODO(), + }, + wantErr: true, + Err: model.ErrNoPageIDError, + }, + + { + name: "when the http request cannot be created", + args: args{ + ctx: context.TODO(), + parentID: 20001, + cursor: "cursor-sample", + limit: 200, + }, + on: func(fields *fields) { + + client := mocks.NewClient(t) + + client.On("NewRequest", + context.Background(), + http.MethodGet, + "wiki/api/v2/pages/20001/children?cursor=cursor-sample&limit=200", + nil). + Return(&http.Request{}, errors.New("error, unable to create the http request")) + + fields.c = client + }, + wantErr: true, + Err: errors.New("error, unable to create the http request"), + }, + } + + for _, testCase := range testCases { + t.Run(testCase.name, func(t *testing.T) { + + if testCase.on != nil { + testCase.on(&testCase.fields) + } + + newService := NewPageService(testCase.fields.c) + + gotResult, gotResponse, err := newService.GetsByParent(testCase.args.ctx, testCase.args.parentID, + testCase.args.cursor, testCase.args.limit) + + if testCase.wantErr { + + if err != nil { + t.Logf("error returned: %v", err.Error()) + } + + assert.EqualError(t, err, testCase.Err.Error()) + } else { + + assert.NoError(t, err) + assert.NotEqual(t, gotResponse, nil) + assert.NotEqual(t, gotResult, nil) + } + + }) + } +} + func Test_internalPageImpl_Delete(t *testing.T) { type fields struct { diff --git a/go-atlassian.iml b/go-atlassian.iml new file mode 100644 index 00000000..eacc75a3 --- /dev/null +++ b/go-atlassian.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/service/confluence/page.go b/service/confluence/page.go index 1df29729..0954519c 100644 --- a/service/confluence/page.go +++ b/service/confluence/page.go @@ -49,6 +49,17 @@ type PageConnector interface { // https://docs.go-atlassian.io/confluence-cloud/v2/page#get-pages-in-space GetsBySpace(ctx context.Context, spaceID int, cursor string, limit int) (*models.PageChunkScheme, *models.ResponseScheme, error) + // GetsByParent returns all children of a page. + // + // The number of results is limited by the limit parameter and additional results (if available) + // + // will be available through the next cursor + // + // GET /wiki/api/v2/pages/{id}/children + // + // https://docs.go-atlassian.io/confluence-cloud/v2/page#get-children + GetsByParent(ctx context.Context, spaceID int, cursor string, limit int) (*models.PageChunkScheme, *models.ResponseScheme, error) + // Create creates a page in the space. // // Pages are created as published by default unless specified as a draft in the status field. From 6a0ce74fd981a0640dcba07cf955915f62d4324e Mon Sep 17 00:00:00 2001 From: Caleb McCombs Date: Fri, 2 Jun 2023 18:12:19 -0700 Subject: [PATCH 03/40] Remove Vestigial File Oops, didn't mean to commit that. --- go-atlassian.iml | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 go-atlassian.iml diff --git a/go-atlassian.iml b/go-atlassian.iml deleted file mode 100644 index eacc75a3..00000000 --- a/go-atlassian.iml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file From 108f7716e4ace9b2d72943c9c71ba0fb5604f618 Mon Sep 17 00:00:00 2001 From: Caleb McCombs Date: Mon, 5 Jun 2023 18:08:09 -0700 Subject: [PATCH 04/40] Update doc link to be more in line with what exists --- confluence/internal/page_impl.go | 2 +- go-atlassian.iml | 9 +++++++++ service/confluence/page.go | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 go-atlassian.iml diff --git a/confluence/internal/page_impl.go b/confluence/internal/page_impl.go index ec557bf0..1c316c6c 100644 --- a/confluence/internal/page_impl.go +++ b/confluence/internal/page_impl.go @@ -78,7 +78,7 @@ func (p *PageService) GetsBySpace(ctx context.Context, spaceID int, cursor strin // // GET /wiki/api/v2/pages/{id}/children // -// https://docs.go-atlassian.io/confluence-cloud/v2/page#get-children +// https://docs.go-atlassian.io/confluence-cloud/v2/page#get-pages-by-parent func (p *PageService) GetsByParent(ctx context.Context, pageID int, cursor string, limit int) (*model.PageChunkScheme, *model.ResponseScheme, error) { return p.internalClient.GetsByParent(ctx, pageID, cursor, limit) } diff --git a/go-atlassian.iml b/go-atlassian.iml new file mode 100644 index 00000000..eacc75a3 --- /dev/null +++ b/go-atlassian.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/service/confluence/page.go b/service/confluence/page.go index 0954519c..cb18c854 100644 --- a/service/confluence/page.go +++ b/service/confluence/page.go @@ -57,7 +57,7 @@ type PageConnector interface { // // GET /wiki/api/v2/pages/{id}/children // - // https://docs.go-atlassian.io/confluence-cloud/v2/page#get-children + // https://docs.go-atlassian.io/confluence-cloud/v2/page#get-pages-by-parent GetsByParent(ctx context.Context, spaceID int, cursor string, limit int) (*models.PageChunkScheme, *models.ResponseScheme, error) // Create creates a page in the space. From 66131f8f086001342ae7e9bf0c15dc4bc8cc695c Mon Sep 17 00:00:00 2001 From: Caleb McCombs Date: Tue, 6 Jun 2023 08:56:34 -0700 Subject: [PATCH 05/40] Remove Vestigial File --- go-atlassian.iml | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 go-atlassian.iml diff --git a/go-atlassian.iml b/go-atlassian.iml deleted file mode 100644 index eacc75a3..00000000 --- a/go-atlassian.iml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file From c36c758a4105f7bf4823ca6eed8a566424e1675e Mon Sep 17 00:00:00 2001 From: Caleb McCombs Date: Tue, 6 Jun 2023 10:45:25 -0700 Subject: [PATCH 06/40] Up Test Coverage To Include Failed Request --- confluence/internal/page_impl_test.go | 32 +++++++++++++++++++++++++++ go-atlassian.iml | 9 ++++++++ 2 files changed, 41 insertions(+) create mode 100644 go-atlassian.iml diff --git a/confluence/internal/page_impl_test.go b/confluence/internal/page_impl_test.go index 2ba60660..34f86ffb 100644 --- a/confluence/internal/page_impl_test.go +++ b/confluence/internal/page_impl_test.go @@ -545,9 +545,41 @@ func Test_internalPageImpl_GetsByParent(t *testing.T) { fields.c = client }, + wantErr: true, Err: errors.New("error, unable to create the http request"), }, + + { + name: "when the call fails", + args: args{ + ctx: context.TODO(), + parentID: 20001, + cursor: "cursor-sample", + limit: 200, + }, + on: func(fields *fields) { + + client := mocks.NewClient(t) + + client.On("NewRequest", + context.Background(), + http.MethodGet, + "wiki/api/v2/pages/20001/children?cursor=cursor-sample&limit=200", + nil). + Return(&http.Request{}, nil) + + client.On("Call", + &http.Request{}, + &model.PageChunkScheme{}). + Return(&model.ResponseScheme{}, errors.New("error, request failed")) + + fields.c = client + }, + + wantErr: true, + Err: errors.New("error, request failed"), + }, } for _, testCase := range testCases { diff --git a/go-atlassian.iml b/go-atlassian.iml new file mode 100644 index 00000000..eacc75a3 --- /dev/null +++ b/go-atlassian.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file From c4ead4e97ae596478d1351a5f8a5af7e175ae299 Mon Sep 17 00:00:00 2001 From: Caleb McCombs Date: Mon, 28 Aug 2023 17:30:20 -0500 Subject: [PATCH 07/40] Update Confluence GetsByChild Return Object To Be Unique --- confluence/internal/page_impl.go | 8 ++++---- confluence/internal/page_impl_test.go | 18 +++++++++--------- pkg/infra/models/confluence_page.go | 17 +++++++++++++++++ service/confluence/page.go | 2 +- 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/confluence/internal/page_impl.go b/confluence/internal/page_impl.go index 01a3a35a..ec8831af 100644 --- a/confluence/internal/page_impl.go +++ b/confluence/internal/page_impl.go @@ -81,7 +81,7 @@ func (p *PageService) GetsBySpace(ctx context.Context, spaceID int, cursor strin // GET /wiki/api/v2/pages/{id}/children // // https://docs.go-atlassian.io/confluence-cloud/v2/page#get-pages-by-parent -func (p *PageService) GetsByParent(ctx context.Context, pageID int, cursor string, limit int) (*model.PageChunkScheme, *model.ResponseScheme, error) { +func (p *PageService) GetsByParent(ctx context.Context, pageID int, cursor string, limit int) (*model.ChildPageChunkScheme, *model.ResponseScheme, error) { return p.internalClient.GetsByParent(ctx, pageID, cursor, limit) } @@ -286,7 +286,7 @@ func (i *internalPageImpl) GetsBySpace(ctx context.Context, spaceID int, cursor return chunk, response, nil } -func (i *internalPageImpl) GetsByParent(ctx context.Context, parentID int, cursor string, limit int) (*model.PageChunkScheme, *model.ResponseScheme, error) { +func (i *internalPageImpl) GetsByParent(ctx context.Context, parentID int, cursor string, limit int) (*model.ChildPageChunkScheme, *model.ResponseScheme, error) { if parentID == 0 { return nil, nil, model.ErrNoPageIDError @@ -301,12 +301,12 @@ func (i *internalPageImpl) GetsByParent(ctx context.Context, parentID int, curso endpoint := fmt.Sprintf("wiki/api/v2/pages/%v/children?%v", parentID, query.Encode()) - request, err := i.c.NewRequest(ctx, http.MethodGet, endpoint, nil) + request, err := i.c.NewRequest(ctx, http.MethodGet, endpoint, "", nil) if err != nil { return nil, nil, err } - chunk := new(model.PageChunkScheme) + chunk := new(model.ChildPageChunkScheme) response, err := i.c.Call(request, chunk) if err != nil { return nil, response, err diff --git a/confluence/internal/page_impl_test.go b/confluence/internal/page_impl_test.go index 1bacd5a4..318a3a55 100644 --- a/confluence/internal/page_impl_test.go +++ b/confluence/internal/page_impl_test.go @@ -587,7 +587,7 @@ func Test_internalPageImpl_GetsBySpace(t *testing.T) { func Test_internalPageImpl_GetsByParent(t *testing.T) { type fields struct { - c service.Client + c service.Connector } type args struct { @@ -615,18 +615,18 @@ func Test_internalPageImpl_GetsByParent(t *testing.T) { }, on: func(fields *fields) { - client := mocks.NewClient(t) + client := mocks.NewConnector(t) client.On("NewRequest", context.Background(), http.MethodGet, "wiki/api/v2/pages/20001/children?cursor=cursor-sample&limit=200", - nil). + "", nil). Return(&http.Request{}, nil) client.On("Call", &http.Request{}, - &model.PageChunkScheme{}). + &model.ChildPageChunkScheme{}). Return(&model.ResponseScheme{}, nil) fields.c = client @@ -652,13 +652,13 @@ func Test_internalPageImpl_GetsByParent(t *testing.T) { }, on: func(fields *fields) { - client := mocks.NewClient(t) + client := mocks.NewConnector(t) client.On("NewRequest", context.Background(), http.MethodGet, "wiki/api/v2/pages/20001/children?cursor=cursor-sample&limit=200", - nil). + "", nil). Return(&http.Request{}, errors.New("error, unable to create the http request")) fields.c = client @@ -678,18 +678,18 @@ func Test_internalPageImpl_GetsByParent(t *testing.T) { }, on: func(fields *fields) { - client := mocks.NewClient(t) + client := mocks.NewConnector(t) client.On("NewRequest", context.Background(), http.MethodGet, "wiki/api/v2/pages/20001/children?cursor=cursor-sample&limit=200", - nil). + "", nil). Return(&http.Request{}, nil) client.On("Call", &http.Request{}, - &model.PageChunkScheme{}). + &model.ChildPageChunkScheme{}). Return(&model.ResponseScheme{}, errors.New("error, request failed")) fields.c = client diff --git a/pkg/infra/models/confluence_page.go b/pkg/infra/models/confluence_page.go index 20116665..96b5b97b 100644 --- a/pkg/infra/models/confluence_page.go +++ b/pkg/infra/models/confluence_page.go @@ -1,5 +1,22 @@ package models +type ChildPageChunkLinksScheme struct { + Next string `json:"next,omitempty"` +} + +type ChildPageChunkScheme struct { + Results []*ChildPageScheme `json:"results,omitempty"` + Links *ChildPageChunkLinksScheme `json:"_links,omitempty"` +} + +type ChildPageScheme struct { + ID string `json:"id,omitempty"` + Status string `json:"status,omitempty"` + Title string `json:"title,omitempty"` + SpaceID string `json:"spaceId,omitempty"` + ChildPosition int `json:"childPosition,omitempty"` +} + type PageOptionsScheme struct { PageIDs []int SpaceIDs []int diff --git a/service/confluence/page.go b/service/confluence/page.go index 35dae25a..b9c9fed5 100644 --- a/service/confluence/page.go +++ b/service/confluence/page.go @@ -70,7 +70,7 @@ type PageConnector interface { // GET /wiki/api/v2/pages/{id}/children // // https://docs.go-atlassian.io/confluence-cloud/v2/page#get-pages-by-parent - GetsByParent(ctx context.Context, spaceID int, cursor string, limit int) (*models.PageChunkScheme, *models.ResponseScheme, error) + GetsByParent(ctx context.Context, spaceID int, cursor string, limit int) (*models.ChildPageChunkScheme, *models.ResponseScheme, error) // Create creates a page in the space. // From 751b204c25ed48f18f98a409684143e7b17d72fc Mon Sep 17 00:00:00 2001 From: tbaert-prest <158584906+tbaert-prest@users.noreply.github.com> Date: Mon, 5 Feb 2024 09:43:56 +0100 Subject: [PATCH 08/40] Update assets_object.go --- pkg/infra/models/assets_object.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/pkg/infra/models/assets_object.go b/pkg/infra/models/assets_object.go index 56b32faf..0b59c6e4 100644 --- a/pkg/infra/models/assets_object.go +++ b/pkg/infra/models/assets_object.go @@ -101,6 +101,28 @@ type ObjectAttributeScheme struct { ObjectAttributeValues []*ObjectTypeAssetAttributeValueScheme `json:"objectAttributeValues,omitempty"` } +type ObjectTypeAttributePayloadScheme struct { + Name string `json:"name,omitempty"` + Label bool `json:"label,omitempty"` + Description string `json:"description,omitempty"` + Type int `json:"type,omitempty"` + DefaultTypeId int `json:defaultTypeId,omitempty"` + TypeValue string `json:"typeValue,omitempty"` + TypeValueMulti []string `json:"typeValueMulti,omitempty"` + AdditionalValue string `json:"additionalValue,omitempty"` + MinimumCardinality int `json:"minimumCardinality,omitempty"` + MaximumCardinality int `json:"maximumCardinality,omitempty"` + Suffix string `json:"suffix,omitempty"` + IncludeChildObjectTypes bool `json:"includeChildObjectTypes,omitempty"` + Hidden bool `json:"hidden,omitempty"` + UniqueAttribute bool `json:"uniqueAttribute,omitempty"` + Summable bool `json:"summable,omitempty"` + RegexValidation string `json:"regexValidation,omitempty"` + QlQuery string `json:"qlQuery,omitempty"` + Iql string `json:"iql,omitempty"` + Options string `json:"options,omitempty"` +} + type ObjectTypeAttributeScheme struct { WorkspaceId string `json:"workspaceId,omitempty"` GlobalId string `json:"globalId,omitempty"` From 258cc8502703a31fa02d8608bafa50d7f9217d2d Mon Sep 17 00:00:00 2001 From: tbaert-prest <158584906+tbaert-prest@users.noreply.github.com> Date: Mon, 5 Feb 2024 09:45:54 +0100 Subject: [PATCH 09/40] Update object_type_attribute_impl.go --- assets/internal/object_type_attribute_impl.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/internal/object_type_attribute_impl.go b/assets/internal/object_type_attribute_impl.go index 5d1464bc..8c1a8f0b 100644 --- a/assets/internal/object_type_attribute_impl.go +++ b/assets/internal/object_type_attribute_impl.go @@ -25,7 +25,7 @@ type ObjectTypeAttributeService struct { // POST /jsm/assets/workspace/{workspaceId}/v1/objecttypeattribute/{objectTypeId} // // https://docs.go-atlassian.io/jira-assets/object/type/attribute#create-object-type-attribute -func (o *ObjectTypeAttributeService) Create(ctx context.Context, workspaceID, objectTypeID string, payload *model.ObjectTypeAttributeScheme) (*model.ObjectTypeAttributeScheme, *model.ResponseScheme, error) { +func (o *ObjectTypeAttributeService) Create(ctx context.Context, workspaceID, objectTypeID string, payload *model.ObjectTypeAttributePayloadScheme) (*model.ObjectTypeAttributeScheme, *model.ResponseScheme, error) { return o.internalClient.Create(ctx, workspaceID, objectTypeID, payload) } @@ -51,7 +51,7 @@ type internalObjectTypeAttributeImpl struct { c service.Connector } -func (i *internalObjectTypeAttributeImpl) Create(ctx context.Context, workspaceID, objectTypeID string, payload *model.ObjectTypeAttributeScheme) (*model.ObjectTypeAttributeScheme, *model.ResponseScheme, error) { +func (i *internalObjectTypeAttributeImpl) Create(ctx context.Context, workspaceID, objectTypeID string, payload *model.ObjectTypeAttributePayloadScheme) (*model.ObjectTypeAttributeScheme, *model.ResponseScheme, error) { if workspaceID == "" { return nil, nil, model.ErrNoWorkspaceIDError @@ -77,7 +77,7 @@ func (i *internalObjectTypeAttributeImpl) Create(ctx context.Context, workspaceI return attribute, res, nil } -func (i *internalObjectTypeAttributeImpl) Update(ctx context.Context, workspaceID, objectTypeID, attributeID string, payload *model.ObjectTypeAttributeScheme) (*model.ObjectTypeAttributeScheme, *model.ResponseScheme, error) { +func (i *internalObjectTypeAttributeImpl) Update(ctx context.Context, workspaceID, objectTypeID, attributeID string, payload *model.ObjectTypeAttributePayloadScheme) (*model.ObjectTypeAttributeScheme, *model.ResponseScheme, error) { if workspaceID == "" { return nil, nil, model.ErrNoWorkspaceIDError From c5a78d4b79be6d4c18c7e3fcc7ea610742e624b4 Mon Sep 17 00:00:00 2001 From: tbaert-prest <158584906+tbaert-prest@users.noreply.github.com> Date: Mon, 5 Feb 2024 09:49:21 +0100 Subject: [PATCH 10/40] Update object_type_attribute_impl_test.go --- .../object_type_attribute_impl_test.go | 46 ++++++++----------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/assets/internal/object_type_attribute_impl_test.go b/assets/internal/object_type_attribute_impl_test.go index 07aaa71f..d0b47e48 100644 --- a/assets/internal/object_type_attribute_impl_test.go +++ b/assets/internal/object_type_attribute_impl_test.go @@ -13,19 +13,16 @@ import ( func Test_internalObjectTypeAttributeImpl_Create(t *testing.T) { - payloadMocked := &model.ObjectTypeAttributeScheme{ - WorkspaceId: "g2778e1d-939d-581d-c8e2-9d5g59de456b", - GlobalId: "g2778e1d-939d-581d-c8e2-9d5g59de456b:1330", - ID: "1330", - ObjectType: nil, - Name: "Geolocation", - Label: false, - Type: 0, - Description: "", - DefaultType: &model.ObjectTypeAssetAttributeDefaultTypeScheme{ - ID: 0, - Name: "Text", - }, + payloadMocked := &model.ObjectTypeAttributePayloadScheme{ + WorkspaceId: "g2778e1d-939d-581d-c8e2-9d5g59de456b", + GlobalId: "g2778e1d-939d-581d-c8e2-9d5g59de456b:1330", + ID: "1330", + ObjectType: nil, + Name: "Geolocation", + Label: false, + Type: 0, + Description: "", + DefaultTypeId: 0, TypeValue: "", TypeValueMulti: nil, AdditionalValue: "", @@ -182,19 +179,16 @@ func Test_internalObjectTypeAttributeImpl_Create(t *testing.T) { func Test_internalObjectTypeAttributeImpl_Update(t *testing.T) { - payloadMocked := &model.ObjectTypeAttributeScheme{ - WorkspaceId: "g2778e1d-939d-581d-c8e2-9d5g59de456b", - GlobalId: "g2778e1d-939d-581d-c8e2-9d5g59de456b:1330", - ID: "1330", - ObjectType: nil, - Name: "Geolocation", - Label: false, - Type: 0, - Description: "", - DefaultType: &model.ObjectTypeAssetAttributeDefaultTypeScheme{ - ID: 0, - Name: "Text", - }, + payloadMocked := &model.ObjectTypeAttributePayloadScheme{ + WorkspaceId: "g2778e1d-939d-581d-c8e2-9d5g59de456b", + GlobalId: "g2778e1d-939d-581d-c8e2-9d5g59de456b:1330", + ID: "1330", + ObjectType: nil, + Name: "Geolocation", + Label: false, + Type: 0, + Description: "", + DefaultTypeId: 0, TypeValue: "", TypeValueMulti: nil, AdditionalValue: "", From a8231d1e93c554290513f8205c15d96a357eadaf Mon Sep 17 00:00:00 2001 From: tbaert-prest <158584906+tbaert-prest@users.noreply.github.com> Date: Tue, 6 Feb 2024 08:06:48 +0100 Subject: [PATCH 11/40] Update object_type_attribute.go --- service/assets/object_type_attribute.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service/assets/object_type_attribute.go b/service/assets/object_type_attribute.go index 9730602a..bc06dba8 100644 --- a/service/assets/object_type_attribute.go +++ b/service/assets/object_type_attribute.go @@ -14,7 +14,7 @@ type ObjectTypeAttributeConnector interface { // POST /jsm/assets/workspace/{workspaceId}/v1/objecttypeattribute/{objectTypeId} // // https://docs.go-atlassian.io/jira-assets/object/type/attribute#create-object-type-attribute - Create(ctx context.Context, workspaceID, objectTypeID string, payload *models.ObjectTypeAttributeScheme) ( + Create(ctx context.Context, workspaceID, objectTypeID string, payload *models.ObjectTypeAttributePayloadScheme) ( *models.ObjectTypeAttributeScheme, *models.ResponseScheme, error) // Update updates an existing object type attribute @@ -22,7 +22,7 @@ type ObjectTypeAttributeConnector interface { // PUT /jsm/assets/workspace/{workspaceId}/v1/objecttypeattribute/{objectTypeId}/{id} // // https://docs.go-atlassian.io/jira-assets/object/type/attribute#update-object-type-attribute - Update(ctx context.Context, workspaceID, objectTypeID, attributeID string, payload *models.ObjectTypeAttributeScheme) ( + Update(ctx context.Context, workspaceID, objectTypeID, attributeID string, payload *models.ObjectTypeAttributePayloadScheme) ( *models.ObjectTypeAttributeScheme, *models.ResponseScheme, error) // Delete deletes an existing object type attribute From 419186e956e56294496badf3867cd4bb6fbc11b9 Mon Sep 17 00:00:00 2001 From: tbaert-prest <158584906+tbaert-prest@users.noreply.github.com> Date: Wed, 7 Feb 2024 09:54:40 +0100 Subject: [PATCH 12/40] Update assets_object.go --- pkg/infra/models/assets_object.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/infra/models/assets_object.go b/pkg/infra/models/assets_object.go index 0b59c6e4..0d65f7f1 100644 --- a/pkg/infra/models/assets_object.go +++ b/pkg/infra/models/assets_object.go @@ -105,13 +105,13 @@ type ObjectTypeAttributePayloadScheme struct { Name string `json:"name,omitempty"` Label bool `json:"label,omitempty"` Description string `json:"description,omitempty"` - Type int `json:"type,omitempty"` - DefaultTypeId int `json:defaultTypeId,omitempty"` + Type *int `json:"type,omitempty"` + DefaultTypeId *int `json:defaultTypeId,omitempty"` TypeValue string `json:"typeValue,omitempty"` TypeValueMulti []string `json:"typeValueMulti,omitempty"` AdditionalValue string `json:"additionalValue,omitempty"` - MinimumCardinality int `json:"minimumCardinality,omitempty"` - MaximumCardinality int `json:"maximumCardinality,omitempty"` + MinimumCardinality *int `json:"minimumCardinality,omitempty"` + MaximumCardinality *int `json:"maximumCardinality,omitempty"` Suffix string `json:"suffix,omitempty"` IncludeChildObjectTypes bool `json:"includeChildObjectTypes,omitempty"` Hidden bool `json:"hidden,omitempty"` From d9f9773ca6e22400079b65bfa980189b53a50347 Mon Sep 17 00:00:00 2001 From: tbaert-prest <158584906+tbaert-prest@users.noreply.github.com> Date: Fri, 16 Feb 2024 10:04:58 +0100 Subject: [PATCH 13/40] Update object_type_attribute_impl.go --- assets/internal/object_type_attribute_impl.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/internal/object_type_attribute_impl.go b/assets/internal/object_type_attribute_impl.go index 8c1a8f0b..0b6b8cca 100644 --- a/assets/internal/object_type_attribute_impl.go +++ b/assets/internal/object_type_attribute_impl.go @@ -34,7 +34,7 @@ func (o *ObjectTypeAttributeService) Create(ctx context.Context, workspaceID, ob // PUT /jsm/assets/workspace/{workspaceId}/v1/objecttypeattribute/{objectTypeId}/{id} // // https://docs.go-atlassian.io/jira-assets/object/type/attribute#update-object-type-attribute -func (o *ObjectTypeAttributeService) Update(ctx context.Context, workspaceID, objectTypeID, attributeID string, payload *model.ObjectTypeAttributeScheme) (*model.ObjectTypeAttributeScheme, *model.ResponseScheme, error) { +func (o *ObjectTypeAttributeService) Update(ctx context.Context, workspaceID, objectTypeID, attributeID string, payload *model.ObjectTypeAttributePayloadScheme) (*model.ObjectTypeAttributeScheme, *model.ResponseScheme, error) { return o.internalClient.Update(ctx, workspaceID, objectTypeID, attributeID, payload) } From e4cdf6e143c70cf00e7c11699f34d44cc8e4db9f Mon Sep 17 00:00:00 2001 From: tbaert-prest <158584906+tbaert-prest@users.noreply.github.com> Date: Fri, 16 Feb 2024 10:08:56 +0100 Subject: [PATCH 14/40] Update object_type_attribute_impl_test.go --- assets/internal/object_type_attribute_impl_test.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/assets/internal/object_type_attribute_impl_test.go b/assets/internal/object_type_attribute_impl_test.go index d0b47e48..08cf0cd2 100644 --- a/assets/internal/object_type_attribute_impl_test.go +++ b/assets/internal/object_type_attribute_impl_test.go @@ -14,10 +14,6 @@ import ( func Test_internalObjectTypeAttributeImpl_Create(t *testing.T) { payloadMocked := &model.ObjectTypeAttributePayloadScheme{ - WorkspaceId: "g2778e1d-939d-581d-c8e2-9d5g59de456b", - GlobalId: "g2778e1d-939d-581d-c8e2-9d5g59de456b:1330", - ID: "1330", - ObjectType: nil, Name: "Geolocation", Label: false, Type: 0, From e7a2135fdc4c6b72d48b1352ebf1ea90226db51d Mon Sep 17 00:00:00 2001 From: tbaert-prest <158584906+tbaert-prest@users.noreply.github.com> Date: Fri, 16 Feb 2024 10:16:17 +0100 Subject: [PATCH 15/40] Update object_type_attribute_impl_test.go --- assets/internal/object_type_attribute_impl_test.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/assets/internal/object_type_attribute_impl_test.go b/assets/internal/object_type_attribute_impl_test.go index 08cf0cd2..277a891d 100644 --- a/assets/internal/object_type_attribute_impl_test.go +++ b/assets/internal/object_type_attribute_impl_test.go @@ -12,19 +12,17 @@ import ( ) func Test_internalObjectTypeAttributeImpl_Create(t *testing.T) { - + attributeType := 0 + defaultTypeId := 0 payloadMocked := &model.ObjectTypeAttributePayloadScheme{ Name: "Geolocation", Label: false, - Type: 0, + Type: &attributeType, Description: "", - DefaultTypeId: 0, + DefaultTypeId: &defaultTypeId, TypeValue: "", TypeValueMulti: nil, AdditionalValue: "", - ReferenceType: nil, - ReferenceObjectTypeId: "", - ReferenceObjectType: nil, Editable: false, System: false, Indexed: false, From 0fee23c59f1cfb5b81aeffd7090c1659db1cc0bd Mon Sep 17 00:00:00 2001 From: tbaert-prest <158584906+tbaert-prest@users.noreply.github.com> Date: Fri, 16 Feb 2024 10:22:35 +0100 Subject: [PATCH 16/40] Update object_type_attribute_impl_test.go --- assets/internal/object_type_attribute_impl_test.go | 7 ------- 1 file changed, 7 deletions(-) diff --git a/assets/internal/object_type_attribute_impl_test.go b/assets/internal/object_type_attribute_impl_test.go index 277a891d..848bba14 100644 --- a/assets/internal/object_type_attribute_impl_test.go +++ b/assets/internal/object_type_attribute_impl_test.go @@ -23,16 +23,10 @@ func Test_internalObjectTypeAttributeImpl_Create(t *testing.T) { TypeValue: "", TypeValueMulti: nil, AdditionalValue: "", - Editable: false, - System: false, - Indexed: false, - Sortable: false, Summable: false, MinimumCardinality: 0, MaximumCardinality: 0, Suffix: "", - Removable: false, - ObjectAttributeExists: false, Hidden: false, IncludeChildObjectTypes: false, UniqueAttribute: false, @@ -40,7 +34,6 @@ func Test_internalObjectTypeAttributeImpl_Create(t *testing.T) { Iql: "", QlQuery: "", Options: "", - Position: 6, } type fields struct { From 2d5324a19ac437329c71073e0563630316d2db58 Mon Sep 17 00:00:00 2001 From: tbaert-prest <158584906+tbaert-prest@users.noreply.github.com> Date: Fri, 16 Feb 2024 10:27:48 +0100 Subject: [PATCH 17/40] Update object_type_attribute_impl_test.go --- assets/internal/object_type_attribute_impl_test.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/assets/internal/object_type_attribute_impl_test.go b/assets/internal/object_type_attribute_impl_test.go index 848bba14..25e960e8 100644 --- a/assets/internal/object_type_attribute_impl_test.go +++ b/assets/internal/object_type_attribute_impl_test.go @@ -12,14 +12,12 @@ import ( ) func Test_internalObjectTypeAttributeImpl_Create(t *testing.T) { - attributeType := 0 - defaultTypeId := 0 payloadMocked := &model.ObjectTypeAttributePayloadScheme{ Name: "Geolocation", Label: false, - Type: &attributeType, + Type: *int(0), Description: "", - DefaultTypeId: &defaultTypeId, + DefaultTypeId: *int(0), TypeValue: "", TypeValueMulti: nil, AdditionalValue: "", From 395073e80fcb11c02f47d36b9472d2963ca2b266 Mon Sep 17 00:00:00 2001 From: tbaert-prest <158584906+tbaert-prest@users.noreply.github.com> Date: Fri, 16 Feb 2024 10:33:25 +0100 Subject: [PATCH 18/40] Update object_type_attribute_impl_test.go --- assets/internal/object_type_attribute_impl_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/internal/object_type_attribute_impl_test.go b/assets/internal/object_type_attribute_impl_test.go index 25e960e8..1ceb9ee9 100644 --- a/assets/internal/object_type_attribute_impl_test.go +++ b/assets/internal/object_type_attribute_impl_test.go @@ -15,9 +15,9 @@ func Test_internalObjectTypeAttributeImpl_Create(t *testing.T) { payloadMocked := &model.ObjectTypeAttributePayloadScheme{ Name: "Geolocation", Label: false, - Type: *int(0), + Type: &int(0), Description: "", - DefaultTypeId: *int(0), + DefaultTypeId: &int(0), TypeValue: "", TypeValueMulti: nil, AdditionalValue: "", From 495bad581b0a82ce31e9a892e5aeb0e00507bc48 Mon Sep 17 00:00:00 2001 From: tbaert-prest <158584906+tbaert-prest@users.noreply.github.com> Date: Fri, 16 Feb 2024 10:35:29 +0100 Subject: [PATCH 19/40] Update object_type_attribute_impl_test.go --- assets/internal/object_type_attribute_impl_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/assets/internal/object_type_attribute_impl_test.go b/assets/internal/object_type_attribute_impl_test.go index 1ceb9ee9..d87710e1 100644 --- a/assets/internal/object_type_attribute_impl_test.go +++ b/assets/internal/object_type_attribute_impl_test.go @@ -12,12 +12,16 @@ import ( ) func Test_internalObjectTypeAttributeImpl_Create(t *testing.T) { + var attributeType int + var defaultTypeID int + attributeType = 0 + defaultTypeID = 0 payloadMocked := &model.ObjectTypeAttributePayloadScheme{ Name: "Geolocation", Label: false, - Type: &int(0), + Type: &attributeType, Description: "", - DefaultTypeId: &int(0), + DefaultTypeId: &defaultTypeID, TypeValue: "", TypeValueMulti: nil, AdditionalValue: "", From 055fc71b86c54ba0d114f69cc8b4b9a767b015cd Mon Sep 17 00:00:00 2001 From: tbaert-prest <158584906+tbaert-prest@users.noreply.github.com> Date: Fri, 16 Feb 2024 11:14:31 +0100 Subject: [PATCH 20/40] Update object_type_attribute_impl_test.go --- .../object_type_attribute_impl_test.go | 44 +++++++++---------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/assets/internal/object_type_attribute_impl_test.go b/assets/internal/object_type_attribute_impl_test.go index d87710e1..b453883c 100644 --- a/assets/internal/object_type_attribute_impl_test.go +++ b/assets/internal/object_type_attribute_impl_test.go @@ -14,8 +14,12 @@ import ( func Test_internalObjectTypeAttributeImpl_Create(t *testing.T) { var attributeType int var defaultTypeID int + var minimumCardinality int + var maximumCardinality int attributeType = 0 defaultTypeID = 0 + minimumCardinality = 0 + maximumCardinality = 0 payloadMocked := &model.ObjectTypeAttributePayloadScheme{ Name: "Geolocation", Label: false, @@ -26,8 +30,8 @@ func Test_internalObjectTypeAttributeImpl_Create(t *testing.T) { TypeValueMulti: nil, AdditionalValue: "", Summable: false, - MinimumCardinality: 0, - MaximumCardinality: 0, + MinimumCardinality: &minimumCardinality, + MaximumCardinality: &maximumCardinality, Suffix: "", Hidden: false, IncludeChildObjectTypes: false, @@ -45,7 +49,7 @@ func Test_internalObjectTypeAttributeImpl_Create(t *testing.T) { type args struct { ctx context.Context workspaceID, objectTypeID string - payload *model.ObjectTypeAttributeScheme + payload *model.ObjectTypeAttributePayloadScheme } testCases := []struct { @@ -168,32 +172,27 @@ func Test_internalObjectTypeAttributeImpl_Create(t *testing.T) { func Test_internalObjectTypeAttributeImpl_Update(t *testing.T) { + var attributeType int + var defaultTypeID int + var minimumCardinality int + var maximumCardinality int + attributeType = 0 + defaultTypeID = 0 + minimumCardinality = 0 + maximumCardinality = 0 payloadMocked := &model.ObjectTypeAttributePayloadScheme{ - WorkspaceId: "g2778e1d-939d-581d-c8e2-9d5g59de456b", - GlobalId: "g2778e1d-939d-581d-c8e2-9d5g59de456b:1330", - ID: "1330", - ObjectType: nil, - Name: "Geolocation", - Label: false, - Type: 0, + Name: "Geolocation", + Label: false, + Type: &attributeType, Description: "", - DefaultTypeId: 0, + DefaultTypeId: &defaultTypeID, TypeValue: "", TypeValueMulti: nil, AdditionalValue: "", - ReferenceType: nil, - ReferenceObjectTypeId: "", - ReferenceObjectType: nil, - Editable: false, - System: false, - Indexed: false, - Sortable: false, Summable: false, - MinimumCardinality: 0, - MaximumCardinality: 0, + MinimumCardinality: &minimumCardinality, + MaximumCardinality: &maximumCardinality, Suffix: "", - Removable: false, - ObjectAttributeExists: false, Hidden: false, IncludeChildObjectTypes: false, UniqueAttribute: false, @@ -201,7 +200,6 @@ func Test_internalObjectTypeAttributeImpl_Update(t *testing.T) { Iql: "", QlQuery: "", Options: "", - Position: 6, } type fields struct { From 6927b3839312e0227d3aaf522de494bdfa478f3d Mon Sep 17 00:00:00 2001 From: tbaert-prest <158584906+tbaert-prest@users.noreply.github.com> Date: Fri, 16 Feb 2024 11:16:53 +0100 Subject: [PATCH 21/40] Update object_type_attribute_impl_test.go --- assets/internal/object_type_attribute_impl_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/internal/object_type_attribute_impl_test.go b/assets/internal/object_type_attribute_impl_test.go index b453883c..2e6caa10 100644 --- a/assets/internal/object_type_attribute_impl_test.go +++ b/assets/internal/object_type_attribute_impl_test.go @@ -209,7 +209,7 @@ func Test_internalObjectTypeAttributeImpl_Update(t *testing.T) { type args struct { ctx context.Context workspaceID, objectTypeID, attributeID string - payload *model.ObjectTypeAttributeScheme + payload *model.ObjectTypeAttributePayloadScheme } testCases := []struct { From a3aaa29bde47c026b6386ac5452c56baf9ea795f Mon Sep 17 00:00:00 2001 From: tbaert-prest <158584906+tbaert-prest@users.noreply.github.com> Date: Fri, 16 Feb 2024 11:20:04 +0100 Subject: [PATCH 22/40] Update assets_object.go --- pkg/infra/models/assets_object.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/infra/models/assets_object.go b/pkg/infra/models/assets_object.go index 0d65f7f1..4bee39e4 100644 --- a/pkg/infra/models/assets_object.go +++ b/pkg/infra/models/assets_object.go @@ -106,7 +106,7 @@ type ObjectTypeAttributePayloadScheme struct { Label bool `json:"label,omitempty"` Description string `json:"description,omitempty"` Type *int `json:"type,omitempty"` - DefaultTypeId *int `json:defaultTypeId,omitempty"` + DefaultTypeId *int `json:"defaultTypeId,omitempty"` TypeValue string `json:"typeValue,omitempty"` TypeValueMulti []string `json:"typeValueMulti,omitempty"` AdditionalValue string `json:"additionalValue,omitempty"` From 89b254c65a61cf73537d121dc48f3efc209cc058 Mon Sep 17 00:00:00 2001 From: Vernier Slenter Date: Fri, 19 Apr 2024 14:14:10 +0200 Subject: [PATCH 23/40] Fix for issue 260 --- jira/internal/attachment_impl.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jira/internal/attachment_impl.go b/jira/internal/attachment_impl.go index 2ce7fcee..93ac750a 100644 --- a/jira/internal/attachment_impl.go +++ b/jira/internal/attachment_impl.go @@ -234,7 +234,7 @@ func (i *internalIssueAttachmentServiceImpl) Add(ctx context.Context, issueKeyOr } var attachments []*model.IssueAttachmentScheme - response, err := i.c.Call(request, attachments) + response, err := i.c.Call(request, &attachments) if err != nil { return nil, response, err } From 21729ee7d1cbdc1de48ef16d2088c68794aa34eb Mon Sep 17 00:00:00 2001 From: Andre Licht Date: Fri, 14 Jun 2024 12:19:06 +0200 Subject: [PATCH 24/40] update dependencies: - github.com/google/uuid to v1.6.0 - github.com/stretchr/testify to v1.9.0 - github.com/tidwall/gjson to v1.17.1 - github.com/imdario/mergo v0.3.16 to dario.cat/mergo v1.0.0 --- go.mod | 8 ++++---- go.sum | 18 ++++++++++-------- jira/internal/issue_impl_adf.go | 2 +- jira/internal/issue_impl_rich_text.go | 2 +- pkg/infra/models/jira_issue_v2.go | 2 +- pkg/infra/models/jira_issue_v3.go | 2 +- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index 8face519..b7510785 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/ctreminiom/go-atlassian go 1.14 require ( - github.com/google/uuid v1.4.0 - github.com/imdario/mergo v0.3.16 - github.com/stretchr/testify v1.8.4 - github.com/tidwall/gjson v1.17.0 + dario.cat/mergo v1.0.0 + github.com/google/uuid v1.6.0 + github.com/stretchr/testify v1.9.0 + github.com/tidwall/gjson v1.17.1 ) diff --git a/go.sum b/go.sum index 24f6296a..7855961f 100644 --- a/go.sum +++ b/go.sum @@ -1,22 +1,24 @@ +dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= +dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= -github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= -github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/tidwall/gjson v1.17.0 h1:/Jocvlh98kcTfpN2+JzGQWQcqrPQwDrVEMApx/M5ZwM= -github.com/tidwall/gjson v1.17.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/tidwall/gjson v1.17.1 h1:wlYEnwqAHgzmhNUFfw7Xalt2JzQvsMx2Se4PcoFCT/U= +github.com/tidwall/gjson v1.17.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= diff --git a/jira/internal/issue_impl_adf.go b/jira/internal/issue_impl_adf.go index dfc4d9b9..5557b395 100644 --- a/jira/internal/issue_impl_adf.go +++ b/jira/internal/issue_impl_adf.go @@ -2,11 +2,11 @@ package internal import ( "context" + "dario.cat/mergo" "fmt" model "github.com/ctreminiom/go-atlassian/pkg/infra/models" "github.com/ctreminiom/go-atlassian/service" "github.com/ctreminiom/go-atlassian/service/jira" - "github.com/imdario/mergo" "net/http" "net/url" "strings" diff --git a/jira/internal/issue_impl_rich_text.go b/jira/internal/issue_impl_rich_text.go index 584d2355..6e9c7762 100644 --- a/jira/internal/issue_impl_rich_text.go +++ b/jira/internal/issue_impl_rich_text.go @@ -2,11 +2,11 @@ package internal import ( "context" + "dario.cat/mergo" "fmt" model "github.com/ctreminiom/go-atlassian/pkg/infra/models" "github.com/ctreminiom/go-atlassian/service" "github.com/ctreminiom/go-atlassian/service/jira" - "github.com/imdario/mergo" "net/http" "net/url" "strings" diff --git a/pkg/infra/models/jira_issue_v2.go b/pkg/infra/models/jira_issue_v2.go index ac8c1829..e6ba97a6 100644 --- a/pkg/infra/models/jira_issue_v2.go +++ b/pkg/infra/models/jira_issue_v2.go @@ -1,8 +1,8 @@ package models import ( + "dario.cat/mergo" "encoding/json" - "github.com/imdario/mergo" ) type IssueSchemeV2 struct { diff --git a/pkg/infra/models/jira_issue_v3.go b/pkg/infra/models/jira_issue_v3.go index 454ce153..62c55f25 100644 --- a/pkg/infra/models/jira_issue_v3.go +++ b/pkg/infra/models/jira_issue_v3.go @@ -1,8 +1,8 @@ package models import ( + "dario.cat/mergo" "encoding/json" - "github.com/imdario/mergo" ) type IssueScheme struct { From 3726c3e676e9c8314fcdfcc94c9e5dd4c2c824df Mon Sep 17 00:00:00 2001 From: Carlos Treminio Date: Sat, 15 Jun 2024 21:44:36 -0600 Subject: [PATCH 25/40] Fixed the test cases after dependencies upgrade. --- admin/api_client_impl_test.go | 4 +- .../organization_directory_impl_test.go | 32 +-- admin/internal/organization_impl_test.go | 48 ++-- .../internal/organization_policy_impl_test.go | 36 +-- admin/internal/scim_group_impl_test.go | 48 ++-- admin/internal/scim_schema_impl_test.go | 30 +-- admin/internal/scim_user_impl_test.go | 44 ++-- admin/internal/user_impl_test.go | 30 +-- admin/internal/user_token_impl_test.go | 14 +- assets/api_client_impl_test.go | 4 +- assets/internal/aql_impl_test.go | 6 +- assets/internal/icon_impl_test.go | 14 +- assets/internal/object_impl_test.go | 76 +++--- assets/internal/object_schema_impl_test.go | 54 ++--- .../object_type_attribute_impl_test.go | 46 ++-- assets/internal/object_type_impl_test.go | 46 ++-- bitbucket/api_client_impl_test.go | 6 +- bitbucket/internal/workspace_impl_test.go | 26 +- .../workspace_permissions_impl_test.go | 20 +- .../internal/workspace_webhooks_impl_test.go | 36 +-- confluence/api_client_impl_test.go | 6 +- confluence/internal/analytics_impl_test.go | 12 +- .../internal/attachment_content_impl_test.go | 26 +- confluence/internal/attachment_impl_test.go | 20 +- .../internal/attachment_version_impl_test.go | 12 +- .../children_descendants_content_impl_test.go | 56 ++--- .../internal/comment_content_impl_test.go | 6 +- confluence/internal/content_impl_test.go | 42 ++-- .../internal/custom_content_impl_test.go | 28 +-- .../internal/label_content_impl_test.go | 20 +- confluence/internal/label_impl_test.go | 6 +- confluence/internal/page_impl_test.go | 50 ++-- .../internal/permission_content_impl_test.go | 6 +- .../internal/permission_space_impl_test.go | 18 +- .../internal/properties_content_impl_test.go | 28 +-- .../internal/restriction_content_impl_test.go | 24 +- ...restriction_operation_content_impl_test.go | 14 +- ...ction_operation_group_content_impl_test.go | 32 +-- ...iction_operation_user_content_impl_test.go | 30 +-- confluence/internal/search_impl_test.go | 12 +- confluence/internal/space_impl_test.go | 42 ++-- confluence/internal/space_v2_impl_test.go | 14 +- confluence/internal/task_impl_test.go | 8 +- confluence/internal/version_content_test.go | 24 +- confluence/v2/api_client_impl_test.go | 6 +- jira/agile/api_client_impl_test.go | 4 +- jira/internal/attachment_impl_test.go | 4 +- jira/internal/comment_impl_adf_test.go | 28 +-- jira/internal/comment_impl_rich_text_test.go | 28 +-- .../internal/field_configuration_impl_test.go | 36 +-- .../field_configuration_item_impl_test.go | 16 +- .../field_configuration_scheme_test.go | 64 ++--- jira/internal/field_context_impl_test.go | 108 ++++----- .../field_context_option_impl_test.go | 50 ++-- jira/internal/field_impl_test.go | 28 +-- jira/internal/field_trash_impl_test.go | 24 +- jira/internal/group_impl_test.go | 50 ++-- jira/internal/issue_impl_adf_test.go | 72 +++--- jira/internal/issue_impl_rich_text_test.go | 72 +++--- jira/internal/issue_property_impl_test.go | 2 +- jira/internal/jql_impl_test.go | 6 +- jira/internal/label_impl_test.go | 6 +- jira/internal/link_impl_adf_test.go | 30 +-- jira/internal/link_impl_rich_text_test.go | 30 +-- jira/internal/link_type_impl_test.go | 36 +-- jira/internal/metadata_impl_test.go | 14 +- jira/internal/myself_impl_test.go | 6 +- .../internal/notification_scheme_impl_test.go | 60 ++--- jira/internal/permission_impl_test.go | 22 +- .../permission_scheme_grant_impl_test.go | 36 +-- jira/internal/permission_scheme_impl_test.go | 34 +-- jira/internal/priority_impl_test.go | 14 +- jira/internal/project_category_impl_test.go | 36 +-- jira/internal/project_component_impl_test.go | 46 ++-- jira/internal/project_feature_impl_test.go | 20 +- jira/internal/project_impl_test.go | 72 +++--- .../project_permission_scheme_impl_test.go | 24 +- jira/internal/project_property_impl_test.go | 2 +- jira/internal/project_role_actor_impl_test.go | 20 +- jira/internal/project_role_impl_test.go | 38 +-- jira/internal/project_type_impl_test.go | 28 +-- jira/internal/project_validator_impl_test.go | 24 +- jira/internal/project_version_impl_test.go | 64 ++--- jira/internal/resolution_impl_test.go | 14 +- jira/internal/screen_impl_test.go | 54 ++--- jira/internal/screen_scheme_impl_test.go | 28 +-- jira/internal/screen_tab_field_impl_test.go | 46 ++-- jira/internal/screen_tab_impl_test.go | 50 ++-- jira/internal/search_impl_adf_test.go | 18 +- jira/internal/search_impl_rich_text_test.go | 18 +- jira/internal/server_impl_test.go | 6 +- jira/internal/task_impl_test.go | 16 +- jira/internal/team_impl_test.go | 12 +- jira/internal/type_impl_test.go | 40 ++-- jira/internal/type_scheme_impl_test.go | 60 ++--- jira/internal/type_screen_scheme_impl_test.go | 84 +++---- jira/internal/user_impl_test.go | 44 ++-- jira/internal/user_search_impl_test.go | 22 +- jira/internal/vote_impl_test.go | 24 +- jira/internal/watcher_impl_test.go | 26 +- jira/internal/workflow_impl_test.go | 20 +- jira/internal/workflow_scheme_impl_test.go | 54 ++--- .../workflow_scheme_issue_type_impl_test.go | 38 +-- jira/internal/workflow_status_impl_test.go | 48 ++-- jira/internal/worklog_impl_adf_test.go | 66 +++--- jira/internal/worklog_impl_rich_text_test.go | 64 ++--- jira/sm/api_client_impl_test.go | 4 +- jira/v2/api_client_impl_test.go | 6 +- jira/v3/api_client_impl_test.go | 6 +- pkg/infra/models/admin_organization.go | 223 ++++++++++-------- pkg/infra/models/admin_organization_policy.go | 40 ++-- pkg/infra/models/admin_scim_group.go | 60 +++-- pkg/infra/models/admin_scim_scheme.go | 114 ++++----- pkg/infra/models/admin_scim_user.go | 185 ++++++++------- pkg/infra/models/admin_scim_user_test.go | 60 ++++- pkg/infra/models/jira_comment_v3.go | 60 +++-- pkg/infra/models/jira_customFields.go | 16 ++ 117 files changed, 2085 insertions(+), 1957 deletions(-) diff --git a/admin/api_client_impl_test.go b/admin/api_client_impl_test.go index 03757874..c3809fa6 100644 --- a/admin/api_client_impl_test.go +++ b/admin/api_client_impl_test.go @@ -290,7 +290,7 @@ func TestClient_NewRequest(t *testing.T) { Site: siteAsURL, }, args: args{ - ctx: context.TODO(), + ctx: context.Background(), method: http.MethodGet, urlStr: "rest/2/issue/attachment", type_: "", @@ -308,7 +308,7 @@ func TestClient_NewRequest(t *testing.T) { Site: siteAsURL, }, args: args{ - ctx: context.TODO(), + ctx: context.Background(), method: http.MethodGet, urlStr: " https://zhidao.baidu.com/special/view?id=49105a24626975510000&preview=1", body: bytes.NewReader([]byte("Hello World")), diff --git a/admin/internal/organization_directory_impl_test.go b/admin/internal/organization_directory_impl_test.go index 5ca0df64..588f3b20 100644 --- a/admin/internal/organization_directory_impl_test.go +++ b/admin/internal/organization_directory_impl_test.go @@ -33,7 +33,7 @@ func Test_internalOrganizationDirectoryServiceImpl_Activity(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", accountID: "account-id-sample", }, @@ -62,7 +62,7 @@ func Test_internalOrganizationDirectoryServiceImpl_Activity(t *testing.T) { { name: "when the organization id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "", }, wantErr: true, @@ -72,7 +72,7 @@ func Test_internalOrganizationDirectoryServiceImpl_Activity(t *testing.T) { { name: "when the account id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", }, wantErr: true, @@ -82,7 +82,7 @@ func Test_internalOrganizationDirectoryServiceImpl_Activity(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", accountID: "account-id-sample", }, @@ -159,7 +159,7 @@ func Test_internalOrganizationDirectoryServiceImpl_Remove(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", accountID: "account-id-sample", }, @@ -188,7 +188,7 @@ func Test_internalOrganizationDirectoryServiceImpl_Remove(t *testing.T) { { name: "when the organization id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "", }, wantErr: true, @@ -198,7 +198,7 @@ func Test_internalOrganizationDirectoryServiceImpl_Remove(t *testing.T) { { name: "when the account id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", }, wantErr: true, @@ -208,7 +208,7 @@ func Test_internalOrganizationDirectoryServiceImpl_Remove(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", accountID: "account-id-sample", }, @@ -284,7 +284,7 @@ func Test_internalOrganizationDirectoryServiceImpl_Suspend(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", accountID: "account-id-sample", }, @@ -313,7 +313,7 @@ func Test_internalOrganizationDirectoryServiceImpl_Suspend(t *testing.T) { { name: "when the organization id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "", }, wantErr: true, @@ -323,7 +323,7 @@ func Test_internalOrganizationDirectoryServiceImpl_Suspend(t *testing.T) { { name: "when the account id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", }, wantErr: true, @@ -333,7 +333,7 @@ func Test_internalOrganizationDirectoryServiceImpl_Suspend(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", accountID: "account-id-sample", }, @@ -410,7 +410,7 @@ func Test_internalOrganizationDirectoryServiceImpl_Restore(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", accountID: "account-id-sample", }, @@ -439,7 +439,7 @@ func Test_internalOrganizationDirectoryServiceImpl_Restore(t *testing.T) { { name: "when the organization id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "", }, wantErr: true, @@ -449,7 +449,7 @@ func Test_internalOrganizationDirectoryServiceImpl_Restore(t *testing.T) { { name: "when the account id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", }, wantErr: true, @@ -459,7 +459,7 @@ func Test_internalOrganizationDirectoryServiceImpl_Restore(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", accountID: "account-id-sample", }, diff --git a/admin/internal/organization_impl_test.go b/admin/internal/organization_impl_test.go index 0cce3cc8..1b7b5866 100644 --- a/admin/internal/organization_impl_test.go +++ b/admin/internal/organization_impl_test.go @@ -34,7 +34,7 @@ func Test_internalOrganizationImpl_Gets(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), cursor: "cursor-sample-uuid", }, on: func(fields *fields) { @@ -62,7 +62,7 @@ func Test_internalOrganizationImpl_Gets(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), cursor: "cursor-sample-uuid", }, on: func(fields *fields) { @@ -137,7 +137,7 @@ func Test_internalOrganizationImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-sample-uuid", }, on: func(fields *fields) { @@ -165,7 +165,7 @@ func Test_internalOrganizationImpl_Get(t *testing.T) { { name: "when the organization id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "", }, wantErr: true, @@ -175,7 +175,7 @@ func Test_internalOrganizationImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-sample-uuid", }, on: func(fields *fields) { @@ -250,7 +250,7 @@ func Test_internalOrganizationImpl_Users(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-sample-uuid", cursor: "cursor-sample-uuid", }, @@ -279,7 +279,7 @@ func Test_internalOrganizationImpl_Users(t *testing.T) { { name: "when the organization id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "", }, wantErr: true, @@ -289,7 +289,7 @@ func Test_internalOrganizationImpl_Users(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-sample-uuid", cursor: "cursor-sample-uuid", }, @@ -365,7 +365,7 @@ func Test_internalOrganizationImpl_Domains(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-sample-uuid", cursor: "cursor-sample-uuid", }, @@ -394,7 +394,7 @@ func Test_internalOrganizationImpl_Domains(t *testing.T) { { name: "when the organization id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "", }, wantErr: true, @@ -404,7 +404,7 @@ func Test_internalOrganizationImpl_Domains(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-sample-uuid", cursor: "cursor-sample-uuid", }, @@ -480,7 +480,7 @@ func Test_internalOrganizationImpl_Domain(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-sample-uuid", domainID: "domain-sample-uuid", }, @@ -509,7 +509,7 @@ func Test_internalOrganizationImpl_Domain(t *testing.T) { { name: "when the organization id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "", }, wantErr: true, @@ -519,7 +519,7 @@ func Test_internalOrganizationImpl_Domain(t *testing.T) { { name: "when the domain id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-sample-uuid", }, wantErr: true, @@ -529,7 +529,7 @@ func Test_internalOrganizationImpl_Domain(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-sample-uuid", domainID: "domain-sample-uuid", }, @@ -617,7 +617,7 @@ func Test_internalOrganizationImpl_Events(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-sample-uuid", options: &model.OrganizationEventOptScheme{ Q: "qq", @@ -652,7 +652,7 @@ func Test_internalOrganizationImpl_Events(t *testing.T) { { name: "when the organization id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "", }, wantErr: true, @@ -662,7 +662,7 @@ func Test_internalOrganizationImpl_Events(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-sample-uuid", options: &model.OrganizationEventOptScheme{ Q: "qq", @@ -745,7 +745,7 @@ func Test_internalOrganizationImpl_Event(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-sample-uuid", eventID: "event-sample-uuid", }, @@ -774,7 +774,7 @@ func Test_internalOrganizationImpl_Event(t *testing.T) { { name: "when the organization id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "", }, wantErr: true, @@ -784,7 +784,7 @@ func Test_internalOrganizationImpl_Event(t *testing.T) { { name: "when the event id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-sample-uuid", }, wantErr: true, @@ -794,7 +794,7 @@ func Test_internalOrganizationImpl_Event(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-sample-uuid", eventID: "event-sample-uuid", }, @@ -870,7 +870,7 @@ func Test_internalOrganizationImpl_Actions(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-sample-uuid", }, on: func(fields *fields) { @@ -898,7 +898,7 @@ func Test_internalOrganizationImpl_Actions(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-sample-uuid", }, on: func(fields *fields) { diff --git a/admin/internal/organization_policy_impl_test.go b/admin/internal/organization_policy_impl_test.go index c74b2eac..b0efae2a 100644 --- a/admin/internal/organization_policy_impl_test.go +++ b/admin/internal/organization_policy_impl_test.go @@ -33,7 +33,7 @@ func Test_internalOrganizationPolicyImpl_Gets(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", policyType: "policy-type-sample", cursor: "cursor-sample-uuid", @@ -63,7 +63,7 @@ func Test_internalOrganizationPolicyImpl_Gets(t *testing.T) { { name: "when the organization id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "", }, wantErr: true, @@ -73,7 +73,7 @@ func Test_internalOrganizationPolicyImpl_Gets(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", policyType: "policy-type-sample", cursor: "cursor-sample-uuid", @@ -151,7 +151,7 @@ func Test_internalOrganizationPolicyImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", policyID: "policy-id-sample", }, @@ -180,7 +180,7 @@ func Test_internalOrganizationPolicyImpl_Get(t *testing.T) { { name: "when the organization id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "", }, wantErr: true, @@ -190,7 +190,7 @@ func Test_internalOrganizationPolicyImpl_Get(t *testing.T) { { name: "when the organization id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", }, wantErr: true, @@ -200,7 +200,7 @@ func Test_internalOrganizationPolicyImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", policyID: "policy-id-sample", }, @@ -287,7 +287,7 @@ func Test_internalOrganizationPolicyImpl_Create(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", payload: payloadMocked, }, @@ -316,7 +316,7 @@ func Test_internalOrganizationPolicyImpl_Create(t *testing.T) { { name: "when the organization id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "", }, wantErr: true, @@ -326,7 +326,7 @@ func Test_internalOrganizationPolicyImpl_Create(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", payload: payloadMocked, }, @@ -412,7 +412,7 @@ func Test_internalOrganizationPolicyImpl_Update(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", policyID: "policy-id-sample", payload: payloadMocked, @@ -442,7 +442,7 @@ func Test_internalOrganizationPolicyImpl_Update(t *testing.T) { { name: "when the organization id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "", }, wantErr: true, @@ -452,7 +452,7 @@ func Test_internalOrganizationPolicyImpl_Update(t *testing.T) { { name: "when the policy id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", }, wantErr: true, @@ -462,7 +462,7 @@ func Test_internalOrganizationPolicyImpl_Update(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", policyID: "policy-id-sample", payload: payloadMocked, @@ -539,7 +539,7 @@ func Test_internalOrganizationPolicyImpl_Delete(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", policyID: "policy-id-sample", }, @@ -568,7 +568,7 @@ func Test_internalOrganizationPolicyImpl_Delete(t *testing.T) { { name: "when the organization id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "", }, wantErr: true, @@ -578,7 +578,7 @@ func Test_internalOrganizationPolicyImpl_Delete(t *testing.T) { { name: "when the policy id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", }, wantErr: true, @@ -588,7 +588,7 @@ func Test_internalOrganizationPolicyImpl_Delete(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), organizationID: "organization-id-sample", policyID: "policy-id-sample", }, diff --git a/admin/internal/scim_group_impl_test.go b/admin/internal/scim_group_impl_test.go index 5c3c0c9b..78be3d57 100644 --- a/admin/internal/scim_group_impl_test.go +++ b/admin/internal/scim_group_impl_test.go @@ -34,7 +34,7 @@ func Test_internalSCIMGroupImpl_Gets(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", filter: "filter-sample", startAt: 50, @@ -65,7 +65,7 @@ func Test_internalSCIMGroupImpl_Gets(t *testing.T) { { name: "when the directory id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "", }, wantErr: true, @@ -75,7 +75,7 @@ func Test_internalSCIMGroupImpl_Gets(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", filter: "filter-sample", startAt: 50, @@ -154,7 +154,7 @@ func Test_internalSCIMGroupImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", groupID: "group-id-sample", }, @@ -183,7 +183,7 @@ func Test_internalSCIMGroupImpl_Get(t *testing.T) { { name: "when the directory id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "", }, wantErr: true, @@ -193,7 +193,7 @@ func Test_internalSCIMGroupImpl_Get(t *testing.T) { { name: "when the group id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "directory-id-sample", }, wantErr: true, @@ -203,7 +203,7 @@ func Test_internalSCIMGroupImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", groupID: "group-id-sample", }, @@ -280,7 +280,7 @@ func Test_internalSCIMGroupImpl_Delete(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", groupID: "group-id-sample", }, @@ -309,7 +309,7 @@ func Test_internalSCIMGroupImpl_Delete(t *testing.T) { { name: "when the directory id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "", }, wantErr: true, @@ -319,7 +319,7 @@ func Test_internalSCIMGroupImpl_Delete(t *testing.T) { { name: "when the group id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "directory-id-sample", }, wantErr: true, @@ -329,7 +329,7 @@ func Test_internalSCIMGroupImpl_Delete(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", groupID: "group-id-sample", }, @@ -407,7 +407,7 @@ func Test_internalSCIMGroupImpl_Create(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", groupName: "group-name-sample", }, @@ -436,7 +436,7 @@ func Test_internalSCIMGroupImpl_Create(t *testing.T) { { name: "when the directory id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "", }, wantErr: true, @@ -446,7 +446,7 @@ func Test_internalSCIMGroupImpl_Create(t *testing.T) { { name: "when the group name is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "directory-id-sample", }, wantErr: true, @@ -456,7 +456,7 @@ func Test_internalSCIMGroupImpl_Create(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", groupName: "group-name-sample", }, @@ -535,7 +535,7 @@ func Test_internalSCIMGroupImpl_Update(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", groupID: "group-id-sample", newGroupName: "group-name-sample", @@ -565,7 +565,7 @@ func Test_internalSCIMGroupImpl_Update(t *testing.T) { { name: "when the directory id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "", }, wantErr: true, @@ -575,7 +575,7 @@ func Test_internalSCIMGroupImpl_Update(t *testing.T) { { name: "when the group id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "directory-id-sample", }, wantErr: true, @@ -585,7 +585,7 @@ func Test_internalSCIMGroupImpl_Update(t *testing.T) { { name: "when the group name is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "directory-id-sample", groupID: "group-id-sample", }, @@ -596,7 +596,7 @@ func Test_internalSCIMGroupImpl_Update(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", groupID: "group-id-sample", newGroupName: "group-name-sample", @@ -691,7 +691,7 @@ func Test_internalSCIMGroupImpl_Path(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", groupID: "group-id-sample", payload: payloadMocked, @@ -721,7 +721,7 @@ func Test_internalSCIMGroupImpl_Path(t *testing.T) { { name: "when the directory id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "", }, wantErr: true, @@ -731,7 +731,7 @@ func Test_internalSCIMGroupImpl_Path(t *testing.T) { { name: "when the group id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "directory-id-sample", }, wantErr: true, @@ -741,7 +741,7 @@ func Test_internalSCIMGroupImpl_Path(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", groupID: "group-id-sample", payload: payloadMocked, diff --git a/admin/internal/scim_schema_impl_test.go b/admin/internal/scim_schema_impl_test.go index 28cf0358..8c156fa4 100644 --- a/admin/internal/scim_schema_impl_test.go +++ b/admin/internal/scim_schema_impl_test.go @@ -33,7 +33,7 @@ func Test_internalSCIMSchemaImpl_Gets(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", }, on: func(fields *fields) { @@ -61,7 +61,7 @@ func Test_internalSCIMSchemaImpl_Gets(t *testing.T) { { name: "when the directory id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "", }, wantErr: true, @@ -71,7 +71,7 @@ func Test_internalSCIMSchemaImpl_Gets(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", }, on: func(fields *fields) { @@ -146,7 +146,7 @@ func Test_internalSCIMSchemaImpl_Group(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", }, on: func(fields *fields) { @@ -174,7 +174,7 @@ func Test_internalSCIMSchemaImpl_Group(t *testing.T) { { name: "when the directory id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "", }, wantErr: true, @@ -184,7 +184,7 @@ func Test_internalSCIMSchemaImpl_Group(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", }, on: func(fields *fields) { @@ -259,7 +259,7 @@ func Test_internalSCIMSchemaImpl_User(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", }, on: func(fields *fields) { @@ -287,7 +287,7 @@ func Test_internalSCIMSchemaImpl_User(t *testing.T) { { name: "when the directory id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "", }, wantErr: true, @@ -297,7 +297,7 @@ func Test_internalSCIMSchemaImpl_User(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", }, on: func(fields *fields) { @@ -372,7 +372,7 @@ func Test_internalSCIMSchemaImpl_Enterprise(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", }, on: func(fields *fields) { @@ -400,7 +400,7 @@ func Test_internalSCIMSchemaImpl_Enterprise(t *testing.T) { { name: "when the directory id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "", }, wantErr: true, @@ -410,7 +410,7 @@ func Test_internalSCIMSchemaImpl_Enterprise(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", }, on: func(fields *fields) { @@ -485,7 +485,7 @@ func Test_internalSCIMSchemaImpl_Feature(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", }, on: func(fields *fields) { @@ -513,7 +513,7 @@ func Test_internalSCIMSchemaImpl_Feature(t *testing.T) { { name: "when the directory id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "", }, wantErr: true, @@ -523,7 +523,7 @@ func Test_internalSCIMSchemaImpl_Feature(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", }, on: func(fields *fields) { diff --git a/admin/internal/scim_user_impl_test.go b/admin/internal/scim_user_impl_test.go index be5afa84..d551d62b 100644 --- a/admin/internal/scim_user_impl_test.go +++ b/admin/internal/scim_user_impl_test.go @@ -35,7 +35,7 @@ func Test_internalSCIMUserImpl_Gets(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", opts: &model.SCIMUserGetsOptionsScheme{ Attributes: []string{"attributes"}, @@ -70,7 +70,7 @@ func Test_internalSCIMUserImpl_Gets(t *testing.T) { { name: "when the directory id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "", }, wantErr: true, @@ -80,7 +80,7 @@ func Test_internalSCIMUserImpl_Gets(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", opts: &model.SCIMUserGetsOptionsScheme{ Attributes: []string{"attributes"}, @@ -164,7 +164,7 @@ func Test_internalSCIMUserImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", userID: "user-id-uuid-sample", attributes: []string{"groups"}, @@ -195,7 +195,7 @@ func Test_internalSCIMUserImpl_Get(t *testing.T) { { name: "when the directory id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "", }, wantErr: true, @@ -205,7 +205,7 @@ func Test_internalSCIMUserImpl_Get(t *testing.T) { { name: "when the user id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", }, wantErr: true, @@ -215,7 +215,7 @@ func Test_internalSCIMUserImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", userID: "user-id-uuid-sample", attributes: []string{"groups"}, @@ -294,7 +294,7 @@ func Test_internalSCIMUserImpl_Deactivate(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", userID: "user-id-uuid-sample", }, @@ -323,7 +323,7 @@ func Test_internalSCIMUserImpl_Deactivate(t *testing.T) { { name: "when the directory id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "", }, wantErr: true, @@ -333,7 +333,7 @@ func Test_internalSCIMUserImpl_Deactivate(t *testing.T) { { name: "when the user id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", }, wantErr: true, @@ -343,7 +343,7 @@ func Test_internalSCIMUserImpl_Deactivate(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", userID: "user-id-uuid-sample", }, @@ -424,7 +424,7 @@ func Test_internalSCIMUserImpl_Path(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", userID: "user-id-uuid-sample", payload: payloadMocked, @@ -456,7 +456,7 @@ func Test_internalSCIMUserImpl_Path(t *testing.T) { { name: "when the directory id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "", }, wantErr: true, @@ -466,7 +466,7 @@ func Test_internalSCIMUserImpl_Path(t *testing.T) { { name: "when the user id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", }, wantErr: true, @@ -476,7 +476,7 @@ func Test_internalSCIMUserImpl_Path(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", userID: "user-id-uuid-sample", payload: payloadMocked, @@ -574,7 +574,7 @@ func Test_internalSCIMUserImpl_Update(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", userID: "user-id-uuid-sample", payload: payloadMocked, @@ -606,7 +606,7 @@ func Test_internalSCIMUserImpl_Update(t *testing.T) { { name: "when the directory id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "", }, wantErr: true, @@ -616,7 +616,7 @@ func Test_internalSCIMUserImpl_Update(t *testing.T) { { name: "when the user id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", }, wantErr: true, @@ -626,7 +626,7 @@ func Test_internalSCIMUserImpl_Update(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", userID: "user-id-uuid-sample", payload: payloadMocked, @@ -724,7 +724,7 @@ func Test_internalSCIMUserImpl_Create(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", payload: payloadMocked, attributes: []string{"groups"}, @@ -755,7 +755,7 @@ func Test_internalSCIMUserImpl_Create(t *testing.T) { { name: "when the directory id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "", }, wantErr: true, @@ -765,7 +765,7 @@ func Test_internalSCIMUserImpl_Create(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), directoryID: "direction-id-sample", payload: payloadMocked, attributes: []string{"groups"}, diff --git a/admin/internal/user_impl_test.go b/admin/internal/user_impl_test.go index 42e7c8c9..4d4484f7 100644 --- a/admin/internal/user_impl_test.go +++ b/admin/internal/user_impl_test.go @@ -34,7 +34,7 @@ func Test_internalUserImpl_Permissions(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountID: "account-id-sample", privileges: []string{"privileges-sample"}, }, @@ -63,7 +63,7 @@ func Test_internalUserImpl_Permissions(t *testing.T) { { name: "when the account id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountID: "", }, wantErr: true, @@ -73,7 +73,7 @@ func Test_internalUserImpl_Permissions(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountID: "account-id-sample", privileges: []string{"privileges-sample"}, }, @@ -149,7 +149,7 @@ func Test_internalUserImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountID: "account-id-sample", }, on: func(fields *fields) { @@ -177,7 +177,7 @@ func Test_internalUserImpl_Get(t *testing.T) { { name: "when the account id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountID: "", }, wantErr: true, @@ -187,7 +187,7 @@ func Test_internalUserImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountID: "account-id-sample", }, on: func(fields *fields) { @@ -262,7 +262,7 @@ func Test_internalUserImpl_Enable(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountID: "account-id-sample", }, on: func(fields *fields) { @@ -290,7 +290,7 @@ func Test_internalUserImpl_Enable(t *testing.T) { { name: "when the account id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountID: "", }, wantErr: true, @@ -300,7 +300,7 @@ func Test_internalUserImpl_Enable(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountID: "account-id-sample", }, on: func(fields *fields) { @@ -376,7 +376,7 @@ func Test_internalUserImpl_Disable(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountID: "account-id-sample", message: "Your account has been disabled :(", }, @@ -405,7 +405,7 @@ func Test_internalUserImpl_Disable(t *testing.T) { { name: "when the account id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountID: "", }, wantErr: true, @@ -415,7 +415,7 @@ func Test_internalUserImpl_Disable(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountID: "account-id-sample", message: "Your account has been disabled :(", }, @@ -493,7 +493,7 @@ func Test_internalUserImpl_Update(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountID: "account-id-sample", payload: payloadMocked, }, @@ -522,7 +522,7 @@ func Test_internalUserImpl_Update(t *testing.T) { { name: "when the account id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountID: "", }, wantErr: true, @@ -532,7 +532,7 @@ func Test_internalUserImpl_Update(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountID: "account-id-sample", payload: payloadMocked, }, diff --git a/admin/internal/user_token_impl_test.go b/admin/internal/user_token_impl_test.go index 81b97d04..b28d8c31 100644 --- a/admin/internal/user_token_impl_test.go +++ b/admin/internal/user_token_impl_test.go @@ -34,7 +34,7 @@ func Test_internalUserTokenImpl_Gets(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountID: "account-id-sample", }, on: func(fields *fields) { @@ -61,7 +61,7 @@ func Test_internalUserTokenImpl_Gets(t *testing.T) { { name: "when the account id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountID: "", }, wantErr: true, @@ -71,7 +71,7 @@ func Test_internalUserTokenImpl_Gets(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountID: "account-id-sample", }, on: func(fields *fields) { @@ -146,7 +146,7 @@ func Test_internalUserTokenImpl_Delete(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountID: "account-id-sample", tokenID: "token-id-sample", }, @@ -174,7 +174,7 @@ func Test_internalUserTokenImpl_Delete(t *testing.T) { { name: "when the account id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountID: "", }, wantErr: true, @@ -184,7 +184,7 @@ func Test_internalUserTokenImpl_Delete(t *testing.T) { { name: "when the token id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountID: "account-id-sample", }, wantErr: true, @@ -194,7 +194,7 @@ func Test_internalUserTokenImpl_Delete(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountID: "account-id-sample", tokenID: "token-id-sample", }, diff --git a/assets/api_client_impl_test.go b/assets/api_client_impl_test.go index b832285e..a2799673 100644 --- a/assets/api_client_impl_test.go +++ b/assets/api_client_impl_test.go @@ -289,7 +289,7 @@ func TestClient_NewRequest(t *testing.T) { Site: siteAsURL, }, args: args{ - ctx: context.TODO(), + ctx: context.Background(), method: http.MethodGet, urlStr: "rest/2/issue/attachment", type_: "", @@ -307,7 +307,7 @@ func TestClient_NewRequest(t *testing.T) { Site: siteAsURL, }, args: args{ - ctx: context.TODO(), + ctx: context.Background(), method: http.MethodGet, urlStr: " https://zhidao.baidu.com/special/view?id=49105a24626975510000&preview=1", body: bytes.NewReader([]byte("Hello World")), diff --git a/assets/internal/aql_impl_test.go b/assets/internal/aql_impl_test.go index 5919a3d8..bfec3277 100644 --- a/assets/internal/aql_impl_test.go +++ b/assets/internal/aql_impl_test.go @@ -44,7 +44,7 @@ func Test_internalAQLImpl_Filter(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", payload: payloadMocked, }, @@ -72,7 +72,7 @@ func Test_internalAQLImpl_Filter(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", payload: payloadMocked, }, @@ -98,7 +98,7 @@ func Test_internalAQLImpl_Filter(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, diff --git a/assets/internal/icon_impl_test.go b/assets/internal/icon_impl_test.go index 4e2c7df6..dec817cf 100644 --- a/assets/internal/icon_impl_test.go +++ b/assets/internal/icon_impl_test.go @@ -34,7 +34,7 @@ func Test_internalIconImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", iconID: "1", }, @@ -62,7 +62,7 @@ func Test_internalIconImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", iconID: "1", }, @@ -88,7 +88,7 @@ func Test_internalIconImpl_Get(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -97,7 +97,7 @@ func Test_internalIconImpl_Get(t *testing.T) { { name: "when the icon id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", }, wantErr: true, @@ -156,7 +156,7 @@ func Test_internalIconImpl_Global(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", }, on: func(fields *fields) { @@ -183,7 +183,7 @@ func Test_internalIconImpl_Global(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", }, on: func(fields *fields) { @@ -208,7 +208,7 @@ func Test_internalIconImpl_Global(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, diff --git a/assets/internal/object_impl_test.go b/assets/internal/object_impl_test.go index d747bd08..7b0bbb3c 100644 --- a/assets/internal/object_impl_test.go +++ b/assets/internal/object_impl_test.go @@ -34,7 +34,7 @@ func Test_internalObjectImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectID: "1", }, @@ -62,7 +62,7 @@ func Test_internalObjectImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectID: "1", }, @@ -88,7 +88,7 @@ func Test_internalObjectImpl_Get(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -97,7 +97,7 @@ func Test_internalObjectImpl_Get(t *testing.T) { { name: "when the object id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", }, wantErr: true, @@ -156,7 +156,7 @@ func Test_internalObjectImpl_Delete(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectID: "1", }, @@ -184,7 +184,7 @@ func Test_internalObjectImpl_Delete(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectID: "1", }, @@ -210,7 +210,7 @@ func Test_internalObjectImpl_Delete(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -219,7 +219,7 @@ func Test_internalObjectImpl_Delete(t *testing.T) { { name: "when the object id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", }, wantErr: true, @@ -277,7 +277,7 @@ func Test_internalObjectImpl_Attributes(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectID: "1", }, @@ -305,7 +305,7 @@ func Test_internalObjectImpl_Attributes(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectID: "1", }, @@ -331,7 +331,7 @@ func Test_internalObjectImpl_Attributes(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -340,7 +340,7 @@ func Test_internalObjectImpl_Attributes(t *testing.T) { { name: "when the object id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", }, wantErr: true, @@ -400,7 +400,7 @@ func Test_internalObjectImpl_History(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectID: "1", ascOrder: true, @@ -429,7 +429,7 @@ func Test_internalObjectImpl_History(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectID: "1", ascOrder: true, @@ -456,7 +456,7 @@ func Test_internalObjectImpl_History(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -465,7 +465,7 @@ func Test_internalObjectImpl_History(t *testing.T) { { name: "when the object id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", }, wantErr: true, @@ -525,7 +525,7 @@ func Test_internalObjectImpl_References(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectID: "1", }, @@ -553,7 +553,7 @@ func Test_internalObjectImpl_References(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectID: "1", }, @@ -579,7 +579,7 @@ func Test_internalObjectImpl_References(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -588,7 +588,7 @@ func Test_internalObjectImpl_References(t *testing.T) { { name: "when the object id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", }, wantErr: true, @@ -647,7 +647,7 @@ func Test_internalObjectImpl_Relation(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectID: "1", }, @@ -675,7 +675,7 @@ func Test_internalObjectImpl_Relation(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectID: "1", }, @@ -701,7 +701,7 @@ func Test_internalObjectImpl_Relation(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -710,7 +710,7 @@ func Test_internalObjectImpl_Relation(t *testing.T) { { name: "when the object id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", }, wantErr: true, @@ -786,7 +786,7 @@ func Test_internalObjectImpl_Update(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectID: "object-uuid-sample", payload: payloadMocked, @@ -815,7 +815,7 @@ func Test_internalObjectImpl_Update(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectID: "object-uuid-sample", payload: payloadMocked, @@ -842,7 +842,7 @@ func Test_internalObjectImpl_Update(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -851,7 +851,7 @@ func Test_internalObjectImpl_Update(t *testing.T) { { name: "when the object id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", }, wantErr: true, @@ -935,7 +935,7 @@ func Test_internalObjectImpl_Create(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", payload: payloadMocked, }, @@ -963,7 +963,7 @@ func Test_internalObjectImpl_Create(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", payload: payloadMocked, }, @@ -989,7 +989,7 @@ func Test_internalObjectImpl_Create(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -1049,7 +1049,7 @@ func Test_internalObjectImpl_Filter(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", aql: "objectType = Office AND Name LIKE SYD", attributes: false, @@ -1080,7 +1080,7 @@ func Test_internalObjectImpl_Filter(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", aql: "objectType = Office AND Name LIKE SYD", attributes: false, @@ -1109,7 +1109,7 @@ func Test_internalObjectImpl_Filter(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -1118,7 +1118,7 @@ func Test_internalObjectImpl_Filter(t *testing.T) { { name: "when the aql query is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", }, wantErr: true, @@ -1191,7 +1191,7 @@ func Test_internalObjectImpl_Search(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", payload: payloadMocked, }, @@ -1219,7 +1219,7 @@ func Test_internalObjectImpl_Search(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", payload: payloadMocked, }, @@ -1245,7 +1245,7 @@ func Test_internalObjectImpl_Search(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, diff --git a/assets/internal/object_schema_impl_test.go b/assets/internal/object_schema_impl_test.go index d4339ed6..c953ee11 100644 --- a/assets/internal/object_schema_impl_test.go +++ b/assets/internal/object_schema_impl_test.go @@ -34,7 +34,7 @@ func Test_internalObjectSchemaImpl_List(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", }, on: func(fields *fields) { @@ -61,7 +61,7 @@ func Test_internalObjectSchemaImpl_List(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", }, on: func(fields *fields) { @@ -86,7 +86,7 @@ func Test_internalObjectSchemaImpl_List(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -144,7 +144,7 @@ func Test_internalObjectSchemaImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectSchemaID: "object-schema-id-sample", }, @@ -172,7 +172,7 @@ func Test_internalObjectSchemaImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectSchemaID: "object-schema-id-sample", }, @@ -198,7 +198,7 @@ func Test_internalObjectSchemaImpl_Get(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -207,7 +207,7 @@ func Test_internalObjectSchemaImpl_Get(t *testing.T) { { name: "when the object schema id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", }, wantErr: true, @@ -266,7 +266,7 @@ func Test_internalObjectSchemaImpl_Delete(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectSchemaID: "object-schema-id-sample", }, @@ -294,7 +294,7 @@ func Test_internalObjectSchemaImpl_Delete(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectSchemaID: "object-schema-id-sample", }, @@ -320,7 +320,7 @@ func Test_internalObjectSchemaImpl_Delete(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -329,7 +329,7 @@ func Test_internalObjectSchemaImpl_Delete(t *testing.T) { { name: "when the object schema id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", }, wantErr: true, @@ -395,7 +395,7 @@ func Test_internalObjectSchemaImpl_Attributes(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectSchemaID: "object-schema-id-sample", options: optionsMocked, @@ -424,7 +424,7 @@ func Test_internalObjectSchemaImpl_Attributes(t *testing.T) { { name: "when the options are not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectSchemaID: "object-schema-id-sample", }, @@ -452,7 +452,7 @@ func Test_internalObjectSchemaImpl_Attributes(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectSchemaID: "object-schema-id-sample", options: optionsMocked, @@ -479,7 +479,7 @@ func Test_internalObjectSchemaImpl_Attributes(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -488,7 +488,7 @@ func Test_internalObjectSchemaImpl_Attributes(t *testing.T) { { name: "when the object schema id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", }, wantErr: true, @@ -552,7 +552,7 @@ func Test_internalObjectSchemaImpl_ObjectTypes(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectSchemaID: "object-schema-id-sample", excludeAbstract: true, @@ -581,7 +581,7 @@ func Test_internalObjectSchemaImpl_ObjectTypes(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectSchemaID: "object-schema-id-sample", excludeAbstract: true, @@ -608,7 +608,7 @@ func Test_internalObjectSchemaImpl_ObjectTypes(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -617,7 +617,7 @@ func Test_internalObjectSchemaImpl_ObjectTypes(t *testing.T) { { name: "when the object schema id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", }, wantErr: true, @@ -687,7 +687,7 @@ func Test_internalObjectSchemaImpl_Update(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectSchemaID: "object-schema-id-sample", payload: payloadMocked, @@ -716,7 +716,7 @@ func Test_internalObjectSchemaImpl_Update(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectSchemaID: "object-schema-id-sample", payload: payloadMocked, @@ -743,7 +743,7 @@ func Test_internalObjectSchemaImpl_Update(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -752,7 +752,7 @@ func Test_internalObjectSchemaImpl_Update(t *testing.T) { { name: "when the object schema id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", }, wantErr: true, @@ -823,7 +823,7 @@ func Test_internalObjectSchemaImpl_Create(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", payload: payloadMocked, }, @@ -851,7 +851,7 @@ func Test_internalObjectSchemaImpl_Create(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", payload: payloadMocked, }, @@ -877,7 +877,7 @@ func Test_internalObjectSchemaImpl_Create(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, diff --git a/assets/internal/object_type_attribute_impl_test.go b/assets/internal/object_type_attribute_impl_test.go index 2e6caa10..1915b370 100644 --- a/assets/internal/object_type_attribute_impl_test.go +++ b/assets/internal/object_type_attribute_impl_test.go @@ -21,11 +21,11 @@ func Test_internalObjectTypeAttributeImpl_Create(t *testing.T) { minimumCardinality = 0 maximumCardinality = 0 payloadMocked := &model.ObjectTypeAttributePayloadScheme{ - Name: "Geolocation", - Label: false, - Type: &attributeType, - Description: "", - DefaultTypeId: &defaultTypeID, + Name: "Geolocation", + Label: false, + Type: &attributeType, + Description: "", + DefaultTypeId: &defaultTypeID, TypeValue: "", TypeValueMulti: nil, AdditionalValue: "", @@ -63,7 +63,7 @@ func Test_internalObjectTypeAttributeImpl_Create(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectTypeID: "object-type-uuid-sample", payload: payloadMocked, @@ -92,7 +92,7 @@ func Test_internalObjectTypeAttributeImpl_Create(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectTypeID: "object-type-uuid-sample", payload: payloadMocked, @@ -119,7 +119,7 @@ func Test_internalObjectTypeAttributeImpl_Create(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -128,7 +128,7 @@ func Test_internalObjectTypeAttributeImpl_Create(t *testing.T) { { name: "when the object type id id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", }, wantErr: true, @@ -181,11 +181,11 @@ func Test_internalObjectTypeAttributeImpl_Update(t *testing.T) { minimumCardinality = 0 maximumCardinality = 0 payloadMocked := &model.ObjectTypeAttributePayloadScheme{ - Name: "Geolocation", - Label: false, - Type: &attributeType, - Description: "", - DefaultTypeId: &defaultTypeID, + Name: "Geolocation", + Label: false, + Type: &attributeType, + Description: "", + DefaultTypeId: &defaultTypeID, TypeValue: "", TypeValueMulti: nil, AdditionalValue: "", @@ -223,7 +223,7 @@ func Test_internalObjectTypeAttributeImpl_Update(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectTypeID: "object-type-uuid-sample", attributeID: "attribute-id-sample", @@ -253,7 +253,7 @@ func Test_internalObjectTypeAttributeImpl_Update(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectTypeID: "object-type-uuid-sample", attributeID: "attribute-id-sample", @@ -281,7 +281,7 @@ func Test_internalObjectTypeAttributeImpl_Update(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -290,7 +290,7 @@ func Test_internalObjectTypeAttributeImpl_Update(t *testing.T) { { name: "when the object type id id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", }, wantErr: true, @@ -300,7 +300,7 @@ func Test_internalObjectTypeAttributeImpl_Update(t *testing.T) { { name: "when the attribute id id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectTypeID: "object-type-id-sample", }, @@ -366,7 +366,7 @@ func Test_internalObjectTypeAttributeImpl_Delete(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", attributeID: "attribute-id-sample", }, @@ -394,7 +394,7 @@ func Test_internalObjectTypeAttributeImpl_Delete(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", attributeID: "attribute-id-sample", }, @@ -420,7 +420,7 @@ func Test_internalObjectTypeAttributeImpl_Delete(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -429,7 +429,7 @@ func Test_internalObjectTypeAttributeImpl_Delete(t *testing.T) { { name: "when the attribute id id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", }, wantErr: true, diff --git a/assets/internal/object_type_impl_test.go b/assets/internal/object_type_impl_test.go index aa627237..913710d9 100644 --- a/assets/internal/object_type_impl_test.go +++ b/assets/internal/object_type_impl_test.go @@ -34,7 +34,7 @@ func Test_internalObjectTypeImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectTypeID: "object-type-id-sample", }, @@ -62,7 +62,7 @@ func Test_internalObjectTypeImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectTypeID: "object-type-id-sample", }, @@ -88,7 +88,7 @@ func Test_internalObjectTypeImpl_Get(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -97,7 +97,7 @@ func Test_internalObjectTypeImpl_Get(t *testing.T) { { name: "when the object type id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-id-sample", }, wantErr: true, @@ -156,7 +156,7 @@ func Test_internalObjectTypeImpl_Delete(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectTypeID: "object-type-id-sample", }, @@ -184,7 +184,7 @@ func Test_internalObjectTypeImpl_Delete(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectTypeID: "object-type-id-sample", }, @@ -210,7 +210,7 @@ func Test_internalObjectTypeImpl_Delete(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -219,7 +219,7 @@ func Test_internalObjectTypeImpl_Delete(t *testing.T) { { name: "when the object type id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -288,7 +288,7 @@ func Test_internalObjectTypeImpl_Attributes(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectTypeID: "object-type-id-sample", options: optionsMocked, @@ -317,7 +317,7 @@ func Test_internalObjectTypeImpl_Attributes(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectTypeID: "object-type-id-sample", options: optionsMocked, @@ -344,7 +344,7 @@ func Test_internalObjectTypeImpl_Attributes(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -353,7 +353,7 @@ func Test_internalObjectTypeImpl_Attributes(t *testing.T) { { name: "when the object type id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-id-sample", }, wantErr: true, @@ -424,7 +424,7 @@ func Test_internalObjectTypeImpl_Update(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectTypeID: "object-type-id-sample", payload: payloadMocked, @@ -453,7 +453,7 @@ func Test_internalObjectTypeImpl_Update(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectTypeID: "object-type-id-sample", payload: payloadMocked, @@ -480,7 +480,7 @@ func Test_internalObjectTypeImpl_Update(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -489,7 +489,7 @@ func Test_internalObjectTypeImpl_Update(t *testing.T) { { name: "when the object type id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", }, wantErr: true, @@ -564,7 +564,7 @@ func Test_internalObjectTypeImpl_Create(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", payload: payloadMocked, }, @@ -592,7 +592,7 @@ func Test_internalObjectTypeImpl_Create(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", payload: payloadMocked, }, @@ -618,7 +618,7 @@ func Test_internalObjectTypeImpl_Create(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -686,7 +686,7 @@ func Test_internalObjectTypeImpl_Position(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectTypeID: "object-type-id-sample", payload: payloadMocked, @@ -715,7 +715,7 @@ func Test_internalObjectTypeImpl_Position(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", objectTypeID: "object-type-id-sample", payload: payloadMocked, @@ -742,7 +742,7 @@ func Test_internalObjectTypeImpl_Position(t *testing.T) { { name: "when the workspace id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkspaceIDError, @@ -751,7 +751,7 @@ func Test_internalObjectTypeImpl_Position(t *testing.T) { { name: "when the object type id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspaceID: "workspace-uuid-sample", }, wantErr: true, diff --git a/bitbucket/api_client_impl_test.go b/bitbucket/api_client_impl_test.go index 4dcf696f..f7ff97d7 100644 --- a/bitbucket/api_client_impl_test.go +++ b/bitbucket/api_client_impl_test.go @@ -291,7 +291,7 @@ func TestClient_NewRequest(t *testing.T) { Site: siteAsURL, }, args: args{ - ctx: context.TODO(), + ctx: context.Background(), method: http.MethodGet, urlStr: "rest/2/issue/attachment", type_: "", @@ -309,7 +309,7 @@ func TestClient_NewRequest(t *testing.T) { Site: siteAsURL, }, args: args{ - ctx: context.TODO(), + ctx: context.Background(), method: http.MethodGet, urlStr: " https://zhidao.baidu.com/special/view?id=49105a24626975510000&preview=1", body: bytes.NewReader([]byte("Hello World")), @@ -326,7 +326,7 @@ func TestClient_NewRequest(t *testing.T) { Site: siteAsURL, }, args: args{ - ctx: context.TODO(), + ctx: context.Background(), method: http.MethodGet, urlStr: "rest/2/issue/attachment", type_: "type_sample", diff --git a/bitbucket/internal/workspace_impl_test.go b/bitbucket/internal/workspace_impl_test.go index 5125cb2c..3167b831 100644 --- a/bitbucket/internal/workspace_impl_test.go +++ b/bitbucket/internal/workspace_impl_test.go @@ -33,7 +33,7 @@ func Test_internalWorkspaceServiceImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", }, on: func(fields *fields) { @@ -59,7 +59,7 @@ func Test_internalWorkspaceServiceImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", }, on: func(fields *fields) { @@ -83,7 +83,7 @@ func Test_internalWorkspaceServiceImpl_Get(t *testing.T) { { name: "when the workspace is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "", }, wantErr: true, @@ -142,7 +142,7 @@ func Test_internalWorkspaceServiceImpl_Members(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", }, on: func(fields *fields) { @@ -168,7 +168,7 @@ func Test_internalWorkspaceServiceImpl_Members(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", }, on: func(fields *fields) { @@ -192,7 +192,7 @@ func Test_internalWorkspaceServiceImpl_Members(t *testing.T) { { name: "when the workspace is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "", }, wantErr: true, @@ -251,7 +251,7 @@ func Test_internalWorkspaceServiceImpl_Projects(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", }, on: func(fields *fields) { @@ -277,7 +277,7 @@ func Test_internalWorkspaceServiceImpl_Projects(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", }, on: func(fields *fields) { @@ -301,7 +301,7 @@ func Test_internalWorkspaceServiceImpl_Projects(t *testing.T) { { name: "when the workspace is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "", }, wantErr: true, @@ -361,7 +361,7 @@ func Test_internalWorkspaceServiceImpl_Membership(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", memberId: "account-id-sample", }, @@ -388,7 +388,7 @@ func Test_internalWorkspaceServiceImpl_Membership(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", memberId: "account-id-sample", }, @@ -413,7 +413,7 @@ func Test_internalWorkspaceServiceImpl_Membership(t *testing.T) { { name: "when the workspace is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "", }, wantErr: true, @@ -423,7 +423,7 @@ func Test_internalWorkspaceServiceImpl_Membership(t *testing.T) { { name: "when the member id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", }, wantErr: true, diff --git a/bitbucket/internal/workspace_permissions_impl_test.go b/bitbucket/internal/workspace_permissions_impl_test.go index bb794ad1..3eed0dd3 100644 --- a/bitbucket/internal/workspace_permissions_impl_test.go +++ b/bitbucket/internal/workspace_permissions_impl_test.go @@ -34,7 +34,7 @@ func Test_internalWorkspacePermissionServiceImpl_Members(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", query: "permission=\"owner\"", }, @@ -61,7 +61,7 @@ func Test_internalWorkspacePermissionServiceImpl_Members(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", query: "permission=\"owner\"", }, @@ -86,7 +86,7 @@ func Test_internalWorkspacePermissionServiceImpl_Members(t *testing.T) { { name: "when the workspace is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "", }, wantErr: true, @@ -147,7 +147,7 @@ func Test_internalWorkspacePermissionServiceImpl_Repositories(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", query: "permission=\"owner\"", sort: "user.display_name", @@ -175,7 +175,7 @@ func Test_internalWorkspacePermissionServiceImpl_Repositories(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", query: "permission=\"owner\"", sort: "user.display_name", @@ -201,7 +201,7 @@ func Test_internalWorkspacePermissionServiceImpl_Repositories(t *testing.T) { { name: "when the workspace is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "", }, wantErr: true, @@ -264,7 +264,7 @@ func Test_internalWorkspacePermissionServiceImpl_Repository(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", query: "permission=\"owner\"", sort: "user.display_name", @@ -293,7 +293,7 @@ func Test_internalWorkspacePermissionServiceImpl_Repository(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", query: "permission=\"owner\"", sort: "user.display_name", @@ -320,7 +320,7 @@ func Test_internalWorkspacePermissionServiceImpl_Repository(t *testing.T) { { name: "when the workspace is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "", }, wantErr: true, @@ -330,7 +330,7 @@ func Test_internalWorkspacePermissionServiceImpl_Repository(t *testing.T) { { name: "when the repository is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", }, wantErr: true, diff --git a/bitbucket/internal/workspace_webhooks_impl_test.go b/bitbucket/internal/workspace_webhooks_impl_test.go index 8e2f1630..9776003d 100644 --- a/bitbucket/internal/workspace_webhooks_impl_test.go +++ b/bitbucket/internal/workspace_webhooks_impl_test.go @@ -33,7 +33,7 @@ func Test_internalWorkspaceWebhookServiceImpl_Gets(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", }, on: func(fields *fields) { @@ -59,7 +59,7 @@ func Test_internalWorkspaceWebhookServiceImpl_Gets(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", }, on: func(fields *fields) { @@ -83,7 +83,7 @@ func Test_internalWorkspaceWebhookServiceImpl_Gets(t *testing.T) { { name: "when the workspace is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "", }, wantErr: true, @@ -143,7 +143,7 @@ func Test_internalWorkspaceWebhookServiceImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", webhookId: "uuid-sample", }, @@ -170,7 +170,7 @@ func Test_internalWorkspaceWebhookServiceImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", webhookId: "uuid-sample", }, @@ -195,7 +195,7 @@ func Test_internalWorkspaceWebhookServiceImpl_Get(t *testing.T) { { name: "when the workspace is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "", }, wantErr: true, @@ -205,7 +205,7 @@ func Test_internalWorkspaceWebhookServiceImpl_Get(t *testing.T) { { name: "when the webhook is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", }, wantErr: true, @@ -272,7 +272,7 @@ func Test_internalWorkspaceWebhookServiceImpl_Create(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", payload: payloadMocked, }, @@ -299,7 +299,7 @@ func Test_internalWorkspaceWebhookServiceImpl_Create(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", payload: payloadMocked, }, @@ -324,7 +324,7 @@ func Test_internalWorkspaceWebhookServiceImpl_Create(t *testing.T) { { name: "when the workspace is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "", }, wantErr: true, @@ -392,7 +392,7 @@ func Test_internalWorkspaceWebhookServiceImpl_Update(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", webhookId: "webhook-uuid", payload: payloadMocked, @@ -420,7 +420,7 @@ func Test_internalWorkspaceWebhookServiceImpl_Update(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", webhookId: "webhook-uuid", payload: payloadMocked, @@ -446,7 +446,7 @@ func Test_internalWorkspaceWebhookServiceImpl_Update(t *testing.T) { { name: "when the workspace is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "", }, wantErr: true, @@ -456,7 +456,7 @@ func Test_internalWorkspaceWebhookServiceImpl_Update(t *testing.T) { { name: "when the webhook is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", }, wantErr: true, @@ -517,7 +517,7 @@ func Test_internalWorkspaceWebhookServiceImpl_Delete(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", webhookId: "uuid-sample", }, @@ -544,7 +544,7 @@ func Test_internalWorkspaceWebhookServiceImpl_Delete(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", webhookId: "uuid-sample", }, @@ -569,7 +569,7 @@ func Test_internalWorkspaceWebhookServiceImpl_Delete(t *testing.T) { { name: "when the workspace is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "", }, wantErr: true, @@ -579,7 +579,7 @@ func Test_internalWorkspaceWebhookServiceImpl_Delete(t *testing.T) { { name: "when the webhook is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), workspace: "work-space-name-sample", }, wantErr: true, diff --git a/confluence/api_client_impl_test.go b/confluence/api_client_impl_test.go index 3739fdf3..ee1350cd 100644 --- a/confluence/api_client_impl_test.go +++ b/confluence/api_client_impl_test.go @@ -291,7 +291,7 @@ func TestClient_NewRequest(t *testing.T) { Site: siteAsURL, }, args: args{ - ctx: context.TODO(), + ctx: context.Background(), method: http.MethodGet, urlStr: "rest/2/issue/attachment", type_: "", @@ -309,7 +309,7 @@ func TestClient_NewRequest(t *testing.T) { Site: siteAsURL, }, args: args{ - ctx: context.TODO(), + ctx: context.Background(), method: http.MethodGet, urlStr: " https://zhidao.baidu.com/special/view?id=49105a24626975510000&preview=1", body: bytes.NewReader([]byte("Hello World")), @@ -326,7 +326,7 @@ func TestClient_NewRequest(t *testing.T) { Site: siteAsURL, }, args: args{ - ctx: context.TODO(), + ctx: context.Background(), method: http.MethodGet, urlStr: "rest/2/issue/attachment", type_: "type_sample", diff --git a/confluence/internal/analytics_impl_test.go b/confluence/internal/analytics_impl_test.go index bf6a3021..43c22e20 100644 --- a/confluence/internal/analytics_impl_test.go +++ b/confluence/internal/analytics_impl_test.go @@ -33,7 +33,7 @@ func Test_internalAnalyticsServiceImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentId: "2337372172371", fromDate: "2023-10-03", }, @@ -60,7 +60,7 @@ func Test_internalAnalyticsServiceImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentId: "2337372172371", fromDate: "2023-10-03", }, @@ -85,7 +85,7 @@ func Test_internalAnalyticsServiceImpl_Get(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -143,7 +143,7 @@ func Test_internalAnalyticsServiceImpl_Distinct(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentId: "2337372172371", fromDate: "2023-10-03", }, @@ -170,7 +170,7 @@ func Test_internalAnalyticsServiceImpl_Distinct(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentId: "2337372172371", fromDate: "2023-10-03", }, @@ -195,7 +195,7 @@ func Test_internalAnalyticsServiceImpl_Distinct(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, diff --git a/confluence/internal/attachment_content_impl_test.go b/confluence/internal/attachment_content_impl_test.go index 76eaad3e..04653218 100644 --- a/confluence/internal/attachment_content_impl_test.go +++ b/confluence/internal/attachment_content_impl_test.go @@ -39,7 +39,7 @@ func Test_internalContentAttachmentImpl_Gets(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100100101", startAt: 50, maxResults: 50, @@ -73,7 +73,7 @@ func Test_internalContentAttachmentImpl_Gets(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100100101", startAt: 50, maxResults: 50, @@ -104,7 +104,7 @@ func Test_internalContentAttachmentImpl_Gets(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -175,7 +175,7 @@ func Test_internalContentAttachmentImpl_CreateOrUpdate(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), attachmentID: "3837272", status: "current", fileName: "LICENSE", @@ -206,7 +206,7 @@ func Test_internalContentAttachmentImpl_CreateOrUpdate(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), attachmentID: "3837272", status: "current", fileName: "LICENSE", @@ -234,7 +234,7 @@ func Test_internalContentAttachmentImpl_CreateOrUpdate(t *testing.T) { { name: "when the attachment id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentAttachmentIDError, @@ -243,7 +243,7 @@ func Test_internalContentAttachmentImpl_CreateOrUpdate(t *testing.T) { { name: "when the file name is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), attachmentID: "3837272", }, wantErr: true, @@ -253,7 +253,7 @@ func Test_internalContentAttachmentImpl_CreateOrUpdate(t *testing.T) { { name: "when the file reader is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), attachmentID: "3837272", fileName: "LICENSE", }, @@ -326,7 +326,7 @@ func Test_internalContentAttachmentImpl_Create(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), attachmentID: "3837272", status: "current", fileName: "LICENSE", @@ -357,7 +357,7 @@ func Test_internalContentAttachmentImpl_Create(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), attachmentID: "3837272", status: "current", fileName: "LICENSE", @@ -385,7 +385,7 @@ func Test_internalContentAttachmentImpl_Create(t *testing.T) { { name: "when the attachment id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentAttachmentIDError, @@ -394,7 +394,7 @@ func Test_internalContentAttachmentImpl_Create(t *testing.T) { { name: "when the file name is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), attachmentID: "3837272", }, wantErr: true, @@ -404,7 +404,7 @@ func Test_internalContentAttachmentImpl_Create(t *testing.T) { { name: "when the file reader is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), attachmentID: "3837272", fileName: "LICENSE", }, diff --git a/confluence/internal/attachment_impl_test.go b/confluence/internal/attachment_impl_test.go index 42288262..7a344454 100644 --- a/confluence/internal/attachment_impl_test.go +++ b/confluence/internal/attachment_impl_test.go @@ -35,7 +35,7 @@ func Test_internalAttachmentImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), attachmentID: "100001", versionID: 25, serializeIDs: true, @@ -64,7 +64,7 @@ func Test_internalAttachmentImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), attachmentID: "100001", versionID: 25, serializeIDs: true, @@ -90,7 +90,7 @@ func Test_internalAttachmentImpl_Get(t *testing.T) { { name: "when the attachment id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentAttachmentIDError, @@ -154,7 +154,7 @@ func Test_internalAttachmentImpl_Gets(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), entityID: 10001, entityType: "labels", options: &model.AttachmentParamsScheme{ @@ -190,7 +190,7 @@ func Test_internalAttachmentImpl_Gets(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), entityID: 10001, entityType: "labels", options: &model.AttachmentParamsScheme{ @@ -223,7 +223,7 @@ func Test_internalAttachmentImpl_Gets(t *testing.T) { { name: "when the entity id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoEntityIDError, @@ -232,7 +232,7 @@ func Test_internalAttachmentImpl_Gets(t *testing.T) { { name: "when the entity type provided is not valid", args: args{ - ctx: context.TODO(), + ctx: context.Background(), entityID: 1002, entityType: "questions", }, @@ -294,7 +294,7 @@ func Test_internalAttachmentImpl_Delete(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), attachmentID: "att10001", }, on: func(fields *fields) { @@ -321,7 +321,7 @@ func Test_internalAttachmentImpl_Delete(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), attachmentID: "att10001", }, on: func(fields *fields) { @@ -345,7 +345,7 @@ func Test_internalAttachmentImpl_Delete(t *testing.T) { { name: "when the attachment id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentAttachmentIDError, diff --git a/confluence/internal/attachment_version_impl_test.go b/confluence/internal/attachment_version_impl_test.go index c3cbcacf..fabddfd1 100644 --- a/confluence/internal/attachment_version_impl_test.go +++ b/confluence/internal/attachment_version_impl_test.go @@ -34,7 +34,7 @@ func Test_internalAttachmentVersionImpl_Gets(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), attachmentID: "100001", sort: "-modified-date", cursor: "uuid-sample", @@ -64,7 +64,7 @@ func Test_internalAttachmentVersionImpl_Gets(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), attachmentID: "100001", sort: "-modified-date", cursor: "uuid-sample", @@ -91,7 +91,7 @@ func Test_internalAttachmentVersionImpl_Gets(t *testing.T) { { name: "when the attachment id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentAttachmentIDError, @@ -152,7 +152,7 @@ func Test_internalAttachmentVersionImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), attachmentID: "100001", versionID: 10002, }, @@ -180,7 +180,7 @@ func Test_internalAttachmentVersionImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), attachmentID: "100001", versionID: 10002, }, @@ -205,7 +205,7 @@ func Test_internalAttachmentVersionImpl_Get(t *testing.T) { { name: "when the attachment id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentAttachmentIDError, diff --git a/confluence/internal/children_descendants_content_impl_test.go b/confluence/internal/children_descendants_content_impl_test.go index 84a90ddc..0ffee077 100644 --- a/confluence/internal/children_descendants_content_impl_test.go +++ b/confluence/internal/children_descendants_content_impl_test.go @@ -35,7 +35,7 @@ func Test_internalChildrenDescandantsImpl_Children(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100100101", expand: []string{"attachment", "comments"}, parentVersion: 12, @@ -64,7 +64,7 @@ func Test_internalChildrenDescandantsImpl_Children(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100100101", expand: []string{"attachment", "comments"}, parentVersion: 12, @@ -90,7 +90,7 @@ func Test_internalChildrenDescandantsImpl_Children(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -150,7 +150,7 @@ func Test_internalChildrenDescandantsImpl_Move(t *testing.T) { { name: "append when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), pageID: "101010101", position: "append", targetID: "202020202", @@ -178,7 +178,7 @@ func Test_internalChildrenDescandantsImpl_Move(t *testing.T) { { name: "position before when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), pageID: "101010101", position: "before", targetID: "202020202", @@ -206,7 +206,7 @@ func Test_internalChildrenDescandantsImpl_Move(t *testing.T) { { name: "position after when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), pageID: "101010101", position: "after", targetID: "202020202", @@ -234,7 +234,7 @@ func Test_internalChildrenDescandantsImpl_Move(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), pageID: "100100101", position: "append", targetID: "200200202", @@ -259,7 +259,7 @@ func Test_internalChildrenDescandantsImpl_Move(t *testing.T) { { name: "when the page id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), position: "append", targetID: "100100101", }, @@ -270,7 +270,7 @@ func Test_internalChildrenDescandantsImpl_Move(t *testing.T) { { name: "when the target id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), pageID: "100100101", position: "append", }, @@ -281,7 +281,7 @@ func Test_internalChildrenDescandantsImpl_Move(t *testing.T) { { name: "when the position is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), pageID: "100100101", targetID: "200200202", }, @@ -292,7 +292,7 @@ func Test_internalChildrenDescandantsImpl_Move(t *testing.T) { { name: "when the position is incorrect", args: args{ - ctx: context.TODO(), + ctx: context.Background(), pageID: "100100101", position: "gopher", targetID: "200200202", @@ -357,7 +357,7 @@ func Test_internalChildrenDescandantsImpl_ChildrenByType(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100100101", contentType: "blogpost", expand: []string{"attachment", "comments"}, @@ -389,7 +389,7 @@ func Test_internalChildrenDescandantsImpl_ChildrenByType(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100100101", contentType: "blogpost", expand: []string{"attachment", "comments"}, @@ -418,7 +418,7 @@ func Test_internalChildrenDescandantsImpl_ChildrenByType(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -427,7 +427,7 @@ func Test_internalChildrenDescandantsImpl_ChildrenByType(t *testing.T) { { name: "when the content type is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "11929292", }, wantErr: true, @@ -490,7 +490,7 @@ func Test_internalChildrenDescandantsImpl_Descendants(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100100101", expand: []string{"attachment", "comments"}, }, @@ -518,7 +518,7 @@ func Test_internalChildrenDescandantsImpl_Descendants(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100100101", expand: []string{"attachment", "comments"}, }, @@ -543,7 +543,7 @@ func Test_internalChildrenDescandantsImpl_Descendants(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -603,7 +603,7 @@ func Test_internalChildrenDescandantsImpl_DescendantsByType(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100100101", contentType: "blogpost", expand: []string{"attachment", "comments"}, @@ -635,7 +635,7 @@ func Test_internalChildrenDescandantsImpl_DescendantsByType(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100100101", contentType: "blogpost", expand: []string{"attachment", "comments"}, @@ -664,7 +664,7 @@ func Test_internalChildrenDescandantsImpl_DescendantsByType(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -673,7 +673,7 @@ func Test_internalChildrenDescandantsImpl_DescendantsByType(t *testing.T) { { name: "when the content type is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "11929292", }, wantErr: true, @@ -750,7 +750,7 @@ func Test_internalChildrenDescandantsImpl_CopyHierarchy(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100100101", options: payloadMocked, }, @@ -778,7 +778,7 @@ func Test_internalChildrenDescandantsImpl_CopyHierarchy(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100100101", options: payloadMocked, }, @@ -803,7 +803,7 @@ func Test_internalChildrenDescandantsImpl_CopyHierarchy(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -879,7 +879,7 @@ func Test_internalChildrenDescandantsImpl_CopyPage(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100100101", options: payloadMocked, expand: []string{"childTypes.all"}, @@ -908,7 +908,7 @@ func Test_internalChildrenDescandantsImpl_CopyPage(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100100101", options: payloadMocked, expand: []string{"childTypes.all"}, @@ -934,7 +934,7 @@ func Test_internalChildrenDescandantsImpl_CopyPage(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, diff --git a/confluence/internal/comment_content_impl_test.go b/confluence/internal/comment_content_impl_test.go index 9d132de8..f53a3a74 100644 --- a/confluence/internal/comment_content_impl_test.go +++ b/confluence/internal/comment_content_impl_test.go @@ -35,7 +35,7 @@ func Test_internalCommentImpl_Gets(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100100101", expand: []string{"attachment", "comments"}, location: []string{"form"}, @@ -66,7 +66,7 @@ func Test_internalCommentImpl_Gets(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100100101", expand: []string{"attachment", "comments"}, location: []string{"form"}, @@ -94,7 +94,7 @@ func Test_internalCommentImpl_Gets(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, diff --git a/confluence/internal/content_impl_test.go b/confluence/internal/content_impl_test.go index 4c441d35..bd099200 100644 --- a/confluence/internal/content_impl_test.go +++ b/confluence/internal/content_impl_test.go @@ -35,7 +35,7 @@ func Test_internalContentImpl_Gets(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.GetContentOptionsScheme{ ContextType: "page", SpaceKey: "DUMMY", @@ -73,7 +73,7 @@ func Test_internalContentImpl_Gets(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.GetContentOptionsScheme{ ContextType: "page", SpaceKey: "DUMMY", @@ -162,7 +162,7 @@ func Test_internalContentImpl_Search(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), cql: "space = DUMMY", cqlContext: "spaceKey", expand: []string{"restrictions.update.restrictions.user"}, @@ -192,7 +192,7 @@ func Test_internalContentImpl_Search(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), cql: "space = DUMMY", cqlContext: "spaceKey", expand: []string{"restrictions.update.restrictions.user"}, @@ -219,7 +219,7 @@ func Test_internalContentImpl_Search(t *testing.T) { { name: "when the cql is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoCQLError, @@ -281,7 +281,7 @@ func Test_internalContentImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "11727271", expand: []string{"restrictions.update.restrictions.user"}, version: 23, @@ -309,7 +309,7 @@ func Test_internalContentImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "11727271", expand: []string{"restrictions.update.restrictions.user"}, version: 23, @@ -334,7 +334,7 @@ func Test_internalContentImpl_Get(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -395,7 +395,7 @@ func Test_internalContentImpl_History(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "11727271", expand: []string{"restrictions.update.restrictions.user"}, }, @@ -422,7 +422,7 @@ func Test_internalContentImpl_History(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "11727271", expand: []string{"restrictions.update.restrictions.user"}, }, @@ -446,7 +446,7 @@ func Test_internalContentImpl_History(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -506,7 +506,7 @@ func Test_internalContentImpl_Delete(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "11727271", status: "trashed", }, @@ -533,7 +533,7 @@ func Test_internalContentImpl_Delete(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "11727271", status: "trashed", }, @@ -557,7 +557,7 @@ func Test_internalContentImpl_Delete(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -627,7 +627,7 @@ func Test_internalContentImpl_Create(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -653,7 +653,7 @@ func Test_internalContentImpl_Create(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -739,7 +739,7 @@ func Test_internalContentImpl_Update(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", payload: payloadMocked, }, @@ -766,7 +766,7 @@ func Test_internalContentImpl_Update(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", payload: payloadMocked, }, @@ -790,7 +790,7 @@ func Test_internalContentImpl_Update(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -857,7 +857,7 @@ func Test_internalContentImpl_Archive(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -883,7 +883,7 @@ func Test_internalContentImpl_Archive(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { diff --git a/confluence/internal/custom_content_impl_test.go b/confluence/internal/custom_content_impl_test.go index 2211a534..36272efa 100644 --- a/confluence/internal/custom_content_impl_test.go +++ b/confluence/internal/custom_content_impl_test.go @@ -36,7 +36,7 @@ func Test_internalCustomContentServiceImpl_Gets(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), type_: "custom_content_type_id", options: &model.CustomContentOptionsScheme{ IDs: []int{101, 102}, @@ -71,7 +71,7 @@ func Test_internalCustomContentServiceImpl_Gets(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), type_: "custom_content_type_id", options: &model.CustomContentOptionsScheme{ IDs: []int{101, 102}, @@ -102,7 +102,7 @@ func Test_internalCustomContentServiceImpl_Gets(t *testing.T) { { name: "when the type is not provided are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoCustomContentTypeError, @@ -179,7 +179,7 @@ func Test_internalCustomContentServiceImpl_Create(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -206,7 +206,7 @@ func Test_internalCustomContentServiceImpl_Create(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -299,7 +299,7 @@ func Test_internalCustomContentServiceImpl_Update(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), customContentID: 10001, payload: payloadMocked, }, @@ -327,7 +327,7 @@ func Test_internalCustomContentServiceImpl_Update(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), customContentID: 10001, payload: payloadMocked, }, @@ -351,7 +351,7 @@ func Test_internalCustomContentServiceImpl_Update(t *testing.T) { { name: "when the custom content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoCustomContentIDError, @@ -414,7 +414,7 @@ func Test_internalCustomContentServiceImpl_Delete(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), customContentID: 10001, }, on: func(fields *fields) { @@ -441,7 +441,7 @@ func Test_internalCustomContentServiceImpl_Delete(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), customContentID: 10001, }, on: func(fields *fields) { @@ -464,7 +464,7 @@ func Test_internalCustomContentServiceImpl_Delete(t *testing.T) { { name: "when the custom content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoCustomContentIDError, @@ -526,7 +526,7 @@ func Test_internalCustomContentServiceImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), customContentID: 10001, format: "anonymous_export_view", versionID: 2, @@ -555,7 +555,7 @@ func Test_internalCustomContentServiceImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), customContentID: 10001, format: "anonymous_export_view", versionID: 2, @@ -580,7 +580,7 @@ func Test_internalCustomContentServiceImpl_Get(t *testing.T) { { name: "when the custom content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoCustomContentIDError, diff --git a/confluence/internal/label_content_impl_test.go b/confluence/internal/label_content_impl_test.go index bab7d101..c1c9c9d6 100644 --- a/confluence/internal/label_content_impl_test.go +++ b/confluence/internal/label_content_impl_test.go @@ -35,7 +35,7 @@ func Test_internalContentLabelImpl_Gets(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "11727271", prefix: "new-", startAt: 25, @@ -64,7 +64,7 @@ func Test_internalContentLabelImpl_Gets(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "11727271", prefix: "new-", startAt: 25, @@ -90,7 +90,7 @@ func Test_internalContentLabelImpl_Gets(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -150,7 +150,7 @@ func Test_internalContentLabelImpl_Remove(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "11727271", labelName: "test", }, @@ -177,7 +177,7 @@ func Test_internalContentLabelImpl_Remove(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "11727271", labelName: "test", }, @@ -201,7 +201,7 @@ func Test_internalContentLabelImpl_Remove(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -210,7 +210,7 @@ func Test_internalContentLabelImpl_Remove(t *testing.T) { { name: "when the label name is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "1111", }, wantErr: true, @@ -278,7 +278,7 @@ func Test_internalContentLabelImpl_Add(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "11727271", payload: payloadMocked, want400Response: true, @@ -306,7 +306,7 @@ func Test_internalContentLabelImpl_Add(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "11727271", payload: payloadMocked, want400Response: true, @@ -331,7 +331,7 @@ func Test_internalContentLabelImpl_Add(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, diff --git a/confluence/internal/label_impl_test.go b/confluence/internal/label_impl_test.go index c942a729..f0b08617 100644 --- a/confluence/internal/label_impl_test.go +++ b/confluence/internal/label_impl_test.go @@ -34,7 +34,7 @@ func Test_internalLabelImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), labelName: "blogs", labelType: "blogpost", start: 200, @@ -64,7 +64,7 @@ func Test_internalLabelImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), labelName: "blogs", labelType: "blogpost", start: 200, @@ -91,7 +91,7 @@ func Test_internalLabelImpl_Get(t *testing.T) { { name: "when the label name is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoLabelNameError, diff --git a/confluence/internal/page_impl_test.go b/confluence/internal/page_impl_test.go index 1f8874d3..bfc78de8 100644 --- a/confluence/internal/page_impl_test.go +++ b/confluence/internal/page_impl_test.go @@ -38,7 +38,7 @@ func Test_internalPageImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), pageID: 200001, format: "atlas_doc_format", draft: true, @@ -67,7 +67,7 @@ func Test_internalPageImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), pageID: 200001, format: "atlas_doc_format", draft: true, @@ -94,7 +94,7 @@ func Test_internalPageImpl_Get(t *testing.T) { { name: "when the page id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoPageIDError, @@ -155,7 +155,7 @@ func Test_internalPageImpl_Gets(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.PageOptionsScheme{ PageIDs: []int{112, 1223}, SpaceIDs: []int{3040, 3040}, @@ -190,7 +190,7 @@ func Test_internalPageImpl_Gets(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), cursor: "cursor-sample", options: &model.PageOptionsScheme{ PageIDs: []int{112, 1223}, @@ -273,7 +273,7 @@ func Test_internalPageImpl_Bulk(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), cursor: "cursor-sample", limit: 200, }, @@ -300,7 +300,7 @@ func Test_internalPageImpl_Bulk(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), cursor: "cursor-sample", limit: 200, }, @@ -377,7 +377,7 @@ func Test_internalPageImpl_GetsByLabel(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), labelID: 20001, sort: "test-label", cursor: "cursor-sample", @@ -406,7 +406,7 @@ func Test_internalPageImpl_GetsByLabel(t *testing.T) { { name: "when the label id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoLabelIDError, @@ -415,7 +415,7 @@ func Test_internalPageImpl_GetsByLabel(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), labelID: 20001, sort: "test-label", cursor: "cursor-sample", @@ -494,7 +494,7 @@ func Test_internalPageImpl_GetsBySpace(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), spaceID: 20001, cursor: "cursor-sample", limit: 200, @@ -522,7 +522,7 @@ func Test_internalPageImpl_GetsBySpace(t *testing.T) { { name: "when the space id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoSpaceIDError, @@ -531,7 +531,7 @@ func Test_internalPageImpl_GetsBySpace(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), spaceID: 20001, cursor: "cursor-sample", limit: 200, @@ -608,7 +608,7 @@ func Test_internalPageImpl_GetsByParent(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), parentID: 20001, cursor: "cursor-sample", limit: 200, @@ -636,7 +636,7 @@ func Test_internalPageImpl_GetsByParent(t *testing.T) { { name: "when the parent id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoPageIDError, @@ -645,7 +645,7 @@ func Test_internalPageImpl_GetsByParent(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), parentID: 20001, cursor: "cursor-sample", limit: 200, @@ -671,7 +671,7 @@ func Test_internalPageImpl_GetsByParent(t *testing.T) { { name: "when the call fails", args: args{ - ctx: context.TODO(), + ctx: context.Background(), parentID: 20001, cursor: "cursor-sample", limit: 200, @@ -752,7 +752,7 @@ func Test_internalPageImpl_Delete(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), pageID: 200001, }, on: func(fields *fields) { @@ -778,7 +778,7 @@ func Test_internalPageImpl_Delete(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), pageID: 200001, }, on: func(fields *fields) { @@ -802,7 +802,7 @@ func Test_internalPageImpl_Delete(t *testing.T) { { name: "when the page id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoPageIDError, @@ -893,7 +893,7 @@ func Test_internalPageImpl_Create(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: mockedPayload, }, on: func(fields *fields) { @@ -919,7 +919,7 @@ func Test_internalPageImpl_Create(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: mockedPayload, }, on: func(fields *fields) { @@ -1033,7 +1033,7 @@ func Test_internalPageImpl_Update(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), pageID: 215646235, payload: mockedPayload, }, @@ -1060,7 +1060,7 @@ func Test_internalPageImpl_Update(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), pageID: 215646235, payload: mockedPayload, }, @@ -1085,7 +1085,7 @@ func Test_internalPageImpl_Update(t *testing.T) { { name: "when the page id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoPageIDError, diff --git a/confluence/internal/permission_content_impl_test.go b/confluence/internal/permission_content_impl_test.go index f54f1ecb..d2096ed8 100644 --- a/confluence/internal/permission_content_impl_test.go +++ b/confluence/internal/permission_content_impl_test.go @@ -42,7 +42,7 @@ func Test_internalPermissionImpl_Check(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100100101", payload: payloadMocked, }, @@ -70,7 +70,7 @@ func Test_internalPermissionImpl_Check(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100100101", payload: payloadMocked, }, @@ -95,7 +95,7 @@ func Test_internalPermissionImpl_Check(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, diff --git a/confluence/internal/permission_space_impl_test.go b/confluence/internal/permission_space_impl_test.go index 5fd25bbc..a3c9ecf4 100644 --- a/confluence/internal/permission_space_impl_test.go +++ b/confluence/internal/permission_space_impl_test.go @@ -45,7 +45,7 @@ func Test_internalSpacePermissionImpl_Add(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), spaceKey: "DUMMY", payload: payloadMocked, }, @@ -72,7 +72,7 @@ func Test_internalSpacePermissionImpl_Add(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), spaceKey: "DUMMY", payload: payloadMocked, }, @@ -96,7 +96,7 @@ func Test_internalSpacePermissionImpl_Add(t *testing.T) { { name: "when the space key is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoSpaceKeyError, @@ -175,7 +175,7 @@ func Test_internalSpacePermissionImpl_Bulk(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), spaceKey: "DUMMY", payload: payloadMocked, }, @@ -202,7 +202,7 @@ func Test_internalSpacePermissionImpl_Bulk(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), spaceKey: "DUMMY", payload: payloadMocked, }, @@ -226,7 +226,7 @@ func Test_internalSpacePermissionImpl_Bulk(t *testing.T) { { name: "when the space key is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoSpaceKeyError, @@ -285,7 +285,7 @@ func Test_internalSpacePermissionImpl_Remove(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), spaceKey: "DUMMY", permissionID: 10001, }, @@ -312,7 +312,7 @@ func Test_internalSpacePermissionImpl_Remove(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), spaceKey: "DUMMY", permissionID: 10001, }, @@ -336,7 +336,7 @@ func Test_internalSpacePermissionImpl_Remove(t *testing.T) { { name: "when the space key is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoSpaceKeyError, diff --git a/confluence/internal/properties_content_impl_test.go b/confluence/internal/properties_content_impl_test.go index 37729b21..5c377dd7 100644 --- a/confluence/internal/properties_content_impl_test.go +++ b/confluence/internal/properties_content_impl_test.go @@ -35,7 +35,7 @@ func Test_internalPropertyImpl_Gets(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "11101", expand: []string{"content", "version"}, startAt: 100, @@ -65,7 +65,7 @@ func Test_internalPropertyImpl_Gets(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "11101", expand: []string{"content", "version"}, startAt: 100, @@ -92,7 +92,7 @@ func Test_internalPropertyImpl_Gets(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -152,7 +152,7 @@ func Test_internalPropertyImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "11101", key: "space-key", }, @@ -180,7 +180,7 @@ func Test_internalPropertyImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "11101", key: "space-key", }, @@ -205,7 +205,7 @@ func Test_internalPropertyImpl_Get(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -214,7 +214,7 @@ func Test_internalPropertyImpl_Get(t *testing.T) { { name: "when the property name is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "1111", }, wantErr: true, @@ -274,7 +274,7 @@ func Test_internalPropertyImpl_Delete(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "11101", key: "space-key", }, @@ -302,7 +302,7 @@ func Test_internalPropertyImpl_Delete(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "11101", key: "space-key", }, @@ -327,7 +327,7 @@ func Test_internalPropertyImpl_Delete(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -336,7 +336,7 @@ func Test_internalPropertyImpl_Delete(t *testing.T) { { name: "when the property name is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "1111", }, wantErr: true, @@ -401,7 +401,7 @@ func Test_internalPropertyImpl_Create(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "11101", payload: payloadMocked, }, @@ -429,7 +429,7 @@ func Test_internalPropertyImpl_Create(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "11101", payload: payloadMocked, }, @@ -454,7 +454,7 @@ func Test_internalPropertyImpl_Create(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, diff --git a/confluence/internal/restriction_content_impl_test.go b/confluence/internal/restriction_content_impl_test.go index 90936a01..e86abdad 100644 --- a/confluence/internal/restriction_content_impl_test.go +++ b/confluence/internal/restriction_content_impl_test.go @@ -36,7 +36,7 @@ func Test_internalRestrictionImpl_Gets(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", expand: []string{"restrictions.user"}, startAt: 50, @@ -66,7 +66,7 @@ func Test_internalRestrictionImpl_Gets(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", expand: []string{"restrictions.user"}, startAt: 50, @@ -93,7 +93,7 @@ func Test_internalRestrictionImpl_Gets(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -157,7 +157,7 @@ func Test_internalRestrictionImpl_Add(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", payload: payloadMocked, expand: []string{"restrictions.user"}, @@ -186,7 +186,7 @@ func Test_internalRestrictionImpl_Add(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", payload: payloadMocked, expand: []string{"restrictions.user"}, @@ -212,7 +212,7 @@ func Test_internalRestrictionImpl_Add(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -273,7 +273,7 @@ func Test_internalRestrictionImpl_Delete(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", expand: []string{"restrictions.user"}, }, @@ -301,7 +301,7 @@ func Test_internalRestrictionImpl_Delete(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", expand: []string{"restrictions.user"}, }, @@ -326,7 +326,7 @@ func Test_internalRestrictionImpl_Delete(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -389,7 +389,7 @@ func Test_internalRestrictionImpl_Update(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", payload: payloadMocked, expand: []string{"restrictions.user"}, @@ -418,7 +418,7 @@ func Test_internalRestrictionImpl_Update(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", payload: payloadMocked, expand: []string{"restrictions.user"}, @@ -444,7 +444,7 @@ func Test_internalRestrictionImpl_Update(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, diff --git a/confluence/internal/restriction_operation_content_impl_test.go b/confluence/internal/restriction_operation_content_impl_test.go index cdede856..b3ed070b 100644 --- a/confluence/internal/restriction_operation_content_impl_test.go +++ b/confluence/internal/restriction_operation_content_impl_test.go @@ -34,7 +34,7 @@ func Test_internalRestrictionOperationImpl_Gets(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", expand: []string{"restrictions.user"}, }, @@ -62,7 +62,7 @@ func Test_internalRestrictionOperationImpl_Gets(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", expand: []string{"restrictions.user"}, }, @@ -87,7 +87,7 @@ func Test_internalRestrictionOperationImpl_Gets(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -149,7 +149,7 @@ func Test_internalRestrictionOperationImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", operationKey: "read", expand: []string{"restrictions.user"}, @@ -180,7 +180,7 @@ func Test_internalRestrictionOperationImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", operationKey: "read", expand: []string{"restrictions.user"}, @@ -208,7 +208,7 @@ func Test_internalRestrictionOperationImpl_Get(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -217,7 +217,7 @@ func Test_internalRestrictionOperationImpl_Get(t *testing.T) { { name: "when the property key is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "1111", }, wantErr: true, diff --git a/confluence/internal/restriction_operation_group_content_impl_test.go b/confluence/internal/restriction_operation_group_content_impl_test.go index b3af1a85..291e423c 100644 --- a/confluence/internal/restriction_operation_group_content_impl_test.go +++ b/confluence/internal/restriction_operation_group_content_impl_test.go @@ -33,7 +33,7 @@ func Test_internalRestrictionOperationGroupImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", operationKey: "read", groupNameOrID: "confluence-users", @@ -62,7 +62,7 @@ func Test_internalRestrictionOperationGroupImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", operationKey: "read", groupNameOrID: "confluence-users", @@ -88,7 +88,7 @@ func Test_internalRestrictionOperationGroupImpl_Get(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -97,7 +97,7 @@ func Test_internalRestrictionOperationGroupImpl_Get(t *testing.T) { { name: "when the property key is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "1111", }, wantErr: true, @@ -107,7 +107,7 @@ func Test_internalRestrictionOperationGroupImpl_Get(t *testing.T) { { name: "when the group name or id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "1111", operationKey: "read", }, @@ -168,7 +168,7 @@ func Test_internalRestrictionOperationGroupImpl_Add(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", operationKey: "read", groupNameOrID: "confluence-users", @@ -197,7 +197,7 @@ func Test_internalRestrictionOperationGroupImpl_Add(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", operationKey: "read", groupNameOrID: "confluence-users", @@ -223,7 +223,7 @@ func Test_internalRestrictionOperationGroupImpl_Add(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -232,7 +232,7 @@ func Test_internalRestrictionOperationGroupImpl_Add(t *testing.T) { { name: "when the property key is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "1111", }, wantErr: true, @@ -242,7 +242,7 @@ func Test_internalRestrictionOperationGroupImpl_Add(t *testing.T) { { name: "when the group name or id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "1111", operationKey: "read", }, @@ -303,7 +303,7 @@ func Test_internalRestrictionOperationGroupImpl_Remove(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", operationKey: "read", groupNameOrID: "confluence-users", @@ -332,7 +332,7 @@ func Test_internalRestrictionOperationGroupImpl_Remove(t *testing.T) { { name: "when the group provided is an uuid type", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", operationKey: "read", groupNameOrID: "5185574c-4008-49bf-803c-e71baecf37d3", @@ -361,7 +361,7 @@ func Test_internalRestrictionOperationGroupImpl_Remove(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", operationKey: "read", groupNameOrID: "confluence-users", @@ -387,7 +387,7 @@ func Test_internalRestrictionOperationGroupImpl_Remove(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -396,7 +396,7 @@ func Test_internalRestrictionOperationGroupImpl_Remove(t *testing.T) { { name: "when the property key is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "1111", }, wantErr: true, @@ -406,7 +406,7 @@ func Test_internalRestrictionOperationGroupImpl_Remove(t *testing.T) { { name: "when the group name or id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "1111", operationKey: "read", }, diff --git a/confluence/internal/restriction_operation_user_content_impl_test.go b/confluence/internal/restriction_operation_user_content_impl_test.go index df1cfd7d..4b6e148e 100644 --- a/confluence/internal/restriction_operation_user_content_impl_test.go +++ b/confluence/internal/restriction_operation_user_content_impl_test.go @@ -33,7 +33,7 @@ func Test_internalRestrictionOperationUserImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", operationKey: "read", accountID: "06db0c76-115b-498e-9cd6-921d6f6dde46", @@ -62,7 +62,7 @@ func Test_internalRestrictionOperationUserImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", operationKey: "read", accountID: "06db0c76-115b-498e-9cd6-921d6f6dde46", @@ -88,7 +88,7 @@ func Test_internalRestrictionOperationUserImpl_Get(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -97,7 +97,7 @@ func Test_internalRestrictionOperationUserImpl_Get(t *testing.T) { { name: "when the property key is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "1111", }, wantErr: true, @@ -107,7 +107,7 @@ func Test_internalRestrictionOperationUserImpl_Get(t *testing.T) { { name: "when the account id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "1111", operationKey: "read", }, @@ -168,7 +168,7 @@ func Test_internalRestrictionOperationUserImpl_Add(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", operationKey: "read", accountID: "06db0c76-115b-498e-9cd6-921d6f6dde46", @@ -197,7 +197,7 @@ func Test_internalRestrictionOperationUserImpl_Add(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", operationKey: "read", accountID: "06db0c76-115b-498e-9cd6-921d6f6dde46", @@ -223,7 +223,7 @@ func Test_internalRestrictionOperationUserImpl_Add(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -232,7 +232,7 @@ func Test_internalRestrictionOperationUserImpl_Add(t *testing.T) { { name: "when the property key is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "1111", }, wantErr: true, @@ -242,7 +242,7 @@ func Test_internalRestrictionOperationUserImpl_Add(t *testing.T) { { name: "when the account id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "1111", operationKey: "read", }, @@ -303,7 +303,7 @@ func Test_internalRestrictionOperationUserImpl_Remove(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", operationKey: "read", accountID: "06db0c76-115b-498e-9cd6-921d6f6dde46", @@ -332,7 +332,7 @@ func Test_internalRestrictionOperationUserImpl_Remove(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "100001", operationKey: "read", accountID: "06db0c76-115b-498e-9cd6-921d6f6dde46", @@ -358,7 +358,7 @@ func Test_internalRestrictionOperationUserImpl_Remove(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -367,7 +367,7 @@ func Test_internalRestrictionOperationUserImpl_Remove(t *testing.T) { { name: "when the property key is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "1111", }, wantErr: true, @@ -377,7 +377,7 @@ func Test_internalRestrictionOperationUserImpl_Remove(t *testing.T) { { name: "when the account id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "1111", operationKey: "read", }, diff --git a/confluence/internal/search_impl_test.go b/confluence/internal/search_impl_test.go index 813e0383..cc7ed651 100644 --- a/confluence/internal/search_impl_test.go +++ b/confluence/internal/search_impl_test.go @@ -34,7 +34,7 @@ func Test_internalSearchImpl_Content(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), cql: "type=page", options: &model.SearchContentOptions{ Context: "spaceKey", @@ -74,7 +74,7 @@ func Test_internalSearchImpl_Content(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), cql: "type=page", options: &model.SearchContentOptions{ Context: "spaceKey", @@ -111,7 +111,7 @@ func Test_internalSearchImpl_Content(t *testing.T) { { name: "when the cql is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoCQLError, @@ -173,7 +173,7 @@ func Test_internalSearchImpl_Users(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), cql: "type=page", start: 20, limit: 50, @@ -203,7 +203,7 @@ func Test_internalSearchImpl_Users(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), cql: "type=page", start: 20, limit: 50, @@ -230,7 +230,7 @@ func Test_internalSearchImpl_Users(t *testing.T) { { name: "when the cql is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoCQLError, diff --git a/confluence/internal/space_impl_test.go b/confluence/internal/space_impl_test.go index c3c80dd0..13998d76 100644 --- a/confluence/internal/space_impl_test.go +++ b/confluence/internal/space_impl_test.go @@ -34,7 +34,7 @@ func Test_internalSpaceImpl_Gets(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.GetSpacesOptionScheme{ SpaceKeys: []string{"DUMMY", "TEST"}, SpaceIDs: []int{1111, 2222, 3333}, @@ -72,7 +72,7 @@ func Test_internalSpaceImpl_Gets(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.GetSpacesOptionScheme{ SpaceKeys: []string{"DUMMY", "TEST"}, SpaceIDs: []int{1111, 2222, 3333}, @@ -159,7 +159,7 @@ func Test_internalSpaceImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), spaceKey: "DUMMY", expand: []string{"childtypes.all", "operations"}, }, @@ -187,7 +187,7 @@ func Test_internalSpaceImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), spaceKey: "DUMMY", expand: []string{"childtypes.all", "operations"}, }, @@ -212,7 +212,7 @@ func Test_internalSpaceImpl_Get(t *testing.T) { { name: "when the space key is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoSpaceKeyError, @@ -273,7 +273,7 @@ func Test_internalSpaceImpl_Content(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), spaceKey: "DUMMY", depth: "all", expand: []string{"childtypes.all", "operations"}, @@ -304,7 +304,7 @@ func Test_internalSpaceImpl_Content(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), spaceKey: "DUMMY", depth: "all", expand: []string{"childtypes.all", "operations"}, @@ -332,7 +332,7 @@ func Test_internalSpaceImpl_Content(t *testing.T) { { name: "when the space key is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoSpaceKeyError, @@ -394,7 +394,7 @@ func Test_internalSpaceImpl_ContentByType(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), spaceKey: "DUMMY", depth: "all", contentType: "page", @@ -426,7 +426,7 @@ func Test_internalSpaceImpl_ContentByType(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), spaceKey: "DUMMY", depth: "all", contentType: "page", @@ -455,7 +455,7 @@ func Test_internalSpaceImpl_ContentByType(t *testing.T) { { name: "when the space key is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoSpaceKeyError, @@ -516,7 +516,7 @@ func Test_internalSpaceImpl_Delete(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), spaceKey: "DUMMY", }, on: func(fields *fields) { @@ -543,7 +543,7 @@ func Test_internalSpaceImpl_Delete(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), spaceKey: "DUMMY", }, on: func(fields *fields) { @@ -567,7 +567,7 @@ func Test_internalSpaceImpl_Delete(t *testing.T) { { name: "when the space key is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoSpaceKeyError, @@ -635,7 +635,7 @@ func Test_internalSpaceImpl_Create(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, private: true, }, @@ -663,7 +663,7 @@ func Test_internalSpaceImpl_Create(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, private: true, }, @@ -688,7 +688,7 @@ func Test_internalSpaceImpl_Create(t *testing.T) { { name: "when the space name is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: &model.CreateSpaceScheme{}, }, wantErr: true, @@ -698,7 +698,7 @@ func Test_internalSpaceImpl_Create(t *testing.T) { { name: "when the space key is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: &model.CreateSpaceScheme{ Name: "DUMMY Space", }, @@ -767,7 +767,7 @@ func Test_internalSpaceImpl_Update(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), spaceKey: "DUMMY", payload: payloadMocked, }, @@ -795,7 +795,7 @@ func Test_internalSpaceImpl_Update(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), spaceKey: "DUMMY", payload: payloadMocked, }, @@ -820,7 +820,7 @@ func Test_internalSpaceImpl_Update(t *testing.T) { { name: "when the space key is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoSpaceKeyError, diff --git a/confluence/internal/space_v2_impl_test.go b/confluence/internal/space_v2_impl_test.go index c83c970b..260ce8a8 100644 --- a/confluence/internal/space_v2_impl_test.go +++ b/confluence/internal/space_v2_impl_test.go @@ -46,7 +46,7 @@ func Test_internalSpaceV2Impl_Bulk(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: optionsMocked, cursor: "cursor_sample_uuid", limit: 50, @@ -75,7 +75,7 @@ func Test_internalSpaceV2Impl_Bulk(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: optionsMocked, cursor: "cursor_sample_uuid", limit: 50, @@ -153,7 +153,7 @@ func Test_internalSpaceV2Impl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), spaceID: 10001, descriptionFormat: "view", }, @@ -181,7 +181,7 @@ func Test_internalSpaceV2Impl_Get(t *testing.T) { { name: "when the space id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoSpaceIDError, @@ -190,7 +190,7 @@ func Test_internalSpaceV2Impl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), spaceID: 10001, descriptionFormat: "view", }, @@ -267,7 +267,7 @@ func Test_internalSpaceV2Impl_Permissions(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), spaceID: 10001, cursor: "cursor_sample_uuid", limit: 50, @@ -296,7 +296,7 @@ func Test_internalSpaceV2Impl_Permissions(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), spaceID: 10001, cursor: "cursor_sample_uuid", limit: 50, diff --git a/confluence/internal/task_impl_test.go b/confluence/internal/task_impl_test.go index 4105eaa1..5f5acd12 100644 --- a/confluence/internal/task_impl_test.go +++ b/confluence/internal/task_impl_test.go @@ -34,7 +34,7 @@ func Test_internalTaskImpl_Gets(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), start: 20, limit: 50, }, @@ -62,7 +62,7 @@ func Test_internalTaskImpl_Gets(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), start: 20, limit: 50, }, @@ -137,7 +137,7 @@ func Test_internalTaskImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), taskID: "2272737477", }, on: func(fields *fields) { @@ -164,7 +164,7 @@ func Test_internalTaskImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), taskID: "2272737477", }, on: func(fields *fields) { diff --git a/confluence/internal/version_content_test.go b/confluence/internal/version_content_test.go index 41ae5cb2..97cbdea6 100644 --- a/confluence/internal/version_content_test.go +++ b/confluence/internal/version_content_test.go @@ -35,7 +35,7 @@ func Test_internalVersionImpl_Gets(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "3838282", expand: []string{"operations"}, start: 20, @@ -65,7 +65,7 @@ func Test_internalVersionImpl_Gets(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "3838282", expand: []string{"operations"}, start: 20, @@ -92,7 +92,7 @@ func Test_internalVersionImpl_Gets(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -154,7 +154,7 @@ func Test_internalVersionImpl_Get(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "3838282", expand: []string{"operations"}, versionNumber: 29, @@ -183,7 +183,7 @@ func Test_internalVersionImpl_Get(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "3838282", expand: []string{"operations"}, versionNumber: 29, @@ -209,7 +209,7 @@ func Test_internalVersionImpl_Get(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -280,7 +280,7 @@ func Test_internalVersionImpl_Restore(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "3838282", payload: payloadMocked, expand: []string{"operations"}, @@ -309,7 +309,7 @@ func Test_internalVersionImpl_Restore(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "3838282", payload: payloadMocked, expand: []string{"operations"}, @@ -335,7 +335,7 @@ func Test_internalVersionImpl_Restore(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, @@ -396,7 +396,7 @@ func Test_internalVersionImpl_Delete(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "3838282", versionNumber: 29, }, @@ -424,7 +424,7 @@ func Test_internalVersionImpl_Delete(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), contentID: "3838282", versionNumber: 29, }, @@ -449,7 +449,7 @@ func Test_internalVersionImpl_Delete(t *testing.T) { { name: "when the content id is not provided", args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoContentIDError, diff --git a/confluence/v2/api_client_impl_test.go b/confluence/v2/api_client_impl_test.go index 3739fdf3..ee1350cd 100644 --- a/confluence/v2/api_client_impl_test.go +++ b/confluence/v2/api_client_impl_test.go @@ -291,7 +291,7 @@ func TestClient_NewRequest(t *testing.T) { Site: siteAsURL, }, args: args{ - ctx: context.TODO(), + ctx: context.Background(), method: http.MethodGet, urlStr: "rest/2/issue/attachment", type_: "", @@ -309,7 +309,7 @@ func TestClient_NewRequest(t *testing.T) { Site: siteAsURL, }, args: args{ - ctx: context.TODO(), + ctx: context.Background(), method: http.MethodGet, urlStr: " https://zhidao.baidu.com/special/view?id=49105a24626975510000&preview=1", body: bytes.NewReader([]byte("Hello World")), @@ -326,7 +326,7 @@ func TestClient_NewRequest(t *testing.T) { Site: siteAsURL, }, args: args{ - ctx: context.TODO(), + ctx: context.Background(), method: http.MethodGet, urlStr: "rest/2/issue/attachment", type_: "type_sample", diff --git a/jira/agile/api_client_impl_test.go b/jira/agile/api_client_impl_test.go index efad4601..65124f82 100644 --- a/jira/agile/api_client_impl_test.go +++ b/jira/agile/api_client_impl_test.go @@ -298,7 +298,7 @@ func TestClient_NewRequest(t *testing.T) { Site: siteAsURL, }, args: args{ - ctx: context.TODO(), + ctx: context.Background(), method: http.MethodGet, urlStr: "rest/2/issue/attachment", type_: "", @@ -316,7 +316,7 @@ func TestClient_NewRequest(t *testing.T) { Site: siteAsURL, }, args: args{ - ctx: context.TODO(), + ctx: context.Background(), method: http.MethodGet, urlStr: " https://zhidao.baidu.com/special/view?id=49105a24626975510000&preview=1", body: bytes.NewReader([]byte("Hello World")), diff --git a/jira/internal/attachment_impl_test.go b/jira/internal/attachment_impl_test.go index 28c58a19..9d885394 100644 --- a/jira/internal/attachment_impl_test.go +++ b/jira/internal/attachment_impl_test.go @@ -647,7 +647,7 @@ func Test_internalIssueAttachmentServiceImpl_Add(t *testing.T) { client.On("Call", &http.Request{}, - []*model.IssueAttachmentScheme(nil)). + mock.Anything). Return(&model.ResponseScheme{}, nil) fields.c = client @@ -677,7 +677,7 @@ func Test_internalIssueAttachmentServiceImpl_Add(t *testing.T) { client.On("Call", &http.Request{}, - []*model.IssueAttachmentScheme(nil)). + mock.Anything). Return(&model.ResponseScheme{}, nil) fields.c = client diff --git a/jira/internal/comment_impl_adf_test.go b/jira/internal/comment_impl_adf_test.go index 8523b5b9..f9ae60a2 100644 --- a/jira/internal/comment_impl_adf_test.go +++ b/jira/internal/comment_impl_adf_test.go @@ -39,7 +39,7 @@ func Test_internalAdfCommentImpl_Gets(t *testing.T) { name: "when the document format is adf (atlassian document format)", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", orderBy: "id", expand: []string{"renderedBody"}, @@ -74,7 +74,7 @@ func Test_internalAdfCommentImpl_Gets(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", orderBy: "id", expand: []string{"renderedBody"}, @@ -89,7 +89,7 @@ func Test_internalAdfCommentImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", orderBy: "id", expand: []string{"renderedBody"}, @@ -172,7 +172,7 @@ func Test_internalAdfCommentImpl_Get(t *testing.T) { name: "when the document format is adf (atlassian document format)", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", commentId: "10001", }, @@ -204,7 +204,7 @@ func Test_internalAdfCommentImpl_Get(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", }, wantErr: true, @@ -215,7 +215,7 @@ func Test_internalAdfCommentImpl_Get(t *testing.T) { name: "when the comment id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", }, wantErr: true, @@ -226,7 +226,7 @@ func Test_internalAdfCommentImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", commentId: "10001", }, @@ -305,7 +305,7 @@ func Test_internalAdfCommentImpl_Delete(t *testing.T) { name: "when the document format is adf (atlassian document format)", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", commentId: "10001", }, @@ -337,7 +337,7 @@ func Test_internalAdfCommentImpl_Delete(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", }, wantErr: true, @@ -348,7 +348,7 @@ func Test_internalAdfCommentImpl_Delete(t *testing.T) { name: "when the comment id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", }, wantErr: true, @@ -359,7 +359,7 @@ func Test_internalAdfCommentImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", commentId: "10001", }, @@ -478,7 +478,7 @@ func Test_internalAdfCommentImpl_Add(t *testing.T) { name: "when the document format is adf (atlassian document format)", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", payload: payloadMocked, expand: []string{"body"}, @@ -511,7 +511,7 @@ func Test_internalAdfCommentImpl_Add(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", payload: payloadMocked, expand: []string{"body"}, @@ -524,7 +524,7 @@ func Test_internalAdfCommentImpl_Add(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", payload: payloadMocked, expand: []string{"body"}, diff --git a/jira/internal/comment_impl_rich_text_test.go b/jira/internal/comment_impl_rich_text_test.go index 26345b42..8a8daae4 100644 --- a/jira/internal/comment_impl_rich_text_test.go +++ b/jira/internal/comment_impl_rich_text_test.go @@ -39,7 +39,7 @@ func Test_internalRichTextCommentImpl_Gets(t *testing.T) { name: "when the document format is rich-text", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", orderBy: "id", expand: []string{"renderedBody"}, @@ -74,7 +74,7 @@ func Test_internalRichTextCommentImpl_Gets(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", orderBy: "id", expand: []string{"renderedBody"}, @@ -89,7 +89,7 @@ func Test_internalRichTextCommentImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", orderBy: "id", expand: []string{"renderedBody"}, @@ -172,7 +172,7 @@ func Test_internalRichTextCommentImpl_Get(t *testing.T) { name: "when the document format is rich-text", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", commentId: "10001", }, @@ -204,7 +204,7 @@ func Test_internalRichTextCommentImpl_Get(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", }, wantErr: true, @@ -215,7 +215,7 @@ func Test_internalRichTextCommentImpl_Get(t *testing.T) { name: "when the comment id is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", }, wantErr: true, @@ -226,7 +226,7 @@ func Test_internalRichTextCommentImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", commentId: "10001", }, @@ -305,7 +305,7 @@ func Test_internalRichTextCommentImpl_Delete(t *testing.T) { name: "when the document format is rich-text", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", commentId: "10001", }, @@ -337,7 +337,7 @@ func Test_internalRichTextCommentImpl_Delete(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", }, wantErr: true, @@ -348,7 +348,7 @@ func Test_internalRichTextCommentImpl_Delete(t *testing.T) { name: "when the comment id is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", }, wantErr: true, @@ -359,7 +359,7 @@ func Test_internalRichTextCommentImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", commentId: "10001", }, @@ -447,7 +447,7 @@ func Test_internalRichTextCommentImpl_Add(t *testing.T) { name: "when the document format is rich-text", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", payload: payloadMocked, expand: []string{"body"}, @@ -480,7 +480,7 @@ func Test_internalRichTextCommentImpl_Add(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", payload: payloadMocked, expand: []string{"body"}, @@ -493,7 +493,7 @@ func Test_internalRichTextCommentImpl_Add(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", payload: payloadMocked, expand: []string{"body"}, diff --git a/jira/internal/field_configuration_impl_test.go b/jira/internal/field_configuration_impl_test.go index 3ce892a3..95009024 100644 --- a/jira/internal/field_configuration_impl_test.go +++ b/jira/internal/field_configuration_impl_test.go @@ -37,7 +37,7 @@ func Test_internalIssueFieldConfigServiceImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), ids: []int{10000, 100001}, isDefault: false, startAt: 50, @@ -71,7 +71,7 @@ func Test_internalIssueFieldConfigServiceImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), ids: []int{10000, 100001}, isDefault: false, startAt: 50, @@ -105,7 +105,7 @@ func Test_internalIssueFieldConfigServiceImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), ids: []int{10000, 100001}, isDefault: false, startAt: 50, @@ -194,7 +194,7 @@ func Test_internalIssueFieldConfigServiceImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), name: "DUMMY Field Configuration Scheme", description: "description sample", }, @@ -226,7 +226,7 @@ func Test_internalIssueFieldConfigServiceImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), name: "DUMMY Field Configuration Scheme", description: "description sample", }, @@ -258,7 +258,7 @@ func Test_internalIssueFieldConfigServiceImpl_Create(t *testing.T) { name: "when the description is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), name: "DUMMY Field Configuration Scheme", description: "", }, @@ -290,7 +290,7 @@ func Test_internalIssueFieldConfigServiceImpl_Create(t *testing.T) { name: "when the field configuration name is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), name: "", description: "description sample", }, @@ -302,7 +302,7 @@ func Test_internalIssueFieldConfigServiceImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), name: "DUMMY Field Configuration Scheme", description: "description sample", }, @@ -389,7 +389,7 @@ func Test_internalIssueFieldConfigServiceImpl_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), id: 1001, name: "DUMMY Field Configuration Scheme", description: "description sample", @@ -422,7 +422,7 @@ func Test_internalIssueFieldConfigServiceImpl_Update(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), id: 1001, name: "DUMMY Field Configuration Scheme", description: "description sample", @@ -455,7 +455,7 @@ func Test_internalIssueFieldConfigServiceImpl_Update(t *testing.T) { name: "when the description is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), id: 1001, name: "DUMMY Field Configuration Scheme", description: "", @@ -488,7 +488,7 @@ func Test_internalIssueFieldConfigServiceImpl_Update(t *testing.T) { name: "when the field configuration name is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), id: 1001, name: "", description: "description sample", @@ -501,7 +501,7 @@ func Test_internalIssueFieldConfigServiceImpl_Update(t *testing.T) { name: "when the field configuration id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), id: 0, name: "field configuration id", description: "description sample", @@ -514,7 +514,7 @@ func Test_internalIssueFieldConfigServiceImpl_Update(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), id: 1001, name: "DUMMY Field Configuration Scheme", description: "description sample", @@ -594,7 +594,7 @@ func Test_internalIssueFieldConfigServiceImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), id: 1001, }, on: func(fields *fields) { @@ -625,7 +625,7 @@ func Test_internalIssueFieldConfigServiceImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), id: 1001, }, on: func(fields *fields) { @@ -656,7 +656,7 @@ func Test_internalIssueFieldConfigServiceImpl_Delete(t *testing.T) { name: "when the field configuration id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), id: 0, }, wantErr: true, @@ -667,7 +667,7 @@ func Test_internalIssueFieldConfigServiceImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), id: 1001, }, on: func(fields *fields) { diff --git a/jira/internal/field_configuration_item_impl_test.go b/jira/internal/field_configuration_item_impl_test.go index c2308f60..99b6fc8b 100644 --- a/jira/internal/field_configuration_item_impl_test.go +++ b/jira/internal/field_configuration_item_impl_test.go @@ -35,7 +35,7 @@ func Test_internalIssueFieldConfigItemServiceImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), id: 10001, startAt: 50, maxResults: 50, @@ -68,7 +68,7 @@ func Test_internalIssueFieldConfigItemServiceImpl_Gets(t *testing.T) { name: "when the field config is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), startAt: 50, maxResults: 50, }, @@ -80,7 +80,7 @@ func Test_internalIssueFieldConfigItemServiceImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), id: 10001, startAt: 50, maxResults: 50, @@ -113,7 +113,7 @@ func Test_internalIssueFieldConfigItemServiceImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), id: 10001, startAt: 50, maxResults: 50, @@ -216,7 +216,7 @@ func Test_internalIssueFieldConfigItemServiceImpl_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), id: 10001, payload: payloadMocked, }, @@ -248,7 +248,7 @@ func Test_internalIssueFieldConfigItemServiceImpl_Update(t *testing.T) { name: "when the field config is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoFieldConfigurationIDError, @@ -258,7 +258,7 @@ func Test_internalIssueFieldConfigItemServiceImpl_Update(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), id: 10001, payload: payloadMocked, }, @@ -290,7 +290,7 @@ func Test_internalIssueFieldConfigItemServiceImpl_Update(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), id: 10001, payload: payloadMocked, }, diff --git a/jira/internal/field_configuration_scheme_test.go b/jira/internal/field_configuration_scheme_test.go index 400f3415..a5c19531 100644 --- a/jira/internal/field_configuration_scheme_test.go +++ b/jira/internal/field_configuration_scheme_test.go @@ -36,7 +36,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), ids: []int{10001}, startAt: 50, maxResults: 50, @@ -68,7 +68,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), ids: []int{10001}, startAt: 50, maxResults: 50, @@ -100,7 +100,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), ids: []int{10001}, startAt: 50, maxResults: 50, @@ -184,7 +184,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), name: "field scheme sample", description: "field scheme sample", }, @@ -215,7 +215,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), name: "field scheme sample", description: "field scheme sample", }, @@ -246,7 +246,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Create(t *testing.T) { name: "when the description is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), name: "field scheme sample", description: "", }, @@ -277,7 +277,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), name: "field scheme sample", description: "field scheme sample", }, @@ -357,7 +357,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Mapping(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldConfigIds: []int{10001}, startAt: 50, maxResults: 50, @@ -389,7 +389,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Mapping(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldConfigIds: []int{10001}, startAt: 50, maxResults: 50, @@ -421,7 +421,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Mapping(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldConfigIds: []int{10001}, startAt: 50, maxResults: 50, @@ -502,7 +502,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Project(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectIds: []int{10001}, startAt: 50, maxResults: 50, @@ -534,7 +534,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Project(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectIds: []int{10001}, startAt: 50, maxResults: 50, @@ -566,7 +566,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Project(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectIds: []int{10001}, startAt: 50, maxResults: 50, @@ -651,7 +651,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Assign(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -681,7 +681,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Assign(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -766,7 +766,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 10001, name: "name sample", description: "description sample", @@ -798,7 +798,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Update(t *testing.T) { name: "when the description is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 10001, name: "name sample", description: "", @@ -830,7 +830,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Update(t *testing.T) { name: "when the scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 0, name: "name sample", description: "description sample", @@ -843,7 +843,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Update(t *testing.T) { name: "when the scheme name is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 10001, name: "", description: "description sample", @@ -856,7 +856,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Update(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 10001, name: "name sample", description: "description sample", @@ -938,7 +938,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 10001, }, on: func(fields *fields) { @@ -968,7 +968,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Delete(t *testing.T) { name: "when the scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 0, }, wantErr: true, @@ -979,7 +979,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 10001, }, on: func(fields *fields) { @@ -1073,7 +1073,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Link(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 10001, payload: payloadMocked, }, @@ -1104,7 +1104,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Link(t *testing.T) { name: "when the scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 0, payload: payloadMocked, }, @@ -1116,7 +1116,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Link(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 10001, payload: payloadMocked, }, @@ -1147,7 +1147,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Link(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 10001, payload: payloadMocked, }, @@ -1226,7 +1226,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Unlink(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 10001, issueTypeIDs: []string{"1001", "1002"}, }, @@ -1257,7 +1257,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Unlink(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 10001, issueTypeIDs: []string{"1001", "1002"}, }, @@ -1288,7 +1288,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Unlink(t *testing.T) { name: "when the scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 0, }, wantErr: true, @@ -1299,7 +1299,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Unlink(t *testing.T) { name: "when the issuetype id's are not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 1000, }, wantErr: true, @@ -1310,7 +1310,7 @@ func Test_internalIssueFieldConfigSchemeServiceImpl_Unlink(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 10001, issueTypeIDs: []string{"1001", "1002"}, }, diff --git a/jira/internal/field_context_impl_test.go b/jira/internal/field_context_impl_test.go index bcda6c83..4841d41f 100644 --- a/jira/internal/field_context_impl_test.go +++ b/jira/internal/field_context_impl_test.go @@ -37,7 +37,7 @@ func Test_internalIssueFieldContextServiceImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", options: &model.FieldContextOptionsScheme{ IsAnyIssueType: true, @@ -74,7 +74,7 @@ func Test_internalIssueFieldContextServiceImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", options: &model.FieldContextOptionsScheme{ IsAnyIssueType: true, @@ -111,7 +111,7 @@ func Test_internalIssueFieldContextServiceImpl_Gets(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "", options: &model.FieldContextOptionsScheme{ IsAnyIssueType: true, @@ -129,7 +129,7 @@ func Test_internalIssueFieldContextServiceImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", options: &model.FieldContextOptionsScheme{ IsAnyIssueType: true, @@ -222,7 +222,7 @@ func Test_internalIssueFieldContextServiceImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", payload: payloadMocked, }, @@ -253,7 +253,7 @@ func Test_internalIssueFieldContextServiceImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", payload: payloadMocked, }, @@ -284,7 +284,7 @@ func Test_internalIssueFieldContextServiceImpl_Create(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "", payload: payloadMocked, }, @@ -296,7 +296,7 @@ func Test_internalIssueFieldContextServiceImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", payload: payloadMocked, }, @@ -376,7 +376,7 @@ func Test_internalIssueFieldContextServiceImpl_GetDefaultValues(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextIds: []int{10001}, startAt: 0, @@ -409,7 +409,7 @@ func Test_internalIssueFieldContextServiceImpl_GetDefaultValues(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextIds: []int{10001}, startAt: 0, @@ -442,7 +442,7 @@ func Test_internalIssueFieldContextServiceImpl_GetDefaultValues(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "", }, wantErr: true, @@ -453,7 +453,7 @@ func Test_internalIssueFieldContextServiceImpl_GetDefaultValues(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextIds: []int{10001}, startAt: 0, @@ -550,7 +550,7 @@ func Test_internalIssueFieldContextServiceImpl_SetDefaultValue(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", payload: payloadMocked, }, @@ -581,7 +581,7 @@ func Test_internalIssueFieldContextServiceImpl_SetDefaultValue(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", payload: payloadMocked, }, @@ -612,7 +612,7 @@ func Test_internalIssueFieldContextServiceImpl_SetDefaultValue(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "", }, wantErr: true, @@ -623,7 +623,7 @@ func Test_internalIssueFieldContextServiceImpl_SetDefaultValue(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", payload: payloadMocked, }, @@ -702,7 +702,7 @@ func Test_internalIssueFieldContextServiceImpl_IssueTypesContext(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextIds: []int{10001}, startAt: 0, @@ -735,7 +735,7 @@ func Test_internalIssueFieldContextServiceImpl_IssueTypesContext(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextIds: []int{10001}, startAt: 0, @@ -768,7 +768,7 @@ func Test_internalIssueFieldContextServiceImpl_IssueTypesContext(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "", }, wantErr: true, @@ -779,7 +779,7 @@ func Test_internalIssueFieldContextServiceImpl_IssueTypesContext(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextIds: []int{10001}, startAt: 0, @@ -862,7 +862,7 @@ func Test_internalIssueFieldContextServiceImpl_ProjectsContext(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextIds: []int{10001}, startAt: 0, @@ -895,7 +895,7 @@ func Test_internalIssueFieldContextServiceImpl_ProjectsContext(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextIds: []int{10001}, startAt: 0, @@ -928,7 +928,7 @@ func Test_internalIssueFieldContextServiceImpl_ProjectsContext(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "", }, wantErr: true, @@ -939,7 +939,7 @@ func Test_internalIssueFieldContextServiceImpl_ProjectsContext(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextIds: []int{10001}, startAt: 0, @@ -1026,7 +1026,7 @@ func Test_internalIssueFieldContextServiceImpl_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, name: "DUMMY - customfield_10002 Context", @@ -1059,7 +1059,7 @@ func Test_internalIssueFieldContextServiceImpl_Update(t *testing.T) { name: "when the description is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, name: "DUMMY - customfield_10002 Context", @@ -1092,7 +1092,7 @@ func Test_internalIssueFieldContextServiceImpl_Update(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, name: "DUMMY - customfield_10002 Context", @@ -1125,7 +1125,7 @@ func Test_internalIssueFieldContextServiceImpl_Update(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "", }, wantErr: true, @@ -1136,7 +1136,7 @@ func Test_internalIssueFieldContextServiceImpl_Update(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, name: "DUMMY - customfield_10002 Context", @@ -1217,7 +1217,7 @@ func Test_internalIssueFieldContextServiceImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, }, @@ -1248,7 +1248,7 @@ func Test_internalIssueFieldContextServiceImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, }, @@ -1279,7 +1279,7 @@ func Test_internalIssueFieldContextServiceImpl_Delete(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "", }, wantErr: true, @@ -1290,7 +1290,7 @@ func Test_internalIssueFieldContextServiceImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, }, @@ -1371,7 +1371,7 @@ func Test_internalIssueFieldContextServiceImpl_AddIssueTypes(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, issueTypesIds: []string{"4", "3"}, @@ -1403,7 +1403,7 @@ func Test_internalIssueFieldContextServiceImpl_AddIssueTypes(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, issueTypesIds: []string{"4", "3"}, @@ -1435,7 +1435,7 @@ func Test_internalIssueFieldContextServiceImpl_AddIssueTypes(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "", }, wantErr: true, @@ -1446,7 +1446,7 @@ func Test_internalIssueFieldContextServiceImpl_AddIssueTypes(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, issueTypesIds: []string{"4", "3"}, @@ -1529,7 +1529,7 @@ func Test_internalIssueFieldContextServiceImpl_RemoveIssueTypes(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, issueTypesIds: []string{"4", "3"}, @@ -1561,7 +1561,7 @@ func Test_internalIssueFieldContextServiceImpl_RemoveIssueTypes(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, issueTypesIds: []string{"4", "3"}, @@ -1593,7 +1593,7 @@ func Test_internalIssueFieldContextServiceImpl_RemoveIssueTypes(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "", }, wantErr: true, @@ -1604,7 +1604,7 @@ func Test_internalIssueFieldContextServiceImpl_RemoveIssueTypes(t *testing.T) { name: "when the issuetype id's are not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", issueTypesIds: nil, }, @@ -1616,7 +1616,7 @@ func Test_internalIssueFieldContextServiceImpl_RemoveIssueTypes(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, issueTypesIds: []string{"4", "3"}, @@ -1699,7 +1699,7 @@ func Test_internalIssueFieldContextServiceImpl_Link(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, projectIds: []string{"4", "3"}, @@ -1731,7 +1731,7 @@ func Test_internalIssueFieldContextServiceImpl_Link(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, projectIds: []string{"4", "3"}, @@ -1763,7 +1763,7 @@ func Test_internalIssueFieldContextServiceImpl_Link(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "", }, wantErr: true, @@ -1774,7 +1774,7 @@ func Test_internalIssueFieldContextServiceImpl_Link(t *testing.T) { name: "when the context id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", }, wantErr: true, @@ -1785,7 +1785,7 @@ func Test_internalIssueFieldContextServiceImpl_Link(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, }, @@ -1797,7 +1797,7 @@ func Test_internalIssueFieldContextServiceImpl_Link(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, projectIds: []string{"4", "3"}, @@ -1880,7 +1880,7 @@ func Test_internalIssueFieldContextServiceImpl_Unlink(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, projectIds: []string{"4", "3"}, @@ -1912,7 +1912,7 @@ func Test_internalIssueFieldContextServiceImpl_Unlink(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, projectIds: []string{"4", "3"}, @@ -1944,7 +1944,7 @@ func Test_internalIssueFieldContextServiceImpl_Unlink(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "", }, wantErr: true, @@ -1955,7 +1955,7 @@ func Test_internalIssueFieldContextServiceImpl_Unlink(t *testing.T) { name: "when the context id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", }, wantErr: true, @@ -1966,7 +1966,7 @@ func Test_internalIssueFieldContextServiceImpl_Unlink(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, }, @@ -1978,7 +1978,7 @@ func Test_internalIssueFieldContextServiceImpl_Unlink(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, projectIds: []string{"4", "3"}, diff --git a/jira/internal/field_context_option_impl_test.go b/jira/internal/field_context_option_impl_test.go index 18162b84..c206f0cd 100644 --- a/jira/internal/field_context_option_impl_test.go +++ b/jira/internal/field_context_option_impl_test.go @@ -38,7 +38,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, options: &model.FieldOptionContextParams{ @@ -75,7 +75,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, options: &model.FieldOptionContextParams{ @@ -112,7 +112,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Gets(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "", contextId: 10001, options: &model.FieldOptionContextParams{ @@ -130,7 +130,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, options: &model.FieldOptionContextParams{ @@ -232,7 +232,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, payload: payloadMocked, @@ -264,7 +264,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, payload: payloadMocked, @@ -296,7 +296,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Create(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "", contextId: 10001, }, @@ -308,7 +308,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Create(t *testing.T) { name: "when the context id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "customfield_1000", contextId: 0, }, @@ -320,7 +320,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, payload: payloadMocked, @@ -417,7 +417,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, payload: payloadMocked, @@ -449,7 +449,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, payload: payloadMocked, @@ -481,7 +481,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Update(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "", contextId: 10001, }, @@ -493,7 +493,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Update(t *testing.T) { name: "when the context id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "customfield_1000", contextId: 0, }, @@ -505,7 +505,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Update(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, payload: payloadMocked, @@ -587,7 +587,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, optionId: 1001, @@ -619,7 +619,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, optionId: 1001, @@ -651,7 +651,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Delete(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "", contextId: 10001, }, @@ -663,7 +663,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Delete(t *testing.T) { name: "when the context id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "customfield_1000", contextId: 0, }, @@ -675,7 +675,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Delete(t *testing.T) { name: "when the option id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "customfield_1000", contextId: 1000, optionId: 0, @@ -689,7 +689,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, optionId: 1001, @@ -775,7 +775,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Order(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, payload: payloadMocked, @@ -807,7 +807,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Order(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, payload: payloadMocked, @@ -839,7 +839,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Order(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "", contextId: 10001, }, @@ -851,7 +851,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Order(t *testing.T) { name: "when the context id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "customfield_1000", contextId: 0, }, @@ -863,7 +863,7 @@ func Test_internalIssueFieldContextOptionServiceImpl_Order(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "custom_field_10002", contextId: 10001, payload: payloadMocked, diff --git a/jira/internal/field_impl_test.go b/jira/internal/field_impl_test.go index 3e44d473..b5df41a2 100644 --- a/jira/internal/field_impl_test.go +++ b/jira/internal/field_impl_test.go @@ -35,7 +35,7 @@ func Test_internalIssueFieldServiceImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -65,7 +65,7 @@ func Test_internalIssueFieldServiceImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -95,7 +95,7 @@ func Test_internalIssueFieldServiceImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -179,7 +179,7 @@ func Test_internalIssueFieldServiceImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -210,7 +210,7 @@ func Test_internalIssueFieldServiceImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -241,7 +241,7 @@ func Test_internalIssueFieldServiceImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -319,7 +319,7 @@ func Test_internalIssueFieldServiceImpl_Search(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.FieldSearchOptionsScheme{ Types: []string{"custom"}, IDs: []string{"111", "12222"}, @@ -358,7 +358,7 @@ func Test_internalIssueFieldServiceImpl_Search(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.FieldSearchOptionsScheme{ Types: []string{"custom"}, IDs: []string{"111", "12222"}, @@ -397,7 +397,7 @@ func Test_internalIssueFieldServiceImpl_Search(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.FieldSearchOptionsScheme{ Types: []string{"custom"}, IDs: []string{"111", "12222"}, @@ -431,7 +431,7 @@ func Test_internalIssueFieldServiceImpl_Search(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -509,7 +509,7 @@ func Test_internalIssueFieldServiceImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "10005", }, on: func(fields *fields) { @@ -540,7 +540,7 @@ func Test_internalIssueFieldServiceImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "10005", }, on: func(fields *fields) { @@ -571,7 +571,7 @@ func Test_internalIssueFieldServiceImpl_Delete(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "", }, wantErr: true, @@ -582,7 +582,7 @@ func Test_internalIssueFieldServiceImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "10005", }, on: func(fields *fields) { diff --git a/jira/internal/field_trash_impl_test.go b/jira/internal/field_trash_impl_test.go index 93f39c69..cf05fc1e 100644 --- a/jira/internal/field_trash_impl_test.go +++ b/jira/internal/field_trash_impl_test.go @@ -36,7 +36,7 @@ func Test_internalFieldTrashServiceImpl_Search(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.FieldSearchOptionsScheme{ IDs: []string{"111", "12222"}, Query: "query-sample", @@ -73,7 +73,7 @@ func Test_internalFieldTrashServiceImpl_Search(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.FieldSearchOptionsScheme{ IDs: []string{"111", "12222"}, Query: "query-sample", @@ -110,7 +110,7 @@ func Test_internalFieldTrashServiceImpl_Search(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.FieldSearchOptionsScheme{ IDs: []string{"111", "12222"}, Query: "query-sample", @@ -142,7 +142,7 @@ func Test_internalFieldTrashServiceImpl_Search(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -220,7 +220,7 @@ func Test_internalFieldTrashServiceImpl_Move(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), id: "customfield_12000", }, on: func(fields *fields) { @@ -251,7 +251,7 @@ func Test_internalFieldTrashServiceImpl_Move(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), id: "customfield_12000", }, on: func(fields *fields) { @@ -282,7 +282,7 @@ func Test_internalFieldTrashServiceImpl_Move(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), id: "", }, wantErr: true, @@ -293,7 +293,7 @@ func Test_internalFieldTrashServiceImpl_Move(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), id: "customfield_12000", }, on: func(fields *fields) { @@ -370,7 +370,7 @@ func Test_internalFieldTrashServiceImpl_Restore(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), id: "customfield_12000", }, on: func(fields *fields) { @@ -401,7 +401,7 @@ func Test_internalFieldTrashServiceImpl_Restore(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), id: "customfield_12000", }, on: func(fields *fields) { @@ -432,7 +432,7 @@ func Test_internalFieldTrashServiceImpl_Restore(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), id: "", }, wantErr: true, @@ -443,7 +443,7 @@ func Test_internalFieldTrashServiceImpl_Restore(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), id: "customfield_12000", }, on: func(fields *fields) { diff --git a/jira/internal/group_impl_test.go b/jira/internal/group_impl_test.go index 24b925bc..87b85a93 100644 --- a/jira/internal/group_impl_test.go +++ b/jira/internal/group_impl_test.go @@ -35,7 +35,7 @@ func Test_internalGroupServiceImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), groupName: "jira-users", }, on: func(fields *fields) { @@ -63,7 +63,7 @@ func Test_internalGroupServiceImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), groupName: "jira-users", }, on: func(fields *fields) { @@ -91,7 +91,7 @@ func Test_internalGroupServiceImpl_Create(t *testing.T) { name: "when the group name is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), groupName: "", }, on: func(fields *fields) { @@ -105,7 +105,7 @@ func Test_internalGroupServiceImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), groupName: "jira-users", }, on: func(fields *fields) { @@ -181,7 +181,7 @@ func Test_internalGroupServiceImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), groupName: "jira-users", }, on: func(fields *fields) { @@ -209,7 +209,7 @@ func Test_internalGroupServiceImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), groupName: "jira-users", }, on: func(fields *fields) { @@ -237,7 +237,7 @@ func Test_internalGroupServiceImpl_Delete(t *testing.T) { name: "when the group name is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), groupName: "", }, on: func(fields *fields) { @@ -251,7 +251,7 @@ func Test_internalGroupServiceImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), groupName: "jira-users", }, on: func(fields *fields) { @@ -327,7 +327,7 @@ func Test_internalGroupServiceImpl_Remove(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), groupName: "jira-users", accountId: "account-id-sample", }, @@ -356,7 +356,7 @@ func Test_internalGroupServiceImpl_Remove(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), groupName: "jira-users", accountId: "account-id-sample", }, @@ -385,7 +385,7 @@ func Test_internalGroupServiceImpl_Remove(t *testing.T) { name: "when the group name is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), groupName: "", }, on: func(fields *fields) { @@ -399,7 +399,7 @@ func Test_internalGroupServiceImpl_Remove(t *testing.T) { name: "when the account id is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), groupName: "jira-users", accountId: "", }, @@ -414,7 +414,7 @@ func Test_internalGroupServiceImpl_Remove(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), groupName: "jira-users", accountId: "account-id-sample", }, @@ -491,7 +491,7 @@ func Test_internalGroupServiceImpl_Add(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), groupName: "jira-users", accountId: "account-id-sample", }, @@ -520,7 +520,7 @@ func Test_internalGroupServiceImpl_Add(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), groupName: "jira-users", accountId: "account-id-sample", }, @@ -549,7 +549,7 @@ func Test_internalGroupServiceImpl_Add(t *testing.T) { name: "when the group name is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), groupName: "", }, on: func(fields *fields) { @@ -563,7 +563,7 @@ func Test_internalGroupServiceImpl_Add(t *testing.T) { name: "when the account id is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), groupName: "jira-users", accountId: "", }, @@ -578,7 +578,7 @@ func Test_internalGroupServiceImpl_Add(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), groupName: "jira-users", accountId: "account-id-sample", }, @@ -656,7 +656,7 @@ func Test_internalGroupServiceImpl_Bulk(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.GroupBulkOptionsScheme{ GroupIDs: []string{"1001", "1002"}, GroupNames: []string{"jira-users", "confluence-users"}, @@ -689,7 +689,7 @@ func Test_internalGroupServiceImpl_Bulk(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.GroupBulkOptionsScheme{ GroupIDs: []string{"1001", "1002"}, GroupNames: []string{"jira-users", "confluence-users"}, @@ -722,7 +722,7 @@ func Test_internalGroupServiceImpl_Bulk(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.GroupBulkOptionsScheme{ GroupIDs: []string{"1001", "1002"}, GroupNames: []string{"jira-users", "confluence-users"}, @@ -806,7 +806,7 @@ func Test_internalGroupServiceImpl_Members(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), groupName: "jira-users", inactive: true, startAt: 0, @@ -837,7 +837,7 @@ func Test_internalGroupServiceImpl_Members(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), groupName: "jira-users", inactive: true, startAt: 0, @@ -868,7 +868,7 @@ func Test_internalGroupServiceImpl_Members(t *testing.T) { name: "when the group name is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), groupName: "", inactive: true, startAt: 0, @@ -885,7 +885,7 @@ func Test_internalGroupServiceImpl_Members(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), groupName: "jira-users", inactive: true, startAt: 0, diff --git a/jira/internal/issue_impl_adf_test.go b/jira/internal/issue_impl_adf_test.go index dd0fbc4c..0ff9e116 100644 --- a/jira/internal/issue_impl_adf_test.go +++ b/jira/internal/issue_impl_adf_test.go @@ -36,7 +36,7 @@ func Test_internalIssueADFServiceImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", deleteSubTasks: true, }, @@ -65,7 +65,7 @@ func Test_internalIssueADFServiceImpl_Delete(t *testing.T) { name: "when the issue issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", deleteSubTasks: true, }, @@ -80,7 +80,7 @@ func Test_internalIssueADFServiceImpl_Delete(t *testing.T) { name: "when the request method cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", deleteSubTasks: true, }, @@ -157,7 +157,7 @@ func Test_internalIssueADFServiceImpl_Assign(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", accountId: "account-id-sample", }, @@ -186,7 +186,7 @@ func Test_internalIssueADFServiceImpl_Assign(t *testing.T) { name: "when the issue issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", accountId: "account-id-sample", }, @@ -201,7 +201,7 @@ func Test_internalIssueADFServiceImpl_Assign(t *testing.T) { name: "when the account id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", accountId: "", }, @@ -216,7 +216,7 @@ func Test_internalIssueADFServiceImpl_Assign(t *testing.T) { name: "when the request method cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", accountId: "account-id-sample", }, @@ -303,7 +303,7 @@ func Test_internalIssueADFServiceImpl_Notify(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", options: optionsMocked, }, @@ -332,7 +332,7 @@ func Test_internalIssueADFServiceImpl_Notify(t *testing.T) { name: "when the issue issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", }, on: func(fields *fields) { @@ -346,7 +346,7 @@ func Test_internalIssueADFServiceImpl_Notify(t *testing.T) { name: "when the request method cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", options: optionsMocked, }, @@ -423,7 +423,7 @@ func Test_internalIssueADFServiceImpl_Transitions(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", }, on: func(fields *fields) { @@ -451,7 +451,7 @@ func Test_internalIssueADFServiceImpl_Transitions(t *testing.T) { name: "when the issue issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", }, on: func(fields *fields) { @@ -465,7 +465,7 @@ func Test_internalIssueADFServiceImpl_Transitions(t *testing.T) { name: "when the request method cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", }, on: func(fields *fields) { @@ -573,7 +573,7 @@ func Test_internalIssueADFServiceImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, customFields: customFieldsMocked, }, @@ -602,7 +602,7 @@ func Test_internalIssueADFServiceImpl_Create(t *testing.T) { name: "when the customfield are not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, customFields: nil, }, @@ -631,7 +631,7 @@ func Test_internalIssueADFServiceImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, customFields: customFieldsMocked, }, @@ -768,7 +768,7 @@ func Test_internalIssueADFServiceImpl_Creates(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -796,7 +796,7 @@ func Test_internalIssueADFServiceImpl_Creates(t *testing.T) { name: "when the payload is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: nil, }, on: func(fields *fields) { @@ -810,7 +810,7 @@ func Test_internalIssueADFServiceImpl_Creates(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -901,7 +901,7 @@ func Test_internalIssueADFServiceImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", fields: []string{"summary", "status"}, expand: []string{"operations", "changelogts"}, @@ -931,7 +931,7 @@ func Test_internalIssueADFServiceImpl_Get(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", fields: []string{"summary", "status"}, expand: []string{"operations", "changelogts"}, @@ -947,7 +947,7 @@ func Test_internalIssueADFServiceImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", fields: []string{"summary", "status"}, expand: []string{"operations", "changelogts"}, @@ -1088,7 +1088,7 @@ func Test_internalIssueADFServiceImpl_Move(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", transitionId: "10001", options: &model.IssueMoveOptionsV3{ @@ -1128,7 +1128,7 @@ func Test_internalIssueADFServiceImpl_Move(t *testing.T) { name: "when the options are provided and the fields are not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", transitionId: "10001", options: &model.IssueMoveOptionsV3{ @@ -1144,7 +1144,7 @@ func Test_internalIssueADFServiceImpl_Move(t *testing.T) { name: "when the operations are not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", transitionId: "10001", options: &model.IssueMoveOptionsV3{ @@ -1184,7 +1184,7 @@ func Test_internalIssueADFServiceImpl_Move(t *testing.T) { name: "when the custom fields are not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", transitionId: "10001", options: &model.IssueMoveOptionsV3{ @@ -1224,7 +1224,7 @@ func Test_internalIssueADFServiceImpl_Move(t *testing.T) { name: "when the the issue comment options are not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", transitionId: "10001", options: nil, @@ -1254,7 +1254,7 @@ func Test_internalIssueADFServiceImpl_Move(t *testing.T) { name: "when the issue key is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", transitionId: "10001", options: &model.IssueMoveOptionsV3{ @@ -1280,7 +1280,7 @@ func Test_internalIssueADFServiceImpl_Move(t *testing.T) { name: "when the transition id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", transitionId: "", options: &model.IssueMoveOptionsV3{ @@ -1306,7 +1306,7 @@ func Test_internalIssueADFServiceImpl_Move(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", transitionId: "10001", options: &model.IssueMoveOptionsV3{ @@ -1443,7 +1443,7 @@ func Test_internalIssueADFServiceImpl_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", notify: true, payload: &model.IssueScheme{ @@ -1479,7 +1479,7 @@ func Test_internalIssueADFServiceImpl_Update(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", notify: true, payload: &model.IssueScheme{ @@ -1501,7 +1501,7 @@ func Test_internalIssueADFServiceImpl_Update(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", notify: true, payload: &model.IssueScheme{ @@ -1534,7 +1534,7 @@ func Test_internalIssueADFServiceImpl_Update(t *testing.T) { name: "when the operations are not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", notify: true, payload: &model.IssueScheme{ @@ -1570,7 +1570,7 @@ func Test_internalIssueADFServiceImpl_Update(t *testing.T) { name: "when the custom fields are not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", notify: true, payload: &model.IssueScheme{ @@ -1606,7 +1606,7 @@ func Test_internalIssueADFServiceImpl_Update(t *testing.T) { name: "when the operations are customfields are not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", notify: true, payload: &model.IssueScheme{ diff --git a/jira/internal/issue_impl_rich_text_test.go b/jira/internal/issue_impl_rich_text_test.go index 843328ba..41209f9d 100644 --- a/jira/internal/issue_impl_rich_text_test.go +++ b/jira/internal/issue_impl_rich_text_test.go @@ -36,7 +36,7 @@ func Test_internalRichTextServiceImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", deleteSubTasks: true, }, @@ -65,7 +65,7 @@ func Test_internalRichTextServiceImpl_Delete(t *testing.T) { name: "when the issue issue key or id is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", deleteSubTasks: true, }, @@ -80,7 +80,7 @@ func Test_internalRichTextServiceImpl_Delete(t *testing.T) { name: "when the request method cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", deleteSubTasks: true, }, @@ -157,7 +157,7 @@ func Test_internalRichTextServiceImpl_Assign(t *testing.T) { name: "when the api version is v3", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", accountId: "account-id-sample", }, @@ -186,7 +186,7 @@ func Test_internalRichTextServiceImpl_Assign(t *testing.T) { name: "when the issue issue key or id is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", accountId: "account-id-sample", }, @@ -201,7 +201,7 @@ func Test_internalRichTextServiceImpl_Assign(t *testing.T) { name: "when the account id is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", accountId: "", }, @@ -216,7 +216,7 @@ func Test_internalRichTextServiceImpl_Assign(t *testing.T) { name: "when the request method cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", accountId: "account-id-sample", }, @@ -303,7 +303,7 @@ func Test_internalRichTextServiceImpl_Notify(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", options: optionsMocked, }, @@ -332,7 +332,7 @@ func Test_internalRichTextServiceImpl_Notify(t *testing.T) { name: "when the issue issue key or id is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", }, on: func(fields *fields) { @@ -346,7 +346,7 @@ func Test_internalRichTextServiceImpl_Notify(t *testing.T) { name: "when the request method cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", options: optionsMocked, }, @@ -423,7 +423,7 @@ func Test_internalRichTextServiceImpl_Transitions(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", }, on: func(fields *fields) { @@ -451,7 +451,7 @@ func Test_internalRichTextServiceImpl_Transitions(t *testing.T) { name: "when the issue issue key or id is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", }, on: func(fields *fields) { @@ -465,7 +465,7 @@ func Test_internalRichTextServiceImpl_Transitions(t *testing.T) { name: "when the request method cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", }, on: func(fields *fields) { @@ -573,7 +573,7 @@ func Test_internalRichTextServiceImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, customFields: customFieldsMocked, }, @@ -602,7 +602,7 @@ func Test_internalRichTextServiceImpl_Create(t *testing.T) { name: "when the customfield are not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, customFields: nil, }, @@ -631,7 +631,7 @@ func Test_internalRichTextServiceImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, customFields: customFieldsMocked, }, @@ -768,7 +768,7 @@ func Test_internalRichTextServiceImpl_Creates(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -796,7 +796,7 @@ func Test_internalRichTextServiceImpl_Creates(t *testing.T) { name: "when the payload is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: nil, }, on: func(fields *fields) { @@ -810,7 +810,7 @@ func Test_internalRichTextServiceImpl_Creates(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -901,7 +901,7 @@ func Test_internalRichTextServiceImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", fields: []string{"summary", "status"}, expand: []string{"operations", "changelogts"}, @@ -931,7 +931,7 @@ func Test_internalRichTextServiceImpl_Get(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", fields: []string{"summary", "status"}, expand: []string{"operations", "changelogts"}, @@ -947,7 +947,7 @@ func Test_internalRichTextServiceImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", fields: []string{"summary", "status"}, expand: []string{"operations", "changelogts"}, @@ -1087,7 +1087,7 @@ func Test_internalRichTextServiceImpl_Move(t *testing.T) { name: "when the api version is v3", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", transitionId: "10001", options: &model.IssueMoveOptionsV2{ @@ -1127,7 +1127,7 @@ func Test_internalRichTextServiceImpl_Move(t *testing.T) { name: "when the options are provided and the fields are not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", transitionId: "10001", options: &model.IssueMoveOptionsV2{ @@ -1143,7 +1143,7 @@ func Test_internalRichTextServiceImpl_Move(t *testing.T) { name: "when the operations are not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", transitionId: "10001", options: &model.IssueMoveOptionsV2{ @@ -1183,7 +1183,7 @@ func Test_internalRichTextServiceImpl_Move(t *testing.T) { name: "when the custom fields are not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", transitionId: "10001", options: &model.IssueMoveOptionsV2{ @@ -1223,7 +1223,7 @@ func Test_internalRichTextServiceImpl_Move(t *testing.T) { name: "when the the issue comment options are not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", transitionId: "10001", options: nil, @@ -1253,7 +1253,7 @@ func Test_internalRichTextServiceImpl_Move(t *testing.T) { name: "when the issue key is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", transitionId: "10001", options: &model.IssueMoveOptionsV2{ @@ -1279,7 +1279,7 @@ func Test_internalRichTextServiceImpl_Move(t *testing.T) { name: "when the transition id is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", transitionId: "", options: &model.IssueMoveOptionsV2{ @@ -1305,7 +1305,7 @@ func Test_internalRichTextServiceImpl_Move(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", transitionId: "10001", options: &model.IssueMoveOptionsV2{ @@ -1442,7 +1442,7 @@ func Test_internalRichTextServiceImpl_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", notify: true, payload: &model.IssueSchemeV2{ @@ -1478,7 +1478,7 @@ func Test_internalRichTextServiceImpl_Update(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", notify: true, payload: &model.IssueSchemeV2{ @@ -1500,7 +1500,7 @@ func Test_internalRichTextServiceImpl_Update(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", notify: true, payload: &model.IssueSchemeV2{ @@ -1533,7 +1533,7 @@ func Test_internalRichTextServiceImpl_Update(t *testing.T) { name: "when the operations are not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", notify: true, payload: &model.IssueSchemeV2{ @@ -1569,7 +1569,7 @@ func Test_internalRichTextServiceImpl_Update(t *testing.T) { name: "when the custom fields are not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", notify: true, payload: &model.IssueSchemeV2{ @@ -1605,7 +1605,7 @@ func Test_internalRichTextServiceImpl_Update(t *testing.T) { name: "when the operations are customfields are not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-1", notify: true, payload: &model.IssueSchemeV2{ diff --git a/jira/internal/issue_property_impl_test.go b/jira/internal/issue_property_impl_test.go index 13a9645c..1615b1f5 100644 --- a/jira/internal/issue_property_impl_test.go +++ b/jira/internal/issue_property_impl_test.go @@ -93,7 +93,7 @@ func Test_internalIssuePropertyImpl_Gets(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoIssueKeyOrIDError, diff --git a/jira/internal/jql_impl_test.go b/jira/internal/jql_impl_test.go index 7dd00910..a8dc5798 100644 --- a/jira/internal/jql_impl_test.go +++ b/jira/internal/jql_impl_test.go @@ -46,7 +46,7 @@ func Test_internalJQLServiceImpl_Parse(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), validationType: "strict", JqlQueries: []string{ "summary ~ test AND (labels in (urgent, blocker) OR lastCommentedBy = currentUser()) AND status CHANGED AFTER startOfMonth(-1M) ORDER BY updated DESC", @@ -83,7 +83,7 @@ func Test_internalJQLServiceImpl_Parse(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), validationType: "strict", JqlQueries: []string{ "summary ~ test AND (labels in (urgent, blocker) OR lastCommentedBy = currentUser()) AND status CHANGED AFTER startOfMonth(-1M) ORDER BY updated DESC", @@ -120,7 +120,7 @@ func Test_internalJQLServiceImpl_Parse(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), validationType: "strict", JqlQueries: []string{ "summary ~ test AND (labels in (urgent, blocker) OR lastCommentedBy = currentUser()) AND status CHANGED AFTER startOfMonth(-1M) ORDER BY updated DESC", diff --git a/jira/internal/label_impl_test.go b/jira/internal/label_impl_test.go index e3cd0a14..1108c355 100644 --- a/jira/internal/label_impl_test.go +++ b/jira/internal/label_impl_test.go @@ -35,7 +35,7 @@ func Test_internalLabelServiceImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), startAt: 50, maxResults: 50, }, @@ -66,7 +66,7 @@ func Test_internalLabelServiceImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), startAt: 50, maxResults: 50, }, @@ -97,7 +97,7 @@ func Test_internalLabelServiceImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), startAt: 50, maxResults: 50, }, diff --git a/jira/internal/link_impl_adf_test.go b/jira/internal/link_impl_adf_test.go index df4eae3c..c3464699 100644 --- a/jira/internal/link_impl_adf_test.go +++ b/jira/internal/link_impl_adf_test.go @@ -35,7 +35,7 @@ func Test_internalLinkADFServiceImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), linkId: "10002", }, on: func(fields *fields) { @@ -65,7 +65,7 @@ func Test_internalLinkADFServiceImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), linkId: "10002", }, on: func(fields *fields) { @@ -95,7 +95,7 @@ func Test_internalLinkADFServiceImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), linkId: "10002", }, on: func(fields *fields) { @@ -120,7 +120,7 @@ func Test_internalLinkADFServiceImpl_Get(t *testing.T) { name: "when the issue link is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), linkId: "", }, wantErr: true, @@ -183,7 +183,7 @@ func Test_internalLinkADFServiceImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-4", }, on: func(fields *fields) { @@ -213,7 +213,7 @@ func Test_internalLinkADFServiceImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-4", }, on: func(fields *fields) { @@ -243,7 +243,7 @@ func Test_internalLinkADFServiceImpl_Gets(t *testing.T) { name: "when the issue key is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", }, wantErr: true, @@ -254,7 +254,7 @@ func Test_internalLinkADFServiceImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-4", }, on: func(fields *fields) { @@ -331,7 +331,7 @@ func Test_internalLinkADFServiceImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), linkId: "10002", }, on: func(fields *fields) { @@ -361,7 +361,7 @@ func Test_internalLinkADFServiceImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), linkId: "10002", }, on: func(fields *fields) { @@ -391,7 +391,7 @@ func Test_internalLinkADFServiceImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), linkId: "10002", }, on: func(fields *fields) { @@ -416,7 +416,7 @@ func Test_internalLinkADFServiceImpl_Delete(t *testing.T) { name: "when the issue link is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), linkId: "", }, wantErr: true, @@ -515,7 +515,7 @@ func Test_internalLinkADFServiceImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -545,7 +545,7 @@ func Test_internalLinkADFServiceImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -575,7 +575,7 @@ func Test_internalLinkADFServiceImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { diff --git a/jira/internal/link_impl_rich_text_test.go b/jira/internal/link_impl_rich_text_test.go index d444e93b..da895ee8 100644 --- a/jira/internal/link_impl_rich_text_test.go +++ b/jira/internal/link_impl_rich_text_test.go @@ -35,7 +35,7 @@ func Test_internalLinkRichTextServiceImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), linkId: "10002", }, on: func(fields *fields) { @@ -65,7 +65,7 @@ func Test_internalLinkRichTextServiceImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), linkId: "10002", }, on: func(fields *fields) { @@ -95,7 +95,7 @@ func Test_internalLinkRichTextServiceImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), linkId: "10002", }, on: func(fields *fields) { @@ -120,7 +120,7 @@ func Test_internalLinkRichTextServiceImpl_Get(t *testing.T) { name: "when the issue link is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), linkId: "", }, wantErr: true, @@ -183,7 +183,7 @@ func Test_internalLinkRichTextServiceImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-4", }, on: func(fields *fields) { @@ -213,7 +213,7 @@ func Test_internalLinkRichTextServiceImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-4", }, on: func(fields *fields) { @@ -243,7 +243,7 @@ func Test_internalLinkRichTextServiceImpl_Gets(t *testing.T) { name: "when the issue key is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", }, wantErr: true, @@ -254,7 +254,7 @@ func Test_internalLinkRichTextServiceImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-4", }, on: func(fields *fields) { @@ -331,7 +331,7 @@ func Test_internalLinkRichTextServiceImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), linkId: "10002", }, on: func(fields *fields) { @@ -361,7 +361,7 @@ func Test_internalLinkRichTextServiceImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), linkId: "10002", }, on: func(fields *fields) { @@ -391,7 +391,7 @@ func Test_internalLinkRichTextServiceImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), linkId: "10002", }, on: func(fields *fields) { @@ -416,7 +416,7 @@ func Test_internalLinkRichTextServiceImpl_Delete(t *testing.T) { name: "when the issue link is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), linkId: "", }, wantErr: true, @@ -493,7 +493,7 @@ func Test_internalLinkRichTextServiceImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -523,7 +523,7 @@ func Test_internalLinkRichTextServiceImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -553,7 +553,7 @@ func Test_internalLinkRichTextServiceImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { diff --git a/jira/internal/link_type_impl_test.go b/jira/internal/link_type_impl_test.go index 35b3e969..f620b069 100644 --- a/jira/internal/link_type_impl_test.go +++ b/jira/internal/link_type_impl_test.go @@ -34,7 +34,7 @@ func Test_internalLinkTypeImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -63,7 +63,7 @@ func Test_internalLinkTypeImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -92,7 +92,7 @@ func Test_internalLinkTypeImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -168,7 +168,7 @@ func Test_internalLinkTypeImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueLinkTypeId: "1002", }, on: func(fields *fields) { @@ -198,7 +198,7 @@ func Test_internalLinkTypeImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueLinkTypeId: "1002", }, on: func(fields *fields) { @@ -228,7 +228,7 @@ func Test_internalLinkTypeImpl_Get(t *testing.T) { name: "when the issue link type id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueLinkTypeId: "", }, wantErr: true, @@ -239,7 +239,7 @@ func Test_internalLinkTypeImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueLinkTypeId: "1002", }, on: func(fields *fields) { @@ -323,7 +323,7 @@ func Test_internalLinkTypeImpl_Update(t *testing.T) { name: "when the issue link type id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueLinkTypeId: "", }, wantErr: true, @@ -333,7 +333,7 @@ func Test_internalLinkTypeImpl_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueLinkTypeId: "1002", payload: payloadMocked, }, @@ -364,7 +364,7 @@ func Test_internalLinkTypeImpl_Update(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueLinkTypeId: "1002", payload: payloadMocked, }, @@ -395,7 +395,7 @@ func Test_internalLinkTypeImpl_Update(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueLinkTypeId: "1002", payload: payloadMocked, }, @@ -479,7 +479,7 @@ func Test_internalLinkTypeImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -509,7 +509,7 @@ func Test_internalLinkTypeImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -539,7 +539,7 @@ func Test_internalLinkTypeImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -616,7 +616,7 @@ func Test_internalLinkTypeImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueLinkTypeId: "1002", }, on: func(fields *fields) { @@ -646,7 +646,7 @@ func Test_internalLinkTypeImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueLinkTypeId: "1002", }, on: func(fields *fields) { @@ -676,7 +676,7 @@ func Test_internalLinkTypeImpl_Delete(t *testing.T) { name: "when the issue link type id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueLinkTypeId: "", }, wantErr: true, @@ -687,7 +687,7 @@ func Test_internalLinkTypeImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueLinkTypeId: "1002", }, on: func(fields *fields) { diff --git a/jira/internal/metadata_impl_test.go b/jira/internal/metadata_impl_test.go index 17f8a1d1..d5515c97 100644 --- a/jira/internal/metadata_impl_test.go +++ b/jira/internal/metadata_impl_test.go @@ -39,7 +39,7 @@ func Test_internalMetadataImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-4", overrideScreenSecurity: true, overrideEditableFlag: false, @@ -71,7 +71,7 @@ func Test_internalMetadataImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-4", overrideScreenSecurity: true, overrideEditableFlag: false, @@ -103,7 +103,7 @@ func Test_internalMetadataImpl_Get(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", overrideScreenSecurity: true, overrideEditableFlag: false, @@ -117,7 +117,7 @@ func Test_internalMetadataImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-4", overrideScreenSecurity: true, overrideEditableFlag: false, @@ -199,7 +199,7 @@ func Test_internalMetadataImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), opts: &model.IssueMetadataCreateOptions{ ProjectIDs: []string{"1002"}, ProjectKeys: []string{"DUMMY"}, @@ -235,7 +235,7 @@ func Test_internalMetadataImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), opts: &model.IssueMetadataCreateOptions{ ProjectIDs: []string{"1002"}, ProjectKeys: []string{"DUMMY"}, @@ -271,7 +271,7 @@ func Test_internalMetadataImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), opts: &model.IssueMetadataCreateOptions{ ProjectIDs: []string{"1002"}, ProjectKeys: []string{"DUMMY"}, diff --git a/jira/internal/myself_impl_test.go b/jira/internal/myself_impl_test.go index d5ef0307..e90a2006 100644 --- a/jira/internal/myself_impl_test.go +++ b/jira/internal/myself_impl_test.go @@ -35,7 +35,7 @@ func Test_internalMySelfImpl_Details(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), expand: []string{"groups", "applicationRoles"}, }, on: func(fields *fields) { @@ -64,7 +64,7 @@ func Test_internalMySelfImpl_Details(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), expand: []string{"groups", "applicationRoles"}, }, on: func(fields *fields) { @@ -93,7 +93,7 @@ func Test_internalMySelfImpl_Details(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), expand: []string{"groups", "applicationRoles"}, }, on: func(fields *fields) { diff --git a/jira/internal/notification_scheme_impl_test.go b/jira/internal/notification_scheme_impl_test.go index 892dd2b6..c4866f2a 100644 --- a/jira/internal/notification_scheme_impl_test.go +++ b/jira/internal/notification_scheme_impl_test.go @@ -36,7 +36,7 @@ func Test_internalNotificationSchemeImpl_Search(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.NotificationSchemeSearchOptions{ NotificationSchemeIDs: []string{"1000", "1001"}, ProjectIDs: []string{"50001", "50002"}, @@ -72,7 +72,7 @@ func Test_internalNotificationSchemeImpl_Search(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.NotificationSchemeSearchOptions{ NotificationSchemeIDs: []string{"1000", "1001"}, ProjectIDs: []string{"50001", "50002"}, @@ -108,7 +108,7 @@ func Test_internalNotificationSchemeImpl_Search(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.NotificationSchemeSearchOptions{ NotificationSchemeIDs: []string{"1000", "1001"}, ProjectIDs: []string{"50001", "50002"}, @@ -193,7 +193,7 @@ func Test_internalNotificationSchemeImpl_Projects(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeIDs: []string{"scheme-id"}, projectIDs: []string{"10001"}, startAt: 100, @@ -225,7 +225,7 @@ func Test_internalNotificationSchemeImpl_Projects(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeIDs: []string{"scheme-id"}, projectIDs: []string{"10001"}, startAt: 100, @@ -257,7 +257,7 @@ func Test_internalNotificationSchemeImpl_Projects(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeIDs: []string{"scheme-id"}, projectIDs: []string{"10001"}, startAt: 100, @@ -339,7 +339,7 @@ func Test_internalNotificationSchemeImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: "10001", expand: []string{"all"}, }, @@ -369,7 +369,7 @@ func Test_internalNotificationSchemeImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: "10001", expand: []string{"all"}, }, @@ -399,7 +399,7 @@ func Test_internalNotificationSchemeImpl_Get(t *testing.T) { name: "when the notification scheme is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoNotificationSchemeIDError, @@ -409,7 +409,7 @@ func Test_internalNotificationSchemeImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: "10001", expand: []string{"all"}, }, @@ -492,7 +492,7 @@ func Test_internalNotificationSchemeImpl_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: "10001", payload: payloadMocked, }, @@ -522,7 +522,7 @@ func Test_internalNotificationSchemeImpl_Update(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: "10001", payload: payloadMocked, }, @@ -552,7 +552,7 @@ func Test_internalNotificationSchemeImpl_Update(t *testing.T) { name: "when the notification scheme is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoNotificationSchemeIDError, @@ -562,7 +562,7 @@ func Test_internalNotificationSchemeImpl_Update(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: "10001", payload: payloadMocked, }, @@ -655,7 +655,7 @@ func Test_internalNotificationSchemeImpl_Append(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: "10001", payload: payloadMocked, }, @@ -685,7 +685,7 @@ func Test_internalNotificationSchemeImpl_Append(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: "10001", payload: payloadMocked, }, @@ -715,7 +715,7 @@ func Test_internalNotificationSchemeImpl_Append(t *testing.T) { name: "when the notification scheme is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoNotificationSchemeIDError, @@ -725,7 +725,7 @@ func Test_internalNotificationSchemeImpl_Append(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: "10001", payload: payloadMocked, }, @@ -802,7 +802,7 @@ func Test_internalNotificationSchemeImpl_Remove(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: "10001", notificationID: "10001", }, @@ -832,7 +832,7 @@ func Test_internalNotificationSchemeImpl_Remove(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: "10001", notificationID: "10001", }, @@ -862,7 +862,7 @@ func Test_internalNotificationSchemeImpl_Remove(t *testing.T) { name: "when the notification scheme is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoNotificationSchemeIDError, @@ -872,7 +872,7 @@ func Test_internalNotificationSchemeImpl_Remove(t *testing.T) { name: "when the notification id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: "10001", }, wantErr: true, @@ -883,7 +883,7 @@ func Test_internalNotificationSchemeImpl_Remove(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: "10001", notificationID: "10001", }, @@ -959,7 +959,7 @@ func Test_internalNotificationSchemeImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: "10001", }, on: func(fields *fields) { @@ -988,7 +988,7 @@ func Test_internalNotificationSchemeImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: "10001", }, on: func(fields *fields) { @@ -1017,7 +1017,7 @@ func Test_internalNotificationSchemeImpl_Delete(t *testing.T) { name: "when the notification scheme is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoNotificationSchemeIDError, @@ -1027,7 +1027,7 @@ func Test_internalNotificationSchemeImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: "10001", }, on: func(fields *fields) { @@ -1120,7 +1120,7 @@ func Test_internalNotificationSchemeImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -1149,7 +1149,7 @@ func Test_internalNotificationSchemeImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -1178,7 +1178,7 @@ func Test_internalNotificationSchemeImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { diff --git a/jira/internal/permission_impl_test.go b/jira/internal/permission_impl_test.go index 4d538d20..eee3e103 100644 --- a/jira/internal/permission_impl_test.go +++ b/jira/internal/permission_impl_test.go @@ -50,7 +50,7 @@ func Test_internalPermissionImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -79,7 +79,7 @@ func Test_internalPermissionImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -108,7 +108,7 @@ func Test_internalPermissionImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -132,7 +132,7 @@ func Test_internalPermissionImpl_Gets(t *testing.T) { name: "when the response cannot be parsed", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -238,7 +238,7 @@ func Test_internalPermissionImpl_Checks(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -268,7 +268,7 @@ func Test_internalPermissionImpl_Checks(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -298,7 +298,7 @@ func Test_internalPermissionImpl_Checks(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -377,7 +377,7 @@ func Test_internalPermissionImpl_Projects(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissions: []string{"EDIT_ISSUES", "CREATE_ISSUES"}, }, on: func(fields *fields) { @@ -407,7 +407,7 @@ func Test_internalPermissionImpl_Projects(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissions: []string{"EDIT_ISSUES", "CREATE_ISSUES"}, }, on: func(fields *fields) { @@ -437,7 +437,7 @@ func Test_internalPermissionImpl_Projects(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissions: []string{"EDIT_ISSUES", "CREATE_ISSUES"}, }, on: func(fields *fields) { @@ -462,7 +462,7 @@ func Test_internalPermissionImpl_Projects(t *testing.T) { name: "when the permission keys are not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoPermissionKeysError, diff --git a/jira/internal/permission_scheme_grant_impl_test.go b/jira/internal/permission_scheme_grant_impl_test.go index 16b16c07..17a8bd72 100644 --- a/jira/internal/permission_scheme_grant_impl_test.go +++ b/jira/internal/permission_scheme_grant_impl_test.go @@ -44,7 +44,7 @@ func TestPermissionSchemeGrantService_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissionSchemeId: 10001, payload: payloadMocked, }, @@ -74,7 +74,7 @@ func TestPermissionSchemeGrantService_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissionSchemeId: 10001, payload: payloadMocked, }, @@ -104,7 +104,7 @@ func TestPermissionSchemeGrantService_Create(t *testing.T) { name: "when the permission scheme id is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoPermissionSchemeIDError, @@ -114,7 +114,7 @@ func TestPermissionSchemeGrantService_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissionSchemeId: 10001, payload: payloadMocked, }, @@ -192,7 +192,7 @@ func TestPermissionSchemeGrantService_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissionSchemeId: 10001, expand: []string{"all"}, }, @@ -222,7 +222,7 @@ func TestPermissionSchemeGrantService_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissionSchemeId: 10001, expand: []string{"all"}, }, @@ -252,7 +252,7 @@ func TestPermissionSchemeGrantService_Gets(t *testing.T) { name: "when the permission scheme id is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoPermissionSchemeIDError, @@ -262,7 +262,7 @@ func TestPermissionSchemeGrantService_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissionSchemeId: 10001, expand: []string{"all"}, }, @@ -341,7 +341,7 @@ func TestPermissionSchemeGrantService_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissionSchemeId: 10001, permissionGrantId: 30092, expand: []string{"all"}, @@ -372,7 +372,7 @@ func TestPermissionSchemeGrantService_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissionSchemeId: 10001, permissionGrantId: 30092, expand: []string{"all"}, @@ -403,7 +403,7 @@ func TestPermissionSchemeGrantService_Get(t *testing.T) { name: "when the permission scheme id is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoPermissionSchemeIDError, @@ -413,7 +413,7 @@ func TestPermissionSchemeGrantService_Get(t *testing.T) { name: "when the permission scheme grant id is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissionSchemeId: 10001, }, wantErr: true, @@ -424,7 +424,7 @@ func TestPermissionSchemeGrantService_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissionSchemeId: 10001, permissionGrantId: 30092, expand: []string{"all"}, @@ -504,7 +504,7 @@ func TestPermissionSchemeGrantService_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissionSchemeId: 10001, permissionGrantId: 30092, }, @@ -534,7 +534,7 @@ func TestPermissionSchemeGrantService_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissionSchemeId: 10001, permissionGrantId: 30092, }, @@ -564,7 +564,7 @@ func TestPermissionSchemeGrantService_Delete(t *testing.T) { name: "when the permission scheme id is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoPermissionSchemeIDError, @@ -574,7 +574,7 @@ func TestPermissionSchemeGrantService_Delete(t *testing.T) { name: "when the permission scheme grant id is not provided", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissionSchemeId: 10001, }, wantErr: true, @@ -585,7 +585,7 @@ func TestPermissionSchemeGrantService_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissionSchemeId: 10001, permissionGrantId: 30092, }, diff --git a/jira/internal/permission_scheme_impl_test.go b/jira/internal/permission_scheme_impl_test.go index 554c7e97..6f8007cb 100644 --- a/jira/internal/permission_scheme_impl_test.go +++ b/jira/internal/permission_scheme_impl_test.go @@ -34,7 +34,7 @@ func TestPermissionSchemeService_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -62,7 +62,7 @@ func TestPermissionSchemeService_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -90,7 +90,7 @@ func TestPermissionSchemeService_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -166,7 +166,7 @@ func TestPermissionSchemeService_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissionSchemeId: 10001, expand: []string{"all"}, }, @@ -196,7 +196,7 @@ func TestPermissionSchemeService_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissionSchemeId: 10001, expand: []string{"all"}, }, @@ -226,7 +226,7 @@ func TestPermissionSchemeService_Get(t *testing.T) { name: "when the permission scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoPermissionSchemeIDError, @@ -236,7 +236,7 @@ func TestPermissionSchemeService_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissionSchemeId: 10001, expand: []string{"all"}, }, @@ -313,7 +313,7 @@ func TestPermissionSchemeService_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissionSchemeId: 10001, }, on: func(fields *fields) { @@ -342,7 +342,7 @@ func TestPermissionSchemeService_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissionSchemeId: 10001, }, on: func(fields *fields) { @@ -371,7 +371,7 @@ func TestPermissionSchemeService_Delete(t *testing.T) { name: "when the permission scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoPermissionSchemeIDError, @@ -381,7 +381,7 @@ func TestPermissionSchemeService_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissionSchemeId: 10001, }, on: func(fields *fields) { @@ -477,7 +477,7 @@ func TestPermissionSchemeService_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -506,7 +506,7 @@ func TestPermissionSchemeService_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -535,7 +535,7 @@ func TestPermissionSchemeService_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -633,7 +633,7 @@ func TestPermissionSchemeService_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissionSchemeId: 10001, payload: payloadMocked, }, @@ -663,7 +663,7 @@ func TestPermissionSchemeService_Update(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissionSchemeId: 10001, payload: payloadMocked, }, @@ -693,7 +693,7 @@ func TestPermissionSchemeService_Update(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permissionSchemeId: 10001, payload: payloadMocked, }, diff --git a/jira/internal/priority_impl_test.go b/jira/internal/priority_impl_test.go index e5fb208c..0d41ed1c 100644 --- a/jira/internal/priority_impl_test.go +++ b/jira/internal/priority_impl_test.go @@ -35,7 +35,7 @@ func Test_internalPriorityImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -63,7 +63,7 @@ func Test_internalPriorityImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -91,7 +91,7 @@ func Test_internalPriorityImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -166,7 +166,7 @@ func Test_internalPriorityImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), priorityId: "2", }, on: func(fields *fields) { @@ -195,7 +195,7 @@ func Test_internalPriorityImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), priorityId: "2", }, on: func(fields *fields) { @@ -224,7 +224,7 @@ func Test_internalPriorityImpl_Get(t *testing.T) { name: "when the priority id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoPriorityIDError, @@ -234,7 +234,7 @@ func Test_internalPriorityImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), priorityId: "2", }, on: func(fields *fields) { diff --git a/jira/internal/project_category_impl_test.go b/jira/internal/project_category_impl_test.go index 3a645f09..9ce0307a 100644 --- a/jira/internal/project_category_impl_test.go +++ b/jira/internal/project_category_impl_test.go @@ -35,7 +35,7 @@ func Test_internalProjectCategoryImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -63,7 +63,7 @@ func Test_internalProjectCategoryImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -91,7 +91,7 @@ func Test_internalProjectCategoryImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -166,7 +166,7 @@ func Test_internalProjectCategoryImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), categoryId: 10001, }, on: func(fields *fields) { @@ -195,7 +195,7 @@ func Test_internalProjectCategoryImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), categoryId: 10001, }, on: func(fields *fields) { @@ -224,7 +224,7 @@ func Test_internalProjectCategoryImpl_Get(t *testing.T) { name: "when the project category id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectCategoryIDError, @@ -234,7 +234,7 @@ func Test_internalProjectCategoryImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), categoryId: 10001, }, on: func(fields *fields) { @@ -315,7 +315,7 @@ func Test_internalProjectCategoryImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -344,7 +344,7 @@ func Test_internalProjectCategoryImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -373,7 +373,7 @@ func Test_internalProjectCategoryImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -455,7 +455,7 @@ func Test_internalProjectCategoryImpl_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), categoryId: 10001, payload: payloadMocked, }, @@ -485,7 +485,7 @@ func Test_internalProjectCategoryImpl_Update(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), categoryId: 10001, payload: payloadMocked, }, @@ -515,7 +515,7 @@ func Test_internalProjectCategoryImpl_Update(t *testing.T) { name: "when the project category id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectCategoryIDError, @@ -525,7 +525,7 @@ func Test_internalProjectCategoryImpl_Update(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), categoryId: 10001, payload: payloadMocked, }, @@ -602,7 +602,7 @@ func Test_internalProjectCategoryImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), categoryId: 10001, }, on: func(fields *fields) { @@ -631,7 +631,7 @@ func Test_internalProjectCategoryImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), categoryId: 10001, }, on: func(fields *fields) { @@ -660,7 +660,7 @@ func Test_internalProjectCategoryImpl_Delete(t *testing.T) { name: "when the project category id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectCategoryIDError, @@ -670,7 +670,7 @@ func Test_internalProjectCategoryImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), categoryId: 10001, }, on: func(fields *fields) { diff --git a/jira/internal/project_component_impl_test.go b/jira/internal/project_component_impl_test.go index 41b3192c..e0c8f15d 100644 --- a/jira/internal/project_component_impl_test.go +++ b/jira/internal/project_component_impl_test.go @@ -45,7 +45,7 @@ func Test_internalProjectComponentImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -74,7 +74,7 @@ func Test_internalProjectComponentImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -103,7 +103,7 @@ func Test_internalProjectComponentImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -189,7 +189,7 @@ func Test_internalProjectComponentImpl_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), componentId: "10393", payload: payloadMocked, }, @@ -219,7 +219,7 @@ func Test_internalProjectComponentImpl_Update(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), componentId: "10393", payload: payloadMocked, }, @@ -249,7 +249,7 @@ func Test_internalProjectComponentImpl_Update(t *testing.T) { name: "when the component id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoComponentIDError, @@ -259,7 +259,7 @@ func Test_internalProjectComponentImpl_Update(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), componentId: "10393", payload: payloadMocked, }, @@ -336,7 +336,7 @@ func Test_internalProjectComponentImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectIdOrKey: "DUMMY", }, on: func(fields *fields) { @@ -365,7 +365,7 @@ func Test_internalProjectComponentImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectIdOrKey: "DUMMY", }, on: func(fields *fields) { @@ -394,7 +394,7 @@ func Test_internalProjectComponentImpl_Gets(t *testing.T) { name: "when the project key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectIDOrKeyError, @@ -404,7 +404,7 @@ func Test_internalProjectComponentImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectIdOrKey: "DUMMY", }, on: func(fields *fields) { @@ -480,7 +480,7 @@ func Test_internalProjectComponentImpl_Count(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), componentId: "10001", }, on: func(fields *fields) { @@ -509,7 +509,7 @@ func Test_internalProjectComponentImpl_Count(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), componentId: "10001", }, on: func(fields *fields) { @@ -538,7 +538,7 @@ func Test_internalProjectComponentImpl_Count(t *testing.T) { name: "when the component id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoComponentIDError, @@ -548,7 +548,7 @@ func Test_internalProjectComponentImpl_Count(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), componentId: "10001", }, on: func(fields *fields) { @@ -624,7 +624,7 @@ func Test_internalProjectComponentImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), componentId: "10001", }, on: func(fields *fields) { @@ -653,7 +653,7 @@ func Test_internalProjectComponentImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), componentId: "10001", }, on: func(fields *fields) { @@ -682,7 +682,7 @@ func Test_internalProjectComponentImpl_Get(t *testing.T) { name: "when the component id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoComponentIDError, @@ -692,7 +692,7 @@ func Test_internalProjectComponentImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), componentId: "10001", }, on: func(fields *fields) { @@ -768,7 +768,7 @@ func Test_internalProjectComponentImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), componentId: "10001", }, on: func(fields *fields) { @@ -797,7 +797,7 @@ func Test_internalProjectComponentImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), componentId: "10001", }, on: func(fields *fields) { @@ -826,7 +826,7 @@ func Test_internalProjectComponentImpl_Delete(t *testing.T) { name: "when the component id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoComponentIDError, @@ -836,7 +836,7 @@ func Test_internalProjectComponentImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), componentId: "10001", }, on: func(fields *fields) { diff --git a/jira/internal/project_feature_impl_test.go b/jira/internal/project_feature_impl_test.go index 1137e44a..85a2eb9f 100644 --- a/jira/internal/project_feature_impl_test.go +++ b/jira/internal/project_feature_impl_test.go @@ -37,7 +37,7 @@ func Test_internalProjectFeatureImpl_Set(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", featureKey: "jsw.classic.roadmap", state: "ENABLED", @@ -68,7 +68,7 @@ func Test_internalProjectFeatureImpl_Set(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", featureKey: "jsw.classic.roadmap", state: "ENABLED", @@ -99,7 +99,7 @@ func Test_internalProjectFeatureImpl_Set(t *testing.T) { name: "when the project key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectIDOrKeyError, @@ -109,7 +109,7 @@ func Test_internalProjectFeatureImpl_Set(t *testing.T) { name: "when the project feature key is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", }, wantErr: true, @@ -120,7 +120,7 @@ func Test_internalProjectFeatureImpl_Set(t *testing.T) { name: "when the project feature state is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", featureKey: "jsw.classic.roadmap", }, @@ -132,7 +132,7 @@ func Test_internalProjectFeatureImpl_Set(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", featureKey: "jsw.classic.roadmap", state: "ENABLED", @@ -211,7 +211,7 @@ func Test_internalProjectFeatureImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", }, on: func(fields *fields) { @@ -240,7 +240,7 @@ func Test_internalProjectFeatureImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", }, on: func(fields *fields) { @@ -269,7 +269,7 @@ func Test_internalProjectFeatureImpl_Gets(t *testing.T) { name: "when the project key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectIDOrKeyError, @@ -279,7 +279,7 @@ func Test_internalProjectFeatureImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", }, on: func(fields *fields) { diff --git a/jira/internal/project_impl_test.go b/jira/internal/project_impl_test.go index bf544310..9a2bdbea 100644 --- a/jira/internal/project_impl_test.go +++ b/jira/internal/project_impl_test.go @@ -52,7 +52,7 @@ func Test_internalProjectImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -81,7 +81,7 @@ func Test_internalProjectImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -110,7 +110,7 @@ func Test_internalProjectImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -201,7 +201,7 @@ func Test_internalProjectImpl_Search(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: mockedParams, startAt: 0, maxResults: 50, @@ -232,7 +232,7 @@ func Test_internalProjectImpl_Search(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: mockedParams, startAt: 0, maxResults: 50, @@ -263,7 +263,7 @@ func Test_internalProjectImpl_Search(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: mockedParams, startAt: 0, maxResults: 50, @@ -343,7 +343,7 @@ func Test_internalProjectImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "KP", expand: []string{"issueTypes", "lead"}, }, @@ -373,7 +373,7 @@ func Test_internalProjectImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "KP", expand: []string{"issueTypes", "lead"}, }, @@ -403,7 +403,7 @@ func Test_internalProjectImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "KP", expand: []string{"issueTypes", "lead"}, }, @@ -496,7 +496,7 @@ func Test_internalProjectImpl_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "KP", payload: payloadMocked, }, @@ -526,7 +526,7 @@ func Test_internalProjectImpl_Update(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "KP", payload: payloadMocked, }, @@ -556,7 +556,7 @@ func Test_internalProjectImpl_Update(t *testing.T) { name: "when the project key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectIDOrKeyError, @@ -566,7 +566,7 @@ func Test_internalProjectImpl_Update(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "KP", payload: payloadMocked, }, @@ -644,7 +644,7 @@ func Test_internalProjectImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "KP", enableUndo: true, }, @@ -674,7 +674,7 @@ func Test_internalProjectImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "KP", enableUndo: true, }, @@ -704,7 +704,7 @@ func Test_internalProjectImpl_Delete(t *testing.T) { name: "when the project key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectIDOrKeyError, @@ -714,7 +714,7 @@ func Test_internalProjectImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "KP", enableUndo: true, }, @@ -790,7 +790,7 @@ func Test_internalProjectImpl_DeleteAsynchronously(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "KP", }, on: func(fields *fields) { @@ -819,7 +819,7 @@ func Test_internalProjectImpl_DeleteAsynchronously(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "KP", }, on: func(fields *fields) { @@ -848,7 +848,7 @@ func Test_internalProjectImpl_DeleteAsynchronously(t *testing.T) { name: "when the project or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectIDOrKeyError, @@ -858,7 +858,7 @@ func Test_internalProjectImpl_DeleteAsynchronously(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "KP", }, on: func(fields *fields) { @@ -934,7 +934,7 @@ func Test_internalProjectImpl_Archive(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "KP", }, on: func(fields *fields) { @@ -963,7 +963,7 @@ func Test_internalProjectImpl_Archive(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "KP", }, on: func(fields *fields) { @@ -992,7 +992,7 @@ func Test_internalProjectImpl_Archive(t *testing.T) { name: "when the project key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectIDOrKeyError, @@ -1002,7 +1002,7 @@ func Test_internalProjectImpl_Archive(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "KP", }, on: func(fields *fields) { @@ -1077,7 +1077,7 @@ func Test_internalProjectImpl_Restore(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "KP", }, on: func(fields *fields) { @@ -1106,7 +1106,7 @@ func Test_internalProjectImpl_Restore(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "KP", }, on: func(fields *fields) { @@ -1135,7 +1135,7 @@ func Test_internalProjectImpl_Restore(t *testing.T) { name: "when the project or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectIDOrKeyError, @@ -1145,7 +1145,7 @@ func Test_internalProjectImpl_Restore(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "KP", }, on: func(fields *fields) { @@ -1221,7 +1221,7 @@ func Test_internalProjectImpl_Statuses(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "KP", }, on: func(fields *fields) { @@ -1250,7 +1250,7 @@ func Test_internalProjectImpl_Statuses(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "KP", }, on: func(fields *fields) { @@ -1279,7 +1279,7 @@ func Test_internalProjectImpl_Statuses(t *testing.T) { name: "when the project or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectIDOrKeyError, @@ -1289,7 +1289,7 @@ func Test_internalProjectImpl_Statuses(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "KP", }, on: func(fields *fields) { @@ -1366,7 +1366,7 @@ func Test_internalProjectImpl_NotificationScheme(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "KP", expand: []string{"all", "projectRole"}, }, @@ -1396,7 +1396,7 @@ func Test_internalProjectImpl_NotificationScheme(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "KP", expand: []string{"all", "projectRole"}, }, @@ -1426,7 +1426,7 @@ func Test_internalProjectImpl_NotificationScheme(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "KP", expand: []string{"all", "projectRole"}, }, diff --git a/jira/internal/project_permission_scheme_impl_test.go b/jira/internal/project_permission_scheme_impl_test.go index 8cbe816a..e78d517f 100644 --- a/jira/internal/project_permission_scheme_impl_test.go +++ b/jira/internal/project_permission_scheme_impl_test.go @@ -36,7 +36,7 @@ func Test_internalProjectPermissionSchemeImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", expand: []string{"field", "group"}, }, @@ -66,7 +66,7 @@ func Test_internalProjectPermissionSchemeImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", expand: []string{"field", "group"}, }, @@ -96,7 +96,7 @@ func Test_internalProjectPermissionSchemeImpl_Get(t *testing.T) { name: "when the project key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectIDOrKeyError, @@ -106,7 +106,7 @@ func Test_internalProjectPermissionSchemeImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", expand: []string{"field", "group"}, }, @@ -183,7 +183,7 @@ func Test_internalProjectPermissionSchemeImpl_SecurityLevels(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", }, on: func(fields *fields) { @@ -212,7 +212,7 @@ func Test_internalProjectPermissionSchemeImpl_SecurityLevels(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", }, on: func(fields *fields) { @@ -241,7 +241,7 @@ func Test_internalProjectPermissionSchemeImpl_SecurityLevels(t *testing.T) { name: "when the project key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectIDOrKeyError, @@ -251,7 +251,7 @@ func Test_internalProjectPermissionSchemeImpl_SecurityLevels(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", }, on: func(fields *fields) { @@ -330,7 +330,7 @@ func Test_internalProjectPermissionSchemeImpl_Assign(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", permissionSchemeId: 10001, }, @@ -360,7 +360,7 @@ func Test_internalProjectPermissionSchemeImpl_Assign(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", permissionSchemeId: 10001, }, @@ -390,7 +390,7 @@ func Test_internalProjectPermissionSchemeImpl_Assign(t *testing.T) { name: "when the project key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectIDOrKeyError, @@ -400,7 +400,7 @@ func Test_internalProjectPermissionSchemeImpl_Assign(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", permissionSchemeId: 10001, }, diff --git a/jira/internal/project_property_impl_test.go b/jira/internal/project_property_impl_test.go index 63cd0d51..de207950 100644 --- a/jira/internal/project_property_impl_test.go +++ b/jira/internal/project_property_impl_test.go @@ -93,7 +93,7 @@ func Test_internalProjectPropertyImpl_Gets(t *testing.T) { name: "when the project key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectIDOrKeyError, diff --git a/jira/internal/project_role_actor_impl_test.go b/jira/internal/project_role_actor_impl_test.go index 90ce34fa..a6654dc0 100644 --- a/jira/internal/project_role_actor_impl_test.go +++ b/jira/internal/project_role_actor_impl_test.go @@ -39,7 +39,7 @@ func Test_internalProjectRoleActorImpl_Add(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", roleId: 10001, accountIds: []string{"uuid"}, @@ -71,7 +71,7 @@ func Test_internalProjectRoleActorImpl_Add(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", roleId: 10001, accountIds: []string{"uuid"}, @@ -103,7 +103,7 @@ func Test_internalProjectRoleActorImpl_Add(t *testing.T) { name: "when the project key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectIDOrKeyError, @@ -113,7 +113,7 @@ func Test_internalProjectRoleActorImpl_Add(t *testing.T) { name: "when the project role id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", }, wantErr: true, @@ -124,7 +124,7 @@ func Test_internalProjectRoleActorImpl_Add(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", roleId: 10001, accountIds: []string{"uuid"}, @@ -206,7 +206,7 @@ func Test_internalProjectRoleActorImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", roleId: 10001, accountId: "uuid", @@ -238,7 +238,7 @@ func Test_internalProjectRoleActorImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", roleId: 10001, accountId: "uuid", @@ -270,7 +270,7 @@ func Test_internalProjectRoleActorImpl_Delete(t *testing.T) { name: "when the project key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectIDOrKeyError, @@ -280,7 +280,7 @@ func Test_internalProjectRoleActorImpl_Delete(t *testing.T) { name: "when the project role id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", }, wantErr: true, @@ -291,7 +291,7 @@ func Test_internalProjectRoleActorImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", roleId: 10001, accountId: "uuid", diff --git a/jira/internal/project_role_impl_test.go b/jira/internal/project_role_impl_test.go index 2b15c4e6..b8dd0ea0 100644 --- a/jira/internal/project_role_impl_test.go +++ b/jira/internal/project_role_impl_test.go @@ -38,7 +38,7 @@ func Test_internalProjectRoleImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", roleId: 10001, }, @@ -68,7 +68,7 @@ func Test_internalProjectRoleImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", roleId: 10001, }, @@ -98,7 +98,7 @@ func Test_internalProjectRoleImpl_Get(t *testing.T) { name: "when the project key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectIDOrKeyError, @@ -108,7 +108,7 @@ func Test_internalProjectRoleImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", roleId: 10001, }, @@ -195,7 +195,7 @@ func Test_internalProjectRoleImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", }, on: func(fields *fields) { @@ -224,7 +224,7 @@ func Test_internalProjectRoleImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", }, on: func(fields *fields) { @@ -253,7 +253,7 @@ func Test_internalProjectRoleImpl_Gets(t *testing.T) { name: "when the project key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectIDOrKeyError, @@ -263,7 +263,7 @@ func Test_internalProjectRoleImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", }, on: func(fields *fields) { @@ -287,7 +287,7 @@ func Test_internalProjectRoleImpl_Gets(t *testing.T) { name: "when the response empty is empty", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", }, on: func(fields *fields) { @@ -368,7 +368,7 @@ func Test_internalProjectRoleImpl_Details(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", }, on: func(fields *fields) { @@ -397,7 +397,7 @@ func Test_internalProjectRoleImpl_Details(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", }, on: func(fields *fields) { @@ -426,7 +426,7 @@ func Test_internalProjectRoleImpl_Details(t *testing.T) { name: "when the project key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectIDOrKeyError, @@ -436,7 +436,7 @@ func Test_internalProjectRoleImpl_Details(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", }, on: func(fields *fields) { @@ -511,7 +511,7 @@ func Test_internalProjectRoleImpl_Global(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -539,7 +539,7 @@ func Test_internalProjectRoleImpl_Global(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -567,7 +567,7 @@ func Test_internalProjectRoleImpl_Global(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -647,7 +647,7 @@ func Test_internalProjectRoleImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -676,7 +676,7 @@ func Test_internalProjectRoleImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -705,7 +705,7 @@ func Test_internalProjectRoleImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { diff --git a/jira/internal/project_type_impl_test.go b/jira/internal/project_type_impl_test.go index fbdaea0a..3f0bb986 100644 --- a/jira/internal/project_type_impl_test.go +++ b/jira/internal/project_type_impl_test.go @@ -35,7 +35,7 @@ func Test_internalProjectTypeImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -63,7 +63,7 @@ func Test_internalProjectTypeImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -91,7 +91,7 @@ func Test_internalProjectTypeImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -165,7 +165,7 @@ func Test_internalProjectTypeImpl_Licensed(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -193,7 +193,7 @@ func Test_internalProjectTypeImpl_Licensed(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -221,7 +221,7 @@ func Test_internalProjectTypeImpl_Licensed(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -296,7 +296,7 @@ func Test_internalProjectTypeImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectTypeKey: "business", }, on: func(fields *fields) { @@ -325,7 +325,7 @@ func Test_internalProjectTypeImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectTypeKey: "business", }, on: func(fields *fields) { @@ -354,7 +354,7 @@ func Test_internalProjectTypeImpl_Get(t *testing.T) { name: "when the project type key is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectTypeKey: "", }, wantErr: true, @@ -365,7 +365,7 @@ func Test_internalProjectTypeImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectTypeKey: "business", }, on: func(fields *fields) { @@ -441,7 +441,7 @@ func Test_internalProjectTypeImpl_Accessible(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectTypeKey: "business", }, on: func(fields *fields) { @@ -470,7 +470,7 @@ func Test_internalProjectTypeImpl_Accessible(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectTypeKey: "business", }, on: func(fields *fields) { @@ -499,7 +499,7 @@ func Test_internalProjectTypeImpl_Accessible(t *testing.T) { name: "when the project type key is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectTypeKey: "", }, wantErr: true, @@ -510,7 +510,7 @@ func Test_internalProjectTypeImpl_Accessible(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectTypeKey: "business", }, on: func(fields *fields) { diff --git a/jira/internal/project_validator_impl_test.go b/jira/internal/project_validator_impl_test.go index e7965074..af09ed40 100644 --- a/jira/internal/project_validator_impl_test.go +++ b/jira/internal/project_validator_impl_test.go @@ -35,7 +35,7 @@ func Test_internalProjectValidatorImpl_Validate(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), key: "DUMMY", }, on: func(fields *fields) { @@ -64,7 +64,7 @@ func Test_internalProjectValidatorImpl_Validate(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), key: "DUMMY", }, on: func(fields *fields) { @@ -93,7 +93,7 @@ func Test_internalProjectValidatorImpl_Validate(t *testing.T) { name: "when the project key is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectIDOrKeyError, @@ -103,7 +103,7 @@ func Test_internalProjectValidatorImpl_Validate(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), key: "DUMMY", }, on: func(fields *fields) { @@ -179,7 +179,7 @@ func Test_internalProjectValidatorImpl_Key(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), key: "DUMMY", }, on: func(fields *fields) { @@ -208,7 +208,7 @@ func Test_internalProjectValidatorImpl_Key(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), key: "DUMMY", }, on: func(fields *fields) { @@ -237,7 +237,7 @@ func Test_internalProjectValidatorImpl_Key(t *testing.T) { name: "when the project key is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectIDOrKeyError, @@ -247,7 +247,7 @@ func Test_internalProjectValidatorImpl_Key(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), key: "DUMMY", }, on: func(fields *fields) { @@ -323,7 +323,7 @@ func Test_internalProjectValidatorImpl_Name(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), name: "DUMMY Project", }, on: func(fields *fields) { @@ -352,7 +352,7 @@ func Test_internalProjectValidatorImpl_Name(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), name: "DUMMY Project", }, on: func(fields *fields) { @@ -381,7 +381,7 @@ func Test_internalProjectValidatorImpl_Name(t *testing.T) { name: "when the project name is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectNameError, @@ -391,7 +391,7 @@ func Test_internalProjectValidatorImpl_Name(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), name: "DUMMY Project", }, on: func(fields *fields) { diff --git a/jira/internal/project_version_impl_test.go b/jira/internal/project_version_impl_test.go index 0d6d253f..1bcac978 100644 --- a/jira/internal/project_version_impl_test.go +++ b/jira/internal/project_version_impl_test.go @@ -36,7 +36,7 @@ func Test_internalProjectVersionImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", }, on: func(fields *fields) { @@ -65,7 +65,7 @@ func Test_internalProjectVersionImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", }, on: func(fields *fields) { @@ -94,7 +94,7 @@ func Test_internalProjectVersionImpl_Gets(t *testing.T) { name: "when the project key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectIDOrKeyError, @@ -104,7 +104,7 @@ func Test_internalProjectVersionImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", }, on: func(fields *fields) { @@ -182,7 +182,7 @@ func Test_internalProjectVersionImpl_Search(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", options: &model.VersionGetsOptions{ OrderBy: "id", @@ -219,7 +219,7 @@ func Test_internalProjectVersionImpl_Search(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", options: &model.VersionGetsOptions{ OrderBy: "id", @@ -256,7 +256,7 @@ func Test_internalProjectVersionImpl_Search(t *testing.T) { name: "when the project key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectIDOrKeyError, @@ -266,7 +266,7 @@ func Test_internalProjectVersionImpl_Search(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeyOrId: "DUMMY", options: &model.VersionGetsOptions{ OrderBy: "id", @@ -352,7 +352,7 @@ func Test_internalProjectVersionImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), versionId: "10391", expand: []string{"operations"}, }, @@ -382,7 +382,7 @@ func Test_internalProjectVersionImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), versionId: "10391", expand: []string{"operations"}, }, @@ -412,7 +412,7 @@ func Test_internalProjectVersionImpl_Get(t *testing.T) { name: "when the project version is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoVersionIDError, @@ -422,7 +422,7 @@ func Test_internalProjectVersionImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), versionId: "10391", expand: []string{"operations"}, }, @@ -500,7 +500,7 @@ func Test_internalProjectVersionImpl_RelatedIssueCounts(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), versionId: "10391", }, on: func(fields *fields) { @@ -529,7 +529,7 @@ func Test_internalProjectVersionImpl_RelatedIssueCounts(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), versionId: "10391", }, on: func(fields *fields) { @@ -558,7 +558,7 @@ func Test_internalProjectVersionImpl_RelatedIssueCounts(t *testing.T) { name: "when the project version is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoVersionIDError, @@ -568,7 +568,7 @@ func Test_internalProjectVersionImpl_RelatedIssueCounts(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), versionId: "10391", }, on: func(fields *fields) { @@ -644,7 +644,7 @@ func Test_internalProjectVersionImpl_UnresolvedIssueCount(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), versionId: "10391", }, on: func(fields *fields) { @@ -673,7 +673,7 @@ func Test_internalProjectVersionImpl_UnresolvedIssueCount(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), versionId: "10391", }, on: func(fields *fields) { @@ -702,7 +702,7 @@ func Test_internalProjectVersionImpl_UnresolvedIssueCount(t *testing.T) { name: "when the project version is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoVersionIDError, @@ -712,7 +712,7 @@ func Test_internalProjectVersionImpl_UnresolvedIssueCount(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), versionId: "10391", }, on: func(fields *fields) { @@ -788,7 +788,7 @@ func Test_internalProjectVersionImpl_Merge(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), versionId: "10391", versionMoveIssuesTo: "10392", }, @@ -818,7 +818,7 @@ func Test_internalProjectVersionImpl_Merge(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), versionId: "10391", versionMoveIssuesTo: "10392", }, @@ -848,7 +848,7 @@ func Test_internalProjectVersionImpl_Merge(t *testing.T) { name: "when the source project version is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoVersionIDError, @@ -858,7 +858,7 @@ func Test_internalProjectVersionImpl_Merge(t *testing.T) { name: "when the destination project version is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), versionId: "100392", }, wantErr: true, @@ -869,7 +869,7 @@ func Test_internalProjectVersionImpl_Merge(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), versionId: "10391", versionMoveIssuesTo: "10392", }, @@ -955,7 +955,7 @@ func Test_internalProjectVersionImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -984,7 +984,7 @@ func Test_internalProjectVersionImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -1013,7 +1013,7 @@ func Test_internalProjectVersionImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -1100,7 +1100,7 @@ func Test_internalProjectVersionImpl_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), versionId: "10923", payload: payloadMocked, }, @@ -1130,7 +1130,7 @@ func Test_internalProjectVersionImpl_Update(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), versionId: "10923", payload: payloadMocked, }, @@ -1160,7 +1160,7 @@ func Test_internalProjectVersionImpl_Update(t *testing.T) { name: "when the version id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoVersionIDError, @@ -1170,7 +1170,7 @@ func Test_internalProjectVersionImpl_Update(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), versionId: "10923", payload: payloadMocked, }, diff --git a/jira/internal/resolution_impl_test.go b/jira/internal/resolution_impl_test.go index 6c48fddc..a6f921b0 100644 --- a/jira/internal/resolution_impl_test.go +++ b/jira/internal/resolution_impl_test.go @@ -35,7 +35,7 @@ func Test_internalResolutionImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -63,7 +63,7 @@ func Test_internalResolutionImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -91,7 +91,7 @@ func Test_internalResolutionImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -166,7 +166,7 @@ func Test_internalResolutionImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), resolutionId: "2", }, on: func(fields *fields) { @@ -195,7 +195,7 @@ func Test_internalResolutionImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), resolutionId: "2", }, on: func(fields *fields) { @@ -224,7 +224,7 @@ func Test_internalResolutionImpl_Get(t *testing.T) { name: "when the resolution id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoResolutionIDError, @@ -234,7 +234,7 @@ func Test_internalResolutionImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), resolutionId: "2", }, on: func(fields *fields) { diff --git a/jira/internal/screen_impl_test.go b/jira/internal/screen_impl_test.go index 5bc9f544..046cf7a3 100644 --- a/jira/internal/screen_impl_test.go +++ b/jira/internal/screen_impl_test.go @@ -37,7 +37,7 @@ func Test_internalScreenImpl_Fields(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "customfield_12000", startAt: 100, maxResults: 50, @@ -68,7 +68,7 @@ func Test_internalScreenImpl_Fields(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "customfield_12000", startAt: 100, maxResults: 50, @@ -99,7 +99,7 @@ func Test_internalScreenImpl_Fields(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoFieldIDError, @@ -109,7 +109,7 @@ func Test_internalScreenImpl_Fields(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "customfield_12000", startAt: 100, maxResults: 50, @@ -189,7 +189,7 @@ func Test_internalScreenImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.ScreenParamsScheme{ IDs: []int{10002, 10002}, QueryString: "Default DUMMY Screen", @@ -225,7 +225,7 @@ func Test_internalScreenImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.ScreenParamsScheme{ IDs: []int{10002, 10002}, QueryString: "Default DUMMY Screen", @@ -261,7 +261,7 @@ func Test_internalScreenImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.ScreenParamsScheme{ IDs: []int{10002, 10002}, QueryString: "Default DUMMY Screen", @@ -345,7 +345,7 @@ func Test_internalScreenImpl_AddToDefault(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "customfield_12700", }, on: func(fields *fields) { @@ -374,7 +374,7 @@ func Test_internalScreenImpl_AddToDefault(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "customfield_12700", }, on: func(fields *fields) { @@ -403,7 +403,7 @@ func Test_internalScreenImpl_AddToDefault(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoFieldIDError, @@ -413,7 +413,7 @@ func Test_internalScreenImpl_AddToDefault(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), fieldId: "customfield_12700", }, on: func(fields *fields) { @@ -488,7 +488,7 @@ func Test_internalScreenImpl_Available(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10001, }, on: func(fields *fields) { @@ -517,7 +517,7 @@ func Test_internalScreenImpl_Available(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10001, }, on: func(fields *fields) { @@ -546,7 +546,7 @@ func Test_internalScreenImpl_Available(t *testing.T) { name: "when the screen id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoScreenIDError, @@ -556,7 +556,7 @@ func Test_internalScreenImpl_Available(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10001, }, on: func(fields *fields) { @@ -634,7 +634,7 @@ func Test_internalScreenImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), name: "Screen Name", description: "Screen Description", }, @@ -664,7 +664,7 @@ func Test_internalScreenImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), name: "Screen Name", description: "Screen Description", }, @@ -694,7 +694,7 @@ func Test_internalScreenImpl_Create(t *testing.T) { name: "when the screen name is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoScreenNameError, @@ -704,7 +704,7 @@ func Test_internalScreenImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), name: "Screen Name", description: "Screen Description", }, @@ -784,7 +784,7 @@ func Test_internalScreenImpl_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10001, name: "Screen Name", description: "Screen Description", @@ -815,7 +815,7 @@ func Test_internalScreenImpl_Update(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10001, name: "Screen Name", description: "Screen Description", @@ -846,7 +846,7 @@ func Test_internalScreenImpl_Update(t *testing.T) { name: "when the screen id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoScreenIDError, @@ -856,7 +856,7 @@ func Test_internalScreenImpl_Update(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10001, name: "Screen Name", description: "Screen Description", @@ -935,7 +935,7 @@ func Test_internalScreenImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10001, }, on: func(fields *fields) { @@ -964,7 +964,7 @@ func Test_internalScreenImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10001, }, on: func(fields *fields) { @@ -993,7 +993,7 @@ func Test_internalScreenImpl_Delete(t *testing.T) { name: "when the screen id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoScreenIDError, @@ -1003,7 +1003,7 @@ func Test_internalScreenImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10001, }, on: func(fields *fields) { diff --git a/jira/internal/screen_scheme_impl_test.go b/jira/internal/screen_scheme_impl_test.go index 597c4ed3..22eaaf52 100644 --- a/jira/internal/screen_scheme_impl_test.go +++ b/jira/internal/screen_scheme_impl_test.go @@ -36,7 +36,7 @@ func Test_internalScreenSchemeImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.ScreenSchemeParamsScheme{ IDs: []int{1292, 38403}, QueryString: "DUMMY Screen", @@ -72,7 +72,7 @@ func Test_internalScreenSchemeImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.ScreenSchemeParamsScheme{ IDs: []int{1292, 38403}, QueryString: "DUMMY Screen", @@ -108,7 +108,7 @@ func Test_internalScreenSchemeImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.ScreenSchemeParamsScheme{ IDs: []int{1292, 38403}, QueryString: "DUMMY Screen", @@ -202,7 +202,7 @@ func Test_internalScreenSchemeImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -231,7 +231,7 @@ func Test_internalScreenSchemeImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -260,7 +260,7 @@ func Test_internalScreenSchemeImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -347,7 +347,7 @@ func Test_internalScreenSchemeImpl_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenSchemeId: "10001", payload: payloadMocked, }, @@ -377,7 +377,7 @@ func Test_internalScreenSchemeImpl_Update(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenSchemeId: "10001", payload: payloadMocked, }, @@ -407,7 +407,7 @@ func Test_internalScreenSchemeImpl_Update(t *testing.T) { name: "when the screen scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoScreenSchemeIDError, @@ -417,7 +417,7 @@ func Test_internalScreenSchemeImpl_Update(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenSchemeId: "10001", payload: payloadMocked, }, @@ -493,7 +493,7 @@ func Test_internalScreenSchemeImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenSchemeId: "10001", }, on: func(fields *fields) { @@ -522,7 +522,7 @@ func Test_internalScreenSchemeImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenSchemeId: "10001", }, on: func(fields *fields) { @@ -551,7 +551,7 @@ func Test_internalScreenSchemeImpl_Delete(t *testing.T) { name: "when the screen scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoScreenSchemeIDError, @@ -561,7 +561,7 @@ func Test_internalScreenSchemeImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenSchemeId: "10001", }, on: func(fields *fields) { diff --git a/jira/internal/screen_tab_field_impl_test.go b/jira/internal/screen_tab_field_impl_test.go index a7ba6f07..7a866c65 100644 --- a/jira/internal/screen_tab_field_impl_test.go +++ b/jira/internal/screen_tab_field_impl_test.go @@ -36,7 +36,7 @@ func Test_internalScreenTabFieldImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, tabId: 18272, }, @@ -66,7 +66,7 @@ func Test_internalScreenTabFieldImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, tabId: 18272, }, @@ -96,7 +96,7 @@ func Test_internalScreenTabFieldImpl_Gets(t *testing.T) { name: "when the screen id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoScreenIDError, @@ -106,7 +106,7 @@ func Test_internalScreenTabFieldImpl_Gets(t *testing.T) { name: "when the tab id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10001, }, wantErr: true, @@ -117,7 +117,7 @@ func Test_internalScreenTabFieldImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, tabId: 18272, }, @@ -197,7 +197,7 @@ func Test_internalScreenTabFieldImpl_Add(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, tabId: 18272, fieldId: "customfield_10001", @@ -228,7 +228,7 @@ func Test_internalScreenTabFieldImpl_Add(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, tabId: 18272, fieldId: "customfield_10001", @@ -259,7 +259,7 @@ func Test_internalScreenTabFieldImpl_Add(t *testing.T) { name: "when the screen id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoScreenIDError, @@ -269,7 +269,7 @@ func Test_internalScreenTabFieldImpl_Add(t *testing.T) { name: "when the tab id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10001, }, wantErr: true, @@ -280,7 +280,7 @@ func Test_internalScreenTabFieldImpl_Add(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10001, tabId: 10001, }, @@ -292,7 +292,7 @@ func Test_internalScreenTabFieldImpl_Add(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, tabId: 18272, fieldId: "customfield_10001", @@ -372,7 +372,7 @@ func Test_internalScreenTabFieldImpl_Remove(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, tabId: 18272, fieldId: "customfield_10001", @@ -403,7 +403,7 @@ func Test_internalScreenTabFieldImpl_Remove(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, tabId: 18272, fieldId: "customfield_10001", @@ -434,7 +434,7 @@ func Test_internalScreenTabFieldImpl_Remove(t *testing.T) { name: "when the screen id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoScreenIDError, @@ -444,7 +444,7 @@ func Test_internalScreenTabFieldImpl_Remove(t *testing.T) { name: "when the tab id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10001, }, wantErr: true, @@ -455,7 +455,7 @@ func Test_internalScreenTabFieldImpl_Remove(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10001, tabId: 10001, }, @@ -467,7 +467,7 @@ func Test_internalScreenTabFieldImpl_Remove(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, tabId: 18272, fieldId: "customfield_10001", @@ -549,7 +549,7 @@ func Test_internalScreenTabFieldImpl_Move(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, tabId: 18272, fieldId: "customfield_10001", @@ -581,7 +581,7 @@ func Test_internalScreenTabFieldImpl_Move(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, tabId: 18272, fieldId: "customfield_10001", @@ -613,7 +613,7 @@ func Test_internalScreenTabFieldImpl_Move(t *testing.T) { name: "when the screen id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoScreenIDError, @@ -623,7 +623,7 @@ func Test_internalScreenTabFieldImpl_Move(t *testing.T) { name: "when the tab id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10001, }, wantErr: true, @@ -634,7 +634,7 @@ func Test_internalScreenTabFieldImpl_Move(t *testing.T) { name: "when the field id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10001, tabId: 10001, }, @@ -646,7 +646,7 @@ func Test_internalScreenTabFieldImpl_Move(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, tabId: 18272, fieldId: "customfield_10001", diff --git a/jira/internal/screen_tab_impl_test.go b/jira/internal/screen_tab_impl_test.go index 4f558b2b..cae5e952 100644 --- a/jira/internal/screen_tab_impl_test.go +++ b/jira/internal/screen_tab_impl_test.go @@ -37,7 +37,7 @@ func Test_internalScreenTabImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, projectKey: "DUMMY", }, @@ -67,7 +67,7 @@ func Test_internalScreenTabImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, projectKey: "DUMMY", }, @@ -97,7 +97,7 @@ func Test_internalScreenTabImpl_Gets(t *testing.T) { name: "when the screen id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoScreenIDError, @@ -107,7 +107,7 @@ func Test_internalScreenTabImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, projectKey: "DUMMY", }, @@ -187,7 +187,7 @@ func Test_internalScreenTabImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, tabName: "Time Tracking", }, @@ -217,7 +217,7 @@ func Test_internalScreenTabImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, tabName: "Time Tracking", }, @@ -247,7 +247,7 @@ func Test_internalScreenTabImpl_Create(t *testing.T) { name: "when the screen id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoScreenIDError, @@ -257,7 +257,7 @@ func Test_internalScreenTabImpl_Create(t *testing.T) { name: "when the tab name is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 19392, }, wantErr: true, @@ -268,7 +268,7 @@ func Test_internalScreenTabImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, tabName: "Time Tracking", }, @@ -349,7 +349,7 @@ func Test_internalScreenTabImpl_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, tabId: 10001, newTabName: "Time Tracking", @@ -380,7 +380,7 @@ func Test_internalScreenTabImpl_Update(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, tabId: 10001, newTabName: "Time Tracking", @@ -411,7 +411,7 @@ func Test_internalScreenTabImpl_Update(t *testing.T) { name: "when the screen id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoScreenIDError, @@ -421,7 +421,7 @@ func Test_internalScreenTabImpl_Update(t *testing.T) { name: "when the tab id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 19392, }, wantErr: true, @@ -432,7 +432,7 @@ func Test_internalScreenTabImpl_Update(t *testing.T) { name: "when the tab name is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 19392, tabId: 10001, }, @@ -444,7 +444,7 @@ func Test_internalScreenTabImpl_Update(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, tabId: 10001, newTabName: "Time Tracking", @@ -524,7 +524,7 @@ func Test_internalScreenTabImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, tabId: 10001, }, @@ -554,7 +554,7 @@ func Test_internalScreenTabImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, tabId: 10001, }, @@ -584,7 +584,7 @@ func Test_internalScreenTabImpl_Delete(t *testing.T) { name: "when the screen id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoScreenIDError, @@ -594,7 +594,7 @@ func Test_internalScreenTabImpl_Delete(t *testing.T) { name: "when the tab id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 19392, }, wantErr: true, @@ -605,7 +605,7 @@ func Test_internalScreenTabImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, tabId: 10001, }, @@ -683,7 +683,7 @@ func Test_internalScreenTabImpl_Move(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, tabId: 10001, position: 1, @@ -714,7 +714,7 @@ func Test_internalScreenTabImpl_Move(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, tabId: 10001, position: 1, @@ -745,7 +745,7 @@ func Test_internalScreenTabImpl_Move(t *testing.T) { name: "when the screen id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoScreenIDError, @@ -755,7 +755,7 @@ func Test_internalScreenTabImpl_Move(t *testing.T) { name: "when the tab id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 19392, }, wantErr: true, @@ -766,7 +766,7 @@ func Test_internalScreenTabImpl_Move(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), screenId: 10002, tabId: 10001, position: 1, diff --git a/jira/internal/search_impl_adf_test.go b/jira/internal/search_impl_adf_test.go index a5c0227a..6ae0427b 100644 --- a/jira/internal/search_impl_adf_test.go +++ b/jira/internal/search_impl_adf_test.go @@ -44,7 +44,7 @@ func Test_internalSearchADFImpl_Checks(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -73,7 +73,7 @@ func Test_internalSearchADFImpl_Checks(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -102,7 +102,7 @@ func Test_internalSearchADFImpl_Checks(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -190,7 +190,7 @@ func Test_internalSearchADFImpl_Post(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), jql: "project = FOO", fields: []string{"status", "summary"}, expands: []string{"operations"}, @@ -224,7 +224,7 @@ func Test_internalSearchADFImpl_Post(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), jql: "project = FOO", fields: []string{"status", "summary"}, expands: []string{"operations"}, @@ -258,7 +258,7 @@ func Test_internalSearchADFImpl_Post(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), jql: "project = FOO", fields: []string{"status", "summary"}, expands: []string{"operations"}, @@ -343,7 +343,7 @@ func Test_internalSearchADFImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), jql: "project = FOO", fields: []string{"status", "summary"}, expands: []string{"operations"}, @@ -377,7 +377,7 @@ func Test_internalSearchADFImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), jql: "project = FOO", fields: []string{"status", "summary"}, expands: []string{"operations"}, @@ -411,7 +411,7 @@ func Test_internalSearchADFImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), jql: "project = FOO", fields: []string{"status", "summary"}, expands: []string{"operations"}, diff --git a/jira/internal/search_impl_rich_text_test.go b/jira/internal/search_impl_rich_text_test.go index 60c7147a..3336b2ff 100644 --- a/jira/internal/search_impl_rich_text_test.go +++ b/jira/internal/search_impl_rich_text_test.go @@ -44,7 +44,7 @@ func Test_internalSearchRichTextImpl_Checks(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -73,7 +73,7 @@ func Test_internalSearchRichTextImpl_Checks(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -102,7 +102,7 @@ func Test_internalSearchRichTextImpl_Checks(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -190,7 +190,7 @@ func Test_internalSearchRichTextImpl_Post(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), jql: "project = FOO", fields: []string{"status", "summary"}, expands: []string{"operations"}, @@ -224,7 +224,7 @@ func Test_internalSearchRichTextImpl_Post(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), jql: "project = FOO", fields: []string{"status", "summary"}, expands: []string{"operations"}, @@ -258,7 +258,7 @@ func Test_internalSearchRichTextImpl_Post(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), jql: "project = FOO", fields: []string{"status", "summary"}, expands: []string{"operations"}, @@ -343,7 +343,7 @@ func Test_internalSearchRichTextImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), jql: "project = FOO", fields: []string{"status", "summary"}, expands: []string{"operations"}, @@ -377,7 +377,7 @@ func Test_internalSearchRichTextImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), jql: "project = FOO", fields: []string{"status", "summary"}, expands: []string{"operations"}, @@ -411,7 +411,7 @@ func Test_internalSearchRichTextImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), jql: "project = FOO", fields: []string{"status", "summary"}, expands: []string{"operations"}, diff --git a/jira/internal/server_impl_test.go b/jira/internal/server_impl_test.go index 369d8d54..38347017 100644 --- a/jira/internal/server_impl_test.go +++ b/jira/internal/server_impl_test.go @@ -34,7 +34,7 @@ func Test_internalServerServiceImpl_Info(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -62,7 +62,7 @@ func Test_internalServerServiceImpl_Info(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -90,7 +90,7 @@ func Test_internalServerServiceImpl_Info(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { diff --git a/jira/internal/task_impl_test.go b/jira/internal/task_impl_test.go index 6fa6ebec..b4379f5f 100644 --- a/jira/internal/task_impl_test.go +++ b/jira/internal/task_impl_test.go @@ -35,7 +35,7 @@ func Test_internalTaskServiceImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), taskId: "uuid-sample", }, on: func(fields *fields) { @@ -64,7 +64,7 @@ func Test_internalTaskServiceImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), taskId: "uuid-sample", }, on: func(fields *fields) { @@ -93,7 +93,7 @@ func Test_internalTaskServiceImpl_Get(t *testing.T) { name: "when the task id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoTaskIDError, @@ -103,7 +103,7 @@ func Test_internalTaskServiceImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), taskId: "uuid-sample", }, on: func(fields *fields) { @@ -179,7 +179,7 @@ func Test_internalTaskServiceImpl_Cancel(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), taskId: "uuid-sample", }, on: func(fields *fields) { @@ -208,7 +208,7 @@ func Test_internalTaskServiceImpl_Cancel(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), taskId: "uuid-sample", }, on: func(fields *fields) { @@ -237,7 +237,7 @@ func Test_internalTaskServiceImpl_Cancel(t *testing.T) { name: "when the task id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoTaskIDError, @@ -247,7 +247,7 @@ func Test_internalTaskServiceImpl_Cancel(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), taskId: "uuid-sample", }, on: func(fields *fields) { diff --git a/jira/internal/team_impl_test.go b/jira/internal/team_impl_test.go index 557513b2..ebcbffcf 100644 --- a/jira/internal/team_impl_test.go +++ b/jira/internal/team_impl_test.go @@ -35,7 +35,7 @@ func Test_internalTeamServiceImpl_Gets(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), maxResults: 1000, }, on: func(fields *fields) { @@ -63,7 +63,7 @@ func Test_internalTeamServiceImpl_Gets(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), maxResults: 1000, }, on: func(fields *fields) { @@ -86,7 +86,7 @@ func Test_internalTeamServiceImpl_Gets(t *testing.T) { { name: "when the http call returns an error", args: args{ - ctx: context.TODO(), + ctx: context.Background(), maxResults: 1000, }, on: func(fields *fields) { @@ -173,7 +173,7 @@ func Test_internalTeamServiceImpl_Create(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -201,7 +201,7 @@ func Test_internalTeamServiceImpl_Create(t *testing.T) { { name: "when the http request cannot be created", args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -224,7 +224,7 @@ func Test_internalTeamServiceImpl_Create(t *testing.T) { { name: "when the http call cannot be executed", args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { diff --git a/jira/internal/type_impl_test.go b/jira/internal/type_impl_test.go index 3ed4ed7a..7536be45 100644 --- a/jira/internal/type_impl_test.go +++ b/jira/internal/type_impl_test.go @@ -35,7 +35,7 @@ func Test_internalTypeImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -63,7 +63,7 @@ func Test_internalTypeImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -91,7 +91,7 @@ func Test_internalTypeImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -166,7 +166,7 @@ func Test_internalTypeImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeId: "8", }, on: func(fields *fields) { @@ -195,7 +195,7 @@ func Test_internalTypeImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeId: "8", }, on: func(fields *fields) { @@ -224,7 +224,7 @@ func Test_internalTypeImpl_Get(t *testing.T) { name: "when the issue type id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoIssueTypeIDError, @@ -234,7 +234,7 @@ func Test_internalTypeImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeId: "8", }, on: func(fields *fields) { @@ -310,7 +310,7 @@ func Test_internalTypeImpl_Alternatives(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeId: "8", }, on: func(fields *fields) { @@ -339,7 +339,7 @@ func Test_internalTypeImpl_Alternatives(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeId: "8", }, on: func(fields *fields) { @@ -368,7 +368,7 @@ func Test_internalTypeImpl_Alternatives(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeId: "8", }, on: func(fields *fields) { @@ -450,7 +450,7 @@ func Test_internalTypeImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -479,7 +479,7 @@ func Test_internalTypeImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -508,7 +508,7 @@ func Test_internalTypeImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -591,7 +591,7 @@ func Test_internalTypeImpl_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeId: "8", payload: payloadMocked, }, @@ -621,7 +621,7 @@ func Test_internalTypeImpl_Update(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeId: "8", payload: payloadMocked, }, @@ -651,7 +651,7 @@ func Test_internalTypeImpl_Update(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeId: "8", payload: payloadMocked, }, @@ -728,7 +728,7 @@ func Test_internalTypeImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeId: "8", }, on: func(fields *fields) { @@ -757,7 +757,7 @@ func Test_internalTypeImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeId: "8", }, on: func(fields *fields) { @@ -786,7 +786,7 @@ func Test_internalTypeImpl_Delete(t *testing.T) { name: "when the issue type id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoIssueTypeIDError, @@ -796,7 +796,7 @@ func Test_internalTypeImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeId: "8", }, on: func(fields *fields) { diff --git a/jira/internal/type_scheme_impl_test.go b/jira/internal/type_scheme_impl_test.go index b6a14dd0..70541ca0 100644 --- a/jira/internal/type_scheme_impl_test.go +++ b/jira/internal/type_scheme_impl_test.go @@ -36,7 +36,7 @@ func Test_internalTypeSchemeImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeSchemeIds: []int{1001, 1002}, startAt: 50, maxResults: 100, @@ -67,7 +67,7 @@ func Test_internalTypeSchemeImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeSchemeIds: []int{1001, 1002}, startAt: 50, maxResults: 100, @@ -98,7 +98,7 @@ func Test_internalTypeSchemeImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeSchemeIds: []int{1001, 1002}, startAt: 50, maxResults: 100, @@ -178,7 +178,7 @@ func Test_internalTypeSchemeImpl_Items(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeSchemeIds: []int{1001, 1002}, startAt: 50, maxResults: 100, @@ -209,7 +209,7 @@ func Test_internalTypeSchemeImpl_Items(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeSchemeIds: []int{1001, 1002}, startAt: 50, maxResults: 100, @@ -240,7 +240,7 @@ func Test_internalTypeSchemeImpl_Items(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeSchemeIds: []int{1001, 1002}, startAt: 50, maxResults: 100, @@ -320,7 +320,7 @@ func Test_internalTypeSchemeImpl_Projects(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectIds: []int{1001, 1002}, startAt: 50, maxResults: 100, @@ -351,7 +351,7 @@ func Test_internalTypeSchemeImpl_Projects(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectIds: []int{1001, 1002}, startAt: 50, maxResults: 100, @@ -382,7 +382,7 @@ func Test_internalTypeSchemeImpl_Projects(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectIds: []int{1001, 1002}, startAt: 50, maxResults: 100, @@ -468,7 +468,7 @@ func Test_internalTypeSchemeImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -497,7 +497,7 @@ func Test_internalTypeSchemeImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -526,7 +526,7 @@ func Test_internalTypeSchemeImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -610,7 +610,7 @@ func Test_internalTypeSchemeImpl_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeSchemeId: 10001, payload: payloadMocked, }, @@ -640,7 +640,7 @@ func Test_internalTypeSchemeImpl_Update(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeSchemeId: 10001, payload: payloadMocked, }, @@ -670,7 +670,7 @@ func Test_internalTypeSchemeImpl_Update(t *testing.T) { name: "when the issue type scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, wantErr: true, @@ -681,7 +681,7 @@ func Test_internalTypeSchemeImpl_Update(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeSchemeId: 10001, payload: payloadMocked, }, @@ -761,7 +761,7 @@ func Test_internalTypeSchemeImpl_Append(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeSchemeId: 10001, issueTypeIds: []int{8, 10, 2}, }, @@ -791,7 +791,7 @@ func Test_internalTypeSchemeImpl_Append(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeSchemeId: 10001, issueTypeIds: []int{8, 10, 2}, }, @@ -821,7 +821,7 @@ func Test_internalTypeSchemeImpl_Append(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeSchemeId: 10001, issueTypeIds: []int{8, 10, 2}, }, @@ -898,7 +898,7 @@ func Test_internalTypeSchemeImpl_Remove(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeId: 9, issueTypeSchemeId: 10001, }, @@ -928,7 +928,7 @@ func Test_internalTypeSchemeImpl_Remove(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeId: 9, issueTypeSchemeId: 10001, }, @@ -958,7 +958,7 @@ func Test_internalTypeSchemeImpl_Remove(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeId: 9, issueTypeSchemeId: 10001, }, @@ -1034,7 +1034,7 @@ func Test_internalTypeSchemeImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeSchemeId: 10001, }, on: func(fields *fields) { @@ -1063,7 +1063,7 @@ func Test_internalTypeSchemeImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeSchemeId: 10001, }, on: func(fields *fields) { @@ -1092,7 +1092,7 @@ func Test_internalTypeSchemeImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeSchemeId: 10001, }, on: func(fields *fields) { @@ -1169,7 +1169,7 @@ func Test_internalTypeSchemeImpl_Assign(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectId: "9", issueTypeSchemeId: "10001", }, @@ -1199,7 +1199,7 @@ func Test_internalTypeSchemeImpl_Assign(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectId: "9", issueTypeSchemeId: "10001", }, @@ -1229,7 +1229,7 @@ func Test_internalTypeSchemeImpl_Assign(t *testing.T) { name: "when the project id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeSchemeId: "10001", }, wantErr: true, @@ -1240,7 +1240,7 @@ func Test_internalTypeSchemeImpl_Assign(t *testing.T) { name: "when the issue type scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectId: "9", }, wantErr: true, @@ -1251,7 +1251,7 @@ func Test_internalTypeSchemeImpl_Assign(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectId: "9", issueTypeSchemeId: "10001", }, diff --git a/jira/internal/type_screen_scheme_impl_test.go b/jira/internal/type_screen_scheme_impl_test.go index a86e5b2b..44a9b3fb 100644 --- a/jira/internal/type_screen_scheme_impl_test.go +++ b/jira/internal/type_screen_scheme_impl_test.go @@ -36,7 +36,7 @@ func Test_internalTypeScreenSchemeImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.ScreenSchemeParamsScheme{ IDs: []int{10001, 10002}, QueryString: "query", @@ -72,7 +72,7 @@ func Test_internalTypeScreenSchemeImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.ScreenSchemeParamsScheme{ IDs: []int{10001, 10002}, QueryString: "query", @@ -108,7 +108,7 @@ func Test_internalTypeScreenSchemeImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.ScreenSchemeParamsScheme{ IDs: []int{10001, 10002}, QueryString: "query", @@ -193,7 +193,7 @@ func Test_internalTypeScreenSchemeImpl_Projects(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectIds: []int{29992, 349383}, startAt: 50, maxResults: 100, @@ -224,7 +224,7 @@ func Test_internalTypeScreenSchemeImpl_Projects(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectIds: []int{29992, 349383}, startAt: 50, maxResults: 100, @@ -255,7 +255,7 @@ func Test_internalTypeScreenSchemeImpl_Projects(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectIds: []int{29992, 349383}, startAt: 50, maxResults: 100, @@ -335,7 +335,7 @@ func Test_internalTypeScreenSchemeImpl_Mapping(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeIds: []int{29992, 349383}, startAt: 50, maxResults: 100, @@ -366,7 +366,7 @@ func Test_internalTypeScreenSchemeImpl_Mapping(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeIds: []int{29992, 349383}, startAt: 50, maxResults: 100, @@ -397,7 +397,7 @@ func Test_internalTypeScreenSchemeImpl_Mapping(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeIds: []int{29992, 349383}, startAt: 50, maxResults: 100, @@ -477,7 +477,7 @@ func Test_internalTypeScreenSchemeImpl_SchemesByProject(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: 29992, startAt: 50, maxResults: 100, @@ -508,7 +508,7 @@ func Test_internalTypeScreenSchemeImpl_SchemesByProject(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: 29992, startAt: 50, maxResults: 100, @@ -539,7 +539,7 @@ func Test_internalTypeScreenSchemeImpl_SchemesByProject(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: 29992, startAt: 50, maxResults: 100, @@ -620,7 +620,7 @@ func Test_internalTypeScreenSchemeImpl_Assign(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "20001", projectId: "848483", }, @@ -650,7 +650,7 @@ func Test_internalTypeScreenSchemeImpl_Assign(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "20001", projectId: "848483", }, @@ -680,7 +680,7 @@ func Test_internalTypeScreenSchemeImpl_Assign(t *testing.T) { name: "when the issue type screen scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "", }, wantErr: true, @@ -691,7 +691,7 @@ func Test_internalTypeScreenSchemeImpl_Assign(t *testing.T) { name: "when the project id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "20001", }, wantErr: true, @@ -702,7 +702,7 @@ func Test_internalTypeScreenSchemeImpl_Assign(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "20001", projectId: "848483", }, @@ -780,7 +780,7 @@ func Test_internalTypeScreenSchemeImpl_Update(t *testing.T) { name: "when the issue type screen scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "", }, wantErr: true, @@ -790,7 +790,7 @@ func Test_internalTypeScreenSchemeImpl_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "20001", name: "New issue type scheme name", description: "New issue type scheme description", @@ -821,7 +821,7 @@ func Test_internalTypeScreenSchemeImpl_Update(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "20001", name: "New issue type scheme name", description: "New issue type scheme description", @@ -852,7 +852,7 @@ func Test_internalTypeScreenSchemeImpl_Update(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "20001", name: "New issue type scheme name", description: "New issue type scheme description", @@ -930,7 +930,7 @@ func Test_internalTypeScreenSchemeImpl_Delete(t *testing.T) { name: "when the issue type screen scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "", }, wantErr: true, @@ -940,7 +940,7 @@ func Test_internalTypeScreenSchemeImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "20001", }, on: func(fields *fields) { @@ -969,7 +969,7 @@ func Test_internalTypeScreenSchemeImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "20001", }, on: func(fields *fields) { @@ -998,7 +998,7 @@ func Test_internalTypeScreenSchemeImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "20001", }, on: func(fields *fields) { @@ -1087,7 +1087,7 @@ func Test_internalTypeScreenSchemeImpl_Append(t *testing.T) { name: "when the issue type screen scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "", }, wantErr: true, @@ -1097,7 +1097,7 @@ func Test_internalTypeScreenSchemeImpl_Append(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "20001", payload: payloadMocked, }, @@ -1127,7 +1127,7 @@ func Test_internalTypeScreenSchemeImpl_Append(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "20001", payload: payloadMocked, }, @@ -1157,7 +1157,7 @@ func Test_internalTypeScreenSchemeImpl_Append(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "20001", payload: payloadMocked, }, @@ -1236,7 +1236,7 @@ func Test_internalTypeScreenSchemeImpl_UpdateDefault(t *testing.T) { name: "when the issue type screen scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "", }, wantErr: true, @@ -1246,7 +1246,7 @@ func Test_internalTypeScreenSchemeImpl_UpdateDefault(t *testing.T) { name: "when the screen scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "20001", }, wantErr: true, @@ -1256,7 +1256,7 @@ func Test_internalTypeScreenSchemeImpl_UpdateDefault(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "20001", screenSchemeId: "200202", }, @@ -1286,7 +1286,7 @@ func Test_internalTypeScreenSchemeImpl_UpdateDefault(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "20001", screenSchemeId: "200202", }, @@ -1316,7 +1316,7 @@ func Test_internalTypeScreenSchemeImpl_UpdateDefault(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "20001", screenSchemeId: "200202", }, @@ -1396,7 +1396,7 @@ func Test_internalTypeScreenSchemeImpl_Remove(t *testing.T) { name: "when the issue type screen scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "", }, wantErr: true, @@ -1406,7 +1406,7 @@ func Test_internalTypeScreenSchemeImpl_Remove(t *testing.T) { name: "when the issue type id's are not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "2201", }, wantErr: true, @@ -1416,7 +1416,7 @@ func Test_internalTypeScreenSchemeImpl_Remove(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "20001", issueTypeIds: []string{"9", "43"}, }, @@ -1446,7 +1446,7 @@ func Test_internalTypeScreenSchemeImpl_Remove(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "20001", issueTypeIds: []string{"9", "43"}, }, @@ -1476,7 +1476,7 @@ func Test_internalTypeScreenSchemeImpl_Remove(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueTypeScreenSchemeId: "20001", issueTypeIds: []string{"9", "43"}, }, @@ -1567,7 +1567,7 @@ func Test_internalTypeScreenSchemeImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -1596,7 +1596,7 @@ func Test_internalTypeScreenSchemeImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -1625,7 +1625,7 @@ func Test_internalTypeScreenSchemeImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { diff --git a/jira/internal/user_impl_test.go b/jira/internal/user_impl_test.go index 053952ff..176aba0d 100644 --- a/jira/internal/user_impl_test.go +++ b/jira/internal/user_impl_test.go @@ -37,7 +37,7 @@ func Test_internalUserImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountId: "uuid-sample", expand: []string{"groups", "applicationRoles"}, }, @@ -67,7 +67,7 @@ func Test_internalUserImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountId: "uuid-sample", expand: []string{"groups", "applicationRoles"}, }, @@ -97,7 +97,7 @@ func Test_internalUserImpl_Get(t *testing.T) { name: "when the account id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoAccountIDError, @@ -107,7 +107,7 @@ func Test_internalUserImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountId: "uuid-sample", expand: []string{"groups", "applicationRoles"}, }, @@ -186,7 +186,7 @@ func Test_internalUserImpl_Find(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountIds: []string{"uuid-sample-1", "uuid-sample-2"}, startAt: 50, maxResults: 25, @@ -217,7 +217,7 @@ func Test_internalUserImpl_Find(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountIds: []string{"uuid-sample-1", "uuid-sample-2"}, startAt: 50, maxResults: 25, @@ -248,7 +248,7 @@ func Test_internalUserImpl_Find(t *testing.T) { name: "when the account ids is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoAccountSliceError, @@ -258,7 +258,7 @@ func Test_internalUserImpl_Find(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountIds: []string{"uuid-sample-1", "uuid-sample-2"}, startAt: 50, maxResults: 25, @@ -337,7 +337,7 @@ func Test_internalUserImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountId: "uuid-sample", }, on: func(fields *fields) { @@ -366,7 +366,7 @@ func Test_internalUserImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountId: "uuid-sample", }, on: func(fields *fields) { @@ -395,7 +395,7 @@ func Test_internalUserImpl_Delete(t *testing.T) { name: "when the account id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoAccountIDError, @@ -405,7 +405,7 @@ func Test_internalUserImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountId: "uuid-sample", }, on: func(fields *fields) { @@ -480,7 +480,7 @@ func Test_internalUserImpl_Groups(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountId: "uuid-sample", }, on: func(fields *fields) { @@ -509,7 +509,7 @@ func Test_internalUserImpl_Groups(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountId: "uuid-sample", }, on: func(fields *fields) { @@ -538,7 +538,7 @@ func Test_internalUserImpl_Groups(t *testing.T) { name: "when the account id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoAccountIDError, @@ -548,7 +548,7 @@ func Test_internalUserImpl_Groups(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountId: "uuid-sample", }, on: func(fields *fields) { @@ -624,7 +624,7 @@ func Test_internalUserImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -652,7 +652,7 @@ func Test_internalUserImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -680,7 +680,7 @@ func Test_internalUserImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -761,7 +761,7 @@ func Test_internalUserImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -790,7 +790,7 @@ func Test_internalUserImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -819,7 +819,7 @@ func Test_internalUserImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { diff --git a/jira/internal/user_search_impl_test.go b/jira/internal/user_search_impl_test.go index 81637e22..ff7e54cb 100644 --- a/jira/internal/user_search_impl_test.go +++ b/jira/internal/user_search_impl_test.go @@ -38,7 +38,7 @@ func Test_internalUserSearchImpl_Projects(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountId: "uuid-sample", projectKeys: []string{"DUMMY", "KP"}, startAt: 100, @@ -70,7 +70,7 @@ func Test_internalUserSearchImpl_Projects(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountId: "uuid-sample", projectKeys: []string{"DUMMY", "KP"}, startAt: 100, @@ -102,7 +102,7 @@ func Test_internalUserSearchImpl_Projects(t *testing.T) { name: "when the project keys are not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectKeys: nil, }, wantErr: true, @@ -113,7 +113,7 @@ func Test_internalUserSearchImpl_Projects(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountId: "uuid-sample", projectKeys: []string{"DUMMY", "KP"}, startAt: 100, @@ -195,7 +195,7 @@ func Test_internalUserSearchImpl_Do(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountId: "uuid-sample", query: "charles.smith@example.com", startAt: 100, @@ -227,7 +227,7 @@ func Test_internalUserSearchImpl_Do(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountId: "uuid-sample", query: "charles.smith@example.com", startAt: 100, @@ -259,7 +259,7 @@ func Test_internalUserSearchImpl_Do(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), accountId: "uuid-sample", query: "charles.smith@example.com", startAt: 100, @@ -341,7 +341,7 @@ func Test_internalUserSearchImpl_Check(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permission: "CREATE_ISSUES", options: &model.UserPermissionCheckParamsScheme{ Query: "project A", @@ -378,7 +378,7 @@ func Test_internalUserSearchImpl_Check(t *testing.T) { name: "when the permission grant is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { client := mocks.NewConnector(t) @@ -392,7 +392,7 @@ func Test_internalUserSearchImpl_Check(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permission: "CREATE_ISSUES", options: &model.UserPermissionCheckParamsScheme{ Query: "project A", @@ -429,7 +429,7 @@ func Test_internalUserSearchImpl_Check(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), permission: "CREATE_ISSUES", options: &model.UserPermissionCheckParamsScheme{ Query: "project A", diff --git a/jira/internal/vote_impl_test.go b/jira/internal/vote_impl_test.go index a2906a11..86044b04 100644 --- a/jira/internal/vote_impl_test.go +++ b/jira/internal/vote_impl_test.go @@ -35,7 +35,7 @@ func Test_internalVoteImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", }, on: func(fields *fields) { @@ -65,7 +65,7 @@ func Test_internalVoteImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", }, on: func(fields *fields) { @@ -95,7 +95,7 @@ func Test_internalVoteImpl_Gets(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", }, wantErr: true, @@ -106,7 +106,7 @@ func Test_internalVoteImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", }, on: func(fields *fields) { @@ -183,7 +183,7 @@ func Test_internalVoteImpl_Add(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", }, on: func(fields *fields) { @@ -213,7 +213,7 @@ func Test_internalVoteImpl_Add(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", }, on: func(fields *fields) { @@ -243,7 +243,7 @@ func Test_internalVoteImpl_Add(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", }, wantErr: true, @@ -254,7 +254,7 @@ func Test_internalVoteImpl_Add(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", }, on: func(fields *fields) { @@ -330,7 +330,7 @@ func Test_internalVoteImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", }, on: func(fields *fields) { @@ -360,7 +360,7 @@ func Test_internalVoteImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", }, on: func(fields *fields) { @@ -390,7 +390,7 @@ func Test_internalVoteImpl_Delete(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", }, wantErr: true, @@ -401,7 +401,7 @@ func Test_internalVoteImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", }, on: func(fields *fields) { diff --git a/jira/internal/watcher_impl_test.go b/jira/internal/watcher_impl_test.go index 49a8f6aa..4469628a 100644 --- a/jira/internal/watcher_impl_test.go +++ b/jira/internal/watcher_impl_test.go @@ -35,7 +35,7 @@ func Test_internalWatcherImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", }, on: func(fields *fields) { @@ -65,7 +65,7 @@ func Test_internalWatcherImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", }, on: func(fields *fields) { @@ -95,7 +95,7 @@ func Test_internalWatcherImpl_Gets(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", }, wantErr: true, @@ -106,7 +106,7 @@ func Test_internalWatcherImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", }, on: func(fields *fields) { @@ -183,7 +183,7 @@ func Test_internalWatcherImpl_Add(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", }, on: func(fields *fields) { @@ -213,7 +213,7 @@ func Test_internalWatcherImpl_Add(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", }, on: func(fields *fields) { @@ -243,7 +243,7 @@ func Test_internalWatcherImpl_Add(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", }, wantErr: true, @@ -254,7 +254,7 @@ func Test_internalWatcherImpl_Add(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", }, on: func(fields *fields) { @@ -331,7 +331,7 @@ func Test_internalWatcherImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", accountId: "dummy-account-id", }, @@ -362,7 +362,7 @@ func Test_internalWatcherImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", accountId: "dummy-account-id", }, @@ -393,7 +393,7 @@ func Test_internalWatcherImpl_Delete(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "", }, wantErr: true, @@ -404,7 +404,7 @@ func Test_internalWatcherImpl_Delete(t *testing.T) { name: "when the account id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", accountId: "", }, @@ -416,7 +416,7 @@ func Test_internalWatcherImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", accountId: "dummy-account-id", }, diff --git a/jira/internal/workflow_impl_test.go b/jira/internal/workflow_impl_test.go index 1e5ee537..7c1f90b2 100644 --- a/jira/internal/workflow_impl_test.go +++ b/jira/internal/workflow_impl_test.go @@ -36,7 +36,7 @@ func Test_internalWorkflowImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.WorkflowSearchOptions{ WorkflowName: []string{"workflow-name"}, Expand: []string{"transitions"}, @@ -73,7 +73,7 @@ func Test_internalWorkflowImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.WorkflowSearchOptions{ WorkflowName: []string{"workflow-name"}, Expand: []string{"transitions"}, @@ -110,7 +110,7 @@ func Test_internalWorkflowImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.WorkflowSearchOptions{ WorkflowName: []string{"workflow-name"}, Expand: []string{"transitions"}, @@ -195,7 +195,7 @@ func Test_internalWorkflowImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), workflowId: "2838382882", }, on: func(fields *fields) { @@ -224,7 +224,7 @@ func Test_internalWorkflowImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), workflowId: "2838382882", }, on: func(fields *fields) { @@ -253,7 +253,7 @@ func Test_internalWorkflowImpl_Delete(t *testing.T) { name: "when the workflow id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkflowIDError, @@ -263,7 +263,7 @@ func Test_internalWorkflowImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), workflowId: "2838382882", }, on: func(fields *fields) { @@ -360,7 +360,7 @@ func Test_internalWorkflowImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -389,7 +389,7 @@ func Test_internalWorkflowImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -418,7 +418,7 @@ func Test_internalWorkflowImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { diff --git a/jira/internal/workflow_scheme_impl_test.go b/jira/internal/workflow_scheme_impl_test.go index a74037af..30056c4f 100644 --- a/jira/internal/workflow_scheme_impl_test.go +++ b/jira/internal/workflow_scheme_impl_test.go @@ -35,7 +35,7 @@ func Test_internalWorkflowSchemeImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), startAt: 50, maxResults: 25, }, @@ -65,7 +65,7 @@ func Test_internalWorkflowSchemeImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), startAt: 50, maxResults: 25, }, @@ -95,7 +95,7 @@ func Test_internalWorkflowSchemeImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), startAt: 50, maxResults: 25, }, @@ -172,7 +172,7 @@ func Test_internalWorkflowSchemeImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 10002, returnDraftIfExists: true, }, @@ -202,7 +202,7 @@ func Test_internalWorkflowSchemeImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 10002, returnDraftIfExists: true, }, @@ -232,7 +232,7 @@ func Test_internalWorkflowSchemeImpl_Get(t *testing.T) { name: "when the workflow scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkflowSchemeIDError, @@ -242,7 +242,7 @@ func Test_internalWorkflowSchemeImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 10002, returnDraftIfExists: true, }, @@ -318,7 +318,7 @@ func Test_internalWorkflowSchemeImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 10002, }, on: func(fields *fields) { @@ -347,7 +347,7 @@ func Test_internalWorkflowSchemeImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 10002, }, on: func(fields *fields) { @@ -376,7 +376,7 @@ func Test_internalWorkflowSchemeImpl_Delete(t *testing.T) { name: "when the workflow scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkflowSchemeIDError, @@ -386,7 +386,7 @@ func Test_internalWorkflowSchemeImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 10002, }, on: func(fields *fields) { @@ -460,7 +460,7 @@ func Test_internalWorkflowSchemeImpl_Associations(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectIds: []int{1002, 1003}, }, on: func(fields *fields) { @@ -489,7 +489,7 @@ func Test_internalWorkflowSchemeImpl_Associations(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectIds: []int{1002, 1003}, }, on: func(fields *fields) { @@ -518,7 +518,7 @@ func Test_internalWorkflowSchemeImpl_Associations(t *testing.T) { name: "when the project ids are not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoProjectsError, @@ -528,7 +528,7 @@ func Test_internalWorkflowSchemeImpl_Associations(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), projectIds: []int{1002, 1003}, }, on: func(fields *fields) { @@ -605,7 +605,7 @@ func Test_internalWorkflowSchemeImpl_Assign(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: "1004561", projectId: "4984838", }, @@ -635,7 +635,7 @@ func Test_internalWorkflowSchemeImpl_Assign(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: "1004561", projectId: "4984838", }, @@ -665,7 +665,7 @@ func Test_internalWorkflowSchemeImpl_Assign(t *testing.T) { name: "when the scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkflowSchemeIDError, @@ -675,7 +675,7 @@ func Test_internalWorkflowSchemeImpl_Assign(t *testing.T) { name: "when the project id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: "1004561", }, wantErr: true, @@ -686,7 +686,7 @@ func Test_internalWorkflowSchemeImpl_Assign(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: "1004561", projectId: "4984838", }, @@ -771,7 +771,7 @@ func Test_internalWorkflowSchemeImpl_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 10002, payload: payloadMocked, }, @@ -801,7 +801,7 @@ func Test_internalWorkflowSchemeImpl_Update(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 10002, payload: payloadMocked, }, @@ -831,7 +831,7 @@ func Test_internalWorkflowSchemeImpl_Update(t *testing.T) { name: "when the workflow scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkflowSchemeIDError, @@ -841,7 +841,7 @@ func Test_internalWorkflowSchemeImpl_Update(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeId: 10002, payload: payloadMocked, }, @@ -927,7 +927,7 @@ func Test_internalWorkflowSchemeImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -956,7 +956,7 @@ func Test_internalWorkflowSchemeImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -985,7 +985,7 @@ func Test_internalWorkflowSchemeImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { diff --git a/jira/internal/workflow_scheme_issue_type_impl_test.go b/jira/internal/workflow_scheme_issue_type_impl_test.go index 5b507895..33923cab 100644 --- a/jira/internal/workflow_scheme_issue_type_impl_test.go +++ b/jira/internal/workflow_scheme_issue_type_impl_test.go @@ -38,7 +38,7 @@ func Test_internalWorkflowSchemeIssueTypeImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: 10002, issueTypeID: "4", returnDraft: true, @@ -69,7 +69,7 @@ func Test_internalWorkflowSchemeIssueTypeImpl_Get(t *testing.T) { name: "when the workflow scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkflowSchemeIDError, @@ -79,7 +79,7 @@ func Test_internalWorkflowSchemeIssueTypeImpl_Get(t *testing.T) { name: "when the issue type id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: 10002, }, wantErr: true, @@ -90,7 +90,7 @@ func Test_internalWorkflowSchemeIssueTypeImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: 10002, issueTypeID: "4", returnDraft: true, @@ -121,7 +121,7 @@ func Test_internalWorkflowSchemeIssueTypeImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: 10002, issueTypeID: "4", returnDraft: true, @@ -201,7 +201,7 @@ func Test_internalWorkflowSchemeIssueTypeImpl_Mapping(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: 10002, workflowName: "jira workflow ", returnDraft: true, @@ -232,7 +232,7 @@ func Test_internalWorkflowSchemeIssueTypeImpl_Mapping(t *testing.T) { name: "when the workflow scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkflowSchemeIDError, @@ -242,7 +242,7 @@ func Test_internalWorkflowSchemeIssueTypeImpl_Mapping(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: 10002, workflowName: "jira workflow ", returnDraft: true, @@ -273,7 +273,7 @@ func Test_internalWorkflowSchemeIssueTypeImpl_Mapping(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: 10002, workflowName: "jira workflow ", returnDraft: true, @@ -353,7 +353,7 @@ func Test_internalWorkflowSchemeIssueTypeImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: 10002, issueTypeID: "4", updateDraft: true, @@ -384,7 +384,7 @@ func Test_internalWorkflowSchemeIssueTypeImpl_Delete(t *testing.T) { name: "when the workflow scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkflowSchemeIDError, @@ -394,7 +394,7 @@ func Test_internalWorkflowSchemeIssueTypeImpl_Delete(t *testing.T) { name: "when the issue type id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: 10002, }, wantErr: true, @@ -405,7 +405,7 @@ func Test_internalWorkflowSchemeIssueTypeImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: 10002, issueTypeID: "4", updateDraft: true, @@ -436,7 +436,7 @@ func Test_internalWorkflowSchemeIssueTypeImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: 10002, issueTypeID: "4", updateDraft: true, @@ -522,7 +522,7 @@ func Test_internalWorkflowSchemeIssueTypeImpl_Set(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: 10002, issueTypeID: "4", payload: payloadMocked, @@ -553,7 +553,7 @@ func Test_internalWorkflowSchemeIssueTypeImpl_Set(t *testing.T) { name: "when the workflow scheme id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkflowSchemeIDError, @@ -563,7 +563,7 @@ func Test_internalWorkflowSchemeIssueTypeImpl_Set(t *testing.T) { name: "when the issue type id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: 10002, }, wantErr: true, @@ -574,7 +574,7 @@ func Test_internalWorkflowSchemeIssueTypeImpl_Set(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: 10002, issueTypeID: "4", payload: payloadMocked, @@ -605,7 +605,7 @@ func Test_internalWorkflowSchemeIssueTypeImpl_Set(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), schemeID: 10002, issueTypeID: "4", payload: payloadMocked, diff --git a/jira/internal/workflow_status_impl_test.go b/jira/internal/workflow_status_impl_test.go index 93ad085e..f3125be3 100644 --- a/jira/internal/workflow_status_impl_test.go +++ b/jira/internal/workflow_status_impl_test.go @@ -36,7 +36,7 @@ func Test_internalWorkflowStatusImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), ids: []string{"10000", "10001"}, expand: []string{"usages"}, }, @@ -66,7 +66,7 @@ func Test_internalWorkflowStatusImpl_Gets(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), ids: []string{"10000", "10001"}, expand: []string{"usages"}, }, @@ -96,7 +96,7 @@ func Test_internalWorkflowStatusImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), ids: []string{"10000", "10001"}, expand: []string{"usages"}, }, @@ -190,7 +190,7 @@ func Test_internalWorkflowStatusImpl_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -219,7 +219,7 @@ func Test_internalWorkflowStatusImpl_Update(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -248,7 +248,7 @@ func Test_internalWorkflowStatusImpl_Update(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -364,7 +364,7 @@ func Test_internalWorkflowStatusImpl_Create(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -393,7 +393,7 @@ func Test_internalWorkflowStatusImpl_Create(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -421,7 +421,7 @@ func Test_internalWorkflowStatusImpl_Create(t *testing.T) { name: "when the payload does not have statuses", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMockedWithOutStatuses, }, on: func(fields *fields) { @@ -438,7 +438,7 @@ func Test_internalWorkflowStatusImpl_Create(t *testing.T) { name: "when the payload does not have a scope", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMockedWithOutScope, }, on: func(fields *fields) { @@ -455,7 +455,7 @@ func Test_internalWorkflowStatusImpl_Create(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), payload: payloadMocked, }, on: func(fields *fields) { @@ -531,7 +531,7 @@ func Test_internalWorkflowStatusImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), ids: []string{"10000", "10001"}, }, on: func(fields *fields) { @@ -560,7 +560,7 @@ func Test_internalWorkflowStatusImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), ids: []string{"10000", "10001"}, }, on: func(fields *fields) { @@ -589,7 +589,7 @@ func Test_internalWorkflowStatusImpl_Delete(t *testing.T) { name: "when the statuses ids are not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoWorkflowStatusesError, @@ -599,7 +599,7 @@ func Test_internalWorkflowStatusImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), ids: []string{"10000", "10001"}, }, on: func(fields *fields) { @@ -675,7 +675,7 @@ func Test_internalWorkflowStatusImpl_Search(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.WorkflowStatusSearchParams{ ProjectID: "8373772", SearchString: "UAT", @@ -711,7 +711,7 @@ func Test_internalWorkflowStatusImpl_Search(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.WorkflowStatusSearchParams{ ProjectID: "8373772", SearchString: "UAT", @@ -747,7 +747,7 @@ func Test_internalWorkflowStatusImpl_Search(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), options: &model.WorkflowStatusSearchParams{ ProjectID: "8373772", SearchString: "UAT", @@ -830,7 +830,7 @@ func Test_internalWorkflowStatusImpl_Bulk(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -858,7 +858,7 @@ func Test_internalWorkflowStatusImpl_Bulk(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -886,7 +886,7 @@ func Test_internalWorkflowStatusImpl_Bulk(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, on: func(fields *fields) { @@ -961,7 +961,7 @@ func Test_internalWorkflowStatusImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), idOrName: "TODO", }, on: func(fields *fields) { @@ -990,7 +990,7 @@ func Test_internalWorkflowStatusImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), idOrName: "TODO", }, on: func(fields *fields) { @@ -1019,7 +1019,7 @@ func Test_internalWorkflowStatusImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), idOrName: "TODO", }, on: func(fields *fields) { diff --git a/jira/internal/worklog_impl_adf_test.go b/jira/internal/worklog_impl_adf_test.go index f76089e8..9c2b1d70 100644 --- a/jira/internal/worklog_impl_adf_test.go +++ b/jira/internal/worklog_impl_adf_test.go @@ -39,7 +39,7 @@ func Test_internalWorklogAdfImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), worklogIds: []int{1, 2, 3, 4}, expand: []string{"properties"}, }, @@ -69,7 +69,7 @@ func Test_internalWorklogAdfImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), worklogIds: []int{1, 2, 3, 4}, expand: []string{"properties"}, }, @@ -99,7 +99,7 @@ func Test_internalWorklogAdfImpl_Gets(t *testing.T) { name: "when the worklogs ids are not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNpWorklogsError, @@ -109,7 +109,7 @@ func Test_internalWorklogAdfImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), worklogIds: []int{1, 2, 3, 4}, expand: []string{"properties"}, }, @@ -187,7 +187,7 @@ func Test_internalWorklogAdfImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", worklogId: "493939", expand: []string{"properties"}, @@ -218,7 +218,7 @@ func Test_internalWorklogAdfImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", worklogId: "493939", expand: []string{"properties"}, @@ -249,7 +249,7 @@ func Test_internalWorklogAdfImpl_Get(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoIssueKeyOrIDError, @@ -259,7 +259,7 @@ func Test_internalWorklogAdfImpl_Get(t *testing.T) { name: "when the worklog id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", }, wantErr: true, @@ -270,7 +270,7 @@ func Test_internalWorklogAdfImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", worklogId: "493939", expand: []string{"properties"}, @@ -350,7 +350,7 @@ func Test_internalWorklogAdfImpl_Issue(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", startAt: 0, maxResults: 50, @@ -383,7 +383,7 @@ func Test_internalWorklogAdfImpl_Issue(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", startAt: 0, maxResults: 50, @@ -416,7 +416,7 @@ func Test_internalWorklogAdfImpl_Issue(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoIssueKeyOrIDError, @@ -426,7 +426,7 @@ func Test_internalWorklogAdfImpl_Issue(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", startAt: 0, maxResults: 50, @@ -508,7 +508,7 @@ func Test_internalWorklogAdfImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", worklogId: "h837372", options: &model.WorklogOptionsScheme{ @@ -546,7 +546,7 @@ func Test_internalWorklogAdfImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", worklogId: "h837372", options: &model.WorklogOptionsScheme{ @@ -584,7 +584,7 @@ func Test_internalWorklogAdfImpl_Delete(t *testing.T) { name: "when the options are not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", worklogId: "h837372", }, @@ -614,7 +614,7 @@ func Test_internalWorklogAdfImpl_Delete(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoIssueKeyOrIDError, @@ -624,7 +624,7 @@ func Test_internalWorklogAdfImpl_Delete(t *testing.T) { name: "when the worklog id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", }, wantErr: true, @@ -635,7 +635,7 @@ func Test_internalWorklogAdfImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", worklogId: "h837372", }, @@ -712,7 +712,7 @@ func Test_internalWorklogAdfImpl_Deleted(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), since: 928281811, }, on: func(fields *fields) { @@ -741,7 +741,7 @@ func Test_internalWorklogAdfImpl_Deleted(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), since: 928281811, }, on: func(fields *fields) { @@ -770,7 +770,7 @@ func Test_internalWorklogAdfImpl_Deleted(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), since: 928281811, }, on: func(fields *fields) { @@ -847,7 +847,7 @@ func Test_internalWorklogAdfImpl_Updated(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), since: 928281811, expand: []string{"properties"}, }, @@ -877,7 +877,7 @@ func Test_internalWorklogAdfImpl_Updated(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), since: 928281811, expand: []string{"properties"}, }, @@ -907,7 +907,7 @@ func Test_internalWorklogAdfImpl_Updated(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), since: 928281811, expand: []string{"properties"}, }, @@ -1012,7 +1012,7 @@ func Test_internalWorklogAdfImpl_Add(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrID: "DUMMY-5", payload: payloadMocked, options: &model.WorklogOptionsScheme{ @@ -1050,7 +1050,7 @@ func Test_internalWorklogAdfImpl_Add(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrID: "DUMMY-5", payload: payloadMocked, options: &model.WorklogOptionsScheme{ @@ -1088,7 +1088,7 @@ func Test_internalWorklogAdfImpl_Add(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrID: "DUMMY-5", payload: payloadMocked, options: &model.WorklogOptionsScheme{ @@ -1202,7 +1202,7 @@ func Test_internalWorklogAdfImpl_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrID: "DUMMY-5", worklogId: "3933828822", payload: payloadMocked, @@ -1241,7 +1241,7 @@ func Test_internalWorklogAdfImpl_Update(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrID: "DUMMY-5", worklogId: "3933828822", payload: payloadMocked, @@ -1280,7 +1280,7 @@ func Test_internalWorklogAdfImpl_Update(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoIssueKeyOrIDError, @@ -1290,7 +1290,7 @@ func Test_internalWorklogAdfImpl_Update(t *testing.T) { name: "when the worklog id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrID: "DUMMY-5", }, wantErr: true, @@ -1301,7 +1301,7 @@ func Test_internalWorklogAdfImpl_Update(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrID: "DUMMY-5", worklogId: "3933828822", payload: payloadMocked, diff --git a/jira/internal/worklog_impl_rich_text_test.go b/jira/internal/worklog_impl_rich_text_test.go index b628b569..92c9d4bb 100644 --- a/jira/internal/worklog_impl_rich_text_test.go +++ b/jira/internal/worklog_impl_rich_text_test.go @@ -39,7 +39,7 @@ func Test_internalWorklogRichTextImpl_Gets(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), worklogIds: []int{1, 2, 3, 4}, expand: []string{"properties"}, }, @@ -69,7 +69,7 @@ func Test_internalWorklogRichTextImpl_Gets(t *testing.T) { name: "when the worklogs ids are not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNpWorklogsError, @@ -79,7 +79,7 @@ func Test_internalWorklogRichTextImpl_Gets(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), worklogIds: []int{1, 2, 3, 4}, expand: []string{"properties"}, }, @@ -157,7 +157,7 @@ func Test_internalWorklogRichTextImpl_Get(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", worklogId: "493939", expand: []string{"properties"}, @@ -188,7 +188,7 @@ func Test_internalWorklogRichTextImpl_Get(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", worklogId: "493939", expand: []string{"properties"}, @@ -219,7 +219,7 @@ func Test_internalWorklogRichTextImpl_Get(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoIssueKeyOrIDError, @@ -229,7 +229,7 @@ func Test_internalWorklogRichTextImpl_Get(t *testing.T) { name: "when the worklog id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", }, wantErr: true, @@ -240,7 +240,7 @@ func Test_internalWorklogRichTextImpl_Get(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", worklogId: "493939", expand: []string{"properties"}, @@ -320,7 +320,7 @@ func Test_internalWorklogRichTextImpl_Issue(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", startAt: 0, maxResults: 50, @@ -353,7 +353,7 @@ func Test_internalWorklogRichTextImpl_Issue(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", startAt: 0, maxResults: 50, @@ -386,7 +386,7 @@ func Test_internalWorklogRichTextImpl_Issue(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoIssueKeyOrIDError, @@ -396,7 +396,7 @@ func Test_internalWorklogRichTextImpl_Issue(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", startAt: 0, maxResults: 50, @@ -478,7 +478,7 @@ func Test_internalWorklogRichTextImpl_Delete(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", worklogId: "h837372", options: &model.WorklogOptionsScheme{ @@ -516,7 +516,7 @@ func Test_internalWorklogRichTextImpl_Delete(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", worklogId: "h837372", options: &model.WorklogOptionsScheme{ @@ -554,7 +554,7 @@ func Test_internalWorklogRichTextImpl_Delete(t *testing.T) { name: "when the options are not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", worklogId: "h837372", }, @@ -584,7 +584,7 @@ func Test_internalWorklogRichTextImpl_Delete(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoIssueKeyOrIDError, @@ -594,7 +594,7 @@ func Test_internalWorklogRichTextImpl_Delete(t *testing.T) { name: "when the worklog id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", }, wantErr: true, @@ -605,7 +605,7 @@ func Test_internalWorklogRichTextImpl_Delete(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrId: "DUMMY-5", worklogId: "h837372", }, @@ -682,7 +682,7 @@ func Test_internalWorklogRichTextImpl_Deleted(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), since: 928281811, }, on: func(fields *fields) { @@ -711,7 +711,7 @@ func Test_internalWorklogRichTextImpl_Deleted(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), since: 928281811, }, on: func(fields *fields) { @@ -740,7 +740,7 @@ func Test_internalWorklogRichTextImpl_Deleted(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), since: 928281811, }, on: func(fields *fields) { @@ -817,7 +817,7 @@ func Test_internalWorklogRichTextImpl_Updated(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), since: 928281811, expand: []string{"properties"}, }, @@ -847,7 +847,7 @@ func Test_internalWorklogRichTextImpl_Updated(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), since: 928281811, expand: []string{"properties"}, }, @@ -877,7 +877,7 @@ func Test_internalWorklogRichTextImpl_Updated(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), since: 928281811, expand: []string{"properties"}, }, @@ -969,7 +969,7 @@ func Test_internalWorklogRichTextImpl_Add(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrID: "DUMMY-5", payload: payloadMocked, options: &model.WorklogOptionsScheme{ @@ -1007,7 +1007,7 @@ func Test_internalWorklogRichTextImpl_Add(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrID: "DUMMY-5", payload: payloadMocked, options: &model.WorklogOptionsScheme{ @@ -1045,7 +1045,7 @@ func Test_internalWorklogRichTextImpl_Add(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrID: "DUMMY-5", payload: payloadMocked, options: &model.WorklogOptionsScheme{ @@ -1144,7 +1144,7 @@ func Test_internalWorklogRichTextImpl_Update(t *testing.T) { name: "when the api version is v3", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrID: "DUMMY-5", worklogId: "3933828822", payload: payloadMocked, @@ -1183,7 +1183,7 @@ func Test_internalWorklogRichTextImpl_Update(t *testing.T) { name: "when the api version is v2", fields: fields{version: "2"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrID: "DUMMY-5", worklogId: "3933828822", payload: payloadMocked, @@ -1222,7 +1222,7 @@ func Test_internalWorklogRichTextImpl_Update(t *testing.T) { name: "when the issue key or id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), }, wantErr: true, Err: model.ErrNoIssueKeyOrIDError, @@ -1232,7 +1232,7 @@ func Test_internalWorklogRichTextImpl_Update(t *testing.T) { name: "when the worklog id is not provided", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrID: "DUMMY-5", }, wantErr: true, @@ -1243,7 +1243,7 @@ func Test_internalWorklogRichTextImpl_Update(t *testing.T) { name: "when the http request cannot be created", fields: fields{version: "3"}, args: args{ - ctx: context.TODO(), + ctx: context.Background(), issueKeyOrID: "DUMMY-5", worklogId: "3933828822", payload: payloadMocked, diff --git a/jira/sm/api_client_impl_test.go b/jira/sm/api_client_impl_test.go index 23d7eac8..720821b2 100644 --- a/jira/sm/api_client_impl_test.go +++ b/jira/sm/api_client_impl_test.go @@ -291,7 +291,7 @@ func TestClient_NewRequest(t *testing.T) { Site: siteAsURL, }, args: args{ - ctx: context.TODO(), + ctx: context.Background(), method: http.MethodGet, urlStr: "rest/2/issue/attachment", type_: "", @@ -309,7 +309,7 @@ func TestClient_NewRequest(t *testing.T) { Site: siteAsURL, }, args: args{ - ctx: context.TODO(), + ctx: context.Background(), method: http.MethodGet, urlStr: " https://zhidao.baidu.com/special/view?id=49105a24626975510000&preview=1", body: bytes.NewReader([]byte("Hello World")), diff --git a/jira/v2/api_client_impl_test.go b/jira/v2/api_client_impl_test.go index ec14ebb7..d1805bcd 100644 --- a/jira/v2/api_client_impl_test.go +++ b/jira/v2/api_client_impl_test.go @@ -291,7 +291,7 @@ func TestClient_NewRequest(t *testing.T) { Site: siteAsURL, }, args: args{ - ctx: context.TODO(), + ctx: context.Background(), method: http.MethodGet, urlStr: "rest/2/issue/attachment", type_: "", @@ -309,7 +309,7 @@ func TestClient_NewRequest(t *testing.T) { Site: siteAsURL, }, args: args{ - ctx: context.TODO(), + ctx: context.Background(), method: http.MethodGet, urlStr: "rest/2/issue/attachment", type_: "type_sample", @@ -327,7 +327,7 @@ func TestClient_NewRequest(t *testing.T) { Site: siteAsURL, }, args: args{ - ctx: context.TODO(), + ctx: context.Background(), method: http.MethodGet, urlStr: " https://zhidao.baidu.com/special/view?id=49105a24626975510000&preview=1", body: bytes.NewReader([]byte("Hello World")), diff --git a/jira/v3/api_client_impl_test.go b/jira/v3/api_client_impl_test.go index 0987d079..1e105415 100644 --- a/jira/v3/api_client_impl_test.go +++ b/jira/v3/api_client_impl_test.go @@ -291,7 +291,7 @@ func TestClient_NewRequest(t *testing.T) { Site: siteAsURL, }, args: args{ - ctx: context.TODO(), + ctx: context.Background(), method: http.MethodGet, urlStr: "rest/2/issue/attachment", type_: "", @@ -309,7 +309,7 @@ func TestClient_NewRequest(t *testing.T) { Site: siteAsURL, }, args: args{ - ctx: context.TODO(), + ctx: context.Background(), method: http.MethodGet, urlStr: " https://zhidao.baidu.com/special/view?id=49105a24626975510000&preview=1", body: bytes.NewReader([]byte("Hello World")), @@ -326,7 +326,7 @@ func TestClient_NewRequest(t *testing.T) { Site: siteAsURL, }, args: args{ - ctx: context.TODO(), + ctx: context.Background(), method: http.MethodGet, urlStr: "rest/2/issue/attachment", type_: "type_sample", diff --git a/pkg/infra/models/admin_organization.go b/pkg/infra/models/admin_organization.go index 6e241fcd..af661562 100644 --- a/pkg/infra/models/admin_organization.go +++ b/pkg/infra/models/admin_organization.go @@ -1,118 +1,137 @@ +// Package models provides the data structures used in the admin package. package models import "time" +// AdminOrganizationPageScheme represents a page of organizations. type AdminOrganizationPageScheme struct { - Data []*OrganizationModelScheme `json:"data,omitempty"` - Links *LinkPageModelScheme `json:"links,omitempty"` + Data []*OrganizationModelScheme `json:"data,omitempty"` // The organizations on this page. + Links *LinkPageModelScheme `json:"links,omitempty"` // Links to other pages. } +// LinkPageModelScheme represents the links to other pages. type LinkPageModelScheme struct { - Self string `json:"self,omitempty"` - Prev string `json:"prev,omitempty"` - Next string `json:"next,omitempty"` + Self string `json:"self,omitempty"` // Link to this page. + Prev string `json:"prev,omitempty"` // Link to the previous page. + Next string `json:"next,omitempty"` // Link to the next page. } +// OrganizationModelScheme represents an organization. type OrganizationModelScheme struct { - ID string `json:"id,omitempty"` - Type string `json:"type,omitempty"` - Attributes *OrganizationModelAttribute `json:"attributes,omitempty"` - Relationships *OrganizationModelRelationships `json:"relationships,omitempty"` - Links *LinkSelfModelScheme `json:"links,omitempty"` + ID string `json:"id,omitempty"` // The ID of the organization. + Type string `json:"type,omitempty"` // The type of the organization. + Attributes *OrganizationModelAttribute `json:"attributes,omitempty"` // The attributes of the organization. + Relationships *OrganizationModelRelationships `json:"relationships,omitempty"` // The relationships of the organization. + Links *LinkSelfModelScheme `json:"links,omitempty"` // Links related to the organization. } +// OrganizationModelAttribute represents the attributes of an organization. type OrganizationModelAttribute struct { - Name string `json:"name,omitempty"` + Name string `json:"name,omitempty"` // The name of the organization. } +// OrganizationModelRelationships represents the relationships of an organization. type OrganizationModelRelationships struct { - Domains *OrganizationModelSchemes `json:"domains,omitempty"` - Users *OrganizationModelSchemes `json:"users,omitempty"` + Domains *OrganizationModelSchemes `json:"domains,omitempty"` // The domains of the organization. + Users *OrganizationModelSchemes `json:"users,omitempty"` // The users of the organization. } +// OrganizationModelSchemes represents the links to related entities. type OrganizationModelSchemes struct { Links struct { - Related string `json:"related,omitempty"` + Related string `json:"related,omitempty"` // Link to the related entity. } `json:"links,omitempty"` } +// LinkSelfModelScheme represents a link to the entity itself. type LinkSelfModelScheme struct { - Self string `json:"self,omitempty"` + Self string `json:"self,omitempty"` // Link to the entity itself. } +// AdminOrganizationScheme represents an organization. type AdminOrganizationScheme struct { - Data *OrganizationModelScheme `json:"data,omitempty"` + Data *OrganizationModelScheme `json:"data,omitempty"` // The organization data. } +// OrganizationUserPageScheme represents a page of users in an organization. type OrganizationUserPageScheme struct { - Data []*AdminOrganizationUserScheme `json:"data,omitempty"` - Links *LinkPageModelScheme `json:"links,omitempty"` + Data []*AdminOrganizationUserScheme `json:"data,omitempty"` // The users on this page. + Links *LinkPageModelScheme `json:"links,omitempty"` // Links to other pages. Meta struct { - Total int `json:"total,omitempty"` + Total int `json:"total,omitempty"` // The total number of users. } `json:"meta,omitempty"` } +// AdminOrganizationUserScheme represents a user in an organization. type AdminOrganizationUserScheme struct { - AccountID string `json:"account_id,omitempty"` - AccountType string `json:"account_type,omitempty"` - AccountStatus string `json:"account_status,omitempty"` - Name string `json:"name,omitempty"` - Picture string `json:"picture,omitempty"` - Email string `json:"email,omitempty"` - AccessBillable bool `json:"access_billable,omitempty"` - LastActive string `json:"last_active,omitempty"` - ProductAccess []*OrganizationUserProductScheme `json:"product_access,omitempty"` - Links *LinkSelfModelScheme `json:"links,omitempty"` -} - + AccountID string `json:"account_id,omitempty"` // The account ID of the user. + AccountType string `json:"account_type,omitempty"` // The account type of the user. + AccountStatus string `json:"account_status,omitempty"` // The account status of the user. + Name string `json:"name,omitempty"` // The name of the user. + Picture string `json:"picture,omitempty"` // The picture of the user. + Email string `json:"email,omitempty"` // The email of the user. + AccessBillable bool `json:"access_billable,omitempty"` // Whether the user is billable. + LastActive string `json:"last_active,omitempty"` // The last active time of the user. + ProductAccess []*OrganizationUserProductScheme `json:"product_access,omitempty"` // The products the user has access to. + Links *LinkSelfModelScheme `json:"links,omitempty"` // Links related to the user. +} + +// OrganizationUserProductScheme represents a product a user has access to. type OrganizationUserProductScheme struct { - Key string `json:"key,omitempty"` - Name string `json:"name,omitempty"` - URL string `json:"url,omitempty"` - LastActive string `json:"last_active,omitempty"` + Key string `json:"key,omitempty"` // The key of the product. + Name string `json:"name,omitempty"` // The name of the product. + URL string `json:"url,omitempty"` // The URL of the product. + LastActive string `json:"last_active,omitempty"` // The last active time of the product. } +// OrganizationDomainPageScheme represents a page of domains in an organization. type OrganizationDomainPageScheme struct { - Data []*OrganizationDomainModelScheme `json:"data,omitempty"` - Links *LinkPageModelScheme `json:"links,omitempty"` + Data []*OrganizationDomainModelScheme `json:"data,omitempty"` // The domains on this page. + Links *LinkPageModelScheme `json:"links,omitempty"` // Links to other pages. } +// OrganizationDomainModelScheme represents a domain in an organization. type OrganizationDomainModelScheme struct { - ID string `json:"id,omitempty"` - Type string `json:"type,omitempty"` - Attributes *OrganizationDomainModelAttributesScheme `json:"attributes,omitempty"` - Links *LinkSelfModelScheme `json:"links,omitempty"` + ID string `json:"id,omitempty"` // The ID of the domain. + Type string `json:"type,omitempty"` // The type of the domain. + Attributes *OrganizationDomainModelAttributesScheme `json:"attributes,omitempty"` // The attributes of the domain. + Links *LinkSelfModelScheme `json:"links,omitempty"` // Links related to the domain. } +// OrganizationDomainModelAttributesScheme represents the attributes of a domain. type OrganizationDomainModelAttributesScheme struct { - Name string `json:"name,omitempty"` - Claim *OrganizationDomainModelAttributeClaimScheme `json:"claim,omitempty"` + Name string `json:"name,omitempty"` // The name of the domain. + Claim *OrganizationDomainModelAttributeClaimScheme `json:"claim,omitempty"` // The claim of the domain. } +// OrganizationDomainModelAttributeClaimScheme represents the claim of a domain. type OrganizationDomainModelAttributeClaimScheme struct { - Type string `json:"type,omitempty"` - Status string `json:"status,omitempty"` + Type string `json:"type,omitempty"` // The type of the claim. + Status string `json:"status,omitempty"` // The status of the claim. } +// OrganizationDomainScheme represents a domain. type OrganizationDomainScheme struct { - Data *OrganizationDomainDataScheme `json:"data"` + Data *OrganizationDomainDataScheme `json:"data"` // The domain data. } +// OrganizationDomainDataScheme represents the data of a domain. type OrganizationDomainDataScheme struct { - ID string `json:"id"` - Type string `json:"type"` + ID string `json:"id"` // The ID of the domain. + Type string `json:"type"` // The type of the domain. Attributes struct { - Name string `json:"name"` + Name string `json:"name"` // The name of the domain. Claim struct { - Type string `json:"type"` - Status string `json:"status"` - } `json:"claim"` - } `json:"attributes"` + Type string `json:"type"` // The type of the claim. + Status string `json:"status"` // The status of the claim. + } `json:"claim"` // The claim of the domain. + } `json:"attributes"` // The attributes of the domain. Links struct { - Self string `json:"self"` - } `json:"links"` + Self string `json:"self"` // Link to the domain itself. + } `json:"links"` // Links related to the domain. } +// OrganizationEventOptScheme represents the options for getting events. type OrganizationEventOptScheme struct { Q string //Single query term for searching events. From time.Time //The earliest date and time of the event represented as a UNIX epoch time. @@ -120,87 +139,101 @@ type OrganizationEventOptScheme struct { Action string //A query filter that returns events of a specific action type. } +// OrganizationEventPageScheme represents a page of events in an organization. type OrganizationEventPageScheme struct { - Data []*OrganizationEventModelScheme `json:"data,omitempty"` - Links *LinkPageModelScheme `json:"links,omitempty"` + Data []*OrganizationEventModelScheme `json:"data,omitempty"` // The events on this page. + Links *LinkPageModelScheme `json:"links,omitempty"` // Links to other pages. Meta struct { - Next string `json:"next,omitempty"` - PageSize int `json:"page_size,omitempty"` + Next string `json:"next,omitempty"` // The next page. + PageSize int `json:"page_size,omitempty"` // The page size. } `json:"meta,omitempty"` } +// OrganizationEventModelScheme represents an event in an organization. type OrganizationEventModelScheme struct { - ID string `json:"id,omitempty"` - Type string `json:"type,omitempty"` - Attributes *OrganizationEventModelAttributesScheme `json:"attributes,omitempty"` - Links *LinkSelfModelScheme `json:"links,omitempty"` + ID string `json:"id,omitempty"` // The ID of the event. + Type string `json:"type,omitempty"` // The type of the event. + Attributes *OrganizationEventModelAttributesScheme `json:"attributes,omitempty"` // The attributes of the event. + Links *LinkSelfModelScheme `json:"links,omitempty"` // Links related to the event. } +// OrganizationEventModelAttributesScheme represents the attributes of an event. type OrganizationEventModelAttributesScheme struct { - Time string `json:"time,omitempty"` - Action string `json:"action,omitempty"` - Actor *OrganizationEventActorModel `json:"actor,omitempty"` - Context []*OrganizationEventObjectModel `json:"context,omitempty"` - Container []*OrganizationEventObjectModel `json:"container,omitempty"` - Location *OrganizationEventLocationModel `json:"location,omitempty"` + Time string `json:"time,omitempty"` // The time of the event. + Action string `json:"action,omitempty"` // The action of the event. + Actor *OrganizationEventActorModel `json:"actor,omitempty"` // The actor of the event. + Context []*OrganizationEventObjectModel `json:"context,omitempty"` // The context of the event. + Container []*OrganizationEventObjectModel `json:"container,omitempty"` // The container of the event. + Location *OrganizationEventLocationModel `json:"location,omitempty"` // The location of the event. } +// OrganizationEventActorModel represents the actor of an event. type OrganizationEventActorModel struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Links *LinkSelfModelScheme `json:"links,omitempty"` + ID string `json:"id,omitempty"` // The ID of the actor. + Name string `json:"name,omitempty"` // The name of the actor. + Links *LinkSelfModelScheme `json:"links,omitempty"` // Links related to the actor. } +// OrganizationEventObjectModel represents an object in the context or container of an event. type OrganizationEventObjectModel struct { - ID string `json:"id,omitempty"` - Type string `json:"type,omitempty"` + ID string `json:"id,omitempty"` // The ID of the object. + Type string `json:"type,omitempty"` // The type of the object. Links struct { - Self string `json:"self,omitempty"` - Alt string `json:"alt,omitempty"` - } `json:"links,omitempty"` + Self string `json:"self,omitempty"` // Link to the object itself. + Alt string `json:"alt,omitempty"` // Alternative link to the object. + } `json:"links,omitempty"` // Links related to the object. } +// OrganizationEventLocationModel represents the location of an event. type OrganizationEventLocationModel struct { - IP string `json:"ip,omitempty"` - Geo string `json:"geo,omitempty"` + IP string `json:"ip,omitempty"` // The IP address of the location. + Geo string `json:"geo,omitempty"` // The geographical location. } +// OrganizationEventScheme represents an event. type OrganizationEventScheme struct { - Data *OrganizationEventModelScheme `json:"data,omitempty"` + Data *OrganizationEventModelScheme `json:"data,omitempty"` // The event data. } +// OrganizationEventActionScheme represents an action in an event. type OrganizationEventActionScheme struct { - Data []*OrganizationEventActionModelScheme `json:"data,omitempty"` + Data []*OrganizationEventActionModelScheme `json:"data,omitempty"` // The action data. } +// OrganizationEventActionModelScheme represents an action in an event. type OrganizationEventActionModelScheme struct { - ID string `json:"id,omitempty"` - Type string `json:"type,omitempty"` - Attributes *OrganizationEventActionModelAttributesScheme `json:"attributes,omitempty"` + ID string `json:"id,omitempty"` // The ID of the action. + Type string `json:"type,omitempty"` // The type of the action. + Attributes *OrganizationEventActionModelAttributesScheme `json:"attributes,omitempty"` // The attributes of the action. } +// OrganizationEventActionModelAttributesScheme represents the attributes of an action in an event. type OrganizationEventActionModelAttributesScheme struct { - DisplayName string `json:"displayName,omitempty"` - GroupDisplayName string `json:"groupDisplayName,omitempty"` + DisplayName string `json:"displayName,omitempty"` // The display name of the action. + GroupDisplayName string `json:"groupDisplayName,omitempty"` // The group display name of the action. } +// UserProductAccessScheme represents the product access of a user. type UserProductAccessScheme struct { - Data *UserProductAccessDataScheme `json:"data,omitempty"` + Data *UserProductAccessDataScheme `json:"data,omitempty"` // The product access data. } +// UserProductAccessDataScheme represents the data of a user's product access. type UserProductAccessDataScheme struct { - ProductAccess []*UserProductLastActiveScheme `json:"product_access,omitempty"` - AddedToOrg string `json:"added_to_org,omitempty"` + ProductAccess []*UserProductLastActiveScheme `json:"product_access,omitempty"` // The products the user has access to. + AddedToOrg string `json:"added_to_org,omitempty"` // The time the user was added to the organization. } +// UserProductLastActiveScheme represents a product a user has access to. type UserProductLastActiveScheme struct { - Id string `json:"id,omitempty"` - Key string `json:"key,omitempty"` - Name string `json:"name,omitempty"` - Url string `json:"url,omitempty"` - LastActive string `json:"last_active,omitempty"` + Id string `json:"id,omitempty"` // The ID of the product. + Key string `json:"key,omitempty"` // The key of the product. + Name string `json:"name,omitempty"` // The name of the product. + Url string `json:"url,omitempty"` // The URL of the product. + LastActive string `json:"last_active,omitempty"` // The last active time of the product. } +// GenericActionSuccessScheme represents a successful action. type GenericActionSuccessScheme struct { - Message string `json:"message,omitempty"` + Message string `json:"message,omitempty"` // The success message. } diff --git a/pkg/infra/models/admin_organization_policy.go b/pkg/infra/models/admin_organization_policy.go index a8577e47..3a4b4ac3 100644 --- a/pkg/infra/models/admin_organization_policy.go +++ b/pkg/infra/models/admin_organization_policy.go @@ -1,36 +1,42 @@ +// Package models provides the data structures used in the admin package. package models import "time" +// OrganizationPolicyPageScheme represents a page of organization policies. type OrganizationPolicyPageScheme struct { - Data []*OrganizationPolicyData `json:"data,omitempty"` - Links *LinkPageModelScheme `json:"links,omitempty"` + Data []*OrganizationPolicyData `json:"data,omitempty"` // The organization policies on this page. + Links *LinkPageModelScheme `json:"links,omitempty"` // Links to other pages. Meta struct { - Next string `json:"next,omitempty"` - PageSize int `json:"page_size,omitempty"` - } `json:"meta,omitempty"` + Next string `json:"next,omitempty"` // The next page. + PageSize int `json:"page_size,omitempty"` // The page size. + } `json:"meta,omitempty"` // Metadata about the page. } +// OrganizationPolicyScheme represents an organization policy. type OrganizationPolicyScheme struct { - Data OrganizationPolicyData `json:"data,omitempty"` + Data OrganizationPolicyData `json:"data,omitempty"` // The organization policy data. } +// OrganizationPolicyResource represents a resource in an organization policy. type OrganizationPolicyResource struct { - ID string `json:"id,omitempty"` - ApplicationStatus string `json:"applicationStatus,omitempty"` + ID string `json:"id,omitempty"` // The ID of the resource. + ApplicationStatus string `json:"applicationStatus,omitempty"` // The application status of the resource. } +// OrganizationPolicyAttributes represents the attributes of an organization policy. type OrganizationPolicyAttributes struct { - Type string `json:"type,omitempty"` - Name string `json:"name,omitempty"` - Status string `json:"status,omitempty"` - Resources []*OrganizationPolicyResource `json:"resources,omitempty"` - CreatedAt time.Time `json:"createdAt,omitempty"` - UpdatedAt time.Time `json:"updatedAt,omitempty"` + Type string `json:"type,omitempty"` // The type of the policy. + Name string `json:"name,omitempty"` // The name of the policy. + Status string `json:"status,omitempty"` // The status of the policy. + Resources []*OrganizationPolicyResource `json:"resources,omitempty"` // The resources of the policy. + CreatedAt time.Time `json:"createdAt,omitempty"` // The creation time of the policy. + UpdatedAt time.Time `json:"updatedAt,omitempty"` // The update time of the policy. } +// OrganizationPolicyData represents the data of an organization policy. type OrganizationPolicyData struct { - ID string `json:"id,omitempty"` - Type string `json:"type,omitempty"` - Attributes *OrganizationPolicyAttributes `json:"attributes,omitempty"` + ID string `json:"id,omitempty"` // The ID of the policy. + Type string `json:"type,omitempty"` // The type of the policy. + Attributes *OrganizationPolicyAttributes `json:"attributes,omitempty"` // The attributes of the policy. } diff --git a/pkg/infra/models/admin_scim_group.go b/pkg/infra/models/admin_scim_group.go index ded9d4c4..4ff96a36 100644 --- a/pkg/infra/models/admin_scim_group.go +++ b/pkg/infra/models/admin_scim_group.go @@ -1,48 +1,56 @@ +// Package models provides the data structures used in the admin package. package models +// SCIMGroupPathScheme represents the path scheme for a SCIM group. type SCIMGroupPathScheme struct { - Schemas []string `json:"schemas,omitempty"` - Operations []*SCIMGroupOperationScheme `json:"Operations,omitempty"` + Schemas []string `json:"schemas,omitempty"` // The schemas for the SCIM group. + Operations []*SCIMGroupOperationScheme `json:"Operations,omitempty"` // The operations for the SCIM group. } +// SCIMGroupOperationScheme represents the operation scheme for a SCIM group. type SCIMGroupOperationScheme struct { - Op string `json:"op,omitempty"` - Path string `json:"path,omitempty"` - Value []*SCIMGroupOperationValueScheme `json:"value,omitempty"` + Op string `json:"op,omitempty"` // The operation type. + Path string `json:"path,omitempty"` // The path for the operation. + Value []*SCIMGroupOperationValueScheme `json:"value,omitempty"` // The values for the operation. } +// SCIMGroupOperationValueScheme represents the value scheme for a SCIM group operation. type SCIMGroupOperationValueScheme struct { - Value string `json:"value,omitempty"` - Display string `json:"display,omitempty"` + Value string `json:"value,omitempty"` // The value for the operation. + Display string `json:"display,omitempty"` // The display for the operation. } +// ScimGroupPageScheme represents a page of SCIM groups. type ScimGroupPageScheme struct { - Schemas []string `json:"schemas,omitempty"` - TotalResults int `json:"totalResults,omitempty"` - StartIndex int `json:"startIndex,omitempty"` - ItemsPerPage int `json:"itemsPerPage,omitempty"` - Resources []*ScimGroupScheme `json:"Resources,omitempty"` + Schemas []string `json:"schemas,omitempty"` // The schemas for the SCIM groups. + TotalResults int `json:"totalResults,omitempty"` // The total number of SCIM groups. + StartIndex int `json:"startIndex,omitempty"` // The start index for the SCIM groups. + ItemsPerPage int `json:"itemsPerPage,omitempty"` // The number of SCIM groups per page. + Resources []*ScimGroupScheme `json:"Resources,omitempty"` // The SCIM groups on the page. } +// ScimGroupScheme represents a SCIM group. type ScimGroupScheme struct { - Schemas []string `json:"schemas,omitempty"` - ID string `json:"id,omitempty"` - ExternalID string `json:"externalId,omitempty"` - DisplayName string `json:"displayName,omitempty"` - Members []*ScimGroupMemberScheme `json:"members,omitempty"` - Meta *ScimMetadata `json:"meta,omitempty"` + Schemas []string `json:"schemas,omitempty"` // The schemas for the SCIM group. + ID string `json:"id,omitempty"` // The ID of the SCIM group. + ExternalID string `json:"externalId,omitempty"` // The external ID of the SCIM group. + DisplayName string `json:"displayName,omitempty"` // The display name of the SCIM group. + Members []*ScimGroupMemberScheme `json:"members,omitempty"` // The members of the SCIM group. + Meta *ScimMetadata `json:"meta,omitempty"` // The metadata for the SCIM group. } +// ScimGroupMemberScheme represents a member of a SCIM group. type ScimGroupMemberScheme struct { - Type string `json:"type,omitempty"` - Value string `json:"value,omitempty"` - Display string `json:"display,omitempty"` - Ref string `json:"$ref,omitempty"` + Type string `json:"type,omitempty"` // The type of the member. + Value string `json:"value,omitempty"` // The value of the member. + Display string `json:"display,omitempty"` // The display of the member. + Ref string `json:"$ref,omitempty"` // The reference of the member. } +// ScimMetadata represents the metadata for a SCIM group. type ScimMetadata struct { - ResourceType string `json:"resourceType,omitempty"` - Location string `json:"location,omitempty"` - LastModified string `json:"lastModified,omitempty"` - Created string `json:"created,omitempty"` + ResourceType string `json:"resourceType,omitempty"` // The resource type of the SCIM group. + Location string `json:"location,omitempty"` // The location of the SCIM group. + LastModified string `json:"lastModified,omitempty"` // The last modified time of the SCIM group. + Created string `json:"created,omitempty"` // The creation time of the SCIM group. } diff --git a/pkg/infra/models/admin_scim_scheme.go b/pkg/infra/models/admin_scim_scheme.go index 30ee42d1..bcc2c3d7 100644 --- a/pkg/infra/models/admin_scim_scheme.go +++ b/pkg/infra/models/admin_scim_scheme.go @@ -1,93 +1,101 @@ +// Package models provides the data structures used in the admin package. package models import "time" +// SCIMSchemasScheme represents a SCIM schema. type SCIMSchemasScheme struct { - TotalResults int `json:"totalResults,omitempty"` - ItemsPerPage int `json:"itemsPerPage,omitempty"` - StartIndex int `json:"startIndex,omitempty"` - Schemas []string `json:"schemas,omitempty"` - Resources []*ResourceScheme `json:"Resources,omitempty"` + TotalResults int `json:"totalResults,omitempty"` // The total number of results. + ItemsPerPage int `json:"itemsPerPage,omitempty"` // The number of items per page. + StartIndex int `json:"startIndex,omitempty"` // The start index of the results. + Schemas []string `json:"schemas,omitempty"` // The schemas. + Resources []*ResourceScheme `json:"Resources,omitempty"` // The resources. } +// ResourceScheme represents a resource. type ResourceScheme struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - Attributes []*AttributeScheme `json:"attributes,omitempty"` - Meta *ResourceMetaScheme `json:"meta,omitempty"` + ID string `json:"id,omitempty"` // The ID of the resource. + Name string `json:"name,omitempty"` // The name of the resource. + Description string `json:"description,omitempty"` // The description of the resource. + Attributes []*AttributeScheme `json:"attributes,omitempty"` // The attributes of the resource. + Meta *ResourceMetaScheme `json:"meta,omitempty"` // The metadata of the resource. } +// ResourceMetaScheme represents the metadata of a resource. type ResourceMetaScheme struct { - ResourceType string `json:"resourceType,omitempty"` - Location string `json:"location,omitempty"` + ResourceType string `json:"resourceType,omitempty"` // The type of the resource. + Location string `json:"location,omitempty"` // The location of the resource. } +// AttributeScheme represents an attribute. type AttributeScheme struct { - Name string `json:"name,omitempty"` - Type string `json:"type,omitempty"` - MultiValued bool `json:"multiValued,omitempty"` - Description string `json:"description,omitempty"` - Required bool `json:"required,omitempty"` - CaseExact bool `json:"caseExact,omitempty"` - Mutability string `json:"mutability,omitempty"` - Returned string `json:"returned,omitempty"` - Uniqueness string `json:"uniqueness,omitempty"` - SubAttributes []*SubAttributeScheme `json:"subAttributes,omitempty"` + Name string `json:"name,omitempty"` // The name of the attribute. + Type string `json:"type,omitempty"` // The type of the attribute. + MultiValued bool `json:"multiValued,omitempty"` // Whether the attribute is multi-valued. + Description string `json:"description,omitempty"` // The description of the attribute. + Required bool `json:"required,omitempty"` // Whether the attribute is required. + CaseExact bool `json:"caseExact,omitempty"` // Whether the attribute is case exact. + Mutability string `json:"mutability,omitempty"` // The mutability of the attribute. + Returned string `json:"returned,omitempty"` // When the attribute is returned. + Uniqueness string `json:"uniqueness,omitempty"` // The uniqueness of the attribute. + SubAttributes []*SubAttributeScheme `json:"subAttributes,omitempty"` // The sub-attributes of the attribute. } +// SubAttributeScheme represents a sub-attribute. type SubAttributeScheme struct { - Name string `json:"name,omitempty"` - Type string `json:"type,omitempty"` - MultiValued bool `json:"multiValued,omitempty"` - Description string `json:"description,omitempty"` - Required bool `json:"required,omitempty"` - CaseExact bool `json:"caseExact,omitempty"` - Mutability string `json:"mutability,omitempty"` - Returned string `json:"returned,omitempty"` - Uniqueness string `json:"uniqueness,omitempty"` + Name string `json:"name,omitempty"` // The name of the sub-attribute. + Type string `json:"type,omitempty"` // The type of the sub-attribute. + MultiValued bool `json:"multiValued,omitempty"` // Whether the sub-attribute is multi-valued. + Description string `json:"description,omitempty"` // The description of the sub-attribute. + Required bool `json:"required,omitempty"` // Whether the sub-attribute is required. + CaseExact bool `json:"caseExact,omitempty"` // Whether the sub-attribute is case exact. + Mutability string `json:"mutability,omitempty"` // The mutability of the sub-attribute. + Returned string `json:"returned,omitempty"` // When the sub-attribute is returned. + Uniqueness string `json:"uniqueness,omitempty"` // The uniqueness of the sub-attribute. } +// SCIMSchemaScheme represents a SCIM schema. type SCIMSchemaScheme struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - Attributes []*AttributeScheme `json:"attributes,omitempty"` - Meta *ResourceMetaScheme `json:"meta,omitempty"` + ID string `json:"id,omitempty"` // The ID of the schema. + Name string `json:"name,omitempty"` // The name of the schema. + Description string `json:"description,omitempty"` // The description of the schema. + Attributes []*AttributeScheme `json:"attributes,omitempty"` // The attributes of the schema. + Meta *ResourceMetaScheme `json:"meta,omitempty"` // The metadata of the schema. } +// ServiceProviderConfigScheme represents a service provider configuration. type ServiceProviderConfigScheme struct { - Schemas []string `json:"schemas"` + Schemas []string `json:"schemas"` // The schemas. Patch struct { - Supported bool `json:"supported"` + Supported bool `json:"supported"` // Whether patching is supported. } `json:"patch"` Bulk struct { - Supported bool `json:"supported"` - MaxOperations int `json:"maxOperations"` - MaxPayloadSize int `json:"maxPayloadSize"` + Supported bool `json:"supported"` // Whether bulk operations are supported. + MaxOperations int `json:"maxOperations"` // The maximum number of operations. + MaxPayloadSize int `json:"maxPayloadSize"` // The maximum payload size. } `json:"bulk"` Filter struct { - MaxResults int `json:"maxResults"` - Supported bool `json:"supported"` + MaxResults int `json:"maxResults"` // The maximum number of results. + Supported bool `json:"supported"` // Whether filtering is supported. } `json:"filter"` ChangePassword struct { - Supported bool `json:"supported"` + Supported bool `json:"supported"` // Whether password change is supported. } `json:"changePassword"` Sort struct { - Supported bool `json:"supported"` + Supported bool `json:"supported"` // Whether sorting is supported. } `json:"sort"` Etag struct { - Supported bool `json:"supported"` + Supported bool `json:"supported"` // Whether ETag is supported. } `json:"etag"` AuthenticationSchemes []struct { - Type string `json:"type"` - Name string `json:"name"` - Description string `json:"description"` + Type string `json:"type"` // The type of the authentication scheme. + Name string `json:"name"` // The name of the authentication scheme. + Description string `json:"description"` // The description of the authentication scheme. } `json:"authenticationSchemes"` Meta struct { - Location string `json:"location"` - ResourceType string `json:"resourceType"` - LastModified time.Time `json:"lastModified"` - Created time.Time `json:"created"` + Location string `json:"location"` // The location of the metadata. + ResourceType string `json:"resourceType"` // The type of the resource. + LastModified time.Time `json:"lastModified"` // The last modified time. + Created time.Time `json:"created"` // The creation time. } `json:"meta"` } diff --git a/pkg/infra/models/admin_scim_user.go b/pkg/infra/models/admin_scim_user.go index 3898e4b8..5fce5d0c 100644 --- a/pkg/infra/models/admin_scim_user.go +++ b/pkg/infra/models/admin_scim_user.go @@ -1,91 +1,103 @@ +// Package models provides the data structures used in the admin package. package models +// SCIMUserScheme represents a SCIM user. type SCIMUserScheme struct { - ID string `json:"id"` - ExternalID string `json:"externalId"` - Meta *SCIMUserMetaScheme `json:"meta,omitempty"` - Groups []*SCIMUserGroupScheme `json:"groups,omitempty"` - UserName string `json:"userName,omitempty"` - Emails []*SCIMUserEmailScheme `json:"emails,omitempty"` - Name *SCIMUserNameScheme `json:"name,omitempty"` - DisplayName string `json:"displayName,omitempty"` - NickName string `json:"nickName,omitempty"` - Title string `json:"title,omitempty"` - PreferredLanguage string `json:"preferredLanguage,omitempty"` - Department string `json:"department,omitempty"` - Organization string `json:"organization,omitempty"` - Timezone string `json:"timezone,omitempty"` - PhoneNumbers []*SCIMUserPhoneNumberScheme `json:"phoneNumbers,omitempty"` - Active bool `json:"active,omitempty"` - EnterpriseInfo *SCIMEnterpriseUserInfoScheme `json:"urn:ietf:params:scim:schemas:extension:enterprise:2.1:User,omitempty"` - SCIMExtension *SCIMExtensionScheme `json:"urn:scim:schemas:extension:atlassian-external:1.1,omitempty"` -} - + ID string `json:"id"` // The ID of the user. + ExternalID string `json:"externalId"` // The external ID of the user. + Meta *SCIMUserMetaScheme `json:"meta,omitempty"` // The metadata of the user. + Groups []*SCIMUserGroupScheme `json:"groups,omitempty"` // The groups the user belongs to. + UserName string `json:"userName,omitempty"` // The username of the user. + Emails []*SCIMUserEmailScheme `json:"emails,omitempty"` // The emails of the user. + Name *SCIMUserNameScheme `json:"name,omitempty"` // The name of the user. + DisplayName string `json:"displayName,omitempty"` // The display name of the user. + NickName string `json:"nickName,omitempty"` // The nickname of the user. + Title string `json:"title,omitempty"` // The title of the user. + PreferredLanguage string `json:"preferredLanguage,omitempty"` // The preferred language of the user. + Department string `json:"department,omitempty"` // The department of the user. + Organization string `json:"organization,omitempty"` // The organization of the user. + Timezone string `json:"timezone,omitempty"` // The timezone of the user. + PhoneNumbers []*SCIMUserPhoneNumberScheme `json:"phoneNumbers,omitempty"` // The phone numbers of the user. + Active bool `json:"active,omitempty"` // Whether the user is active. + EnterpriseInfo *SCIMEnterpriseUserInfoScheme `json:"urn:ietf:params:scim:schemas:extension:enterprise:2.1:User,omitempty"` // The enterprise user info of the user. + SCIMExtension *SCIMExtensionScheme `json:"urn:scim:schemas:extension:atlassian-external:1.1,omitempty"` // The SCIM extension of the user. +} + +// SCIMUserEmailScheme represents an email of a SCIM user. type SCIMUserEmailScheme struct { - Value string `json:"value,omitempty"` - Type string `json:"type,omitempty"` - Primary bool `json:"primary,omitempty"` + Value string `json:"value,omitempty"` // The value of the email. + Type string `json:"type,omitempty"` // The type of the email. + Primary bool `json:"primary,omitempty"` // Whether the email is primary. } +// SCIMUserNameScheme represents the name of a SCIM user. type SCIMUserNameScheme struct { - Formatted string `json:"formatted,omitempty"` - FamilyName string `json:"familyName,omitempty"` - GivenName string `json:"givenName,omitempty"` - MiddleName string `json:"middleName,omitempty"` - HonorificPrefix string `json:"honorificPrefix,omitempty"` - HonorificSuffix string `json:"honorificSuffix,omitempty"` + Formatted string `json:"formatted,omitempty"` // The formatted name. + FamilyName string `json:"familyName,omitempty"` // The family name. + GivenName string `json:"givenName,omitempty"` // The given name. + MiddleName string `json:"middleName,omitempty"` // The middle name. + HonorificPrefix string `json:"honorificPrefix,omitempty"` // The honorific prefix. + HonorificSuffix string `json:"honorificSuffix,omitempty"` // The honorific suffix. } +// SCIMUserPhoneNumberScheme represents a phone number of a SCIM user. type SCIMUserPhoneNumberScheme struct { - Value string `json:"value,omitempty"` - Type string `json:"type,omitempty"` - Primary bool `json:"primary,omitempty"` + Value string `json:"value,omitempty"` // The value of the phone number. + Type string `json:"type,omitempty"` // The type of the phone number. + Primary bool `json:"primary,omitempty"` // Whether the phone number is primary. } +// SCIMUserMetaScheme represents the metadata of a SCIM user. type SCIMUserMetaScheme struct { - ResourceType string `json:"resourceType,omitempty"` - Location string `json:"location,omitempty"` - LastModified string `json:"lastModified,omitempty"` - Created string `json:"created,omitempty"` + ResourceType string `json:"resourceType,omitempty"` // The resource type. + Location string `json:"location,omitempty"` // The location. + LastModified string `json:"lastModified,omitempty"` // The last modified time. + Created string `json:"created,omitempty"` // The creation time. } +// SCIMUserGroupScheme represents a group of a SCIM user. type SCIMUserGroupScheme struct { - Type string `json:"type,omitempty"` - Value string `json:"value,omitempty"` - Display string `json:"display,omitempty"` - Ref string `json:"$ref,omitempty"` + Type string `json:"type,omitempty"` // The type of the group. + Value string `json:"value,omitempty"` // The value of the group. + Display string `json:"display,omitempty"` // The display of the group. + Ref string `json:"$ref,omitempty"` // The reference of the group. } +// SCIMEnterpriseUserInfoScheme represents the enterprise user info of a SCIM user. type SCIMEnterpriseUserInfoScheme struct { - Organization string `json:"organization,omitempty"` - Department string `json:"department,omitempty"` + Organization string `json:"organization,omitempty"` // The organization. + Department string `json:"department,omitempty"` // The department. } +// SCIMExtensionScheme represents the SCIM extension of a SCIM user. type SCIMExtensionScheme struct { - AtlassianAccountID string `json:"atlassianAccountId,omitempty"` + AtlassianAccountID string `json:"atlassianAccountId,omitempty"` // The Atlassian account ID. } +// SCIMUserGetsOptionsScheme represents the options for getting SCIM users. type SCIMUserGetsOptionsScheme struct { - Attributes []string - ExcludedAttributes []string - Filter string + Attributes []string // The attributes to get. + ExcludedAttributes []string // The attributes to exclude. + Filter string // The filter. } +// SCIMUserPageScheme represents a page of SCIM users. type SCIMUserPageScheme struct { - Schemas []string `json:"schemas,omitempty"` - TotalResults int `json:"totalResults,omitempty"` - StartIndex int `json:"startIndex,omitempty"` - ItemsPerPage int `json:"itemsPerPage,omitempty"` - Resources []*SCIMUserScheme `json:"Resources,omitempty"` + Schemas []string `json:"schemas,omitempty"` // The schemas. + TotalResults int `json:"totalResults,omitempty"` // The total results. + StartIndex int `json:"startIndex,omitempty"` // The start index. + ItemsPerPage int `json:"itemsPerPage,omitempty"` // The items per page. + Resources []*SCIMUserScheme `json:"Resources,omitempty"` // The resources. } +// SCIMUserToPathScheme represents the path scheme for a SCIM user. type SCIMUserToPathScheme struct { - Schemas []string `json:"schemas,omitempty"` - Operations []*SCIMUserToPathOperationScheme `json:"operations,omitempty"` + Schemas []string `json:"schemas,omitempty"` // The schemas. + Operations []*SCIMUserToPathOperationScheme `json:"operations,omitempty"` // The operations. } +// AddStringOperation adds a string operation to the SCIM user path scheme. func (s *SCIMUserToPathScheme) AddStringOperation(operation, path, value string) error { - if operation == "" { return ErrNoSCIMOperationError } @@ -107,8 +119,8 @@ func (s *SCIMUserToPathScheme) AddStringOperation(operation, path, value string) return nil } +// AddBoolOperation adds a boolean operation to the SCIM user path scheme. func (s *SCIMUserToPathScheme) AddBoolOperation(operation, path string, value bool) error { - if operation == "" { return ErrNoSCIMOperationError } @@ -126,8 +138,8 @@ func (s *SCIMUserToPathScheme) AddBoolOperation(operation, path string, value bo return nil } +// AddComplexOperation adds a complex operation to the SCIM user path scheme. func (s *SCIMUserToPathScheme) AddComplexOperation(operation, path string, values []*SCIMUserComplexOperationScheme) error { - if operation == "" { return ErrNoSCIMOperationError } @@ -153,38 +165,41 @@ func (s *SCIMUserToPathScheme) AddComplexOperation(operation, path string, value return nil } +// SCIMUserComplexOperationScheme represents a complex operation of a SCIM user. type SCIMUserComplexOperationScheme struct { - Value string `json:"value,omitempty"` - ValueType string `json:"type,omitempty"` // Available values (work, home, other) - Primary bool `json:"primary,omitempty"` + Value string `json:"value,omitempty"` // The value of the operation. + ValueType string `json:"type,omitempty"` // Available values (work, home, other) + Primary bool `json:"primary,omitempty"` // Whether the operation is primary. } +// SCIMUserToPathValueScheme represents the value scheme for a path of a SCIM user. type SCIMUserToPathValueScheme struct { - Array bool `json:"array,omitempty"` - Null bool `json:"null,omitempty"` - ValueNode bool `json:"valueNode,omitempty"` - ContainerNode bool `json:"containerNode,omitempty"` - MissingNode bool `json:"missingNode,omitempty"` - Object bool `json:"object,omitempty"` - NodeType string `json:"nodeType,omitempty"` - Pojo bool `json:"pojo,omitempty"` - Number bool `json:"number,omitempty"` - IntegralNumber bool `json:"integralNumber,omitempty"` - FloatingPointNumber bool `json:"floatingPointNumber,omitempty"` - Short bool `json:"short,omitempty"` - Int bool `json:"int,omitempty"` - Long bool `json:"long,omitempty"` - Double bool `json:"double,omitempty"` - BigDecimal bool `json:"bigDecimal,omitempty"` - BigInteger bool `json:"bigInteger,omitempty"` - Textual bool `json:"textual,omitempty"` - Boolean bool `json:"boolean,omitempty"` - Binary bool `json:"binary,omitempty"` - Float bool `json:"float,omitempty"` -} - + Array bool `json:"array,omitempty"` // Whether the value is an array. + Null bool `json:"null,omitempty"` // Whether the value is null. + ValueNode bool `json:"valueNode,omitempty"` // Whether the value is a node. + ContainerNode bool `json:"containerNode,omitempty"` // Whether the value is a container node. + MissingNode bool `json:"missingNode,omitempty"` // Whether the value is a missing node. + Object bool `json:"object,omitempty"` // Whether the value is an object. + NodeType string `json:"nodeType,omitempty"` // The node type. + Pojo bool `json:"pojo,omitempty"` // Whether the value is a POJO. + Number bool `json:"number,omitempty"` // Whether the value is a number. + IntegralNumber bool `json:"integralNumber,omitempty"` // Whether the value is an integral number. + FloatingPointNumber bool `json:"floatingPointNumber,omitempty"` // Whether the value is a floating point number. + Short bool `json:"short,omitempty"` // Whether the value is short. + Int bool `json:"int,omitempty"` // Whether the value is an integer. + Long bool `json:"long,omitempty"` // Whether the value is long. + Double bool `json:"double,omitempty"` // Whether the value is double. + BigDecimal bool `json:"bigDecimal,omitempty"` // Whether the value is a big decimal. + BigInteger bool `json:"bigInteger,omitempty"` // Whether the value is a big integer. + Textual bool `json:"textual,omitempty"` // Whether the value is textual. + Boolean bool `json:"boolean,omitempty"` // Whether the value is boolean. + Binary bool `json:"binary,omitempty"` // Whether the value is binary. + Float bool `json:"float,omitempty"` // Whether the value is float. +} + +// SCIMUserToPathOperationScheme represents the operation scheme for a path of a SCIM user. type SCIMUserToPathOperationScheme struct { - Op string `json:"op,omitempty"` - Path string `json:"path,omitempty"` - Value interface{} `json:"value,omitempty"` + Op string `json:"op,omitempty"` // The operation. + Path string `json:"path,omitempty"` // The path. + Value interface{} `json:"value,omitempty"` // The value. } diff --git a/pkg/infra/models/admin_scim_user_test.go b/pkg/infra/models/admin_scim_user_test.go index 7cc5a0dc..e832fa2e 100644 --- a/pkg/infra/models/admin_scim_user_test.go +++ b/pkg/infra/models/admin_scim_user_test.go @@ -1,20 +1,25 @@ +// Package models provides the data structures used in the admin package. package models import ( - "github.com/stretchr/testify/assert" - "testing" + "github.com/stretchr/testify/assert" // Assert package for testing + "testing" // Standard Go testing package ) +// TestSCIMUserToPathScheme_AddStringOperation tests the AddStringOperation method of the SCIMUserToPathScheme struct. func TestSCIMUserToPathScheme_AddStringOperation(t *testing.T) { + // fields struct for holding the fields of SCIMUserToPathScheme type fields struct { Schemas []string Operations []*SCIMUserToPathOperationScheme } + // args struct for holding the arguments to the AddStringOperation method type args struct { operation string path string value string } + // testCases struct for holding each test case testCases := []struct { name string fields fields @@ -22,6 +27,7 @@ func TestSCIMUserToPathScheme_AddStringOperation(t *testing.T) { wantErr bool Err error }{ + // Test case when the parameters are correct { name: "when the parameters are correct", fields: fields{}, @@ -33,7 +39,7 @@ func TestSCIMUserToPathScheme_AddStringOperation(t *testing.T) { wantErr: false, Err: nil, }, - + // Test case when the operation is not provided { name: "when the operation is not provided", fields: fields{}, @@ -45,7 +51,7 @@ func TestSCIMUserToPathScheme_AddStringOperation(t *testing.T) { wantErr: true, Err: ErrNoSCIMOperationError, }, - + // Test case when the path is not provided { name: "when the path is not provided", fields: fields{}, @@ -57,7 +63,7 @@ func TestSCIMUserToPathScheme_AddStringOperation(t *testing.T) { wantErr: true, Err: ErrNoSCIMPathError, }, - + // Test case when the value is not provided { name: "when the value is not provided", fields: fields{}, @@ -70,38 +76,48 @@ func TestSCIMUserToPathScheme_AddStringOperation(t *testing.T) { Err: ErrNoSCIMValueError, }, } + // Loop over each test case for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { + // Create a new SCIMUserToPathScheme s := &SCIMUserToPathScheme{ Schemas: testCase.fields.Schemas, Operations: testCase.fields.Operations, } + // Call the AddStringOperation method err := s.AddStringOperation(testCase.args.operation, testCase.args.path, testCase.args.value) + // If an error is expected if testCase.wantErr { - + // Log the error if it exists if err != nil { t.Logf("error returned: %v", err.Error()) } + // Assert that the error is as expected assert.EqualError(t, err, testCase.Err.Error()) } else { + // Assert that no error occurred assert.NoError(t, err) } }) } } +// TestSCIMUserToPathScheme_AddBoolOperation tests the AddBoolOperation method of the SCIMUserToPathScheme struct. func TestSCIMUserToPathScheme_AddBoolOperation(t *testing.T) { + // fields struct for holding the fields of SCIMUserToPathScheme type fields struct { Schemas []string Operations []*SCIMUserToPathOperationScheme } + // args struct for holding the arguments to the AddBoolOperation method type args struct { operation string path string value bool } + // testCases struct for holding each test case testCases := []struct { name string fields fields @@ -109,6 +125,7 @@ func TestSCIMUserToPathScheme_AddBoolOperation(t *testing.T) { wantErr bool Err error }{ + // Test case when the parameters are correct { name: "when the parameters are correct", fields: fields{}, @@ -120,7 +137,7 @@ func TestSCIMUserToPathScheme_AddBoolOperation(t *testing.T) { wantErr: false, Err: nil, }, - + // Test case when the operation is not provided { name: "when the operation is not provided", fields: fields{}, @@ -132,7 +149,7 @@ func TestSCIMUserToPathScheme_AddBoolOperation(t *testing.T) { wantErr: true, Err: ErrNoSCIMOperationError, }, - + // Test case when the path is not provided { name: "when the path is not provided", fields: fields{}, @@ -145,38 +162,48 @@ func TestSCIMUserToPathScheme_AddBoolOperation(t *testing.T) { Err: ErrNoSCIMPathError, }, } + // Loop over each test case for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { + // Create a new SCIMUserToPathScheme s := &SCIMUserToPathScheme{ Schemas: testCase.fields.Schemas, Operations: testCase.fields.Operations, } + // Call the AddBoolOperation method err := s.AddBoolOperation(testCase.args.operation, testCase.args.path, testCase.args.value) + // If an error is expected if testCase.wantErr { - + // Log the error if it exists if err != nil { t.Logf("error returned: %v", err.Error()) } + // Assert that the error is as expected assert.EqualError(t, err, testCase.Err.Error()) } else { + // Assert that no error occurred assert.NoError(t, err) } }) } } +// TestSCIMUserToPathScheme_AddComplexOperation tests the AddComplexOperation method of the SCIMUserToPathScheme struct. func TestSCIMUserToPathScheme_AddComplexOperation(t *testing.T) { + // fields struct for holding the fields of SCIMUserToPathScheme type fields struct { Schemas []string Operations []*SCIMUserToPathOperationScheme } + // args struct for holding the arguments to the AddComplexOperation method type args struct { operation string path string values []*SCIMUserComplexOperationScheme } + // testCases struct for holding each test case testCases := []struct { name string fields fields @@ -184,6 +211,7 @@ func TestSCIMUserToPathScheme_AddComplexOperation(t *testing.T) { wantErr bool Err error }{ + // Test case when the parameters are correct { name: "when the parameters are correct", fields: fields{}, @@ -201,7 +229,7 @@ func TestSCIMUserToPathScheme_AddComplexOperation(t *testing.T) { wantErr: false, Err: nil, }, - + // Test case when the operation is not provided { name: "when the operation is not provided", fields: fields{}, @@ -212,7 +240,7 @@ func TestSCIMUserToPathScheme_AddComplexOperation(t *testing.T) { wantErr: true, Err: ErrNoSCIMOperationError, }, - + // Test case when the path is not provided { name: "when the path is not provided", fields: fields{}, @@ -223,7 +251,7 @@ func TestSCIMUserToPathScheme_AddComplexOperation(t *testing.T) { wantErr: true, Err: ErrNoSCIMPathError, }, - + // Test case when the value is not provided { name: "when the value is not provided", fields: fields{}, @@ -236,22 +264,28 @@ func TestSCIMUserToPathScheme_AddComplexOperation(t *testing.T) { Err: ErrNoSCIMComplexValueError, }, } + // Loop over each test case for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { + // Create a new SCIMUserToPathScheme s := &SCIMUserToPathScheme{ Schemas: testCase.fields.Schemas, Operations: testCase.fields.Operations, } + // Call the AddComplexOperation method err := s.AddComplexOperation(testCase.args.operation, testCase.args.path, testCase.args.values) + // If an error is expected if testCase.wantErr { - + // Log the error if it exists if err != nil { t.Logf("error returned: %v", err.Error()) } + // Assert that the error is as expected assert.EqualError(t, err, testCase.Err.Error()) } else { + // Assert that no error occurred assert.NoError(t, err) } }) diff --git a/pkg/infra/models/jira_comment_v3.go b/pkg/infra/models/jira_comment_v3.go index 5ad87129..e0a7a2a3 100644 --- a/pkg/infra/models/jira_comment_v3.go +++ b/pkg/infra/models/jira_comment_v3.go @@ -1,49 +1,57 @@ +// Package models provides the data structures used in the admin package. package models +// CommentNodeScheme represents a node in a comment. type CommentNodeScheme struct { - Version int `json:"version,omitempty"` - Type string `json:"type,omitempty"` - Content []*CommentNodeScheme `json:"content,omitempty"` - Text string `json:"text,omitempty"` - Attrs map[string]interface{} `json:"attrs,omitempty"` - Marks []*MarkScheme `json:"marks,omitempty"` + Version int `json:"version,omitempty"` // The version of the node. + Type string `json:"type,omitempty"` // The type of the node. + Content []*CommentNodeScheme `json:"content,omitempty"` // The content of the node. + Text string `json:"text,omitempty"` // The text of the node. + Attrs map[string]interface{} `json:"attrs,omitempty"` // The attributes of the node. + Marks []*MarkScheme `json:"marks,omitempty"` // The marks of the node. } +// AppendNode appends a node to the content of the CommentNodeScheme. func (n *CommentNodeScheme) AppendNode(node *CommentNodeScheme) { n.Content = append(n.Content, node) } +// MarkScheme represents a mark in a comment. type MarkScheme struct { - Type string `json:"type,omitempty"` - Attrs map[string]interface{} `json:"attrs,omitempty"` + Type string `json:"type,omitempty"` // The type of the mark. + Attrs map[string]interface{} `json:"attrs,omitempty"` // The attributes of the mark. } +// CommentPayloadScheme represents the payload of a comment. type CommentPayloadScheme struct { - Visibility *CommentVisibilityScheme `json:"visibility,omitempty"` - Body *CommentNodeScheme `json:"body,omitempty"` + Visibility *CommentVisibilityScheme `json:"visibility,omitempty"` // The visibility of the comment. + Body *CommentNodeScheme `json:"body,omitempty"` // The body of the comment. } +// IssueCommentPageScheme represents a page of issue comments. type IssueCommentPageScheme struct { - StartAt int `json:"startAt,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - Total int `json:"total,omitempty"` - Comments []*IssueCommentScheme `json:"comments,omitempty"` + StartAt int `json:"startAt,omitempty"` // The start index of the comments. + MaxResults int `json:"maxResults,omitempty"` // The maximum number of comments per page. + Total int `json:"total,omitempty"` // The total number of comments. + Comments []*IssueCommentScheme `json:"comments,omitempty"` // The comments on the page. } +// IssueCommentScheme represents a comment on an issue. type IssueCommentScheme struct { - Self string `json:"self,omitempty"` - ID string `json:"id,omitempty"` - Author *UserScheme `json:"author,omitempty"` - RenderedBody string `json:"renderedBody,omitempty"` - Body *CommentNodeScheme `json:"body,omitempty"` - JSDPublic bool `json:"jsdPublic,omitempty"` - UpdateAuthor *UserScheme `json:"updateAuthor,omitempty"` - Created string `json:"created,omitempty"` - Updated string `json:"updated,omitempty"` - Visibility *CommentVisibilityScheme `json:"visibility,omitempty"` + Self string `json:"self,omitempty"` // The self link of the comment. + ID string `json:"id,omitempty"` // The ID of the comment. + Author *UserScheme `json:"author,omitempty"` // The author of the comment. + RenderedBody string `json:"renderedBody,omitempty"` // The rendered body of the comment. + Body *CommentNodeScheme `json:"body,omitempty"` // The body of the comment. + JSDPublic bool `json:"jsdPublic,omitempty"` // Whether the comment is public. + UpdateAuthor *UserScheme `json:"updateAuthor,omitempty"` // The author of the last update. + Created string `json:"created,omitempty"` // The creation time of the comment. + Updated string `json:"updated,omitempty"` // The last update time of the comment. + Visibility *CommentVisibilityScheme `json:"visibility,omitempty"` // The visibility of the comment. } +// CommentVisibilityScheme represents the visibility of a comment. type CommentVisibilityScheme struct { - Type string `json:"type,omitempty"` - Value string `json:"value,omitempty"` + Type string `json:"type,omitempty"` // The type of the visibility. + Value string `json:"value,omitempty"` // The value of the visibility. } diff --git a/pkg/infra/models/jira_customFields.go b/pkg/infra/models/jira_customFields.go index 83cd5c5a..15571d99 100644 --- a/pkg/infra/models/jira_customFields.go +++ b/pkg/infra/models/jira_customFields.go @@ -1,11 +1,14 @@ +// Package models provides the data structures used in the admin package. package models import ( "time" ) +// CustomFields represents a collection of custom fields. type CustomFields struct{ Fields []map[string]interface{} } +// Groups adds a group custom field to the collection. func (c *CustomFields) Groups(customFieldID string, groups []string) error { if len(customFieldID) == 0 { @@ -35,6 +38,7 @@ func (c *CustomFields) Groups(customFieldID string, groups []string) error { return nil } +// Group adds a single group custom field to the collection. func (c *CustomFields) Group(customFieldID, group string) error { if len(customFieldID) == 0 { @@ -58,6 +62,7 @@ func (c *CustomFields) Group(customFieldID, group string) error { return nil } +// URL adds a URL custom field to the collection. func (c *CustomFields) URL(customFieldID, URL string) error { if len(customFieldID) == 0 { @@ -78,6 +83,7 @@ func (c *CustomFields) URL(customFieldID, URL string) error { return nil } +// Text adds a text custom field to the collection. func (c *CustomFields) Text(customFieldID, textValue string) error { if len(customFieldID) == 0 { @@ -98,6 +104,7 @@ func (c *CustomFields) Text(customFieldID, textValue string) error { return nil } +// DateTime adds a datetime custom field to the collection. func (c *CustomFields) DateTime(customFieldID string, dateValue time.Time) error { if len(customFieldID) == 0 { @@ -118,6 +125,7 @@ func (c *CustomFields) DateTime(customFieldID string, dateValue time.Time) error return nil } +// Date adds a date custom field to the collection. func (c *CustomFields) Date(customFieldID string, dateTimeValue time.Time) (err error) { if len(customFieldID) == 0 { @@ -138,6 +146,7 @@ func (c *CustomFields) Date(customFieldID string, dateTimeValue time.Time) (err return } +// MultiSelect adds a multi-select custom field to the collection. func (c *CustomFields) MultiSelect(customFieldID string, options []string) error { if len(customFieldID) == 0 { @@ -167,6 +176,7 @@ func (c *CustomFields) MultiSelect(customFieldID string, options []string) error return nil } +// Select adds a select custom field to the collection. func (c *CustomFields) Select(customFieldID string, option string) error { if len(customFieldID) == 0 { @@ -190,6 +200,7 @@ func (c *CustomFields) Select(customFieldID string, option string) error { return nil } +// RadioButton adds a radio button custom field to the collection. func (c *CustomFields) RadioButton(customFieldID, button string) error { if len(customFieldID) == 0 { @@ -213,6 +224,7 @@ func (c *CustomFields) RadioButton(customFieldID, button string) error { return nil } +// User adds a user custom field to the collection. func (c *CustomFields) User(customFieldID string, accountID string) error { if len(customFieldID) == 0 { @@ -236,6 +248,7 @@ func (c *CustomFields) User(customFieldID string, accountID string) error { return nil } +// Users adds a multi-user custom field to the collection. func (c *CustomFields) Users(customFieldID string, accountIDs []string) error { if len(customFieldID) == 0 { @@ -265,6 +278,7 @@ func (c *CustomFields) Users(customFieldID string, accountIDs []string) error { return nil } +// Number adds a number custom field to the collection. func (c *CustomFields) Number(customFieldID string, numberValue float64) error { if len(customFieldID) == 0 { @@ -281,6 +295,7 @@ func (c *CustomFields) Number(customFieldID string, numberValue float64) error { return nil } +// CheckBox adds a checkbox custom field to the collection. func (c *CustomFields) CheckBox(customFieldID string, options []string) error { if len(customFieldID) == 0 { @@ -310,6 +325,7 @@ func (c *CustomFields) CheckBox(customFieldID string, options []string) error { return nil } +// Cascading adds a cascading custom field to the collection. func (c *CustomFields) Cascading(customFieldID, parent, child string) error { if len(customFieldID) == 0 { From 0a83fc74b4e98a2b9747ed0211660343069028bb Mon Sep 17 00:00:00 2001 From: Carlos Treminio Date: Thu, 7 Mar 2024 23:37:17 -0600 Subject: [PATCH 26/40] :sparkles: Support the possibility to adde multiobject on the issue update with operations 1. Fixes #255 --- pkg/infra/models/jira_issue_operations.go | 19 +++++ .../models/jira_issue_operations_test.go | 79 +++++++++++++++++++ 2 files changed, 98 insertions(+) diff --git a/pkg/infra/models/jira_issue_operations.go b/pkg/infra/models/jira_issue_operations.go index ca8663b7..ca5577cf 100644 --- a/pkg/infra/models/jira_issue_operations.go +++ b/pkg/infra/models/jira_issue_operations.go @@ -57,3 +57,22 @@ func (u *UpdateOperations) AddStringOperation(customFieldID, operation, value st return nil } + +func (u *UpdateOperations) AddMultiRawOperation(customFieldID string, mappings []map[string]interface{}) error { + + if len(customFieldID) == 0 { + return ErrNoFieldIDError + } + + var operations []map[string]interface{} + operations = append(operations, mappings...) + + var fieldNode = map[string]interface{}{} + fieldNode[customFieldID] = operations + + var updateNode = map[string]interface{}{} + updateNode["update"] = fieldNode + + u.Fields = append(u.Fields, updateNode) + return nil +} diff --git a/pkg/infra/models/jira_issue_operations_test.go b/pkg/infra/models/jira_issue_operations_test.go index 22cd330f..fe19b145 100644 --- a/pkg/infra/models/jira_issue_operations_test.go +++ b/pkg/infra/models/jira_issue_operations_test.go @@ -1,6 +1,9 @@ package models import ( + "encoding/json" + "fmt" + "github.com/stretchr/testify/assert" "reflect" "testing" ) @@ -141,3 +144,79 @@ func TestUpdateOperations_AddStringOperation(t *testing.T) { }) } } + +func TestUpdateOperations_AddMultiRawOperation(t *testing.T) { + + expectedJson := `[{"update":{"custom_field_id":[{"add":{"id":"10001"}},{"remove":{"name":"Version 00"}},{"add":{"id":"1010"}}]}}]` + + type fields struct { + Fields []map[string]interface{} + } + type args struct { + customFieldID string + mappings []map[string]interface{} + } + + tests := []struct { + name string + fields fields + args args + wantErr assert.ErrorAssertionFunc + expectedErr bool + }{ + { + name: "when the parameters are correct", + fields: fields{}, + args: args{ + customFieldID: "custom_field_id", + mappings: []map[string]interface{}{ + { + "add": map[string]interface{}{ + "id": "10001", + }, + }, + { + "remove": map[string]interface{}{ + "name": "Version 00", + }, + }, + { + "add": map[string]interface{}{ + "id": "1010", + }, + }, + }, + }, + wantErr: assert.NoError, + }, + + { + name: "when the customfieldID is not provided", + fields: fields{}, + args: args{ + customFieldID: "", + }, + wantErr: assert.Error, + expectedErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + u := &UpdateOperations{ + Fields: tt.fields.Fields, + } + + tt.wantErr(t, u.AddMultiRawOperation(tt.args.customFieldID, tt.args.mappings), + fmt.Sprintf("AddMultiRawOperation(%v, %v)", tt.args.customFieldID, tt.args.mappings)) + + if !tt.expectedErr { + actualJson, err := json.Marshal(u.Fields) + if err != nil { + t.Fatal(err) + } + + assert.Equal(t, expectedJson, string(actualJson)) + } + }) + } +} From c697e8f22fa512bb0ffde29268b35fa9e5a19ddb Mon Sep 17 00:00:00 2001 From: Carlos Treminio Date: Sat, 15 Jun 2024 23:46:07 -0600 Subject: [PATCH 27/40] README.md edited (#266) --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index a9b28bc4..6736b710 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,9 @@ ![GitHub](https://img.shields.io/github/license/ctreminiom/go-atlassian) [![Mentioned in Awesome Go-Atlassian](https://awesome.re/mentioned-badge-flat.svg)](https://github.com/avelino/awesome-go#third-party-apis) [![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/4861/badge)](https://bestpractices.coreinfrastructure.org/projects/4861) +[![OpenSSF Best Practices](https://img.shields.io/ossf-scorecard/github.com/ctreminiom/go-atlassian?label=openssf%20scorecard&style=flat)](https://img.shields.io/ossf-scorecard/github.com/ctreminiom/go-atlassian?label=openssf%20scorecard&style=flat) [![Documentation](https://img.shields.io/badge/%F0%9F%92%A1%20go-documentation-00ACD7.svg?style=flat)](https://docs.go-atlassian.io/) +[![Sourcegraph](https://sourcegraph.com/github.com/ctreminiom/go-atlassian/-/badge.svg)](https://sourcegraph.com/github.com/ctreminiom/go-atlassian?badge) [![Dependency Review](https://github.com/ctreminiom/go-atlassian/actions/workflows/dependency-review.yml/badge.svg)](https://github.com/ctreminiom/go-atlassian/actions/workflows/dependency-review.yml) [![Analysis](https://github.com/ctreminiom/go-atlassian/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/ctreminiom/go-atlassian/actions/workflows/codeql-analysis.yml) From ec97dc8d19bc0a6b3a16f5f447740383ec7af037 Mon Sep 17 00:00:00 2001 From: Carlos Treminio Date: Sun, 16 Jun 2024 20:03:15 -0600 Subject: [PATCH 28/40] Fixed the security warnings. (#267) --- pkg/infra/models/admin_organization.go | 4 +- pkg/infra/models/admin_user.go | 109 ++-- pkg/infra/models/admin_user_token.go | 14 +- pkg/infra/models/agile_epic.go | 21 +- pkg/infra/models/agile_sprint.go | 44 ++ pkg/infra/models/assets_aql.go | 104 ++-- pkg/infra/models/assets_icon.go | 14 +- pkg/infra/models/assets_object.go | 503 +++++++++++------- pkg/infra/models/assets_object_schema.go | 68 ++- pkg/infra/models/assets_object_type.go | 97 ++-- pkg/infra/models/assets_ticket.go | 57 +- pkg/infra/models/bitbucket_branch.go | 7 +- pkg/infra/models/bitbucket_projects.go | 38 +- pkg/infra/models/bitbucket_repository.go | 118 ++-- pkg/infra/models/bitbucket_webhooks.go | 61 ++- pkg/infra/models/bitbucket_workspace.go | 57 +- .../models/bitbucket_workspace_membership.go | 108 ++-- pkg/infra/models/confluence_analytics.go | 7 +- pkg/infra/models/confluence_attachment.go | 66 ++- pkg/infra/models/confluence_content.go | 139 ++++- .../models/confluence_content_attachement.go | 10 +- .../models/confluence_content_children.go | 55 +- pkg/infra/models/confluence_content_label.go | 23 +- .../models/confluence_content_permission.go | 28 +- .../models/confluence_content_property.go | 40 +- .../models/confluence_content_restriction.go | 48 +- .../models/confluence_content_version.go | 51 +- pkg/infra/models/confluence_custom_content.go | 96 ++-- pkg/infra/models/confluence_label.go | 21 +- pkg/infra/models/confluence_long_task.go | 47 +- pkg/infra/models/confluence_page.go | 111 ++-- pkg/infra/models/confluence_search.go | 6 + pkg/infra/models/confluence_space.go | 16 + .../models/confluence_space_permission.go | 29 +- pkg/infra/models/confluence_space_v2.go | 70 +-- pkg/infra/models/const.go | 2 + pkg/infra/models/jira_announcement_banner.go | 20 +- pkg/infra/models/jira_applicationRole.go | 25 +- pkg/infra/models/jira_audit.go | 68 +-- pkg/infra/models/jira_avatar.go | 9 +- pkg/infra/models/jira_changelog.go | 50 +- pkg/infra/models/jira_comment_v2.go | 35 +- pkg/infra/models/jira_component.go | 45 +- pkg/infra/models/jira_dashboard.go | 76 +-- pkg/infra/models/jira_field.go | 6 + pkg/infra/models/jira_field_configuration.go | 45 +- .../models/jira_field_configuration_scheme.go | 65 ++- pkg/infra/models/jira_field_context.go | 107 ++-- pkg/infra/models/jira_field_context_option.go | 62 ++- pkg/infra/models/jira_filter.go | 11 + pkg/infra/models/jira_group.go | 89 ++-- pkg/infra/models/jira_issue_attachments.go | 65 +-- pkg/infra/models/jira_issue_metadata.go | 11 +- pkg/infra/models/jira_issue_operations.go | 30 ++ .../models/jira_issue_operations_test.go | 4 +- pkg/infra/models/jira_issue_search.go | 13 +- pkg/infra/models/jira_issue_security.go | 12 +- pkg/infra/models/jira_issue_type.go | 37 +- pkg/infra/models/jira_issue_type_scheme.go | 44 +- .../models/jira_issue_type_screen_scheme.go | 116 ++-- pkg/infra/models/jira_issue_v2.go | 90 ++-- pkg/infra/models/jira_issue_v3.go | 174 +++--- pkg/infra/models/jira_jql.go | 40 +- pkg/infra/models/jira_labels.go | 11 +- pkg/infra/models/jira_links.go | 122 +++-- pkg/infra/models/jira_notification_scheme.go | 62 ++- pkg/infra/models/jira_permission.go | 64 ++- pkg/infra/models/jira_permission_scheme.go | 33 +- pkg/infra/models/jira_priority.go | 13 +- pkg/infra/models/jira_project.go | 218 ++++---- pkg/infra/models/jira_project_category.go | 5 +- pkg/infra/models/jira_project_feature.go | 20 +- pkg/infra/models/jira_project_notification.go | 50 +- pkg/infra/models/jira_project_property.go | 13 +- pkg/infra/models/jira_project_role.go | 24 +- pkg/infra/models/jira_project_type.go | 11 +- pkg/infra/models/jira_project_validation.go | 7 +- pkg/infra/models/jira_remote_links.go | 46 +- pkg/infra/models/jira_resolution.go | 9 +- pkg/infra/models/jira_role.go | 50 +- pkg/infra/models/jira_screen.go | 72 +-- pkg/infra/models/jira_screen_scheme.go | 68 +-- pkg/infra/models/jira_search_v2.go | 13 +- pkg/infra/models/jira_search_v3.go | 18 +- pkg/infra/models/jira_security.go | 9 +- pkg/infra/models/jira_server.go | 28 +- pkg/infra/models/jira_task.go | 25 +- pkg/infra/models/jira_teams.go | 51 +- pkg/infra/models/jira_user.go | 90 ++-- pkg/infra/models/jira_version.go | 124 +++-- pkg/infra/models/jira_vote.go | 9 +- pkg/infra/models/jira_watcher.go | 28 +- pkg/infra/models/jira_work_log.go | 129 +++-- pkg/infra/models/jira_workflow.go | 136 ++--- pkg/infra/models/jira_workflow_scheme.go | 53 +- .../models/jira_workflow_scheme_issue_type.go | 19 +- pkg/infra/models/jira_workflow_status.go | 79 +-- pkg/infra/models/shared_service.go | 11 +- pkg/infra/models/sm_customer.go | 48 +- pkg/infra/models/sm_info.go | 25 +- pkg/infra/models/sm_knowledge_base.go | 41 +- pkg/infra/models/sm_organization.go | 83 +-- pkg/infra/models/sm_request.go | 162 +++--- pkg/infra/models/sm_request_approval.go | 75 +-- pkg/infra/models/sm_request_attachments.go | 85 +-- pkg/infra/models/sm_request_comment.go | 51 +- pkg/infra/models/sm_request_feedback.go | 10 +- pkg/infra/models/sm_request_field.go | 57 +- pkg/infra/models/sm_request_participants.go | 48 +- pkg/infra/models/sm_request_sla.go | 45 +- pkg/infra/models/sm_request_type.go | 118 ++-- pkg/infra/models/sm_service_desk.go | 49 +- pkg/infra/models/sm_service_desk_queue.go | 55 +- pkg/infra/models/sm_workspace.go | 25 +- 114 files changed, 3709 insertions(+), 2626 deletions(-) diff --git a/pkg/infra/models/admin_organization.go b/pkg/infra/models/admin_organization.go index af661562..7e685756 100644 --- a/pkg/infra/models/admin_organization.go +++ b/pkg/infra/models/admin_organization.go @@ -226,10 +226,10 @@ type UserProductAccessDataScheme struct { // UserProductLastActiveScheme represents a product a user has access to. type UserProductLastActiveScheme struct { - Id string `json:"id,omitempty"` // The ID of the product. + ID string `json:"id,omitempty"` // The ID of the product. Key string `json:"key,omitempty"` // The key of the product. Name string `json:"name,omitempty"` // The name of the product. - Url string `json:"url,omitempty"` // The URL of the product. + URL string `json:"url,omitempty"` // The URL of the product. LastActive string `json:"last_active,omitempty"` // The last active time of the product. } diff --git a/pkg/infra/models/admin_user.go b/pkg/infra/models/admin_user.go index df676725..9460e290 100644 --- a/pkg/infra/models/admin_user.go +++ b/pkg/infra/models/admin_user.go @@ -1,75 +1,84 @@ +// Package models provides the data structures used in the admin user management. package models +// AdminUserScheme represents an admin user account. type AdminUserScheme struct { - Account *AdminUserAccountScheme `json:"account,omitempty"` + Account *AdminUserAccountScheme `json:"account,omitempty"` // The account details of the admin user. } +// AdminUserAccountScheme represents the account details of an admin user. type AdminUserAccountScheme struct { - AccountID string `json:"account_id,omitempty"` - Name string `json:"name,omitempty"` - Nickname string `json:"nickname,omitempty"` - ZoneInfo string `json:"zoneinfo,omitempty"` - Locale string `json:"locale,omitempty"` - Email string `json:"email,omitempty"` - Picture string `json:"picture,omitempty"` - AccountType string `json:"account_type,omitempty"` - AccountStatus string `json:"account_status,omitempty"` - EmailVerified bool `json:"email_verified,omitempty"` - ExtendedProfile *AdminUserExtendedProfileScheme `json:"extended_profile"` - PrivacySettings *AdminUserPrivacySettingsScheme `json:"privacy_settings"` + AccountID string `json:"account_id,omitempty"` // The account ID of the admin user. + Name string `json:"name,omitempty"` // The name of the admin user. + Nickname string `json:"nickname,omitempty"` // The nickname of the admin user. + ZoneInfo string `json:"zoneinfo,omitempty"` // The timezone information of the admin user. + Locale string `json:"locale,omitempty"` // The locale of the admin user. + Email string `json:"email,omitempty"` // The email of the admin user. + Picture string `json:"picture,omitempty"` // The picture of the admin user. + AccountType string `json:"account_type,omitempty"` // The account type of the admin user. + AccountStatus string `json:"account_status,omitempty"` // The account status of the admin user. + EmailVerified bool `json:"email_verified,omitempty"` // Whether the email of the admin user is verified. + ExtendedProfile *AdminUserExtendedProfileScheme `json:"extended_profile"` // The extended profile of the admin user. + PrivacySettings *AdminUserPrivacySettingsScheme `json:"privacy_settings"` // The privacy settings of the admin user. } +// AdminUserExtendedProfileScheme represents the extended profile of an admin user. type AdminUserExtendedProfileScheme struct { - JobTitle string `json:"job_title,omitempty"` - TeamType string `json:"team_type,omitempty"` + JobTitle string `json:"job_title,omitempty"` // The job title of the admin user. + TeamType string `json:"team_type,omitempty"` // The team type of the admin user. } +// AdminUserPrivacySettingsScheme represents the privacy settings of an admin user. type AdminUserPrivacySettingsScheme struct { - Name string `json:"name,omitempty"` - Nickname string `json:"nickname,omitempty"` - Picture string `json:"picture,omitempty"` - ExtendedProfileJobTitle string `json:"extended_profile.job_title,omitempty"` - ExtendedProfileDepartment string `json:"extended_profile.department,omitempty"` - ExtendedProfileOrganization string `json:"extended_profile.organization,omitempty"` - ExtendedProfileLocation string `json:"extended_profile.location,omitempty"` - ZoneInfo string `json:"zoneinfo,omitempty"` - Email string `json:"email,omitempty"` - ExtendedProfilePhoneNumber string `json:"extended_profile.phone_number,omitempty"` - ExtendedProfileTeamType string `json:"extended_profile.team_type,omitempty"` + Name string `json:"name,omitempty"` // The name privacy setting of the admin user. + Nickname string `json:"nickname,omitempty"` // The nickname privacy setting of the admin user. + Picture string `json:"picture,omitempty"` // The picture privacy setting of the admin user. + ExtendedProfileJobTitle string `json:"extended_profile.job_title,omitempty"` // The job title privacy setting of the admin user. + ExtendedProfileDepartment string `json:"extended_profile.department,omitempty"` // The department privacy setting of the admin user. + ExtendedProfileOrganization string `json:"extended_profile.organization,omitempty"` // The organization privacy setting of the admin user. + ExtendedProfileLocation string `json:"extended_profile.location,omitempty"` // The location privacy setting of the admin user. + ZoneInfo string `json:"zoneinfo,omitempty"` // The timezone information privacy setting of the admin user. + Email string `json:"email,omitempty"` // The email privacy setting of the admin user. + ExtendedProfilePhoneNumber string `json:"extended_profile.phone_number,omitempty"` // The phone number privacy setting of the admin user. + ExtendedProfileTeamType string `json:"extended_profile.team_type,omitempty"` // The team type privacy setting of the admin user. } +// AdminUserPermissionGrantScheme represents a permission grant of an admin user. type AdminUserPermissionGrantScheme struct { - Allowed bool `json:"allowed,omitempty"` - Reason *AdminUserPermissionGrantReasonScheme `json:"reason,omitempty"` + Allowed bool `json:"allowed,omitempty"` // Whether the permission is allowed. + Reason *AdminUserPermissionGrantReasonScheme `json:"reason,omitempty"` // The reason for the permission grant. } +// AdminUserPermissionGrantReasonScheme represents the reason for a permission grant of an admin user. type AdminUserPermissionGrantReasonScheme struct { - Key string `json:"key,omitempty"` + Key string `json:"key,omitempty"` // The key of the reason. } +// AdminUserPermissionScheme represents the permissions of an admin user. type AdminUserPermissionScheme struct { - EmailSet *AdminUserPermissionGrantScheme `json:"email.set,omitempty"` - LifecycleEnablement *AdminUserPermissionGrantScheme `json:"lifecycle.enablement,omitempty"` - Profile *AdminUserPermissionProfileScheme `json:"profile,omitempty"` - ProfileWrite *AdminUserPermissionProfileScheme `json:"profile.write,omitempty"` - ProfileRead *AdminUserPermissionGrantScheme `json:"profile.read,omitempty"` - LinkedAccountsRead *AdminUserPermissionGrantScheme `json:"linkedAccounts.read,omitempty"` - APITokenRead *AdminUserPermissionGrantScheme `json:"apiToken.read,omitempty"` - APITokenDelete *AdminUserPermissionGrantScheme `json:"apiToken.delete,omitempty"` - Avatar *AdminUserPermissionGrantScheme `json:"avatar,omitempty"` - PrivacySet *AdminUserPermissionGrantScheme `json:"privacy.set,omitempty"` - SessionRead *AdminUserPermissionGrantScheme `json:"session.read,omitempty"` + EmailSet *AdminUserPermissionGrantScheme `json:"email.set,omitempty"` // The email set permission of the admin user. + LifecycleEnablement *AdminUserPermissionGrantScheme `json:"lifecycle.enablement,omitempty"` // The lifecycle enablement permission of the admin user. + Profile *AdminUserPermissionProfileScheme `json:"profile,omitempty"` // The profile permission of the admin user. + ProfileWrite *AdminUserPermissionProfileScheme `json:"profile.write,omitempty"` // The profile write permission of the admin user. + ProfileRead *AdminUserPermissionGrantScheme `json:"profile.read,omitempty"` // The profile read permission of the admin user. + LinkedAccountsRead *AdminUserPermissionGrantScheme `json:"linkedAccounts.read,omitempty"` // The linked accounts read permission of the admin user. + APITokenRead *AdminUserPermissionGrantScheme `json:"apiToken.read,omitempty"` // The API token read permission of the admin user. + APITokenDelete *AdminUserPermissionGrantScheme `json:"apiToken.delete,omitempty"` // The API token delete permission of the admin user. + Avatar *AdminUserPermissionGrantScheme `json:"avatar,omitempty"` // The avatar permission of the admin user. + PrivacySet *AdminUserPermissionGrantScheme `json:"privacy.set,omitempty"` // The privacy set permission of the admin user. + SessionRead *AdminUserPermissionGrantScheme `json:"session.read,omitempty"` // The session read permission of the admin user. } +// AdminUserPermissionProfileScheme represents the profile permissions of an admin user. type AdminUserPermissionProfileScheme struct { - Name *AdminUserPermissionGrantScheme `json:"name,omitempty"` - Nickname *AdminUserPermissionGrantScheme `json:"nickname,omitempty"` - Zoneinfo *AdminUserPermissionGrantScheme `json:"zoneinfo,omitempty"` - Locale *AdminUserPermissionGrantScheme `json:"locale,omitempty"` - ExtendedProfilePhoneNumber *AdminUserPermissionGrantScheme `json:"extended_profile.phone_number,omitempty"` - ExtendedProfileJobTitle *AdminUserPermissionGrantScheme `json:"extended_profile.job_title,omitempty"` - ExtendedProfileOrganization *AdminUserPermissionGrantScheme `json:"extended_profile.organization,omitempty"` - ExtendedProfileDepartment *AdminUserPermissionGrantScheme `json:"extended_profile.department,omitempty"` - ExtendedProfileLocation *AdminUserPermissionGrantScheme `json:"extended_profile.location,omitempty"` - ExtendedProfileTeamType *AdminUserPermissionGrantScheme `json:"extended_profile.team_type,omitempty"` + Name *AdminUserPermissionGrantScheme `json:"name,omitempty"` // The name permission of the admin user. + Nickname *AdminUserPermissionGrantScheme `json:"nickname,omitempty"` // The nickname permission of the admin user. + Zoneinfo *AdminUserPermissionGrantScheme `json:"zoneinfo,omitempty"` // The timezone information permission of the admin user. + Locale *AdminUserPermissionGrantScheme `json:"locale,omitempty"` // The locale permission of the admin user. + ExtendedProfilePhoneNumber *AdminUserPermissionGrantScheme `json:"extended_profile.phone_number,omitempty"` // The phone number permission of the admin user. + ExtendedProfileJobTitle *AdminUserPermissionGrantScheme `json:"extended_profile.job_title,omitempty"` // The job title permission of the admin user. + ExtendedProfileOrganization *AdminUserPermissionGrantScheme `json:"extended_profile.organization,omitempty"` // The organization permission of the admin user. + ExtendedProfileDepartment *AdminUserPermissionGrantScheme `json:"extended_profile.department,omitempty"` // The department permission of the admin user. + ExtendedProfileLocation *AdminUserPermissionGrantScheme `json:"extended_profile.location,omitempty"` // The location permission of the admin user. + ExtendedProfileTeamType *AdminUserPermissionGrantScheme `json:"extended_profile.team_type,omitempty"` // The team type permission of the admin user. } diff --git a/pkg/infra/models/admin_user_token.go b/pkg/infra/models/admin_user_token.go index 79ceb28d..75ab107e 100644 --- a/pkg/infra/models/admin_user_token.go +++ b/pkg/infra/models/admin_user_token.go @@ -1,10 +1,16 @@ +// Package models provides the data structures used in the user token management. package models import "time" +// UserTokensScheme represents a user token. +// ID is the unique identifier of the token. +// Label is the label assigned to the token. +// CreatedAt is the time when the token was created. +// LastAccess is the last time the token was accessed. type UserTokensScheme struct { - ID string `json:"id,omitempty"` - Label string `json:"label,omitempty"` - CreatedAt time.Time `json:"createdAt,omitempty"` - LastAccess time.Time `json:"lastAccess,omitempty"` + ID string `json:"id,omitempty"` // The ID of the user token. + Label string `json:"label,omitempty"` // The label of the user token. + CreatedAt time.Time `json:"createdAt,omitempty"` // The creation time of the user token. + LastAccess time.Time `json:"lastAccess,omitempty"` // The last access time of the user token. } diff --git a/pkg/infra/models/agile_epic.go b/pkg/infra/models/agile_epic.go index 12e9804e..685bed47 100644 --- a/pkg/infra/models/agile_epic.go +++ b/pkg/infra/models/agile_epic.go @@ -1,14 +1,19 @@ +// Package models provides the data structures used in the agile management. package models +// EpicScheme represents an agile epic. type EpicScheme struct { - ID int `json:"id,omitempty"` - Key string `json:"key,omitempty"` - Self string `json:"self,omitempty"` - Name string `json:"name,omitempty"` - Summary string `json:"summary,omitempty"` - Color *EpicColorScheme `json:"color,omitempty"` - Done bool `json:"done,omitempty"` + ID int `json:"id,omitempty"` // The ID of the epic. + Key string `json:"key,omitempty"` // The key of the epic. + Self string `json:"self,omitempty"` // The self URL of the epic. + Name string `json:"name,omitempty"` // The name of the epic. + Summary string `json:"summary,omitempty"` // The summary of the epic. + Color *EpicColorScheme `json:"color,omitempty"` // The color scheme of the epic. + Done bool `json:"done,omitempty"` // The status of the epic. } + +// EpicColorScheme represents the color scheme of an epic. +// Key is the key of the color scheme. type EpicColorScheme struct { - Key string `json:"key,omitempty"` + Key string `json:"key,omitempty"` // The key of the color scheme. } diff --git a/pkg/infra/models/agile_sprint.go b/pkg/infra/models/agile_sprint.go index 1e0ca095..c9be4dc9 100644 --- a/pkg/infra/models/agile_sprint.go +++ b/pkg/infra/models/agile_sprint.go @@ -1,7 +1,18 @@ +// Package models provides the data structures used in the agile sprint management. package models import "time" +// SprintScheme represents an agile sprint. +// ID is the unique identifier of the sprint. +// Self is the self URL of the sprint. +// State is the state of the sprint. +// Name is the name of the sprint. +// StartDate is the start date of the sprint. +// EndDate is the end date of the sprint. +// CompleteDate is the completion date of the sprint. +// OriginBoardID is the ID of the board where the sprint originated. +// Goal is the goal of the sprint. type SprintScheme struct { ID int `json:"id,omitempty"` Self string `json:"self,omitempty"` @@ -14,6 +25,13 @@ type SprintScheme struct { Goal string `json:"goal,omitempty"` } +// SprintPayloadScheme represents the payload for creating or updating a sprint. +// Name is the name of the sprint. +// StartDate is the start date of the sprint. +// EndDate is the end date of the sprint. +// OriginBoardID is the ID of the board where the sprint originated. +// Goal is the goal of the sprint. +// State is the state of the sprint. type SprintPayloadScheme struct { Name string `json:"name,omitempty"` StartDate string `json:"startDate,omitempty"` @@ -23,6 +41,12 @@ type SprintPayloadScheme struct { State string `json:"state,omitempty"` } +// SprintIssuePageScheme represents a page of issues in a sprint. +// Expand is a string that contains the instructions for expanding the issues in the page. +// StartAt is the starting index of the page. +// MaxResults is the maximum number of results per page. +// Total is the total number of issues. +// Issues is a slice of the issues in the page. type SprintIssuePageScheme struct { Expand string `json:"expand,omitempty"` StartAt int `json:"startAt,omitempty"` @@ -31,6 +55,11 @@ type SprintIssuePageScheme struct { Issues []*SprintIssueScheme `json:"issues,omitempty"` } +// SprintIssueScheme represents an issue in a sprint. +// Expand is a string that contains the instructions for expanding the issue. +// ID is the unique identifier of the issue. +// Self is the self URL of the issue. +// Key is the key of the issue. type SprintIssueScheme struct { Expand string `json:"expand,omitempty"` ID string `json:"id,omitempty"` @@ -38,6 +67,11 @@ type SprintIssueScheme struct { Key string `json:"key,omitempty"` } +// SprintMovePayloadScheme represents the payload for moving an issue in a sprint. +// Issues is a slice of the issues to be moved. +// RankBeforeIssue is the rank of the issue before the move. +// RankAfterIssue is the rank of the issue after the move. +// RankCustomFieldId is the ID of the custom field used for ranking. type SprintMovePayloadScheme struct { Issues []string `json:"issues,omitempty"` RankBeforeIssue string `json:"rankBeforeIssue,omitempty"` @@ -45,6 +79,16 @@ type SprintMovePayloadScheme struct { RankCustomFieldId int `json:"rankCustomFieldId,omitempty"` } +// SprintDetailScheme represents the details of a sprint. +// ID is the unique identifier of the sprint. +// State is the state of the sprint. +// Name is the name of the sprint. +// StartDate is the start date of the sprint. +// EndDate is the end date of the sprint. +// CompleteDate is the completion date of the sprint. +// OriginBoardID is the ID of the board where the sprint originated. +// Goal is the goal of the sprint. +// BoardID is the ID of the board where the sprint is located. type SprintDetailScheme struct { ID int `json:"id,omitempty"` State string `json:"state,omitempty"` diff --git a/pkg/infra/models/assets_aql.go b/pkg/infra/models/assets_aql.go index 181faf3e..b925e562 100644 --- a/pkg/infra/models/assets_aql.go +++ b/pkg/infra/models/assets_aql.go @@ -1,65 +1,81 @@ +// Package models provides the data structures used in the AQL search parameters. package models +// AQLSearchParamsScheme represents the parameters for an AQL search. type AQLSearchParamsScheme struct { - // The query to determine which objects that should be fetched. - // - // E.g. objectType = "Computer". The empty AQL means all objects + // Query is the AQL query to determine which objects should be fetched. Query string `query:"qlQuery,omitempty"` - // Which page to fetch when paginating through the response + // Page is the page number to fetch when paginating through the response. Page int `query:"page,omitempty"` - // The amount of objects returned per page + // ResultPerPage is the number of objects returned per page. ResultPerPage int `query:"resultPerPage,omitempty"` - // Should the objects attributes be included in the response. - // - // If this parameter is false only the information on the object will - // - // be returned and the object attributes will not be present + // IncludeAttributes determines if the objects' attributes should be included in the response. IncludeAttributes bool `query:"includeAttributes,omitempty"` - // How many levels of attributes should be included. - // - // E.g. consider an object A that has a reference to object B that has a reference to object C. - // - // If object A is included in the response and includeAttributesDeep=1 object A's reference to - // - // object B will be included in the attributes of object A but object B's reference to - // - // object C will not be included. However, if the includeAttributesDeep=2 then object B's - // - // reference to object C will be included in object B's attributes + // IncludeAttributesDeep determines how many levels of attributes should be included. IncludeAttributesDeep bool `query:"includeAttributesDeep,omitempty"` - // Should the response include the object type attribute definition - // - // for each attribute that is returned with the objects + // IncludeTypeAttributes determines if the response should include the object type attribute definition for each attribute returned with the objects. IncludeTypeAttributes bool `query:"includeTypeAttributes,omitempty"` - // Include information about open Jira issues. - // - // Should each object have information if open tickets are connected to the object? + // IncludeExtendedInfo determines if each object should have information if open tickets are connected to the object. IncludeExtendedInfo bool `query:"includeExtendedInfo,omitempty"` } +// ObjectPageScheme represents a page of objects in an AQL search. type ObjectPageScheme struct { - ObjectEntries []*ObjectScheme `json:"objectEntries"` - ObjectTypeAttributes []*ObjectTypeAttributeScheme `json:"objectTypeAttributes"` - ObjectTypeID string `json:"objectTypeId"` - ObjectTypeIsInherited bool `json:"objectTypeIsInherited"` - AbstractObjectType bool `json:"abstractObjectType"` - TotalFilterCount int `json:"totalFilterCount"` - StartIndex int `json:"startIndex"` - ToIndex int `json:"toIndex"` - PageObjectSize int `json:"pageObjectSize"` - PageNumber int `json:"pageNumber"` - OrderByTypeAttrId int `json:"orderByTypeAttrId"` - OrderWay string `json:"orderWay"` - QlQuery string `json:"qlQuery"` - QlQuerySearchResult bool `json:"qlQuerySearchResult"` - Iql string `json:"iql"` - IqlSearchResult bool `json:"iqlSearchResult"` - ConversionPossible bool `json:"conversionPossible"` + // ObjectEntries is a slice of the objects in the page. + ObjectEntries []*ObjectScheme `json:"objectEntries"` + + // ObjectTypeAttributes is a slice of the object type attributes in the page. + ObjectTypeAttributes []*ObjectTypeAttributeScheme `json:"objectTypeAttributes"` + + // ObjectTypeID is the ID of the object type. + ObjectTypeID string `json:"objectTypeId"` + + // ObjectTypeIsInherited determines if the object type is inherited. + ObjectTypeIsInherited bool `json:"objectTypeIsInherited"` + + // AbstractObjectType determines if the object type is abstract. + AbstractObjectType bool `json:"abstractObjectType"` + + // TotalFilterCount is the total number of filters applied. + TotalFilterCount int `json:"totalFilterCount"` + + // StartIndex is the starting index of the page. + StartIndex int `json:"startIndex"` + + // ToIndex is the ending index of the page. + ToIndex int `json:"toIndex"` + + // PageObjectSize is the number of objects in the page. + PageObjectSize int `json:"pageObjectSize"` + + // PageNumber is the number of the page. + PageNumber int `json:"pageNumber"` + + // OrderByTypeAttrId is the ID of the attribute used for ordering. + OrderByTypeAttrId int `json:"orderByTypeAttrId"` + + // OrderWay is the way of ordering (ascending or descending). + OrderWay string `json:"orderWay"` + + // QlQuery is the AQL query used for the search. + QlQuery string `json:"qlQuery"` + + // QlQuerySearchResult determines if the result is from an AQL query search. + QlQuerySearchResult bool `json:"qlQuerySearchResult"` + + // Iql is the IQL query used for the search. + Iql string `json:"iql"` + + // IqlSearchResult determines if the result is from an IQL query search. + IqlSearchResult bool `json:"iqlSearchResult"` + + // ConversionPossible determines if a conversion is possible. + ConversionPossible bool `json:"conversionPossible"` } diff --git a/pkg/infra/models/assets_icon.go b/pkg/infra/models/assets_icon.go index f33456e1..ff35b41a 100644 --- a/pkg/infra/models/assets_icon.go +++ b/pkg/infra/models/assets_icon.go @@ -1,8 +1,14 @@ +// Package models provides the data structures used in the asset icon management. package models +// IconScheme represents an asset icon. +// ID is the unique identifier of the icon. +// Name is the name of the icon. +// URL16 is the URL for the 16x16 version of the icon. +// URL48 is the URL for the 48x48 version of the icon. type IconScheme struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - URL16 string `json:"url16,omitempty"` - URL48 string `json:"url48,omitempty"` + ID string `json:"id,omitempty"` // The ID of the icon. + Name string `json:"name,omitempty"` // The name of the icon. + URL16 string `json:"url16,omitempty"` // The URL for the 16x16 version of the icon. + URL48 string `json:"url48,omitempty"` // The URL for the 48x48 version of the icon. } diff --git a/pkg/infra/models/assets_object.go b/pkg/infra/models/assets_object.go index 4bee39e4..11e58a1f 100644 --- a/pkg/infra/models/assets_object.go +++ b/pkg/infra/models/assets_object.go @@ -1,273 +1,364 @@ package models +// ObjectReferenceTypeInfoScheme represents the information about an object reference type. +// ReferenceTypes is a slice of the reference types. +// ObjectType is the type of the object. +// NumberOfReferencedObjects is the number of objects that reference this type. +// OpenIssuesExists is a boolean indicating if there are open issues related to this type. type ObjectReferenceTypeInfoScheme struct { - ReferenceTypes []*TypeReferenceScheme `json:"referenceTypes,omitempty"` - ObjectType *ObjectTypeScheme `json:"objectType,omitempty"` - NumberOfReferencedObjects int `json:"numberOfReferencedObjects,omitempty"` - OpenIssuesExists bool `json:"openIssuesExists,omitempty"` + ReferenceTypes []*TypeReferenceScheme `json:"referenceTypes,omitempty"` // The reference types of the object. + ObjectType *ObjectTypeScheme `json:"objectType,omitempty"` // The type of the object. + NumberOfReferencedObjects int `json:"numberOfReferencedObjects,omitempty"` // The number of referenced objects. + OpenIssuesExists bool `json:"openIssuesExists,omitempty"` // Indicates if there are open issues related to this type. } +// TypeReferenceScheme represents a type reference. +// WorkspaceID is the ID of the workspace. +// GlobalID is the global ID of the type reference. +// ID is the unique identifier of the type reference. +// Name is the name of the type reference. +// Description is the description of the type reference. +// Color is the color of the type reference. +// URL16 is the URL for the 16x16 version of the type reference. +// Removable indicates if the type reference is removable. +// ObjectSchemaID is the ID of the object schema. type TypeReferenceScheme struct { - WorkspaceID string `json:"workspaceId,omitempty"` - GlobalID string `json:"globalId,omitempty"` - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - Color string `json:"color,omitempty"` - URL16 string `json:"url16,omitempty"` - Removable bool `json:"removable,omitempty"` - ObjectSchemaID string `json:"objectSchemaId,omitempty"` + WorkspaceID string `json:"workspaceId,omitempty"` // The ID of the workspace. + GlobalID string `json:"globalId,omitempty"` // The global ID of the type reference. + ID string `json:"id,omitempty"` // The ID of the type reference. + Name string `json:"name,omitempty"` // The name of the type reference. + Description string `json:"description,omitempty"` // The description of the type reference. + Color string `json:"color,omitempty"` // The color of the type reference. + URL16 string `json:"url16,omitempty"` // The URL for the 16x16 version of the type reference. + Removable bool `json:"removable,omitempty"` // Indicates if the type reference is removable. + ObjectSchemaID string `json:"objectSchemaId,omitempty"` // The ID of the object schema. } +// ObjectHistoryScheme represents the history of an object. +// Actor is the actor who made the change. +// ID is the unique identifier of the history entry. +// AffectedAttribute is the attribute that was affected. +// OldValue is the old value of the attribute. +// NewValue is the new value of the attribute. +// Type is the type of the history entry. +// Created is the creation time of the history entry. +// ObjectID is the ID of the object. type ObjectHistoryScheme struct { - Actor *ObjectHistoryActorScheme `json:"actor,omitempty"` - ID string `json:"id,omitempty"` - AffectedAttribute string `json:"affectedAttribute,omitempty"` - OldValue string `json:"oldValue,omitempty"` - NewValue string `json:"newValue,omitempty"` - Type int `json:"type,omitempty"` - Created string `json:"created,omitempty"` - ObjectID string `json:"objectId,omitempty"` + Actor *ObjectHistoryActorScheme `json:"actor,omitempty"` // The actor who made the change. + ID string `json:"id,omitempty"` // The ID of the history entry. + AffectedAttribute string `json:"affectedAttribute,omitempty"` // The affected attribute. + OldValue string `json:"oldValue,omitempty"` // The old value of the attribute. + NewValue string `json:"newValue,omitempty"` // The new value of the attribute. + Type int `json:"type,omitempty"` // The type of the history entry. + Created string `json:"created,omitempty"` // The creation time of the history entry. + ObjectID string `json:"objectId,omitempty"` // The ID of the object. } +// ObjectHistoryActorScheme represents the actor who made a change in the object history. +// AvatarUrl is the URL of the actor's avatar. +// DisplayName is the display name of the actor. +// Name is the name of the actor. +// Key is the key of the actor. +// EmailAddress is the email address of the actor. +// Html is the HTML representation of the actor. +// RenderedLink is the rendered link of the actor. +// IsDeleted indicates if the actor is deleted. +// LastSeenVersion is the last seen version of the actor. +// Self is the self URL of the actor. type ObjectHistoryActorScheme struct { - AvatarUrl string `json:"avatarUrl,omitempty"` - DisplayName string `json:"displayName,omitempty"` - Name string `json:"name,omitempty"` - Key string `json:"key,omitempty"` - EmailAddress string `json:"emailAddress,omitempty"` - Html string `json:"html,omitempty"` - RenderedLink string `json:"renderedLink,omitempty"` - IsDeleted bool `json:"isDeleted,omitempty"` - LastSeenVersion string `json:"lastSeenVersion,omitempty"` - Self string `json:"self,omitempty"` + AvatarUrl string `json:"avatarUrl,omitempty"` // The URL of the actor's avatar. + DisplayName string `json:"displayName,omitempty"` // The display name of the actor. + Name string `json:"name,omitempty"` // The name of the actor. + Key string `json:"key,omitempty"` // The key of the actor. + EmailAddress string `json:"emailAddress,omitempty"` // The email address of the actor. + Html string `json:"html,omitempty"` // The HTML representation of the actor. + RenderedLink string `json:"renderedLink,omitempty"` // The rendered link of the actor. + IsDeleted bool `json:"isDeleted,omitempty"` // Indicates if the actor is deleted. + LastSeenVersion string `json:"lastSeenVersion,omitempty"` // The last seen version of the actor. + Self string `json:"self,omitempty"` // The self URL of the actor. } +// ObjectPayloadScheme represents the payload for an object. +// ObjectTypeID is the ID of the object type. +// AvatarUUID is the UUID of the avatar. +// HasAvatar indicates if the object has an avatar. +// Attributes is a slice of the attributes of the object. type ObjectPayloadScheme struct { - ObjectTypeID string `json:"objectTypeId,omitempty"` - AvatarUUID string `json:"avatarUUID,omitempty"` - HasAvatar bool `json:"hasAvatar,omitempty"` - Attributes []*ObjectPayloadAttributeScheme `json:"attributes,omitempty"` + ObjectTypeID string `json:"objectTypeId,omitempty"` // The ID of the object type. + AvatarUUID string `json:"avatarUUID,omitempty"` // The UUID of the avatar. + HasAvatar bool `json:"hasAvatar,omitempty"` // Indicates if the object has an avatar. + Attributes []*ObjectPayloadAttributeScheme `json:"attributes,omitempty"` // The attributes of the object. } +// ObjectPayloadAttributeScheme represents an attribute in the payload for an object. +// ObjectTypeAttributeID is the ID of the object type attribute. +// ObjectAttributeValues is a slice of the values of the object attribute. type ObjectPayloadAttributeScheme struct { - ObjectTypeAttributeID string `json:"objectTypeAttributeId,omitempty"` - ObjectAttributeValues []*ObjectPayloadAttributeValueScheme `json:"objectAttributeValues,omitempty"` + ObjectTypeAttributeID string `json:"objectTypeAttributeId,omitempty"` // The ID of the object type attribute. + ObjectAttributeValues []*ObjectPayloadAttributeValueScheme `json:"objectAttributeValues,omitempty"` // The values of the object attribute. } +// ObjectPayloadAttributeValueScheme represents the value of an attribute in the payload for an object. +// Value is the value of the attribute. type ObjectPayloadAttributeValueScheme struct { - Value string `json:"value,omitempty"` + Value string `json:"value,omitempty"` // The value of the attribute. } +// ObjectScheme represents an object. +// WorkspaceId is the ID of the workspace. +// GlobalId is the global ID of the object. +// ID is the unique identifier of the object. +// Label is the label of the object. +// ObjectKey is the key of the object. +// Avatar is the avatar of the object. +// ObjectType is the type of the object. +// Created is the creation time of the object. +// Updated is the update time of the object. +// HasAvatar indicates if the object has an avatar. +// Timestamp is the timestamp of the object. +// Attributes is a slice of the attributes of the object. +// Links is the links of the object. type ObjectScheme struct { - WorkspaceId string `json:"workspaceId,omitempty"` - GlobalId string `json:"globalId,omitempty"` - ID string `json:"id,omitempty"` - Label string `json:"label,omitempty"` - ObjectKey string `json:"objectKey,omitempty"` - Avatar *ObjectAvatarScheme `json:"avatar,omitempty"` - ObjectType *ObjectTypeScheme `json:"objectType,omitempty"` - Created string `json:"created,omitempty"` - Updated string `json:"updated,omitempty"` - HasAvatar bool `json:"hasAvatar,omitempty"` - Timestamp int `json:"timestamp,omitempty"` - Attributes []*ObjectAttributeScheme `json:"attributes"` - Links *ObjectLinksScheme `json:"_links,omitempty"` + WorkspaceId string `json:"workspaceId,omitempty"` // The ID of the workspace. + GlobalId string `json:"globalId,omitempty"` // The global ID of the object. + ID string `json:"id,omitempty"` // The ID of the object. + Label string `json:"label,omitempty"` // The label of the object. + ObjectKey string `json:"objectKey,omitempty"` // The key of the object. + Avatar *ObjectAvatarScheme `json:"avatar,omitempty"` // The avatar of the object. + ObjectType *ObjectTypeScheme `json:"objectType,omitempty"` // The type of the object. + Created string `json:"created,omitempty"` // The creation time of the object. + Updated string `json:"updated,omitempty"` // The update time of the object. + HasAvatar bool `json:"hasAvatar,omitempty"` // Indicates if the object has an avatar. + Timestamp int `json:"timestamp,omitempty"` // The timestamp of the object. + Attributes []*ObjectAttributeScheme `json:"attributes"` // The attributes of the object. + Links *ObjectLinksScheme `json:"_links,omitempty"` // The links of the object. } +// ObjectAvatarScheme represents an avatar of an object. +// WorkspaceId is the ID of the workspace. +// GlobalId is the global ID of the avatar. +// ID is the unique identifier of the avatar. +// AvatarUUID is the UUID of the avatar. +// Url16 is the URL for the 16x16 version of the avatar. +// Url48 is the URL for the 48x48 version of the avatar. +// Url72 is the URL for the 72x72 version of the avatar. +// Url144 is the URL for the 144x144 version of the avatar. +// Url288 is the URL for the 288x288 version of the avatar. +// ObjectId is the ID of the object. type ObjectAvatarScheme struct { - WorkspaceId string `json:"workspaceId,omitempty"` - GlobalId string `json:"globalId,omitempty"` - ID string `json:"id,omitempty"` - AvatarUUID string `json:"avatarUUID,omitempty"` - Url16 string `json:"url16,omitempty"` - Url48 string `json:"url48,omitempty"` - Url72 string `json:"url72,omitempty"` - Url144 string `json:"url144,omitempty"` - Url288 string `json:"url288,omitempty"` - ObjectId string `json:"objectId,omitempty"` + WorkspaceId string `json:"workspaceId,omitempty"` // The ID of the workspace. + GlobalId string `json:"globalId,omitempty"` // The global ID of the avatar. + ID string `json:"id,omitempty"` // The ID of the avatar. + AvatarUUID string `json:"avatarUUID,omitempty"` // The UUID of the avatar. + Url16 string `json:"url16,omitempty"` // The URL for the 16x16 version of the avatar. + Url48 string `json:"url48,omitempty"` // The URL for the 48x48 version of the avatar. + Url72 string `json:"url72,omitempty"` // The URL for the 72x72 version of the avatar. + Url144 string `json:"url144,omitempty"` // The URL for the 144x144 version of the avatar. + Url288 string `json:"url288,omitempty"` // The URL for the 288x288 version of the avatar. + ObjectId string `json:"objectId,omitempty"` // The ID of the object. } +// ObjectLinksScheme represents the links of an object. +// Self is the self URL of the object. type ObjectLinksScheme struct { - Self string `json:"self,omitempty"` + Self string `json:"self,omitempty"` // The self URL of the object. } +// ObjectAttributeScheme represents an attribute of an object. +// WorkspaceId is the ID of the workspace. +// GlobalId is the global ID of the attribute. +// ID is the unique identifier of the attribute. +// ObjectTypeAttribute is the type of the attribute. +// ObjectTypeAttributeId is the ID of the attribute type. +// ObjectAttributeValues is a slice of the values of the attribute. type ObjectAttributeScheme struct { - WorkspaceId string `json:"workspaceId,omitempty"` - GlobalId string `json:"globalId,omitempty"` - ID string `json:"id,omitempty"` - ObjectTypeAttribute *ObjectTypeAttributeScheme `json:"objectTypeAttribute,omitempty"` - ObjectTypeAttributeId string `json:"objectTypeAttributeId,omitempty"` - ObjectAttributeValues []*ObjectTypeAssetAttributeValueScheme `json:"objectAttributeValues,omitempty"` + WorkspaceId string `json:"workspaceId,omitempty"` // The ID of the workspace. + GlobalId string `json:"globalId,omitempty"` // The global ID of the attribute. + ID string `json:"id,omitempty"` // The ID of the attribute. + ObjectTypeAttribute *ObjectTypeAttributeScheme `json:"objectTypeAttribute,omitempty"` // The type of the attribute. + ObjectTypeAttributeId string `json:"objectTypeAttributeId,omitempty"` // The ID of the attribute type. + ObjectAttributeValues []*ObjectTypeAssetAttributeValueScheme `json:"objectAttributeValues,omitempty"` // The values of the attribute. } +// ObjectTypeAttributePayloadScheme represents the payload for an attribute type. +// It includes various properties of the attribute type like name, label, description, type, default type ID, type value, etc. type ObjectTypeAttributePayloadScheme struct { - Name string `json:"name,omitempty"` - Label bool `json:"label,omitempty"` - Description string `json:"description,omitempty"` - Type *int `json:"type,omitempty"` - DefaultTypeId *int `json:"defaultTypeId,omitempty"` - TypeValue string `json:"typeValue,omitempty"` - TypeValueMulti []string `json:"typeValueMulti,omitempty"` - AdditionalValue string `json:"additionalValue,omitempty"` - MinimumCardinality *int `json:"minimumCardinality,omitempty"` - MaximumCardinality *int `json:"maximumCardinality,omitempty"` - Suffix string `json:"suffix,omitempty"` - IncludeChildObjectTypes bool `json:"includeChildObjectTypes,omitempty"` - Hidden bool `json:"hidden,omitempty"` - UniqueAttribute bool `json:"uniqueAttribute,omitempty"` - Summable bool `json:"summable,omitempty"` - RegexValidation string `json:"regexValidation,omitempty"` - QlQuery string `json:"qlQuery,omitempty"` - Iql string `json:"iql,omitempty"` - Options string `json:"options,omitempty"` + Name string `json:"name,omitempty"` // The name of the attribute type. + Label bool `json:"label,omitempty"` // Indicates if the attribute type is a label. + Description string `json:"description,omitempty"` // The description of the attribute type. + Type *int `json:"type,omitempty"` // The type of the attribute type. + DefaultTypeId *int `json:"defaultTypeId,omitempty"` // The default type ID of the attribute type. + TypeValue string `json:"typeValue,omitempty"` // The type value of the attribute type. + TypeValueMulti []string `json:"typeValueMulti,omitempty"` // The multiple type values of the attribute type. + AdditionalValue string `json:"additionalValue,omitempty"` // The additional value of the attribute type. + MinimumCardinality *int `json:"minimumCardinality,omitempty"` // The minimum cardinality of the attribute type. + MaximumCardinality *int `json:"maximumCardinality,omitempty"` // The maximum cardinality of the attribute type. + Suffix string `json:"suffix,omitempty"` // The suffix of the attribute type. + IncludeChildObjectTypes bool `json:"includeChildObjectTypes,omitempty"` // Indicates if child object types are included. + Hidden bool `json:"hidden,omitempty"` // Indicates if the attribute type is hidden. + UniqueAttribute bool `json:"uniqueAttribute,omitempty"` // Indicates if the attribute type is unique. + Summable bool `json:"summable,omitempty"` // Indicates if the attribute type is summable. + RegexValidation string `json:"regexValidation,omitempty"` // The regex validation of the attribute type. + QlQuery string `json:"qlQuery,omitempty"` // The QL query of the attribute type. + Iql string `json:"iql,omitempty"` // The IQL of the attribute type. + Options string `json:"options,omitempty"` // The options of the attribute type. } +// ObjectTypeAttributeScheme represents an attribute type of an object. +// It includes various properties of the attribute type like workspace ID, global ID, ID, object type, name, label, type, description, etc. type ObjectTypeAttributeScheme struct { - WorkspaceId string `json:"workspaceId,omitempty"` - GlobalId string `json:"globalId,omitempty"` - ID string `json:"id,omitempty"` - ObjectType *ObjectTypeScheme `json:"objectType,omitempty"` - Name string `json:"name,omitempty"` - Label bool `json:"label,omitempty"` - Type int `json:"type,omitempty"` - Description string `json:"description,omitempty"` - DefaultType *ObjectTypeAssetAttributeDefaultTypeScheme `json:"defaultType,omitempty"` - TypeValue string `json:"typeValue,omitempty"` - TypeValueMulti []string `json:"typeValueMulti,omitempty"` - AdditionalValue string `json:"additionalValue,omitempty"` - ReferenceType *ObjectTypeAssetAttributeReferenceTypeScheme `json:"referenceType,omitempty"` - ReferenceObjectTypeId string `json:"referenceObjectTypeId,omitempty"` - ReferenceObjectType *ObjectTypeScheme `json:"referenceObjectType,omitempty"` - Editable bool `json:"editable,omitempty"` - System bool `json:"system,omitempty"` - Indexed bool `json:"indexed,omitempty"` - Sortable bool `json:"sortable,omitempty"` - Summable bool `json:"summable,omitempty"` - MinimumCardinality int `json:"minimumCardinality,omitempty"` - MaximumCardinality int `json:"maximumCardinality,omitempty"` - Suffix string `json:"suffix,omitempty"` - Removable bool `json:"removable,omitempty"` - ObjectAttributeExists bool `json:"objectAttributeExists,omitempty"` - Hidden bool `json:"hidden,omitempty"` - IncludeChildObjectTypes bool `json:"includeChildObjectTypes,omitempty"` - UniqueAttribute bool `json:"uniqueAttribute,omitempty"` - RegexValidation string `json:"regexValidation,omitempty"` - Iql string `json:"iql,omitempty"` - QlQuery string `json:"qlQuery,omitempty"` - Options string `json:"options,omitempty"` - Position int `json:"position,omitempty"` + WorkspaceId string `json:"workspaceId,omitempty"` // The ID of the workspace. + GlobalId string `json:"globalId,omitempty"` // The global ID of the attribute type. + ID string `json:"id,omitempty"` // The ID of the attribute type. + ObjectType *ObjectTypeScheme `json:"objectType,omitempty"` // The type of the object. + Name string `json:"name,omitempty"` // The name of the attribute type. + Label bool `json:"label,omitempty"` // Indicates if the attribute type is a label. + Type int `json:"type,omitempty"` // The type of the attribute type. + Description string `json:"description,omitempty"` // The description of the attribute type. + DefaultType *ObjectTypeAssetAttributeDefaultTypeScheme `json:"defaultType,omitempty"` // The default type of the attribute type. + TypeValue string `json:"typeValue,omitempty"` // The type value of the attribute type. + TypeValueMulti []string `json:"typeValueMulti,omitempty"` // The multiple type values of the attribute type. + AdditionalValue string `json:"additionalValue,omitempty"` // The additional value of the attribute type. + ReferenceType *ObjectTypeAssetAttributeReferenceTypeScheme `json:"referenceType,omitempty"` // The reference type of the attribute type. + ReferenceObjectTypeId string `json:"referenceObjectTypeId,omitempty"` // The ID of the reference object type. + ReferenceObjectType *ObjectTypeScheme `json:"referenceObjectType,omitempty"` // The reference object type. + Editable bool `json:"editable,omitempty"` // Indicates if the attribute type is editable. + System bool `json:"system,omitempty"` // Indicates if the attribute type is a system attribute. + Indexed bool `json:"indexed,omitempty"` // Indicates if the attribute type is indexed. + Sortable bool `json:"sortable,omitempty"` // Indicates if the attribute type is sortable. + Summable bool `json:"summable,omitempty"` // Indicates if the attribute type is summable. + MinimumCardinality int `json:"minimumCardinality,omitempty"` // The minimum cardinality of the attribute type. + MaximumCardinality int `json:"maximumCardinality,omitempty"` // The maximum cardinality of the attribute type. + Suffix string `json:"suffix,omitempty"` // The suffix of the attribute type. + Removable bool `json:"removable,omitempty"` // Indicates if the attribute type is removable. + ObjectAttributeExists bool `json:"objectAttributeExists,omitempty"` // Indicates if the attribute exists in the object. + Hidden bool `json:"hidden,omitempty"` // Indicates if the attribute type is hidden. + IncludeChildObjectTypes bool `json:"includeChildObjectTypes,omitempty"` // Indicates if child object types are included. + UniqueAttribute bool `json:"uniqueAttribute,omitempty"` // Indicates if the attribute type is unique. + RegexValidation string `json:"regexValidation,omitempty"` // The regex validation of the attribute type. + Iql string `json:"iql,omitempty"` // The IQL of the attribute type. + QlQuery string `json:"qlQuery,omitempty"` // The QL query of the attribute type. + Options string `json:"options,omitempty"` // The options of the attribute type. + Position int `json:"position,omitempty"` // The position of the attribute type. } +// ObjectTypeAssetAttributeDefaultTypeScheme represents the default type of an attribute in an asset. +// ID is the unique identifier of the default type. +// Name is the name of the default type. type ObjectTypeAssetAttributeDefaultTypeScheme struct { - ID int `json:"id,omitempty"` - Name string `json:"name,omitempty"` + ID int `json:"id,omitempty"` // The ID of the default type. + Name string `json:"name,omitempty"` // The name of the default type. } +// ObjectTypeAssetAttributeReferenceTypeScheme represents a reference type of an attribute in an asset. +// WorkspaceId is the ID of the workspace. +// GlobalId is the global ID of the reference type. +// Name is the name of the reference type. type ObjectTypeAssetAttributeReferenceTypeScheme struct { - WorkspaceId string `json:"workspaceId,omitempty"` - GlobalId string `json:"globalId,omitempty"` - Name string `json:"name,omitempty"` + WorkspaceId string `json:"workspaceId,omitempty"` // The ID of the workspace. + GlobalId string `json:"globalId,omitempty"` // The global ID of the reference type. + Name string `json:"name,omitempty"` // The name of the reference type. } +// ObjectTypeAssetAttributeValueScheme represents the value of an attribute in an asset. +// Value is the value of the attribute. +// DisplayValue is the display value of the attribute. +// SearchValue is the search value of the attribute. +// Group is the group of the attribute value. +// Status is the status of the attribute value. +// AdditionalValue is the additional value of the attribute. type ObjectTypeAssetAttributeValueScheme struct { - Value string `json:"value,omitempty"` - DisplayValue string `json:"displayValue,omitempty"` - SearchValue string `json:"searchValue,omitempty"` - Group *ObjectTypeAssetAttributeValueGroupScheme `json:"group,omitempty"` - Status *ObjectTypeAssetAttributeStatusScheme `json:"status,omitempty"` - AdditionalValue string `json:"additionalValue,omitempty"` + Value string `json:"value,omitempty"` // The value of the attribute. + DisplayValue string `json:"displayValue,omitempty"` // The display value of the attribute. + SearchValue string `json:"searchValue,omitempty"` // The search value of the attribute. + Group *ObjectTypeAssetAttributeValueGroupScheme `json:"group,omitempty"` // The group of the attribute value. + Status *ObjectTypeAssetAttributeStatusScheme `json:"status,omitempty"` // The status of the attribute value. + AdditionalValue string `json:"additionalValue,omitempty"` // The additional value of the attribute. } +// ObjectTypeAssetAttributeValueGroupScheme represents a group of attribute values in an asset. +// AvatarUrl is the URL of the avatar for the group. +// Name is the name of the group. type ObjectTypeAssetAttributeValueGroupScheme struct { - AvatarUrl string `json:"avatarUrl,omitempty"` - Name string `json:"name,omitempty"` + AvatarUrl string `json:"avatarUrl,omitempty"` // The URL of the avatar for the group. + Name string `json:"name,omitempty"` // The name of the group. } +// ObjectTypeAssetAttributeStatusScheme represents the status of an attribute value in an asset. +// ID is the unique identifier of the status. +// Name is the name of the status. +// Category is the category of the status. type ObjectTypeAssetAttributeStatusScheme struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Category int `json:"category,omitempty"` + ID string `json:"id,omitempty"` // The ID of the status. + Name string `json:"name,omitempty"` // The name of the status. + Category int `json:"category,omitempty"` // The category of the status. } +// ObjectListScheme represents a list of objects. type ObjectListScheme struct { - ObjectEntries []*ObjectScheme `json:"objectEntries,omitempty"` - ObjectTypeAttributes []*ObjectTypeAttributeScheme `json:"objectTypeAttributes,omitempty"` - ObjectTypeId string `json:"objectTypeId,omitempty"` - ObjectTypeIsInherited bool `json:"objectTypeIsInherited,omitempty"` - AbstractObjectType bool `json:"abstractObjectType,omitempty"` - TotalFilterCount int `json:"totalFilterCount,omitempty"` - StartIndex int `json:"startIndex,omitempty"` - ToIndex int `json:"toIndex,omitempty"` - PageObjectSize int `json:"pageObjectSize,omitempty"` - PageNumber int `json:"pageNumber,omitempty"` - OrderByTypeAttrId int `json:"orderByTypeAttrId,omitempty"` - OrderWay string `json:"orderWay,omitempty"` - QlQuery string `json:"qlQuery,omitempty"` - QlQuerySearchResult bool `json:"qlQuerySearchResult,omitempty"` - Iql string `json:"iql,omitempty"` - IqlSearchResult bool `json:"iqlSearchResult,omitempty"` - ConversionPossible bool `json:"conversionPossible,omitempty"` + ObjectEntries []*ObjectScheme `json:"objectEntries,omitempty"` // The objects in the list. + ObjectTypeAttributes []*ObjectTypeAttributeScheme `json:"objectTypeAttributes,omitempty"` // The attributes of the object type. + ObjectTypeId string `json:"objectTypeId,omitempty"` // The ID of the object type. + ObjectTypeIsInherited bool `json:"objectTypeIsInherited,omitempty"` // Indicates if the object type is inherited. + AbstractObjectType bool `json:"abstractObjectType,omitempty"` // Indicates if the object type is abstract. + TotalFilterCount int `json:"totalFilterCount,omitempty"` // The total count of filters. + StartIndex int `json:"startIndex,omitempty"` // The start index of the list. + ToIndex int `json:"toIndex,omitempty"` // The end index of the list. + PageObjectSize int `json:"pageObjectSize,omitempty"` // The size of the page of objects. + PageNumber int `json:"pageNumber,omitempty"` // The number of the page of objects. + OrderByTypeAttrId int `json:"orderByTypeAttrId,omitempty"` // The ID of the attribute type to order by. + OrderWay string `json:"orderWay,omitempty"` // The way to order the list. + QlQuery string `json:"qlQuery,omitempty"` // The QL query to filter the list. + QlQuerySearchResult bool `json:"qlQuerySearchResult,omitempty"` // Indicates if the QL query search result is included. + Iql string `json:"iql,omitempty"` // The IQL to filter the list. + IqlSearchResult bool `json:"iqlSearchResult,omitempty"` // Indicates if the IQL search result is included. + ConversionPossible bool `json:"conversionPossible,omitempty"` // Indicates if a conversion is possible. } +// ObjectListResultScheme represents the result of a list of objects. +// StartAt is the starting index of the list. +// MaxResults is the maximum number of results in the list. +// Total is the total number of objects in the list. +// IsLast indicates if this is the last page of the list. +// Values is a slice of the objects in the list. +// ObjectTypeAttributes is a slice of the attributes of the object type. type ObjectListResultScheme struct { - StartAt int `json:"startAt,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*ObjectScheme `json:"values,omitempty"` - ObjectTypeAttributes []*ObjectTypeAttributeScheme `json:"objectTypeAttributes,omitempty"` + StartAt int `json:"startAt,omitempty"` // The starting index of the list. + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results in the list. + Total int `json:"total,omitempty"` // The total number of objects in the list. + IsLast bool `json:"isLast,omitempty"` // Indicates if this is the last page of the list. + Values []*ObjectScheme `json:"values,omitempty"` // The objects in the list. + ObjectTypeAttributes []*ObjectTypeAttributeScheme `json:"objectTypeAttributes,omitempty"` // The attributes of the object type. } +// ObjectSearchParamsScheme represents the search parameters for an object. +// Query is the AQL that will fetch the objects. +// Iql is deprecated and Query should be used instead. +// ObjectTypeID is the ID of the object type. +// Page is the requested page to be loaded for a paginated result. +// ResultPerPage is how many objects should be returned in the request. +// OrderByTypeAttributeID is which attribute should be used to order by. +// Asc is to sort objects in ascending order or descending order based on the attribute identified by OrderByTypeAttributeID. +// ObjectID identifies an object that should be included in the result. +// ObjectSchemaID is the ID of the object schema. +// IncludeAttributes indicates if attribute values should be included in the response. +// AttributesToDisplay identifies attributes to be displayed. type ObjectSearchParamsScheme struct { - - // The AQL that will fetch the objects. - // - // The object type parameter will be appended implicitly to this AQL - Query string `json:"qlQuery,omitempty"` - - // Required if qlQuery is not set. - // - // Deprecated. Use Query instead. - Iql string `json:"iql,omitempty"` - ObjectTypeID string `json:"objectTypeId,omitempty"` - - // The requested page to be loaded for a paginated result. - // - // The default value is page = 1 - Page int `json:"page,omitempty"` - - // How many objects should be returned in the request. - // - // It is used with page attribute for pagination. - ResultPerPage int `json:"resultsPerPage,omitempty"` - - // Which attribute should be used to order by. - // - // The preferred way is to use an order by in qlQuery and not pass this argument. - OrderByTypeAttributeID int `json:"orderByTypeAttrId,omitempty"` - - // Sort objects in ascending order or descending order based on the attribute identified by orderByTypeAttrId. - // - // 1 mean ascending all other values mean descending. - // - // The preferred way is to not supply the asc parameter and use an order by in qlQuery instead. - Asc int `json:"asc,omitempty"` - - // Identifies an object that should be included in the result. - // - // The page will be calculated accordingly to include the object specified in the result set - ObjectID string `json:"objectId,omitempty"` - - ObjectSchemaID string `json:"objectSchemaId,omitempty"` - - // Should attribute values be included in the response. - IncludeAttributes bool `json:"includeAttributes,omitempty"` - - // Identifies attributes to be displayed - AttributesToDisplay *AttributesToDisplayScheme `json:"attributesToDisplay,omitempty"` + Query string `json:"qlQuery,omitempty"` // The AQL that will fetch the objects. + Iql string `json:"iql,omitempty"` // Deprecated. Use Query instead. + ObjectTypeID string `json:"objectTypeId,omitempty"` // The ID of the object type. + Page int `json:"page,omitempty"` // The requested page to be loaded for a paginated result. + ResultPerPage int `json:"resultsPerPage,omitempty"` // How many objects should be returned in the request. + OrderByTypeAttributeID int `json:"orderByTypeAttrId,omitempty"` // Which attribute should be used to order by. + Asc int `json:"asc,omitempty"` // Sort objects in ascending order or descending order based on the attribute identified by OrderByTypeAttributeID. + ObjectID string `json:"objectId,omitempty"` // Identifies an object that should be included in the result. + ObjectSchemaID string `json:"objectSchemaId,omitempty"` // The ID of the object schema. + IncludeAttributes bool `json:"includeAttributes,omitempty"` // Should attribute values be included in the response. + AttributesToDisplay *AttributesToDisplayScheme `json:"attributesToDisplay,omitempty"` // Identifies attributes to be displayed. } +// AttributesToDisplayScheme represents a scheme for attributes to be displayed. +// AttributesToDisplayIds is a slice of the IDs of the attributes to be displayed. type AttributesToDisplayScheme struct { - AttributesToDisplayIds []int `json:"attributesToDisplayIds,omitempty"` + AttributesToDisplayIds []int `json:"attributesToDisplayIds,omitempty"` // The IDs of the attributes to be displayed. } diff --git a/pkg/infra/models/assets_object_schema.go b/pkg/infra/models/assets_object_schema.go index 16e4238d..a4182ba7 100644 --- a/pkg/infra/models/assets_object_schema.go +++ b/pkg/infra/models/assets_object_schema.go @@ -1,45 +1,55 @@ package models +// ObjectSchemaPageScheme represents a paginated list of object schemas. +// StartAt is the starting index of the list. +// MaxResults is the maximum number of results in the list. +// Total is the total number of object schemas in the list. +// Values is a slice of the object schemas in the list. type ObjectSchemaPageScheme struct { - StartAt int `json:"startAt,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - Total int `json:"total,omitempty"` - Values []*ObjectSchemaScheme `json:"values,omitempty"` + StartAt int `json:"startAt,omitempty"` // The starting index of the list. + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results in the list. + Total int `json:"total,omitempty"` // The total number of object schemas in the list. + Values []*ObjectSchemaScheme `json:"values,omitempty"` // The object schemas in the list. } +// ObjectSchemaScheme represents an object schema. type ObjectSchemaScheme struct { - WorkspaceId string `json:"workspaceId,omitempty"` - GlobalId string `json:"globalId,omitempty"` - Id string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - ObjectSchemaKey string `json:"objectSchemaKey,omitempty"` - Description string `json:"description,omitempty"` - Status string `json:"status,omitempty"` - Created string `json:"created,omitempty"` - Updated string `json:"updated,omitempty"` - ObjectCount int `json:"objectCount,omitempty"` - ObjectTypeCount int `json:"objectTypeCount,omitempty"` - CanManage bool `json:"canManage,omitempty"` + WorkspaceId string `json:"workspaceId,omitempty"` // The ID of the workspace. + GlobalId string `json:"globalId,omitempty"` // The global ID of the object schema. + Id string `json:"id,omitempty"` // The ID of the object schema. + Name string `json:"name,omitempty"` // The name of the object schema. + ObjectSchemaKey string `json:"objectSchemaKey,omitempty"` // The key of the object schema. + Description string `json:"description,omitempty"` // The description of the object schema. + Status string `json:"status,omitempty"` // The status of the object schema. + Created string `json:"created,omitempty"` // The creation time of the object schema. + Updated string `json:"updated,omitempty"` // The update time of the object schema. + ObjectCount int `json:"objectCount,omitempty"` // The number of objects in the object schema. + ObjectTypeCount int `json:"objectTypeCount,omitempty"` // The number of object types in the object schema. + CanManage bool `json:"canManage,omitempty"` // Indicates if the object schema can be managed. } +// ObjectSchemaPayloadScheme represents the payload for an object schema. +// Name is the name of the object schema. +// ObjectSchemaKey is the key of the object schema. +// Description is the description of the object schema. type ObjectSchemaPayloadScheme struct { - Name string `json:"name,omitempty"` - ObjectSchemaKey string `json:"objectSchemaKey,omitempty"` - Description string `json:"description,omitempty"` + Name string `json:"name,omitempty"` // The name of the object schema. + ObjectSchemaKey string `json:"objectSchemaKey,omitempty"` // The key of the object schema. + Description string `json:"description,omitempty"` // The description of the object schema. } +// ObjectSchemaAttributesParamsScheme represents the search parameters for an object schema's attributes. +// OnlyValueEditable return only values that are associated with values that can be edited. +// Extended include the object type with each object type attribute. +// Query it's a query that will be used to filter object type attributes by their name. type ObjectSchemaAttributesParamsScheme struct { - - // OnlyValueEditable return only values that are associated with values that can be edited - OnlyValueEditable bool - - // Extended include the object type with each object type attribute - Extended bool - - // Query it's a query that will be used to filter object type attributes by their name - Query string + OnlyValueEditable bool // Return only values that are associated with values that can be edited. + Extended bool // Include the object type with each object type attribute. + Query string // A query that will be used to filter object type attributes by their name. } +// ObjectSchemaTypePageScheme represents a page of object types. +// Entries is a slice of the object types on the page. type ObjectSchemaTypePageScheme struct { - Entries []*ObjectTypeScheme `json:"entries,omitempty"` + Entries []*ObjectTypeScheme `json:"entries,omitempty"` // The object types on the page. } diff --git a/pkg/infra/models/assets_object_type.go b/pkg/infra/models/assets_object_type.go index 95da70a7..02b056d4 100644 --- a/pkg/infra/models/assets_object_type.go +++ b/pkg/infra/models/assets_object_type.go @@ -1,44 +1,79 @@ package models +// ObjectTypePositionPayloadScheme represents the payload for the position of an object type. +// ToObjectTypeId is the ID of the object type to which the position is related. +// Position is the position of the object type. type ObjectTypePositionPayloadScheme struct { - ToObjectTypeId string `json:"toObjectTypeId,omitempty"` - Position int `json:"position,omitempty"` + ToObjectTypeId string `json:"toObjectTypeId,omitempty"` // The ID of the object type to which the position is related. + Position int `json:"position,omitempty"` // The position of the object type. } +// ObjectTypeScheme represents an object type. +// WorkspaceId is the ID of the workspace. +// GlobalId is the global ID of the object type. +// Id is the unique identifier of the object type. +// Name is the name of the object type. +// Description is the description of the object type. +// Icon is the icon of the object type. +// Position is the position of the object type. +// Created is the creation time of the object type. +// Updated is the update time of the object type. +// ObjectCount is the number of objects of the object type. +// ParentObjectTypeId is the ID of the parent object type. +// ObjectSchemaId is the ID of the object schema. +// Inherited indicates if the object type is inherited. +// AbstractObjectType indicates if the object type is abstract. +// ParentObjectTypeInherited indicates if the parent object type is inherited. type ObjectTypeScheme struct { - WorkspaceId string `json:"workspaceId,omitempty"` - GlobalId string `json:"globalId,omitempty"` - Id string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - Icon *IconScheme `json:"icon,omitempty"` - Position int `json:"position,omitempty"` - Created string `json:"created,omitempty"` - Updated string `json:"updated,omitempty"` - ObjectCount int `json:"objectCount,omitempty"` - ParentObjectTypeId string `json:"parentObjectTypeId,omitempty"` - ObjectSchemaId string `json:"objectSchemaId,omitempty"` - Inherited bool `json:"inherited,omitempty"` - AbstractObjectType bool `json:"abstractObjectType,omitempty"` - ParentObjectTypeInherited bool `json:"parentObjectTypeInherited,omitempty"` + WorkspaceId string `json:"workspaceId,omitempty"` // The ID of the workspace. + GlobalId string `json:"globalId,omitempty"` // The global ID of the object type. + Id string `json:"id,omitempty"` // The ID of the object type. + Name string `json:"name,omitempty"` // The name of the object type. + Description string `json:"description,omitempty"` // The description of the object type. + Icon *IconScheme `json:"icon,omitempty"` // The icon of the object type. + Position int `json:"position,omitempty"` // The position of the object type. + Created string `json:"created,omitempty"` // The creation time of the object type. + Updated string `json:"updated,omitempty"` // The update time of the object type. + ObjectCount int `json:"objectCount,omitempty"` // The number of objects of the object type. + ParentObjectTypeId string `json:"parentObjectTypeId,omitempty"` // The ID of the parent object type. + ObjectSchemaId string `json:"objectSchemaId,omitempty"` // The ID of the object schema. + Inherited bool `json:"inherited,omitempty"` // Indicates if the object type is inherited. + AbstractObjectType bool `json:"abstractObjectType,omitempty"` // Indicates if the object type is abstract. + ParentObjectTypeInherited bool `json:"parentObjectTypeInherited,omitempty"` // Indicates if the parent object type is inherited. } +// ObjectTypePayloadScheme represents the payload for an object type. +// Name is the name of the object type. +// Description is the description of the object type. +// IconId is the ID of the icon of the object type. +// ObjectSchemaId is the ID of the object schema. +// ParentObjectTypeId is the ID of the parent object type. +// Inherited indicates if the object type is inherited. +// AbstractObjectType indicates if the object type is abstract. type ObjectTypePayloadScheme struct { - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - IconId string `json:"iconId,omitempty"` - ObjectSchemaId string `json:"objectSchemaId,omitempty"` - ParentObjectTypeId string `json:"parentObjectTypeId,omitempty"` - Inherited bool `json:"inherited,omitempty"` - AbstractObjectType bool `json:"abstractObjectType,omitempty"` + Name string `json:"name,omitempty"` // The name of the object type. + Description string `json:"description,omitempty"` // The description of the object type. + IconId string `json:"iconId,omitempty"` // The ID of the icon of the object type. + ObjectSchemaId string `json:"objectSchemaId,omitempty"` // The ID of the object schema. + ParentObjectTypeId string `json:"parentObjectTypeId,omitempty"` // The ID of the parent object type. + Inherited bool `json:"inherited,omitempty"` // Indicates if the object type is inherited. + AbstractObjectType bool `json:"abstractObjectType,omitempty"` // Indicates if the object type is abstract. } +// ObjectTypeAttributesParamsScheme represents the search parameters for an object type's attributes. +// OnlyValueEditable return only values that are associated with values that can be edited. +// OrderByName order by the name of the attribute. +// Query is a query that will be used to filter object type attributes by their name. +// IncludeValuesExist include values that exist. +// ExcludeParentAttributes exclude parent attributes. +// IncludeChildren include children. +// OrderByRequired order by required. type ObjectTypeAttributesParamsScheme struct { - OnlyValueEditable bool - OrderByName bool - Query string - IncludeValuesExist bool - ExcludeParentAttributes bool - IncludeChildren bool - OrderByRequired bool + OnlyValueEditable bool // Return only values that are associated with values that can be edited. + OrderByName bool // Order by the name of the attribute. + Query string // A query that will be used to filter object type attributes by their name. + IncludeValuesExist bool // Include values that exist. + ExcludeParentAttributes bool // Exclude parent attributes. + IncludeChildren bool // Include children. + OrderByRequired bool // Order by required. } diff --git a/pkg/infra/models/assets_ticket.go b/pkg/infra/models/assets_ticket.go index 8e6c978c..1333562c 100644 --- a/pkg/infra/models/assets_ticket.go +++ b/pkg/infra/models/assets_ticket.go @@ -1,37 +1,52 @@ package models +// TicketPageScheme represents a paginated list of tickets. +// Tickets is a slice of the tickets on the page. +// AllTicketsQuery is a query that fetches all tickets. type TicketPageScheme struct { - Tickets []*TicketScheme `json:"tickets,omitempty"` - AllTicketsQuery string `json:"allTicketsQuery,omitempty"` + Tickets []*TicketScheme `json:"tickets,omitempty"` // The tickets on the page. + AllTicketsQuery string `json:"allTicketsQuery,omitempty"` // A query that fetches all tickets. } +// TicketScheme represents a ticket. type TicketScheme struct { - WorkspaceId string `json:"workspaceId,omitempty"` - GlobalId string `json:"globalId,omitempty"` - Key string `json:"key,omitempty"` - Id string `json:"id,omitempty"` - Reporter string `json:"reporter,omitempty"` - Created string `json:"created,omitempty"` - Updated string `json:"updated,omitempty"` - Title string `json:"title,omitempty"` - Status *TicketStatusScheme `json:"status,omitempty"` - Type *TicketTypeScheme `json:"type,omitempty"` - Priority *TicketPriorityScheme `json:"priority,omitempty"` + WorkspaceId string `json:"workspaceId,omitempty"` // The ID of the workspace. + GlobalId string `json:"globalId,omitempty"` // The global ID of the ticket. + Key string `json:"key,omitempty"` // The key of the ticket. + Id string `json:"id,omitempty"` // The ID of the ticket. + Reporter string `json:"reporter,omitempty"` // The reporter of the ticket. + Created string `json:"created,omitempty"` // The creation time of the ticket. + Updated string `json:"updated,omitempty"` // The update time of the ticket. + Title string `json:"title,omitempty"` // The title of the ticket. + Status *TicketStatusScheme `json:"status,omitempty"` // The status of the ticket. + Type *TicketTypeScheme `json:"type,omitempty"` // The type of the ticket. + Priority *TicketPriorityScheme `json:"priority,omitempty"` // The priority of the ticket. } +// TicketStatusScheme represents the status of a ticket. +// Name is the name of the status. +// Description is the description of the status. +// ColorName is the name of the color associated with the status. type TicketStatusScheme struct { - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - ColorName string `json:"colorName,omitempty"` + Name string `json:"name,omitempty"` // The name of the status. + Description string `json:"description,omitempty"` // The description of the status. + ColorName string `json:"colorName,omitempty"` // The name of the color associated with the status. } +// TicketTypeScheme represents the type of a ticket. +// Name is the name of the type. +// Description is the description of the type. +// IconUrl is the URL of the icon associated with the type. type TicketTypeScheme struct { - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - IconUrl string `json:"iconUrl,omitempty"` + Name string `json:"name,omitempty"` // The name of the type. + Description string `json:"description,omitempty"` // The description of the type. + IconUrl string `json:"iconUrl,omitempty"` // The URL of the icon associated with the type. } +// TicketPriorityScheme represents the priority of a ticket. +// Name is the name of the priority. +// IconUrl is the URL of the icon associated with the priority. type TicketPriorityScheme struct { - Name string `json:"name,omitempty"` - IconUrl string `json:"iconUrl,omitempty"` + Name string `json:"name,omitempty"` // The name of the priority. + IconUrl string `json:"iconUrl,omitempty"` // The URL of the icon associated with the priority. } diff --git a/pkg/infra/models/bitbucket_branch.go b/pkg/infra/models/bitbucket_branch.go index 2de5947d..b3aeb13e 100644 --- a/pkg/infra/models/bitbucket_branch.go +++ b/pkg/infra/models/bitbucket_branch.go @@ -1,6 +1,9 @@ package models +// BranchScheme represents a branch in a repository. +// MergeStrategies is a slice of the merge strategies available for the branch. +// DefaultMergeStrategy is the default merge strategy used for the branch. type BranchScheme struct { - MergeStrategies []string `json:"merge_strategies"` - DefaultMergeStrategy string `json:"default_merge_strategy"` + MergeStrategies []string `json:"merge_strategies"` // The merge strategies available for the branch. + DefaultMergeStrategy string `json:"default_merge_strategy"` // The default merge strategy used for the branch. } diff --git a/pkg/infra/models/bitbucket_projects.go b/pkg/infra/models/bitbucket_projects.go index c99b5e91..af87a7a9 100644 --- a/pkg/infra/models/bitbucket_projects.go +++ b/pkg/infra/models/bitbucket_projects.go @@ -1,27 +1,31 @@ +// Package models provides the data structures used in the Bitbucket integration. package models +// BitbucketProjectPageScheme represents a page of Bitbucket projects. type BitbucketProjectPageScheme struct { - Size int `json:"size,omitempty"` - Page int `json:"page,omitempty"` - Pagelen int `json:"pagelen,omitempty"` - Next string `json:"next,omitempty"` - Previous string `json:"previous,omitempty"` - Values []*BitbucketProjectScheme `json:"values,omitempty"` + Size int `json:"size,omitempty"` // The size of the page. + Page int `json:"page,omitempty"` // The current page number. + Pagelen int `json:"pagelen,omitempty"` // The length of the page. + Next string `json:"next,omitempty"` // The link to the next page. + Previous string `json:"previous,omitempty"` // The link to the previous page. + Values []*BitbucketProjectScheme `json:"values,omitempty"` // The projects on the page. } +// BitbucketProjectScheme represents a Bitbucket project. type BitbucketProjectScheme struct { - Links *BitbucketProjectLinksScheme `json:"links,omitempty"` - Uuid string `json:"uuid,omitempty"` - Key string `json:"key,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - IsPrivate bool `json:"is_private,omitempty"` - CreatedOn string `json:"created_on,omitempty"` - UpdatedOn string `json:"updated_on,omitempty"` - HasPubliclyVisibleRepos bool `json:"has_publicly_visible_repos,omitempty"` + Links *BitbucketProjectLinksScheme `json:"links,omitempty"` // The links related to the project. + Uuid string `json:"uuid,omitempty"` // The UUID of the project. + Key string `json:"key,omitempty"` // The key of the project. + Name string `json:"name,omitempty"` // The name of the project. + Description string `json:"description,omitempty"` // The description of the project. + IsPrivate bool `json:"is_private,omitempty"` // Whether the project is private. + CreatedOn string `json:"created_on,omitempty"` // The creation time of the project. + UpdatedOn string `json:"updated_on,omitempty"` // The last update time of the project. + HasPubliclyVisibleRepos bool `json:"has_publicly_visible_repos,omitempty"` // Whether the project has publicly visible repositories. } +// BitbucketProjectLinksScheme represents the links related to a Bitbucket project. type BitbucketProjectLinksScheme struct { - Html *BitbucketLinkScheme `json:"html,omitempty"` - Avatar *BitbucketLinkScheme `json:"avatar,omitempty"` + Html *BitbucketLinkScheme `json:"html,omitempty"` // The HTML link of the project. + Avatar *BitbucketLinkScheme `json:"avatar,omitempty"` // The avatar link of the project. } diff --git a/pkg/infra/models/bitbucket_repository.go b/pkg/infra/models/bitbucket_repository.go index d55a3f80..bf43cbfd 100644 --- a/pkg/infra/models/bitbucket_repository.go +++ b/pkg/infra/models/bitbucket_repository.go @@ -1,51 +1,93 @@ package models +// RepositoryPermissionPageScheme represents a paginated list of repository permissions. +// Size is the number of permissions in the current page. +// Page is the current page number. +// Pagelen is the total number of pages. +// Next is the URL to the next page. +// Previous is the URL to the previous page. +// Values is a slice of the repository permissions in the current page. type RepositoryPermissionPageScheme struct { - Size int `json:"size,omitempty"` - Page int `json:"page,omitempty"` - Pagelen int `json:"pagelen,omitempty"` - Next string `json:"next,omitempty"` - Previous string `json:"previous,omitempty"` - Values []*RepositoryPermissionScheme `json:"values,omitempty"` + Size int `json:"size,omitempty"` // The number of permissions in the current page. + Page int `json:"page,omitempty"` // The current page number. + Pagelen int `json:"pagelen,omitempty"` // The total number of pages. + Next string `json:"next,omitempty"` // The URL to the next page. + Previous string `json:"previous,omitempty"` // The URL to the previous page. + Values []*RepositoryPermissionScheme `json:"values,omitempty"` // The repository permissions in the current page. } +// RepositoryPermissionScheme represents a repository permission. +// Type is the type of the permission. +// Permission is the level of the permission. +// User is the user who has the permission. +// Repository is the repository to which the permission applies. type RepositoryPermissionScheme struct { - Type string `json:"type,omitempty"` - Permission string `json:"permission,omitempty"` - User *BitbucketAccountScheme `json:"user,omitempty"` - Repository *RepositoryScheme `json:"repository,omitempty"` + Type string `json:"type,omitempty"` // The type of the permission. + Permission string `json:"permission,omitempty"` // The level of the permission. + User *BitbucketAccountScheme `json:"user,omitempty"` // The user who has the permission. + Repository *RepositoryScheme `json:"repository,omitempty"` // The repository to which the permission applies. } +// RepositoryScheme represents a repository. +// Type is the type of the repository. +// Uuid is the unique identifier of the repository. +// FullName is the full name of the repository. +// IsPrivate indicates if the repository is private. +// Scm is the source control management system used by the repository. +// Name is the name of the repository. +// Description is the description of the repository. +// CreatedOn is the creation time of the repository. +// UpdatedOn is the update time of the repository. +// Size is the size of the repository. +// Language is the programming language used in the repository. +// HasIssues indicates if the repository has issues enabled. +// HasWiki indicates if the repository has a wiki enabled. +// ForkPolicy is the fork policy of the repository. +// Owner is the owner of the repository. +// Parent is the parent repository, if the repository is a fork. +// Project is the project to which the repository belongs. +// Links is a collection of links related to the repository. type RepositoryScheme struct { - Type string `json:"type,omitempty"` - Uuid string `json:"uuid,omitempty"` - FullName string `json:"full_name,omitempty"` - IsPrivate bool `json:"is_private,omitempty"` - Scm string `json:"scm,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - CreatedOn string `json:"created_on,omitempty"` - UpdatedOn string `json:"updated_on,omitempty"` - Size int `json:"size,omitempty"` - Language string `json:"language,omitempty"` - HasIssues bool `json:"has_issues,omitempty"` - HasWiki bool `json:"has_wiki,omitempty"` - ForkPolicy string `json:"fork_policy,omitempty"` - Owner *BitbucketAccountScheme `json:"owner,omitempty"` - Parent *RepositoryScheme `json:"parent,omitempty"` - Project BitbucketProjectScheme `json:"project,omitempty"` - Links *RepositoryLinksScheme `json:"links,omitempty"` + Type string `json:"type,omitempty"` // The type of the repository. + Uuid string `json:"uuid,omitempty"` // The unique identifier of the repository. + FullName string `json:"full_name,omitempty"` // The full name of the repository. + IsPrivate bool `json:"is_private,omitempty"` // Indicates if the repository is private. + Scm string `json:"scm,omitempty"` // The source control management system used by the repository. + Name string `json:"name,omitempty"` // The name of the repository. + Description string `json:"description,omitempty"` // The description of the repository. + CreatedOn string `json:"created_on,omitempty"` // The creation time of the repository. + UpdatedOn string `json:"updated_on,omitempty"` // The update time of the repository. + Size int `json:"size,omitempty"` // The size of the repository. + Language string `json:"language,omitempty"` // The programming language used in the repository. + HasIssues bool `json:"has_issues,omitempty"` // Indicates if the repository has issues enabled. + HasWiki bool `json:"has_wiki,omitempty"` // Indicates if the repository has a wiki enabled. + ForkPolicy string `json:"fork_policy,omitempty"` // The fork policy of the repository. + Owner *BitbucketAccountScheme `json:"owner,omitempty"` // The owner of the repository. + Parent *RepositoryScheme `json:"parent,omitempty"` // The parent repository, if the repository is a fork. + Project BitbucketProjectScheme `json:"project,omitempty"` // The project to which the repository belongs. + Links *RepositoryLinksScheme `json:"links,omitempty"` // A collection of links related to the repository. } +// RepositoryLinksScheme represents a collection of links related to a repository. +// Self is the link to the repository itself. +// Html is the link to the repository's HTML page. +// Avatar is the link to the repository's avatar. +// PullRequests is the link to the repository's pull requests. +// Commits is the link to the repository's commits. +// Forks is the link to the repository's forks. +// Watchers is the link to the repository's watchers. +// Downloads is the link to the repository's downloads. +// Clone is a slice of links to clone the repository. +// Hooks is the link to the repository's hooks. type RepositoryLinksScheme struct { - Self *BitbucketLinkScheme `json:"self,omitempty"` - Html *BitbucketLinkScheme `json:"html,omitempty"` - Avatar *BitbucketLinkScheme `json:"avatar,omitempty"` - PullRequests *BitbucketLinkScheme `json:"pullrequests,omitempty"` - Commits *BitbucketLinkScheme `json:"commits,omitempty"` - Forks *BitbucketLinkScheme `json:"forks,omitempty"` - Watchers *BitbucketLinkScheme `json:"watchers,omitempty"` - Downloads *BitbucketLinkScheme `json:"downloads,omitempty"` - Clone []*BitbucketLinkScheme `json:"clone,omitempty"` - Hooks *BitbucketLinkScheme `json:"hooks,omitempty"` + Self *BitbucketLinkScheme `json:"self,omitempty"` // The link to the repository itself. + Html *BitbucketLinkScheme `json:"html,omitempty"` // The link to the repository's HTML page. + Avatar *BitbucketLinkScheme `json:"avatar,omitempty"` // The link to the repository's avatar. + PullRequests *BitbucketLinkScheme `json:"pullrequests,omitempty"` // The link to the repository's pull requests. + Commits *BitbucketLinkScheme `json:"commits,omitempty"` // The link to the repository's commits. + Forks *BitbucketLinkScheme `json:"forks,omitempty"` // The link to the repository's forks. + Watchers *BitbucketLinkScheme `json:"watchers,omitempty"` // The link to the repository's watchers. + Downloads *BitbucketLinkScheme `json:"downloads,omitempty"` // The link to the repository's downloads. + Clone []*BitbucketLinkScheme `json:"clone,omitempty"` // The links to clone the repository. + Hooks *BitbucketLinkScheme `json:"hooks,omitempty"` // The link to the repository's hooks. } diff --git a/pkg/infra/models/bitbucket_webhooks.go b/pkg/infra/models/bitbucket_webhooks.go index 6f355130..bf711bb2 100644 --- a/pkg/infra/models/bitbucket_webhooks.go +++ b/pkg/infra/models/bitbucket_webhooks.go @@ -1,32 +1,55 @@ package models +// WebhookSubscriptionPayloadScheme represents the payload for a webhook subscription. +// Description is the description of the webhook subscription. +// Url is the URL of the webhook subscription. +// Active indicates if the webhook subscription is active. +// Events is a slice of the events for the webhook subscription. type WebhookSubscriptionPayloadScheme struct { - Description string `json:"description,omitempty"` - Url string `json:"url,omitempty"` - Active bool `json:"active,omitempty"` - Events []string `json:"events,omitempty"` + Description string `json:"description,omitempty"` // The description of the webhook subscription. + Url string `json:"url,omitempty"` // The URL of the webhook subscription. + Active bool `json:"active,omitempty"` // Indicates if the webhook subscription is active. + Events []string `json:"events,omitempty"` // The events for the webhook subscription. } +// WebhookSubscriptionPageScheme represents a paginated list of webhook subscriptions. +// Size is the number of subscriptions in the current page. +// Page is the current page number. +// Pagelen is the total number of pages. +// Next is the URL to the next page. +// Previous is the URL to the previous page. +// Values is a slice of the webhook subscriptions in the current page. type WebhookSubscriptionPageScheme struct { - Size int `json:"size,omitempty"` - Page int `json:"page,omitempty"` - Pagelen int `json:"pagelen,omitempty"` - Next string `json:"next,omitempty"` - Previous string `json:"previous,omitempty"` - Values []*WebhookSubscriptionScheme `json:"values,omitempty"` + Size int `json:"size,omitempty"` // The number of subscriptions in the current page. + Page int `json:"page,omitempty"` // The current page number. + Pagelen int `json:"pagelen,omitempty"` // The total number of pages. + Next string `json:"next,omitempty"` // The URL to the next page. + Previous string `json:"previous,omitempty"` // The URL to the previous page. + Values []*WebhookSubscriptionScheme `json:"values,omitempty"` // The webhook subscriptions in the current page. } +// WebhookSubscriptionScheme represents a webhook subscription. +// UUID is the unique identifier of the webhook subscription. +// URL is the URL of the webhook subscription. +// Description is the description of the webhook subscription. +// SubjectType is the type of the subject of the webhook subscription. +// Subject is the subject of the webhook subscription. +// Active indicates if the webhook subscription is active. +// CreatedAt is the creation time of the webhook subscription. +// Events is a slice of the events for the webhook subscription. type WebhookSubscriptionScheme struct { - UUID string `json:"uuid,omitempty"` - URL string `json:"url,omitempty"` - Description string `json:"description,omitempty"` - SubjectType string `json:"subject_type,omitempty"` - Subject *WebhookSubscriptionSubjectScheme `json:"subject,omitempty"` - Active bool `json:"active,omitempty"` - CreatedAt string `json:"created_at,omitempty"` - Events []string `json:"events,omitempty"` + UUID string `json:"uuid,omitempty"` // The unique identifier of the webhook subscription. + URL string `json:"url,omitempty"` // The URL of the webhook subscription. + Description string `json:"description,omitempty"` // The description of the webhook subscription. + SubjectType string `json:"subject_type,omitempty"` // The type of the subject of the webhook subscription. + Subject *WebhookSubscriptionSubjectScheme `json:"subject,omitempty"` // The subject of the webhook subscription. + Active bool `json:"active,omitempty"` // Indicates if the webhook subscription is active. + CreatedAt string `json:"created_at,omitempty"` // The creation time of the webhook subscription. + Events []string `json:"events,omitempty"` // The events for the webhook subscription. } +// WebhookSubscriptionSubjectScheme represents the subject of a webhook subscription. +// Type is the type of the subject. type WebhookSubscriptionSubjectScheme struct { - Type string `json:"type,omitempty"` + Type string `json:"type,omitempty"` // The type of the subject. } diff --git a/pkg/infra/models/bitbucket_workspace.go b/pkg/infra/models/bitbucket_workspace.go index 05dab19f..904cb55d 100644 --- a/pkg/infra/models/bitbucket_workspace.go +++ b/pkg/infra/models/bitbucket_workspace.go @@ -1,28 +1,49 @@ package models +// WorkspaceScheme represents a workspace. +// Type is the type of the workspace. +// Links is a collection of links related to the workspace. +// Uuid is the unique identifier of the workspace. +// Name is the name of the workspace. +// Slug is the slug of the workspace. +// IsPrivate indicates if the workspace is private. +// CreatedOn is the creation time of the workspace. +// UpdatedOn is the update time of the workspace. type WorkspaceScheme struct { - Type string `json:"type,omitempty"` - Links *WorkspaceLinksScheme `json:"links,omitempty"` - Uuid string `json:"uuid,omitempty"` - Name string `json:"name,omitempty"` - Slug string `json:"slug,omitempty"` - IsPrivate bool `json:"is_private,omitempty"` - CreatedOn string `json:"created_on,omitempty"` - UpdatedOn string `json:"updated_on,omitempty"` + Type string `json:"type,omitempty"` // The type of the workspace. + Links *WorkspaceLinksScheme `json:"links,omitempty"` // The links related to the workspace. + Uuid string `json:"uuid,omitempty"` // The unique identifier of the workspace. + Name string `json:"name,omitempty"` // The name of the workspace. + Slug string `json:"slug,omitempty"` // The slug of the workspace. + IsPrivate bool `json:"is_private,omitempty"` // Indicates if the workspace is private. + CreatedOn string `json:"created_on,omitempty"` // The creation time of the workspace. + UpdatedOn string `json:"updated_on,omitempty"` // The update time of the workspace. } +// WorkspaceLinksScheme represents a collection of links related to a workspace. +// Avatar is the link to the workspace's avatar. +// Html is the link to the workspace's HTML page. +// Members is the link to the workspace's members. +// Owners is the link to the workspace's owners. +// Projects is the link to the workspace's projects. +// Repositories is the link to the workspace's repositories. +// Snippets is the link to the workspace's snippets. +// Self is the link to the workspace itself. type WorkspaceLinksScheme struct { - Avatar *BitbucketLinkScheme `json:"avatar,omitempty"` - Html *BitbucketLinkScheme `json:"html,omitempty"` - Members *BitbucketLinkScheme `json:"members,omitempty"` - Owners *BitbucketLinkScheme `json:"owners,omitempty"` - Projects *BitbucketLinkScheme `json:"projects,omitempty"` - Repositories *BitbucketLinkScheme `json:"repositories,omitempty"` - Snippets *BitbucketLinkScheme `json:"snippets,omitempty"` - Self *BitbucketLinkScheme `json:"self,omitempty"` + Avatar *BitbucketLinkScheme `json:"avatar,omitempty"` // The link to the workspace's avatar. + Html *BitbucketLinkScheme `json:"html,omitempty"` // The link to the workspace's HTML page. + Members *BitbucketLinkScheme `json:"members,omitempty"` // The link to the workspace's members. + Owners *BitbucketLinkScheme `json:"owners,omitempty"` // The link to the workspace's owners. + Projects *BitbucketLinkScheme `json:"projects,omitempty"` // The link to the workspace's projects. + Repositories *BitbucketLinkScheme `json:"repositories,omitempty"` // The link to the workspace's repositories. + Snippets *BitbucketLinkScheme `json:"snippets,omitempty"` // The link to the workspace's snippets. + Self *BitbucketLinkScheme `json:"self,omitempty"` // The link to the workspace itself. } +// BitbucketLinkScheme represents a link in Bitbucket. +// Href is the URL of the link. +// Name is the name of the link. type BitbucketLinkScheme struct { - Href string `json:"href,omitempty"` - Name string `json:"name,omitempty"` + Href string `json:"href,omitempty"` // The URL of the link. + Name string `json:"name,omitempty"` // The name of the link. } diff --git a/pkg/infra/models/bitbucket_workspace_membership.go b/pkg/infra/models/bitbucket_workspace_membership.go index 1017de19..1fa05f70 100644 --- a/pkg/infra/models/bitbucket_workspace_membership.go +++ b/pkg/infra/models/bitbucket_workspace_membership.go @@ -2,72 +2,70 @@ package models import "time" +// WorkspaceMembershipPageScheme represents a paginated list of workspace memberships. +// Size is the number of memberships in the current page. +// Page is the current page number. +// Pagelen is the total number of pages. +// Next is the URL to the next page. +// Previous is the URL to the previous page. +// Values is a slice of the workspace memberships in the current page. type WorkspaceMembershipPageScheme struct { - Size int `json:"size,omitempty"` - Page int `json:"page,omitempty"` - Pagelen int `json:"pagelen,omitempty"` - Next string `json:"next,omitempty"` - Previous string `json:"previous,omitempty"` - Values []*WorkspaceMembershipScheme `json:"values,omitempty"` + Size int `json:"size,omitempty"` // The number of memberships in the current page. + Page int `json:"page,omitempty"` // The current page number. + Pagelen int `json:"pagelen,omitempty"` // The total number of pages. + Next string `json:"next,omitempty"` // The URL to the next page. + Previous string `json:"previous,omitempty"` // The URL to the previous page. + Values []*WorkspaceMembershipScheme `json:"values,omitempty"` // The workspace memberships in the current page. } +// WorkspaceMembershipScheme represents a workspace membership. +// Links is a collection of links related to the membership. +// User is the user who has the membership. +// Workspace is the workspace to which the membership applies. +// AddedOn is the time when the membership was added. +// Permission is the level of the membership. +// LastAccessed is the last time the membership was accessed. type WorkspaceMembershipScheme struct { - Links *WorkspaceMembershipLinksScheme `json:"links,omitempty"` - User *BitbucketAccountScheme `json:"user,omitempty"` - Workspace *WorkspaceScheme `json:"workspace,omitempty"` - AddedOn time.Time `json:"added_on,omitempty"` - Permission string `json:"permission,omitempty"` - LastAccessed time.Time `json:"last_accessed,omitempty"` + Links *WorkspaceMembershipLinksScheme `json:"links,omitempty"` // The links related to the membership. + User *BitbucketAccountScheme `json:"user,omitempty"` // The user who has the membership. + Workspace *WorkspaceScheme `json:"workspace,omitempty"` // The workspace to which the membership applies. + AddedOn time.Time `json:"added_on,omitempty"` // The time when the membership was added. + Permission string `json:"permission,omitempty"` // The level of the membership. + LastAccessed time.Time `json:"last_accessed,omitempty"` // The last time the membership was accessed. } +// WorkspaceMembershipLinksScheme represents a collection of links related to a workspace membership. +// Self is the link to the membership itself. type WorkspaceMembershipLinksScheme struct { - Self *BitbucketLinkScheme `json:"self,omitempty"` + Self *BitbucketLinkScheme `json:"self,omitempty"` // The link to the membership itself. } +// BitbucketAccountScheme represents a Bitbucket account. +// Links is a collection of links related to the account. +// CreatedOn is the creation time of the account. +// DisplayName is the display name of the account. +// Username is the username of the account. +// Uuid is the unique identifier of the account. +// Type is the type of the account. +// AccountId is the account ID of the account. +// Nickname is the nickname of the account. type BitbucketAccountScheme struct { - Links *BitbucketAccountLinksScheme `json:"links,omitempty"` - CreatedOn string `json:"created_on,omitempty"` - DisplayName string `json:"display_name,omitempty"` - Username string `json:"username,omitempty"` - Uuid string `json:"uuid,omitempty"` - Type string `json:"type,omitempty"` - AccountId string `json:"account_id,omitempty"` - Nickname string `json:"nickname,omitempty"` + Links *BitbucketAccountLinksScheme `json:"links,omitempty"` // The links related to the account. + CreatedOn string `json:"created_on,omitempty"` // The creation time of the account. + DisplayName string `json:"display_name,omitempty"` // The display name of the account. + Username string `json:"username,omitempty"` // The username of the account. + Uuid string `json:"uuid,omitempty"` // The unique identifier of the account. + Type string `json:"type,omitempty"` // The type of the account. + AccountId string `json:"account_id,omitempty"` // The account ID of the account. + Nickname string `json:"nickname,omitempty"` // The nickname of the account. } +// BitbucketAccountLinksScheme represents a collection of links related to a Bitbucket account. +// Avatar is the link to the account's avatar. +// Self is the link to the account itself. +// Html is the link to the account's HTML page. type BitbucketAccountLinksScheme struct { - Avatar *BitbucketLinkScheme `json:"avatar,omitempty"` - Self *BitbucketLinkScheme `json:"self,omitempty"` - Html *BitbucketLinkScheme `json:"html,omitempty"` -} - -/* - - */ - -type T struct { - Values []struct { - Repository struct { - Type string `json:"type"` - FullName string `json:"full_name"` - Links struct { - Self struct { - Href string `json:"href"` - } `json:"self"` - Html struct { - Href string `json:"href"` - } `json:"html"` - Avatar struct { - Href string `json:"href"` - } `json:"avatar"` - } `json:"links"` - Name string `json:"name"` - Uuid string `json:"uuid"` - } `json:"repository"` - Type string `json:"type"` - Permission string `json:"permission"` - } `json:"values"` - Pagelen int `json:"pagelen"` - Size int `json:"size"` - Page int `json:"page"` + Avatar *BitbucketLinkScheme `json:"avatar,omitempty"` // The link to the account's avatar. + Self *BitbucketLinkScheme `json:"self,omitempty"` // The link to the account itself. + Html *BitbucketLinkScheme `json:"html,omitempty"` // The link to the account's HTML page. } diff --git a/pkg/infra/models/confluence_analytics.go b/pkg/infra/models/confluence_analytics.go index ae0070f3..0f64db6e 100644 --- a/pkg/infra/models/confluence_analytics.go +++ b/pkg/infra/models/confluence_analytics.go @@ -1,6 +1,9 @@ package models +// ContentViewScheme represents a content view in Confluence. +// ID is the unique identifier of the content view. +// Count is the number of times the content has been viewed. type ContentViewScheme struct { - ID int `json:"id,omitempty"` - Count int `json:"count,omitempty"` + ID int `json:"id,omitempty"` // The unique identifier of the content view. + Count int `json:"count,omitempty"` // The number of times the content has been viewed. } diff --git a/pkg/infra/models/confluence_attachment.go b/pkg/infra/models/confluence_attachment.go index c63c3e79..031f4ec3 100644 --- a/pkg/infra/models/confluence_attachment.go +++ b/pkg/infra/models/confluence_attachment.go @@ -1,5 +1,20 @@ package models +// AttachmentScheme represents an attachment in Confluence. +// ID is the unique identifier of the attachment. +// BlogPostID is the ID of the blog post to which the attachment belongs. +// CustomContentID is the custom content ID of the attachment. +// Comment is the comment for the attachment. +// MediaTypeDescription is the description of the media type of the attachment. +// WebuiLink is the web UI link of the attachment. +// DownloadLink is the download link of the attachment. +// Title is the title of the attachment. +// Status is the status of the attachment. +// FileSize is the size of the file of the attachment. +// MediaType is the media type of the attachment. +// PageID is the ID of the page to which the attachment belongs. +// FileID is the ID of the file of the attachment. +// Version is the version of the attachment. type AttachmentScheme struct { ID string `json:"id,omitempty"` BlogPostID string `json:"blogPostId,omitempty"` @@ -17,6 +32,13 @@ type AttachmentScheme struct { Version *AttachmentVersionScheme `json:"version,omitempty"` } +// AttachmentVersionScheme represents a version of an attachment in Confluence. +// CreatedAt is the creation time of the version. +// Message is the message for the version. +// Number is the number of the version. +// MinorEdit indicates if the version is a minor edit. +// AuthorID is the ID of the author of the version. +// Attachment is the attachment of the version. type AttachmentVersionScheme struct { CreatedAt string `json:"createdAt,omitempty"` Message string `json:"message,omitempty"` @@ -26,44 +48,58 @@ type AttachmentVersionScheme struct { Attachment *AttachmentVersionBodyScheme `json:"attachment,omitempty"` } +// AttachmentVersionBodyScheme represents the body of a version of an attachment in Confluence. +// Title is the title of the body. +// ID is the ID of the body. type AttachmentVersionBodyScheme struct { Title string `json:"title,omitempty"` ID string `json:"id,omitempty"` } +// AttachmentParamsScheme represents the parameters for an attachment in Confluence. +// Sort is used to sort the result by a particular field. +// MediaType filters the mediaType of attachments. +// FileName filters on the file-name of attachments. +// SerializeIDs indicates if IDs should be serialized. type AttachmentParamsScheme struct { - - // Sort it's used to sort the result by a particular field. - // Valid values: - // created-date - // -created-date - // modified-date - // -modified-date - Sort string - - // MediaType filters the mediaType of attachments. Only one may be specified. - MediaType string - - // FileName filters on the file-name of attachments. Only one may be specified. - FileName string - + Sort string + MediaType string + FileName string SerializeIDs bool } +// AttachmentPageScheme represents a paginated list of attachments in Confluence. +// Results is a slice of the attachments in the current page. +// Links is a collection of links related to the page. type AttachmentPageScheme struct { Results []*AttachmentScheme `json:"results,omitempty"` Links *PageLinkScheme `json:"_links,omitempty"` } +// PageLinkScheme represents a link in a page in Confluence. +// Next is the URL to the next page. type PageLinkScheme struct { Next string `json:"next,omitempty"` } +// AttachmentVersionPageScheme represents a paginated list of versions of an attachment in Confluence. +// Results is a slice of the versions in the current page. +// Links is a collection of links related to the page. type AttachmentVersionPageScheme struct { Results []*AttachmentVersionScheme `json:"results,omitempty"` Links *PageLinkScheme `json:"_links,omitempty"` } +// DetailedVersionScheme represents a detailed version in Confluence. +// Number is the number of the version. +// AuthorID is the ID of the author of the version. +// Message is the message for the version. +// CreatedAt is the creation time of the version. +// MinorEdit indicates if the version is a minor edit. +// ContentTypeModified indicates if the content type was modified in the version. +// Collaborators is a slice of the collaborators of the version. +// PrevVersion is the number of the previous version. +// NextVersion is the number of the next version. type DetailedVersionScheme struct { Number int `json:"number,omitempty"` AuthorID string `json:"authorId,omitempty"` diff --git a/pkg/infra/models/confluence_content.go b/pkg/infra/models/confluence_content.go index 283f19bc..5ce60619 100644 --- a/pkg/infra/models/confluence_content.go +++ b/pkg/infra/models/confluence_content.go @@ -2,6 +2,15 @@ package models import "time" +// GetContentOptionsScheme represents the options for getting content. +// ContextType is the type of the context. +// SpaceKey is the key of the space. +// Title is the title of the content. +// Trigger is the trigger for getting the content. +// OrderBy is the field by which to order the content. +// Status is the status of the content. +// Expand is the fields to expand in the content. +// PostingDay is the day the content was posted. type GetContentOptionsScheme struct { ContextType, SpaceKey string Title string @@ -11,6 +20,12 @@ type GetContentOptionsScheme struct { PostingDay time.Time } +// ContentPageScheme represents a page of content. +// Results is the content in the current page. +// Start is the start index of the content in the current page. +// Limit is the limit on the number of content in the current page. +// Size is the size of the content in the current page. +// Links is the links related to the current page. type ContentPageScheme struct { Results []*ContentScheme `json:"results"` Start int `json:"start"` @@ -19,6 +34,16 @@ type ContentPageScheme struct { Links *LinkScheme `json:"_links"` } +// LinkScheme represents a link. +// Base is the base URL of the link. +// Context is the context of the link. +// Self is the URL to the link itself. +// Tinyui is the tiny UI URL of the link. +// Editui is the edit UI URL of the link. +// Webui is the web UI URL of the link. +// Download is the download URL of the link. +// Next is the URL to the next link. +// Collection is the collection of the link. type LinkScheme struct { Base string `json:"base,omitempty"` Context string `json:"context,omitempty"` @@ -31,6 +56,22 @@ type LinkScheme struct { Collection string `json:"collection"` } +// ContentScheme represents content. +// ID is the unique identifier of the content. +// Type is the type of the content. +// Status is the status of the content. +// Title is the title of the content. +// Expandable is the fields that can be expanded in the content. +// Links is the links related to the content. +// ChildTypes is the types of the children of the content. +// Space is the space of the content. +// Metadata is the metadata of the content. +// Operations is the operations on the content. +// Body is the body of the content. +// Version is the version of the content. +// Extensions is the extensions of the content. +// Ancestors is the ancestors of the content. +// History is the history of the content. type ContentScheme struct { ID string `json:"id,omitempty"` Type string `json:"type,omitempty"` @@ -49,6 +90,12 @@ type ContentScheme struct { History *ContentHistoryScheme `json:"history,omitempty"` } +// ContentExtensionScheme represents an extension of content. +// MediaType is the media type of the extension. +// FileSize is the size of the file of the extension. +// Comment is the comment on the extension. +// MediaTypeDescription is the description of the media type of the extension. +// FileID is the ID of the file of the extension. type ContentExtensionScheme struct { MediaType string `json:"mediaType,omitempty"` FileSize int `json:"fileSize,omitempty"` @@ -57,6 +104,13 @@ type ContentExtensionScheme struct { FileID string `json:"fileId,omitempty"` } +// BodyScheme represents the body of content. +// View is the view of the body. +// ExportView is the export view of the body. +// StyledView is the styled view of the body. +// Storage is the storage of the body. +// Editor2 is the editor2 of the body. +// AnonymousExportView is the anonymous export view of the body. type BodyScheme struct { View *BodyNodeScheme `json:"view,omitempty"` ExportView *BodyNodeScheme `json:"export_view,omitempty"` @@ -66,22 +120,38 @@ type BodyScheme struct { AnonymousExportView *BodyNodeScheme `json:"anonymous_export_view,omitempty"` } +// BodyNodeScheme represents a node in the body of content. +// Value is the value of the node. +// Representation is the representation of the node. type BodyNodeScheme struct { Value string `json:"value,omitempty"` Representation string `json:"representation,omitempty"` } +// OperationScheme represents an operation. +// Operation is the operation. +// TargetType is the target type of the operation. type OperationScheme struct { Operation string `json:"operation,omitempty"` TargetType string `json:"targetType,omitempty"` } +// MetadataScheme represents the metadata of content. +// Labels is the labels of the metadata. +// Expandable is the fields that can be expanded in the metadata. +// MediaType is the media type of the metadata. type MetadataScheme struct { Labels *LabelsScheme `json:"labels"` Expandable *ExpandableScheme `json:"_expandable,omitempty"` MediaType string `json:"mediaType,omitempty"` } +// LabelsScheme represents labels. +// Results is the results of the labels. +// Start is the start index of the labels. +// Limit is the limit on the number of labels. +// Size is the size of the labels. +// Links is the links related to the labels. type LabelsScheme struct { Results []*LabelValueScheme `json:"results,omitempty"` Start int `json:"start,omitempty"` @@ -90,6 +160,11 @@ type LabelsScheme struct { Links *LinkScheme `json:"_links,omitempty"` } +// LabelValueScheme represents a value of a label. +// Prefix is the prefix of the label value. +// Name is the name of the label value. +// ID is the ID of the label value. +// Label is the label of the label value. type LabelValueScheme struct { Prefix string `json:"prefix,omitempty"` Name string `json:"name,omitempty"` @@ -97,12 +172,19 @@ type LabelValueScheme struct { Label string `json:"label,omitempty"` } +// ChildTypesScheme represents the types of children of content. +// Attachment is the attachment type of the child. +// Comment is the comment type of the child. +// Page is the page type of the child. type ChildTypesScheme struct { Attachment *ChildTypeScheme `json:"attachment,omitempty"` Comment *ChildTypeScheme `json:"comment,omitempty"` Page *ChildTypeScheme `json:"page,omitempty"` } +// ChildTypeScheme represents a type of a child of content. +// Value is the value of the child type. +// Links is the links related to the child type. type ChildTypeScheme struct { Value bool `json:"value,omitempty"` Links struct { @@ -110,6 +192,7 @@ type ChildTypeScheme struct { } `json:"_links,omitempty"` } +// ExpandableScheme represents the fields that can be expanded in the content. type ExpandableScheme struct { Container string `json:"container"` Metadata string `json:"metadata"` @@ -138,6 +221,7 @@ type ExpandableScheme struct { NextVersion string `json:"nextVersion"` } +// ContentHistoryScheme represents the history of the content. type ContentHistoryScheme struct { Latest bool `json:"latest,omitempty"` CreatedBy *ContentUserScheme `json:"createdBy,omitempty"` @@ -150,10 +234,13 @@ type ContentHistoryScheme struct { Links *LinkScheme `json:"_links,omitempty"` } +// ContentHistoryContributorsScheme represents the contributors of the content history. +// Publishers are the publishers of the content. type ContentHistoryContributorsScheme struct { Publishers *VersionCollaboratorsScheme `json:"publishers,omitempty"` } +// ContentUserScheme represents a user of the content. type ContentUserScheme struct { Type string `json:"type,omitempty"` Username string `json:"username,omitempty"` @@ -171,6 +258,7 @@ type ContentUserScheme struct { Links *LinkScheme `json:"_links,omitempty"` } +// ProfilePictureScheme represents a profile picture. type ProfilePictureScheme struct { Path string `json:"path,omitempty"` Width int `json:"width,omitempty"` @@ -178,39 +266,60 @@ type ProfilePictureScheme struct { IsDefault bool `json:"isDefault,omitempty"` } +// ContentUserDetailScheme represents the detailed information of a user in the content. +// Business is a pointer to a UserBusinessDetailScheme which represents the business details of the user. +// Personal is a pointer to a UserPersonalDetailScheme which represents the personal details of the user. type ContentUserDetailScheme struct { - Business *UserBusinessDetailScheme `json:"business,omitempty"` - Personal *UserPersonalDetailScheme `json:"personal,omitempty"` + Business *UserBusinessDetailScheme `json:"business,omitempty"` // The business details of the user. + Personal *UserPersonalDetailScheme `json:"personal,omitempty"` // The personal details of the user. } +// UserBusinessDetailScheme represents the business details of a user. +// Position is the position of the user in the business. +// Department is the department of the user in the business. +// Location is the location of the user in the business. type UserBusinessDetailScheme struct { - Position string `json:"position,omitempty"` - Department string `json:"department,omitempty"` - Location string `json:"location,omitempty"` + Position string `json:"position,omitempty"` // The position of the user in the business. + Department string `json:"department,omitempty"` // The department of the user in the business. + Location string `json:"location,omitempty"` // The location of the user in the business. } +// UserPersonalDetailScheme represents the personal details of a user. +// Phone is the phone number of the user. +// Im is the instant messaging handle of the user. +// Website is the website of the user. +// Email is the email of the user. type UserPersonalDetailScheme struct { - Phone string `json:"phone,omitempty"` - Im string `json:"im,omitempty"` - Website string `json:"website,omitempty"` - Email string `json:"email,omitempty"` + Phone string `json:"phone,omitempty"` // The phone number of the user. + Im string `json:"im,omitempty"` // The instant messaging handle of the user. + Website string `json:"website,omitempty"` // The website of the user. + Email string `json:"email,omitempty"` // The email of the user. } +// ContentArchivePayloadScheme represents the payload for archiving content. +// Pages is a slice of pointers to ContentArchiveIDPayloadScheme which represents the pages to be archived. type ContentArchivePayloadScheme struct { - Pages []*ContentArchiveIDPayloadScheme `json:"pages,omitempty"` + Pages []*ContentArchiveIDPayloadScheme `json:"pages,omitempty"` // The pages to be archived. } +// ContentArchiveIDPayloadScheme represents the ID payload for archiving content. +// ID is the ID of the content to be archived. type ContentArchiveIDPayloadScheme struct { - ID int `json:"id,omitempty"` + ID int `json:"id,omitempty"` // The ID of the content to be archived. } +// ContentArchiveResultScheme represents the result of archiving content. +// ID is the ID of the archived content. +// Links is a struct containing the status of the archived content. type ContentArchiveResultScheme struct { - ID string `json:"id"` + ID string `json:"id"` // The ID of the archived content. Links struct { - Status string `json:"status"` - } `json:"links"` + Status string `json:"status"` // The status of the archived content. + } } +// ContentMoveScheme represents the scheme for moving content. +// ID is the ID of the content to be moved. type ContentMoveScheme struct { - ID string `json:"pageId"` + ID string `json:"pageId"` // The ID of the content to be moved. } diff --git a/pkg/infra/models/confluence_content_attachement.go b/pkg/infra/models/confluence_content_attachement.go index a8d839c1..bcc996de 100644 --- a/pkg/infra/models/confluence_content_attachement.go +++ b/pkg/infra/models/confluence_content_attachement.go @@ -1,7 +1,11 @@ package models +// GetContentAttachmentsOptionsScheme represents the options for getting content attachments. +// Expand is a slice of strings representing the fields to expand in the content attachments. +// FileName is a string representing the file name of the content attachments. +// MediaType is a string representing the media type of the content attachments. type GetContentAttachmentsOptionsScheme struct { - Expand []string - FileName string - MediaType string + Expand []string // The fields to expand in the content attachments. + FileName string // The file name of the content attachments. + MediaType string // The media type of the content attachments. } diff --git a/pkg/infra/models/confluence_content_children.go b/pkg/infra/models/confluence_content_children.go index 05be04e9..fc2a518c 100644 --- a/pkg/infra/models/confluence_content_children.go +++ b/pkg/infra/models/confluence_content_children.go @@ -1,46 +1,53 @@ package models +// ContentChildrenScheme represents the children of a content item in Confluence. type ContentChildrenScheme struct { - Attachment *ContentPageScheme `json:"attachment,omitempty"` - Comments *ContentPageScheme `json:"comment,omitempty"` - Page *ContentPageScheme `json:"page,omitempty"` - Links *LinkScheme `json:"_links,omitempty"` + Attachment *ContentPageScheme `json:"attachment,omitempty"` // The attachment of the content item. + Comments *ContentPageScheme `json:"comment,omitempty"` // The comments of the content item. + Page *ContentPageScheme `json:"page,omitempty"` // The page of the content item. + Links *LinkScheme `json:"_links,omitempty"` // The links related to the content item. } +// CopyOptionsScheme represents the options for copying a content item in Confluence. type CopyOptionsScheme struct { - CopyAttachments bool `json:"copyAttachments,omitempty"` - CopyPermissions bool `json:"copyPermissions,omitempty"` - CopyProperties bool `json:"copyProperties,omitempty"` - CopyLabels bool `json:"copyLabels,omitempty"` - CopyCustomContents bool `json:"copyCustomContents,omitempty"` - DestinationPageID string `json:"destinationPageId,omitempty"` - TitleOptions *CopyTitleOptionScheme `json:"titleOptions,omitempty"` - Destination *CopyPageDestinationScheme `json:"destination,omitempty"` - PageTitle string `json:"pageTitle,omitempty"` - Body *CopyPageBodyScheme `json:"body,omitempty"` + CopyAttachments bool `json:"copyAttachments,omitempty"` // Indicates if the attachments should be copied. + CopyPermissions bool `json:"copyPermissions,omitempty"` // Indicates if the permissions should be copied. + CopyProperties bool `json:"copyProperties,omitempty"` // Indicates if the properties should be copied. + CopyLabels bool `json:"copyLabels,omitempty"` // Indicates if the labels should be copied. + CopyCustomContents bool `json:"copyCustomContents,omitempty"` // Indicates if the custom contents should be copied. + DestinationPageID string `json:"destinationPageId,omitempty"` // The ID of the destination page. + TitleOptions *CopyTitleOptionScheme `json:"titleOptions,omitempty"` // The options for the title of the copied content. + Destination *CopyPageDestinationScheme `json:"destination,omitempty"` // The destination of the copied content. + PageTitle string `json:"pageTitle,omitempty"` // The title of the page. + Body *CopyPageBodyScheme `json:"body,omitempty"` // The body of the copied content. } +// CopyTitleOptionScheme represents the options for the title of a copied content item in Confluence. type CopyTitleOptionScheme struct { - Prefix string `json:"prefix,omitempty"` - Replace string `json:"replace,omitempty"` - Search string `json:"search,omitempty"` + Prefix string `json:"prefix,omitempty"` // The prefix of the title. + Replace string `json:"replace,omitempty"` // The replacement for the title. + Search string `json:"search,omitempty"` // The search term for the title. } +// CopyPageDestinationScheme represents the destination of a copied content item in Confluence. type CopyPageDestinationScheme struct { - Type string `json:"type,omitempty"` - Value string `json:"value,omitempty"` + Type string `json:"type,omitempty"` // The type of the destination. + Value string `json:"value,omitempty"` // The value of the destination. } +// CopyPageBodyScheme represents the body of a copied content item in Confluence. type CopyPageBodyScheme struct { - Storage *BodyNodeScheme `json:"storage"` - Editor2 *BodyNodeScheme `json:"editor2"` + Storage *BodyNodeScheme `json:"storage"` // The storage of the body. + Editor2 *BodyNodeScheme `json:"editor2"` // The editor2 of the body. } +// ContentTaskScheme represents a task in a content item in Confluence. type ContentTaskScheme struct { - ID string `json:"id,omitempty"` - Links *TaskLinkScheme `json:"links,omitempty"` + ID string `json:"id,omitempty"` // The ID of the task. + Links *TaskLinkScheme `json:"links,omitempty"` // The links related to the task. } +// TaskLinkScheme represents the links related to a task in a content item in Confluence. type TaskLinkScheme struct { - Status string `json:"status"` + Status string `json:"status"` // The status of the task. } diff --git a/pkg/infra/models/confluence_content_label.go b/pkg/infra/models/confluence_content_label.go index 28e16c71..741a8f98 100644 --- a/pkg/infra/models/confluence_content_label.go +++ b/pkg/infra/models/confluence_content_label.go @@ -1,20 +1,23 @@ package models +// ContentLabelPayloadScheme represents the payload for a content label in Confluence. type ContentLabelPayloadScheme struct { - Prefix string `json:"prefix,omitempty"` - Name string `json:"name,omitempty"` + Prefix string `json:"prefix,omitempty"` // The prefix of the content label. + Name string `json:"name,omitempty"` // The name of the content label. } +// ContentLabelPageScheme represents a page of content labels in Confluence. type ContentLabelPageScheme struct { - Results []*ContentLabelScheme `json:"results,omitempty"` - Start int `json:"start,omitempty"` - Limit int `json:"limit,omitempty"` - Size int `json:"size,omitempty"` + Results []*ContentLabelScheme `json:"results,omitempty"` // The content labels in the page. + Start int `json:"start,omitempty"` // The start index of the content labels in the page. + Limit int `json:"limit,omitempty"` // The limit of the content labels in the page. + Size int `json:"size,omitempty"` // The size of the content labels in the page. } +// ContentLabelScheme represents a content label in Confluence. type ContentLabelScheme struct { - Prefix string `json:"prefix,omitempty"` - Name string `json:"name,omitempty"` - ID string `json:"id,omitempty"` - Label string `json:"label,omitempty"` + Prefix string `json:"prefix,omitempty"` // The prefix of the content label. + Name string `json:"name,omitempty"` // The name of the content label. + ID string `json:"id,omitempty"` // The ID of the content label. + Label string `json:"label,omitempty"` // The label of the content label. } diff --git a/pkg/infra/models/confluence_content_permission.go b/pkg/infra/models/confluence_content_permission.go index 6482d4f8..984a2843 100644 --- a/pkg/infra/models/confluence_content_permission.go +++ b/pkg/infra/models/confluence_content_permission.go @@ -1,22 +1,34 @@ package models +// CheckPermissionScheme represents the scheme for checking permissions in Confluence. +// Subject is a pointer to a PermissionSubjectScheme which represents the subject of the permission. +// Operation is a string representing the operation of the permission. type CheckPermissionScheme struct { - Subject *PermissionSubjectScheme `json:"subject,omitempty"` - Operation string `json:"operation,omitempty"` + Subject *PermissionSubjectScheme `json:"subject,omitempty"` // The subject of the permission. + Operation string `json:"operation,omitempty"` // The operation of the permission. } +// PermissionSubjectScheme represents the subject of a permission in Confluence. +// Identifier is a string representing the identifier of the subject. +// Type is a string representing the type of the subject. type PermissionSubjectScheme struct { - Identifier string `json:"identifier,omitempty"` - Type string `json:"type,omitempty"` + Identifier string `json:"identifier,omitempty"` // The identifier of the subject. + Type string `json:"type,omitempty"` // The type of the subject. } +// PermissionCheckResponseScheme represents the response scheme for checking permissions in Confluence. +// HasPermission is a boolean indicating if the permission is granted. +// Errors is a slice of pointers to PermissionCheckMessageScheme which represents the errors occurred during the permission check. type PermissionCheckResponseScheme struct { - HasPermission bool `json:"hasPermission"` - Errors []*PermissionCheckMessageScheme `json:"errors,omitempty"` + HasPermission bool `json:"hasPermission"` // Indicates if the permission is granted. + Errors []*PermissionCheckMessageScheme `json:"errors,omitempty"` // The errors occurred during the permission check. } +// PermissionCheckMessageScheme represents a message scheme for checking permissions in Confluence. +// Translation is a string representing the translation of the message. +// Args is a slice of anonymous structs representing the arguments of the message. type PermissionCheckMessageScheme struct { - Translation string `json:"translation"` + Translation string `json:"translation"` // The translation of the message. Args []struct { - } `json:"args"` + } `json:"args"` // The arguments of the message. } diff --git a/pkg/infra/models/confluence_content_property.go b/pkg/infra/models/confluence_content_property.go index 0e03d5cc..c065d6be 100644 --- a/pkg/infra/models/confluence_content_property.go +++ b/pkg/infra/models/confluence_content_property.go @@ -1,32 +1,36 @@ package models +// ContentPropertyPayloadScheme represents the payload for a content property in Confluence. type ContentPropertyPayloadScheme struct { - Key string `json:"key"` - Value string `json:"value"` + Key string `json:"key"` // The key of the content property. + Value string `json:"value"` // The value of the content property. } +// ContentPropertyPageScheme represents a page of content properties in Confluence. type ContentPropertyPageScheme struct { - Results []*ContentPropertyScheme `json:"results,omitempty"` - Start int `json:"start,omitempty"` - Limit int `json:"limit,omitempty"` - Size int `json:"size,omitempty"` + Results []*ContentPropertyScheme `json:"results,omitempty"` // The content properties in the page. + Start int `json:"start,omitempty"` // The start index of the content properties in the page. + Limit int `json:"limit,omitempty"` // The limit of the content properties in the page. + Size int `json:"size,omitempty"` // The size of the content properties in the page. } +// ContentPropertyScheme represents a content property in Confluence. type ContentPropertyScheme struct { - ID string `json:"id,omitempty"` - Key string `json:"key,omitempty"` - Value interface{} `json:"value,omitempty"` - Version *ContentPropertyVersionScheme `json:"version,omitempty"` + ID string `json:"id,omitempty"` // The ID of the content property. + Key string `json:"key,omitempty"` // The key of the content property. + Value interface{} `json:"value,omitempty"` // The value of the content property. + Version *ContentPropertyVersionScheme `json:"version,omitempty"` // The version of the content property. Expandable struct { - Content string `json:"content,omitempty"` - AdditionalProperties string `json:"additionalProperties,omitempty"` - } `json:"_expandable,omitempty"` + Content string `json:"content,omitempty"` // The content of the content property. + AdditionalProperties string `json:"additionalProperties,omitempty"` // The additional properties of the content property. + } `json:"_expandable,omitempty"` // The expandable fields of the content property. } +// ContentPropertyVersionScheme represents the version of a content property in Confluence. type ContentPropertyVersionScheme struct { - When string `json:"when,omitempty"` - Message string `json:"message,omitempty"` - Number int `json:"number,omitempty"` - MinorEdit bool `json:"minorEdit,omitempty"` - ContentTypeModified bool `json:"contentTypeModified,omitempty"` + When string `json:"when,omitempty"` // The timestamp of the version. + Message string `json:"message,omitempty"` // The message of the version. + Number int `json:"number,omitempty"` // The number of the version. + MinorEdit bool `json:"minorEdit,omitempty"` // Indicates if the version is a minor edit. + ContentTypeModified bool `json:"contentTypeModified,omitempty"` // Indicates if the content type is modified in the version. } diff --git a/pkg/infra/models/confluence_content_restriction.go b/pkg/infra/models/confluence_content_restriction.go index 48ff6fc4..b2de17ec 100644 --- a/pkg/infra/models/confluence_content_restriction.go +++ b/pkg/infra/models/confluence_content_restriction.go @@ -1,45 +1,53 @@ package models +// ContentRestrictionPageScheme represents a page of content restrictions in Confluence. type ContentRestrictionPageScheme struct { - Start int `json:"start,omitempty"` - Limit int `json:"limit,omitempty"` - Size int `json:"size,omitempty"` - RestrictionsHash string `json:"restrictionsHash,omitempty"` - Results []*ContentRestrictionScheme `json:"results,omitempty"` + Start int `json:"start,omitempty"` // The start index of the content restrictions in the page. + Limit int `json:"limit,omitempty"` // The limit of the content restrictions in the page. + Size int `json:"size,omitempty"` // The size of the content restrictions in the page. + RestrictionsHash string `json:"restrictionsHash,omitempty"` // The hash of the restrictions. + Results []*ContentRestrictionScheme `json:"results,omitempty"` // The content restrictions in the page. } +// ContentRestrictionScheme represents a content restriction in Confluence. type ContentRestrictionScheme struct { - Operation string `json:"operation,omitempty"` - Restrictions *ContentRestrictionDetailScheme `json:"restrictions,omitempty"` - Content *ContentScheme `json:"content,omitempty"` - Expandable *ContentRestrictionExpandableScheme `json:"_expandable,omitempty"` + Operation string `json:"operation,omitempty"` // The operation of the restriction. + Restrictions *ContentRestrictionDetailScheme `json:"restrictions,omitempty"` // The details of the restriction. + Content *ContentScheme `json:"content,omitempty"` // The content of the restriction. + Expandable *ContentRestrictionExpandableScheme `json:"_expandable,omitempty"` // The expandable fields of the restriction. } +// ContentRestrictionExpandableScheme represents the expandable fields of a content restriction in Confluence. type ContentRestrictionExpandableScheme struct { - Restrictions string `json:"restrictions,omitempty"` - Content string `json:"content,omitempty"` + Restrictions string `json:"restrictions,omitempty"` // The restrictions of the content restriction. + Content string `json:"content,omitempty"` // The content of the content restriction. } +// ContentRestrictionDetailScheme represents the details of a content restriction in Confluence. type ContentRestrictionDetailScheme struct { - User *UserPermissionScheme `json:"user,omitempty"` - Group *GroupPermissionScheme `json:"group,omitempty"` + User *UserPermissionScheme `json:"user,omitempty"` // The user permissions of the restriction. + Group *GroupPermissionScheme `json:"group,omitempty"` // The group permissions of the restriction. } +// ContentRestrictionUpdatePayloadScheme represents the payload for updating a content restriction in Confluence. type ContentRestrictionUpdatePayloadScheme struct { - Results []*ContentRestrictionUpdateScheme `json:"results,omitempty"` + Results []*ContentRestrictionUpdateScheme `json:"results,omitempty"` // The content restrictions to be updated. } +// ContentRestrictionUpdateScheme represents a content restriction to be updated in Confluence. type ContentRestrictionUpdateScheme struct { - Operation string `json:"operation,omitempty"` - Restrictions *ContentRestrictionRestrictionUpdateScheme `json:"restrictions,omitempty"` - Content *ContentScheme `json:"content,omitempty"` + Operation string `json:"operation,omitempty"` // The operation of the restriction. + Restrictions *ContentRestrictionRestrictionUpdateScheme `json:"restrictions,omitempty"` // The details of the restriction to be updated. + Content *ContentScheme `json:"content,omitempty"` // The content of the restriction to be updated. } +// ContentRestrictionRestrictionUpdateScheme represents the details of a content restriction to be updated in Confluence. type ContentRestrictionRestrictionUpdateScheme struct { - Group []*SpaceGroupScheme `json:"group,omitempty"` - User []*ContentUserScheme `json:"user,omitempty"` + Group []*SpaceGroupScheme `json:"group,omitempty"` // The group permissions of the restriction to be updated. + User []*ContentUserScheme `json:"user,omitempty"` // The user permissions of the restriction to be updated. } +// ContentRestrictionByOperationScheme represents a content restriction by operation in Confluence. type ContentRestrictionByOperationScheme struct { - OperationType *ContentRestrictionScheme `json:"operationType,omitempty"` + OperationType *ContentRestrictionScheme `json:"operationType,omitempty"` // The type of the operation of the restriction. } diff --git a/pkg/infra/models/confluence_content_version.go b/pkg/infra/models/confluence_content_version.go index 1db47713..945044fb 100644 --- a/pkg/infra/models/confluence_content_version.go +++ b/pkg/infra/models/confluence_content_version.go @@ -1,40 +1,45 @@ package models +// ContentVersionPageScheme represents a page of content versions in Confluence. type ContentVersionPageScheme struct { - Results []*ContentVersionScheme `json:"results,omitempty"` - Start int `json:"start,omitempty"` - Limit int `json:"limit,omitempty"` - Size int `json:"size,omitempty"` + Results []*ContentVersionScheme `json:"results,omitempty"` // The content versions in the page. + Start int `json:"start,omitempty"` // The start index of the content versions in the page. + Limit int `json:"limit,omitempty"` // The limit of the content versions in the page. + Size int `json:"size,omitempty"` // The size of the content versions in the page. } +// ContentVersionScheme represents a content version in Confluence. type ContentVersionScheme struct { - By *ContentUserScheme `json:"by,omitempty"` - Number int `json:"number,omitempty"` - When string `json:"when,omitempty"` - FriendlyWhen string `json:"friendlyWhen,omitempty"` - Message string `json:"message,omitempty"` - MinorEdit bool `json:"minorEdit,omitempty"` - Content *ContentScheme `json:"content,omitempty"` - Collaborators *VersionCollaboratorsScheme `json:"collaborators,omitempty"` + By *ContentUserScheme `json:"by,omitempty"` // The user who made the version. + Number int `json:"number,omitempty"` // The number of the version. + When string `json:"when,omitempty"` // The timestamp of the version. + FriendlyWhen string `json:"friendlyWhen,omitempty"` // The friendly timestamp of the version. + Message string `json:"message,omitempty"` // The message of the version. + MinorEdit bool `json:"minorEdit,omitempty"` // Indicates if the version is a minor edit. + Content *ContentScheme `json:"content,omitempty"` // The content of the version. + Collaborators *VersionCollaboratorsScheme `json:"collaborators,omitempty"` // The collaborators of the version. Expandable struct { - Content string `json:"content"` - Collaborators string `json:"collaborators"` - } `json:"_expandable"` - ContentTypeModified bool `json:"contentTypeModified"` + Content string `json:"content"` // The content of the version. + Collaborators string `json:"collaborators"` // The collaborators of the version. + } `json:"_expandable"` // The expandable fields of the version. + ContentTypeModified bool `json:"contentTypeModified"` // Indicates if the content type is modified in the version. } +// VersionCollaboratorsScheme represents the collaborators of a version in Confluence. type VersionCollaboratorsScheme struct { - Users []*ContentUserScheme `json:"users,omitempty"` - UserKeys []string `json:"userKeys,omitempty"` + Users []*ContentUserScheme `json:"users,omitempty"` // The users who are collaborators. + UserKeys []string `json:"userKeys,omitempty"` // The keys of the users who are collaborators. } +// ContentRestorePayloadScheme represents the payload for restoring a content in Confluence. type ContentRestorePayloadScheme struct { - OperationKey string `json:"operationKey,omitempty"` - Params *ContentRestoreParamsPayloadScheme `json:"params,omitempty"` + OperationKey string `json:"operationKey,omitempty"` // The key of the operation for restoring the content. + Params *ContentRestoreParamsPayloadScheme `json:"params,omitempty"` // The parameters for restoring the content. } +// ContentRestoreParamsPayloadScheme represents the parameters for restoring a content in Confluence. type ContentRestoreParamsPayloadScheme struct { - VersionNumber int `json:"versionNumber,omitempty"` - Message string `json:"message,omitempty"` - RestoreTitle bool `json:"restoreTitle,omitempty"` + VersionNumber int `json:"versionNumber,omitempty"` // The number of the version to be restored. + Message string `json:"message,omitempty"` // The message for restoring the content. + RestoreTitle bool `json:"restoreTitle,omitempty"` // Indicates if the title should be restored. } diff --git a/pkg/infra/models/confluence_custom_content.go b/pkg/infra/models/confluence_custom_content.go index 3c7eac8a..a52d8953 100644 --- a/pkg/infra/models/confluence_custom_content.go +++ b/pkg/infra/models/confluence_custom_content.go @@ -1,74 +1,84 @@ package models +// CustomContentOptionsScheme represents the options for custom content in Confluence. type CustomContentOptionsScheme struct { - IDs []int - SpaceIDs []int - Sort string - BodyFormat string + IDs []int `json:"ids,omitempty"` // The IDs of the custom content. + SpaceIDs []int `json:"spaceIDs,omitempty"` // The IDs of the spaces of the custom content. + Sort string `json:"sort,omitempty"` // The sort order of the custom content. + BodyFormat string `json:"bodyFormat,omitempty"` // The body format of the custom content. } +// CustomContentPageScheme represents a page of custom content in Confluence. type CustomContentPageScheme struct { - Results []*CustomContentScheme `json:"results,omitempty"` - Links *CustomContentPageLinksScheme `json:"_links,omitempty"` + Results []*CustomContentScheme `json:"results,omitempty"` // The custom content in the page. + Links *CustomContentPageLinksScheme `json:"_links,omitempty"` // The links of the page. } +// CustomContentPageLinksScheme represents the links of a page of custom content in Confluence. type CustomContentPageLinksScheme struct { - Next string `json:"next,omitempty"` + Next string `json:"next,omitempty"` // The link to the next page. } +// CustomContentScheme represents custom content in Confluence. type CustomContentScheme struct { - ID string `json:"id,omitempty"` - Type string `json:"type,omitempty"` - Status string `json:"status,omitempty"` - Title string `json:"title,omitempty"` - SpaceID string `json:"spaceId,omitempty"` - PageID string `json:"pageId,omitempty"` - BlogPostID string `json:"blogPostId,omitempty"` - CustomContentID string `json:"customContentId,omitempty"` - AuthorID string `json:"authorId,omitempty"` - CreatedAt string `json:"createdAt,omitempty"` - Version *CustomContentVersionScheme `json:"version,omitempty"` - Body *CustomContentBodyScheme `json:"body,omitempty"` - Links *CustomContentLinksScheme `json:"_links,omitempty"` + ID string `json:"id,omitempty"` // The ID of the custom content. + Type string `json:"type,omitempty"` // The type of the custom content. + Status string `json:"status,omitempty"` // The status of the custom content. + Title string `json:"title,omitempty"` // The title of the custom content. + SpaceID string `json:"spaceId,omitempty"` // The ID of the space of the custom content. + PageID string `json:"pageId,omitempty"` // The ID of the page of the custom content. + BlogPostID string `json:"blogPostId,omitempty"` // The ID of the blog post of the custom content. + CustomContentID string `json:"customContentId,omitempty"` // The ID of the custom content. + AuthorID string `json:"authorId,omitempty"` // The ID of the author of the custom content. + CreatedAt string `json:"createdAt,omitempty"` // The timestamp of the creation of the custom content. + Version *CustomContentVersionScheme `json:"version,omitempty"` // The version of the custom content. + Body *CustomContentBodyScheme `json:"body,omitempty"` // The body of the custom content. + Links *CustomContentLinksScheme `json:"_links,omitempty"` // The links of the custom content. } +// CustomContentVersionScheme represents the version of custom content in Confluence. type CustomContentVersionScheme struct { - CreatedAt string `json:"createdAt,omitempty"` - Message string `json:"message,omitempty"` - Number int `json:"number,omitempty"` - MinorEdit bool `json:"minorEdit,omitempty"` - AuthorID string `json:"authorId,omitempty"` + CreatedAt string `json:"createdAt,omitempty"` // The timestamp of the creation of the version. + Message string `json:"message,omitempty"` // The message of the version. + Number int `json:"number,omitempty"` // The number of the version. + MinorEdit bool `json:"minorEdit,omitempty"` // Indicates if the version is a minor edit. + AuthorID string `json:"authorId,omitempty"` // The ID of the author of the version. } +// CustomContentBodyScheme represents the body of custom content in Confluence. type CustomContentBodyScheme struct { - Raw *BodyTypeScheme `json:"raw,omitempty"` - Storage *BodyTypeScheme `json:"storage,omitempty"` - AtlasDocFormat *BodyTypeScheme `json:"atlas_doc_format,omitempty"` + Raw *BodyTypeScheme `json:"raw,omitempty"` // The raw body. + Storage *BodyTypeScheme `json:"storage,omitempty"` // The storage body. + AtlasDocFormat *BodyTypeScheme `json:"atlas_doc_format,omitempty"` // The Atlas doc format body. } +// CustomContentLinksScheme represents the links of custom content in Confluence. type CustomContentLinksScheme struct { - Webui string `json:"webui,omitempty"` + Webui string `json:"webui,omitempty"` // The web UI link. } +// BodyTypeScheme represents a type of body in Confluence. type BodyTypeScheme struct { - Representation string `json:"representation,omitempty"` - Value string `json:"value,omitempty"` + Representation string `json:"representation,omitempty"` // The representation of the body. + Value string `json:"value,omitempty"` // The value of the body. } +// CustomContentPayloadScheme represents the payload for custom content in Confluence. type CustomContentPayloadScheme struct { - ID string `json:"id,omitempty"` - Type string `json:"type,omitempty"` - Status string `json:"status,omitempty"` - SpaceID string `json:"spaceId,omitempty"` - PageID string `json:"pageId,omitempty"` - BlogPostID string `json:"blogPostId,omitempty"` - CustomContentID string `json:"customContentId,omitempty"` - Title string `json:"title,omitempty"` - Body *BodyTypeScheme `json:"body,omitempty"` - Version *CustomContentPayloadVersionScheme `json:"version,omitempty"` + ID string `json:"id,omitempty"` // The ID of the custom content. + Type string `json:"type,omitempty"` // The type of the custom content. + Status string `json:"status,omitempty"` // The status of the custom content. + SpaceID string `json:"spaceId,omitempty"` // The ID of the space of the custom content. + PageID string `json:"pageId,omitempty"` // The ID of the page of the custom content. + BlogPostID string `json:"blogPostId,omitempty"` // The ID of the blog post of the custom content. + CustomContentID string `json:"customContentId,omitempty"` // The ID of the custom content. + Title string `json:"title,omitempty"` // The title of the custom content. + Body *BodyTypeScheme `json:"body,omitempty"` // The body of the custom content. + Version *CustomContentPayloadVersionScheme `json:"version,omitempty"` // The version of the custom content. } +// CustomContentPayloadVersionScheme represents the version of the payload for custom content in Confluence. type CustomContentPayloadVersionScheme struct { - Number int `json:"number,omitempty"` - Message string `json:"message,omitempty"` + Number int `json:"number,omitempty"` // The number of the version. + Message string `json:"message,omitempty"` // The message of the version. } diff --git a/pkg/infra/models/confluence_label.go b/pkg/infra/models/confluence_label.go index c6372a5c..04ebb847 100644 --- a/pkg/infra/models/confluence_label.go +++ b/pkg/infra/models/confluence_label.go @@ -1,19 +1,22 @@ package models +// LabelDetailsScheme represents the details of a label in Confluence. type LabelDetailsScheme struct { - Label *ContentLabelScheme `json:"label"` - AssociatedContents *LabelAssociatedContentPageScheme `json:"associatedContents"` + Label *ContentLabelScheme `json:"label"` // The label. + AssociatedContents *LabelAssociatedContentPageScheme `json:"associatedContents"` // The associated contents of the label. } +// LabelAssociatedContentPageScheme represents a page of associated contents of a label in Confluence. type LabelAssociatedContentPageScheme struct { - Results []*LabelAssociatedContentScheme `json:"results,omitempty"` - Start int `json:"start,omitempty"` - Limit int `json:"limit,omitempty"` - Size int `json:"size,omitempty"` + Results []*LabelAssociatedContentScheme `json:"results,omitempty"` // The associated contents in the page. + Start int `json:"start,omitempty"` // The start index of the associated contents in the page. + Limit int `json:"limit,omitempty"` // The limit of the associated contents in the page. + Size int `json:"size,omitempty"` // The size of the associated contents in the page. } +// LabelAssociatedContentScheme represents an associated content of a label in Confluence. type LabelAssociatedContentScheme struct { - ContentType string `json:"contentType,omitempty"` - ContentID int `json:"contentId,omitempty"` - Title string `json:"title,omitempty"` + ContentType string `json:"contentType,omitempty"` // The content type of the associated content. + ContentID int `json:"contentId,omitempty"` // The ID of the associated content. + Title string `json:"title,omitempty"` // The title of the associated content. } diff --git a/pkg/infra/models/confluence_long_task.go b/pkg/infra/models/confluence_long_task.go index 5fdf5cfe..55cc0998 100644 --- a/pkg/infra/models/confluence_long_task.go +++ b/pkg/infra/models/confluence_long_task.go @@ -1,37 +1,42 @@ package models +// LongTaskPageScheme represents a page of long tasks in Confluence. type LongTaskPageScheme struct { - Results []*LongTaskScheme `json:"results,omitempty"` - Start int `json:"start,omitempty"` - Limit int `json:"limit,omitempty"` - Size int `json:"size,omitempty"` + Results []*LongTaskScheme `json:"results,omitempty"` // The long tasks in the page. + Start int `json:"start,omitempty"` // The start index of the long tasks in the page. + Limit int `json:"limit,omitempty"` // The limit of the long tasks in the page. + Size int `json:"size,omitempty"` // The size of the long tasks in the page. } +// LongTaskScheme represents a long task in Confluence. type LongTaskScheme struct { - ID string `json:"id,omitempty"` - Name *LongTaskNameScheme `json:"name,omitempty"` - ElapsedTime int `json:"elapsedTime,omitempty"` - PercentageComplete int `json:"percentageComplete,omitempty"` - Successful bool `json:"successful,omitempty"` - Finished bool `json:"finished,omitempty"` - Messages []*LongTaskMessageScheme `json:"messages,omitempty"` - Status string `json:"status,omitempty"` - Errors []*LongTaskMessageScheme `json:"errors,omitempty"` - AdditionalDetails *LongTaskDetailsScheme `json:"additionalDetails,omitempty"` + ID string `json:"id,omitempty"` // The ID of the long task. + Name *LongTaskNameScheme `json:"name,omitempty"` // The name of the long task. + ElapsedTime int `json:"elapsedTime,omitempty"` // The elapsed time of the long task. + PercentageComplete int `json:"percentageComplete,omitempty"` // The percentage completion of the long task. + Successful bool `json:"successful,omitempty"` // Indicates if the long task is successful. + Finished bool `json:"finished,omitempty"` // Indicates if the long task is finished. + Messages []*LongTaskMessageScheme `json:"messages,omitempty"` // The messages of the long task. + Status string `json:"status,omitempty"` // The status of the long task. + Errors []*LongTaskMessageScheme `json:"errors,omitempty"` // The errors of the long task. + AdditionalDetails *LongTaskDetailsScheme `json:"additionalDetails,omitempty"` // The additional details of the long task. } +// LongTaskNameScheme represents the name of a long task in Confluence. type LongTaskNameScheme struct { - Key string `json:"key,omitempty"` + Key string `json:"key,omitempty"` // The key of the name. } +// LongTaskMessageScheme represents a message of a long task in Confluence. type LongTaskMessageScheme struct { - Translation string `json:"translation,omitempty"` - Args []string `json:"args,omitempty"` + Translation string `json:"translation,omitempty"` // The translation of the message. + Args []string `json:"args,omitempty"` // The arguments of the message. } +// LongTaskDetailsScheme represents the additional details of a long task in Confluence. type LongTaskDetailsScheme struct { - DestinationID string `json:"destinationId,omitempty"` - DestinationURL string `json:"destinationUrl,omitempty"` - TotalPageNeedToCopy int `json:"totalPageNeedToCopy,omitempty"` - AdditionalProperties string `json:"additionalProperties,omitempty"` + DestinationID string `json:"destinationId,omitempty"` // The ID of the destination of the long task. + DestinationURL string `json:"destinationUrl,omitempty"` // The URL of the destination of the long task. + TotalPageNeedToCopy int `json:"totalPageNeedToCopy,omitempty"` // The total number of pages needed to copy for the long task. + AdditionalProperties string `json:"additionalProperties,omitempty"` // The additional properties of the long task. } diff --git a/pkg/infra/models/confluence_page.go b/pkg/infra/models/confluence_page.go index 167378c2..0aef6334 100644 --- a/pkg/infra/models/confluence_page.go +++ b/pkg/infra/models/confluence_page.go @@ -1,89 +1,102 @@ package models +// ChildPageChunkLinksScheme represents the links of a chunk of child pages in Confluence. type ChildPageChunkLinksScheme struct { - Next string `json:"next,omitempty"` + Next string `json:"next,omitempty"` // The link to the next chunk of child pages. } +// ChildPageChunkScheme represents a chunk of child pages in Confluence. type ChildPageChunkScheme struct { - Results []*ChildPageScheme `json:"results,omitempty"` - Links *ChildPageChunkLinksScheme `json:"_links,omitempty"` + Results []*ChildPageScheme `json:"results,omitempty"` // The child pages in the chunk. + Links *ChildPageChunkLinksScheme `json:"_links,omitempty"` // The links of the chunk. } +// ChildPageScheme represents a child page in Confluence. type ChildPageScheme struct { - ID string `json:"id,omitempty"` - Status string `json:"status,omitempty"` - Title string `json:"title,omitempty"` - SpaceID string `json:"spaceId,omitempty"` - ChildPosition int `json:"childPosition,omitempty"` + ID string `json:"id,omitempty"` // The ID of the child page. + Status string `json:"status,omitempty"` // The status of the child page. + Title string `json:"title,omitempty"` // The title of the child page. + SpaceID string `json:"spaceId,omitempty"` // The ID of the space of the child page. + ChildPosition int `json:"childPosition,omitempty"` // The position of the child page. } +// PageOptionsScheme represents the options for a page in Confluence. type PageOptionsScheme struct { - PageIDs []int - SpaceIDs []int - Sort string - Status []string - Title string - BodyFormat string + PageIDs []int `json:"pageIDs,omitempty"` // The IDs of the pages. + SpaceIDs []int `json:"spaceIDs,omitempty"` // The IDs of the spaces of the pages. + Sort string `json:"sort,omitempty"` // The sort order of the pages. + Status []string `json:"status,omitempty"` // The statuses of the pages. + Title string `json:"title,omitempty"` // The title of the pages. + BodyFormat string `json:"bodyFormat,omitempty"` // The body format of the pages. } +// PageChunkScheme represents a chunk of pages in Confluence. type PageChunkScheme struct { - Results []*PageScheme `json:"results,omitempty"` - Links *PageChunkLinksScheme `json:"_links,omitempty"` + Results []*PageScheme `json:"results,omitempty"` // The pages in the chunk. + Links *PageChunkLinksScheme `json:"_links,omitempty"` // The links of the chunk. } +// PageChunkLinksScheme represents the links of a chunk of pages in Confluence. type PageChunkLinksScheme struct { - Next string `json:"next,omitempty"` + Next string `json:"next,omitempty"` // The link to the next chunk of pages. } +// PageScheme represents a page in Confluence. type PageScheme struct { - ID string `json:"id,omitempty"` - Status string `json:"status,omitempty"` - Title string `json:"title,omitempty"` - SpaceID string `json:"spaceId,omitempty"` - ParentID string `json:"parentId,omitempty"` - AuthorID string `json:"authorId,omitempty"` - CreatedAt string `json:"createdAt,omitempty"` - ParentType string `json:"parentType,omitempty"` - Position int `json:"position,omitempty"` - Version *PageVersionScheme `json:"version,omitempty"` - Body *PageBodyScheme `json:"body,omitempty"` + ID string `json:"id,omitempty"` // The ID of the page. + Status string `json:"status,omitempty"` // The status of the page. + Title string `json:"title,omitempty"` // The title of the page. + SpaceID string `json:"spaceId,omitempty"` // The ID of the space of the page. + ParentID string `json:"parentId,omitempty"` // The ID of the parent of the page. + AuthorID string `json:"authorId,omitempty"` // The ID of the author of the page. + CreatedAt string `json:"createdAt,omitempty"` // The timestamp of the creation of the page. + ParentType string `json:"parentType,omitempty"` // The type of the parent of the page. + Position int `json:"position,omitempty"` // The position of the page. + Version *PageVersionScheme `json:"version,omitempty"` // The version of the page. + Body *PageBodyScheme `json:"body,omitempty"` // The body of the page. } +// PageVersionScheme represents the version of a page in Confluence. type PageVersionScheme struct { - CreatedAt string `json:"createdAt,omitempty"` - Message string `json:"message,omitempty"` - Number int `json:"number,omitempty"` - MinorEdit bool `json:"minorEdit,omitempty"` - AuthorID string `json:"authorId,omitempty"` + CreatedAt string `json:"createdAt,omitempty"` // The timestamp of the creation of the version. + Message string `json:"message,omitempty"` // The message of the version. + Number int `json:"number,omitempty"` // The number of the version. + MinorEdit bool `json:"minorEdit,omitempty"` // Indicates if the version is a minor edit. + AuthorID string `json:"authorId,omitempty"` // The ID of the author of the version. } +// PageBodyScheme represents the body of a page in Confluence. type PageBodyScheme struct { - Storage *PageBodyRepresentationScheme `json:"storage,omitempty"` - AtlasDocFormat *PageBodyRepresentationScheme `json:"atlas_doc_format,omitempty"` + Storage *PageBodyRepresentationScheme `json:"storage,omitempty"` // The storage body. + AtlasDocFormat *PageBodyRepresentationScheme `json:"atlas_doc_format,omitempty"` // The Atlas doc format body. } +// PageCreatePayloadScheme represents the payload for creating a page in Confluence. type PageCreatePayloadScheme struct { - SpaceID string `json:"spaceId,omitempty"` - Status string `json:"status,omitempty"` - Title string `json:"title,omitempty"` - Body *PageBodyRepresentationScheme `json:"body,omitempty"` + SpaceID string `json:"spaceId,omitempty"` // The ID of the space of the page. + Status string `json:"status,omitempty"` // The status of the page. + Title string `json:"title,omitempty"` // The title of the page. + Body *PageBodyRepresentationScheme `json:"body,omitempty"` // The body of the page. } +// PageBodyRepresentationScheme represents a representation of a body in Confluence. type PageBodyRepresentationScheme struct { - Representation string `json:"representation,omitempty"` - Value string `json:"value,omitempty"` + Representation string `json:"representation,omitempty"` // The representation of the body. + Value string `json:"value,omitempty"` // The value of the body. } +// PageUpdatePayloadScheme represents the payload for updating a page in Confluence. type PageUpdatePayloadScheme struct { - ID int `json:"id,omitempty"` - Status string `json:"status,omitempty"` - Title string `json:"title,omitempty"` - SpaceID int `json:"spaceId,omitempty"` - Body *PageBodyRepresentationScheme `json:"body,omitempty"` - Version *PageUpdatePayloadVersionScheme `json:"version,omitempty"` + ID int `json:"id,omitempty"` // The ID of the page. + Status string `json:"status,omitempty"` // The status of the page. + Title string `json:"title,omitempty"` // The title of the page. + SpaceID int `json:"spaceId,omitempty"` // The ID of the space of the page. + Body *PageBodyRepresentationScheme `json:"body,omitempty"` // The body of the page. + Version *PageUpdatePayloadVersionScheme `json:"version,omitempty"` // The version of the page. } +// PageUpdatePayloadVersionScheme represents the version of the payload for updating a page in Confluence. type PageUpdatePayloadVersionScheme struct { - Number int `json:"number,omitempty"` - Message string `json:"message,omitempty"` + Number int `json:"number,omitempty"` // The number of the version. + Message string `json:"message,omitempty"` // The message of the version. } diff --git a/pkg/infra/models/confluence_search.go b/pkg/infra/models/confluence_search.go index 253be520..2a72586f 100644 --- a/pkg/infra/models/confluence_search.go +++ b/pkg/infra/models/confluence_search.go @@ -1,5 +1,6 @@ package models +// SearchContentOptions represents the options for searching content in Confluence. type SearchContentOptions struct { Context string Cursor string @@ -14,6 +15,7 @@ type SearchContentOptions struct { Expand []string } +// SearchPageScheme represents a page of search results in Confluence. type SearchPageScheme struct { Results []*SearchResultScheme `json:"results,omitempty"` Start int `json:"start,omitempty"` @@ -26,6 +28,7 @@ type SearchPageScheme struct { Links *SearchPageLinksScheme `json:"_links,omitempty"` } +// SearchPageLinksScheme represents the links of a page of search results in Confluence. type SearchPageLinksScheme struct { Base string `json:"base,omitempty"` Context string `json:"context,omitempty"` @@ -33,6 +36,7 @@ type SearchPageLinksScheme struct { Self string `json:"self,omitempty"` } +// SearchResultScheme represents a search result in Confluence. type SearchResultScheme struct { Content *ContentScheme `json:"content,omitempty"` User *ContentUserScheme `json:"user,omitempty"` @@ -50,11 +54,13 @@ type SearchResultScheme struct { Score float64 `json:"score,omitempty"` } +// ContainerSummaryScheme represents a summary of a container in Confluence. type ContainerSummaryScheme struct { Title string `json:"title,omitempty"` DisplayURL string `json:"displayUrl,omitempty"` } +// SearchBreadcrumbScheme represents a breadcrumb in a search result in Confluence. type SearchBreadcrumbScheme struct { Label string `json:"label,omitempty"` URL string `json:"url,omitempty"` diff --git a/pkg/infra/models/confluence_space.go b/pkg/infra/models/confluence_space.go index 613642c3..450ab874 100644 --- a/pkg/infra/models/confluence_space.go +++ b/pkg/infra/models/confluence_space.go @@ -1,5 +1,6 @@ package models +// SpaceScheme represents a space in Confluence. type SpaceScheme struct { ID int `json:"id,omitempty"` Key string `json:"key,omitempty"` @@ -14,16 +15,19 @@ type SpaceScheme struct { Links *LinkScheme `json:"_links,omitempty"` } +// SpaceHistoryScheme represents the history of a space in Confluence. type SpaceHistoryScheme struct { CreatedDate string `json:"createdDate,omitempty"` CreatedBy *ContentUserScheme `json:"createdBy,omitempty"` } +// SpaceOperationScheme represents an operation in a space in Confluence. type SpaceOperationScheme struct { Operation string `json:"operation,omitempty"` TargetType string `json:"targetType,omitempty"` } +// SpacePageScheme represents a page of spaces in Confluence. type SpacePageScheme struct { Results []*SpaceScheme `json:"results,omitempty"` Start int `json:"start"` @@ -36,6 +40,7 @@ type SpacePageScheme struct { } `json:"_links"` } +// GetSpacesOptionScheme represents the options for getting spaces in Confluence. type GetSpacesOptionScheme struct { SpaceKeys []string SpaceIDs []int @@ -47,6 +52,7 @@ type GetSpacesOptionScheme struct { Expand []string } +// CreateSpaceScheme represents the scheme for creating a space in Confluence. type CreateSpaceScheme struct { Key string `json:"key,omitempty"` Name string `json:"name,omitempty"` @@ -55,15 +61,18 @@ type CreateSpaceScheme struct { UnlicensedAccess bool `json:"unlicensedAccess,omitempty"` } +// CreateSpaceDescriptionScheme represents the description of a space in Confluence. type CreateSpaceDescriptionScheme struct { Plain *CreateSpaceDescriptionPlainScheme `json:"plain"` } +// CreateSpaceDescriptionPlainScheme represents the plain text description of a space in Confluence. type CreateSpaceDescriptionPlainScheme struct { Value string `json:"value"` Representation string `json:"representation"` } +// SpacePermissionScheme represents a permission in a space in Confluence. type SpacePermissionScheme struct { Subject *SubjectPermissionScheme `json:"subjects,omitempty"` Operation *OperationPermissionScheme `json:"operation,omitempty"` @@ -71,26 +80,31 @@ type SpacePermissionScheme struct { UnlicensedAccess bool `json:"unlicensedAccess,omitempty"` } +// OperationPermissionScheme represents an operation in a permission in Confluence. type OperationPermissionScheme struct { Operation string `json:"operation,omitempty"` TargetType string `json:"targetType,omitempty"` } +// SubjectPermissionScheme represents a subject in a permission in Confluence. type SubjectPermissionScheme struct { User *UserPermissionScheme `json:"user,omitempty"` Group *GroupPermissionScheme `json:"group,omitempty"` } +// UserPermissionScheme represents a user in a subject in a permission in Confluence. type UserPermissionScheme struct { Results []*ContentUserScheme `json:"results,omitempty"` Size int `json:"size,omitempty"` } +// GroupPermissionScheme represents a group in a subject in a permission in Confluence. type GroupPermissionScheme struct { Results []*SpaceGroupScheme `json:"results,omitempty"` Size int `json:"size,omitempty"` } +// SpaceGroupScheme represents a group in a subject in a permission in Confluence. type SpaceGroupScheme struct { Type string `json:"type,omitempty"` Name string `json:"name,omitempty"` @@ -98,12 +112,14 @@ type SpaceGroupScheme struct { Links *LinkScheme `json:"_links,omitempty"` } +// UpdateSpaceScheme represents the scheme for updating a space in Confluence. type UpdateSpaceScheme struct { Name string `json:"name,omitempty"` Description *CreateSpaceDescriptionScheme `json:"description,omitempty"` Homepage *UpdateSpaceHomepageScheme `json:"homepage,omitempty"` } +// UpdateSpaceHomepageScheme represents the home page of a space in Confluence. type UpdateSpaceHomepageScheme struct { ID string `json:"id"` } diff --git a/pkg/infra/models/confluence_space_permission.go b/pkg/infra/models/confluence_space_permission.go index bfbae532..0c87f0b3 100644 --- a/pkg/infra/models/confluence_space_permission.go +++ b/pkg/infra/models/confluence_space_permission.go @@ -1,28 +1,33 @@ package models +// SpacePermissionPayloadScheme represents the payload for a space permission in Confluence. type SpacePermissionPayloadScheme struct { - Subject *PermissionSubjectScheme `json:"subject,omitempty"` - Operation *SpacePermissionOperationScheme `json:"operation,omitempty"` + Subject *PermissionSubjectScheme `json:"subject,omitempty"` // The subject of the permission. + Operation *SpacePermissionOperationScheme `json:"operation,omitempty"` // The operation of the permission. } +// SpacePermissionArrayPayloadScheme represents the payload for an array of space permissions in Confluence. type SpacePermissionArrayPayloadScheme struct { - Subject *PermissionSubjectScheme `json:"subject,omitempty"` - Operations []*SpaceOperationPayloadScheme `json:"operations,omitempty"` + Subject *PermissionSubjectScheme `json:"subject,omitempty"` // The subject of the permissions. + Operations []*SpaceOperationPayloadScheme `json:"operations,omitempty"` // The operations of the permissions. } +// SpaceOperationPayloadScheme represents the payload for a space operation in Confluence. type SpaceOperationPayloadScheme struct { - Key string `json:"key,omitempty"` - Target string `json:"target,omitempty"` - Access bool `json:"access,omitempty"` + Key string `json:"key,omitempty"` // The key of the operation. + Target string `json:"target,omitempty"` // The target of the operation. + Access bool `json:"access,omitempty"` // Indicates if the operation has access. } +// SpacePermissionOperationScheme represents an operation in a space permission in Confluence. type SpacePermissionOperationScheme struct { - Operation string `json:"operation,omitempty"` - Target string `json:"target,omitempty"` - Key string `json:"key,omitempty"` + Operation string `json:"operation,omitempty"` // The operation. + Target string `json:"target,omitempty"` // The target of the operation. + Key string `json:"key,omitempty"` // The key of the operation. } +// SpacePermissionV2Scheme represents a version 2 space permission in Confluence. type SpacePermissionV2Scheme struct { - Subject *PermissionSubjectScheme `json:"subject,omitempty"` - Operation *SpacePermissionOperationScheme `json:"operation,omitempty"` + Subject *PermissionSubjectScheme `json:"subject,omitempty"` // The subject of the permission. + Operation *SpacePermissionOperationScheme `json:"operation,omitempty"` // The operation of the permission. } diff --git a/pkg/infra/models/confluence_space_v2.go b/pkg/infra/models/confluence_space_v2.go index b0898199..18428696 100644 --- a/pkg/infra/models/confluence_space_v2.go +++ b/pkg/infra/models/confluence_space_v2.go @@ -1,63 +1,73 @@ package models +// SpaceChunkV2Scheme represents a chunk of spaces in Confluence. type SpaceChunkV2Scheme struct { - Results []*SpaceSchemeV2 `json:"results,omitempty"` + Results []*SpaceSchemeV2 `json:"results,omitempty"` // The spaces in the chunk. Links struct { - Next string `json:"next"` + Next string `json:"next"` // The link to the next chunk of spaces. } `json:"_links"` } +// SpacePageLinkSchemeV2 represents the links of a page of spaces in Confluence. type SpacePageLinkSchemeV2 struct { - Next string `json:"next,omitempty"` + Next string `json:"next,omitempty"` // The link to the next page of spaces. } +// GetSpacesOptionSchemeV2 represents the options for getting spaces in Confluence. type GetSpacesOptionSchemeV2 struct { - IDs []string - Keys []string - Type string - Status string - Labels []string - Sort string - DescriptionFormat string - SerializeIDs bool + IDs []string // The IDs of the spaces. + Keys []string // The keys of the spaces. + Type string // The type of the spaces. + Status string // The status of the spaces. + Labels []string // The labels of the spaces. + Sort string // The sort order of the spaces. + DescriptionFormat string // The format of the description of the spaces. + SerializeIDs bool // Indicates if the IDs of the spaces should be serialized. } +// SpaceSchemeV2 represents a space in Confluence. type SpaceSchemeV2 struct { - ID string `json:"id,omitempty"` - Key string `json:"key,omitempty"` - Name string `json:"name,omitempty"` - Type string `json:"type,omitempty"` - Status string `json:"status,omitempty"` - HomepageId string `json:"homepageId,omitempty"` - Description *SpaceDescriptionSchemeV2 `json:"description,omitempty"` + ID string `json:"id,omitempty"` // The ID of the space. + Key string `json:"key,omitempty"` // The key of the space. + Name string `json:"name,omitempty"` // The name of the space. + Type string `json:"type,omitempty"` // The type of the space. + Status string `json:"status,omitempty"` // The status of the space. + HomepageId string `json:"homepageId,omitempty"` // The ID of the home page of the space. + Description *SpaceDescriptionSchemeV2 `json:"description,omitempty"` // The description of the space. } +// SpaceDescriptionSchemeV2 represents the description of a space in Confluence. type SpaceDescriptionSchemeV2 struct { - Plain *PageBodyRepresentationScheme `json:"plain,omitempty"` - View *PageBodyRepresentationScheme `json:"view,omitempty"` + Plain *PageBodyRepresentationScheme `json:"plain,omitempty"` // The plain text description of the space. + View *PageBodyRepresentationScheme `json:"view,omitempty"` // The view description of the space. } +// SpacePermissionPageScheme represents a page of space permissions in Confluence. type SpacePermissionPageScheme struct { - Results []*SpacePermissionsV2Scheme `json:"results,omitempty"` - Links *SpacePermissionPageLinkScheme `json:"_links,omitempty"` + Results []*SpacePermissionsV2Scheme `json:"results,omitempty"` // The space permissions in the page. + Links *SpacePermissionPageLinkScheme `json:"_links,omitempty"` // The links of the page. } +// SpacePermissionsV2Scheme represents a version 2 space permission in Confluence. type SpacePermissionsV2Scheme struct { - ID string `json:"id"` - Principal *SpacePermissionsPrincipalScheme `json:"principal"` - Operation *SpacePermissionsOperationScheme `json:"operation"` + ID string `json:"id"` // The ID of the space permission. + Principal *SpacePermissionsPrincipalScheme `json:"principal,omitempty"` // The principal of the space permission. + Operation *SpacePermissionsOperationScheme `json:"operation,omitempty"` // The operation of the space permission. } +// SpacePermissionsPrincipalScheme represents a principal in a space permission in Confluence. type SpacePermissionsPrincipalScheme struct { - Type string `json:"type,omitempty"` - ID string `json:"id,omitempty"` + Type string `json:"type,omitempty"` // The type of the principal. + ID string `json:"id,omitempty"` // The ID of the principal. } +// SpacePermissionsOperationScheme represents an operation in a space permission in Confluence. type SpacePermissionsOperationScheme struct { - Key string `json:"key,omitempty"` - TargetType string `json:"targetType,omitempty"` + Key string `json:"key,omitempty"` // The key of the operation. + TargetType string `json:"targetType,omitempty"` // The target type of the operation. } +// SpacePermissionPageLinkScheme represents the links of a page of space permissions in Confluence. type SpacePermissionPageLinkScheme struct { - Next string `json:"next,omitempty"` + Next string `json:"next,omitempty"` // The link to the next page of space permissions. } diff --git a/pkg/infra/models/const.go b/pkg/infra/models/const.go index dee6b737..50d00f56 100644 --- a/pkg/infra/models/const.go +++ b/pkg/infra/models/const.go @@ -1,5 +1,7 @@ package models +// DateFormatJira is a constant that defines the date format used in Jira. +// The format is "2006-01-02T15:04:05.999-0700". const ( DateFormatJira = "2006-01-02T15:04:05.999-0700" ) diff --git a/pkg/infra/models/jira_announcement_banner.go b/pkg/infra/models/jira_announcement_banner.go index b2dedf4c..3034c9b1 100644 --- a/pkg/infra/models/jira_announcement_banner.go +++ b/pkg/infra/models/jira_announcement_banner.go @@ -1,16 +1,18 @@ package models +// AnnouncementBannerScheme represents an announcement banner in Jira. type AnnouncementBannerScheme struct { - HashId string `json:"hashId,omitempty"` - IsDismissible bool `json:"isDismissible,omitempty"` - IsEnabled bool `json:"isEnabled,omitempty"` - Message string `json:"message,omitempty"` - Visibility string `json:"visibility,omitempty"` + HashId string `json:"hashId,omitempty"` // The hash ID of the banner. + IsDismissible bool `json:"isDismissible,omitempty"` // Indicates if the banner is dismissible. + IsEnabled bool `json:"isEnabled,omitempty"` // Indicates if the banner is enabled. + Message string `json:"message,omitempty"` // The message of the banner. + Visibility string `json:"visibility,omitempty"` // The visibility of the banner. } +// AnnouncementBannerPayloadScheme represents the payload for an announcement banner in Jira. type AnnouncementBannerPayloadScheme struct { - IsDismissible bool `json:"isDismissible,omitempty"` - IsEnabled bool `json:"isEnabled,omitempty"` - Message string `json:"message,omitempty"` - Visibility string `json:"visibility,omitempty"` + IsDismissible bool `json:"isDismissible,omitempty"` // Indicates if the banner is dismissible. + IsEnabled bool `json:"isEnabled,omitempty"` // Indicates if the banner is enabled. + Message string `json:"message,omitempty"` // The message of the banner. + Visibility string `json:"visibility,omitempty"` // The visibility of the banner. } diff --git a/pkg/infra/models/jira_applicationRole.go b/pkg/infra/models/jira_applicationRole.go index 74075b5a..2cfe58ae 100644 --- a/pkg/infra/models/jira_applicationRole.go +++ b/pkg/infra/models/jira_applicationRole.go @@ -1,16 +1,17 @@ package models +// ApplicationRoleScheme represents an application role in Jira. type ApplicationRoleScheme struct { - Key string `json:"key,omitempty"` - Groups []string `json:"groups,omitempty"` - Name string `json:"name,omitempty"` - DefaultGroups []string `json:"defaultGroups,omitempty"` - SelectedByDefault bool `json:"selectedByDefault,omitempty"` - Defined bool `json:"defined,omitempty"` - NumberOfSeats int `json:"numberOfSeats,omitempty"` - RemainingSeats int `json:"remainingSeats,omitempty"` - UserCount int `json:"userCount,omitempty"` - UserCountDescription string `json:"userCountDescription,omitempty"` - HasUnlimitedSeats bool `json:"hasUnlimitedSeats,omitempty"` - Platform bool `json:"platform,omitempty"` + Key string `json:"key,omitempty"` // The key of the application role. + Groups []string `json:"groups,omitempty"` // The groups associated with the application role. + Name string `json:"name,omitempty"` // The name of the application role. + DefaultGroups []string `json:"defaultGroups,omitempty"` // The default groups of the application role. + SelectedByDefault bool `json:"selectedByDefault,omitempty"` // Indicates if the application role is selected by default. + Defined bool `json:"defined,omitempty"` // Indicates if the application role is defined. + NumberOfSeats int `json:"numberOfSeats,omitempty"` // The number of seats for the application role. + RemainingSeats int `json:"remainingSeats,omitempty"` // The remaining seats for the application role. + UserCount int `json:"userCount,omitempty"` // The user count for the application role. + UserCountDescription string `json:"userCountDescription,omitempty"` // The user count description for the application role. + HasUnlimitedSeats bool `json:"hasUnlimitedSeats,omitempty"` // Indicates if the application role has unlimited seats. + Platform bool `json:"platform,omitempty"` // Indicates if the application role is a platform role. } diff --git a/pkg/infra/models/jira_audit.go b/pkg/infra/models/jira_audit.go index 4f0d937f..9b2724d2 100644 --- a/pkg/infra/models/jira_audit.go +++ b/pkg/infra/models/jira_audit.go @@ -2,51 +2,57 @@ package models import "time" +// AuditRecordPageScheme represents a page of audit records in Jira. type AuditRecordPageScheme struct { - Offset int `json:"offset,omitempty"` - Limit int `json:"limit,omitempty"` - Total int `json:"total,omitempty"` - Records []*AuditRecordScheme `json:"records,omitempty"` + Offset int `json:"offset,omitempty"` // The offset of the page. + Limit int `json:"limit,omitempty"` // The limit of the page. + Total int `json:"total,omitempty"` // The total number of audit records. + Records []*AuditRecordScheme `json:"records,omitempty"` // The audit records in the page. } +// AuditRecordScheme represents an audit record in Jira. type AuditRecordScheme struct { - ID int `json:"id,omitempty"` - Summary string `json:"summary,omitempty"` - RemoteAddress string `json:"remoteAddress,omitempty"` - AuthorKey string `json:"authorKey,omitempty"` - Created string `json:"created,omitempty"` - Category string `json:"category,omitempty"` - EventSource string `json:"eventSource,omitempty"` - Description string `json:"description,omitempty"` - ObjectItem *AuditRecordObjectItemScheme `json:"objectItem,omitempty"` - ChangedValues []*AuditRecordChangedValueScheme `json:"changedValues,omitempty"` - AssociatedItems []*AuditRecordAssociatedItemScheme `json:"associatedItems,omitempty"` + ID int `json:"id,omitempty"` // The ID of the audit record. + Summary string `json:"summary,omitempty"` // The summary of the audit record. + RemoteAddress string `json:"remoteAddress,omitempty"` // The remote address of the audit record. + AuthorKey string `json:"authorKey,omitempty"` // The author key of the audit record. + Created string `json:"created,omitempty"` // The creation time of the audit record. + Category string `json:"category,omitempty"` // The category of the audit record. + EventSource string `json:"eventSource,omitempty"` // The event source of the audit record. + Description string `json:"description,omitempty"` // The description of the audit record. + ObjectItem *AuditRecordObjectItemScheme `json:"objectItem,omitempty"` // The object item of the audit record. + ChangedValues []*AuditRecordChangedValueScheme `json:"changedValues,omitempty"` // The changed values of the audit record. + AssociatedItems []*AuditRecordAssociatedItemScheme `json:"associatedItems,omitempty"` // The associated items of the audit record. } +// AuditRecordObjectItemScheme represents an object item in an audit record in Jira. type AuditRecordObjectItemScheme struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - TypeName string `json:"typeName,omitempty"` - ParentID string `json:"parentId,omitempty"` - ParentName string `json:"parentName,omitempty"` + ID string `json:"id,omitempty"` // The ID of the object item. + Name string `json:"name,omitempty"` // The name of the object item. + TypeName string `json:"typeName,omitempty"` // The type name of the object item. + ParentID string `json:"parentId,omitempty"` // The parent ID of the object item. + ParentName string `json:"parentName,omitempty"` // The parent name of the object item. } +// AuditRecordChangedValueScheme represents a changed value in an audit record in Jira. type AuditRecordChangedValueScheme struct { - FieldName string `json:"fieldName,omitempty"` - ChangedFrom string `json:"changedFrom,omitempty"` - ChangedTo string `json:"changedTo,omitempty"` + FieldName string `json:"fieldName,omitempty"` // The field name of the changed value. + ChangedFrom string `json:"changedFrom,omitempty"` // The previous value of the changed field. + ChangedTo string `json:"changedTo,omitempty"` // The new value of the changed field. } +// AuditRecordAssociatedItemScheme represents an associated item in an audit record in Jira. type AuditRecordAssociatedItemScheme struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - TypeName string `json:"typeName,omitempty"` - ParentID string `json:"parentId,omitempty"` - ParentName string `json:"parentName,omitempty"` + ID string `json:"id,omitempty"` // The ID of the associated item. + Name string `json:"name,omitempty"` // The name of the associated item. + TypeName string `json:"typeName,omitempty"` // The type name of the associated item. + ParentID string `json:"parentId,omitempty"` // The parent ID of the associated item. + ParentName string `json:"parentName,omitempty"` // The parent name of the associated item. } +// AuditRecordGetOptions represents the options for getting audit records in Jira. type AuditRecordGetOptions struct { - Filter string - From time.Time - To time.Time + Filter string // The filter for the audit records. + From time.Time // The start time for the audit records. + To time.Time // The end time for the audit records. } diff --git a/pkg/infra/models/jira_avatar.go b/pkg/infra/models/jira_avatar.go index d082e376..1b49db12 100644 --- a/pkg/infra/models/jira_avatar.go +++ b/pkg/infra/models/jira_avatar.go @@ -1,8 +1,9 @@ package models +// AvatarURLScheme represents the URLs for different sizes of an avatar in Jira. type AvatarURLScheme struct { - Four8X48 string `json:"48x48,omitempty"` - Two4X24 string `json:"24x24,omitempty"` - One6X16 string `json:"16x16,omitempty"` - Three2X32 string `json:"32x32,omitempty"` + Four8X48 string `json:"48x48,omitempty"` // The URL for the 48x48 size of the avatar. + Two4X24 string `json:"24x24,omitempty"` // The URL for the 24x24 size of the avatar. + One6X16 string `json:"16x16,omitempty"` // The URL for the 16x16 size of the avatar. + Three2X32 string `json:"32x32,omitempty"` // The URL for the 32x32 size of the avatar. } diff --git a/pkg/infra/models/jira_changelog.go b/pkg/infra/models/jira_changelog.go index 971115e5..95a36e5c 100644 --- a/pkg/infra/models/jira_changelog.go +++ b/pkg/infra/models/jira_changelog.go @@ -1,36 +1,40 @@ package models +// IssueChangelogScheme represents the changelog of an issue in Jira. type IssueChangelogScheme struct { - StartAt int `json:"startAt,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - Total int `json:"total,omitempty"` - Histories []*IssueChangelogHistoryScheme `json:"histories,omitempty"` + StartAt int `json:"startAt,omitempty"` // The starting index of the changelog. + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results in the changelog. + Total int `json:"total,omitempty"` // The total number of changes in the changelog. + Histories []*IssueChangelogHistoryScheme `json:"histories,omitempty"` // The history of changes in the changelog. } +// IssueChangelogHistoryScheme represents a history of changes in an issue's changelog in Jira. type IssueChangelogHistoryScheme struct { - ID string `json:"id,omitempty"` - Author *IssueChangelogAuthor `json:"author,omitempty"` - Created string `json:"created,omitempty"` - Items []*IssueChangelogHistoryItemScheme `json:"items,omitempty"` + ID string `json:"id,omitempty"` // The ID of the history. + Author *IssueChangelogAuthor `json:"author,omitempty"` // The author of the history. + Created string `json:"created,omitempty"` // The creation time of the history. + Items []*IssueChangelogHistoryItemScheme `json:"items,omitempty"` // The items in the history. } +// IssueChangelogAuthor represents the author of a history in an issue's changelog in Jira. type IssueChangelogAuthor struct { - Self string `json:"self,omitempty"` - AccountID string `json:"accountId,omitempty"` - EmailAddress string `json:"emailAddress,omitempty"` - AvatarUrls *AvatarURLScheme `json:"avatarUrls,omitempty"` - DisplayName string `json:"displayName,omitempty"` - Active bool `json:"active,omitempty"` - TimeZone string `json:"timeZone,omitempty"` - AccountType string `json:"accountType,omitempty"` + Self string `json:"self,omitempty"` // The URL of the author's profile. + AccountID string `json:"accountId,omitempty"` // The account ID of the author. + EmailAddress string `json:"emailAddress,omitempty"` // The email address of the author. + AvatarUrls *AvatarURLScheme `json:"avatarUrls,omitempty"` // The URLs for different sizes of the author's avatar. + DisplayName string `json:"displayName,omitempty"` // The display name of the author. + Active bool `json:"active,omitempty"` // Indicates if the author's account is active. + TimeZone string `json:"timeZone,omitempty"` // The time zone of the author. + AccountType string `json:"accountType,omitempty"` // The type of the author's account. } +// IssueChangelogHistoryItemScheme represents an item in a history of an issue's changelog in Jira. type IssueChangelogHistoryItemScheme struct { - Field string `json:"field,omitempty"` - Fieldtype string `json:"fieldtype,omitempty"` - FieldID string `json:"fieldId,omitempty"` - From string `json:"from,omitempty"` - FromString string `json:"fromString,omitempty"` - To string `json:"to,omitempty"` - ToString string `json:"toString,omitempty"` + Field string `json:"field,omitempty"` // The field of the item. + Fieldtype string `json:"fieldtype,omitempty"` // The type of the field. + FieldID string `json:"fieldId,omitempty"` // The ID of the field. + From string `json:"from,omitempty"` // The previous value of the field. + FromString string `json:"fromString,omitempty"` // The previous value of the field as a string. + To string `json:"to,omitempty"` // The new value of the field. + ToString string `json:"toString,omitempty"` // The new value of the field as a string. } diff --git a/pkg/infra/models/jira_comment_v2.go b/pkg/infra/models/jira_comment_v2.go index 71d5ff33..6d3f9e9e 100644 --- a/pkg/infra/models/jira_comment_v2.go +++ b/pkg/infra/models/jira_comment_v2.go @@ -1,26 +1,29 @@ package models +// IssueCommentPageSchemeV2 represents a page of issue comments in Jira. type IssueCommentPageSchemeV2 struct { - StartAt int `json:"startAt,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - Total int `json:"total,omitempty"` - Comments []*IssueCommentSchemeV2 `json:"comments,omitempty"` + StartAt int `json:"startAt,omitempty"` // The starting index of the page. + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results in the page. + Total int `json:"total,omitempty"` // The total number of comments. + Comments []*IssueCommentSchemeV2 `json:"comments,omitempty"` // The comments in the page. } +// IssueCommentSchemeV2 represents an issue comment in Jira. type IssueCommentSchemeV2 struct { - Self string `json:"self,omitempty"` - ID string `json:"id,omitempty"` - Body string `json:"body,omitempty"` - RenderedBody string `json:"renderedBody,omitempty"` - Author *UserScheme `json:"author,omitempty"` - JSDPublic bool `json:"jsdPublic,omitempty"` - UpdateAuthor *UserScheme `json:"updateAuthor,omitempty"` - Created string `json:"created,omitempty"` - Updated string `json:"updated,omitempty"` - Visibility *CommentVisibilityScheme `json:"visibility,omitempty"` + Self string `json:"self,omitempty"` // The URL of the comment. + ID string `json:"id,omitempty"` // The ID of the comment. + Body string `json:"body,omitempty"` // The body of the comment. + RenderedBody string `json:"renderedBody,omitempty"` // The rendered body of the comment. + Author *UserScheme `json:"author,omitempty"` // The author of the comment. + JSDPublic bool `json:"jsdPublic,omitempty"` // Indicates if the comment is public in Jira Service Desk. + UpdateAuthor *UserScheme `json:"updateAuthor,omitempty"` // The user who last updated the comment. + Created string `json:"created,omitempty"` // The creation time of the comment. + Updated string `json:"updated,omitempty"` // The last update time of the comment. + Visibility *CommentVisibilityScheme `json:"visibility,omitempty"` // The visibility of the comment. } +// CommentPayloadSchemeV2 represents the payload for an issue comment in Jira. type CommentPayloadSchemeV2 struct { - Visibility *CommentVisibilityScheme `json:"visibility,omitempty"` - Body string `json:"body,omitempty"` + Visibility *CommentVisibilityScheme `json:"visibility,omitempty"` // The visibility of the comment. + Body string `json:"body,omitempty"` // The body of the comment. } diff --git a/pkg/infra/models/jira_component.go b/pkg/infra/models/jira_component.go index bab0fc5e..ded8f57b 100644 --- a/pkg/infra/models/jira_component.go +++ b/pkg/infra/models/jira_component.go @@ -1,31 +1,34 @@ package models +// ComponentPayloadScheme represents the payload for a component in Jira. type ComponentPayloadScheme struct { - IsAssigneeTypeValid bool `json:"isAssigneeTypeValid,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - Project string `json:"project,omitempty"` - AssigneeType string `json:"assigneeType,omitempty"` - LeadAccountID string `json:"leadAccountId,omitempty"` + IsAssigneeTypeValid bool `json:"isAssigneeTypeValid,omitempty"` // Indicates if the assignee type is valid. + Name string `json:"name,omitempty"` // The name of the component. + Description string `json:"description,omitempty"` // The description of the component. + Project string `json:"project,omitempty"` // The project to which the component belongs. + AssigneeType string `json:"assigneeType,omitempty"` // The type of the assignee. + LeadAccountID string `json:"leadAccountId,omitempty"` // The account ID of the lead. } +// ComponentScheme represents a component in Jira. type ComponentScheme struct { - Self string `json:"self,omitempty"` - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - Lead *UserScheme `json:"lead,omitempty"` - LeadUserName string `json:"leadUserName,omitempty"` - AssigneeType string `json:"assigneeType,omitempty"` - Assignee *UserScheme `json:"assignee,omitempty"` - RealAssigneeType string `json:"realAssigneeType,omitempty"` - RealAssignee *UserScheme `json:"realAssignee,omitempty"` - IsAssigneeTypeValid bool `json:"isAssigneeTypeValid,omitempty"` - Project string `json:"project,omitempty"` - ProjectID int `json:"projectId,omitempty"` + Self string `json:"self,omitempty"` // The URL of the component. + ID string `json:"id,omitempty"` // The ID of the component. + Name string `json:"name,omitempty"` // The name of the component. + Description string `json:"description,omitempty"` // The description of the component. + Lead *UserScheme `json:"lead,omitempty"` // The lead of the component. + LeadUserName string `json:"leadUserName,omitempty"` // The username of the lead. + AssigneeType string `json:"assigneeType,omitempty"` // The type of the assignee. + Assignee *UserScheme `json:"assignee,omitempty"` // The assignee of the component. + RealAssigneeType string `json:"realAssigneeType,omitempty"` // The real type of the assignee. + RealAssignee *UserScheme `json:"realAssignee,omitempty"` // The real assignee of the component. + IsAssigneeTypeValid bool `json:"isAssigneeTypeValid,omitempty"` // Indicates if the assignee type is valid. + Project string `json:"project,omitempty"` // The project to which the component belongs. + ProjectID int `json:"projectId,omitempty"` // The ID of the project to which the component belongs. } +// ComponentCountScheme represents the count of components in Jira. type ComponentCountScheme struct { - Self string `json:"self,omitempty"` - IssueCount int `json:"issueCount,omitempty"` + Self string `json:"self,omitempty"` // The URL of the component count. + IssueCount int `json:"issueCount,omitempty"` // The count of issues in the component. } diff --git a/pkg/infra/models/jira_dashboard.go b/pkg/infra/models/jira_dashboard.go index b3e0ee39..0716b6d9 100644 --- a/pkg/infra/models/jira_dashboard.go +++ b/pkg/infra/models/jira_dashboard.go @@ -1,54 +1,60 @@ package models +// DashboardPageScheme represents a page of dashboards in Jira. type DashboardPageScheme struct { - StartAt int `json:"startAt,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - Total int `json:"total,omitempty"` - Dashboards []*DashboardScheme `json:"dashboards,omitempty"` + StartAt int `json:"startAt,omitempty"` // The starting index of the page. + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results in the page. + Total int `json:"total,omitempty"` // The total number of dashboards. + Dashboards []*DashboardScheme `json:"dashboards,omitempty"` // The dashboards in the page. } +// DashboardScheme represents a dashboard in Jira. type DashboardScheme struct { - ID string `json:"id,omitempty"` - IsFavourite bool `json:"isFavourite,omitempty"` - Name string `json:"name,omitempty"` - Owner *UserScheme `json:"owner,omitempty"` - Popularity int `json:"popularity,omitempty"` - Rank int `json:"rank,omitempty"` - Self string `json:"self,omitempty"` - SharePermissions []*SharePermissionScheme `json:"sharePermissions,omitempty"` - EditPermission []*SharePermissionScheme `json:"editPermissions,omitempty"` - View string `json:"view,omitempty"` + ID string `json:"id,omitempty"` // The ID of the dashboard. + IsFavourite bool `json:"isFavourite,omitempty"` // Indicates if the dashboard is a favourite. + Name string `json:"name,omitempty"` // The name of the dashboard. + Owner *UserScheme `json:"owner,omitempty"` // The owner of the dashboard. + Popularity int `json:"popularity,omitempty"` // The popularity of the dashboard. + Rank int `json:"rank,omitempty"` // The rank of the dashboard. + Self string `json:"self,omitempty"` // The URL of the dashboard. + SharePermissions []*SharePermissionScheme `json:"sharePermissions,omitempty"` // The share permissions of the dashboard. + EditPermission []*SharePermissionScheme `json:"editPermissions,omitempty"` // The edit permissions of the dashboard. + View string `json:"view,omitempty"` // The view of the dashboard. } +// SharePermissionScheme represents a share permission in Jira. type SharePermissionScheme struct { - ID int `json:"id,omitempty"` - Type string `json:"type,omitempty"` - Project *ProjectScheme `json:"project,omitempty"` - Role *ProjectRoleScheme `json:"role,omitempty"` - Group *GroupScheme `json:"group,omitempty"` - User *UserDetailScheme `json:"user,omitempty"` + ID int `json:"id,omitempty"` // The ID of the share permission. + Type string `json:"type,omitempty"` // The type of the share permission. + Project *ProjectScheme `json:"project,omitempty"` // The project of the share permission. + Role *ProjectRoleScheme `json:"role,omitempty"` // The role of the share permission. + Group *GroupScheme `json:"group,omitempty"` // The group of the share permission. + User *UserDetailScheme `json:"user,omitempty"` // The user of the share permission. } +// DashboardSearchPageScheme represents a search page of dashboards in Jira. type DashboardSearchPageScheme struct { - Self string `json:"self,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*DashboardScheme `json:"values,omitempty"` + Self string `json:"self,omitempty"` // The URL of the search page. + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results in the search page. + StartAt int `json:"startAt,omitempty"` // The starting index of the search page. + Total int `json:"total,omitempty"` // The total number of dashboards in the search page. + IsLast bool `json:"isLast,omitempty"` // Indicates if the search page is the last one. + Values []*DashboardScheme `json:"values,omitempty"` // The dashboards in the search page. } +// DashboardPayloadScheme represents the payload for a dashboard in Jira. type DashboardPayloadScheme struct { - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - SharePermissions []*SharePermissionScheme `json:"sharePermissions,omitempty"` - EditPermissions []*SharePermissionScheme `json:"editPermissions,omitempty"` + Name string `json:"name,omitempty"` // The name of the dashboard. + Description string `json:"description,omitempty"` // The description of the dashboard. + SharePermissions []*SharePermissionScheme `json:"sharePermissions,omitempty"` // The share permissions of the dashboard. + EditPermissions []*SharePermissionScheme `json:"editPermissions,omitempty"` // The edit permissions of the dashboard. } +// DashboardSearchOptionsScheme represents the search options for a dashboard in Jira. type DashboardSearchOptionsScheme struct { - DashboardName string - OwnerAccountID string - GroupPermissionName string - OrderBy string - Expand []string + DashboardName string // The name of the dashboard. + OwnerAccountID string // The account ID of the owner of the dashboard. + GroupPermissionName string // The name of the group permission of the dashboard. + OrderBy string // The order by criteria of the dashboard. + Expand []string // The fields to be expanded in the dashboard. } diff --git a/pkg/infra/models/jira_field.go b/pkg/infra/models/jira_field.go index 5f10aca3..b073bc6f 100644 --- a/pkg/infra/models/jira_field.go +++ b/pkg/infra/models/jira_field.go @@ -1,5 +1,6 @@ package models +// IssueFieldScheme represents an issue field in Jira. type IssueFieldScheme struct { ID string `json:"id,omitempty"` Key string `json:"key,omitempty"` @@ -19,6 +20,7 @@ type IssueFieldScheme struct { LastUsed *IssueFieldLastUsedScheme `json:"lastUsed,omitempty"` } +// IssueFieldSchemaScheme represents the schema of an issue field in Jira. type IssueFieldSchemaScheme struct { Type string `json:"type,omitempty"` Items string `json:"items,omitempty"` @@ -27,11 +29,13 @@ type IssueFieldSchemaScheme struct { CustomID int `json:"customId,omitempty"` } +// IssueFieldLastUsedScheme represents the last used information of an issue field in Jira. type IssueFieldLastUsedScheme struct { Type string `json:"type,omitempty"` Value string `json:"value,omitempty"` } +// FieldSearchPageScheme represents a search page of fields in Jira. type FieldSearchPageScheme struct { MaxResults int `json:"maxResults,omitempty"` StartAt int `json:"startAt,omitempty"` @@ -40,6 +44,7 @@ type FieldSearchPageScheme struct { Values []*IssueFieldScheme `json:"values,omitempty"` } +// FieldSearchOptionsScheme represents the search options for a field in Jira. type FieldSearchOptionsScheme struct { Types []string IDs []string @@ -48,6 +53,7 @@ type FieldSearchOptionsScheme struct { Expand []string } +// CustomFieldScheme represents a custom field in Jira. type CustomFieldScheme struct { Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` diff --git a/pkg/infra/models/jira_field_configuration.go b/pkg/infra/models/jira_field_configuration.go index 54d64e60..86eac5ea 100644 --- a/pkg/infra/models/jira_field_configuration.go +++ b/pkg/infra/models/jira_field_configuration.go @@ -1,36 +1,41 @@ package models +// FieldConfigurationPageScheme represents a page of field configurations in Jira. type FieldConfigurationPageScheme struct { - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*FieldConfigurationScheme `json:"values,omitempty"` + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results in the page. + StartAt int `json:"startAt,omitempty"` // The starting index of the page. + Total int `json:"total,omitempty"` // The total number of field configurations. + IsLast bool `json:"isLast,omitempty"` // Indicates if the page is the last one. + Values []*FieldConfigurationScheme `json:"values,omitempty"` // The field configurations in the page. } +// FieldConfigurationScheme represents a field configuration in Jira. type FieldConfigurationScheme struct { - ID int `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - IsDefault bool `json:"isDefault,omitempty"` + ID int `json:"id,omitempty"` // The ID of the field configuration. + Name string `json:"name,omitempty"` // The name of the field configuration. + Description string `json:"description,omitempty"` // The description of the field configuration. + IsDefault bool `json:"isDefault,omitempty"` // Indicates if the field configuration is the default one. } +// FieldConfigurationItemPageScheme represents a page of field configuration items in Jira. type FieldConfigurationItemPageScheme struct { - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*FieldConfigurationItemScheme `json:"values,omitempty"` + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results in the page. + StartAt int `json:"startAt,omitempty"` // The starting index of the page. + Total int `json:"total,omitempty"` // The total number of field configuration items. + IsLast bool `json:"isLast,omitempty"` // Indicates if the page is the last one. + Values []*FieldConfigurationItemScheme `json:"values,omitempty"` // The field configuration items in the page. } +// UpdateFieldConfigurationItemPayloadScheme represents the payload for updating a field configuration item in Jira. type UpdateFieldConfigurationItemPayloadScheme struct { - FieldConfigurationItems []*FieldConfigurationItemScheme `json:"fieldConfigurationItems"` + FieldConfigurationItems []*FieldConfigurationItemScheme `json:"fieldConfigurationItems"` // The field configuration items to be updated. } +// FieldConfigurationItemScheme represents a field configuration item in Jira. type FieldConfigurationItemScheme struct { - ID string `json:"id,omitempty"` - IsHidden bool `json:"isHidden,omitempty"` - IsRequired bool `json:"isRequired,omitempty"` - Description string `json:"description,omitempty"` - Renderer string `json:"renderer,omitempty"` + ID string `json:"id,omitempty"` // The ID of the field configuration item. + IsHidden bool `json:"isHidden,omitempty"` // Indicates if the field configuration item is hidden. + IsRequired bool `json:"isRequired,omitempty"` // Indicates if the field configuration item is required. + Description string `json:"description,omitempty"` // The description of the field configuration item. + Renderer string `json:"renderer,omitempty"` // The renderer of the field configuration item. } diff --git a/pkg/infra/models/jira_field_configuration_scheme.go b/pkg/infra/models/jira_field_configuration_scheme.go index 08f96130..28b82f6f 100644 --- a/pkg/infra/models/jira_field_configuration_scheme.go +++ b/pkg/infra/models/jira_field_configuration_scheme.go @@ -1,56 +1,65 @@ package models +// FieldConfigurationSchemePageScheme represents a page of field configurations in Jira. type FieldConfigurationSchemePageScheme struct { - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*FieldConfigurationSchemeScheme `json:"values,omitempty"` + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results in the page. + StartAt int `json:"startAt,omitempty"` // The starting index of the page. + Total int `json:"total,omitempty"` // The total number of field configurations. + IsLast bool `json:"isLast,omitempty"` // Indicates if the page is the last one. + Values []*FieldConfigurationSchemeScheme `json:"values,omitempty"` // The field configurations in the page. } +// FieldConfigurationSchemeScheme represents a field configuration in Jira. type FieldConfigurationSchemeScheme struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` + ID string `json:"id,omitempty"` // The ID of the field configuration. + Name string `json:"name,omitempty"` // The name of the field configuration. + Description string `json:"description,omitempty"` // The description of the field configuration. } +// FieldConfigurationIssueTypeItemPageScheme represents a page of field configuration items in Jira. type FieldConfigurationIssueTypeItemPageScheme struct { - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*FieldConfigurationIssueTypeItemScheme `json:"values,omitempty"` + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results in the page. + StartAt int `json:"startAt,omitempty"` // The starting index of the page. + Total int `json:"total,omitempty"` // The total number of field configuration items. + IsLast bool `json:"isLast,omitempty"` // Indicates if the page is the last one. + Values []*FieldConfigurationIssueTypeItemScheme `json:"values,omitempty"` // The field configuration items in the page. } +// FieldConfigurationIssueTypeItemScheme represents a field configuration item in Jira. type FieldConfigurationIssueTypeItemScheme struct { - FieldConfigurationSchemeID string `json:"fieldConfigurationSchemeId,omitempty"` - IssueTypeID string `json:"issueTypeId,omitempty"` - FieldConfigurationID string `json:"fieldConfigurationId,omitempty"` + FieldConfigurationSchemeID string `json:"fieldConfigurationSchemeId,omitempty"` // The ID of the field configuration scheme. + IssueTypeID string `json:"issueTypeId,omitempty"` // The ID of the issue type. + FieldConfigurationID string `json:"fieldConfigurationId,omitempty"` // The ID of the field configuration. } +// FieldConfigurationSchemeProjectPageScheme represents a page of field configuration scheme projects in Jira. type FieldConfigurationSchemeProjectPageScheme struct { - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*FieldConfigurationSchemeProjectScheme `json:"values,omitempty"` + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results in the page. + StartAt int `json:"startAt,omitempty"` // The starting index of the page. + Total int `json:"total,omitempty"` // The total number of field configuration scheme projects. + IsLast bool `json:"isLast,omitempty"` // Indicates if the page is the last one. + Values []*FieldConfigurationSchemeProjectScheme `json:"values,omitempty"` // The field configuration scheme projects in the page. } +// FieldConfigurationSchemeProjectScheme represents a field configuration scheme project in Jira. type FieldConfigurationSchemeProjectScheme struct { - ProjectIds []string `json:"projectIds,omitempty"` - FieldConfigurationScheme *FieldConfigurationSchemeScheme `json:"fieldConfigurationScheme,omitempty"` + ProjectIds []string `json:"projectIds,omitempty"` // The IDs of the projects. + FieldConfigurationScheme *FieldConfigurationSchemeScheme `json:"fieldConfigurationScheme,omitempty"` // The field configuration scheme. } +// FieldConfigurationSchemeAssignPayload represents the payload for assigning a field configuration scheme in Jira. type FieldConfigurationSchemeAssignPayload struct { - FieldConfigurationSchemeID string `json:"fieldConfigurationSchemeId"` - ProjectID string `json:"projectId"` + FieldConfigurationSchemeID string `json:"fieldConfigurationSchemeId"` // The ID of the field configuration scheme. + ProjectID string `json:"projectId"` // The ID of the project. } +// FieldConfigurationToIssueTypeMappingPayloadScheme represents the payload for mapping a field configuration to an issue type in Jira. type FieldConfigurationToIssueTypeMappingPayloadScheme struct { - Mappings []*FieldConfigurationToIssueTypeMappingScheme `json:"mappings,omitempty"` + Mappings []*FieldConfigurationToIssueTypeMappingScheme `json:"mappings,omitempty"` // The mappings. } +// FieldConfigurationToIssueTypeMappingScheme represents a mapping of a field configuration to an issue type in Jira. type FieldConfigurationToIssueTypeMappingScheme struct { - IssueTypeID string `json:"issueTypeId,omitempty"` - FieldConfigurationID string `json:"fieldConfigurationId,omitempty"` + IssueTypeID string `json:"issueTypeId,omitempty"` // The ID of the issue type. + FieldConfigurationID string `json:"fieldConfigurationId,omitempty"` // The ID of the field configuration. } diff --git a/pkg/infra/models/jira_field_context.go b/pkg/infra/models/jira_field_context.go index 3a8a15a5..18536180 100644 --- a/pkg/infra/models/jira_field_context.go +++ b/pkg/infra/models/jira_field_context.go @@ -1,82 +1,93 @@ package models +// FieldContextOptionsScheme represents the options for a field context in Jira. type FieldContextOptionsScheme struct { - IsAnyIssueType bool - IsGlobalContext bool - ContextID []int + IsAnyIssueType bool // Indicates if any issue type is applicable. + IsGlobalContext bool // Indicates if the context is global. + ContextID []int // The IDs of the contexts. } +// CustomFieldContextPageScheme represents a page of custom field contexts in Jira. type CustomFieldContextPageScheme struct { - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*FieldContextScheme `json:"values,omitempty"` + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results in the page. + StartAt int `json:"startAt,omitempty"` // The starting index of the page. + Total int `json:"total,omitempty"` // The total number of custom field contexts. + IsLast bool `json:"isLast,omitempty"` // Indicates if the page is the last one. + Values []*FieldContextScheme `json:"values,omitempty"` // The custom field contexts in the page. } +// FieldContextScheme represents a field context in Jira. type FieldContextScheme struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - IsGlobalContext bool `json:"isGlobalContext,omitempty"` - IsAnyIssueType bool `json:"isAnyIssueType,omitempty"` - ProjectIds []string `json:"projectIds,omitempty"` - IssueTypeIds []string `json:"issueTypeIds,omitempty"` + ID string `json:"id,omitempty"` // The ID of the field context. + Name string `json:"name,omitempty"` // The name of the field context. + Description string `json:"description,omitempty"` // The description of the field context. + IsGlobalContext bool `json:"isGlobalContext,omitempty"` // Indicates if the context is global. + IsAnyIssueType bool `json:"isAnyIssueType,omitempty"` // Indicates if any issue type is applicable. + ProjectIds []string `json:"projectIds,omitempty"` // The IDs of the projects. + IssueTypeIds []string `json:"issueTypeIds,omitempty"` // The IDs of the issue types. } +// CustomFieldDefaultValuePageScheme represents a page of default values for custom fields in Jira. type CustomFieldDefaultValuePageScheme struct { - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*CustomFieldDefaultValueScheme `json:"values,omitempty"` + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results in the page. + StartAt int `json:"startAt,omitempty"` // The starting index of the page. + Total int `json:"total,omitempty"` // The total number of default values for custom fields. + IsLast bool `json:"isLast,omitempty"` // Indicates if the page is the last one. + Values []*CustomFieldDefaultValueScheme `json:"values,omitempty"` // The default values for custom fields in the page. } +// CustomFieldDefaultValueScheme represents a default value for a custom field in Jira. type CustomFieldDefaultValueScheme struct { - ContextID string `json:"contextId,omitempty"` - OptionID string `json:"optionId,omitempty"` - CascadingOptionID string `json:"cascadingOptionId,omitempty"` - OptionIDs []string `json:"optionIds,omitempty"` - Type string `json:"type,omitempty"` + ContextID string `json:"contextId,omitempty"` // The ID of the context. + OptionID string `json:"optionId,omitempty"` // The ID of the option. + CascadingOptionID string `json:"cascadingOptionId,omitempty"` // The ID of the cascading option. + OptionIDs []string `json:"optionIds,omitempty"` // The IDs of the options. + Type string `json:"type,omitempty"` // The type of the default value. } +// FieldContextDefaultPayloadScheme represents the payload for a default field context in Jira. type FieldContextDefaultPayloadScheme struct { - DefaultValues []*CustomFieldDefaultValueScheme `json:"defaultValues,omitempty"` + DefaultValues []*CustomFieldDefaultValueScheme `json:"defaultValues,omitempty"` // The default values for the field context. } +// IssueTypeToContextMappingPageScheme represents a page of issue type to context mappings in Jira. type IssueTypeToContextMappingPageScheme struct { - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*IssueTypeToContextMappingValueScheme `json:"values"` + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results in the page. + StartAt int `json:"startAt,omitempty"` // The starting index of the page. + Total int `json:"total,omitempty"` // The total number of issue type to context mappings. + IsLast bool `json:"isLast,omitempty"` // Indicates if the page is the last one. + Values []*IssueTypeToContextMappingValueScheme `json:"values"` // The issue type to context mappings in the page. } +// IssueTypeToContextMappingValueScheme represents an issue type to context mapping in Jira. type IssueTypeToContextMappingValueScheme struct { - ContextID string `json:"contextId"` - IsAnyIssueType bool `json:"isAnyIssueType,omitempty"` - IssueTypeID string `json:"issueTypeId,omitempty"` + ContextID string `json:"contextId"` // The ID of the context. + IsAnyIssueType bool `json:"isAnyIssueType,omitempty"` // Indicates if any issue type is applicable. + IssueTypeID string `json:"issueTypeId,omitempty"` // The ID of the issue type. } +// CustomFieldContextProjectMappingPageScheme represents a page of project mappings for custom field contexts in Jira. type CustomFieldContextProjectMappingPageScheme struct { - Self string `json:"self,omitempty"` - NextPage string `json:"nextPage,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*CustomFieldContextProjectMappingValueScheme `json:"values,omitempty"` + Self string `json:"self,omitempty"` // The URL of the page. + NextPage string `json:"nextPage,omitempty"` // The URL of the next page. + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results in the page. + StartAt int `json:"startAt,omitempty"` // The starting index of the page. + Total int `json:"total,omitempty"` // The total number of project mappings for custom field contexts. + IsLast bool `json:"isLast,omitempty"` // Indicates if the page is the last one. + Values []*CustomFieldContextProjectMappingValueScheme `json:"values,omitempty"` // The project mappings for custom field contexts in the page. } +// CustomFieldContextProjectMappingValueScheme represents a project mapping for a custom field context in Jira. type CustomFieldContextProjectMappingValueScheme struct { - ContextID string `json:"contextId,omitempty"` - ProjectID string `json:"projectId,omitempty"` - IsGlobalContext bool `json:"isGlobalContext,omitempty"` + ContextID string `json:"contextId,omitempty"` // The ID of the context. + ProjectID string `json:"projectId,omitempty"` // The ID of the project. + IsGlobalContext bool `json:"isGlobalContext,omitempty"` // Indicates if the context is global. } +// FieldContextPayloadScheme represents the payload for a field context in Jira. type FieldContextPayloadScheme struct { - IssueTypeIDs []int `json:"issueTypeIds,omitempty"` - ProjectIDs []int `json:"projectIds,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` + IssueTypeIDs []int `json:"issueTypeIds,omitempty"` // The IDs of the issue types. + ProjectIDs []int `json:"projectIds,omitempty"` // The IDs of the projects. + Name string `json:"name,omitempty"` // The name of the field context. + Description string `json:"description,omitempty"` // The description of the field context. } diff --git a/pkg/infra/models/jira_field_context_option.go b/pkg/infra/models/jira_field_context_option.go index 539e2309..673bdf44 100644 --- a/pkg/infra/models/jira_field_context_option.go +++ b/pkg/infra/models/jira_field_context_option.go @@ -1,52 +1,60 @@ package models +// CustomFieldAssetScheme represents a custom field asset in Jira. type CustomFieldAssetScheme struct { - WorkspaceId string `json:"workspaceId,omitempty"` - Id string `json:"id,omitempty"` - ObjectId string `json:"objectId,omitempty"` + WorkspaceId string `json:"workspaceId,omitempty"` // The ID of the workspace. + Id string `json:"id,omitempty"` // The ID of the custom field asset. + ObjectId string `json:"objectId,omitempty"` // The object ID of the custom field asset. } +// CustomFieldContextOptionPageScheme represents a page of custom field context options in Jira. type CustomFieldContextOptionPageScheme struct { - Self string `json:"self,omitempty"` - NextPage string `json:"nextPage,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*CustomFieldContextOptionScheme `json:"values,omitempty"` + Self string `json:"self,omitempty"` // The URL of the page. + NextPage string `json:"nextPage,omitempty"` // The URL of the next page. + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results in the page. + StartAt int `json:"startAt,omitempty"` // The starting index of the page. + Total int `json:"total,omitempty"` // The total number of custom field context options. + IsLast bool `json:"isLast,omitempty"` // Indicates if the page is the last one. + Values []*CustomFieldContextOptionScheme `json:"values,omitempty"` // The custom field context options in the page. } +// CustomFieldContextOptionScheme represents a custom field context option in Jira. type CustomFieldContextOptionScheme struct { - ID string `json:"id,omitempty"` - Value string `json:"value,omitempty"` - Disabled bool `json:"disabled"` - OptionID string `json:"optionId,omitempty"` + ID string `json:"id,omitempty"` // The ID of the custom field context option. + Value string `json:"value,omitempty"` // The value of the custom field context option. + Disabled bool `json:"disabled"` // Indicates if the custom field context option is disabled. + OptionID string `json:"optionId,omitempty"` // The ID of the option. } +// FieldContextOptionListScheme represents a list of field context options in Jira. type FieldContextOptionListScheme struct { - Options []*CustomFieldContextOptionScheme `json:"options,omitempty"` + Options []*CustomFieldContextOptionScheme `json:"options,omitempty"` // The field context options. } +// FieldOptionContextParams represents the parameters for a field option context in Jira. type FieldOptionContextParams struct { - OptionID int - OnlyOptions bool + OptionID int // The ID of the option. + OnlyOptions bool // Indicates if only options are applicable. } +// OrderFieldOptionPayloadScheme represents the payload for ordering a field option in Jira. type OrderFieldOptionPayloadScheme struct { - After string `json:"after,omitempty"` - Position string `json:"position,omitempty"` - CustomFieldOptionIds []string `json:"customFieldOptionIds,omitempty"` + After string `json:"after,omitempty"` // The ID of the option after which the current option should be placed. + Position string `json:"position,omitempty"` // The position of the option. + CustomFieldOptionIds []string `json:"customFieldOptionIds,omitempty"` // The IDs of the custom field options. } +// CascadingSelectScheme represents a cascading select in Jira. type CascadingSelectScheme struct { - Self string `json:"self,omitempty"` - Value string `json:"value,omitempty"` - Id string `json:"id,omitempty"` - Child *CascadingSelectChildScheme `json:"child,omitempty"` + Self string `json:"self,omitempty"` // The URL of the cascading select. + Value string `json:"value,omitempty"` // The value of the cascading select. + Id string `json:"id,omitempty"` // The ID of the cascading select. + Child *CascadingSelectChildScheme `json:"child,omitempty"` // The child of the cascading select. } +// CascadingSelectChildScheme represents a child of a cascading select in Jira. type CascadingSelectChildScheme struct { - Self string `json:"self,omitempty"` - Value string `json:"value,omitempty"` - Id string `json:"id,omitempty"` + Self string `json:"self,omitempty"` // The URL of the child. + Value string `json:"value,omitempty"` // The value of the child. + Id string `json:"id,omitempty"` // The ID of the child. } diff --git a/pkg/infra/models/jira_filter.go b/pkg/infra/models/jira_filter.go index e5df1471..fd883301 100644 --- a/pkg/infra/models/jira_filter.go +++ b/pkg/infra/models/jira_filter.go @@ -1,5 +1,6 @@ package models +// FilterPageScheme represents a page of filters in Jira. type FilterPageScheme struct { Self string `json:"self,omitempty"` MaxResults int `json:"maxResults,omitempty"` @@ -9,6 +10,7 @@ type FilterPageScheme struct { Values []*FilterScheme `json:"values,omitempty"` } +// FilterSearchPageScheme represents a page of filter details in Jira. type FilterSearchPageScheme struct { Self string `json:"self,omitempty"` MaxResults int `json:"maxResults,omitempty"` @@ -18,6 +20,7 @@ type FilterSearchPageScheme struct { Values []*FilterDetailScheme `json:"values,omitempty"` } +// FilterDetailScheme represents the details of a filter in Jira. type FilterDetailScheme struct { Self string `json:"self,omitempty"` ID string `json:"id,omitempty"` @@ -32,6 +35,7 @@ type FilterDetailScheme struct { Subscriptions []*FilterSubscriptionScheme `json:"subscriptions,omitempty"` } +// FilterScheme represents a filter in Jira. type FilterScheme struct { Self string `json:"self,omitempty"` ID string `json:"id,omitempty"` @@ -47,6 +51,7 @@ type FilterScheme struct { Subscriptions *FilterSubscriptionPageScheme `json:"subscriptions,omitempty"` } +// FilterSubscriptionPageScheme represents a page of filter subscriptions in Jira. type FilterSubscriptionPageScheme struct { Size int `json:"size,omitempty"` Items []*FilterSubscriptionScheme `json:"items,omitempty"` @@ -55,12 +60,14 @@ type FilterSubscriptionPageScheme struct { EndIndex int `json:"end-index,omitempty"` } +// FilterSubscriptionScheme represents a filter subscription in Jira. type FilterSubscriptionScheme struct { ID int `json:"id,omitempty"` User *UserScheme `json:"user,omitempty"` Group *GroupScheme `json:"group,omitempty"` } +// FilterUsersScheme represents the users of a filter in Jira. type FilterUsersScheme struct { Size int `json:"size,omitempty"` Items []*UserScheme `json:"items,omitempty"` @@ -69,6 +76,7 @@ type FilterUsersScheme struct { EndIndex int `json:"end-index,omitempty"` } +// FilterPayloadScheme represents the payload for a filter in Jira. type FilterPayloadScheme struct { Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` @@ -78,6 +86,7 @@ type FilterPayloadScheme struct { EditPermissions []*SharePermissionScheme `json:"editPermissions,omitempty"` } +// FilterSearchOptionScheme represents the search options for a filter in Jira. type FilterSearchOptionScheme struct { Name string AccountID string @@ -88,10 +97,12 @@ type FilterSearchOptionScheme struct { Expand []string } +// ShareFilterScopeScheme represents the scope of a shared filter in Jira. type ShareFilterScopeScheme struct { Scope string `json:"scope"` } +// PermissionFilterPayloadScheme represents the payload for a permission filter in Jira. type PermissionFilterPayloadScheme struct { Type string `json:"type,omitempty"` ProjectID string `json:"projectId,omitempty"` diff --git a/pkg/infra/models/jira_group.go b/pkg/infra/models/jira_group.go index 5f6a15b6..d3c0cb16 100644 --- a/pkg/infra/models/jira_group.go +++ b/pkg/infra/models/jira_group.go @@ -1,68 +1,77 @@ package models +// UserGroupsScheme represents a collection of user groups in Jira. type UserGroupsScheme struct { - Size int `json:"size,omitempty"` - Items []*UserGroupScheme `json:"items,omitempty"` - MaxResults int `json:"max-results,omitempty"` + Size int `json:"size,omitempty"` // The size of the collection. + Items []*UserGroupScheme `json:"items,omitempty"` // The user groups. + MaxResults int `json:"max-results,omitempty"` // The maximum number of results in the collection. } +// UserGroupScheme represents a user group in Jira. type UserGroupScheme struct { - Name string `json:"name,omitempty"` - Self string `json:"self,omitempty"` + Name string `json:"name,omitempty"` // The name of the user group. + Self string `json:"self,omitempty"` // The URL of the user group. } +// GroupScheme represents a group in Jira. type GroupScheme struct { - Name string `json:"name,omitempty"` - Self string `json:"self,omitempty"` - Users *GroupUserPageScheme `json:"users,omitempty"` - Expand string `json:"expand,omitempty"` + Name string `json:"name,omitempty"` // The name of the group. + Self string `json:"self,omitempty"` // The URL of the group. + Users *GroupUserPageScheme `json:"users,omitempty"` // The users in the group. + Expand string `json:"expand,omitempty"` // The fields to be expanded in the group. } +// GroupUserPageScheme represents a page of users in a group in Jira. type GroupUserPageScheme struct { - Size int `json:"size,omitempty"` - Items []*UserScheme `json:"items,omitempty"` - MaxResults int `json:"max-results,omitempty"` - StartIndex int `json:"start-index,omitempty"` - EndIndex int `json:"end-index,omitempty"` + Size int `json:"size,omitempty"` // The size of the page. + Items []*UserScheme `json:"items,omitempty"` // The users in the page. + MaxResults int `json:"max-results,omitempty"` // The maximum number of results in the page. + StartIndex int `json:"start-index,omitempty"` // The starting index of the page. + EndIndex int `json:"end-index,omitempty"` // The ending index of the page. } +// BulkGroupScheme represents a bulk of groups in Jira. type BulkGroupScheme struct { - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*GroupDetailScheme `json:"values,omitempty"` + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results in the bulk. + StartAt int `json:"startAt,omitempty"` // The starting index of the bulk. + Total int `json:"total,omitempty"` // The total number of groups in the bulk. + IsLast bool `json:"isLast,omitempty"` // Indicates if the bulk is the last one. + Values []*GroupDetailScheme `json:"values,omitempty"` // The groups in the bulk. } +// GroupDetailScheme represents the details of a group in Jira. type GroupDetailScheme struct { - Self string `json:"self,omitempty"` - Name string `json:"name,omitempty"` - GroupID string `json:"groupId,omitempty"` + Self string `json:"self,omitempty"` // The URL of the group. + Name string `json:"name,omitempty"` // The name of the group. + GroupID string `json:"groupId,omitempty"` // The ID of the group. } +// GroupMemberPageScheme represents a page of group members in Jira. type GroupMemberPageScheme struct { - Self string `json:"self,omitempty"` - NextPage string `json:"nextPage,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*GroupUserDetailScheme `json:"values,omitempty"` + Self string `json:"self,omitempty"` // The URL of the page. + NextPage string `json:"nextPage,omitempty"` // The URL of the next page. + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results in the page. + StartAt int `json:"startAt,omitempty"` // The starting index of the page. + Total int `json:"total,omitempty"` // The total number of group members. + IsLast bool `json:"isLast,omitempty"` // Indicates if the page is the last one. + Values []*GroupUserDetailScheme `json:"values,omitempty"` // The group members in the page. } +// GroupUserDetailScheme represents the details of a group user in Jira. type GroupUserDetailScheme struct { - Self string `json:"self"` - Name string `json:"name"` - Key string `json:"key"` - AccountID string `json:"accountId"` - EmailAddress string `json:"emailAddress"` - DisplayName string `json:"displayName"` - Active bool `json:"active"` - TimeZone string `json:"timeZone"` - AccountType string `json:"accountType"` + Self string `json:"self"` // The URL of the group user. + Name string `json:"name"` // The name of the group user. + Key string `json:"key"` // The key of the group user. + AccountID string `json:"accountId"` // The account ID of the group user. + EmailAddress string `json:"emailAddress"` // The email address of the group user. + DisplayName string `json:"displayName"` // The display name of the group user. + Active bool `json:"active"` // Indicates if the group user is active. + TimeZone string `json:"timeZone"` // The time zone of the group user. + AccountType string `json:"accountType"` // The account type of the group user. } +// GroupBulkOptionsScheme represents the bulk options for a group in Jira. type GroupBulkOptionsScheme struct { - GroupIDs []string - GroupNames []string + GroupIDs []string // The IDs of the groups. + GroupNames []string // The names of the groups. } diff --git a/pkg/infra/models/jira_issue_attachments.go b/pkg/infra/models/jira_issue_attachments.go index be3ac9ad..5fd056a8 100644 --- a/pkg/infra/models/jira_issue_attachments.go +++ b/pkg/infra/models/jira_issue_attachments.go @@ -1,46 +1,51 @@ package models +// AttachmentSettingScheme represents the attachment settings in Jira. type AttachmentSettingScheme struct { - Enabled bool `json:"enabled,omitempty"` - UploadLimit int `json:"uploadLimit,omitempty"` + Enabled bool `json:"enabled,omitempty"` // Indicates if attachments are enabled. + UploadLimit int `json:"uploadLimit,omitempty"` // The upload limit for attachments. } +// IssueAttachmentScheme represents an attachment of an issue in Jira. type IssueAttachmentScheme struct { - Self string `json:"self,omitempty"` - ID string `json:"id,omitempty"` - Filename string `json:"filename,omitempty"` - Author *UserScheme `json:"author,omitempty"` - Created string `json:"created,omitempty"` - Size int `json:"size,omitempty"` - MimeType string `json:"mimeType,omitempty"` - Content string `json:"content,omitempty"` - Thumbnail string `json:"thumbnail,omitempty"` + Self string `json:"self,omitempty"` // The URL of the attachment. + ID string `json:"id,omitempty"` // The ID of the attachment. + Filename string `json:"filename,omitempty"` // The filename of the attachment. + Author *UserScheme `json:"author,omitempty"` // The author of the attachment. + Created string `json:"created,omitempty"` // The creation time of the attachment. + Size int `json:"size,omitempty"` // The size of the attachment. + MimeType string `json:"mimeType,omitempty"` // The MIME type of the attachment. + Content string `json:"content,omitempty"` // The content of the attachment. + Thumbnail string `json:"thumbnail,omitempty"` // The thumbnail of the attachment. } +// IssueAttachmentMetadataScheme represents the metadata of an attachment of an issue in Jira. type IssueAttachmentMetadataScheme struct { - ID int `json:"id,omitempty"` - Self string `json:"self,omitempty"` - Filename string `json:"filename,omitempty"` - Author *UserScheme `json:"author,omitempty"` - Created string `json:"created,omitempty"` - Size int `json:"size,omitempty"` - MimeType string `json:"mimeType,omitempty"` - Content string `json:"content,omitempty"` - Thumbnail string `json:"thumbnail,omitempty"` + ID int `json:"id,omitempty"` // The ID of the attachment. + Self string `json:"self,omitempty"` // The URL of the attachment. + Filename string `json:"filename,omitempty"` // The filename of the attachment. + Author *UserScheme `json:"author,omitempty"` // The author of the attachment. + Created string `json:"created,omitempty"` // The creation time of the attachment. + Size int `json:"size,omitempty"` // The size of the attachment. + MimeType string `json:"mimeType,omitempty"` // The MIME type of the attachment. + Content string `json:"content,omitempty"` // The content of the attachment. + Thumbnail string `json:"thumbnail,omitempty"` // The thumbnail of the attachment. } +// IssueAttachmentHumanMetadataScheme represents the human-readable metadata of an attachment of an issue in Jira. type IssueAttachmentHumanMetadataScheme struct { - ID int `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Entries []*IssueAttachmentHumanMetadataEntryScheme `json:"entries,omitempty"` - TotalEntryCount int `json:"totalEntryCount,omitempty"` - MediaType string `json:"mediaType,omitempty"` + ID int `json:"id,omitempty"` // The ID of the attachment. + Name string `json:"name,omitempty"` // The name of the attachment. + Entries []*IssueAttachmentHumanMetadataEntryScheme `json:"entries,omitempty"` // The entries of the attachment. + TotalEntryCount int `json:"totalEntryCount,omitempty"` // The total count of entries of the attachment. + MediaType string `json:"mediaType,omitempty"` // The media type of the attachment. } +// IssueAttachmentHumanMetadataEntryScheme represents an entry of the human-readable metadata of an attachment of an issue in Jira. type IssueAttachmentHumanMetadataEntryScheme struct { - Path string `json:"path,omitempty"` - Index int `json:"index,omitempty"` - Size string `json:"size,omitempty"` - MediaType string `json:"mediaType,omitempty"` - Label string `json:"label,omitempty"` + Path string `json:"path,omitempty"` // The path of the entry. + Index int `json:"index,omitempty"` // The index of the entry. + Size string `json:"size,omitempty"` // The size of the entry. + MediaType string `json:"mediaType,omitempty"` // The media type of the entry. + Label string `json:"label,omitempty"` // The label of the entry. } diff --git a/pkg/infra/models/jira_issue_metadata.go b/pkg/infra/models/jira_issue_metadata.go index 7c5af4f3..31778bd8 100644 --- a/pkg/infra/models/jira_issue_metadata.go +++ b/pkg/infra/models/jira_issue_metadata.go @@ -1,9 +1,10 @@ package models +// IssueMetadataCreateOptions represents the options for creating issue metadata in Jira. type IssueMetadataCreateOptions struct { - ProjectIDs []string - ProjectKeys []string - IssueTypeIDs []string - IssueTypeNames []string - Expand string + ProjectIDs []string // The IDs of the projects. + ProjectKeys []string // The keys of the projects. + IssueTypeIDs []string // The IDs of the issue types. + IssueTypeNames []string // The names of the issue types. + Expand string // The fields to be expanded in the issue metadata. } diff --git a/pkg/infra/models/jira_issue_operations.go b/pkg/infra/models/jira_issue_operations.go index ca5577cf..3abcd1d4 100644 --- a/pkg/infra/models/jira_issue_operations.go +++ b/pkg/infra/models/jira_issue_operations.go @@ -1,7 +1,19 @@ package models +// UpdateOperations represents a collection of update operations. +// Fields is a slice of maps, each containing a string key and an interface{} value. type UpdateOperations struct{ Fields []map[string]interface{} } +// AddArrayOperation adds an array operation to the collection. +// It takes a custom field ID and a mapping of string to string as parameters. +// If the custom field ID is not provided, it returns an ErrNoFieldIDError. +// It creates an operation node for each value-operation pair in the mapping, +// with the operation as the key and the value as the value, +// and appends the operation node to the operations. +// It then creates a field node with the custom field ID as the key and the operations as the value, +// creates an update node with the "update" key and the field node as the value, +// and appends the update node to the Fields of the UpdateOperations. +// It returns nil if the operation is successful. func (u *UpdateOperations) AddArrayOperation(customFieldID string, mapping map[string]string) error { if len(customFieldID) == 0 { @@ -27,6 +39,17 @@ func (u *UpdateOperations) AddArrayOperation(customFieldID string, mapping map[s return nil } +// AddStringOperation adds a string operation to the collection. +// It takes a custom field ID, an operation, and a value as parameters. +// If the custom field ID is not provided, it returns an ErrNoFieldIDError. +// If the operation is not provided, it returns an ErrNoEditOperatorError. +// If the value is not provided, it returns an ErrNoEditValueError. +// It creates an operation node with the operation as the key and the value as the value, +// appends the operation node to the operations, +// creates a field node with the custom field ID as the key and the operations as the value, +// creates an update node with the "update" key and the field node as the value, +// and appends the update node to the Fields of the UpdateOperations. +// It returns nil if the operation is successful. func (u *UpdateOperations) AddStringOperation(customFieldID, operation, value string) error { if len(customFieldID) == 0 { @@ -58,6 +81,13 @@ func (u *UpdateOperations) AddStringOperation(customFieldID, operation, value st return nil } +// AddMultiRawOperation adds a multi raw operation to the collection. +// It takes a custom field ID and a slice of mappings as parameters. +// Each mapping is a map with string keys and interface{} values. +// If the custom field ID is not provided, it returns an ErrNoFieldIDError. +// It appends the mappings to the operations, creates a field node with the custom field ID and the operations, +// creates an update node with the "update" key and the field node, and appends the update node to the Fields of the UpdateOperations. +// It returns nil if the operation is successful. func (u *UpdateOperations) AddMultiRawOperation(customFieldID string, mappings []map[string]interface{}) error { if len(customFieldID) == 0 { diff --git a/pkg/infra/models/jira_issue_operations_test.go b/pkg/infra/models/jira_issue_operations_test.go index fe19b145..6a5d44fa 100644 --- a/pkg/infra/models/jira_issue_operations_test.go +++ b/pkg/infra/models/jira_issue_operations_test.go @@ -210,12 +210,12 @@ func TestUpdateOperations_AddMultiRawOperation(t *testing.T) { fmt.Sprintf("AddMultiRawOperation(%v, %v)", tt.args.customFieldID, tt.args.mappings)) if !tt.expectedErr { - actualJson, err := json.Marshal(u.Fields) + actualJSON, err := json.Marshal(u.Fields) if err != nil { t.Fatal(err) } - assert.Equal(t, expectedJson, string(actualJson)) + assert.Equal(t, expectedJson, string(actualJSON)) } }) } diff --git a/pkg/infra/models/jira_issue_search.go b/pkg/infra/models/jira_issue_search.go index 8a55c1f7..3f64c07b 100644 --- a/pkg/infra/models/jira_issue_search.go +++ b/pkg/infra/models/jira_issue_search.go @@ -1,15 +1,18 @@ package models +// IssueSearchCheckPayloadScheme represents the payload for checking issue search in Jira. type IssueSearchCheckPayloadScheme struct { - IssueIds []int `json:"issueIds,omitempty"` - JQLs []string `json:"jqls,omitempty"` + IssueIds []int `json:"issueIds,omitempty"` // The IDs of the issues. + JQLs []string `json:"jqls,omitempty"` // The JQLs for the issue search. } +// IssueMatchesPageScheme represents a page of issue matches in Jira. type IssueMatchesPageScheme struct { - Matches []*IssueMatchesScheme `json:"matches,omitempty"` + Matches []*IssueMatchesScheme `json:"matches,omitempty"` // The issue matches in the page. } +// IssueMatchesScheme represents the matches of an issue in Jira. type IssueMatchesScheme struct { - MatchedIssues []int `json:"matchedIssues,omitempty"` - Errors []string `json:"errors,omitempty"` + MatchedIssues []int `json:"matchedIssues,omitempty"` // The matched issues. + Errors []string `json:"errors,omitempty"` // The errors occurred during the matching process. } diff --git a/pkg/infra/models/jira_issue_security.go b/pkg/infra/models/jira_issue_security.go index 6207b23d..d5c975e3 100644 --- a/pkg/infra/models/jira_issue_security.go +++ b/pkg/infra/models/jira_issue_security.go @@ -1,12 +1,14 @@ package models +// IssueSecurityLevelsScheme represents the security levels of an issue in Jira. type IssueSecurityLevelsScheme struct { - Levels []*IssueSecurityLevelScheme `json:"levels,omitempty"` + Levels []*IssueSecurityLevelScheme `json:"levels,omitempty"` // The security levels of the issue. } +// IssueSecurityLevelScheme represents a security level of an issue in Jira. type IssueSecurityLevelScheme struct { - Self string `json:"self,omitempty"` - ID string `json:"id,omitempty"` - Description string `json:"description,omitempty"` - Name string `json:"name,omitempty"` + Self string `json:"self,omitempty"` // The URL of the security level. + ID string `json:"id,omitempty"` // The ID of the security level. + Description string `json:"description,omitempty"` // The description of the security level. + Name string `json:"name,omitempty"` // The name of the security level. } diff --git a/pkg/infra/models/jira_issue_type.go b/pkg/infra/models/jira_issue_type.go index aa596450..ee1183d2 100644 --- a/pkg/infra/models/jira_issue_type.go +++ b/pkg/infra/models/jira_issue_type.go @@ -1,27 +1,30 @@ package models +// IssueTypeScheme represents an issue type in Jira. type IssueTypeScheme struct { - Self string `json:"self,omitempty"` - ID string `json:"id,omitempty"` - Description string `json:"description,omitempty"` - IconURL string `json:"iconUrl,omitempty"` - Name string `json:"name,omitempty"` - Subtask bool `json:"subtask,omitempty"` - AvatarID int `json:"avatarId,omitempty"` - EntityID string `json:"entityId,omitempty"` - HierarchyLevel int `json:"hierarchyLevel,omitempty"` - Scope *IssueTypeScopeScheme `json:"scope,omitempty"` + Self string `json:"self,omitempty"` // The URL of the issue type. + ID string `json:"id,omitempty"` // The ID of the issue type. + Description string `json:"description,omitempty"` // The description of the issue type. + IconURL string `json:"iconUrl,omitempty"` // The URL of the icon of the issue type. + Name string `json:"name,omitempty"` // The name of the issue type. + Subtask bool `json:"subtask,omitempty"` // Indicates if the issue type is a subtask. + AvatarID int `json:"avatarId,omitempty"` // The ID of the avatar of the issue type. + EntityID string `json:"entityId,omitempty"` // The entity ID of the issue type. + HierarchyLevel int `json:"hierarchyLevel,omitempty"` // The hierarchy level of the issue type. + Scope *IssueTypeScopeScheme `json:"scope,omitempty"` // The scope of the issue type. } +// IssueTypeScopeScheme represents the scope of an issue type in Jira. type IssueTypeScopeScheme struct { - Type string `json:"type,omitempty"` - Project *ProjectScheme `json:"project,omitempty"` + Type string `json:"type,omitempty"` // The type of the scope. + Project *ProjectScheme `json:"project,omitempty"` // The project of the scope. } +// IssueTypePayloadScheme represents the payload for an issue type in Jira. type IssueTypePayloadScheme struct { - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - Type string `json:"type,omitempty"` - HierarchyLevel int `json:"hierarchyLevel,omitempty"` - AvatarID int `json:"avatarId,omitempty"` + Name string `json:"name,omitempty"` // The name of the issue type. + Description string `json:"description,omitempty"` // The description of the issue type. + Type string `json:"type,omitempty"` // The type of the issue type. + HierarchyLevel int `json:"hierarchyLevel,omitempty"` // The hierarchy level of the issue type. + AvatarID int `json:"avatarId,omitempty"` // The ID of the avatar of the issue type. } diff --git a/pkg/infra/models/jira_issue_type_scheme.go b/pkg/infra/models/jira_issue_type_scheme.go index 2757e4c6..53b15f7e 100644 --- a/pkg/infra/models/jira_issue_type_scheme.go +++ b/pkg/infra/models/jira_issue_type_scheme.go @@ -1,38 +1,44 @@ package models +// IssueTypeSchemePayloadScheme represents the payload for an issue type scheme in Jira. type IssueTypeSchemePayloadScheme struct { - DefaultIssueTypeID string `json:"defaultIssueTypeId,omitempty"` - IssueTypeIds []string `json:"issueTypeIds,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` + DefaultIssueTypeID string `json:"defaultIssueTypeId,omitempty"` // The default issue type ID. + IssueTypeIds []string `json:"issueTypeIds,omitempty"` // The issue type IDs. + Name string `json:"name,omitempty"` // The name of the issue type scheme. + Description string `json:"description,omitempty"` // The description of the issue type scheme. } +// NewIssueTypeSchemeScheme represents a new issue type scheme in Jira. type NewIssueTypeSchemeScheme struct { - IssueTypeSchemeID string `json:"issueTypeSchemeId"` + IssueTypeSchemeID string `json:"issueTypeSchemeId"` // The ID of the issue type scheme. } +// IssueTypeSchemeItemPageScheme represents a page of issue type scheme items in Jira. type IssueTypeSchemeItemPageScheme struct { - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*IssueTypeSchemeMappingScheme `json:"values,omitempty"` + MaxResults int `json:"maxResults,omitempty"` // The maximum results per page. + StartAt int `json:"startAt,omitempty"` // The starting index of the page. + Total int `json:"total,omitempty"` // The total number of issue type scheme items. + IsLast bool `json:"isLast,omitempty"` // Indicates if this is the last page. + Values []*IssueTypeSchemeMappingScheme `json:"values,omitempty"` // The issue type scheme items in the page. } +// IssueTypeSchemeMappingScheme represents a mapping of an issue type scheme in Jira. type IssueTypeSchemeMappingScheme struct { - IssueTypeSchemeID string `json:"issueTypeSchemeId,omitempty"` - IssueTypeID string `json:"issueTypeId,omitempty"` + IssueTypeSchemeID string `json:"issueTypeSchemeId,omitempty"` // The ID of the issue type scheme. + IssueTypeID string `json:"issueTypeId,omitempty"` // The ID of the issue type. } +// ProjectIssueTypeSchemePageScheme represents a page of project issue type schemes in Jira. type ProjectIssueTypeSchemePageScheme struct { - MaxResults int `json:"maxResults"` - StartAt int `json:"startAt"` - Total int `json:"total"` - IsLast bool `json:"isLast"` - Values []*IssueTypeSchemeProjectsScheme `json:"values"` + MaxResults int `json:"maxResults"` // The maximum results per page. + StartAt int `json:"startAt"` // The starting index of the page. + Total int `json:"total"` // The total number of project issue type schemes. + IsLast bool `json:"isLast"` // Indicates if this is the last page. + Values []*IssueTypeSchemeProjectsScheme `json:"values"` // The project issue type schemes in the page. } +// IssueTypeSchemeProjectsScheme represents the projects of an issue type scheme in Jira. type IssueTypeSchemeProjectsScheme struct { - IssueTypeScheme *IssueTypeSchemeScheme `json:"issueTypeScheme,omitempty"` - ProjectIds []string `json:"projectIds,omitempty"` + IssueTypeScheme *IssueTypeSchemeScheme `json:"issueTypeScheme,omitempty"` // The issue type scheme. + ProjectIds []string `json:"projectIds,omitempty"` // The IDs of the projects. } diff --git a/pkg/infra/models/jira_issue_type_screen_scheme.go b/pkg/infra/models/jira_issue_type_screen_scheme.go index 94535aab..87fd03e0 100644 --- a/pkg/infra/models/jira_issue_type_screen_scheme.go +++ b/pkg/infra/models/jira_issue_type_screen_scheme.go @@ -1,89 +1,101 @@ package models +// ScreenSchemeParamsScheme represents the parameters for a screen scheme in Jira. type ScreenSchemeParamsScheme struct { - IDs []int - QueryString string - OrderBy string - Expand []string + IDs []int // The IDs of the screen schemes. + QueryString string // The query string for the screen scheme search. + OrderBy string // The order by field for the screen scheme search. + Expand []string // The fields to be expanded in the screen scheme. } +// IssueTypeScreenSchemePageScheme represents a page of issue type screen schemes in Jira. type IssueTypeScreenSchemePageScheme struct { - Self string `json:"self,omitempty"` - NextPage string `json:"nextPage,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*IssueTypeScreenSchemeScheme `json:"values,omitempty"` + Self string `json:"self,omitempty"` // The URL of the page. + NextPage string `json:"nextPage,omitempty"` // The URL of the next page. + MaxResults int `json:"maxResults,omitempty"` // The maximum results per page. + StartAt int `json:"startAt,omitempty"` // The starting index of the page. + Total int `json:"total,omitempty"` // The total number of issue type screen schemes. + IsLast bool `json:"isLast,omitempty"` // Indicates if this is the last page. + Values []*IssueTypeScreenSchemeScheme `json:"values,omitempty"` // The issue type screen schemes in the page. } +// IssueTypeScreenSchemePayloadScheme represents the payload for an issue type screen scheme in Jira. type IssueTypeScreenSchemePayloadScheme struct { - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - IssueTypeMappings []*IssueTypeScreenSchemeMappingPayloadScheme `json:"issueTypeMappings,omitempty"` + Name string `json:"name,omitempty"` // The name of the issue type screen scheme. + Description string `json:"description,omitempty"` // The description of the issue type screen scheme. + IssueTypeMappings []*IssueTypeScreenSchemeMappingPayloadScheme `json:"issueTypeMappings,omitempty"` // The issue type mappings for the screen scheme. } +// IssueTypeScreenSchemeMappingPayloadScheme represents a mapping payload for an issue type screen scheme in Jira. type IssueTypeScreenSchemeMappingPayloadScheme struct { - IssueTypeID string `json:"issueTypeId,omitempty"` - ScreenSchemeID string `json:"screenSchemeId,omitempty"` + IssueTypeID string `json:"issueTypeId,omitempty"` // The ID of the issue type. + ScreenSchemeID string `json:"screenSchemeId,omitempty"` // The ID of the screen scheme. } +// IssueTypeScreenSchemeScheme represents an issue type screen scheme in Jira. type IssueTypeScreenSchemeScheme struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - Projects *ProjectSearchScheme `json:"projects,omitempty"` + ID string `json:"id,omitempty"` // The ID of the issue type screen scheme. + Name string `json:"name,omitempty"` // The name of the issue type screen scheme. + Description string `json:"description,omitempty"` // The description of the issue type screen scheme. + Projects *ProjectSearchScheme `json:"projects,omitempty"` // The projects associated with the screen scheme. } +// IssueTypeScreenScreenCreatedScheme represents a newly created issue type screen scheme in Jira. type IssueTypeScreenScreenCreatedScheme struct { - ID string `json:"id"` + ID string `json:"id"` // The ID of the newly created issue type screen scheme. } +// IssueTypeProjectScreenSchemePageScheme represents a page of project issue type screen schemes in Jira. type IssueTypeProjectScreenSchemePageScheme struct { - Self string `json:"self,omitempty"` - NextPage string `json:"nextPage,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*IssueTypeScreenSchemesProjectScheme `json:"values,omitempty"` + Self string `json:"self,omitempty"` // The URL of the page. + NextPage string `json:"nextPage,omitempty"` // The URL of the next page. + MaxResults int `json:"maxResults,omitempty"` // The maximum results per page. + StartAt int `json:"startAt,omitempty"` // The starting index of the page. + Total int `json:"total,omitempty"` // The total number of project issue type screen schemes. + IsLast bool `json:"isLast,omitempty"` // Indicates if this is the last page. + Values []*IssueTypeScreenSchemesProjectScheme `json:"values,omitempty"` // The project issue type screen schemes in the page. } +// IssueTypeScreenSchemesProjectScheme represents the project issue type screen schemes in Jira. type IssueTypeScreenSchemesProjectScheme struct { - IssueTypeScreenScheme *IssueTypeScreenSchemeScheme `json:"issueTypeScreenScheme,omitempty"` - ProjectIds []string `json:"projectIds,omitempty"` + IssueTypeScreenScheme *IssueTypeScreenSchemeScheme `json:"issueTypeScreenScheme,omitempty"` // The issue type screen scheme. + ProjectIds []string `json:"projectIds,omitempty"` // The IDs of the projects. } +// IssueTypeScreenSchemeMappingScheme represents a mapping of an issue type screen scheme in Jira. type IssueTypeScreenSchemeMappingScheme struct { - Self string `json:"self,omitempty"` - NextPage string `json:"nextPage,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*IssueTypeScreenSchemeItemScheme `json:"values,omitempty"` + Self string `json:"self,omitempty"` // The URL of the mapping. + NextPage string `json:"nextPage,omitempty"` // The URL of the next page. + MaxResults int `json:"maxResults,omitempty"` // The maximum results per page. + StartAt int `json:"startAt,omitempty"` // The starting index of the page. + Total int `json:"total,omitempty"` // The total number of issue type screen scheme mappings. + IsLast bool `json:"isLast,omitempty"` // Indicates if this is the last page. + Values []*IssueTypeScreenSchemeItemScheme `json:"values,omitempty"` // The issue type screen scheme items in the mapping. } +// IssueTypeScreenSchemeItemScheme represents an item of an issue type screen scheme in Jira. type IssueTypeScreenSchemeItemScheme struct { - IssueTypeScreenSchemeID string `json:"issueTypeScreenSchemeId,omitempty"` - IssueTypeID string `json:"issueTypeId,omitempty"` - ScreenSchemeID string `json:"screenSchemeId,omitempty"` + IssueTypeScreenSchemeID string `json:"issueTypeScreenSchemeId,omitempty"` // The ID of the issue type screen scheme. + IssueTypeID string `json:"issueTypeId,omitempty"` // The ID of the issue type. + ScreenSchemeID string `json:"screenSchemeId,omitempty"` // The ID of the screen scheme. } +// IssueTypeScreenSchemeByProjectPageScheme represents a page of issue type screen schemes by project in Jira. type IssueTypeScreenSchemeByProjectPageScheme struct { - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*ProjectDetailScheme `json:"values,omitempty"` + MaxResults int `json:"maxResults,omitempty"` // The maximum results per page. + StartAt int `json:"startAt,omitempty"` // The starting index of the page. + Total int `json:"total,omitempty"` // The total number of issue type screen schemes by project. + IsLast bool `json:"isLast,omitempty"` // Indicates if this is the last page. + Values []*ProjectDetailScheme `json:"values,omitempty"` // The project details in the page. } +// ProjectDetailScheme represents the details of a project in Jira. type ProjectDetailScheme struct { - Self string `json:"self,omitempty"` - ID string `json:"id,omitempty"` - Key string `json:"key,omitempty"` - Name string `json:"name,omitempty"` - ProjectTypeKey string `json:"projectTypeKey,omitempty"` - Simplified bool `json:"simplified,omitempty"` - ProjectCategory *ProjectCategoryScheme `json:"projectCategory,omitempty"` + Self string `json:"self,omitempty"` // The URL of the project. + ID string `json:"id,omitempty"` // The ID of the project. + Key string `json:"key,omitempty"` // The key of the project. + Name string `json:"name,omitempty"` // The name of the project. + ProjectTypeKey string `json:"projectTypeKey,omitempty"` // The type key of the project. + Simplified bool `json:"simplified,omitempty"` // Indicates if the project is simplified. + ProjectCategory *ProjectCategoryScheme `json:"projectCategory,omitempty"` // The category of the project. } diff --git a/pkg/infra/models/jira_issue_v2.go b/pkg/infra/models/jira_issue_v2.go index e6ba97a6..26c17661 100644 --- a/pkg/infra/models/jira_issue_v2.go +++ b/pkg/infra/models/jira_issue_v2.go @@ -5,22 +5,26 @@ import ( "encoding/json" ) +// IssueSchemeV2 represents the scheme of an issue in Jira version 2. type IssueSchemeV2 struct { - ID string `json:"id,omitempty"` - Key string `json:"key,omitempty"` - Self string `json:"self,omitempty"` - Transitions []*IssueTransitionScheme `json:"transitions,omitempty"` - Changelog *IssueChangelogScheme `json:"changelog,omitempty"` - Fields *IssueFieldsSchemeV2 `json:"fields,omitempty"` + ID string `json:"id,omitempty"` // The ID of the issue. + Key string `json:"key,omitempty"` // The key of the issue. + Self string `json:"self,omitempty"` // The URL of the issue. + Transitions []*IssueTransitionScheme `json:"transitions,omitempty"` // The transitions of the issue. + Changelog *IssueChangelogScheme `json:"changelog,omitempty"` // The changelog of the issue. + Fields *IssueFieldsSchemeV2 `json:"fields,omitempty"` // The fields of the issue. } +// MergeCustomFields merges custom fields into the issue scheme. +// It returns a map representation of the issue scheme with the merged fields. +// If the provided fields are nil or empty, it returns an error. func (i *IssueSchemeV2) MergeCustomFields(fields *CustomFields) (map[string]interface{}, error) { if fields == nil || len(fields.Fields) == 0 { return nil, ErrNoCustomFieldError } - //Convert the IssueScheme struct to map[string]interface{} + // Convert the IssueScheme struct to map[string]interface{} issueSchemeAsBytes, err := json.Marshal(i) if err != nil { return nil, err @@ -31,7 +35,7 @@ func (i *IssueSchemeV2) MergeCustomFields(fields *CustomFields) (map[string]inte return nil, err } - //For each customField created, merge it into the eAsMap + // For each customField created, merge it into the eAsMap for _, customField := range fields.Fields { if err := mergo.Merge(&issueSchemeAsMap, customField, mergo.WithOverride); err != nil { return nil, err @@ -41,13 +45,16 @@ func (i *IssueSchemeV2) MergeCustomFields(fields *CustomFields) (map[string]inte return issueSchemeAsMap, nil } +// MergeOperations merges operations into the issue scheme. +// It returns a map representation of the issue scheme with the merged operations. +// If the provided operations are nil or empty, it returns an error. func (i *IssueSchemeV2) MergeOperations(operations *UpdateOperations) (map[string]interface{}, error) { if operations == nil || len(operations.Fields) == 0 { return nil, ErrNoOperatorError } - //Convert the IssueScheme struct to map[string]interface{} + // Convert the IssueScheme struct to map[string]interface{} issueSchemeAsBytes, err := json.Marshal(i) if err != nil { return nil, err @@ -58,7 +65,7 @@ func (i *IssueSchemeV2) MergeOperations(operations *UpdateOperations) (map[strin return nil, err } - //For each customField created, merge it into the eAsMap + // For each customField created, merge it into the eAsMap for _, customField := range operations.Fields { if err := mergo.Merge(&issueSchemeAsMap, customField, mergo.WithOverride); err != nil { return nil, err @@ -68,9 +75,11 @@ func (i *IssueSchemeV2) MergeOperations(operations *UpdateOperations) (map[strin return issueSchemeAsMap, nil } +// ToMap converts the issue scheme to a map representation. +// It returns a map[string]interface{} where the keys are the field names and the values are the field values. func (i *IssueSchemeV2) ToMap() (map[string]interface{}, error) { - //Convert the IssueScheme struct to map[string]interface{} + // Convert the IssueScheme struct to map[string]interface{} issueSchemeAsBytes, err := json.Marshal(i) if err != nil { return nil, err @@ -84,6 +93,7 @@ func (i *IssueSchemeV2) ToMap() (map[string]interface{}, error) { return issueSchemeAsMap, nil } +// IssueFieldsSchemeV2 represents the fields of an issue in Jira version 2. type IssueFieldsSchemeV2 struct { Parent *ParentScheme `json:"parent,omitempty"` IssueType *IssueTypeScheme `json:"issuetype,omitempty"` @@ -115,53 +125,61 @@ type IssueFieldsSchemeV2 struct { Worklog *IssueWorklogRichTextPageScheme `json:"worklog,omitempty"` } +// ParentScheme represents the parent of an issue in Jira. type ParentScheme struct { - ID string `json:"id,omitempty"` - Key string `json:"key,omitempty"` - Self string `json:"self,omitempty"` - Fields *ParentFieldsScheme `json:"fields,omitempty"` + ID string `json:"id,omitempty"` // The ID of the parent issue. + Key string `json:"key,omitempty"` // The key of the parent issue. + Self string `json:"self,omitempty"` // The URL of the parent issue. + Fields *ParentFieldsScheme `json:"fields,omitempty"` // The fields of the parent issue. } +// ParentFieldsScheme represents the fields of a parent issue in Jira. type ParentFieldsScheme struct { - Summary string `json:"summary,omitempty"` - Status *StatusScheme `json:"status,omitempty"` + Summary string `json:"summary,omitempty"` // The summary of the parent issue. + Status *StatusScheme `json:"status,omitempty"` // The status of the parent issue. } +// IssueResponseScheme represents the response of an issue operation in Jira. type IssueResponseScheme struct { - ID string `json:"id,omitempty"` - Key string `json:"key,omitempty"` - Self string `json:"self,omitempty"` + ID string `json:"id,omitempty"` // The ID of the issue. + Key string `json:"key,omitempty"` // The key of the issue. + Self string `json:"self,omitempty"` // The URL of the issue. } +// IssueBulkSchemeV2 represents the bulk operation scheme for issues in Jira. type IssueBulkSchemeV2 struct { - Payload *IssueSchemeV2 - CustomFields *CustomFields + Payload *IssueSchemeV2 // The payload of the bulk operation. + CustomFields *CustomFields // The custom fields of the bulk operation. } +// BulkIssueSchemeV2 represents the bulk issue scheme in Jira. type BulkIssueSchemeV2 struct { - Issues []*IssueSchemeV2 `json:"issues,omitempty"` + Issues []*IssueSchemeV2 `json:"issues,omitempty"` // The issues in the bulk operation. } +// IssueBulkResponseScheme represents the response of a bulk issue operation in Jira. type IssueBulkResponseScheme struct { Issues []struct { - ID string `json:"id,omitempty"` - Key string `json:"key,omitempty"` - Self string `json:"self,omitempty"` - } `json:"issues,omitempty"` - Errors []*IssueBulkResponseErrorScheme `json:"errors,omitempty"` + ID string `json:"id,omitempty"` // The ID of the issue. + Key string `json:"key,omitempty"` // The key of the issue. + Self string `json:"self,omitempty"` // The URL of the issue. + } `json:"issues,omitempty"` // The issues in the response. + Errors []*IssueBulkResponseErrorScheme `json:"errors,omitempty"` // The errors in the response. } +// IssueBulkResponseErrorScheme represents the error scheme of a bulk issue operation in Jira. type IssueBulkResponseErrorScheme struct { - Status int `json:"status"` + Status int `json:"status"` // The status of the error. ElementErrors struct { - ErrorMessages []string `json:"errorMessages"` - Status int `json:"status"` - } `json:"elementErrors"` - FailedElementNumber int `json:"failedElementNumber"` + ErrorMessages []string `json:"errorMessages"` // The error messages. + Status int `json:"status"` // The status of the error messages. + } `json:"elementErrors"` // The element errors in the response. + FailedElementNumber int `json:"failedElementNumber"` // The number of the failed element. } +// IssueMoveOptionsV2 represents the move options for an issue in Jira. type IssueMoveOptionsV2 struct { - Fields *IssueSchemeV2 - CustomFields *CustomFields - Operations *UpdateOperations + Fields *IssueSchemeV2 // The fields of the issue. + CustomFields *CustomFields // The custom fields of the issue. + Operations *UpdateOperations // The operations for the issue. } diff --git a/pkg/infra/models/jira_issue_v3.go b/pkg/infra/models/jira_issue_v3.go index 62c55f25..03137f01 100644 --- a/pkg/infra/models/jira_issue_v3.go +++ b/pkg/infra/models/jira_issue_v3.go @@ -5,6 +5,7 @@ import ( "encoding/json" ) +// IssueScheme represents an issue in Jira. type IssueScheme struct { ID string `json:"id,omitempty"` Key string `json:"key,omitempty"` @@ -14,6 +15,9 @@ type IssueScheme struct { Fields *IssueFieldsScheme `json:"fields,omitempty"` } +// MergeCustomFields merges the custom fields into the issue. +// fields is a pointer to CustomFields which represents the custom fields to be merged. +// It returns a map[string]interface{} representing the issue with the merged custom fields and an error if any occurred. func (i *IssueScheme) MergeCustomFields(fields *CustomFields) (map[string]interface{}, error) { if fields == nil || len(fields.Fields) == 0 { @@ -41,6 +45,9 @@ func (i *IssueScheme) MergeCustomFields(fields *CustomFields) (map[string]interf return issueSchemeAsMap, nil } +// MergeOperations merges the operations into the issue. +// operations is a pointer to UpdateOperations which represents the operations to be merged. +// It returns a map[string]interface{} representing the issue with the merged operations and an error if any occurred. func (i *IssueScheme) MergeOperations(operations *UpdateOperations) (map[string]interface{}, error) { if operations == nil || len(operations.Fields) == 0 { @@ -68,6 +75,8 @@ func (i *IssueScheme) MergeOperations(operations *UpdateOperations) (map[string] return issueSchemeAsMap, nil } +// ToMap converts the issue to a map[string]interface{}. +// It returns a map[string]interface{} representing the issue and an error if any occurred. func (i *IssueScheme) ToMap() (map[string]interface{}, error) { //Convert the IssueScheme struct to map[string]interface{} @@ -84,113 +93,126 @@ func (i *IssueScheme) ToMap() (map[string]interface{}, error) { return issueSchemeAsMap, nil } +// IssueFieldsScheme represents the fields of an issue in Jira. type IssueFieldsScheme struct { - Parent *ParentScheme `json:"parent,omitempty"` - IssueType *IssueTypeScheme `json:"issuetype,omitempty"` - IssueLinks []*IssueLinkScheme `json:"issuelinks,omitempty"` - Watcher *IssueWatcherScheme `json:"watches,omitempty"` - Votes *IssueVoteScheme `json:"votes,omitempty"` - Versions []*VersionScheme `json:"versions,omitempty"` - Project *ProjectScheme `json:"project,omitempty"` - FixVersions []*VersionScheme `json:"fixVersions,omitempty"` - Priority *PriorityScheme `json:"priority,omitempty"` - Components []*ComponentScheme `json:"components,omitempty"` - Creator *UserScheme `json:"creator,omitempty"` - Reporter *UserScheme `json:"reporter,omitempty"` - Assignee *UserScheme `json:"assignee,omitempty"` - Resolution *ResolutionScheme `json:"resolution,omitempty"` - Resolutiondate string `json:"resolutiondate,omitempty"` - Workratio int `json:"workratio,omitempty"` - StatusCategoryChangeDate string `json:"statuscategorychangedate,omitempty"` - LastViewed string `json:"lastViewed,omitempty"` - Summary string `json:"summary,omitempty"` - Created string `json:"created,omitempty"` - Updated string `json:"updated,omitempty"` - Labels []string `json:"labels,omitempty"` - Status *StatusScheme `json:"status,omitempty"` - Description *CommentNodeScheme `json:"description,omitempty"` - Comment *IssueCommentPageScheme `json:"comment,omitempty"` - Subtasks []*IssueScheme `json:"subtasks,omitempty"` - Security *SecurityScheme `json:"security,omitempty"` - Attachment []*AttachmentScheme `json:"attachment,omitempty"` - Worklog *IssueWorklogADFPageScheme `json:"worklog,omitempty"` -} - + Parent *ParentScheme `json:"parent,omitempty"` // The parent of the issue. + IssueType *IssueTypeScheme `json:"issuetype,omitempty"` // The type of the issue. + IssueLinks []*IssueLinkScheme `json:"issuelinks,omitempty"` // The links associated with the issue. + Watcher *IssueWatcherScheme `json:"watches,omitempty"` // The watchers of the issue. + Votes *IssueVoteScheme `json:"votes,omitempty"` // The votes for the issue. + Versions []*VersionScheme `json:"versions,omitempty"` // The versions associated with the issue. + Project *ProjectScheme `json:"project,omitempty"` // The project the issue belongs to. + FixVersions []*VersionScheme `json:"fixVersions,omitempty"` // The fix versions for the issue. + Priority *PriorityScheme `json:"priority,omitempty"` // The priority of the issue. + Components []*ComponentScheme `json:"components,omitempty"` // The components associated with the issue. + Creator *UserScheme `json:"creator,omitempty"` // The user who created the issue. + Reporter *UserScheme `json:"reporter,omitempty"` // The user who reported the issue. + Assignee *UserScheme `json:"assignee,omitempty"` // The user assigned to the issue. + Resolution *ResolutionScheme `json:"resolution,omitempty"` // The resolution of the issue. + Resolutiondate string `json:"resolutiondate,omitempty"` // The date the issue was resolved. + Workratio int `json:"workratio,omitempty"` // The work ratio of the issue. + StatusCategoryChangeDate string `json:"statuscategorychangedate,omitempty"` // The date the status category changed. + LastViewed string `json:"lastViewed,omitempty"` // The last time the issue was viewed. + Summary string `json:"summary,omitempty"` // The summary of the issue. + Created string `json:"created,omitempty"` // The date the issue was created. + Updated string `json:"updated,omitempty"` // The date the issue was last updated. + Labels []string `json:"labels,omitempty"` // The labels associated with the issue. + Status *StatusScheme `json:"status,omitempty"` // The status of the issue. + Description *CommentNodeScheme `json:"description,omitempty"` // The description of the issue. + Comment *IssueCommentPageScheme `json:"comment,omitempty"` // The comments on the issue. + Subtasks []*IssueScheme `json:"subtasks,omitempty"` // The subtasks of the issue. + Security *SecurityScheme `json:"security,omitempty"` // The security level of the issue. + Attachment []*AttachmentScheme `json:"attachment,omitempty"` // The attachments of the issue. + Worklog *IssueWorklogADFPageScheme `json:"worklog,omitempty"` // The worklog of the issue. +} + +// IssueTransitionScheme represents a transition of an issue in Jira. type IssueTransitionScheme struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - To *StatusScheme `json:"to,omitempty"` - HasScreen bool `json:"hasScreen,omitempty"` - IsGlobal bool `json:"isGlobal,omitempty"` - IsInitial bool `json:"isInitial,omitempty"` - IsAvailable bool `json:"isAvailable,omitempty"` - IsConditional bool `json:"isConditional,omitempty"` - IsLooped bool `json:"isLooped,omitempty"` -} - + ID string `json:"id,omitempty"` // The ID of the transition. + Name string `json:"name,omitempty"` // The name of the transition. + To *StatusScheme `json:"to,omitempty"` // The status the issue transitions to. + HasScreen bool `json:"hasScreen,omitempty"` // Indicates if the transition has a screen. + IsGlobal bool `json:"isGlobal,omitempty"` // Indicates if the transition is global. + IsInitial bool `json:"isInitial,omitempty"` // Indicates if the transition is initial. + IsAvailable bool `json:"isAvailable,omitempty"` // Indicates if the transition is available. + IsConditional bool `json:"isConditional,omitempty"` // Indicates if the transition is conditional. + IsLooped bool `json:"isLooped,omitempty"` // Indicates if the transition is looped. +} + +// StatusScheme represents the status of an issue in Jira. type StatusScheme struct { - Self string `json:"self,omitempty"` - Description string `json:"description,omitempty"` - IconURL string `json:"iconUrl,omitempty"` - Name string `json:"name,omitempty"` - ID string `json:"id,omitempty"` - StatusCategory *StatusCategoryScheme `json:"statusCategory,omitempty"` + Self string `json:"self,omitempty"` // The URL of the status. + Description string `json:"description,omitempty"` // The description of the status. + IconURL string `json:"iconUrl,omitempty"` // The icon URL of the status. + Name string `json:"name,omitempty"` // The name of the status. + ID string `json:"id,omitempty"` // The ID of the status. + StatusCategory *StatusCategoryScheme `json:"statusCategory,omitempty"` // The category of the status. } +// StatusCategoryScheme represents the category of a status in Jira. type StatusCategoryScheme struct { - Self string `json:"self,omitempty"` - ID int `json:"id,omitempty"` - Key string `json:"key,omitempty"` - ColorName string `json:"colorName,omitempty"` - Name string `json:"name,omitempty"` + Self string `json:"self,omitempty"` // The URL of the status category. + ID int `json:"id,omitempty"` // The ID of the status category. + Key string `json:"key,omitempty"` // The key of the status category. + ColorName string `json:"colorName,omitempty"` // The color name of the status category. + Name string `json:"name,omitempty"` // The name of the status category. } +// IssueNotifyOptionsScheme represents the options for notifying about an issue in Jira. type IssueNotifyOptionsScheme struct { - HTMLBody string `json:"htmlBody,omitempty"` - Subject string `json:"subject,omitempty"` - TextBody string `json:"textBody,omitempty"` - To *IssueNotifyToScheme `json:"to,omitempty"` - Restrict *IssueNotifyRestrictScheme `json:"restrict,omitempty"` + HTMLBody string `json:"htmlBody,omitempty"` // The HTML body of the notification. + Subject string `json:"subject,omitempty"` // The subject of the notification. + TextBody string `json:"textBody,omitempty"` // The text body of the notification. + To *IssueNotifyToScheme `json:"to,omitempty"` // The recipients of the notification. + Restrict *IssueNotifyRestrictScheme `json:"restrict,omitempty"` // The restrictions for the notification. } +// IssueNotifyRestrictScheme represents the restrictions for notifying about an issue in Jira. type IssueNotifyRestrictScheme struct { - Groups []*IssueNotifyGroupScheme `json:"groups,omitempty"` - Permissions []*IssueNotifyPermissionScheme `json:"permissions,omitempty"` + Groups []*IssueNotifyGroupScheme `json:"groups,omitempty"` // The groups to restrict the notification to. + Permissions []*IssueNotifyPermissionScheme `json:"permissions,omitempty"` // The permissions to restrict the notification to. } +// IssueNotifyToScheme represents the recipients for notifying about an issue in Jira. type IssueNotifyToScheme struct { - Reporter bool `json:"reporter,omitempty"` - Assignee bool `json:"assignee,omitempty"` - Watchers bool `json:"watchers,omitempty"` - Voters bool `json:"voters,omitempty"` - Users []*IssueNotifyUserScheme `json:"users,omitempty"` - Groups []*IssueNotifyGroupScheme `json:"groups,omitempty"` + Reporter bool `json:"reporter,omitempty"` // Indicates if the reporter should be notified. + Assignee bool `json:"assignee,omitempty"` // Indicates if the assignee should be notified. + Watchers bool `json:"watchers,omitempty"` // Indicates if the watchers should be notified. + Voters bool `json:"voters,omitempty"` // Indicates if the voters should be notified. + Users []*IssueNotifyUserScheme `json:"users,omitempty"` // The users to notify. + Groups []*IssueNotifyGroupScheme `json:"groups,omitempty"` // The groups to notify. } +// IssueNotifyPermissionScheme represents a permission for notifying about an issue in Jira. type IssueNotifyPermissionScheme struct { - ID string `json:"id,omitempty"` - Key string `json:"key,omitempty"` + ID string `json:"id,omitempty"` // The ID of the permission. + Key string `json:"key,omitempty"` // The key of the permission. } +// IssueNotifyUserScheme represents a user for notifying about an issue in Jira. type IssueNotifyUserScheme struct { - AccountID string `json:"accountId,omitempty"` + AccountID string `json:"accountId,omitempty"` // The account ID of the user. } +// IssueNotifyGroupScheme represents a group for notifying about an issue in Jira. type IssueNotifyGroupScheme struct { - Name string `json:"name,omitempty"` + Name string `json:"name,omitempty"` // The name of the group. } +// IssueBulkSchemeV3 represents a bulk operation on version 3 issues in Jira. type IssueBulkSchemeV3 struct { - Payload *IssueScheme - CustomFields *CustomFields + Payload *IssueScheme // The payload for the bulk operation. + CustomFields *CustomFields // The custom fields for the bulk operation. } +// BulkIssueSchemeV3 represents a bulk of version 3 issues in Jira. type BulkIssueSchemeV3 struct { - Issues []*IssueScheme `json:"issues,omitempty"` + Issues []*IssueScheme `json:"issues,omitempty"` // The issues in the bulk. } +// IssueMoveOptionsV3 represents the options for moving a version 3 issue in Jira. type IssueMoveOptionsV3 struct { - Fields *IssueScheme - CustomFields *CustomFields - Operations *UpdateOperations + Fields *IssueScheme // The fields for the move operation. + CustomFields *CustomFields // The custom fields for the move operation. + Operations *UpdateOperations // The operations for the move operation. } diff --git a/pkg/infra/models/jira_jql.go b/pkg/infra/models/jira_jql.go index fc13aa10..cc99b925 100644 --- a/pkg/infra/models/jira_jql.go +++ b/pkg/infra/models/jira_jql.go @@ -1,40 +1,48 @@ package models +// ParsedQueryPageScheme represents a page of parsed queries in Jira. +// Queries is a slice of pointers to ParseQueryScheme which represents the parsed queries in the page. type ParsedQueryPageScheme struct { - Queries []*ParseQueryScheme `json:"queries"` + Queries []*ParseQueryScheme `json:"queries"` // The parsed queries in the page. } +// ParseQueryScheme represents a parsed query in Jira. type ParseQueryScheme struct { - Query string `json:"query"` + Query string `json:"query"` // The query. Structure struct { Where struct { - } `json:"where"` - OrderBy *QueryStructureOrderScheme `json:"orderBy"` - } `json:"structure"` - Errors []string `json:"errors"` + } `json:"where"` // The where clause of the query. + OrderBy *QueryStructureOrderScheme `json:"orderBy"` // The order by clause of the query. + } `json:"structure"` // The structure of the query. + Errors []string `json:"errors"` // The errors occurred during parsing the query. } +// QueryStructureScheme represents the structure of a query in Jira. type QueryStructureScheme struct { - OrderBy *QueryStructureOrderScheme `json:"orderBy"` + OrderBy *QueryStructureOrderScheme `json:"orderBy"` // The order by clause of the query. } +// QueryStructureOrderScheme represents the order by clause of a query in Jira. type QueryStructureOrderScheme struct { - Fields []*QueryStructureOrderFieldScheme `json:"fields"` + Fields []*QueryStructureOrderFieldScheme `json:"fields"` // The fields in the order by clause. } +// QueryStructureOrderFieldScheme represents a field in the order by clause of a query in Jira. type QueryStructureOrderFieldScheme struct { - Field *QueryStructureOrderFieldNodeScheme `json:"field"` - Direction string `json:"direction"` + Field *QueryStructureOrderFieldNodeScheme `json:"field"` // The field node. + Direction string `json:"direction"` // The direction of the order. } +// QueryStructureOrderFieldNodeScheme represents a field node in the order by clause of a query in Jira. type QueryStructureOrderFieldNodeScheme struct { - Name string `json:"name"` - Property []*QueryPropertyScheme `json:"property"` + Name string `json:"name"` // The name of the field. + Property []*QueryPropertyScheme `json:"property"` // The properties of the field. } +// QueryPropertyScheme represents a property of a field in the order by clause of a query in Jira. type QueryPropertyScheme struct { - Entity string `json:"entity"` - Key string `json:"key"` - Path string `json:"path"` - Type string `json:"type"` + Entity string `json:"entity"` // The entity of the property. + Key string `json:"key"` // The key of the property. + Path string `json:"path"` // The path of the property. + Type string `json:"type"` // The type of the property. } diff --git a/pkg/infra/models/jira_labels.go b/pkg/infra/models/jira_labels.go index 410c0392..cadbc5bd 100644 --- a/pkg/infra/models/jira_labels.go +++ b/pkg/infra/models/jira_labels.go @@ -1,9 +1,10 @@ package models +// IssueLabelsScheme represents the labels of an issue in Jira. type IssueLabelsScheme struct { - MaxResults int `json:"maxResults"` - StartAt int `json:"startAt"` - Total int `json:"total"` - IsLast bool `json:"isLast"` - Values []string `json:"values"` + MaxResults int `json:"maxResults"` // The maximum number of results. + StartAt int `json:"startAt"` // The starting index of the results. + Total int `json:"total"` // The total number of results. + IsLast bool `json:"isLast"` // Indicates if this is the last page of results. + Values []string `json:"values"` // The labels of the issue. } diff --git a/pkg/infra/models/jira_links.go b/pkg/infra/models/jira_links.go index 4cb8dc07..9a8fce29 100644 --- a/pkg/infra/models/jira_links.go +++ b/pkg/infra/models/jira_links.go @@ -1,87 +1,97 @@ package models +// IssueLinkScheme represents a link of an issue in Jira. type IssueLinkScheme struct { - ID string `json:"id,omitempty"` - Type *LinkTypeScheme `json:"type,omitempty"` - InwardIssue *LinkedIssueScheme `json:"inwardIssue,omitempty"` - OutwardIssue *LinkedIssueScheme `json:"outwardIssue,omitempty"` + ID string `json:"id,omitempty"` // The ID of the link. + Type *LinkTypeScheme `json:"type,omitempty"` // The type of the link. + InwardIssue *LinkedIssueScheme `json:"inwardIssue,omitempty"` // The inward issue of the link. + OutwardIssue *LinkedIssueScheme `json:"outwardIssue,omitempty"` // The outward issue of the link. } +// LinkTypeScheme represents the type of a link in Jira. type LinkTypeScheme struct { - Self string `json:"self,omitempty"` - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Inward string `json:"inward,omitempty"` - Outward string `json:"outward,omitempty"` + Self string `json:"self,omitempty"` // The URL of the link type. + ID string `json:"id,omitempty"` // The ID of the link type. + Name string `json:"name,omitempty"` // The name of the link type. + Inward string `json:"inward,omitempty"` // The inward description of the link type. + Outward string `json:"outward,omitempty"` // The outward description of the link type. } +// LinkedIssueScheme represents a linked issue in Jira. type LinkedIssueScheme struct { - ID string `json:"id,omitempty"` - Key string `json:"key,omitempty"` - Self string `json:"self,omitempty"` - Fields *IssueLinkFieldsScheme `json:"fields,omitempty"` + ID string `json:"id,omitempty"` // The ID of the linked issue. + Key string `json:"key,omitempty"` // The key of the linked issue. + Self string `json:"self,omitempty"` // The URL of the linked issue. + Fields *IssueLinkFieldsScheme `json:"fields,omitempty"` // The fields of the linked issue. } +// IssueLinkFieldsScheme represents the fields of a linked issue in Jira. type IssueLinkFieldsScheme struct { - IssueType *IssueTypeScheme `json:"issuetype,omitempty"` - IssueLinks []*IssueLinkScheme `json:"issuelinks,omitempty"` - Watcher *IssueWatcherScheme `json:"watches,omitempty"` - Votes *IssueVoteScheme `json:"votes,omitempty"` - Versions []*VersionScheme `json:"versions,omitempty"` - Project *ProjectScheme `json:"project,omitempty"` - FixVersions []*VersionScheme `json:"fixVersions,omitempty"` - Priority *PriorityScheme `json:"priority,omitempty"` - Components []*ComponentScheme `json:"components,omitempty"` - Creator *UserScheme `json:"creator,omitempty"` - Reporter *UserScheme `json:"reporter,omitempty"` - Assignee *UserScheme `json:"assignee,omitempty"` - Resolution *ResolutionScheme `json:"resolution,omitempty"` - Resolutiondate string `json:"resolutiondate,omitempty"` - Workratio int `json:"workratio,omitempty"` - StatusCategoryChangeDate string `json:"statuscategorychangedate,omitempty"` - LastViewed string `json:"lastViewed,omitempty"` - Summary string `json:"summary,omitempty"` - Created string `json:"created,omitempty"` - Updated string `json:"updated,omitempty"` - Labels []string `json:"labels,omitempty"` - Status *StatusScheme `json:"status,omitempty"` - Security *SecurityScheme `json:"security,omitempty"` + IssueType *IssueTypeScheme `json:"issuetype,omitempty"` // The type of the linked issue. + IssueLinks []*IssueLinkScheme `json:"issuelinks,omitempty"` // The links of the linked issue. + Watcher *IssueWatcherScheme `json:"watches,omitempty"` // The watchers of the linked issue. + Votes *IssueVoteScheme `json:"votes,omitempty"` // The votes for the linked issue. + Versions []*VersionScheme `json:"versions,omitempty"` // The versions of the linked issue. + Project *ProjectScheme `json:"project,omitempty"` // The project of the linked issue. + FixVersions []*VersionScheme `json:"fixVersions,omitempty"` // The fix versions for the linked issue. + Priority *PriorityScheme `json:"priority,omitempty"` // The priority of the linked issue. + Components []*ComponentScheme `json:"components,omitempty"` // The components of the linked issue. + Creator *UserScheme `json:"creator,omitempty"` // The creator of the linked issue. + Reporter *UserScheme `json:"reporter,omitempty"` // The reporter of the linked issue. + Assignee *UserScheme `json:"assignee,omitempty"` // The assignee of the linked issue. + Resolution *ResolutionScheme `json:"resolution,omitempty"` // The resolution of the linked issue. + Resolutiondate string `json:"resolutiondate,omitempty"` // The date the linked issue was resolved. + Workratio int `json:"workratio,omitempty"` // The work ratio of the linked issue. + StatusCategoryChangeDate string `json:"statuscategorychangedate,omitempty"` // The date the status category of the linked issue changed. + LastViewed string `json:"lastViewed,omitempty"` // The last time the linked issue was viewed. + Summary string `json:"summary,omitempty"` // The summary of the linked issue. + Created string `json:"created,omitempty"` // The date the linked issue was created. + Updated string `json:"updated,omitempty"` // The date the linked issue was last updated. + Labels []string `json:"labels,omitempty"` // The labels of the linked issue. + Status *StatusScheme `json:"status,omitempty"` // The status of the linked issue. + Security *SecurityScheme `json:"security,omitempty"` // The security level of the linked issue. } +// LinkPayloadSchemeV3 represents the payload for a version 3 link in Jira. type LinkPayloadSchemeV3 struct { - Comment *CommentPayloadScheme `json:"comment,omitempty"` - InwardIssue *LinkedIssueScheme `json:"inwardIssue,omitempty"` - OutwardIssue *LinkedIssueScheme `json:"outwardIssue,omitempty"` - Type *LinkTypeScheme `json:"type,omitempty"` + Comment *CommentPayloadScheme `json:"comment,omitempty"` // The comment for the link. + InwardIssue *LinkedIssueScheme `json:"inwardIssue,omitempty"` // The inward issue for the link. + OutwardIssue *LinkedIssueScheme `json:"outwardIssue,omitempty"` // The outward issue for the link. + Type *LinkTypeScheme `json:"type,omitempty"` // The type of the link. } +// LinkPayloadSchemeV2 represents the payload for a version 2 link in Jira. type LinkPayloadSchemeV2 struct { - Comment *CommentPayloadSchemeV2 `json:"comment,omitempty"` - InwardIssue *LinkedIssueScheme `json:"inwardIssue,omitempty"` - OutwardIssue *LinkedIssueScheme `json:"outwardIssue,omitempty"` - Type *LinkTypeScheme `json:"type,omitempty"` + Comment *CommentPayloadSchemeV2 `json:"comment,omitempty"` // The comment for the link. + InwardIssue *LinkedIssueScheme `json:"inwardIssue,omitempty"` // The inward issue for the link. + OutwardIssue *LinkedIssueScheme `json:"outwardIssue,omitempty"` // The outward issue for the link. + Type *LinkTypeScheme `json:"type,omitempty"` // The type of the link. } +// IssueLinkPageScheme represents a page of links in Jira. type IssueLinkPageScheme struct { - Expand string `json:"expand,omitempty"` - ID string `json:"id,omitempty"` - Self string `json:"self,omitempty"` - Key string `json:"key,omitempty"` - Fields *IssueLinkFieldScheme `json:"fields,omitempty"` + Expand string `json:"expand,omitempty"` // The expand option for the page. + ID string `json:"id,omitempty"` // The ID of the page. + Self string `json:"self,omitempty"` // The URL of the page. + Key string `json:"key,omitempty"` // The key of the page. + Fields *IssueLinkFieldScheme `json:"fields,omitempty"` // The fields of the page. } +// IssueLinkFieldScheme represents the fields of a page of links in Jira. type IssueLinkFieldScheme struct { - IssueLinks []*IssueLinkScheme `json:"issuelinks,omitempty"` + IssueLinks []*IssueLinkScheme `json:"issuelinks,omitempty"` // The links in the page. } +// IssueLinkTypeSearchScheme represents a search for link types in Jira. type IssueLinkTypeSearchScheme struct { - IssueLinkTypes []*LinkTypeScheme `json:"issueLinkTypes,omitempty"` + IssueLinkTypes []*LinkTypeScheme `json:"issueLinkTypes,omitempty"` // The link types in the search. } +// IssueLinkTypeScheme represents a link type in Jira. type IssueLinkTypeScheme struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Inward string `json:"inward,omitempty"` - Outward string `json:"outward,omitempty"` - Self string `json:"self,omitempty"` + ID string `json:"id,omitempty"` // The ID of the link type. + Name string `json:"name,omitempty"` // The name of the link type. + Inward string `json:"inward,omitempty"` // The inward description of the link type. + Outward string `json:"outward,omitempty"` // The outward description of the link type. + Self string `json:"self,omitempty"` // The URL of the link type. } diff --git a/pkg/infra/models/jira_notification_scheme.go b/pkg/infra/models/jira_notification_scheme.go index df2910fd..b85c2d8b 100644 --- a/pkg/infra/models/jira_notification_scheme.go +++ b/pkg/infra/models/jira_notification_scheme.go @@ -1,57 +1,67 @@ package models +// NotificationSchemeSearchOptions represents the search options for notification schemes in Jira. type NotificationSchemeSearchOptions struct { - NotificationSchemeIDs []string - ProjectIDs []string - OnlyDefault bool - Expand []string + NotificationSchemeIDs []string // The IDs of the notification schemes to search for. + ProjectIDs []string // The IDs of the projects to search for. + OnlyDefault bool // Indicates if only default notification schemes should be searched for. + Expand []string // The fields to expand in the search results. } +// NotificationSchemePayloadScheme represents the payload for a notification scheme in Jira. type NotificationSchemePayloadScheme struct { - Description string `json:"description,omitempty"` - Name string `json:"name,omitempty"` - Events []*NotificationSchemePayloadEventScheme `json:"notificationSchemeEvents,omitempty"` + Description string `json:"description,omitempty"` // The description of the notification scheme. + Name string `json:"name,omitempty"` // The name of the notification scheme. + Events []*NotificationSchemePayloadEventScheme `json:"notificationSchemeEvents,omitempty"` // The events of the notification scheme. } +// NotificationSchemePayloadEventScheme represents an event in the payload for a notification scheme in Jira. type NotificationSchemePayloadEventScheme struct { - Event *NotificationSchemeEventTypeScheme `json:"event,omitempty"` - Notifications []*NotificationSchemeEventNotificationScheme `json:"notifications,omitempty"` + Event *NotificationSchemeEventTypeScheme `json:"event,omitempty"` // The type of the event. + Notifications []*NotificationSchemeEventNotificationScheme `json:"notifications,omitempty"` // The notifications for the event. } +// NotificationSchemeEventTypeScheme represents the type of an event in the payload for a notification scheme in Jira. type NotificationSchemeEventTypeScheme struct { - ID string `json:"id,omitempty"` + ID string `json:"id,omitempty"` // The ID of the event type. } +// NotificationSchemeEventNotificationScheme represents a notification for an event in the payload for a notification scheme in Jira. type NotificationSchemeEventNotificationScheme struct { - NotificationType string `json:"notificationType,omitempty"` - Parameter string `json:"parameter,omitempty"` + NotificationType string `json:"notificationType,omitempty"` // The type of the notification. + Parameter string `json:"parameter,omitempty"` // The parameter for the notification. } +// NotificationSchemePageScheme represents a page of notification schemes in Jira. type NotificationSchemePageScheme struct { - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*NotificationSchemeScheme `json:"values,omitempty"` + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results per page. + StartAt int `json:"startAt,omitempty"` // The starting index of the results. + Total int `json:"total,omitempty"` // The total number of results. + IsLast bool `json:"isLast,omitempty"` // Indicates if this is the last page of results. + Values []*NotificationSchemeScheme `json:"values,omitempty"` // The notification schemes in the page. } +// NotificationSchemeCreatedPayload represents the payload for a created notification scheme in Jira. type NotificationSchemeCreatedPayload struct { - Id string `json:"id"` + Id string `json:"id"` // The ID of the created notification scheme. } +// NotificationSchemeProjectPageScheme represents a page of projects for a notification scheme in Jira. type NotificationSchemeProjectPageScheme struct { - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*NotificationSchemeProjectScheme `json:"values,omitempty"` + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results per page. + StartAt int `json:"startAt,omitempty"` // The starting index of the results. + Total int `json:"total,omitempty"` // The total number of results. + IsLast bool `json:"isLast,omitempty"` // Indicates if this is the last page of results. + Values []*NotificationSchemeProjectScheme `json:"values,omitempty"` // The projects for the notification scheme in the page. } +// NotificationSchemeProjectScheme represents a project for a notification scheme in Jira. type NotificationSchemeProjectScheme struct { - NotificationSchemeId string `json:"notificationSchemeId,omitempty"` - ProjectId string `json:"projectId,omitempty"` + NotificationSchemeId string `json:"notificationSchemeId,omitempty"` // The ID of the notification scheme. + ProjectId string `json:"projectId,omitempty"` // The ID of the project. } +// NotificationSchemeEventsPayloadScheme represents the payload for the events of a notification scheme in Jira. type NotificationSchemeEventsPayloadScheme struct { - NotificationSchemeEvents []*NotificationSchemePayloadEventScheme `json:"notificationSchemeEvents,omitempty"` + NotificationSchemeEvents []*NotificationSchemePayloadEventScheme `json:"notificationSchemeEvents,omitempty"` // The events of the notification scheme. } diff --git a/pkg/infra/models/jira_permission.go b/pkg/infra/models/jira_permission.go index a6ac8c28..c88a2084 100644 --- a/pkg/infra/models/jira_permission.go +++ b/pkg/infra/models/jira_permission.go @@ -1,58 +1,68 @@ package models +// PermissionScheme represents a permission scheme in Jira. type PermissionScheme struct { - Key string `json:"key,omitempty"` - Name string `json:"name,omitempty"` - Type string `json:"type,omitempty"` - Description string `json:"description,omitempty"` + Key string `json:"key,omitempty"` // The key of the permission scheme. + Name string `json:"name,omitempty"` // The name of the permission scheme. + Type string `json:"type,omitempty"` // The type of the permission scheme. + Description string `json:"description,omitempty"` // The description of the permission scheme. } +// PermissionCheckPayload represents the payload for a permission check in Jira. type PermissionCheckPayload struct { - GlobalPermissions []string `json:"globalPermissions,omitempty"` - AccountID string `json:"accountId,omitempty"` - ProjectPermissions []*BulkProjectPermissionsScheme `json:"projectPermissions,omitempty"` + GlobalPermissions []string `json:"globalPermissions,omitempty"` // The global permissions to check. + AccountID string `json:"accountId,omitempty"` // The account ID to check the permissions for. + ProjectPermissions []*BulkProjectPermissionsScheme `json:"projectPermissions,omitempty"` // The project permissions to check. } +// BulkProjectPermissionsScheme represents a bulk of project permissions in Jira. type BulkProjectPermissionsScheme struct { - Issues []int `json:"issues"` - Projects []int `json:"projects"` - Permissions []string `json:"permissions"` + Issues []int `json:"issues"` // The issues to check the permissions for. + Projects []int `json:"projects"` // The projects to check the permissions for. + Permissions []string `json:"permissions"` // The permissions to check. } +// PermissionGrantsScheme represents the grants of a permission in Jira. type PermissionGrantsScheme struct { - ProjectPermissions []*ProjectPermissionGrantsScheme `json:"projectPermissions,omitempty"` - GlobalPermissions []string `json:"globalPermissions,omitempty"` + ProjectPermissions []*ProjectPermissionGrantsScheme `json:"projectPermissions,omitempty"` // The project permission grants. + GlobalPermissions []string `json:"globalPermissions,omitempty"` // The global permission grants. } +// ProjectPermissionGrantsScheme represents the grants of a project permission in Jira. type ProjectPermissionGrantsScheme struct { - Permission string `json:"permission,omitempty"` - Issues []int `json:"issues,omitempty"` - Projects []int `json:"projects,omitempty"` + Permission string `json:"permission,omitempty"` // The permission to grant. + Issues []int `json:"issues,omitempty"` // The issues to grant the permission for. + Projects []int `json:"projects,omitempty"` // The projects to grant the permission for. } +// PermissionSchemeGrantsScheme represents the grants of a permission scheme in Jira. type PermissionSchemeGrantsScheme struct { - Permissions []*PermissionGrantScheme `json:"permissions,omitempty"` - Expand string `json:"expand,omitempty"` + Permissions []*PermissionGrantScheme `json:"permissions,omitempty"` // The permission grants. + Expand string `json:"expand,omitempty"` // The expand option for the permission scheme grants. } +// PermissionGrantScheme represents a grant of a permission in Jira. type PermissionGrantScheme struct { - ID int `json:"id,omitempty"` - Self string `json:"self,omitempty"` - Holder *PermissionGrantHolderScheme `json:"holder,omitempty"` - Permission string `json:"permission,omitempty"` + ID int `json:"id,omitempty"` // The ID of the permission grant. + Self string `json:"self,omitempty"` // The URL of the permission grant. + Holder *PermissionGrantHolderScheme `json:"holder,omitempty"` // The holder of the permission grant. + Permission string `json:"permission,omitempty"` // The permission to grant. } +// PermissionGrantHolderScheme represents a holder of a permission grant in Jira. type PermissionGrantHolderScheme struct { - Type string `json:"type,omitempty"` - Parameter string `json:"parameter,omitempty"` - Expand string `json:"expand,omitempty"` + Type string `json:"type,omitempty"` // The type of the holder. + Parameter string `json:"parameter,omitempty"` // The parameter of the holder. + Expand string `json:"expand,omitempty"` // The expand option for the holder. } +// PermissionGrantPayloadScheme represents the payload for a permission grant in Jira. type PermissionGrantPayloadScheme struct { - Holder *PermissionGrantHolderScheme `json:"holder,omitempty"` - Permission string `json:"permission,omitempty"` + Holder *PermissionGrantHolderScheme `json:"holder,omitempty"` // The holder of the permission grant. + Permission string `json:"permission,omitempty"` // The permission to grant. } +// PermittedProjectsScheme represents the permitted projects of a permission in Jira. type PermittedProjectsScheme struct { - Projects []*ProjectIdentifierScheme `json:"projects,omitempty"` + Projects []*ProjectIdentifierScheme `json:"projects,omitempty"` // The permitted projects. } diff --git a/pkg/infra/models/jira_permission_scheme.go b/pkg/infra/models/jira_permission_scheme.go index b3682327..1c4dba73 100644 --- a/pkg/infra/models/jira_permission_scheme.go +++ b/pkg/infra/models/jira_permission_scheme.go @@ -1,25 +1,28 @@ package models +// PermissionSchemePageScheme represents a page of permission schemes in Jira. type PermissionSchemePageScheme struct { - PermissionSchemes []*PermissionSchemeScheme `json:"permissionSchemes,omitempty"` + PermissionSchemes []*PermissionSchemeScheme `json:"permissionSchemes,omitempty"` // The permission schemes in the page. } +// PermissionSchemeScheme represents a permission scheme in Jira. type PermissionSchemeScheme struct { - Expand string `json:"expand,omitempty"` - ID int `json:"id,omitempty"` - Self string `json:"self,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - Permissions []*PermissionGrantScheme `json:"permissions,omitempty"` - Scope *TeamManagedProjectScopeScheme `json:"scope,omitempty"` + Expand string `json:"expand,omitempty"` // The expand option for the permission scheme. + ID int `json:"id,omitempty"` // The ID of the permission scheme. + Self string `json:"self,omitempty"` // The URL of the permission scheme. + Name string `json:"name,omitempty"` // The name of the permission scheme. + Description string `json:"description,omitempty"` // The description of the permission scheme. + Permissions []*PermissionGrantScheme `json:"permissions,omitempty"` // The permissions of the permission scheme. + Scope *TeamManagedProjectScopeScheme `json:"scope,omitempty"` // The scope of the permission scheme. } +// PermissionScopeItemScheme represents an item in the scope of a permission in Jira. type PermissionScopeItemScheme struct { - Self string `json:"self,omitempty"` - ID string `json:"id,omitempty"` - Key string `json:"key,omitempty"` - Name string `json:"name,omitempty"` - ProjectTypeKey string `json:"projectTypeKey,omitempty"` - Simplified bool `json:"simplified,omitempty"` - ProjectCategory *ProjectCategoryScheme `json:"projectCategory,omitempty"` + Self string `json:"self,omitempty"` // The URL of the item. + ID string `json:"id,omitempty"` // The ID of the item. + Key string `json:"key,omitempty"` // The key of the item. + Name string `json:"name,omitempty"` // The name of the item. + ProjectTypeKey string `json:"projectTypeKey,omitempty"` // The project type key of the item. + Simplified bool `json:"simplified,omitempty"` // Indicates if the item is simplified. + ProjectCategory *ProjectCategoryScheme `json:"projectCategory,omitempty"` // The project category of the item. } diff --git a/pkg/infra/models/jira_priority.go b/pkg/infra/models/jira_priority.go index 61f45b93..d420aa87 100644 --- a/pkg/infra/models/jira_priority.go +++ b/pkg/infra/models/jira_priority.go @@ -1,10 +1,11 @@ package models +// PriorityScheme represents a priority in Jira. type PriorityScheme struct { - Self string `json:"self,omitempty"` - StatusColor string `json:"statusColor,omitempty"` - Description string `json:"description,omitempty"` - IconURL string `json:"iconUrl,omitempty"` - Name string `json:"name,omitempty"` - ID string `json:"id,omitempty"` + Self string `json:"self,omitempty"` // The URL of the priority. + StatusColor string `json:"statusColor,omitempty"` // The status color of the priority. + Description string `json:"description,omitempty"` // The description of the priority. + IconURL string `json:"iconUrl,omitempty"` // The URL of the icon for the priority. + Name string `json:"name,omitempty"` // The name of the priority. + ID string `json:"id,omitempty"` // The ID of the priority. } diff --git a/pkg/infra/models/jira_project.go b/pkg/infra/models/jira_project.go index 2df32a4b..b7151dcc 100644 --- a/pkg/infra/models/jira_project.go +++ b/pkg/infra/models/jira_project.go @@ -18,34 +18,37 @@ const ( SoftwareCompanyManagedScrumProjectTemplate = "com.pyxis.greenhopper.jira:gh-simplified-scrum-classic" ) +// ProjectPayloadScheme represents the payload for a project in Jira. type ProjectPayloadScheme struct { - NotificationScheme int `json:"notificationScheme,omitempty"` - FieldConfigurationScheme int `json:"fieldConfigurationScheme,omitempty"` - IssueSecurityScheme int `json:"issueSecurityScheme,omitempty"` - PermissionScheme int `json:"permissionScheme,omitempty"` - IssueTypeScheme int `json:"issueTypeScheme,omitempty"` - IssueTypeScreenScheme int `json:"issueTypeScreenScheme,omitempty"` - WorkflowScheme int `json:"workflowScheme,omitempty"` - Description string `json:"description,omitempty"` - LeadAccountID string `json:"leadAccountId,omitempty"` - URL string `json:"url,omitempty"` - ProjectTemplateKey string `json:"projectTemplateKey,omitempty"` - AvatarID int `json:"avatarId,omitempty"` - Name string `json:"name,omitempty"` - AssigneeType string `json:"assigneeType,omitempty"` - ProjectTypeKey string `json:"projectTypeKey,omitempty"` - Key string `json:"key,omitempty"` - CategoryID int `json:"categoryId,omitempty"` + NotificationScheme int `json:"notificationScheme,omitempty"` // The ID of the notification scheme for the project. + FieldConfigurationScheme int `json:"fieldConfigurationScheme,omitempty"` // The ID of the field configuration scheme for the project. + IssueSecurityScheme int `json:"issueSecurityScheme,omitempty"` // The ID of the issue security scheme for the project. + PermissionScheme int `json:"permissionScheme,omitempty"` // The ID of the permission scheme for the project. + IssueTypeScheme int `json:"issueTypeScheme,omitempty"` // The ID of the issue type scheme for the project. + IssueTypeScreenScheme int `json:"issueTypeScreenScheme,omitempty"` // The ID of the issue type screen scheme for the project. + WorkflowScheme int `json:"workflowScheme,omitempty"` // The ID of the workflow scheme for the project. + Description string `json:"description,omitempty"` // The description of the project. + LeadAccountID string `json:"leadAccountId,omitempty"` // The account ID of the lead for the project. + URL string `json:"url,omitempty"` // The URL of the project. + ProjectTemplateKey string `json:"projectTemplateKey,omitempty"` // The key of the project template for the project. + AvatarID int `json:"avatarId,omitempty"` // The ID of the avatar for the project. + Name string `json:"name,omitempty"` // The name of the project. + AssigneeType string `json:"assigneeType,omitempty"` // The type of assignee for the project. + ProjectTypeKey string `json:"projectTypeKey,omitempty"` // The key of the project type for the project. + Key string `json:"key,omitempty"` // The key of the project. + CategoryID int `json:"categoryId,omitempty"` // The ID of the category for the project. } +// NewProjectCreatedScheme represents a newly created project in Jira. type NewProjectCreatedScheme struct { - Self string `json:"self"` - ID int `json:"id"` - Key string `json:"key"` + Self string `json:"self"` // The URL of the newly created project. + ID int `json:"id"` // The ID of the newly created project. + Key string `json:"key"` // The key of the newly created project. } +// ProjectSearchOptionsScheme represents the search options for projects in Jira. type ProjectSearchOptionsScheme struct { - OrderBy string + OrderBy string // The order by field for the search. // The project IDs to filter the results by. // To include multiple IDs, provide an ampersand-separated list. @@ -68,7 +71,7 @@ type ProjectSearchOptionsScheme struct { // A complete list of category IDs is found using the Get all project categories operation. CategoryID int - Action string + Action string // The action to perform on the search results. // EXPERIMENTAL. Filter results by project status: // 1. live: Search live projects. @@ -92,115 +95,126 @@ type ProjectSearchOptionsScheme struct { PropertyQuery string } +// ProjectSearchScheme represents the search results for projects in Jira. type ProjectSearchScheme struct { - Self string `json:"self,omitempty"` - NextPage string `json:"nextPage,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*ProjectScheme `json:"values,omitempty"` + Self string `json:"self,omitempty"` // The URL of the search results. + NextPage string `json:"nextPage,omitempty"` // The URL of the next page of search results. + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results per page. + StartAt int `json:"startAt,omitempty"` // The starting index of the results. + Total int `json:"total,omitempty"` // The total number of results. + IsLast bool `json:"isLast,omitempty"` // Indicates if this is the last page of results. + Values []*ProjectScheme `json:"values,omitempty"` // The projects in the search results. } +// ProjectScheme represents a project in Jira. type ProjectScheme struct { - Expand string `json:"expand,omitempty"` - Self string `json:"self,omitempty"` - ID string `json:"id,omitempty"` - Key string `json:"key,omitempty"` - Description string `json:"description,omitempty"` - URL string `json:"url,omitempty"` - Email string `json:"email,omitempty"` - AssigneeType string `json:"assigneeType,omitempty"` - Name string `json:"name,omitempty"` - ProjectTypeKey string `json:"projectTypeKey,omitempty"` - Simplified bool `json:"simplified,omitempty"` - Style string `json:"style,omitempty"` - Favourite bool `json:"favourite,omitempty"` - IsPrivate bool `json:"isPrivate,omitempty"` - UUID string `json:"uuid,omitempty"` - Lead *UserScheme `json:"lead,omitempty"` - Components []*ComponentScheme `json:"components,omitempty"` - IssueTypes []*IssueTypeScheme `json:"issueTypes,omitempty"` - Versions []*VersionScheme `json:"versions,omitempty"` - Roles *ProjectRolesScheme `json:"roles,omitempty"` - AvatarUrls *AvatarURLScheme `json:"avatarUrls,omitempty"` - ProjectKeys []string `json:"projectKeys,omitempty"` - Insight *ProjectInsightScheme `json:"insight,omitempty"` - Category *ProjectCategoryScheme `json:"projectCategory,omitempty"` - Deleted bool `json:"deleted,omitempty"` - RetentionTillDate string `json:"retentionTillDate,omitempty"` - DeletedDate string `json:"deletedDate,omitempty"` - DeletedBy *UserScheme `json:"deletedBy,omitempty"` - Archived bool `json:"archived,omitempty"` - ArchivedDate string `json:"archivedDate,omitempty"` - ArchivedBy *UserScheme `json:"archivedBy,omitempty"` + Expand string `json:"expand,omitempty"` // The fields to expand in the project. + Self string `json:"self,omitempty"` // The URL of the project. + ID string `json:"id,omitempty"` // The ID of the project. + Key string `json:"key,omitempty"` // The key of the project. + Description string `json:"description,omitempty"` // The description of the project. + URL string `json:"url,omitempty"` // The URL of the project. + Email string `json:"email,omitempty"` // The email of the project. + AssigneeType string `json:"assigneeType,omitempty"` // The type of assignee for the project. + Name string `json:"name,omitempty"` // The name of the project. + ProjectTypeKey string `json:"projectTypeKey,omitempty"` // The key of the project type for the project. + Simplified bool `json:"simplified,omitempty"` // Indicates if the project is simplified. + Style string `json:"style,omitempty"` // The style of the project. + Favourite bool `json:"favourite,omitempty"` // Indicates if the project is a favourite. + IsPrivate bool `json:"isPrivate,omitempty"` // Indicates if the project is private. + UUID string `json:"uuid,omitempty"` // The UUID of the project. + Lead *UserScheme `json:"lead,omitempty"` // The lead of the project. + Components []*ComponentScheme `json:"components,omitempty"` // The components of the project. + IssueTypes []*IssueTypeScheme `json:"issueTypes,omitempty"` // The issue types of the project. + Versions []*VersionScheme `json:"versions,omitempty"` // The versions of the project. + Roles *ProjectRolesScheme `json:"roles,omitempty"` // The roles of the project. + AvatarUrls *AvatarURLScheme `json:"avatarUrls,omitempty"` // The avatar URLs of the project. + ProjectKeys []string `json:"projectKeys,omitempty"` // The keys of the project. + Insight *ProjectInsightScheme `json:"insight,omitempty"` // The insight of the project. + Category *ProjectCategoryScheme `json:"projectCategory,omitempty"` // The category of the project. + Deleted bool `json:"deleted,omitempty"` // Indicates if the project is deleted. + RetentionTillDate string `json:"retentionTillDate,omitempty"` // The retention till date of the project. + DeletedDate string `json:"deletedDate,omitempty"` // The date the project was deleted. + DeletedBy *UserScheme `json:"deletedBy,omitempty"` // The user who deleted the project. + Archived bool `json:"archived,omitempty"` // Indicates if the project is archived. + ArchivedDate string `json:"archivedDate,omitempty"` // The date the project was archived. + ArchivedBy *UserScheme `json:"archivedBy,omitempty"` // The user who archived the project. } +// ProjectInsightScheme represents the insight of a project in Jira. type ProjectInsightScheme struct { - TotalIssueCount int `json:"totalIssueCount,omitempty"` - LastIssueUpdateTime string `json:"lastIssueUpdateTime,omitempty"` + TotalIssueCount int `json:"totalIssueCount,omitempty"` // The total number of issues in the project. + LastIssueUpdateTime string `json:"lastIssueUpdateTime,omitempty"` // The last time an issue was updated in the project. } +// ProjectCategoryScheme represents a category of a project in Jira. type ProjectCategoryScheme struct { - Self string `json:"self,omitempty"` - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` + Self string `json:"self,omitempty"` // The URL of the category. + ID string `json:"id,omitempty"` // The ID of the category. + Name string `json:"name,omitempty"` // The name of the category. + Description string `json:"description,omitempty"` // The description of the category. } +// TeamManagedProjectScopeScheme represents the scope of a team-managed project in Jira. type TeamManagedProjectScopeScheme struct { - Type string `json:"type,omitempty"` - Project *ProjectScheme `json:"project,omitempty"` + Type string `json:"type,omitempty"` // The type of the scope. + Project *ProjectScheme `json:"project,omitempty"` // The project in the scope. } +// ProjectUpdateScheme represents the update scheme for a project in Jira. type ProjectUpdateScheme struct { - NotificationScheme int `json:"notificationScheme,omitempty"` - Description string `json:"description,omitempty"` - Lead string `json:"lead,omitempty"` - URL string `json:"url,omitempty"` - ProjectTemplateKey string `json:"projectTemplateKey,omitempty"` - AvatarID int `json:"avatarId,omitempty"` - IssueSecurityScheme int `json:"issueSecurityScheme,omitempty"` - Name string `json:"name,omitempty"` - PermissionScheme int `json:"permissionScheme,omitempty"` - AssigneeType string `json:"assigneeType,omitempty"` - ProjectTypeKey string `json:"projectTypeKey,omitempty"` - Key string `json:"key,omitempty"` - CategoryID int `json:"categoryId,omitempty"` + NotificationScheme int `json:"notificationScheme,omitempty"` // The ID of the notification scheme for the project. + Description string `json:"description,omitempty"` // The description of the project. + Lead string `json:"lead,omitempty"` // The lead of the project. + URL string `json:"url,omitempty"` // The URL of the project. + ProjectTemplateKey string `json:"projectTemplateKey,omitempty"` // The key of the project template for the project. + AvatarID int `json:"avatarId,omitempty"` // The ID of the avatar for the project. + IssueSecurityScheme int `json:"issueSecurityScheme,omitempty"` // The ID of the issue security scheme for the project. + Name string `json:"name,omitempty"` // The name of the project. + PermissionScheme int `json:"permissionScheme,omitempty"` // The ID of the permission scheme for the project. + AssigneeType string `json:"assigneeType,omitempty"` // The type of assignee for the project. + ProjectTypeKey string `json:"projectTypeKey,omitempty"` // The key of the project type for the project. + Key string `json:"key,omitempty"` // The key of the project. + CategoryID int `json:"categoryId,omitempty"` // The ID of the category for the project. } +// ProjectStatusPageScheme represents the status page scheme for a project in Jira. type ProjectStatusPageScheme struct { - Self string `json:"self,omitempty"` - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Subtask bool `json:"subtask,omitempty"` - Statuses []*ProjectStatusDetailsScheme `json:"statuses,omitempty"` + Self string `json:"self,omitempty"` // The URL of the status page. + ID string `json:"id,omitempty"` // The ID of the status page. + Name string `json:"name,omitempty"` // The name of the status page. + Subtask bool `json:"subtask,omitempty"` // Indicates if the status page is a subtask. + Statuses []*ProjectStatusDetailsScheme `json:"statuses,omitempty"` // The statuses in the status page. } +// ProjectStatusDetailsScheme represents the status details scheme for a project in Jira. type ProjectStatusDetailsScheme struct { - Self string `json:"self,omitempty"` - Description string `json:"description,omitempty"` - IconURL string `json:"iconUrl,omitempty"` - Name string `json:"name,omitempty"` - ID string `json:"id,omitempty"` - StatusCategory *StatusCategoryScheme `json:"statusCategory,omitempty"` + Self string `json:"self,omitempty"` // The URL of the status details. + Description string `json:"description,omitempty"` // The description of the status. + IconURL string `json:"iconUrl,omitempty"` // The URL of the icon for the status. + Name string `json:"name,omitempty"` // The name of the status. + ID string `json:"id,omitempty"` // The ID of the status. + StatusCategory *StatusCategoryScheme `json:"statusCategory,omitempty"` // The status category of the status. } +// ProjectHierarchyScheme represents the hierarchy scheme for a project in Jira. type ProjectHierarchyScheme struct { - EntityID string `json:"entityId,omitempty"` - Level int `json:"level,omitempty"` - Name string `json:"name,omitempty"` - IssueTypes []*ProjectHierarchyIssueTypeScheme `json:"issueTypes,omitempty"` + EntityID string `json:"entityId,omitempty"` // The entity ID of the hierarchy. + Level int `json:"level,omitempty"` // The level of the hierarchy. + Name string `json:"name,omitempty"` // The name of the hierarchy. + IssueTypes []*ProjectHierarchyIssueTypeScheme `json:"issueTypes,omitempty"` // The issue types in the hierarchy. } +// ProjectHierarchyIssueTypeScheme represents the hierarchy issue type scheme for a project in Jira. type ProjectHierarchyIssueTypeScheme struct { - ID int `json:"id,omitempty"` - EntityID string `json:"entityId,omitempty"` - Name string `json:"name,omitempty"` - AvatarID int `json:"avatarId,omitempty"` + ID int `json:"id,omitempty"` // The ID of the issue type. + EntityID string `json:"entityId,omitempty"` // The entity ID of the issue type. + Name string `json:"name,omitempty"` // The name of the issue type. + AvatarID int `json:"avatarId,omitempty"` // The ID of the avatar for the issue type. } +// ProjectIdentifierScheme represents the identifier scheme for a project in Jira. type ProjectIdentifierScheme struct { - ID int `json:"id,omitempty"` - Key string `json:"key,omitempty"` + ID int `json:"id,omitempty"` // The ID of the project. + Key string `json:"key,omitempty"` // The key of the project. } diff --git a/pkg/infra/models/jira_project_category.go b/pkg/infra/models/jira_project_category.go index b48245dc..14870ce5 100644 --- a/pkg/infra/models/jira_project_category.go +++ b/pkg/infra/models/jira_project_category.go @@ -1,6 +1,7 @@ package models +// ProjectCategoryPayloadScheme represents the payload for a project category in Jira. type ProjectCategoryPayloadScheme struct { - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` + Name string `json:"name,omitempty"` // The name of the project category. + Description string `json:"description,omitempty"` // The description of the project category. } diff --git a/pkg/infra/models/jira_project_feature.go b/pkg/infra/models/jira_project_feature.go index 8bf0ca45..73da2a37 100644 --- a/pkg/infra/models/jira_project_feature.go +++ b/pkg/infra/models/jira_project_feature.go @@ -1,16 +1,18 @@ package models +// ProjectFeaturesScheme represents the features of a project in Jira. type ProjectFeaturesScheme struct { - Features []*ProjectFeatureScheme `json:"features,omitempty"` + Features []*ProjectFeatureScheme `json:"features,omitempty"` // The features of the project. } +// ProjectFeatureScheme represents a feature of a project in Jira. type ProjectFeatureScheme struct { - ProjectID int `json:"projectId,omitempty"` - State string `json:"state,omitempty"` - ToggleLocked bool `json:"toggleLocked,omitempty"` - Feature string `json:"feature,omitempty"` - Prerequisites []string `json:"prerequisites,omitempty"` - LocalisedName string `json:"localisedName,omitempty"` - LocalisedDescription string `json:"localisedDescription,omitempty"` - ImageURI string `json:"imageUri,omitempty"` + ProjectID int `json:"projectId,omitempty"` // The ID of the project. + State string `json:"state,omitempty"` // The state of the feature. + ToggleLocked bool `json:"toggleLocked,omitempty"` // Indicates if the feature is locked. + Feature string `json:"feature,omitempty"` // The name of the feature. + Prerequisites []string `json:"prerequisites,omitempty"` // The prerequisites of the feature. + LocalisedName string `json:"localisedName,omitempty"` // The localized name of the feature. + LocalisedDescription string `json:"localisedDescription,omitempty"` // The localized description of the feature. + ImageURI string `json:"imageUri,omitempty"` // The URI of the feature image. } diff --git a/pkg/infra/models/jira_project_notification.go b/pkg/infra/models/jira_project_notification.go index aa941ac5..80b615bf 100644 --- a/pkg/infra/models/jira_project_notification.go +++ b/pkg/infra/models/jira_project_notification.go @@ -1,36 +1,40 @@ package models +// NotificationSchemeScheme represents a notification scheme in Jira. type NotificationSchemeScheme struct { - Expand string `json:"expand,omitempty"` - ID int `json:"id,omitempty"` - Self string `json:"self,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - NotificationSchemeEvents []*ProjectNotificationSchemeEventScheme `json:"notificationSchemeEvents,omitempty"` - Scope *TeamManagedProjectScopeScheme `json:"scope,omitempty"` - Projects []int `json:"projects,omitempty"` + Expand string `json:"expand,omitempty"` // The expand field for the notification scheme. + ID int `json:"id,omitempty"` // The ID of the notification scheme. + Self string `json:"self,omitempty"` // The URL of the notification scheme. + Name string `json:"name,omitempty"` // The name of the notification scheme. + Description string `json:"description,omitempty"` // The description of the notification scheme. + NotificationSchemeEvents []*ProjectNotificationSchemeEventScheme `json:"notificationSchemeEvents,omitempty"` // The events of the notification scheme. + Scope *TeamManagedProjectScopeScheme `json:"scope,omitempty"` // The scope of the notification scheme. + Projects []int `json:"projects,omitempty"` // The projects associated with the notification scheme. } +// ProjectNotificationSchemeEventScheme represents an event in a project notification scheme in Jira. type ProjectNotificationSchemeEventScheme struct { - Event *NotificationEventScheme `json:"event,omitempty"` - Notifications []*EventNotificationScheme `json:"notifications,omitempty"` + Event *NotificationEventScheme `json:"event,omitempty"` // The event of the project notification scheme. + Notifications []*EventNotificationScheme `json:"notifications,omitempty"` // The notifications of the project notification scheme. } +// NotificationEventScheme represents a notification event in Jira. type NotificationEventScheme struct { - ID int `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - TemplateEvent *NotificationEventScheme `json:"templateEvent,omitempty"` + ID int `json:"id,omitempty"` // The ID of the notification event. + Name string `json:"name,omitempty"` // The name of the notification event. + Description string `json:"description,omitempty"` // The description of the notification event. + TemplateEvent *NotificationEventScheme `json:"templateEvent,omitempty"` // The template event of the notification event. } +// EventNotificationScheme represents an event notification in Jira. type EventNotificationScheme struct { - Expand string `json:"expand,omitempty"` - ID int `json:"id,omitempty"` - NotificationType string `json:"notificationType,omitempty"` - Parameter string `json:"parameter,omitempty"` - EmailAddress string `json:"emailAddress,omitempty"` - Group *GroupScheme `json:"group,omitempty"` - Field *IssueFieldScheme `json:"field,omitempty"` - ProjectRole *ProjectRoleScheme `json:"projectRole,omitempty"` - User *UserScheme `json:"user,omitempty"` + Expand string `json:"expand,omitempty"` // The expand field for the event notification. + ID int `json:"id,omitempty"` // The ID of the event notification. + NotificationType string `json:"notificationType,omitempty"` // The type of the event notification. + Parameter string `json:"parameter,omitempty"` // The parameter of the event notification. + EmailAddress string `json:"emailAddress,omitempty"` // The email address associated with the event notification. + Group *GroupScheme `json:"group,omitempty"` // The group associated with the event notification. + Field *IssueFieldScheme `json:"field,omitempty"` // The field associated with the event notification. + ProjectRole *ProjectRoleScheme `json:"projectRole,omitempty"` // The project role associated with the event notification. + User *UserScheme `json:"user,omitempty"` // The user associated with the event notification. } diff --git a/pkg/infra/models/jira_project_property.go b/pkg/infra/models/jira_project_property.go index 410bb479..998cdc1d 100644 --- a/pkg/infra/models/jira_project_property.go +++ b/pkg/infra/models/jira_project_property.go @@ -1,15 +1,18 @@ package models +// PropertyPageScheme represents a page of properties in Jira. type PropertyPageScheme struct { - Keys []*PropertyScheme `json:"keys,omitempty"` + Keys []*PropertyScheme `json:"keys,omitempty"` // The keys of the properties on the page. } +// PropertyScheme represents a property in Jira. type PropertyScheme struct { - Self string `json:"self,omitempty"` - Key string `json:"key,omitempty"` + Self string `json:"self,omitempty"` // The URL of the property. + Key string `json:"key,omitempty"` // The key of the property. } +// EntityPropertyScheme represents an entity property in Jira. type EntityPropertyScheme struct { - Key string `json:"key"` - Value interface{} `json:"value"` + Key string `json:"key"` // The key of the entity property. + Value interface{} `json:"value"` // The value of the entity property. } diff --git a/pkg/infra/models/jira_project_role.go b/pkg/infra/models/jira_project_role.go index f0f8cd39..5db316fb 100644 --- a/pkg/infra/models/jira_project_role.go +++ b/pkg/infra/models/jira_project_role.go @@ -1,18 +1,20 @@ package models +// ProjectRoleDetailScheme represents the details of a project role in Jira. type ProjectRoleDetailScheme struct { - Self string `json:"self,omitempty"` - Name string `json:"name,omitempty"` - ID int `json:"id,omitempty"` - Description string `json:"description,omitempty"` - Admin bool `json:"admin,omitempty"` - Scope *TeamManagedProjectScopeScheme `json:"scope,omitempty"` - RoleConfigurable bool `json:"roleConfigurable,omitempty"` - TranslatedName string `json:"translatedName,omitempty"` - Default bool `json:"default,omitempty"` + Self string `json:"self,omitempty"` // The URL of the project role. + Name string `json:"name,omitempty"` // The name of the project role. + ID int `json:"id,omitempty"` // The ID of the project role. + Description string `json:"description,omitempty"` // The description of the project role. + Admin bool `json:"admin,omitempty"` // Indicates if the project role has admin privileges. + Scope *TeamManagedProjectScopeScheme `json:"scope,omitempty"` // The scope of the project role. + RoleConfigurable bool `json:"roleConfigurable,omitempty"` // Indicates if the project role is configurable. + TranslatedName string `json:"translatedName,omitempty"` // The translated name of the project role. + Default bool `json:"default,omitempty"` // Indicates if the project role is the default role. } +// ProjectRolePayloadScheme represents the payload for a project role in Jira. type ProjectRolePayloadScheme struct { - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` + Name string `json:"name,omitempty"` // The name of the project role. + Description string `json:"description,omitempty"` // The description of the project role. } diff --git a/pkg/infra/models/jira_project_type.go b/pkg/infra/models/jira_project_type.go index 03997062..df369a80 100644 --- a/pkg/infra/models/jira_project_type.go +++ b/pkg/infra/models/jira_project_type.go @@ -1,9 +1,10 @@ package models +// ProjectTypeScheme represents a project type in Jira. type ProjectTypeScheme struct { - Key string `json:"key"` - FormattedKey string `json:"formattedKey"` - DescriptionI18NKey string `json:"descriptionI18nKey"` - Icon string `json:"icon"` - Color string `json:"color"` + Key string `json:"key"` // The key of the project type. + FormattedKey string `json:"formattedKey"` // The formatted key of the project type. + DescriptionI18NKey string `json:"descriptionI18nKey"` // The internationalized description key of the project type. + Icon string `json:"icon"` // The icon of the project type. + Color string `json:"color"` // The color associated with the project type. } diff --git a/pkg/infra/models/jira_project_validation.go b/pkg/infra/models/jira_project_validation.go index 643ab7f7..e10eb59c 100644 --- a/pkg/infra/models/jira_project_validation.go +++ b/pkg/infra/models/jira_project_validation.go @@ -1,8 +1,9 @@ package models +// ProjectValidationMessageScheme represents a validation message for a project in Jira. type ProjectValidationMessageScheme struct { - ErrorMessages []string `json:"errorMessages"` + ErrorMessages []string `json:"errorMessages"` // The error messages of the project validation. Errors struct { - ProjectKey string `json:"projectKey"` - } `json:"errors"` + ProjectKey string `json:"projectKey"` // The key of the project that has errors. + } `json:"errors"` // The errors of the project validation. } diff --git a/pkg/infra/models/jira_remote_links.go b/pkg/infra/models/jira_remote_links.go index b6509c27..ba4b92b7 100644 --- a/pkg/infra/models/jira_remote_links.go +++ b/pkg/infra/models/jira_remote_links.go @@ -1,39 +1,45 @@ package models +// RemoteLinkIdentify represents the identification of a remote link in Jira. type RemoteLinkIdentify struct { - ID int `json:"id,omitempty"` - Self string `json:"self,omitempty"` + ID int `json:"id,omitempty"` // The ID of the remote link. + Self string `json:"self,omitempty"` // The URL of the remote link. } +// RemoteLinkScheme represents a remote link in Jira. type RemoteLinkScheme struct { - Application *RemoteLinkApplicationScheme `json:"application,omitempty"` - GlobalID string `json:"globalId,omitempty"` - ID int `json:"id,omitempty"` - Object *RemoteLinkObjectScheme `json:"object,omitempty"` - Relationship string `json:"relationship,omitempty"` - Self string `json:"self,omitempty"` + Application *RemoteLinkApplicationScheme `json:"application,omitempty"` // The application associated with the remote link. + GlobalID string `json:"globalId,omitempty"` // The global ID of the remote link. + ID int `json:"id,omitempty"` // The ID of the remote link. + Object *RemoteLinkObjectScheme `json:"object,omitempty"` // The object associated with the remote link. + Relationship string `json:"relationship,omitempty"` // The relationship of the remote link. + Self string `json:"self,omitempty"` // The URL of the remote link. } +// RemoteLinkObjectScheme represents an object in a remote link in Jira. type RemoteLinkObjectScheme struct { - Icon *RemoteLinkObjectLinkScheme `json:"icon,omitempty"` - Status *RemoteLinkObjectStatusScheme `json:"status,omitempty"` - Summary string `json:"summary,omitempty"` - Title string `json:"title,omitempty"` - URL string `json:"url,omitempty"` + Icon *RemoteLinkObjectLinkScheme `json:"icon,omitempty"` // The icon of the remote link object. + Status *RemoteLinkObjectStatusScheme `json:"status,omitempty"` // The status of the remote link object. + Summary string `json:"summary,omitempty"` // The summary of the remote link object. + Title string `json:"title,omitempty"` // The title of the remote link object. + URL string `json:"url,omitempty"` // The URL of the remote link object. } +// RemoteLinkObjectStatusScheme represents the status of an object in a remote link in Jira. type RemoteLinkObjectStatusScheme struct { - Icon *RemoteLinkObjectLinkScheme `json:"icon,omitempty"` - Resolved bool `json:"resolved,omitempty"` + Icon *RemoteLinkObjectLinkScheme `json:"icon,omitempty"` // The icon of the remote link object status. + Resolved bool `json:"resolved,omitempty"` // Indicates if the remote link object status is resolved. } +// RemoteLinkObjectLinkScheme represents a link of an object in a remote link in Jira. type RemoteLinkObjectLinkScheme struct { - Link string `json:"link,omitempty"` - Title string `json:"title,omitempty"` - URL16X16 string `json:"url16x16,omitempty"` + Link string `json:"link,omitempty"` // The link of the remote link object. + Title string `json:"title,omitempty"` // The title of the remote link object link. + URL16X16 string `json:"url16x16,omitempty"` // The 16x16 URL of the remote link object link. } +// RemoteLinkApplicationScheme represents an application in a remote link in Jira. type RemoteLinkApplicationScheme struct { - Name string `json:"name,omitempty"` - Type string `json:"type,omitempty"` + Name string `json:"name,omitempty"` // The name of the remote link application. + Type string `json:"type,omitempty"` // The type of the remote link application. } diff --git a/pkg/infra/models/jira_resolution.go b/pkg/infra/models/jira_resolution.go index 2299f47a..d0636e01 100644 --- a/pkg/infra/models/jira_resolution.go +++ b/pkg/infra/models/jira_resolution.go @@ -1,8 +1,9 @@ package models +// ResolutionScheme represents a resolution in Jira. type ResolutionScheme struct { - Self string `json:"self"` - ID string `json:"id"` - Description string `json:"description"` - Name string `json:"name"` + Self string `json:"self"` // The URL of the resolution. + ID string `json:"id"` // The ID of the resolution. + Description string `json:"description"` // The description of the resolution. + Name string `json:"name"` // The name of the resolution. } diff --git a/pkg/infra/models/jira_role.go b/pkg/infra/models/jira_role.go index 907189b8..1ab6833f 100644 --- a/pkg/infra/models/jira_role.go +++ b/pkg/infra/models/jira_role.go @@ -1,36 +1,40 @@ package models +// ProjectRolesScheme represents the roles of a project in Jira. type ProjectRolesScheme struct { - AtlassianAddonsProjectAccess string `json:"atlassian-addons-project-access,omitempty"` - ServiceDeskTeam string `json:"Service Desk Team,omitempty"` - ServiceDeskCustomers string `json:"Service Desk Customers,omitempty"` - Administrators string `json:"Administrators,omitempty"` + AtlassianAddonsProjectAccess string `json:"atlassian-addons-project-access,omitempty"` // The access of Atlassian addons in the project. + ServiceDeskTeam string `json:"Service Desk Team,omitempty"` // The team of the service desk in the project. + ServiceDeskCustomers string `json:"Service Desk Customers,omitempty"` // The customers of the service desk in the project. + Administrators string `json:"Administrators,omitempty"` // The administrators of the project. } +// ProjectRoleScheme represents a role in a project in Jira. type ProjectRoleScheme struct { - Self string `json:"self,omitempty"` - Name string `json:"name,omitempty"` - ID int `json:"id,omitempty"` - Description string `json:"description,omitempty"` - Actors []*RoleActorScheme `json:"actors,omitempty"` - Scope *TeamManagedProjectScopeScheme `json:"scope,omitempty"` - TranslatedName string `json:"translatedName,omitempty"` - CurrentUserRole bool `json:"currentUserRole,omitempty"` - Admin bool `json:"admin,omitempty"` - RoleConfigurable bool `json:"roleConfigurable,omitempty"` - Default bool `json:"default,omitempty"` + Self string `json:"self,omitempty"` // The URL of the project role. + Name string `json:"name,omitempty"` // The name of the project role. + ID int `json:"id,omitempty"` // The ID of the project role. + Description string `json:"description,omitempty"` // The description of the project role. + Actors []*RoleActorScheme `json:"actors,omitempty"` // The actors of the project role. + Scope *TeamManagedProjectScopeScheme `json:"scope,omitempty"` // The scope of the project role. + TranslatedName string `json:"translatedName,omitempty"` // The translated name of the project role. + CurrentUserRole bool `json:"currentUserRole,omitempty"` // Indicates if the current user has this role. + Admin bool `json:"admin,omitempty"` // Indicates if the project role has admin privileges. + RoleConfigurable bool `json:"roleConfigurable,omitempty"` // Indicates if the project role is configurable. + Default bool `json:"default,omitempty"` // Indicates if the project role is the default role. } +// RoleActorScheme represents an actor in a role in a project in Jira. type RoleActorScheme struct { - ID int `json:"id,omitempty"` - DisplayName string `json:"displayName,omitempty"` - Type string `json:"type,omitempty"` - Name string `json:"name,omitempty"` - AvatarURL string `json:"avatarUrl,omitempty"` - ActorGroup *GroupScheme `json:"actorGroup,omitempty"` - ActorUser *RoleActorUserScheme `json:"actorUser,omitempty"` + ID int `json:"id,omitempty"` // The ID of the role actor. + DisplayName string `json:"displayName,omitempty"` // The display name of the role actor. + Type string `json:"type,omitempty"` // The type of the role actor. + Name string `json:"name,omitempty"` // The name of the role actor. + AvatarURL string `json:"avatarUrl,omitempty"` // The avatar URL of the role actor. + ActorGroup *GroupScheme `json:"actorGroup,omitempty"` // The group of the role actor. + ActorUser *RoleActorUserScheme `json:"actorUser,omitempty"` // The user of the role actor. } +// RoleActorUserScheme represents a user in a role actor in a project in Jira. type RoleActorUserScheme struct { - AccountID string `json:"accountId,omitempty"` + AccountID string `json:"accountId,omitempty"` // The account ID of the role actor user. } diff --git a/pkg/infra/models/jira_screen.go b/pkg/infra/models/jira_screen.go index 4f497c72..d8f69256 100644 --- a/pkg/infra/models/jira_screen.go +++ b/pkg/infra/models/jira_screen.go @@ -1,67 +1,75 @@ package models +// ScreenParamsScheme represents the parameters for a screen in Jira. type ScreenParamsScheme struct { - // The list of screen IDs + // IDs is the list of screen IDs IDs []int - // String used to perform a case-insensitive partial match with screen name. + // QueryString is used to perform a case-insensitive partial match with screen name. QueryString string - // The scope filter string. To filter by multiple scope, + // Scope is used to filter by multiple scopes. Scope []string - // Order the results by a field: + // OrderBy is used to order the results by a field: // 1. id Sorts by screen ID. // 2. name Sorts by screen name. OrderBy string } +// ScreenScheme represents a screen in Jira. type ScreenScheme struct { - ID int `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - Scope *TeamManagedProjectScopeScheme `json:"scope,omitempty"` + ID int `json:"id,omitempty"` // The ID of the screen. + Name string `json:"name,omitempty"` // The name of the screen. + Description string `json:"description,omitempty"` // The description of the screen. + Scope *TeamManagedProjectScopeScheme `json:"scope,omitempty"` // The scope of the screen. } +// ScreenFieldPageScheme represents a page of screen fields in Jira. type ScreenFieldPageScheme struct { - Self string `json:"self,omitempty"` - NextPage string `json:"nextPage,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*ScreenWithTabScheme `json:"values,omitempty"` + Self string `json:"self,omitempty"` // The URL of the screen field page. + NextPage string `json:"nextPage,omitempty"` // The URL of the next page. + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results per page. + StartAt int `json:"startAt,omitempty"` // The index of the first item returned in the page. + Total int `json:"total,omitempty"` // The total number of items available. + IsLast bool `json:"isLast,omitempty"` // Indicates if this is the last page. + Values []*ScreenWithTabScheme `json:"values,omitempty"` // The screen fields in the page. } +// ScreenWithTabScheme represents a screen with a tab in Jira. type ScreenWithTabScheme struct { - ID int `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - Scope *TeamManagedProjectScopeScheme `json:"scope,omitempty"` - Tab *ScreenTabScheme `json:"tab,omitempty"` + ID int `json:"id,omitempty"` // The ID of the screen. + Name string `json:"name,omitempty"` // The name of the screen. + Description string `json:"description,omitempty"` // The description of the screen. + Scope *TeamManagedProjectScopeScheme `json:"scope,omitempty"` // The scope of the screen. + Tab *ScreenTabScheme `json:"tab,omitempty"` // The tab of the screen. } +// ScreenSearchPageScheme represents a page of screens in a search in Jira. type ScreenSearchPageScheme struct { - Self string `json:"self,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*ScreenScheme `json:"values,omitempty"` + Self string `json:"self,omitempty"` // The URL of the screen search page. + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results per page. + StartAt int `json:"startAt,omitempty"` // The index of the first item returned in the page. + Total int `json:"total,omitempty"` // The total number of items available. + IsLast bool `json:"isLast,omitempty"` // Indicates if this is the last page. + Values []*ScreenScheme `json:"values,omitempty"` // The screens in the page. } +// AvailableScreenFieldScheme represents an available field in a screen in Jira. type AvailableScreenFieldScheme struct { - ID string `json:"id"` - Name string `json:"name"` + ID string `json:"id"` // The ID of the field. + Name string `json:"name"` // The name of the field. } +// ScreenTabScheme represents a tab in a screen in Jira. type ScreenTabScheme struct { - ID int `json:"id"` - Name string `json:"name"` + ID int `json:"id"` // The ID of the tab. + Name string `json:"name"` // The name of the tab. } +// ScreenTabFieldScheme represents a field in a tab in a screen in Jira. type ScreenTabFieldScheme struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` + ID string `json:"id,omitempty"` // The ID of the field. + Name string `json:"name,omitempty"` // The name of the field. } diff --git a/pkg/infra/models/jira_screen_scheme.go b/pkg/infra/models/jira_screen_scheme.go index 37edcabc..e3ece130 100644 --- a/pkg/infra/models/jira_screen_scheme.go +++ b/pkg/infra/models/jira_screen_scheme.go @@ -1,50 +1,56 @@ package models +// ScreenSchemePageScheme represents a page of screen schemes in Jira. type ScreenSchemePageScheme struct { - Self string `json:"self,omitempty"` - NextPage string `json:"nextPage,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*ScreenSchemeScheme `json:"values,omitempty"` + Self string `json:"self,omitempty"` // The URL of the screen scheme page. + NextPage string `json:"nextPage,omitempty"` // The URL of the next page. + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results per page. + StartAt int `json:"startAt,omitempty"` // The index of the first item returned in the page. + Total int `json:"total,omitempty"` // The total number of items available. + IsLast bool `json:"isLast,omitempty"` // Indicates if this is the last page. + Values []*ScreenSchemeScheme `json:"values,omitempty"` // The screen schemes in the page. } +// ScreenSchemeScheme represents a screen scheme in Jira. type ScreenSchemeScheme struct { - ID int `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - Screens *ScreenTypesScheme `json:"screens,omitempty"` - IssueTypeScreenSchemes *IssueTypeSchemePageScheme `json:"issueTypeScreenSchemes,omitempty"` + ID int `json:"id,omitempty"` // The ID of the screen scheme. + Name string `json:"name,omitempty"` // The name of the screen scheme. + Description string `json:"description,omitempty"` // The description of the screen scheme. + Screens *ScreenTypesScheme `json:"screens,omitempty"` // The types of screens in the screen scheme. + IssueTypeScreenSchemes *IssueTypeSchemePageScheme `json:"issueTypeScreenSchemes,omitempty"` // The issue type screen schemes in the screen scheme. } +// ScreenTypesScheme represents the types of screens in a screen scheme in Jira. type ScreenTypesScheme struct { - Create int `json:"create,omitempty"` - Default int `json:"default,omitempty"` - View int `json:"view,omitempty"` - Edit int `json:"edit,omitempty"` + Create int `json:"create,omitempty"` // The ID of the create screen. + Default int `json:"default,omitempty"` // The ID of the default screen. + View int `json:"view,omitempty"` // The ID of the view screen. + Edit int `json:"edit,omitempty"` // The ID of the edit screen. } +// IssueTypeSchemePageScheme represents a page of issue type schemes in Jira. type IssueTypeSchemePageScheme struct { - Self string `json:"self,omitempty"` - NextPage string `json:"nextPage,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*IssueTypeSchemeScheme `json:"values,omitempty"` + Self string `json:"self,omitempty"` // The URL of the issue type scheme page. + NextPage string `json:"nextPage,omitempty"` // The URL of the next page. + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results per page. + StartAt int `json:"startAt,omitempty"` // The index of the first item returned in the page. + Total int `json:"total,omitempty"` // The total number of items available. + IsLast bool `json:"isLast,omitempty"` // Indicates if this is the last page. + Values []*IssueTypeSchemeScheme `json:"values,omitempty"` // The issue type schemes in the page. } +// IssueTypeSchemeScheme represents an issue type scheme in Jira. type IssueTypeSchemeScheme struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - DefaultIssueTypeID string `json:"defaultIssueTypeId,omitempty"` - IsDefault bool `json:"isDefault,omitempty"` + ID string `json:"id,omitempty"` // The ID of the issue type scheme. + Name string `json:"name,omitempty"` // The name of the issue type scheme. + Description string `json:"description,omitempty"` // The description of the issue type scheme. + DefaultIssueTypeID string `json:"defaultIssueTypeId,omitempty"` // The ID of the default issue type in the scheme. + IsDefault bool `json:"isDefault,omitempty"` // Indicates if this is the default issue type scheme. } +// ScreenSchemePayloadScheme represents the payload for a screen scheme in Jira. type ScreenSchemePayloadScheme struct { - Screens *ScreenTypesScheme `json:"screens,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` + Screens *ScreenTypesScheme `json:"screens,omitempty"` // The types of screens in the screen scheme. + Name string `json:"name,omitempty"` // The name of the screen scheme. + Description string `json:"description,omitempty"` // The description of the screen scheme. } diff --git a/pkg/infra/models/jira_search_v2.go b/pkg/infra/models/jira_search_v2.go index 6f8645c0..af7a04f6 100644 --- a/pkg/infra/models/jira_search_v2.go +++ b/pkg/infra/models/jira_search_v2.go @@ -1,10 +1,11 @@ package models +// IssueSearchSchemeV2 represents the results of an issue search in Jira. type IssueSearchSchemeV2 struct { - Expand string `json:"expand,omitempty"` - StartAt int `json:"startAt,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - Total int `json:"total,omitempty"` - Issues []*IssueSchemeV2 `json:"issues,omitempty"` - WarningMessages []string `json:"warningMessages,omitempty"` + Expand string `json:"expand,omitempty"` // The fields that are expanded in the results. + StartAt int `json:"startAt,omitempty"` // The index of the first result returned. + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results returned. + Total int `json:"total,omitempty"` // The total number of results available. + Issues []*IssueSchemeV2 `json:"issues,omitempty"` // The issues returned in the results. + WarningMessages []string `json:"warningMessages,omitempty"` // Any warning messages generated during the search. } diff --git a/pkg/infra/models/jira_search_v3.go b/pkg/infra/models/jira_search_v3.go index 5e4d849e..352d9b56 100644 --- a/pkg/infra/models/jira_search_v3.go +++ b/pkg/infra/models/jira_search_v3.go @@ -1,15 +1,17 @@ package models +// IssueSearchScheme represents the results of an issue search in Jira. type IssueSearchScheme struct { - Expand string `json:"expand,omitempty"` - StartAt int `json:"startAt,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - Total int `json:"total,omitempty"` - Issues []*IssueScheme `json:"issues,omitempty"` - WarningMessages []string `json:"warningMessages,omitempty"` + Expand string `json:"expand,omitempty"` // The fields that are expanded in the results. + StartAt int `json:"startAt,omitempty"` // The index of the first result returned. + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results returned. + Total int `json:"total,omitempty"` // The total number of results available. + Issues []*IssueScheme `json:"issues,omitempty"` // The issues returned in the results. + WarningMessages []string `json:"warningMessages,omitempty"` // Any warning messages generated during the search. } +// IssueTransitionsScheme represents the transitions of an issue in Jira. type IssueTransitionsScheme struct { - Expand string `json:"expand,omitempty"` - Transitions []*IssueTransitionScheme `json:"transitions,omitempty"` + Expand string `json:"expand,omitempty"` // The fields that are expanded in the results. + Transitions []*IssueTransitionScheme `json:"transitions,omitempty"` // The transitions of the issue. } diff --git a/pkg/infra/models/jira_security.go b/pkg/infra/models/jira_security.go index abeba404..0e89047a 100644 --- a/pkg/infra/models/jira_security.go +++ b/pkg/infra/models/jira_security.go @@ -1,8 +1,9 @@ package models +// SecurityScheme represents a security scheme in Jira. type SecurityScheme struct { - Self string `json:"self,omitempty"` - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` + Self string `json:"self,omitempty"` // The URL of the security scheme. + ID string `json:"id,omitempty"` // The ID of the security scheme. + Name string `json:"name,omitempty"` // The name of the security scheme. + Description string `json:"description,omitempty"` // The description of the security scheme. } diff --git a/pkg/infra/models/jira_server.go b/pkg/infra/models/jira_server.go index b1719e76..b08d6363 100644 --- a/pkg/infra/models/jira_server.go +++ b/pkg/infra/models/jira_server.go @@ -1,20 +1,22 @@ package models +// ServerInformationScheme represents the server information in Jira. type ServerInformationScheme struct { - BaseURL string `json:"baseUrl,omitempty"` - Version string `json:"version,omitempty"` - VersionNumbers []int `json:"versionNumbers,omitempty"` - DeploymentType string `json:"deploymentType,omitempty"` - BuildNumber int `json:"buildNumber,omitempty"` - BuildDate string `json:"buildDate,omitempty"` - ServerTime string `json:"serverTime,omitempty"` - ScmInfo string `json:"scmInfo,omitempty"` - ServerTitle string `json:"serverTitle,omitempty"` - HealthChecks []*ServerHealthCheckScheme `json:"healthChecks,omitempty"` + BaseURL string `json:"baseUrl,omitempty"` // The base URL of the Jira server. + Version string `json:"version,omitempty"` // The version of the Jira server. + VersionNumbers []int `json:"versionNumbers,omitempty"` // The version numbers of the Jira server. + DeploymentType string `json:"deploymentType,omitempty"` // The deployment type of the Jira server. + BuildNumber int `json:"buildNumber,omitempty"` // The build number of the Jira server. + BuildDate string `json:"buildDate,omitempty"` // The build date of the Jira server. + ServerTime string `json:"serverTime,omitempty"` // The server time of the Jira server. + ScmInfo string `json:"scmInfo,omitempty"` // The SCM information of the Jira server. + ServerTitle string `json:"serverTitle,omitempty"` // The server title of the Jira server. + HealthChecks []*ServerHealthCheckScheme `json:"healthChecks,omitempty"` // The health checks of the Jira server. } +// ServerHealthCheckScheme represents a health check of a server in Jira. type ServerHealthCheckScheme struct { - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - Passed bool `json:"passed,omitempty"` + Name string `json:"name,omitempty"` // The name of the health check. + Description string `json:"description,omitempty"` // The description of the health check. + Passed bool `json:"passed,omitempty"` // Indicates if the health check passed. } diff --git a/pkg/infra/models/jira_task.go b/pkg/infra/models/jira_task.go index 3e374325..c898c40b 100644 --- a/pkg/infra/models/jira_task.go +++ b/pkg/infra/models/jira_task.go @@ -1,16 +1,17 @@ package models +// TaskScheme represents a task in Jira. type TaskScheme struct { - Self string `json:"self"` - ID string `json:"id"` - Description string `json:"description"` - Status string `json:"status"` - Result string `json:"result"` - SubmittedBy int `json:"submittedBy"` - Progress int `json:"progress"` - ElapsedRuntime int `json:"elapsedRuntime"` - Submitted int64 `json:"submitted"` - Started int64 `json:"started"` - Finished int64 `json:"finished"` - LastUpdate int64 `json:"lastUpdate"` + Self string `json:"self"` // The URL of the task. + ID string `json:"id"` // The ID of the task. + Description string `json:"description"` // The description of the task. + Status string `json:"status"` // The status of the task. + Result string `json:"result"` // The result of the task. + SubmittedBy int `json:"submittedBy"` // The ID of the user who submitted the task. + Progress int `json:"progress"` // The progress of the task. + ElapsedRuntime int `json:"elapsedRuntime"` // The elapsed runtime of the task. + Submitted int64 `json:"submitted"` // The timestamp when the task was submitted. + Started int64 `json:"started"` // The timestamp when the task started. + Finished int64 `json:"finished"` // The timestamp when the task finished. + LastUpdate int64 `json:"lastUpdate"` // The timestamp of the last update to the task. } diff --git a/pkg/infra/models/jira_teams.go b/pkg/infra/models/jira_teams.go index 86543a7b..09c842dc 100644 --- a/pkg/infra/models/jira_teams.go +++ b/pkg/infra/models/jira_teams.go @@ -1,44 +1,51 @@ package models +// JiraTeamPageScheme represents a page of teams in Jira. type JiraTeamPageScheme struct { - MoreResultsAvailable bool `json:"moreResultsAvailable,omitempty"` - Teams []*JiraTeamScheme `json:"teams,omitempty"` - Persons []*JiraTeamPersonScheme `json:"persons,omitempty"` - ZeroMemberTeamsCount int `json:"zeroMemberTeamsCount,omitempty"` + MoreResultsAvailable bool `json:"moreResultsAvailable,omitempty"` // Indicates if more results are available. + Teams []*JiraTeamScheme `json:"teams,omitempty"` // The teams on the page. + Persons []*JiraTeamPersonScheme `json:"persons,omitempty"` // The persons on the page. + ZeroMemberTeamsCount int `json:"zeroMemberTeamsCount,omitempty"` // The count of teams with zero members. } +// JiraTeamScheme represents a team in Jira. type JiraTeamScheme struct { - Id int `json:"id,omitempty"` - ExternalId string `json:"externalId,omitempty"` - Title string `json:"title,omitempty"` - Shareable bool `json:"shareable,omitempty"` - Resources []*JiraTeamResourceScheme `json:"resources,omitempty"` + Id int `json:"id,omitempty"` // The ID of the team. + ExternalId string `json:"externalId,omitempty"` // The external ID of the team. + Title string `json:"title,omitempty"` // The title of the team. + Shareable bool `json:"shareable,omitempty"` // Indicates if the team is shareable. + Resources []*JiraTeamResourceScheme `json:"resources,omitempty"` // The resources of the team. } +// JiraTeamResourceScheme represents a resource in a Jira team. type JiraTeamResourceScheme struct { - Id int `json:"id,omitempty"` - PersonId int `json:"personId,omitempty"` + Id int `json:"id,omitempty"` // The ID of the resource. + PersonId int `json:"personId,omitempty"` // The ID of the person associated with the resource. } +// JiraTeamPersonScheme represents a person in a Jira team. type JiraTeamPersonScheme struct { - PersonId int `json:"personId,omitempty"` - JiraUser *JiraTeamUserScheme `json:"jiraUser,omitempty"` + PersonId int `json:"personId,omitempty"` // The ID of the person. + JiraUser *JiraTeamUserScheme `json:"jiraUser,omitempty"` // The Jira user associated with the person. } +// JiraTeamUserScheme represents a user in a Jira team. type JiraTeamUserScheme struct { - Title string `json:"title,omitempty"` - Email string `json:"email,omitempty"` - AvatarUrl string `json:"avatarUrl,omitempty"` + Title string `json:"title,omitempty"` // The title of the user. + Email string `json:"email,omitempty"` // The email of the user. + AvatarUrl string `json:"avatarUrl,omitempty"` // The avatar URL of the user. } +// JiraTeamCreatePayloadScheme represents the payload for creating a Jira team. type JiraTeamCreatePayloadScheme struct { - Title string `json:"title,omitempty"` - Shareable bool `json:"shareable,omitempty"` - Resources []*JiraTeamResourceScheme `json:"resources,omitempty"` + Title string `json:"title,omitempty"` // The title of the team. + Shareable bool `json:"shareable,omitempty"` // Indicates if the team is shareable. + Resources []*JiraTeamResourceScheme `json:"resources,omitempty"` // The resources of the team. } +// JiraTeamCreateResponseScheme represents the response from creating a Jira team. type JiraTeamCreateResponseScheme struct { - Id int `json:"id,omitempty"` - Team *JiraTeamScheme `json:"team,omitempty"` - Persons []*JiraTeamPersonScheme `json:"persons,omitempty"` + Id int `json:"id,omitempty"` // The ID of the created team. + Team *JiraTeamScheme `json:"team,omitempty"` // The created team. + Persons []*JiraTeamPersonScheme `json:"persons,omitempty"` // The persons associated with the created team. } diff --git a/pkg/infra/models/jira_user.go b/pkg/infra/models/jira_user.go index 93827ba4..22340b10 100644 --- a/pkg/infra/models/jira_user.go +++ b/pkg/infra/models/jira_user.go @@ -1,61 +1,67 @@ package models +// UserScheme represents a user in Jira. type UserScheme struct { - Self string `json:"self,omitempty"` - Key string `json:"key,omitempty"` - AccountID string `json:"accountId,omitempty"` - AccountType string `json:"accountType,omitempty"` - Name string `json:"name,omitempty"` - EmailAddress string `json:"emailAddress,omitempty"` - AvatarUrls *AvatarURLScheme `json:"avatarUrls,omitempty"` - DisplayName string `json:"displayName,omitempty"` - Active bool `json:"active,omitempty"` - TimeZone string `json:"timeZone,omitempty"` - Locale string `json:"locale,omitempty"` - Groups *UserGroupsScheme `json:"groups,omitempty"` - ApplicationRoles *UserApplicationRolesScheme `json:"applicationRoles,omitempty"` - Expand string `json:"expand,omitempty"` + Self string `json:"self,omitempty"` // The URL of the user. + Key string `json:"key,omitempty"` // The key of the user. + AccountID string `json:"accountId,omitempty"` // The account ID of the user. + AccountType string `json:"accountType,omitempty"` // The account type of the user. + Name string `json:"name,omitempty"` // The name of the user. + EmailAddress string `json:"emailAddress,omitempty"` // The email address of the user. + AvatarUrls *AvatarURLScheme `json:"avatarUrls,omitempty"` // The avatar URLs of the user. + DisplayName string `json:"displayName,omitempty"` // The display name of the user. + Active bool `json:"active,omitempty"` // Indicates if the user is active. + TimeZone string `json:"timeZone,omitempty"` // The time zone of the user. + Locale string `json:"locale,omitempty"` // The locale of the user. + Groups *UserGroupsScheme `json:"groups,omitempty"` // The groups of the user. + ApplicationRoles *UserApplicationRolesScheme `json:"applicationRoles,omitempty"` // The application roles of the user. + Expand string `json:"expand,omitempty"` // The fields that are expanded in the results. } +// UserApplicationRolesScheme represents the application roles of a user in Jira. type UserApplicationRolesScheme struct { - Size int `json:"size,omitempty"` - Items []*UserApplicationRoleItemsScheme `json:"items,omitempty"` - MaxResults int `json:"max-results,omitempty"` + Size int `json:"size,omitempty"` // The size of the application roles. + Items []*UserApplicationRoleItemsScheme `json:"items,omitempty"` // The items of the application roles. + MaxResults int `json:"max-results,omitempty"` // The maximum number of results returned. } +// UserApplicationRoleItemsScheme represents an item of the application roles of a user in Jira. type UserApplicationRoleItemsScheme struct { - Key string `json:"key,omitempty"` - Groups []string `json:"groups,omitempty"` - Name string `json:"name,omitempty"` - DefaultGroups []string `json:"defaultGroups,omitempty"` - SelectedByDefault bool `json:"selectedByDefault,omitempty"` - Defined bool `json:"defined,omitempty"` - NumberOfSeats int `json:"numberOfSeats,omitempty"` - RemainingSeats int `json:"remainingSeats,omitempty"` - UserCount int `json:"userCount,omitempty"` - UserCountDescription string `json:"userCountDescription,omitempty"` - HasUnlimitedSeats bool `json:"hasUnlimitedSeats,omitempty"` - Platform bool `json:"platform,omitempty"` + Key string `json:"key,omitempty"` // The key of the item. + Groups []string `json:"groups,omitempty"` // The groups of the item. + Name string `json:"name,omitempty"` // The name of the item. + DefaultGroups []string `json:"defaultGroups,omitempty"` // The default groups of the item. + SelectedByDefault bool `json:"selectedByDefault,omitempty"` // Indicates if the item is selected by default. + Defined bool `json:"defined,omitempty"` // Indicates if the item is defined. + NumberOfSeats int `json:"numberOfSeats,omitempty"` // The number of seats of the item. + RemainingSeats int `json:"remainingSeats,omitempty"` // The remaining seats of the item. + UserCount int `json:"userCount,omitempty"` // The user count of the item. + UserCountDescription string `json:"userCountDescription,omitempty"` // The user count description of the item. + HasUnlimitedSeats bool `json:"hasUnlimitedSeats,omitempty"` // Indicates if the item has unlimited seats. + Platform bool `json:"platform,omitempty"` // Indicates if the item is a platform. } +// UserPayloadScheme represents the payload for a user in Jira. type UserPayloadScheme struct { - Password string `json:"password,omitempty"` - EmailAddress string `json:"emailAddress,omitempty"` - DisplayName string `json:"displayName,omitempty"` - Notification bool `json:"notification,omitempty"` + Password string `json:"password,omitempty"` // The password of the user. + EmailAddress string `json:"emailAddress,omitempty"` // The email address of the user. + DisplayName string `json:"displayName,omitempty"` // The display name of the user. + Notification bool `json:"notification,omitempty"` // Indicates if the user receives notifications. } +// UserSearchPageScheme represents a page of users in Jira. type UserSearchPageScheme struct { - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*UserScheme `json:"values,omitempty"` + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results returned. + StartAt int `json:"startAt,omitempty"` // The index of the first result returned. + Total int `json:"total,omitempty"` // The total number of results available. + IsLast bool `json:"isLast,omitempty"` // Indicates if this is the last page of results. + Values []*UserScheme `json:"values,omitempty"` // The users on the page. } +// UserPermissionCheckParamsScheme represents the parameters for checking a user's permissions in Jira. type UserPermissionCheckParamsScheme struct { - Query string - AccountID string - IssueKey string - ProjectKey string + Query string // The query for the check. + AccountID string // The account ID for the check. + IssueKey string // The issue key for the check. + ProjectKey string // The project key for the check. } diff --git a/pkg/infra/models/jira_version.go b/pkg/infra/models/jira_version.go index f16039b8..c4f54fe3 100644 --- a/pkg/infra/models/jira_version.go +++ b/pkg/infra/models/jira_version.go @@ -1,88 +1,98 @@ package models +// VersionScheme represents a version in Jira. type VersionScheme struct { - Self string `json:"self,omitempty"` - ID string `json:"id,omitempty"` - Description string `json:"description,omitempty"` - Name string `json:"name,omitempty"` - Archived bool `json:"archived,omitempty"` - Released bool `json:"released,omitempty"` - ReleaseDate string `json:"releaseDate,omitempty"` - Overdue bool `json:"overdue,omitempty"` - UserReleaseDate string `json:"userReleaseDate,omitempty"` - ProjectID int `json:"projectId,omitempty"` - Operations []*VersionOperation `json:"operations,omitempty"` - IssuesStatusForFixVersion *VersionIssuesStatusForFixVersionScheme `json:"issuesStatusForFixVersion,omitempty"` + Self string `json:"self,omitempty"` // The URL of the version. + ID string `json:"id,omitempty"` // The ID of the version. + Description string `json:"description,omitempty"` // The description of the version. + Name string `json:"name,omitempty"` // The name of the version. + Archived bool `json:"archived,omitempty"` // Indicates if the version is archived. + Released bool `json:"released,omitempty"` // Indicates if the version is released. + ReleaseDate string `json:"releaseDate,omitempty"` // The release date of the version. + Overdue bool `json:"overdue,omitempty"` // Indicates if the version is overdue. + UserReleaseDate string `json:"userReleaseDate,omitempty"` // The user release date of the version. + ProjectID int `json:"projectId,omitempty"` // The project ID of the version. + Operations []*VersionOperation `json:"operations,omitempty"` // The operations of the version. + IssuesStatusForFixVersion *VersionIssuesStatusForFixVersionScheme `json:"issuesStatusForFixVersion,omitempty"` // The issues status for fix version of the version. } +// VersionOperation represents an operation in a version in Jira. type VersionOperation struct { - ID string `json:"id,omitempty"` - StyleClass string `json:"styleClass,omitempty"` - Label string `json:"label,omitempty"` - Href string `json:"href,omitempty"` - Weight int `json:"weight,omitempty"` + ID string `json:"id,omitempty"` // The ID of the operation. + StyleClass string `json:"styleClass,omitempty"` // The style class of the operation. + Label string `json:"label,omitempty"` // The label of the operation. + Href string `json:"href,omitempty"` // The href of the operation. + Weight int `json:"weight,omitempty"` // The weight of the operation. } +// VersionIssuesStatusForFixVersionScheme represents the issues status for fix version in a version in Jira. type VersionIssuesStatusForFixVersionScheme struct { - Unmapped int `json:"unmapped,omitempty"` - ToDo int `json:"toDo,omitempty"` - InProgress int `json:"inProgress,omitempty"` - Done int `json:"done,omitempty"` + Unmapped int `json:"unmapped,omitempty"` // The unmapped status. + ToDo int `json:"toDo,omitempty"` // The to do status. + InProgress int `json:"inProgress,omitempty"` // The in progress status. + Done int `json:"done,omitempty"` // The done status. } +// VersionPageScheme represents a page of versions in Jira. type VersionPageScheme struct { - Self string `json:"self,omitempty"` - NextPage string `json:"nextPage,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*VersionScheme `json:"values,omitempty"` + Self string `json:"self,omitempty"` // The URL of the page. + NextPage string `json:"nextPage,omitempty"` // The URL of the next page. + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results returned. + StartAt int `json:"startAt,omitempty"` // The index of the first result returned. + Total int `json:"total,omitempty"` // The total number of results available. + IsLast bool `json:"isLast,omitempty"` // Indicates if this is the last page of results. + Values []*VersionScheme `json:"values,omitempty"` // The versions on the page. } +// VersionGetsOptions represents the options for getting versions in Jira. type VersionGetsOptions struct { - OrderBy string - Query string - Status string - Expand []string + OrderBy string // The order by option. + Query string // The query option. + Status string // The status option. + Expand []string // The expand option. } +// VersionPayloadScheme represents the payload for a version in Jira. type VersionPayloadScheme struct { - Archived bool `json:"archived,omitempty"` - ReleaseDate string `json:"releaseDate,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - ProjectID int `json:"projectId,omitempty"` - Released bool `json:"released,omitempty"` - StartDate string `json:"startDate,omitempty"` + Archived bool `json:"archived,omitempty"` // Indicates if the version is archived. + ReleaseDate string `json:"releaseDate,omitempty"` // The release date of the version. + Name string `json:"name,omitempty"` // The name of the version. + Description string `json:"description,omitempty"` // The description of the version. + ProjectID int `json:"projectId,omitempty"` // The project ID of the version. + Released bool `json:"released,omitempty"` // Indicates if the version is released. + StartDate string `json:"startDate,omitempty"` // The start date of the version. } +// VersionIssueCountsScheme represents the issue counts for a version in Jira. type VersionIssueCountsScheme struct { - Self string `json:"self,omitempty"` - IssuesFixedCount int `json:"issuesFixedCount,omitempty"` - IssuesAffectedCount int `json:"issuesAffectedCount,omitempty"` - IssueCountWithCustomFieldsShowingVersion int `json:"issueCountWithCustomFieldsShowingVersion,omitempty"` - CustomFieldUsage []*VersionIssueCountCustomFieldUsageScheme `json:"customFieldUsage,omitempty"` + Self string `json:"self,omitempty"` // The URL of the issue counts. + IssuesFixedCount int `json:"issuesFixedCount,omitempty"` // The count of issues fixed. + IssuesAffectedCount int `json:"issuesAffectedCount,omitempty"` // The count of issues affected. + IssueCountWithCustomFieldsShowingVersion int `json:"issueCountWithCustomFieldsShowingVersion,omitempty"` // The count of issues with custom fields showing version. + CustomFieldUsage []*VersionIssueCountCustomFieldUsageScheme `json:"customFieldUsage,omitempty"` // The custom field usage of the version. } +// VersionIssueCountCustomFieldUsageScheme represents the custom field usage for a version in Jira. type VersionIssueCountCustomFieldUsageScheme struct { - FieldName string `json:"fieldName,omitempty"` - CustomFieldID int `json:"customFieldId,omitempty"` - IssueCountWithVersionInCustomField int `json:"issueCountWithVersionInCustomField,omitempty"` + FieldName string `json:"fieldName,omitempty"` // The field name of the custom field usage. + CustomFieldID int `json:"customFieldId,omitempty"` // The custom field ID of the custom field usage. + IssueCountWithVersionInCustomField int `json:"issueCountWithVersionInCustomField,omitempty"` // The issue count with version in custom field of the custom field usage. } +// VersionUnresolvedIssuesCountScheme represents the unresolved issues count for a version in Jira. type VersionUnresolvedIssuesCountScheme struct { - Self string `json:"self"` - IssuesUnresolvedCount int `json:"issuesUnresolvedCount"` - IssuesCount int `json:"issuesCount"` + Self string `json:"self"` // The URL of the unresolved issues count. + IssuesUnresolvedCount int `json:"issuesUnresolvedCount"` // The count of unresolved issues. + IssuesCount int `json:"issuesCount"` // The count of issues. } +// VersionDetailScheme represents the detail of a version in Jira. type VersionDetailScheme struct { - Self string `json:"self,omitempty"` - ID string `json:"id,omitempty"` - Description string `json:"description,omitempty"` - Name string `json:"name,omitempty"` - Archived bool `json:"archived,omitempty"` - Released bool `json:"released,omitempty"` - ReleaseDate string `json:"releaseDate,omitempty"` + Self string `json:"self,omitempty"` // The URL of the detail. + ID string `json:"id,omitempty"` // The ID of the detail. + Description string `json:"description,omitempty"` // The description of the detail. + Name string `json:"name,omitempty"` // The name of the detail. + Archived bool `json:"archived,omitempty"` // Indicates if the detail is archived. + Released bool `json:"released,omitempty"` // Indicates if the detail is released. + ReleaseDate string `json:"releaseDate,omitempty"` // The release date of the detail. } diff --git a/pkg/infra/models/jira_vote.go b/pkg/infra/models/jira_vote.go index a0898453..bdf72ee4 100644 --- a/pkg/infra/models/jira_vote.go +++ b/pkg/infra/models/jira_vote.go @@ -1,8 +1,9 @@ package models +// IssueVoteScheme represents the voting information for an issue in Jira. type IssueVoteScheme struct { - Self string `json:"self,omitempty"` - Votes int `json:"votes,omitempty"` - HasVoted bool `json:"hasVoted,omitempty"` - Voters []*UserScheme `json:"voters,omitempty"` + Self string `json:"self,omitempty"` // The URL of the voting information. + Votes int `json:"votes,omitempty"` // The number of votes for the issue. + HasVoted bool `json:"hasVoted,omitempty"` // Indicates if the current user has voted for the issue. + Voters []*UserScheme `json:"voters,omitempty"` // The users who have voted for the issue. } diff --git a/pkg/infra/models/jira_watcher.go b/pkg/infra/models/jira_watcher.go index 3c8da6c9..cf2534c4 100644 --- a/pkg/infra/models/jira_watcher.go +++ b/pkg/infra/models/jira_watcher.go @@ -1,20 +1,22 @@ package models +// IssueWatcherScheme represents the watcher information for an issue in Jira. type IssueWatcherScheme struct { - Self string `json:"self,omitempty"` - IsWatching bool `json:"isWatching,omitempty"` - WatchCount int `json:"watchCount,omitempty"` - Watchers []*UserDetailScheme `json:"watchers,omitempty"` + Self string `json:"self,omitempty"` // The URL of the watcher information. + IsWatching bool `json:"isWatching,omitempty"` // Indicates if the current user is watching the issue. + WatchCount int `json:"watchCount,omitempty"` // The number of watchers for the issue. + Watchers []*UserDetailScheme `json:"watchers,omitempty"` // The users who are watching the issue. } +// UserDetailScheme represents the detail of a user in Jira. type UserDetailScheme struct { - Self string `json:"self,omitempty"` - Name string `json:"name,omitempty"` - Key string `json:"key,omitempty"` - AccountID string `json:"accountId,omitempty"` - EmailAddress string `json:"emailAddress,omitempty"` - DisplayName string `json:"displayName,omitempty"` - Active bool `json:"active,omitempty"` - TimeZone string `json:"timeZone,omitempty"` - AccountType string `json:"accountType,omitempty"` + Self string `json:"self,omitempty"` // The URL of the user detail. + Name string `json:"name,omitempty"` // The name of the user. + Key string `json:"key,omitempty"` // The key of the user. + AccountID string `json:"accountId,omitempty"` // The account ID of the user. + EmailAddress string `json:"emailAddress,omitempty"` // The email address of the user. + DisplayName string `json:"displayName,omitempty"` // The display name of the user. + Active bool `json:"active,omitempty"` // Indicates if the user is active. + TimeZone string `json:"timeZone,omitempty"` // The time zone of the user. + AccountType string `json:"accountType,omitempty"` // The account type of the user. } diff --git a/pkg/infra/models/jira_work_log.go b/pkg/infra/models/jira_work_log.go index 22c806a7..ed9dc432 100644 --- a/pkg/infra/models/jira_work_log.go +++ b/pkg/infra/models/jira_work_log.go @@ -1,93 +1,104 @@ package models +// WorklogOptionsScheme represents the options for a worklog in Jira. type WorklogOptionsScheme struct { - Notify bool - AdjustEstimate string - NewEstimate string - ReduceBy string - OverrideEditableFlag bool - Expand []string + Notify bool // Indicates if notifications should be sent for the worklog. + AdjustEstimate string // The method for adjusting the estimate of the issue. + NewEstimate string // The new estimate of the issue if the adjust estimate is "new". + ReduceBy string // The amount to reduce the estimate by if the adjust estimate is "manual". + OverrideEditableFlag bool // Indicates if the editable flag of the worklog should be overridden. + Expand []string // The fields that should be expanded in the response. } +// WorklogADFPayloadScheme represents the payload for a worklog with Atlassian Document Format (ADF) content in Jira. type WorklogADFPayloadScheme struct { - Comment *CommentNodeScheme `json:"comment,omitempty"` - Visibility *IssueWorklogVisibilityScheme `json:"visibility,omitempty"` - Started string `json:"started,omitempty"` - TimeSpent string `json:"timeSpent,omitempty"` - TimeSpentSeconds int `json:"timeSpentSeconds,omitempty"` + Comment *CommentNodeScheme `json:"comment,omitempty"` // The comment for the worklog in ADF format. + Visibility *IssueWorklogVisibilityScheme `json:"visibility,omitempty"` // The visibility of the worklog. + Started string `json:"started,omitempty"` // The date and time when the work started. + TimeSpent string `json:"timeSpent,omitempty"` // The time spent on the work. + TimeSpentSeconds int `json:"timeSpentSeconds,omitempty"` // The time spent on the work in seconds. } +// WorklogRichTextPayloadScheme represents the payload for a worklog with rich text content in Jira. type WorklogRichTextPayloadScheme struct { - Comment *CommentPayloadSchemeV2 `json:"comment,omitempty"` - Visibility *IssueWorklogVisibilityScheme `json:"visibility,omitempty"` - Started string `json:"started,omitempty"` - TimeSpent string `json:"timeSpent,omitempty"` - TimeSpentSeconds int `json:"timeSpentSeconds,omitempty"` + Comment *CommentPayloadSchemeV2 `json:"comment,omitempty"` // The comment for the worklog in rich text format. + Visibility *IssueWorklogVisibilityScheme `json:"visibility,omitempty"` // The visibility of the worklog. + Started string `json:"started,omitempty"` // The date and time when the work started. + TimeSpent string `json:"timeSpent,omitempty"` // The time spent on the work. + TimeSpentSeconds int `json:"timeSpentSeconds,omitempty"` // The time spent on the work in seconds. } +// ChangedWorklogPageScheme represents a page of changed worklogs in Jira. type ChangedWorklogPageScheme struct { - Since int `json:"since,omitempty"` - Until int `json:"until,omitempty"` - Self string `json:"self,omitempty"` - NextPage string `json:"nextPage,omitempty"` - LastPage bool `json:"lastPage,omitempty"` - Values []*ChangedWorklogScheme `json:"values,omitempty"` + Since int `json:"since,omitempty"` // The timestamp of the start of the period. + Until int `json:"until,omitempty"` // The timestamp of the end of the period. + Self string `json:"self,omitempty"` // The URL of the page. + NextPage string `json:"nextPage,omitempty"` // The URL of the next page. + LastPage bool `json:"lastPage,omitempty"` // Indicates if this is the last page of results. + Values []*ChangedWorklogScheme `json:"values,omitempty"` // The changed worklogs on the page. } +// ChangedWorklogScheme represents a changed worklog in Jira. type ChangedWorklogScheme struct { - WorklogID int `json:"worklogId,omitempty"` - UpdatedTime int `json:"updatedTime,omitempty"` - Properties []*ChangedWorklogPropertyScheme `json:"properties,omitempty"` + WorklogID int `json:"worklogId,omitempty"` // The ID of the worklog. + UpdatedTime int `json:"updatedTime,omitempty"` // The timestamp when the worklog was updated. + Properties []*ChangedWorklogPropertyScheme `json:"properties,omitempty"` // The properties of the worklog. } +// ChangedWorklogPropertyScheme represents a property of a changed worklog in Jira. type ChangedWorklogPropertyScheme struct { - Key string `json:"key,omitempty"` + Key string `json:"key,omitempty"` // The key of the property. } +// IssueWorklogRichTextPageScheme represents a page of worklogs with rich text content in Jira. type IssueWorklogRichTextPageScheme struct { - StartAt int `json:"startAt,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - Total int `json:"total,omitempty"` - Worklogs []*IssueWorklogRichTextScheme `json:"worklogs,omitempty"` + StartAt int `json:"startAt,omitempty"` // The index of the first result returned. + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results returned. + Total int `json:"total,omitempty"` // The total number of results available. + Worklogs []*IssueWorklogRichTextScheme `json:"worklogs,omitempty"` // The worklogs on the page. } +// IssueWorklogADFPageScheme represents a page of worklogs with Atlassian Document Format (ADF) content in Jira. type IssueWorklogADFPageScheme struct { - StartAt int `json:"startAt,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - Total int `json:"total,omitempty"` - Worklogs []*IssueWorklogADFScheme `json:"worklogs,omitempty"` + StartAt int `json:"startAt,omitempty"` // The index of the first result returned. + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results returned. + Total int `json:"total,omitempty"` // The total number of results available. + Worklogs []*IssueWorklogADFScheme `json:"worklogs,omitempty"` // The worklogs on the page. } +// IssueWorklogVisibilityScheme represents the visibility of a worklog in Jira. type IssueWorklogVisibilityScheme struct { - Type string `json:"type,omitempty"` - Value string `json:"value,omitempty"` - Identifier string `json:"identifier,omitempty"` + Type string `json:"type,omitempty"` // The type of the visibility. + Value string `json:"value,omitempty"` // The value of the visibility. + Identifier string `json:"identifier,omitempty"` // The identifier of the visibility. } +// IssueWorklogRichTextScheme represents a worklog with rich text content in Jira. type IssueWorklogRichTextScheme struct { - Self string `json:"self,omitempty"` - Author *UserDetailScheme `json:"author,omitempty"` - UpdateAuthor *UserDetailScheme `json:"updateAuthor,omitempty"` - Comment string `json:"comment,omitempty"` - Updated string `json:"updated,omitempty"` - Visibility *IssueWorklogVisibilityScheme `json:"visibility,omitempty"` - Started string `json:"started,omitempty"` - TimeSpent string `json:"timeSpent,omitempty"` - TimeSpentSeconds int `json:"timeSpentSeconds,omitempty"` - ID string `json:"id,omitempty"` - IssueID string `json:"issueId,omitempty"` + Self string `json:"self,omitempty"` // The URL of the worklog. + Author *UserDetailScheme `json:"author,omitempty"` // The author of the worklog. + UpdateAuthor *UserDetailScheme `json:"updateAuthor,omitempty"` // The user who last updated the worklog. + Comment string `json:"comment,omitempty"` // The comment of the worklog. + Updated string `json:"updated,omitempty"` // The date and time when the worklog was last updated. + Visibility *IssueWorklogVisibilityScheme `json:"visibility,omitempty"` // The visibility of the worklog. + Started string `json:"started,omitempty"` // The date and time when the work started. + TimeSpent string `json:"timeSpent,omitempty"` // The time spent on the work. + TimeSpentSeconds int `json:"timeSpentSeconds,omitempty"` // The time spent on the work in seconds. + ID string `json:"id,omitempty"` // The ID of the worklog. + IssueID string `json:"issueId,omitempty"` // The ID of the issue the worklog is associated with. } +// IssueWorklogADFScheme represents a worklog with Atlassian Document Format (ADF) content in Jira. type IssueWorklogADFScheme struct { - Self string `json:"self,omitempty"` - Author *UserDetailScheme `json:"author,omitempty"` - UpdateAuthor *UserDetailScheme `json:"updateAuthor,omitempty"` - Comment *CommentNodeScheme `json:"comment,omitempty"` - Updated string `json:"updated,omitempty"` - Visibility *IssueWorklogVisibilityScheme `json:"visibility,omitempty"` - Started string `json:"started,omitempty"` - TimeSpent string `json:"timeSpent,omitempty"` - TimeSpentSeconds int `json:"timeSpentSeconds,omitempty"` - ID string `json:"id,omitempty"` - IssueID string `json:"issueId,omitempty"` + Self string `json:"self,omitempty"` // The URL of the worklog. + Author *UserDetailScheme `json:"author,omitempty"` // The author of the worklog. + UpdateAuthor *UserDetailScheme `json:"updateAuthor,omitempty"` // The user who last updated the worklog. + Comment *CommentNodeScheme `json:"comment,omitempty"` // The comment of the worklog in ADF format. + Updated string `json:"updated,omitempty"` // The date and time when the worklog was last updated. + Visibility *IssueWorklogVisibilityScheme `json:"visibility,omitempty"` // The visibility of the worklog. + Started string `json:"started,omitempty"` // The date and time when the work started. + TimeSpent string `json:"timeSpent,omitempty"` // The time spent on the work. + TimeSpentSeconds int `json:"timeSpentSeconds,omitempty"` // The time spent on the work in seconds. + ID string `json:"id,omitempty"` // The ID of the worklog. + IssueID string `json:"issueId,omitempty"` // The ID of the issue the worklog is associated with. } diff --git a/pkg/infra/models/jira_workflow.go b/pkg/infra/models/jira_workflow.go index 505564d2..99767b86 100644 --- a/pkg/infra/models/jira_workflow.go +++ b/pkg/infra/models/jira_workflow.go @@ -1,109 +1,125 @@ package models +// WorkflowSearchOptions represents the search options for a workflow in Jira. type WorkflowSearchOptions struct { - WorkflowName []string - Expand []string - QueryString string - OrderBy string - IsActive bool + WorkflowName []string // The names of the workflows to search for. + Expand []string // The fields to expand in the response. + QueryString string // The query string for the search. + OrderBy string // The field to order the results by. + IsActive bool // Indicates if only active workflows should be returned. } +// WorkflowPageScheme represents a page of workflows in Jira. type WorkflowPageScheme struct { - Self string `json:"self,omitempty"` - NextPage string `json:"nextPage,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*WorkflowScheme `json:"values,omitempty"` + Self string `json:"self,omitempty"` // The URL of the page. + NextPage string `json:"nextPage,omitempty"` // The URL of the next page. + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results returned. + StartAt int `json:"startAt,omitempty"` // The index of the first result returned. + Total int `json:"total,omitempty"` // The total number of results available. + IsLast bool `json:"isLast,omitempty"` // Indicates if this is the last page of results. + Values []*WorkflowScheme `json:"values,omitempty"` // The workflows on the page. } +// WorkflowScheme represents a workflow in Jira. type WorkflowScheme struct { - ID *WorkflowPublishedIDScheme `json:"id,omitempty"` - Transitions []*WorkflowTransitionScheme `json:"transitions,omitempty"` - Statuses []*WorkflowStatusScheme `json:"statuses,omitempty"` - Description string `json:"description,omitempty"` - IsDefault bool `json:"isDefault,omitempty"` + ID *WorkflowPublishedIDScheme `json:"id,omitempty"` // The ID of the workflow. + Transitions []*WorkflowTransitionScheme `json:"transitions,omitempty"` // The transitions of the workflow. + Statuses []*WorkflowStatusScheme `json:"statuses,omitempty"` // The statuses of the workflow. + Description string `json:"description,omitempty"` // The description of the workflow. + IsDefault bool `json:"isDefault,omitempty"` // Indicates if the workflow is the default workflow. } +// WorkflowPublishedIDScheme represents the published ID of a workflow in Jira. type WorkflowPublishedIDScheme struct { - Name string `json:"name,omitempty"` - EntityID string `json:"entityId,omitempty"` + Name string `json:"name,omitempty"` // The name of the workflow. + EntityID string `json:"entityId,omitempty"` // The entity ID of the workflow. } +// WorkflowTransitionScheme represents a transition in a workflow in Jira. type WorkflowTransitionScheme struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - From []string `json:"from,omitempty"` - To string `json:"to,omitempty"` - Type string `json:"type,omitempty"` - Screen *WorkflowTransitionScreenScheme `json:"screen,omitempty"` - Rules *WorkflowTransitionRulesScheme `json:"rules,omitempty"` + ID string `json:"id,omitempty"` // The ID of the transition. + Name string `json:"name,omitempty"` // The name of the transition. + Description string `json:"description,omitempty"` // The description of the transition. + From []string `json:"from,omitempty"` // The statuses from which this transition can be executed. + To string `json:"to,omitempty"` // The status to which this transition goes. + Type string `json:"type,omitempty"` // The type of the transition. + Screen *WorkflowTransitionScreenScheme `json:"screen,omitempty"` // The screen associated with the transition. + Rules *WorkflowTransitionRulesScheme `json:"rules,omitempty"` // The rules of the transition. } +// WorkflowTransitionScreenScheme represents a screen associated with a transition in a workflow in Jira. type WorkflowTransitionScreenScheme struct { - ID string `json:"id,omitempty"` - Properties interface{} `json:"properties,omitempty"` + ID string `json:"id,omitempty"` // The ID of the screen. + Properties interface{} `json:"properties,omitempty"` // The properties of the screen. } +// WorkflowTransitionRulesScheme represents the rules of a transition in a workflow in Jira. type WorkflowTransitionRulesScheme struct { - Conditions []*WorkflowTransitionRuleScheme `json:"conditions,omitempty"` - Validators []*WorkflowTransitionRuleScheme `json:"validators,omitempty"` - PostFunctions []*WorkflowTransitionRuleScheme `json:"postFunctions,omitempty"` + Conditions []*WorkflowTransitionRuleScheme `json:"conditions,omitempty"` // The conditions of the transition. + Validators []*WorkflowTransitionRuleScheme `json:"validators,omitempty"` // The validators of the transition. + PostFunctions []*WorkflowTransitionRuleScheme `json:"postFunctions,omitempty"` // The post functions of the transition. } +// WorkflowTransitionRuleScheme represents a rule of a transition in a workflow in Jira. type WorkflowTransitionRuleScheme struct { - Type string `json:"type,omitempty"` - Configuration interface{} `json:"configuration,omitempty"` + Type string `json:"type,omitempty"` // The type of the rule. + Configuration interface{} `json:"configuration,omitempty"` // The configuration of the rule. } +// WorkflowStatusScheme represents a status in a workflow in Jira. type WorkflowStatusScheme struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Properties *WorkflowStatusPropertiesScheme `json:"properties,omitempty"` + ID string `json:"id,omitempty"` // The ID of the status. + Name string `json:"name,omitempty"` // The name of the status. + Properties *WorkflowStatusPropertiesScheme `json:"properties,omitempty"` // The properties of the status. } +// WorkflowStatusPropertiesScheme represents the properties of a status in a workflow in Jira. type WorkflowStatusPropertiesScheme struct { - IssueEditable bool `json:"issueEditable,omitempty"` + IssueEditable bool `json:"issueEditable,omitempty"` // Indicates if the issue is editable. } +// WorkflowCreatedResponseScheme represents the response after a workflow is created in Jira. type WorkflowCreatedResponseScheme struct { - Name string `json:"name,omitempty"` - EntityID string `json:"entityId,omitempty"` + Name string `json:"name,omitempty"` // The name of the created workflow. + EntityID string `json:"entityId,omitempty"` // The entity ID of the created workflow. } +// WorkflowPayloadScheme represents the payload for creating a workflow in Jira. type WorkflowPayloadScheme struct { - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - Statuses []*WorkflowTransitionScreenScheme `json:"statuses,omitempty"` - Transitions []*WorkflowTransitionPayloadScheme `json:"transitions,omitempty"` + Name string `json:"name,omitempty"` // The name of the workflow. + Description string `json:"description,omitempty"` // The description of the workflow. + Statuses []*WorkflowTransitionScreenScheme `json:"statuses,omitempty"` // The statuses of the workflow. + Transitions []*WorkflowTransitionPayloadScheme `json:"transitions,omitempty"` // The transitions of the workflow. } +// WorkflowTransitionPayloadScheme represents the payload for a transition in a workflow in Jira. type WorkflowTransitionPayloadScheme struct { - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - From []string `json:"from,omitempty"` - To string `json:"to,omitempty"` - Type string `json:"type,omitempty"` - Rules *WorkflowTransitionRulePayloadScheme `json:"rules,omitempty"` - Screen *WorkflowTransitionScreenPayloadScheme `json:"screen,omitempty"` - Properties interface{} `json:"properties,omitempty"` + Name string `json:"name,omitempty"` // The name of the transition. + Description string `json:"description,omitempty"` // The description of the transition. + From []string `json:"from,omitempty"` // The statuses from which this transition can be executed. + To string `json:"to,omitempty"` // The status to which this transition goes. + Type string `json:"type,omitempty"` // The type of the transition. + Rules *WorkflowTransitionRulePayloadScheme `json:"rules,omitempty"` // The rules of the transition. + Screen *WorkflowTransitionScreenPayloadScheme `json:"screen,omitempty"` // The screen associated with the transition. + Properties interface{} `json:"properties,omitempty"` // The properties of the transition. } +// WorkflowTransitionScreenPayloadScheme represents the payload for a screen associated with a transition in a workflow in Jira. type WorkflowTransitionScreenPayloadScheme struct { - ID string `json:"id"` + ID string `json:"id"` // The ID of the screen. } +// WorkflowTransitionRulePayloadScheme represents the payload for the rules of a transition in a workflow in Jira. type WorkflowTransitionRulePayloadScheme struct { - Conditions *WorkflowConditionScheme `json:"conditions,omitempty"` - PostFunctions []*WorkflowTransitionRuleScheme `json:"postFunctions,omitempty"` - Validators []*WorkflowTransitionRuleScheme `json:"validators,omitempty"` + Conditions *WorkflowConditionScheme `json:"conditions,omitempty"` // The conditions of the transition. + PostFunctions []*WorkflowTransitionRuleScheme `json:"postFunctions,omitempty"` // The post functions of the transition. + Validators []*WorkflowTransitionRuleScheme `json:"validators,omitempty"` // The validators of the transition. } +// WorkflowConditionScheme represents a condition in a workflow in Jira. type WorkflowConditionScheme struct { - Conditions []*WorkflowConditionScheme `json:"conditions,omitempty"` - Configuration interface{} `json:"configuration,omitempty"` - Operator string `json:"operator,omitempty"` - Type string `json:"type,omitempty"` + Conditions []*WorkflowConditionScheme `json:"conditions,omitempty"` // The conditions of the workflow. + Configuration interface{} `json:"configuration,omitempty"` // The configuration of the condition. + Operator string `json:"operator,omitempty"` // The operator of the condition. + Type string `json:"type,omitempty"` // The type of the condition. } diff --git a/pkg/infra/models/jira_workflow_scheme.go b/pkg/infra/models/jira_workflow_scheme.go index c99121a0..75ae7c3d 100644 --- a/pkg/infra/models/jira_workflow_scheme.go +++ b/pkg/infra/models/jira_workflow_scheme.go @@ -1,40 +1,45 @@ package models +// WorkflowSchemePayloadScheme represents the payload for a workflow scheme in Jira. type WorkflowSchemePayloadScheme struct { - DefaultWorkflow string `json:"defaultWorkflow,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - IssueTypeMappings interface{} `json:"issueTypeMappings,omitempty"` - UpdateDraftIfNeeded bool `json:"updateDraftIfNeeded,omitempty"` + DefaultWorkflow string `json:"defaultWorkflow,omitempty"` // The default workflow of the scheme. + Name string `json:"name,omitempty"` // The name of the scheme. + Description string `json:"description,omitempty"` // The description of the scheme. + IssueTypeMappings interface{} `json:"issueTypeMappings,omitempty"` // The issue type mappings of the scheme. + UpdateDraftIfNeeded bool `json:"updateDraftIfNeeded,omitempty"` // Indicates if the draft should be updated if needed. } +// WorkflowSchemePageScheme represents a page of workflow schemes in Jira. type WorkflowSchemePageScheme struct { - Self string `json:"self,omitempty"` - NextPage string `json:"nextPage,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - Values []*WorkflowSchemeScheme `json:"values,omitempty"` + Self string `json:"self,omitempty"` // The URL of the page. + NextPage string `json:"nextPage,omitempty"` // The URL of the next page. + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results returned. + StartAt int `json:"startAt,omitempty"` // The index of the first result returned. + Total int `json:"total,omitempty"` // The total number of results available. + IsLast bool `json:"isLast,omitempty"` // Indicates if this is the last page of results. + Values []*WorkflowSchemeScheme `json:"values,omitempty"` // The workflow schemes on the page. } +// WorkflowSchemeScheme represents a workflow scheme in Jira. type WorkflowSchemeScheme struct { - ID int `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - DefaultWorkflow string `json:"defaultWorkflow,omitempty"` - Draft bool `json:"draft,omitempty"` - LastModifiedUser *UserScheme `json:"lastModifiedUser,omitempty"` - LastModified string `json:"lastModified,omitempty"` - Self string `json:"self,omitempty"` - UpdateDraftIfNeeded bool `json:"updateDraftIfNeeded,omitempty"` + ID int `json:"id,omitempty"` // The ID of the scheme. + Name string `json:"name,omitempty"` // The name of the scheme. + Description string `json:"description,omitempty"` // The description of the scheme. + DefaultWorkflow string `json:"defaultWorkflow,omitempty"` // The default workflow of the scheme. + Draft bool `json:"draft,omitempty"` // Indicates if the scheme is a draft. + LastModifiedUser *UserScheme `json:"lastModifiedUser,omitempty"` // The user who last modified the scheme. + LastModified string `json:"lastModified,omitempty"` // The date and time when the scheme was last modified. + Self string `json:"self,omitempty"` // The URL of the scheme. + UpdateDraftIfNeeded bool `json:"updateDraftIfNeeded,omitempty"` // Indicates if the draft should be updated if needed. } +// WorkflowSchemeAssociationPageScheme represents a page of workflow scheme associations in Jira. type WorkflowSchemeAssociationPageScheme struct { - Values []*WorkflowSchemeAssociationsScheme `json:"values,omitempty"` + Values []*WorkflowSchemeAssociationsScheme `json:"values,omitempty"` // The workflow scheme associations on the page. } +// WorkflowSchemeAssociationsScheme represents a workflow scheme association in Jira. type WorkflowSchemeAssociationsScheme struct { - ProjectIds []string `json:"projectIds,omitempty"` - WorkflowScheme *WorkflowSchemeScheme `json:"workflowScheme,omitempty"` + ProjectIds []string `json:"projectIds,omitempty"` // The IDs of the projects associated with the scheme. + WorkflowScheme *WorkflowSchemeScheme `json:"workflowScheme,omitempty"` // The workflow scheme associated with the projects. } diff --git a/pkg/infra/models/jira_workflow_scheme_issue_type.go b/pkg/infra/models/jira_workflow_scheme_issue_type.go index 4bfe1fe4..e79936df 100644 --- a/pkg/infra/models/jira_workflow_scheme_issue_type.go +++ b/pkg/infra/models/jira_workflow_scheme_issue_type.go @@ -1,18 +1,21 @@ package models +// IssueTypeWorkflowMappingScheme represents the mapping between an issue type and a workflow in Jira. type IssueTypeWorkflowMappingScheme struct { - IssueType string `json:"issueType,omitempty"` - Workflow string `json:"workflow,omitempty"` + IssueType string `json:"issueType,omitempty"` // The type of the issue. + Workflow string `json:"workflow,omitempty"` // The workflow associated with the issue type. } +// IssueTypeWorkflowPayloadScheme represents the payload for an issue type and workflow mapping in Jira. type IssueTypeWorkflowPayloadScheme struct { - IssueType string `json:"issueType,omitempty"` - UpdateDraftIfNeeded bool `json:"updateDraftIfNeeded,omitempty"` - Workflow string `json:"workflow,omitempty"` + IssueType string `json:"issueType,omitempty"` // The type of the issue. + UpdateDraftIfNeeded bool `json:"updateDraftIfNeeded,omitempty"` // Indicates if the draft should be updated if needed. + Workflow string `json:"workflow,omitempty"` // The workflow associated with the issue type. } +// IssueTypesWorkflowMappingScheme represents the mapping between multiple issue types and a workflow in Jira. type IssueTypesWorkflowMappingScheme struct { - Workflow string `json:"workflow,omitempty"` - IssueTypes []string `json:"issueTypes,omitempty"` - DefaultMapping bool `json:"defaultMapping,omitempty"` + Workflow string `json:"workflow,omitempty"` // The workflow associated with the issue types. + IssueTypes []string `json:"issueTypes,omitempty"` // The types of the issues. + DefaultMapping bool `json:"defaultMapping,omitempty"` // Indicates if this is the default mapping. } diff --git a/pkg/infra/models/jira_workflow_status.go b/pkg/infra/models/jira_workflow_status.go index 49d8062a..07971b9b 100644 --- a/pkg/infra/models/jira_workflow_status.go +++ b/pkg/infra/models/jira_workflow_status.go @@ -1,63 +1,72 @@ package models +// WorkflowStatusDetailPageScheme represents a page of workflow status details in Jira. type WorkflowStatusDetailPageScheme struct { - StartAt int `json:"startAt,omitempty"` - Total int `json:"total,omitempty"` - IsLast bool `json:"isLast,omitempty"` - MaxResults int `json:"maxResults,omitempty"` - Values []*WorkflowStatusDetailScheme `json:"values,omitempty"` - Self string `json:"self,omitempty"` - NextPage string `json:"nextPage,omitempty"` + StartAt int `json:"startAt,omitempty"` // The index of the first result returned. + Total int `json:"total,omitempty"` // The total number of results available. + IsLast bool `json:"isLast,omitempty"` // Indicates if this is the last page of results. + MaxResults int `json:"maxResults,omitempty"` // The maximum number of results returned. + Values []*WorkflowStatusDetailScheme `json:"values,omitempty"` // The workflow status details on the page. + Self string `json:"self,omitempty"` // The URL of the page. + NextPage string `json:"nextPage,omitempty"` // The URL of the next page. } +// WorkflowStatusDetailScheme represents a workflow status detail in Jira. type WorkflowStatusDetailScheme struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - StatusCategory string `json:"statusCategory,omitempty"` - Scope *WorkflowStatusScopeScheme `json:"scope,omitempty"` - Description string `json:"description,omitempty"` - Usages []*ProjectIssueTypesScheme `json:"usages,omitempty"` + ID string `json:"id,omitempty"` // The ID of the workflow status. + Name string `json:"name,omitempty"` // The name of the workflow status. + StatusCategory string `json:"statusCategory,omitempty"` // The status category of the workflow status. + Scope *WorkflowStatusScopeScheme `json:"scope,omitempty"` // The scope of the workflow status. + Description string `json:"description,omitempty"` // The description of the workflow status. + Usages []*ProjectIssueTypesScheme `json:"usages,omitempty"` // The usages of the workflow status. } +// WorkflowStatusScopeScheme represents the scope of a workflow status in Jira. type WorkflowStatusScopeScheme struct { - Type string `json:"type,omitempty"` - Project *WorkflowStatusProjectScheme `json:"project,omitempty"` + Type string `json:"type,omitempty"` // The type of the scope. + Project *WorkflowStatusProjectScheme `json:"project,omitempty"` // The project associated with the scope. } +// WorkflowStatusProjectScheme represents a project associated with a workflow status scope in Jira. type WorkflowStatusProjectScheme struct { - ID string `json:"id,omitempty"` + ID string `json:"id,omitempty"` // The ID of the project. } +// ProjectIssueTypesScheme represents the issue types associated with a project in Jira. type ProjectIssueTypesScheme struct { - Project *ProjectScheme `json:"project,omitempty"` - IssueTypes []string `json:"issueTypes,omitempty"` + Project *ProjectScheme `json:"project,omitempty"` // The project associated with the issue types. + IssueTypes []string `json:"issueTypes,omitempty"` // The issue types associated with the project. } +// WorkflowStatusPayloadScheme represents the payload for a workflow status in Jira. type WorkflowStatusPayloadScheme struct { - Statuses []*WorkflowStatusNodeScheme `json:"statuses,omitempty"` - Scope *WorkflowStatusScopeScheme `json:"scope,omitempty"` + Statuses []*WorkflowStatusNodeScheme `json:"statuses,omitempty"` // The statuses of the workflow. + Scope *WorkflowStatusScopeScheme `json:"scope,omitempty"` // The scope of the workflow status. } +// WorkflowStatusNodeScheme represents a node of a workflow status in Jira. type WorkflowStatusNodeScheme struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - StatusCategory string `json:"statusCategory,omitempty"` - Description string `json:"description,omitempty"` + ID string `json:"id,omitempty"` // The ID of the workflow status node. + Name string `json:"name,omitempty"` // The name of the workflow status node. + StatusCategory string `json:"statusCategory,omitempty"` // The status category of the workflow status node. + Description string `json:"description,omitempty"` // The description of the workflow status node. } +// WorkflowStatusSearchParams represents the search parameters for a workflow status in Jira. type WorkflowStatusSearchParams struct { - ProjectID string - SearchString string - StatusCategory string - Expand []string + ProjectID string // The ID of the project. + SearchString string // The search string. + StatusCategory string // The status category. + Expand []string // The fields to expand in the response. } +// StatusDetailScheme represents a status detail in Jira. type StatusDetailScheme struct { - Self string `json:"self,omitempty"` - Description string `json:"description,omitempty"` - IconURL string `json:"iconUrl,omitempty"` - Name string `json:"name,omitempty"` - ID string `json:"id,omitempty"` - StatusCategory *StatusCategoryScheme `json:"statusCategory,omitempty"` - Scope *WorkflowStatusScopeScheme `json:"scope,omitempty"` + Self string `json:"self,omitempty"` // The URL of the status detail. + Description string `json:"description,omitempty"` // The description of the status detail. + IconURL string `json:"iconUrl,omitempty"` // The URL of the icon for the status detail. + Name string `json:"name,omitempty"` // The name of the status detail. + ID string `json:"id,omitempty"` // The ID of the status detail. + StatusCategory *StatusCategoryScheme `json:"statusCategory,omitempty"` // The status category of the status detail. + Scope *WorkflowStatusScopeScheme `json:"scope,omitempty"` // The scope of the status detail. } diff --git a/pkg/infra/models/shared_service.go b/pkg/infra/models/shared_service.go index b1fcdd82..2d8aa10e 100644 --- a/pkg/infra/models/shared_service.go +++ b/pkg/infra/models/shared_service.go @@ -5,11 +5,12 @@ import ( "net/http" ) +// ResponseScheme represents the response from an HTTP request. type ResponseScheme struct { - *http.Response + *http.Response // Embedding the http.Response struct from the net/http package. - Code int - Endpoint string - Method string - Bytes bytes.Buffer + Code int // The HTTP status code of the response. + Endpoint string // The endpoint that the request was made to. + Method string // The HTTP method used for the request. + Bytes bytes.Buffer // The response body. } diff --git a/pkg/infra/models/sm_customer.go b/pkg/infra/models/sm_customer.go index 48e3952b..855a15b8 100644 --- a/pkg/infra/models/sm_customer.go +++ b/pkg/infra/models/sm_customer.go @@ -1,35 +1,39 @@ package models +// CustomerPageScheme represents a page of customers in a system. type CustomerPageScheme struct { - Expands []interface{} `json:"_expands,omitempty"` - Size int `json:"size,omitempty"` - Start int `json:"start,omitempty"` - Limit int `json:"limit,omitempty"` - IsLastPage bool `json:"isLastPage,omitempty"` - Links *CustomerPageLinksScheme `json:"_links,omitempty"` - Values []*CustomerScheme `json:"values,omitempty"` + Expands []interface{} `json:"_expands,omitempty"` // Additional data related to the customers. + Size int `json:"size,omitempty"` // The number of customers on the page. + Start int `json:"start,omitempty"` // The index of the first customer on the page. + Limit int `json:"limit,omitempty"` // The maximum number of customers that can be on the page. + IsLastPage bool `json:"isLastPage,omitempty"` // Indicates if this is the last page of customers. + Links *CustomerPageLinksScheme `json:"_links,omitempty"` // Links related to the page of customers. + Values []*CustomerScheme `json:"values,omitempty"` // The customers on the page. } +// CustomerPageLinksScheme represents links related to a page of customers. type CustomerPageLinksScheme struct { - Base string `json:"base,omitempty"` - Context string `json:"context,omitempty"` - Next string `json:"next,omitempty"` - Prev string `json:"prev,omitempty"` + Base string `json:"base,omitempty"` // The base URL for the links. + Context string `json:"context,omitempty"` // The context for the links. + Next string `json:"next,omitempty"` // The URL for the next page of customers. + Prev string `json:"prev,omitempty"` // The URL for the previous page of customers. } +// CustomerScheme represents a customer in a system. type CustomerScheme struct { - AccountID string `json:"accountId,omitempty"` - Name string `json:"name,omitempty"` - Key string `json:"key,omitempty"` - EmailAddress string `json:"emailAddress,omitempty"` - DisplayName string `json:"displayName,omitempty"` - Active bool `json:"active,omitempty"` - TimeZone string `json:"timeZone,omitempty"` - Links *CustomerLinkScheme `json:"_links,omitempty"` + AccountID string `json:"accountId,omitempty"` // The account ID of the customer. + Name string `json:"name,omitempty"` // The name of the customer. + Key string `json:"key,omitempty"` // The key of the customer. + EmailAddress string `json:"emailAddress,omitempty"` // The email address of the customer. + DisplayName string `json:"displayName,omitempty"` // The display name of the customer. + Active bool `json:"active,omitempty"` // Indicates if the customer is active. + TimeZone string `json:"timeZone,omitempty"` // The time zone of the customer. + Links *CustomerLinkScheme `json:"_links,omitempty"` // Links related to the customer. } +// CustomerLinkScheme represents links related to a customer. type CustomerLinkScheme struct { - JiraRest string `json:"jiraRest"` - AvatarUrls *AvatarURLScheme `json:"avatarUrls"` - Self string `json:"self"` + JiraRest string `json:"jiraRest"` // The Jira REST API link for the customer. + AvatarUrls *AvatarURLScheme `json:"avatarUrls"` // The URLs for the customer's avatars. + Self string `json:"self"` // The URL for the customer itself. } diff --git a/pkg/infra/models/sm_info.go b/pkg/infra/models/sm_info.go index b04ba0fe..5736b70b 100644 --- a/pkg/infra/models/sm_info.go +++ b/pkg/infra/models/sm_info.go @@ -1,21 +1,24 @@ package models +// InfoScheme represents the information about a system. type InfoScheme struct { - Version string `json:"version,omitempty"` - PlatformVersion string `json:"platformVersion,omitempty"` - BuildDate *InfoBuildDataScheme `json:"buildDate,omitempty"` - BuildChangeSet string `json:"buildChangeSet,omitempty"` - IsLicensedForUse bool `json:"isLicensedForUse,omitempty"` - Links *InfoLinkScheme `json:"_links,omitempty"` + Version string `json:"version,omitempty"` // The version of the system. + PlatformVersion string `json:"platformVersion,omitempty"` // The platform version of the system. + BuildDate *InfoBuildDataScheme `json:"buildDate,omitempty"` // The build date of the system. + BuildChangeSet string `json:"buildChangeSet,omitempty"` // The build change set of the system. + IsLicensedForUse bool `json:"isLicensedForUse,omitempty"` // Indicates if the system is licensed for use. + Links *InfoLinkScheme `json:"_links,omitempty"` // Links related to the system. } +// InfoBuildDataScheme represents the build date of a system. type InfoBuildDataScheme struct { - Iso8601 string `json:"iso8601,omitempty"` - Jira string `json:"jira,omitempty"` - Friendly string `json:"friendly,omitempty"` - EpochMillis int64 `json:"epochMillis,omitempty"` + Iso8601 string `json:"iso8601,omitempty"` // The ISO 8601 format of the build date. + Jira string `json:"jira,omitempty"` // The Jira format of the build date. + Friendly string `json:"friendly,omitempty"` // The friendly format of the build date. + EpochMillis int64 `json:"epochMillis,omitempty"` // The epoch milliseconds of the build date. } +// InfoLinkScheme represents a link related to a system. type InfoLinkScheme struct { - Self string `json:"self,omitempty"` + Self string `json:"self,omitempty"` // The URL of the system itself. } diff --git a/pkg/infra/models/sm_knowledge_base.go b/pkg/infra/models/sm_knowledge_base.go index 64597e3b..85a990b9 100644 --- a/pkg/infra/models/sm_knowledge_base.go +++ b/pkg/infra/models/sm_knowledge_base.go @@ -1,34 +1,39 @@ package models +// ArticlePageScheme represents a page of articles in a system. type ArticlePageScheme struct { - Size int `json:"size,omitempty"` - Start int `json:"start,omitempty"` - Limit int `json:"limit,omitempty"` - IsLastPage bool `json:"isLastPage,omitempty"` - Values []*ArticleScheme `json:"values,omitempty"` - Expands []string `json:"_expands,omitempty"` - Links *ArticlePageLinkScheme `json:"_links,omitempty"` + Size int `json:"size,omitempty"` // The number of articles on the page. + Start int `json:"start,omitempty"` // The index of the first article on the page. + Limit int `json:"limit,omitempty"` // The maximum number of articles that can be on the page. + IsLastPage bool `json:"isLastPage,omitempty"` // Indicates if this is the last page of articles. + Values []*ArticleScheme `json:"values,omitempty"` // The articles on the page. + Expands []string `json:"_expands,omitempty"` // Additional data related to the articles. + Links *ArticlePageLinkScheme `json:"_links,omitempty"` // Links related to the page of articles. } +// ArticlePageLinkScheme represents links related to a page of articles. type ArticlePageLinkScheme struct { - Self string `json:"self,omitempty"` - Base string `json:"base,omitempty"` - Context string `json:"context,omitempty"` - Next string `json:"next,omitempty"` - Prev string `json:"prev,omitempty"` + Self string `json:"self,omitempty"` // The URL of the page itself. + Base string `json:"base,omitempty"` // The base URL for the links. + Context string `json:"context,omitempty"` // The context for the links. + Next string `json:"next,omitempty"` // The URL for the next page of articles. + Prev string `json:"prev,omitempty"` // The URL for the previous page of articles. } +// ArticleScheme represents an article in a system. type ArticleScheme struct { - Title string `json:"title,omitempty"` - Excerpt string `json:"excerpt,omitempty"` - Source *ArticleSourceScheme `json:"source,omitempty"` - Content *ArticleContentScheme `json:"content,omitempty"` + Title string `json:"title,omitempty"` // The title of the article. + Excerpt string `json:"excerpt,omitempty"` // An excerpt from the article. + Source *ArticleSourceScheme `json:"source,omitempty"` // The source of the article. + Content *ArticleContentScheme `json:"content,omitempty"` // The content of the article. } +// ArticleSourceScheme represents the source of an article. type ArticleSourceScheme struct { - Type string `json:"type,omitempty"` + Type string `json:"type,omitempty"` // The type of the source. } +// ArticleContentScheme represents the content of an article. type ArticleContentScheme struct { - IframeSrc string `json:"iframeSrc,omitempty"` + IframeSrc string `json:"iframeSrc,omitempty"` // The source of the iframe for the article content. } diff --git a/pkg/infra/models/sm_organization.go b/pkg/infra/models/sm_organization.go index 229b2cf6..9aaacfe7 100644 --- a/pkg/infra/models/sm_organization.go +++ b/pkg/infra/models/sm_organization.go @@ -1,61 +1,68 @@ package models +// OrganizationUsersPageScheme represents a page of organization users in a system. type OrganizationUsersPageScheme struct { - Size int `json:"size,omitempty"` - Start int `json:"start,omitempty"` - Limit int `json:"limit,omitempty"` - IsLastPage bool `json:"isLastPage,omitempty"` - Values []*OrganizationUserScheme `json:"values,omitempty"` - Expands []string `json:"_expands,omitempty"` - Links *OrganizationUsersPageLinkScheme `json:"_links,omitempty"` + Size int `json:"size,omitempty"` // The number of organization users on the page. + Start int `json:"start,omitempty"` // The index of the first organization user on the page. + Limit int `json:"limit,omitempty"` // The maximum number of organization users that can be on the page. + IsLastPage bool `json:"isLastPage,omitempty"` // Indicates if this is the last page of organization users. + Values []*OrganizationUserScheme `json:"values,omitempty"` // The organization users on the page. + Expands []string `json:"_expands,omitempty"` // Additional data related to the organization users. + Links *OrganizationUsersPageLinkScheme `json:"_links,omitempty"` // Links related to the page of organization users. } +// OrganizationUsersPageLinkScheme represents links related to a page of organization users. type OrganizationUsersPageLinkScheme struct { - Self string `json:"self,omitempty"` - Base string `json:"base,omitempty"` - Context string `json:"context,omitempty"` - Next string `json:"next,omitempty"` - Prev string `json:"prev,omitempty"` + Self string `json:"self,omitempty"` // The URL of the page itself. + Base string `json:"base,omitempty"` // The base URL for the links. + Context string `json:"context,omitempty"` // The context for the links. + Next string `json:"next,omitempty"` // The URL for the next page of organization users. + Prev string `json:"prev,omitempty"` // The URL for the previous page of organization users. } +// OrganizationUserScheme represents an organization user in a system. type OrganizationUserScheme struct { - AccountID string `json:"accountId,omitempty"` - Name string `json:"name,omitempty"` - Key string `json:"key,omitempty"` - EmailAddress string `json:"emailAddress,omitempty"` - DisplayName string `json:"displayName,omitempty"` - Active bool `json:"active,omitempty"` - TimeZone string `json:"timeZone,omitempty"` - Links *OrganizationUserLinkScheme `json:"_links,omitempty"` + AccountID string `json:"accountId,omitempty"` // The account ID of the organization user. + Name string `json:"name,omitempty"` // The name of the organization user. + Key string `json:"key,omitempty"` // The key of the organization user. + EmailAddress string `json:"emailAddress,omitempty"` // The email address of the organization user. + DisplayName string `json:"displayName,omitempty"` // The display name of the organization user. + Active bool `json:"active,omitempty"` // Indicates if the organization user is active. + TimeZone string `json:"timeZone,omitempty"` // The time zone of the organization user. + Links *OrganizationUserLinkScheme `json:"_links,omitempty"` // Links related to the organization user. } +// OrganizationUserLinkScheme represents links related to an organization user. type OrganizationUserLinkScheme struct { - Self string `json:"self,omitempty"` - JiraRest string `json:"jiraRest,omitempty"` + Self string `json:"self,omitempty"` // The URL of the organization user itself. + JiraRest string `json:"jiraRest,omitempty"` // The Jira REST API link for the organization user. } +// OrganizationPageScheme represents a page of organizations in a system. type OrganizationPageScheme struct { - Size int `json:"size,omitempty"` - Start int `json:"start,omitempty"` - Limit int `json:"limit,omitempty"` - IsLastPage bool `json:"isLastPage,omitempty"` - Values []*OrganizationScheme `json:"values,omitempty"` - Expands []string `json:"_expands,omitempty"` - Links *OrganizationPageLinkScheme `json:"_links,omitempty"` + Size int `json:"size,omitempty"` // The number of organizations on the page. + Start int `json:"start,omitempty"` // The index of the first organization on the page. + Limit int `json:"limit,omitempty"` // The maximum number of organizations that can be on the page. + IsLastPage bool `json:"isLastPage,omitempty"` // Indicates if this is the last page of organizations. + Values []*OrganizationScheme `json:"values,omitempty"` // The organizations on the page. + Expands []string `json:"_expands,omitempty"` // Additional data related to the organizations. + Links *OrganizationPageLinkScheme `json:"_links,omitempty"` // Links related to the page of organizations. } +// OrganizationPageLinkScheme represents links related to a page of organizations. type OrganizationPageLinkScheme struct { - Self string `json:"self,omitempty"` - Base string `json:"base,omitempty"` - Context string `json:"context,omitempty"` - Next string `json:"next,omitempty"` - Prev string `json:"prev,omitempty"` + Self string `json:"self,omitempty"` // The URL of the page itself. + Base string `json:"base,omitempty"` // The base URL for the links. + Context string `json:"context,omitempty"` // The context for the links. + Next string `json:"next,omitempty"` // The URL for the next page of organizations. + Prev string `json:"prev,omitempty"` // The URL for the previous page of organizations. } +// OrganizationScheme represents an organization in a system. type OrganizationScheme struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` + ID string `json:"id,omitempty"` // The ID of the organization. + Name string `json:"name,omitempty"` // The name of the organization. Links struct { - Self string `json:"self,omitempty"` - } `json:"_links,omitempty"` + Self string `json:"self,omitempty"` // The URL of the organization itself. + } `json:"_links,omitempty"` // Links related to the organization. } diff --git a/pkg/infra/models/sm_request.go b/pkg/infra/models/sm_request.go index c711c8cb..5ffbaa7f 100644 --- a/pkg/infra/models/sm_request.go +++ b/pkg/infra/models/sm_request.go @@ -1,118 +1,132 @@ package models +// ServiceRequestOptionScheme represents the options for a service request. type ServiceRequestOptionScheme struct { - ApprovalStatus, RequestStatus, SearchTerm string - OrganizationID, ServiceDeskID int - RequestTypeID int - Expand, RequestOwnerships []string + ApprovalStatus, RequestStatus, SearchTerm string // The approval status, request status, and search term for the service request. + OrganizationID, ServiceDeskID int // The organization ID and service desk ID for the service request. + RequestTypeID int // The request type ID for the service request. + Expand, RequestOwnerships []string // The fields to expand and the request ownerships for the service request. } +// CustomerRequestTransitionPageScheme represents a page of customer request transitions. type CustomerRequestTransitionPageScheme struct { - Size int `json:"size,omitempty"` - Start int `json:"start,omitempty"` - Limit int `json:"limit,omitempty"` - IsLastPage bool `json:"isLastPage,omitempty"` - Values []*CustomerRequestTransitionScheme `json:"values,omitempty"` - Expands []string `json:"_expands,omitempty"` - Links *CustomerRequestTransitionPageLinkScheme `json:"_links,omitempty"` + Size int `json:"size,omitempty"` // The number of customer request transitions on the page. + Start int `json:"start,omitempty"` // The index of the first customer request transition on the page. + Limit int `json:"limit,omitempty"` // The maximum number of customer request transitions that can be on the page. + IsLastPage bool `json:"isLastPage,omitempty"` // Indicates if this is the last page of customer request transitions. + Values []*CustomerRequestTransitionScheme `json:"values,omitempty"` // The customer request transitions on the page. + Expands []string `json:"_expands,omitempty"` // Additional data related to the customer request transitions. + Links *CustomerRequestTransitionPageLinkScheme `json:"_links,omitempty"` // Links related to the page of customer request transitions. } +// CustomerRequestTransitionScheme represents a customer request transition. type CustomerRequestTransitionScheme struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` + ID string `json:"id,omitempty"` // The ID of the customer request transition. + Name string `json:"name,omitempty"` // The name of the customer request transition. } +// CustomerRequestTransitionPageLinkScheme represents links related to a page of customer request transitions. type CustomerRequestTransitionPageLinkScheme struct { - Self string `json:"self,omitempty"` - Base string `json:"base,omitempty"` - Context string `json:"context,omitempty"` - Next string `json:"next,omitempty"` - Prev string `json:"prev,omitempty"` + Self string `json:"self,omitempty"` // The URL of the page itself. + Base string `json:"base,omitempty"` // The base URL for the links. + Context string `json:"context,omitempty"` // The context for the links. + Next string `json:"next,omitempty"` // The URL for the next page of customer request transitions. + Prev string `json:"prev,omitempty"` // The URL for the previous page of customer request transitions. } +// CustomerRequestPageScheme represents a page of customer requests. type CustomerRequestPageScheme struct { - Size int `json:"size,omitempty"` - Start int `json:"start,omitempty"` - Limit int `json:"limit,omitempty"` - IsLastPage bool `json:"isLastPage,omitempty"` - Values []*CustomerRequestScheme `json:"values,omitempty"` - Expands []string `json:"_expands,omitempty"` - Links *CustomerRequestsLinksScheme `json:"_links,omitempty"` + Size int `json:"size,omitempty"` // The number of customer requests on the page. + Start int `json:"start,omitempty"` // The index of the first customer request on the page. + Limit int `json:"limit,omitempty"` // The maximum number of customer requests that can be on the page. + IsLastPage bool `json:"isLastPage,omitempty"` // Indicates if this is the last page of customer requests. + Values []*CustomerRequestScheme `json:"values,omitempty"` // The customer requests on the page. + Expands []string `json:"_expands,omitempty"` // Additional data related to the customer requests. + Links *CustomerRequestsLinksScheme `json:"_links,omitempty"` // Links related to the page of customer requests. } +// CustomerRequestsLinksScheme represents links related to a page of customer requests. type CustomerRequestsLinksScheme struct { - Self string `json:"self,omitempty"` - Base string `json:"base,omitempty"` - Context string `json:"context,omitempty"` - Next string `json:"next,omitempty"` - Prev string `json:"prev,omitempty"` + Self string `json:"self,omitempty"` // The URL of the page itself. + Base string `json:"base,omitempty"` // The base URL for the links. + Context string `json:"context,omitempty"` // The context for the links. + Next string `json:"next,omitempty"` // The URL for the next page of customer requests. + Prev string `json:"prev,omitempty"` // The URL for the previous page of customer requests. } +// CustomerRequestTypeScheme represents a type of customer request. type CustomerRequestTypeScheme struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - HelpText string `json:"helpText,omitempty"` - IssueTypeID string `json:"issueTypeId,omitempty"` - ServiceDeskID string `json:"serviceDeskId,omitempty"` - GroupIds []string `json:"groupIds,omitempty"` + ID string `json:"id,omitempty"` // The ID of the customer request type. + Name string `json:"name,omitempty"` // The name of the customer request type. + Description string `json:"description,omitempty"` // The description of the customer request type. + HelpText string `json:"helpText,omitempty"` // The help text for the customer request type. + IssueTypeID string `json:"issueTypeId,omitempty"` // The issue type ID for the customer request type. + ServiceDeskID string `json:"serviceDeskId,omitempty"` // The service desk ID for the customer request type. + GroupIds []string `json:"groupIds,omitempty"` // The group IDs for the customer request type. } +// CustomerRequestServiceDeskScheme represents a service desk for a customer request. type CustomerRequestServiceDeskScheme struct { - ID string `json:"id,omitempty"` - ProjectID string `json:"projectId,omitempty"` - ProjectName string `json:"projectName,omitempty"` - ProjectKey string `json:"projectKey,omitempty"` + ID string `json:"id,omitempty"` // The ID of the service desk. + ProjectID string `json:"projectId,omitempty"` // The project ID for the service desk. + ProjectName string `json:"projectName,omitempty"` // The project name for the service desk. + ProjectKey string `json:"projectKey,omitempty"` // The project key for the service desk. } +// CustomerRequestDateScheme represents a date for a customer request. type CustomerRequestDateScheme struct { - Iso8601 string `json:"iso8601,omitempty"` - Jira string `json:"jira,omitempty"` - Friendly string `json:"friendly,omitempty"` - EpochMillis int `json:"epochMillis,omitempty"` + Iso8601 string `json:"iso8601,omitempty"` // The ISO 8601 format of the date. + Jira string `json:"jira,omitempty"` // The Jira format of the date. + Friendly string `json:"friendly,omitempty"` // The friendly format of the date. + EpochMillis int `json:"epochMillis,omitempty"` // The epoch milliseconds of the date. } +// CustomerRequestReporterScheme represents a reporter for a customer request. type CustomerRequestReporterScheme struct { - AccountID string `json:"accountId,omitempty"` - Name string `json:"name,omitempty"` - Key string `json:"key,omitempty"` - EmailAddress string `json:"emailAddress,omitempty"` - DisplayName string `json:"displayName,omitempty"` - Active bool `json:"active,omitempty"` - TimeZone string `json:"timeZone,omitempty"` + AccountID string `json:"accountId,omitempty"` // The account ID of the reporter. + Name string `json:"name,omitempty"` // The name of the reporter. + Key string `json:"key,omitempty"` // The key of the reporter. + EmailAddress string `json:"emailAddress,omitempty"` // The email address of the reporter. + DisplayName string `json:"displayName,omitempty"` // The display name of the reporter. + Active bool `json:"active,omitempty"` // Indicates if the reporter is active. + TimeZone string `json:"timeZone,omitempty"` // The time zone of the reporter. } +// CustomerRequestRequestFieldValueScheme represents the field value of a customer request. type CustomerRequestRequestFieldValueScheme struct { - FieldID string `json:"fieldId,omitempty"` - Label string `json:"label,omitempty"` - Value interface{} `json:"value,omitempty"` + FieldID string `json:"fieldId,omitempty"` // The ID of the field. + Label string `json:"label,omitempty"` // The label of the field. + Value interface{} `json:"value,omitempty"` // The value of the field. } +// CustomerRequestCurrentStatusScheme represents the current status of a customer request. type CustomerRequestCurrentStatusScheme struct { - Status string `json:"status,omitempty"` - StatusCategory string `json:"statusCategory,omitempty"` + Status string `json:"status,omitempty"` // The status of the customer request. + StatusCategory string `json:"statusCategory,omitempty"` // The category of the status. StatusDate struct { - } `json:"statusDate,omitempty"` + } `json:"statusDate,omitempty"` // The date of the status. } +// CustomerRequestLinksScheme represents the links related to a customer request. type CustomerRequestLinksScheme struct { - Self string `json:"self,omitempty"` - JiraRest string `json:"jiraRest,omitempty"` - Web string `json:"web,omitempty"` - Agent string `json:"agent,omitempty"` + Self string `json:"self,omitempty"` // The URL of the customer request itself. + JiraRest string `json:"jiraRest,omitempty"` // The Jira REST API link for the customer request. + Web string `json:"web,omitempty"` // The web link for the customer request. + Agent string `json:"agent,omitempty"` // The agent link for the customer request. } +// CustomerRequestScheme represents a customer request. type CustomerRequestScheme struct { - IssueID string `json:"issueId,omitempty"` - IssueKey string `json:"issueKey,omitempty"` - RequestTypeID string `json:"requestTypeId,omitempty"` - RequestType *CustomerRequestTypeScheme `json:"requestType,omitempty"` - ServiceDeskID string `json:"serviceDeskId,omitempty"` - ServiceDesk *CustomerRequestServiceDeskScheme `json:"serviceDesk,omitempty"` - CreatedDate *CustomerRequestDateScheme `json:"createdDate,omitempty"` - Reporter *CustomerRequestReporterScheme `json:"reporter,omitempty"` - RequestFieldValues []*CustomerRequestRequestFieldValueScheme `json:"requestFieldValues,omitempty"` - CurrentStatus *CustomerRequestCurrentStatusScheme `json:"currentStatus,omitempty"` - Expands []string `json:"_expands,omitempty"` - Links *CustomerRequestLinksScheme `json:"_links,omitempty"` + IssueID string `json:"issueId,omitempty"` // The issue ID of the customer request. + IssueKey string `json:"issueKey,omitempty"` // The issue key of the customer request. + RequestTypeID string `json:"requestTypeId,omitempty"` // The request type ID of the customer request. + RequestType *CustomerRequestTypeScheme `json:"requestType,omitempty"` // The request type of the customer request. + ServiceDeskID string `json:"serviceDeskId,omitempty"` // The service desk ID of the customer request. + ServiceDesk *CustomerRequestServiceDeskScheme `json:"serviceDesk,omitempty"` // The service desk of the customer request. + CreatedDate *CustomerRequestDateScheme `json:"createdDate,omitempty"` // The created date of the customer request. + Reporter *CustomerRequestReporterScheme `json:"reporter,omitempty"` // The reporter of the customer request. + RequestFieldValues []*CustomerRequestRequestFieldValueScheme `json:"requestFieldValues,omitempty"` // The field values of the customer request. + CurrentStatus *CustomerRequestCurrentStatusScheme `json:"currentStatus,omitempty"` // The current status of the customer request. + Expands []string `json:"_expands,omitempty"` // The fields to expand in the customer request. + Links *CustomerRequestLinksScheme `json:"_links,omitempty"` // The links related to the customer request. } diff --git a/pkg/infra/models/sm_request_approval.go b/pkg/infra/models/sm_request_approval.go index 3e34d5fd..d001d927 100644 --- a/pkg/infra/models/sm_request_approval.go +++ b/pkg/infra/models/sm_request_approval.go @@ -1,56 +1,63 @@ package models +// CustomerApprovalPageScheme represents a page of customer approvals in a system. type CustomerApprovalPageScheme struct { - Size int `json:"size,omitempty"` - Start int `json:"start,omitempty"` - Limit int `json:"limit,omitempty"` - IsLastPage bool `json:"isLastPage,omitempty"` - Values []*CustomerApprovalScheme `json:"values,omitempty"` - Expands []string `json:"_expands,omitempty"` - Links *CustomerApprovalPageLinkScheme `json:"_links,omitempty"` + Size int `json:"size,omitempty"` // The number of customer approvals on the page. + Start int `json:"start,omitempty"` // The index of the first customer approval on the page. + Limit int `json:"limit,omitempty"` // The maximum number of customer approvals that can be on the page. + IsLastPage bool `json:"isLastPage,omitempty"` // Indicates if this is the last page of customer approvals. + Values []*CustomerApprovalScheme `json:"values,omitempty"` // The customer approvals on the page. + Expands []string `json:"_expands,omitempty"` // Additional data related to the customer approvals. + Links *CustomerApprovalPageLinkScheme `json:"_links,omitempty"` // Links related to the page of customer approvals. } +// CustomerApprovalPageLinkScheme represents links related to a page of customer approvals. type CustomerApprovalPageLinkScheme struct { - Self string `json:"self,omitempty"` - Base string `json:"base,omitempty"` - Context string `json:"context,omitempty"` - Next string `json:"next,omitempty"` - Prev string `json:"prev,omitempty"` + Self string `json:"self,omitempty"` // The URL of the page itself. + Base string `json:"base,omitempty"` // The base URL for the links. + Context string `json:"context,omitempty"` // The context for the links. + Next string `json:"next,omitempty"` // The URL for the next page of customer approvals. + Prev string `json:"prev,omitempty"` // The URL for the previous page of customer approvals. } +// CustomerApprovalScheme represents a customer approval in a system. type CustomerApprovalScheme struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - FinalDecision string `json:"finalDecision,omitempty"` - CanAnswerApproval bool `json:"canAnswerApproval,omitempty"` - Approvers []*CustomerApproveScheme `json:"approvers,omitempty"` - CreatedDate *CustomerRequestDateScheme `json:"createdDate,omitempty"` - CompletedDate *CustomerRequestDateScheme `json:"completedDate,omitempty"` - Links *CustomerApprovalLinkScheme `json:"_links,omitempty"` + ID string `json:"id,omitempty"` // The ID of the customer approval. + Name string `json:"name,omitempty"` // The name of the customer approval. + FinalDecision string `json:"finalDecision,omitempty"` // The final decision of the customer approval. + CanAnswerApproval bool `json:"canAnswerApproval,omitempty"` // Indicates if the customer approval can be answered. + Approvers []*CustomerApproveScheme `json:"approvers,omitempty"` // The approvers of the customer approval. + CreatedDate *CustomerRequestDateScheme `json:"createdDate,omitempty"` // The created date of the customer approval. + CompletedDate *CustomerRequestDateScheme `json:"completedDate,omitempty"` // The completed date of the customer approval. + Links *CustomerApprovalLinkScheme `json:"_links,omitempty"` // Links related to the customer approval. } +// CustomerApprovalLinkScheme represents links related to a customer approval. type CustomerApprovalLinkScheme struct { - Self string `json:"self"` + Self string `json:"self"` // The URL of the customer approval itself. } +// CustomerApproveScheme represents an approver of a customer approval. type CustomerApproveScheme struct { - Approver *ApproverScheme `json:"approver,omitempty"` - ApproverDecision string `json:"approverDecision,omitempty"` + Approver *ApproverScheme `json:"approver,omitempty"` // The approver of the customer approval. + ApproverDecision string `json:"approverDecision,omitempty"` // The decision of the approver. } +// ApproverScheme represents an approver in a system. type ApproverScheme struct { - AccountID string `json:"accountId,omitempty"` - Name string `json:"name,omitempty"` - Key string `json:"key,omitempty"` - EmailAddress string `json:"emailAddress,omitempty"` - DisplayName string `json:"displayName,omitempty"` - Active bool `json:"active,omitempty"` - TimeZone string `json:"timeZone,omitempty"` - Links *ApproverLinkScheme `json:"_links,omitempty"` + AccountID string `json:"accountId,omitempty"` // The account ID of the approver. + Name string `json:"name,omitempty"` // The name of the approver. + Key string `json:"key,omitempty"` // The key of the approver. + EmailAddress string `json:"emailAddress,omitempty"` // The email address of the approver. + DisplayName string `json:"displayName,omitempty"` // The display name of the approver. + Active bool `json:"active,omitempty"` // Indicates if the approver is active. + TimeZone string `json:"timeZone,omitempty"` // The time zone of the approver. + Links *ApproverLinkScheme `json:"_links,omitempty"` // Links related to the approver. } +// ApproverLinkScheme represents links related to an approver. type ApproverLinkScheme struct { - JiraRest string `json:"jiraRest,omitempty"` - AvatarUrls *AvatarURLScheme `json:"avatarUrls,omitempty"` - Self string `json:"self,omitempty"` + JiraRest string `json:"jiraRest,omitempty"` // The Jira REST API link for the approver. + AvatarUrls *AvatarURLScheme `json:"avatarUrls,omitempty"` // The avatar URLs of the approver. + Self string `json:"self,omitempty"` // The URL of the approver itself. } diff --git a/pkg/infra/models/sm_request_attachments.go b/pkg/infra/models/sm_request_attachments.go index 31c9eed9..b268145e 100644 --- a/pkg/infra/models/sm_request_attachments.go +++ b/pkg/infra/models/sm_request_attachments.go @@ -1,62 +1,69 @@ package models +// RequestAttachmentPageScheme represents a page of request attachments in a system. type RequestAttachmentPageScheme struct { - Size int `json:"size,omitempty"` - Start int `json:"start,omitempty"` - Limit int `json:"limit,omitempty"` - IsLastPage bool `json:"isLastPage,omitempty"` - Values []*RequestAttachmentScheme `json:"values,omitempty"` - Expands []string `json:"_expands,omitempty"` - Links *RequestAttachmentPageLinkScheme `json:"_links,omitempty"` + Size int `json:"size,omitempty"` // The number of request attachments on the page. + Start int `json:"start,omitempty"` // The index of the first request attachment on the page. + Limit int `json:"limit,omitempty"` // The maximum number of request attachments that can be on the page. + IsLastPage bool `json:"isLastPage,omitempty"` // Indicates if this is the last page of request attachments. + Values []*RequestAttachmentScheme `json:"values,omitempty"` // The request attachments on the page. + Expands []string `json:"_expands,omitempty"` // Additional data related to the request attachments. + Links *RequestAttachmentPageLinkScheme `json:"_links,omitempty"` // Links related to the page of request attachments. } +// RequestAttachmentPageLinkScheme represents links related to a page of request attachments. type RequestAttachmentPageLinkScheme struct { - Self string `json:"self,omitempty"` - Base string `json:"base,omitempty"` - Context string `json:"context,omitempty"` - Next string `json:"next,omitempty"` - Prev string `json:"prev,omitempty"` + Self string `json:"self,omitempty"` // The URL of the page itself. + Base string `json:"base,omitempty"` // The base URL for the links. + Context string `json:"context,omitempty"` // The context for the links. + Next string `json:"next,omitempty"` // The URL for the next page of request attachments. + Prev string `json:"prev,omitempty"` // The URL for the previous page of request attachments. } +// RequestAttachmentScheme represents a request attachment in a system. type RequestAttachmentScheme struct { - Filename string `json:"filename,omitempty"` - Author *RequestAuthorScheme `json:"author,omitempty"` - Created *CustomerRequestDateScheme `json:"created,omitempty"` - Size int `json:"size,omitempty"` - MimeType string `json:"mimeType,omitempty"` - Links *RequestAttachmentLinkScheme `json:"_links,omitempty"` + Filename string `json:"filename,omitempty"` // The filename of the request attachment. + Author *RequestAuthorScheme `json:"author,omitempty"` // The author of the request attachment. + Created *CustomerRequestDateScheme `json:"created,omitempty"` // The created date of the request attachment. + Size int `json:"size,omitempty"` // The size of the request attachment. + MimeType string `json:"mimeType,omitempty"` // The MIME type of the request attachment. + Links *RequestAttachmentLinkScheme `json:"_links,omitempty"` // Links related to the request attachment. } +// RequestAttachmentLinkScheme represents links related to a request attachment. type RequestAttachmentLinkScheme struct { - Self string `json:"self,omitempty"` - JiraRest string `json:"jiraRest,omitempty"` - Content string `json:"content,omitempty"` - Thumbnail string `json:"thumbnail,omitempty"` + Self string `json:"self,omitempty"` // The URL of the request attachment itself. + JiraRest string `json:"jiraRest,omitempty"` // The Jira REST API link for the request attachment. + Content string `json:"content,omitempty"` // The content link for the request attachment. + Thumbnail string `json:"thumbnail,omitempty"` // The thumbnail link for the request attachment. } +// RequestAuthorScheme represents an author in a system. type RequestAuthorScheme struct { - AccountID string `json:"accountId,omitempty"` - Name string `json:"name,omitempty"` - Key string `json:"key,omitempty"` - EmailAddress string `json:"emailAddress,omitempty"` - DisplayName string `json:"displayName,omitempty"` - Active bool `json:"active,omitempty"` - TimeZone string `json:"timeZone,omitempty"` + AccountID string `json:"accountId,omitempty"` // The account ID of the author. + Name string `json:"name,omitempty"` // The name of the author. + Key string `json:"key,omitempty"` // The key of the author. + EmailAddress string `json:"emailAddress,omitempty"` // The email address of the author. + DisplayName string `json:"displayName,omitempty"` // The display name of the author. + Active bool `json:"active,omitempty"` // Indicates if the author is active. + TimeZone string `json:"timeZone,omitempty"` // The time zone of the author. } +// RequestAttachmentCreationCommentScheme represents a comment during the creation of a request attachment. type RequestAttachmentCreationCommentScheme struct { - Expands []string `json:"_expands,omitempty"` - ID string `json:"id,omitempty"` - Body string `json:"body,omitempty"` - Public bool `json:"public,omitempty"` - Author RequestAuthorScheme `json:"author,omitempty"` - Created *CustomerRequestDateScheme `json:"created,omitempty"` + Expands []string `json:"_expands,omitempty"` // The fields to expand in the comment. + ID string `json:"id,omitempty"` // The ID of the comment. + Body string `json:"body,omitempty"` // The body of the comment. + Public bool `json:"public,omitempty"` // Indicates if the comment is public. + Author RequestAuthorScheme `json:"author,omitempty"` // The author of the comment. + Created *CustomerRequestDateScheme `json:"created,omitempty"` // The created date of the comment. Links struct { - Self string `json:"self,omitempty"` - } `json:"_links,omitempty"` + Self string `json:"self,omitempty"` // The URL of the comment itself. + } `json:"_links,omitempty"` // Links related to the comment. } +// RequestAttachmentCreationScheme represents the creation of a request attachment. type RequestAttachmentCreationScheme struct { - Comment *RequestAttachmentCreationCommentScheme `json:"comment,omitempty"` - Attachments *RequestAttachmentPageScheme `json:"attachments,omitempty"` + Comment *RequestAttachmentCreationCommentScheme `json:"comment,omitempty"` // The comment during the creation of the request attachment. + Attachments *RequestAttachmentPageScheme `json:"attachments,omitempty"` // The request attachment that was created. } diff --git a/pkg/infra/models/sm_request_comment.go b/pkg/infra/models/sm_request_comment.go index 3ba6b27e..7e6b4831 100644 --- a/pkg/infra/models/sm_request_comment.go +++ b/pkg/infra/models/sm_request_comment.go @@ -1,39 +1,44 @@ package models +// RequestCommentPageScheme represents a page of request comments in a system. type RequestCommentPageScheme struct { - Size int `json:"size"` - Start int `json:"start"` - Limit int `json:"limit"` - IsLastPage bool `json:"isLastPage"` - Values []*RequestCommentScheme `json:"values"` - Expands []string `json:"_expands"` - Links *RequestCommentPageLinkScheme `json:"_links"` + Size int `json:"size"` // The number of request comments on the page. + Start int `json:"start"` // The index of the first request comment on the page. + Limit int `json:"limit"` // The maximum number of request comments that can be on the page. + IsLastPage bool `json:"isLastPage"` // Indicates if this is the last page of request comments. + Values []*RequestCommentScheme `json:"values"` // The request comments on the page. + Expands []string `json:"_expands"` // Additional data related to the request comments. + Links *RequestCommentPageLinkScheme `json:"_links"` // Links related to the page of request comments. } +// RequestCommentPageLinkScheme represents links related to a page of request comments. type RequestCommentPageLinkScheme struct { - Self string `json:"self"` - Base string `json:"base"` - Context string `json:"context"` - Next string `json:"next"` - Prev string `json:"prev"` + Self string `json:"self"` // The URL of the page itself. + Base string `json:"base"` // The base URL for the links. + Context string `json:"context"` // The context for the links. + Next string `json:"next"` // The URL for the next page of request comments. + Prev string `json:"prev"` // The URL for the previous page of request comments. } +// RequestCommentScheme represents a request comment in a system. type RequestCommentScheme struct { - ID string `json:"id,omitempty"` - Body string `json:"body,omitempty"` - RenderedBody *RequestCommentRenderScheme `json:"renderedBody,omitempty"` - Author *RequestAuthorScheme `json:"author,omitempty"` - Created *CustomerRequestDateScheme `json:"created,omitempty"` - Attachments *RequestAttachmentPageScheme `json:"attachments,omitempty"` - Expands []string `json:"_expands,omitempty"` - Public bool `json:"public,omitempty"` - Links *RequestCommentLinkScheme `json:"_links,omitempty"` + ID string `json:"id,omitempty"` // The ID of the request comment. + Body string `json:"body,omitempty"` // The body of the request comment. + RenderedBody *RequestCommentRenderScheme `json:"renderedBody,omitempty"` // The rendered body of the request comment. + Author *RequestAuthorScheme `json:"author,omitempty"` // The author of the request comment. + Created *CustomerRequestDateScheme `json:"created,omitempty"` // The created date of the request comment. + Attachments *RequestAttachmentPageScheme `json:"attachments,omitempty"` // The attachments of the request comment. + Expands []string `json:"_expands,omitempty"` // The fields to expand in the request comment. + Public bool `json:"public,omitempty"` // Indicates if the request comment is public. + Links *RequestCommentLinkScheme `json:"_links,omitempty"` // Links related to the request comment. } +// RequestCommentLinkScheme represents links related to a request comment. type RequestCommentLinkScheme struct { - Self string `json:"self"` + Self string `json:"self"` // The URL of the request comment itself. } +// RequestCommentRenderScheme represents the rendered body of a request comment. type RequestCommentRenderScheme struct { - HTML string `json:"html"` + HTML string `json:"html"` // The HTML of the rendered body. } diff --git a/pkg/infra/models/sm_request_feedback.go b/pkg/infra/models/sm_request_feedback.go index 98083ec1..11a16b5d 100644 --- a/pkg/infra/models/sm_request_feedback.go +++ b/pkg/infra/models/sm_request_feedback.go @@ -1,11 +1,13 @@ package models +// CustomerFeedbackScheme represents the feedback provided by a customer. type CustomerFeedbackScheme struct { - Type string `json:"type,omitempty"` - Rating int `json:"rating,omitempty"` - Comment *CustomerFeedbackCommentScheme `json:"comment,omitempty"` + Type string `json:"type,omitempty"` // The type of feedback. + Rating int `json:"rating,omitempty"` // The rating provided in the feedback. + Comment *CustomerFeedbackCommentScheme `json:"comment,omitempty"` // The comment provided in the feedback. } +// CustomerFeedbackCommentScheme represents the comment provided in a customer's feedback. type CustomerFeedbackCommentScheme struct { - Body string `json:"body,omitempty"` + Body string `json:"body,omitempty"` // The body of the comment. } diff --git a/pkg/infra/models/sm_request_field.go b/pkg/infra/models/sm_request_field.go index e867894a..b0ff15db 100644 --- a/pkg/infra/models/sm_request_field.go +++ b/pkg/infra/models/sm_request_field.go @@ -4,21 +4,27 @@ import ( "time" ) +// CreateCustomerRequestPayloadScheme represents the payload for creating a customer request. type CreateCustomerRequestPayloadScheme struct { - Channel string `json:"channel,omitempty"` - Form *CreateCustomerRequestFormPayloadScheme `json:"form,omitempty"` - IsAdfRequest bool `json:"isAdfRequest,omitempty"` - RaiseOnBehalfOf string `json:"raiseOnBehalfOf,omitempty"` - RequestFieldValues map[string]interface{} `json:"requestFieldValues,omitempty"` - RequestParticipants []string `json:"requestParticipants,omitempty"` - RequestTypeID string `json:"requestTypeId,omitempty"` - ServiceDeskID string `json:"serviceDeskId,omitempty"` + Channel string `json:"channel,omitempty"` // The channel through which the request is made. + Form *CreateCustomerRequestFormPayloadScheme `json:"form,omitempty"` // The form associated with the request. + IsAdfRequest bool `json:"isAdfRequest,omitempty"` // Indicates if the request is an Atlassian Document Format (ADF) request. + RaiseOnBehalfOf string `json:"raiseOnBehalfOf,omitempty"` // The account ID of the user on whose behalf the request is raised. + RequestFieldValues map[string]interface{} `json:"requestFieldValues,omitempty"` // The custom field values for the request. + RequestParticipants []string `json:"requestParticipants,omitempty"` // The account IDs of the participants of the request. + RequestTypeID string `json:"requestTypeId,omitempty"` // The ID of the request type. + ServiceDeskID string `json:"serviceDeskId,omitempty"` // The ID of the service desk. } +// CreateCustomerRequestFormPayloadScheme represents the form payload for creating a customer request. type CreateCustomerRequestFormPayloadScheme struct { - Answers interface{} `json:"answers,omitempty"` + Answers interface{} `json:"answers,omitempty"` // The answers provided in the form. } +// AddCustomField adds a custom field to the request payload. +// It takes a key which is the name of the custom field and a value which is the value of the custom field. +// If the RequestFieldValues map is not initialized, it initializes it. +// It returns an error if any occurs during the process. func (c *CreateCustomerRequestPayloadScheme) AddCustomField(key string, value interface{}) error { if c.RequestFieldValues == nil { @@ -29,6 +35,10 @@ func (c *CreateCustomerRequestPayloadScheme) AddCustomField(key string, value in return nil } +// DateTimeCustomField adds a custom field of type DateTime to the request payload. +// It takes an id which is the name of the custom field and a value which is the value of the custom field. +// The value is formatted as RFC3339. +// It returns an error if the id is empty or the value is zero. func (c *CreateCustomerRequestPayloadScheme) DateTimeCustomField(id string, value time.Time) error { if id == "" { @@ -42,6 +52,10 @@ func (c *CreateCustomerRequestPayloadScheme) DateTimeCustomField(id string, valu return c.AddCustomField(id, value.Format(time.RFC3339)) } +// DateCustomField adds a custom field of type Date to the request payload. +// It takes an id which is the name of the custom field and a value which is the value of the custom field. +// The value is formatted as "2006-01-02". +// It returns an error if the id is empty or the value is zero. func (c *CreateCustomerRequestPayloadScheme) DateCustomField(id string, value time.Time) error { if id == "" { @@ -55,6 +69,9 @@ func (c *CreateCustomerRequestPayloadScheme) DateCustomField(id string, value ti return c.AddCustomField(id, value.Format("2006-01-02")) } +// MultiSelectOrCheckBoxCustomField adds a custom field of type MultiSelect or CheckBox to the request payload. +// It takes an id which is the name of the custom field and values which are the values of the custom field. +// It returns an error if the id is empty or the values slice is empty. func (c *CreateCustomerRequestPayloadScheme) MultiSelectOrCheckBoxCustomField(id string, values []string) error { if id == "" { @@ -75,6 +92,9 @@ func (c *CreateCustomerRequestPayloadScheme) MultiSelectOrCheckBoxCustomField(id return c.AddCustomField(id, options) } +// UserCustomField adds a custom field of type User to the request payload. +// It takes an id which is the name of the custom field and an accountID which is the account ID of the user. +// It returns an error if the id or accountID is empty. func (c *CreateCustomerRequestPayloadScheme) UserCustomField(id, accountID string) error { if id == "" { @@ -88,6 +108,9 @@ func (c *CreateCustomerRequestPayloadScheme) UserCustomField(id, accountID strin return c.AddCustomField(id, map[string]interface{}{"accountId": accountID}) } +// UsersCustomField adds a custom field of type Users to the request payload. +// It takes an id which is the name of the custom field and accountIDs which are the account IDs of the users. +// It returns an error if the id is empty or the accountIDs slice is empty or contains an empty string. func (c *CreateCustomerRequestPayloadScheme) UsersCustomField(id string, accountIDs []string) error { if id == "" { @@ -111,6 +134,10 @@ func (c *CreateCustomerRequestPayloadScheme) UsersCustomField(id string, account return c.AddCustomField(id, accounts) } +// CascadingCustomField adds a custom field of type Cascading to the request payload. +// It takes an id which is the name of the custom field, a parent which is the parent value of the cascading field, +// and a child which is the child value of the cascading field. +// It returns an error if the id, parent, or child is empty. func (c *CreateCustomerRequestPayloadScheme) CascadingCustomField(id, parent, child string) error { if id == "" { @@ -129,6 +156,9 @@ func (c *CreateCustomerRequestPayloadScheme) CascadingCustomField(id, parent, ch return c.AddCustomField(id, map[string]interface{}{"value": parent, "child": childNode}) } +// GroupsCustomField adds a custom field of type Groups to the request payload. +// It takes an id which is the name of the custom field and names which are the names of the groups. +// It returns an error if the id is empty or the names slice is empty or contains an empty string. func (c *CreateCustomerRequestPayloadScheme) GroupsCustomField(id string, names []string) error { if id == "" { @@ -152,6 +182,9 @@ func (c *CreateCustomerRequestPayloadScheme) GroupsCustomField(id string, names return c.AddCustomField(id, groups) } +// GroupCustomField adds a custom field of type Group to the request payload. +// It takes an id which is the name of the custom field and a name which is the name of the group. +// It returns an error if the id or name is empty. func (c *CreateCustomerRequestPayloadScheme) GroupCustomField(id, name string) error { if id == "" { @@ -165,6 +198,9 @@ func (c *CreateCustomerRequestPayloadScheme) GroupCustomField(id, name string) e return c.AddCustomField(id, map[string]interface{}{"name": name}) } +// RadioButtonOrSelectCustomField adds a custom field of type RadioButton or Select to the request payload. +// It takes an id which is the name of the custom field and an option which is the selected option. +// It returns an error if the id or option is empty. func (c *CreateCustomerRequestPayloadScheme) RadioButtonOrSelectCustomField(id string, option string) error { if id == "" { @@ -178,6 +214,9 @@ func (c *CreateCustomerRequestPayloadScheme) RadioButtonOrSelectCustomField(id s return c.AddCustomField(id, map[string]interface{}{"value": option}) } +// Components adds a custom field of type Components to the request payload. +// It takes components which are the names of the components. +// It returns an error if the components slice is empty or contains an empty string. func (c *CreateCustomerRequestPayloadScheme) Components(components []string) error { if len(components) == 0 { diff --git a/pkg/infra/models/sm_request_participants.go b/pkg/infra/models/sm_request_participants.go index 3aba93ef..4b9ffe01 100644 --- a/pkg/infra/models/sm_request_participants.go +++ b/pkg/infra/models/sm_request_participants.go @@ -1,35 +1,39 @@ package models +// RequestParticipantPageScheme represents a page of request participants. type RequestParticipantPageScheme struct { - Size int `json:"size,omitempty"` - Start int `json:"start,omitempty"` - Limit int `json:"limit,omitempty"` - IsLastPage bool `json:"isLastPage,omitempty"` - Values []*RequestParticipantScheme `json:"values,omitempty"` - Expands []string `json:"_expands,omitempty"` - Links *RequestParticipantPageLinkScheme `json:"_links,omitempty"` + Size int `json:"size,omitempty"` // The size of the page. + Start int `json:"start,omitempty"` // The start index of the page. + Limit int `json:"limit,omitempty"` // The limit of the page. + IsLastPage bool `json:"isLastPage,omitempty"` // Indicates if this is the last page. + Values []*RequestParticipantScheme `json:"values,omitempty"` // The request participants in the page. + Expands []string `json:"_expands,omitempty"` // The fields to expand in the page. + Links *RequestParticipantPageLinkScheme `json:"_links,omitempty"` // The links related to the page. } +// RequestParticipantPageLinkScheme represents the links related to a page of request participants. type RequestParticipantPageLinkScheme struct { - Self string `json:"self,omitempty"` - Base string `json:"base,omitempty"` - Context string `json:"context,omitempty"` - Next string `json:"next,omitempty"` - Prev string `json:"prev,omitempty"` + Self string `json:"self,omitempty"` // The self link of the page. + Base string `json:"base,omitempty"` // The base link of the page. + Context string `json:"context,omitempty"` // The context link of the page. + Next string `json:"next,omitempty"` // The next link of the page. + Prev string `json:"prev,omitempty"` // The previous link of the page. } +// RequestParticipantScheme represents a request participant. type RequestParticipantScheme struct { - AccountID string `json:"accountId,omitempty"` - Name string `json:"name,omitempty"` - Key string `json:"key,omitempty"` - EmailAddress string `json:"emailAddress,omitempty"` - DisplayName string `json:"displayName,omitempty"` - Active bool `json:"active,omitempty"` - TimeZone string `json:"timeZone,omitempty"` - Links *RequestParticipantLinkScheme `json:"_links,omitempty"` + AccountID string `json:"accountId,omitempty"` // The account ID of the participant. + Name string `json:"name,omitempty"` // The name of the participant. + Key string `json:"key,omitempty"` // The key of the participant. + EmailAddress string `json:"emailAddress,omitempty"` // The email address of the participant. + DisplayName string `json:"displayName,omitempty"` // The display name of the participant. + Active bool `json:"active,omitempty"` // Indicates if the participant is active. + TimeZone string `json:"timeZone,omitempty"` // The time zone of the participant. + Links *RequestParticipantLinkScheme `json:"_links,omitempty"` // The links related to the participant. } +// RequestParticipantLinkScheme represents the links related to a request participant. type RequestParticipantLinkScheme struct { - Self string `json:"self,omitempty"` - JiraRest string `json:"jiraRest,omitempty"` + Self string `json:"self,omitempty"` // The self link of the participant. + JiraRest string `json:"jiraRest,omitempty"` // The Jira REST link of the participant. } diff --git a/pkg/infra/models/sm_request_sla.go b/pkg/infra/models/sm_request_sla.go index 53ff6fa0..d484bda7 100644 --- a/pkg/infra/models/sm_request_sla.go +++ b/pkg/infra/models/sm_request_sla.go @@ -1,36 +1,41 @@ package models +// RequestSLAPageScheme represents a page of request SLAs. type RequestSLAPageScheme struct { - Size int `json:"size,omitempty"` - Start int `json:"start,omitempty"` - Limit int `json:"limit,omitempty"` - IsLastPage bool `json:"isLastPage,omitempty"` - Values []*RequestSLAScheme `json:"values,omitempty"` - Expands []string `json:"_expands,omitempty"` - Links *RequestSLAPageLinkScheme `json:"_links,omitempty"` + Size int `json:"size,omitempty"` // The size of the page. + Start int `json:"start,omitempty"` // The start index of the page. + Limit int `json:"limit,omitempty"` // The limit of the page. + IsLastPage bool `json:"isLastPage,omitempty"` // Indicates if this is the last page. + Values []*RequestSLAScheme `json:"values,omitempty"` // The request SLAs in the page. + Expands []string `json:"_expands,omitempty"` // The fields to expand in the page. + Links *RequestSLAPageLinkScheme `json:"_links,omitempty"` // The links related to the page. } +// RequestSLAPageLinkScheme represents the links related to a page of request SLAs. type RequestSLAPageLinkScheme struct { - Self string `json:"self,omitempty"` - Base string `json:"base,omitempty"` - Context string `json:"context,omitempty"` - Next string `json:"next,omitempty"` - Prev string `json:"prev,omitempty"` + Self string `json:"self,omitempty"` // The self link of the page. + Base string `json:"base,omitempty"` // The base link of the page. + Context string `json:"context,omitempty"` // The context link of the page. + Next string `json:"next,omitempty"` // The next link of the page. + Prev string `json:"prev,omitempty"` // The previous link of the page. } +// RequestSLAScheme represents a request SLA. type RequestSLAScheme struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - OngoingCycle *RequestSLAOngoingCycleScheme `json:"ongoingCycle,omitempty"` - Links *RequestSLALinkScheme `json:"_links,omitempty"` + ID string `json:"id,omitempty"` // The ID of the SLA. + Name string `json:"name,omitempty"` // The name of the SLA. + OngoingCycle *RequestSLAOngoingCycleScheme `json:"ongoingCycle,omitempty"` // The ongoing cycle of the SLA. + Links *RequestSLALinkScheme `json:"_links,omitempty"` // The links related to the SLA. } +// RequestSLAOngoingCycleScheme represents the ongoing cycle of a request SLA. type RequestSLAOngoingCycleScheme struct { - Breached bool `json:"breached,omitempty"` - Paused bool `json:"paused,omitempty"` - WithinCalendarHours bool `json:"withinCalendarHours,omitempty"` + Breached bool `json:"breached,omitempty"` // Indicates if the SLA is breached. + Paused bool `json:"paused,omitempty"` // Indicates if the SLA is paused. + WithinCalendarHours bool `json:"withinCalendarHours,omitempty"` // Indicates if the SLA is within calendar hours. } +// RequestSLALinkScheme represents the links related to a request SLA. type RequestSLALinkScheme struct { - Self string `json:"self,omitempty"` + Self string `json:"self,omitempty"` // The self link of the SLA. } diff --git a/pkg/infra/models/sm_request_type.go b/pkg/infra/models/sm_request_type.go index 7cc63476..6a9b7170 100644 --- a/pkg/infra/models/sm_request_type.go +++ b/pkg/infra/models/sm_request_type.go @@ -1,85 +1,95 @@ package models +// RequestTypePageScheme represents a page of request types. type RequestTypePageScheme struct { - Size int `json:"size,omitempty"` - Start int `json:"start,omitempty"` - Limit int `json:"limit,omitempty"` - IsLastPage bool `json:"isLastPage,omitempty"` - Values []*RequestTypeScheme `json:"values,omitempty"` - Expands []string `json:"_expands,omitempty"` - Links *RequestTypePageLinkScheme `json:"_links,omitempty"` + Size int `json:"size,omitempty"` // The size of the page. + Start int `json:"start,omitempty"` // The start index of the page. + Limit int `json:"limit,omitempty"` // The limit of the page. + IsLastPage bool `json:"isLastPage,omitempty"` // Indicates if this is the last page. + Values []*RequestTypeScheme `json:"values,omitempty"` // The request types in the page. + Expands []string `json:"_expands,omitempty"` // The fields to expand in the page. + Links *RequestTypePageLinkScheme `json:"_links,omitempty"` // The links related to the page. } +// RequestTypePageLinkScheme represents the links related to a page of request types. type RequestTypePageLinkScheme struct { - Self string `json:"self,omitempty"` - Base string `json:"base,omitempty"` - Context string `json:"context,omitempty"` - Next string `json:"next,omitempty"` - Prev string `json:"prev,omitempty"` + Self string `json:"self,omitempty"` // The self link of the page. + Base string `json:"base,omitempty"` // The base link of the page. + Context string `json:"context,omitempty"` // The context link of the page. + Next string `json:"next,omitempty"` // The next link of the page. + Prev string `json:"prev,omitempty"` // The previous link of the page. } +// ProjectRequestTypePageScheme represents a page of project request types. type ProjectRequestTypePageScheme struct { - Expands []string `json:"_expands,omitempty"` - Size int `json:"size,omitempty"` - Start int `json:"start,omitempty"` - Limit int `json:"limit,omitempty"` - IsLastPage bool `json:"isLastPage,omitempty"` - Values []*RequestTypeScheme `json:"values,omitempty"` - Links *ProjectRequestTypePageLinkScheme `json:"_links,omitempty"` + Expands []string `json:"_expands,omitempty"` // The fields to expand in the page. + Size int `json:"size,omitempty"` // The size of the page. + Start int `json:"start,omitempty"` // The start index of the page. + Limit int `json:"limit,omitempty"` // The limit of the page. + IsLastPage bool `json:"isLastPage,omitempty"` // Indicates if this is the last page. + Values []*RequestTypeScheme `json:"values,omitempty"` // The project request types in the page. + Links *ProjectRequestTypePageLinkScheme `json:"_links,omitempty"` // The links related to the page. } +// ProjectRequestTypePageLinkScheme represents the links related to a page of project request types. type ProjectRequestTypePageLinkScheme struct { - Base string `json:"base,omitempty"` - Context string `json:"context,omitempty"` - Next string `json:"next,omitempty"` - Prev string `json:"prev,omitempty"` + Base string `json:"base,omitempty"` // The base link of the page. + Context string `json:"context,omitempty"` // The context link of the page. + Next string `json:"next,omitempty"` // The next link of the page. + Prev string `json:"prev,omitempty"` // The previous link of the page. } +// RequestTypeScheme represents a request type. type RequestTypeScheme struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - HelpText string `json:"helpText,omitempty"` - IssueTypeID string `json:"issueTypeId,omitempty"` - ServiceDeskID string `json:"serviceDeskId,omitempty"` - GroupIds []string `json:"groupIds,omitempty"` - Expands []string `json:"_expands,omitempty"` + ID string `json:"id,omitempty"` // The ID of the request type. + Name string `json:"name,omitempty"` // The name of the request type. + Description string `json:"description,omitempty"` // The description of the request type. + HelpText string `json:"helpText,omitempty"` // The help text of the request type. + IssueTypeID string `json:"issueTypeId,omitempty"` // The issue type ID of the request type. + ServiceDeskID string `json:"serviceDeskId,omitempty"` // The service desk ID of the request type. + GroupIds []string `json:"groupIds,omitempty"` // The group IDs of the request type. + Expands []string `json:"_expands,omitempty"` // The fields to expand in the request type. } +// RequestTypePayloadScheme represents a request type payload. type RequestTypePayloadScheme struct { - Description string `json:"description,omitempty"` - HelpText string `json:"helpText,omitempty"` - IssueTypeId string `json:"issueTypeId,omitempty"` - Name string `json:"name,omitempty"` + Description string `json:"description,omitempty"` // The description of the request type payload. + HelpText string `json:"helpText,omitempty"` // The help text of the request type payload. + IssueTypeId string `json:"issueTypeId,omitempty"` // The issue type ID of the request type payload. + Name string `json:"name,omitempty"` // The name of the request type payload. } +// RequestTypeFieldsScheme represents the fields of a request type. type RequestTypeFieldsScheme struct { - RequestTypeFields []*RequestTypeFieldScheme `json:"requestTypeFields,omitempty"` - CanRaiseOnBehalfOf bool `json:"canRaiseOnBehalfOf,omitempty"` - CanAddRequestParticipants bool `json:"canAddRequestParticipants,omitempty"` + RequestTypeFields []*RequestTypeFieldScheme `json:"requestTypeFields,omitempty"` // The fields of the request type. + CanRaiseOnBehalfOf bool `json:"canRaiseOnBehalfOf,omitempty"` // Indicates if the request type can be raised on behalf of. + CanAddRequestParticipants bool `json:"canAddRequestParticipants,omitempty"` // Indicates if the request type can add request participants. } +// RequestTypeFieldScheme represents a field of a request type. type RequestTypeFieldScheme struct { - FieldID string `json:"fieldId,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - Required bool `json:"required,omitempty"` - DefaultValues []*RequestTypeFieldValueScheme `json:"defaultValues,omitempty"` - ValidValues []*RequestTypeFieldValueScheme `json:"validValues,omitempty"` - JiraSchema *RequestTypeJiraSchema `json:"jiraSchema,omitempty"` - Visible bool `json:"visible,omitempty"` + FieldID string `json:"fieldId,omitempty"` // The field ID of the request type field. + Name string `json:"name,omitempty"` // The name of the request type field. + Description string `json:"description,omitempty"` // The description of the request type field. + Required bool `json:"required,omitempty"` // Indicates if the request type field is required. + DefaultValues []*RequestTypeFieldValueScheme `json:"defaultValues,omitempty"` // The default values of the request type field. + ValidValues []*RequestTypeFieldValueScheme `json:"validValues,omitempty"` // The valid values of the request type field. + JiraSchema *RequestTypeJiraSchema `json:"jiraSchema,omitempty"` // The Jira schema of the request type field. + Visible bool `json:"visible,omitempty"` // Indicates if the request type field is visible. } +// RequestTypeFieldValueScheme represents a field value of a request type field. type RequestTypeFieldValueScheme struct { - Value string `json:"value,omitempty"` - Label string `json:"label,omitempty"` - Children []interface{} `json:"children,omitempty"` + Value string `json:"value,omitempty"` // The value of the request type field value. + Label string `json:"label,omitempty"` // The label of the request type field value. + Children []interface{} `json:"children,omitempty"` // The children of the request type field value. } +// RequestTypeJiraSchema represents the Jira schema of a request type field. type RequestTypeJiraSchema struct { - Type string `json:"type,omitempty"` - Items string `json:"items,omitempty"` - System string `json:"system,omitempty"` - Custom string `json:"custom,omitempty"` - CustomID int `json:"customId,omitempty"` + Type string `json:"type,omitempty"` // The type of the Jira schema. + Items string `json:"items,omitempty"` // The items of the Jira schema. + System string `json:"system,omitempty"` // The system of the Jira schema. + Custom string `json:"custom,omitempty"` // The custom of the Jira schema. + CustomID int `json:"customId,omitempty"` // The custom ID of the Jira schema. } diff --git a/pkg/infra/models/sm_service_desk.go b/pkg/infra/models/sm_service_desk.go index 6fa1c8db..b534c1f8 100644 --- a/pkg/infra/models/sm_service_desk.go +++ b/pkg/infra/models/sm_service_desk.go @@ -1,37 +1,46 @@ package models +// ServiceDeskTemporaryFileScheme represents a temporary file in a service desk. +// It contains a slice of temporary attachments. type ServiceDeskTemporaryFileScheme struct { - TemporaryAttachments []*TemporaryAttachmentScheme `json:"temporaryAttachments,omitempty"` + TemporaryAttachments []*TemporaryAttachmentScheme `json:"temporaryAttachments,omitempty"` // The temporary attachments of the file. } +// TemporaryAttachmentScheme represents a temporary attachment in a service desk. +// It contains the ID and the name of the temporary attachment. type TemporaryAttachmentScheme struct { - TemporaryAttachmentID string `json:"temporaryAttachmentId,omitempty"` - FileName string `json:"fileName,omitempty"` + TemporaryAttachmentID string `json:"temporaryAttachmentId,omitempty"` // The ID of the temporary attachment. + FileName string `json:"fileName,omitempty"` // The name of the temporary attachment. } +// ServiceDeskPageScheme represents a page of service desks. +// It contains information about the page and a slice of service desks. type ServiceDeskPageScheme struct { - Expands []string `json:"_expands,omitempty"` - Size int `json:"size,omitempty"` - Start int `json:"start,omitempty"` - Limit int `json:"limit,omitempty"` - IsLastPage bool `json:"isLastPage,omitempty"` - Links *ServiceDeskPageLinkScheme `json:"_links,omitempty"` - Values []*ServiceDeskScheme `json:"values,omitempty"` + Expands []string `json:"_expands,omitempty"` // The fields to expand in the page. + Size int `json:"size,omitempty"` // The size of the page. + Start int `json:"start,omitempty"` // The start index of the page. + Limit int `json:"limit,omitempty"` // The limit of the page. + IsLastPage bool `json:"isLastPage,omitempty"` // Indicates if this is the last page. + Links *ServiceDeskPageLinkScheme `json:"_links,omitempty"` // The links related to the page. + Values []*ServiceDeskScheme `json:"values,omitempty"` // The service desks in the page. } +// ServiceDeskPageLinkScheme represents the links related to a page of service desks. type ServiceDeskPageLinkScheme struct { - Base string `json:"base,omitempty"` - Context string `json:"context,omitempty"` - Next string `json:"next,omitempty"` - Prev string `json:"prev,omitempty"` + Base string `json:"base,omitempty"` // The base link of the page. + Context string `json:"context,omitempty"` // The context link of the page. + Next string `json:"next,omitempty"` // The next link of the page. + Prev string `json:"prev,omitempty"` // The previous link of the page. } +// ServiceDeskScheme represents a service desk. +// It contains information about the service desk and its related project. type ServiceDeskScheme struct { - ID string `json:"id,omitempty"` - ProjectID string `json:"projectId,omitempty"` - ProjectName string `json:"projectName,omitempty"` - ProjectKey string `json:"projectKey,omitempty"` + ID string `json:"id,omitempty"` // The ID of the service desk. + ProjectID string `json:"projectId,omitempty"` // The ID of the related project. + ProjectName string `json:"projectName,omitempty"` // The name of the related project. + ProjectKey string `json:"projectKey,omitempty"` // The key of the related project. Links struct { - Self string `json:"self,omitempty"` - } `json:"_links,omitempty"` + Self string `json:"self,omitempty"` // The self link of the service desk. + } `json:"_links,omitempty"` // The links related to the service desk. } diff --git a/pkg/infra/models/sm_service_desk_queue.go b/pkg/infra/models/sm_service_desk_queue.go index bbc8c516..a90e0523 100644 --- a/pkg/infra/models/sm_service_desk_queue.go +++ b/pkg/infra/models/sm_service_desk_queue.go @@ -1,37 +1,44 @@ package models +// ServiceDeskQueuePageScheme represents a page of service desk queues. +// It contains information about the page and a slice of service desk queues. type ServiceDeskQueuePageScheme struct { - Size int `json:"size,omitempty"` - Start int `json:"start,omitempty"` - Limit int `json:"limit,omitempty"` - IsLastPage bool `json:"isLastPage,omitempty"` - Values []*ServiceDeskQueueScheme `json:"values,omitempty"` - Expands []string `json:"_expands,omitempty"` - Links *ServiceDeskQueuePageLinkScheme `json:"_links,omitempty"` + Size int `json:"size,omitempty"` // The size of the page. + Start int `json:"start,omitempty"` // The start index of the page. + Limit int `json:"limit,omitempty"` // The limit of the page. + IsLastPage bool `json:"isLastPage,omitempty"` // Indicates if this is the last page. + Values []*ServiceDeskQueueScheme `json:"values,omitempty"` // The service desk queues in the page. + Expands []string `json:"_expands,omitempty"` // The fields to expand in the page. + Links *ServiceDeskQueuePageLinkScheme `json:"_links,omitempty"` // The links related to the page. } +// ServiceDeskQueuePageLinkScheme represents the links related to a page of service desk queues. type ServiceDeskQueuePageLinkScheme struct { - Self string `json:"self,omitempty"` - Base string `json:"base,omitempty"` - Context string `json:"context,omitempty"` - Next string `json:"next,omitempty"` - Prev string `json:"prev,omitempty"` + Self string `json:"self,omitempty"` // The self link of the page. + Base string `json:"base,omitempty"` // The base link of the page. + Context string `json:"context,omitempty"` // The context link of the page. + Next string `json:"next,omitempty"` // The next link of the page. + Prev string `json:"prev,omitempty"` // The previous link of the page. } +// ServiceDeskQueueScheme represents a service desk queue. +// It contains information about the queue and a slice of fields. type ServiceDeskQueueScheme struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Jql string `json:"jql,omitempty"` - Fields []string `json:"fields,omitempty"` - IssueCount int `json:"issueCount,omitempty"` + ID string `json:"id,omitempty"` // The ID of the queue. + Name string `json:"name,omitempty"` // The name of the queue. + Jql string `json:"jql,omitempty"` // The JQL of the queue. + Fields []string `json:"fields,omitempty"` // The fields of the queue. + IssueCount int `json:"issueCount,omitempty"` // The issue count of the queue. } +// ServiceDeskIssueQueueScheme represents a service desk issue queue. +// It contains information about the page and a slice of issues. type ServiceDeskIssueQueueScheme struct { - Size int `json:"size,omitempty"` - Start int `json:"start,omitempty"` - Limit int `json:"limit,omitempty"` - IsLastPage bool `json:"isLastPage,omitempty"` - Values []*IssueSchemeV2 `json:"values,omitempty"` - Expands []string `json:"_expands,omitempty"` - Links *ServiceDeskQueuePageLinkScheme `json:"_links,omitempty"` + Size int `json:"size,omitempty"` // The size of the page. + Start int `json:"start,omitempty"` // The start index of the page. + Limit int `json:"limit,omitempty"` // The limit of the page. + IsLastPage bool `json:"isLastPage,omitempty"` // Indicates if this is the last page. + Values []*IssueSchemeV2 `json:"values,omitempty"` // The issues in the page. + Expands []string `json:"_expands,omitempty"` // The fields to expand in the page. + Links *ServiceDeskQueuePageLinkScheme `json:"_links,omitempty"` // The links related to the page. } diff --git a/pkg/infra/models/sm_workspace.go b/pkg/infra/models/sm_workspace.go index 726b3108..c28e215b 100644 --- a/pkg/infra/models/sm_workspace.go +++ b/pkg/infra/models/sm_workspace.go @@ -1,20 +1,25 @@ package models +// WorkSpacePageScheme represents a page of workspaces. +// It contains information about the page and a slice of workspaces. type WorkSpacePageScheme struct { - Size int `json:"size,omitempty"` - Start int `json:"start,omitempty"` - Limit int `json:"limit,omitempty"` - IsLastPage bool `json:"isLastPage,omitempty"` - Links *WorkSpaceLinksPageScheme `json:"_links,omitempty"` - Values []*WorkSpaceScheme `json:"values,omitempty"` + Size int `json:"size,omitempty"` // The size of the page. + Start int `json:"start,omitempty"` // The start index of the page. + Limit int `json:"limit,omitempty"` // The limit of the page. + IsLastPage bool `json:"isLastPage,omitempty"` // Indicates if this is the last page. + Links *WorkSpaceLinksPageScheme `json:"_links,omitempty"` // The links related to the page. + Values []*WorkSpaceScheme `json:"values,omitempty"` // The workspaces in the page. } +// WorkSpaceLinksPageScheme represents the links related to a page of workspaces. type WorkSpaceLinksPageScheme struct { - Self string `json:"self,omitempty"` - Base string `json:"base,omitempty"` - Context string `json:"context,omitempty"` + Self string `json:"self,omitempty"` // The self link of the page. + Base string `json:"base,omitempty"` // The base link of the page. + Context string `json:"context,omitempty"` // The context link of the page. } +// WorkSpaceScheme represents a workspace. +// It contains the ID of the workspace. type WorkSpaceScheme struct { - WorkspaceId string `json:"workspaceId,omitempty"` + WorkspaceId string `json:"workspaceId,omitempty"` // The ID of the workspace. } From 43dd3930d77f93dfbdd7dde8b405ab7cba27420f Mon Sep 17 00:00:00 2001 From: Florian Kinder Date: Wed, 26 Jun 2024 16:31:09 +0900 Subject: [PATCH 29/40] Added service desk request type groups --- jira/sm/internal/type_impl.go | 38 ++++++++++++++++++++++++++--- pkg/infra/models/sm_request_type.go | 25 +++++++++++++++++++ service/sm/type.go | 8 ++++++ 3 files changed, 68 insertions(+), 3 deletions(-) diff --git a/jira/sm/internal/type_impl.go b/jira/sm/internal/type_impl.go index 42bbf111..5814c389 100644 --- a/jira/sm/internal/type_impl.go +++ b/jira/sm/internal/type_impl.go @@ -3,12 +3,13 @@ package internal import ( "context" "fmt" - model "github.com/ctreminiom/go-atlassian/pkg/infra/models" - "github.com/ctreminiom/go-atlassian/service" - "github.com/ctreminiom/go-atlassian/service/sm" "net/http" "net/url" "strconv" + + model "github.com/ctreminiom/go-atlassian/pkg/infra/models" + "github.com/ctreminiom/go-atlassian/service" + "github.com/ctreminiom/go-atlassian/service/sm" ) func NewTypeService(client service.Connector, version string) *TypeService { @@ -77,6 +78,15 @@ func (t *TypeService) Fields(ctx context.Context, serviceDeskID, requestTypeID i return t.internalClient.Fields(ctx, serviceDeskID, requestTypeID) } +// Groups returns the groups for a service desk's customer request type. +// +// GET /rest/servicedeskapi/servicedesk/{serviceDeskId}/requesttypegroup +// +// https://docs.go-atlassian.io/jira-service-management-cloud/request/types#get-request-type-groups +func (t *TypeService) Groups(ctx context.Context, serviceDeskID int) (*model.RequestTypeGroupsScheme, *model.ResponseScheme, error) { + return t.internalClient.Groups(ctx, serviceDeskID) +} + type internalTypeImpl struct { c service.Connector version string @@ -231,3 +241,25 @@ func (i *internalTypeImpl) Fields(ctx context.Context, serviceDeskID, requestTyp return fields, res, nil } + +func (i *internalTypeImpl) Groups(ctx context.Context, serviceDeskID int) (*model.RequestTypeGroupsScheme, *model.ResponseScheme, error) { + + if serviceDeskID == 0 { + return nil, nil, model.ErrNoServiceDeskIDError + } + + endpoint := fmt.Sprintf("rest/servicedeskapi/servicedesk/%v/requesttypegroup", serviceDeskID) + + req, err := i.c.NewRequest(ctx, http.MethodGet, endpoint, "", nil) + if err != nil { + return nil, nil, err + } + + groups := new(model.RequestTypeGroupsScheme) + res, err := i.c.Call(req, groups) + if err != nil { + return nil, res, err + } + + return groups, res, nil +} diff --git a/pkg/infra/models/sm_request_type.go b/pkg/infra/models/sm_request_type.go index 6a9b7170..dd3fbe5e 100644 --- a/pkg/infra/models/sm_request_type.go +++ b/pkg/infra/models/sm_request_type.go @@ -93,3 +93,28 @@ type RequestTypeJiraSchema struct { Custom string `json:"custom,omitempty"` // The custom of the Jira schema. CustomID int `json:"customId,omitempty"` // The custom ID of the Jira schema. } + +// ProjectRequestTypeGroupPageScheme represents a page of project request type groups. +type ProjectRequestTypeGroupPageScheme struct { + Expands []string `json:"_expands,omitempty"` // The fields to expand in the page. + Size int `json:"size,omitempty"` // The size of the page. + Start int `json:"start,omitempty"` // The start index of the page. + Limit int `json:"limit,omitempty"` // The limit of the page. + IsLastPage bool `json:"isLastPage,omitempty"` // Indicates if this is the last page. + Values []*RequestTypeGroupsScheme `json:"values,omitempty"` // The project request types in the page. + Links *ProjectRequestTypeGroupPageLinkScheme `json:"_links,omitempty"` // The links related to the page. +} + +// ProjectRequestTypeGroupPageLinkScheme represents the links related to a page of project request type groups. +type ProjectRequestTypeGroupPageLinkScheme struct { + Base string `json:"base,omitempty"` // The base link of the page. + Context string `json:"context,omitempty"` // The context link of the page. + Next string `json:"next,omitempty"` // The next link of the page. + Prev string `json:"prev,omitempty"` // The previous link of the page. +} + +// RequestTypeGroupsScheme represents the groups for request types. +type RequestTypeGroupsScheme struct { + ID string `json:"id,omitempty"` // The ID of the request type group. + Name string `json:"name,omitempty"` // The name of the request type group. +} diff --git a/service/sm/type.go b/service/sm/type.go index 385722ef..1a486b88 100644 --- a/service/sm/type.go +++ b/service/sm/type.go @@ -2,6 +2,7 @@ package sm import ( "context" + model "github.com/ctreminiom/go-atlassian/pkg/infra/models" ) @@ -49,4 +50,11 @@ type TypeConnector interface { // // https://docs.go-atlassian.io/jira-service-management-cloud/request/types#get-request-type-fields Fields(ctx context.Context, serviceDeskID, requestTypeID int) (*model.RequestTypeFieldsScheme, *model.ResponseScheme, error) + + // Groups returns the groups for a service desk's customer request types. + // + // GET /rest/servicedeskapi/servicedesk/{serviceDeskId}/requesttypegroup + // + // https://docs.go-atlassian.io/jira-service-management-cloud/request/types#get-request-type-groups + Groups(ctx context.Context, serviceDeskID int) (*model.RequestTypeGroupsScheme, *model.ResponseScheme, error) } From 78a60ca8550ad6de1676a0a8bc9dc39bbc59bddc Mon Sep 17 00:00:00 2001 From: Florian Kinder Date: Wed, 26 Jun 2024 16:59:18 +0900 Subject: [PATCH 30/40] Use correct scheme --- jira/sm/internal/type_impl.go | 6 +++--- pkg/infra/models/sm_request_type.go | 22 +++++++++++----------- service/sm/type.go | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/jira/sm/internal/type_impl.go b/jira/sm/internal/type_impl.go index 5814c389..a1ffe4fb 100644 --- a/jira/sm/internal/type_impl.go +++ b/jira/sm/internal/type_impl.go @@ -83,7 +83,7 @@ func (t *TypeService) Fields(ctx context.Context, serviceDeskID, requestTypeID i // GET /rest/servicedeskapi/servicedesk/{serviceDeskId}/requesttypegroup // // https://docs.go-atlassian.io/jira-service-management-cloud/request/types#get-request-type-groups -func (t *TypeService) Groups(ctx context.Context, serviceDeskID int) (*model.RequestTypeGroupsScheme, *model.ResponseScheme, error) { +func (t *TypeService) Groups(ctx context.Context, serviceDeskID int) (*model.RequestTypeGroupPageScheme, *model.ResponseScheme, error) { return t.internalClient.Groups(ctx, serviceDeskID) } @@ -242,7 +242,7 @@ func (i *internalTypeImpl) Fields(ctx context.Context, serviceDeskID, requestTyp return fields, res, nil } -func (i *internalTypeImpl) Groups(ctx context.Context, serviceDeskID int) (*model.RequestTypeGroupsScheme, *model.ResponseScheme, error) { +func (i *internalTypeImpl) Groups(ctx context.Context, serviceDeskID int) (*model.RequestTypeGroupPageScheme, *model.ResponseScheme, error) { if serviceDeskID == 0 { return nil, nil, model.ErrNoServiceDeskIDError @@ -255,7 +255,7 @@ func (i *internalTypeImpl) Groups(ctx context.Context, serviceDeskID int) (*mode return nil, nil, err } - groups := new(model.RequestTypeGroupsScheme) + groups := new(model.RequestTypeGroupPageScheme) res, err := i.c.Call(req, groups) if err != nil { return nil, res, err diff --git a/pkg/infra/models/sm_request_type.go b/pkg/infra/models/sm_request_type.go index dd3fbe5e..c37cd3fc 100644 --- a/pkg/infra/models/sm_request_type.go +++ b/pkg/infra/models/sm_request_type.go @@ -94,19 +94,19 @@ type RequestTypeJiraSchema struct { CustomID int `json:"customId,omitempty"` // The custom ID of the Jira schema. } -// ProjectRequestTypeGroupPageScheme represents a page of project request type groups. -type ProjectRequestTypeGroupPageScheme struct { - Expands []string `json:"_expands,omitempty"` // The fields to expand in the page. - Size int `json:"size,omitempty"` // The size of the page. - Start int `json:"start,omitempty"` // The start index of the page. - Limit int `json:"limit,omitempty"` // The limit of the page. - IsLastPage bool `json:"isLastPage,omitempty"` // Indicates if this is the last page. - Values []*RequestTypeGroupsScheme `json:"values,omitempty"` // The project request types in the page. - Links *ProjectRequestTypeGroupPageLinkScheme `json:"_links,omitempty"` // The links related to the page. +// RequestTypeGroupPageScheme represents a page of project request type groups. +type RequestTypeGroupPageScheme struct { + Expands []string `json:"_expands,omitempty"` // The fields to expand in the page. + Size int `json:"size,omitempty"` // The size of the page. + Start int `json:"start,omitempty"` // The start index of the page. + Limit int `json:"limit,omitempty"` // The limit of the page. + IsLastPage bool `json:"isLastPage,omitempty"` // Indicates if this is the last page. + Values []*RequestTypeGroupsScheme `json:"values,omitempty"` // The project request types in the page. + Links *RequestTypeGroupPageLinkScheme `json:"_links,omitempty"` // The links related to the page. } -// ProjectRequestTypeGroupPageLinkScheme represents the links related to a page of project request type groups. -type ProjectRequestTypeGroupPageLinkScheme struct { +// RequestTypeGroupPageLinkScheme represents the links related to a page of project request type groups. +type RequestTypeGroupPageLinkScheme struct { Base string `json:"base,omitempty"` // The base link of the page. Context string `json:"context,omitempty"` // The context link of the page. Next string `json:"next,omitempty"` // The next link of the page. diff --git a/service/sm/type.go b/service/sm/type.go index 1a486b88..2c58542b 100644 --- a/service/sm/type.go +++ b/service/sm/type.go @@ -56,5 +56,5 @@ type TypeConnector interface { // GET /rest/servicedeskapi/servicedesk/{serviceDeskId}/requesttypegroup // // https://docs.go-atlassian.io/jira-service-management-cloud/request/types#get-request-type-groups - Groups(ctx context.Context, serviceDeskID int) (*model.RequestTypeGroupsScheme, *model.ResponseScheme, error) + Groups(ctx context.Context, serviceDeskID int) (*model.RequestTypeGroupPageScheme, *model.ResponseScheme, error) } From 7a86ef7b996373617a5a023f1a694a25f8b5bc62 Mon Sep 17 00:00:00 2001 From: Florian Kinder Date: Wed, 26 Jun 2024 18:10:24 +0900 Subject: [PATCH 31/40] Added missing date struct in request current status date --- pkg/infra/models/sm_request.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pkg/infra/models/sm_request.go b/pkg/infra/models/sm_request.go index 5ffbaa7f..8c9a1c7d 100644 --- a/pkg/infra/models/sm_request.go +++ b/pkg/infra/models/sm_request.go @@ -101,10 +101,17 @@ type CustomerRequestRequestFieldValueScheme struct { // CustomerRequestCurrentStatusScheme represents the current status of a customer request. type CustomerRequestCurrentStatusScheme struct { - Status string `json:"status,omitempty"` // The status of the customer request. - StatusCategory string `json:"statusCategory,omitempty"` // The category of the status. - StatusDate struct { - } `json:"statusDate,omitempty"` // The date of the status. + Status string `json:"status,omitempty"` // The status of the customer request. + StatusCategory string `json:"statusCategory,omitempty"` // The category of the status. + StatusDate *CustomerRequestCurrentStatusDateScheme `json:"statusDate,omitempty"` // The date of the status. +} + +// CustomerRequestCurrentStatusDateScheme represents a date for a customer request current status. +type CustomerRequestCurrentStatusDateScheme struct { + Iso8601 string `json:"iso8601,omitempty"` // The ISO 8601 format of the date. + Jira string `json:"jira,omitempty"` // The Jira format of the date. + Friendly string `json:"friendly,omitempty"` // The friendly format of the date. + EpochMillis int `json:"epochMillis,omitempty"` // The epoch milliseconds of the date. } // CustomerRequestLinksScheme represents the links related to a customer request. From 12d6fe9141adfa404bf97b85358fe63e036c6505 Mon Sep 17 00:00:00 2001 From: Florian Kinder Date: Wed, 26 Jun 2024 18:41:07 +0900 Subject: [PATCH 32/40] Replace service desk id with string instead of int --- jira/sm/internal/customer_impl.go | 23 ++++++++++++----------- service/sm/customer.go | 7 ++++--- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/jira/sm/internal/customer_impl.go b/jira/sm/internal/customer_impl.go index eddd3d46..6bf80f20 100644 --- a/jira/sm/internal/customer_impl.go +++ b/jira/sm/internal/customer_impl.go @@ -3,12 +3,13 @@ package internal import ( "context" "fmt" - model "github.com/ctreminiom/go-atlassian/pkg/infra/models" - "github.com/ctreminiom/go-atlassian/service" - "github.com/ctreminiom/go-atlassian/service/sm" "net/http" "net/url" "strconv" + + model "github.com/ctreminiom/go-atlassian/pkg/infra/models" + "github.com/ctreminiom/go-atlassian/service" + "github.com/ctreminiom/go-atlassian/service/sm" ) func NewCustomerService(client service.Connector, version string) *CustomerService { @@ -42,7 +43,7 @@ func (c *CustomerService) Create(ctx context.Context, email, displayName string) // GET /rest/servicedeskapi/servicedesk/{serviceDeskId}/customer // // https://docs.go-atlassian.io/jira-service-management-cloud/customer#get-customers -func (c *CustomerService) Gets(ctx context.Context, serviceDeskID int, query string, start, limit int) (*model.CustomerPageScheme, *model.ResponseScheme, error) { +func (c *CustomerService) Gets(ctx context.Context, serviceDeskID string, query string, start, limit int) (*model.CustomerPageScheme, *model.ResponseScheme, error) { return c.internalClient.Gets(ctx, serviceDeskID, query, start, limit) } @@ -51,7 +52,7 @@ func (c *CustomerService) Gets(ctx context.Context, serviceDeskID int, query str // POST /rest/servicedeskapi/servicedesk/{serviceDeskId}/customer // // https://docs.go-atlassian.io/jira-service-management-cloud/customer#add-customers -func (c *CustomerService) Add(ctx context.Context, serviceDeskID int, accountIDs []string) (*model.ResponseScheme, error) { +func (c *CustomerService) Add(ctx context.Context, serviceDeskID string, accountIDs []string) (*model.ResponseScheme, error) { return c.internalClient.Add(ctx, serviceDeskID, accountIDs) } @@ -60,7 +61,7 @@ func (c *CustomerService) Add(ctx context.Context, serviceDeskID int, accountIDs // DELETE /rest/servicedeskapi/servicedesk/{serviceDeskId}/customer // // https://docs.go-atlassian.io/jira-service-management-cloud/customer#remove-customers -func (c *CustomerService) Remove(ctx context.Context, serviceDeskID int, accountIDs []string) (*model.ResponseScheme, error) { +func (c *CustomerService) Remove(ctx context.Context, serviceDeskID string, accountIDs []string) (*model.ResponseScheme, error) { return c.internalClient.Remove(ctx, serviceDeskID, accountIDs) } @@ -92,7 +93,7 @@ func (i *internalCustomerImpl) Create(ctx context.Context, email, displayName st return customer, res, nil } -func (i *internalCustomerImpl) Gets(ctx context.Context, serviceDeskID int, query string, start, limit int) (*model.CustomerPageScheme, *model.ResponseScheme, error) { +func (i *internalCustomerImpl) Gets(ctx context.Context, serviceDeskID string, query string, start, limit int) (*model.CustomerPageScheme, *model.ResponseScheme, error) { params := url.Values{} params.Add("start", strconv.Itoa(start)) @@ -118,9 +119,9 @@ func (i *internalCustomerImpl) Gets(ctx context.Context, serviceDeskID int, quer return page, res, nil } -func (i *internalCustomerImpl) Add(ctx context.Context, serviceDeskID int, accountIDs []string) (*model.ResponseScheme, error) { +func (i *internalCustomerImpl) Add(ctx context.Context, serviceDeskID string, accountIDs []string) (*model.ResponseScheme, error) { - if serviceDeskID == 0 { + if serviceDeskID == "" { return nil, model.ErrNoServiceDeskIDError } @@ -142,9 +143,9 @@ func (i *internalCustomerImpl) Add(ctx context.Context, serviceDeskID int, accou return i.c.Call(req, nil) } -func (i *internalCustomerImpl) Remove(ctx context.Context, serviceDeskID int, accountIDs []string) (*model.ResponseScheme, error) { +func (i *internalCustomerImpl) Remove(ctx context.Context, serviceDeskID string, accountIDs []string) (*model.ResponseScheme, error) { - if serviceDeskID == 0 { + if serviceDeskID == "" { return nil, model.ErrNoServiceDeskIDError } diff --git a/service/sm/customer.go b/service/sm/customer.go index 61f1d950..ad409030 100644 --- a/service/sm/customer.go +++ b/service/sm/customer.go @@ -2,6 +2,7 @@ package sm import ( "context" + model "github.com/ctreminiom/go-atlassian/pkg/infra/models" ) @@ -25,19 +26,19 @@ type CustomerConnector interface { // GET /rest/servicedeskapi/servicedesk/{serviceDeskId}/customer // // https://docs.go-atlassian.io/jira-service-management-cloud/customer#get-customers - Gets(ctx context.Context, serviceDeskID int, query string, start, limit int) (*model.CustomerPageScheme, *model.ResponseScheme, error) + Gets(ctx context.Context, serviceDeskID string, query string, start, limit int) (*model.CustomerPageScheme, *model.ResponseScheme, error) // Add adds one or more customers to a service desk. // // POST /rest/servicedeskapi/servicedesk/{serviceDeskId}/customer // // https://docs.go-atlassian.io/jira-service-management-cloud/customer#add-customers - Add(ctx context.Context, serviceDeskID int, accountIDs []string) (*model.ResponseScheme, error) + Add(ctx context.Context, serviceDeskID string, accountIDs []string) (*model.ResponseScheme, error) // Remove removes one or more customers from a service desk. The service desk must have closed access // // DELETE /rest/servicedeskapi/servicedesk/{serviceDeskId}/customer // // https://docs.go-atlassian.io/jira-service-management-cloud/customer#remove-customers - Remove(ctx context.Context, serviceDeskID int, accountIDs []string) (*model.ResponseScheme, error) + Remove(ctx context.Context, serviceDeskID string, accountIDs []string) (*model.ResponseScheme, error) } From 625e050155c9079c906b130c68fe4d19a3f79a2a Mon Sep 17 00:00:00 2001 From: Florian Kinder Date: Wed, 26 Jun 2024 18:45:30 +0900 Subject: [PATCH 33/40] Updated tests --- jira/sm/internal/customer_impl_test.go | 36 ++++++++++++++------------ 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/jira/sm/internal/customer_impl_test.go b/jira/sm/internal/customer_impl_test.go index c42a2ff4..d9ee5438 100644 --- a/jira/sm/internal/customer_impl_test.go +++ b/jira/sm/internal/customer_impl_test.go @@ -3,12 +3,14 @@ package internal import ( "context" "errors" + "net/http" + "testing" + + "github.com/stretchr/testify/assert" + model "github.com/ctreminiom/go-atlassian/pkg/infra/models" "github.com/ctreminiom/go-atlassian/service" "github.com/ctreminiom/go-atlassian/service/mocks" - "github.com/stretchr/testify/assert" - "net/http" - "testing" ) func Test_internalCustomerImpl_Create(t *testing.T) { @@ -151,7 +153,7 @@ func Test_internalCustomerImpl_Gets(t *testing.T) { type args struct { ctx context.Context - serviceDeskID int + serviceDeskID string query string start, limit int } @@ -168,7 +170,7 @@ func Test_internalCustomerImpl_Gets(t *testing.T) { name: "when the parameters are correct", args: args{ ctx: context.Background(), - serviceDeskID: 10001, + serviceDeskID: "10001", query: "Carlos T", start: 100, limit: 50, @@ -198,7 +200,7 @@ func Test_internalCustomerImpl_Gets(t *testing.T) { name: "when the http call cannot be executed", args: args{ ctx: context.Background(), - serviceDeskID: 10001, + serviceDeskID: "10001", query: "Carlos T", start: 100, limit: 50, @@ -230,7 +232,7 @@ func Test_internalCustomerImpl_Gets(t *testing.T) { name: "when the request cannot be created", args: args{ ctx: context.Background(), - serviceDeskID: 10001, + serviceDeskID: "10001", query: "Carlos T", start: 100, limit: 50, @@ -292,7 +294,7 @@ func Test_internalCustomerImpl_Add(t *testing.T) { type args struct { ctx context.Context - serviceDeskID int + serviceDeskID string accountIDs []string } @@ -308,7 +310,7 @@ func Test_internalCustomerImpl_Add(t *testing.T) { name: "when the parameters are correct", args: args{ ctx: context.Background(), - serviceDeskID: 10001, + serviceDeskID: "10001", accountIDs: []string{"uuid-sample-1", "uuid-sample-2"}, }, on: func(fields *fields) { @@ -336,7 +338,7 @@ func Test_internalCustomerImpl_Add(t *testing.T) { name: "when the http call cannot be executed", args: args{ ctx: context.Background(), - serviceDeskID: 10001, + serviceDeskID: "10001", accountIDs: []string{"uuid-sample-1", "uuid-sample-2"}, }, on: func(fields *fields) { @@ -366,7 +368,7 @@ func Test_internalCustomerImpl_Add(t *testing.T) { name: "when the request cannot be created", args: args{ ctx: context.Background(), - serviceDeskID: 10001, + serviceDeskID: "10001", accountIDs: []string{"uuid-sample-1", "uuid-sample-2"}, }, on: func(fields *fields) { @@ -400,7 +402,7 @@ func Test_internalCustomerImpl_Add(t *testing.T) { name: "when the account ids are not provided", args: args{ ctx: context.Background(), - serviceDeskID: 10001, + serviceDeskID: "10001", }, wantErr: true, Err: model.ErrNoAccountSliceError, @@ -443,7 +445,7 @@ func Test_internalCustomerImpl_Remove(t *testing.T) { type args struct { ctx context.Context - serviceDeskID int + serviceDeskID string accountIDs []string } @@ -459,7 +461,7 @@ func Test_internalCustomerImpl_Remove(t *testing.T) { name: "when the parameters are correct", args: args{ ctx: context.Background(), - serviceDeskID: 10001, + serviceDeskID: "10001", accountIDs: []string{"uuid-sample-1", "uuid-sample-2"}, }, on: func(fields *fields) { @@ -487,7 +489,7 @@ func Test_internalCustomerImpl_Remove(t *testing.T) { name: "when the http call cannot be executed", args: args{ ctx: context.Background(), - serviceDeskID: 10001, + serviceDeskID: "10001", accountIDs: []string{"uuid-sample-1", "uuid-sample-2"}, }, on: func(fields *fields) { @@ -517,7 +519,7 @@ func Test_internalCustomerImpl_Remove(t *testing.T) { name: "when the request cannot be created", args: args{ ctx: context.Background(), - serviceDeskID: 10001, + serviceDeskID: "10001", accountIDs: []string{"uuid-sample-1", "uuid-sample-2"}, }, on: func(fields *fields) { @@ -551,7 +553,7 @@ func Test_internalCustomerImpl_Remove(t *testing.T) { name: "when the account ids are not provided", args: args{ ctx: context.Background(), - serviceDeskID: 10001, + serviceDeskID: "10001", }, wantErr: true, Err: model.ErrNoAccountSliceError, From becd7530e146cf454c4870604de8f5113d5b9e72 Mon Sep 17 00:00:00 2001 From: Florian Kinder Date: Wed, 26 Jun 2024 19:02:53 +0900 Subject: [PATCH 34/40] Replace service desk id with string instead of int --- jira/sm/internal/service_desk_impl.go | 19 +++++++------ jira/sm/internal/service_desk_impl_test.go | 32 ++++++++++++---------- service/sm/service_desk.go | 7 +++-- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/jira/sm/internal/service_desk_impl.go b/jira/sm/internal/service_desk_impl.go index 3a152486..a5e0c93c 100644 --- a/jira/sm/internal/service_desk_impl.go +++ b/jira/sm/internal/service_desk_impl.go @@ -4,14 +4,15 @@ import ( "bytes" "context" "fmt" - model "github.com/ctreminiom/go-atlassian/pkg/infra/models" - "github.com/ctreminiom/go-atlassian/service" - "github.com/ctreminiom/go-atlassian/service/sm" "io" "mime/multipart" "net/http" "net/url" "strconv" + + model "github.com/ctreminiom/go-atlassian/pkg/infra/models" + "github.com/ctreminiom/go-atlassian/service" + "github.com/ctreminiom/go-atlassian/service/sm" ) func NewServiceDeskService(client service.Connector, version string, queue *QueueService) (*ServiceDeskService, error) { @@ -49,7 +50,7 @@ func (s *ServiceDeskService) Gets(ctx context.Context, start, limit int) (*model // GET /rest/servicedeskapi/servicedesk/{serviceDeskId} // // https://docs.go-atlassian.io/jira-service-management-cloud/request/service-desk#get-service-desk-by-id -func (s *ServiceDeskService) Get(ctx context.Context, serviceDeskID int) (*model.ServiceDeskScheme, *model.ResponseScheme, error) { +func (s *ServiceDeskService) Get(ctx context.Context, serviceDeskID string) (*model.ServiceDeskScheme, *model.ResponseScheme, error) { return s.internalClient.Get(ctx, serviceDeskID) } @@ -58,7 +59,7 @@ func (s *ServiceDeskService) Get(ctx context.Context, serviceDeskID int) (*model // POST /rest/servicedeskapi/servicedesk/{serviceDeskId}/attachTemporaryFile // // https://docs.go-atlassian.io/jira-service-management-cloud/request/service-desk#attach-temporary-file -func (s *ServiceDeskService) Attach(ctx context.Context, serviceDeskID int, fileName string, file io.Reader) (*model.ServiceDeskTemporaryFileScheme, *model.ResponseScheme, error) { +func (s *ServiceDeskService) Attach(ctx context.Context, serviceDeskID string, fileName string, file io.Reader) (*model.ServiceDeskTemporaryFileScheme, *model.ResponseScheme, error) { return s.internalClient.Attach(ctx, serviceDeskID, fileName, file) } @@ -89,9 +90,9 @@ func (i *internalServiceDeskImpl) Gets(ctx context.Context, start, limit int) (* return page, res, nil } -func (i *internalServiceDeskImpl) Get(ctx context.Context, serviceDeskID int) (*model.ServiceDeskScheme, *model.ResponseScheme, error) { +func (i *internalServiceDeskImpl) Get(ctx context.Context, serviceDeskID string) (*model.ServiceDeskScheme, *model.ResponseScheme, error) { - if serviceDeskID == 0 { + if serviceDeskID == "" { return nil, nil, model.ErrNoServiceDeskIDError } @@ -111,9 +112,9 @@ func (i *internalServiceDeskImpl) Get(ctx context.Context, serviceDeskID int) (* return serviceDesk, res, nil } -func (i *internalServiceDeskImpl) Attach(ctx context.Context, serviceDeskID int, fileName string, file io.Reader) (*model.ServiceDeskTemporaryFileScheme, *model.ResponseScheme, error) { +func (i *internalServiceDeskImpl) Attach(ctx context.Context, serviceDeskID string, fileName string, file io.Reader) (*model.ServiceDeskTemporaryFileScheme, *model.ResponseScheme, error) { - if serviceDeskID == 0 { + if serviceDeskID == "" { return nil, nil, model.ErrNoServiceDeskIDError } diff --git a/jira/sm/internal/service_desk_impl_test.go b/jira/sm/internal/service_desk_impl_test.go index 8670cb9d..d3b079e5 100644 --- a/jira/sm/internal/service_desk_impl_test.go +++ b/jira/sm/internal/service_desk_impl_test.go @@ -3,16 +3,18 @@ package internal import ( "context" "errors" - model "github.com/ctreminiom/go-atlassian/pkg/infra/models" - "github.com/ctreminiom/go-atlassian/service" - "github.com/ctreminiom/go-atlassian/service/mocks" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" "io" "net/http" "os" "path/filepath" "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + + model "github.com/ctreminiom/go-atlassian/pkg/infra/models" + "github.com/ctreminiom/go-atlassian/service" + "github.com/ctreminiom/go-atlassian/service/mocks" ) func Test_internalServiceDeskImpl_Gets(t *testing.T) { @@ -156,7 +158,7 @@ func Test_internalServiceDeskImpl_Get(t *testing.T) { type args struct { ctx context.Context - serviceDeskID int + serviceDeskID string } testCases := []struct { @@ -171,7 +173,7 @@ func Test_internalServiceDeskImpl_Get(t *testing.T) { name: "when the parameters are correct", args: args{ ctx: context.Background(), - serviceDeskID: 10001, + serviceDeskID: "10001", }, on: func(fields *fields) { @@ -198,7 +200,7 @@ func Test_internalServiceDeskImpl_Get(t *testing.T) { name: "when the http call cannot be executed", args: args{ ctx: context.Background(), - serviceDeskID: 10001, + serviceDeskID: "10001", }, on: func(fields *fields) { @@ -227,7 +229,7 @@ func Test_internalServiceDeskImpl_Get(t *testing.T) { name: "when the request cannot be created", args: args{ ctx: context.Background(), - serviceDeskID: 10001, + serviceDeskID: "10001", }, on: func(fields *fields) { @@ -305,7 +307,7 @@ func Test_internalServiceDeskImpl_Attach(t *testing.T) { type args struct { ctx context.Context - serviceDeskID int + serviceDeskID string fileName string file io.Reader } @@ -322,7 +324,7 @@ func Test_internalServiceDeskImpl_Attach(t *testing.T) { name: "when the parameters are correct", args: args{ ctx: context.Background(), - serviceDeskID: 10001, + serviceDeskID: "10001", fileName: "LICENSE", file: fileMocked, }, @@ -351,7 +353,7 @@ func Test_internalServiceDeskImpl_Attach(t *testing.T) { name: "when the http call cannot be executed", args: args{ ctx: context.Background(), - serviceDeskID: 10001, + serviceDeskID: "10001", fileName: "LICENSE", file: fileMocked, }, @@ -382,7 +384,7 @@ func Test_internalServiceDeskImpl_Attach(t *testing.T) { name: "when the request cannot be created", args: args{ ctx: context.Background(), - serviceDeskID: 10001, + serviceDeskID: "10001", fileName: "LICENSE", file: fileMocked, }, @@ -417,7 +419,7 @@ func Test_internalServiceDeskImpl_Attach(t *testing.T) { name: "when the file name is not provided", args: args{ ctx: context.Background(), - serviceDeskID: 10001, + serviceDeskID: "10001", }, Err: model.ErrNoFileNameError, wantErr: true, @@ -427,7 +429,7 @@ func Test_internalServiceDeskImpl_Attach(t *testing.T) { name: "when the file reader is not provided", args: args{ ctx: context.Background(), - serviceDeskID: 10001, + serviceDeskID: "10001", fileName: "LICENSE", }, Err: model.ErrNoFileReaderError, diff --git a/service/sm/service_desk.go b/service/sm/service_desk.go index f2249f95..4e6f23f9 100644 --- a/service/sm/service_desk.go +++ b/service/sm/service_desk.go @@ -2,8 +2,9 @@ package sm import ( "context" - model "github.com/ctreminiom/go-atlassian/pkg/infra/models" "io" + + model "github.com/ctreminiom/go-atlassian/pkg/infra/models" ) type ServiceDeskConnector interface { @@ -24,12 +25,12 @@ type ServiceDeskConnector interface { // GET /rest/servicedeskapi/servicedesk/{serviceDeskId} // // https://docs.go-atlassian.io/jira-service-management-cloud/request/service-desk#get-service-desk-by-id - Get(ctx context.Context, serviceDeskID int) (*model.ServiceDeskScheme, *model.ResponseScheme, error) + Get(ctx context.Context, serviceDeskID string) (*model.ServiceDeskScheme, *model.ResponseScheme, error) // Attach one temporary attachments to a service desk // // POST /rest/servicedeskapi/servicedesk/{serviceDeskId}/attachTemporaryFile // // https://docs.go-atlassian.io/jira-service-management-cloud/request/service-desk#attach-temporary-file - Attach(ctx context.Context, serviceDeskID int, fileName string, file io.Reader) (*model.ServiceDeskTemporaryFileScheme, *model.ResponseScheme, error) + Attach(ctx context.Context, serviceDeskID string, fileName string, file io.Reader) (*model.ServiceDeskTemporaryFileScheme, *model.ResponseScheme, error) } From 88c4ecb3b9d296859dd02e60fefcf88607a79f8d Mon Sep 17 00:00:00 2001 From: Florian Kinder Date: Thu, 27 Jun 2024 13:21:09 +0900 Subject: [PATCH 35/40] Fixed struct types and added missing properties in request type fields --- pkg/infra/models/sm_request_type.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pkg/infra/models/sm_request_type.go b/pkg/infra/models/sm_request_type.go index 6a9b7170..00c86a67 100644 --- a/pkg/infra/models/sm_request_type.go +++ b/pkg/infra/models/sm_request_type.go @@ -74,22 +74,24 @@ type RequestTypeFieldScheme struct { Required bool `json:"required,omitempty"` // Indicates if the request type field is required. DefaultValues []*RequestTypeFieldValueScheme `json:"defaultValues,omitempty"` // The default values of the request type field. ValidValues []*RequestTypeFieldValueScheme `json:"validValues,omitempty"` // The valid values of the request type field. + PresetValues []string `json:"presetValues,omitempty"` // The preset values of the request type field. JiraSchema *RequestTypeJiraSchema `json:"jiraSchema,omitempty"` // The Jira schema of the request type field. Visible bool `json:"visible,omitempty"` // Indicates if the request type field is visible. } // RequestTypeFieldValueScheme represents a field value of a request type field. type RequestTypeFieldValueScheme struct { - Value string `json:"value,omitempty"` // The value of the request type field value. - Label string `json:"label,omitempty"` // The label of the request type field value. - Children []interface{} `json:"children,omitempty"` // The children of the request type field value. + Value string `json:"value,omitempty"` // The value of the request type field value. + Label string `json:"label,omitempty"` // The label of the request type field value. + Children []*RequestTypeFieldValueScheme `json:"children,omitempty"` // The children of the request type field value. } // RequestTypeJiraSchema represents the Jira schema of a request type field. type RequestTypeJiraSchema struct { - Type string `json:"type,omitempty"` // The type of the Jira schema. - Items string `json:"items,omitempty"` // The items of the Jira schema. - System string `json:"system,omitempty"` // The system of the Jira schema. - Custom string `json:"custom,omitempty"` // The custom of the Jira schema. - CustomID int `json:"customId,omitempty"` // The custom ID of the Jira schema. + Type string `json:"type,omitempty"` // The type of the Jira schema. + Items string `json:"items,omitempty"` // The items of the Jira schema. + System string `json:"system,omitempty"` // The system of the Jira schema. + Custom string `json:"custom,omitempty"` // The custom of the Jira schema. + CustomID int `json:"customId,omitempty"` // The custom ID of the Jira schema. + Configuration map[string]string `json:"configuration,omitempty"` // The configuration of the Jira schema. } From 6557c100984acc74173332ddcd4d7442c306c363 Mon Sep 17 00:00:00 2001 From: Florian Kinder Date: Thu, 27 Jun 2024 13:36:04 +0900 Subject: [PATCH 36/40] Added properties to request type scheme --- pkg/infra/models/sm_request_type.go | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/pkg/infra/models/sm_request_type.go b/pkg/infra/models/sm_request_type.go index 6a9b7170..c2ee7263 100644 --- a/pkg/infra/models/sm_request_type.go +++ b/pkg/infra/models/sm_request_type.go @@ -41,14 +41,22 @@ type ProjectRequestTypePageLinkScheme struct { // RequestTypeScheme represents a request type. type RequestTypeScheme struct { - ID string `json:"id,omitempty"` // The ID of the request type. - Name string `json:"name,omitempty"` // The name of the request type. - Description string `json:"description,omitempty"` // The description of the request type. - HelpText string `json:"helpText,omitempty"` // The help text of the request type. - IssueTypeID string `json:"issueTypeId,omitempty"` // The issue type ID of the request type. - ServiceDeskID string `json:"serviceDeskId,omitempty"` // The service desk ID of the request type. - GroupIds []string `json:"groupIds,omitempty"` // The group IDs of the request type. - Expands []string `json:"_expands,omitempty"` // The fields to expand in the request type. + ID string `json:"id,omitempty"` // The ID of the request type. + Name string `json:"name,omitempty"` // The name of the request type. + Description string `json:"description,omitempty"` // The description of the request type. + HelpText string `json:"helpText,omitempty"` // The help text of the request type. + Practice string `json:"practice,omitempty"` // The practice of the request type. + IssueTypeID string `json:"issueTypeId,omitempty"` // The issue type ID of the request type. + ServiceDeskID string `json:"serviceDeskId,omitempty"` // The service desk ID of the request type. + PortalID string `json:"portalId,omitempty"` // The portal ID of the request type. + GroupIDs []string `json:"groupIds,omitempty"` // The group IDs of the request type. + Expands []string `json:"_expands,omitempty"` // The fields to expand in the request type. + Links *RequestTypeLinksScheme `json:"_links,omitempty"` // The links related to the request type. +} + +// RequestTypeLinksScheme represents the links related to a request type. +type RequestTypeLinksScheme struct { + Self string `json:"self,omitempty"` // The self link the request type. } // RequestTypePayloadScheme represents a request type payload. From 2303df57d74179cc53d370872b6d3373c20e7e6d Mon Sep 17 00:00:00 2001 From: Florian Kinder Date: Sun, 30 Jun 2024 10:43:56 +0900 Subject: [PATCH 37/40] Added custom field request type (#282) * Added custom field request type * Fixed docs --------- Co-authored-by: Florian Kinder --- pkg/infra/models/jira_field.go | 22 +++ pkg/infra/models/jira_field_context_option.go | 7 - pkg/infra/models/jira_issue_custom_fields.go | 133 +++++++++++++++++- 3 files changed, 152 insertions(+), 10 deletions(-) diff --git a/pkg/infra/models/jira_field.go b/pkg/infra/models/jira_field.go index b073bc6f..8abbf2e9 100644 --- a/pkg/infra/models/jira_field.go +++ b/pkg/infra/models/jira_field.go @@ -60,3 +60,25 @@ type CustomFieldScheme struct { FieldType string `json:"type,omitempty"` SearcherKey string `json:"searcherKey,omitempty"` } + +// CustomFieldAssetScheme represents a custom field asset in Jira. +type CustomFieldAssetScheme struct { + WorkspaceId string `json:"workspaceId,omitempty"` // The ID of the workspace. + Id string `json:"id,omitempty"` // The ID of the custom field asset. + ObjectId string `json:"objectId,omitempty"` // The object ID of the custom field asset. +} + +// CustomFieldRequestTypeScheme represents a custom field request type in Jira. +type CustomFieldRequestTypeScheme struct { + Links *CustomFieldRequestTypeLinkScheme `json:"_links"` // Links related to the custom field request type. + RequestType *CustomerRequestTypeScheme `json:"requestType"` // The request type of the custom field. + CurrentStatus *CustomerRequestCurrentStatusScheme `json:"currentStatus"` // The current status of the request type. +} + +// CustomFieldRequestTypeLinkScheme represents the links of a custom field request type in Jira. +type CustomFieldRequestTypeLinkScheme struct { + Self string `json:"self,omitempty"` // The URL of the custom field request type itself. + JiraRest string `json:"jiraRest,omitempty"` // The Jira REST API link for the custom field request type. + Web string `json:"web,omitempty"` // The web link for the custom field request type. + Agent string `json:"agent,omitempty"` // The agent link for the custom field request type. +} diff --git a/pkg/infra/models/jira_field_context_option.go b/pkg/infra/models/jira_field_context_option.go index 673bdf44..c197f3ae 100644 --- a/pkg/infra/models/jira_field_context_option.go +++ b/pkg/infra/models/jira_field_context_option.go @@ -1,12 +1,5 @@ package models -// CustomFieldAssetScheme represents a custom field asset in Jira. -type CustomFieldAssetScheme struct { - WorkspaceId string `json:"workspaceId,omitempty"` // The ID of the workspace. - Id string `json:"id,omitempty"` // The ID of the custom field asset. - ObjectId string `json:"objectId,omitempty"` // The object ID of the custom field asset. -} - // CustomFieldContextOptionPageScheme represents a page of custom field context options in Jira. type CustomFieldContextOptionPageScheme struct { Self string `json:"self,omitempty"` // The URL of the page. diff --git a/pkg/infra/models/jira_issue_custom_fields.go b/pkg/infra/models/jira_issue_custom_fields.go index f895ae35..359a85c0 100644 --- a/pkg/infra/models/jira_issue_custom_fields.go +++ b/pkg/infra/models/jira_issue_custom_fields.go @@ -4,9 +4,10 @@ import ( "bytes" "encoding/json" "fmt" - "github.com/tidwall/gjson" "reflect" "time" + + "github.com/tidwall/gjson" ) // ParseMultiSelectCustomField parses a multi-select custom field from the given buffer data @@ -1517,11 +1518,11 @@ func ParseAssetCustomField(buffer bytes.Buffer, customField string) ([]*CustomFi // } // // Parameters: -// - customField: The name of the multi-select custom field to parse. +// - customField: The name of the asset custom field to parse. // - buffer: A bytes.Buffer containing JSON data representing custom field values. // // Returns: -// - map[string]*CustomFieldAssetScheme: A map where the key is the issue key and the +// - map[string][]*CustomFieldAssetScheme: A map where the key is the issue key and the // value is a CustomFieldAssetScheme struct representing the parsed // jira assets values. // - error: An error if there was a problem parsing the custom field data or if the JSON data @@ -1818,3 +1819,129 @@ func ParseDateTimeCustomFields(buffer bytes.Buffer, customField string) (map[str return customfieldsAsMap, nil } + +// ParseRequestTypeCustomField parses the Jira service desk request type elements from the given buffer +// data associated with the specified custom field ID and returns a struct CustomFieldRequestTypeScheme +// +// Parameters: +// - customfieldID: A string representing the unique identifier of the custom field. +// - buffer: A bytes.Buffer containing the serialized data to be parsed. +// +// Returns: +// - *CustomFieldRequestTypeScheme: the customfield value as CustomFieldRequestTypeScheme type +// +// Example usage: +// +// customfieldID := "customfield_10010" +// buffer := bytes.NewBuffer([]byte{ /* Serialized data */ }) +// requestType, err := ParseRequestTypeCustomField(customfieldID, buffer) +// if err != nil { +// log.Fatal(err) +// } +// +// fmt.Println(requestType) +// +// Docs: https://docs.go-atlassian.io/cookbooks/extract-customfields-from-issue-s#parse-requesttype-customfield +func ParseRequestTypeCustomField(buffer bytes.Buffer, customField string) (*CustomFieldRequestTypeScheme, error) { + + raw := gjson.ParseBytes(buffer.Bytes()) + path := fmt.Sprintf("fields.%v", customField) + + // Check if the buffer contains the "fields" object + if !raw.Get("fields").Exists() { + return nil, ErrNoFieldInformationError + } + + // Check if the issue iteration contains information on the customfield selected, + // if not, continue + if raw.Get(path).Type == gjson.Null { + return nil, ErrNoAssetTypeError + } + + var requestType *CustomFieldRequestTypeScheme + if err := json.Unmarshal([]byte(raw.Get(path).String()), &requestType); err != nil { + return nil, ErrNoAssetTypeError + } + + return requestType, nil +} + +// ParseRequestTypeCustomFields extracts and parses jira service desk reqeust type customfield data from +// a given bytes.Buffer from multiple issues +// +// This function takes the name of the custom field to parse and a bytes.Buffer containing +// JSON data representing the custom field values associated with different issues. It returns +// a map where the key is the issue key and the value is a slice of CustomFieldRequestTypeScheme +// structs, representing the parsed assets associated with a Jira issues. +// +// The JSON data within the buffer is expected to have a specific structure where the custom field +// values are organized by issue keys and options are represented within a context. The function +// parses this structure to extract and organize the custom field values. +// +// If the custom field data cannot be parsed successfully, an error is returned. +// +// Example Usage: +// +// customFieldName := "customfield_10010" +// buffer := // Populate the buffer with JSON data +// customFields, err := ParseRequestTypeCustomFields(customFieldName, buffer) +// if err != nil { +// // Handle the error +// } +// +// // Iterate through the parsed custom fields +// for issueKey, customFieldValues := range customFields { +// fmt.Printf("Issue Key: %s\n", issueKey) +// fmt.Printf("Custom Field Value: %+v\n", customFieldValues) +// } +// +// Parameters: +// - customField: The name of the request type custom field to parse. +// - buffer: A bytes.Buffer containing JSON data representing custom field values. +// +// Returns: +// - map[string]*CustomFieldRequestTypeScheme: A map where the key is the issue key and the +// value is a CustomFieldRequestTypeScheme struct representing the parsed +// jira service desk request type values. +// - error: An error if there was a problem parsing the custom field data or if the JSON data +// did not conform to the expected structure. +// +// Docs: https://docs.go-atlassian.io/cookbooks/extract-customfields-from-issue-s#parse-requesttype-customfields +func ParseRequestTypeCustomFields(buffer bytes.Buffer, customField string) (map[string]*CustomFieldRequestTypeScheme, error) { + + raw := gjson.ParseBytes(buffer.Bytes()) + + // Check if the buffer contains the "issues" object + if !raw.Get("issues").Exists() { + return nil, ErrNoIssuesSliceError + } + + // Loop through each custom field, extract the information and stores the data on a map + customfieldsAsMap := make(map[string]*CustomFieldRequestTypeScheme) + raw.Get("issues").ForEach(func(key, value gjson.Result) bool { + + path, issueKey := fmt.Sprintf("fields.%v", customField), value.Get("key").String() + + // Check if the issue iteration contains information on the customfield selected, + // if not, continue + if value.Get(path).Type == gjson.Null { + return true + } + + var customFields *CustomFieldRequestTypeScheme + if err := json.Unmarshal([]byte(value.Get(path).String()), &customFields); err != nil { + return true + } + + customfieldsAsMap[issueKey] = customFields + return true + }) + + // Check if the map processed contains elements + // if so, return an error interface + if len(customfieldsAsMap) == 0 { + return nil, ErrNoMapValuesError + } + + return customfieldsAsMap, nil +} From b1db9a1aca4dbcd8d19ba9c2111828cd773f1475 Mon Sep 17 00:00:00 2001 From: Florian Kinder Date: Sun, 30 Jun 2024 10:53:52 +0900 Subject: [PATCH 38/40] Fixed initialism in bitbucket (#281) Co-authored-by: Florian Kinder --- bitbucket/internal/workspace_webhooks_impl_test.go | 12 +++++++----- pkg/infra/models/bitbucket_projects.go | 4 ++-- pkg/infra/models/bitbucket_repository.go | 12 ++++++------ pkg/infra/models/bitbucket_webhooks.go | 4 ++-- pkg/infra/models/bitbucket_workspace.go | 8 ++++---- pkg/infra/models/bitbucket_workspace_membership.go | 12 ++++++------ 6 files changed, 27 insertions(+), 25 deletions(-) diff --git a/bitbucket/internal/workspace_webhooks_impl_test.go b/bitbucket/internal/workspace_webhooks_impl_test.go index 9776003d..f8abca6e 100644 --- a/bitbucket/internal/workspace_webhooks_impl_test.go +++ b/bitbucket/internal/workspace_webhooks_impl_test.go @@ -3,12 +3,14 @@ package internal import ( "context" "errors" + "net/http" + "testing" + + "github.com/stretchr/testify/assert" + model "github.com/ctreminiom/go-atlassian/pkg/infra/models" "github.com/ctreminiom/go-atlassian/service" "github.com/ctreminiom/go-atlassian/service/mocks" - "github.com/stretchr/testify/assert" - "net/http" - "testing" ) func Test_internalWorkspaceWebhookServiceImpl_Gets(t *testing.T) { @@ -246,7 +248,7 @@ func Test_internalWorkspaceWebhookServiceImpl_Create(t *testing.T) { payloadMocked := &model.WebhookSubscriptionPayloadScheme{ Description: "", - Url: "", + URL: "", Active: false, Events: nil, } @@ -365,7 +367,7 @@ func Test_internalWorkspaceWebhookServiceImpl_Update(t *testing.T) { payloadMocked := &model.WebhookSubscriptionPayloadScheme{ Description: "", - Url: "", + URL: "", Active: false, Events: nil, } diff --git a/pkg/infra/models/bitbucket_projects.go b/pkg/infra/models/bitbucket_projects.go index af87a7a9..06ad3683 100644 --- a/pkg/infra/models/bitbucket_projects.go +++ b/pkg/infra/models/bitbucket_projects.go @@ -14,7 +14,7 @@ type BitbucketProjectPageScheme struct { // BitbucketProjectScheme represents a Bitbucket project. type BitbucketProjectScheme struct { Links *BitbucketProjectLinksScheme `json:"links,omitempty"` // The links related to the project. - Uuid string `json:"uuid,omitempty"` // The UUID of the project. + UUID string `json:"uuid,omitempty"` // The UUID of the project. Key string `json:"key,omitempty"` // The key of the project. Name string `json:"name,omitempty"` // The name of the project. Description string `json:"description,omitempty"` // The description of the project. @@ -26,6 +26,6 @@ type BitbucketProjectScheme struct { // BitbucketProjectLinksScheme represents the links related to a Bitbucket project. type BitbucketProjectLinksScheme struct { - Html *BitbucketLinkScheme `json:"html,omitempty"` // The HTML link of the project. + HTML *BitbucketLinkScheme `json:"html,omitempty"` // The HTML link of the project. Avatar *BitbucketLinkScheme `json:"avatar,omitempty"` // The avatar link of the project. } diff --git a/pkg/infra/models/bitbucket_repository.go b/pkg/infra/models/bitbucket_repository.go index bf43cbfd..ba13a2a8 100644 --- a/pkg/infra/models/bitbucket_repository.go +++ b/pkg/infra/models/bitbucket_repository.go @@ -30,10 +30,10 @@ type RepositoryPermissionScheme struct { // RepositoryScheme represents a repository. // Type is the type of the repository. -// Uuid is the unique identifier of the repository. +// UUID is the unique identifier of the repository. // FullName is the full name of the repository. // IsPrivate indicates if the repository is private. -// Scm is the source control management system used by the repository. +// SCM is the source control management system used by the repository. // Name is the name of the repository. // Description is the description of the repository. // CreatedOn is the creation time of the repository. @@ -49,10 +49,10 @@ type RepositoryPermissionScheme struct { // Links is a collection of links related to the repository. type RepositoryScheme struct { Type string `json:"type,omitempty"` // The type of the repository. - Uuid string `json:"uuid,omitempty"` // The unique identifier of the repository. + UUID string `json:"uuid,omitempty"` // The unique identifier of the repository. FullName string `json:"full_name,omitempty"` // The full name of the repository. IsPrivate bool `json:"is_private,omitempty"` // Indicates if the repository is private. - Scm string `json:"scm,omitempty"` // The source control management system used by the repository. + SCM string `json:"scm,omitempty"` // The source control management system used by the repository. Name string `json:"name,omitempty"` // The name of the repository. Description string `json:"description,omitempty"` // The description of the repository. CreatedOn string `json:"created_on,omitempty"` // The creation time of the repository. @@ -70,7 +70,7 @@ type RepositoryScheme struct { // RepositoryLinksScheme represents a collection of links related to a repository. // Self is the link to the repository itself. -// Html is the link to the repository's HTML page. +// HTML is the link to the repository's HTML page. // Avatar is the link to the repository's avatar. // PullRequests is the link to the repository's pull requests. // Commits is the link to the repository's commits. @@ -81,7 +81,7 @@ type RepositoryScheme struct { // Hooks is the link to the repository's hooks. type RepositoryLinksScheme struct { Self *BitbucketLinkScheme `json:"self,omitempty"` // The link to the repository itself. - Html *BitbucketLinkScheme `json:"html,omitempty"` // The link to the repository's HTML page. + HTML *BitbucketLinkScheme `json:"html,omitempty"` // The link to the repository's HTML page. Avatar *BitbucketLinkScheme `json:"avatar,omitempty"` // The link to the repository's avatar. PullRequests *BitbucketLinkScheme `json:"pullrequests,omitempty"` // The link to the repository's pull requests. Commits *BitbucketLinkScheme `json:"commits,omitempty"` // The link to the repository's commits. diff --git a/pkg/infra/models/bitbucket_webhooks.go b/pkg/infra/models/bitbucket_webhooks.go index bf711bb2..c8531ea8 100644 --- a/pkg/infra/models/bitbucket_webhooks.go +++ b/pkg/infra/models/bitbucket_webhooks.go @@ -2,12 +2,12 @@ package models // WebhookSubscriptionPayloadScheme represents the payload for a webhook subscription. // Description is the description of the webhook subscription. -// Url is the URL of the webhook subscription. +// URL is the URL of the webhook subscription. // Active indicates if the webhook subscription is active. // Events is a slice of the events for the webhook subscription. type WebhookSubscriptionPayloadScheme struct { Description string `json:"description,omitempty"` // The description of the webhook subscription. - Url string `json:"url,omitempty"` // The URL of the webhook subscription. + URL string `json:"url,omitempty"` // The URL of the webhook subscription. Active bool `json:"active,omitempty"` // Indicates if the webhook subscription is active. Events []string `json:"events,omitempty"` // The events for the webhook subscription. } diff --git a/pkg/infra/models/bitbucket_workspace.go b/pkg/infra/models/bitbucket_workspace.go index 904cb55d..00308de9 100644 --- a/pkg/infra/models/bitbucket_workspace.go +++ b/pkg/infra/models/bitbucket_workspace.go @@ -3,7 +3,7 @@ package models // WorkspaceScheme represents a workspace. // Type is the type of the workspace. // Links is a collection of links related to the workspace. -// Uuid is the unique identifier of the workspace. +// UUID is the unique identifier of the workspace. // Name is the name of the workspace. // Slug is the slug of the workspace. // IsPrivate indicates if the workspace is private. @@ -12,7 +12,7 @@ package models type WorkspaceScheme struct { Type string `json:"type,omitempty"` // The type of the workspace. Links *WorkspaceLinksScheme `json:"links,omitempty"` // The links related to the workspace. - Uuid string `json:"uuid,omitempty"` // The unique identifier of the workspace. + UUID string `json:"uuid,omitempty"` // The unique identifier of the workspace. Name string `json:"name,omitempty"` // The name of the workspace. Slug string `json:"slug,omitempty"` // The slug of the workspace. IsPrivate bool `json:"is_private,omitempty"` // Indicates if the workspace is private. @@ -22,7 +22,7 @@ type WorkspaceScheme struct { // WorkspaceLinksScheme represents a collection of links related to a workspace. // Avatar is the link to the workspace's avatar. -// Html is the link to the workspace's HTML page. +// HTML is the link to the workspace's HTML page. // Members is the link to the workspace's members. // Owners is the link to the workspace's owners. // Projects is the link to the workspace's projects. @@ -31,7 +31,7 @@ type WorkspaceScheme struct { // Self is the link to the workspace itself. type WorkspaceLinksScheme struct { Avatar *BitbucketLinkScheme `json:"avatar,omitempty"` // The link to the workspace's avatar. - Html *BitbucketLinkScheme `json:"html,omitempty"` // The link to the workspace's HTML page. + HTML *BitbucketLinkScheme `json:"html,omitempty"` // The link to the workspace's HTML page. Members *BitbucketLinkScheme `json:"members,omitempty"` // The link to the workspace's members. Owners *BitbucketLinkScheme `json:"owners,omitempty"` // The link to the workspace's owners. Projects *BitbucketLinkScheme `json:"projects,omitempty"` // The link to the workspace's projects. diff --git a/pkg/infra/models/bitbucket_workspace_membership.go b/pkg/infra/models/bitbucket_workspace_membership.go index 1fa05f70..5fb446e2 100644 --- a/pkg/infra/models/bitbucket_workspace_membership.go +++ b/pkg/infra/models/bitbucket_workspace_membership.go @@ -45,27 +45,27 @@ type WorkspaceMembershipLinksScheme struct { // CreatedOn is the creation time of the account. // DisplayName is the display name of the account. // Username is the username of the account. -// Uuid is the unique identifier of the account. +// UUID is the unique identifier of the account. // Type is the type of the account. -// AccountId is the account ID of the account. +// AccountID is the account ID of the account. // Nickname is the nickname of the account. type BitbucketAccountScheme struct { Links *BitbucketAccountLinksScheme `json:"links,omitempty"` // The links related to the account. CreatedOn string `json:"created_on,omitempty"` // The creation time of the account. DisplayName string `json:"display_name,omitempty"` // The display name of the account. Username string `json:"username,omitempty"` // The username of the account. - Uuid string `json:"uuid,omitempty"` // The unique identifier of the account. + UUID string `json:"uuid,omitempty"` // The unique identifier of the account. Type string `json:"type,omitempty"` // The type of the account. - AccountId string `json:"account_id,omitempty"` // The account ID of the account. + AccountID string `json:"account_id,omitempty"` // The account ID of the account. Nickname string `json:"nickname,omitempty"` // The nickname of the account. } // BitbucketAccountLinksScheme represents a collection of links related to a Bitbucket account. // Avatar is the link to the account's avatar. // Self is the link to the account itself. -// Html is the link to the account's HTML page. +// HTML is the link to the account's HTML page. type BitbucketAccountLinksScheme struct { Avatar *BitbucketLinkScheme `json:"avatar,omitempty"` // The link to the account's avatar. Self *BitbucketLinkScheme `json:"self,omitempty"` // The link to the account itself. - Html *BitbucketLinkScheme `json:"html,omitempty"` // The link to the account's HTML page. + HTML *BitbucketLinkScheme `json:"html,omitempty"` // The link to the account's HTML page. } From 06e675c59213b368ae9b5b03bdeeedd33b2c496a Mon Sep 17 00:00:00 2001 From: Florian Kinder Date: Sun, 30 Jun 2024 11:09:55 +0900 Subject: [PATCH 39/40] =?UTF-8?q?Change=20payload=20for=20service=20desk?= =?UTF-8?q?=20request=20attachemnt=20create=20to=20provide=20=E2=80=A6=20(?= =?UTF-8?q?#271)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Change payload for service desk request attachemnt create to provide additional comment * Fixed tests * Fixed tests --------- Co-authored-by: Florian Kinder --- jira/sm/internal/attachment_impl.go | 20 +++---- jira/sm/internal/attachment_impl_test.go | 62 ++++++++++++++-------- pkg/infra/models/sm_request_attachments.go | 12 +++++ service/sm/attachment.go | 3 +- 4 files changed, 61 insertions(+), 36 deletions(-) diff --git a/jira/sm/internal/attachment_impl.go b/jira/sm/internal/attachment_impl.go index 7844b4e4..1357d7ef 100644 --- a/jira/sm/internal/attachment_impl.go +++ b/jira/sm/internal/attachment_impl.go @@ -3,12 +3,13 @@ package internal import ( "context" "fmt" - model "github.com/ctreminiom/go-atlassian/pkg/infra/models" - "github.com/ctreminiom/go-atlassian/service" - "github.com/ctreminiom/go-atlassian/service/sm" "net/http" "net/url" "strconv" + + model "github.com/ctreminiom/go-atlassian/pkg/infra/models" + "github.com/ctreminiom/go-atlassian/service" + "github.com/ctreminiom/go-atlassian/service/sm" ) func NewAttachmentService(client service.Connector, version string) *AttachmentService { @@ -38,8 +39,8 @@ func (s *AttachmentService) Gets(ctx context.Context, issueKeyOrID string, start // POST /rest/servicedeskapi/request/{issueIdOrKey}/attachment // // https://docs.go-atlassian.io/jira-service-management-cloud/request/attachment#create-attachment -func (s *AttachmentService) Create(ctx context.Context, issueKeyOrID string, temporaryAttachmentIDs []string, public bool) (*model.RequestAttachmentCreationScheme, *model.ResponseScheme, error) { - return s.internalClient.Create(ctx, issueKeyOrID, temporaryAttachmentIDs, public) +func (s *AttachmentService) Create(ctx context.Context, issueKeyOrID string, payload *model.RequestAttachmentCreationPayloadScheme) (*model.RequestAttachmentCreationScheme, *model.ResponseScheme, error) { + return s.internalClient.Create(ctx, issueKeyOrID, payload) } type internalServiceRequestAttachmentImpl struct { @@ -73,21 +74,16 @@ func (i *internalServiceRequestAttachmentImpl) Gets(ctx context.Context, issueKe return page, res, nil } -func (i *internalServiceRequestAttachmentImpl) Create(ctx context.Context, issueKeyOrID string, temporaryAttachmentIDs []string, public bool) (*model.RequestAttachmentCreationScheme, *model.ResponseScheme, error) { +func (i *internalServiceRequestAttachmentImpl) Create(ctx context.Context, issueKeyOrID string, payload *model.RequestAttachmentCreationPayloadScheme) (*model.RequestAttachmentCreationScheme, *model.ResponseScheme, error) { if issueKeyOrID == "" { return nil, nil, model.ErrNoIssueKeyOrIDError } - if len(temporaryAttachmentIDs) == 0 { + if len(payload.TemporaryAttachmentIDs) == 0 { return nil, nil, model.ErrNoAttachmentIDError } - payload := map[string]interface{}{ - "temporaryAttachmentIds": temporaryAttachmentIDs, - "public": public, - } - url := fmt.Sprintf("rest/servicedeskapi/request/%v/attachment", issueKeyOrID) req, err := i.c.NewRequest(ctx, http.MethodPost, url, "", payload) diff --git a/jira/sm/internal/attachment_impl_test.go b/jira/sm/internal/attachment_impl_test.go index aa9d8ce9..6e3d5928 100644 --- a/jira/sm/internal/attachment_impl_test.go +++ b/jira/sm/internal/attachment_impl_test.go @@ -3,12 +3,14 @@ package internal import ( "context" "errors" + "net/http" + "testing" + + "github.com/stretchr/testify/assert" + model "github.com/ctreminiom/go-atlassian/pkg/infra/models" "github.com/ctreminiom/go-atlassian/service" "github.com/ctreminiom/go-atlassian/service/mocks" - "github.com/stretchr/testify/assert" - "net/http" - "testing" ) func Test_internalServiceRequestAttachmentImpl_Gets(t *testing.T) { @@ -167,10 +169,9 @@ func Test_internalServiceRequestAttachmentImpl_Create(t *testing.T) { } type args struct { - ctx context.Context - issueKeyOrID string - temporaryAttachmentIDs []string - public bool + ctx context.Context + issueKeyOrID string + payload *model.RequestAttachmentCreationPayloadScheme } testCases := []struct { @@ -184,10 +185,12 @@ func Test_internalServiceRequestAttachmentImpl_Create(t *testing.T) { { name: "when the parameters are correct", args: args{ - ctx: context.Background(), - issueKeyOrID: "DUMMY-2", - temporaryAttachmentIDs: []string{"10001"}, - public: true, + ctx: context.Background(), + issueKeyOrID: "DUMMY-2", + payload: &model.RequestAttachmentCreationPayloadScheme{ + TemporaryAttachmentIDs: []string{"10001"}, + Public: true, + }, }, on: func(fields *fields) { @@ -198,7 +201,10 @@ func Test_internalServiceRequestAttachmentImpl_Create(t *testing.T) { http.MethodPost, "rest/servicedeskapi/request/DUMMY-2/attachment", "", - map[string]interface{}{"public": true, "temporaryAttachmentIds": []string{"10001"}}). + &model.RequestAttachmentCreationPayloadScheme{ + TemporaryAttachmentIDs: []string{"10001"}, + Public: true, + }). Return(&http.Request{}, nil) client.On("Call", @@ -213,10 +219,12 @@ func Test_internalServiceRequestAttachmentImpl_Create(t *testing.T) { { name: "when the http call cannot be executed", args: args{ - ctx: context.Background(), - issueKeyOrID: "DUMMY-2", - temporaryAttachmentIDs: []string{"10001"}, - public: true, + ctx: context.Background(), + issueKeyOrID: "DUMMY-2", + payload: &model.RequestAttachmentCreationPayloadScheme{ + TemporaryAttachmentIDs: []string{"10001"}, + Public: true, + }, }, on: func(fields *fields) { @@ -227,7 +235,10 @@ func Test_internalServiceRequestAttachmentImpl_Create(t *testing.T) { http.MethodPost, "rest/servicedeskapi/request/DUMMY-2/attachment", "", - map[string]interface{}{"public": true, "temporaryAttachmentIds": []string{"10001"}}). + &model.RequestAttachmentCreationPayloadScheme{ + TemporaryAttachmentIDs: []string{"10001"}, + Public: true, + }). Return(&http.Request{}, nil) client.On("Call", @@ -244,10 +255,12 @@ func Test_internalServiceRequestAttachmentImpl_Create(t *testing.T) { { name: "when the request cannot be created", args: args{ - ctx: context.Background(), - issueKeyOrID: "DUMMY-2", - temporaryAttachmentIDs: []string{"10001"}, - public: true, + ctx: context.Background(), + issueKeyOrID: "DUMMY-2", + payload: &model.RequestAttachmentCreationPayloadScheme{ + TemporaryAttachmentIDs: []string{"10001"}, + Public: true, + }, }, on: func(fields *fields) { @@ -258,7 +271,10 @@ func Test_internalServiceRequestAttachmentImpl_Create(t *testing.T) { http.MethodPost, "rest/servicedeskapi/request/DUMMY-2/attachment", "", - map[string]interface{}{"public": true, "temporaryAttachmentIds": []string{"10001"}}). + &model.RequestAttachmentCreationPayloadScheme{ + TemporaryAttachmentIDs: []string{"10001"}, + Public: true, + }). Return(&http.Request{}, errors.New("client: no http request created")) fields.c = client @@ -290,7 +306,7 @@ func Test_internalServiceRequestAttachmentImpl_Create(t *testing.T) { attachmentService := NewAttachmentService(testCase.fields.c, "latest") gotResult, gotResponse, err := attachmentService.Create(testCase.args.ctx, testCase.args.issueKeyOrID, - testCase.args.temporaryAttachmentIDs, testCase.args.public) + testCase.args.payload) if testCase.wantErr { diff --git a/pkg/infra/models/sm_request_attachments.go b/pkg/infra/models/sm_request_attachments.go index b268145e..d565b880 100644 --- a/pkg/infra/models/sm_request_attachments.go +++ b/pkg/infra/models/sm_request_attachments.go @@ -62,6 +62,18 @@ type RequestAttachmentCreationCommentScheme struct { } `json:"_links,omitempty"` // Links related to the comment. } +// RequestAttachmentCreationPayloadScheme represents the payload for creating a request attachment. +type RequestAttachmentCreationPayloadScheme struct { + TemporaryAttachmentIDs []string `json:"temporaryAttachmentIds,omitempty"` + Public bool `json:"public,omitempty"` + AdditionalComment *RequestAttachmentCreationAdditionalCommentPayloadScheme `json:"additionalComment,omitempty"` +} + +// RequestAttachmentCreationAdditionalCommentPayloadScheme represents the additional comment for creating a request attachment. +type RequestAttachmentCreationAdditionalCommentPayloadScheme struct { + Body string `json:"body,omitempty"` +} + // RequestAttachmentCreationScheme represents the creation of a request attachment. type RequestAttachmentCreationScheme struct { Comment *RequestAttachmentCreationCommentScheme `json:"comment,omitempty"` // The comment during the creation of the request attachment. diff --git a/service/sm/attachment.go b/service/sm/attachment.go index 121d8e8b..a3770f1f 100644 --- a/service/sm/attachment.go +++ b/service/sm/attachment.go @@ -2,6 +2,7 @@ package sm import ( "context" + model "github.com/ctreminiom/go-atlassian/pkg/infra/models" ) @@ -21,5 +22,5 @@ type AttachmentConnector interface { // POST /rest/servicedeskapi/request/{issueIdOrKey}/attachment // // https://docs.go-atlassian.io/jira-service-management-cloud/request/attachment#create-attachment - Create(ctx context.Context, issueKeyOrID string, temporaryAttachmentIDs []string, public bool) (*model.RequestAttachmentCreationScheme, *model.ResponseScheme, error) + Create(ctx context.Context, issueKeyOrID string, payload *model.RequestAttachmentCreationPayloadScheme) (*model.RequestAttachmentCreationScheme, *model.ResponseScheme, error) } From 2856a1bb7031b90f16960aac20da1db3b50e3e83 Mon Sep 17 00:00:00 2001 From: Florian Kinder Date: Sun, 30 Jun 2024 11:29:04 +0900 Subject: [PATCH 40/40] Added RenderedFields and replaced string with time.Time in date fields (#279) * Added RenderedFields and replaced string with time.Time in date fields * :art: * Added duedate * test * Revert "test" This reverts commit a4c0a42c05e5992314ea372107cefbe8557a75f9. * Fixed json * Fixed json --------- Co-authored-by: Florian Kinder --- pkg/infra/models/jira_issue_v2.go | 22 +++++++++++++--------- pkg/infra/models/jira_issue_v3.go | 22 +++++++++++++--------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/pkg/infra/models/jira_issue_v2.go b/pkg/infra/models/jira_issue_v2.go index 26c17661..f8c95de9 100644 --- a/pkg/infra/models/jira_issue_v2.go +++ b/pkg/infra/models/jira_issue_v2.go @@ -1,18 +1,21 @@ package models import ( - "dario.cat/mergo" "encoding/json" + "time" + + "dario.cat/mergo" ) // IssueSchemeV2 represents the scheme of an issue in Jira version 2. type IssueSchemeV2 struct { - ID string `json:"id,omitempty"` // The ID of the issue. - Key string `json:"key,omitempty"` // The key of the issue. - Self string `json:"self,omitempty"` // The URL of the issue. - Transitions []*IssueTransitionScheme `json:"transitions,omitempty"` // The transitions of the issue. - Changelog *IssueChangelogScheme `json:"changelog,omitempty"` // The changelog of the issue. - Fields *IssueFieldsSchemeV2 `json:"fields,omitempty"` // The fields of the issue. + ID string `json:"id,omitempty"` // The ID of the issue. + Key string `json:"key,omitempty"` // The key of the issue. + Self string `json:"self,omitempty"` // The URL of the issue. + Transitions []*IssueTransitionScheme `json:"transitions,omitempty"` // The transitions of the issue. + Changelog *IssueChangelogScheme `json:"changelog,omitempty"` // The changelog of the issue. + Fields *IssueFieldsSchemeV2 `json:"fields,omitempty"` // The fields of the issue. + RenderedFields map[string]interface{} `json:"renderedFields,omitempty"` } // MergeCustomFields merges custom fields into the issue scheme. @@ -114,8 +117,8 @@ type IssueFieldsSchemeV2 struct { StatusCategoryChangeDate string `json:"statuscategorychangedate,omitempty"` LastViewed string `json:"lastViewed,omitempty"` Summary string `json:"summary,omitempty"` - Created string `json:"created,omitempty"` - Updated string `json:"updated,omitempty"` + Created *time.Time `json:"created,omitempty"` + Updated *time.Time `json:"updated,omitempty"` Labels []string `json:"labels,omitempty"` Status *StatusScheme `json:"status,omitempty"` Description string `json:"description,omitempty"` @@ -123,6 +126,7 @@ type IssueFieldsSchemeV2 struct { Subtasks []*IssueScheme `json:"subtasks,omitempty"` Security *SecurityScheme `json:"security,omitempty"` Worklog *IssueWorklogRichTextPageScheme `json:"worklog,omitempty"` + DueDate string `json:"duedate,omitempty"` } // ParentScheme represents the parent of an issue in Jira. diff --git a/pkg/infra/models/jira_issue_v3.go b/pkg/infra/models/jira_issue_v3.go index 03137f01..c1e28c1b 100644 --- a/pkg/infra/models/jira_issue_v3.go +++ b/pkg/infra/models/jira_issue_v3.go @@ -1,18 +1,21 @@ package models import ( - "dario.cat/mergo" "encoding/json" + "time" + + "dario.cat/mergo" ) // IssueScheme represents an issue in Jira. type IssueScheme struct { - ID string `json:"id,omitempty"` - Key string `json:"key,omitempty"` - Self string `json:"self,omitempty"` - Transitions []*IssueTransitionScheme `json:"transitions,omitempty"` - Changelog *IssueChangelogScheme `json:"changelog,omitempty"` - Fields *IssueFieldsScheme `json:"fields,omitempty"` + ID string `json:"id,omitempty"` + Key string `json:"key,omitempty"` + Self string `json:"self,omitempty"` + Transitions []*IssueTransitionScheme `json:"transitions,omitempty"` + Changelog *IssueChangelogScheme `json:"changelog,omitempty"` + Fields *IssueFieldsScheme `json:"fields,omitempty"` + RenderedFields map[string]interface{} `json:"renderedFields,omitempty"` } // MergeCustomFields merges the custom fields into the issue. @@ -114,8 +117,8 @@ type IssueFieldsScheme struct { StatusCategoryChangeDate string `json:"statuscategorychangedate,omitempty"` // The date the status category changed. LastViewed string `json:"lastViewed,omitempty"` // The last time the issue was viewed. Summary string `json:"summary,omitempty"` // The summary of the issue. - Created string `json:"created,omitempty"` // The date the issue was created. - Updated string `json:"updated,omitempty"` // The date the issue was last updated. + Created *time.Time `json:"created,omitempty"` // The date the issue was created. + Updated *time.Time `json:"updated,omitempty"` // The date the issue was last updated. Labels []string `json:"labels,omitempty"` // The labels associated with the issue. Status *StatusScheme `json:"status,omitempty"` // The status of the issue. Description *CommentNodeScheme `json:"description,omitempty"` // The description of the issue. @@ -124,6 +127,7 @@ type IssueFieldsScheme struct { Security *SecurityScheme `json:"security,omitempty"` // The security level of the issue. Attachment []*AttachmentScheme `json:"attachment,omitempty"` // The attachments of the issue. Worklog *IssueWorklogADFPageScheme `json:"worklog,omitempty"` // The worklog of the issue. + DueDate string `json:"duedate,omitempty"` // The due date of the issue. } // IssueTransitionScheme represents a transition of an issue in Jira.