1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Created for IG Client. |
4
|
|
|
* User: jakim <[email protected]> |
5
|
|
|
* Date: 23.03.2018 |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace Jakim\Mapper; |
9
|
|
|
|
10
|
|
|
|
11
|
|
|
use Jakim\Base\Mapper; |
12
|
|
|
use Jakim\Model\Account; |
13
|
|
|
use Jakim\Model\Location; |
14
|
|
|
use Jakim\Model\Post; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Specific media mapper. |
18
|
|
|
* |
19
|
|
|
* @package Jakim\Mapper |
20
|
|
|
*/ |
21
|
|
|
class MediaDetails extends Mapper |
22
|
|
|
{ |
23
|
|
|
public function config(): array |
24
|
|
|
{ |
25
|
|
|
return [ |
26
|
|
|
'class' => Post::class, |
27
|
|
|
'envelope' => 'graphql.shortcode_media', |
28
|
|
|
'properties' => [ |
29
|
|
|
'id' => 'id', |
30
|
|
|
'shortcode' => 'shortcode', |
31
|
|
|
'url' => 'display_url', |
32
|
|
|
'caption' => 'edge_media_to_caption.edges.0.node.text', |
33
|
|
|
'likes' => 'edge_media_preview_like.count', |
34
|
|
|
'comments' => 'edge_media_preview_comment.count', |
35
|
|
|
'takenAt' => 'taken_at_timestamp', |
36
|
|
|
'isVideo' => 'is_video', |
37
|
|
|
'videoViews' => 'video_view_count', |
38
|
|
|
'videoUrl' => 'video_url', |
39
|
|
|
'typename' => '__typename', |
40
|
|
|
'accessibilityCaption' => 'accessibility_caption', |
41
|
|
|
], |
42
|
|
|
'relations' => [ |
43
|
|
|
'account' => [ |
44
|
|
|
'class' => Account::class, |
45
|
|
|
'envelope' => 'owner', //related to parent map |
46
|
|
|
'properties' => [ |
47
|
|
|
'id' => 'id', |
48
|
|
|
'username' => 'username', |
49
|
|
|
'profilePicUrl' => 'profile_pic_url', |
50
|
|
|
'fullName' => 'full_name', |
51
|
|
|
'isPrivate' => 'is_private', |
52
|
|
|
], |
53
|
|
|
], |
54
|
|
|
'location' => [ |
55
|
|
|
'class' => Location::class, |
56
|
|
|
'envelope' => 'location', |
57
|
|
|
'properties' => [ |
58
|
|
|
'id' => 'id', |
59
|
|
|
'hasPublicPage' => 'has_public_page', |
60
|
|
|
'name' => 'name', |
61
|
|
|
'slug' => 'slug', |
62
|
|
|
'addressJson' => 'address_json', |
63
|
|
|
], |
64
|
|
|
], |
65
|
|
|
'sponsor' => [ |
66
|
|
|
'class' => Account::class, |
67
|
|
|
'envelope' => 'edge_media_to_sponsor_user.edges.0.node.sponsor', //related to parent map |
68
|
|
|
'properties' => [ |
69
|
|
|
'id' => 'id', |
70
|
|
|
'username' => 'username', |
71
|
|
|
], |
72
|
|
|
], |
73
|
|
|
'tagged' => [ |
74
|
|
|
'multiple' => true, |
75
|
|
|
'class' => Account::class, |
76
|
|
|
'envelope' => 'edge_media_to_tagged_user.edges', |
77
|
|
|
'properties' => [ |
78
|
|
|
'id' => 'node.user.id', |
79
|
|
|
'username' => 'node.user.username', |
80
|
|
|
'profilePicUrl' => 'node.user.profile_pic_url', |
81
|
|
|
'fullName' => 'node.user.full_name', |
82
|
|
|
'isVerified' => 'node.user.is_verified', |
83
|
|
|
], |
84
|
|
|
], |
85
|
|
|
], |
86
|
|
|
]; |
87
|
|
|
} |
88
|
|
|
} |