o
    $iB                     @  sH  d dl mZ d dlmZ d dlZddlmZ ddlmZm	Z	m
Z
mZmZmZmZmZ ddlmZmZ ddlmZ dd	lmZmZ dd
lmZmZ ddlmZmZ ddlmZ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gZ*G dd deZ+G dd deZ,G dd dZ-G dd dZ.G dd dZ/G dd dZ0dS )    )annotations)LiteralN   )_legacy_response)BodyOmitQueryHeadersNotGivenSequenceNotStromit	not_given)maybe_transformasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper)SyncPage	AsyncPage)AsyncPaginatormake_request_options)permission_create_paramspermission_retrieve_params)PermissionCreateResponse)PermissionDeleteResponse)PermissionRetrieveResponsePermissionsAsyncPermissionsc                	   @  r   e Zd Zed(ddZed)ddZddded	d*ddZeeeedddedd+d"d#Z	ddded	d,d&d'Z
dS )-r   returnPermissionsWithRawResponsec                 C     t | S a  
        This property can be used as a prefix for any HTTP method call to return
        the raw response object instead of the parsed content.

        For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
        )r"   self r'   t/var/www/html/flask_server/venv/lib/python3.10/site-packages/openai/resources/fine_tuning/checkpoints/permissions.pywith_raw_response      zPermissions.with_raw_response PermissionsWithStreamingResponsec                 C  r#   z
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/openai/openai-python#with_streaming_response
        )r+   r%   r'   r'   r(   with_streaming_response$      z#Permissions.with_streaming_responseNextra_headersextra_query
extra_bodytimeoutfine_tuned_model_checkpointstrproject_idsSequenceNotStr[str]r0   Headers | Noner1   Query | Noner2   Body | Noner3   'float | httpx.Timeout | None | NotGiven"SyncPage[PermissionCreateResponse]c             
   C  L   |s	t d|| jd| dtt td|itjt||||dtddS a?  
        **NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys).

        This enables organization owners to share fine-tuned models with other projects
        in their organization.

        Args:
          project_ids: The project identifiers to grant access to.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        JExpected a non-empty value for `fine_tuned_model_checkpoint` but received /fine_tuning/checkpoints//permissionsr6   r/   post)pagebodyoptionsmodelmethod)
ValueError_get_api_listr   r   r   r   PermissionCreateParamsr   r&   r4   r6   r0   r1   r2   r3   r'   r'   r(   create-      
zPermissions.createafterlimitorder
project_idr0   r1   r2   r3   rO   
str | OmitrP   
int | OmitrQ   )Literal['ascending', 'descending'] | OmitrR   r   c          
      C  sJ   |s	t d|| jd| dt||||	t||||dtjdtdS )  
        **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).

        Organization owners can use this endpoint to view all permissions for a
        fine-tuned model checkpoint.

        Args:
          after: Identifier for the last permission ID from the previous pagination request.

          limit: Number of permissions to retrieve.

          order: The order in which to retrieve permissions.

          project_id: The ID of the project to get permissions for.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        r?   r@   rA   rO   rP   rQ   rR   r0   r1   r2   r3   queryrE   cast_to)rH   _getr   r   r   PermissionRetrieveParamsr   
r&   r4   rO   rP   rQ   rR   r0   r1   r2   r3   r'   r'   r(   retrieveY   s,   &
zPermissions.retrievepermission_idr   c                C  sL   |s	t d||st d|| jd| d| t||||dtdS )  
        **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).

        Organization owners can use this endpoint to delete a permission for a
        fine-tuned model checkpoint.

        Args:
          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        r?   <Expected a non-empty value for `permission_id` but received r@   /permissions/r/   rZ   rH   _deleter   r   r&   r`   r4   r0   r1   r2   r3   r'   r'   r(   delete   s   zPermissions.delete)r!   r"   )r!   r+   )r4   r5   r6   r7   r0   r8   r1   r9   r2   r:   r3   r;   r!   r<   r4   r5   rO   rS   rP   rT   rQ   rU   rR   rS   r0   r8   r1   r9   r2   r:   r3   r;   r!   r   r`   r5   r4   r5   r0   r8   r1   r9   r2   r:   r3   r;   r!   r   __name__
