Skip to content

Commit

Permalink
🏗️ Moved the Notification Scheme to their own dedicated service.
Browse files Browse the repository at this point in the history
1. The notification schemes can be linked with a project, but there are no exclusivity related to the project.
2. Hence, the service was moved under the root library and not under the project service.
  • Loading branch information
ctreminiom committed Apr 28, 2023
1 parent 7306879 commit c3fe434
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 68 deletions.
21 changes: 9 additions & 12 deletions jira/internal/project_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@ import (
)

type ProjectChildServices struct {
Category *ProjectCategoryService
Component *ProjectComponentService
Feature *ProjectFeatureService
Permission *ProjectPermissionSchemeService
Notification *NotificationSchemeService
Property *ProjectPropertyService
Role *ProjectRoleService
Type *ProjectTypeService
Validator *ProjectValidatorService
Version *ProjectVersionService
Category *ProjectCategoryService
Component *ProjectComponentService
Feature *ProjectFeatureService
Permission *ProjectPermissionSchemeService
Property *ProjectPropertyService
Role *ProjectRoleService
Type *ProjectTypeService
Validator *ProjectValidatorService
Version *ProjectVersionService
}

func NewProjectService(client service.Client, version string, subServices *ProjectChildServices) (*ProjectService, error) {
Expand All @@ -42,7 +41,6 @@ func NewProjectService(client service.Client, version string, subServices *Proje
Type: subServices.Type,
Validator: subServices.Validator,
Version: subServices.Version,
Notification: subServices.Notification,
}, nil
}

Expand All @@ -57,7 +55,6 @@ type ProjectService struct {
Type *ProjectTypeService
Validator *ProjectValidatorService
Version *ProjectVersionService
Notification *NotificationSchemeService
}

// Create creates a project based on a project type template
Expand Down
57 changes: 29 additions & 28 deletions jira/v2/api_client_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,16 +276,15 @@ func New(httpClient common.HttpClient, site string) (*Client, error) {
}

projectSubService := &internal.ProjectChildServices{
Category: projectCategory,
Component: projectComponent,
Feature: projectFeature,
Permission: projectPermission,
Property: projectProperties,
Role: projectRole,
Type: projectType,
Validator: projectValidator,
Version: projectVersion,
Notification: projectNotificationScheme,
Category: projectCategory,
Component: projectComponent,
Feature: projectFeature,
Permission: projectPermission,
Property: projectProperties,
Role: projectRole,
Type: projectType,
Validator: projectValidator,
Version: projectVersion,
}

project, err := internal.NewProjectService(client, "2", projectSubService)
Expand Down Expand Up @@ -369,29 +368,31 @@ func New(httpClient common.HttpClient, site string) (*Client, error) {
client.User = user
client.Workflow = workflow
client.JQL = jql
client.NotificationScheme = projectNotificationScheme

return client, nil
}

type Client struct {
HTTP common.HttpClient
Auth common.Authentication
Site *url.URL
Role *internal.ApplicationRoleService
Audit *internal.AuditRecordService
Dashboard *internal.DashboardService
Filter *internal.FilterService
Group *internal.GroupService
Issue *internal.IssueRichTextService
MySelf *internal.MySelfService
Permission *internal.PermissionService
Project *internal.ProjectService
Screen *internal.ScreenService
Task *internal.TaskService
Server *internal.ServerService
User *internal.UserService
Workflow *internal.WorkflowService
JQL *internal.JQLService
HTTP common.HttpClient
Auth common.Authentication
Site *url.URL
Role *internal.ApplicationRoleService
Audit *internal.AuditRecordService
Dashboard *internal.DashboardService
Filter *internal.FilterService
Group *internal.GroupService
Issue *internal.IssueRichTextService
MySelf *internal.MySelfService
Permission *internal.PermissionService
Project *internal.ProjectService
Screen *internal.ScreenService
Task *internal.TaskService
Server *internal.ServerService
User *internal.UserService
Workflow *internal.WorkflowService
JQL *internal.JQLService
NotificationScheme *internal.NotificationSchemeService
}

func (c *Client) NewFormRequest(ctx context.Context, method, apiEndpoint, contentType string, payload io.Reader) (*http.Request, error) {
Expand Down
57 changes: 29 additions & 28 deletions jira/v3/api_client_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,16 +276,15 @@ func New(httpClient common.HttpClient, site string) (*Client, error) {
}

projectSubService := &internal.ProjectChildServices{
Category: projectCategory,
Component: projectComponent,
Feature: projectFeature,
Permission: projectPermission,
Property: projectProperties,
Role: projectRole,
Type: projectType,
Validator: projectValidator,
Version: projectVersion,
Notification: projectNotificationScheme,
Category: projectCategory,
Component: projectComponent,
Feature: projectFeature,
Permission: projectPermission,
Property: projectProperties,
Role: projectRole,
Type: projectType,
Validator: projectValidator,
Version: projectVersion,
}

project, err := internal.NewProjectService(client, "3", projectSubService)
Expand Down Expand Up @@ -369,29 +368,31 @@ func New(httpClient common.HttpClient, site string) (*Client, error) {
client.User = user
client.Workflow = workflow
client.JQL = jql
client.NotificationScheme = projectNotificationScheme

return client, nil
}

type Client struct {
HTTP common.HttpClient
Auth common.Authentication
Site *url.URL
Audit *internal.AuditRecordService
Role *internal.ApplicationRoleService
Dashboard *internal.DashboardService
Filter *internal.FilterService
Group *internal.GroupService
Issue *internal.IssueADFService
MySelf *internal.MySelfService
Permission *internal.PermissionService
Project *internal.ProjectService
Screen *internal.ScreenService
Task *internal.TaskService
Server *internal.ServerService
User *internal.UserService
Workflow *internal.WorkflowService
JQL *internal.JQLService
HTTP common.HttpClient
Auth common.Authentication
Site *url.URL
Audit *internal.AuditRecordService
Role *internal.ApplicationRoleService
Dashboard *internal.DashboardService
Filter *internal.FilterService
Group *internal.GroupService
Issue *internal.IssueADFService
MySelf *internal.MySelfService
Permission *internal.PermissionService
Project *internal.ProjectService
Screen *internal.ScreenService
Task *internal.TaskService
Server *internal.ServerService
User *internal.UserService
Workflow *internal.WorkflowService
JQL *internal.JQLService
NotificationScheme *internal.NotificationSchemeService
}

func (c *Client) NewFormRequest(ctx context.Context, method, apiEndpoint, contentType string, payload io.Reader) (*http.Request, error) {
Expand Down

0 comments on commit c3fe434

Please sign in to comment.