last_response = $res; return $res; } public function is_error() { if ( empty( $this->last_response ) ) return false; return $this->last_response['status_code'] >= 400; } public function get_last_error() { if ( empty( $this->last_response['body'] ) ) return ''; $error = ''; $body = $this->last_response['body']; if ( isset( $body->error ) && isset( $body->error->message ) ) $error = $body->error->message; return $error; } }