__module____qualname__r   r)   r-   r   rL   r   r_   rg   r'   r'   r'   r(   r      0    	0Ec                	   @  r    )-r   r!   AsyncPermissionsWithRawResponsec                 C  r#   r$   )ro   r%   r'   r'   r(   r)      r*   z"AsyncPermissions.with_raw_response%AsyncPermissionsWithStreamingResponsec                 C  r#   r,   )rp   r%   r'   r'   r(   r-      r.   z(AsyncPermissions.with_streaming_responseNr/   r4   r5   r6   r7   r0   r8   r1   r9   r2   r:   r3   r;   MAsyncPaginator[PermissionCreateResponse, AsyncPage[PermissionCreateResponse]]c             
   C  r=   r>   )rH   rI   r   r   r   r   rJ   r   rK   r'   r'   r(   rL      rM   zAsyncPermissions.createrN   rO   rS   rP   rT   rQ   rU   rR   r   c          
        sX   |s
t d|| jd| dt||||	t||||dtjI dH dtdI dH S )rV   r?   r@   rA   rW   NrX   rZ   )rH   r\   r   r   r   r]   r   r^   r'   r'   r(   r_     s.   &
zAsyncPermissions.retriever`   r   c                  sT   |s
t d||st d|| jd| d| t||||dtdI dH S )ra   r?   rb   r@   rc   r/   rZ   Nrd   rf   r'   r'   r(   rg   ?  s   zAsyncPermissions.delete)r!   ro   )r!   rp   )r4   r5   r6   r7   r0   r8   r1   r9   r2   r:   r3   r;   r!   rq   rh   ri   rj   r'   r'   r'   r(   r      rn   c                   @     e Zd ZdddZdS )	r"   permissionsr   r!   Nonec                 C  4   || _ t|j| _t|j| _t|j| _d S N)_permissionsr   to_raw_response_wrapperrL   r_   rg   r&   rs   r'   r'   r(   __init__j     
z#PermissionsWithRawResponse.__init__Nrs   r   r!   rt   rk   rl   rm   rz   r'   r'   r'   r(   r"   i      r"   c                   @  rr   )	ro   rs   r   r!   rt   c                 C  ru   rv   )rw   r   async_to_raw_response_wrapperrL   r_   rg   ry   r'   r'   r(   rz   y  r{   z(AsyncPermissionsWithRawResponse.__init__Nrs   r   r!   rt   r}   r'   r'   r'   r(   ro   x  r~   ro   c                   @  rr   )	r+   rs   r   r!   rt   c                 C  .   || _ t|j| _t|j| _t|j| _d S rv   )rw   r   rL   r_   rg   ry   r'   r'   r(   rz        
z)PermissionsWithStreamingResponse.__init__Nr|   r}   r'   r'   r'   r(   r+     r~   r+   c                   @  rr   )	rp   rs   r   r!   rt   c                 C  r   rv   )rw   r   rL   r_   rg   ry   r'   r'   r(   rz     r   z.AsyncPermissionsWithStreamingResponse.__init__Nr   r}   r'   r'   r'   r(   rp     r~   rp   )1
__future__r   typing_extensionsr   httpx r   _typesr   r   r   r	   r
   r   r   r   _utilsr   r   _compatr   	_resourcer   r   	_responser   r   
paginationr   r   _base_clientr   r   types.fine_tuning.checkpointsr   r   8types.fine_tuning.checkpoints.permission_create_responser   8types.fine_tuning.checkpoints.permission_delete_responser   :types.fine_tuning.checkpoints.permission_retrieve_responser   __all__r   r   r"   ro   r+   rp   r'   r'   r'   r(   <module>   s0   ( ) )