
    (ph7                     x   S r SSKJr  SrSSKrSSKrSSKrSSKrSSKrSSK	J
r  SSKJr   SSKJr  Sr\R$                  r\R(                  " 5       r\R,                  " \5      rS	rS
 r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r  " S S\5      r!S r"g! \ a    S	r Nf = f)zModel objects for requests and responses.

Each API may support one or more serializations, such
as JSON, Atom, etc. The model classes are responsible
for converting between the wire format and the Python
object representation.
    )absolute_importz$jcgregorio@google.com (Joe Gregorio)N)version)	HttpError)API_VERSION_METADATA_KEYTFc                      [        S5      e)Nz"You need to override this function)NotImplementedError     H/var/www/html/venv/lib/python3.13/site-packages/googleapiclient/model.py	_abstractr   2   s    
B
CCr
   c                   $    \ rS rSrSrS rS rSrg)Model6   zModel base class.

All Model classes should implement this interface.
The Model serializes and de-serializes between a wire
format such as JSON and a Python object representation.
c                     [        5         g)aD  Updates outgoing requests with a serialized body.

Args:
  headers: dict, request headers
  path_params: dict, parameters that appear in the request path
  query_params: dict, parameters that appear in the query
  body_value: object, the request body as a Python object, which must be
              serializable.
Returns:
  A tuple of (headers, path_params, query, body)

  headers: dict, request headers
  path_params: dict, parameters that appear in the request path
  query: string, query part of the request URI
  body: string, the body serialized in the desired wire format.
Nr   )selfheaderspath_paramsquery_params
body_values        r   requestModel.request>   s	    " 	r
   c                     [        5         g)5  Convert the response wire format into a Python object.

Args:
  resp: httplib2.Response, the HTTP response headers and status
  content: string, the body of the HTTP response

Returns:
  The body de-serialized as a Python object.

Raises:
  googleapiclient.errors.HttpError if a non 2xx response is received.
Nr   r   respcontents      r   responseModel.responseQ   s	     	r
   r	   N)__name__
__module____qualname____firstlineno____doc__r   r   __static_attributes__r	   r
   r   r   r   6   s    &r
   r   c                   V    \ rS rSrSrSrSrSrSrS r	SS jr
S rS rS rS	 rS
 rSrg)	BaseModela   a  Base model class.

Subclasses should provide implementations for the "serialize" and
"deserialize" methods, as well as values for the following class attributes.

Attributes:
  accept: The value to use for the HTTP Accept header.
  content_type: The value to use for the HTTP Content-type header.
  no_content_response: The value to return when deserializing a 204 "No
      Content" response.
  alt_param: The value to supply as the "alt" query parameter for requests.
