Skip to content

Commit

Permalink
Merge pull request #60 from conjoon/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ThorstenSuckow authored May 11, 2022
2 parents 1855847 + 94e0bc0 commit 59bb128
Show file tree
Hide file tree
Showing 227 changed files with 3,725 additions and 27,180 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run.tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
with:
php-version: ${{ matrix.php }}
coverage: none
tools: composer:v1
tools: composer:v2

- name: Install dependencies
run: composer install --no-progress
Expand Down
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,14 @@ In case you cannot run tests from within this folder with your phpunit-installat
phpunit included in the vendor directory:
```./vendor/bin/phpunit```

#### Composer 2.0 / Horde vows
Unfortunately, there is no full support for the required Horde packages as of now. If you experience any troubles running ```composer update```, the following will most likely help:
### Composer 2.0 - Pear/Horde vows
As of **v1.0.1**, _php-lib-conjoon_ no longer requires _Composer 1.*_ for installation.
For _Composer 2.*_-compatibility, _php-lib-conjoon_ relies on the following private composer
package repository:

```
// remove the "requires" and "repositories" from the composer.json
//
> composer self-update --1
// add the previously "requires" and "repositories" from the composer.json back
// ...
> composer update
> composer self-update --rollback
https://horde-satis.maintaina.com
```
This repository is mentioned in **THIS** package's _composer.json_
This repository is also mentioned in the _composer.json_-file of
[horde\/horde_deployment](https://github.com/horde/horde-deployment/blob/master/composer.json).
19 changes: 16 additions & 3 deletions app/bootstrap/bindings.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* conjoon
* php-ms-imapuser
* Copyright (C) 2019-2021 Thorsten Suckow-Homberg https://github.com/conjoon/php-ms-imapuser
* Copyright (C) 2019-2022 Thorsten Suckow-Homberg https://github.com/conjoon/php-ms-imapuser
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
Expand All @@ -30,6 +30,7 @@
use App\Console\Kernel as ConsoleKernel;
use App\Exceptions\Handler;
use Conjoon\Horde\Mail\Client\Imap\HordeClient;
use Conjoon\Horde\Mail\Client\Message\Composer\HordeAttachmentComposer;
use Conjoon\Horde\Mail\Client\Message\Composer\HordeBodyComposer;
use Conjoon\Horde\Mail\Client\Message\Composer\HordeHeaderComposer;
use Conjoon\Illuminate\Auth\Imap\DefaultImapUserProvider;
Expand All @@ -43,6 +44,8 @@
use Conjoon\Mail\Client\Reader\DefaultPlainReadableStrategy;
use Conjoon\Mail\Client\Reader\PurifiedHtmlStrategy;
use Conjoon\Mail\Client\Reader\ReadableMessagePartContentProcessor;
use Conjoon\Mail\Client\Request\Attachment\Transformer\AttachmentListJsonTransformer;
use Conjoon\Illuminate\Mail\Client\Request\Attachment\Transformer\LaravelAttachmentListJsonTransformer;
use Conjoon\Mail\Client\Request\Message\Transformer\DefaultMessageBodyDraftJsonTransformer;
use Conjoon\Mail\Client\Request\Message\Transformer\DefaultMessageItemDraftJsonTransformer;
use Conjoon\Mail\Client\Request\Message\Transformer\MessageBodyDraftJsonTransformer;
Expand All @@ -63,9 +66,15 @@
// helper function to make sure Services can share HordeClients for the same account
$mailClients = [];
$hordeBodyComposer = new HordeBodyComposer();
$hordeAttachmentComposer = new HordeAttachmentComposer();
$hordeHeaderComposer = new HordeHeaderComposer();

$getMailClient = function (MailAccount $account) use (&$mailClients, &$hordeBodyComposer, &$hordeHeaderComposer) {
$getMailClient = function (MailAccount $account) use (
&$mailClients,
&$hordeBodyComposer,
&$hordeHeaderComposer,
&$hordeAttachmentComposer
) {

$accountId = $account->getId();

Expand All @@ -74,7 +83,7 @@
}


$mailClient = new HordeClient($account, $hordeBodyComposer, $hordeHeaderComposer);
$mailClient = new HordeClient($account, $hordeBodyComposer, $hordeHeaderComposer, $hordeAttachmentComposer);
$mailClients[$accountId] = $mailClient;
return $mailClient;
};
Expand Down Expand Up @@ -121,6 +130,10 @@
return new DefaultMessageBodyDraftJsonTransformer();
});

$app->singleton(AttachmentListJsonTransformer::class, function () {
return new LaravelAttachmentListJsonTransformer();
});

