Skip to main content

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 url

  1. Create a DecodeUrlRequest object, using the DecodeUrlRequestBuilder class.
  2. For decoding url call decodeUrl() function using the instance of LMChatClient class, using your request object.
  3. Process the response (LMResponse<DecodeUrlResponse>) as per your requirement.
final LMChatClient lmClient = ...;

DecodeUrlRequest request = (DecodeUrlRequestBuilder()
..url("https://www.google.com"))
.build();

LMResponse<DecodeUrlResponse> response =
await lmClient.decodeUrl(request);

if (response.success) {
debugPrint("Link preview fetched");
} else {
debugPrint("Failed to fetch link preview");
}

Models

DecodeUrlRequest

List of parameters for the DecodeUrlRequest class

VariableTypeDescriptionOptional
urlStringUrl

DecodeUrlResponse

List of parameters for the DecodeUrlResponse class

VariableTypeDescriptionOptional
successboolAPI success status
errorMessageString?Error message in case of failure✔️
ogTagsOgTags?Link preview data✔️