Overview
  • Namespace
  • Class

Namespaces

  • MailChimp
    • AuthorizedApps
    • Automations
    • Batches
    • CampaignFolders
    • Campaigns
    • Conversations
    • Ecommerce
    • FileManager
    • Lists
    • Reports
    • TemplateFolders
    • Templates

Classes

  • MailChimp\AuthorizedApps\AuthorizedApps
  • MailChimp\Automations\Automations
  • MailChimp\Batches\Batches
  • MailChimp\CampaignFolders\CampaignFolders
  • MailChimp\Campaigns\Campaigns
  • MailChimp\Campaigns\Content
  • MailChimp\Campaigns\Feedback
  • MailChimp\Conversations\Conversations
  • MailChimp\Ecommerce\Carts
  • MailChimp\Ecommerce\Customers
  • MailChimp\Ecommerce\Ecommerce
  • MailChimp\Ecommerce\Orders
  • MailChimp\Ecommerce\Products
  • MailChimp\FileManager\Files
  • MailChimp\FileManager\Folders
  • MailChimp\Lists\Interests
  • MailChimp\Lists\Lists
  • MailChimp\Lists\Members
  • MailChimp\Lists\MergeFields
  • MailChimp\Lists\Segments
  • MailChimp\Lists\SignupForms
  • MailChimp\Lists\Webhooks
  • MailChimp\MailChimp
  • MailChimp\Reports\Reports
  • MailChimp\TemplateFolders\TemplateFolders
  • MailChimp\Templates\Templates
 1 <?php
 2 
 3 namespace MailChimp\FileManager;
 4 
 5 use MailChimp\MailChimp as MailChimp;
 6 
 7 class Files extends MailChimp
 8 {
 9 
10     /**
11      * Get a list of available images and files stored in the File Manager for the account.
12      *
13      * Available query fields:
14      * array["fields"]              array       list of strings of response fields to return
15      * array["exclude_fields"]      array       list of strings of response fields to exclude (not to be used with "fields")
16      * array["count"]               int         number of records to return
17      * array["offset"]              int         number of records from a collection to skip.
18      * array["folder_id"]           int         Filter results by a specific campaign folder.
19      * array["created_by"]          string      The MailChimp account user who created the File Manager file.
20      * array["type"]                string      The file type for the File Manager file
21      *                                          Possible values: image,file
22      * array["before_created_at"]   string      Restrict the response to files created before the set date
23      *                                          ISO 8601 time format: 2015-10-21T15:41:36+00:00.
24      * array["since_created_at"]    string      Restrict the response to files created after the set date.
25      *                                          ISO 8601 time format: 2015-10-21T15:41:36+00:00.
26      * array["sort_field"]          string      Returns files sorted by the specified field.
27      * array["sort_dir"]            string      Determines the order direction for sorted results.
28      *
29      * @param array $query (See Above) OPTIONAL associative array of query parameters.
30      * @return object
31      */
32     public function getFiles(array $query = [])
33     {
34         return self::execute("GET", "file-manager/files", $query);
35     }
36 
37     /**
38      * Get information about a specific file in the File Manager.
39      *
40      * Available query fields:
41      * array["fields"]              array       list of strings of response fields to return
42      * array["exclude_fields"]      array       list of strings of response fields to exclude (not to be used with "fields")
43      *
44      * @param int file_id
45      * @param array $query (See Above) OPTIONAL associative array of query parameters.
46      * @return object
47      */
48     public function getFile($file_id, array $query = [])
49     {
50         return self::execute("GET", "file-manager/files/{$file_id}", $query);
51     }
52 
53     /**
54      * Upload a new image or file to the File Manager.
55      *
56      * @param string $name
57      * @param string $file_data
58      * @param int   (optional) $folder_id
59      * @return object
60      */
61     public function uploadFile($name, $file_data, $folder_id = null)
62     {
63         $data = [
64             "name" => $name,
65             "file_data" => $file_data
66         ];
67 
68         if ($folder_id) {
69             $data["folder_id"] = $folder_id;
70         }
71 
72         return self::execute("POST", "file-manager/files", $data);
73     }
74 
75     /**
76      * Update a file in the File Manager.
77      *
78      * @param string file_id
79      * @param array $data
80      */
81     public function updateFile($file_id, array $data = [])
82     {
83         return self::execute("PATCH", "file-manager/files/{$file_id}", $data);
84     }
85 
86     /**
87      * Remove a specific file from the File Manager.
88      *
89      * @param int file_id
90      */
91     public function deleteFile($file_id)
92     {
93         return self::execute("DELETE", "file-manager/files/{$file_id}");
94     }
95 
96 }
97 
API documentation generated by ApiGen