All files you-track-rest.ts

100% Statements 13/13
100% Branches 0/0
100% Functions 7/7
100% Lines 13/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228                  5x   7x 13x 8x                 5x                                                                                                                                                                                                                                                     5x 54x                                               5x 27x               5x 54x                                         5x 27x                                                  
/**
 * Types defined by the [YouTrack REST API](https://www.jetbrains.com/help/youtrack/standalone/api-entities.html).
 *
 * Not part of the public API of this project.
 */
 
/**
 * YouTrack REST API paths.
 */
export const youTrackPath = Object.freeze({
  ACTIVITIES_PAGE: 'api/activitiesPage',
  CUSTOM_FIELD: (customFieldId: string) => `api/admin/customFieldSettings/customFields/${customFieldId}`,
  ISSUES: (queryId: string) => `api/savedQueries/${queryId}/issues`,
  SAVED_QUERY: (queryId: string) => `api/savedQueries/${queryId}`,
  SORTED_ISSUES: 'api/sortedIssues',
  STATE_BUNDLES: 'api/admin/customFieldSettings/bundles/state',
  WORK_TIME_SETTINGS: 'api/admin/timeTrackingSettings/workTimeSettings',
});
 
/**
 * Hub REST API paths.
 */
export const hubPath = Object.freeze({
  OAUTH: 'api/rest/oauth2/auth',
});
 
export interface ActivityCursorPage {
  afterCursor?: string;
  hasAfter: boolean;
  activities: ActivityItem[];
}
 
export interface ActivityItem {
  $type: string;
  timestamp: number;
  added: any[];
  removed: any[];
  field: FilterField;
}
 
export interface BaseBundle extends Bundle {
  values: BundleElement[];
}
 
export interface Bundle {
  id: string;
}
 
export interface BundleCustomFieldDefaults extends CustomFieldDefaults {
  $type: string;
}
 
export interface BundleElement {
  id: string;
  name: string;
  ordinal: number;
  color: FieldStyle;
}
 
export interface CustomField {
  id: string;
  fieldDefaults: CustomFieldDefaults;
  fieldType: FieldType;
  name: string;
}
 
export interface CustomFieldActivityItem extends ActivityItem {
  $type: 'CustomFieldActivityItem';
  target: Issue;
}
 
// tslint:disable-next-line:no-empty-interface
export interface CustomFieldDefaults {}
 
export interface EnumBundleCustomFieldDefaults extends BundleCustomFieldDefaults {
  bundle: EnumBundle;
}
 
export interface EnumBundle extends BaseBundle {
  values: EnumBundleElement[];
}
 
// tslint:disable-next-line:no-empty-interface
export interface EnumBundleElement extends LocalizableBundleElement {}
 
export interface FieldStyle {
  background: string;
  foreground: string;
}
 
export interface FieldType {
  id: string;
}
 
export interface FilterField {
  id: string;
  name: string;
}
 
export interface Issue {
  $type: 'Issue';
  created: number;
  customFields: IssueCustomField[];
  id: string;
  idReadable: string;
  links: IssueLink[];
  parent: IssueLink;
  subtasks: IssueLink;
  resolved: number | null;
  summary: string;
  updated: number;
}
 
export interface IssueCustomField {
  $type: string;
  projectCustomField: ProjectCustomField;
}
 
export interface IssueFolder {
  id: string;
  name: string;
}
 
export interface IssueLink {
  direction: 'INWARD' | 'OUTWARD' | 'BOTH';
  linkType: IssueLinkType;
  issues: Issue[];
}
 
export interface IssueLinkType {
  directed: boolean;
  id: string;
  name: string;
  sourceToTarget: string;
  targetToSource: string;
}
 
// tslint:disable-next-line:no-empty-interface
export interface LocalizableBundleElement extends BundleElement {}
 
export interface PeriodIssueCustomField extends IssueCustomField {
  $type: 'PeriodIssueCustomField';
  value: PeriodValue | null;
}
 
export function isPeriodIssueCustomField(field: any): field is PeriodIssueCustomField {
  return field.$type === 'PeriodIssueCustomField';
}
 
export interface PeriodValue {
  minutes: number;
}
 
export interface ProjectCustomField {
  field: CustomField;
}
 
export interface SavedQuery extends WatchFolder {
  issues: Issue[];
}
 
export interface SortedIssuesResponse {
  count: number;
}
 
export interface SingleUserIssueCustomField extends IssueCustomField {
  $type: 'SingleUserIssueCustomField';
  value: User | null;
}
 
export function isSingleUserIssueCustomField(field: any): field is SingleUserIssueCustomField {
  return field.$type === 'SingleUserIssueCustomField';
}
 
export interface SingleEnumIssueCustomField extends IssueCustomField {
  $type: 'SingleEnumIssueCustomField';
  value: EnumBundleElement | null;
}
 
export function isSingleEnumIssueCustomField(field: any): field is SingleEnumIssueCustomField {
  return field.$type === 'SingleEnumIssueCustomField';
}
 
export interface StateBundle extends BaseBundle {
  $type: 'StateBundle';
  values: StateBundleElement[];
}
 
export interface StateBundleElement extends LocalizableBundleElement {
  isResolved: boolean;
}
 
export interface StateBundleCustomFieldDefaults extends BundleCustomFieldDefaults {
  bundle: StateBundle;
}
 
export interface StateIssueCustomField extends IssueCustomField {
  $type: 'StateIssueCustomField';
  value: StateBundleElement;
}
 
export function isStateIssueCustomField(field: any): field is StateIssueCustomField {
  return field.$type === 'StateIssueCustomField';
}
 
export interface User {
  id: string;
  avatarUrl: string;
  fullName: string;
}
 
export interface WatchFolder extends IssueFolder {
  owner: User;
}
 
export interface WorkTimeSettings {
  minutesADay: number;
  daysAWeek: number;
}
 
/**
 * Error returned by the YouTrack REST API, typically in case of an invalid request.
 */
export interface YouTrackError {
  error: string;
  error_description: string;
}