Skip to content

Commit

Permalink
no-namespaces rule applied
Browse files Browse the repository at this point in the history
  • Loading branch information
MrRefactoring committed Oct 12, 2023
1 parent 5bf2337 commit 25c71ec
Show file tree
Hide file tree
Showing 26 changed files with 77 additions and 375 deletions.
10 changes: 1 addition & 9 deletions src/agile/models/sprint.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export interface Sprint {
id: number;
self?: string;
state: 'future' | 'active' | 'closed' | string | Sprint.State;
state: 'future' | 'active' | 'closed' | string;
name: string;
startDate?: string;
endDate?: string;
Expand All @@ -10,11 +10,3 @@ export interface Sprint {
originBoardId?: number;
goal?: string;
}

export namespace Sprint {
export enum State {
Future = 'future',
Active = 'active',
Closed = 'closed',
}
}
4 changes: 1 addition & 3 deletions src/agile/parameters/partiallyUpdateSprint.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { Sprint } from '../models';

export interface PartiallyUpdateSprint {
/** The ID of the sprint to update. */
sprintId: number;
id?: number;
self?: string;
state?: string | Sprint.State;
state?: string;
name?: string;
startDate?: string | Date;
endDate?: string | Date;
Expand Down
4 changes: 2 additions & 2 deletions src/clients/baseClient.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AuthenticationService } from '../services/authenticationService';
import type { Callback } from '../callback';
import type { Client } from './client';
import type { Config } from '../config';
import { getAuthenticationToken } from '../services/authenticationService';
import type { RequestConfig } from '../requestConfig';
import axios, { AxiosError, AxiosInstance, AxiosResponse } from 'axios';

Expand Down Expand Up @@ -98,7 +98,7 @@ export class BaseClient implements Client {
const modifiedRequestConfig = {
...requestConfig,
headers: this.removeUndefinedProperties({
Authorization: await AuthenticationService.getAuthenticationToken(this.config.authentication),
Authorization: await getAuthenticationToken(this.config.authentication),
...requestConfig.headers,
}),
};
Expand Down
14 changes: 6 additions & 8 deletions src/serviceDesk/parameters/attachTemporaryFile.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
interface Attachment {
filename: string;
file: Buffer | ReadableStream | string | Blob | File;
}

export interface AttachTemporaryFile {
/**
* The ID of the Service Desk to which the file will be attached. This can alternatively be a [project
* identifier.](#project-identifiers)
*/
serviceDeskId: string;
attachment: AttachTemporaryFile.Attachment | AttachTemporaryFile.Attachment[];
}

export namespace AttachTemporaryFile {
export interface Attachment {
filename: string;
file: Buffer | ReadableStream | string | Blob | File;
}
attachment: Attachment | Attachment[];
}
30 changes: 0 additions & 30 deletions src/services/authenticationService/authenticationService.ts

This file was deleted.

28 changes: 28 additions & 0 deletions src/services/authenticationService/getAuthenticationToken.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Config } from '../../config';
import {
createBasicAuthenticationToken,
createOAuth2AuthenticationToken,
createPATAuthentication,
} from './authentications';

export async function getAuthenticationToken(
authentication: Config.Authentication | undefined,
): Promise<string | undefined> {
if (!authentication) {
return undefined;
}

if (authentication.basic) {
return createBasicAuthenticationToken(authentication.basic);
}

if (authentication.oauth2) {
return createOAuth2AuthenticationToken(authentication.oauth2);
}

if (authentication.personalAccessToken) {
return createPATAuthentication(authentication.personalAccessToken);
}

return undefined;
}
2 changes: 1 addition & 1 deletion src/services/authenticationService/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './authenticationService';
export * from './getAuthenticationToken';
14 changes: 6 additions & 8 deletions src/version2/parameters/addAttachment.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
interface Attachment {
filename: string;
file: Buffer | ReadableStream | string | Blob | File;
}

export interface AddAttachment {
/** The ID or key of the issue that attachments are added to. */
issueIdOrKey: string;

attachment: AddAttachment.Attachment | AddAttachment.Attachment[];
}

export namespace AddAttachment {
export interface Attachment {
filename: string;
file: Buffer | ReadableStream | string | Blob | File;
}
attachment: Attachment | Attachment[];
}
18 changes: 1 addition & 17 deletions src/version2/parameters/getCurrentUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,5 @@ export interface GetCurrentUser {
* `groups` Returns all groups, including nested groups, the user belongs to. `applicationRoles` Returns the
* application roles the user is assigned to.
*/
expand?:
| 'groups'
| 'applicationRoles'
| ('groups' | 'applicationRoles')[]
| string
| string[]
| GetCurrentUser.Expand
| GetCurrentUser.Expand[];
}

export namespace GetCurrentUser {
export enum Expand {
/** Returns all groups, including nested groups, the user belongs to. */
Groups = 'groups',
/** Returns the application roles the user is assigned to. */
ApplicationRoles = 'applicationRoles',
}
expand?: 'groups' | 'applicationRoles' | ('groups' | 'applicationRoles')[] | string | string[];
}
31 changes: 1 addition & 30 deletions src/version2/parameters/getFiltersPaginated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,40 +105,11 @@ export interface GetFiltersPaginated {
| 'viewUrl'
)[]
| string
| string[]
| GetFiltersPaginated.Expand
| GetFiltersPaginated.Expand[];
| string[];

/**
* EXPERIMENTAL: Whether share permissions are overridden to enable filters with any share permissions to be returned.
* Available to users with _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
overrideSharePermissions?: boolean;
}

export namespace GetFiltersPaginated {
export enum Expand {
/** Returns the description of the filter. */
Description = 'description',
/** Returns an indicator of whether the user has set the filter as a favorite. */
Favourite = 'favourite',
/** Returns a count of how many users have set this filter as a favorite. */
FavouritedCount = 'favouritedCount',
/** Returns the JQL query that the filter uses. */
JQL = 'jql',
/** Returns the owner of the filter. */
Owner = 'owner',
/** Returns a URL to perform the filter's JQL query. */
SearchUrl = 'searchUrl',
/** Returns the share permissions defined for the filter. */
SharePermissions = 'sharePermissions',
/** Returns the edit permissions defined for the filter. */
EditPermissions = 'editPermissions',
/** Returns whether the current user has permission to edit the filter. */
IsWritable = 'isWritable',
/** Returns the users that are subscribed to the filter. */
Subscriptions = 'subscriptions',
/** Returns a URL to view the filter. */
ViewUrl = 'viewUrl',
}
}
24 changes: 1 addition & 23 deletions src/version2/parameters/getIssue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ export interface GetIssue {
| 'versionedRepresentations'
| ('renderedFields' | 'names' | 'transitions' | 'editmeta' | 'changelog' | 'versionedRepresentations')[]
| string
| string[]
| GetIssue.Expand
| GetIssue.Expand[];
| string[];
/**
* A list of issue properties to return for the issue. This parameter accepts a comma-separated list. Allowed values:
*
Expand All @@ -70,23 +68,3 @@ export interface GetIssue {
*/
updateHistory?: boolean;
}

