1
0
mirror of synced 2024-11-25 21:16:01 +03:00

Parse dates with and without nanoseconds

This commit is contained in:
Pavel 2023-01-20 13:09:15 +03:00 committed by GitHub
commit 1650ff34aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 244 additions and 38 deletions

View File

@ -33,7 +33,7 @@ class Bot implements ModelInterface
/** /**
* @var \DateTime $createdAt * @var \DateTime $createdAt
* *
* @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z', null, ['Y-m-d\TH:i:s\.u\Z', 'Y-m-d\TH:i:s\Z']>")
* @Accessor(getter="getCreatedAt",setter="setCreatedAt") * @Accessor(getter="getCreatedAt",setter="setCreatedAt")
* @SkipWhenEmpty() * @SkipWhenEmpty()
*/ */
@ -42,7 +42,7 @@ class Bot implements ModelInterface
/** /**
* @var \DateTime $updatedAt * @var \DateTime $updatedAt
* *
* @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z', null, ['Y-m-d\TH:i:s\.u\Z', 'Y-m-d\TH:i:s\Z']>")
* @Accessor(getter="getUpdatedAt",setter="setUpdatedAt") * @Accessor(getter="getUpdatedAt",setter="setUpdatedAt")
* @SkipWhenEmpty() * @SkipWhenEmpty()
*/ */

View File

@ -33,7 +33,7 @@ class Channel implements ModelInterface
/** /**
* @var \DateTime $createdAt * @var \DateTime $createdAt
* *
* @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z', null, ['Y-m-d\TH:i:s\.u\Z', 'Y-m-d\TH:i:s\Z']>")
* @Accessor(getter="getCreatedAt",setter="setCreatedAt") * @Accessor(getter="getCreatedAt",setter="setCreatedAt")
*/ */
private $createdAt; private $createdAt;
@ -41,7 +41,7 @@ class Channel implements ModelInterface
/** /**
* @var \DateTime $updatedAt * @var \DateTime $updatedAt
* *
* @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z', null, ['Y-m-d\TH:i:s\.u\Z', 'Y-m-d\TH:i:s\Z']>")
* @Accessor(getter="getUpdatedAt",setter="setUpdatedAt") * @Accessor(getter="getUpdatedAt",setter="setUpdatedAt")
*/ */
private $updatedAt; private $updatedAt;
@ -49,7 +49,7 @@ class Channel implements ModelInterface
/** /**
* @var \DateTime $activatedAt * @var \DateTime $activatedAt
* *
* @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z', null, ['Y-m-d\TH:i:s\.u\Z', 'Y-m-d\TH:i:s\Z']>")
* @Accessor(getter="getActivatedAt",setter="setActivatedAt") * @Accessor(getter="getActivatedAt",setter="setActivatedAt")
*/ */
private $activatedAt; private $activatedAt;
@ -57,7 +57,7 @@ class Channel implements ModelInterface
/** /**
* @var \DateTime $deactivatedAt * @var \DateTime $deactivatedAt
* *
* @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z', null, ['Y-m-d\TH:i:s\.u\Z', 'Y-m-d\TH:i:s\Z']>")
* @Accessor(getter="getDeactivatedAt",setter="setDeactivatedAt") * @Accessor(getter="getDeactivatedAt",setter="setDeactivatedAt")
*/ */
private $deactivatedAt; private $deactivatedAt;

View File

@ -35,7 +35,7 @@ class Chat implements ModelInterface
/** /**
* @var \DateTime $createdAt * @var \DateTime $createdAt
* *
* @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z', null, ['Y-m-d\TH:i:s\.u\Z', 'Y-m-d\TH:i:s\Z']>")
* @Accessor(getter="getCreatedAt",setter="setCreatedAt") * @Accessor(getter="getCreatedAt",setter="setCreatedAt")
*/ */
private $createdAt; private $createdAt;
@ -43,7 +43,7 @@ class Chat implements ModelInterface
/** /**
* @var \DateTime $updatedAt * @var \DateTime $updatedAt
* *
* @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z', null, ['Y-m-d\TH:i:s\.u\Z', 'Y-m-d\TH:i:s\Z']>")
* @Accessor(getter="getUpdatedAt",setter="setUpdatedAt") * @Accessor(getter="getUpdatedAt",setter="setUpdatedAt")
*/ */
private $updatedAt; private $updatedAt;

View File

