• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

podio-community / podio-php / 5155068956

pending completion
5155068956

push

github

daniel-sc
feat: isolated client class to allow for parallel usage + extension + mocking

BREAKING CHANGE: replace static Podio with instantiable PodioClient

648 of 648 new or added lines in 66 files covered. (100.0%)

917 of 2107 relevant lines covered (43.52%)

24.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/models/PodioContact.php
1
<?php
2
/**
3
 * @see https://developers.podio.com/doc/contacts
4
 */
5
class PodioContact extends PodioObject
6
{
7
    public function __construct(PodioClient $podio_client, $attributes = array())
8
    {
9
        parent::__construct($podio_client);
18✔
10
        $this->property('profile_id', 'integer');
18✔
11
        $this->property('user_id', 'integer');
18✔
12
        $this->property('name', 'string');
18✔
13
        $this->property('avatar', 'integer');
18✔
14
        $this->property('birthdate', 'date');
18✔
15
        $this->property('department', 'string');
18✔
16
        $this->property('vatin', 'string');
18✔
17
        $this->property('skype', 'string');
18✔
18
        $this->property('about', 'string');
18✔
19
        $this->property('address', 'array');
18✔
20
        $this->property('zip', 'string');
18✔
21
        $this->property('city', 'string');
18✔
22
        $this->property('country', 'string');
18✔
23
        $this->property('state', 'string');
18✔
24
        $this->property('im', 'array');
18✔
25
        $this->property('location', 'array');
18✔
26
        $this->property('mail', 'array');
18✔
27
        $this->property('phone', 'array');
18✔
28
        $this->property('title', 'array');
18✔
29
        $this->property('url', 'array');
18✔
30
        $this->property('skill', 'array');
18✔
31
        $this->property('linkedin', 'string');
18✔
32
        $this->property('twitter', 'string');
18✔
33
        $this->property('organization', 'string');
18✔
34
        $this->property('type', 'string');
18✔
35
        $this->property('space_id', 'integer');
18✔
36
        $this->property('link', 'string');
18✔
37
        $this->property('rights', 'array');
18✔
38

39
        $this->property('app_store_about', 'string');
18✔
40
        $this->property('app_store_organization', 'string');
18✔
41
        $this->property('app_store_location', 'string');
18✔
42
        $this->property('app_store_title', 'string');
18✔
43
        $this->property('app_store_url', 'string');
18✔
44

45
        $this->property('last_seen_on', 'datetime');
18✔
46
        $this->property('is_employee', 'boolean');
18✔
47

48
        // Only available for space contacts
49
        $this->property('role', 'integer');
18✔
50
        $this->property('removable', 'boolean');
18✔
51

52
        $this->has_one('image', 'File');
18✔
53

54
        $this->init($attributes);
18✔
55
    }
56

57
    /**
58
     * @see https://developers.podio.com/doc/contacts/create-space-contact-65590
59
     */
60
    public static function create($space_id, $attributes = array(), PodioClient $podio_client)
61
    {
62
        $body = $podio_client->post("/contact/space/{$space_id}/", $attributes)->json_body();
×
63
        return $body['profile_id'];
×
64
    }
65

66
    /**
67
     * @see https://developers.podio.com/doc/contacts/delete-contact-s-60560
68
     */
69
    public static function delete($profile_ids, PodioClient $podio_client)
70
    {
71
        return $podio_client->delete("/contact/{$profile_ids}");
×
72
    }
73

74
    /**
75
     * @see https://developers.podio.com/doc/contacts/get-user-contact-field-22403
76
     */
77
    public static function get_field_for_user($user_id, $key, PodioClient $podio_client)
78
    {
79
        return $podio_client->get("/contact/user/{$user_id}/{$key}")->json_body();
×
80
    }
81

82
    /**
83
     * @see https://developers.podio.com/doc/contacts/get-contact-totals-60467
84
     */
85
    public static function get_totals(PodioClient $podio_client)
86
    {
87
        return $podio_client->get("/contact/totals/")->json_body();
×
88
    }
89

90
    /**
91
     * @see https://developers.podio.com/doc/contacts/get-contact-totals-v3-34629208
92
     */
93
    public static function get_totals_v3(PodioClient $podio_client)
94
    {
95
        return $podio_client->get("/contact/totals/v3/")->json_body();
×
96
    }
97

98
    /**
99
     * @see https://developers.podio.com/doc/contacts/get-space-contact-totals-67508
100
     */
101
    public static function get_totals_for_space($space_id, PodioClient $podio_client)
102
    {
103
        return $podio_client->get("/contact/space/{$space_id}/totals/")->json_body();
×
104
    }
105

106
    /**
107
     * @see https://developers.podio.com/doc/contacts/get-contact-s-22335
108
     */
109
    public static function get($profile_ids, $attributes = array(), PodioClient $podio_client)
110
    {
111
        $result = $podio_client->get("/contact/{$profile_ids}/v2", $attributes);
×
112
        if (is_array($result->json_body())) {
×
113
            return self::listing($result, $podio_client);
×
114
        }
115
        return self::member($result, $podio_client);
×
116
    }
117

118
    /**
119
     * @see https://developers.podio.com/doc/contacts/get-vcard-213496
120
     */
121
    public static function vcard($profile_id, PodioClient $podio_client)
122
    {
123
        return $podio_client->get("/contact/{$profile_id}/vcard")->body;
×
124
    }
125

126
    /**
127
     * @see https://developers.podio.com/doc/contacts/get-user-contact-60514
128
     */
129
    public static function get_for_user($user_id, PodioClient $podio_client)
130
    {
131
        return self::member($podio_client->get("/contact/user/{$user_id}"), $podio_client);
×
132
    }
133

134
    /**
135
     * @see https://developers.podio.com/doc/contacts/get-contacts-22400
136
     */
137
    public static function get_all($attributes = array(), PodioClient $podio_client)
138
    {
139
        return self::listing($podio_client->get("/contact/", $attributes), $podio_client);
×
140
    }
141

142
    /**
143
     * @see https://developers.podio.com/doc/contacts/get-organization-contacts-22401
144
     */
145
    public static function get_for_org($org_id, $attributes = array(), PodioClient $podio_client)
146
    {
147
        return self::listing($podio_client->get("/contact/org/{$org_id}", $attributes), $podio_client);
×
148
    }
149

150
    /**
151
     * @see https://developers.podio.com/doc/contacts/get-space-contacts-22414
152
     */
153
    public static function get_for_space($space_id, $attributes = array(), PodioClient $podio_client)
154
    {
155
        return self::listing($podio_client->get("/contact/space/{$space_id}/", $attributes), $podio_client);
×
156
    }
157

158
    /**
159
     * @see https://developers.podio.com/doc/contacts/get-space-contacts-on-app-79475279
160
     */
161
    public static function get_for_app($app_id, $attributes = array(), PodioClient $podio_client)
162
    {
163
        return self::listing($podio_client->get("/contact/app/{$app_id}/", $attributes), $podio_client);
×
164
    }
165

166
    /**
167
     * @see https://developers.podio.com/doc/contacts/get-skills-1346872
168
     */
169
    public static function get_skills($attributes = array(), PodioClient $podio_client)
170
    {
171
        return $podio_client->get("/contact/skill/", $attributes)->json_body();
×
172
    }
173

174
    /**
175
     * @see https://developers.podio.com/doc/contacts/update-contact-60556
176
     */
177
    public static function update($profile_id, $attributes = array(), PodioClient $podio_client)
178
    {
179
        return $podio_client->put("/contact/{$profile_id}", $attributes);
×
180
    }
181

182
    /**
183
     * @see https://developers.podio.com/doc/contacts/update-contact-field-60558
184
     */
185
    public static function update_field($profile_id, $key, $attributes = array(), PodioClient $podio_client)
186
    {
187
        return $podio_client->put("/contact/{$profile_id}/{$key}", $attributes);
×
188
    }
189
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc