
    Jiӯ                        d dl Z d dlZd dlmZ ddlmZ ddlmZm	Z	 ddl
mZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ 	 d dl Z e jB                  jE                  d      re#d dl$m%Z   e jL                  e jN                  d      Z( G d d      Z) G d d      Z*y# e#$ r d dl Z Y =w xY w)    N)JSONDecodeError   )ApiError)AsyncClientWrapperSyncClientWrapper)jsonable_encoder)remove_none_from_dict)UnprocessableEntityError)BasePlan)HttpValidationError)Organization)OrganizationCreate)Project)Role)UsageAndPlan)UserOrganizationRolez1..c            
          e Zd ZdefdZdej                  e   fdZde	defdZ
de	defdZdefdZd	edefd
Zedd	edej                   ej"                  eej$                  f      dedefdZd	eddfdZd	edefdZd	edej                  e   fdZddd	edej                   e   defdZddd	edej                   e   dej                   e   fdZd	ededededef
dZd	ededej                  e   fdZ ddd	ej                   e   dedej                   e   dej$                  fdZ!d	edededej$                  fdZ"y) OrganizationsClientclient_wrapperc                    || _         y N_client_wrapperselfr   s     |/var/www/html/BankruptcyAI-uat/bankruptcy-ai/venv/lib/python3.12/site-packages/llama_cloud/resources/organizations/client.py__init__zOrganizationsClient.__init__"   
    -    returnc                    | j                   j                  j                  dt        j                  j                  | j                   j                          dd      | j                   j                         d      }d|j                  cxk  rdk  r<n n9t        j                  t        j                  t           |j                               S |j                  dk(  r1t        t        j                  t         |j                                     	 |j                         }t%        |j                  |	      # t"        $ r" t%        |j                  |j&                  	      w xY w)
z
        List organizations for a user.

        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.organizations.list_organizations()
        GET/api/v1/organizations<   headerstimeout   ,    status_codebodyr   httpx_clientrequesturllibparseurljoinget_base_urlget_headersr-   pydanticparse_obj_astypingListr   jsonr
   r   r   r   textr   	_response_response_jsons      r   list_organizationsz&OrganizationsClient.list_organizations%   s#    ((55==LL  D$8$8$E$E$G#H!JLbc((446	 > 
	 )''-#-((\)BINNDTUU  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   D4 4+Er1   c                   | j                   j                  j                  dt        j                  j                  | j                   j                          dd      t        |      | j                   j                         d      }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  dk(  r1t        t        j                  t        |j                                     	 |j                         }t#        |j                  |	      # t         $ r" t#        |j                  |j$                  	      w xY w)
a  
        Create a new organization.

        Parameters:
            - request: OrganizationCreate.
        ---
        from llama_cloud import OrganizationCreate
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.organizations.create_organization(
            request=OrganizationCreate(
                name="string",
            ),
        )
        POSTr#   r$   r%   r;   r'   r(   r)   r*   r+   r,   r   r0   r1   r2   r3   r4   r5   r   r6   r-   r7   r8   r   r;   r
   r   r   r   r<   r   r1   r>   r?   s       r   create_organizationz'OrganizationsClient.create_organizationA   s"   & ((55==LL  D$8$8$E$E$G#H!JLbc!'*((446 > 
	 )''-#-((y~~7GHH  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	S   D- -+Ec                   | j                   j                  j                  dt        j                  j                  | j                   j                          dd      t        |      | j                   j                         d      }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  dk(  r1t        t        j                  t        |j                                     	 |j                         }t#        |j                  |	      # t         $ r" t#        |j                  |j$                  	      w xY w)
a  
        Upsert a new organization.

        Parameters:
            - request: OrganizationCreate.
        ---
        from llama_cloud import OrganizationCreate
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.organizations.upsert_organization(
            request=OrganizationCreate(
                name="string",
            ),
        )
        PUTr#   r$   r%   rC   r)   r*   r+   r,   rD   rE   s       r   upsert_organizationz'OrganizationsClient.upsert_organizatione   s"   & ((55==LL  D$8$8$E$E$G#H!JLbc!'*((446 > 
	 )''-#-((y~~7GHH  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	SrG   c                    | j                   j                  j                  dt        j                  j                  | j                   j                          dd      | j                   j                         d      }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  dk(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |	      # t        $ r" t!        |j                  |j"                  	      w xY w)
