Initial commit

This commit is contained in:
root
2026-01-04 22:05:37 -05:00
committed by Sebastian Krupinski
commit 4f979ced22
57 changed files with 11076 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXM\ProviderJmapc\Jmap\FM\Request\Contacts;
use JmapClient\Requests\RequestParameters;
class ContactEmailParameters extends RequestParameters {
public function __construct(&$parameters = null) {
parent::__construct($parameters);
}
public function type(string $value): self {
$this->parameter('type', $value);
return $this;
}
public function value(string $value): self {
$this->parameter('value', $value);
return $this;
}
public function label(string $value): self {
$this->parameter('label', $value);
return $this;
}
public function default(bool $value): self {
$this->parameter('isDefault', $value);
return $this;
}
}

View File

@@ -0,0 +1,60 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXM\ProviderJmapc\Jmap\FM\Request\Contacts;
use JmapClient\Requests\RequestParameters;
class ContactLocationParameters extends RequestParameters {
public function __construct(&$parameters = null) {
parent::__construct($parameters);
}
public function type(string $value): self {
$this->parameter('type', $value);
return $this;
}
public function label(string $value): self {
$this->parameter('label', $value);
return $this;
}
public function street(string $value): self {
$this->parameter('street', $value);
return $this;
}
public function locality(string $value): self {
$this->parameter('locality', $value);
return $this;
}
public function region(string $value): self {
$this->parameter('region', $value);
return $this;
}
public function code(string $value): self {
$this->parameter('postcode', $value);
return $this;
}
public function country(string $value): self {
$this->parameter('country', $value);
return $this;
}
public function default(bool $value): self {
$this->parameter('isDefault', $value);
return $this;
}
}

View File

@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXM\ProviderJmapc\Jmap\FM\Request\Contacts;
use JmapClient\Requests\RequestParameters;
class ContactOnlineParameters extends RequestParameters {
public function __construct(&$parameters = null) {
parent::__construct($parameters);
}
public function type(string $value): self {
$this->parameter('type', $value);
return $this;
}
public function value(string $value): self {
$this->parameter('value', $value);
return $this;
}
public function label(string $value): self {
$this->parameter('label', $value);
return $this;
}
}

View File

@@ -0,0 +1,171 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXM\ProviderJmapc\Jmap\FM\Request\Contacts;
use JmapClient\Requests\RequestParameters;
use function PHPUnit\Framework\isEmpty;
class ContactParameters extends RequestParameters {
public const DATE_FORMAT_ANNIVERSARY = 'YYYY-MM-DD';
public function __construct(&$parameters = null) {
parent::__construct($parameters);
}
public function in(string $value): self {
if (isEmpty($value)) {
$this->parameter('addressbookId', 'Default');
} else {
$this->parameter('addressbookId', $value);
}
return $this;
}
public function id(string $value): self {
$this->parameter('id', $value);
return $this;
}
public function uid(string $value): self {
$this->parameter('uid', $value);
return $this;
}
public function type(string $value): self {
$this->parameter('kind', $value);
return $this;
}
public function nameLast(string $value): self {
$this->parameter('lastName', $value);
return $this;
}
public function nameFirst(string $value): self {
$this->parameter('firstName', $value);
return $this;
}
public function namePrefix(string $value): self {
$this->parameter('prefix', $value);
return $this;
}
public function nameSuffix(string $value): self {
$this->parameter('suffix', $value);
return $this;
}
public function organizationName(string $value): self {
$this->parameter('company', $value);
return $this;
}
public function organizationUnit(string $value): self {
$this->parameter('department', $value);
return $this;
}
public function title(string $value): self {
$this->parameter('jobTitle', $value);
return $this;
}
public function notes(string $value): self {
$this->parameter('notes', $value);
return $this;
}
public function priority(int $value): self {
$this->parameter('importance', $value);
return $this;
}
public function birthDay(string $value): self {
$this->parameter('birthday', $value);
return $this;
}
public function nuptialDay(string $value): self {
$this->parameter('anniversary', $value);
return $this;
}
public function email(?int $id = null): ContactEmailParameters {
// Ensure the parameter exists
if (!isset($this->_parameters->emails)) {
$this->_parameters->emails = [];
}
// If an ID is provided, ensure the specific email entry exists
if ($id !== null) {
if (!isset($this->_parameters->emails[$id])) {
$this->_parameters->emails[$id] = new \stdClass();
}
return new ContactEmailParameters($this->_parameters->emails[$id]);
}
// If no ID is provided, create a new email entry
$this->_parameters->emails[] = new \stdClass();
return new ContactEmailParameters(end($this->_parameters->emails));
}
public function phone(?int $id = null): ContactPhoneParameters {
// Ensure the parameter exists
if (!isset($this->_parameters->phones)) {
$this->_parameters->phones = [];
}
// If an ID is provided, ensure the specific phone entry exists
if ($id !== null) {
if (!isset($this->_parameters->phones[$id])) {
$this->_parameters->phones[$id] = new \stdClass();
}
return new ContactPhoneParameters($this->_parameters->phones[$id]);
}
// If no ID is provided, create a new phone entry
$this->_parameters->phones[] = new \stdClass();
return new ContactPhoneParameters(end($this->_parameters->phones));
}
public function location(?int $id = null): ContactLocationParameters {
// Ensure the parameter exists
if (!isset($this->_parameters->addresses)) {
$this->_parameters->addresses = [];
}
// If an ID is provided, ensure the specific address entry exists
if ($id !== null) {
if (!isset($this->_parameters->addresses[$id])) {
$this->_parameters->addresses[$id] = new \stdClass();
}
return new ContactLocationParameters($this->_parameters->addresses[$id]);
}
// If no ID is provided, create a new address entry
$this->_parameters->addresses[] = new \stdClass();
return new ContactLocationParameters(end($this->_parameters->addresses));
}
public function online(?int $id = null): ContactOnlineParameters {
// Ensure the parameter exists
if (!isset($this->_parameters->addresses)) {
$this->_parameters->addresses = [];
}
// If an ID is provided, ensure the specific address entry exists
if ($id !== null) {
if (!isset($this->_parameters->addresses[$id])) {
$this->_parameters->addresses[$id] = new \stdClass();
}
return new ContactOnlineParameters($this->_parameters->addresses[$id]);
}
// If no ID is provided, create a new address entry
$this->_parameters->addresses[] = new \stdClass();
return new ContactOnlineParameters(end($this->_parameters->addresses));
}
}

View File

@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXM\ProviderJmapc\Jmap\FM\Request\Contacts;
use JmapClient\Requests\RequestParameters;
class ContactPhoneParameters extends RequestParameters {
public function __construct(&$parameters = null) {
parent::__construct($parameters);
}
public function type(string $value): self {
$this->parameter('type', $value);
return $this;
}
public function value(string $value): self {
$this->parameter('value', $value);
return $this;
}
public function label(string $value): self {
$this->parameter('label', $value);
return $this;
}
public function default(bool $value): self {
$this->parameter('isDefault', $value);
return $this;
}
}