@@ -58,6 +58,189 @@ public function getConfig()
5858 return $ this ->config ;
5959 }
6060
61+ public function listAmortizedCostBillDaily ($ body )
62+ {
63+ list ($ response ) = $ this ->listAmortizedCostBillDailyWithHttpInfo ($ body );
64+ return $ response ;
65+ }
66+
67+ public function listAmortizedCostBillDailyWithHttpInfo ($ body )
68+ {
69+ $ returnType = '\Volcengine\Billing\Model\ListAmortizedCostBillDailyResponse ' ;
70+ $ request = $ this ->listAmortizedCostBillDailyRequest ($ body );
71+
72+ $ options = $ this ->createHttpClientOption ();
73+ try {
74+ $ response = $ this ->client ->send ($ request , $ options );
75+ } catch (RequestException $ e ) {
76+ throw new ApiException (
77+ "[ {$ e ->getCode ()}] {$ e ->getMessage ()}" ,
78+ $ e ->getCode (),
79+ $ e ->getResponse () ? $ e ->getResponse ()->getHeaders () : null ,
80+ $ e ->getResponse () ? $ e ->getResponse ()->getBody ()->getContents () : null
81+ );
82+ }
83+
84+ $ statusCode = $ response ->getStatusCode ();
85+
86+ if ($ statusCode < 200 || $ statusCode > 299 ) {
87+ throw new ApiException (
88+ sprintf (
89+ '[%d] Error connecting to the API (%s) ' ,
90+ $ statusCode ,
91+ $ request ->getUri ()
92+ ),
93+ $ statusCode ,
94+ $ response ->getHeaders (),
95+ $ response ->getBody ()
96+ );
97+ }
98+
99+ $ responseContent = $ response ->getBody ()->getContents ();
100+ $ content = json_decode ($ responseContent );
101+
102+ if (isset ($ content ->{'ResponseMetadata ' }->{'Error ' })) {
103+ throw new ApiException (
104+ sprintf (
105+ '[%d] Return Error From the API (%s) ' ,
106+ $ statusCode ,
107+ $ request ->getUri ()
108+ ),
109+ $ statusCode ,
110+ $ response ->getHeaders (),
111+ $ responseContent );
112+ }
113+ $ content = $ content ->{'Result ' };
114+
115+ return [
116+ ObjectSerializer::deserialize ($ content , $ returnType , []),
117+ $ response ->getStatusCode (),
118+ $ response ->getHeaders ()
119+ ];
120+ }
121+
122+ public function listAmortizedCostBillDailyAsync ($ body )
123+ {
124+ return $ this ->listAmortizedCostBillDailyAsyncWithHttpInfo ($ body )
125+ ->then (
126+ function ($ response ) {
127+ return $ response [0 ];
128+ }
129+ );
130+ }
131+
132+ public function listAmortizedCostBillDailyAsyncWithHttpInfo ($ body )
133+ {
134+ $ returnType = '\Volcengine\Billing\Model\ListAmortizedCostBillDailyResponse ' ;
135+ $ request = $ this ->listAmortizedCostBillDailyRequest ($ body );
136+ $ uri = $ request ->getUri ();
137+
138+ return $ this ->client
139+ ->sendAsync ($ request , $ this ->createHttpClientOption ())
140+ ->then (
141+ function ($ response ) use ($ uri , $ returnType ) {
142+ $ responseContent = $ response ->getBody ()->getContents ();
143+ $ content = json_decode ($ responseContent );
144+ $ statusCode = $ response ->getStatusCode ();
145+
146+ if (isset ($ content ->{'ResponseMetadata ' }->{'Error ' })) {
147+ throw new ApiException (
148+ sprintf (
149+ '[%d] Return Error From the API (%s) ' ,
150+ $ statusCode ,
151+ $ uri
152+ ),
153+ $ statusCode ,
154+ $ response ->getHeaders (),
155+ $ responseContent );
156+ }
157+ $ content = $ content ->{'Result ' };
158+
159+ return [
160+ ObjectSerializer::deserialize ($ content , $ returnType , []),
161+ $ response ->getStatusCode (),
162+ $ response ->getHeaders ()
163+ ];
164+ },
165+ function ($ exception ) {
166+ $ response = $ exception ->getResponse ();
167+ $ statusCode = $ response ->getStatusCode ();
168+ throw new ApiException (
169+ sprintf (
170+ '[%d] Error connecting to the API (%s) ' ,
171+ $ statusCode ,
172+ $ exception ->getRequest ()->getUri ()
173+ ),
174+ $ statusCode ,
175+ $ response ->getHeaders (),
176+ $ response ->getBody ()
177+ );
178+ }
179+ );
180+ }
181+
182+ protected function listAmortizedCostBillDailyRequest ($ body )
183+ {
184+ // verify the required parameter 'body' is set
185+ if ($ body === null || (is_array ($ body ) && count ($ body ) === 0 )) {
186+ throw new \InvalidArgumentException (
187+ 'Missing the required parameter $body when calling listAmortizedCostBillDaily '
188+ );
189+ }
190+
191+ $ resourcePath = '/ListAmortizedCostBillDaily/2022-01-01/billing/post/application_json/ ' ;
192+ $ queryParams = [];
193+ $ httpBody = $ body ;
194+
195+ $ headers = $ this ->headerSelector ->selectHeaders (
196+ ['application/json ' ],
197+ ['application/json ' ]
198+ );
199+
200+ $ defaultHeaders = [];
201+ if ($ this ->config ->getUserAgent ()) {
202+ $ defaultHeaders ['User-Agent ' ] = $ this ->config ->getUserAgent ();
203+ }
204+ if ($ this ->config ->getHost ()) {
205+ $ defaultHeaders ['Host ' ] = $ this ->config ->getHost ();
206+ }
207+
208+ $ headers = array_merge (
209+ $ defaultHeaders ,
210+ $ headers
211+ );
212+
213+ $ paths = explode ("/ " , $ resourcePath );
214+ $ service = $ paths [3 ];
215+ $ method = strtoupper ($ paths [4 ]);
216+
217+ // format request body
218+ if ($ method == 'GET ' && $ headers ['Content-Type ' ] === 'text/plain ' ) {
219+ $ queryParams = Utils::transRequest ($ httpBody );
220+ $ httpBody = '' ;
221+ } else {
222+ $ httpBody = json_encode (ObjectSerializer::sanitizeForSerialization ($ body ));
223+ }
224+
225+ $ queryParams ['Action ' ] = $ paths [1 ];
226+ $ queryParams ['Version ' ] = $ paths [2 ];
227+ $ resourcePath = '/ ' ;
228+
229+ $ query = '' ;
230+ ksort ($ queryParams ); // sort query first
231+ foreach ($ queryParams as $ k => $ v ) {
232+ $ query .= rawurlencode ($ k ) . '= ' . rawurlencode ($ v ) . '& ' ;
233+ }
234+ $ query = substr ($ query , 0 , -1 );
235+
236+ $ headers = Utils::signv4 ($ this ->config ->getAk (), $ this ->config ->getSk (), $ this ->config ->getRegion (), $ service ,
237+ $ httpBody , $ query , $ method , $ resourcePath , $ headers );
238+
239+ return new Request ($ method ,
240+ 'https:// ' . $ this ->config ->getHost () . $ resourcePath . ($ query ? "? {$ query }" : '' ),
241+ $ headers , $ httpBody );
242+ }
243+
61244 public function listAmortizedCostBillDetail ($ body )
62245 {
63246 list ($ response ) = $ this ->listAmortizedCostBillDetailWithHttpInfo ($ body );
0 commit comments