diff --git a/.phpunit.result.cache b/.phpunit.result.cache index 0f9cfd9..7e127d9 100644 --- a/.phpunit.result.cache +++ b/.phpunit.result.cache @@ -1 +1 @@ -C:37:"PHPUnit\Runner\DefaultTestResultCache":7423:{a:2:{s:7:"defects";a:60:{s:40:"ClientTest::testConstantsAreCorrectlySet";i:4;s:34:"ClientTest::testQueryUrlCanBeBuilt";i:4;s:31:"ClientTest::testOneTypeCanBeSet";i:4;s:36:"ClientTest::testUpToSixTypesCanBeSet";i:4;s:33:"ClientTest::testTypeCannotBeEmpty";i:4;s:37:"ClientTest::testPromotionTypeCanBeSet";i:4;s:34:"ClientTest::testPriceRangeCanBeSet";i:4;s:36:"ClientTest::testSurfaceRangeCanBeSet";i:4;s:33:"ClientTest::testRoomRangeCanBeSet";i:4;s:50:"ClientTest::testRangeTypeCanOnlyBeOfPredefinedType";i:4;s:57:"ClientTest::testRangeCannotHaveMaxValueHigherThanMinValue";i:4;s:30:"ClientTest::testCityIdCanBeSet";i:4;s:32:"ClientTest::testDistanceCanBeSet";i:4;s:30:"ClientTest::testRegionCanBeSet";i:4;s:26:"ClientTest::testIdCanBeSet";i:4;s:36:"ClientTest::testSearchStringCanBeSet";i:4;s:31:"ClientTest::testCountryCanBeSet";i:4;s:48:"ClientTest::testCountryCharactersLengthMustBeTwo";i:4;s:28:"ClientTest::testCityCanBeSet";i:4;s:35:"ClientTest::testTransactionCanBeSet";i:4;s:53:"ClientTest::testTransactionCanOnlyBeOfPredefinedTypes";i:4;s:32:"ClientTest::testSelfOnlyCanBeSet";i:4;s:28:"ClientTest::testSortCanBeSet";i:4;s:46:"ClientTest::testSortCanOnlyBeOfPredefinedTypes";i:4;s:37:"ClientTest::testSortDirectionCanBeSet";i:4;s:54:"ClientTest::testSortDirectionCanOnlyBeOfPredefinedType";i:4;s:32:"ClientTest::testLanguageCanBeSet";i:4;s:49:"ClientTest::testLanguageCanOnlyBeOfPredefinedType";i:4;s:27:"ClientTest::testIdsCanBeSet";i:4;s:32:"ClientTest::testIdsCannotBeEmpty";i:4;s:34:"ClientTest::testCourtierIdCanBeSet";i:4;s:34:"ClientTest::testForeignersCanBeSet";i:4;s:36:"ClientTest::testDisponibliteCanBeSet";i:4;s:54:"ClientTest::testDisponibliteCanOnlyBeOfPredefinedTypes";i:4;s:43:"ClientTest::testResidenceSecondaireCanBeSet";i:4;s:36:"ClientTest::testLocationTypeCanBeSet";i:4;s:54:"ClientTest::testLocationTypeCanOnlyBeOfPredefinedTypes";i:4;s:32:"ClientTest::testNpaOrderCanBeSet";i:4;s:40:"MailerTest::testConstantsAreCorrectlySet";i:5;s:46:"ObjectCollectionTest::testGetTotalReturnsTotal";i:4;s:43:"ObjectCollectionTest::testGetReturnsResults";i:4;s:67:"ObjectCollectionTest::testInclusiveFilterReturnsOnlyIncludedObjects";i:4;s:69:"ObjectCollectionTest::testExclusiveFilterDoesNotReturnExcludedObjects";i:4;s:53:"ObjectCollectionTest::testSortDescUsingOneInstruction";i:4;s:52:"ObjectCollectionTest::testSortAscUsingOneInstruction";i:4;s:55:"ObjectCollectionTest::testSortUsingMultipleInstructions";i:4;s:59:"ObjectCollectionTest::testSortUsingWrongOrderRaiseException";i:4;s:42:"ObjectEntityTest::testRawReturnsSameObject";i:4;s:41:"ObjectEntityTest::testObjectIsFromNetwork";i:4;s:39:"ObjectEntityTest::testObjectIsPromotion";i:4;s:28:"ObjectEntityTest::testIsType";i:4;s:61:"ObjectEntityTest::testIsTypeArgumentCanOnlyBeOfPredefinedType";i:4;s:33:"MailerTest::testClassCanConstruct";i:5;s:52:"MailerTest::testMissingRequiredFieldRaiseAnException";i:4;s:43:"MailerTest::testCaseMandatoryFieldsProvider";i:5;s:7:"Warning";i:6;s:21:"MailerTest::testMIaou";i:5;s:44:"MailerTest::testInvalidEmailRaiseAnException";i:3;s:45:"MailerTest::testEmailBodyIsGeneratedCorrectly";i:3;s:75:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set "title"";i:4;}s:5:"times";a:72:{s:40:"ClientTest::testConstantsAreCorrectlySet";d:0.001;s:34:"ClientTest::testQueryUrlCanBeBuilt";d:0;s:31:"ClientTest::testOneTypeCanBeSet";d:0;s:36:"ClientTest::testUpToSixTypesCanBeSet";d:0;s:33:"ClientTest::testTypeCannotBeEmpty";d:0;s:37:"ClientTest::testPromotionTypeCanBeSet";d:0;s:34:"ClientTest::testPriceRangeCanBeSet";d:0;s:36:"ClientTest::testSurfaceRangeCanBeSet";d:0;s:33:"ClientTest::testRoomRangeCanBeSet";d:0;s:50:"ClientTest::testRangeTypeCanOnlyBeOfPredefinedType";d:0;s:57:"ClientTest::testRangeCannotHaveMaxValueHigherThanMinValue";d:0;s:30:"ClientTest::testCityIdCanBeSet";d:0;s:32:"ClientTest::testDistanceCanBeSet";d:0;s:30:"ClientTest::testRegionCanBeSet";d:0;s:26:"ClientTest::testIdCanBeSet";d:0;s:36:"ClientTest::testSearchStringCanBeSet";d:0;s:31:"ClientTest::testCountryCanBeSet";d:0;s:48:"ClientTest::testCountryCharactersLengthMustBeTwo";d:0;s:28:"ClientTest::testCityCanBeSet";d:0;s:35:"ClientTest::testTransactionCanBeSet";d:0;s:53:"ClientTest::testTransactionCanOnlyBeOfPredefinedTypes";d:0;s:32:"ClientTest::testSelfOnlyCanBeSet";d:0;s:28:"ClientTest::testSortCanBeSet";d:0;s:46:"ClientTest::testSortCanOnlyBeOfPredefinedTypes";d:0;s:37:"ClientTest::testSortDirectionCanBeSet";d:0;s:54:"ClientTest::testSortDirectionCanOnlyBeOfPredefinedType";d:0;s:32:"ClientTest::testLanguageCanBeSet";d:0;s:49:"ClientTest::testLanguageCanOnlyBeOfPredefinedType";d:0;s:27:"ClientTest::testIdsCanBeSet";d:0;s:32:"ClientTest::testIdsCannotBeEmpty";d:0;s:34:"ClientTest::testCourtierIdCanBeSet";d:0;s:34:"ClientTest::testForeignersCanBeSet";d:0;s:36:"ClientTest::testDisponibliteCanBeSet";d:0;s:54:"ClientTest::testDisponibliteCanOnlyBeOfPredefinedTypes";d:0;s:43:"ClientTest::testResidenceSecondaireCanBeSet";d:0;s:36:"ClientTest::testLocationTypeCanBeSet";d:0;s:54:"ClientTest::testLocationTypeCanOnlyBeOfPredefinedTypes";d:0;s:32:"ClientTest::testNpaOrderCanBeSet";d:0;s:40:"MailerTest::testConstantsAreCorrectlySet";d:0;s:46:"ObjectCollectionTest::testGetTotalReturnsTotal";d:0.004;s:43:"ObjectCollectionTest::testGetReturnsResults";d:0.003;s:67:"ObjectCollectionTest::testInclusiveFilterReturnsOnlyIncludedObjects";d:0.003;s:69:"ObjectCollectionTest::testExclusiveFilterDoesNotReturnExcludedObjects";d:0.003;s:53:"ObjectCollectionTest::testSortDescUsingOneInstruction";d:0.007;s:52:"ObjectCollectionTest::testSortAscUsingOneInstruction";d:0.007;s:55:"ObjectCollectionTest::testSortUsingMultipleInstructions";d:0.008;s:59:"ObjectCollectionTest::testSortUsingWrongOrderRaiseException";d:0.003;s:42:"ObjectEntityTest::testRawReturnsSameObject";d:0;s:41:"ObjectEntityTest::testObjectIsFromNetwork";d:0;s:39:"ObjectEntityTest::testObjectIsPromotion";d:0;s:28:"ObjectEntityTest::testIsType";d:0;s:61:"ObjectEntityTest::testIsTypeArgumentCanOnlyBeOfPredefinedType";d:0;s:33:"MailerTest::testClassCanConstruct";d:0.001;s:52:"MailerTest::testMissingRequiredFieldRaiseAnException";d:0;s:48:"MailerTest::testMissingUserTitleRaiseAnException";d:0;s:43:"MailerTest::testCaseMandatoryFieldsProvider";d:0.001;s:7:"Warning";d:0;s:21:"MailerTest::testMIaou";d:0.001;s:70:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set #0";d:0;s:70:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set #1";d:0;s:70:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set #2";d:0;s:70:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set #3";d:0;s:70:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set #4";d:0;s:70:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set #5";d:0;s:75:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set "title"";d:0.001;s:78:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set "lastname"";d:0;s:79:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set "firstname"";d:0;s:75:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set "email"";d:0;s:75:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set "phone"";d:0;s:78:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set "language"";d:0;s:44:"MailerTest::testInvalidEmailRaiseAnException";d:0;s:45:"MailerTest::testEmailBodyIsGeneratedCorrectly";d:0;}}} \ No newline at end of file +C:37:"PHPUnit\Runner\DefaultTestResultCache":7513:{a:2:{s:7:"defects";a:61:{s:40:"ClientTest::testConstantsAreCorrectlySet";i:4;s:34:"ClientTest::testQueryUrlCanBeBuilt";i:4;s:31:"ClientTest::testOneTypeCanBeSet";i:4;s:36:"ClientTest::testUpToSixTypesCanBeSet";i:4;s:33:"ClientTest::testTypeCannotBeEmpty";i:4;s:37:"ClientTest::testPromotionTypeCanBeSet";i:4;s:34:"ClientTest::testPriceRangeCanBeSet";i:4;s:36:"ClientTest::testSurfaceRangeCanBeSet";i:4;s:33:"ClientTest::testRoomRangeCanBeSet";i:4;s:50:"ClientTest::testRangeTypeCanOnlyBeOfPredefinedType";i:4;s:57:"ClientTest::testRangeCannotHaveMaxValueHigherThanMinValue";i:4;s:30:"ClientTest::testCityIdCanBeSet";i:4;s:32:"ClientTest::testDistanceCanBeSet";i:4;s:30:"ClientTest::testRegionCanBeSet";i:4;s:26:"ClientTest::testIdCanBeSet";i:4;s:36:"ClientTest::testSearchStringCanBeSet";i:4;s:31:"ClientTest::testCountryCanBeSet";i:4;s:48:"ClientTest::testCountryCharactersLengthMustBeTwo";i:4;s:28:"ClientTest::testCityCanBeSet";i:4;s:35:"ClientTest::testTransactionCanBeSet";i:4;s:53:"ClientTest::testTransactionCanOnlyBeOfPredefinedTypes";i:4;s:32:"ClientTest::testSelfOnlyCanBeSet";i:4;s:28:"ClientTest::testSortCanBeSet";i:4;s:46:"ClientTest::testSortCanOnlyBeOfPredefinedTypes";i:4;s:37:"ClientTest::testSortDirectionCanBeSet";i:4;s:54:"ClientTest::testSortDirectionCanOnlyBeOfPredefinedType";i:4;s:32:"ClientTest::testLanguageCanBeSet";i:4;s:49:"ClientTest::testLanguageCanOnlyBeOfPredefinedType";i:4;s:27:"ClientTest::testIdsCanBeSet";i:4;s:32:"ClientTest::testIdsCannotBeEmpty";i:4;s:34:"ClientTest::testCourtierIdCanBeSet";i:4;s:34:"ClientTest::testForeignersCanBeSet";i:4;s:36:"ClientTest::testDisponibliteCanBeSet";i:4;s:54:"ClientTest::testDisponibliteCanOnlyBeOfPredefinedTypes";i:4;s:43:"ClientTest::testResidenceSecondaireCanBeSet";i:4;s:36:"ClientTest::testLocationTypeCanBeSet";i:4;s:54:"ClientTest::testLocationTypeCanOnlyBeOfPredefinedTypes";i:4;s:32:"ClientTest::testNpaOrderCanBeSet";i:4;s:40:"MailerTest::testConstantsAreCorrectlySet";i:5;s:46:"ObjectCollectionTest::testGetTotalReturnsTotal";i:4;s:43:"ObjectCollectionTest::testGetReturnsResults";i:4;s:67:"ObjectCollectionTest::testInclusiveFilterReturnsOnlyIncludedObjects";i:4;s:69:"ObjectCollectionTest::testExclusiveFilterDoesNotReturnExcludedObjects";i:4;s:53:"ObjectCollectionTest::testSortDescUsingOneInstruction";i:4;s:52:"ObjectCollectionTest::testSortAscUsingOneInstruction";i:4;s:55:"ObjectCollectionTest::testSortUsingMultipleInstructions";i:4;s:59:"ObjectCollectionTest::testSortUsingWrongOrderRaiseException";i:4;s:42:"ObjectEntityTest::testRawReturnsSameObject";i:4;s:41:"ObjectEntityTest::testObjectIsFromNetwork";i:4;s:39:"ObjectEntityTest::testObjectIsPromotion";i:4;s:28:"ObjectEntityTest::testIsType";i:4;s:61:"ObjectEntityTest::testIsTypeArgumentCanOnlyBeOfPredefinedType";i:4;s:33:"MailerTest::testClassCanConstruct";i:5;s:52:"MailerTest::testMissingRequiredFieldRaiseAnException";i:4;s:43:"MailerTest::testCaseMandatoryFieldsProvider";i:5;s:7:"Warning";i:6;s:21:"MailerTest::testMIaou";i:5;s:44:"MailerTest::testInvalidEmailRaiseAnException";i:3;s:45:"MailerTest::testEmailBodyIsGeneratedCorrectly";i:4;s:75:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set "title"";i:4;s:31:"ClientTest::testSubtypeCanBeSet";i:3;}s:5:"times";a:73:{s:40:"ClientTest::testConstantsAreCorrectlySet";d:0.001;s:34:"ClientTest::testQueryUrlCanBeBuilt";d:0;s:31:"ClientTest::testOneTypeCanBeSet";d:0;s:36:"ClientTest::testUpToSixTypesCanBeSet";d:0;s:33:"ClientTest::testTypeCannotBeEmpty";d:0;s:37:"ClientTest::testPromotionTypeCanBeSet";d:0;s:34:"ClientTest::testPriceRangeCanBeSet";d:0;s:36:"ClientTest::testSurfaceRangeCanBeSet";d:0;s:33:"ClientTest::testRoomRangeCanBeSet";d:0;s:50:"ClientTest::testRangeTypeCanOnlyBeOfPredefinedType";d:0;s:57:"ClientTest::testRangeCannotHaveMaxValueHigherThanMinValue";d:0;s:30:"ClientTest::testCityIdCanBeSet";d:0;s:32:"ClientTest::testDistanceCanBeSet";d:0;s:30:"ClientTest::testRegionCanBeSet";d:0;s:26:"ClientTest::testIdCanBeSet";d:0;s:36:"ClientTest::testSearchStringCanBeSet";d:0;s:31:"ClientTest::testCountryCanBeSet";d:0;s:48:"ClientTest::testCountryCharactersLengthMustBeTwo";d:0;s:28:"ClientTest::testCityCanBeSet";d:0;s:35:"ClientTest::testTransactionCanBeSet";d:0;s:53:"ClientTest::testTransactionCanOnlyBeOfPredefinedTypes";d:0;s:32:"ClientTest::testSelfOnlyCanBeSet";d:0;s:28:"ClientTest::testSortCanBeSet";d:0;s:46:"ClientTest::testSortCanOnlyBeOfPredefinedTypes";d:0;s:37:"ClientTest::testSortDirectionCanBeSet";d:0;s:54:"ClientTest::testSortDirectionCanOnlyBeOfPredefinedType";d:0;s:32:"ClientTest::testLanguageCanBeSet";d:0;s:49:"ClientTest::testLanguageCanOnlyBeOfPredefinedType";d:0;s:27:"ClientTest::testIdsCanBeSet";d:0;s:32:"ClientTest::testIdsCannotBeEmpty";d:0;s:34:"ClientTest::testCourtierIdCanBeSet";d:0;s:34:"ClientTest::testForeignersCanBeSet";d:0;s:36:"ClientTest::testDisponibliteCanBeSet";d:0;s:54:"ClientTest::testDisponibliteCanOnlyBeOfPredefinedTypes";d:0;s:43:"ClientTest::testResidenceSecondaireCanBeSet";d:0;s:36:"ClientTest::testLocationTypeCanBeSet";d:0;s:54:"ClientTest::testLocationTypeCanOnlyBeOfPredefinedTypes";d:0;s:32:"ClientTest::testNpaOrderCanBeSet";d:0;s:40:"MailerTest::testConstantsAreCorrectlySet";d:0;s:46:"ObjectCollectionTest::testGetTotalReturnsTotal";d:0.009;s:43:"ObjectCollectionTest::testGetReturnsResults";d:0.004;s:67:"ObjectCollectionTest::testInclusiveFilterReturnsOnlyIncludedObjects";d:0.004;s:69:"ObjectCollectionTest::testExclusiveFilterDoesNotReturnExcludedObjects";d:0.004;s:53:"ObjectCollectionTest::testSortDescUsingOneInstruction";d:0.008;s:52:"ObjectCollectionTest::testSortAscUsingOneInstruction";d:0.007;s:55:"ObjectCollectionTest::testSortUsingMultipleInstructions";d:0.007;s:59:"ObjectCollectionTest::testSortUsingWrongOrderRaiseException";d:0.004;s:42:"ObjectEntityTest::testRawReturnsSameObject";d:0.001;s:41:"ObjectEntityTest::testObjectIsFromNetwork";d:0;s:39:"ObjectEntityTest::testObjectIsPromotion";d:0;s:28:"ObjectEntityTest::testIsType";d:0;s:61:"ObjectEntityTest::testIsTypeArgumentCanOnlyBeOfPredefinedType";d:0;s:33:"MailerTest::testClassCanConstruct";d:0.001;s:52:"MailerTest::testMissingRequiredFieldRaiseAnException";d:0;s:48:"MailerTest::testMissingUserTitleRaiseAnException";d:0;s:43:"MailerTest::testCaseMandatoryFieldsProvider";d:0.001;s:7:"Warning";d:0;s:21:"MailerTest::testMIaou";d:0.001;s:70:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set #0";d:0;s:70:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set #1";d:0;s:70:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set #2";d:0;s:70:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set #3";d:0;s:70:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set #4";d:0;s:70:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set #5";d:0;s:75:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set "title"";d:0.001;s:78:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set "lastname"";d:0;s:79:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set "firstname"";d:0;s:75:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set "email"";d:0;s:75:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set "phone"";d:0;s:78:"MailerTest::testMissingMandatoryFieldRaiseAnException with data set "language"";d:0;s:44:"MailerTest::testInvalidEmailRaiseAnException";d:0;s:45:"MailerTest::testEmailBodyIsGeneratedCorrectly";d:0;s:31:"ClientTest::testSubtypeCanBeSet";d:0;}}} \ No newline at end of file diff --git a/docs/api/recherche.md b/docs/api/recherche.md index d696b29..cabcad3 100644 --- a/docs/api/recherche.md +++ b/docs/api/recherche.md @@ -41,6 +41,7 @@ https://syn.publimmo.ch/api/v1/{idagence}/objets | disponiblite | int | 2 | Code de disponiblité (0=disponible,1=reserve,2=vendu,3=option) | | residenceSecondaire | int | 1 | Vente en résidence secondaire si précisé dans Publimmo (1=OUI, 2=NON) | | locationType | int | 2 | Location saisonnière (1=semaine,2=saison,3=année) | +| sousType | int | 1 | Sous-type des objets pour le type sélectionné (1 type max), consulter [api/Types](/api/types) | | npaOrder | int | 1204 | Trie les résultats en commençant par le npa indiqué | ## Réponse diff --git a/src/PublimmoPro/Client.php b/src/PublimmoPro/Client.php index c8ef8ff..0bc7658 100644 --- a/src/PublimmoPro/Client.php +++ b/src/PublimmoPro/Client.php @@ -100,6 +100,9 @@ class Client /** @var int $type_6 6th type of requested object */ private $type_6; + /** @var int $sousType subType of the requested object (must use only type_1) */ + private $sousType; + /** @var int $p The type of promotion */ private $p; //| int | 1 | 2=Fiches promotions uniquement,1=Objets neufs/promotion uniquement, 0=Objets (par défaut) | @@ -208,6 +211,13 @@ public function setType(int ...$types) return $this; } + public function setSubType(int $subtype) + { + $this->sousType = $subtype; + + return $this; + } + public function setPromotionType(int $type) { $this->p = $type; diff --git a/tests/ClientTest.php b/tests/ClientTest.php index 9617c5e..5c36685 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -53,6 +53,12 @@ public function testOneTypeCanBeSet(): void $this->assertTrue(strpos($queryUrl, 'type_1='.Client::APPARTMENT) !== false); } + public function testSubtypeCanBeSet(): void + { + $queryUrl = $this->Client->setSubType(0)->getQueryURL(); + $this->assertTrue(strpos($queryUrl, 'sousType=0') !== false); + } + public function testUpToSixTypesCanBeSet(): void { $queryUrl = $this->Client->setType(