gitverse-api-sdk 5.1.0 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.d.ts CHANGED
@@ -1,155 +1,123 @@
1
- /**
2
- * Типы данных для GitVerse API
3
- * @generated Сгенерировано автоматически из OpenAPI спецификации
4
- */
5
- /**
6
- * Опции для выполнения HTTP-запросов
7
- */
8
- interface RequestOptions {
9
- /**
10
- * AbortSignal для отмены запроса
11
- * @example
12
- * const controller = new AbortController();
13
- * const promise = client.users.getCurrent({ signal: controller.signal });
14
- * controller.abort(); // Отменяет запрос
15
- */
16
- signal?: AbortSignal;
17
- }
18
- /**
19
- * Предупреждение об устаревшей версии API
20
- */
21
- declare class ApiVersionWarning {
22
- /** Текущая используемая версия */
23
- readonly currentVersion: string;
24
- /** Последняя доступная версия */
25
- readonly latestVersion: string;
26
- /** Дата вывода из эксплуатации */
27
- readonly decommissioning?: string;
28
- constructor(currentVersion: string, latestVersion: string, decommissioning?: string);
29
- /**
30
- * Возвращает сообщение о предупреждении
31
- */
32
- getMessage(): string;
33
- }
34
- declare const HTTPMethods: {
35
- readonly DELETE: "DELETE"
36
- readonly GET: "GET"
37
- readonly PATCH: "PATCH"
38
- readonly POST: "POST"
39
- readonly PUT: "PUT"
1
+ import { ApiVersionWarning } from "./errors";
2
+ import type { RequestOptions } from "./types";
3
+ export declare const HTTPMethods: {
4
+ readonly DELETE: "DELETE";
5
+ readonly GET: "GET";
6
+ readonly PATCH: "PATCH";
7
+ readonly POST: "POST";
8
+ readonly PUT: "PUT";
40
9
  };
41
- type HTTPMethods = (typeof HTTPMethods)[keyof typeof HTTPMethods];
10
+ export type HTTPMethods = (typeof HTTPMethods)[keyof typeof HTTPMethods];
42
11
  /**
43
- * Параметры для конфигурации GitVerse клиента
44
- */
45
- interface GitVerseClientConfig {
46
- /**
47
- * Базовый URL API GitVerse
48
- * @default 'https://api.gitverse.ru'
49
- */
50
- baseUrl?: string;
51
- /**
52
- * Токен доступа для авторизации в API
53
- */
54
- token?: string;
55
- /**
56
- * Версия API
57
- * @default '1'
58
- */
59
- apiVersion?: string;
12
+ * Параметры для конфигурации GitVerse клиента
13
+ */
14
+ export interface GitVerseClientConfig {
15
+ /**
16
+ * Базовый URL API GitVerse
17
+ * @default 'https://api.gitverse.ru'
18
+ */
19
+ baseUrl?: string;
20
+ /**
21
+ * Токен доступа для авторизации в API
22
+ */
23
+ token?: string;
24
+ /**
25
+ * Версия API
26
+ * @default '1'
27
+ */
28
+ apiVersion?: string;
60
29
  }
61
30
  /**
62
- * Основной класс для работы с GitVerse API
63
- */
64
- declare class GitVerseClient {
65
- private baseUrl;
66
- private token?;
67
- private apiVersion;
68
- /**
69
- * Callback для обработки предупреждений об устаревшей версии API
70
- */
71
- onApiVersionWarning?: (warning: ApiVersionWarning) => void;
72
- /**
73
- * Создает новый экземпляр GitVerse клиента
74
- * @param config Конфигурация клиента
75
- */
76
- constructor(config?: GitVerseClientConfig);
77
- /**
78
- * Устанавливает токен авторизации
79
- * @param token Токен доступа
80
- */
81
- setToken(token: string): void;
82
- /**
83
- * Извлекает информацию о Rate Limit из заголовков ответа
84
- */
85
- private extractRateLimitInfo;
86
- /**
87
- * Извлекает информацию о версии API из заголовков ответа
88
- */
89
- private extractApiVersionInfo;
90
- /**
91
- * Извлекает метаданные из заголовков ответа
92
- */
93
- private extractMetadata;
94
- /**
95
- * Выполняет API-запрос с учетом авторизации и версии API
96
- * @param path Путь к API-ресурсу
97
- * @param method HTTP-метод
98
- * @param body Тело запроса (опционально)
99
- * @param options Опции запроса (опционально)
100
- * @returns Ответ от API
101
- * @throws {RateLimitError} При превышении лимита запросов (429)
102
- * @throws {GitVerseApiError} При других ошибках API
103
- */
104
- request<T>(path: string, method: HTTPMethods, body?: unknown, options?: RequestOptions): Promise<T>;
105
- /**
106
- * Выполняет GET-запрос
107
- * @param path Путь к API-ресурсу
108
- * @param options Опции запроса (опционально)
109
- * @returns Ответ от API
110
- */
111
- get<T>(path: string, options?: RequestOptions): Promise<T>;
112
- /**
113
- * Выполняет POST-запрос
114
- * @param path Путь к API-ресурсу
115
- * @param body Тело запроса
116
- * @param options Опции запроса (опционально)
117
- * @returns Ответ от API
118
- */
119
- post<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
120
- /**
121
- * Выполняет PUT-запрос
122
- * @param path Путь к API-ресурсу
123
- * @param body Тело запроса
124
- * @param options Опции запроса (опционально)
125
- * @returns Ответ от API
126
- */
127
- put<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
128
- /**
129
- * Выполняет DELETE-запрос
130
- * @param path Путь к API-ресурсу
131
- * @param body Тело запроса (опционально)
132
- * @param options Опции запроса (опционально)
133
- * @returns Ответ от API
134
- */
135
- delete<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
136
- /**
137
- * Выполняет PATCH-запрос
138
- * @param path Путь к API-ресурсу
139
- * @param body Тело запроса
140
- * @param options Опции запроса (опционально)
141
- * @returns Ответ от API
142
- */
143
- patch<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
144
- /**
145
- * Выполняет загрузку файла через multipart/form-data
146
- * @param path Путь к API-ресурсу
147
- * @param fieldName Имя поля для файла
148
- * @param file Файл для загрузки (Blob или ArrayBuffer)
149
- * @param fileName Имя файла
150
- * @param options Опции запроса (опционально)
151
- * @returns Ответ от API
152
- */
153
- uploadFile<T>(path: string, fieldName: string, file: Blob | ArrayBuffer, fileName: string, options?: RequestOptions): Promise<T>;
31
+ * Основной класс для работы с GitVerse API
32
+ */
33
+ export declare class GitVerseClient {
34
+ private baseUrl;
35
+ private token?;
36
+ private apiVersion;
37
+ /**
38
+ * Callback для обработки предупреждений об устаревшей версии API
39
+ */
40
+ onApiVersionWarning?: (warning: ApiVersionWarning) => void;
41
+ /**
42
+ * Создает новый экземпляр GitVerse клиента
43
+ * @param config Конфигурация клиента
44
+ */
45
+ constructor(config?: GitVerseClientConfig);
46
+ /**
47
+ * Устанавливает токен авторизации
48
+ * @param token Токен доступа
49
+ */
50
+ setToken(token: string): void;
51
+ /**
52
+ * Извлекает информацию о Rate Limit из заголовков ответа
53
+ */
54
+ private extractRateLimitInfo;
55
+ /**
56
+ * Извлекает информацию о версии API из заголовков ответа
57
+ */
58
+ private extractApiVersionInfo;
59
+ /**
60
+ * Извлекает метаданные из заголовков ответа
61
+ */
62
+ private extractMetadata;
63
+ /**
64
+ * Выполняет API-запрос с учетом авторизации и версии API
65
+ * @param path Путь к API-ресурсу
66
+ * @param method HTTP-метод
67
+ * @param body Тело запроса (опционально)
68
+ * @param options Опции запроса (опционально)
69
+ * @returns Ответ от API
70
+ * @throws {RateLimitError} При превышении лимита запросов (429)
71
+ * @throws {GitVerseApiError} При других ошибках API
72
+ */
73
+ request<T>(path: string, method: HTTPMethods, body?: unknown, options?: RequestOptions): Promise<T>;
74
+ /**
75
+ * Выполняет GET-запрос
76
+ * @param path Путь к API-ресурсу
77
+ * @param options Опции запроса (опционально)
78
+ * @returns Ответ от API
79
+ */
80
+ get<T>(path: string, options?: RequestOptions): Promise<T>;
81
+ /**
82
+ * Выполняет POST-запрос
83
+ * @param path Путь к API-ресурсу
84
+ * @param body Тело запроса
85
+ * @param options Опции запроса (опционально)
86
+ * @returns Ответ от API
87
+ */
88
+ post<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
89
+ /**
90
+ * Выполняет PUT-запрос
91
+ * @param path Путь к API-ресурсу
92
+ * @param body Тело запроса
93
+ * @param options Опции запроса (опционально)
94
+ * @returns Ответ от API
95
+ */
96
+ put<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
97
+ /**
98
+ * Выполняет DELETE-запрос
99
+ * @param path Путь к API-ресурсу
100
+ * @param body Тело запроса (опционально)
101
+ * @param options Опции запроса (опционально)
102
+ * @returns Ответ от API
103
+ */
104
+ delete<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
105
+ /**
106
+ * Выполняет PATCH-запрос
107
+ * @param path Путь к API-ресурсу
108
+ * @param body Тело запроса
109
+ * @param options Опции запроса (опционально)
110
+ * @returns Ответ от API
111
+ */
112
+ patch<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
113
+ /**
114
+ * Выполняет загрузку файла через multipart/form-data
115
+ * @param path Путь к API-ресурсу
116
+ * @param fieldName Имя поля для файла
117
+ * @param file Файл для загрузки (Blob или ArrayBuffer)
118
+ * @param fileName Имя файла
119
+ * @param options Опции запроса (опционально)
120
+ * @returns Ответ от API
121
+ */
122
+ uploadFile<T>(path: string, fieldName: string, file: Blob | ArrayBuffer, fileName: string, options?: RequestOptions): Promise<T>;
154
123
  }
155
- export { HTTPMethods, GitVerseClientConfig, GitVerseClient };
package/dist/enums.d.ts CHANGED
@@ -1,49 +1,48 @@
1
1
  /**
2
- * Перечисления для GitVerse API
3
- * @generated Сгенерировано автоматически из OpenAPI спецификации
4
- */
5
- declare const ContentType: {
6
- readonly Dir: "dir"
7
- readonly File: "file"
8
- };
9
- type ContentType = (typeof ContentType)[keyof typeof ContentType];
10
- declare const IssueState: {
11
- readonly Closed: "closed"
12
- readonly Open: "open"
13
- };
14
- type IssueState = (typeof IssueState)[keyof typeof IssueState];
15
- declare const PullRequestSortCriteria: {
16
- readonly Created: "created"
17
- readonly LongRunning: "long-running"
18
- readonly Popularity: "popularity"
19
- readonly Updated: "updated"
20
- };
21
- type PullRequestSortCriteria = (typeof PullRequestSortCriteria)[keyof typeof PullRequestSortCriteria];
22
- declare const PullRequestSortDirection: {
23
- readonly Asc: "asc"
24
- readonly Desc: "desc"
25
- };
26
- type PullRequestSortDirection = (typeof PullRequestSortDirection)[keyof typeof PullRequestSortDirection];
27
- declare const PullRequestState: {
28
- readonly Closed: "closed"
29
- readonly Open: "open"
30
- };
31
- type PullRequestState = (typeof PullRequestState)[keyof typeof PullRequestState];
32
- declare const PullRequestStateFilter: {
33
- readonly All: "all"
34
- readonly Closed: "closed"
35
- readonly Open: "open"
36
- };
37
- type PullRequestStateFilter = (typeof PullRequestStateFilter)[keyof typeof PullRequestStateFilter];
38
- declare const UserType: {
39
- readonly Organization: "Organization"
40
- readonly User: "User"
41
- };
42
- type UserType = (typeof UserType)[keyof typeof UserType];
43
- declare const VisibilityType: {
44
- readonly Limited: "limited"
45
- readonly Private: "private"
46
- readonly Public: "public"
47
- };
48
- type VisibilityType = (typeof VisibilityType)[keyof typeof VisibilityType];
49
- export { VisibilityType, UserType, PullRequestStateFilter, PullRequestState, PullRequestSortDirection, PullRequestSortCriteria, IssueState, ContentType };
2
+ * Перечисления для GitVerse API
3
+ * @generated Сгенерировано автоматически из OpenAPI спецификации
4
+ */
5
+ export declare const ContentType: {
6
+ readonly Dir: "dir";
7
+ readonly File: "file";
8
+ };
9
+ export type ContentType = (typeof ContentType)[keyof typeof ContentType];
10
+ export declare const IssueState: {
11
+ readonly Closed: "closed";
12
+ readonly Open: "open";
13
+ };
14
+ export type IssueState = (typeof IssueState)[keyof typeof IssueState];
15
+ export declare const PullRequestSortCriteria: {
16
+ readonly Created: "created";
17
+ readonly LongRunning: "long-running";
18
+ readonly Popularity: "popularity";
19
+ readonly Updated: "updated";
20
+ };
21
+ export type PullRequestSortCriteria = (typeof PullRequestSortCriteria)[keyof typeof PullRequestSortCriteria];
22
+ export declare const PullRequestSortDirection: {
23
+ readonly Asc: "asc";
24
+ readonly Desc: "desc";
25
+ };
26
+ export type PullRequestSortDirection = (typeof PullRequestSortDirection)[keyof typeof PullRequestSortDirection];
27
+ export declare const PullRequestState: {
28
+ readonly Closed: "closed";
29
+ readonly Open: "open";
30
+ };
31
+ export type PullRequestState = (typeof PullRequestState)[keyof typeof PullRequestState];
32
+ export declare const PullRequestStateFilter: {
33
+ readonly All: "all";
34
+ readonly Closed: "closed";
35
+ readonly Open: "open";
36
+ };
37
+ export type PullRequestStateFilter = (typeof PullRequestStateFilter)[keyof typeof PullRequestStateFilter];
38
+ export declare const UserType: {
39
+ readonly Organization: "Organization";
40
+ readonly User: "User";
41
+ };
42
+ export type UserType = (typeof UserType)[keyof typeof UserType];
43
+ export declare const VisibilityType: {
44
+ readonly Limited: "limited";
45
+ readonly Private: "private";
46
+ readonly Public: "public";
47
+ };
48
+ export type VisibilityType = (typeof VisibilityType)[keyof typeof VisibilityType];
package/dist/errors.d.ts CHANGED
@@ -1,80 +1,46 @@
1
1
  /**
2
- * Информация о лимитах запросов
3
- */
4
- interface RateLimitInfo {
5
- /** Максимальное количество запросов */
6
- limit: number;
7
- /** Оставшееся количество запросов */
8
- remaining: number;
9
- /** Unix timestamp сброса лимита */
10
- reset: number;
11
- /** Секунд до сброса лимита */
12
- retryAfter: number;
13
- }
14
- /**
15
- * Информация о версии API
16
- */
17
- interface ApiVersionInfo {
18
- /** Текущая используемая версия */
19
- version: string;
20
- /** Последняя доступная версия */
21
- latestVersion: string;
22
- /** Версия помечена как устаревшая */
23
- deprecated: boolean;
24
- /** Дата вывода из эксплуатации */
25
- decommissioning?: string;
26
- }
27
- /**
28
- * Метаданные ответа API
29
- */
30
- interface ApiResponseMetadata {
31
- /** Уникальный идентификатор запроса */
32
- requestId?: string;
33
- /** Информация о лимитах */
34
- rateLimit?: RateLimitInfo;
35
- /** Информация о версии API */
36
- apiVersion?: ApiVersionInfo;
37
- }
2
+ * Классы ошибок для GitVerse API
3
+ */
4
+ import type { ApiResponseMetadata, RateLimitInfo } from "./types";
38
5
  /**
39
- * Базовая ошибка GitVerse API
40
- */
41
- declare class GitVerseApiError extends Error {
42
- /** HTTP статус код */
43
- readonly status: number;
44
- /** Метаданные ответа API */
45
- readonly metadata?: ApiResponseMetadata;
46
- constructor(status: number, message: string, metadata?: ApiResponseMetadata);
6
+ * Базовая ошибка GitVerse API
7
+ */
8
+ export declare class GitVerseApiError extends Error {
9
+ /** HTTP статус код */
10
+ readonly status: number;
11
+ /** Метаданные ответа API */
12
+ readonly metadata?: ApiResponseMetadata;
13
+ constructor(status: number, message: string, metadata?: ApiResponseMetadata);
47
14
  }
48
15
  /**
49
- * Ошибка превышения лимита запросов (429 Too Many Requests)
50
- */
51
- declare class RateLimitError extends GitVerseApiError {
52
- /** Информация о лимитах */
53
- readonly rateLimit: RateLimitInfo;
54
- constructor(message: string, rateLimit: RateLimitInfo, metadata?: ApiResponseMetadata);
55
- /**
56
- * Возвращает количество секунд до сброса лимита
57
- */
58
- getRetryAfterSeconds(): number;
59
- /**
60
- * Возвращает дату/время сброса лимита
61
- */
62
- getResetDate(): Date;
16
+ * Ошибка превышения лимита запросов (429 Too Many Requests)
17
+ */
18
+ export declare class RateLimitError extends GitVerseApiError {
19
+ /** Информация о лимитах */
20
+ readonly rateLimit: RateLimitInfo;
21
+ constructor(message: string, rateLimit: RateLimitInfo, metadata?: ApiResponseMetadata);
22
+ /**
23
+ * Возвращает количество секунд до сброса лимита
24
+ */
25
+ getRetryAfterSeconds(): number;
26
+ /**
27
+ * Возвращает дату/время сброса лимита
28
+ */
29
+ getResetDate(): Date;
63
30
  }
64
31
  /**
65
- * Предупреждение об устаревшей версии API
66
- */
67
- declare class ApiVersionWarning {
68
- /** Текущая используемая версия */
69
- readonly currentVersion: string;
70
- /** Последняя доступная версия */
71
- readonly latestVersion: string;
72
- /** Дата вывода из эксплуатации */
73
- readonly decommissioning?: string;
74
- constructor(currentVersion: string, latestVersion: string, decommissioning?: string);
75
- /**
76
- * Возвращает сообщение о предупреждении
77
- */
78
- getMessage(): string;
32
+ * Предупреждение об устаревшей версии API
33
+ */
34
+ export declare class ApiVersionWarning {
35
+ /** Текущая используемая версия */
36
+ readonly currentVersion: string;
37
+ /** Последняя доступная версия */
38
+ readonly latestVersion: string;
39
+ /** Дата вывода из эксплуатации */
40
+ readonly decommissioning?: string;
41
+ constructor(currentVersion: string, latestVersion: string, decommissioning?: string);
42
+ /**
43
+ * Возвращает сообщение о предупреждении
44
+ */
45
+ getMessage(): string;
79
46
  }
80
- export { RateLimitError, GitVerseApiError, ApiVersionWarning };