1+ import requests
2+ from . import utils
3+ from codat .models import operations
4+ from typing import Optional
5+
6+ class CompanyInfo :
7+ _client : requests .Session
8+ _security_client : requests .Session
9+ _server_url : str
10+ _language : str
11+ _sdk_version : str
12+ _gen_version : str
13+
14+ def __init__ (self , client : requests .Session , security_client : requests .Session , server_url : str , language : str , sdk_version : str , gen_version : str ) -> None :
15+ self ._client = client
16+ self ._security_client = security_client
17+ self ._server_url = server_url
18+ self ._language = language
19+ self ._sdk_version = sdk_version
20+ self ._gen_version = gen_version
21+
22+
23+ def get_commerce_info (self , request : operations .GetCommerceInfoRequest ) -> operations .GetCommerceInfoResponse :
24+ r"""Get company info
25+ Retrieve information about the company, as seen in the commerce platform.
26+
27+ This may include information like addresses, tax registration details and social media or website information.
28+ """
29+
30+ base_url = self ._server_url
31+
32+ url = utils .generate_url (base_url , "/companies/{companyId}/connections/{connectionId}/data/commerce-info" , request .path_params )
33+
34+
35+ client = self ._security_client
36+
37+ r = client .request ("GET" , url )
38+ content_type = r .headers .get ("Content-Type" )
39+
40+ res = operations .GetCommerceInfoResponse (status_code = r .status_code , content_type = content_type )
41+
42+ if r .status_code == 200 :
43+ if utils .match_content_type (content_type , "application/json" ):
44+ out = utils .unmarshal_json (r .text , Optional [operations .GetCommerceInfoSourceModifiedDate ])
45+ res .source_modified_date = out
46+
47+ return res
48+
49+
0 commit comments