o
    i&                     @   s   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
 e
rdd 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dgiZ!G dd deZ"dS )    )StripeService)sanitize_id)Optionalcast)import_module)TYPE_CHECKING)
ListObject)Product)ProductFeatureService)RequestOptions)SearchResultObject)ProductCreateParams)ProductDeleteParams)ProductListParams)ProductRetrieveParams)ProductSearchParams)ProductUpdateParamsfeatureszstripe._product_feature_servicer
   c                	       s  e Zd ZU ded<  fddZdd Z		d.ded	ed
 ded ddfddZ		d.ded	ed
 ded ddfddZ			d.ded	ed ded ddfddZ
		d.ded	ed ded ddfddZ		d.ded	ed ded ddfddZ		d.ded	ed ded ddfddZ		d.d	ed ded ddfdd Z		d.d	ed ded ddfd!d"Z	d/d	d#ded ddfd$d%Z	d/d	d#ded ddfd&d'Z	d/d	d(ded dd)fd*d+Z	d/d	d(ded dd)fd,d-Z  ZS )0ProductServicer
   r   c                    s   t  | d S N)super__init__)self	requestor	__class__ w/var/www/snowflake_co_dev_github/snow_flake_back_end_deploy/env/lib/python3.10/site-packages/stripe/_product_service.pyr      s   zProductService.__init__c                 C   sN   zt | \}}tt||}t| ||| j t| |W S  ty&   t w r   )_subservicesgetattrr   setattr
_requestorKeyErrorAttributeError)r   nameimport_fromserviceservice_classr   r   r   __getattr__!   s   zProductService.__getattr__Nidparamsr   optionsr   returnr	   c              	   C   &   t d| jddjt|dd||dS )
        Delete a product. Deleting a product is only possible if it has no prices associated with it. Additionally, deleting a product with type=good is only possible if it has no SKUs associated with it.
        r	   delete/v1/products/{id}r)   apibase_addressr*   r+   r   _requestformatr   r   r)   r*   r+   r   r   r   r/   1      	zProductService.deletec              	      .   t d| jddjt|dd||dI dH S )r.   r	   r/   r0   r1   r2   r3   Nr   _request_asyncr7   r   r8   r   r   r   delete_asyncE      	
zProductService.delete_asyncr   c              	   C   r-   )
        Retrieves the details of an existing product. Supply the unique product ID from either a product creation request or the product list, and Stripe will return the corresponding product information.
        r	   getr0   r1   r2   r3   r5   r8   r   r   r   retrieveY   r9   zProductService.retrievec              	      r:   )r?   r	   r@   r0   r1   r2   r3   Nr;   r8   r   r   r   retrieve_asyncm   r>   zProductService.retrieve_asyncr   c              	   C   r-   )
        Updates the specific product by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
        r	   postr0   r1   r2   r3   r5   r8   r   r   r   update   r9   zProductService.updatec              	      r:   )rC   r	   rD   r0   r1   r2   r3   Nr;   r8   r   r   r   update_async   r>   zProductService.update_asyncr   ListObject[Product]c              	   C      t d| jddd||dS )
        Returns a list of your products. The products are returned sorted by creation date, with the most recently created products appearing first.
        rG   r@   /v1/productsr2   r3   r   r6   r   r*   r+   r   r   r   list      zProductService.listc              	      "   t d| jddd||dI dH S )rI   rG   r@   rJ   r2   r3   Nr   r<   rL   r   r   r   
list_async      
zProductService.list_asyncr   c              	   C   rH   )/
        Creates a new product object.
        r	   rD   rJ   r2   r3   rK   rL   r   r   r   create   rN   zProductService.createc              	      rO   )rS   r	   rD   rJ   r2   r3   NrP   rL   r   r   r   create_async   rR   zProductService.create_asyncr   SearchResultObject[Product]c              	   C   rH   )  
        Search for products you've previously created using Stripe's [Search Query Language](https://docs.stripe.com/docs/search#search-query-language).
        Don't use search in read-after-write flows where strict consistency is necessary. Under normal operating
        conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up
        to an hour behind during outages. Search functionality is not available to merchants in India.
        rV   r@   /v1/products/searchr2   r3   rK   rL   r   r   r   search   s   zProductService.searchc              	      rO   )rW   rV   r@   rX   r2   r3   NrP   rL   r   r   r   search_async  s   
zProductService.search_async)NNr   )__name__
__module____qualname____annotations__r   r(   strr   r/   r=   rA   rB   rE   rF   rM   rQ   rT   rU   rY   rZ   __classcell__r   r   r   r   r      s   
 










r   N)#stripe._stripe_servicer   stripe._utilr   typingr   r   	importlibr   typing_extensionsr   stripe._list_objectr   stripe._productr	   stripe._product_feature_servicer
   stripe._request_optionsr   stripe._search_result_objectr   $stripe.params._product_create_paramsr   $stripe.params._product_delete_paramsr   "stripe.params._product_list_paramsr   &stripe.params._product_retrieve_paramsr   $stripe.params._product_search_paramsr   $stripe.params._product_update_paramsr   r   r   r   r   r   r   <module>   s(   