diff --git a/crates/api_clients/grok_client/src/requests/media_post_list/_metadata/firefox_media_post_list_curl_request.txt b/crates/api_clients/grok_client/src/requests/media_post_list/_metadata/firefox_media_post_list_curl_request.txt new file mode 100644 index 0000000000..ca4e9025ee --- /dev/null +++ b/crates/api_clients/grok_client/src/requests/media_post_list/_metadata/firefox_media_post_list_curl_request.txt @@ -0,0 +1,24 @@ +curl 'https://grok.com/rest/media/post/list' \ + --compressed \ + -X POST \ + -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:144.0) Gecko/20100101 Firefox/144.0' \ + -H 'Accept: */*' \ + -H 'Accept-Language: en-US,en;q=0.5' \ + -H 'Accept-Encoding: gzip, deflate, br, zstd' \ + -H 'Referer: https://grok.com/imagine/favorites' \ + -H 'traceparent: 00-b28237cfadf176bbd0c36fb0ff06a3c9-f2940af12cf53770-00' \ + -H 'Content-Type: application/json' \ + -H 'x-xai-request-id: 91522ffe-bbfc-48d4-87eb-a3063f0c1476' \ + -H 'x-statsig-id: q15NyzGsJCh4SnigNL2jHcMQJgKTHwFmu61q0oPTNseHkzmbNBhJhTPfx95XHBhselA9H69n4PoJ7/Zrb9kj645kDoROqA' \ + -H 'sentry-trace: 00461630c637f9a69baf30bb37c0ecd4-8f3078bbbac51430-0' \ + -H 'baggage: sentry-environment=production,sentry-public_key=b311e0f2690c81f25e2c4cf6d4f7ce1c,sentry-trace_id=00461630c637f9a69baf30bb37c0ecd4,sentry-org_id=4508179396558848,sentry-sampled=false,sentry-sample_rand=0.4352105572006608,sentry-sample_rate=0' \ + -H 'Origin: https://grok.com' \ + -H 'Sec-GPC: 1' \ + -H 'Connection: keep-alive' \ + -H 'Cookie: stblid=59d7cf53-ffeb-42ad-8ba3-ab300f12d741; cf_clearance=1XFYsysnawAmx3PrMOKmdczAfFiwkQhC75XLkCAsqUU-1761868196-1.2.1.1-XO.t8iWRNDMvVqIrQrnvedcdxqhTqoDyjvMkU6XT3IOUm3Hs4iIBFPPdzOEvjR1NxeGDJRr20dbZ2B1Xcuwzl78dDLJn_hbQeugOlxG7K7QNrctY.zbdDcEECtmbaghnPOsq2x_Gn6n4t72kaij10m.9EqMrAPwPB.n87Z14APKS_7XXYoF96mByVnckLcM71_WiJUA7eXvNl4j5Kc65XlrgXi.sku3cX52WFZkmBNg; i18nextLng=en; x-anonuserid=41f3614a-1a08-4c9b-81b4-0c2085f6b8d8; x-challenge=tmsr%2B%2BbUg2pjTWyAOGqqFe%2BW38g66vDImJiVuiLtmSmNpaQm%2B46WajkdQoflNC1CyRKRcOLOc1ylzYI%2BerCVbWLrHr022ZWcTJqcN0o1499%2FcjPAAspeAKPV%2F6OAaHmYGu8eSXR4dj27qXSWxLixSctJLIQZVpKXX7njuuSkvKDQCwBgt%2BY%3D; x-signature=GqtNLJQw2%2BOk1rO6sby9vQT3N5%2BiX8g%2B8Bqrndiv51dSYQFC4v2%2FlrkKmH1utjqExbfvVjtks0%2Bn6RC3q61%2FRA%3D%3D; sso=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzZXNzaW9uX2lkIjoiMmM1OGEyMjQtMDViZi00NjllLWFkYjUtNmY3ODdmZDU1MTc2In0.rnUG2UvKv32YBGSyYWrWh_1KaLiTix-6H4TZe4ZywfU; sso-rw=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzZXNzaW9uX2lkIjoiMmM1OGEyMjQtMDViZi00NjllLWFkYjUtNmY3ODdmZDU1MTc2In0.rnUG2UvKv32YBGSyYWrWh_1KaLiTix-6H4TZe4ZywfU; mp_ea93da913ddb66b6372b89d97b1029ac_mixpanel=%7B%22distinct_id%22%3A%2285980643-ffab-4984-a3de-59a608c47d7f%22%2C%22%24device_id%22%3A%22c02bd50a-db0e-4f35-903e-b03f32f28b5f%22%2C%22%24initial_referrer%22%3A%22%24direct%22%2C%22%24initial_referring_domain%22%3A%22%24direct%22%2C%22__mps%22%3A%7B%7D%2C%22__mpso%22%3A%7B%7D%2C%22__mpus%22%3A%7B%7D%2C%22__mpa%22%3A%7B%7D%2C%22__mpu%22%3A%7B%7D%2C%22__mpr%22%3A%5B%5D%2C%22__mpap%22%3A%5B%5D%2C%22%24user_id%22%3A%2285980643-ffab-4984-a3de-59a608c47d7f%22%7D' \ + -H 'Sec-Fetch-Dest: empty' \ + -H 'Sec-Fetch-Mode: cors' \ + -H 'Sec-Fetch-Site: same-origin' \ + -H 'Priority: u=4' \ + -H 'TE: trailers' \ + --data-raw '{"limit":40,"filter":{"source":"MEDIA_POST_SOURCE_LIKED"}}' \ No newline at end of file diff --git a/crates/api_clients/grok_client/src/requests/media_post_list/_metadata/oct_30_media_post_list_response.json b/crates/api_clients/grok_client/src/requests/media_post_list/_metadata/oct_30_media_post_list_response.json new file mode 100644 index 0000000000..f3e8aa2b59 --- /dev/null +++ b/crates/api_clients/grok_client/src/requests/media_post_list/_metadata/oct_30_media_post_list_response.json @@ -0,0 +1,703 @@ +{ + "posts": [ + { + "id": "abd9331b-c5ac-49cc-8bec-c410c7efde98", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-30T23:49:37.583477Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_IMAGE", + "mediaUrl": "https://imagine-public.x.ai/imagine-public/share-images/abd9331b-c5ac-49cc-8bec-c410c7efde98.jpg", + "mimeType": "image/jpeg", + "audioUrls": [], + "childPosts": [ + { + "id": "ecec690e-15bd-4f5f-b4e9-9b8733c3fd69", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-30T23:50:04.862487Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/ecec690e-15bd-4f5f-b4e9-9b8733c3fd69/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "abd9331b-c5ac-49cc-8bec-c410c7efde98", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "an anime girl runs away from a giant t-rex", + "mode": "custom", + "modelName": "imagine_xdit_1" + } + ], + "originalPrompt": "", + "userInteractionStatus": { + "likeStatus": true + }, + "modelName": "imagine_h_1", + "thumbnailImageUrl": "https://imagine-public.x.ai/cdn-cgi/image/width=500,fit=scale-down,format=auto/imagine-public/share-images/abd9331b-c5ac-49cc-8bec-c410c7efde98.jpg" + }, + { + "id": "3c896963-8e6b-4e71-83e1-4253b2bf2ac8", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-30T23:22:19.528702Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_IMAGE", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/3c896963-8e6b-4e71-83e1-4253b2bf2ac8/content", + "mimeType": "image/jpeg", + "audioUrls": [], + "childPosts": [ + { + "id": "b3929c27-0f02-4a17-bfb1-867ac555a72a", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-30T23:22:46.680830Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/b3929c27-0f02-4a17-bfb1-867ac555a72a/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "3c896963-8e6b-4e71-83e1-4253b2bf2ac8", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "an anime girl peacefully stands in front of a t-rex in a solar punk field. the t-rex roars and the girl streches and yawns", + "mode": "custom", + "modelName": "imagine_xdit_1", + "thumbnailImageUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/b3929c27-0f02-4a17-bfb1-867ac555a72a/preview_image.jpg" + } + ], + "originalPrompt": "", + "userInteractionStatus": { + "likeStatus": true + }, + "modelName": "imagine_h_1" + }, + { + "id": "6272020b-bb05-4b61-ae72-0df4500d813c", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-30T22:55:11.977212Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_IMAGE", + "mediaUrl": "https://imagine-public.x.ai/imagine-public/share-images/6272020b-bb05-4b61-ae72-0df4500d813c.jpg", + "mimeType": "image/jpeg", + "audioUrls": [], + "childPosts": [ + { + "id": "e3785eeb-0b18-4179-a3ba-878a59b5a230", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-30T22:55:37.558045Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/e3785eeb-0b18-4179-a3ba-878a59b5a230/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "6272020b-bb05-4b61-ae72-0df4500d813c", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "the mountains are digitial and lights flicker up and down the topography. the camera pans gently by", + "mode": "custom", + "modelName": "imagine_xdit_1" + } + ], + "originalPrompt": "", + "userInteractionStatus": { + "likeStatus": true + }, + "modelName": "imagine_h_1", + "thumbnailImageUrl": "https://imagine-public.x.ai/cdn-cgi/image/width=500,fit=scale-down,format=auto/imagine-public/share-images/6272020b-bb05-4b61-ae72-0df4500d813c.jpg" + }, + { + "id": "e40ee84c-fbc5-4fd0-9618-0a5b80f46a47", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-30T22:03:09.166736Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_IMAGE", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/e40ee84c-fbc5-4fd0-9618-0a5b80f46a47/content", + "mimeType": "image/jpeg", + "audioUrls": [], + "childPosts": [ + { + "id": "ffa3304d-0c79-4f3b-ab8e-a56b6a603b30", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-30T22:03:34.259468Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/ffa3304d-0c79-4f3b-ab8e-a56b6a603b30/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "e40ee84c-fbc5-4fd0-9618-0a5b80f46a47", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "The hero shoots an arrow and it hits a skeleton monster", + "mode": "custom", + "modelName": "imagine_xdit_1" + } + ], + "originalPrompt": "", + "userInteractionStatus": { + "likeStatus": true + }, + "modelName": "imagine_h_1" + }, + { + "id": "ba25cc83-c986-49bd-9e98-edbad66457a3", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-30T21:52:05.585904Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_IMAGE", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/ba25cc83-c986-49bd-9e98-edbad66457a3/content", + "mimeType": "image/jpeg", + "audioUrls": [], + "childPosts": [ + { + "id": "432ffd25-686e-4970-9bae-5089a8993234", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-30T21:52:29.182159Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/432ffd25-686e-4970-9bae-5089a8993234/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "ba25cc83-c986-49bd-9e98-edbad66457a3", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "The hero shoots an arrow and the camera zooms out to follow the arrow", + "mode": "custom", + "modelName": "imagine_xdit_1" + } + ], + "originalPrompt": "", + "userInteractionStatus": { + "likeStatus": true + }, + "modelName": "imagine_h_1" + }, + { + "id": "3ce7350b-323a-48c3-b8a0-798fd11e176c", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-30T19:25:03.911369Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_IMAGE", + "mediaUrl": "https://imagine-public.x.ai/imagine-public/share-images/3ce7350b-323a-48c3-b8a0-798fd11e176c.jpg", + "mimeType": "image/jpeg", + "audioUrls": [], + "childPosts": [ + { + "id": "ff98ccba-7879-478d-b8a1-089de60b23f1", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-30T19:25:30.649705Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/ff98ccba-7879-478d-b8a1-089de60b23f1/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "3ce7350b-323a-48c3-b8a0-798fd11e176c", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "our hero link plunges the sword into the pedestal, the temple is glowing with a blue aura", + "mode": "custom", + "modelName": "imagine_xdit_1" + } + ], + "originalPrompt": "", + "userInteractionStatus": { + "likeStatus": true + }, + "modelName": "imagine_h_1", + "thumbnailImageUrl": "https://imagine-public.x.ai/cdn-cgi/image/width=500,fit=scale-down,format=auto/imagine-public/share-images/3ce7350b-323a-48c3-b8a0-798fd11e176c.jpg" + }, + { + "id": "eabcc2a5-8a9b-4382-82d2-020b4b286e87", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-30T19:04:27.442590Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_IMAGE", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/eabcc2a5-8a9b-4382-82d2-020b4b286e87/content", + "mimeType": "image/jpeg", + "audioUrls": [], + "childPosts": [ + { + "id": "34fa0313-3cde-4693-b046-319093374dbe", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-30T19:04:52.479768Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/34fa0313-3cde-4693-b046-319093374dbe/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "eabcc2a5-8a9b-4382-82d2-020b4b286e87", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "our hero link on horseback galloping through the fantasy world, bright sun behind him. a dormant volcano has a circling ring of smoke. the camera pulls back and follows our hero", + "mode": "custom", + "modelName": "imagine_xdit_1", + "thumbnailImageUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/34fa0313-3cde-4693-b046-319093374dbe/preview_image.jpg" + } + ], + "originalPrompt": "", + "userInteractionStatus": { + "likeStatus": true + }, + "modelName": "imagine_h_1" + }, + { + "id": "187f207f-7e4f-4491-a90c-a5ce7efa0586", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-30T18:31:07.586547Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_IMAGE", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/187f207f-7e4f-4491-a90c-a5ce7efa0586/content", + "mimeType": "image/jpeg", + "audioUrls": [], + "childPosts": [ + { + "id": "d9b300c6-9562-4e24-a87a-3ede2a53f0bc", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-30T18:31:30.976720Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/d9b300c6-9562-4e24-a87a-3ede2a53f0bc/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "187f207f-7e4f-4491-a90c-a5ce7efa0586", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "A man in the forest cuts down a tree", + "mode": "custom", + "modelName": "imagine_xdit_1" + } + ], + "originalPrompt": "", + "userInteractionStatus": { + "likeStatus": true + }, + "modelName": "imagine_h_1" + }, + { + "id": "def0be3d-d1dc-4511-98fe-0b71663cd689", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-29T07:36:42.981250Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_IMAGE", + "mediaUrl": "https://imagine-public.x.ai/imagine-public/share-images/def0be3d-d1dc-4511-98fe-0b71663cd689.jpg", + "mimeType": "image/jpeg", + "audioUrls": [], + "childPosts": [ + { + "id": "eb05dc4b-c243-4ff5-ba84-9bbea708cfb6", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-29T07:37:08.105827Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/eb05dc4b-c243-4ff5-ba84-9bbea708cfb6/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "def0be3d-d1dc-4511-98fe-0b71663cd689", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "A man in the forest runs away from a spooky ghost", + "mode": "custom", + "modelName": "imagine_xdit_1", + "thumbnailImageUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/eb05dc4b-c243-4ff5-ba84-9bbea708cfb6/preview_image.jpg" + } + ], + "originalPrompt": "", + "userInteractionStatus": { + "likeStatus": true + }, + "modelName": "imagine_h_1", + "thumbnailImageUrl": "https://imagine-public.x.ai/cdn-cgi/image/width=500,fit=scale-down,format=auto/imagine-public/share-images/def0be3d-d1dc-4511-98fe-0b71663cd689.jpg" + }, + { + "id": "d6d73ffd-ce87-40a3-9cc2-3432d7192652", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-29T06:27:31.563653Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_IMAGE", + "mediaUrl": "https://imagine-public.x.ai/imagine-public/share-images/d6d73ffd-ce87-40a3-9cc2-3432d7192652.jpg", + "mimeType": "image/jpeg", + "audioUrls": [], + "childPosts": [ + { + "id": "3768b6db-9694-4630-b547-4d4fa061ac9b", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-29T06:49:30.755029Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/3768b6db-9694-4630-b547-4d4fa061ac9b/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "d6d73ffd-ce87-40a3-9cc2-3432d7192652", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "building gets hit by tornado", + "mode": "custom", + "modelName": "imagine_xdit_1", + "thumbnailImageUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/3768b6db-9694-4630-b547-4d4fa061ac9b/preview_image.jpg" + }, + { + "id": "2e68bc4b-ceb7-4eee-be13-8423fc9595b0", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-29T06:27:58.455499Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/2e68bc4b-ceb7-4eee-be13-8423fc9595b0/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "d6d73ffd-ce87-40a3-9cc2-3432d7192652", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "", + "mode": "normal", + "modelName": "imagine_xdit_1" + } + ], + "originalPrompt": "", + "userInteractionStatus": { + "likeStatus": true + }, + "modelName": "imagine_h_1", + "thumbnailImageUrl": "https://imagine-public.x.ai/cdn-cgi/image/width=500,fit=scale-down,format=auto/imagine-public/share-images/d6d73ffd-ce87-40a3-9cc2-3432d7192652.jpg" + }, + { + "id": "0e1b621b-2d45-491b-91b0-e9cf6c6daaac", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-29T00:37:15.507858Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_IMAGE", + "mediaUrl": "https://imagine-public.x.ai/imagine-public/share-images/0e1b621b-2d45-491b-91b0-e9cf6c6daaac.jpg", + "mimeType": "image/jpeg", + "audioUrls": [], + "childPosts": [ + { + "id": "55ef6c27-87bc-4fff-a1a9-72acb06e53e5", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-29T00:37:42.725023Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/55ef6c27-87bc-4fff-a1a9-72acb06e53e5/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "0e1b621b-2d45-491b-91b0-e9cf6c6daaac", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "", + "mode": "normal", + "modelName": "imagine_xdit_1", + "thumbnailImageUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/55ef6c27-87bc-4fff-a1a9-72acb06e53e5/preview_image.jpg" + } + ], + "originalPrompt": "", + "userInteractionStatus": { + "likeStatus": true + }, + "modelName": "imagine_h_1", + "thumbnailImageUrl": "https://imagine-public.x.ai/cdn-cgi/image/width=500,fit=scale-down,format=auto/imagine-public/share-images/0e1b621b-2d45-491b-91b0-e9cf6c6daaac.jpg" + }, + { + "id": "5088adf9-85fd-4f51-a514-005aae2e1027", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-22T17:27:33.154910Z", + "prompt": "A serene pathway lined with trees and benches, bathed in soft sunlight, with fallen leaves scattered on the ground and a fence along the side.", + "mediaType": "MEDIA_POST_TYPE_IMAGE", + "mediaUrl": "https://imagine-public.x.ai/imagine-public/share-images/5088adf9-85fd-4f51-a514-005aae2e1027.jpg", + "mimeType": "image/jpeg", + "audioUrls": [], + "childPosts": [ + { + "id": "23b90ea3-3236-4d88-81d3-f978e8f0a29c", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-22T17:33:13.785269Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/23b90ea3-3236-4d88-81d3-f978e8f0a29c/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "5088adf9-85fd-4f51-a514-005aae2e1027", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "an explosion topples the trees and benches in the park", + "mode": "custom", + "modelName": "imagine_xdit_1" + }, + { + "id": "d5d9a592-250b-4f0e-85a4-c51463852834", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-22T17:31:48.884685Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/d5d9a592-250b-4f0e-85a4-c51463852834/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "5088adf9-85fd-4f51-a514-005aae2e1027", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "", + "mode": "normal", + "modelName": "imagine_xdit_1" + }, + { + "id": "ddb08c24-1ad2-44dc-b9fe-a7850d0e512a", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-22T17:29:16.206510Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/ddb08c24-1ad2-44dc-b9fe-a7850d0e512a/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "5088adf9-85fd-4f51-a514-005aae2e1027", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "", + "mode": "normal", + "modelName": "imagine_xdit_1" + }, + { + "id": "be350818-6610-461b-8103-e0a5e0548639", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-22T17:28:00.140298Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/be350818-6610-461b-8103-e0a5e0548639/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "5088adf9-85fd-4f51-a514-005aae2e1027", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "", + "mode": "normal", + "modelName": "imagine_xdit_1" + } + ], + "originalPrompt": "", + "userInteractionStatus": { + "likeStatus": true + }, + "modelName": "imagine_h_1", + "thumbnailImageUrl": "https://imagine-public.x.ai/cdn-cgi/image/width=500,fit=scale-down,format=auto/imagine-public/share-images/5088adf9-85fd-4f51-a514-005aae2e1027.jpg" + }, + { + "id": "2d8260d7-3b7c-4bc1-84ca-6e82dd892c39", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-22T00:14:15.635290Z", + "prompt": "an alien in the hallway", + "mediaType": "MEDIA_POST_TYPE_IMAGE", + "mediaUrl": "https://imagine-public.x.ai/imagine-public/images/2d8260d7-3b7c-4bc1-84ca-6e82dd892c39.png", + "mimeType": "image/png", + "audioUrls": [], + "childPosts": [ + { + "id": "6128c2c7-d353-426f-a7e0-de052a014381", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-22T17:23:14.118415Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/6128c2c7-d353-426f-a7e0-de052a014381/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "2d8260d7-3b7c-4bc1-84ca-6e82dd892c39", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "alien runs down the hallway chasing after humans", + "mode": "custom", + "modelName": "imagine_xdit_1" + }, + { + "id": "8f7cf34b-a44a-4f1f-9199-47ad2a4fbfcc", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-22T17:21:45.452694Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/8f7cf34b-a44a-4f1f-9199-47ad2a4fbfcc/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "2d8260d7-3b7c-4bc1-84ca-6e82dd892c39", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "alien dances in the hallway", + "mode": "custom", + "modelName": "imagine_xdit_1" + }, + { + "id": "019a9e76-e68b-4243-a479-7842f9d6ec0f", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-22T00:14:39.537709Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/019a9e76-e68b-4243-a479-7842f9d6ec0f/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "2d8260d7-3b7c-4bc1-84ca-6e82dd892c39", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "alien walks down the hallway", + "mode": "custom", + "modelName": "imagine_xdit_1" + } + ], + "originalPrompt": "an alien in the hallway", + "userInteractionStatus": { + "likeStatus": true + }, + "modelName": "imagine_h_1", + "thumbnailImageUrl": "https://imagine-public.x.ai/cdn-cgi/image/width=500,fit=scale-down,format=auto/imagine-public/images/2d8260d7-3b7c-4bc1-84ca-6e82dd892c39.png" + }, + { + "id": "990ddf90-8f34-42b1-81a5-39c509d62ff7", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-22T17:00:16.178428Z", + "prompt": "A dog wearing oversized glasses is held by a hand, with another dog nuzzling it near a window with a city view.", + "mediaType": "MEDIA_POST_TYPE_IMAGE", + "mediaUrl": "https://imagine-public.x.ai/imagine-public/share-images/990ddf90-8f34-42b1-81a5-39c509d62ff7.jpg", + "mimeType": "image/jpeg", + "audioUrls": [], + "childPosts": [ + { + "id": "640ddff1-e090-46e9-9595-b956cdd38775", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-22T17:17:34.830503Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/640ddff1-e090-46e9-9595-b956cdd38775/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "990ddf90-8f34-42b1-81a5-39c509d62ff7", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "", + "mode": "normal", + "modelName": "imagine_xdit_1" + }, + { + "id": "a1057c67-399f-4a21-8e3d-eb7f48cf8765", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-22T17:14:22.396685Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/a1057c67-399f-4a21-8e3d-eb7f48cf8765/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "990ddf90-8f34-42b1-81a5-39c509d62ff7", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "", + "mode": "normal", + "modelName": "imagine_xdit_1" + } + ], + "originalPrompt": "A dog wearing oversized glasses is held by a hand, with another dog nuzzling it near a window with a city view.", + "userInteractionStatus": { + "likeStatus": true + }, + "modelName": "imagine_h_1", + "thumbnailImageUrl": "https://imagine-public.x.ai/cdn-cgi/image/width=500,fit=scale-down,format=auto/imagine-public/share-images/990ddf90-8f34-42b1-81a5-39c509d62ff7.jpg" + }, + { + "id": "5ef078a9-e4af-4354-a469-abd5d60a3882", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-22T04:24:17.856448Z", + "prompt": "A rainy train platform with a sleek train, illuminated street lamps, wet cobblestones, and scattered autumn leaves, creating a moody, atmospheric scene.", + "mediaType": "MEDIA_POST_TYPE_IMAGE", + "mediaUrl": "https://imagine-public.x.ai/imagine-public/share-images/5ef078a9-e4af-4354-a469-abd5d60a3882.jpg", + "mimeType": "image/jpeg", + "audioUrls": [], + "childPosts": [ + { + "id": "45c32947-3431-458f-82cf-1a1f1e5288ee", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-22T04:24:43.661840Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/45c32947-3431-458f-82cf-1a1f1e5288ee/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "5ef078a9-e4af-4354-a469-abd5d60a3882", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "", + "mode": "normal", + "modelName": "imagine_xdit_1" + } + ], + "originalPrompt": "", + "userInteractionStatus": { + "likeStatus": true + }, + "modelName": "imagine_h_1", + "thumbnailImageUrl": "https://imagine-public.x.ai/cdn-cgi/image/width=500,fit=scale-down,format=auto/imagine-public/share-images/5ef078a9-e4af-4354-a469-abd5d60a3882.jpg" + }, + { + "id": "21a79085-e206-4b0b-88ac-5f2b7a453e45", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-21T23:40:41.993980Z", + "prompt": "A black panther lounges on an ornate chandelier in a lavish, gilded room with multiple chandeliers and elegant decor.", + "mediaType": "MEDIA_POST_TYPE_IMAGE", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/21a79085-e206-4b0b-88ac-5f2b7a453e45/content", + "mimeType": "image/jpeg", + "audioUrls": [], + "childPosts": [ + { + "id": "8e340f1f-f477-4b52-9337-58d1a6696ff6", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-21T23:41:07.708119Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/8e340f1f-f477-4b52-9337-58d1a6696ff6/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "21a79085-e206-4b0b-88ac-5f2b7a453e45", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "", + "mode": "normal", + "modelName": "imagine_xdit_1" + } + ], + "originalPrompt": "", + "userInteractionStatus": { + "likeStatus": true + }, + "modelName": "imagine_h_1" + }, + { + "id": "6136f31a-4aaf-48e0-ab86-fe9871feca91", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-21T23:33:38.986385Z", + "prompt": "a photorealistic pirate ship sailing", + "mediaType": "MEDIA_POST_TYPE_IMAGE", + "mediaUrl": "https://imagine-public.x.ai/imagine-public/images/6136f31a-4aaf-48e0-ab86-fe9871feca91.png", + "mimeType": "image/png", + "audioUrls": [], + "childPosts": [ + { + "id": "30e27f72-da40-48ff-8ddf-2a064434da99", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-21T23:34:05.919219Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/30e27f72-da40-48ff-8ddf-2a064434da99/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "6136f31a-4aaf-48e0-ab86-fe9871feca91", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "the pirate ship is sailing and suddenly gets attacked by a sea monster", + "mode": "custom", + "modelName": "imagine_xdit_1" + } + ], + "originalPrompt": "a photorealistic pirate ship sailing", + "userInteractionStatus": { + "likeStatus": true + }, + "modelName": "imagine_h_1", + "thumbnailImageUrl": "https://imagine-public.x.ai/cdn-cgi/image/width=500,fit=scale-down,format=auto/imagine-public/images/6136f31a-4aaf-48e0-ab86-fe9871feca91.png" + }, + { + "id": "dcecdbec-12b1-4614-bf7a-edf86fd10fbc", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-21T03:47:54.420776Z", + "prompt": "a video of a dog eating a cake", + "mediaType": "MEDIA_POST_TYPE_IMAGE", + "mediaUrl": "https://imagine-public.x.ai/imagine-public/images/dcecdbec-12b1-4614-bf7a-edf86fd10fbc.png", + "mimeType": "image/png", + "audioUrls": [], + "childPosts": [ + { + "id": "f54b0aef-b320-4987-8f31-f89152f501a6", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-21T03:48:20.217760Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/f54b0aef-b320-4987-8f31-f89152f501a6/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "dcecdbec-12b1-4614-bf7a-edf86fd10fbc", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "", + "mode": "extremely-crazy", + "modelName": "imagine_xdit_1" + } + ], + "originalPrompt": "a video of a dog eating a cake", + "userInteractionStatus": { + "likeStatus": true + }, + "modelName": "imagine_h_1", + "thumbnailImageUrl": "https://imagine-public.x.ai/cdn-cgi/image/width=500,fit=scale-down,format=auto/imagine-public/images/dcecdbec-12b1-4614-bf7a-edf86fd10fbc.png" + } + ], + "nextCursor": "1761018527111" +} diff --git a/crates/api_clients/grok_client/src/requests/media_post_list/grok_list_media_posts.rs b/crates/api_clients/grok_client/src/requests/media_post_list/grok_list_media_posts.rs new file mode 100644 index 0000000000..475d8c99af --- /dev/null +++ b/crates/api_clients/grok_client/src/requests/media_post_list/grok_list_media_posts.rs @@ -0,0 +1,204 @@ +use crate::client::browser_user_agents::FIREFOX_143_MAC_USER_AGENT; +use crate::datatypes::api::file_id::FileId; +use crate::datatypes::api::post_id::PostId; +use crate::datatypes::api::user_id::UserId; +use crate::error::grok_client_error::GrokClientError; +use crate::error::grok_error::GrokError; +use crate::error::grok_generic_api_error::GrokGenericApiError; +use crate::requests::media_post_list::request::{FilterData, MediaPostListRawRequest}; +use crate::requests::media_post_list::response::{PostItem, PostListRawResponse}; +use crate::requests::upload_file::grok_upload_file::{GrokUploadFile, GrokUploadFileResponse}; +use crate::utils::user_and_file_id_to_image_url::user_and_file_id_to_image_url; +use log::{error, info}; +use std::time::Duration; +use wreq::header::{ACCEPT, ACCEPT_ENCODING, ACCEPT_LANGUAGE, CACHE_CONTROL, CONNECTION, CONTENT_TYPE, COOKIE, ORIGIN, PRAGMA, REFERER, TE, USER_AGENT}; +use wreq::Client; +use wreq_util::Emulation; + +const MEDIA_LIST_URL: &str = "https://grok.com/rest/media/post/list"; + +/// Request builder +pub struct GrokMediaPostListRequest<'a> { + pub cookie: &'a str, + + /// Optional cursor + pub cursor: Option, + + pub request_timeout: Option, +} + +/// Response type +#[derive(Debug, Clone)] +pub struct GrokMediaPostList { + /// List of posts + pub posts: Vec, + + /// Cursor for the next items. + pub next_cursor: Option, +} + +#[derive(Debug, Clone)] +pub struct MediaPost { + pub post_id: PostId, + + /// Only populated if there's a video and all the video data is present. + pub video_data: Option +} + +#[derive(Debug, Clone)] +pub struct VideoData { + pub file_id: FileId, + pub video_url: String, + pub user_prompt: Option, +} + +impl <'a> GrokMediaPostListRequest<'a> { + + pub async fn send(&self) -> Result { + info!("Configuring client..."); + + let client = Client::builder() + .emulation(Emulation::Firefox143) + .build() + .map_err(|err| GrokClientError::WreqClientError(err))?; + + // TODO: Headers were from Chromium, not Firefox. Partial implementation. + let mut request_builder = client.post(MEDIA_LIST_URL) + // TODO: Missing header "baggage" + // TODO: Missing header "sentry-trace" + // TODO: Missing header "traceparent" + // TODO: Missing header "x-statsig-id" + // TODO: Missing header "x-xai-request-id" + //.header(CACHE_CONTROL, "no-cache") // NB: Not present in firefox + //.header(PRAGMA, "no-cache") // NB: Not present in firefox + //.header("sec-ch-ua", "") // NB: Not present in firefox + //.header("sec-ch-ua-mobile", "") // NB: Not present in firefox + //.header("sec-ch-ua-platform", "") // NB: Not present in firefox + .header(USER_AGENT, FIREFOX_143_MAC_USER_AGENT) + .header(ACCEPT, "*/*") + .header(ACCEPT_LANGUAGE, "en-US,en;q=0.5") + .header(ACCEPT_ENCODING, "gzip, deflate, br, zstd") + .header(REFERER, "https://grok.com/imagine/favorites") + .header(CONTENT_TYPE, "application/json") + .header(ORIGIN, "https://grok.com") + .header("Sec-GPC", "1") + .header(CONNECTION, "keep-alive") + .header(COOKIE, self.cookie.to_string()) + .header("sec-fetch-dest", "empty") + .header("sec-fetch-mode", "cors") + .header("sec-fetch-site", "same-origin") + .header("Priority", "u=4") + .header(TE, "trailers"); + + if let Some(timeout) = self.request_timeout { + request_builder = request_builder.timeout(timeout); + } + + let request_body = MediaPostListRawRequest { + limit: 40, + filter: FilterData { + source: "MEDIA_POST_SOURCE_LIKED".to_string(), + }, + }; + + let http_request = request_builder.json(&request_body) + .build() + .map_err(|err| { + error!("Error building create media request: {:?}", err); + GrokClientError::WreqClientError(err) + })?; + + let response = client.execute(http_request) + .await + .map_err(|err| { + error!("Error during create media: {:?}", err); + GrokGenericApiError::WreqError(err) + })?; + + let status = response.status(); + + let response_body = response.text() + .await + .map_err(|err| { + error!("Error reading Grok create media response body: {:?}", err); + GrokGenericApiError::WreqError(err) + })?; + + // TODO: Handle errors (Cloudflare, Grok, etc.) + if !status.is_success() { + error!("Upload file request returned an error (code {}) : {:?}", status.as_u16(), response_body); + //return Err(classify_general_http_status_code_and_body(status, response_body)); + } + + let response : PostListRawResponse = serde_json::from_str(&response_body) + .map_err(|err| GrokGenericApiError::SerdeResponseParseErrorWithBody(err, response_body.to_string()))?; + + let mut posts = Vec::new(); + + for post in response.posts.into_iter() { + let post_id = post.id; + let mut video_data = None; + + for child in post.child_posts.into_iter() { + // Maybe children can have more than one video? + if let Some(url) = child.media_url { + let mut has_video = false; + if url.to_lowercase().contains(".mp4") { + has_video = true; + } + if has_video { + video_data = Some(VideoData { + file_id: FileId(child.id), + video_url: url, + user_prompt: child.original_prompt, + }); + } + } + } + + posts.push(MediaPost { + post_id: PostId(post_id), + video_data, + }) + } + + Ok(GrokMediaPostList { + posts, + next_cursor: response.next_cursor, + }) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::test_utils::get_test_cookies::get_test_cookies; + use crate::test_utils::setup_test_logging::setup_test_logging; + use errors::AnyhowResult; + use log::LevelFilter; + + #[tokio::test] + #[ignore] // Client side tests only + async fn create_media_post() -> AnyhowResult<()> { + setup_test_logging(LevelFilter::Info); + + let cookies = get_test_cookies()?; + + let request = GrokMediaPostListRequest { + cookie: &cookies, + request_timeout: None, + cursor: None, + }; + + let result = request.send().await?; + + println!("[test] Next Cursor: {:?}", result.next_cursor); + + for post in result.posts { + println!("[test] Post : {:?}", post); + } + + assert_eq!(1, 2); + Ok(()) + } +} diff --git a/crates/api_clients/grok_client/src/requests/media_post_list/mod.rs b/crates/api_clients/grok_client/src/requests/media_post_list/mod.rs new file mode 100644 index 0000000000..2f3476f8e8 --- /dev/null +++ b/crates/api_clients/grok_client/src/requests/media_post_list/mod.rs @@ -0,0 +1,3 @@ +mod response; +mod request; +pub mod grok_list_media_posts; \ No newline at end of file diff --git a/crates/api_clients/grok_client/src/requests/media_post_list/request.rs b/crates/api_clients/grok_client/src/requests/media_post_list/request.rs new file mode 100644 index 0000000000..89d9a47123 --- /dev/null +++ b/crates/api_clients/grok_client/src/requests/media_post_list/request.rs @@ -0,0 +1,24 @@ +use serde::Serialize; + +#[derive(Serialize)] +pub struct MediaPostListRawRequest { + /// eg. 40 + pub limit: usize, + pub filter: FilterData, +} + +#[derive(Serialize)] +pub struct FilterData { + /// eg. "MEDIA_POST_SOURCE_LIKED" + pub source: String, +} + +/* +{ + "limit":40, + "filter":{ + "source":"MEDIA_POST_SOURCE_LIKED" + } +} +*/ + diff --git a/crates/api_clients/grok_client/src/requests/media_post_list/response.rs b/crates/api_clients/grok_client/src/requests/media_post_list/response.rs new file mode 100644 index 0000000000..6d66ba6a19 --- /dev/null +++ b/crates/api_clients/grok_client/src/requests/media_post_list/response.rs @@ -0,0 +1,84 @@ +use serde::Deserialize; + +#[derive(Deserialize, Debug)] +pub (crate) struct PostListRawResponse { + pub posts: Vec, + + #[serde(rename = "nextCursor")] + pub next_cursor: Option, +} + +#[derive(Deserialize, Debug)] +pub (crate) struct PostItem { + /// The "id" of the post. + /// This is how we assert video task completion + pub id: String, + + /// eg. `MEDIA_POST_TYPE_IMAGE` + #[serde(rename = "mediaType")] + pub media_type: Option, + + /// eg. "https://imagine-public.x.ai/imagine-public/share-images/abd9331b-c5ac-49cc-8bec-c410c7efde98.jpg" + #[serde(rename = "mediaUrl")] + pub media_url: Option, + + #[serde(rename = "childPosts")] + pub child_posts: Vec, +} + +#[derive(Deserialize, Debug)] +pub (crate) struct ChildPostItem { + pub id: String, + + /// eg. `MEDIA_POST_TYPE_VIDEO` + #[serde(rename = "mediaType")] + pub media_type: Option, + + /// eg. "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/ecec690e-15bd-4f5f-b4e9-9b8733c3fd69/generated_video.mp4" + #[serde(rename = "mediaUrl")] + pub media_url: Option, + + /// The unmodified user prompt + #[serde(rename = "originalPrompt")] + pub original_prompt: Option, +} + +/* +{ + "posts": [ + { + "id": "abd9331b-c5ac-49cc-8bec-c410c7efde98", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-30T23:49:37.583477Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_IMAGE", + "mediaUrl": "https://imagine-public.x.ai/imagine-public/share-images/abd9331b-c5ac-49cc-8bec-c410c7efde98.jpg", + "mimeType": "image/jpeg", + "audioUrls": [], + "childPosts": [ + { + "id": "ecec690e-15bd-4f5f-b4e9-9b8733c3fd69", + "userId": "85980643-ffab-4984-a3de-59a608c47d7f", + "createTime": "2025-10-30T23:50:04.862487Z", + "prompt": "", + "mediaType": "MEDIA_POST_TYPE_VIDEO", + "mediaUrl": "https://assets.grok.com/users/85980643-ffab-4984-a3de-59a608c47d7f/generated/ecec690e-15bd-4f5f-b4e9-9b8733c3fd69/generated_video.mp4", + "mimeType": "video/mp4", + "originalPostId": "abd9331b-c5ac-49cc-8bec-c410c7efde98", + "audioUrls": [], + "childPosts": [], + "originalPrompt": "an anime girl runs away from a giant t-rex", + "mode": "custom", + "modelName": "imagine_xdit_1" + } + ], + "originalPrompt": "", + "userInteractionStatus": { + "likeStatus": true + }, + "modelName": "imagine_h_1", + "thumbnailImageUrl": "https://imagine-public.x.ai/cdn-cgi/image/width=500,fit=scale-down,format=auto/imagine-public/share-images/abd9331b-c5ac-49cc-8bec-c410c7efde98.jpg" + }, + { + "id": "3c896963-8e6b-4e71-83e1-4253b2bf2ac8", + */ \ No newline at end of file diff --git a/crates/api_clients/grok_client/src/requests/mod.rs b/crates/api_clients/grok_client/src/requests/mod.rs index 7e60330501..18714cde96 100644 --- a/crates/api_clients/grok_client/src/requests/mod.rs +++ b/crates/api_clients/grok_client/src/requests/mod.rs @@ -5,3 +5,4 @@ pub mod index_page; pub mod like_media; pub mod upload_file; pub mod video_chat; +mod media_post_list;