z
        Get the default organization for the user.

        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.organizations.get_default_organization()
        r"   r#   api/v1/organizations/defaultr%   r&   r)   r*   r+   r,   r   r0   r1   r2   r3   r4   r5   r6   r-   r7   r8   r   r;   r
   r   r   r   r<   r=   s      r   get_default_organizationz,OrganizationsClient.get_default_organization   s    ((55==LL  D$8$8$E$E$G#H!JLjk((446	 > 
	 )''-#-((y~~7GHH  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   <D# #+Eorganization_idc                    | j                   j                  j                  dt        j                  j                  | j                   j                          dd|       | j                   j                         d      }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  dk(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |	      # t        $ r" t!        |j                  |j"                  	      w xY w)
aJ  
        Get an organization by ID.

        Parameters:
            - organization_id: str.
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.organizations.get_organization(
            organization_id="string",
        )
        r"   r#   api/v1/organizations/r%   r&   r)   r*   r+   r,   rM   r   rO   r>   r?   s       r   get_organizationz$OrganizationsClient.get_organization   s#     ((55==LL  D$8$8$E$E$G#H!JNcdsctLuv((446	 > 
	 )''-#-((y~~7GHH  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   ?D& &+Efeature_flagsrU   namec                   d|i}|t         ur||d<   | j                  j                  j                  dt        j
                  j                  | j                  j                          dd|       t        |      | j                  j                         d      }d|j                  cxk  rd	k  r+n n(t        j                  t        |j                               S |j                  d
k(  r1t        t        j                  t         |j                                     	 |j                         }t%        |j                  |      # t"        $ r" t%        |j                  |j&                        w xY w)a  
        Update an existing organization.

        Parameters:
            - organization_id: str.

            - feature_flags: typing.Optional[typing.Dict[str, typing.Any]].

            - name: str. A name for the organization.
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.organizations.update_organization(
            organization_id="string",
            name="string",
        )
        rV   rU   rI   r#   rQ   r%   rC   r)   r*   r+   r,   OMITr   r0   r1   r2   r3   r4   r5   r   r6   r-   r7   r8   r   r;   r
   r   r   r   r<   r   rO   rU   rV   _requestr>   r?   s          r   update_organizationz'OrganizationsClient.update_organization   sF   . 39$$(5H_%((55==LL  D$8$8$E$E$G#H!JNcdsctLuv!(+((446 > 
	 )''-#-((y~~7GHH  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   E +E,Nc                 V   | j                   j                  j                  dt        j                  j                  | j                   j                          dd|       | j                   j                         d      }d|j                  cxk  rdk  ry |j                  d	k(  r1t        t        j                  t        |j                                     	 |j                         }t        |j                  |
      # t        $ r" t        |j                  |j                   
      w xY w)aP  
        Delete an organization by ID.

        Parameters:
            - organization_id: str.
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.organizations.delete_organization(
            organization_id="string",
        )
        DELETEr#   rQ   r%   r&   r)   r*   Nr+   r,   r   r0   r1   r2   r3   r4   r5   r6   r-   r
   r7   r8   r   r;   r   r   r<   rR   s       r   delete_organizationz'OrganizationsClient.delete_organization   s     ((55==LL  D$8$8$E$E$G#H!JNcdsctLuv((446	 > 
	 )''-#- .  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   C= =+D(c           	         | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      | j                   j                         d      }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  d	k(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |
      # t        $ r" t!        |j                  |j"                  
      w xY w)af  
        Get plan information for a specific organization.

        Parameters:
            - organization_id: str.
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.organizations.get_organization_plan(
            organization_id="string",
        )
        r"   r#   rQ   /planr%   r&   r)   r*   r+   r,   r   r0   r1   r2   r3   r4   r5   r6   r-   r7   r8   r   r;   r
   r   r   r   r<   rR   s       r   get_organization_planz)OrganizationsClient.get_organization_plan  s+     ((55==LL  ''4467q9=RSbRcch;i ((446 > 
	 )''-#-((9>>3CDD  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss    D' '+Ec           	         | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      | j                   j                         d      }d|j                  cxk  rdk  r<n n9t        j                  t        j                  t           |j                               S |j                  d	k(  r1t        t        j                  t         |j                                     	 |j                         }t%        |j                  |
      # t"        $ r" t%        |j                  |j&                  
      w xY w)aL  
        List all roles in an organization.

        Parameters:
            - organization_id: str.
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.organizations.list_roles(
            organization_id="string",
        )
        r"   r#   rQ   /rolesr%   r&   r)   r*   r+   r,   r   r0   r1   r2   r3   r4   r5   r6   r-   r7   r8   r9   r:   r   r;   r
   r   r   r   r<   rR   s       r   
list_roleszOrganizationsClient.list_roles2  s4     ((55==LL  ''4467q9=RSbRcci;j ((446 > 
	 )''-#-((T):INN<LMM  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   D8 8+E#get_current_invoice_totalrj   c          	         | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      t        d|i      | j                   j                         d      }d|j                  cxk  rd	k  r+n n(t        j                  t        |j                               S |j                  d
k(  r1t        t        j                  t        |j                                     	 |j                         }t#        |j                  |      # t         $ r" t#        |j                  |j$                        w xY w)a  
        Get usage for a specific organization.

        Parameters:
            - organization_id: str.

            - get_current_invoice_total: typing.Optional[bool].
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.organizations.get_organization_usage(
            organization_id="string",
        )
        r"   r#   rQ   /usagerj   r%   paramsr'   r(   r)   r*   r+   r,   r   r0   r1   r2   r3   r4   r5   r	   r6   r-   r7   r8   r   r;   r
   r   r   r   r<   r   rO   rj   r>   r?   s        r   get_organization_usagez*OrganizationsClient.get_organization_usageT  s:   ( ((55==LL  ''4467q9=RSbRcci;j )*EG`)ab((446 > 
	 )''-#-((y~~7GHH  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   D3 3+E
project_idrs   c          	         | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      t        d|i      | j                   j                         d      }d|j                  cxk  rd	k  r<n n9t        j                  t        j                  t           |j                               S |j                  d
k(  r1t!        t        j                  t"        |j                                     	 |j                         }t'        |j                  |      # t$        $ r" t'        |j                  |j(                        w xY w)a  
        Get the role of a user in an organization.

        Parameters:
            - organization_id: str.

            - project_id: typing.Optional[str].
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.organizations.get_user_role(
            organization_id="string",
        )
        r"   r#   rQ   /users/rolesrs   r%   rm   r)   r*   r+   r,   r   r0   r1   r2   r3   r4   r5   r	   r6   r-   r7   r8   r9   Optionalr   r;   r
   r   r   r   r<   r   rO   rs   r>   r?   s        r   get_user_rolez!OrganizationsClient.get_user_role{  sE   ( ((55==LL  ''4467q9=RSbRcco;p ),
)CD((446 > 
	 )''-#-((9M)NPYP^P^P`aa  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   E +E/-user_organization_role_create_organization_idrole_iduser_idc          
         | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      t        |||d      | j                   j                         d      }d|j                  cxk  rd	k  r+n n(t        j                  t        |j                               S |j                  d
k(  r1t        t        j                  t        |j                                     	 |j                         }t#        |j                  |      # t         $ r" t#        |j                  |j$                        w xY w)a  
        Assign a role to a user in an organization.

        Parameters:
            - organization_id: str.

            - user_organization_role_create_organization_id: str. The organization's ID.

            - role_id: str. The role's ID.

            - user_id: str. The user's ID.
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.organizations.assign_role_to_user_in_organization(
            organization_id="string",
            user_organization_role_create_organization_id="string",
            role_id="string",
            user_id="string",
        )
        rI   r#   rQ   ru   rO   r{   r|   r%   rC   r)   r*   r+   r,   r   r0   r1   r2   r3   r4   r5   r   r6   r-   r7   r8   r   r;   r
   r   r   r   r<   r   rO   rz   r{   r|   r>   r?   s          r   #assign_role_to_user_in_organizationz7OrganizationsClient.assign_role_to_user_in_organization  sD   6 ((55==LL  ''4467q9=RSbRcco;p "'T&& ((446 > 
	 )''-#-(()=y~~?OPP  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   D5 5+E c                    | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d| d      | j                   j                         d      }d|j                  cxk  rd	k  r<n n9t        j                  t        j                  t           |j                               S |j                  d
k(  r1t        t        j                  t         |j                                     	 |j                         }t%        |j                  |      # t"        $ r" t%        |j                  |j&                        w xY w)a  
        List all projects for a user in an organization.

        Parameters:
            - organization_id: str.

            - user_id: str.
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.organizations.list_projects_by_user(
            organization_id="string",
            user_id="string",
        )
        r"   r#   rQ   /users/	/projectsr%   r&   r)   r*   r+   r,   r   r0   r1   r2   r3   r4   r5   r6   r-   r7   r8   r9   r:   r   r;   r
   r   r   r   r<   r   rO   r|   r>   r?   s        r   list_projects_by_userz)OrganizationsClient.list_projects_by_user  s8   & ((55==LL  ''4467q9''8y	R ((446 > 
	 )''-#-((W)=y~~?OPP  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   D; ;+E&c                   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d| d      t        d|i      | j                   j                         d      }d	|j                  cxk  rd
k  r5n n2t        j                  t        j                  |j                               S |j                  dk(  r1t        t        j                  t         |j                                     	 |j                         }t%        |j                  |      # t"        $ r" t%        |j                  |j&                        w xY w)a  
        Add a user to a project.

        Parameters:
            - organization_id: typing.Optional[str].

            - user_id: str.

            - project_id: typing.Optional[str].
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.organizations.add_user_to_project(
            user_id="string",
        )
        rI   r#   rQ   r   r   rs   r%   rm   r)   r*   r+   r,   r   r0   r1   r2   r3   r4   r5   r	   r6   r-   r7   r8   r9   Anyr;   r
   r   r   r   r<   r   rO   r|   rs   r>   r?   s         r   add_user_to_projectz'OrganizationsClient.add_user_to_project  s@   , ((55==LL  ''4467q9''8y	R ),
)CD((446 > 	
	 )''-#-((Y^^5EFF  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   E   +E+c                    | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d| d|       | j                   j                         d      }d|j                  cxk  rd	k  r5n n2t        j                  t        j                  |j                               S |j                  d
k(  r1t        t        j                  t        |j                                     	 |j                         }t#        |j                  |      # t         $ r" t#        |j                  |j$                        w xY w)a  
        Remove a user from a project.

        Parameters:
            - organization_id: str.

            - user_id: str.

            - project_id: str.
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.organizations.remove_user_from_project(
            organization_id="string",
            user_id="string",
            project_id="string",
        )
        r^   r#   rQ   r   
/projects/r%   r&   r)   r*   r+   r,   r   r0   r1   r2   r3   r4   r5   r6   r-   r7   r8   r9   r   r;   r
   r   r   r   r<   r   s         r   remove_user_from_projectz,OrganizationsClient.remove_user_from_project&  s9   , ((55==LL  ''4467q9''8y
S]R^_ ((446 > 
	 )''-#-((Y^^5EFF  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   D6 6+E!)#__name__
__module____qualname__r   r   r9   r:   r   r@   r   rF   rJ   rN   strrS   rY   rw   Dictr   r\   r`   r   rd   r   rh   boolr   rq   r   ry   r   r   r   r   r    r   r   r   r   !   s_   .*; .OFKK$= O8"O.@ "O\ "OH"O.@ "O\ "OHO, O8O O OB gk)O")O6<oofkkRUW]WaWaRaFb6c)Oru)O	)OVO3 O4 O@ OS  OX  OD O#  O&++d2C  OF [_%O"%OBH//RVBW%O	%OP KO%O"%O39??33G%O	-	.%ON2O"2OVY2Odg2Oru2O	2Oh$OS $O3 $O6;;W^K_ $ON jn(O%s3(O>A(ORXRaRabeRf(O	(OT'O 'Oc 'OWZ 'O_e_i_i 'Or   r   c            
          e Zd ZdefdZdej                  e   fdZde	defdZ
de	defdZdefdZd	edefd
Zedd	edej                   ej"                  eej$                  f      dedefdZd	eddfdZd	edefdZd	edej                  e   fdZddd	edej                   e   defdZddd	edej                   e   dej                   e   fdZd	ededededef
dZd	ededej                  e   fdZ ddd	ej                   e   dedej                   e   dej$                  fdZ!d	edededej$                  fdZ"y) AsyncOrganizationsClientr   c                    || _         y r   r   r   s     r   r   z!AsyncOrganizationsClient.__init__Q  r   r   r    c                   K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd      | j                   j                         d       d{   }d|j                  cxk  rdk  r<n n9t        j                  t        j                  t           |j                               S |j                  d	k(  r1t        t        j                  t         |j                                     	 |j                         }t%        |j                  |
      7 # t"        $ r" t%        |j                  |j&                  
      w xY ww)z
        List organizations for a user.

        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.organizations.list_organizations()
        r"   r#   r$   r%   r&   Nr)   r*   r+   r,   r/   r=   s      r   r@   z+AsyncOrganizationsClient.list_organizationsT  s1     ..;;CCLL  D$8$8$E$E$G#H!JLbc((446	 D 
 
	 )''-#-((\)BINNDTUU  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN
  	Sy'<'<9>>RR	Ss+   A>E. D>BE.E  'E. +E++E.r1   c                  K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd      t        |      | j                   j                         d       d{   }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  d	k(  r1t        t        j                  t        |j                                     	 |j                         }t#        |j                  |
      7 # t         $ r" t#        |j                  |j$                  
      w xY ww)a  
        Create a new organization.

        Parameters:
            - request: OrganizationCreate.
        ---
        from llama_cloud import OrganizationCreate
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.organizations.create_organization(
            request=OrganizationCreate(
                name="string",
            ),
        )
        rB   r#   r$   r%   rC   Nr)   r*   r+   r,   rD   rE   s       r   rF   z,AsyncOrganizationsClient.create_organizationp  s0    & ..;;CCLL  D$8$8$E$E$G#H!JLbc!'*((446 D 
 
	 )''-#-((y~~7GHH  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN
  	Sy'<'<9>>RR	S+   BE'
D7BE'D9  E'9+E$$E'c                  K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd      t        |      | j                   j                         d       d{   }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  d	k(  r1t        t        j                  t        |j                                     	 |j                         }t#        |j                  |
      7 # t         $ r" t#        |j                  |j$                  
      w xY ww)a  
        Upsert a new organization.

        Parameters:
            - request: OrganizationCreate.
        ---
        from llama_cloud import OrganizationCreate
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.organizations.upsert_organization(
            request=OrganizationCreate(
                name="string",
            ),
        )
        rI   r#   r$   r%   rC   Nr)   r*   r+   r,   rD   rE   s       r   rJ   z,AsyncOrganizationsClient.upsert_organization  s0    & ..;;CCLL  D$8$8$E$E$G#H!JLbc!'*((446 D 
 
	 )''-#-((y~~7GHH  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN
  	Sy'<'<9>>RR	Sr   c                   K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd      | j                   j                         d       d{   }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  d	k(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |
      7 # t        $ r" t!        |j                  |j"                  
      w xY ww)a  
        Get the default organization for the user.

        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.organizations.get_default_organization()
        r"   r#   rL   r%   r&   Nr)   r*   r+   r,   rM   r=   s      r   rN   z1AsyncOrganizationsClient.get_default_organization  s(     ..;;CCLL  D$8$8$E$E$G#H!JLjk((446	 D 
 
	 )''-#-((y~~7GHH  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN
  	Sy'<'<9>>RR	Ss+   A>E D-BED/ E/+EErO   c                   K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd|       | j                   j                         d       d{   }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  d	k(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |
      7 # t        $ r" t!        |j                  |j"                  
      w xY ww)aZ  
        Get an organization by ID.

        Parameters:
            - organization_id: str.
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.organizations.get_organization(
            organization_id="string",
        )
        r"   r#   rQ   r%   r&   Nr)   r*   r+   r,   rM   rR   s       r   rS   z)AsyncOrganizationsClient.get_organization  s1      ..;;CCLL  D$8$8$E$E$G#H!JNcdsctLuv((446	 D 
 
	 )''-#-((y~~7GHH  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN
  	Sy'<'<9>>RR	Ss+   BE D0BE 	D2 E 2+EE rT   rU   rV   c                  K   d|i}|t         ur||d<   | j                  j                  j                  dt        j
                  j                  | j                  j                          dd|       t        |      | j                  j                         d       d{   }d	|j                  cxk  rd
k  r+n n(t        j                  t        |j                               S |j                  dk(  r1t        t        j                  t         |j                                     	 |j                         }t%        |j                  |      7 # t"        $ r" t%        |j                  |j&                        w xY ww)a  
        Update an existing organization.

        Parameters:
            - organization_id: str.

            - feature_flags: typing.Optional[typing.Dict[str, typing.Any]].

            - name: str. A name for the organization.
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.organizations.update_organization(
            organization_id="string",
            name="string",
        )
        rV   rU   rI   r#   rQ   r%   rC   Nr)   r*   r+   r,   rX   rZ   s          r   r\   z,AsyncOrganizationsClient.update_organization  sT    . 39$$(5H_%..;;CCLL  D$8$8$E$E$G#H!JNcdsctLuv!(+((446 D 
 
	 )''-#-((y~~7GHH  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN
  	Sy'<'<9>>RR	Ss+   BE;EBE;$E 4E;+E88E;Nc                 r  K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd|       | j                   j                         d       d{   }d|j                  cxk  rdk  ry |j                  d	k(  r1t        t        j                  t        |j                                     	 |j                         }t        |j                  |
      7 # t        $ r" t        |j                  |j                   
      w xY ww)a`  
        Delete an organization by ID.

        Parameters:
            - organization_id: str.
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.organizations.delete_organization(
            organization_id="string",
        )
        r^   r#   rQ   r%   r&   Nr)   r*   r+   r,   r_   rR   s       r   r`   z,AsyncOrganizationsClient.delete_organization  s      ..;;CCLL  D$8$8$E$E$G#H!JNcdsctLuv((446	 D 
 
	 )''-#- .  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN
  	Sy'<'<9>>RR	Ss+   BD7DAD7 D	 0D7	+D44D7c           	        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      | j                   j                         d       d{   }d|j                  cxk  rd	k  r+n n(t        j                  t        |j                               S |j                  d
k(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |      7 # t        $ r" t!        |j                  |j"                        w xY ww)av  
        Get plan information for a specific organization.

        Parameters:
            - organization_id: str.
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.organizations.get_organization_plan(
            organization_id="string",
        )
        r"   r#   rQ   rb   r%   r&   Nr)   r*   r+   r,   rc   rR   s       r   rd   z.AsyncOrganizationsClient.get_organization_plan?  s9      ..;;CCLL  ''4467q9=RSbRcch;i ((446 D 
 
	 )''-#-((9>>3CDD  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN!
  	Sy'<'<9>>RR	Ss+   BE!D1BE!
D3 E!3+EE!c           	        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      | j                   j                         d       d{   }d|j                  cxk  rd	k  r<n n9t        j                  t        j                  t           |j                               S |j                  d
k(  r1t        t        j                  t         |j                                     	 |j                         }t%        |j                  |      7 # t"        $ r" t%        |j                  |j&                        w xY ww)a\  
        List all roles in an organization.

        Parameters:
            - organization_id: str.
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.organizations.list_roles(
            organization_id="string",
        )
        r"   r#   rQ   rf   r%   r&   Nr)   r*   r+   r,   rg   rR   s       r   rh   z#AsyncOrganizationsClient.list_rolesa  sB      ..;;CCLL  ''4467q9=RSbRcci;j ((446 D 
 
	 )''-#-((T):INN<LMM  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN!
  	Sy'<'<9>>RR	Ss+   BE2EBE2E +E2+E//E2ri   rj   c          	        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      t        d|i      | j                   j                         d       d{   }d	|j                  cxk  rd
k  r+n n(t        j                  t        |j                               S |j                  dk(  r1t        t        j                  t        |j                                     	 |j                         }t#        |j                  |      7 # t         $ r" t#        |j                  |j$                        w xY ww)a  
        Get usage for a specific organization.

        Parameters:
            - organization_id: str.

            - get_current_invoice_total: typing.Optional[bool].
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.organizations.get_organization_usage(
            organization_id="string",
        )
        r"   r#   rQ   rl   rj   r%   rm   Nr)   r*   r+   r,   ro   rp   s        r   rq   z/AsyncOrganizationsClient.get_organization_usage  sH    ( ..;;CCLL  ''4467q9=RSbRcci;j )*EG`)ab((446 D 
 
	 )''-#-((y~~7GHH  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN#
  	Sy'<'<9>>RR	Ss+   BE-D=BE-D? &E-?+E**E-rr   rs   c          	         K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      t        d|i      | j                   j                         d       d{   }d	|j                  cxk  rd
k  r<n n9t        j                  t        j                  t           |j                               S |j                  dk(  r1t!        t        j                  t"        |j                                     	 |j                         }t'        |j                  |      7 # t$        $ r" t'        |j                  |j(                        w xY ww)a  
        Get the role of a user in an organization.

        Parameters:
            - organization_id: str.

            - project_id: typing.Optional[str].
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.organizations.get_user_role(
            organization_id="string",
        )
        r"   r#   rQ   ru   rs   r%   rm   Nr)   r*   r+   r,   rv   rx   s        r   ry   z&AsyncOrganizationsClient.get_user_role  sS    ( ..;;CCLL  ''4467q9=RSbRcco;p ),
)CD((446 D 
 
	 )''-#-((9M)NPYP^P^P`aa  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN#
  	Sy'<'<9>>RR	Ss+   BE>EBE>'E 7E>+E;;E>rz   r{   r|   c          
        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      t        |||d      | j                   j                         d       d{   }d	|j                  cxk  rd
k  r+n n(t        j                  t        |j                               S |j                  dk(  r1t        t        j                  t        |j                                     	 |j                         }t#        |j                  |      7 # t         $ r" t#        |j                  |j$                        w xY ww)a  
        Assign a role to a user in an organization.

        Parameters:
            - organization_id: str.

            - user_organization_role_create_organization_id: str. The organization's ID.

            - role_id: str. The role's ID.

            - user_id: str. The user's ID.
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.organizations.assign_role_to_user_in_organization(
            organization_id="string",
            user_organization_role_create_organization_id="string",
            role_id="string",
            user_id="string",
        )
        rI   r#   rQ   ru   r~   r%   rC   Nr)   r*   r+   r,   r   r   s          r   r   z<AsyncOrganizationsClient.assign_role_to_user_in_organization  sR    6 ..;;CCLL  ''4467q9=RSbRcco;p "'T&& ((446 D 
 
	 )''-#-(()=y~~?OPP  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN/
*  	Sy'<'<9>>RR	Ss+   BE/D?BE/E (E/+E,,E/c                   K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d| d      | j                   j                         d       d{   }d	|j                  cxk  rd
k  r<n n9t        j                  t        j                  t           |j                               S |j                  dk(  r1t        t        j                  t         |j                                     	 |j                         }t%        |j                  |      7 # t"        $ r" t%        |j                  |j&                        w xY ww)a  
        List all projects for a user in an organization.

        Parameters:
            - organization_id: str.

            - user_id: str.
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.organizations.list_projects_by_user(
            organization_id="string",
            user_id="string",
        )
        r"   r#   rQ   r   r   r%   r&   Nr)   r*   r+   r,   r   r   s        r   r   z.AsyncOrganizationsClient.list_projects_by_user  sF    & ..;;CCLL  ''4467q9''8y	R ((446 D 
 
	 )''-#-((W)=y~~?OPP  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN#
  	Sy'<'<9>>RR	Ss+   BE5EBE5E .E5+E22E5c                  K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d| d      t        d|i      | j                   j                         d       d	{   }d
|j                  cxk  rdk  r5n n2t        j                  t        j                  |j                               S |j                  dk(  r1t        t        j                  t         |j                                     	 |j                         }t%        |j                  |      7 # t"        $ r" t%        |j                  |j&                        w xY ww)a  
        Add a user to a project.

        Parameters:
            - organization_id: typing.Optional[str].

            - user_id: str.

            - project_id: typing.Optional[str].
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.organizations.add_user_to_project(
            user_id="string",
        )
        rI   r#   rQ   r   r   rs   r%   rm   Nr)   r*   r+   r,   r   r   s         r   r   z,AsyncOrganizationsClient.add_user_to_project+  sN    , ..;;CCLL  ''4467q9''8y	R ),
)CD((446 D 	
 	
	 )''-#-((Y^^5EFF  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN%	
   	Sy'<'<9>>RR	Ss+   BE:E
BE:#E 3E:+E77E:c                   K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d| d|       | j                   j                         d       d{   }d	|j                  cxk  rd
k  r5n n2t        j                  t        j                  |j                               S |j                  dk(  r1t        t        j                  t        |j                                     	 |j                         }t#        |j                  |      7 # t         $ r" t#        |j                  |j$                        w xY ww)a  
        Remove a user from a project.

        Parameters:
            - organization_id: str.

            - user_id: str.

            - project_id: str.
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.organizations.remove_user_from_project(
            organization_id="string",
            user_id="string",
            project_id="string",
        )
        r^   r#   rQ   r   r   r%   r&   Nr)   r*   r+   r,   r   r   s         r   r   z1AsyncOrganizationsClient.remove_user_from_projectU  sG    , ..;;CCLL  ''4467q9''8y
S]R^_ ((446 D 
 
	 )''-#-((Y^^5EFF  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN#
  	Sy'<'<9>>RR	Ss+   BE0	E 
BE0E )E0+E--E0)#r   r   r   r   r   r9   r:   r   r@   r   rF   rJ   rN   r   rS   rY   rw   r   r   r\   r`   r   rd   r   rh   r   r   rq   r   ry   r   r   r   r   r   r   r   r   r   r   P  sb   .*< .O&++l*C O8"O4F "O< "OH"O4F "O< "OHO O8Oc Ol OB gk)O")O6<oofkkRUW]WaWaRaFb6c)Oru)O	)OVO O O@ O3  O8  OD O  OD8I  OF [_%O"%OBH//RVBW%O	%OP KO%O"%O39??33G%O	-	.%ON2O"2OVY2Odg2Oru2O	2Oh$O3 $O $OQWQ\Q\]dQe $ON jn(O%s3(O>A(ORXRaRabeRf(O	(OT'Oc 'OC 'O]` 'Oekeoeo 'Or   r   )+r9   urllib.parser2   json.decoderr   core.api_errorr   core.client_wrapperr   r   core.jsonable_encoderr   core.remove_none_from_dictr	   !errors.unprocessable_entity_errorr
   types.base_planr   types.http_validation_errorr   types.organizationr   types.organization_creater   types.projectr   
types.roler   types.usage_and_planr   types.user_organization_roler   r7   __version__
startswithImportErrorpydantic.v1v1castr   rY   r   r   r   r   r   <module>r      s      ( & H 5 ? I ' > . ; $  0 @&&t,"
 v{{6::s#lO lO^lO lOm  s    'B9 9	CC