Nc                 .   [         (       Ga	  [        R                  S5        [        R                  S5        UR                  5        H  u  pV[        R                  SXV5        M     [        R                  S5        [        R                  S5        UR                  5        H  u  pV[        R                  SXV5        M     [        R                  S5        [        R                  SU5        [        R                  SU5        [        R                  S	5        g
g
)z:Logs debugging information about the request if requested.z--request-start--z-headers-start-%s: %sz-headers-end-z-path-parameters-start-z-path-parameters-end-zbody: %sz	query: %sz--request-end--Ndump_request_responseLOGGERinfoitems)r   r   r   querybodyhvs          r   _log_requestBaseModel._log_requestt   s      KK+,KK)*Ha+ (KK(KK12#))+Ha+ ,KK/0KK
D)KKU+KK)* !r
   c                    U R                  U5      nU R                  US'   SUS'   SU;   a  US==   S-  ss'   OSUS'   US==   S-  ss'   SU;   a  US==   S-  ss'   OSUS'   US==   S	[        < S
[        < 3-  ss'   U(       a  [        (       a	  XQ[
        '   OU(       a  [        R                  " S5        Ub   U R                  US'   U R                  U5      nU R                  XXd5        XXd4$ )a  Updates outgoing requests with a serialized body.

Args:
  headers: dict, request headers
  path_params: dict, parameters that appear in the request path
  query_params: dict, parameters that appear in the query
  body_value: object, the request body as a Python object, which must be
      serializable by json.
  api_version: str, The precise API version represented by this request,
      which will result in an API Version header being sent along with the
      HTTP request.
Returns:
  A tuple of (headers, path_params, query, body)

  headers: dict, request headers
  path_params: dict, parameters that appear in the request path
  query: string, query part of the request URI
  body: string, the body serialized as JSON
acceptzgzip, deflatezaccept-encodingz
user-agent  z(gzip)zx-goog-api-clientzgdcl/z gl-python/zThe `api_version` argument is ignored as a newer version of `google-api-core` is required to use this feature.Please upgrade `google-api-core` to 2.19.0 or newer.zcontent-type)_build_queryr7   _LIBRARY_VERSION_PY_VERSIONHAS_API_VERSIONr   warningswarncontent_type	serializer4   )r   r   r   r   r   api_versionr0   s          r   r   BaseModel.request   s   ( !!,/ KK%4!"7"L!S(!$&GL!)')'(C/(+-G'(#$)
 	
$
 ??0;,-MMG !&*&7&7GN#
3J'Be88r
   c                     U R                   b  UR                  SU R                   05        / nUR                  5        H  u  p4[        U5      [        / 5      :X  a.  U H&  nUR	                  S5      nUR                  X545        M(     MK  [        U[        5      (       a+  [        UR                  5      (       a  UR	                  S5      nUR                  X445        M     S[        R                  R                  U5      -   $ )zBuilds a query string.

Args:
  params: dict, the query parameters

Returns:
  The query parameters properly encoded into an HTTP URI query string.
altutf-8?)	alt_paramupdater/   typeencodeappend
isinstancestrcallableurllibparse	urlencode)r   paramsastupleskeyvaluexs         r   r:   BaseModel._build_query   s     >>%MM5$..12 ,,.JCE{d2h&A)AOOSH-  eS))hu||.D.D!LL1E- ) V\\++H555r
   c                    [         (       av  [        R                  S5        UR                  5        H  u  p4[        R                  SX45        M     U(       a  [        R                  U5        [        R                  S5        gg)z;Logs debugging information about the response if requested.z--response-start--r*   z--response-end--Nr+   )r   r   r   r2   r3   s        r   _log_responseBaseModel._log_response   sV      KK,-

Ha+ %G$KK*+ !r
   c                     U R                  X5        UR                  S:  a-  UR                  S:X  a  U R                  $ U R                  U5      $ [        R                  SU-  5        [        X5      e)r   i,     z Content from bad request was: %r)rZ   statusno_content_responsedeserializer-   debugr   r   s      r   r   BaseModel.response   sh     	4) ;;{{c! ///##G,,LL;gEFD**r
   c                     [        5         g)zPerform the actual Python object serialization.

Args:
  body_value: object, the request body as a Python object.

Returns:
  string, the body in serialized form.
Nr   r   r   s     r   rA   BaseModel.serialize   s	     	r
   c                     [        5         g)zPerform the actual deserialization from response string to Python
object.

Args:
  content: string, the body of the HTTP response

Returns:
  The body de-serialized as a Python object.
Nr   r   r   s     r   r`   BaseModel.deserialize   s	     	r
   r	   N)r    r!   r"   r#   r$   r7   r@   r_   rH   r4   r   r:   rZ   r   rA   r`   r%   r	   r
   r   r'   r'   a   sB     FLI+ 29h6.,+4	
r
   r'   c                   J    \ rS rSrSrSrSrSrSS jrS r	S r
\S 5       rS	rg
)	JsonModeli  zModel class for JSON.

Serializes and de-serializes between JSON and the Python
object representation of HTTP request and response bodies.
application/jsonjsonc                     Xl         g)zeConstruct a JsonModel.

Args:
  data_wrapper: boolean, wrap requests and responses in a data wrapper
N_data_wrapper)r   data_wrappers     r   __init__JsonModel.__init__  s
     *r
   c                     [        U[        5      (       a  SU;  a  U R                  (       a  SU0n[        R                  " U5      $ )Ndata)rM   dictrp   rm   dumpsrd   s     r   rA   JsonModel.serialize  s9    z4((j("" *-Jzz*%%r
   c                      UR                  S5      n [        R                  " U5      nU R                  (       a  SU;   a  US   nU$ ! [         a     NAf = f! [        R
                  R                   a    Un U$ f = f)NrF   ru   )decodeAttributeErrorrm   loadsrp   decoderJSONDecodeError)r   r   r1   s      r   r`   JsonModel.deserialize'  s    	nnW-G	$::g&D !!fnF|  		 ||++ 	D 	s"   A A 
AA A<;A<c                     0 $ ri   r	   r   s    r   r_   JsonModel.no_content_response5  s    	r
   ro   N)Fr    r!   r"   r#   r$   r7   r@   rH   rr   rA   r`   propertyr_   r%   r	   r
   r   rk   rk     s;      F%LI*&  r
   rk   c                   :    \ rS rSrSrSrSrSrS r\	S 5       r
Srg)	RawModeli:  zModel class for requests that don't return JSON.

Serializes and de-serializes between JSON and the Python
object representation of HTTP request, and returns the raw bytes
of the response body.
*/*rl   Nc                     U$ ri   r	   rg   s     r   r`   RawModel.deserializeF      r
   c                     gNr9   r	   r   s    r   r_   RawModel.no_content_responseI      r
   r	   r    r!   r"   r#   r$   r7   r@   rH   r`   r   r_   r%   r	   r
   r   r   r   :  s1     F%LI  r
   r   c                   :    \ rS rSrSrSrSrSrS r\	S 5       r
Srg	)

MediaModeliN  zModel class for requests that return Media.

Serializes and de-serializes between JSON and the Python
object representation of HTTP request, and returns the raw bytes
of the response body.
r   rl   mediac                     U$ ri   r	   rg   s     r   r`   MediaModel.deserializeZ  r   r
   c                     gr   r	   r   s    r   r_   MediaModel.no_content_response]  r   r
   r	   Nr   r	   r
   r   r   r   N  s1     F%LI  r
   r   c                   F    \ rS rSrSrSrSrSrS rS r	S r
\S 5       rS	rg
)ProtocolBufferModelib  zModel class for protocol buffers.

Serializes and de-serializes the binary protocol buffer sent in the HTTP
request and response bodies.
zapplication/x-protobufprotoc                     Xl         g)a   Constructs a ProtocolBufferModel.

The serialized protocol buffer returned in an HTTP response will be
de-serialized using the given protocol buffer class.

Args:
  protocol_buffer: The protocol buffer class used to de-serialize a
  response from the API.
N_protocol_buffer)r   protocol_buffers     r   rr   ProtocolBufferModel.__init__m  s
     !0r
   c                 "    UR                  5       $ ri   )SerializeToStringrd   s     r   rA   ProtocolBufferModel.serializey  s    ++--r
   c                 8    U R                   R                  U5      $ ri   )r   
FromStringrg   s     r   r`   ProtocolBufferModel.deserialize|  s    $$//88r
   c                 "    U R                  5       $ ri   r   r   s    r   r_   'ProtocolBufferModel.no_content_response  s    $$&&r
   r   Nr   r	   r
   r   r   r   b  s;     &F+LI
0.9 ' 'r
   r   c                    0 nU R                  5        HR  u  p4UR                  US5      nUc  SX#'   M   XE:w  a-  [        U5      [        0 5      :X  a  [        XE5      X#'   ML  XRU'   MR  MT     U H  nX0;  d  M
  X   X#'   M     U$ )a  Create a patch object.

Some methods support PATCH, an efficient way to send updates to a resource.
This method allows the easy construction of patch bodies by looking at the
differences between a resource before and after it was modified.

Args:
  original: object, the original deserialized resource
  modified: object, the modified deserialized resource
Returns:
  An object that contains only the changes from original to modified, in a
  form suitable to pass to a PATCH method.

Example usage:
  item = service.activities().get(postid=postid, userid=userid).execute()
  original = copy.deepcopy(item)
  item['object']['content'] = 'This is updated.'
  service.activities.patch(postid=postid, userid=userid,
    body=makepatch(original, item)).execute()
N)r/   getrJ   	makepatch)originalmodifiedpatchrU   original_valuemodified_values         r   r   r     s    * E'~~/!c40!EJ-N#tBx/&~F
 ,c
   0 !EJ  Lr
   )#r$   
__future__r   
__author__rm   loggingplatformrP   r>   googleapiclientr   googleapiclient_versiongoogleapiclient.errorsr   google.api_core.version_headerr   r=   ImportError__version__r;   python_versionr<   	getLoggerr    r-   r,   r   objectr   r'   rk   r   r   r   r   r	   r
   r   <module>r      s    '3
      > ,GO +66 %%'			8	$ D(F (Vg gT,	 ,^y ( (') 'D){
  Os   B. .B98B9