@@ -34,6 +34,9 @@ class AdInsightServiceApi extends AbstractServiceApi
3434 'getAuctionInsightData ' => [
3535 'application/json ' ,
3636 ],
37+ 'getAudienceBreakdown ' => [
38+ 'application/json ' ,
39+ ],
3740 'getAudienceFullEstimation ' => [
3841 'application/json ' ,
3942 ],
@@ -793,6 +796,225 @@ public function getAuctionInsightDataRequest($GetAuctionInsightDataRequest, stri
793796 );
794797 }
795798
799+ /**
800+ * Operation getAudienceBreakdown
801+ *
802+ * @param \Microsoft\MsAds\Rest\Model\AdInsightService\GetAudienceBreakdownRequest $GetAudienceBreakdownRequest GetAudienceBreakdownRequest (required)
803+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAudienceBreakdown'] to see the possible values for this operation
804+ *
805+ * @throws \Microsoft\MsAds\Rest\ApiException on non-2xx response or if the response body is not in the expected format
806+ * @throws \InvalidArgumentException
807+ * @return \Microsoft\MsAds\Rest\Model\AdInsightService\GetAudienceBreakdownResponse|\Microsoft\MsAds\Rest\Model\AdInsightService\ApplicationFault|\Microsoft\MsAds\Rest\Model\AdInsightService\ApplicationFault|\Microsoft\MsAds\Rest\Model\AdInsightService\ApplicationFault|\Microsoft\MsAds\Rest\Model\AdInsightService\ApplicationFault
808+ */
809+ public function getAudienceBreakdown ($ GetAudienceBreakdownRequest , string $ contentType = self ::contentTypes['getAudienceBreakdown ' ][0 ])
810+ {
811+ list ($ response ) = $ this ->getAudienceBreakdownWithHttpInfo ($ GetAudienceBreakdownRequest , $ contentType );
812+ return $ response ;
813+ }
814+
815+ /**
816+ * Operation getAudienceBreakdownWithHttpInfo
817+ *
818+ * @param \Microsoft\MsAds\Rest\Model\AdInsightService\GetAudienceBreakdownRequest $GetAudienceBreakdownRequest (required)
819+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAudienceBreakdown'] to see the possible values for this operation
820+ *
821+ * @throws \Microsoft\MsAds\Rest\ApiException on non-2xx response or if the response body is not in the expected format
822+ * @throws \InvalidArgumentException
823+ * @return array of \Microsoft\MsAds\Rest\Model\AdInsightService\GetAudienceBreakdownResponse|\Microsoft\MsAds\Rest\Model\AdInsightService\ApplicationFault|\Microsoft\MsAds\Rest\Model\AdInsightService\ApplicationFault|\Microsoft\MsAds\Rest\Model\AdInsightService\ApplicationFault|\Microsoft\MsAds\Rest\Model\AdInsightService\ApplicationFault, HTTP status code, HTTP response headers (array of strings)
824+ */
825+ public function getAudienceBreakdownWithHttpInfo ($ GetAudienceBreakdownRequest , string $ contentType = self ::contentTypes['getAudienceBreakdown ' ][0 ])
826+ {
827+ $ request = $ this ->getAudienceBreakdownRequest ($ GetAudienceBreakdownRequest , $ contentType );
828+
829+ try {
830+ $ options = $ this ->createHttpClientOption ();
831+ try {
832+ $ response = $ this ->client ->send ($ request , $ options );
833+ } catch (RequestException $ e ) {
834+ $ response = $ e ->getResponse ();
835+ } catch (ConnectException $ e ) {
836+ throw new ApiException (
837+ "[ {$ e ->getCode ()}] {$ e ->getMessage ()}" ,
838+ (int ) $ e ->getCode (),
839+ null ,
840+ null
841+ );
842+ }
843+
844+ $ statusCode = $ response ->getStatusCode ();
845+
846+
847+ switch ($ statusCode ) {
848+ case 200 :
849+ return $ this ->getResponseContent ($ request , $ response , '\Microsoft\MsAds\Rest\Model\AdInsightService\GetAudienceBreakdownResponse ' );
850+ case 400 :
851+ return $ this ->getResponseContent ($ request , $ response , '\Microsoft\MsAds\Rest\Model\AdInsightService\ApplicationFault ' );
852+ case 500 :
853+ return $ this ->getResponseContent ($ request , $ response , '\Microsoft\MsAds\Rest\Model\AdInsightService\ApplicationFault ' );
854+ case 401 :
855+ return $ this ->getResponseContent ($ request , $ response , '\Microsoft\MsAds\Rest\Model\AdInsightService\ApplicationFault ' );
856+ case 403 :
857+ return $ this ->getResponseContent ($ request , $ response , '\Microsoft\MsAds\Rest\Model\AdInsightService\ApplicationFault ' );
858+ }
859+
860+ if ($ statusCode < 200 || $ statusCode > 299 ) {
861+ throw new ApiException (
862+ sprintf (
863+ '[%d] Error connecting to the API (%s) ' ,
864+ $ statusCode ,
865+ (string ) $ request ->getUri ()
866+ ),
867+ $ statusCode ,
868+ $ response ->getHeaders (),
869+ (string ) $ response ->getBody ()
870+ );
871+ }
872+
873+ $ returnType = '\Microsoft\MsAds\Rest\Model\AdInsightService\GetAudienceBreakdownResponse ' ;
874+ return $ this ->getResponseContent ($ request , $ response , $ returnType );
875+
876+ } catch (ApiException $ e ) {
877+ switch ($ e ->getCode ()) {
878+ case 200 :
879+ $ data = ObjectSerializer::deserialize (
880+ $ e ->getResponseBody (),
881+ '\Microsoft\MsAds\Rest\Model\AdInsightService\GetAudienceBreakdownResponse ' ,
882+ $ e ->getResponseHeaders ()
883+ );
884+ $ e ->setResponseObject ($ data );
885+ break ;
886+ case 400 :
887+ $ data = ObjectSerializer::deserialize (
888+ $ e ->getResponseBody (),
889+ '\Microsoft\MsAds\Rest\Model\AdInsightService\ApplicationFault ' ,
890+ $ e ->getResponseHeaders ()
891+ );
892+ $ e ->setResponseObject ($ data );
893+ break ;
894+ case 500 :
895+ $ data = ObjectSerializer::deserialize (
896+ $ e ->getResponseBody (),
897+ '\Microsoft\MsAds\Rest\Model\AdInsightService\ApplicationFault ' ,
898+ $ e ->getResponseHeaders ()
899+ );
900+ $ e ->setResponseObject ($ data );
901+ break ;
902+ case 401 :
903+ $ data = ObjectSerializer::deserialize (
904+ $ e ->getResponseBody (),
905+ '\Microsoft\MsAds\Rest\Model\AdInsightService\ApplicationFault ' ,
906+ $ e ->getResponseHeaders ()
907+ );
908+ $ e ->setResponseObject ($ data );
909+ break ;
910+ case 403 :
911+ $ data = ObjectSerializer::deserialize (
912+ $ e ->getResponseBody (),
913+ '\Microsoft\MsAds\Rest\Model\AdInsightService\ApplicationFault ' ,
914+ $ e ->getResponseHeaders ()
915+ );
916+ $ e ->setResponseObject ($ data );
917+ break ;
918+ }
919+ throw $ e ;
920+ }
921+ }
922+
923+ /**
924+ * Operation getAudienceBreakdownAsync
925+ *
926+ * @param \Microsoft\MsAds\Rest\Model\AdInsightService\GetAudienceBreakdownRequest $GetAudienceBreakdownRequest (required)
927+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAudienceBreakdown'] to see the possible values for this operation
928+ *
929+ * @throws \InvalidArgumentException
930+ * @return \GuzzleHttp\Promise\PromiseInterface
931+ */
932+ public function getAudienceBreakdownAsync ($ GetAudienceBreakdownRequest , string $ contentType = self ::contentTypes['getAudienceBreakdown ' ][0 ])
933+ {
934+ return $ this ->getAudienceBreakdownAsyncWithHttpInfo ($ GetAudienceBreakdownRequest , $ contentType )
935+ ->then (
936+ function ($ response ) {
937+ return $ response [0 ];
938+ }
939+ );
940+ }
941+
942+ /**
943+ * Operation getAudienceBreakdownAsyncWithHttpInfo
944+ *
945+ * @param \Microsoft\MsAds\Rest\Model\AdInsightService\GetAudienceBreakdownRequest $GetAudienceBreakdownRequest (required)
946+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAudienceBreakdown'] to see the possible values for this operation
947+ *
948+ * @throws \InvalidArgumentException
949+ * @return \GuzzleHttp\Promise\PromiseInterface
950+ */
951+ public function getAudienceBreakdownAsyncWithHttpInfo ($ GetAudienceBreakdownRequest , string $ contentType = self ::contentTypes['getAudienceBreakdown ' ][0 ])
952+ {
953+ $ returnType = '\Microsoft\MsAds\Rest\Model\AdInsightService\GetAudienceBreakdownResponse ' ;
954+ $ request = $ this ->getAudienceBreakdownRequest ($ GetAudienceBreakdownRequest , $ contentType );
955+
956+ return $ this ->client
957+ ->sendAsync ($ request , $ this ->createHttpClientOption ())
958+ ->then (
959+ function ($ response ) use ($ returnType ) {
960+ return $ this ->onFulfilledResponse ($ response , $ returnType );
961+ },
962+ function ($ exception ) {
963+ $ this ->onRejectedResponse ($ exception );
964+ }
965+ );
966+ }
967+
968+ /**
969+ * Create request for operation 'getAudienceBreakdown'
970+ *
971+ * @param \Microsoft\MsAds\Rest\Model\AdInsightService\GetAudienceBreakdownRequest $GetAudienceBreakdownRequest (required)
972+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAudienceBreakdown'] to see the possible values for this operation
973+ *
974+ * @throws \InvalidArgumentException
975+ * @return \GuzzleHttp\Psr7\Request
976+ */
977+ public function getAudienceBreakdownRequest ($ GetAudienceBreakdownRequest , string $ contentType = self ::contentTypes['getAudienceBreakdown ' ][0 ])
978+ {
979+
980+ // verify the required parameter 'GetAudienceBreakdownRequest' is set
981+ if ($ GetAudienceBreakdownRequest === null || (is_array ($ GetAudienceBreakdownRequest ) && count ($ GetAudienceBreakdownRequest ) === 0 )) {
982+ throw new \InvalidArgumentException (
983+ 'Missing the required parameter $GetAudienceBreakdownRequest when calling getAudienceBreakdown '
984+ );
985+ }
986+
987+
988+ $ resourcePath = '/AdInsight/v13/AudienceBreakdown/query ' ;
989+ $ formParams = [];
990+ $ queryParams = [];
991+ $ headerParams = [];
992+ $ multipart = false ;
993+
994+ $ headers = $ this ->headerSelector ->selectHeaders (
995+ ['application/json ' , ],
996+ $ contentType ,
997+ $ multipart
998+ );
999+
1000+ return $ this ->setupAndSendRequest (
1001+ 'POST ' ,
1002+ $ resourcePath ,
1003+ $ headers ,
1004+ $ headerParams ,
1005+ $ GetAudienceBreakdownRequest ,
1006+ $ formParams ,
1007+ $ multipart ,
1008+ true ,
1009+ true ,
1010+ false ,
1011+ 'getHostSettingsForgetAudienceBreakdown ' ,
1012+ null ,
1013+ [],
1014+ $ queryParams
1015+ );
1016+ }
1017+
7961018 /**
7971019 * Operation getAudienceFullEstimation
7981020 *
0 commit comments