@@ -522,7 +522,7 @@ public function getMobileAppPhotos($mobileAppId)
522522
523523 /**
524524 * Method to return all active brands for a studio.
525- *
525+ *
526526 * @return array
527527 */
528528 public function getBrands ()
@@ -536,7 +536,7 @@ public function getBrands()
536536
537537 /**
538538 * Method to return data on a single brand.
539- *
539+ *
540540 * @param integer $brandId Brand ID to retrieve for.
541541 * @return array
542542 */
@@ -550,6 +550,154 @@ public function getBrandInfo($brandId)
550550 return $ this ->_makeApiRequest ($ params );
551551 }
552552
553+ /**
554+ * Method to return data on a single contact.
555+ *
556+ * @param integer $contactId Contact ID to retrieve for.
557+ * @return array
558+ */
559+ public function getContactInfo ($ contactId )
560+ {
561+ $ params = array (
562+ 'method ' => 'sp.contact.info ' ,
563+ 'contact_id ' => $ contactId
564+ );
565+
566+ return $ this ->_makeApiRequest ($ params );
567+ }
568+
569+ /**
570+ * Method to create a new contact.
571+ *
572+ * Supported key-value pairs:
573+ *
574+ * brand_id
575+ * first_name (required)
576+ * last_name
577+ * email (required)
578+ * phone
579+ * business_name
580+ * notes
581+ * tags (string of tags, separated by commas)
582+ * address (associative array)
583+ * address_1
584+ * address_2
585+ * city
586+ * state
587+ * state_other
588+ * country (required if address is provided)
589+ * zip_postal
590+ *
591+ * @param array $contactData Associative array of contact data.
592+ * @return array
593+ */
594+ public function createContact (array $ contactData )
595+ {
596+ $ params = array_merge (
597+ array (
598+ 'method ' => 'sp.contact.create '
599+ ),
600+ $ contactData
601+ );
602+
603+ return $ this ->_makeApiRequest ($ params );
604+ }
605+
606+ /**
607+ * Method to update a new contact.
608+ *
609+ * Supported key-value pairs:
610+ *
611+ * brand_id
612+ * first_name (required)
613+ * last_name
614+ * email (required)
615+ * phone
616+ * business_name
617+ * notes
618+ * tags (string of tags, separated by commas)
619+ * address (associative array, or null to remove)
620+ * address_1
621+ * address_2
622+ * city
623+ * state
624+ * state_other
625+ * country (required if address is provided)
626+ * zip_postal
627+ *
628+ * @param array $contactData Associative array of contact data.
629+ * @return array
630+ */
631+ public function updateContact ($ contactId , array $ contactData )
632+ {
633+ $ params = array_merge (
634+ array (
635+ 'method ' => 'sp.contact.create ' ,
636+ 'contact_id ' => $ contactId
637+ ),
638+ $ contactData
639+ );
640+
641+ return $ this ->_makeApiRequest ($ params );
642+ }
643+
644+ /**
645+ * Method to create a multiple contacts in bulk.
646+ *
647+ * Must be an array of associative arrays. The same key-value pauirs
648+ * in Sp_Api::createContact() are supported in the inner associative arrays.
649+ * Supported key-value pairs:
650+ *
651+ * brand_id
652+ * first_name (required)
653+ * last_name
654+ * email (required)
655+ * phone
656+ * business_name
657+ * notes
658+ * tags (string of tags, separated by commas)
659+ * address (associative array)
660+ * address_1
661+ * address_2
662+ * city
663+ * state
664+ * state_other
665+ * country (required if address is provided)
666+ * zip_postal
667+ *
668+ * @param array $contactData Array of associative arrays of contact data.
669+ * @return array
670+ */
671+ public function bulkCreateContacts (array $ contacts )
672+ {
673+ $ params = array (
674+ 'method ' => 'sp.contact.bulk_create ' ,
675+ 'contacts ' => $ contacts
676+ );
677+
678+ return $ this ->_makeApiRequest ($ params );
679+ }
680+
681+ /**
682+ * Method to delete a contact.
683+ *
684+ * @param integer $contactId
685+ * @return array
686+ */
687+ public function deleteContact ($ contactId )
688+ {
689+ if (is_null ($ contactId ) || $ contactId == '' ) {
690+ throw new Exception ('The contactId is required to delete a contact. ' );
691+ }
692+
693+ $ params = array (
694+ 'method ' => 'sp.contact.delete ' ,
695+ 'contact_id ' => $ contactId
696+ );
697+
698+ return $ this ->_makeApiRequest ($ params );
699+ }
700+
553701 /**
554702 * Method to get the accessToken
555703 *
0 commit comments