export namespace GetIssue {
export enum Expand {
/** Returns field values rendered in HTML format. */
RenderedFields = 'renderedFields',
/** Returns the display name of each field. -`schema` Returns the schema describing a field type. */
Names = 'names',
/** Returns all possible transitions for the issue. */
Transitions = 'transitions',
/** Returns information about how each field can be edited. */
EditMeta = 'editmeta',
/** Returns a list of recent updates to an issue, sorted by date, starting from the most recent. */
Changelog = 'changelog',
/**
* Returns a JSON array for each version of a field's value, with the highest number representing the most recent
* version. Note: When included in the request, the `fields` parameter is ignored.
*/
VersionedRepresentations = 'versionedRepresentations',
}
}
25 changes: 1 addition & 24 deletions src/version2/parameters/getRecent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,10 @@ export interface GetRecent {
| '*'
| ('description' | 'projectKeys' | 'lead' | 'issueTypes' | 'url' | 'permissions' | 'insight')[]
| string
| string[]
| GetRecent.Expand
| GetRecent.Expand[];
| string[];
/**
* EXPERIMENTAL. A list of project properties to return for the project. This parameter accepts a comma-separated
* list. Invalid property names are ignored.
*/
properties?: string[];
}

export namespace GetRecent {
export enum Expand {
/** Returns the project description. */
Description = 'description',
/** Returns all project keys associated with a project. */
ProjectKeys = 'projectKeys',
/** Returns information about the project lead. */
Lead = 'lead',
/** Returns all issue types associated with the project. */
IssueTypes = 'issueTypes',
/** Returns the URL associated with the project. */
Url = 'url',
/** Returns the permissions associated with the project. */
Permissions = 'permissions',
/** EXPERIMENTAL. Returns the insight details of total issue count and last issue update time for the project. */
Insight = 'insight',
/** Returns the project with all available expand options. */
All = '*',
}
}
11 changes: 1 addition & 10 deletions src/version2/parameters/getUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,5 @@ export interface GetUser {
* - `groups` includes all groups and nested groups to which the user belongs.
* - `applicationRoles` includes details of all the applications to which the user has access.
*/
expand?: 'groups' | 'applicationRoles' | string | string[] | GetUser.Expand | GetUser.Expand[];
}

export namespace GetUser {
export enum Expand {
/** Includes all groups and nested groups to which the user belongs. */
Groups = 'groups',
/** Includes details of all the applications to which the user has access. */
ApplicationRoles = 'applicationRoles',
}
expand?: 'groups' | 'applicationRoles' | string | string[];
}
10 changes: 0 additions & 10 deletions src/version3/models/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,3 @@ export interface Project {
archivedBy?: User;
landingPageInfo?: ProjectLandingPageInfo;
}

export namespace Project {
export enum Expand {
Description = 'description',
IssueTypes = 'issueTypes',
Lead = 'lead',
ProjectKeys = 'projectKeys',
IssueTypeHierarchy = 'issueTypeHierarchy',
}
}
14 changes: 6 additions & 8 deletions src/version3/parameters/addAttachment.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
interface Attachment {
filename: string;
file: Buffer | ReadableStream | string | Blob | File;
}

export interface AddAttachment {
/** The ID or key of the issue that attachments are added to. */
issueIdOrKey: string;

attachment: AddAttachment.Attachment | AddAttachment.Attachment[];
}

export namespace AddAttachment {
export interface Attachment {
filename: string;
file: Buffer | ReadableStream | string | Blob | File;
}
attachment: Attachment | Attachment[];
}
18 changes: 1 addition & 17 deletions src/version3/parameters/getCurrentUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,5 @@ export interface GetCurrentUser {
* - `groups` Returns all groups, including nested groups, the user belongs to.
* - `applicationRoles` Returns the application roles the user is assigned to.
*/
expand?:
| 'groups'
| 'applicationRoles'
| ('groups' | 'applicationRoles')[]
| string
| string[]
| GetCurrentUser.Expand
| GetCurrentUser.Expand[];
}

export namespace GetCurrentUser {
export enum Expand {
/** Returns all groups, including nested groups, the user belongs to. */
Groups = 'groups',
/** Returns the application roles the user is assigned to. */
ApplicationRoles = 'applicationRoles',
}
expand?: 'groups' | 'applicationRoles' | ('groups' | 'applicationRoles')[] | string | string[];
}
Loading

0 comments on commit 25c71ec

Please sign in to comment.