-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapi.raml
More file actions
644 lines (642 loc) · 19.8 KB
/
api.raml
File metadata and controls
644 lines (642 loc) · 19.8 KB
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
#%RAML 1.0
title: ProstoTV
version: 1
baseUri: https://api.prosto.tv/v1
mediaType: application/json
types: !include ./types.raml
securitySchemes:
bearer:
type: x-bearer
describedBy:
headers:
Authorization:
description: Заголовок для авторизации по токену
example: Bearer 00112233445566778899aabbccddeeff
/objects:
securedBy: bearer
post:
description: Добавление пользователя
body:
type: object
properties:
first_name?: string
middle_name?: string
last_name?: string
note?: string
phone?: string
password?: string
responses:
201:
description: Пользователь добавлен
body:
type: object
example: |
{
"id": 123456,
"password": 12345678,
"status": "active",
"balance": 0,
"bonus": 0,
"ebs_url": 'https://{ebs_url}/{object_id}/more/services',
"bundles": [],
"services": [],
"devices": [],
"playlists": []
}
/{account_id}:
securedBy: bearer
uriParameters:
account_id:
type: integer
description: Account ID
get:
description: Получение данных пользователя
responses:
200:
body:
type: object
properties:
id: integer
status: ['none', 'active', 'blocked', 'disconnected', 'deleted']
balance: number
bonus: number
contacts: array
date_create: string
bundles: array
services: array
devices: array
playlists: array
example: |
{
"id": 123456,
"status": "active",
"balance": 0,
"bonus": 0,
"ebs_url": 'https://{ebs_url}/{object_id}/more/services',
"contacts": [ "012 3456789", "098 7654321"...]
"date_create": "2015-02-08"
"bundles": [
{
"id": 40,
"main": 1,
"bundles": [],
"name_ru": "Украина",
"name_uk": "Україна",
"channels_count": 38,
"cost": 39
},
{
"id": 50,
"main": 1,
"bundles": [40],
"name_ru": "Вселенная",
"name_uk": "Всесвіт"
"channels_count": 144,
"cost": 79
}
],
"services": [
{
"id": 50,
"created": "2018-11-01 01:00:14",
"name_ru": "IPTV Вселенная",
"name_uk": "IPTV Всесвіт",
"active": 1,
"auto_renewal": 1,
"cost": 79,
"main": 1,
"channels_count": 144,
"bundles": [40],
"stop": "2019-01-01"
}
],
"devices": [
{
"id": "123456_3",
"created": "2018-11-01 02:01:04",
"updated": "2018-12-08 19:54:17",
"password": "520630",
"device": "M01PR100",
"comment": "Телевизор на кухне"
}
],
"playlists": [
{
"id": "secret",
"created": "2018-12-01 12:14:34",
"updated": "2018-12-08 19:54:17",
"genres": 1,
"comment": "Домашний ПК",
"ip": "90.100.110.120",
"url": "http://my.prosto.tv/secret.m3u"
}
]
}
delete:
description: Удаление учетки
responses:
200:
description: Учетка удалена
body:
type: object
example: |
{
"id": "123456",
"status": "deleted"
}
305:
description: Учетка удалена не полностью
body:
type: Error
404:
description: Учетка уже удалена
body:
type: Error
/devices:
description: Работа с устройствами
securedBy: bearer
get:
description: Получение списка всех устройств
responses:
200:
body:
properties:
devices:
type: array
items: Device
example: !include types/device.json
post:
description: Добавление устройства
responses:
201:
description: Устройство добавлено
body:
type: Device
example: !include types/device.json
406:
description: Достугнут лимит устройств
body:
type: Error
/{device_id}:
securedBy: bearer
uriParameters:
device_id:
type: string
description: Идентификатор (логин) устройства
example: "000000_0"
delete:
description: Удаление устройства
responses:
200:
description: Устройство удалено
400:
description: Некорректный запрос
body:
type: Error
404:
description: Устройство не найдено
body:
type: Error
put:
description: Добавление комментария к устройству
body:
properties:
comment?: string
responses:
201:
description: Комментарий добавлено
body:
type: Device
example: !include types/device.json
400:
description: Неверный id устройства
body:
type: Error
204:
description: Не задан комментарий
body:
type: Error
/playlists:
description: Управление плейлистами
securedBy: bearer
get:
description: Получение списка всех плейлистов
responses:
200:
body:
properties:
playlists:
type: array
items: Playlist
example: !include types/playlist.json
post:
description: Добавление плейлиста
responses:
201:
description: Плейлист добавлен
body:
type: Playlist
example: !include types/playlist.json
406:
description: Достугнут лимит
body:
type: Error
/{playlist_id}:
securedBy: bearer
uriParameters:
playlist_id:
type: string
description: Идентификатор (secret) плейлиста
example: "xxxxxxxx"
delete:
description: Удаление плейлиста
responses:
200:
description: Плейлист удален
400:
description: Некорректный запрос
body:
type: Error
404:
description: Плейлист не найден
body:
type: Error
put:
description: Добавление комментария, включение выключение группировки по жанрам
body:
properties:
comment?: string
genres?: 0|1
tv_guide?: 0|1
available_mode?:
description: Оставить в плейлисте только доступные каналы
type: 0|1
responses:
201:
description: Плейлист изменен
body:
type: Playlist
example: !include types/playlist.json
400:
description: Не указаны параметры
body:
type: Error
500:
description: Внутренняя ошибка
body:
type: Error
/workoncredit:
securedBy: bearer
post:
description: Активация работы в кредит
responses:
200:
description: Работа в кредит активирована
400:
description: Не удалось активировать услугу
body:
type: Error
402:
description: Активация услуги недоступна
body:
type: Error
/operations:
securedBy: bearer
post:
description: Проведение операции
body:
type: object
properties:
operation_id: integer
sum: number
example: |
{
"operation_id": 20,
"sum": 120.0
}
responses:
201:
description: Операция проведена
body:
type: Operation
example: |
{
"id": 123456,
"transaction_id": 123456,
"object_id": 123456,
"created": "2018-12-01 10:10:43",
"sum": 79.00,
"balance": 79.00
}
400:
description: Некорректный запрос
body:
type: Error
403:
description: Указанный тип операции не разрешен
body:
type: Error
404:
description: Указанный тип операции не найден
body:
type: Error
500:
description: Внутренняя ошибка
body:
type: Error
/status:
securedBy: bearer
post:
description: Отключение/включение учетной записи
body:
type: object
properties:
status: string
responses:
201:
description: Статус учетной записи изменен
body:
type: Status
example: |
{
"id": 123456,
"status": "disconnected"
}
400:
description: Некорректный запрос
body:
type: Error
203:
description: Неверный статус
body:
type: Error
304:
description: Статус уже установлен
body:
type: Error
402:
description: Недостаточно средств
body:
type: Error
500:
description: Внутренняя ошибка
body:
type: Error
/services:
securedBy: bearer
post:
description: Активация услуги
body:
type: object
properties:
id: integer
auto_renewal: integer
responses:
201:
description: Услуга активирована
body:
type: Service
example: |
{
"id": 50,
"created": "2018-11-01 01:00:14",
"name_ru": "IPTV Вселенная",
"name_uk": "IPTV Всесвіт",
"active": 1,
"auto_renewal": 1,
"cost": 79,
"main": 1,
"channels_count": 230,
"bundles": [40],
}
400:
description: Некорректный запрос
body:
type: Error
402:
description: Недостаточно средств
body:
type: Error
403:
description: Нет прав для активации указанной услуги
body:
type: Error
404:
description: Услуга не найдена
body:
type: Error
500:
description: Внутренняя ошибка
body:
type: Error
/{service_id}:
securedBy: bearer
delete:
description: Отключение услуги
body:
type: object
responses:
201:
description: Услуга активирована
body:
type: Service
example: |
{
"id": 50,
"name_ru": "IPTV Вселенная",
"name_uk": "IPTV Всесвіт",
"active": 1,
"auto_renewal": 0,
"cost": 79,
"main": 1,
"channels_count": 230,
"bundles": [40],
"stop": "2019-01-01"
}
400:
description: Некорректный запрос
body:
type: Error
403:
description: Нет прав для работы с указанной услуги
body:
type: Error
404:
description: Услуга не найдена
body:
type: Error
500:
description: Внутренняя ошибка
body:
type: Error
/contacts:
securedBy: bearer
post:
description: Добавление номера телефона
body:
type: object
properties:
phone: string
responses:
201:
description: Номер добавлен
body:
type: object
example: |
{
"id": 123456,
"contact": "012 3456789",
"status": "added"
}
400:
description: Некорректный запрос
body:
type: Error
6:
description: Duplicate entry data
body:
type: Error
/{phone}:
securedBy: bearer
delete:
description: Удаление номера телефона
responses:
200:
description: Номер удален
body:
type: object
example: |
{
"id": 123456,
"contact": "012 3456789",
"status": "deleted"
}
400:
description: Некорректный запрос
body:
type: Error
406:
description: No phone number found
body:
type: Error
/password:
securedBy: bearer
put:
description: Изменение пароля. Формат пароля минимум 8 символов
body:
properties:
password?: string
responses:
200:
description: Пароль изменен
body:
type: object
example:
{
"id": 123456,
"newPassword": "12345678"
}
400:
description: Некорректный пароль
body:
type: Error
500:
description: Внутренняя ошибка
body:
type: Error
/token:
securedBy: bearer
post:
description: Создание временного токена для авторизации устройства
responses:
200:
description: Токен создан, время жизни токена 2 минуты
body:
type: object
example:
{
"account_id": 123456,
"date_create": "2020-03-25 15:42:37",
"date_expire": "2020-03-25 15:44:37",
"token": "01234"
}
500:
description: Внутренняя ошибка
body:
type: Error
/search:
/accounts:
securedBy: bearer
get:
description: Получить список всех точек аккаунтов
responses:
200:
body:
type: object
properties:
count: integer
accounts: integer[]
500:
description: Внутренняя ошибка
body:
type: Error
post:
description: Получить список точек аккаунтов согласно заданнім условиям
body:
type: object
properties:
parameter: string status|phone|service_id|first_name|last_name|middle_name
value: string
responses:
200:
body:
type: object
properties:
count: integer
property: string
value: string
accounts: integer[]
500:
description: Внутренняя ошибка
body:
type: Error
/bundles:
securedBy: bearer
get:
description: Получение списка доступных пакетов
responses:
200:
description: Список пакетов для пользователей которые уже созданы или будут созданы по api
body:
type: array
items: Bundles
example: !include types/bundle.json
500:
description: Ошибка сервера, нужно проверить настройки учётки оператора
body:
type: Error
/tokens:
post:
description: Получение токена
body:
type: object
properties:
login: string
password: string
responses:
201:
description: Токен создан
body:
type: Token
example: |
{
"token": "00112233445566778899aabbccddeeff"
}
400:
description: Некорректный запрос, см. дополнительную информацию в ответе
body:
type: Error
404:
description: Указанная пара логин/пароль не найдена
body:
type: Error