Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with getWhatsAppMediaMetadataResponse Returning Null #67

Open
andre-hoffmann opened this issue May 30, 2024 · 1 comment
Open

Comments

@andre-hoffmann
Copy link

I am trying to retrieve the metadata of a media file using the getWhatsAppMediaMetadata function. However, the function returns a getWhatsAppMediaMetadataResponse that is null. I am unsure if I am missing something in my implementation or if this is a bug in the function.

  • Original code
    private function getWhatsAppMediaMetadataResponse(ResponseInterface $response, UriInterface $requestUri): mixed
    {
        $statusCode = $response->getStatusCode();
        $responseBody = $response->getBody();
        $responseHeaders = $response->getHeaders();

        if ($statusCode < 200 || $statusCode > 299) {
            throw new ApiException(
                sprintf('[%d] API Error (%s)', $statusCode, $requestUri),
                $statusCode,
                $responseHeaders,
                $responseBody
            );
        }

        $responseResult = null;

        return $responseResult;
    }
  • Recommended code
    private function getWhatsAppMediaMetadataResponse(ResponseInterface $response, UriInterface $requestUri): mixed
    {
        $statusCode = $response->getStatusCode();
        $responseBody = $response->getBody();
        $responseHeaders = $response->getHeaders();

        if ($statusCode < 200 || $statusCode > 299) {
            throw new ApiException(
                sprintf('[%d] API Error (%s)', $statusCode, $requestUri),
                $statusCode,
                $responseHeaders,
                $responseBody
            );
        }

        return $responseHeaders;
    }
@andre-hoffmann
Copy link
Author

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant