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.
@@ -1,386 +1,137 @@
1
+ import type { GitVerseClient } from "../client";
2
+ import type { Attachment, CreateReleaseParams, Release, UpdateReleaseParams } from "../types";
1
3
  /**
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
- interface CreateReleaseParams {
19
- body?: string;
20
- draft?: boolean;
21
- name?: string;
22
- prerelease?: boolean;
23
- tag_name?: string;
24
- target_commitish?: string;
25
- }
26
- interface UpdateReleaseParams {
27
- body?: string;
28
- draft?: boolean;
29
- name?: string;
30
- prerelease?: boolean;
31
- tag_name?: string;
32
- target_commitish?: string;
33
- }
34
- interface Attachment {
35
- browser_download_url?: string;
36
- created_at?: string;
37
- download_count?: number;
38
- id?: number;
39
- name?: string;
40
- size?: number;
41
- uuid?: string;
42
- }
43
- interface User {
44
- /** Адрес аватарки */
45
- avatar_url?: string;
46
- /** О себе */
47
- bio?: string;
48
- /** Дата создания учетной записи */
49
- created_at?: string;
50
- /** Почта */
51
- email?: string;
52
- /** Счетчики */
53
- followers?: number;
54
- /** Url для получения подписчиков пользователя */
55
- followers_url?: string;
56
- following?: number;
57
- /** Url для получения подписок пользователя */
58
- following_url?: string;
59
- /** Полное имя */
60
- full_name?: string;
61
- /** Адрес страницы пользователя */
62
- html_url?: string;
63
- /** Идентификатор */
64
- id?: number;
65
- /** Верифицирован? */
66
- is_verified?: boolean;
67
- /** Местоположение */
68
- location?: string;
69
- /** Логин пользователя */
70
- login?: string;
71
- /** Имя пользователя */
72
- name?: string;
73
- /** Url для получения организаций пользователя */
74
- organizations_url?: string;
75
- /** Публичные репозитории */
76
- public_repos?: number;
77
- /** Url для получения репозиториев пользователя */
78
- repos_url?: string;
79
- /** Есть ли права админа */
80
- site_admin?: boolean;
81
- /** Url для получения репозиториев пользователя, которые были добавлены в избранное */
82
- starred_url?: string;
83
- /** Количество репозиториев в избранном */
84
- stars_count?: number;
85
- /** Url для получения подписок пользователя */
86
- subscriptions_url?: string;
87
- /** Тип пользователя */
88
- type?: string;
89
- /** Дата изменения учетной записи */
90
- updated_at?: string;
91
- /** Url для получения пользователя */
92
- url?: string;
93
- /** Вебсайт */
94
- website?: string;
95
- }
96
- interface Release {
97
- assets?: Attachment[];
98
- author?: User;
99
- body?: string;
100
- created_at?: string;
101
- draft?: boolean;
102
- html_url?: string;
103
- id?: number;
104
- name?: string;
105
- prerelease?: boolean;
106
- published_at?: string;
107
- tag_name?: string;
108
- tarball_url?: string;
109
- target_commitish?: string;
110
- upload_url?: string;
111
- url?: string;
112
- zipball_url?: string;
113
- }
114
- /**
115
- * Предупреждение об устаревшей версии API
116
- */
117
- declare class ApiVersionWarning {
118
- /** Текущая используемая версия */
119
- readonly currentVersion: string;
120
- /** Последняя доступная версия */
121
- readonly latestVersion: string;
122
- /** Дата вывода из эксплуатации */
123
- readonly decommissioning?: string;
124
- constructor(currentVersion: string, latestVersion: string, decommissioning?: string);
125
- /**
126
- * Возвращает сообщение о предупреждении
127
- */
128
- getMessage(): string;
129
- }
130
- declare const HTTPMethods: {
131
- readonly DELETE: "DELETE"
132
- readonly GET: "GET"
133
- readonly PATCH: "PATCH"
134
- readonly POST: "POST"
135
- readonly PUT: "PUT"
136
- };
137
- type HTTPMethods = (typeof HTTPMethods)[keyof typeof HTTPMethods];
138
- /**
139
- * Параметры для конфигурации GitVerse клиента
140
- */
141
- interface GitVerseClientConfig {
142
- /**
143
- * Базовый URL API GitVerse
144
- * @default 'https://api.gitverse.ru'
145
- */
146
- baseUrl?: string;
147
- /**
148
- * Токен доступа для авторизации в API
149
- */
150
- token?: string;
151
- /**
152
- * Версия API
153
- * @default '1'
154
- */
155
- apiVersion?: string;
156
- }
157
- /**
158
- * Основной класс для работы с GitVerse API
159
- */
160
- declare class GitVerseClient {
161
- private baseUrl;
162
- private token?;
163
- private apiVersion;
164
- /**
165
- * Callback для обработки предупреждений об устаревшей версии API
166
- */
167
- onApiVersionWarning?: (warning: ApiVersionWarning) => void;
168
- /**
169
- * Создает новый экземпляр GitVerse клиента
170
- * @param config Конфигурация клиента
171
- */
172
- constructor(config?: GitVerseClientConfig);
173
- /**
174
- * Устанавливает токен авторизации
175
- * @param token Токен доступа
176
- */
177
- setToken(token: string): void;
178
- /**
179
- * Извлекает информацию о Rate Limit из заголовков ответа
180
- */
181
- private extractRateLimitInfo;
182
- /**
183
- * Извлекает информацию о версии API из заголовков ответа
184
- */
185
- private extractApiVersionInfo;
186
- /**
187
- * Извлекает метаданные из заголовков ответа
188
- */
189
- private extractMetadata;
190
- /**
191
- * Выполняет API-запрос с учетом авторизации и версии API
192
- * @param path Путь к API-ресурсу
193
- * @param method HTTP-метод
194
- * @param body Тело запроса (опционально)
195
- * @param options Опции запроса (опционально)
196
- * @returns Ответ от API
197
- * @throws {RateLimitError} При превышении лимита запросов (429)
198
- * @throws {GitVerseApiError} При других ошибках API
199
- */
200
- request<T>(path: string, method: HTTPMethods, body?: unknown, options?: RequestOptions): Promise<T>;
201
- /**
202
- * Выполняет GET-запрос
203
- * @param path Путь к API-ресурсу
204
- * @param options Опции запроса (опционально)
205
- * @returns Ответ от API
206
- */
207
- get<T>(path: string, options?: RequestOptions): Promise<T>;
208
- /**
209
- * Выполняет POST-запрос
210
- * @param path Путь к API-ресурсу
211
- * @param body Тело запроса
212
- * @param options Опции запроса (опционально)
213
- * @returns Ответ от API
214
- */
215
- post<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
216
- /**
217
- * Выполняет PUT-запрос
218
- * @param path Путь к API-ресурсу
219
- * @param body Тело запроса
220
- * @param options Опции запроса (опционально)
221
- * @returns Ответ от API
222
- */
223
- put<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
224
- /**
225
- * Выполняет DELETE-запрос
226
- * @param path Путь к API-ресурсу
227
- * @param body Тело запроса (опционально)
228
- * @param options Опции запроса (опционально)
229
- * @returns Ответ от API
230
- */
231
- delete<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
232
- /**
233
- * Выполняет PATCH-запрос
234
- * @param path Путь к API-ресурсу
235
- * @param body Тело запроса
236
- * @param options Опции запроса (опционально)
237
- * @returns Ответ от API
238
- */
239
- patch<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
240
- /**
241
- * Выполняет загрузку файла через multipart/form-data
242
- * @param path Путь к API-ресурсу
243
- * @param fieldName Имя поля для файла
244
- * @param file Файл для загрузки (Blob или ArrayBuffer)
245
- * @param fileName Имя файла
246
- * @param options Опции запроса (опционально)
247
- * @returns Ответ от API
248
- */
249
- uploadFile<T>(path: string, fieldName: string, file: Blob | ArrayBuffer, fileName: string, options?: RequestOptions): Promise<T>;
250
- }
251
- /**
252
- * API для работы с релизами
253
- */
254
- declare class ReleasesApi {
255
- private client;
256
- /**
257
- * Создает новый экземпляр API
258
- * @param client GitVerse клиент
259
- */
260
- constructor(client: GitVerseClient);
261
- /**
262
- * Returns a list of releases
263
- * @param owner Owner of the repository (owner or organization name)
264
- * @param repo Name of the repository without the .git extension
265
- * @param queryParams Параметры запроса
266
- * @param options Опции запроса
267
- * @returns Release[]
268
- */
269
- list(owner: string, repo: string, queryParams?: {
270
- page?: number
271
- per_page?: number
272
- draft?: boolean
273
- pre_release?: boolean
274
- }, options?: {
275
- signal?: AbortSignal
276
- }): Promise<Release[]>;
277
- /**
278
- * Create a release
279
- * @param owner Owner of the repository (owner or organization name)
280
- * @param repo Name of the repository without the .git extension
281
- * @param params Parameters for creating the release
282
- * @param options Опции запроса
283
- * @returns Release
284
- */
285
- create(owner: string, repo: string, params: CreateReleaseParams, options?: {
286
- signal?: AbortSignal
287
- }): Promise<Release>;
288
- /**
289
- * Gets a release by its tag name
290
- * @param owner Owner of the repository (owner or organization name)
291
- * @param repo Name of the repository without the .git extension
292
- * @param tag Tag name of the release to retrieve (e.g., 'v1.0.0')
293
- * @param options Опции запроса
294
- * @returns Release
295
- */
296
- getByTag(owner: string, repo: string, tag: string, options?: {
297
- signal?: AbortSignal
298
- }): Promise<Release>;
299
- /**
300
- * Deletes a release by its tag name
301
- * @param owner Owner of the repository (owner or organization name)
302
- * @param repo Name of the repository without the .git extension
303
- * @param tag Tag name of the release to delete (e.g., 'v1.0.0')
304
- * @param options Опции запроса
305
- * @returns void
306
- */
307
- deleteByTag(owner: string, repo: string, tag: string, options?: {
308
- signal?: AbortSignal
309
- }): Promise<void>;
310
- /**
311
- * Return a release
312
- * @param owner Owner of the repository (owner or organization name)
313
- * @param repo Name of the repository without the .git extension
314
- * @param release_id Identifier of the release
315
- * @param options Опции запроса
316
- * @returns Release
317
- */
318
- get(owner: string, repo: string, release_id: string, options?: {
319
- signal?: AbortSignal
320
- }): Promise<Release>;
321
- /**
322
- * Edit a release
323
- * @param owner Owner of the repository (owner or organization name)
324
- * @param repo Name of the repository without the .git extension
325
- * @param release_id Identifier of the release
326
- * @param params Parameters for editing the release
327
- * @param options Опции запроса
328
- * @returns Release
329
- */
330
- update(owner: string, repo: string, release_id: string, params: UpdateReleaseParams, options?: {
331
- signal?: AbortSignal
332
- }): Promise<Release>;
333
- /**
334
- * Delete a release
335
- * @param owner Owner of the repository (owner or organization name)
336
- * @param repo Name of the repository without the .git extension
337
- * @param release_id Identifier of the release
338
- * @param options Опции запроса
339
- * @returns void
340
- */
341
- delete(owner: string, repo: string, release_id: string, options?: {
342
- signal?: AbortSignal
343
- }): Promise<void>;
344
- /**
345
- * Returns a list of assets (files) for a release
346
- * @param owner Owner of the repository (owner or organization name)
347
- * @param repo Name of the repository without the .git extension
348
- * @param release_id Identifier of the release
349
- * @param queryParams Параметры запроса
350
- * @param options Опции запроса
351
- * @returns Attachment[]
352
- */
353
- listAssets(owner: string, repo: string, release_id: string, queryParams?: {
354
- page?: number
355
- per_page?: number
356
- }, options?: {
357
- signal?: AbortSignal
358
- }): Promise<Attachment[]>;
359
- /**
360
- * Upload asset to release
361
- * @param owner Owner of the repository (owner or organization name)
362
- * @param repo Name of the repository without the .git extension
363
- * @param release_id Identifier of the release
364
- * @param queryParams Параметры запроса
365
- * @param options Опции запроса
366
- * @returns Attachment
367
- */
368
- uploadAsset(owner: string, repo: string, release_id: string, queryParams?: {
369
- name: string
370
- }, options?: {
371
- signal?: AbortSignal
372
- }): Promise<Attachment>;
373
- /**
374
- * Delete asset from release
375
- * @param owner Owner of the repository (owner or organization name)
376
- * @param repo Name of the repository without the .git extension
377
- * @param release_id Identifier of the release
378
- * @param asset_id Identifier of the asset
379
- * @param options Опции запроса
380
- * @returns void
381
- */
382
- deleteAsset(owner: string, repo: string, release_id: string, asset_id: string, options?: {
383
- signal?: AbortSignal
384
- }): Promise<void>;
4
+ * API для работы с релизами
5
+ */
6
+ export declare class ReleasesApi {
7
+ private client;
8
+ /**
9
+ * Создает новый экземпляр API
10
+ * @param client GitVerse клиент
11
+ */
12
+ constructor(client: GitVerseClient);
13
+ /**
14
+ * Returns a list of releases
15
+ * @param owner Owner of the repository (owner or organization name)
16
+ * @param repo Name of the repository without the .git extension
17
+ * @param queryParams Параметры запроса
18
+ * @param options Опции запроса
19
+ * @returns Release[]
20
+ */
21
+ list(owner: string, repo: string, queryParams?: {
22
+ page?: number;
23
+ per_page?: number;
24
+ draft?: boolean;
25
+ pre_release?: boolean;
26
+ }, options?: {
27
+ signal?: AbortSignal;
28
+ }): Promise<Release[]>;
29
+ /**
30
+ * Create a release
31
+ * @param owner Owner of the repository (owner or organization name)
32
+ * @param repo Name of the repository without the .git extension
33
+ * @param params Parameters for creating the release
34
+ * @param options Опции запроса
35
+ * @returns Release
36
+ */
37
+ create(owner: string, repo: string, params: CreateReleaseParams, options?: {
38
+ signal?: AbortSignal;
39
+ }): Promise<Release>;
40
+ /**
41
+ * Gets a release by its tag name
42
+ * @param owner Owner of the repository (owner or organization name)
43
+ * @param repo Name of the repository without the .git extension
44
+ * @param tag Tag name of the release to retrieve (e.g., 'v1.0.0')
45
+ * @param options Опции запроса
46
+ * @returns Release
47
+ */
48
+ getByTag(owner: string, repo: string, tag: string, options?: {
49
+ signal?: AbortSignal;
50
+ }): Promise<Release>;
51
+ /**
52
+ * Deletes a release by its tag name
53
+ * @param owner Owner of the repository (owner or organization name)
54
+ * @param repo Name of the repository without the .git extension
55
+ * @param tag Tag name of the release to delete (e.g., 'v1.0.0')
56
+ * @param options Опции запроса
57
+ * @returns void
58
+ */
59
+ deleteByTag(owner: string, repo: string, tag: string, options?: {
60
+ signal?: AbortSignal;
61
+ }): Promise<void>;
62
+ /**
63
+ * Return a release
64
+ * @param owner Owner of the repository (owner or organization name)
65
+ * @param repo Name of the repository without the .git extension
66
+ * @param release_id Identifier of the release
67
+ * @param options Опции запроса
68
+ * @returns Release
69
+ */
70
+ get(owner: string, repo: string, release_id: string, options?: {
71
+ signal?: AbortSignal;
72
+ }): Promise<Release>;
73
+ /**
74
+ * Edit a release
75
+ * @param owner Owner of the repository (owner or organization name)
76
+ * @param repo Name of the repository without the .git extension
77
+ * @param release_id Identifier of the release
78
+ * @param params Parameters for editing the release
79
+ * @param options Опции запроса
80
+ * @returns Release
81
+ */
82
+ update(owner: string, repo: string, release_id: string, params: UpdateReleaseParams, options?: {
83
+ signal?: AbortSignal;
84
+ }): Promise<Release>;
85
+ /**
86
+ * Delete a release
87
+ * @param owner Owner of the repository (owner or organization name)
88
+ * @param repo Name of the repository without the .git extension
89
+ * @param release_id Identifier of the release
90
+ * @param options Опции запроса
91
+ * @returns void
92
+ */
93
+ delete(owner: string, repo: string, release_id: string, options?: {
94
+ signal?: AbortSignal;
95
+ }): Promise<void>;
96
+ /**
97
+ * Returns a list of assets (files) for a release
98
+ * @param owner Owner of the repository (owner or organization name)
99
+ * @param repo Name of the repository without the .git extension
100
+ * @param release_id Identifier of the release
101
+ * @param queryParams Параметры запроса
102
+ * @param options Опции запроса
103
+ * @returns Attachment[]
104
+ */
105
+ listAssets(owner: string, repo: string, release_id: string, queryParams?: {
106
+ page?: number;
107
+ per_page?: number;
108
+ }, options?: {
109
+ signal?: AbortSignal;
110
+ }): Promise<Attachment[]>;
111
+ /**
112
+ * Upload asset to release
113
+ * @param owner Owner of the repository (owner or organization name)
114
+ * @param repo Name of the repository without the .git extension
115
+ * @param release_id Identifier of the release
116
+ * @param queryParams Параметры запроса
117
+ * @param options Опции запроса
118
+ * @returns Attachment
119
+ */
120
+ uploadAsset(owner: string, repo: string, release_id: string, queryParams?: {
121
+ name: string;
122
+ }, options?: {
123
+ signal?: AbortSignal;
124
+ }): Promise<Attachment>;
125
+ /**
126
+ * Delete asset from release
127
+ * @param owner Owner of the repository (owner or organization name)
128
+ * @param repo Name of the repository without the .git extension
129
+ * @param release_id Identifier of the release
130
+ * @param asset_id Identifier of the asset
131
+ * @param options Опции запроса
132
+ * @returns void
133
+ */
134
+ deleteAsset(owner: string, repo: string, release_id: string, asset_id: string, options?: {
135
+ signal?: AbortSignal;
136
+ }): Promise<void>;
385
137
  }
386
- export { ReleasesApi };