Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/Connection/ImapQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,14 @@ public function keyword(string $value): static
return $this->where(ImapSearchKey::Keyword, $value);
}

/**
* Add a where "UNKEYWORD" clause to the query.
*/
public function unkeyword(string $value): static
{
return $this->where(ImapSearchKey::Unkeyword, $value);
}

/**
* Add a where "ON" clause to the query.
*/
Expand Down
1 change: 1 addition & 0 deletions src/Enums/ImapSearchKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ enum ImapSearchKey: string
case Deleted = 'DELETED';
case Flagged = 'FLAGGED';
case Keyword = 'KEYWORD';
case Unkeyword = 'UNKEYWORD';
case Subject = 'SUBJECT';
case Smaller = 'SMALLER';
case Answered = 'ANSWERED';
Expand Down
8 changes: 8 additions & 0 deletions tests/Unit/Connection/ImapQueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,3 +300,11 @@ function (ImapQueryBuilder $q) {

expect($builder->toImap())->toBe('LARGER 1024 SMALLER 1048576');
});

test('compiles KEYWORD condition', function () {
expect((new ImapQueryBuilder)->keyword('important')->toImap())->toBe('KEYWORD "important"');
});

test('compiles UNKEYWORD condition', function () {
expect((new ImapQueryBuilder)->unkeyword('important')->toImap())->toBe('UNKEYWORD "important"');
});