private function normalizeSearchChannelsResponse($response)
    {
        $response = json_decode($response, true);
        if (!is_array($response) || !array_key_exists('result', $response) || !array_key_exists('total', $response)) {
            throw new Exception('Invalid response from search endpoint');
        }

        $response['totalCount'] = $response['total'];
        $response['channels'] = $response['result'];
        unset($response['result'], $response['total']);

        return json_encode($response);
    }
private function normalizeSearchChannelsResponse($response)
    {
        $response = json_decode($response, true);
        if (!is_array($response) || !array_key_exists('result', $response) || !array_key_exists('total', $response)) {
            throw new Exception('Invalid response from search endpoint');
        }

        $response['totalCount'] = $response['total'];
        $response['channels'] = $response['result'];
        unset($response['result'], $response['total']);

        return json_encode($response);
    }
private function normalizeSearchChannelsResponse ( $ response ) { $ response = json_decode ( $ response , true ) ; if ( ! is_array ( $ response ) || ! array_key_exists ( 'result' , $ response ) || ! array_key_exists ( 'total' , $ response ) ) { throw new Exception ( 'Invalid response from search endpoint' ) ; } $ response [ 'totalCount' ] = $ response [ 'total' ] ; $ response [ 'channels' ] = $ response [ 'result' ] ; unset ( $ response [ 'result' ] , $ response [ 'total' ] ) ; return json_encode ( $ response ) ; }
Adjust the response from the `search` endpoint for channel data type.
Namely, it renames the root-level properties, so they can be correctly unserialized.

@param string $response

@return string

@throws Exception
Adjust the response from the search endpoint for channel data type . Namely it renames the root - level properties so they can be correctly unserialized .