ReviewOS

also looking at this

meemalabs/laravel-meema

Initial Progress

#2
Merged glennmichael123 wants to merge initial-progress into main
11 files +235 -34

Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.

.env.exampleadded+1-0
Changes to .env.example
@@ -0,0 +1,1 @@
1PUBLISHABLE_API_KEY=""
.gitignoremodified+1-0
Changes to .gitignore
@@ -5,3 +5,4 @@ vendor
55coverage
66.phpunit.result.cache
77.idea
8.env
composer.jsonmodified+6-4
Changes to composer.json
@@ -24,8 +24,10 @@
2424 "meema/meema-client-php": "dev-main"
2525 },
2626 "require-dev": {
27 "symfony/var-dumper": "^4.3",
28 "phpunit/phpunit": "^8.2"
27 "orchestra/testbench": "^5.0|^6.0",
28 "pestphp/pest": "^1.0",
29 "pestphp/pest-plugin-laravel": "^1.0",
30 "phpunit/phpunit": "^8.0|^9.3"
2931 },
3032 "autoload": {
3133 "psr-4": {
@@ -47,10 +49,10 @@
4749 "extra": {
4850 "laravel": {
4951 "providers": [
50 "Meema\\LaravelMeema\\MeemaServiceProvider"
52 "Meema\\LaravelMeema\\Providers\\MeemaServiceProvider"
5153 ],
5254 "aliases": {
53 "Meema": "Meema\\LaravelMeema\\MeemaFacade"
55 "Meema": "Meema\\LaravelMeema\\Facades\\MeemaFacade"
5456 }
5557 }
5658 }
config/config.phpadded+8-0
Changes to config/config.php
@@ -0,0 +1,8 @@
1<?php
2
3return [
4 /*
5 * The publishable API key provided by the meema API
6 */
7 'api_key' => env('PUBLISHABLE_API_KEY', ''),
8];
src/Contracts/FavoriteInterface.phpdeleted+0-59
Changes to src/Contracts/FavoriteInterface.php
@@ -1,59 +0,0 @@
1<?php
2
3namespace Meema\LaravelMeema\Contracts;
4
5interface FavoriteInterface
6{
7 /**
8 * List all favorites.
9 *
10 * @return array
11 */
12 public function all(): array;
13
14 /**
15 * Get specific favorites.
16 *
17 * @param array $ids
18 *
19 * @return array
20 */
21 public function get($ids = null): array;
22
23 /**
24 * Get specific favorites.
25 *
26 * @param int $id
27 *
28 * @return array
29 */
30 public function find($id): array;
31
32 /**
33 * Create favorite.
34 *
35 * @param array $data
36 *
37 * @return array
38 */
39 public function create($data): array;
40
41 /**
42 * Update favorite.
43 *
44 * @param int $id
45 * @param string $data
46 *
47 * @return array
48 */
49 public function update($id, $data): array;
50
51 /**
52 * Delete a favorite.
53 *
54 * @param array $ids
55 *
56 * @return null
57 */
58 public function delete($ids);
59}
src/Contracts/FolderInterface.phpdeleted+0-95
Changes to src/Contracts/FolderInterface.php
@@ -1,95 +0,0 @@
1<?php
2
3namespace Meema\LaravelMeema\Contracts;
4
5interface FolderInterface
6{
7 /**
8 * List all folders.
9 *
10 * @return array
11 */
12 public static function all(): array;
13
14 /**
15 * Get specific folders.
16 *
17 * @param int $id
18 *
19 * @return array
20 */
21 public static function get($id = null): array;
22
23 /**
24 * Search for specific folders.
25 *
26 * @param string $query
27 *
28 * @return array
29 */
30 public static function search($query): array;
31
32 /**
33 * Get specific folders.
34 *
35 * @param int $id
36 *
37 * @return Response
38 */
39 public static function find($id): array;
40
41 /**
42 * Create folder.
43 *
44 * @param string $name
45 *
46 * @return array
47 */
48 public static function create($name): array;
49
50 /**
51 * Update folder.
52 *
53 * @param int $id
54 * @param string $name
55 *
56 * @return array
57 */
58 public static function update($id, $name): array;
59
60 /**
61 * Delete a folder.
62 *
63 * @param array $ids
64 *
65 * @return null
66 */
67 public static function delete($ids);
68
69 /**
70 * Archive a folder.
71 *
72 * @param array $ids
73 *
74 * @return array
75 */
76 public static function archive($ids): array;
77
78 /**
79 * Unarchive a folder.
80 *
81 * @param array $ids
82 *
83 * @return array
84 */
85 public static function unarchive($ids): array;
86
87 /**
88 * Duplicate a folder.
89 *
90 * @param array $ids
91 *
92 * @return array
93 */
94 public static function duplicate($ids): array;
95}
src/Contracts/MediaInterface.phpdeleted+0-122
Changes to src/Contracts/MediaInterface.php
@@ -1,122 +0,0 @@
1<?php
2
3namespace Meema\LaravelMeema\Contracts;
4
5interface MediaInterface
6{
7 /**
8 * List all media.
9 *
10 * @return array
11 */
12 public static function all(): array;
13
14 /**
15 * Get specific media.
16 *
17 * @param array $ids
18 *
19 * @return array
20 */
21 public static function get($ids = null): array;
22
23 /**
24 * Search for specific media.
25 *
26 * @param string $query
27 *
28 * @return array
29 */
30 public static function search($query): array;
31
32 /**
33 * Get specific media.
34 *
35 * @param int $id
36 *
37 * @return array
38 */
39 public static function find($id): array;
40
41 /**
42 * Create media.
43 *
44 * @param string $name
45 *
46 * @return array
47 */
48 public static function create($name): array;
49
50 /**
51 * Update media.
52 *
53 * @param int $id
54 * @param string $name
55 *
56 * @return array
57 */
58 public static function update($id, $name): array;
59
60 /**
61 * Delete a media.
62 *
63 * @param array $ids
64 *
65 * @return null
66 */
67 public static function delete($ids);
68
69 /**
70 * Upload a media file.
71 *
72 * @param string $path
73 *
74 * @return array
75 */
76 public static function upload($path): array;
77
78 /**
79 * Archive a media.
80 *
81 * @param array $ids
82 *
83 * @return array
84 */
85 public static function archive($ids): array;
86
87 /**
88 * Unarchive a media.
89 *
90 * @param array $ids
91 *
92 * @return array
93 */
94 public static function unarchive($ids): array;
95
96 /**
97 * Make a media private.
98 *
99 * @param array $ids
100 *
101 * @return array
102 */
103 public static function makePrivate($ids): array;
104
105 /**
106 * Make a media public.
107 *
108 * @param array $ids
109 *
110 * @return array
111 */
112 public static function makePublic($ids): array;
113
114 /**
115 * Duplicate a media.
116 *
117 * @param array $ids
118 *
119 * @return array
120 */
121 public static function duplicate($ids): array;
122}
src/Contracts/TagInterface.phpdeleted+0-50
Changes to src/Contracts/TagInterface.php
@@ -1,50 +0,0 @@
1<?php
2
3namespace Meema\LaravelMeema\Contracts;
4
5interface TagInterface
6{
7 /**
8 * List all tags.
9 *
10 * @return array
11 */
12 public static function all(): array;
13
14 /**
15 * Get specific tags.
16 *
17 * @param array $ids
18 *
19 * @return array
20 */
21 public static function get($ids = null): array;
22
23 /**
24 * Get specific tags.
25 *
26 * @param int $id
27 *
28 * @return array
29 */
30 public static function find($id): array;
31
32 /**
33 * Update a tag color.
34 *
35 * @param int $id
36 * @param string $color
37 *
38 * @return array
39 */
40 public static function update($id, $color): array;
41
42 /**
43 * Delete tags.
44 *
45 * @param array $ids
46 *
47 * @return null
48 */
49 public static function delete($ids);
50}
src/Facades/Favorite.phpadded+27-0
Changes to src/Facades/Favorite.php
@@ -0,0 +1,27 @@
1<?php
2
3namespace Meema\LaravelMeema\Facades;
4
5use Illuminate\Support\Facades\Facade;
6
7/**
8 * @method static function all()
9 * @method static function get($ids = null)
10 * @method static function find($id)
11 * @method static function update($id, $name)
12 * @method static function delete($ids)
13 *
14 * @see \Meema\MeemaApi\Models\Favorite
15 */
16class Favorite extends Facade
17{
18 /**
19 * Get the registered name of the component.
20 *
21 * @return string
22 */
23 protected static function getFacadeAccessor()
24 {
25 return 'meema-favorite';
26 }
27}
src/Facades/Folder.phpadded+36-0
Changes to src/Facades/Folder.php
@@ -0,0 +1,36 @@
1<?php
2
3namespace Meema\LaravelMeema\Facades;
4
5use Illuminate\Support\Facades\Facade;
6
7/**
8 * @method static function all()
9 * @method static function get($ids = null)
10 * @method static function search($query)
11 * @method static function find($id)
12 * @method static function create($name)
13 * @method static function update($id, $name)
14 * @method static function delete($ids)
15 * @method static function archive($ids)
16 * @method static function unarchive($ids)
17 * @method static function makePublic($ids)
18 * @method static function duplicate($ids)
19 * @method static function getId()
20 * @method static media($id = null)
21 * @method static tags($id = null)
22 *
23 * @see \Meema\MeemaApi\Models\Folder
24 */
25class Folder extends Facade
26{
27 /**
28 * Get the registered name of the component.
29 *
30 * @return string
31 */
32 protected static function getFacadeAccessor()
33 {
34 return 'meema-folder';
35 }
36}
src/Facades/Media.phpadded+38-0
Changes to src/Facades/Media.php
@@ -0,0 +1,38 @@
1<?php
2
3namespace Meema\LaravelMeema\Facades;
4
5use Illuminate\Support\Facades\Facade;
6
7/**
8 * @method static function all()
9 * @method static function get($ids = null)
10 * @method static function search($query)
11 * @method static function find($id)
12 * @method static function create($name)
13 * @method static function update($id, $name)
14 * @method static function delete($ids)
15 * @method static function upload($path)
16 * @method static function archive($ids)
17 * @method static function unarchive($ids)
18 * @method static function makePrivate($ids)
19 * @method static function makePublic($ids)
20 * @method static function duplicate($ids)
21 * @method static folders($id = null)
22 * @method static tags($id = null)
23 * @method static function getId()
24 *
25 * @see \Meema\MeemaApi\Models\Media
26 */
27class Media extends Facade
28{
29 /**
30 * Get the registered name of the component.
31 *
32 * @return string
33 */
34 protected static function getFacadeAccessor()
35 {
36 return 'meema-media';
37 }
38}
src/Facades/Meema.phpadded+28-0
Changes to src/Facades/Meema.php
@@ -0,0 +1,28 @@
1<?php
2
3namespace Meema\LaravelMeema\Facades;
4
5use Illuminate\Support\Facades\Facade;
6
7/**
8 * @method static function request($method, $path, $data = null)
9 * @method static function getAccessKey()
10 * @method static function folders()
11 * @method static function media()
12 * @method static function tags()
13 * @method static function favorites()
14 *
15 * @see \Meema\MeemaApi\Client
16 */
17class Meema extends Facade
18{
19 /**
20 * Get the registered name of the component.
21 *
22 * @return string
23 */
24 protected static function getFacadeAccessor()
25 {
26 return 'meema';
27 }
28}
src/Facades/MeemaFavorite.phpdeleted+0-19
Changes to src/Facades/MeemaFavorite.php
@@ -1,19 +0,0 @@
1<?php
2
3namespace Meema\LaravelMeema\Facades;
4
5use Illuminate\Support\Facades\Facade;
6use Meema\LaravelMeema\Models\Favorite;
7
8class MeemaFavorite extends Facade
9{
10 /**
11 * Get the registered name of the component.
12 *
13 * @return string
14 */
15 protected static function getFacadeAccessor()
16 {
17 return Favorite::class;
18 }
19}
src/Facades/MeemaFolder.phpdeleted+0-19
Changes to src/Facades/MeemaFolder.php
@@ -1,19 +0,0 @@
1<?php
2
3namespace Meema\LaravelMeema\Facades;
4
5use Illuminate\Support\Facades\Facade;
6use Meema\LaravelMeema\Models\Folder;
7
8class MeemaFolder extends Facade
9{
10 /**
11 * Get the registered name of the component.
12 *
13 * @return string
14 */
15 protected static function getFacadeAccessor()
16 {
17 return Folder::class;
18 }
19}
src/Facades/MeemaMedia.phpdeleted+0-19
Changes to src/Facades/MeemaMedia.php
@@ -1,19 +0,0 @@
1<?php
2
3namespace Meema\LaravelMeema\Facades;
4
5use Illuminate\Support\Facades\Facade;
6use Meema\LaravelMeema\Models\Media;
7
8class MeemaMedia extends Facade
9{
10 /**
11 * Get the registered name of the component.
12 *
13 * @return string
14 */
15 protected static function getFacadeAccessor()
16 {
17 return Media::class;
18 }
19}
src/Facades/MeemaTag.phpdeleted+0-19
Changes to src/Facades/MeemaTag.php
@@ -1,19 +0,0 @@
1<?php
2
3namespace Meema\LaravelMeema\Facades;
4
5use Illuminate\Support\Facades\Facade;
6use Meema\LaravelMeema\Models\Tag;
7
8class MeemaTag extends Facade
9{
10 /**
11 * Get the registered name of the component.
12 *
13 * @return string
14 */
15 protected static function getFacadeAccessor()
16 {
17 return Tag::class;
18 }
19}
src/Facades/Tag.phpadded+30-0
Changes to src/Facades/Tag.php
@@ -0,0 +1,30 @@
1<?php
2
3namespace Meema\LaravelMeema\Facades;
4
5use Illuminate\Support\Facades\Facade;
6
7/**
8 * @method static function all()
9 * @method static function get($ids = null)
10 * @method static function find($id)
11 * @method static function update($id, $name)
12 * @method static function delete($ids)
13 * @method static media($id = null)
14 * @method static folders($id = null)
15 * @method static function getId()
16 *
17 * @see \Meema\MeemaApi\Models\Tag
18 */
19class Tag extends Facade
20{
21 /**
22 * Get the registered name of the component.
23 *
24 * @return string
25 */
26 protected static function getFacadeAccessor()
27 {
28 return 'meema-tag';
29 }
30}
src/MeemaServiceProvider.phpdeleted+0-28
Changes to src/MeemaServiceProvider.php
@@ -1,28 +0,0 @@
1<?php
2
3namespace Meema\LaravelMeema;
4
5use Illuminate\Support\ServiceProvider;
6
7class MeemaServiceProvider extends ServiceProvider
8{
9 /**
10 * Bootstrap the application services.
11 */
12 public function boot()
13 {
14 if ($this->app->runningInConsole()) {
15 $this->publishes([
16 __DIR__.'/../config/config.php' => config_path('meema.php'),
17 ], 'config');
18 }
19 }
20
21 /**
22 * Register the application services.
23 */
24 public function register()
25 {
26 $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'meema');
27 }
28}
src/Models/Tag.phpdeleted+0-67
Changes to src/Models/Tag.php
@@ -1,67 +0,0 @@
1<?php
2
3namespace Meema\LaravelMeema\Models;
4
5use Meema\LaravelMeema\Contracts\TagInterface;
6
7class Tag implements TagInterface
8{
9 /**
10 * List all tags.
11 *
12 * @return array
13 */
14 public static function all(): array
15 {
16 return [];
17 }
18
19 /**
20 * Get specific tags.
21 *
22 * @param array $ids
23 *
24 * @return array
25 */
26 public static function get($ids = null): array
27 {
28 return [];
29 }
30
31 /**
32 * Get specific tags.
33 *
34 * @param int $id
35 *
36 * @return array
37 */
38 public static function find($id): array
39 {
40 return [];
41 }
42
43 /**
44 * Update a tag color.
45 *
46 * @param int $id
47 * @param string $color
48 *
49 * @return array
50 */
51 public static function update($id, $color): array
52 {
53 return [];
54 }
55
56 /**
57 * Delete tags.
58 *
59 * @param array $ids
60 *
61 * @return null
62 */
63 public static function delete($ids)
64 {
65 return [];
66 }
67}
src/Providers/MeemaServiceProvider.phpadded+59-0
Changes to src/Providers/MeemaServiceProvider.php
@@ -0,0 +1,59 @@
1<?php
2
3namespace Meema\LaravelMeema\Providers;
4
5use Illuminate\Support\ServiceProvider;
6use Meema\MeemaApi\Client;
7
8class MeemaServiceProvider extends ServiceProvider
9{
10 /**
11 * Bootstrap the application services.
12 */
13 public function boot()
14 {
15 if ($this->app->runningInConsole()) {
16 $this->publishes([
17 __DIR__.'/../../config/config.php' => config_path('meema.php'),
18 ], 'config');
19 }
20 }
21
22 /**
23 * Register the application services.
24 */
25 public function register()
26 {
27 $this->registerMeemaClient();
28
29 $this->app->bind('meema-media', function ($app) {
30 return $app['meema']->media();
31 });
32
33 $this->app->bind('meema-folder', function ($app) {
34 return $app['meema']->folders();
35 });
36
37 $this->app->bind('meema-tag', function ($app) {
38 return $app['meema']->tags();
39 });
40
41 $this->app->bind('meema-favorite', function ($app) {
42 return $app['meema']->favorite();
43 });
44
45 $this->mergeConfigFrom(__DIR__.'/../../config/config.php', 'meema');
46 }
47
48 /**
49 * Registers the Meema SDK Client
50 *
51 * @return void
52 */
53 protected function registerMeemaClient()
54 {
55 $this->app->singleton('meema', function ($app) {
56 return new Client(config('meema.api_key'));
57 });
58 }
59}
tests/ExampleTest.phpmodified+5-2
Changes to tests/ExampleTest.php
@@ -2,13 +2,16 @@
22
33namespace Meema\LaravelMeema\Tests;
44
5use Meema\LaravelMeema\Facades\Meema;
56use PHPUnit\Framework\TestCase;
67
78class ExampleTest extends TestCase
89{
910 /** @test */
10 public function true_is_true()
11 public function it_can_be_instantiated()
1112 {
12 $this->assertTrue(true);
13 $accessKey = Meema::getAccessKey();
14
15 dump($accessKey);
1316 }
1417}