Decode URL
You can get the link preview by calling the decodeUrl()
method present in LMChatClient
class and passing the request object.
Steps to Decode a URL
- Create an object of the
DecodeUrlRequest
class. - Call the
decodeUrl()
function using the instance of theLMChatClient
class. - Process the response LMResponse<
DecodeUrlResponse
> as per your requirement.
DecodeUrlRequest request = (DecodeUrlRequestBuilder()
..url("ENTER_URL"))
.build();
LMResponse<DecodeUrlResponse> response = await lmChatClient.decodeUrl(request);
if (response.success) {
// your function to handle successful decoding
handleDecodeSuccess(response.data?.ogTags);
} else {
// your function to handle decode error
handleDecodeError(response.errorMessage);
}
Models
DecodeUrlRequest
List of parameters for the DecodeUrlRequest
class
Variable | Type | Description | Optional |
---|---|---|---|
url | String | The URL to decode |
DecodeUrlResponse
List of parameters for the DecodeUrlResponse
class
Variable | Type | Description | Optional |
---|---|---|---|
ogTags | OgTags? | The Open Graph tags extracted from the URL | ✔️ |