@@ -26,6 +26,7 @@ class KlaviyoAPI {
2626 public $ wait_seconds ;
2727 public $ num_retries ;
2828 public $ config ;
29+ public $ guzzle_options ;
2930 public $ Campaigns ;
3031 public $ Catalogs ;
3132 public $ Client ;
@@ -41,7 +42,7 @@ class KlaviyoAPI {
4142
4243
4344
44- public function __construct ($ api_key , $ num_retries = 3 , $ wait_seconds = 3 ) {
45+ public function __construct ($ api_key , $ num_retries = 3 , $ wait_seconds = 3 , $ guzzle_options = [] ) {
4546
4647 if (gettype ($ num_retries ) == 'NULL ' ){
4748 $ num_retries = 3 ;
@@ -54,81 +55,82 @@ public function __construct($api_key, $num_retries = 3, $wait_seconds = 3) {
5455 $ this ->api_key = $ api_key ;
5556 $ this ->num_retries = $ num_retries ;
5657 $ this ->wait_seconds = $ wait_seconds ;
58+ $ this ->guzzle_options = $ guzzle_options ;
5759
5860 $ this ->config = clone Configuration::getDefaultConfiguration ();
5961 $ this ->config ->setApiKey ('Authorization ' ,"Klaviyo-API-Key $ this ->api_key " );
6062
6163
6264 $ this ->Campaigns = new Subclient (
63- new CampaignsApi (new GuzzleClient (),$ this ->config ),
64- $ wait_seconds = 3 ,
65- $ num_retries = 3 ,
65+ new CampaignsApi (new GuzzleClient ($ this -> guzzle_options ),$ this ->config ),
66+ $ wait_seconds = $ this -> $ wait_seconds ,
67+ $ num_retries = $ this -> $ num_retries ,
6668 );
6769
6870 $ this ->Catalogs = new Subclient (
69- new CatalogsApi (new GuzzleClient (),$ this ->config ),
70- $ wait_seconds = 3 ,
71- $ num_retries = 3 ,
71+ new CatalogsApi (new GuzzleClient ($ this -> guzzle_options ),$ this ->config ),
72+ $ wait_seconds = $ this -> $ wait_seconds ,
73+ $ num_retries = $ this -> $ num_retries ,
7274 );
7375
7476 $ this ->Client = new Subclient (
75- new ClientApi (new GuzzleClient (),$ this ->config ),
76- $ wait_seconds = 3 ,
77- $ num_retries = 3 ,
77+ new ClientApi (new GuzzleClient ($ this -> guzzle_options ),$ this ->config ),
78+ $ wait_seconds = $ this -> $ wait_seconds ,
79+ $ num_retries = $ this -> $ num_retries ,
7880 );
7981
8082 $ this ->DataPrivacy = new Subclient (
81- new DataPrivacyApi (new GuzzleClient (),$ this ->config ),
82- $ wait_seconds = 3 ,
83- $ num_retries = 3 ,
83+ new DataPrivacyApi (new GuzzleClient ($ this -> guzzle_options ),$ this ->config ),
84+ $ wait_seconds = $ this -> $ wait_seconds ,
85+ $ num_retries = $ this -> $ num_retries ,
8486 );
8587
8688 $ this ->Events = new Subclient (
87- new EventsApi (new GuzzleClient (),$ this ->config ),
88- $ wait_seconds = 3 ,
89- $ num_retries = 3 ,
89+ new EventsApi (new GuzzleClient ($ this -> guzzle_options ),$ this ->config ),
90+ $ wait_seconds = $ this -> $ wait_seconds ,
91+ $ num_retries = $ this -> $ num_retries ,
9092 );
9193
9294 $ this ->Flows = new Subclient (
93- new FlowsApi (new GuzzleClient (),$ this ->config ),
94- $ wait_seconds = 3 ,
95- $ num_retries = 3 ,
95+ new FlowsApi (new GuzzleClient ($ this -> guzzle_options ),$ this ->config ),
96+ $ wait_seconds = $ this -> $ wait_seconds ,
97+ $ num_retries = $ this -> $ num_retries ,
9698 );
9799
98100 $ this ->Lists = new Subclient (
99- new ListsApi (new GuzzleClient (),$ this ->config ),
100- $ wait_seconds = 3 ,
101- $ num_retries = 3 ,
101+ new ListsApi (new GuzzleClient ($ this -> guzzle_options ),$ this ->config ),
102+ $ wait_seconds = $ this -> $ wait_seconds ,
103+ $ num_retries = $ this -> $ num_retries ,
102104 );
103105
104106 $ this ->Metrics = new Subclient (
105- new MetricsApi (new GuzzleClient (),$ this ->config ),
106- $ wait_seconds = 3 ,
107- $ num_retries = 3 ,
107+ new MetricsApi (new GuzzleClient ($ this -> guzzle_options ),$ this ->config ),
108+ $ wait_seconds = $ this -> $ wait_seconds ,
109+ $ num_retries = $ this -> $ num_retries ,
108110 );
109111
110112 $ this ->Profiles = new Subclient (
111- new ProfilesApi (new GuzzleClient (),$ this ->config ),
112- $ wait_seconds = 3 ,
113- $ num_retries = 3 ,
113+ new ProfilesApi (new GuzzleClient ($ this -> guzzle_options ),$ this ->config ),
114+ $ wait_seconds = $ this -> $ wait_seconds ,
115+ $ num_retries = $ this -> $ num_retries ,
114116 );
115117
116118 $ this ->Segments = new Subclient (
117- new SegmentsApi (new GuzzleClient (),$ this ->config ),
118- $ wait_seconds = 3 ,
119- $ num_retries = 3 ,
119+ new SegmentsApi (new GuzzleClient ($ this -> guzzle_options ),$ this ->config ),
120+ $ wait_seconds = $ this -> $ wait_seconds ,
121+ $ num_retries = $ this -> $ num_retries ,
120122 );
121123
122124 $ this ->Tags = new Subclient (
123- new TagsApi (new GuzzleClient (),$ this ->config ),
124- $ wait_seconds = 3 ,
125- $ num_retries = 3 ,
125+ new TagsApi (new GuzzleClient ($ this -> guzzle_options ),$ this ->config ),
126+ $ wait_seconds = $ this -> $ wait_seconds ,
127+ $ num_retries = $ this -> $ num_retries ,
126128 );
127129
128130 $ this ->Templates = new Subclient (
129- new TemplatesApi (new GuzzleClient (),$ this ->config ),
130- $ wait_seconds = 3 ,
131- $ num_retries = 3 ,
131+ new TemplatesApi (new GuzzleClient ($ this -> guzzle_options ),$ this ->config ),
132+ $ wait_seconds = $ this -> $ wait_seconds ,
133+ $ num_retries = $ this -> $ num_retries ,
132134 );
133135
134136
0 commit comments