ReviewOS

also looking at this

meemalabs/meema-client-php

Media model

#6
Merged glennmichael123 wants to merge media-model into main
7 files +1700 -76
composer.jsonmodified+3-1
Changes to composer.json
@@ -18,7 +18,9 @@
1818 }
1919 ],
2020 "require": {
21 "guzzlehttp/guzzle": "^7.2"
21 "guzzlehttp/guzzle": "^7.2",
22 "vlucas/phpdotenv": "^5.3",
23 "illuminate/support": "^8.35"
2224 },
2325 "autoload": {
2426 "psr-4": {
composer.lockmodified+1212-69
Changes to composer.lock
@@ -4,8 +4,161 @@
44 "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
55 "This file is @generated automatically"
66 ],
7 "content-hash": "8bb6064c215286e90527567ef11ef40b",
7 "content-hash": "0f531baa6d19f003df2c4c502f030e37",
88 "packages": [
9 {
10 "name": "doctrine/inflector",
11 "version": "2.0.3",
12 "source": {
13 "type": "git",
14 "url": "https://github.com/doctrine/inflector.git",
15 "reference": "9cf661f4eb38f7c881cac67c75ea9b00bf97b210"
16 },
17 "dist": {
18 "type": "zip",
19 "url": "https://api.github.com/repos/doctrine/inflector/zipball/9cf661f4eb38f7c881cac67c75ea9b00bf97b210",
20 "reference": "9cf661f4eb38f7c881cac67c75ea9b00bf97b210",
21 "shasum": ""
22 },
23 "require": {
24 "php": "^7.2 || ^8.0"
25 },
26 "require-dev": {
27 "doctrine/coding-standard": "^7.0",
28 "phpstan/phpstan": "^0.11",
29 "phpstan/phpstan-phpunit": "^0.11",
30 "phpstan/phpstan-strict-rules": "^0.11",
31 "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0"
32 },
33 "type": "library",
34 "extra": {
35 "branch-alias": {
36 "dev-master": "2.0.x-dev"
37 }
38 },
39 "autoload": {
40 "psr-4": {
41 "Doctrine\\Inflector\\": "lib/Doctrine/Inflector"
42 }
43 },
44 "notification-url": "https://packagist.org/downloads/",
45 "license": [
46 "MIT"
47 ],
48 "authors": [
49 {
50 "name": "Guilherme Blanco",
51 "email": "guilhermeblanco@gmail.com"
52 },
53 {
54 "name": "Roman Borschel",
55 "email": "roman@code-factory.org"
56 },
57 {
58 "name": "Benjamin Eberlei",
59 "email": "kontakt@beberlei.de"
60 },
61 {
62 "name": "Jonathan Wage",
63 "email": "jonwage@gmail.com"
64 },
65 {
66 "name": "Johannes Schmitt",
67 "email": "schmittjoh@gmail.com"
68 }
69 ],
70 "description": "PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.",
71 "homepage": "https://www.doctrine-project.org/projects/inflector.html",
72 "keywords": [
73 "inflection",
74 "inflector",
75 "lowercase",
76 "manipulation",
77 "php",
78 "plural",
79 "singular",
80 "strings",
81 "uppercase",
82 "words"
83 ],
84 "funding": [
85 {
86 "url": "https://www.doctrine-project.org/sponsorship.html",
87 "type": "custom"
88 },
89 {
90 "url": "https://www.patreon.com/phpdoctrine",
91 "type": "patreon"
92 },
93 {
94 "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finflector",
95 "type": "tidelift"
96 }
97 ],
98 "time": "2020-05-29T15:13:26+00:00"
99 },
100 {
101 "name": "graham-campbell/result-type",
102 "version": "v1.0.1",
103 "source": {
104 "type": "git",
105 "url": "https://github.com/GrahamCampbell/Result-Type.git",
106 "reference": "7e279d2cd5d7fbb156ce46daada972355cea27bb"
107 },
108 "dist": {
109 "type": "zip",
110 "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/7e279d2cd5d7fbb156ce46daada972355cea27bb",
111 "reference": "7e279d2cd5d7fbb156ce46daada972355cea27bb",
112 "shasum": ""
113 },
114 "require": {
115 "php": "^7.0|^8.0",
116 "phpoption/phpoption": "^1.7.3"
117 },
118 "require-dev": {
119 "phpunit/phpunit": "^6.5|^7.5|^8.5|^9.0"
120 },
121 "type": "library",
122 "extra": {
123 "branch-alias": {
124 "dev-master": "1.0-dev"
125 }
126 },
127 "autoload": {
128 "psr-4": {
129 "GrahamCampbell\\ResultType\\": "src/"
130 }
131 },
132 "notification-url": "https://packagist.org/downloads/",
133 "license": [
134 "MIT"
135 ],
136 "authors": [
137 {
138 "name": "Graham Campbell",
139 "email": "graham@alt-three.com"
140 }
141 ],
142 "description": "An Implementation Of The Result Type",
143 "keywords": [
144 "Graham Campbell",
145 "GrahamCampbell",
146 "Result Type",
147 "Result-Type",
148 "result"
149 ],
150 "funding": [
151 {
152 "url": "https://github.com/GrahamCampbell",
153 "type": "github"
154 },
155 {
156 "url": "https://tidelift.com/funding/github/packagist/graham-campbell/result-type",
157 "type": "tidelift"
158 }
159 ],
160 "time": "2020-04-13T13:17:36+00:00"
161 },
9162 {
10163 "name": "guzzlehttp/guzzle",
11164 "version": "7.2.0",
@@ -239,33 +392,40 @@
239392 "time": "2020-09-30T07:37:11+00:00"
240393 },
241394 {
242 "name": "psr/http-client",
243 "version": "1.0.1",
395 "name": "illuminate/collections",
396 "version": "v8.35.1",
244397 "source": {
245398 "type": "git",
246 "url": "https://github.com/php-fig/http-client.git",
247 "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621"
399 "url": "https://github.com/illuminate/collections.git",
400 "reference": "0a7a96520928b61df1750b4e1909588f10ae2abe"
248401 },
249402 "dist": {
250403 "type": "zip",
251 "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
252 "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
404 "url": "https://api.github.com/repos/illuminate/collections/zipball/0a7a96520928b61df1750b4e1909588f10ae2abe",
405 "reference": "0a7a96520928b61df1750b4e1909588f10ae2abe",
253406 "shasum": ""
254407 },
255408 "require": {
256 "php": "^7.0 || ^8.0",
257 "psr/http-message": "^1.0"
409 "illuminate/contracts": "^8.0",
410 "illuminate/macroable": "^8.0",
411 "php": "^7.3|^8.0"
412 },
413 "suggest": {
414 "symfony/var-dumper": "Required to use the dump method (^5.1.4)."
258415 },
259416 "type": "library",
260417 "extra": {
261418 "branch-alias": {
262 "dev-master": "1.0.x-dev"
419 "dev-master": "8.x-dev"
263420 }
264421 },
265422 "autoload": {
266423 "psr-4": {
267 "Psr\\Http\\Client\\": "src/"
268 }
424 "Illuminate\\Support\\": ""
425 },
426 "files": [
427 "helpers.php"
428 ]
269429 },
270430 "notification-url": "https://packagist.org/downloads/",
271431 "license": [
@@ -273,49 +433,42 @@
273433 ],
274434 "authors": [
275435 {
276 "name": "PHP-FIG",
277 "homepage": "http://www.php-fig.org/"
436 "name": "Taylor Otwell",
437 "email": "taylor@laravel.com"
278438 }
279439 ],
280 "description": "Common interface for HTTP clients",
281 "homepage": "https://github.com/php-fig/http-client",
282 "keywords": [
283 "http",
284 "http-client",
285 "psr",
286 "psr-18"
287 ],
288 "support": {
289 "source": "https://github.com/php-fig/http-client/tree/master"
290 },
291 "time": "2020-06-29T06:28:15+00:00"
440 "description": "The Illuminate Collections package.",
441 "homepage": "https://laravel.com",
442 "time": "2021-03-25T14:54:04+00:00"
292443 },
293444 {
294 "name": "psr/http-message",
295 "version": "1.0.1",
445 "name": "illuminate/contracts",
446 "version": "v8.35.1",
296447 "source": {
297448 "type": "git",
298 "url": "https://github.com/php-fig/http-message.git",
299 "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
449 "url": "https://github.com/illuminate/contracts.git",
450 "reference": "121cea1d8b8772bc7fee99c71ecf0f57c1d77b3b"
300451 },
301452 "dist": {
302453 "type": "zip",
303 "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
304 "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
454 "url": "https://api.github.com/repos/illuminate/contracts/zipball/121cea1d8b8772bc7fee99c71ecf0f57c1d77b3b",
455 "reference": "121cea1d8b8772bc7fee99c71ecf0f57c1d77b3b",
305456 "shasum": ""
306457 },
307458 "require": {
308 "php": ">=5.3.0"
459 "php": "^7.3|^8.0",
460 "psr/container": "^1.0",
461 "psr/simple-cache": "^1.0"
309462 },
310463 "type": "library",
311464 "extra": {
312465 "branch-alias": {
313 "dev-master": "1.0.x-dev"
466 "dev-master": "8.x-dev"
314467 }
315468 },
316469 "autoload": {
317470 "psr-4": {
318 "Psr\\Http\\Message\\": "src/"
471 "Illuminate\\Contracts\\": ""
319472 }
320473 },
321474 "notification-url": "https://packagist.org/downloads/",
@@ -324,50 +477,104 @@
324477 ],
325478 "authors": [
326479 {
327 "name": "PHP-FIG",
328 "homepage": "http://www.php-fig.org/"
480 "name": "Taylor Otwell",
481 "email": "taylor@laravel.com"
329482 }
330483 ],
331 "description": "Common interface for HTTP messages",
332 "homepage": "https://github.com/php-fig/http-message",
333 "keywords": [
334 "http",
335 "http-message",
336 "psr",
337 "psr-7",
338 "request",
339 "response"
340 ],
341 "support": {
342 "source": "https://github.com/php-fig/http-message/tree/master"
484 "description": "The Illuminate Contracts package.",
485 "homepage": "https://laravel.com",
486 "time": "2021-03-12T14:45:30+00:00"
487 },
488 {
489 "name": "illuminate/macroable",
490 "version": "v8.35.1",
491 "source": {
492 "type": "git",
493 "url": "https://github.com/illuminate/macroable.git",
494 "reference": "300aa13c086f25116b5f3cde3ca54ff5c822fb05"
343495 },
344 "time": "2016-08-06T14:39:51+00:00"
496 "dist": {
497 "type": "zip",
498 "url": "https://api.github.com/repos/illuminate/macroable/zipball/300aa13c086f25116b5f3cde3ca54ff5c822fb05",
499 "reference": "300aa13c086f25116b5f3cde3ca54ff5c822fb05",
500 "shasum": ""
501 },
502 "require": {
503 "php": "^7.3|^8.0"
504 },
505 "type": "library",
506 "extra": {
507 "branch-alias": {
508 "dev-master": "8.x-dev"
509 }
510 },
511 "autoload": {
512 "psr-4": {
513 "Illuminate\\Support\\": ""
514 }
515 },
516 "notification-url": "https://packagist.org/downloads/",
517 "license": [
518 "MIT"
519 ],
520 "authors": [
521 {
522 "name": "Taylor Otwell",
523 "email": "taylor@laravel.com"
524 }
525 ],
526 "description": "The Illuminate Macroable package.",
527 "homepage": "https://laravel.com",
528 "time": "2020-10-27T15:20:30+00:00"
345529 },
346530 {
347 "name": "ralouphie/getallheaders",
348 "version": "3.0.3",
531 "name": "illuminate/support",
532 "version": "v8.35.1",
349533 "source": {
350534 "type": "git",
351 "url": "https://github.com/ralouphie/getallheaders.git",
352 "reference": "120b605dfeb996808c31b6477290a714d356e822"
535 "url": "https://github.com/illuminate/support.git",
536 "reference": "8eee1bc181c87cfdac32b4d876ab44da9894771c"
353537 },
354538 "dist": {
355539 "type": "zip",
356 "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
357 "reference": "120b605dfeb996808c31b6477290a714d356e822",
540 "url": "https://api.github.com/repos/illuminate/support/zipball/8eee1bc181c87cfdac32b4d876ab44da9894771c",
541 "reference": "8eee1bc181c87cfdac32b4d876ab44da9894771c",
358542 "shasum": ""
359543 },
360544 "require": {
361 "php": ">=5.6"
545 "doctrine/inflector": "^1.4|^2.0",
546 "ext-json": "*",
547 "ext-mbstring": "*",
548 "illuminate/collections": "^8.0",
549 "illuminate/contracts": "^8.0",
550 "illuminate/macroable": "^8.0",
551 "nesbot/carbon": "^2.31",
552 "php": "^7.3|^8.0",
553 "voku/portable-ascii": "^1.4.8"
362554 },
363 "require-dev": {
364 "php-coveralls/php-coveralls": "^2.1",
365 "phpunit/phpunit": "^5 || ^6.5"
555 "conflict": {
556 "tightenco/collect": "<5.5.33"
557 },
558 "suggest": {
559 "illuminate/filesystem": "Required to use the composer class (^8.0).",
560 "league/commonmark": "Required to use Str::markdown() and Stringable::markdown() (^1.3).",
561 "ramsey/uuid": "Required to use Str::uuid() (^4.0).",
562 "symfony/process": "Required to use the composer class (^5.1.4).",
563 "symfony/var-dumper": "Required to use the dd function (^5.1.4).",
564 "vlucas/phpdotenv": "Required to use the Env class and env helper (^5.2)."
366565 },
367566 "type": "library",
567 "extra": {
568 "branch-alias": {
569 "dev-master": "8.x-dev"
570 }
571 },
368572 "autoload": {
573 "psr-4": {
574 "Illuminate\\Support\\": ""
575 },
369576 "files": [
370 "src/getallheaders.php"
577 "helpers.php"
371578 ]
372579 },
373580 "notification-url": "https://packagist.org/downloads/",
@@ -376,16 +583,952 @@
376583 ],
377584 "authors": [
378585 {
379 "name": "Ralph Khattar",
380 "email": "ralph.khattar@gmail.com"
586 "name": "Taylor Otwell",
587 "email": "taylor@laravel.com"
381588 }
382589 ],
383 "description": "A polyfill for getallheaders.",
384 "support": {
385 "issues": "https://github.com/ralouphie/getallheaders/issues",
386 "source": "https://github.com/ralouphie/getallheaders/tree/develop"
590 "description": "The Illuminate Support package.",
591 "homepage": "https://laravel.com",
592 "time": "2021-03-30T13:39:44+00:00"
593 },
594 {
595 "name": "nesbot/carbon",
596 "version": "2.46.0",
597 "source": {
598 "type": "git",
599 "url": "https://github.com/briannesbitt/Carbon.git",
600 "reference": "2fd2c4a77d58a4e95234c8a61c5df1f157a91bf4"
387601 },
388 "time": "2019-03-08T08:55:37+00:00"
602 "dist": {
603 "type": "zip",
604 "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/2fd2c4a77d58a4e95234c8a61c5df1f157a91bf4",
605 "reference": "2fd2c4a77d58a4e95234c8a61c5df1f157a91bf4",
606 "shasum": ""
607 },
608 "require": {
609 "ext-json": "*",
610 "php": "^7.1.8 || ^8.0",
611 "symfony/polyfill-mbstring": "^1.0",
612 "symfony/translation": "^3.4 || ^4.0 || ^5.0"
613 },
614 "require-dev": {
615 "doctrine/orm": "^2.7",
616 "friendsofphp/php-cs-fixer": "^2.14 || ^3.0",
617 "kylekatarnls/multi-tester": "^2.0",
618 "phpmd/phpmd": "^2.9",
619 "phpstan/extension-installer": "^1.0",
620 "phpstan/phpstan": "^0.12.54",
621 "phpunit/phpunit": "^7.5.20 || ^8.5.14",
622 "squizlabs/php_codesniffer": "^3.4"
623 },
624 "bin": [
625 "bin/carbon"
626 ],
627 "type": "library",
628 "extra": {
629 "branch-alias": {
630 "dev-master": "2.x-dev",
631 "dev-3.x": "3.x-dev"
632 },
633 "laravel": {
634 "providers": [
635 "Carbon\\Laravel\\ServiceProvider"
636 ]
637 },
638 "phpstan": {
639 "includes": [
640 "extension.neon"
641 ]
642 }
643 },
644 "autoload": {
645 "psr-4": {
646 "Carbon\\": "src/Carbon/"
647 }
648 },
649 "notification-url": "https://packagist.org/downloads/",
650 "license": [
651 "MIT"
652 ],
653 "authors": [
654 {
655 "name": "Brian Nesbitt",
656 "email": "brian@nesbot.com",
657 "homepage": "http://nesbot.com"
658 },
659 {
660 "name": "kylekatarnls",
661 "homepage": "http://github.com/kylekatarnls"
662 }
663 ],
664 "description": "An API extension for DateTime that supports 281 different languages.",
665 "homepage": "http://carbon.nesbot.com",
666 "keywords": [
667 "date",
668 "datetime",
669 "time"
670 ],
671 "funding": [
672 {
673 "url": "https://opencollective.com/Carbon",
674 "type": "open_collective"
675 },
676 {
677 "url": "https://tidelift.com/funding/github/packagist/nesbot/carbon",
678 "type": "tidelift"
679 }
680 ],
681 "time": "2021-02-24T17:30:44+00:00"
682 },
683 {
684 "name": "phpoption/phpoption",
685 "version": "1.7.5",
686 "source": {
687 "type": "git",
688 "url": "https://github.com/schmittjoh/php-option.git",
689 "reference": "994ecccd8f3283ecf5ac33254543eb0ac946d525"
690 },
691 "dist": {
692 "type": "zip",
693 "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/994ecccd8f3283ecf5ac33254543eb0ac946d525",
694 "reference": "994ecccd8f3283ecf5ac33254543eb0ac946d525",
695 "shasum": ""
696 },
697 "require": {
698 "php": "^5.5.9 || ^7.0 || ^8.0"
699 },
700 "require-dev": {
701 "bamarni/composer-bin-plugin": "^1.4.1",
702 "phpunit/phpunit": "^4.8.35 || ^5.7.27 || ^6.5.6 || ^7.0 || ^8.0 || ^9.0"
703 },
704 "type": "library",
705 "extra": {
706 "branch-alias": {
707 "dev-master": "1.7-dev"
708 }
709 },
710 "autoload": {
711 "psr-4": {
712 "PhpOption\\": "src/PhpOption/"
713 }
714 },
715 "notification-url": "https://packagist.org/downloads/",
716 "license": [
717 "Apache-2.0"
718 ],
719 "authors": [
720 {
721 "name": "Johannes M. Schmitt",
722 "email": "schmittjoh@gmail.com"
723 },
724 {
725 "name": "Graham Campbell",
726 "email": "graham@alt-three.com"
727 }
728 ],
729 "description": "Option Type for PHP",
730 "keywords": [
731 "language",
732 "option",
733 "php",
734 "type"
735 ],
736 "funding": [
737 {
738 "url": "https://github.com/GrahamCampbell",
739 "type": "github"
740 },
741 {
742 "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption",
743 "type": "tidelift"
744 }
745 ],
746 "time": "2020-07-20T17:29:33+00:00"
747 },
748 {
749 "name": "psr/container",
750 "version": "1.1.1",
751 "source": {
752 "type": "git",
753 "url": "https://github.com/php-fig/container.git",
754 "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf"
755 },
756 "dist": {
757 "type": "zip",
758 "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf",
759 "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf",
760 "shasum": ""
761 },
762 "require": {
763 "php": ">=7.2.0"
764 },
765 "type": "library",
766 "autoload": {
767 "psr-4": {
768 "Psr\\Container\\": "src/"
769 }
770 },
771 "notification-url": "https://packagist.org/downloads/",
772 "license": [
773 "MIT"
774 ],
775 "authors": [
776 {
777 "name": "PHP-FIG",
778 "homepage": "https://www.php-fig.org/"
779 }
780 ],
781 "description": "Common Container Interface (PHP FIG PSR-11)",
782 "homepage": "https://github.com/php-fig/container",
783 "keywords": [
784 "PSR-11",
785 "container",
786 "container-interface",
787 "container-interop",
788 "psr"
789 ],
790 "time": "2021-03-05T17:36:06+00:00"
791 },
792 {
793 "name": "psr/http-client",
794 "version": "1.0.1",
795 "source": {
796 "type": "git",
797 "url": "https://github.com/php-fig/http-client.git",
798 "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621"
799 },
800 "dist": {
801 "type": "zip",
802 "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
803 "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
804 "shasum": ""
805 },
806 "require": {
807 "php": "^7.0 || ^8.0",
808 "psr/http-message": "^1.0"
809 },
810 "type": "library",
811 "extra": {
812 "branch-alias": {
813 "dev-master": "1.0.x-dev"
814 }
815 },
816 "autoload": {
817 "psr-4": {
818 "Psr\\Http\\Client\\": "src/"
819 }
820 },
821 "notification-url": "https://packagist.org/downloads/",
822 "license": [
823 "MIT"
824 ],
825 "authors": [
826 {
827 "name": "PHP-FIG",
828 "homepage": "http://www.php-fig.org/"
829 }
830 ],
831 "description": "Common interface for HTTP clients",
832 "homepage": "https://github.com/php-fig/http-client",
833 "keywords": [
834 "http",
835 "http-client",
836 "psr",
837 "psr-18"
838 ],
839 "support": {
840 "source": "https://github.com/php-fig/http-client/tree/master"
841 },
842 "time": "2020-06-29T06:28:15+00:00"
843 },
844 {
845 "name": "psr/http-message",
846 "version": "1.0.1",
847 "source": {
848 "type": "git",
849 "url": "https://github.com/php-fig/http-message.git",
850 "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
851 },
852 "dist": {
853 "type": "zip",
854 "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
855 "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
856 "shasum": ""
857 },
858 "require": {
859 "php": ">=5.3.0"
860 },
861 "type": "library",
862 "extra": {
863 "branch-alias": {
864 "dev-master": "1.0.x-dev"
865 }
866 },
867 "autoload": {
868 "psr-4": {
869 "Psr\\Http\\Message\\": "src/"
870 }
871 },
872 "notification-url": "https://packagist.org/downloads/",
873 "license": [
874 "MIT"
875 ],
876 "authors": [
877 {
878 "name": "PHP-FIG",
879 "homepage": "http://www.php-fig.org/"
880 }
881 ],
882 "description": "Common interface for HTTP messages",
883 "homepage": "https://github.com/php-fig/http-message",
884 "keywords": [
885 "http",
886 "http-message",
887 "psr",
888 "psr-7",
889 "request",
890 "response"
891 ],
892 "support": {
893 "source": "https://github.com/php-fig/http-message/tree/master"
894 },
895 "time": "2016-08-06T14:39:51+00:00"
896 },
897 {
898 "name": "psr/simple-cache",
899 "version": "1.0.1",
900 "source": {
901 "type": "git",
902 "url": "https://github.com/php-fig/simple-cache.git",
903 "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b"
904 },
905 "dist": {
906 "type": "zip",
907 "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
908 "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
909 "shasum": ""
910 },
911 "require": {
912 "php": ">=5.3.0"
913 },
914 "type": "library",
915 "extra": {
916 "branch-alias": {
917 "dev-master": "1.0.x-dev"
918 }
919 },
920 "autoload": {
921 "psr-4": {
922 "Psr\\SimpleCache\\": "src/"
923 }
924 },
925 "notification-url": "https://packagist.org/downloads/",
926 "license": [
927 "MIT"
928 ],
929 "authors": [
930 {
931 "name": "PHP-FIG",
932 "homepage": "http://www.php-fig.org/"
933 }
934 ],
935 "description": "Common interfaces for simple caching",
936 "keywords": [
937 "cache",
938 "caching",
939 "psr",
940 "psr-16",
941 "simple-cache"
942 ],
943 "time": "2017-10-23T01:57:42+00:00"
944 },
945 {
946 "name": "ralouphie/getallheaders",
947 "version": "3.0.3",
948 "source": {
949 "type": "git",
950 "url": "https://github.com/ralouphie/getallheaders.git",
951 "reference": "120b605dfeb996808c31b6477290a714d356e822"
952 },
953 "dist": {
954 "type": "zip",
955 "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
956 "reference": "120b605dfeb996808c31b6477290a714d356e822",
957 "shasum": ""
958 },
959 "require": {
960 "php": ">=5.6"
961 },
962 "require-dev": {
963 "php-coveralls/php-coveralls": "^2.1",
964 "phpunit/phpunit": "^5 || ^6.5"
965 },
966 "type": "library",
967 "autoload": {
968 "files": [
969 "src/getallheaders.php"
970 ]
971 },
972 "notification-url": "https://packagist.org/downloads/",
973 "license": [
974 "MIT"
975 ],
976 "authors": [
977 {
978 "name": "Ralph Khattar",
979 "email": "ralph.khattar@gmail.com"
980 }
981 ],
982 "description": "A polyfill for getallheaders.",
983 "support": {
984 "issues": "https://github.com/ralouphie/getallheaders/issues",
985 "source": "https://github.com/ralouphie/getallheaders/tree/develop"
986 },
987 "time": "2019-03-08T08:55:37+00:00"
988 },
989 {
990 "name": "symfony/polyfill-ctype",
991 "version": "v1.22.1",
992 "source": {
993 "type": "git",
994 "url": "https://github.com/symfony/polyfill-ctype.git",
995 "reference": "c6c942b1ac76c82448322025e084cadc56048b4e"
996 },
997 "dist": {
998 "type": "zip",
999 "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e",
1000 "reference": "c6c942b1ac76c82448322025e084cadc56048b4e",
1001 "shasum": ""
1002 },
1003 "require": {
1004 "php": ">=7.1"
1005 },
1006 "suggest": {
1007 "ext-ctype": "For best performance"
1008 },
1009 "type": "library",
1010 "extra": {
1011 "branch-alias": {
1012 "dev-main": "1.22-dev"
1013 },
1014 "thanks": {
1015 "name": "symfony/polyfill",
1016 "url": "https://github.com/symfony/polyfill"
1017 }
1018 },
1019 "autoload": {
1020 "psr-4": {
1021 "Symfony\\Polyfill\\Ctype\\": ""
1022 },
1023 "files": [
1024 "bootstrap.php"
1025 ]
1026 },
1027 "notification-url": "https://packagist.org/downloads/",
1028 "license": [
1029 "MIT"
1030 ],
1031 "authors": [
1032 {
1033 "name": "Gert de Pagter",
1034 "email": "BackEndTea@gmail.com"
1035 },
1036 {
1037 "name": "Symfony Community",
1038 "homepage": "https://symfony.com/contributors"
1039 }
1040 ],
1041 "description": "Symfony polyfill for ctype functions",
1042 "homepage": "https://symfony.com",
1043 "keywords": [
1044 "compatibility",
1045 "ctype",
1046 "polyfill",
1047 "portable"
1048 ],
1049 "funding": [
1050 {
1051 "url": "https://symfony.com/sponsor",
1052 "type": "custom"
1053 },
1054 {
1055 "url": "https://github.com/fabpot",
1056 "type": "github"
1057 },
1058 {
1059 "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
1060 "type": "tidelift"
1061 }
1062 ],
1063 "time": "2021-01-07T16:49:33+00:00"
1064 },
1065 {
1066 "name": "symfony/polyfill-mbstring",
1067 "version": "v1.22.1",
1068 "source": {
1069 "type": "git",
1070 "url": "https://github.com/symfony/polyfill-mbstring.git",
1071 "reference": "5232de97ee3b75b0360528dae24e73db49566ab1"
1072 },
1073 "dist": {
1074 "type": "zip",
1075 "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/5232de97ee3b75b0360528dae24e73db49566ab1",
1076 "reference": "5232de97ee3b75b0360528dae24e73db49566ab1",
1077 "shasum": ""
1078 },
1079 "require": {
1080 "php": ">=7.1"
1081 },
1082 "suggest": {
1083 "ext-mbstring": "For best performance"
1084 },
1085 "type": "library",
1086 "extra": {
1087 "branch-alias": {
1088 "dev-main": "1.22-dev"
1089 },
1090 "thanks": {
1091 "name": "symfony/polyfill",
1092 "url": "https://github.com/symfony/polyfill"
1093 }
1094 },
1095 "autoload": {
1096 "psr-4": {
1097 "Symfony\\Polyfill\\Mbstring\\": ""
1098 },
1099 "files": [
1100 "bootstrap.php"
1101 ]
1102 },
1103 "notification-url": "https://packagist.org/downloads/",
1104 "license": [
1105 "MIT"
1106 ],
1107 "authors": [
1108 {
1109 "name": "Nicolas Grekas",
1110 "email": "p@tchwork.com"
1111 },
1112 {
1113 "name": "Symfony Community",
1114 "homepage": "https://symfony.com/contributors"
1115 }
1116 ],
1117 "description": "Symfony polyfill for the Mbstring extension",
1118 "homepage": "https://symfony.com",
1119 "keywords": [
1120 "compatibility",
1121 "mbstring",
1122 "polyfill",
1123 "portable",
1124 "shim"
1125 ],
1126 "funding": [
1127 {
1128 "url": "https://symfony.com/sponsor",
1129 "type": "custom"
1130 },
1131 {
1132 "url": "https://github.com/fabpot",
1133 "type": "github"
1134 },
1135 {
1136 "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
1137 "type": "tidelift"
1138 }
1139 ],
1140 "time": "2021-01-22T09:19:47+00:00"
1141 },
1142 {
1143 "name": "symfony/polyfill-php80",
1144 "version": "v1.22.1",
1145 "source": {
1146 "type": "git",
1147 "url": "https://github.com/symfony/polyfill-php80.git",
1148 "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91"
1149 },
1150 "dist": {
1151 "type": "zip",
1152 "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dc3063ba22c2a1fd2f45ed856374d79114998f91",
1153 "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91",
1154 "shasum": ""
1155 },
1156 "require": {
1157 "php": ">=7.1"
1158 },
1159 "type": "library",
1160 "extra": {
1161 "branch-alias": {
1162 "dev-main": "1.22-dev"
1163 },
1164 "thanks": {
1165 "name": "symfony/polyfill",
1166 "url": "https://github.com/symfony/polyfill"
1167 }
1168 },
1169 "autoload": {
1170 "psr-4": {
1171 "Symfony\\Polyfill\\Php80\\": ""
1172 },
1173 "files": [
1174 "bootstrap.php"
1175 ],
1176 "classmap": [
1177 "Resources/stubs"
1178 ]
1179 },
1180 "notification-url": "https://packagist.org/downloads/",
1181 "license": [
1182 "MIT"
1183 ],
1184 "authors": [
1185 {
1186 "name": "Ion Bazan",
1187 "email": "ion.bazan@gmail.com"
1188 },
1189 {
1190 "name": "Nicolas Grekas",
1191 "email": "p@tchwork.com"
1192 },
1193 {
1194 "name": "Symfony Community",
1195 "homepage": "https://symfony.com/contributors"
1196 }
1197 ],
1198 "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
1199 "homepage": "https://symfony.com",
1200 "keywords": [
1201 "compatibility",
1202 "polyfill",
1203 "portable",
1204 "shim"
1205 ],
1206 "funding": [
1207 {
1208 "url": "https://symfony.com/sponsor",
1209 "type": "custom"
1210 },
1211 {
1212 "url": "https://github.com/fabpot",
1213 "type": "github"
1214 },
1215 {
1216 "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
1217 "type": "tidelift"
1218 }
1219 ],
1220 "time": "2021-01-07T16:49:33+00:00"
1221 },
1222 {
1223 "name": "symfony/translation",
1224 "version": "v5.2.6",
1225 "source": {
1226 "type": "git",
1227 "url": "https://github.com/symfony/translation.git",
1228 "reference": "2cc7f45d96db9adfcf89adf4401d9dfed509f4e1"
1229 },
1230 "dist": {
1231 "type": "zip",
1232 "url": "https://api.github.com/repos/symfony/translation/zipball/2cc7f45d96db9adfcf89adf4401d9dfed509f4e1",
1233 "reference": "2cc7f45d96db9adfcf89adf4401d9dfed509f4e1",
1234 "shasum": ""
1235 },
1236 "require": {
1237 "php": ">=7.2.5",
1238 "symfony/polyfill-mbstring": "~1.0",
1239 "symfony/polyfill-php80": "^1.15",
1240 "symfony/translation-contracts": "^2.3"
1241 },
1242 "conflict": {
1243 "symfony/config": "<4.4",
1244 "symfony/dependency-injection": "<5.0",
1245 "symfony/http-kernel": "<5.0",
1246 "symfony/twig-bundle": "<5.0",
1247 "symfony/yaml": "<4.4"
1248 },
1249 "provide": {
1250 "symfony/translation-implementation": "2.3"
1251 },
1252 "require-dev": {
1253 "psr/log": "~1.0",
1254 "symfony/config": "^4.4|^5.0",
1255 "symfony/console": "^4.4|^5.0",
1256 "symfony/dependency-injection": "^5.0",
1257 "symfony/finder": "^4.4|^5.0",
1258 "symfony/http-kernel": "^5.0",
1259 "symfony/intl": "^4.4|^5.0",
1260 "symfony/service-contracts": "^1.1.2|^2",
1261 "symfony/yaml": "^4.4|^5.0"
1262 },
1263 "suggest": {
1264 "psr/log-implementation": "To use logging capability in translator",
1265 "symfony/config": "",
1266 "symfony/yaml": ""
1267 },
1268 "type": "library",
1269 "autoload": {
1270 "files": [
1271 "Resources/functions.php"
1272 ],
1273 "psr-4": {
1274 "Symfony\\Component\\Translation\\": ""
1275 },
1276 "exclude-from-classmap": [
1277 "/Tests/"
1278 ]
1279 },
1280 "notification-url": "https://packagist.org/downloads/",
1281 "license": [
1282 "MIT"
1283 ],
1284 "authors": [
1285 {
1286 "name": "Fabien Potencier",
1287 "email": "fabien@symfony.com"
1288 },
1289 {
1290 "name": "Symfony Community",
1291 "homepage": "https://symfony.com/contributors"
1292 }
1293 ],
1294 "description": "Provides tools to internationalize your application",
1295 "homepage": "https://symfony.com",
1296 "funding": [
1297 {
1298 "url": "https://symfony.com/sponsor",
1299 "type": "custom"
1300 },
1301 {
1302 "url": "https://github.com/fabpot",
1303 "type": "github"
1304 },
1305 {
1306 "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
1307 "type": "tidelift"
1308 }
1309 ],
1310 "time": "2021-03-23T19:33:48+00:00"
1311 },
1312 {
1313 "name": "symfony/translation-contracts",
1314 "version": "v2.3.0",
1315 "source": {
1316 "type": "git",
1317 "url": "https://github.com/symfony/translation-contracts.git",
1318 "reference": "e2eaa60b558f26a4b0354e1bbb25636efaaad105"
1319 },
1320 "dist": {
1321 "type": "zip",
1322 "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/e2eaa60b558f26a4b0354e1bbb25636efaaad105",
1323 "reference": "e2eaa60b558f26a4b0354e1bbb25636efaaad105",
1324 "shasum": ""
1325 },
1326 "require": {
1327 "php": ">=7.2.5"
1328 },
1329 "suggest": {
1330 "symfony/translation-implementation": ""
1331 },
1332 "type": "library",
1333 "extra": {
1334 "branch-alias": {
1335 "dev-master": "2.3-dev"
1336 },
1337 "thanks": {
1338 "name": "symfony/contracts",
1339 "url": "https://github.com/symfony/contracts"
1340 }
1341 },
1342 "autoload": {
1343 "psr-4": {
1344 "Symfony\\Contracts\\Translation\\": ""
1345 }
1346 },
1347 "notification-url": "https://packagist.org/downloads/",
1348 "license": [
1349 "MIT"
1350 ],
1351 "authors": [
1352 {
1353 "name": "Nicolas Grekas",
1354 "email": "p@tchwork.com"
1355 },
1356 {
1357 "name": "Symfony Community",
1358 "homepage": "https://symfony.com/contributors"
1359 }
1360 ],
1361 "description": "Generic abstractions related to translation",
1362 "homepage": "https://symfony.com",
1363 "keywords": [
1364 "abstractions",
1365 "contracts",
1366 "decoupling",
1367 "interfaces",
1368 "interoperability",
1369 "standards"
1370 ],
1371 "funding": [
1372 {
1373 "url": "https://symfony.com/sponsor",
1374 "type": "custom"
1375 },
1376 {
1377 "url": "https://github.com/fabpot",
1378 "type": "github"
1379 },
1380 {
1381 "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
1382 "type": "tidelift"
1383 }
1384 ],
1385 "time": "2020-09-28T13:05:58+00:00"
1386 },
1387 {
1388 "name": "vlucas/phpdotenv",
1389 "version": "v5.3.0",
1390 "source": {
1391 "type": "git",
1392 "url": "https://github.com/vlucas/phpdotenv.git",
1393 "reference": "b3eac5c7ac896e52deab4a99068e3f4ab12d9e56"
1394 },
1395 "dist": {
1396 "type": "zip",
1397 "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/b3eac5c7ac896e52deab4a99068e3f4ab12d9e56",
1398 "reference": "b3eac5c7ac896e52deab4a99068e3f4ab12d9e56",
1399 "shasum": ""
1400 },
1401 "require": {
1402 "ext-pcre": "*",
1403 "graham-campbell/result-type": "^1.0.1",
1404 "php": "^7.1.3 || ^8.0",
1405 "phpoption/phpoption": "^1.7.4",
1406 "symfony/polyfill-ctype": "^1.17",
1407 "symfony/polyfill-mbstring": "^1.17",
1408 "symfony/polyfill-php80": "^1.17"
1409 },
1410 "require-dev": {
1411 "bamarni/composer-bin-plugin": "^1.4.1",
1412 "ext-filter": "*",
1413 "phpunit/phpunit": "^7.5.20 || ^8.5.14 || ^9.5.1"
1414 },
1415 "suggest": {
1416 "ext-filter": "Required to use the boolean validator."
1417 },
1418 "type": "library",
1419 "extra": {
1420 "branch-alias": {
1421 "dev-master": "5.3-dev"
1422 }
1423 },
1424 "autoload": {
1425 "psr-4": {
1426 "Dotenv\\": "src/"
1427 }
1428 },
1429 "notification-url": "https://packagist.org/downloads/",
1430 "license": [
1431 "BSD-3-Clause"
1432 ],
1433 "authors": [
1434 {
1435 "name": "Graham Campbell",
1436 "email": "graham@alt-three.com",
1437 "homepage": "https://gjcampbell.co.uk/"
1438 },
1439 {
1440 "name": "Vance Lucas",
1441 "email": "vance@vancelucas.com",
1442 "homepage": "https://vancelucas.com/"
1443 }
1444 ],
1445 "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.",
1446 "keywords": [
1447 "dotenv",
1448 "env",
1449 "environment"
1450 ],
1451 "funding": [
1452 {
1453 "url": "https://github.com/GrahamCampbell",
1454 "type": "github"
1455 },
1456 {
1457 "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv",
1458 "type": "tidelift"
1459 }
1460 ],
1461 "time": "2021-01-20T15:23:13+00:00"
1462 },
1463 {
1464 "name": "voku/portable-ascii",
1465 "version": "1.5.6",
1466 "source": {
1467 "type": "git",
1468 "url": "https://github.com/voku/portable-ascii.git",
1469 "reference": "80953678b19901e5165c56752d087fc11526017c"
1470 },
1471 "dist": {
1472 "type": "zip",
1473 "url": "https://api.github.com/repos/voku/portable-ascii/zipball/80953678b19901e5165c56752d087fc11526017c",
1474 "reference": "80953678b19901e5165c56752d087fc11526017c",
1475 "shasum": ""
1476 },
1477 "require": {
1478 "php": ">=7.0.0"
1479 },
1480 "require-dev": {
1481 "phpunit/phpunit": "~6.0 || ~7.0 || ~9.0"
1482 },
1483 "suggest": {
1484 "ext-intl": "Use Intl for transliterator_transliterate() support"
1485 },
1486 "type": "library",
1487 "autoload": {
1488 "psr-4": {
1489 "voku\\": "src/voku/"
1490 }
1491 },
1492 "notification-url": "https://packagist.org/downloads/",
1493 "license": [
1494 "MIT"
1495 ],
1496 "authors": [
1497 {
1498 "name": "Lars Moelleken",
1499 "homepage": "http://www.moelleken.org/"
1500 }
1501 ],
1502 "description": "Portable ASCII library - performance optimized (ascii) string functions for php.",
1503 "homepage": "https://github.com/voku/portable-ascii",
1504 "keywords": [
1505 "ascii",
1506 "clean",
1507 "php"
1508 ],
1509 "funding": [
1510 {
1511 "url": "https://www.paypal.me/moelleken",
1512 "type": "custom"
1513 },
1514 {
1515 "url": "https://github.com/voku",
1516 "type": "github"
1517 },
1518 {
1519 "url": "https://opencollective.com/portable-ascii",
1520 "type": "open_collective"
1521 },
1522 {
1523 "url": "https://www.patreon.com/voku",
1524 "type": "patreon"
1525 },
1526 {
1527 "url": "https://tidelift.com/funding/github/packagist/voku/portable-ascii",
1528 "type": "tidelift"
1529 }
1530 ],
1531 "time": "2020-11-12T00:07:28+00:00"
3891532 }
3901533 ],
3911534 "packages-dev": [],
@@ -396,5 +1539,5 @@
3961539 "prefer-lowest": false,
3971540 "platform": [],
3981541 "platform-dev": [],
399 "plugin-api-version": "2.0.0"
1542 "plugin-api-version": "1.1.0"
4001543}
src/Client.phpmodified+11-0
Changes to src/Client.php
@@ -5,6 +5,7 @@ namespace Meema\MeemaApi;
55use Dotenv\Dotenv;
66use GuzzleHttp\Client as GuzzleClient;
77use Meema\MeemaApi\Models\Folder;
8use Meema\MeemaApi\Models\Media;
89
910class Client
1011{
@@ -94,4 +95,14 @@ class Client
9495 {
9596 return new Folder($this);
9697 }
98
99 /**
100 * Initialize the media model.
101 *
102 * @return Meema\MeemaApi\Models\Media
103 */
104 public function media(): Media
105 {
106 return new Media($this);
107 }
97108}
src/Models/Folder.phpmodified+106-6
Changes to src/Models/Folder.php
@@ -3,18 +3,24 @@
33namespace Meema\MeemaApi\Models;
44
55use Meema\MeemaApi\Client;
6use Meema\MeemaApi\Response\Response;
67
78class Folder
89{
910 /**
10 * @var Meema\MeemaApi\Client
11 * @var \Meema\MeemaApi\Client
1112 */
12 public $client;
13 protected $client;
1314
1415 /**
1516 * @var int
1617 */
17 public $id;
18 protected $id;
19
20 /**
21 * @var object
22 */
23 protected $model;
1824
1925 /**
2026 * Construct Folder model.
@@ -39,6 +45,8 @@ class Folder
3945 /**
4046 * Get specific folders.
4147 *
48 * @param int $id
49 *
4250 * @return array
4351 */
4452 public function get($id = null)
@@ -49,7 +57,23 @@ class Folder
4957
5058 $ids = is_array($id) ? $id : func_get_args();
5159
52 return $this->client->request('GET', 'folders/show', ['folder_ids' => $ids]);
60 return $this->client->request('GET', 'folders', ['folder_ids' => $ids]);
61 }
62
63 /**
64 * Get specific folders.
65 *
66 * @param int $id
67 *
68 * @return Response
69 */
70 public function find($id): Response
71 {
72 $response = $this->client->request('GET', "folders/${id}");
73
74 $this->id = $response['data']['id'];
75
76 return new Response($this, $response);
5377 }
5478
5579 /**
@@ -63,14 +87,20 @@ class Folder
6387 {
6488 $name = is_array($name) ? $name : compact('name');
6589
90 if ($this->model) {
91 $folderName = ['folder_name' => $name['name']];
92
93 return $this->addFolderToMedia($this->model->getId(), $folderName);
94 }
95
6696 return $this->client->request('POST', "folders/{$this->client->getAccessKey()}", $name);
6797 }
6898
6999 /**
70100 * Update folder.
71101 *
72 * @param int $id
73102 * @param string $name
103 * @param int $id
74104 *
75105 * @return array
76106 */
@@ -84,18 +114,24 @@ class Folder
84114 /**
85115 * Delete a folder.
86116 *
87 * @param int|array $id
117 * @param int $id
88118 *
89119 * @return null
90120 */
91121 public function delete($id)
92122 {
123 if ($this->model) {
124 return $this->deleteFolderFromMedia($this->model->getId(), $id);
125 }
126
93127 return $this->client->request('DELETE', "folders/{$id}");
94128 }
95129
96130 /**
97131 * Archive a folder.
98132 *
133 * @param int $id
134 *
99135 * @return array
100136 */
101137 public function archive($id): array
@@ -106,6 +142,8 @@ class Folder
106142 /**
107143 * Unarchive a folder.
108144 *
145 * @param int $id
146 *
109147 * @return array
110148 */
111149 public function unarchive($id): array
@@ -116,10 +154,72 @@ class Folder
116154 /**
117155 * Duplicate a folder.
118156 *
157 * @param int $id
158 *
119159 * @return array
120160 */
121161 public function duplicate($id): array
122162 {
123163 return $this->client->request('POST', "folders/{$id}/duplicate");
124164 }
165
166 /**
167 * Add folder to media.
168 *
169 * @param int $id
170 *
171 * @return array
172 */
173 public function addFolderToMedia($id, $name): array
174 {
175 return $this->client->request('POST', "media/{$id}/folders", $name);
176 }
177
178 /**
179 * Add folder to media.
180 *
181 * @param int $id
182 *
183 * @return null
184 */
185 public function deleteFolderFromMedia($mediaId, $folderId)
186 {
187 return $this->client->request('DELETE', "media/{$mediaId}/folders/{$folderId}");
188 }
189
190 /**
191 * Initialize media model.
192 *
193 * @param Meema\MeemaApi\Models\Media $media
194 *
195 * @return self
196 */
src/Models/Folder.php:196
  1. harlekoySun Oct 25 2026 00:09:39 GMT+0000 (Coordinated Universal Time)

    @glennmichael123 can we have something like this instead.

    return (new Media($this->client))->setFolder($this->id);
