+
     	i                     h    R t ^ RIHt ^ RIHtHtHtHtHtH	t	 ^ RI
t
 ! R R]4      t ! R R4      tR# )z
Upload-Post API Client

Cross-platform social media upload for TikTok, Instagram, YouTube, LinkedIn,
Facebook, Pinterest, Threads, Reddit, Bluesky, and X (Twitter).
)Path)DictListUnionOptionalAnyLiteralNc                       ] tR t^tRtRtR# )UploadPostErrorz)Base exception for Upload-Post API errors N)__name__
__module____qualname____firstlineno____doc____static_attributes__r       \/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/upload_post/api_client.pyr
   r
      s    3r   r
   c                     a  ] tR t^t o RtRtV 3R lR ltRAV 3R lR lltRBV 3R lR	 lltRCV 3R
 lR llt	RCV 3R lR llt
V 3R lR ltV 3R lR ltRDV 3R lR lltREV 3R lR lltREV 3R lR lltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R  lR! ltRFV 3R" lR# lltV 3R$ lR% ltRGV 3R& lR' lltRHV 3R( lR) lltV 3R* lR+ ltV 3R, lR- ltRIV 3R. lR/ lltV 3R0 lR1 ltV 3R2 lR3 ltV 3R4 lR5 ltRJV 3R6 lR7 lltV 3R8 lR9 lt RHV 3R: lR; llt!RHV 3R< lR= llt"RHV 3R> lR? llt#R@t$V t%R# )KUploadPostClienta  
Upload-Post API Client

Supports uploading to: TikTok, Instagram, YouTube, LinkedIn, Facebook,
Pinterest, Threads, Reddit, Bluesky, X (Twitter)

Example:
    >>> client = UploadPostClient("YOUR_API_KEY")
    >>> response = client.upload_video(
    ...     "video.mp4",
    ...     title="My awesome video",
    ...     user="my-profile",
    ...     platforms=["tiktok", "instagram"]
    ... )
zhttps://api.upload-post.com/apic                    < V ^8  d   QhRS[ /# )   api_key)str)format__classdict__s   "r   __annotate__UploadPostClient.__annotate__%   s       r   c                    Wn         \        P                  ! 4       V n        V P                  P                  P                  RRV P                    2RR/4       R# )zV
Initialize the Upload-Post client.

Args:
    api_key: Your API key from Upload-Post
