U
    ZhB                     @  sH  d dl mZ 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 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Z/dS )    )annotations)List)LiteralN   )_legacy_response)	NOT_GIVENBodyQueryHeadersNotGiven)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                   @  s   e Zd ZeddddZeddddZddded	d
dddddddddZeeeedddedd
dddddddddd
ddZddded	d
d
ddddddddZ	dS ) r   PermissionsWithRawResponsereturnc                 C  s   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$   X/tmp/pip-unpacked-wheel-693nel7n/openai/resources/fine_tuning/checkpoints/permissions.pywith_raw_response   s    zPermissions.with_raw_response PermissionsWithStreamingResponsec                 C  s   t | S 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%   s    z#Permissions.with_streaming_responseNextra_headersextra_query
extra_bodytimeoutstr	List[str]Headers | NoneQuery | NoneBody | None'float | httpx.Timeout | None | NotGivenz"SyncPage[PermissionCreateResponse]fine_tuned_model_checkpointproject_idsr+   r,   r-   r.   r    c             
   C  sL   |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//permissionsr7   r*   post)pagebodyoptionsmodelmethod)
ValueError_get_api_listr   r   r   r   PermissionCreateParamsr   r#   r6   r7   r+   r,   r-   r.   r$   r$   r%   create.   s"    
   zPermissions.createafterlimitorder
project_idr+   r,   r-   r.   str | NotGivenint | NotGiven/Literal[('ascending', 'descending')] | NotGivenr   
r6   rH   rI   rJ   rK   r+   r,   r-   r.   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
        r9   r:   r;   rH   rI   rJ   rK   r+   r,   r-   r.   queryr?   Zcast_to)rB   _getr   r   r   PermissionRetrieveParamsr   
r#   r6   rH   rI   rJ   rK   r+   r,   r-   r.   r$   r$   r%   retrieveZ   s,    &
zPermissions.retriever   permission_idr6   r+   r,   r-   r.   r    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
        r9   <Expected a non-empty value for `permission_id` but received r:   /permissions/r*   rT   rB   _deleter   r   r#   rZ   r6   r+   r,   r-   r.   r$   r$   r%   delete   s        zPermissions.delete
__name__
__module____qualname__r   r&   r)   r   rF   rX   ra   r$   r$   r$   r%   r      s.   	0$Ec                   @  s   e Zd ZeddddZeddddZddded	d
dddddddddZeeeedddedd
dddddddddd
ddZddded	d
d
ddddddddZ	dS ) r   AsyncPermissionsWithRawResponser   c                 C  s   t | S r!   )rf   r"   r$   r$   r%   r&      s    z"AsyncPermissions.with_raw_response%AsyncPermissionsWithStreamingResponsec                 C  s   t | S r(   )rg   r"   r$   r$   r%   r)      s    z(AsyncPermissions.with_streaming_responseNr*   r/   r0   r1   r2   r3   r4   zMAsyncPaginator[PermissionCreateResponse, AsyncPage[PermissionCreateResponse]]r5   c             
   C  sL   |st d|| jd| dtt td|itjt||||dtddS r8   )rB   rC   r   r   r   r   rD   r   rE   r$   r$   r%   rF      s"    
   zAsyncPermissions.createrG   rL   rM   rN   r   rO   c          
        sV   |st d|| jd| dt||||	t||||dtjI dH dtdI dH S )rP   r9   r:   r;   rQ   NrR   rT   )rB   rU   r   r   r   rV   r   rW   r$   r$   r%   rX     s,    &
zAsyncPermissions.retriever   rY   c                  sR   |st d||s$t d|| jd| d| t||||dtdI dH S )r[   r9   r\   r:   r]   r*   rT   Nr^   r`   r$   r$   r%   ra   @  s        zAsyncPermissions.deleterb   r$   r$   r$   r%   r      s.   	0$Ec                   @  s   e Zd ZdddddZdS )r   r   Nonepermissionsr    c                 C  s4   || _ t|j| _t|j| _t|j| _d S N)_permissionsr   Zto_raw_response_wrapperrF   rX   ra   r#   rj   r$   r$   r%   __init__k  s    z#PermissionsWithRawResponse.__init__Nrc   rd   re   rn   r$   r$   r$   r%   r   j  s   r   c                   @  s   e Zd ZdddddZdS )rf   r   rh   ri   c                 C  s4   || _ t|j| _t|j| _t|j| _d S rk   )rl   r   Zasync_to_raw_response_wrapperrF   rX   ra   rm   r$   r$   r%   rn   z  s    z(AsyncPermissionsWithRawResponse.__init__Nro   r$   r$   r$   r%   rf   y  s   rf   c                   @  s   e Zd ZdddddZdS )r'   r   rh   ri   c                 C  s.   || _ t|j| _t|j| _t|j| _d S rk   )rl   r   rF   rX   ra   rm   r$   r$   r%   rn     s    z)PermissionsWithStreamingResponse.__init__Nro   r$   r$   r$   r%   r'     s   r'   c                   @  s   e Zd ZdddddZdS )rg   r   rh   ri   c                 C  s.   || _ t|j| _t|j| _t|j| _d S rk   )rl   r   rF   rX   ra   rm   r$   r$   r%   rn     s    z.AsyncPermissionsWithStreamingResponse.__init__Nro   r$   r$   r$   r%   rg     s   rg   )0
__future__r   typingr   Ztyping_extensionsr   Zhttpx r   _typesr   r   r	   r
   r   _utilsr   r   _compatr   Z	_resourcer   r   	_responser   r   Z
paginationr   r   Z_base_clientr   r   Ztypes.fine_tuning.checkpointsr   r   Z8types.fine_tuning.checkpoints.permission_create_responser   Z8types.fine_tuning.checkpoints.permission_delete_responser   Z:types.fine_tuning.checkpoints.permission_retrieve_responser   __all__r   r   r   rf   r'   rg   r$   r$   r$   r%   <module>   s0    ) )