$app->singleton(MessageItemService::class, function ($app) use ($getMailClient) {

// if mailAccountId not part of the routing url, but request parameters, use those
Expand Down
49 changes: 44 additions & 5 deletions app/routes/rest-api-email/api_v0.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* conjoon
* php-ms-imapuser
* Copyright (C) 2020 Thorsten Suckow-Homberg https://github.com/conjoon/php-ms-imapuser
* Copyright (C) 2020-2022 Thorsten Suckow-Homberg https://github.com/conjoon/php-ms-imapuser
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
Expand Down Expand Up @@ -35,7 +35,10 @@
| https://github.com/conjoon/rest-api-description
*/

$router->post('SendMessage', 'MessageItemController@sendMessageDraft');
$router->post(
'MailAccounts/{mailAccountId}/MailFolders/{mailFolderId:.*}/MessageItems/{messageItemId}',
'MessageItemController@sendMessageDraft'
);

$router->get('MailAccounts', 'MailAccountController@index');

Expand All @@ -51,19 +54,55 @@
'MailAccounts/{mailAccountId}/MailFolders/{mailFolderId:.*}/MessageItems',
'MessageItemController@post'
);

/**
* GET MessageItem / MessageBody / MessageDraft
*/
$router->get(
'MailAccounts/{mailAccountId}/MailFolders/{mailFolderId:.*}/MessageItems/{messageItemId}',
'MessageItemController@get'
);
$router->put(
'MailAccounts/{mailAccountId}/MailFolders/{mailFolderId:.*}/MessageItems/{messageItemId}',
'MessageItemController@put'

$router->patch(
'MailAccounts/{mailAccountId}/MailFolders/{mailFolderId:.*}/MessageItems/{messageItemId}/MessageItem',
'MessageItemController@patchMessageItem'
);

$router->patch(
'MailAccounts/{mailAccountId}/MailFolders/{mailFolderId:.*}/MessageItems/{messageItemId}/MessageDraft',
'MessageItemController@patchMessageDraft'
);

$router->delete(
'MailAccounts/{mailAccountId}/MailFolders/{mailFolderId:.*}/MessageItems/{messageItemId}',
'MessageItemController@delete'
);

/**
* MessageBody
*/
$router->get(
'MailAccounts/{mailAccountId}/MailFolders/{mailFolderId:.*}/MessageItems/{messageItemId}/MessageBody',
'MessageItemController@getMessageBody'
);

$router->patch(
'MailAccounts/{mailAccountId}/MailFolders/{mailFolderId:.*}/MessageItems/{messageItemId}/MessageBody',
'MessageItemController@patchMessageBody'
);

/**
* Attachments
*/
$router->get(
'MailAccounts/{mailAccountId}/MailFolders/{mailFolderId:.*}/MessageItems/{messageItemId}/Attachments',
'AttachmentController@index'
);
$router->post(
'MailAccounts/{mailAccountId}/MailFolders/{mailFolderId:.*}/MessageItems/{messageItemId}/Attachments',
'AttachmentController@post'
);
$router->delete(
'MailAccounts/{mailAccountId}/MailFolders/{mailFolderId:.*}/MessageItems/{messageItemId}/Attachments/{id}',
'AttachmentController@delete'
);
26 changes: 10 additions & 16 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
{
"name": "laravel/lumen",
"description": "The Laravel Lumen Framework.",
"keywords": ["framework", "laravel", "lumen"],
"name": "conjoon/php-ms-imapuser",
"description": "PHP microservice for accessing IMAP servers, implementing rest-api-email from conjoon/rest-api-description.",
"license": "MIT",
"type": "project",
"repositories": [
{
"type": "pear",
"url": "https://pear.horde.org"
}
{"url": "https://horde-satis.maintaina.com", "type": "composer"}
],
"require": {
"php": ">=7.4",
"ezyang/htmlpurifier": "^4.11",
"conjoon/php-lib-conjoon": "^1.0",
"fruitcake/laravel-cors": "^2.0",
"laravel/lumen-framework": "5.8.*",
"pear-pear.horde.org/horde_imap_client": "*",
"pear-pear.horde.org/horde_smtp": "*"
"laravel/lumen-framework": "5.8.*"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
Expand All @@ -26,21 +20,21 @@
},
"autoload": {
"psr-4": {
"App\\": "lib/src/",
"Conjoon\\": "lib/src/Conjoon"
"App\\": "lib/src/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\App\\": "lib/tests/",
"Tests\\Conjoon\\": "lib/tests/Conjoon/",
"Tests\\": "lib/tests"
}
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
"optimize-autoloader": true,
"allow-plugins": {
"horde/horde-installer-plugin": false
}
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand Down
Loading

0 comments on commit 59bb128

Please sign in to comment.