AuthorizationzApikey z
User-Agentzupload-post-python-client/2.0.0N)r   requestsSessionsessionheadersupdate)selfr   s   &&r   __init__UploadPostClient.__init__%   sL     '')##wt||n5;%
 	r   Nc                   < V ^8  d   QhRS[ RS[ RS[S[S[,          ,          RS[S[S[,          ,          RS[S[,          RS[S[,          RS[/# )r   endpointmethoddatafiles	json_dataparamsreturn)r   r   r   tupler   )r   r   s   "r   r   r   3   st     'M 'M'M 'M tE{#	'M
 U$'M D>'M 'M 
'Mr   c                n   V P                    V 2p VR8X  d   V P                  P                  WvR7      pMVR8X  dD   V'       d   V P                  P                  WuR7      pMtV P                  P                  WsVR7      pMVVR8X  dB   V'       d   V P                  P	                  WuR7      pM*V P                  P	                  V4      pM\        RV 24      hVP                  4        VP                  4       #   \        P                  P                   d   p	\        T	4      p
\        T	R4      '       do   T	P                  ea    T	P                  P                  4       pTP                  R
4      ;'       g%    TP                  R4      ;'       g    \        T4      p
M    M; i\        RT
 24      T	hR	p	?	ii ; i)zMake an API request.GETr.   POST)jsonr+   r,   DELETEzUnsupported HTTP method: responseNmessagedetailzAPI request failed: )BASE_URLr"   getpostdeleter
   raise_for_statusr5   r    
exceptionsRequestExceptionr   hasattrr8   )r%   r)   r*   r+   r,   r-   r.   urlr8   e	error_msg
error_datas   &&&&&&&     r   _requestUploadPostClient._request3   su    z*	M<<++C+?6!#||000EH#||00u0MH8##||2232GH#||2237H%(A&&JKK%%'==?"""33 	MAIq*%%!***@!"!2J *y 9 h hZ^^H=U h hY\]gYhI!$8"DE1L	MsI   2C6 A	C6 A&C6 6F4+F/1F3FFF/FF//F4c                   < V ^8  d   QhRS[ S[,          RS[RS[RS[ S[,          RS[S[,          RS[S[,          RS[S[,          RS[S[,          R	S[S[,          R
S[S[,          /
# )r   r+   usertitle	platformsfirst_commentalt_textscheduled_datetimezoneadd_to_queueasync_upload)r   r0   r   r   bool)r   r   s   "r   r   r   \   s     ;0 ;05k;0 ;0 	;0
 9;0  };0 3-;0 !;0 3-;0 tn;0 tn;0r   c                   VP                  RV34       VP                  RV34       V F  pVP                  RV34       K  	  V'       d   VP                  RV34       V'       d   VP                  RV34       V'       d   VP                  RV34       V'       d   VP                  RV34       V	e+   VP                  R	\        V	4      P                  4       34       V
e+   VP                  R
\        V
4      P                  4       34       . ROpV F5  pVP                  V4      '       g   K  VP                  WV,          34       K7  	  . ROpV F5  pVP                  V4      '       g   K  VP                  WV,          34       K7  	  . ROpV F5  pVP                  V4      '       g   K  VP                  WV,          34       K7  	  R# )zAdd common upload parameters.rJ   rK   
platform[]rM   rN   rO   rP   NrQ   rR   )	bluesky_titleinstagram_titlefacebook_titletiktok_titlelinkedin_titlex_titleyoutube_titlepinterest_titlethreads_title)descriptionlinkedin_descriptionyoutube_descriptionfacebook_descriptiontiktok_descriptionpinterest_description)instagram_first_commentfacebook_first_commentx_first_commentthreads_first_commentyoutube_first_commentreddit_first_commentbluesky_first_comment)appendr   lowerr<   )r%   r+   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   kwargsptitle_overrideskeydesc_overridescomment_overridess   &&&&&&&&&&&,     r   _add_common_params#UploadPostClient._add_common_params\   sw    	VTN#We$%AKKq)*  KK-89KKX./KK)>:;KKX./#KK\):)@)@)BCD#KK\):)@)@)BCD
 #Czz#S+./ #

 "Czz#S+./ "


 %Czz#S+./ %r   c                6   < V ^8  d   QhRS[ S[,          RS[/# r   r+   is_videor   r0   rS   )r   r   s   "r   r   r      s#     U UtE{ Ud Ur   c                x   VP                  R4      e2   VP                  R\        VR,          4      P                  4       34       VP                  R4      e2   VP                  R\        VR,          4      P                  4       34       VP                  R4      e2   VP                  R\        VR,          4      P                  4       34       V'       Edi   VP                  R4      '       d   VP                  RVR,          34       VP                  R4      e2   VP                  R\        VR,          4      P                  4       34       VP                  R4      e2   VP                  R\        VR,          4      P                  4       34       VP                  R4      e$   VP                  R\        VR,          4      34       VP                  R	4      e2   VP                  R	\        VR	,          4      P                  4       34       VP                  R
4      '       d   VP                  R
VR
,          34       R# R# VP                  R4      e2   VP                  R\        VR,          4      P                  4       34       VP                  R4      e&   VP                  R\        VR,          4      34       R# R# )zAdd TikTok-specific parameters.disable_commentNbrand_content_togglebrand_organic_toggleprivacy_leveldisable_duetdisable_stitchcover_timestampis_aigc	post_modeauto_add_musicphoto_cover_indexr<   rl   r   rm   r%   r+   rx   rn   s   &&&,r   _add_tiktok_params#UploadPostClient._add_tiktok_params   s+   ::'(4KK*C7H0I,J,P,P,RST::,-9KK/V<R5S1T1Z1Z1\]^::,-9KK/V<R5S1T1Z1Z1\]^8zz/**_f_.EFGzz.)5^S1G-H-N-N-PQRzz*+7-s6:J3K/L/R/R/TUVzz+,8.F;L4M0NOPzz)$0YF9,=(>(D(D(FGHzz+&&[&*=>? ' zz*+7-s6:J3K/L/R/R/TUVzz-.:0#f=P6Q2RST ;r   c                6   < V ^8  d   QhRS[ S[,          RS[/# rw   ry   )r   r   s   "r   r   r      s#     F F$u+ F Fr   c                T   VP                  R4      '       d   VP                  RVR,          34       VP                  R4      '       d   VP                  RVR,          34       VP                  R4      '       d   VP                  RVR,          34       VP                  R4      '       d   VP                  RVR,          34       V'       d   VP                  R4      e2   VP                  R\        VR,          4      P                  4       34       VP                  R4      '       d   VP                  RVR,          34       VP                  R4      '       d   VP                  RVR,          34       VP                  R	4      '       d   VP                  R	VR	,          34       R# R# R# )
z"Add Instagram-specific parameters.
media_typecollaborators	user_tagslocation_idshare_to_feedN	cover_url
audio_namethumb_offsetr   r   s   &&&,r   _add_instagram_params&UploadPostClient._add_instagram_params   sE   ::l##KKvl';<=::o&&KK&*ABC::k""KKf[&9:;::m$$KK}(=>?zz/*6_c&2I.J.P.P.RSTzz+&&[&*=>?zz,''\6,+?@Azz.))^VN-CDE * r   c                0   < V ^8  d   QhRS[ S[,          /# r   r+   r   r0   )r   r   s   "r   r   r      s     #D #DU #Dr   c                ,   VP                  R4      '       di   VR,          p\        V\        4      '       d.   VP                  R4       Uu. uF  qDP	                  4       NK  	  ppV F  pVP                  RV34       K  	  VP                  R4      '       d   VP                  RVR,          34       VP                  R4      '       d   VP                  RVR,          34       VP                  R4      e2   VP                  R\        VR,          4      P                  4       34       VP                  R4      '       d   VP                  RVR,          34       VP                  R	4      e2   VP                  R	\        VR	,          4      P                  4       34       VP                  R
4      '       d   VP                  R
VR
,          34       VP                  R4      e2   VP                  R\        VR,          4      P                  4       34       VP                  R4      e2   VP                  R\        VR,          4      P                  4       34       VP                  R4      '       d   VP                  RVR,          34       VP                  R4      '       d   VP                  RVR,          34       VP                  R4      '       d   VP                  RVR,          34       VP                  R4      '       d   VP                  RVR,          34       VP                  R4      e2   VP                  R\        VR,          4      P                  4       34       VP                  R4      '       d   VP                  RVR,          34       R# R# u upi )z Add YouTube-specific parameters.tags,ztags[]
categoryIdprivacyStatus
embeddableNlicensepublicStatsViewablethumbnail_urlselfDeclaredMadeForKidscontainsSyntheticMediadefaultLanguagedefaultAudioLanguageallowedCountriesblockedCountrieshasPaidProductPlacementrecordingDate)r<   
isinstancer   splitstriprl   rm   )r%   r+   rn   r   ttags   &&,   r   _add_youtube_params$UploadPostClient._add_youtube_params   s   ::f&>D$$$+/::c?;?a	?;XsO, ::l##KKvl';<=::o&&KK&*ABC::l#/KKs6,+?'@'F'F'HIJ::i  KKF9$567::+,8KK.F;P4Q0R0X0X0Z[\::o&&KK&*ABC::/0<KK2C?X8Y4Z4`4`4bcd::./;KK13v>V7W3X3^3^3`ab::'((KK*F3D,EFG::,--KK/8N1OPQ::())KK+V4F-GHI::())KK+V4F-GHI::/0<KK2C?X8Y4Z4`4`4bcd::o&&KK&*ABC '; <s   
Nc                0   < V ^8  d   QhRS[ S[,          /# r   r   )r   r   s   "r   r   r      s     X Xe Xr   c                    VP                  R4      '       d   VP                  RVR,          34       VP                  R4      '       d   VP                  RVR,          34       R# R# )z!Add LinkedIn-specific parameters.
visibilitytarget_linkedin_page_idNr<   rl   r%   r+   rn   s   &&,r   _add_linkedin_params%UploadPostClient._add_linkedin_params   sT    ::l##KKvl';<=::/00KK2F;T4UVW 1r   c                <   < V ^8  d   QhRS[ S[,          RS[RS[/# )r   r+   rx   is_textry   )r   r   s   "r   r   r      s,     L Le L LW[ Lr   c                   VP                  R4      '       d   VP                  RVR,          34       V'       dc   VP                  R4      '       d   VP                  RVR,          34       VP                  R4      '       d   VP                  RVR,          34       V'       d6   VP                  R4      '       d   VP                  RVR,          34       R# R# R# )z!Add Facebook-specific parameters.facebook_page_idvideo_statefacebook_media_typefacebook_link_urlNr   )r%   r+   rx   r   rn   s   &&&&,r   _add_facebook_params%UploadPostClient._add_facebook_params   s    ::())KK+V4F-GHIzz-((]F=,ABCzz/002F;P4QRSvzz"566KK,f5H.IJK 77r   c                6   < V ^8  d   QhRS[ S[,          RS[/# rw   ry   )r   r   s   "r   r   r     s#     { {$u+ { {r   c                   VP                  R4      '       d   VP                  RVR,          34       VP                  R4      '       d   VP                  RVR,          34       VP                  R4      '       d   VP                  RVR,          34       V'       d   VP                  R4      '       d   VP                  RVR,          34       VP                  R4      '       d   VP                  RVR,          34       VP                  R4      '       d   VP                  RVR,          34       VP                  R4      e&   VP                  R\        VR,          4      34       R# R# R# )	z"Add Pinterest-specific parameters.pinterest_board_idpinterest_alt_textpinterest_linkpinterest_cover_image_url"pinterest_cover_image_content_typepinterest_cover_image_data$pinterest_cover_image_key_frame_timeN)r<   rl   r   r   s   &&&,r   _add_pinterest_params&UploadPostClient._add_pinterest_params  s-   ::*++KK-v6J/KLM::*++KK-v6J/KLM::&''KK)62B+CDEzz5668&A\:]^_zz>??A6JnCopqzz67796B^;_`azz@AMCSPvIwExyz N r   c                6   < V ^8  d   QhRS[ S[,          RS[/# )r   r+   r   ry   )r   r   s   "r   r   r     s#     .X .X$u+ .X .Xr   c                @   VP                  R4      pV'       d   VR8w  d   VP                  RV34       VP                  R4      e2   VP                  R\        VR,          4      P                  4       34       VP                  R4      '       d   VP                  RVR,          34       VP                  R4      '       d   VP                  RVR,          34       VP                  R4      e2   VP                  R\        VR,          4      P                  4       34       VP                  R4      '       d   VP                  RVR,          34       VP                  R	4      e2   VP                  R	\        VR	,          4      P                  4       34       VP                  R
4      '       d   VP                  R
VR
,          34       VP                  R4      e2   VP                  R\        VR,          4      P                  4       34       V'       g   VP                  R4      '       di   VR,          p\	        V\        4      '       d.   VP                  R4       Uu. uF  qfP                  4       NK  	  ppV F  pVP                  RV34       K  	  VP                  R4      '       d   VP                  RVR,          34       R# R# VP                  R4      '       d   VP                  RVR,          34       VP                  R4      '       d   VP                  RVR,          34       VP                  R4      '       d   VR,          p\	        V\        4      '       d.   VP                  R4       U	u. uF  qP                  4       NK  	  pp	V F  p
VP                  RV
34       K  	  VP                  R4      '       d$   VP                  R\        VR,          4      34       VP                  R4      '       d   VP                  RVR,          34       R# R# R# u upi u up	i )z$Add X (Twitter) specific parameters.reply_settingseveryonenullcastNquote_tweet_idgeo_place_idfor_super_followers_onlycommunity_idshare_with_followersdirect_message_deep_linkx_long_text_as_posttagged_user_idsr   ztagged_user_ids[]place_idpost_urlcard_uripoll_optionszpoll_options[]poll_durationpoll_reply_settings)r<   rl   r   rm   r   r   r   )r%   r+   r   rn   r   idsr   uid	poll_optsoopts   &&&,       r   _add_x_paramsUploadPostClient._add_x_params  sE   $45n
:KK)>:;::j!-KKS
);%<%B%B%DEF::&''KK)62B+CDE::n%%KK)?@A::01=KK3S@Z9[5\5b5b5def::n%%KK)?@A::,-9KK/V<R5S1T1Z1Z1\]^::011KK3V<V5WXY::+,8KK.F;P4Q0R0X0X0Z[\zz+,,./c3''.1iin=n779nC=CKK!4c :; zz*%%Z
);<= & zz*%%Z
);<=zz*%%Z
);<=zz.))">2	i--4=OOC4H I4Hq4HI I$CKK!13 78 %::o..KK#f_6M2N OP::344KK!6?T8U VW 5 * > !Js   P/Pc                0   < V ^8  d   QhRS[ S[,          /# r   r   )r   r   s   "r   r   r   G  s     i iU ir   c                    VP                  R4      e4   VP                  R\        VR,          4      P                  4       34       R# R# )z Add Threads-specific parameters.threads_long_text_as_postNr   r   s   &&,r   _add_threads_params$UploadPostClient._add_threads_paramsG  s=    ::12>KK4c&A\:]6^6d6d6fgh ?r   c                0   < V ^8  d   QhRS[ S[,          /# r   r   )r   r   s   "r   r   r   L  s     : :tE{ :r   c                    VP                  R4      '       d   VP                  RVR,          34       VP                  R4      '       d   VP                  RVR,          34       R# R# )zAdd Reddit-specific parameters.	subredditflair_idNr   r   s   &&,r   _add_reddit_params#UploadPostClient._add_reddit_paramsL  sQ    ::k""KKf[&9:;::j!!KKVJ%789 "r   c          
      ^   < V ^8  d   QhRS[ S[S[3,          RS[RS[RS[S[,          RS[/# )r   
video_pathrK   rJ   rL   r/   )r   r   r   r   r   )r   r   s   "r   r   r   S  sQ     J# J##t)$J# J# 	J#
 9J# 
J#r   c                   . p. pRp \        V4      p	V	P                  4       P                  R4      '       d   VP                  RV	34       M_\	        V4      p
V
P                  4       '       g   \        RV
 24      hV
P                  R4      pVP                  RV
P                  V334       V P                  ! WcW$3/ VB  RV9   d   V P                  ! V3RR/VB  RV9   d   V P                  ! V3RR/VB  R	V9   d   V P                  ! V3/ VB  R
V9   d   V P                  ! V3/ VB  RV9   d   V P                  ! V3RR/VB  RV9   d   V P                  ! V3RR/VB  RV9   d   V P                   ! V3RR/VB  RV9   d   V P"                  ! V3/ VB  T P%                  RRYg'       d   TMRR7      V'       d   VP'                  4        # #   T'       d   TP'                  4        i i ; i)a  
Upload a video to social media platforms.

Args:
    video_path: Path to video file or video URL.
    title: Video title/caption.
    user: User identifier (profile name).
    platforms: Target platforms. Supported: tiktok, instagram, youtube, 
              linkedin, facebook, pinterest, threads, bluesky, x

Keyword Args:
    description: Video description
    first_comment: First comment to post
    scheduled_date: ISO date for scheduling (e.g., "2024-12-25T10:00:00Z")
    timezone: Timezone for scheduled date (e.g., "Europe/Madrid")
    add_to_queue: Add to posting queue
    async_upload: Process asynchronously (default: True)
    
    TikTok:
        privacy_level: PUBLIC_TO_EVERYONE, MUTUAL_FOLLOW_FRIENDS, 
                      FOLLOWER_OF_CREATOR, SELF_ONLY
        disable_duet: Disable duet
        disable_comment: Disable comments
        disable_stitch: Disable stitch
        cover_timestamp: Timestamp in ms for cover
        is_aigc: AI-generated content flag
        post_mode: DIRECT_POST or MEDIA_UPLOAD
        brand_content_toggle: Branded content toggle
        brand_organic_toggle: Brand organic toggle
    
    Instagram:
        media_type: REELS or STORIES
        share_to_feed: Share to feed
        collaborators: Comma-separated collaborator usernames
        cover_url: Custom cover URL
        audio_name: Audio track name
        user_tags: Comma-separated user tags
        location_id: Location ID
        thumb_offset: Thumbnail offset
    
    YouTube:
        tags: List or comma-separated tags
        categoryId: Category ID (default: "22")
        privacyStatus: public, unlisted, private
        embeddable: Allow embedding
        license: youtube, creativeCommon
        publicStatsViewable: Show public stats
        thumbnail_url: Custom thumbnail URL
        selfDeclaredMadeForKids: Made for kids (COPPA)
        containsSyntheticMedia: AI/synthetic content flag
        defaultLanguage: Title/description language (BCP-47)
        defaultAudioLanguage: Audio language (BCP-47)
        allowedCountries: Comma-separated country codes
        blockedCountries: Comma-separated country codes
        hasPaidProductPlacement: Paid placement flag
        recordingDate: Recording date (ISO 8601)
    
    LinkedIn:
        visibility: PUBLIC, CONNECTIONS, LOGGED_IN, CONTAINER
        target_linkedin_page_id: Page ID for organization posts
    
    Facebook:
        facebook_page_id: Facebook Page ID
        video_state: PUBLISHED or DRAFT
        facebook_media_type: REELS or STORIES
    
    Pinterest:
        pinterest_board_id: Board ID
        pinterest_link: Destination link
        pinterest_cover_image_url: Cover image URL
        pinterest_cover_image_key_frame_time: Key frame time in ms
    
    X (Twitter):
        reply_settings: everyone, following, mentionedUsers, subscribers, verified
        nullcast: Promoted-only post
        tagged_user_ids: User IDs to tag
        place_id: Location place ID
        geo_place_id: Geographic place ID
        for_super_followers_only: Exclusive for super followers
        community_id: Community ID
        share_with_followers: Share community post with followers
        x_long_text_as_post: Post long text as single post
    
    Threads:
        threads_long_text_as_post: Post long text as single post

Returns:
    API response with request_id for async uploads.

Raises:
    UploadPostError: If upload fails or video file not found.
NvideozVideo file not found: rbtiktokrx   T	instagramyoutubelinkedinfacebook	pinterestxr   Fthreadsz/uploadr4   r6   zhttp://zhttps://)r   rm   
startswithrl   r   existsr
   opennamert   r   r   r   r   r   r   r   r   rG   close)r%   r   rK   rJ   rL   rn   r+   r,   
video_file	video_strvideo_ps   &&&&&,     r   upload_videoUploadPostClient.upload_videoS  s   H 
"	#JI ++,CDDWi01z*~~''),B7)*LMM$\\$/
gj'ABC##DKFK9$''FtFvFi'**4I$I&II%((88Y&))$9&9Y&))$HHHi'**4I$I&Ii""4AA&AI%((88==FeUY]=^   " z  " s   F.G G+c          
      n   < V ^8  d   QhRS[ S[S[S[3,          ,          RS[RS[RS[ S[,          RS[/# )r   photosrK   rJ   rL   r/   )r   r   r   r   r   )r   r   s   "r   r   r     sV     o oU39%&o o 	o
 9o 
or   c                   . p. p. p V F  p	\        V	4      p
V
P                  4       P                  R4      '       d   VP                  RV
34       KH  \	        V	4      pVP                  4       '       g   \        RV 24      hVP                  R4      pVP                  V4       VP                  RVP                  V334       K  	  V P                  ! WcW$3/ VB  RV9   d   V P                  ! V3RR/VB  RV9   d   V P                  ! V3RR/VB  RV9   d   V P                  ! V3/ VB  R	V9   d   V P                  ! V3RR/VB  R
V9   d   V P                  ! V3RR/VB  RV9   d   V P                  ! V3RR/VB  RV9   d   V P                   ! V3/ VB  RV9   d   V P"                  ! V3/ VB  T P%                  RRYg'       d   TMRR7      V F  pVP'                  4        K  	  #   T F  pTP'                  4        K  	  i ; i)a\  
Upload photos to social media platforms.

Args:
    photos: List of photo file paths or URLs.
    title: Post title/caption.
    user: User identifier (profile name).
    platforms: Target platforms. Supported: tiktok, instagram, linkedin,
              facebook, pinterest, threads, reddit, bluesky, x

Keyword Args:
    description: Photo description
    first_comment: First comment to post
    alt_text: Alt text for accessibility
    scheduled_date: ISO date for scheduling
    timezone: Timezone for scheduled date
    add_to_queue: Add to posting queue
    async_upload: Process asynchronously
    
    TikTok:
        auto_add_music: Auto add music
        disable_comment: Disable comments
        photo_cover_index: Index of photo for cover (0-based)
        brand_content_toggle: Branded content toggle
        brand_organic_toggle: Brand organic toggle
    
    Instagram:
        media_type: IMAGE or STORIES
        collaborators: Comma-separated collaborator usernames
        user_tags: Comma-separated user tags
        location_id: Location ID
    
    LinkedIn:
        visibility: PUBLIC (only PUBLIC supported for photos)
        target_linkedin_page_id: Page ID for organization posts
    
    Facebook:
        facebook_page_id: Facebook Page ID
    
    Pinterest:
        pinterest_board_id: Board ID
        pinterest_alt_text: Alt text
        pinterest_link: Destination link
    
    X (Twitter):
        reply_settings: Who can reply
        nullcast: Promoted-only post
        tagged_user_ids: User IDs to tag
        x_long_text_as_post: Post long text as single post
    
    Threads:
        threads_long_text_as_post: Post long text as single post
    
    Reddit:
        subreddit: Subreddit name (without r/)
        flair_id: Flair template ID

Returns:
    API response.

Raises:
    UploadPostError: If upload fails or photo file not found.
zphotos[]zPhoto file not found: r   r   rx   Fr   r   r   r   r   r   r   redditz/upload_photosr4   Nr6   r   )r   rm   r   rl   r   r  r
   r  r  rt   r   r   r   r   r   r   r   r   rG   r  )r%   r  rK   rJ   rL   rn   r+   r,   opened_filesphoto	photo_strphoto_p
photo_filefs   &&&&&,        r   upload_photosUploadPostClient.upload_photos  s   N $	J	??$//0GHHKKY 78"5kG">>++-0Fwi.PQQ!(d!3J ''
3LL*w||Z.H!IJ   ##DKFK9$''GuGGi'**4J%J6JY&))$9&9Y&))$II&Ii'**4J%J6Ji""4AA&AI%((889$''77==!16UZE`d=e "	 "\	 "s   G	G+ +Hc                B   < V ^8  d   QhRS[ RS[ RS[S[ ,          RS[/# )r   rK   rJ   rL   r/   )r   r   r   )r   r   s   "r   r   r   P  sC     D@ D@D@ D@ 9	D@ 
D@r   c                f   . pV P                   ! WRW3/ VB  RV9   d   V P                  ! V3/ VB  RV9   d   V P                  ! V3RRRR/VB  RV9   d   V P                  ! V3RR/VB  RV9   d   V P                  ! V3/ VB  R	V9   d   V P
                  ! V3/ VB  V P                  R
RVR7      # )a&  
Upload text posts to social media platforms.

Args:
    title: Text content for the post.
    user: User identifier (profile name).
    platforms: Target platforms. Supported: x, linkedin, facebook, 
              threads, reddit, bluesky

Keyword Args:
    first_comment: First comment to post
    scheduled_date: ISO date for scheduling
    timezone: Timezone for scheduled date
    add_to_queue: Add to posting queue
    async_upload: Process asynchronously
    
    LinkedIn:
        target_linkedin_page_id: Page ID for organization posts
    
    Facebook:
        facebook_page_id: Facebook Page ID
        facebook_link_url: URL to attach as link preview
    
    X (Twitter):
        reply_settings: Who can reply
        post_url: URL to attach
        quote_tweet_id: Tweet ID to quote
        poll_options: Poll options (2-4 options)
        poll_duration: Poll duration in minutes (5-10080)
        poll_reply_settings: Who can reply to poll
        card_uri: Card URI for Twitter Cards
        x_long_text_as_post: Post long text as single post
    
    Threads:
        threads_long_text_as_post: Post long text as single post
    
    Reddit:
        subreddit: Subreddit name (without r/)
        flair_id: Flair template ID

Returns:
    API response.

Raises:
    UploadPostError: If upload fails.
r   r   rx   Fr   Tr   r   r  z/upload_textr4   )r+   )rt   r   r   r   r   r   rG   )r%   rK   rJ   rL   rn   r+   s   &&&&, r   upload_textUploadPostClient.upload_textP  s    j EGG"%%d5f5"%%dSUSDSFS)t<T<V<	!$$T4V4y ##D3F3}}^V$}??r   c                   < V ^8  d   QhRS[ S[S[3,          RS[RS[RS[S[,          RS[S[,          RS[S[,          RS[S[,          RS[S[,          R	S[S[,          R
S[S[,          RS[/# )r   document_pathrK   rJ   r_   r   r   rO   rP   rQ   rR   r/   )r   r   r   r   rS   r   )r   r   s   "r   r   r     s     H! H!S$Y'H! H! 	H!
 c]H! SMH! "*#H! !H! 3-H! tnH! tnH! 
H!r   c                4   . p. pRp \        V4      pVP                  4       P                  R4      '       d   VP                  RV34       M_\	        V4      pVP                  4       '       g   \        RV 24      hVP                  R4      pVP                  RVP                  V334       VP                  RV34       VP                  RV34       VP                  R4       V'       d   VP                  RV34       V'       d   VP                  RV34       V'       d   VP                  R	V34       V'       d   VP                  R
V34       V'       d   VP                  RV34       V	e+   VP                  R\        V	4      P                  4       34       V
e+   VP                  R\        V
4      P                  4       34       T P                  RRY'       d   TMRR7      V'       d   VP                  4        # #   T'       d   TP                  4        i i ; i)a  
Upload a document to LinkedIn (PDF, PPT, PPTX, DOC, DOCX).

Args:
    document_path: Path to document file or document URL.
    title: Post title/caption.
    user: User identifier (profile name).
    description: Document description/commentary.
    visibility: PUBLIC, CONNECTIONS, LOGGED_IN, CONTAINER
    target_linkedin_page_id: Page ID for organization posts.
    scheduled_date: ISO date for scheduling.
    timezone: Timezone for scheduled date.
    add_to_queue: Add to posting queue.
    async_upload: Process asynchronously.

Returns:
    API response.

Raises:
    UploadPostError: If upload fails or document file not found.
NdocumentzDocument file not found: r   rJ   rK   r_   r   r   rO   rP   rQ   rR   z/upload_documentr4   r6   r   )rU   r   )r   rm   r   rl   r   r  r
   r  r  rG   r  )r%   r  rK   rJ   r_   r   r   rO   rP   rQ   rR   r+   r,   doc_filedoc_strdoc_ps   &&&&&&&&&&&     r   upload_document UploadPostClient.upload_document  s   D "	!-(G}}))*ABBZ12]+||~~),EeW*MNN ::d+j5::x*@ABKK'KK%()KK23]K89\:67&68OPQ-~>?Z23'^S->-D-D-FGH'^S->-D-D-FGH==!3V$W\ebf=g   x  s%   C<G< G<  G< ;G< BG< <Hc                &   < V ^8  d   QhRS[ RS[/# )r   
request_idr/   r   r   )r   r   s   "r   r   r     s     
^ 
^S 
^T 
^r   c                .    V P                  RRRV/R7      # )z}
Get the status of an async upload.

Args:
    request_id: The request_id from an async upload.

Returns:
    Upload status.
z/uploadposts/statusr2   r$  r3   rG   )r%   r$  s   &&r   
get_statusUploadPostClient.get_status  s      }}2E<Q[B\}]]r   c                ,   < V ^8  d   QhRS[ RS[ RS[/# )r   pagelimitr/   )intr   )r   r   s   "r   r   r     s'     c c c cT cr   c                2    V P                  RRRVRV/R7      # )z}
Get upload history.

Args:
    page: Page number.
    limit: Items per page (20, 50, or 100).

Returns:
    Upload history.
z/uploadposts/historyr2   r+  r,  r3   r'  )r%   r+  r,  s   &&&r   get_historyUploadPostClient.get_history  s%     }}3UFDRY[`Ca}bbr   c                L   < V ^8  d   QhRS[ RS[S[S[ ,          ,          RS[/# )r   profile_usernamerL   r/   r   r   r   r   )r   r   s   "r   r   r     s1     i ic ihtCy>Q i]a ir   c                    / pV'       d   RP                  V4      VR&   T P                  RV 2RV'       d   VR7      # RR7      # )z
Get analytics for a profile.

Args:
    profile_username: Profile username.
    platforms: Filter by platforms (instagram, linkedin, facebook, x).

Returns:
    Analytics data.
r   rL   z/analytics/r2   Nr3   )joinrG   )r%   r2  rL   r.   s   &&& r   get_analyticsUploadPostClient.get_analytics  sK     "%((9"5F;}}{+;*<=uW]V}hhcg}hhr   c                    < V ^8  d   QhRS[ /# r   r/   r   )r   r   s   "r   r   r     s     = = =r   c                &    V P                  RR4      # )z>
List scheduled posts.

Returns:
    List of scheduled posts.
z/uploadposts/scheduler2   r'  r%   s   &r   list_scheduledUploadPostClient.list_scheduled  s     }}4e<<r   c                &   < V ^8  d   QhRS[ RS[/# )r   job_idr/   r%  )r   r   s   "r   r   r     s     
J 
Js 
Jt 
Jr   c                ,    V P                  RV 2R4      # )zb
Cancel a scheduled post.

Args:
    job_id: Scheduled job ID.

Returns:
    Cancellation result.
/uploadposts/schedule/r7   r'  )r%   r@  s   &&r   cancel_scheduled!UploadPostClient.cancel_scheduled  s     }}5fX>IIr   c                R   < V ^8  d   QhRS[ RS[S[ ,          RS[S[ ,          RS[/# )r   r@  rO   rP   r/   )r   r   r   )r   r   s   "r   r   r   "  sA     X XX !X 3-	X
 
Xr   c                d    / pV'       d   W$R&   V'       d   W4R&   V P                  RV 2RVR7      # )z
Edit a scheduled post.

Args:
    job_id: Scheduled job ID.
    scheduled_date: New scheduled date (ISO 8601).
    timezone: New timezone.

Returns:
    Edit result.
rO   rP   rB  r4   r-   r'  )r%   r@  rO   rP   bodys   &&&& r   edit_scheduledUploadPostClient.edit_scheduled"  s>    " %3!"'}}5fX>RV}WWr   c                    < V ^8  d   QhRS[ /# r9  r:  )r   r   s   "r   r   r   <  s     : :D :r   c                &    V P                  RR4      # )z7
List all users/profiles.

Returns:
    List of users.
/uploadposts/usersr2   r'  r<  s   &r   
list_usersUploadPostClient.list_users<  s     }}1599r   c                &   < V ^8  d   QhRS[ RS[/# r   usernamer/   r%  )r   r   s   "r   r   r   E  s     
] 
]C 
]D 
]r   c                .    V P                  RRRV/R7      # )ze
Create a new user/profile.

