1 | <?php |
||
16 | class PhotoCreateAction |
||
17 | { |
||
18 | /** |
||
19 | * @var ResponseFactory |
||
20 | */ |
||
21 | private $responseFactory; |
||
22 | |||
23 | /** |
||
24 | * @var PhotoManager |
||
25 | */ |
||
26 | private $photoManager; |
||
27 | |||
28 | /** |
||
29 | * PhotoCreateAction constructor. |
||
30 | * |
||
31 | * @param ResponseFactory $responseFactory |
||
32 | * @param PhotoManager $photoManager |
||
33 | */ |
||
34 | public function __construct(ResponseFactory $responseFactory, PhotoManager $photoManager) |
||
39 | |||
40 | /** |
||
41 | * @apiVersion 1.0.0 |
||
42 | * @api {post} /v1/photos Create |
||
43 | * @apiName Create |
||
44 | * @apiGroup Photos |
||
45 | * @apiHeader {String} Accept application/json |
||
46 | * @apiHeader {String} Content-type multipart/form-data |
||
47 | * @apiParam {File{1KB..20MB}=JPEG} file Photo file. |
||
48 | * @apiParam {Object} location Photo location. |
||
49 | * @apiParam {Number{-90-90}} location.latitude Photo location latitude. |
||
50 | * @apiParam {Number{-180-180}} location.longitude Photo location longitude. |
||
51 | * @apiSuccessExample {json} Success-Response: |
||
52 | * HTTP/1.1 201 Created |
||
53 | * { |
||
54 | * "id": 1, |
||
55 | * "created_by_user_id" 1, |
||
56 | * "avg_color": "#000000", |
||
57 | * "created_at": "2099-12-31T23:59:59+00:00", |
||
58 | * "location": { |
||
59 | * "latitude": 49.85, |
||
60 | * "longitude": 24.0166666667 |
||
61 | * } |
||
62 | * "exif": { |
||
63 | * "manufacturer": "Manufacturer Name", |
||
64 | * "model": "Model Number", |
||
65 | * "exposure_time": "1/160", |
||
66 | * "aperture": "f/11.0", |
||
67 | * "iso": 200, |
||
68 | * "taken_at": "2099-12-31T23:59:59+00:00", |
||
69 | * "software": "Software Name" |
||
70 | * }, |
||
71 | * "thumbnails": [ |
||
72 | * "medium": { |
||
73 | * "url": "http://path/to/photo/thumbnail/medium_file" |
||
74 | * "width": 500, |
||
75 | * "height": 500 |
||
76 | * }, |
||
77 | * "large": { |
||
78 | * "url": "http://path/to/photo/thumbnail/large_file" |
||
79 | * "width": 1000, |
||
80 | * "height": 1000 |
||
81 | * } |
||
82 | * ] |
||
83 | * } |
||
84 | */ |
||
85 | |||
86 | /** |
||
87 | * Create a photo. |
||
88 | * |
||
89 | * @param Request $request |
||
90 | * @return JsonResponse |
||
91 | */ |
||
92 | public function __invoke(Request $request): JsonResponse |
||
100 | } |
||
101 |