Decode URL
The decodeUrl()
function is used to decode a URL and retrieve information about the content it represents, such as Open Graph (OG) tags. You can then use those tags to build Link Previews inside the feed.
Steps to Decode URL
Build a
DecodeUrlRequest
object using theDecodeUrlRequestBuilder
class.Call the
decodeUrl()
function using the instance of theLMFeedClient
class.Use the response as per your requirement.
// Provide the URL to be decoded
String urlToDecode = "https://example.com"; // replace with the actual URL
// Build the request object
DecodeUrlRequest request = (DecodeUrlRequestBuilder()
..url(urlToDecode))
.build();
// Get the response from calling the function
final DecodeUrlResponse response = await lmFeedClient.decodeUrl(request);
// Process the response, as per requirement
if(response.success){
// your function to handle successful URL decoding
handleDecodedUrl(response);
}else{
// your function to handle error message
handleDecodedUrlError(response.errorMessage);
}
tip
Decoding a URL can provide valuable information about the content it points to, including OG tags for better content presentation.
Models
DecodeUrlRequest
List of parameters for the DecodeUrlRequest
class
Variable | Type | Description | Optional |
---|---|---|---|
url | String | URL to be decoded |
DecodeUrlResponse
List of parameters for the DecodeUrlResponse
class
Variable | Type | Description | Optional |
---|---|---|---|
success | bool | API success status | |
errorMessage | String | Error message in case of failure | ✔ |
ogTags | OgTags | Open Graph tags for the decoded content | ✔ |