@@ 247-252 (lines=6) @@ | ||
244 | $params = $request->get_params(); |
|
245 | $wpcom_path = sprintf( '/meta/external-media/%s', rawurlencode( $params['service'] ) ); |
|
246 | ||
247 | if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) { |
|
248 | $request = new \WP_REST_Request( 'GET', '/' . $this->namespace . $wpcom_path ); |
|
249 | $request->set_query_params( $params ); |
|
250 | ||
251 | return rest_do_request( $request ); |
|
252 | } |
|
253 | ||
254 | // Build query string to pass to wpcom endpoint. |
|
255 | $service_args = array_filter( |
|
@@ 348-353 (lines=6) @@ | ||
345 | $service = rawurlencode( $request->get_param( 'service' ) ); |
|
346 | $wpcom_path = sprintf( '/meta/external-media/connection/%s', $service ); |
|
347 | ||
348 | if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) { |
|
349 | $request = new \WP_REST_Request( 'GET', '/' . $this->namespace . $wpcom_path ); |
|
350 | $request->set_query_params( $request->get_params() ); |
|
351 | ||
352 | return rest_do_request( $request ); |
|
353 | } |
|
354 | ||
355 | $response = Client::wpcom_json_api_request_as_user( $wpcom_path ); |
|
356 | $response = json_decode( wp_remote_retrieve_body( $response ) ); |