summaryrefslogtreecommitdiff
path: root/Postman/Postman-Mail/mailchimp-mandrill-api-php-da3adc10042e/src/Mandrill/Metadata.php
blob: ca681e90ab6c84cfc96fda6947c409f3d41320e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php

class Postman_Mandrill_Metadata {
    public function __construct(Postman_Mandrill $master) {
        $this->master = $master;
    }

    /**
     * Get the list of custom metadata fields indexed for the account.
     * @return array the custom metadata fields for the account
     *     - return[] struct the individual custom metadata field info
     *         - name string the unique identifier of the metadata field to update
     *         - state string the current state of the metadata field, one of "active", "delete", or "index"
     *         - view_template string Mustache template to control how the metadata is rendered in your activity log
     */
    public function getList() {
        $_params = array();
        return $this->master->call('metadata/list', $_params);
    }

    /**
     * Add a new custom metadata field to be indexed for the account.
     * @param string $name a unique identifier for the metadata field
     * @param string $view_template optional Mustache template to control how the metadata is rendered in your activity log
     * @return struct the information saved about the new metadata field
     *     - name string the unique identifier of the metadata field to update
     *     - state string the current state of the metadata field, one of "active", "delete", or "index"
     *     - view_template string Mustache template to control how the metadata is rendered in your activity log
     */
    public function add($name, $view_template=null) {
        $_params = array("name" => $name, "view_template" => $view_template);
        return $this->master->call('metadata/add', $_params);
    }

    /**
     * Update an existing custom metadata field.
     * @param string $name the unique identifier of the metadata field to update
     * @param string $view_template optional Mustache template to control how the metadata is rendered in your activity log
     * @return struct the information for the updated metadata field
     *     - name string the unique identifier of the metadata field to update
     *     - state string the current state of the metadata field, one of "active", "delete", or "index"
     *     - view_template string Mustache template to control how the metadata is rendered in your activity log
     */
    public function update($name, $view_template) {
        $_params = array("name" => $name, "view_template" => $view_template);
        return $this->master->call('metadata/update', $_params);
    }

    /**
     * Delete an existing custom metadata field. Deletion isn't instataneous, and /metadata/list will continue to return the field until the asynchronous deletion process is complete.
     * @param string $name the unique identifier of the metadata field to update
     * @return struct the information for the deleted metadata field
     *     - name string the unique identifier of the metadata field to update
     *     - state string the current state of the metadata field, one of "active", "delete", or "index"
     *     - view_template string Mustache template to control how the metadata is rendered in your activity log
     */
    public function delete($name) {
        $_params = array("name" => $name);
        return $this->master->call('metadata/delete', $_params);
    }

}