197 public function setMedia($media): self
198 {
199 $this->model = $media;
200
201 return $this;
202 }
203
204 /**
205 * Get the protected id.
206 *
207 * @return int
208 */
209 public function getId(): int
210 {
211 return $this->id;
212 }
213
214 /**
215 * Initialize the media model.
216 *
217 * @return Meema\MeemaApi\Models\Media
218 */
219 public function media($id = null): Media
220 {
221 $this->id = $id;
222
223 return (new Media($this->client))->setFolder($this);
224 }
125225}
src/Models/Media.phpadded+227-0
Changes to src/Models/Media.php
@@ -0,0 +1,227 @@
1<?php
2
3namespace Meema\MeemaApi\Models;
4
5use Meema\MeemaApi\Client;
6use Meema\MeemaApi\Response\Response;
7
8class Media
9{
10 /**
11 * @var \Meema\MeemaApi\Client
12 */
13 protected $client;
14
15 /**
16 * @var int
17 */
18 protected $id;
19
20 /**
21 * @var object
22 */
23 protected $model;
24
25 /**
26 * Construct media model.
27 *
28 * @param Meema\MeemaApi\Client $client
29 */
30 public function __construct(Client $client)
31 {
32 $this->client = $client;
33 }
34
35 /**
36 * List all media.
37 *
38 * @return array
39 */
40 public function all(): array
41 {
42 return $this->client->request('GET', 'media');
43 }
44
45 /**
46 * Get specific media.
47 *
48 * @return array
49 */
50 public function get($id = null)
51 {
52 if ($this->model) {
53 return $this->fetchMediaForFolder($this->model->getId());
54 }
55
56 if (! $id) {
57 return $this->all();
58 }
59
60 $ids = is_array($id) ? $id : func_get_args();
61
62 return $this->client->request('GET', 'media/show', ['media_ids' => $ids]);
63 }
64
65 /**
66 * Get specific folders.
67 *
68 * @param int $id
69 *
70 * @return array
71 */
72 public function find($id)
73 {
74 $response = $this->client->request('GET', "folders/${id}");
75
76 return new Response($this, $response);
77 }
78
79 /**
80 * Create media.
81 *
82 * @param string $name
83 *
84 * @return array
85 */
86 public function create($name): array
87 {
88 $name = is_array($name) ? $name : compact('name');
89
90 return $this->client->request('POST', "media/{$this->client->getAccessKey()}", $name);
91 }
92
93 /**
94 * Update media.
95 *
96 * @param int $id
97 * @param string $name
98 *
99 * @return array
100 */
101 public function update($id, $name): array
102 {
103 $name = is_array($name) ? $name : compact('name');
104
105 return $this->client->request('PATCH', "media/{$id}/file-name", $name);
106 }
107
108 /**
109 * Delete a media.
110 *
111 * @param int $id
112 *
113 * @return null
114 */
115 public function delete($id = null)
116 {
117 return $this->client->request('DELETE', "media/{$id}", ['media_id' => $id]);
118 }
119
120 /**
121 * Archive a media.
122 *
123 * @param int $id
124 *
125 * @return array
126 */
127 public function archive($id = null): array
128 {
129 return $this->client->request('POST', "media/{$id}/archive");
130 }
131
132 /**
133 * Unarchive a media.
134 *
135 * @param int $id
136 *
137 * @return array
138 */
139 public function unarchive($id): array
140 {
141 return $this->client->request('POST', "media/{$id}/unarchive");
142 }
143
144 /**
145 * Make a media private.
146 *
147 * @param int $id
148 *
149 * @return array
150 */
151 public function makePrivate($id): array
152 {
153 return $this->client->request('PATCH', "media/{$id}/make-private");
154 }
155
156 /**
157 * Make a media public.
158 *
159 * @param int $id
160 *
161 * @return array
162 */
163 public function makePublic($id): array
164 {
165 return $this->client->request('PATCH', "media/{$id}/make-public");
166 }
167
168 /**
169 * Duplicate a media.
170 *
171 * @param int $id
172 *
173 * @return array
174 */
175 public function duplicate($id): array
176 {
177 return $this->client->request('POST', "media/{$id}/duplicate");
178 }
179
180 /**
181 * Initialize the folder model.
182 *
183 * @return Meema\MeemaApi\Models\Folder
184 */
185 public function folders($id = null)
186 {
187 $this->id = $id;
188
189 return (new Folder($this->client))->setMedia($this);
190 }
191
192 /**
193 * Fetch the media for the folder.
194 *
195 * @param int $id
196 *
197 * @return array
198 */
199 public function fetchMediaForFolder($id): array
200 {
201 return $this->client->request('GET', "folders/{$id}/media");
202 }
203
204 /**
205 * Initialize media model.
206 *
207 * @param Meema\MeemaApi\Models\Folder $folder
208 *
209 * @return self
210 */
211 public function setFolder($folder): self
212 {
213 $this->model = $folder;
214
215 return $this;
216 }
src/Models/Media.php:216
  1. harlekoySun Oct 25 2026 00:09:39 GMT+0000 (Coordinated Universal Time)

    Also this @glennmichael123

    return (new Folder($this->client))->setMedia($this->id);
217
218 /**
219 * Get the protected id.
220 *
221 * @return int
222 */
223 public function getId()
224 {
225 return $this->id;
226 }
227}
src/Response/Response.phpadded+87-0
Changes to src/Response/Response.php
@@ -0,0 +1,87 @@
1<?php
2
3namespace Meema\MeemaApi\Response;
4
5use Illuminate\Support\Arr;
6use Meema\MeemaApi\Traits\ForwardsCalls;
7
8class Response
9{
10 use ForwardsCalls;
11
12 /**
13 * @var \Meema\MeemaApi\Client
14 */
15 protected $api;
16
17 /**
18 * @var array
19 */
20 protected $content;
21
22 public function __construct($api, $content)
23 {
24 $this->api = $api;
25 $this->content = $content;
26 }
27
28 /**
29 * Dynamically handle calls into the query instance.
30 *
31 * @param string $method
32 * @param array $parameters
33 *
34 * @return mixed
35 */
36 public function __call($method, $parameters)
37 {
38 return $this->forwardCallTo($this->api, $method, array_merge(
39 Arr::wrap($this->getKey()), $parameters
40 ));
41 }
42
43 /**
44 * Get the primary key for the model.
45 *
46 * @return string
47 */
48 public function getKeyName()
49 {
50 return 'id';
51 }
52
53 /**
54 * Get the value of the response primary key.
55 *
56 * @return mixed
57 */
58 public function getKey()
59 {
60 return $this->getData($this->getKeyName());
61 }
62
63 /**
64 * Get data.
65 *
66 * @return array
67 */
68 public function getData($key)
69 {
70 return $this->getContent('data'.($key ? '.'.$key : ''));
71 }
72
73 /**
74 * Get response content.
75 *
76 * @param mixed $key
77 * @return array
78 */
79 public function getContent($key = null)
80 {
81 if ($key) {
82 return Arr::get($this->content, $key);
83 }
84
85 return $this->content;
86 }
87}
src/Traits/ForwardsCalls.phpadded+54-0
Changes to src/Traits/ForwardsCalls.php
@@ -0,0 +1,54 @@
1<?php
2
3namespace Meema\MeemaApi\Traits;
4
5use BadMethodCallException;
6use Error;
7
8trait ForwardsCalls
9{
10 /**
11 * Forward a method call to the given object.
12 *
13 * @param mixed $object
14 * @param string $method
15 * @param array $parameters
16 * @return mixed
17 *
18 * @throws \BadMethodCallException
19 */
20 protected function forwardCallTo($object, $method, $parameters)
21 {
22 try {
23 return $object->{$method}(...$parameters);
24 } catch (Error | BadMethodCallException $e) {
25 $pattern = '~^Call to undefined method (?P<class>[^:]+)::(?P<method>[^\(]+)\(\)$~';
26
27 if (! preg_match($pattern, $e->getMessage(), $matches)) {
28 throw $e;
29 }
30
31 if ($matches['class'] != get_class($object) ||
32 $matches['method'] != $method) {
33 throw $e;
34 }
35
36 static::throwBadMethodCallException($method);
37 }
38 }
39
40 /**
41 * Throw a bad method call exception for the given method.
42 *
43 * @param string $method
44 * @return void
45 *
46 * @throws \BadMethodCallException
47 */
48 protected static function throwBadMethodCallException($method)
49 {
50 throw new BadMethodCallException(sprintf(
51 'Call to undefined method %s::%s()', static::class, $method
52 ));
53 }
54}