Args:
    username: Profile name to create.

Returns:
    Created user.
rM  r4   rR  rG  r'  r%   rR  s   &&r   create_userUploadPostClient.create_userE  s      }}16jRZE[}\\r   c                &   < V ^8  d   QhRS[ RS[/# rQ  r%  )r   r   s   "r   r   r   Q  s     
_ 
_C 
_D 
_r   c                .    V P                  RRRV/R7      # )zd
Delete a user/profile.

Args:
    username: Profile name to delete.

Returns:
    Deletion result.
rM  r7   rR  rG  r'  rT  s   &&r   delete_userUploadPostClient.delete_userQ  s      }}18
T\G]}^^r   c                   < V ^8  d   QhRS[ RS[S[ ,          RS[S[ ,          RS[S[ ,          RS[S[S[ ,          ,          RS[/# )r   rR  redirect_url
logo_imageredirect_button_textrL   r/   r3  )r   r   s   "r   r   r   ]  sd     X XX smX SM	X
 'smX DI&X 
Xr   c                    RV/pV'       d   W&R&   V'       d   W6R&   V'       d   WFR&   V'       d   WVR&   V P                  RRVR7      # )	a|  
Generate a JWT for platform integration.
Used when integrating Upload-Post into your own platform.

Args:
    username: Profile username.
    redirect_url: URL to redirect after linking.
    logo_image: Logo image URL for the linking page.
    redirect_button_text: Text for redirect button.
    platforms: Platforms to show for connection.

Returns:
    JWT and connection URL.
rR  r\  r]  r^  rL   z/uploadposts/users/generate-jwtr4   rG  r'  )r%   rR  r\  r]  r^  rL   rH  s   &&&&&& r   generate_jwtUploadPostClient.generate_jwt]  sR    , !+H5#/ !++?'( )}}>RV}WWr   c                &   < V ^8  d   QhRS[ RS[/# )r   jwtr/   r%  )r   r   s   "r   r   r   ~  s     
` 
` 
` 
`r   c                .    V P                  RRRV/R7      # )z_
Validate a JWT token.

Args:
    jwt: JWT token to validate.

Returns:
    Validation result.
z/uploadposts/users/validate-jwtr4   rc  rG  r'  )r%   rc  s   &&r   validate_jwtUploadPostClient.validate_jwt~  s!     }}>SXZ]R^}__r   c                6   < V ^8  d   QhRS[ S[,          RS[/# r   profiler/   r   r   r   )r   r   s   "r   r   r     #     R R(3- R4 Rr   c                F    V'       d   RV/MRpV P                  RRVR7      # )zo
Get Facebook pages for a profile.

Args:
    profile: Profile username.

Returns:
    List of Facebook pages.
ri  Nz/uploadposts/facebook/pagesr2   r3   r'  r%   ri  r.   s   && r   get_facebook_pages#UploadPostClient.get_facebook_pages  (     *1)W%d}}:E&}QQr   c                6   < V ^8  d   QhRS[ S[,          RS[/# rh  rj  )r   r   s   "r   r   r     rk  r   c                F    V'       d   RV/MRpV P                  RRVR7      # )zo
Get LinkedIn pages for a profile.

Args:
    profile: Profile username.

Returns:
    List of LinkedIn pages.
ri  Nz/uploadposts/linkedin/pagesr2   r3   r'  rm  s   && r   get_linkedin_pages#UploadPostClient.get_linkedin_pages  rp  r   c                6   < V ^8  d   QhRS[ S[,          RS[/# rh  rj  )r   r   s   "r   r   r     s#     T THSM TT Tr   c                F    V'       d   RV/MRpV P                  RRVR7      # )zs
Get Pinterest boards for a profile.

Args:
    profile: Profile username.

Returns:
    List of Pinterest boards.
ri  Nz/uploadposts/pinterest/boardsr2   r3   r'  rm  s   && r   get_pinterest_boards%UploadPostClient.get_pinterest_boards  s(     *1)W%d}}<eF}SSr   )r   r"   )r2   NNNN)NNNNNN)T)FF)F)NNNNNNN)      )N)NN)NNNN)&r   r   r   r   r   r;   r&   rG   rt   r   r   r   r   r   r   r   r   r   r  r  r  r!  r(  r/  r6  r=  rC  rI  rN  rU  rY  r`  re  rn  rs  rw  r   __classdictcell__)r   s   @r   r   r      s      1H 'M 'MR;0 ;0zU U8F F*#D #DJX XL L{ {&.X .X`i i
: :J# J#Xo obD@ D@LH! H!X
^ 
^c ci i$= =
J 
JX X4: :
] 
]
_ 
_X XB
` 
`R RR RT T Tr   r   )r   pathlibr   typingr   r   r   r   r   r   r    	Exceptionr
   r   r   r   r   <module>r     s2     < < 	i 	
_T _Tr   