@@ -1598,4 +1598,50 @@ private function _changeObjectAttachmentsorder($aArgs)
1598
1598
$ req ->unset_parameter ('username ' );
1599
1599
return parent ::getContent ($ req ,$ sSecret );
1600
1600
}
1601
+
1602
+ /**
1603
+ * Attachment(Meta)daten ändern
1604
+ * Nur Infos über Bild und nicht binären Daten
1605
+ *
1606
+ * @param array $aArgs
1607
+ * @return mixed
1608
+ */
1609
+ private function _changeObjectAttachment ($ aArgs )
1610
+ {
1611
+ $ aRequired = array ('username ' ,'estateid ' ,'attachmentid ' ,'type ' );
1612
+ if (!isset ($ aArgs ['username ' ]))
1613
+ {
1614
+ $ aArgs ['username ' ] = $ this ->_sDefaultUsername ;
1615
+ }
1616
+ // create body for different attachment types
1617
+ $ sBreak = "\r\n" ;
1618
+ $ sBody = '<common:attachment xsi:type="common: ' .$ aArgs ['type ' ]. '" xmlns:common="http://rest.immobilienscout24.de/schema/common/1.0" xmlns:ns3="http://rest.immobilienscout24.de/schema/platform/gis/1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> ' . $ sBreak ;
1619
+ $ sBody .= '<title> ' .$ aArgs ['title ' ]. '</title> ' . $ sBreak ;
1620
+ $ sBody .= '<externalId> ' .$ aArgs ['externalId ' ]. '</externalId> ' . $ sBreak ;
1621
+ if ($ aArgs ['type ' ] == 'Picture ' or $ aArgs ['type ' ] == 'PDFDocument ' ) {
1622
+ $ sBody .= '<floorplan> ' .$ aArgs ['floorplan ' ]. '</floorplan> ' . $ sBreak ;
1623
+ }
1624
+ if ($ aArgs ['type ' ] == 'Picture ' ) {
1625
+ $ sBody .= '<titlePicture> ' .$ aArgs ['titlePicture ' ]. '</titlePicture> ' . $ sBreak ;
1626
+ }
1627
+ if ($ aArgs ['type ' ] == 'Link ' ) {
1628
+ $ sBody .= '<url> ' .$ aArgs ['url ' ]. '</url> ' . $ sBreak ;
1629
+ }
1630
+ $ sBody .= '</common:attachment> ' ;
1631
+ $ aArgs ['request_body ' ] = $ sBody ;
1632
+
1633
+ $ oToken = null ;
1634
+ $ sSecret = null ;
1635
+ list ($ oToken , $ sSecret ) = $ this ->getApplicationTokenAndSecret ($ aArgs ['username ' ]);
1636
+ if ($ oToken === NULL || $ sSecret === NULL )
1637
+ {
1638
+ return IMMOCASTER_SDK_LANG_APPLICATION_NOT_CERTIFIED ;
1639
+ }
1640
+ $ req = $ this ->doRequest ('offer/v1.0/user/ ' .$ aArgs ['username ' ].'/realestate/ ' .$ aArgs ['estateid ' ].'/attachment/ ' .$ aArgs ['attachmentid ' ],$ aArgs ,$ aRequired ,__FUNCTION__ ,$ oToken ,'PUT ' );
1641
+ $ req ->unset_parameter ('estateid ' );
1642
+ $ req ->unset_parameter ('username ' );
1643
+ $ req ->unset_parameter ('attachmentid ' );
1644
+ $ req ->unset_parameter ('type ' );
1645
+ return parent ::getContent ($ req ,$ sSecret );
1646
+ }
1601
1647
}
0 commit comments