@ -33,7 +33,7 @@ class ChatMember implements ModelInterface
/** /**
* @var \DateTime $createdAt * @var \DateTime $createdAt
* *
* @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z', null, ['Y-m-d\TH:i:s\.u\Z', 'Y-m-d\TH:i:s\Z']>")
* @Accessor(getter="getCreatedAt",setter="setCreatedAt") * @Accessor(getter="getCreatedAt",setter="setCreatedAt")
*/ */
private $createdAt; private $createdAt;
@ -41,7 +41,7 @@ class ChatMember implements ModelInterface
/** /**
* @var \DateTime $updatedAt * @var \DateTime $updatedAt
* *
* @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z', null, ['Y-m-d\TH:i:s\.u\Z', 'Y-m-d\TH:i:s\Z']>")
* @Accessor(getter="getUpdatedAt",setter="setUpdatedAt") * @Accessor(getter="getUpdatedAt",setter="setUpdatedAt")
* @SkipWhenEmpty() * @SkipWhenEmpty()
*/ */

View File

@ -33,7 +33,7 @@ class Command implements ModelInterface
/** /**
* @var \DateTime $createdAt * @var \DateTime $createdAt
* *
* @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z', null, ['Y-m-d\TH:i:s\.u\Z', 'Y-m-d\TH:i:s\Z']>")
* @Accessor(getter="getCreatedAt",setter="setCreatedAt") * @Accessor(getter="getCreatedAt",setter="setCreatedAt")
*/ */
private $createdAt; private $createdAt;
@ -41,7 +41,7 @@ class Command implements ModelInterface
/** /**
* @var \DateTime $updatedAt * @var \DateTime $updatedAt
* *
* @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z', null, ['Y-m-d\TH:i:s\.u\Z', 'Y-m-d\TH:i:s\Z']>")
* @Accessor(getter="getUpdatedAt",setter="setUpdatedAt") * @Accessor(getter="getUpdatedAt",setter="setUpdatedAt")
* @SkipWhenEmpty() * @SkipWhenEmpty()
*/ */

View File

@ -34,7 +34,7 @@ class Customer implements ModelInterface
/** /**
* @var \DateTime $createdAt * @var \DateTime $createdAt
* *
* @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z', null, ['Y-m-d\TH:i:s\.u\Z', 'Y-m-d\TH:i:s\Z']>")
* @Accessor(getter="getCreatedAt",setter="setCreatedAt") * @Accessor(getter="getCreatedAt",setter="setCreatedAt")
*/ */
private $createdAt; private $createdAt;
@ -42,7 +42,7 @@ class Customer implements ModelInterface
/** /**
* @var \DateTime $updatedAt * @var \DateTime $updatedAt
* *
* @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z', null, ['Y-m-d\TH:i:s\.u\Z', 'Y-m-d\TH:i:s\Z']>")
* @Accessor(getter="getUpdatedAt",setter="setUpdatedAt") * @Accessor(getter="getUpdatedAt",setter="setUpdatedAt")
* @SkipWhenEmpty() * @SkipWhenEmpty()
*/ */

View File

@ -33,7 +33,7 @@ class Dialog implements ModelInterface
/** /**
* @var \DateTime $createdAt * @var \DateTime $createdAt
* *
* @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z', null, ['Y-m-d\TH:i:s\.u\Z', 'Y-m-d\TH:i:s\Z']>")
* @Accessor(getter="getCreatedAt",setter="setCreatedAt") * @Accessor(getter="getCreatedAt",setter="setCreatedAt")
*/ */
private $createdAt; private $createdAt;
@ -41,7 +41,7 @@ class Dialog implements ModelInterface
/** /**
* @var \DateTime $updatedAt * @var \DateTime $updatedAt
* *
* @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z', null, ['Y-m-d\TH:i:s\.u\Z', 'Y-m-d\TH:i:s\Z']>")
* @Accessor(getter="getUpdatedAt",setter="setUpdatedAt") * @Accessor(getter="getUpdatedAt",setter="setUpdatedAt")
* @SkipWhenEmpty() * @SkipWhenEmpty()
*/ */
@ -86,7 +86,7 @@ class Dialog implements ModelInterface
/** /**
* @var \DateTime $closedAt * @var \DateTime $closedAt
* *
* @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z', null, ['Y-m-d\TH:i:s\.u\Z', 'Y-m-d\TH:i:s\Z']>")
* @Accessor(getter="getClosedAt",setter="setClosedAt") * @Accessor(getter="getClosedAt",setter="setClosedAt")
* @SkipWhenEmpty() * @SkipWhenEmpty()
*/ */

View File

@ -35,7 +35,7 @@ class Message implements ModelInterface
/** /**
* @var \DateTime $createdAt * @var \DateTime $createdAt
* *
* @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z', null, ['Y-m-d\TH:i:s\.u\Z', 'Y-m-d\TH:i:s\Z']>")
* @Accessor(getter="getCreatedAt",setter="setCreatedAt") * @Accessor(getter="getCreatedAt",setter="setCreatedAt")
*/ */
private $createdAt; private $createdAt;
@ -43,7 +43,7 @@ class Message implements ModelInterface
/** /**
* @var \DateTime $updatedAt * @var \DateTime $updatedAt
* *
* @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z', null, ['Y-m-d\TH:i:s\.u\Z', 'Y-m-d\TH:i:s\Z']>")
* @Accessor(getter="getUpdatedAt",setter="setUpdatedAt") * @Accessor(getter="getUpdatedAt",setter="setUpdatedAt")
* @SkipWhenEmpty() * @SkipWhenEmpty()
*/ */
@ -178,7 +178,7 @@ class Message implements ModelInterface
/** /**
* @var \DateTime $channelSentAt * @var \DateTime $channelSentAt
* *
* @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z', null, ['Y-m-d\TH:i:s\.u\Z', 'Y-m-d\TH:i:s\Z']>")
* @Accessor(getter="getChannelSentAt",setter="setChannelSentAt") * @Accessor(getter="getChannelSentAt",setter="setChannelSentAt")
* @SkipWhenEmpty() * @SkipWhenEmpty()
*/ */

View File

@ -34,7 +34,7 @@ class User implements ModelInterface
/** /**
* @var \DateTime $createdAt * @var \DateTime $createdAt
* *
* @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z', null, ['Y-m-d\TH:i:s\.u\Z', 'Y-m-d\TH:i:s\Z']>")
* @Accessor(getter="getCreatedAt",setter="setCreatedAt") * @Accessor(getter="getCreatedAt",setter="setCreatedAt")
*/ */
private $createdAt; private $createdAt;
@ -42,7 +42,7 @@ class User implements ModelInterface
/** /**
* @var \DateTime $updatedAt * @var \DateTime $updatedAt
* *
* @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z', null, ['Y-m-d\TH:i:s\.u\Z', 'Y-m-d\TH:i:s\Z']>")
* @Accessor(getter="getUpdatedAt",setter="setUpdatedAt") * @Accessor(getter="getUpdatedAt",setter="setUpdatedAt")
* @SkipWhenEmpty() * @SkipWhenEmpty()
*/ */
@ -136,7 +136,7 @@ class User implements ModelInterface
/** /**
* @var \DateTime $revokedAt * @var \DateTime $revokedAt
* *
* @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z', null, ['Y-m-d\TH:i:s\.u\Z', 'Y-m-d\TH:i:s\Z']>")
* @Accessor(getter="getRevokedAt",setter="setRevokedAt") * @Accessor(getter="getRevokedAt",setter="setRevokedAt")
* @SkipWhenEmpty() * @SkipWhenEmpty()
*/ */

View File

@ -49,7 +49,7 @@ class ClientListTest extends TestCase
$response = $client->channels($request); $response = $client->channels($request);
static::assertCount(4, $response, "Incorrect channels count"); static::assertCount(5, $response, "Incorrect channels count");
static::assertInstanceOf(Channel\Channel::class, $response[0], "Incorrect channel instance"); static::assertInstanceOf(Channel\Channel::class, $response[0], "Incorrect channel instance");
} }
@ -71,7 +71,7 @@ class ClientListTest extends TestCase
$response = $client->chats($request); $response = $client->chats($request);
static::assertCount(2, $response, "Incorrect chats count"); static::assertCount(3, $response, "Incorrect chats count");
static::assertInstanceOf(Chat::class, $response[0], "Incorrect chat instance"); static::assertInstanceOf(Chat::class, $response[0], "Incorrect chat instance");
} }
@ -112,7 +112,7 @@ class ClientListTest extends TestCase
$request = new Request\MembersRequest(); $request = new Request\MembersRequest();
$response = $client->members($request); $response = $client->members($request);
static::assertCount(4, $response, "Incorrect members count"); static::assertCount(5, $response, "Incorrect members count");
static::assertInstanceOf(ChatMember::class, $response[0], "Incorrect member instance"); static::assertInstanceOf(ChatMember::class, $response[0], "Incorrect member instance");
} }
@ -135,7 +135,7 @@ class ClientListTest extends TestCase
$response = $client->messages($request); $response = $client->messages($request);
static::assertCount(2, $response, "Incorrect message count"); static::assertCount(3, $response, "Incorrect message count");
static::assertInstanceOf(Message::class, $response[0], "Incorrect message instance"); static::assertInstanceOf(Message::class, $response[0], "Incorrect message instance");
} }
@ -177,7 +177,7 @@ class ClientListTest extends TestCase
$data = $client->bots($request); $data = $client->bots($request);
static::assertCount(3, $data); static::assertCount(4, $data);
} }
/** /**
@ -199,7 +199,7 @@ class ClientListTest extends TestCase
$response = $client->users($request); $response = $client->users($request);
self::assertCount(2, $response); self::assertCount(3, $response);
self::assertInstanceOf(User::class, $response[0]); self::assertInstanceOf(User::class, $response[0]);
} }
@ -222,7 +222,7 @@ class ClientListTest extends TestCase
$response = $client->dialogs($request); $response = $client->dialogs($request);
self::assertCount(2, $response); self::assertCount(3, $response);
self::assertInstanceOf(Dialog::class, $response[0]); self::assertInstanceOf(Dialog::class, $response[0]);
} }
@ -243,7 +243,7 @@ class ClientListTest extends TestCase
$response = $client->customers($request); $response = $client->customers($request);
self::assertCount(2, $response); self::assertCount(3, $response);
self::assertInstanceOf(Customer::class, $response[0]); self::assertInstanceOf(Customer::class, $response[0]);
} }
} }

View File

@ -42,5 +42,21 @@
"is_active": true, "is_active": true,
"is_self": false, "is_self": false,
"is_system": false "is_system": false
},
{
"id": 5,
"name": "Weird date formats bot",
"events": null,
"client_id": "identifier_4",
"avatar_url": "https://s3.retailcrm.pro/eu-central-1/retailcrm-billing/images/5b97bfd983d2b-bot-logo-2.svg",
"roles": [
"responsible"
],
"created_at": "2018-09-06T13:40:02Z",
"updated_at": "2018-09-12T06:15:32Z",
"deactivated_at": "2019-09-12T06:15:32Z",
"is_active": true,
"is_self": false,
"is_system": false
} }
] ]

View File

@ -174,5 +174,49 @@
"activated_at": "2019-06-11T12:33:08.676043Z", "activated_at": "2019-06-11T12:33:08.676043Z",
"deactivated_at": "2019-06-11T12:38:19.615335Z", "deactivated_at": "2019-06-11T12:38:19.615335Z",
"is_active": true "is_active": true
},
{
"id": 68,
"type": "telegram",
"name": "@oldtestbot",
"settings": {
"status": {
"delivered": "send"
},
"text": {
"creating": "both",
"editing": "both",
"quoting": "both",
"deleting": "receive",
"max_chars_count": 4096
},
"product": {
"creating": "receive",
"editing": "receive"
},
"order": {
"creating": "receive",
"editing": "receive"
},
"image": {
"creating": "both",
"editing": "both",
"quoting": "both",
"deleting": "receive",
"max_items_count": 10
},
"file": {
"creating": "both",
"editing": "both",
"quoting": "both",
"deleting": "receive",
"max_items_count": 1
}
},
"created_at": "2019-06-11T12:33:08Z",
"updated_at": "2019-06-11T12:38:19Z",
"activated_at": "2019-06-11T12:33:08Z",
"deactivated_at": "2019-06-11T12:38:19Z",
"is_active": false
} }
] ]

View File

@ -131,5 +131,77 @@
"last_activity": "2019-06-13T11:07:14+03:00", "last_activity": "2019-06-13T11:07:14+03:00",
"created_at": "2019-06-11T07:34:16.082957Z", "created_at": "2019-06-11T07:34:16.082957Z",
"updated_at": "2019-06-16T08:10:28.657972Z" "updated_at": "2019-06-16T08:10:28.657972Z"
},
{
"id": 28,
"avatar": "",
"name": "",
"channel": {
"id": 61,
"avatar": "",
"transport_id": 1,
"type": "fbmessenger",
"settings": {
"status": {
"delivered": "send",
"read": "send"
},
"text": {
"creating": "both",
"quoting": "receive",
"max_chars_count": 2000
},
"product": {
"creating": "receive"
},
"order": {
"creating": "receive"
},
"image": {
"creating": "both",
"max_items_count": 10
},
"file": {
"creating": "both",
"max_items_count": 10
}
},
"name": "testbot",
"is_active": false
},
"members": null,
"customer": {
"id": 38,
"type": "customer",
"avatar": "",
"name": "Пётр Петрович",
"username": "Пётр",
"first_name": "Пётр",
"last_name": "Петрович"
},
"author_id": 0,
"last_message": {
"id": 1,
"time": "2022-12-21T17:15:54+01:00",
"type": "command",
"scope": "private",
"chat_id": 1053,
"is_read": false,
"is_edit": false,
"status": "received",
"from": {
"id": 2,
"external_id": "12",
"type": "user",
"avatar": null,
"name": "Cuenta Soporte",
"first_name": "Cuenta",
"last_name": "Soporte",
"is_technical_account": true
}
},
"last_activity": "2019-06-13T11:07:14+03:00",
"created_at": "2019-06-11T07:34:16Z",
"updated_at": "2019-06-16T08:10:28Z"
} }
] ]

View File

@ -30,5 +30,21 @@
"language": "ru", "language": "ru",
"phone": "", "phone": "",
"email": "" "email": ""
},
{
"id": 37,
"external_id": "2272664739519803",
"channel_id": 3,
"username": "user2",
"first_name": "User2",
"last_name": "Lastname2",
"created_at": "2019-06-11T07:34:16Z",
"updated_at": "2019-06-13T08:07:14Z",
"avatar_url": "",
"profile_url": "",
"country": "",
"language": "ru",
"phone": "",
"email": ""
} }
] ]

View File

@ -30,5 +30,21 @@
"assigned_at": "2019-06-11T08:40:14.136916Z" "assigned_at": "2019-06-11T08:40:14.136916Z"
}, },
"is_active": true "is_active": true
},
{
"id": 58,
"chat_id": 28,
"begin_message_id": 1,
"ending_message_id": 30,
"created_at": "2019-06-11T07:34:16Z",
"updated_at": "2019-06-16T08:10:28Z",
"closed_at": "2019-06-16T08:10:28Z",
"is_assigned": true,
"responsible": {
"type": "user",
"id": 12,
"assigned_at": "2019-06-11T08:40:14Z"
},
"is_active": true
} }
] ]

View File

@ -34,5 +34,14 @@
"state": "kicked", "state": "kicked",
"chat_id": 29, "chat_id": 29,
"user_id": 4 "user_id": 4
},
{
"id": 46,
"created_at": "2019-06-11T07:34:16Z",
"updated_at": "2019-06-11T08:40:14Z",
"is_author": false,
"state": "kicked",
"chat_id": 29,
"user_id": 4
} }
] ]

View File

@ -44,5 +44,28 @@
"channel_id": 61, "channel_id": 61,
"created_at": "2019-05-20T12:24:52.478633Z", "created_at": "2019-05-20T12:24:52.478633Z",
"updated_at": "2019-05-20T12:24:52.585284Z" "updated_at": "2019-05-20T12:24:52.585284Z"
},
{
"id": 3372,
"time": "2019-05-20T15:24:52+03:00",
"type": "text",
"scope": "public",
"chat_id": 26,
"is_read": false,
"is_edit": false,
"status": "seen",
"from": {
"id": 35,
"type": "customer",
"avatar": "",
"name": "Иванов Иван",
"username": "username",
"first_name": "Иванов Иван"
},
"content": "❤️",
"quote": null,
"channel_id": 61,
"created_at": "2019-05-20T12:24:52Z",
"updated_at": "2019-05-20T12:24:52Z"
} }
] ]

View File

@ -19,5 +19,15 @@
"updated_at": "2019-06-07T11:36:52.342065Z", "updated_at": "2019-06-07T11:36:52.342065Z",
"is_online": false, "is_online": false,
"is_active": true "is_active": true
},
{
"id": 3,
"external_id": "33",
"username": "User 3",
"first_name": "User",
"created_at": "2018-09-06T13:19:25Z",
"updated_at": "2019-06-07T11:36:52Z",
"is_online": false,
"is_active": true
} }
] ]